droidsembly 0.4.0-beta.3 → 0.4.0-beta.5

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 (75) hide show
  1. package/README.it.md +7 -6
  2. package/README.md +7 -6
  3. package/bin/cubefarm.js +2 -296
  4. package/bin/droidsembly.js +304 -0
  5. package/bin/environment.d.ts +3 -0
  6. package/bin/environment.js +48 -0
  7. package/dist/assets/AccessibilitySettings-vd4x_sEq.js +30 -0
  8. package/dist/assets/{AppViewer-0Bly3EdB.js → AppViewer-BB9lvg-4.js} +1 -1
  9. package/dist/assets/{Balloon-B6odnAlm.js → Balloon-CWEK5uK2.js} +1 -1
  10. package/dist/assets/{Batched-CTJWq46z.js → Batched-yAiB-c-b.js} +1 -1
  11. package/dist/assets/{Birds-DSS0OIz9.js → Birds-ClBZkA83.js} +1 -1
  12. package/dist/assets/{Blimp-CZt6dddK.js → Blimp-VHMnVBQt.js} +1 -1
  13. package/dist/assets/{BufferGeometryUtils-CmpUrBC5.js → BufferGeometryUtils-B4Tnxtjb.js} +1 -1
  14. package/dist/assets/{Duck-BnRLkodp.js → Duck-CCThHMtF.js} +1 -1
  15. package/dist/assets/{Effects-Bkewth1L.js → Effects-BZfFy3yq.js} +1 -1
  16. package/dist/assets/{Fireworks-Cvn8YKWd.js → Fireworks-CxvvEwV_.js} +1 -1
  17. package/dist/assets/{Helicopter-BDrFQMNX.js → Helicopter-DXHDrTnQ.js} +1 -1
  18. package/dist/assets/{Hurricane-C8hyFXjx.js → Hurricane-WXNUxoUz.js} +1 -1
  19. package/dist/assets/{Kaiju-Bxxe9DG0.js → Kaiju-D-wVgKo-.js} +1 -1
  20. package/dist/assets/{Meteors-UdYL0Tbv.js → Meteors-DSr-7bEl.js} +1 -1
  21. package/dist/assets/{MissionConsole-DJRtojZP.js → MissionConsole-4G02S89d.js} +1 -1
  22. package/dist/assets/{Office-9Mank16i.js → Office-B_EroD2U.js} +44 -44
  23. package/dist/assets/{PhotoPanel-C_njIXp0.js → PhotoPanel-ByzwApow.js} +1 -1
  24. package/dist/assets/{PhotoScene-DwpeJjGe.js → PhotoScene-CW3yZkqH.js} +3 -3
  25. package/dist/assets/{Plane-DzvUAUYE.js → Plane-CT7-QFbA.js} +1 -1
  26. package/dist/assets/Pocket-B0o4siMl.js +2 -0
  27. package/dist/assets/{Rainbow-CV1rD6rW.js → Rainbow-DNvXfTl9.js} +1 -1
  28. package/dist/assets/{Roof-DSpKcGXK.js → Roof-yLX0ZK0x.js} +1 -1
  29. package/dist/assets/{Shell-GaQY3zre.js → Shell-lZOZ3aG8.js} +2 -2
  30. package/dist/assets/{Skywriting-D4B2ZvH7.js → Skywriting-N1GDZKYR.js} +1 -1
  31. package/dist/assets/TerminalView-cUAMhOxM.js +17 -0
  32. package/dist/assets/{ToyWorld-DeQUxcuy.js → ToyWorld-BYE8776A.js} +1 -1
  33. package/dist/assets/{Ufo-CitoxReu.js → Ufo-D_Wt75n1.js} +1 -1
  34. package/dist/assets/{Whale-Btx5ph-T.js → Whale-Kkz3B36R.js} +1 -1
  35. package/dist/assets/all-BMItClgN.js +11 -0
  36. package/dist/assets/{bloomMarks-DRhDp19k.js → bloomMarks-C22qSi5d.js} +1 -1
  37. package/dist/assets/{cheerRules-DWb8Qwzg.js → cheerRules-G9WFRB4C.js} +1 -1
  38. package/dist/assets/{cityLayout-aA2Ktgpu.js → cityLayout-C8f5-bpM.js} +1 -1
  39. package/dist/assets/{dogState-DY7tJEVD.js → dogState-9uong8D8.js} +1 -1
  40. package/dist/assets/{doors-BlKvxXVp.js → doors-DsKuGpOi.js} +1 -1
  41. package/dist/assets/{gallery-COKuWb9E.js → gallery-DSKvNkBq.js} +1 -1
  42. package/dist/assets/gate-D6_NXB1w.js +2 -0
  43. package/dist/assets/index-rznd4Djx.js +10 -0
  44. package/dist/assets/{instantReplay-BjoV6jrY.js → instantReplay-CiWMru53.js} +1 -1
  45. package/dist/assets/{interact-0jqx03Xr.js → interact-Bt-XX-z4.js} +1 -1
  46. package/dist/assets/{jsx-runtime-CXW0f58S.js → jsx-runtime-CZP6s5wa.js} +1 -1
  47. package/dist/assets/{kit-n-eqZ1AT.js → kit-CZEafHnz.js} +1 -1
  48. package/dist/assets/mic-DeYDrNoY.js +1 -0
  49. package/dist/assets/{photoMode-BybFMLKC.js → photoMode-BTxq9-gL.js} +1 -1
  50. package/dist/assets/{pipeline-BGPWXegt.js → pipeline-DNe3sjnP.js} +1 -1
  51. package/dist/assets/{rapier-CrXmTSyE.js → rapier-C-KFR0AR.js} +1 -1
  52. package/dist/assets/{rig-DfdntE8m.js → rig-B88WinIa.js} +1 -1
  53. package/dist/assets/{speechLanguage-DfsQvU9M.js → speechLanguage-Bq3BAswq.js} +1 -1
  54. package/dist/assets/store-9CvxLGNQ.js +5 -0
  55. package/dist/assets/useDayTime-Nrdy7kH1.js +1 -0
  56. package/dist/assets/useGraphics-Bhnj8CAm.js +1 -0
  57. package/dist/assets/voiceMessages-BF3P4sjw.js +1 -0
  58. package/dist/assets/{weatherState-BJVm5hU-.js → weatherState-CufaxiyU.js} +1 -1
  59. package/dist/index.html +3 -3
  60. package/dist-server/index.js +1251 -494
  61. package/dist-server/index.js.map +4 -4
  62. package/dist-server/ptyHost.js +6 -2
  63. package/dist-server/ptyHost.js.map +2 -2
  64. package/package.json +2 -2
  65. package/dist/assets/AccessibilitySettings-HB1JfQbh.js +0 -30
  66. package/dist/assets/Pocket-A1iI6Ivy.js +0 -2
  67. package/dist/assets/TerminalView-DhmLqjYn.js +0 -17
  68. package/dist/assets/all-gw-szDg1.js +0 -11
  69. package/dist/assets/gate-D0uU0wv5.js +0 -2
  70. package/dist/assets/index-CDJgPTOC.js +0 -10
  71. package/dist/assets/mic-BnAa4E99.js +0 -1
  72. package/dist/assets/store-CXLtXw8e.js +0 -5
  73. package/dist/assets/useDayTime-BjBDzh_t.js +0 -1
  74. package/dist/assets/useGraphics-Bg6L4EdS.js +0 -1
  75. package/dist/assets/voiceMessages-CFLyZLZ4.js +0 -1
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalView-DhmLqjYn.js","assets/rolldown-runtime-XKyaHtl9.js","assets/jsx-runtime-CXW0f58S.js","assets/index-CDJgPTOC.js","assets/store-CXLtXw8e.js","assets/index-COpmc42S.css","assets/AccessibilitySettings-HB1JfQbh.js","assets/mic-BnAa4E99.js","assets/jukeboxSongs-CUwHJ1cS.js","assets/AccessibilitySettings-HrzBDUTN.css","assets/bloomMarks-DRhDp19k.js","assets/BufferGeometryUtils-CmpUrBC5.js","assets/Batched-CTJWq46z.js","assets/rig-DfdntE8m.js","assets/TerminalView-BrP-ENHg.css","assets/AppViewer-0Bly3EdB.js","assets/MissionConsole-DJRtojZP.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{s as t,t as n}from"./jsx-runtime-CXW0f58S.js";import{O as r,a as i,c as a,l as o,o as s,s as c}from"./index-CDJgPTOC.js";import{At as l,a as u,d,ds as f,li as p,m,p as h,t as g}from"./store-CXLtXw8e.js";import{C as _,I as v,N as y,a as b,b as x,c as S,f as C,g as w,i as T,n as E,o as D,p as O,r as k,s as A,t as j,u as M,v as N}from"./AccessibilitySettings-HB1JfQbh.js";var P=e(t(),1),F=n();function I({repo:e,qa:t,ready:n}){let r=c(),i=h(e=>t.devAgentId?e.agents[t.devAgentId]:void 0),l=h(e=>e.settings.language),[u,d]=(0,P.useState)(!1),p=e.pulls.find(e=>e.number===t.prNumber);if(!p)return null;let{note:m,tone:g}=f(t,p,e.autoMerge,l),_=async e=>{d(!0);try{await e()}catch{}finally{d(!1)}},v=async()=>{await o(n?{icon:`🎉`,title:r(`Merge PR #{number}?`,{number:p.number}),body:r(`“{title}” passed QA. It will be squash-merged into {branch}.`,{title:p.title,branch:e.defaultBranch}),confirm:r(`Squash & merge`)}:{tone:`warn`,title:r(`Merge PR #{number} without QA?`,{number:p.number}),body:r(`“{title}” has not passed QA yet. Merge it into {branch} anyway?`,{title:p.title,branch:e.defaultBranch}),confirm:r(`Merge anyway`)})&&await _(()=>a.mergePull(e.id,p.number))},y=async()=>{let t=``;await o({icon:`🔧`,title:r(`Send PR #{number} back for a fix?`,{number:p.number}),body:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{children:(0,F.jsx)(s,{children:`Its author, or any free agent, fixes it with QA’s findings, then it’s tested once more.`})}),(0,F.jsx)(`input`,{maxLength:1e3,placeholder:r(`Optional note for whoever fixes it`),"aria-label":r(`Note for whoever fixes it`),onChange:e=>t=e.target.value})]}),confirm:r(`Send back`)})&&await _(()=>a.sendBack(e.id,p.number,t.trim()||void 0))},b=async()=>{await o({tone:`danger`,title:r(`Close PR #{number}?`,{number:p.number}),body:r(`“{title}” will be closed without merging. The branch stays on GitHub.`,{title:p.title}),confirm:r(`Close PR`)})&&await _(()=>a.closePull(e.id,p.number))};return(0,F.jsxs)(`div`,{className:`pk-card pk-pr kcard-${g??`plain`}`,style:{"--accent":e.color},children:[(0,F.jsxs)(`div`,{className:`pk-pr-head`,children:[(0,F.jsx)(`span`,{className:`floor-badge`,children:e.floor}),(0,F.jsxs)(`div`,{className:`grow`,children:[(0,F.jsx)(`a`,{href:p.url,target:`_blank`,rel:`noreferrer`,children:(0,F.jsxs)(`b`,{children:[`PR #`,p.number]})}),` `,p.title,(0,F.jsxs)(`div`,{className:`muted small`,children:[e.fullName.split(`/`)[1],i?` · ${r(`by {name}`,{name:i.name})}`:``,` · `,r(`round {number}`,{number:t.round}),` · `,m]})]})]}),t.summary&&(0,F.jsx)(`div`,{className:`small pk-pr-summary`,children:t.summary}),t.commentUrl&&(0,F.jsx)(`a`,{className:`small`,href:t.commentUrl,target:`_blank`,rel:`noreferrer`,children:(0,F.jsx)(s,{children:`QA report ↗`})}),(0,F.jsxs)(`div`,{className:`pk-actions`,children:[!n&&(0,F.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:u,onClick:()=>void _(()=>a.sendToQa(e.id,p.number)),children:(0,F.jsx)(s,{children:`Retry QA`})}),!n&&(0,F.jsx)(`button`,{className:`btn btn-small`,disabled:u,onClick:()=>void y(),children:(0,F.jsx)(s,{children:`Send back`})}),(0,F.jsx)(`button`,{className:`btn btn-small ${n?`btn-good`:``}`,disabled:u||p.isDraft,onClick:()=>void v(),children:r(n?`Merge`:`Merge anyway`)}),(0,F.jsx)(`button`,{className:`btn btn-small btn-ghost`,disabled:u,onClick:()=>void b(),children:(0,F.jsx)(s,{children:`Close`})})]})]})}function L(){let e=h(e=>e.repos),t=h(e=>e.qa),n=h(e=>e.requests),r=A(e,t,n),i=r.requests.length+r.stuck.length+r.ready.length===0;return(0,F.jsxs)(`div`,{className:`pk-page`,children:[i&&(0,F.jsx)(`p`,{className:`pk-empty`,children:(0,F.jsx)(s,{children:`Nothing waits on you. The team carries on, and your phone hears when that changes.`})}),r.requests.length>0&&(0,F.jsx)(`h3`,{className:`pk-h`,children:(0,F.jsx)(s,{children:`👥 Team changes`})}),r.requests.map(e=>(0,F.jsx)(_,{req:e},e.id)),r.stuck.length>0&&(0,F.jsx)(`h3`,{className:`pk-h`,children:(0,F.jsx)(s,{children:`⚠️ Pull requests that need you`})}),r.stuck.map(e=>(0,F.jsx)(I,{repo:e.repo,qa:e.qa},`${e.repo.id}#${e.qa.prNumber}`)),r.ready.length>0&&(0,F.jsx)(`h3`,{className:`pk-h`,children:(0,F.jsx)(s,{children:`✅ Ready to merge`})}),r.ready.map(e=>(0,F.jsx)(I,{repo:e.repo,qa:e.qa,ready:!0},`${e.repo.id}#${e.qa.prNumber}`))]})}var R={idle:`free`,preparing:`setting up`,working:`working`,done:`done`,error:`needs help`,stopped:`stopped`};function z({status:e}){let t=c();return(0,F.jsx)(`span`,{className:`status status-${e}`,children:t(R[e]??e)})}function B(){let[e,t]=(0,P.useState)(!1);return[e,async e=>{t(!0);try{return await e(),!0}catch{return!1}finally{t(!1)}}]}function V({agent:e,repo:t}){let n=c(),r=h(e=>e.agents),i=h(e=>e.qa),o=h(e=>e.settings),d=h(e=>e.clis),f=h(e=>e.openOverlay),p=(0,P.useMemo)(()=>u(t,g(r,t.id),i),[t,r,i]),[m,_]=B(),[y,x]=(0,P.useState)(``),[S,C]=(0,P.useState)(!1),[D,O]=(0,P.useState)(``),k=E(e),A=T(p),j=A.find(e=>e.key===y),M=e.status===`working`||e.status===`preparing`,I=N(e,o),L=async()=>{let t=D.trim();t&&await _(()=>a.message(e.id,t))&&(O(``),C(!1))};return(0,F.jsxs)(`div`,{className:`pk-card pk-agent ${e.status===`error`?`pk-agent-bad`:``}`,children:[(0,F.jsxs)(`div`,{className:`pk-agent-head`,children:[(0,F.jsx)(`span`,{className:`avatar`,style:{background:e.color},children:e.name[0]}),(0,F.jsxs)(`div`,{className:`grow`,children:[(0,F.jsx)(`b`,{children:e.name}),` `,(0,F.jsx)(`span`,{className:`muted small`,children:w(e,o,d)}),(0,F.jsxs)(`div`,{className:`small pk-ellipsis`,children:[b(e,o.language),M&&e.currentTool?(0,F.jsxs)(`span`,{className:`muted`,children:[` · `,n(l(e.currentTool)||e.currentTool),`…`]}):null]})]}),(0,F.jsx)(z,{status:e.status})]}),e.lastError&&!M&&(0,F.jsxs)(`div`,{className:`term-error small pk-error`,children:[`⚠️ `,e.lastError]}),I&&(0,F.jsxs)(`div`,{className:`small pk-sign-in`,children:[`🔑 `,n(`Waiting for you to sign {provider} in, in their terminal`,{provider:I}),`.`]}),(0,F.jsxs)(`div`,{className:`pk-actions`,children:[I&&(0,F.jsx)(`button`,{className:`btn btn-small btn-good`,onClick:()=>f({kind:`terminal`,agentId:e.id}),children:(0,F.jsx)(s,{children:`🔑 Sign in`})}),k.stop&&(0,F.jsx)(`button`,{className:`btn btn-small btn-bad`,disabled:m,onClick:()=>void _(()=>a.stop(e.id)),children:(0,F.jsx)(s,{children:`■ Stop`})}),k.assign&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`select`,{className:`pk-assign`,value:y,"aria-label":n(`Give {name} an issue or a pull request to test`,{name:e.name}),onChange:e=>x(e.target.value),disabled:m||A.length===0,children:[(0,F.jsx)(`option`,{value:``,children:n(A.length?`Pick an issue or a PR…`:`Nothing to pick up`)}),A.map(e=>(0,F.jsxs)(`option`,{value:e.key,children:[e.kind===`qa`?`🔍 PR `:``,`#`,e.number,` `,e.title]},e.key))]}),(0,F.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:m||!j,onClick:()=>j&&void _(()=>j.kind===`qa`?a.sendToQa(t.id,j.number,e.id):a.assign(e.id,j.number)).then(e=>e&&x(``)),children:n(j?.kind===`qa`?`🔍 Test`:`▶ Start`)})]}),k.clear&&(0,F.jsx)(`button`,{className:`btn btn-small`,disabled:m,onClick:()=>void _(()=>a.reset(e.id)),children:(0,F.jsx)(s,{children:`↺ Clear desk`})}),k.message&&(0,F.jsx)(`button`,{className:`btn btn-small ${S?`btn-ghost`:``}`,"aria-expanded":S,onClick:()=>C(!S),children:(0,F.jsx)(s,{children:`💬 Message`})}),(0,F.jsx)(`button`,{className:`btn btn-small btn-ghost`,onClick:()=>f({kind:`terminal`,agentId:e.id}),children:(0,F.jsx)(s,{children:`Terminal`})})]}),S&&k.message&&(0,F.jsxs)(`form`,{className:`pk-msg`,onSubmit:e=>{e.preventDefault(),L()},children:[(0,F.jsx)(v,{value:D,onChange:O,autoFocus:!0,"aria-label":n(`Message {name}`,{name:e.name}),placeholder:n(M?`Tell {name} something while they work…`:`Ask {name} for a follow-up…`,{name:e.name})}),(0,F.jsx)(`button`,{className:`btn btn-small btn-good`,disabled:m||!D.trim(),children:(0,F.jsx)(s,{children:`Send`})})]})]})}function H(){let e=c(),t=h(e=>e.agents.ceo),n=h(e=>e.ceo),[r,i]=B();if(!t)return null;let o=t.status===`working`;return(0,F.jsxs)(`div`,{className:`pk-card pk-agent`,children:[(0,F.jsxs)(`div`,{className:`pk-agent-head`,children:[(0,F.jsx)(`span`,{className:`avatar`,style:{background:t.color},children:t.name[0]}),(0,F.jsxs)(`div`,{className:`grow`,children:[(0,F.jsx)(`b`,{children:t.name}),` `,(0,F.jsx)(`span`,{className:`muted small`,children:`CEO`}),(0,F.jsx)(`div`,{className:`small pk-ellipsis`,children:o?n.job?.label??e(`Working`):n.queue.length?e(`Up next: {jobs}`,{jobs:n.queue.map(e=>e.label).join(` → `)}):e(`Free`)})]}),(0,F.jsx)(z,{status:t.status})]}),o&&(0,F.jsx)(`div`,{className:`pk-actions`,children:(0,F.jsx)(`button`,{className:`btn btn-small btn-bad`,disabled:r,onClick:()=>void i(()=>a.stop(t.id)),children:(0,F.jsx)(s,{children:`■ Stop`})})})]})}function U({focusRepo:e}){let t=c(),n=h(e=>e.repos),r=h(e=>e.agents),i=(0,P.useRef)(null);return(0,P.useEffect)(()=>i.current?.scrollIntoView({block:`start`}),[]),(0,F.jsxs)(`div`,{className:`pk-page`,children:[(0,F.jsx)(H,{}),n.length===0&&(0,F.jsx)(`p`,{className:`muted`,children:(0,F.jsx)(s,{children:`No floors yet, so no team.`})}),n.map(n=>{let a=g(r,n.id);return(0,F.jsxs)(`section`,{ref:n.id===e?i:void 0,className:`pk-section`,style:{"--accent":n.color},children:[(0,F.jsxs)(`h3`,{className:`pk-h`,children:[(0,F.jsx)(`span`,{className:`floor-badge`,children:n.floor}),` `,n.fullName.split(`/`)[1],(0,F.jsxs)(`span`,{className:`muted small`,children:[` · `,t(a.length===1?`{count} agent`:`{count} agents`,{count:a.length})]})]}),a.length===0&&(0,F.jsx)(`p`,{className:`muted small`,children:(0,F.jsx)(s,{children:`Nobody works here yet.`})}),a.map(e=>(0,F.jsx)(V,{agent:e,repo:n},e.id))]},n.id)})]})}var W=(0,P.lazy)(()=>m(()=>import(`./TerminalView-DhmLqjYn.js`).then(e=>e.r).then(e=>({default:e.TerminalView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),G=(0,P.lazy)(()=>m(()=>import(`./AppViewer-0Bly3EdB.js`).then(e=>e.n).then(e=>({default:e.AppViewer})),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9]))),K=(0,P.lazy)(()=>m(()=>import(`./MissionConsole-DJRtojZP.js`).then(e=>e.t).then(e=>({default:e.UsageCard})),__vite__mapDeps([16,1,2,4,3,5]))),q=[`company`,`chat`,`kanban`,`team`,`approvals`];function J(e){let t=e?new URL(e,location.origin).searchParams.get(`tab`):null;return q.includes(t)?t:null}var Y=e=>e.split(`/`)[1]??e;function X(){h.getState().openOverlay(null),r(`office`)}var Z=[[`building`,`🔨`,`Building`],[`qa`,`🔍`,`QA`],[`fixing`,`🔧`,`Fixing`],[`ready`,`✅`,`Ready`],[`needsYou`,`⚠️`,`Needs you`]];function Q(){let e=c(),t=h(e=>e.connected),n=h(e=>e.loaded),r=h(e=>e.usage),i=h(e=>e.restarting?`⟳ The office is restarting…`:p(e.officeUpdate,e.settings.language)),a=r.until?new Date(r.until).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null;return(0,F.jsxs)(F.Fragment,{children:[!t&&(0,F.jsx)(`div`,{className:`pk-banner pk-banner-bad`,children:e(n?`📡 Reconnecting to the office…`:`📡 Connecting to the office…`)}),r.state===`paused`&&(0,F.jsxs)(`div`,{className:`pk-banner pk-banner-bad`,children:[(0,F.jsx)(s,{children:`⏸ Claude’s usage limit was reached: no new work starts`}),a?e(` until {time}`,{time:a}):``,`.`]}),r.state===`pacing`&&(0,F.jsxs)(`div`,{className:`pk-banner`,children:[(0,F.jsx)(s,{children:`🐢 Pacing new work after a usage warning`}),a?e(` until {time}`,{time:a}):``,`.`]}),i&&(0,F.jsx)(`div`,{className:`pk-banner`,children:e(i)})]})}function $({go:e}){let t=c(),n=h(e=>e.repos),r=h(e=>e.agents),i=h(e=>e.qa),a=h(e=>e.requests),o=h(e=>e.ceo),l=h(e=>e.demo),d=h(e=>e.version),f=r.ceo,p=(0,P.useMemo)(()=>n.map(e=>{let t=g(r,e.id);return{repo:e,team:t.length,busy:t.filter(e=>e.status===`working`||e.status===`preparing`).length,p:D(u(e,t,i))}}),[n,r,i]),m=k(A(n,i,a));return(0,F.jsxs)(`div`,{className:`pk-page`,children:[(0,F.jsx)(Q,{}),m>0&&(0,F.jsxs)(`button`,{className:`pk-callout`,onClick:()=>e(`approvals`),children:[(0,F.jsxs)(`span`,{children:[`⚠️ `,t(m===1?`{count} decision waiting on you`:`{count} decisions waiting on you`,{count:m})]}),(0,F.jsx)(`span`,{children:(0,F.jsx)(s,{children:`Approvals →`})})]}),f&&(0,F.jsxs)(`div`,{className:`pk-card pk-ceo`,children:[(0,F.jsx)(`span`,{className:`avatar`,style:{background:f.color},children:f.name[0]}),(0,F.jsxs)(`div`,{className:`grow`,children:[(0,F.jsx)(`b`,{children:f.name}),` `,(0,F.jsx)(`span`,{className:`muted small`,children:`CEO`}),(0,F.jsx)(`div`,{className:`small`,children:f.status===`working`?o.job?.label??t(`Working`):o.queue.length?t(`Next: {job}`,{job:o.queue[0].label}):t(`Free`)})]}),(0,F.jsx)(`button`,{className:`btn btn-small`,onClick:()=>e(`chat`),children:(0,F.jsx)(s,{children:`💬 Chat`})})]}),p.length===0&&(0,F.jsx)(`p`,{className:`muted`,children:(0,F.jsx)(s,{children:`No projects yet. Connect a repo from the manager’s console in the 3D office.`})}),p.map(({repo:n,team:r,busy:i,p:a})=>(0,F.jsxs)(`div`,{className:`pk-card pk-floor`,style:{"--accent":n.color},children:[(0,F.jsxs)(`div`,{className:`pk-floor-head`,children:[(0,F.jsx)(`span`,{className:`floor-badge`,children:n.floor}),(0,F.jsxs)(`div`,{className:`grow`,children:[(0,F.jsx)(`b`,{className:`pk-floor-name`,children:Y(n.fullName)}),(0,F.jsx)(`div`,{className:`muted small pk-ellipsis`,children:n.summary||n.description||n.fullName})]})]}),(0,F.jsx)(`div`,{className:`pk-pipeline`,role:`list`,"aria-label":t(`Floor {floor} pipeline`,{floor:n.floor}),children:Z.map(([e,n,r])=>(0,F.jsxs)(`div`,{role:`listitem`,className:`pk-stage ${a[e]?``:`pk-stage-zero`} ${e===`needsYou`&&a[e]?`pk-stage-hot`:``}`,children:[(0,F.jsxs)(`span`,{className:`pk-stage-n`,children:[(0,F.jsx)(`span`,{className:`pk-stage-icon`,"aria-hidden":!0,children:n}),a[e]]}),(0,F.jsx)(`span`,{className:`pk-stage-label`,children:t(r)})]},e))}),(0,F.jsxs)(`div`,{className:`pk-floor-foot small`,children:[(0,F.jsx)(`span`,{className:`muted`,children:t(`👥 {team} · {busy} busy · 📋 {backlog} in backlog`,{team:r,busy:i,backlog:a.backlog})}),(0,F.jsx)(`span`,{className:`spacer`}),(0,F.jsx)(`button`,{className:`btn btn-small`,onClick:()=>e(`kanban`,n.id),children:(0,F.jsx)(s,{children:`Board`})}),(0,F.jsx)(`button`,{className:`btn btn-small`,onClick:()=>e(`team`,n.id),children:(0,F.jsx)(s,{children:`Team`})})]})]},n.id)),(0,F.jsx)(`button`,{className:`btn pk-wide`,onClick:X,children:(0,F.jsx)(s,{children:`🏢 Open the 3D office`})}),l&&(0,F.jsx)(`div`,{className:`pk-center small muted`,children:(0,F.jsx)(s,{children:`DEMO MODE: fake repos, fake agents`})}),d&&(0,F.jsxs)(`div`,{className:`pk-center small muted`,children:[`Droidsembly `,d]})]})}function ee({repoId:e,pick:t}){let n=c(),r=h(e=>e.repos),i=r.some(t=>t.id===e)?e:r[0]?.id;return i?(0,F.jsxs)(`div`,{className:`pk-page`,children:[r.length>1&&(0,F.jsx)(`div`,{className:`pk-chips`,role:`tablist`,"aria-label":n(`Floor`),children:r.map(e=>(0,F.jsxs)(`button`,{role:`tab`,"aria-selected":e.id===i,className:`pk-chip ${e.id===i?`pk-chip-on`:``}`,style:{"--accent":e.color},onClick:()=>t(e.id),children:[e.floor,` · `,Y(e.fullName)]},e.id))}),(0,F.jsx)(M,{repoId:i,embedded:!0},i)]}):(0,F.jsx)(`p`,{className:`muted pk-page`,children:(0,F.jsx)(s,{children:`No projects yet.`})})}function te(){let e=h(e=>e.toasts),t=h(e=>e.dismissToast);return(0,F.jsx)(`div`,{className:`toasts`,children:e.slice(-2).map(e=>(0,F.jsx)(`div`,{className:`toast toast-${e.level}`,onClick:()=>t(e.id),children:e.text},e.id))})}function ne(){let e=h(e=>e.overlay);return e?.kind===`terminal`&&e.agentId!==`ceo`?(0,F.jsx)(W,{agentId:e.agentId}):e?.kind===`app`?(0,F.jsx)(G,{repoId:e.repoId}):null}function re({onClose:e}){let t=c();return(0,F.jsxs)(y,{title:t(`⚙️ This device and notifications`),onClose:e,className:`pk-settings`,children:[(0,F.jsx)(`div`,{className:`card`,children:(0,F.jsx)(i,{})}),(0,F.jsx)(P.Suspense,{fallback:null,children:(0,F.jsx)(K,{hot:!1})}),(0,F.jsx)(O,{}),(0,F.jsx)(S,{}),(0,F.jsx)(j,{pocket:!0}),(0,F.jsxs)(`div`,{className:`card`,children:[(0,F.jsx)(`h3`,{children:(0,F.jsx)(s,{children:`📱 Pocket mode`})}),(0,F.jsxs)(`p`,{className:`muted small`,children:[(0,F.jsx)(s,{children:`This is the office without the 3D building, for phones and touch screens. It’s picked on its own on small or touch screens; this device remembers what you last chose. To reach the office from your phone safely, see`}),` `,(0,F.jsx)(`a`,{href:`https://github.com/leonvanzyl/cubefarm/blob/main/docs/pocket.md`,children:`docs/pocket.md`}),`.`]}),(0,F.jsx)(`button`,{className:`btn`,onClick:X,children:(0,F.jsx)(s,{children:`🏢 Open the 3D office`})})]})]})}function ie(){let e=c(),[t,n]=(0,P.useState)(()=>J(location.href)??`company`),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(!1),l=h(e=>e.settings.companyName),u=h(e=>e.loaded),f=h(e=>e.settings.setupDone),p=h(e=>d(e.messages,e.phoneReadAt)),m=h(e=>k(A(e.repos,e.qa,e.requests))),g=h(e=>e.agents.ceo?.name??`CEO`),_=h(e=>e.usage.state),v=h(e=>e.connected),y=(e,t)=>{t&&i(t),n(e)};(0,P.useEffect)(()=>{let e=e=>{let t=J(e.detail);t&&n(t)};return window.addEventListener(`cubefarm:open`,e),()=>window.removeEventListener(`cubefarm:open`,e)},[]),(0,P.useEffect)(()=>{let e=h.getState();t===`chat`?e.openOverlay({kind:`phone`,tab:`chat`}):e.overlay?.kind===`phone`&&e.openOverlay(null)},[t]),(0,P.useEffect)(()=>(document.title=`${l?`${l} · `:``}Droidsembly · pocket`,()=>void(document.title=`Droidsembly`)),[l]);let b=[[`company`,`📊`,`Company`,0],[`chat`,`💬`,g,t===`chat`?0:p],[`kanban`,`📋`,`Kanban`,0],[`team`,`👥`,`Team`,0],[`approvals`,`✋`,`Approvals`,m]];return(0,F.jsxs)(`div`,{className:`pocket`,children:[(0,F.jsxs)(`header`,{className:`pk-head`,children:[(0,F.jsx)(C,{}),(0,F.jsx)(`b`,{className:`pk-title`,children:l||`Droidsembly`}),(0,F.jsx)(`span`,{className:`pk-dot ${v?`pk-dot-on`:``}`,title:e(v?`Connected`:`Not connected`)}),(0,F.jsx)(`span`,{className:`spacer`}),_!==`normal`&&(0,F.jsx)(`span`,{className:`chip chip-warn`,children:e(_===`paused`?`⏸ paused`:`🐢 pacing`)}),(0,F.jsx)(`button`,{className:`pk-icon-btn`,onClick:()=>o(!0),"aria-label":e(`Settings and notifications`),title:e(`Settings and notifications`),children:`⚙️`})]}),(0,F.jsx)(`main`,{className:`pk-main ${t===`chat`?`pk-main-chat`:``}`,children:u&&!f?(0,F.jsxs)(`div`,{className:`pk-page`,children:[(0,F.jsx)(`p`,{children:(0,F.jsx)(s,{children:`The office isn’t set up yet. Finish the setup in the 3D office (on a computer is easiest), then come back.`})}),(0,F.jsx)(`button`,{className:`btn`,onClick:X,children:(0,F.jsx)(s,{children:`🏢 Open the 3D office`})})]}):(0,F.jsxs)(F.Fragment,{children:[t===`company`&&(0,F.jsx)($,{go:y}),t===`chat`&&(0,F.jsx)(x,{autoFocus:!1}),t===`kanban`&&(0,F.jsx)(ee,{repoId:r,pick:i}),t===`team`&&(0,F.jsx)(U,{focusRepo:r}),t===`approvals`&&(0,F.jsx)(L,{})]})}),(0,F.jsx)(`nav`,{className:`pk-tabs`,"aria-label":e(`Pocket office`),children:b.map(([r,i,a,o])=>(0,F.jsxs)(`button`,{className:`pk-tab ${t===r?`pk-tab-on`:``}`,"aria-current":t===r?`page`:void 0,onClick:()=>n(r),children:[(0,F.jsxs)(`span`,{className:`pk-tab-icon`,children:[i,o>0&&(0,F.jsx)(`span`,{className:`badge badge-dot`,children:o})]}),(0,F.jsx)(`span`,{className:`pk-tab-label`,children:r===`chat`?a:e(a)})]},r))}),(0,F.jsx)(te,{}),(0,F.jsx)(P.Suspense,{fallback:null,children:(0,F.jsx)(ne,{})}),a&&(0,F.jsx)(re,{onClose:()=>o(!1)})]})}export{ie as default};