busybits 2.5.0 → 2.6.1

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.
Files changed (29) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/dist/build.json +2 -2
  4. package/dist/cli/busybits.js +6 -0
  5. package/dist/client/bundle/{app-Cn3BvqjA.css → app-BODKiLC2.css} +1 -1
  6. package/dist/client/bundle/app-D5bRv3Io.js +24 -0
  7. package/dist/client/bundle/{city-S-WD2HZe.js → city-1iWQHg0m.js} +1 -1
  8. package/dist/client/bundle/{daystats-BaQmwDUl.js → daystats-8-rKd2hK.js} +1 -1
  9. package/dist/client/bundle/{dom-z_NH7Uh7.js → dom-BZgsJMv9.js} +1 -1
  10. package/dist/client/bundle/{en-DK_q-bO7.js → en-ChmFNZf9.js} +1 -1
  11. package/dist/client/bundle/{es-CUFTupoF.js → es-Dxz3P98Y.js} +1 -1
  12. package/dist/client/bundle/{format-BrkFnmVF.js → format-DrvIRA6J.js} +1 -1
  13. package/dist/client/bundle/{fr-CY87v2sh.js → fr-CINcBINu.js} +1 -1
  14. package/dist/client/bundle/{main-DNVSCypp.js → main-CJZNyhMz.js} +2 -2
  15. package/dist/client/bundle/{ptypane-DAVYBQ48.js → ptypane-B_D8yEvn.js} +1 -1
  16. package/dist/client/bundle/{room-name-Cg36nI5X.js → room-name-CSxOS6Qg.js} +1 -1
  17. package/dist/client/bundle/{simulator-CDeHv4xc.js → simulator-DSTKHVKF.js} +1 -1
  18. package/dist/client/bundle/world-model-DIM3eqSC.js +1 -0
  19. package/dist/client/bundle/world-stream-D8eI5CKj.js +1 -0
  20. package/dist/client/index.html +1 -1
  21. package/dist/server/index.js +37 -13
  22. package/mod/habblaud/.claude-plugin/plugin.json +1 -1
  23. package/mod/habblaud-mensagens/.claude-plugin/plugin.json +1 -1
  24. package/mod/habblaud-permissoes/.claude-plugin/plugin.json +1 -1
  25. package/mod/habblaud-pi/package.json +1 -1
  26. package/package.json +2 -1
  27. package/dist/client/bundle/app-QVC1DacC.js +0 -24
  28. package/dist/client/bundle/world-model-CPBvh77_.js +0 -1
  29. package/dist/client/bundle/world-stream-FBFp8Oax.js +0 -1
@@ -0,0 +1 @@
1
+ import{s as e}from"./main-CJZNyhMz.js";import{l as t,n}from"./simulator-DSTKHVKF.js";import{c as r,g as i}from"./format-DrvIRA6J.js";var a=e=>new TextEncoder().encode(e).length;function o(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}var s=e=>typeof e==`object`&&!!e&&!Array.isArray(e),c=e=>typeof e==`number`&&Number.isFinite(e);function l(e){if(s(e)){if(e.kind===`agent`&&typeof e.agentId==`string`&&e.agentId)return{kind:`agent`,agentId:e.agentId};if(e.kind===`script`&&(e.name===void 0||typeof e.name==`string`))return{kind:`script`,...typeof e.name==`string`?{name:e.name}:{}}}}function u(e){if(!s(e))return;let t=l(e.from);if(typeof e.id!=`string`||!e.id||typeof e.title!=`string`||!e.title||!t||e.status!==`open`&&e.status!==`resolved`||!c(e.createdAt)||!c(e.updatedAt))return;let n={id:e.id,title:e.title.slice(0,200),from:t,scope:`local`,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt};return typeof e.key==`string`&&e.key&&(n.key=e.key.slice(0,128)),typeof e.body==`string`&&a(e.body)<=8192&&(n.body=e.body),typeof e.link==`string`&&e.link.length<=2048&&o(e.link)&&(n.link=e.link),c(e.resolvedAt)&&(n.resolvedAt=e.resolvedAt),typeof e.machine==`string`&&e.machine&&(n.machine=e.machine),n}var d=32768;function f(e){let t=e.toBase64;if(typeof t==`function`)return t.call(e);let n=[];for(let t=0;t<e.length;t+=d)n.push(String.fromCharCode.apply(null,e.subarray(t,t+d)));return btoa(n.join(``))}async function p(t){try{return f(new Uint8Array(await t.arrayBuffer()))}catch{throw Error(e(`não deu para ler o arquivo`))}}function m(e=import.meta.url){try{return/\/bundle\/(main-[\w-]+)\.js$/.exec(new URL(e).pathname)?.[1]}catch{return}}function h(e){return e.behavior}var ee=2,te=2e3,g=3e4;function _(e){return Math.min(g,te*2**Math.max(0,e))}function ne(e){let t=new URLSearchParams(e),n=e=>{let n=t.get(e);if(n===null||n.trim()===``)return null;let r=Number(n);return Number.isFinite(r)?r:null},r=n(`speed`),i=n(`sessions`),a=n(`seed`);return{speed:r!==null&&r>0?Math.min(r,50):1,sessions:i!==null&&i>=0?Math.min(Math.floor(i),40):4,...a!==null&&a>=0?{seed:Math.floor(a)}:{},...t.get(`noquota`)===`1`?{codexNoQuota:!0}:{}}}var re=[{name:`compact`,description:e(`Resume a conversa para liberar contexto`),source:`builtin`},{name:`context`,description:e(`Mostra o uso do contexto`),source:`builtin`},{name:`review`,description:e(`Revisa um pull request`),source:`plugin`,plugin:`code-review`}],ie=class{snapshot=null;feed=[];connection=`connecting`;mock;inboxFrame={items:[]};listeners=new Map;agentIndex=new Map;roomIndex=new Map;source=null;mockTimer=null;search;openStream;attempts=0;retryTimer=null;retryAt=null;stopped=!0;onOnline=()=>{!this.stopped&&this.connection===`closed`&&this.reconnectNow()};replay=!1;live=null;constructor(e={}){this.mock=!!e.mock,this.search=e.search??(typeof location<`u`?location.search:``),this.openStream=e.eventSource??(e=>new EventSource(e))}on(e,t){let n=this.listeners.get(e);return n||this.listeners.set(e,n=new Set),n.add(t),()=>void n.delete(t)}connect(){if(this.stopped){if(this.stopped=!1,this.mock)return this.startMock();this.startSSE()}}disconnect(){this.stopped=!0,typeof removeEventListener==`function`&&removeEventListener(`online`,this.onOnline),this.clearRetry(),this.closeSource(),this.mockTimer&&clearInterval(this.mockTimer),this.mockTimer=null}reconnectNow(){this.mock||(this.clearRetry(),this.closeSource(),this.stopped=!1,this.startSSE())}get nextRetryAt(){return this.retryAt}agent(e){return this.agentIndex.get(e)}room(e){return this.roomIndex.get(e)}agentsInRoom(e){return(this.snapshot?.agents??[]).filter(t=>t.roomId===e)}async agentHistory(e){if(this.mock||this.replay)return this.agent(e)?.recent??[];let t=await fetch(`/api/agents/${encodeURIComponent(e)}`);return t.ok?(await t.json()).history:this.agent(e)?.recent??[]}async setDemo(e){return this.mock?!0:(await fetch(`/api/demo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})})).ok}async checkUpdates(){return!this.mock&&(await fetch(`/api/updates/check`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`})).ok}async applyUpdate(){if(this.mock)return{ok:!1};let e=await fetch(`/api/updates/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(e.ok)return{ok:!0};let t=await e.json().catch(()=>({}));return t.error?{ok:!1,error:t.error}:{ok:!1}}get replaying(){return this.replay}get liveSnapshot(){return this.replay?this.live?.snap??null:this.snapshot}pushReplay(e){this.replay||(this.replay=!0,this.live=this.snapshot?{snap:this.snapshot,at:Date.now()}:null),this.setSnapshot(e)}stopReplay(){if(!this.replay)return;this.replay=!1;let e=this.live;this.live=null,e?this.setSnapshot({...e.snap,serverTime:e.snap.serverTime+(Date.now()-e.at)}):(this.snapshot=null,this.agentIndex=new Map,this.roomIndex=new Map)}async permissionDetail(e,t){let n=this.agent(e)?.permission;if(n?.id===t&&n.input!==void 0)return n;if(this.mock)return n?.id===t?n:void 0;let r=await fetch(`/api/permissions/${encodeURIComponent(t)}`);if(r.ok)return await r.json()}async decidePermission(t,n){let r=this.snapshot?.agents.find(e=>e.permission?.id===t)?.id,i=()=>{r&&this.emit(`decided`,{agentId:r,verdict:h(n)})};if(this.mock){let r=this.mockSim;if(!r?.decidePermission(t,n))return e(`Este pedido já foi respondido.`);this.applySnapshot(r.snapshot()),i();return}let a=await fetch(`/api/permissions/${encodeURIComponent(t)}/decision`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)});if(a.ok){i();return}try{let e=await a.json();if(typeof e.error==`string`)return e.error}catch{}return e(`Não foi possível responder (erro {0}).`,[a.status])}async saveCharacter(e,t){return this.characterRequest(e,`PUT`,t)}async resetCharacter(e){return this.characterRequest(e,`DELETE`,{})}async characterRequest(t,n,r){return this.mock||this.replay?e(`Editar o personagem só funciona com o escritório ao vivo.`):this.writeRequest(`/api/agents/${encodeURIComponent(t)}/character`,n,r,t=>e(`Não foi possível salvar o personagem (erro {0}).`,[t]))}async writeRequest(t,n,r,i){let a;try{a=await fetch(t,{method:n,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})}catch{return e(`Sem conexão com o Habblaud.`)}if(!a.ok){try{let e=await a.json();if(typeof e.error==`string`)return e.error}catch{}return i(a.status)}}async loadAvatar(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/avatar`);return e.ok?await e.json():null}catch{return null}}async saveAvatar(e){return this.avatarRequest(`PUT`,e)}async resetAvatar(){return this.avatarRequest(`DELETE`,{})}async avatarRequest(t,n){return this.mock||this.replay?e(`Editar o personagem só funciona com o escritório ao vivo.`):this.writeRequest(`/api/avatar`,t,n,t=>e(`Não foi possível salvar o avatar (erro {0}).`,[t]))}get inboxItems(){return this.inboxFrame.items}async resolveInbox(t){return this.mock||this.replay?e(`A mesa só funciona com o escritório ao vivo.`):this.writeRequest(`/api/inbox/${encodeURIComponent(t)}/resolve`,`POST`,{},t=>e(`Não foi possível resolver o item (erro {0}).`,[t]))}applyInbox(e){if(!e||!Array.isArray(e.items))return;let t=e.items.map(u).filter(e=>!!e),n=e.arrived?u(e.arrived):void 0;this.inboxFrame={items:t},this.emit(`inbox`,n?{items:t,arrived:n}:{items:t})}get defaultLook(){return(this.liveSnapshot??this.snapshot)?.defaultLook??{parts:{},since:0}}async loadDefaultLook(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/settings/default-look`);return e.ok?await e.json():null}catch{return null}}async saveDefaultLook(t){return this.mock||this.replay?e(`Editar o personagem só funciona com o escritório ao vivo.`):this.writeRequest(`/api/settings/default-look`,`PUT`,t,t=>e(`Não foi possível salvar o estilo padrão (erro {0}).`,[t]))}async resetDefaultLook(){return this.mock||this.replay?e(`Editar o personagem só funciona com o escritório ao vivo.`):this.writeRequest(`/api/settings/default-look`,`DELETE`,{},t=>e(`Não foi possível salvar o estilo padrão (erro {0}).`,[t]))}async loadAttachmentSettings(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/settings/attachments`);if(!e.ok)return null;let t=(await e.json()).retentionDays;return t===null||typeof t==`number`?{retentionDays:t}:null}catch{return null}}async saveAttachmentSettings(t){return this.mock||this.replay?e(`Editar a limpeza dos anexos só funciona com o escritório ao vivo.`):this.writeRequest(`/api/settings/attachments`,`PUT`,t,t=>e(`Não foi possível salvar a limpeza dos anexos (erro {0}).`,[t]))}async loadMachines(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/central/machines`,{cache:`no-store`});if(!e.ok)return null;let t=(await e.json()).machines;return Array.isArray(t)?t:null}catch{return null}}async createPairing(){if(this.mock||this.replay)return{error:e(`Parear máquinas só funciona com o escritório ao vivo.`)};let t;try{t=await fetch(`/api/central/pairing`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`,cache:`no-store`})}catch{return{error:e(`Sem conexão com o Habblaud.`)}}try{let e=await t.json();if(t.ok&&typeof e.pairing==`string`&&typeof e.code==`string`&&typeof e.expiresAt==`number`&&typeof e.fingerprint==`string`)return{pairing:e.pairing,code:e.code,expiresAt:e.expiresAt,fingerprint:e.fingerprint};if(typeof e.error==`string`)return{error:e.error}}catch{}return{error:e(`Não foi possível gerar o código (erro {0}).`,[t.status])}}async revokeMachine(t){return this.mock||this.replay?e(`Revogar máquinas só funciona com o escritório ao vivo.`):this.writeRequest(`/api/central/machines/${encodeURIComponent(t)}/revoke`,`POST`,{},t=>e(`Não foi possível revogar a máquina (erro {0}).`,[t]))}async loadSatelliteLink(){if(this.mock||this.replay)return null;try{let e=await fetch(`/api/satellite/status`,{cache:`no-store`});if(!e.ok)return null;let t=await e.json();return(t.status===`up`||t.status===`down`||t.status===`revoked`||t.status===`unpaired`)&&typeof t.url==`string`&&typeof t.label==`string`?{status:t.status,url:t.url,label:t.label}:null}catch{return null}}async sendMessage(t,n,r=[]){if(this.mock){let e=this.mockSend(t,n);return`message`in e&&this.emit(`sent`,{agentId:t}),e}let i=r.length?{agentId:t,text:n,attachments:r}:{agentId:t,text:n},a=await fetch(`/api/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),o;try{o=await a.json()}catch{}if(a.status===201&&o&&typeof o==`object`)return this.emit(`sent`,{agentId:t}),{message:o};let s=o?.error,c=typeof s==`string`?s:e(`erro {0}`,[a.status]);if(r.length>0&&a.status===410){let e=o?.expired,t=Array.isArray(e)?e.filter(e=>typeof e==`string`):[];return{error:c,expired:t.length?t:r}}return r.length>0&&a.status===500?{error:c,expired:r}:{error:c}}async uploadMessageImage(t){if(this.mock)return{error:e(`imagens só funcionam com o escritório ao vivo`)};let n=await p(t),r=await fetch(`/api/messages/attachments`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:t.name,type:t.type,data:n})}),i;try{i=await r.json()}catch{}let a=i;return r.ok&&typeof a?.id==`string`?{id:a.id}:{error:typeof a?.error==`string`?a.error:e(`erro {0}`,[r.status])}}async dropMessageImage(e){if(!this.mock)try{await fetch(`/api/messages/attachments/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:`{}`})}catch{}}async messageStatus(t){if(this.mock){let e=this.mockOutbox.get(t);return e?{...e}:null}let n=await fetch(`/api/messages/${encodeURIComponent(t)}`);if(n.status===404)return null;if(!n.ok)throw Error(e(`erro {0}`,[n.status]));return await n.json()}async slashCommands(e){if(this.mock)return re.map(e=>({...e}));try{let t=await fetch(`/api/messages/commands/${encodeURIComponent(e)}`);if(!t.ok)return[];let n=await t.json();return Array.isArray(n.commands)?n.commands:[]}catch{return[]}}mockOutbox=new Map;mockSeq=0;mockSend(t,n){let r=this.agent(t);if(!r)return{error:e(`agente desconhecido: ele já saiu do escritório?`)};if(!r.canMessage||r.kind!==`main`||r.status===`offline`)return{error:e(`este agente não recebe mensagens agora`)};let i=Date.now(),a={id:`mock-${i.toString(36)}-${++this.mockSeq}`,agentId:t,status:`queued`,createdAt:i,updatedAt:i};return this.mockOutbox.set(a.id,a),setTimeout(()=>{let r=this.mockSim,i=!!r?.receiveMessage(t,n);Object.assign(a,{status:i?`delivered`:`failed`,updatedAt:Date.now()},i?{}:{error:e(`o agente saiu do escritório`)}),i&&r&&this.applySnapshot(r.snapshot())},1e3),{message:{...a}}}emit(e,t){this.listeners.get(e)?.forEach(n=>{try{n(t)}catch(t){console.error(`[store] listener de "${e}" falhou`,t)}})}setConnection(e){this.connection!==e&&(this.connection=e,this.emit(`connection`,e))}applySnapshot(e){let t=this.replay?this.live?.snap:this.snapshot;t&&e.rev<t.rev&&e.meta.startedAt===t.meta.startedAt||(this.replay?this.live={snap:e,at:Date.now()}:this.setSnapshot(e),this.checkBuild(e.meta.build))}setSnapshot(e){this.snapshot=e,this.agentIndex=new Map(e.agents.map(e=>[e.id,e])),this.roomIndex=new Map(e.rooms.map(e=>[e.id,e])),this.emit(`snapshot`,e),this.emit(`defaultLook`,e.defaultLook??{parts:{},since:0})}updateAnnounced=!1;pageBuildId=m();checkBuild(e){if(this.updateAnnounced||this.mock||!e)return;let t=this.pageBuildId;t&&t!==e&&(this.updateAnnounced=!0,this.emit(`update`,{build:e,current:t}))}applyFeed(e){if(!e.length)return;let t=new Set(this.feed.map(e=>e.id)),n=e.filter(e=>!t.has(e.id));n.length&&(this.feed=[...this.feed,...n].slice(-200),this.emit(`feed`,n))}parse(e,t){try{return JSON.parse(e.data)}catch(e){return console.warn(`[store] ${t} inválido ignorado`,e),null}}startSSE(){typeof addEventListener==`function`&&addEventListener(`online`,this.onOnline),this.setConnection(`connecting`);let e;try{e=this.openStream(`/api/stream`)}catch(e){console.error(`[store] não foi possível abrir o stream`,e),this.setConnection(`closed`),this.scheduleRetry();return}this.source=e;let t=()=>this.source===e;e.addEventListener(`open`,()=>{t()&&(this.attempts=0,this.clearRetry(),this.setConnection(`open`))}),e.addEventListener(`error`,()=>{t()&&(e.readyState===ee?(this.setConnection(`closed`),this.scheduleRetry()):this.setConnection(`connecting`))}),e.addEventListener(`snapshot`,e=>{if(!t())return;let n=this.parse(e,`snapshot`);n&&this.applySnapshot(n)}),e.addEventListener(`feed`,e=>{if(!t())return;let n=this.parse(e,`feed`);n&&this.applyFeed(n)}),e.addEventListener(`notice`,e=>{if(!t())return;let n=this.parse(e,`aviso`);n&&this.emit(`notice`,n)}),e.addEventListener(`attention`,e=>{if(!t())return;let n=this.parse(e,`attention`);n&&this.emit(`attention`,n)}),e.addEventListener(`presence`,e=>{if(!t())return;let n=this.parse(e,`presence`);n&&this.emit(`presence`,n)}),e.addEventListener(`avatar`,e=>{if(!t())return;let n=this.parse(e,`avatar`);n&&this.emit(`avatar`,n)}),e.addEventListener(`inbox`,e=>{if(!t())return;let n=this.parse(e,`inbox`);n&&this.applyInbox(n)}),e.addEventListener(`defaultLook`,e=>{if(!t())return;let n=this.parse(e,`defaultLook`);n&&this.emit(`defaultLook`,n)})}closeSource(){this.source?.close(),this.source=null}scheduleRetry(){if(this.retryTimer||this.mock||this.stopped)return;let e=_(this.attempts);this.attempts++,this.retryAt=Date.now()+e,this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.retryAt=null,!this.stopped&&this.connection===`closed`&&(this.closeSource(),this.startSSE())},e)}clearRetry(){this.retryTimer&&clearTimeout(this.retryTimer),this.retryTimer=null,this.retryAt=null}mockSim=null;startMock(){if(this.mockTimer)return;this.setConnection(`mock`);let e=new n({...ne(this.search),crowd:!0});this.mockSim=e,this.applySnapshot(e.snapshot()),this.mockTimer=setInterval(()=>{let t=Date.now(),n=e.tick(t);n.changed&&this.applySnapshot(e.snapshot(t)),this.applyFeed(n.feed),n.notices.forEach(e=>this.emit(`notice`,e))},250)}},v=[`short`,`buzz`,`spiky`,`side_part`,`curly`,`afro`,`bob`,`long`,`ponytail`,`bun`,`pigtails`,`mohawk`,`bald`,`wavy`],y=[`tshirt`,`hoodie`,`shirt_tie`,`sweater`,`jacket`,`blouse`,`polo`,`hoodie_up`],b=[`none`,`glasses`,`sunglasses`,`headphones`,`cap`,`beanie`,`earrings`,`bow`,`gamer_headphones`],x=[`none`,`led_mask`,`bandana`,`respirator`,`visor`,`ar_monocle`,`smile_mask`],ae=[`none`,`stubble`,`beard`,`mustache`,`goatee`],oe=[`pants`,`shorts`,`skirt`],S=[`skin`,`hair`,`hairStyle`,`eyes`,`top`,`topAccent`,`topStyle`,`bottom`,`bottomStyle`,`shoes`,`accessory`,`accessoryColor`,`facialHair`],se=[`face`,`faceColor`],C=[...S,...se],ce={hoodie_up:`hoodie`,gamer_headphones:`headphones`};function w(e){return ce[e]??e}var le={hairStyle:v,topStyle:y,bottomStyle:oe,accessory:b,facialHair:ae,face:x},ue=/^#[0-9a-f]{6}$/i,de=/[\p{Cc}\u2028\u2029\u200e\u200f\u202a-\u202e\u2066-\u2069]/u,fe=Object.keys(ce);function pe(e,t,n){if(!e||typeof e!=`object`||Array.isArray(e))return null;let r=e;for(let e of Object.keys(r))if(!t.includes(e))return null;let i={};for(let e of t){let t=r[e];if(t===void 0)continue;if(typeof t!=`string`)return null;let a=n(e);if(a?!a.includes(t):!ue.test(t))return null;i[e]=a?t:t.toLowerCase()}return i}function me(e){return pe(e,S,e=>le[e]?.filter(e=>!fe.includes(e)))}function he(e){if(typeof e!=`string`)return null;let t=e.normalize(`NFC`).replace(/\s+/g,` `).trim();return!t||de.test(t)||[...t].length>24?null:t}function ge(e){if(!e)return``;let t=S.map(t=>e[t]??``).join(`,`);return e.face===void 0&&e.faceColor===void 0?t:`${t},${e.face??``},${e.faceColor??``}`}function _e(e,t){return e.custom||!t||typeof t.since!=`number`?!1:e.startedAt>=t.since}function ve(e,t){if(typeof e.startedAt!=`number`||!t||!_e({custom:e.custom,startedAt:e.startedAt},t))return e.parts;let n={};for(let r of C){let i=e.parts?.[r]??t.parts?.[r];i!==void 0&&(n[r]=i)}return Object.keys(n).length?n:void 0}var ye=[`#ffe2cc`,`#f6cfb0`,`#eab894`,`#d69f78`,`#bd8560`,`#9a6444`,`#7a4a31`,`#5a3623`],be=[[`#2b2530`,5],[`#3f2c22`,5],[`#5f3c28`,4],[`#87593a`,2.5],[`#b0703c`,1.2],[`#8e3b2b`,1],[`#d6ae68`,1.8],[`#ebdcb0`,.7],[`#8f929b`,.7],[`#d9dbe0`,.5]],xe=[`#e47aa8`,`#5b8fe0`,`#8f6ad8`,`#3fb3a0`,`#e0584e`,`#7cc45a`,`#f0a24a`],Se=[`#2b2236`,`#2b2236`,`#4a2f22`,`#5a3b22`,`#2f5f9e`,`#3c7a52`],T=[`#e2604f`,`#4a86d8`,`#4bab72`,`#efb54a`,`#8d66cf`,`#36b0b0`,`#e47aa8`,`#3d4352`,`#f1efe9`,`#8a96a3`,`#2f4c7d`,`#c9713f`,`#76913f`,`#e3d3b2`,`#f29b72`,`#5bc0de`,`#b04a5a`,`#f2d16b`],Ce=[`#f4f4f0`,`#d3e3f4`,`#f3d6de`,`#dfe3e8`,`#e9f1dc`,`#fbf0d6`],we=[`#c0392b`,`#2f4c7d`,`#7b2d44`,`#2e7d4f`,`#d9a42e`,`#5b3a8c`,`#3d4352`],Te=[`#2f3b55`,`#3d4352`,`#6b4a35`,`#55613b`,`#262a33`,`#b08a5e`,`#7a2f3a`,`#4a6a8a`],E=[`#f4f4f0`,`#e8e3d6`,`#dfe7ef`,`#f6e7c8`,`#c9ced6`],Ee=[[`#3f5f8c`,5],[`#2e3e5e`,4],[`#2c2c35`,4],[`#b49c72`,2],[`#6d7480`,2],[`#6e4c38`,1.5],[`#5f6845`,1.2],[`#2c3655`,2],[`#7f9cc4`,1.5],[`#e2ded5`,.5],[`#9b3b3b`,.4]],De=[[`#2b2b33`,5],[`#6b4630`,3],[`#ececec`,3],[`#d04848`,1],[`#3f63a8`,1],[`#b88752`,1.5],[`#7d8592`,1]],D={none:[`#2b2b33`],glasses:[`#2b2b33`,`#5a3a28`,`#3f63a8`,`#b03a3a`,`#8a8f99`],sunglasses:[`#22232b`],headphones:[`#2b2b33`,`#f1efe9`,`#e2604f`,`#4a86d8`,`#efb54a`,`#36b0b0`],cap:[`#e2604f`,`#4a86d8`,`#2b2b33`,`#4bab72`,`#efb54a`,`#f1efe9`,`#2f4c7d`],beanie:[`#e2604f`,`#efb54a`,`#4bab72`,`#8d66cf`,`#3d4352`,`#36b0b0`],earrings:[`#f2c14e`,`#d9dde3`],bow:[`#e2604f`,`#e47aa8`,`#efb54a`,`#4a86d8`,`#8d66cf`],gamer_headphones:[`#2b2b33`,`#f1efe9`,`#8d66cf`,`#e2604f`,`#4a86d8`]},O=[`#f2b33d`,`#e2604f`,`#4a86d8`,`#4bab72`,`#8d66cf`,`#36b0b0`],Oe={m:{short:16,buzz:9,spiky:9,side_part:12,curly:9,afro:6,bob:2,long:4,ponytail:3,bun:4,pigtails:.4,mohawk:4,bald:5,wavy:9},f:{short:4,buzz:1.2,spiky:2,side_part:4,curly:9,afro:7,bob:13,long:16,ponytail:13,bun:10,pigtails:6,mohawk:1,bald:.4,wavy:13}},ke={m:{tshirt:20,hoodie:16,shirt_tie:10,sweater:13,jacket:13,blouse:2,hoodie_up:0,polo:14},f:{tshirt:17,hoodie:14,shirt_tie:5,sweater:14,jacket:12,blouse:20,hoodie_up:0,polo:8}},Ae={m:{none:40,glasses:18,sunglasses:4,headphones:13,cap:7,beanie:6,earrings:2,gamer_headphones:0,bow:.3},f:{none:36,glasses:16,sunglasses:4,headphones:11,cap:4,beanie:5,earrings:13,gamer_headphones:0,bow:7}},je={none:62,stubble:12,beard:13,mustache:7,goatee:6},Me={m:{pants:88,shorts:12,skirt:0},f:{pants:62,shorts:10,skirt:28}};function Ne(e){let t=(e^2654435769)>>>0;return t=Math.imul(t^t>>>16,2246822507),t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}function k(e,n={}){let r=t(Ne(e)),i=e=>e[Math.floor(r()*e.length)%e.length],a=e=>{let t=Object.entries(e),n=t.reduce((e,[,t])=>e+t,0),i=r()*n;for(let[e,n]of t)if(i-=n,i<0)return e;return t[t.length-1][0]},o=e=>a(Object.fromEntries(e)),s=r(),c=n.look??(s<.5?`f`:`m`),l=i(ye),u=r()<.08?i(xe):o(be),d=a(Oe[c]),f=i(Se),p=a(ke[c]),m,h;switch(p){case`shirt_tie`:m=i(Ce),h=i(we);break;case`jacket`:m=i(Te),h=r()<.7?i(E):i(T);break;case`hoodie`:case`polo`:m=i(T),h=r()<.6?i(E):i(T);break;default:m=i(T),h=i(T)}h===m&&(h=i(E));let ee=o(Ee),te=o(De),g=a(Ae[c]);(g===`cap`||g===`beanie`)&&(d===`afro`||d===`bun`||d===`mohawk`||d===`pigtails`)&&(g=`glasses`),g===`bow`&&(d===`bald`||d===`buzz`)&&(g=`earrings`);let _=i(D[g]),ne=r(),re=a(je),ie=c===`m`?re:`none`,v=a(Me[c]);c===`f`&&d===`bald`&&(d=`buzz`);let y={skin:l,hair:u,hairStyle:d,eyes:f,top:m,topAccent:h,topStyle:p,bottom:ee,shoes:te,accessory:g,accessoryColor:_,lanyard:n.sub?O[Math.floor(ne*O.length)%O.length]:null,look:c,facialHair:ie,bottomStyle:v},b=n.parts;if(!b)return y;let x=Object.fromEntries(C.filter(e=>b[e]!==void 0).map(e=>[e,b[e]]));return{...y,...x}}function Pe(e,t,n){let r=k(e,{look:n,parts:t}),i={};for(let e of S){let t=r[e];t!==void 0&&(i[e]=w(t))}return i}function Fe(e){return[e.skin,e.hair,e.hairStyle,e.eyes,e.top,e.topAccent,e.topStyle,e.bottom,e.shoes,e.accessory,e.accessoryColor,e.lanyard??`-`,e.look,e.facialHair??`-`,e.bottomStyle??`-`].join(`|`)+(e.face&&e.face!==`none`?`|${e.face}|${e.faceColor??``}`:``)}var Ie=e=>[...new Set(e)],A=e=>e.map(([e])=>e),Le={none:[`#2b2b33`],led_mask:[`#2b2f3a`,`#f1efe9`,`#e2604f`,`#4a86d8`,`#8d66cf`],bandana:[`#2b2b33`,`#c0392b`,`#2f4c7d`,`#2e7d4f`,`#efb54a`,`#8d66cf`,`#f1efe9`],respirator:[`#3d4352`,`#2b2b33`,`#55613b`,`#8a96a3`,`#7a2f3a`],visor:[`#39f0ff`,`#ff3df0`,`#7dff4a`,`#ffe03a`,`#ff5a4a`],ar_monocle:[`#39f0ff`,`#ff3df0`,`#7dff4a`,`#ffe03a`,`#ff5a4a`],smile_mask:[`#f4f2ee`,`#e9e1d0`,`#bfe3f5`,`#f2c7d6`]},Re=Ie([...E,...T]);function ze(e){switch(e){case`shirt_tie`:return{top:Ce,topAccent:we};case`jacket`:return{top:Te,topAccent:Re};default:return{top:T,topAccent:Re}}}function Be(e){let t=ze(e.topStyle);return{skin:ye,hair:[...A(be),...xe],hairStyle:v,eyes:Ie(Se),top:t.top,topAccent:t.topAccent,topStyle:y,bottom:A(Ee),bottomStyle:oe,shoes:A(De),accessory:b,accessoryColor:D[e.accessory],facialHair:ae,face:x,faceColor:Le[e.face??`none`]}}var j=[`afro`,`bun`,`mohawk`,`pigtails`],Ve=[`led_mask`,`visor`,`ar_monocle`,`smile_mask`],He=[`glasses`,`sunglasses`],Ue=[`cap`,`beanie`,`bow`],We=[`bald`,`buzz`];function Ge(t,n,r){if(n===`accessory`){if((r===`cap`||r===`beanie`)&&j.includes(t.hairStyle)||r===`bow`&&We.includes(t.hairStyle))return e(`Não combina com este cabelo`);if(Ue.includes(r)&&t.topStyle===`hoodie_up`)return e(`Não combina com o capuz`);if(He.includes(r)&&t.face&&Ve.includes(t.face))return e(`Não combina com a máscara`)}if(n===`topStyle`&&r===`hoodie_up`){if(t.accessory===`cap`||t.accessory===`beanie`)return e(`Não combina com o boné ou o gorro`);if(t.accessory===`bow`)return e(`Não combina com o laço`);if(j.includes(t.hairStyle))return e(`Não combina com este cabelo`)}if(n===`face`&&Ve.includes(r)&&He.includes(t.accessory))return e(`Não combina com os óculos`);if(n===`hairStyle`){if((t.accessory===`cap`||t.accessory===`beanie`)&&j.includes(r))return e(`Não combina com o boné ou o gorro`);if(t.accessory===`bow`&&We.includes(r))return e(`Não combina com o laço`);if(t.topStyle===`hoodie_up`&&j.includes(r))return e(`Não combina com o capuz`)}}function Ke(e){let t=Be(e),n=(e,t)=>t.includes(e)?e:t[0],r={...e,top:n(e.top,t.top),topAccent:n(e.topAccent,t.topAccent),accessoryColor:n(e.accessoryColor,t.accessoryColor)};return e.face&&e.face!==`none`&&(r.faceColor=n(e.faceColor??``,t.faceColor)),r}function qe(e,t){if(e&&e!==`auto`)return e;let n=t.getMonth();return n===9?`halloween`:n===10||n===11&&t.getDate()<=26?`christmas`:`none`}var Je={showNames:!0,bubbles:`important`,liveliness:`normal`,followSelected:!1,dayNight:!0,theme:`auto`},Ye=[`competicao`,`apostas`,`games`,`series`,`fofoca`,`vaidade`,`cafeina`,`piadas`,`esporte`,`timidez`,`economia`,`sonecas`,`calma`,`leitura`],Xe=[[`timidez`,`piadas`],[`timidez`,`fofoca`],[`apostas`,`economia`],[`esporte`,`sonecas`],[`calma`,`competicao`]],M={min:2,max:3},Ze=[`night_owl`,`early_bird`,`coffee`,`tea`,`tabs`,`spaces`,`dark_mode`,`light_mode`,`vim`,`tests_first`,`ship_fast`,`refactor`,`pixel_art`,`music`,`silence`,`cats`,`dogs`,`open_source`,`learning`,`hello`],Qe=[`hello`,`nice_building`,`coffee`,`congrats`,`nice_to_meet`,`bye`,`thanks`,`good_luck`,`wave`,`clap`],$e=[`offensive_name`,`impersonation`,`harassment`,`greeting_spam`,`fake_building`,`other`],et=[`visited`,`nice_building`,`keep_going`,`coffee`,`wave`,`star`,`heart`,`rocket`],tt=[`agent_hours_10k`,`agent_hours_50k`,`agent_hours_100k`],nt=[`deploy`,`other-device`,`banned`,`suspended`,`waiting`,`update`,`unauthorized`,`no_player`,`deleted`],rt=[`schema`,`limits`,`name_pool`,`parts`,`ids`,`rate`,`internal`,`left`,`implausible`],it={floors:64,agentsPerFloor:64,agentsTotal:256,bytes:65536},N={min:3,max:20},at=[`habblaud`,`admin`,`staff`,`claude`,`anthropic`,`codex`,`openai`,`moderador`,`moderator`,`suporte`,`support`,`system`,`world`],ot=`invalid.invalid_code.invalid_credentials.email_not_verified.banned.suspended.unauthorized.name_taken.name_invalid.name_blocked.name_cooldown.password_invalid.password_weak.password_pwned.altcha_required.altcha_invalid.device_limit.rate_limited.not_found.no_player.unavailable.maintenance.invalid_json.too_large.unsupported_media_type.method_not_allowed.internal`.split(`.`),st={competicao:{id:`competicao`,emoji:`🏆`,label:e(`Competição`),desc:e(`Adora competir: desafia os colegas no ping-pong, no videogame e no jokenpô.`)},apostas:{id:`apostas`,emoji:`🎲`,label:e(`Apostas`),desc:e(`Topa qualquer aposta e aposta alto no jokenpô.`)},games:{id:`games`,emoji:`🎮`,label:e(`Games`),desc:e(`Vive no videogame do lounge e nos fliperamas — e costuma ganhar.`)},series:{id:`series`,emoji:`📺`,label:e(`Séries e TV`),desc:e(`Não perde um programa na TV do lounge (de preferência com pipoca).`)},fofoca:{id:`fofoca`,emoji:`🗣️`,label:e(`Fofoca`),desc:e(`Puxa papo na copa e sabe de tudo o que acontece nas salas.`)},vaidade:{id:`vaidade`,emoji:`💄`,label:e(`Vaidade`),desc:e(`Passa no espelho do banheiro para se arrumar sempre que pode.`)},cafeina:{id:`cafeina`,emoji:`☕`,label:e(`Cafeína`),desc:e(`Movido a café: a cafeteira da copa é a segunda casa.`)},piadas:{id:`piadas`,emoji:`😂`,label:e(`Piadas`),desc:e(`Conta piada em toda conversa e faz a roda rir.`)},esporte:{id:`esporte`,emoji:`🏓`,label:e(`Esporte`),desc:e(`Joga ping-pong, se alonga e vibra com o futebol na TV.`)},timidez:{id:`timidez`,emoji:`🙈`,label:e(`Timidez`),desc:e(`Prefere ficar na sua: lê, olha a janela e entra menos nas rodas.`)},economia:{id:`economia`,emoji:`💰`,label:e(`Economia`),desc:e(`Pão-duro: aposta pouco e às vezes foge da aposta.`)},sonecas:{id:`sonecas`,emoji:`😴`,label:e(`Sonecas`),desc:e(`Qualquer sofá ou puff vira cama.`)},calma:{id:`calma`,emoji:`🧘`,label:e(`Calma`),desc:e(`Zen: alongamentos, janela e conversas tranquilas.`)},leitura:{id:`leitura`,emoji:`📚`,label:e(`Leitura`),desc:e(`Sempre com um livro da estante (ou o celular) na mão.`)}};function ct(e){return typeof e==`string`&&Ye.includes(e)}function P(e,t){return Xe.some(([n,r])=>n===e&&r===t||n===t&&r===e)}function lt(e){if(!Array.isArray(e)||e.length<M.min||e.length>M.max)return null;let t=[];for(let n of e){if(!ct(n)||t.includes(n)||t.some(e=>P(e,n)))return null;t.push(n)}return t}var ut=[`auto`,`none`,`halloween`,`christmas`];function dt(e){return typeof e==`string`&&ut.includes(e)}var ft={cmdsPerBatch:20,batchesPerSec:5,streams:4},pt=[`area`,`area.patch`,`players`,`player.join`,`player.leave`,`pos`,`minimap`,`afk`,`profile`,`notice`,`like.update`,`greeting`,`building`,`building.patch`,`visitors`,`city`,`city.fireworks`,`likes.today`,`away.summary`,`knock`],mt=[`not_configured`,`local_only`,`terminal_off`,`not_logged_in`,`session_expired`,`invalid_email`,`altcha_failed`,`world_unreachable`,`world_timeout`,`world_bad_response`,`world_error`,`storage_failed`,`too_many_streams`,`no_stream`,`not_connected`,`account_deleted`,`network`,`unknown`],ht=[...new Set([...ot,...mt])];function gt(e){return typeof e==`string`&&ht.includes(e)}var _t=3,vt=/[\p{C}\p{Zl}\p{Zp}\p{Default_Ignorable_Code_Point}\p{Bidi_Control}]/u,yt=/(?! )[\p{Zs}\s]/u,bt=/^\p{L}$/u,xt=/^\p{M}$/u,St=/^[0-9 _.-]$/,Ct=`Latin.Greek.Cyrillic.Armenian.Hebrew.Arabic.Syriac.Thaana.Devanagari.Bengali.Gurmukhi.Gujarati.Oriya.Tamil.Telugu.Kannada.Malayalam.Sinhala.Thai.Lao.Tibetan.Myanmar.Georgian.Hangul.Ethiopic.Khmer.Mongolian.Hiragana.Katakana.Bopomofo.Han`.split(`.`),wt=Ct.map(e=>[e,RegExp(`^\\p{Script_Extensions=${e}}$`,`u`)]),Tt=`Other`,Et=[...Ct.map(e=>[e]),[`Han`,`Hiragana`,`Katakana`],[`Hangul`,`Han`],[`Han`,`Bopomofo`],[Tt]];function Dt(e){let t=wt.filter(([,t])=>t.test(e)).map(([e])=>e);return t.length?t:[Tt]}function Ot(e){let t=[...new Set(e)].map(Dt);return Et.some(e=>t.every(t=>t.some(t=>e.includes(t))))}function kt(e){return e.normalize(`NFC`).trim().replace(/ {2,}/g,` `)}function At(e){return e.normalize(`NFKC`).toLowerCase().normalize(`NFD`).replace(/[\p{Mn}\p{Me}]/gu,``).normalize(`NFC`).replace(/\s+/g,` `).trim()}function jt(e){return e.replace(/[ _.-]/g,``)}var F=e=>({ok:!1,code:`name_invalid`,problem:e});function Mt(e){if(typeof e!=`string`)return F(`type`);if(e.length>N.max*8)return F(`length`);let t=kt(e);if(vt.test(t)||yt.test(t))return F(`invisible`);let n=[...t];if(n.length<N.min||n.length>N.max)return F(`length`);let r=[],i=0,a=!1;for(let e of n)if(bt.test(e))r.push(e),i=0,a=!0;else if(xt.test(e)){if(!a||++i>_t)return F(`chars`)}else if(St.test(e))i=0,a=!1;else return F(`chars`);if(!r.length)return F(`no_letter`);if(!Ot(r))return F(`scripts`);let o=At(t);return at.includes(jt(o))?{ok:!1,code:`name_blocked`,problem:`reserved`}:{ok:!0,name:t,key:o}}var I={w:14,h:12},L={w:3,h:2},R={w:I.w*L.w,h:I.h*L.h},z={x:R.w+4+5,y:R.h+4+5},Nt={w:2,h:2},B={x:0,y:0},V={x:19,y:10,w:4,h:3},H={x:21,y:15},U={dx:6,w:2},W=(e,t)=>Math.floor(e/t);function*Pt(){let e=0,t=0;yield{x:e,y:t};let n=[[1,0],[0,1],[-1,0],[0,-1]];for(let r=1,i=0;;r++)for(let a=0;a<2;a++,i++){let a=n[i%4]??n[0];for(let n=0;n<r;n++)e+=a[0],t+=a[1],yield{x:e,y:t}}}function G(e){return e.x===B.x&&e.y===B.y}function*Ft(){for(let e of Pt())if(!G(e))for(let t=0;t<L.h;t++)for(let n=0;n<L.w;n++)yield{x:e.x*L.w+n,y:e.y*L.h+t}}function K(e){return{x:W(e.x,L.w),y:W(e.y,L.h)}}function It(e){return{x:e.x*z.x,y:e.y*z.y}}function Lt(e){let t=K(e),n=It(t);return{x:n.x+I.w*(e.x-L.w*t.x),y:n.y+I.h*(e.y-L.h*t.y)}}function Rt(e){let t=Lt(e),n=e.y-L.h*K(e).y===0,r=n?t.y:t.y+I.h-1;return{side:n?`n`:`s`,tiles:[{x:t.x+U.dx,y:r},{x:t.x+U.dx+1,y:r}],front:{x:t.x+U.dx+U.w/2,y:n?t.y-1:t.y+I.h}}}function zt(e,t){let n=(z.x-R.w)/2,r=(z.y-R.h)/2;return{x:W(e+n,z.x),y:W(t+r,z.y)}}function Bt(e){return{x:W(e.x,Nt.w),y:W(e.y,Nt.h)}}function Vt(e,t){return`${e}:${t.x},${t.y}`}function Ht(e){let t=/^([a-z0-9_-]{1,32}):(-?\d{1,6}),(-?\d{1,6})$/.exec(e);return t?{district:t[1]??``,chunk:{x:Number(t[2]),y:Number(t[3])}}:null}function Ut(e,t=1){let n=[];for(let r=-t;r<=t;r++)for(let i=-t;i<=t;i++)n.push({x:e.x+i,y:e.y+r});return n}function Wt(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t))return!1;let r=Math.floor(e),i=Math.floor(t),a=W(r,z.x),o=W(i,z.y),s=r-a*z.x,c=i-o*z.y;return s>=R.w||c>=R.h?!0:G({x:a,y:o})?!(s>=V.x&&s<V.x+V.w&&c>=V.y&&c<V.y+V.h):!1}function Gt(){return{x:H.x,y:H.y}}var q=e=>!!e&&typeof e==`object`&&!Array.isArray(e),J=e=>typeof e==`number`&&Number.isFinite(e),Y=e=>J(e)&&Number.isInteger(e)&&e>=0&&e<=1e9;function Kt(e){if(!q(e)||!Y(e.lit))return;let t={lit:e.lit},n=e.goal;return q(n)&&typeof n.id==`string`&&n.id.length<=64&&tt.includes(n.label)&&J(n.target)&&n.target>0&&J(n.progress)&&n.progress>=0&&J(n.until)&&(t.goal={id:n.id,label:n.label,target:n.target,progress:n.progress,until:n.until}),J(e.tokensBand)&&Number.isInteger(e.tokensBand)&&e.tokensBand>=0&&e.tokensBand<=5&&(t.tokensBand=e.tokensBand),t}function qt(e){if(!q(e)||typeof e.since!=`string`||!/^\d{4}-\d{2}-\d{2}$/.test(e.since)||!Y(e.visits)||!Y(e.likes))return;let t=[];for(let n of Array.isArray(e.stamps)?e.stamps:[])q(n)&&et.includes(n.stampId)&&Y(n.count)&&n.count!==0&&(t.some(e=>e.stampId===n.stampId)||t.push({stampId:n.stampId,count:n.count}));return{since:e.since,visits:e.visits,likes:e.likes,stamps:t}}function Jt(e){return!!e&&(e.visits>0||e.likes>0||e.stamps.some(e=>e.count>0))}function Yt(e){let t=-1;return e.forEach((e,n)=>{e.t===`move`&&(t=n)}),e.filter((e,n)=>e.t!==`move`||n===t)}var Xt={night_owl:()=>e(`Codo de madrugada`),early_bird:()=>e(`Acordo cedo para codar`),coffee:()=>e(`Movido a café`),tea:()=>e(`Time do chá`),tabs:()=>e(`Time dos tabs`),spaces:()=>e(`Time dos espaços`),dark_mode:()=>e(`Modo escuro sempre`),light_mode:()=>e(`Modo claro, sem medo`),vim:()=>e(`Vim até o fim`),tests_first:()=>e(`Testo antes de escrever`),ship_fast:()=>e(`Entrego rápido`),refactor:()=>e(`Refatorar é meu hobby`),pixel_art:()=>e(`Fã de pixel art`),music:()=>e(`Codo ouvindo música`),silence:()=>e(`Codo em silêncio`),cats:()=>e(`Gente de gato`),dogs:()=>e(`Gente de cachorro`),open_source:()=>e(`Vivo de código aberto`),learning:()=>e(`Sempre aprendendo`),hello:()=>e(`Oi, prazer!`)};function Zt(e){return typeof e==`string`&&Ze.includes(e)}function Qt(e){return Xt[e]?.()??String(e)}function X(e,t){return!e?.enabled||!e.configured||e.state===`off`||t.remote?`hidden`:!t.fake&&(!t.local||!t.terminal)?`local_only`:`active`}function $t(e){return!!e&&(e.scene!==void 0||e.building!==void 0)}var en=`habblaud:world-invite-seen`,tn=`habblaud:world-launch`,nn=`habblaud:world-waitlist-seen`,rn=`habblaud:world-approved-seen`,an={launch:null,waitlistSeen:!1,approvedSeen:!1};function on(e){let t=null;if(e.launch===`never`||e.legacy===`never`)t=`never`;else if(e.launch)try{let n=JSON.parse(e.launch);n&&typeof n==`object`&&typeof n.shown==`number`&&typeof n.last==`number`&&Number.isFinite(n.shown)&&Number.isFinite(n.last)&&(t={shown:Math.max(0,Math.floor(n.shown)),last:Math.max(0,n.last)})}catch{}return{launch:t,waitlistSeen:e.waitlist!==null,approvedSeen:e.approved!==null}}function sn(e){return{launch:e.launch===`never`?`never`:e.launch?JSON.stringify(e.launch):null,waitlist:e.waitlistSeen?`1`:null,approved:e.approvedSeen?`1`:null}}function cn(e,t,n,r){if(t.fake||t.replaying||X(e,t)!==`active`||!e)return{show:null,memory:null};if(e.state===`logged_out`){let e=n.launch;return e===`never`||e&&(e.shown>=3||r-e.last<2592e5)?{show:null,memory:null}:{show:`launch`,memory:{...n,launch:{shown:(e?.shown??0)+1,last:r}}}}let i=n.launch===`never`?n:{...n,launch:`never`},a=i!==n;return e.state===`waiting`&&!n.waitlistSeen?{show:`waitlist`,memory:{...i,waitlistSeen:!0}}:e.state===`approved`&&!n.approvedSeen&&!$t(e)?{show:`approved`,memory:{...i,approvedSeen:!0}}:{show:null,memory:a?i:null}}var ln=[`welcome`,`register`,`login`,`verify`,`forgot`,`reset`],un=[`home`,`character`,`visibility`,`devices`,`account`,`blocked`];function dn(e){return e===`waiting`||e===`approved`?un:e===`logged_out`?ln:[]}function fn(){return{server:null,screen:`welcome`,email:``,name:``,flash:null}}function Z(e){if(!e.server)return e;let t=dn(e.server);return!t.length||t.includes(e.screen)?e:{...e,screen:t[0]}}function pn(e,t){switch(t.type){case`server`:return Z({...e,server:t.state});case`go`:return Z({...e,screen:t.screen,flash:null});case`code_sent`:return Z({...e,screen:`verify`,email:t.email,name:t.name??e.name,flash:`code_sent`});case`reset_code_sent`:return Z({...e,screen:`reset`,email:t.email,flash:`code_sent`});case`password_changed`:return Z({...e,screen:`login`,flash:`password_changed`});case`signed_in`:return{...e,flash:null};case`flash`:return{...e,flash:t.flash}}}function Q(e){return e.normalize(`NFC`).trim()}function mn(e){let t=Q(e);return t.length<=254&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function hn(e){return e.replace(/\D/g,``).slice(0,6)}function gn(e){return/^\d{6}$/.test(hn(e))}function _n(e,t=``){let n=e.normalize(`NFC`),r=[...n].length;if(r<12)return`short`;if(r>128)return`long`;let i=Q(t).toLowerCase(),a=n.toLowerCase();return i&&(a===i||a===i.split(`@`)[0])?`email`:/^(.+?)\1+$/su.test(n)?`repeated`:null}function vn(t){switch(t){case`short`:return e(`A senha precisa ter pelo menos 12 caracteres.`);case`long`:return e(`A senha pode ter no máximo 128 caracteres.`);case`email`:return e(`A senha não pode ser o seu e-mail.`);case`repeated`:return e(`A senha não pode ser só uma repetição (como "aaaaaaaaaaaa").`)}}function yn(t){switch(t){case`type`:case`length`:return e(`O nome precisa ter de 3 a 20 caracteres.`);case`invisible`:return e(`Tire do nome os caracteres invisíveis e os espaços especiais.`);case`chars`:return e(`Use só letras, números, espaço, _ - e . no nome.`);case`scripts`:return e(`Use letras de um só alfabeto no nome.`);case`no_letter`:return e(`O nome precisa ter pelo menos uma letra.`);case`reserved`:return e(`Este nome é reservado. Escolha outro.`)}}function bn(e,t){if(e.includes(t))return null;let n=e.find(e=>P(e,t));return n?{reason:`clash`,with:n}:e.length>=M.max?{reason:`full`}:null}function xn(e,t){return e.includes(t)?e.filter(e=>e!==t):bn(e,t)?[...e]:[...e,t]}function Sn(e){return lt(e)!==null}var Cn=24301;function wn(e){let t={};for(let n of S)t[n]=w(n===`facialHair`?e.facialHair??`none`:n===`bottomStyle`?e.bottomStyle??`pants`:e[n]);return t}function Tn(e,t,n=Cn){return k(n,{look:e,parts:t})}function En(e){let t=Mt(e.name);return t.ok?Sn(e.traits)?!e.intro||!Zt(e.intro)?{field:`intro`}:null:{field:`traits`}:{field:`name`,problem:t.problem}}var Dn={mode:`live`,closed:!1,hideCountry:!1,tokensVisible:!0,leaderboard:!1,compactions:!1,knocks:!1},On=[`closed`,`hideCountry`,`tokensVisible`,`leaderboard`,`compactions`,`knocks`];function kn(e){return e?.notifyInactivity!==!1}var An=`habblaud-world-dados.json`,$=`privacidade@habblaud.com`,jn=`Recurso Habblaud World`;function Mn(e){let t=e&&/^[A-Za-z0-9_-]{1,64}$/.test(e)?e:``;return`mailto:${$}?subject=${encodeURIComponent(t?`${jn} ${t}`:jn)}`}function Nn(t,n){switch(gt(t)||t===`offline`||t===`forbidden`?t:`unknown`){case`invalid_code`:return e(`Código errado ou vencido. Confira o e-mail ou peça outro código.`);case`invalid_credentials`:return e(`E-mail ou senha não conferem.`);case`email_not_verified`:return e(`Falta confirmar o e-mail: mandamos um código novo.`);case`banned`:return e(`Esta conta foi banida do Habblaud World. Para recorrer, responda ao e-mail do banimento.`);case`suspended`:return e(`Esta conta está suspensa no Habblaud World por enquanto.`);case`unauthorized`:case`not_logged_in`:case`session_expired`:return e(`A sessão do Habblaud World neste computador terminou. Entre de novo.`);case`name_taken`:return e(`Este nome já está em uso no mundo. Escolha outro.`);case`name_invalid`:return e(`Nome inválido: de 3 a 20 caracteres, com letras de um só alfabeto, números, espaço, _ - e .`);case`name_blocked`:return e(`Este nome não é permitido. Escolha outro.`);case`name_cooldown`:return e(`O nome só pode ser trocado uma vez a cada 30 dias.`);case`password_invalid`:return e(`A senha precisa ter de 12 a 128 caracteres.`);case`password_weak`:return e(`Senha fraca: não use o e-mail, o nome de jogador nem só repetição.`);case`password_pwned`:return e(`Esta senha aparece em vazamentos de dados conhecidos. Escolha outra.`);case`invalid_email`:return e(`E-mail inválido. Confira o endereço.`);case`altcha_required`:case`altcha_invalid`:case`altcha_failed`:return e(`A verificação anti-robô não passou. Tente de novo em instantes.`);case`device_limit`:return e(`Esta conta já tem 3 computadores; revogue um em Dispositivos.`);case`no_player`:return e(`Crie o personagem primeiro.`);case`unavailable`:return e(`O Habblaud World está em manutenção. Tente de novo mais tarde.`);case`maintenance`:return e(`O mundo está em manutenção; tentamos de novo em instantes.`);case`not_found`:return e(n===`revoke`?`Este dispositivo não está mais na conta.`:`O servidor do Habblaud World não encontrou o que foi pedido.`);case`invalid_json`:case`too_large`:case`unsupported_media_type`:case`method_not_allowed`:return e(`O pedido saiu num formato que o servidor não aceita. Atualize o Habblaud e tente de novo.`);case`not_configured`:return e(`O Habblaud World não está ligado neste Habblaud (HABBLAUD_WORLD_URL recusada; veja o log do servidor).`);case`rate_limited`:return e(n===`export`?`Dá para baixar os dados uma vez por dia. Tente de novo amanhã.`:`Muitas tentativas seguidas. Espere alguns minutos e tente de novo.`);case`network`:case`world_unreachable`:case`world_timeout`:return e(`O servidor do Habblaud World não respondeu. Tente de novo em instantes.`);case`world_bad_response`:return e(`O servidor do Habblaud World respondeu algo inesperado. Tente de novo em instantes.`);case`account_deleted`:return e(`A conta do Habblaud World foi excluída. O prédio e o perfil saíram do mundo na hora; o resto é apagado do banco em 7 dias e dos backups em até 30.`);case`storage_failed`:return e(`Não deu para gravar a sessão neste computador: ela vale só até o Habblaud reiniciar.`);case`too_many_streams`:return e(`A cidade já está aberta em outras abas do Habblaud. Feche uma delas para abrir aqui.`);case`no_stream`:return e(`A cena Mundo perdeu a conexão com o Habblaud. Abra a cidade de novo.`);case`not_connected`:return e(n===`unblock`?`Sem conexão com o Habblaud World agora: desbloquear precisa do prédio aceso ou da cidade aberta.`:`Sem conexão com o Habblaud World agora; o Habblaud tenta de novo sozinho.`);case`offline`:return e(`Sem conexão com o Habblaud.`);case`forbidden`:case`local_only`:return e(`A conta do World só pode ser mexida pelo próprio computador, com o Habblaud aberto em localhost.`);case`terminal_off`:return e(`A conta do World só pode ser mexida com o Habblaud acessível apenas pelo próprio computador (acesso local, bind 127.0.0.1).`);case`invalid`:switch(n){case`register`:case`reset`:return e(`O servidor recusou o e-mail ou a senha. A senha precisa ter de 12 a 128 caracteres e não pode estar numa lista de senhas vazadas.`);case`character`:return e(`O servidor recusou o personagem. Confira o nome, os traços (2 ou 3) e a frase de apresentação.`);case`visibility`:case`inactivity`:return e(`O servidor recusou as opções de visibilidade.`);default:return e(`O servidor recusou o pedido. Confira os dados e tente de novo.`)}case`internal`:return e(`O servidor do mundo teve um erro; tente de novo.`);case`world_error`:case`unknown`:return e(`Algo deu errado. Tente de novo em instantes.`)}}function Pn(e,t){return t?e?.left?`left`:e?.paused?`paused`:e?.stopped?`stopped`:e?.connected?`connected`:`reconnecting`:`no_player`}function Fn(t){switch(t){case`update`:return{label:e(`Atualize o Habblaud`),desc:e(`Esta versão do Habblaud não entra mais no mundo. Atualize para o prédio voltar a acender.`),toggle:null};case`other-device`:return{label:e(`Conectado em outro computador`),desc:e(`A sua conta conectou o prédio em outro computador, e este parou de enviar.`),toggle:{action:`resume`,text:e(`Trazer para este computador`),hint:e(`O prédio volta a subir daqui, e o outro computador para de enviar.`)}};case`banned`:return{label:e(`Conta banida`),desc:e(`O Habblaud World baniu esta conta: o prédio saiu do mundo e nada mais sai deste computador.`),toggle:null};case`suspended`:return{label:e(`Conta suspensa`),desc:e(`Esta conta está suspensa no Habblaud World: o prédio fica apagado e nada sai deste computador.`),toggle:{action:`resume`,text:e(`Tentar de novo`),hint:e(`Se a suspensão já acabou, o prédio volta a acender.`)}};case`waiting`:return{label:e(`Na lista de espera`),desc:e(`A conta voltou para a lista de espera: o prédio sai do mundo até o acesso ser liberado de novo.`),toggle:null};case`no_player`:return{label:e(`Sem personagem`),desc:e(`O mundo não encontrou o seu personagem: crie de novo para o prédio voltar.`),toggle:null};case`unauthorized`:return{label:e(`Entre de novo`),desc:e(`O servidor do mundo não reconheceu este computador: entre de novo na conta.`),toggle:null};case`deleted`:return{label:e(`Conta excluída`),desc:e(`A conta do Habblaud World foi excluída: o prédio e o perfil saíram do mundo e nada mais sai deste computador.`),toggle:null}}}function In(t){switch(t){case`schema`:return e(`O pacote saiu fora do formato do protocolo. Atualize o Habblaud.`);case`limits`:return e(`O escritório passou dos limites do mundo (64 andares, 64 agentes por andar, 256 agentes ou 64 KB).`);case`name_pool`:return e(`Um nome de personagem não está na lista de nomes do mundo.`);case`parts`:return e(`Uma peça de aparência está fora das paletas do editor.`);case`ids`:return e(`Um código de andar ou de agente está fora do formato.`);case`rate`:return e(`Remessas demais em pouco tempo (o limite é 12 por minuto). A próxima vai normalmente.`);case`internal`:return e(`Um erro no servidor do mundo. A próxima remessa tenta de novo.`);case`left`:return e(`A conta saiu do mundo (por este ou por outro computador): nada mais sai até você voltar ao mundo.`);case`implausible`:return e(`O pacote contradiz o anterior de um jeito que o Habblaud não produz: o mundo o descartou, e o prédio fica com o último aceito. As próximas remessas vão normalmente.`);default:return e(`Um motivo que esta versão do Habblaud não conhece.`)}}function Ln(t){return t===`appeal`?{text:e(`Recorrer por e-mail`),hint:e(`Abre um e-mail para {0}: conte o que aconteceu, e uma pessoa revê o caso.`,[$])}:{text:e(`Contestar por e-mail`),hint:e(`Abre um e-mail para {0}: se for engano, uma pessoa revê os números e tira o selo.`,[$])}}function Rn(t){return t===1?e(`1 byte`):e(`{0} bytes`,[r(t)])}function zn(t){return t===1?e(`1 andar`):e(`{0} andares`,[r(t)])}function Bn(t){return t===1?e(`1 agente`):e(`{0} agentes`,[r(t)])}function Vn(t){return t===1?e(`1 visitante agora`):e(`{0} visitantes agora`,[r(t)])}var Hn={started:!1,last:void 0,notified:!1};function Un(e,t,n){let r=typeof t==`number`&&t>0?t:t===0?0:void 0;if(!e.started)return{state:{started:!0,last:r,notified:r!==void 0&&r>0},notify:!1};if(r===void 0)return{state:{started:!0,last:void 0,notified:!1},notify:!1};let i=r>0&&(e.last??0)===0,a=i&&!e.notified&&n;return{state:{started:!0,last:r,notified:e.notified||i},notify:a}}function Wn(t,n,r,i={}){let a=Gn(t,n,r,i);return a.state===`stopped`&&(t?.stopped===`banned`||t?.stopped===`suspended`)?{...a,appeal:Ln(`appeal`)}:t?.unverified&&a.state!==`stopped`&&a.state!==`left`&&a.state!==`no_player`?{...a,unverified:e(`O mundo marcou o seu prédio como "não verificado": os números pareceram fora do normal e estão em revisão. Ele continua no mundo, mas fora de placares e destaques.`),appeal:Ln(`contest`)}:a}function Gn(t,n,r,a){let o=Pn(t,n),s={unverified:null,appeal:null},c=t?.floors??0,l=t?.agents??0,u=o===`no_player`||o===`left`?[]:[zn(c),Bn(l),t?.lastUplinkAt?e(`Última remessa: {0}`,[i(t.lastUplinkAt,r)]):e(`Nenhuma remessa ainda`),...t?.visitors?[`👀 ${Vn(t.visitors)}`]:[]],d=(o===`connected`||o===`reconnecting`||o===`paused`)&&t?.lastAck?.ok===!1?In(t.lastAck.error):null,f=e(`Pausado por 30 dias, o prédio some do mapa e, 30 dias depois, é retirado; retomar antes disso traz de volta, no mesmo lote.`);switch(o){case`no_player`:return{state:o,label:e(`Sem personagem`),desc:e(`Crie o seu personagem: o prédio entra no mundo junto com ele.`),stats:u,rejected:d,toggle:null,leave:!1,...s};case`left`:return{state:o,label:e(`Fora do mundo`),desc:e(`Você saiu do mundo: o prédio foi retirado e o lote, liberado. Dá para andar pela cidade; nada do escritório sai deste computador.`),stats:u,rejected:null,toggle:{action:`join`,text:e(`Voltar ao mundo`),hint:e(`Voltar cria um prédio novo, em outro lote; a conta e o personagem são os mesmos.`)},leave:!1,...s};case`stopped`:{let e=t.stopped;return{state:o,...Fn(e),stats:u,rejected:d,leave:e===`update`||e===`other-device`||e===`suspended`,...s}}case`paused`:return{state:o,label:e(`Pausado`),desc:e(`Pausado: seu prédio está apagado, mas você pode andar pela cidade. Nada do escritório sai deste computador.`),stats:u,rejected:d,toggle:{action:`resume`,text:e(`Retomar`),hint:`${e(`Retomar volta a enviar e acende o prédio.`)} ${f}`},leave:!0,...s};case`connected`:case`reconnecting`:{let n=o===`connected`,r=!t?.lastUplinkAt,i=!n&&!!a.maintenance;return{state:o,label:e(n?`Conectado`:i?`Em manutenção`:r?`Conectando…`:`Reconectando…`),desc:e(n?`Aceso no mundo: um andar por sala aberta e cada personagem no status de agora. Os tokens, se você deixar, aparecem só em faixas, no medidor da fachada.`:i?`O mundo está em manutenção; tentamos de novo em instantes.`:r?`O prédio acende com a primeira remessa.`:`Sem conexão com o mundo agora: o Habblaud tenta de novo sozinho. Com 2 minutos sem notícias, o prédio apaga.`),stats:u,rejected:d,toggle:{action:`pause`,text:e(`Pausar`),hint:`${e(`Pausar interrompe o envio na hora e apaga o prédio no mundo.`)} ${f}`},leave:!0,...s}}}}function Kn(){return e(`Pausar apaga o prédio e guarda o lote: retomar traz de volta, no mesmo lugar. Sair do mundo retira o prédio na hora e libera o lote; a conta e o personagem continuam, e voltar depois cria um prédio novo, em outro lote.`)}function qn(t,n){if(!t)return{kind:`pending`,label:e(`Sem resposta do mundo ainda.`),reason:null};if(t.ok){let r=t.bytes===void 0?null:t.bytes===n?e(`O mundo recebeu os mesmos {0}.`,[Rn(t.bytes)]):e(`O mundo contou {0}.`,[Rn(t.bytes)]);return{kind:`accepted`,label:e(`Aceita pelo mundo.`),reason:r}}return{kind:`rejected`,label:e(`Recusada pelo mundo.`),reason:In(t.error)}}function Jn(e){return JSON.stringify(e,null,2)}function Yn(e,t){return X(e,t)===`active`&&e?.state===`approved`}function Xn(e,t){let n=e?.building;return!n||n.left||e.state!==`approved`||X(e,t)===`hidden`?null:n.paused?`paused`:n.stopped?`stopped`:n.connected?`live`:n.lastUplinkAt?`reconnecting`:null}export{U as $,he as $t,on as A,Ze as At,Xn as B,Fe as Bt,Kn as C,dt as Ct,hn as D,tt as Dt,cn as E,P as Et,Yn as F,rt as Ft,Zt as G,k as Gt,pn as H,Be as Ht,xn as I,it as It,Yt as J,x as Jt,qt as K,Pe as Kt,bn as L,Je as Lt,vn as M,$e as Mt,Jn as N,et as Nt,Q as O,nt as Ot,sn as P,Ye as Pt,R as Q,me as Qt,Sn as R,qe as Rt,fn as S,ut as St,Un as T,ct as Tt,X as U,Ke as Ut,Nn as V,Ge as Vt,Qt as W,D as Wt,L as X,_e as Xt,Jt as Y,S as Yt,z as Z,ve as Zt,gn as _,Mt as _t,An as a,o as an,K as at,zn as b,ft as bt,On as c,Bt as ct,qn as d,Wt as dt,ge as en,V as et,Bn as f,Rt as ft,En as g,Gt as gt,Rn as h,Ht as ht,an as i,p as in,zt as it,_n as j,N as jt,kn as k,Qe as kt,Hn as l,Ut as lt,Wn as m,Ft as mt,rn as n,ie as nn,B as nt,en as o,It as ot,Mn as p,Lt as pt,Kt as q,C as qt,Dn as r,_ as rn,H as rt,tn as s,Vt as st,$ as t,w as tn,I as tt,nn as u,G as ut,Tn as v,At as vt,yn as w,st as wt,wn as x,pt as xt,mn as y,ht as yt,Vn as z,Le as zt};
@@ -0,0 +1 @@
1
+ import{c as e,l as t}from"./simulator-DSTKHVKF.js";import{J as n,Kt as r,Q as i,at as a,bt as o,ct as s,dt as c,et as l,ft as u,gt as d,it as f,kt as p,mt as m,nt as h,ot as g,rn as _,st as v,xt as ee}from"./world-model-DIM3eqSC.js";import{f as y}from"./app-D5bRv3Io.js";function b(t,n,i,a,o,s,c){return{id:t,kind:a,...c?{parentId:c}:{},provider:o,status:s,look:i,name:n,parts:r(e(t),void 0,i)}}function x(e=`live`){let t=e===`live`,n=[{id:`f_0a1b2c3d4e`,label:`ipe`,agents:[b(`a_1f2e3d4c`,`Marina`,`f`,`main`,`claude`,`working`),b(`a_2a3b4c5d`,`Rafael`,`m`,`sub`,`claude`,`working`,`a_1f2e3d4c`)]},{id:`f_1b2c3d4e5f`,label:`jade`,agents:[b(`a_3c4d5e6f`,`Beatriz`,`f`,`main`,`codex`,`waiting`),b(`a_4d5e6f70`,`Thiago`,`m`,`sub`,`codex`,`shell`)]},{id:`f_2c3d4e5f60`,label:`aurora`,agents:[b(`a_5e6f7081`,`Larissa`,`f`,`main`,`claude`,`idle`),b(`a_6f708192`,`Gustavo`,`m`,`main`,`codex`,`idle`)]}].map(e=>t?e:{...e,agents:[]});return{building:{id:`o_7a8b9c0d1e2f`,lot:{district:`centro`,x:3,y:5},owner:{id:`o_7a8b9c0d1e2f`,name:`Helena`,country:`BR`},state:e===`away`?`away`:`online`,theme:`none`,floors:n.length,...t?{agents:{total:6,working:3,waiting:1,idle:2}}:{},...e===`discreet`?{discreet:!0}:{},rev:12,likes:3,sinceMonth:`2026-10`},floors:n,visitors:1}}var S=200,C=o.cmdsPerBatch-1,w=2,T=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function E(e,t){let r=n([...e,...t]),i=r.filter(e=>e.t!==`move`),a=new Set(i.slice(Math.max(0,i.length-C)));return r.filter(e=>e.t===`move`||a.has(e))}var D=class{set=new Set;add(e){return this.set.add(e),()=>void this.set.delete(e)}emit(e){for(let t of[...this.set])try{t(e)}catch(e){console.error(`[world-stream]`,e)}}clear(){this.set.clear()}},O=class{listeners=new D;open;fetchImpl;setT;clearT;now;base;es=null;stream=null;queue=[];flushTimer=null;retryTimer=null;inflight=!1;lastPostAt=-1/0;holdUntil=0;attempts=0;closed=!1;status=`connecting`;constructor(e={}){this.open=e.eventSource??(e=>new EventSource(e)),this.fetchImpl=e.fetch??((e,t)=>fetch(e,t)),this.setT=e.setTimeout??((e,t)=>setTimeout(e,t)),this.clearT=e.clearTimeout??(e=>clearTimeout(e)),this.now=e.now??Date.now,this.base=e.base??`/api/world`,this.connect()}on(e){return this.listeners.add(e)}send(e){!this.closed&&e.length&&(this.queue=E(this.queue,e),this.schedule())}close(){this.closed||(this.closed=!0,this.es?.close(),this.es=null,this.flushTimer&&this.clearT(this.flushTimer),this.retryTimer&&this.clearT(this.retryTimer),this.flushTimer=this.retryTimer=null,this.queue=[],this.setStatus(`closed`),this.listeners.clear())}setStatus(e){this.status!==e&&(this.status=e,this.listeners.emit({type:`status`,status:e}))}connect(){if(this.closed)return;this.stream=null;let e;try{e=this.open(`${this.base}/stream`)}catch{return this.retry()}this.es=e;let t=()=>this.es===e&&!this.closed;e.addEventListener(`world.snapshot`,e=>{if(!t())return;let n=k(e);T(n)&&typeof n.stream==`string`&&Array.isArray(n.chunks)&&Array.isArray(n.players)&&(this.stream=n.stream,this.attempts=0,this.setStatus(`open`),this.listeners.emit({type:`snapshot`,snapshot:n}),this.schedule())}),e.addEventListener(`world`,e=>{if(!t())return;let n=k(e);T(n)&&ee.includes(n.t)&&this.listeners.emit({type:`message`,msg:n})}),e.addEventListener(`error`,()=>{t()&&(this.stream=null,e.readyState===w?(e.close(),this.es=null,this.retry()):this.setStatus(`connecting`))})}retry(){if(this.closed||this.retryTimer)return;this.setStatus(`retrying`);let e=_(this.attempts++);this.retryTimer=this.setT(()=>{this.retryTimer=null,this.setStatus(`connecting`),this.connect()},e)}schedule(){if(this.closed||this.flushTimer||this.inflight||!this.queue.length||!this.stream)return;let e=Math.max(0,this.lastPostAt+200-this.now(),this.holdUntil-this.now());this.flushTimer=this.setT(()=>{this.flushTimer=null,this.flush()},e)}async flush(){let e=this.stream;if(this.closed||!e||!this.queue.length)return;let t=this.queue;this.queue=[],this.inflight=!0,this.lastPostAt=this.now();let n=0,r=`offline`,i=1;try{let a=await this.fetchImpl(`${this.base}/cmd`,{method:`POST`,credentials:`same-origin`,cache:`no-store`,headers:{"Content-Type":`application/json`},body:JSON.stringify({stream:e,cmds:t})});if(n=a.status,!a.ok){let e=await a.json().catch(()=>null);typeof e?.error?.code==`string`&&(r=e.error.code),typeof e?.error?.retryAfter==`number`&&(i=e.error.retryAfter)}}catch{n=0}this.inflight=!1,!this.closed&&(n===429&&r===`rate_limited`?(this.queue=E(t,this.queue),this.holdUntil=this.now()+i*1e3):(n<200||n>=300)&&this.listeners.emit({type:`error`,code:r}),this.schedule())}};function k(e){try{return JSON.parse(String(e.data))}catch{return}}var A=`centro`,j=6e4,te=3,M=[{},{Beatriz:`waiting`,Larissa:`idle`,Thiago:`shell`},{Beatriz:`working`,Larissa:`idle`,Thiago:`shell`},{Beatriz:`working`,Larissa:`working`,Thiago:`working`}],N={id:`p_voce`,name:`Pixel Dev`,look:`f`,parts:{skin:`#d69f78`,hair:`#2b2530`,hairStyle:`bob`,eyes:`#2f5f9e`,top:`#4a86d8`,topAccent:`#f4f4f0`,topStyle:`hoodie`,bottom:`#2c2c35`,bottomStyle:`pants`,shoes:`#ececec`,accessory:`glasses`,accessoryColor:`#2b2b33`,facialHair:`none`},traits:[`cafeina`,`games`],intro:`night_owl`,country:`BR`,buildingId:`p_voce`},P=3,F=`HB-4F2K`,ne=`23456789ABCDEFGHJKMNPQRSTVWXYZ`;function I(e){let t=(Math.imul(e+7,2654435761)>>>0)%30**4,n=``;for(let e=0;e<4;e++)n=ne[t%30]+n,t=Math.floor(t/30);let r=`HB-${n}`;return r===`HB-4F2K`?`HB-7777`:r}function re(e){let t=e.trim().toUpperCase().replace(/[\s_]+/g,``),n=t.startsWith(`HB-`)?t.slice(3):t.startsWith(`HB`)&&t.length===6?t.slice(2):t;return/^[2-9A-HJKMNP-TV-Z]{4}$/.test(n)?`HB-${n}`:null}var L={hello:`nice_to_meet`,wave:`hello`,nice_building:`thanks`,congrats:`thanks`,clap:`thanks`,good_luck:`thanks`,coffee:`coffee`,bye:`bye`,thanks:`clap`,nice_to_meet:`wave`},R=[[`Ana Pixel`,`BR`],[`Bruno Byte`,`PT`],[`Camille Code`,`FR`],[`Diego Deploy`,`MX`],[`Emma Stack`,`US`],[`Felipe Fork`,`AR`],[`Gabi Git`,`BR`],[`Hiro Hash`,`JP`],[`Inês Infra`,`ES`],[`Jonas Json`,`DE`],[`Kai Kernel`,`CA`],[`Lia Lambda`,`IT`],[`Marco Merge`,`CL`],[`Nina Node`,`CO`],[`Oscar Ops`,`GB`],[`Priya Patch`,`IN`],[`Quim Query`,void 0],[`Rosa Regex`,`BR`],[`Sami Shell`,`KR`],[`Téo Test`,`PT`]],z=[2,6,13,4,9,3,16,5,0,11,4,7,2,20,8,3,12,1,6,10],B=[`none`,`halloween`,`none`,`christmas`,`none`,`halloween`],V=[[`games`,`piadas`],[`leitura`,`calma`],[`competicao`,`esporte`,`cafeina`],[`series`,`fofoca`],[`esporte`,`cafeina`],[`timidez`,`leitura`]],H=[`coffee`,`tabs`,`pixel_art`,`cats`,`ship_fast`,`music`],U=[{name:`Luna Loop`,look:`f`,block:{x:1,y:0},cw:!0,speed:3,phase:12,owns:1},{name:`Max Merge`,look:`m`,block:{x:1,y:0},cw:!1,speed:3.2,phase:70},{name:`Zoe Zip`,look:`f`,block:{x:0,y:0},cw:!0,speed:2.9,phase:40,owns:7},{name:`Rafa Runtime`,look:`m`,block:{x:1,y:1},cw:!1,speed:3.1,phase:110},{name:`Yuki Yarn`,look:`f`,block:{x:0,y:1},cw:!0,speed:5.6,phase:25,owns:13}],W={name:`Ravi Repo`,look:`m`},G=[`BR`,`US`,`FR`,`ES`,`JP`,`IN`];function K(e){let t=g(e),n=t.x-1,r=t.y-1,a=t.x+i.w+1,o=t.y+i.h+1;return{x0:n,y0:r,x1:a,y1:o,length:2*(a-n+(o-r))}}function q(e,t,n){let r=K(e),i=r.x1-r.x0,a=r.y1-r.y0,o=((n?t:-t)%r.length+r.length)%r.length,s=e=>Math.round(e*100)/100,c=(e,t,r,i)=>({x:s(e),y:s(t),dir:n?r:i,moving:!0});return o<i?c(r.x0+o,r.y0,`e`,`w`):(o-=i,o<a?c(r.x1,r.y0+o,`s`,`n`):(o-=a,o<i?c(r.x1-o,r.y1,`w`,`e`):(o-=i,c(r.x0,r.y1-o,`n`,`s`))))}function J(){let e=g(h);return{x:e.x+l.x+l.w/2+5,y:e.y+l.y+l.h+2+.85}}function Y(){return u(Z(4)[P]).front}var ie=(e,t)=>v(A,s(f(e,t)));function X(e){let t=new Date(e),n=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),r=n-(new Date(n).getUTCDay()+6)%7*864e5;return{id:`${new Date(r).toISOString().slice(0,10)}:agent_hours_10k`,label:`agent_hours_10k`,target:1e4,progress:8e3,until:r+6048e5}}function Z(e){let t=[];for(let n of m()){if(t.length>=e)break;t.push(n)}return t}function Q(e=20){let n=t(12680215),r=Math.max(1,Math.min(2e3,Math.floor(e))),i=new Map;return U.forEach((e,t)=>e.owns!==void 0&&i.set(e.owns,t)),Z(r).map((e,t)=>{let a=t===P,[o,s]=R[t%R.length],c=i.get(t),l=a?4:z[t%z.length],u=Math.max(1,Math.round(l*(1+n()*1.5))),d=Math.round(u*n()),f=Math.min(u-d,n()<.4?1+Math.floor(n()*2):0),p=!a&&(t%7==5||t%11==9),m=!a&&t%9==7,h=a?N.id:c===void 0?`b_${t.toString(36).padStart(3,`0`)}`:`p_${c+1}`,g=a?{id:h,name:N.name,country:N.country}:c===void 0?{id:h,name:r>R.length?`${o} ${Math.floor(t/R.length)+1}`:o,...s?{country:s}:{}}:{id:h,name:U[c].name,country:G[c]},_={id:h,lot:{district:A,x:e.x,y:e.y},owner:g,state:p?`away`:`online`,theme:a?`halloween`:B[t%B.length],floors:l,rev:1,likes:Math.floor(n()*240),sinceMonth:`2026-${String(8+t%3).padStart(2,`0`)}`};return m||(_.agents={total:u,working:d,waiting:f,idle:u-d-f}),t%4!=1&&(_.tokens={day:t%5,week:Math.min(5,t%5+1)}),t%8==6&&(_.closed=!0),_.code=a?F:I(t),(t%3==1||t===4)&&(_.knocks=!0),t===10&&(_.unverified=!0),_})}var $=class{listeners=new D;now;start;buildings;revs=new Map;walkers;me;viewing=!0;closed=!1;ticks=0;lastMoveAt;afkSent=!1;timer=null;pending=[];inside=null;later=[];social=t(5292449);memory;summarySeen=!1;hidden=new Set;stamped=new Set;greetedMe=new Map;goal;constructor(e={}){this.now=e.now??Date.now,this.start=this.now(),this.lastMoveAt=this.start,this.buildings=Q(e.buildings??20);for(let e of this.buildings)this.revs.set(this.chunkOfBuilding(e),1);let n=this.buildings.find(e=>e.id===N.id),i=n?u(n.lot).front:d();this.memory=e.memory;let a=e.memory?.pos;this.me=a?{x:a.x,y:a.y,dir:a.dir,moving:!1}:{x:i.x,y:i.y,dir:`s`,moving:!1},this.goal=X(this.start);let o=t(40474),s=(e,t,n,i)=>{let a=U[e]?.owns,s=`p_${e+1}`;return{id:s,name:t,...e===3?{}:{country:G[e]},look:n,parts:r(1e3+e*97,void 0,n),traits:[...V[e%V.length]],intro:H[e%H.length],...a!==void 0&&a<this.buildings.length?{buildingId:s}:{},likesReceived:Math.floor(o()*60),pos:i,where:`street`}};this.walkers=U.map((e,t)=>s(t,e.name,e.look,q(e.block,e.phase,e.cw)));let c=J();this.walkers.push(s(U.length,W.name,W.look,{x:c.x,y:c.y,dir:`s`,moving:!1})),e.autoplay!==!1&&(this.timer=setInterval(()=>this.tick(),200))}on(e){let t=this.listeners.add(e);return Promise.resolve().then(()=>{this.closed||(e({type:`status`,status:`open`}),e({type:`snapshot`,snapshot:this.snapshot()}))}),t}snapshot(){let e=new Map;for(let t of this.buildings){let n=this.chunkOfBuilding(t);e.has(n)||e.set(n,[]),e.get(n).push(t)}return structuredClone({stream:`fake`,connected:!0,viewing:this.viewing,district:A,me:N,pos:this.me,afk:this.afkSent,chunks:this.viewing?[...e.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({chunk:e,rev:this.revs.get(e)??1,buildings:t})):[],players:this.viewing&&!this.inside?this.walkers.filter(e=>!this.hidden.has(e.id)):[],minimap:this.viewing?this.minimap():null,...this.inside?{inside:{id:this.inside.id,rev:this.inside.rev,detail:this.inside.detail}}:{},...this.viewing?{city:this.cityStatus()}:{},likesToday:3,...this.summarySeen?{}:{summary:structuredClone(y)}})}cityStatus(){return{lit:this.buildings.filter(e=>e.state===`online`).length,goal:{...this.goal},tokensBand:4}}celebrate(){if(this.closed)return;let e=this.goal;this.emit({t:`city.fireworks`,goalId:e.id});let t=e.label===`agent_hours_10k`?`agent_hours_50k`:`agent_hours_100k`,n=t===`agent_hours_50k`?5e4:1e5;this.goal={id:e.id.replace(e.label,t),label:t,target:n,progress:Math.max(e.target,e.progress),until:e.until},this.emit({t:`city`,...this.cityStatus()})}send(e){if(!this.closed)for(let t of n(e))this.command(t)}close(){this.closed||(this.remember(),this.closed=!0,this.timer&&clearInterval(this.timer),this.timer=null,this.listeners.emit({type:`status`,status:`closed`}),this.listeners.clear())}remember(){this.memory&&(this.memory.pos={x:this.me.x,y:this.me.y,dir:this.me.dir,moving:!1})}tick(){if(this.closed)return;this.ticks++;let e=this.pending;this.pending=[];for(let t of e)this.emit(t);if(!this.viewing)return;if(this.inside){this.ticks%15==0&&this.patchInside();return}let t=this.now(),n=this.later.filter(e=>e.at<=t);if(n.length){this.later=this.later.filter(e=>e.at>t);for(let e of n)this.emit(e.msg)}let r=(t-this.start)/1e3,i=new Map;U.forEach((e,t)=>{let n=this.walkers[t];if(n.pos=q(e.block,e.phase+e.speed*r,e.cw),this.hidden.has(n.id))return;let a=ie(n.pos.x,n.pos.y);i.has(a)||i.set(a,[]),i.get(a).push({id:n.id,pos:{...n.pos}})});for(let[e,t]of i)this.emit({t:`players`,chunk:e,players:t});this.ticks%15==0&&this.changeBuilding(this.ticks/15),this.ticks%300==0&&this.emit({t:`minimap`,blocks:this.minimap()}),this.ticks%300==0&&(this.goal={...this.goal,progress:Math.min(this.goal.target-1,this.goal.progress+7)},this.emit({t:`city`,...this.cityStatus()})),this.ticks%25==0&&this.botsGreet(t),!this.afkSent&&t-this.lastMoveAt>=j&&(this.afkSent=!0,this.emit({t:`afk`}))}botsGreet(e){let t=this.walkers.filter(e=>!this.hidden.has(e.id));if(t.length>=2){let n=t[Math.floor(this.social()*t.length)],r=t.filter(e=>e!==n).sort((e,t)=>Math.hypot(e.pos.x-n.pos.x,e.pos.y-n.pos.y)-Math.hypot(t.pos.x-n.pos.x,t.pos.y-n.pos.y))[0],i=p[Math.floor(this.social()*p.length)];this.emit({t:`greeting`,from:n.id,to:r.id,greetingId:i,until:e+5e3}),this.later.push({at:e+1600,msg:{t:`greeting`,from:r.id,to:n.id,greetingId:L[i],until:e+6600}})}for(let n of t){if(Math.hypot(n.pos.x-this.me.x,n.pos.y-this.me.y)>7||e-(this.greetedMe.get(n.id)??-1/0)<3e4||this.social()<.5)continue;this.greetedMe.set(n.id,e);let t=this.social()<.5?`hello`:`wave`;this.emit({t:`greeting`,from:n.id,to:N.id,greetingId:t,until:e+5e3});break}}changeBuilding(e){let t=this.buildings[e*7%this.buildings.length];if(!t.agents||t.state!==`online`)return;let n=e%4==0&&t.agents.working>0?0:(t.agents.working+1)%(t.agents.total+1),r=Math.min(t.agents.total-n,e%2);t.agents={total:t.agents.total,working:n,waiting:r,idle:t.agents.total-n-r},e%3==0&&t.likes++,t.rev++;let i=this.chunkOfBuilding(t),a=(this.revs.get(i)??1)+1;this.revs.set(i,a),this.emit({t:`area.patch`,chunk:i,rev:a,changes:[{id:t.id,agents:{...t.agents},likes:t.likes,rev:t.rev}]})}command(e){switch(e.t){case`move`:{let t=Math.hypot(e.x-this.me.x,e.y-this.me.y)>6;if(!c(e.x,e.y,()=>!0)||t){this.pending.push({t:`pos`,x:this.me.x,y:this.me.y});return}let n=e.x!==this.me.x||e.y!==this.me.y||e.dir!==this.me.dir||e.moving!==this.me.moving;this.me={x:e.x,y:e.y,dir:e.dir,moving:e.moving},n&&(this.lastMoveAt=this.now(),this.afkSent=!1);return}case`profile`:{let t=this.walkers.find(t=>t.id===e.playerId);this.pending.push(t?{t:`profile`,player:structuredClone(t)}:{t:`notice`,level:`info`,text:`not_found`});return}case`like`:case`unlike`:{let t=this.near(e.buildingId,4);if(typeof t==`string`)return void this.pending.push({t:`notice`,level:`warn`,text:t});let n=e.t===`like`;!!t.likedByMe!==n&&(t.likes+=n?1:-1),t.likedByMe=n,this.pending.push({t:`like.update`,buildingId:t.id,likes:t.likes,likedByMe:n}),this.inside?.id===t.id&&Object.assign(this.inside.detail.building,{likes:t.likes,likedByMe:n});return}case`greet`:{if(!this.walkers.find(t=>t.id===e.playerId&&!this.hidden.has(t.id)))return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});let t=this.now();this.pending.push({t:`greeting`,from:N.id,to:e.playerId,greetingId:e.greetingId,until:t+5e3}),this.later.push({at:t+1200,msg:{t:`greeting`,from:e.playerId,to:N.id,greetingId:L[e.greetingId]??`wave`,until:t+6200}});return}case`stamp`:{let t=this.near(e.buildingId,2);if(typeof t==`string`)return void this.pending.push({t:`notice`,level:`warn`,text:t});if(this.stamped.has(t.id))return void this.pending.push({t:`notice`,level:`info`,text:`already_done`});this.stamped.add(t.id),this.pending.push({t:`notice`,level:`info`,text:`stamped`});return}case`knock`:{let t=this.near(e.buildingId,2);typeof t==`string`&&this.pending.push({t:`notice`,level:`warn`,text:t});return}case`teleport`:{let t=e.code===void 0?null:re(e.code),n;if(e.code!==void 0)n=t?this.buildings.find(e=>e.code===t&&!this.hidden.has(e.id)):void 0;else{let e=this.buildings.filter(e=>e.state===`online`&&e.id!==N.id&&!this.hidden.has(e.id));n=e[Math.floor(this.social()*e.length)]}if(!n)return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});let r=u(n.lot);this.me={x:r.front.x,y:r.front.y,dir:r.side,moving:!1},this.lastMoveAt=this.now(),this.afkSent=!1,this.pending.push({t:`pos`,x:r.front.x,y:r.front.y});for(let e of this.snapshot().chunks)this.pending.push({t:`area`,chunk:e.chunk,rev:e.rev,buildings:e.buildings});return}case`block`:{let t=this.walkers.find(t=>t.id===e.playerId);if(!t)return void this.pending.push({t:`notice`,level:`info`,text:`not_found`});this.hidden.add(t.id),this.pending.push({t:`player.leave`,id:t.id},{t:`notice`,level:`info`,text:`blocked_ok`});return}case`unblock`:{let t=this.walkers.find(t=>t.id===e.playerId);if(!t||!this.hidden.delete(t.id))return;this.pending.push({t:`player.join`,player:structuredClone(t)});return}case`resync`:for(let t of this.snapshot().chunks)(e.chunk===void 0||t.chunk===e.chunk)&&this.pending.push({t:`area`,chunk:t.chunk,rev:t.rev,buildings:t.buildings});return;case`view`:this.viewing=!0,Promise.resolve().then(()=>!this.closed&&this.listeners.emit({type:`snapshot`,snapshot:this.snapshot()}));return;case`view.off`:this.remember(),this.viewing=!1,this.inside=null;return;case`enter`:this.enter(e.buildingId);return;case`leave`:{let e=this.inside?this.buildings.find(e=>e.id===this.inside.id):void 0;if(this.inside=null,e){let t=u(e.lot);this.me={x:t.front.x,y:t.front.y,dir:t.side===`s`?`s`:`n`,moving:!1}}this.lastMoveAt=this.now(),this.pending.push({t:`pos`,x:this.me.x,y:this.me.y});for(let e of this.snapshot().chunks)this.pending.push({t:`area`,chunk:e.chunk,rev:e.rev,buildings:e.buildings});return}default:e.t===`report`&&this.pending.push({t:`notice`,level:`info`,text:`reported`}),e.t===`summary.seen`&&(this.summarySeen=!0);return}}enter(e){let t=this.buildings.find(t=>t.id===e);if(!t){this.pending.push({t:`notice`,level:`info`,text:`not_found`});return}let n=t.id===N.id,r=u(t.lot).front;if(!n&&Math.hypot(this.me.x-r.x,this.me.y-r.y)>te){this.pending.push({t:`notice`,level:`info`,text:`too_far`});return}if(!n&&t.closed){this.pending.push({t:`notice`,level:`info`,text:`closed`});return}let i=t.state===`away`?`away`:t.agents?`live`:`discreet`,a=x(i),{agents:o,...s}=t;a.building={...s,...a.building.agents?{agents:a.building.agents}:{},floors:a.floors.length,...i===`discreet`?{discreet:!0}:{}},a.visitors=n?0:2,this.inside={id:t.id,rev:1,detail:a,patches:0},this.pending.push({t:`building`,rev:1,detail:structuredClone(a)})}patchInside(){let e=this.inside;if(!e)return;if(e.patches++,e.patches%4==0){e.detail.visitors=e.detail.visitors>=3?2:e.detail.visitors+1,e.rev++,this.emit({t:`building.patch`,rev:e.rev,visitors:e.detail.visitors});return}if(e.detail.building.state!==`online`||e.detail.building.discreet)return;let t=M[e.patches%M.length];for(let n of e.detail.floors)for(let e of n.agents)t[e.name]&&(e.status=t[e.name]);e.rev++,this.emit({t:`building.patch`,rev:e.rev,floors:structuredClone(e.detail.floors)})}near(e,t){if(e===N.id)return`invalid`;let n=this.buildings.find(t=>t.id===e);if(!n)return`not_found`;if(this.inside?.id===e)return n;let r=u(n.lot).front;return Math.hypot(r.x-this.me.x,r.y-this.me.y)<=t+1e-9?n:`too_far`}emit(e){this.listeners.emit({type:`message`,msg:structuredClone(e)})}chunkOfBuilding(e){return v(A,s(a(e.lot)))}minimap(){let e=new Map;for(let t of this.buildings){let n=a(t.lot),r=`${n.x},${n.y}`;e.has(r)||e.set(r,{x:n.x,y:n.y,lit:0}),t.state===`online`&&e.get(r).lit++}return[...e.values()].sort((e,t)=>e.y-t.y||e.x-t.x)}};function ae(e){return e.mock?new $(e):new O(e)}export{S as CMD_BATCH_MS,N as FAKE_ME,F as FAKE_MY_CODE,$ as FakeWorldStream,O as HttpWorldStream,ae as createWorldStream,E as enqueueCommands,J as fakeBenchSeat,I as fakeBuildingCode,Q as fakeCityBuildings,X as fakeGoal,Y as fakeMyDoor,q as loopPosition};
@@ -32,7 +32,7 @@
32
32
  <meta name="apple-mobile-web-app-title" content="Busybits" />
33
33
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
34
34
  <style>html,body{background:#12151d;height:100%;margin:0;overflow:hidden}#world,#city,#visit{width:100vw;height:100vh;image-rendering:pixelated;display:block;position:fixed;inset:0}#world[hidden],#city[hidden],#visit[hidden]{display:none}#ui{pointer-events:none;position:fixed;inset:0}#ui>*{pointer-events:auto}</style>
35
- <script type="module" crossorigin src="/bundle/main-DNVSCypp.js"></script>
35
+ <script type="module" crossorigin src="/bundle/main-CJZNyhMz.js"></script>
36
36
  </head>
37
37
  <body>
38
38
  <canvas id="world"></canvas>
@@ -848,6 +848,8 @@ var EN = {
848
848
  "S\xF3 os seus prompts e as respostas finais do agente": "Only your prompts and the agent's final replies",
849
849
  "Sem ferramentas": "No tools",
850
850
  "Esconde as ferramentas e os resultados": "Hides tools and their results",
851
+ "Ferramentas resumidas": "Compact tools",
852
+ "Junta cada sequ\xEAncia de ferramentas numa linha; clique para abrir": "Joins each run of tools into one line; click to expand",
851
853
  // client/src/ui/timelapse.ts
852
854
  "Reproduzir": "Play",
853
855
  "Dia gravado": "Recorded day",
@@ -4585,6 +4587,8 @@ var ES = {
4585
4587
  "S\xF3 os seus prompts e as respostas finais do agente": "Solo tus prompts y las respuestas finales del agente",
4586
4588
  "Sem ferramentas": "Sin herramientas",
4587
4589
  "Esconde as ferramentas e os resultados": "Oculta las herramientas y los resultados",
4590
+ "Ferramentas resumidas": "Herramientas resumidas",
4591
+ "Junta cada sequ\xEAncia de ferramentas numa linha; clique para abrir": "Junta cada secuencia de herramientas en una l\xEDnea; haz clic para abrir",
4588
4592
  // client/src/ui/timelapse.ts
4589
4593
  "Reproduzir": "Reproducir",
4590
4594
  "Dia gravado": "D\xEDa grabado",
@@ -8273,6 +8277,8 @@ var FR = {
8273
8277
  "S\xF3 os seus prompts e as respostas finais do agente": "Seulement vos prompts et les r\xE9ponses finales de l'agent",
8274
8278
  "Sem ferramentas": "Sans outils",
8275
8279
  "Esconde as ferramentas e os resultados": "Masque les outils et les r\xE9sultats",
8280
+ "Ferramentas resumidas": "Outils r\xE9sum\xE9s",
8281
+ "Junta cada sequ\xEAncia de ferramentas numa linha; clique para abrir": "Regroupe chaque s\xE9rie d'outils en une ligne ; cliquez pour ouvrir",
8276
8282
  // client/src/ui/timelapse.ts
8277
8283
  "Reproduzir": "Lire",
8278
8284
  "Dia gravado": "Jour enregistr\xE9",
@@ -16226,6 +16232,13 @@ import { join as join6 } from "node:path";
16226
16232
  function str7(v) {
16227
16233
  return typeof v === "string" && v.trim() ? v.trim() : void 0;
16228
16234
  }
16235
+ function int(v) {
16236
+ return typeof v === "number" && Number.isInteger(v) && v >= 0 ? v : void 0;
16237
+ }
16238
+ function ticks(v) {
16239
+ if (typeof v === "string") return /^\d{1,15}$/.test(v) ? Number(v) : void 0;
16240
+ return int(v);
16241
+ }
16229
16242
  function num3(v) {
16230
16243
  return typeof v === "number" && Number.isFinite(v) ? v : void 0;
16231
16244
  }
@@ -16244,6 +16257,7 @@ function parseRegistryEntry(raw) {
16244
16257
  const e = { pid, sessionId, cwd };
16245
16258
  const optional = [
16246
16259
  ["startedAt", num3(j.startedAt)],
16260
+ ["procStart", ticks(j.procStart)],
16247
16261
  ["version", str7(j.version)],
16248
16262
  ["kind", str7(j.kind)],
16249
16263
  ["entrypoint", str7(j.entrypoint)],
@@ -16294,17 +16308,27 @@ var realProc = {
16294
16308
  var CLK_TCK = 100;
16295
16309
  var START_SLACK_MS = 5e3;
16296
16310
  var LONG_LIVED_MS = 10 * 6e4;
16297
- function processStartMs(pid, proc) {
16311
+ function processStartTicks(pid, proc) {
16298
16312
  const stat3 = proc.stat(pid);
16299
- const sys = proc.sysStat();
16300
- if (!stat3 || !sys) return void 0;
16313
+ if (!stat3) return void 0;
16301
16314
  const rest = stat3.slice(stat3.lastIndexOf(")") + 1).trim().split(/\s+/);
16302
- const ticks = Number.parseInt(rest[19] ?? "", 10);
16315
+ const ticks2 = Number.parseInt(rest[19] ?? "", 10);
16316
+ return Number.isFinite(ticks2) ? ticks2 : void 0;
16317
+ }
16318
+ function processStartMs(pid, proc) {
16319
+ const ticks2 = processStartTicks(pid, proc);
16320
+ const sys = proc.sysStat();
16321
+ if (ticks2 === void 0 || !sys) return void 0;
16303
16322
  const btime = /^btime\s+(\d+)/m.exec(sys)?.[1];
16304
- if (!Number.isFinite(ticks) || !btime) return void 0;
16305
- return (Number.parseInt(btime, 10) + ticks / CLK_TCK) * 1e3;
16323
+ if (!btime) return void 0;
16324
+ return (Number.parseInt(btime, 10) + ticks2 / CLK_TCK) * 1e3;
16306
16325
  }
16307
- function sameProcess(pid, startedAt2, proc) {
16326
+ function sameProcess(pid, startedAt2, proc, procStart) {
16327
+ if (procStart !== void 0) {
16328
+ const ticks2 = processStartTicks(pid, proc);
16329
+ if (ticks2 !== void 0) return ticks2 === procStart;
16330
+ }
16331
+ if (startedAt2 === void 0) return void 0;
16308
16332
  const start = processStartMs(pid, proc);
16309
16333
  if (start === void 0) return void 0;
16310
16334
  if (start > startedAt2 + START_SLACK_MS) return false;
@@ -16314,16 +16338,16 @@ function sameProcess(pid, startedAt2, proc) {
16314
16338
  return /claude/i.test(cmd);
16315
16339
  }
16316
16340
  var reusedCache = /* @__PURE__ */ new Map();
16317
- function pidAlive(pid, startedAt2, proc = realProc) {
16341
+ function pidAlive(pid, startedAt2, proc = realProc, procStart) {
16318
16342
  try {
16319
16343
  process.kill(pid, 0);
16320
16344
  } catch (err) {
16321
16345
  if (err.code === "ESRCH") return false;
16322
16346
  }
16323
- if (startedAt2 === void 0) return true;
16324
- const key = `${pid}:${startedAt2}`;
16347
+ if (startedAt2 === void 0 && procStart === void 0) return true;
16348
+ const key = `${pid}:${startedAt2}:${procStart}`;
16325
16349
  if (reusedCache.has(key)) return false;
16326
- if (sameProcess(pid, startedAt2, proc) === false) {
16350
+ if (sameProcess(pid, startedAt2, proc, procStart) === false) {
16327
16351
  if (reusedCache.size > 5e3) reusedCache.clear();
16328
16352
  reusedCache.set(key, true);
16329
16353
  return false;
@@ -16335,7 +16359,7 @@ var RegistryReader = class {
16335
16359
  this.configDir = configDir;
16336
16360
  this.opts = opts;
16337
16361
  this.sessionsDir = join6(configDir, "sessions");
16338
- this.isAlive = opts.isAlive ?? pidAlive;
16362
+ this.isAlive = opts.isAlive ?? ((pid, startedAt2, procStart) => pidAlive(pid, startedAt2, realProc, procStart));
16339
16363
  }
16340
16364
  configDir;
16341
16365
  opts;
@@ -16377,7 +16401,7 @@ var RegistryReader = class {
16377
16401
  }
16378
16402
  const e = cached.entry;
16379
16403
  if (!e) continue;
16380
- if (this.opts.checkPid && !this.isAlive(e.pid, e.startedAt)) continue;
16404
+ if (this.opts.checkPid && !this.isAlive(e.pid, e.startedAt, e.procStart)) continue;
16381
16405
  entries.push(e);
16382
16406
  }
16383
16407
  for (const file of [...this.cache.keys()]) if (!seen.has(file)) this.cache.delete(file);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "busybits",
3
3
  "displayName": "Busybits",
4
- "version": "2.5.0",
4
+ "version": "2.6.1",
5
5
  "description": "Connects the session to Busybits: records plan usage (5h and weekly) for the office, shows a line under the prompt when another session needs you, and adds the /busybits command.",
6
6
  "author": { "name": "Márcio Junior", "url": "https://github.com/marmottajr" },
7
7
  "homepage": "https://github.com/marmottajr/habblaud#readme",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "busybits-messages",
3
3
  "displayName": "Busybits: messages from the office",
4
- "version": "2.5.0",
4
+ "version": "2.6.1",
5
5
  "description": "Delivers to the Claude Code session the messages you type in Busybits (agent panel or terminal), as if you had typed them in the terminal.",
6
6
  "author": { "name": "Márcio Junior", "url": "https://github.com/marmottajr" },
7
7
  "homepage": "https://github.com/marmottajr/habblaud#readme",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "busybits-permissions",
3
3
  "displayName": "Busybits: permissions from the office",
4
- "version": "2.5.0",
4
+ "version": "2.6.1",
5
5
  "description": "PermissionRequest hook that lets you approve or deny Claude Code permission requests and answer AskUserQuestion prompts from Busybits; the dialog stays in the terminal and whichever answer comes first wins.",
6
6
  "author": { "name": "Márcio Junior", "url": "https://github.com/marmottajr" },
7
7
  "homepage": "https://github.com/marmottajr/habblaud#readme",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "habblaud-pi",
3
- "version": "2.5.0",
3
+ "version": "2.6.1",
4
4
  "private": true,
5
5
  "description": "Extensão do Pi / Gentle Shell para o Habblaud: recebe as mensagens do escritório e mostra quando o agente precisa de você.",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "busybits",
3
- "version": "2.5.0",
3
+ "version": "2.6.1",
4
4
  "description": "Animated pixel-art office that shows what your Claude Code, Codex and Pi agents are doing, live.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -42,6 +42,7 @@
42
42
  "build:server": "node scripts/build-server.mjs",
43
43
  "build:cli": "node scripts/build-cli.mjs",
44
44
  "start": "node dist/server/index.js",
45
+ "protocol:check": "node scripts/protocol-check.mjs",
45
46
  "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p server/tsconfig.json && tsc --noEmit -p client/.storybook/tsconfig.json",
46
47
  "test": "vitest run",
47
48
  "i18n:check": "tsx scripts/i18n-check.ts",