codeharden 2026.1122.2133 → 2026.1122.2302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -3
- package/dist/{args-B0i5tyjE.js → args-BJ0ric8X.js} +5 -5
- package/dist/args-BJ0ric8X.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{commands-CvAvyECH.js → commands-BPobEsBP.js} +33 -14
- package/dist/commands-BPobEsBP.js.map +1 -0
- package/dist/{env-wDgRchH9.js → env-CMkse2o0.js} +2 -2
- package/dist/{env-wDgRchH9.js.map → env-CMkse2o0.js.map} +1 -1
- package/dist/{harden-channel-2IT0Y7p3.js → harden-channel-D7h06kQ_.js} +41 -3
- package/dist/harden-channel-D7h06kQ_.js.map +1 -0
- package/dist/{launcher-D17oQovS.js → launcher-CvQZcEIC.js} +3 -3
- package/dist/launcher-CvQZcEIC.js.map +1 -0
- package/dist/{lock-DxXcNd2w.js → lock-iovTSSb0.js} +2 -2
- package/dist/{lock-DxXcNd2w.js.map → lock-iovTSSb0.js.map} +1 -1
- package/dist/{main-BRHfJHGf.js → main-BFo94KOF.js} +6 -6
- package/dist/{main-BRHfJHGf.js.map → main-BFo94KOF.js.map} +1 -1
- package/dist/{main-CJdbWeA_.js → main-B_ui4G93.js} +3 -3
- package/dist/{main-CJdbWeA_.js.map → main-B_ui4G93.js.map} +1 -1
- package/dist/{mediaType-e66mt7Cb.js → mediaType-DHbUOwRj.js} +2 -2
- package/dist/{mediaType-e66mt7Cb.js.map → mediaType-DHbUOwRj.js.map} +1 -1
- package/dist/{runner-CKo8zFVx.js → runner-agAgr2qn.js} +5 -5
- package/dist/{runner-CKo8zFVx.js.map → runner-agAgr2qn.js.map} +1 -1
- package/dist/{runner-link-CGefyJ5U.js → runner-link-B7SsTYaz.js} +3 -3
- package/dist/{runner-link-CGefyJ5U.js.map → runner-link-B7SsTYaz.js.map} +1 -1
- package/dist/runner.js +1 -1
- package/dist/{server-test-aa-ENBUk.js → server-test-Cad_bM68.js} +4 -4
- package/dist/{server-test-aa-ENBUk.js.map → server-test-Cad_bM68.js.map} +1 -1
- package/dist/{src-CwV8i4Mj.js → src-BPcdaWEw.js} +4 -6
- package/dist/{src-CwV8i4Mj.js.map → src-BPcdaWEw.js.map} +1 -1
- package/dist/web/assets/{add-project-dialog-VBi3WXnh.js → add-project-dialog-BHbgORVh.js} +1 -1
- package/dist/web/assets/{agent-tabs-BNgrQWDq.js → agent-tabs-B6uUKAXD.js} +1 -1
- package/dist/web/assets/{agents-Ir1aHz-I.js → agents-NbcZbVrc.js} +1 -1
- package/dist/web/assets/{api-jkvqht5P.js → api-B9OffDXw.js} +1 -1
- package/dist/web/assets/{api-B620HpC2.js → api-yvn34iKU.js} +27 -27
- package/dist/web/assets/{archived-sessions-D4fJHB37.js → archived-sessions-C1-stU7x.js} +1 -1
- package/dist/web/assets/{automation-B91XTDIM.js → automation-Co7V1tcW.js} +1 -1
- package/dist/web/assets/{automation-new-CN7YhryW.js → automation-new-hCV8HoK1.js} +1 -1
- package/dist/web/assets/{automations-CLzVG-zc.js → automations-7GJxGbPp.js} +1 -1
- package/dist/web/assets/{composer-Dd8joSgj.js → composer-B1tdNGSi.js} +1 -1
- package/dist/web/assets/{conflict-card-BN9kNMVL.js → conflict-card-Bx8tT_d5.js} +1 -1
- package/dist/web/assets/{dialog-Dyw3b_Tu.js → dialog-Cvj_lHPY.js} +1 -1
- package/dist/web/assets/{diff-panel-CQ2XZMk2.js → diff-panel-BHhM9z93.js} +1 -1
- package/dist/web/assets/{draft-BmnE6-7J.js → draft-JkaN3nCS.js} +1 -1
- package/dist/web/assets/{dropdown-menu-C4XI7F63.js → dropdown-menu-Bflkx6wY.js} +1 -1
- package/dist/web/assets/{engines-Chq2ih3x.js → engines-pLQJYIu_.js} +1 -1
- package/dist/web/assets/{factory-BBYEYI9i.js → factory-DVCs5zxg.js} +1 -1
- package/dist/web/assets/{factory-columns-CtJOpFim.js → factory-columns-DExb6gW2.js} +1 -1
- package/dist/web/assets/{factory-item-BjydL6AH.js → factory-item-efMFkxnv.js} +1 -1
- package/dist/web/assets/{factory-view-BU2AKcD8.js → factory-view-Cot7flHA.js} +1 -1
- package/dist/web/assets/{files-panel-B6_6pSo9.js → files-panel-BIkR_seN.js} +1 -1
- package/dist/web/assets/{floor-scene-DCpEq0j7.js → floor-scene-DGy8i_5R.js} +1 -1
- package/dist/web/assets/{form-bits-BSfnSmQ7.js → form-bits-5XojWhBG.js} +1 -1
- package/dist/web/assets/{format-D1ma_o2D.js → format-D3kairnQ.js} +1 -1
- package/dist/web/assets/{home-_m_Aihwv.js → home-BtFPGjza.js} +1 -1
- package/dist/web/assets/{inbox-FDD5FMWW.js → inbox-CUPkJ4WC.js} +1 -1
- package/dist/web/assets/{index-BkpVvQrC.js → index-C0C9GyeX.js} +4 -4
- package/dist/web/assets/{item-parts-BhDFWsT1.js → item-parts-DZ3TQad4.js} +1 -1
- package/dist/web/assets/{kill-switch-Dvqaozhz.js → kill-switch-BDAFCjui.js} +1 -1
- package/dist/web/assets/{label-DcWfyglU.js → label-Bm_8Eqe2.js} +1 -1
- package/dist/web/assets/{local-whisper-test-DPTOEA1M.js → local-whisper-test-CqGlAOvK.js} +1 -1
- package/dist/web/assets/{markdown-ad2jia51.js → markdown-DGHfubu-.js} +1 -1
- package/dist/web/assets/{mobile-nav-D8FZcJzG.js → mobile-nav-CrjrDJZ5.js} +1 -1
- package/dist/web/assets/{model-picker-4yoJPkRY.js → model-picker-DnKv2cbc.js} +1 -1
- package/dist/web/assets/{new-session-ddLbjOoZ.js → new-session-Bc93-xJK.js} +1 -1
- package/dist/web/assets/{new-session-GpxXZWbB.js → new-session-CUpOffXI.js} +1 -1
- package/dist/web/assets/{new-session-CwbgcYzY.js → new-session-DVYesr8z.js} +1 -1
- package/dist/web/assets/{now-next-D-6j1g_S.js → now-next-x8fwFm7p.js} +1 -1
- package/dist/web/assets/{on-demand-Cvu5D9uT.js → on-demand-Cvi90jRi.js} +2 -2
- package/dist/web/assets/{open-pr-controls--EtUvzD2.js → open-pr-controls-CYypJCKQ.js} +1 -1
- package/dist/web/assets/{orchestration-pknfiYFr.js → orchestration-BZj0HlxR.js} +1 -1
- package/dist/web/assets/{page-header-BqPf-jRo.js → page-header-t9HzSrxd.js} +1 -1
- package/dist/web/assets/{pm-fMuSJMPP.js → pm-DJfHcB90.js} +1 -1
- package/dist/web/assets/{popover-OrzLEhHL.js → popover-BqwWmyWQ.js} +1 -1
- package/dist/web/assets/{pr-details-BBVM9Kll.js → pr-details-1hhbiFWa.js} +1 -1
- package/dist/web/assets/{project-ws85aDq4.js → project-dy2_DT0H.js} +1 -1
- package/dist/web/assets/{question-card-4aNx5IRX.js → question-card-ldxLXNS_.js} +1 -1
- package/dist/web/assets/{remote-check-BAPXUznK.js → remote-check-CQktPgyp.js} +2 -2
- package/dist/web/assets/{reports-BZj5_wsp.js → reports-D0GAsXFv.js} +1 -1
- package/dist/web/assets/{role-chat-CeJXMsYB.js → role-chat-nIyzM-vQ.js} +1 -1
- package/dist/web/assets/{run-conflict-CPr9OWa3.js → run-conflict-BlgKVpOG.js} +1 -1
- package/dist/web/assets/{runs-table-DpBJ4ZeQ.js → runs-table-DMPF5_D6.js} +1 -1
- package/dist/web/assets/{search-BFTvT67N.js → search-gwjIEGis.js} +1 -1
- package/dist/web/assets/{search-Da3B5-lr.js → search-hK5b8Xwb.js} +1 -1
- package/dist/web/assets/{select-B4LGxZQI.js → select-B1ES0hhy.js} +1 -1
- package/dist/web/assets/{session-_62x2rSZ.js → session-CPUTlq1O.js} +1 -1
- package/dist/web/assets/{settings-CUYuBL-5.js → settings-DRd0b0Kz.js} +1 -1
- package/dist/web/assets/{settings-ui-Ux8rPFol.js → settings-ui-Bc6ymtc_.js} +1 -1
- package/dist/web/assets/{setup-BKOOV6vX.js → setup-Bn2CFYAt.js} +1 -1
- package/dist/web/assets/{shallow-CbfSRfYC.js → shallow-BUNpybIA.js} +1 -1
- package/dist/web/assets/{spec-approval-9S-jPMrI.js → spec-approval-CmC6QBSh.js} +1 -1
- package/dist/web/assets/{spot-check-actions-5CmYjt8A.js → spot-check-actions-DzMUED1O.js} +1 -1
- package/dist/web/assets/{spot-checks-BadmkHuG.js → spot-checks-CDZxwwu0.js} +1 -1
- package/dist/web/assets/{storeys-OlWmOmqA.js → storeys-BEgFUsix.js} +1 -1
- package/dist/web/assets/{switch-DuBpF2_h.js → switch-BHplnCdo.js} +1 -1
- package/dist/web/assets/{terminal-view-ChO1pNp0.js → terminal-view-WNT8FI6K.js} +1 -1
- package/dist/web/assets/{theme-DsW-i9mD.js → theme-3eeE0sp4.js} +1 -1
- package/dist/web/assets/{thread-view-CPlJsMhl.js → thread-view-AQKzJlKb.js} +1 -1
- package/dist/web/assets/{update-banner-CNYd8gAf.js → update-banner-CZGRgiG8.js} +1 -1
- package/dist/web/assets/{updates-CQZDqpFF.js → updates-4l7pwDq1.js} +1 -1
- package/dist/web/assets/{use-retry-item-CWwb3JGo.js → use-retry-item-3n4BD_3J.js} +1 -1
- package/dist/web/assets/{vision-7gkgZ-Ap.js → vision-Z1sLHr_c.js} +1 -1
- package/dist/web/assets/{wip-chip-D5-cZcfN.js → wip-chip-DXwuAo3A.js} +1 -1
- package/dist/web/index.html +34 -34
- package/package.json +1 -1
- package/dist/args-B0i5tyjE.js.map +0 -1
- package/dist/commands-CvAvyECH.js.map +0 -1
- package/dist/harden-channel-2IT0Y7p3.js.map +0 -1
- package/dist/launcher-D17oQovS.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{F as t,t as n}from"./useQuery-VSotSwry.js";import{d as r,i,n as a,o,t as s}from"./switch-DuBpF2_h.js";import{Er as c,Gn as l,K as u,Kn as d,Lt as f,Pt as p,St as m,Wn as h,X as g,kr as _,m as v,n as y,pr as b,r as x,s as S}from"./icons-COCLuOtb.js";import{n as C,t as w}from"./jsx-runtime-C3cWAN_r.js";import{D as T,T as E,_ as D,j as O,m as k}from"./format-D1ma_o2D.js";import{i as A}from"./settings-ui-Ux8rPFol.js";import{n as j}from"./add-project-dialog-VBi3WXnh.js";import{s as M}from"./on-demand-Cvu5D9uT.js";import{a as N,c as P,n as ee,r as te,t as ne}from"./dialog-Dyw3b_Tu.js";import{i as F}from"./api-B620HpC2.js";import{t as I}from"./dist-wxbqfqV1.js";import{a as L,i as R,n as z,r as B,t as V}from"./local-whisper-test-DPTOEA1M.js";import{i as H,r as U}from"./engines-Chq2ih3x.js";var W=e(C(),1),G=w(),K=[`setup`,`claude-sdk`];function q(e){let t=F();return n({queryKey:K,queryFn:()=>t.getClaudeSdkStatus(),enabled:e,refetchInterval:e=>e.state.data?.state===`installing`&&700})}function J(){let e=F(),n=t();return(0,W.useCallback)(async()=>{try{let t=await e.installClaudeSdk();return n.setQueryData(K,t),t}catch(e){return O.error(`Couldn't start the install`,{description:e.message}),null}},[e,n])}function Y(e){if(!e)return`Checking…`;switch(e.state){case`ready`:return e.source===`workspace`?`Agent SDK ${e.version} (development checkout)`:`Agent SDK ${e.version} installed`;case`installing`:return e.progress??`Installing…`;case`failed`:return e.error??`The install failed`;default:return`Installs the Claude Agent SDK from npm (about 5 MB) when you continue`}}function X(){let{data:e}=q(!0),t=J(),n=e?.state,r=`flex size-6 shrink-0 items-center justify-center rounded-full transition-all duration-300`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 pl-8`,"data-check":`claude-sdk`,children:[n===`ready`?(0,G.jsx)(`span`,{className:I(r,`bg-status-done/15 text-status-done`),children:(0,G.jsx)(b,{className:`size-3.5`,strokeWidth:3})}):n===`failed`?(0,G.jsx)(`span`,{className:I(r,`bg-status-failed/12 text-status-failed`),children:(0,G.jsx)(y,{className:`size-3.5`,strokeWidth:3})}):n===`installing`||!e?(0,G.jsx)(`span`,{className:I(r,`border border-border`),children:(0,G.jsx)(f,{className:`size-3.5 animate-spin text-muted-foreground`})}):(0,G.jsx)(`span`,{className:I(r,`border border-border text-muted-foreground`),children:(0,G.jsx)(h,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:`Claude Code support`}),(0,G.jsx)(`div`,{className:I(`text-2xs break-words`,n===`failed`?`text-status-failed/90`:`text-muted-foreground`),title:Y(e),"data-testid":`claude-sdk-message`,children:Y(e)})]}),n===`failed`&&(0,G.jsxs)(k,{size:`sm`,variant:`outline`,onClick:()=>void t(),children:[(0,G.jsx)(u,{}),` Retry`]}),n===`missing`&&(0,G.jsxs)(k,{size:`xs`,variant:`ghost`,onClick:()=>void t(),children:[(0,G.jsx)(h,{}),` Install now`]})]})}var re=[{id:`claude`,label:`Claude Code`},{id:`codex`,label:`Codex`},{id:`opencode`,label:`OpenCode`},{id:`cursor`,label:`Cursor`},{id:`gemini`,label:`Gemini CLI`},{id:`gh`,label:`GitHub CLI`},{id:`git`,label:`git identity`},{id:`browser`,label:`Browser for agents`}],Z={install:`Install`,login:`Sign in`,upgrade:`Upgrade`,configure:`Set up`};function ie({state:e}){let t=`flex size-6 shrink-0 items-center justify-center rounded-full transition-all duration-300`;return e===`checking`?(0,G.jsx)(`span`,{className:I(t,`border border-border`),children:(0,G.jsx)(f,{className:`size-3.5 animate-spin text-muted-foreground`})}):e===`ok`?(0,G.jsx)(`span`,{className:I(t,`bg-status-done/15 text-status-done`),children:(0,G.jsx)(b,{className:`size-3.5`,strokeWidth:3})}):e===`warning`?(0,G.jsx)(`span`,{className:I(t,`bg-status-waiting/15 text-status-waiting`),children:(0,G.jsx)(v,{className:`size-3.5`})}):(0,G.jsx)(`span`,{className:I(t,`bg-status-failed/12 text-status-failed`),children:(0,G.jsx)(y,{className:`size-3.5`,strokeWidth:3})})}function ae({check:e}){let t=e.broken??[];return t.length===0&&!e.detail?null:(0,G.jsxs)(`details`,{className:`mt-1 text-2xs text-muted-foreground`,"data-testid":`check-details`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer select-none`,children:`Details`}),t.length>0&&(0,G.jsx)(`ul`,{className:`mt-1 space-y-1`,children:t.map(e=>(0,G.jsxs)(`li`,{className:`break-all`,children:[(0,G.jsx)(`code`,{className:`font-mono`,children:e.path}),` `,e.reason,e.target?(0,G.jsxs)(G.Fragment,{children:[`: `,(0,G.jsx)(`code`,{className:`font-mono`,children:e.target})]}):null]},e.path))}),e.detail&&(0,G.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-all rounded bg-muted/50 p-2 font-mono`,children:e.detail})]})}function oe(){let e=F(),n=t(),[r,a]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),{data:l}=E(),u=T(e=>e.runner.providers,[]),f=new Set(u.map(e=>e.id)),m=async t=>{c(!0);try{let r=await e.getSetupStatus({refresh:!0});n.setQueryData([`setup`],r);let i=t&&r.checks.find(e=>e.id===t.id);t&&i?.state===`ok`&&O.success(`${t.label} is ready`)}catch(e){O.error(`Couldn't re-check`,{description:e.message})}finally{c(!1)}},_=()=>{let e=r;a(null),e&&m(e)},v=l?l.checks.map(e=>({id:e.id,label:e.label,check:e})):re;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-border overflow-hidden rounded-xl border border-border bg-card`,"data-testid":`setup-checklist`,children:v.map(({id:e,label:t,check:n})=>{let r=!n||s?`checking`:n.state,o=r!==`ok`&&r!==`checking`;return(0,G.jsxs)(W.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-3 sm:flex-nowrap`,"data-check":e,children:[(0,G.jsx)(ie,{state:r}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px] font-medium`,children:[t,f.has(e)?(0,G.jsx)(`span`,{className:`text-3xs font-normal text-muted-foreground`,children:`provider`}):null]}),(0,G.jsx)(`div`,{className:I(`text-2xs`,o?`break-words`:`truncate`,r===`missing`||r===`error`?`text-status-failed/90`:`text-muted-foreground`),title:n?.message,children:r===`checking`?`Checking…`:n?.message}),n&&o&&(0,G.jsx)(ae,{check:n})]}),n?.fix&&o&&(0,G.jsxs)(`div`,{className:`flex min-w-0 basis-full items-center gap-1.5 pl-9 sm:basis-auto sm:pl-0`,children:[(0,G.jsxs)(k,{size:`xs`,variant:`ghost`,className:`min-w-0 max-w-56 shrink font-mono text-muted-foreground`,title:n.fix.command,onClick:()=>void i(n.fix?.command??``,`Command copied`),children:[(0,G.jsx)(d,{}),` `,(0,G.jsx)(`span`,{className:`truncate`,children:n.fix.command})]}),(0,G.jsxs)(k,{size:`sm`,onClick:()=>a(n),children:[n.fix.kind===`login`?(0,G.jsx)(p,{}):n.fix.kind===`install`?(0,G.jsx)(h,{}):(0,G.jsx)(x,{}),Z[n.fix.kind]]})]})]}),e===`claude`&&n?.installed&&(0,G.jsx)(X,{})]},e)})}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-start gap-3`,children:[(0,G.jsx)(`p`,{className:`flex-1 text-2xs text-muted-foreground`,children:`CodeDen reuses your existing logins and never stores provider or GitHub credentials. At least one agent provider is required; GitHub is recommended.`}),(0,G.jsxs)(k,{size:`xs`,variant:`ghost`,className:`text-muted-foreground`,disabled:s,onClick:()=>void m(),children:[(0,G.jsx)(g,{className:I(s&&`animate-spin`)}),` Re-check`]})]}),(0,G.jsx)(ne,{open:r!==null,onOpenChange:e=>!e&&_(),children:(0,G.jsxs)(ee,{className:`sm:max-w-2xl`,children:[(0,G.jsxs)(N,{children:[(0,G.jsxs)(P,{children:[r?.fix?Z[r.fix.kind]:``,` · `,r?.label]}),(0,G.jsx)(te,{children:r?.fix?.kind===`login`?`Runs the tool's own login. Finish in your browser, then close this window.`:`Runs the command in a terminal on this machine. Close this window when it's done.`})]}),(0,G.jsx)(`div`,{className:`h-64 overflow-hidden rounded-lg border border-border`,children:r&&(0,G.jsx)(M,{sessionId:null,command:r.fix?.command,ephemeral:!0})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[r?.fix?.url?(0,G.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>r.fix?.url&&o.openExternal(r.fix.url),children:`Install guide`}):(0,G.jsx)(`span`,{}),(0,G.jsx)(k,{onClick:_,children:`Done, re-check`})]})]})})]})}function se({recommended:e}){let{settings:t,update:n}=A(),r=R(),i=L(),a=t.voice.dictation,o=a.engine===`local`,c=r.data?.models.find(e=>e.id===a.local.model),u=r.data?.supported??!0;return(0,G.jsxs)(`div`,{className:`px-4 py-3.5`,"data-testid":`local-whisper-card`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(l,{className:`size-4 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:`Use local Whisper for dictation`}),(0,G.jsx)(`div`,{className:`text-2xs text-muted-foreground`,children:u?e?`Recommended here: this browser has no speech recognition. Runs offline on this machine.`:`Optional. Private and offline: transcribes on this machine and works in any browser.`:r.data?.unsupportedReason??`Not available on this machine.`})]}),(0,G.jsx)(s,{"aria-label":`Use local Whisper for dictation`,checked:o,disabled:!u,onCheckedChange:e=>{n({voice:{dictation:{engine:e?`local`:`browser`}}}),e&&(c?.state===`missing`||c?.state===`failed`)&&i.download(c.id)}})]}),o&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3 pl-7`,children:[(0,G.jsx)(z,{status:r.data,value:a.local.model,onChange:e=>n({voice:{dictation:{local:{model:e}}}})}),(0,G.jsx)(B,{status:r.data,modelId:a.local.model}),(0,G.jsx)(V,{disabled:c?.state!==`installed`,language:a.language})]})]})}function Q(e){return e?`Turned off for CodeDen in your system's notification settings. Turn them on there, then check again.`:`Blocked for this site. To allow them, open the site settings (the icon left of the address bar), allow notifications, then check again.`}function ce(){let[e,t]=(0,W.useState)(o.notificationPermission()),n=typeof window<`u`&&window.isSecureContext===!1,r=e!==`granted`&&n&&!o.capabilities.osIntegration;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5`,"data-testid":`setup-notifications`,children:[(0,G.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:`Browser notifications`}),(0,G.jsx)(`div`,{className:`text-2xs text-muted-foreground`,children:r?`Browsers only allow notifications on secure pages, and this one is plain http. Open CodeDen on the computer that runs it to get them.`:e===`denied`?Q(o.capabilities.osIntegration):`Know when an agent needs you, even in another tab.`})]}),e===`granted`?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-2xs text-status-done`,children:[(0,G.jsx)(b,{className:`size-3`}),` Allowed`]}):r?(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:`Unavailable`}):e===`denied`?(0,G.jsxs)(k,{size:`sm`,variant:`outline`,onClick:()=>{let e=o.notificationPermission();t(e),e===`denied`&&O(`Notifications are still blocked`,{description:`If you just allowed them, reload the page.`})},children:[(0,G.jsx)(u,{}),` Check again`]}):(0,G.jsx)(k,{size:`sm`,variant:`outline`,disabled:e===`unsupported`,onClick:async()=>t(await o.requestNotificationPermission()),children:`Allow`})]})}var $=[`Check your tools`,`Voice & notifications`,`First project`];function le(){let{settings:e,update:t}=A(),n=(0,W.useId)(),r=`flex items-center gap-3 px-4 py-3.5`,i=U.supported;return(0,G.jsxs)(`div`,{className:`divide-y divide-border rounded-xl border border-border bg-card`,children:[(0,G.jsxs)(`div`,{className:r,children:[(0,G.jsx)(m,{className:`size-4 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:`Dictation`}),(0,G.jsx)(`div`,{className:`text-2xs text-muted-foreground`,children:i?`Your browser supports speech to text. Press Ctrl Shift M in the composer.`:`This browser has no speech recognition. Use local Whisper below, or a cloud engine in Settings.`})]}),(0,G.jsx)(`span`,{className:I(`text-2xs`,i?`text-status-done`:`text-muted-foreground`),children:i?`Available`:`Unavailable`})]}),(0,G.jsx)(se,{recommended:!i}),(0,G.jsxs)(`div`,{className:r,children:[(0,G.jsx)(S,{className:`size-4 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{id:`${n}-label`,className:`text-[13.5px] font-medium`,children:`Read final messages aloud`}),(0,G.jsx)(`div`,{id:`${n}-hint`,className:`text-2xs text-muted-foreground`,children:`When a turn completes and you're in another tab.`})]}),(0,G.jsx)(k,{size:`xs`,variant:`ghost`,disabled:!H.supported,onClick:()=>H.speak(`Hi! I'll read agent summaries like this.`),children:`Test`}),(0,G.jsx)(s,{"aria-labelledby":`${n}-label`,"aria-describedby":`${n}-hint`,checked:e.voice.readAloud.enabled,onCheckedChange:e=>t({voice:{readAloud:{enabled:e}}})})]}),(0,G.jsx)(ce,{})]})}function ue(){let e=F(),n=t(),i=r(),[o,s]=(0,W.useState)(0),c=E(),l=c.data?.ready??!1,u=c.data?.checks.some(e=>e.id===`claude`&&e.installed),d=q(u===!0).data,p=J(),[m,h]=(0,W.useState)(!1);(0,W.useEffect)(()=>{m&&d?.state!==`installing`&&(h(!1),d?.state===`ready`&&s(1))},[m,d?.state]);let g=async()=>{if(o===0&&u&&(d?.state===`missing`||d?.state===`installing`)){let e=d.state===`missing`?await p():d;e?.state===`ready`?s(1):e?.state===`installing`&&h(!0)}else s(o+1)},v=async t=>{let r=new Date().toISOString();n.setQueryData(D,e=>e&&{...e,settings:{...e.settings,setup:{completed:!0,completedAt:r}}});try{await e.completeSetup();let t=await e.updateSettings({setup:{completed:!0,completedAt:r}});n.setQueryData(D,e=>e&&{...e,settings:t})}catch(e){O.error(`Setup wasn't saved`,{description:e instanceof Error?e.message:String(e)})}i(t?{to:`/projects/$projectId/new`,params:{projectId:t}}:{to:`/`})};return(0,G.jsxs)(`div`,{className:`relative flex min-h-dvh flex-col items-center overflow-y-auto bg-background px-6 py-12`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-96 bg-[radial-gradient(50%_100%_at_50%_0%,var(--glow),transparent)]`}),(0,G.jsxs)(`div`,{className:`relative w-full max-w-2xl`,children:[(0,G.jsxs)(`div`,{className:`mb-8 flex flex-col items-center text-center`,children:[(0,G.jsx)(a,{className:`mb-4 size-12`}),(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Welcome to CodeDen`}),(0,G.jsx)(`p`,{className:`mt-1.5 max-w-md text-sm text-muted-foreground`,children:`We'll reuse what's already set up on this machine. Nothing to type if you're already signed in.`})]}),(0,G.jsx)(`ol`,{className:`mb-6 flex items-center justify-center gap-2`,children:$.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t<=o&&s(t),className:I(`flex items-center gap-2 rounded-full py-1 pr-3 pl-1 text-xs transition-colors`,t===o?`bg-accent text-foreground`:`text-muted-foreground`),children:[(0,G.jsx)(`span`,{className:I(`flex size-5 items-center justify-center rounded-full text-3xs font-semibold`,t<o?`bg-status-done/15 text-status-done`:t===o?`bg-primary text-primary-foreground`:`border border-border`),children:t<o?(0,G.jsx)(b,{className:`size-3`,strokeWidth:3}):t+1}),e]}),t<$.length-1&&(0,G.jsx)(`span`,{className:`h-px w-6 bg-border`})]},e))}),o===0&&(0,G.jsx)(oe,{}),o===1&&(0,G.jsx)(le,{}),o===2&&(0,G.jsx)(j,{submitLabel:`Add project & finish`,onCreated:e=>void v(e)}),(0,G.jsxs)(`div`,{className:`mt-6 flex items-center justify-between`,children:[(0,G.jsx)(k,{variant:`ghost`,className:`text-muted-foreground`,onClick:()=>void v(),children:`Skip setup`}),o<2?(0,G.jsxs)(k,{disabled:o===0&&!l||m,onClick:()=>void g(),children:[m?`Installing Claude Code support…`:o===0&&u&&d?.state===`failed`?`Continue anyway`:o===1||l?`Continue`:`Waiting for a provider…`,` `,m?(0,G.jsx)(f,{className:`animate-spin`}):(0,G.jsx)(_,{})]}):(0,G.jsx)(k,{variant:`outline`,onClick:()=>void v(),children:`I'll add a project later`})]})]})]})}export{ue as SetupPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{F as t,t as n}from"./useQuery-VSotSwry.js";import{d as r,i,n as a,o,t as s}from"./switch-BHplnCdo.js";import{Er as c,Gn as l,K as u,Kn as d,Lt as f,Pt as p,St as m,Wn as h,X as g,kr as _,m as v,n as y,pr as b,r as x,s as S}from"./icons-COCLuOtb.js";import{n as C,t as w}from"./jsx-runtime-C3cWAN_r.js";import{D as T,T as E,_ as D,j as O,m as k}from"./format-D3kairnQ.js";import{i as A}from"./settings-ui-Bc6ymtc_.js";import{n as j}from"./add-project-dialog-BHbgORVh.js";import{s as M}from"./on-demand-Cvi90jRi.js";import{a as N,c as P,n as ee,r as te,t as ne}from"./dialog-Cvj_lHPY.js";import{i as F}from"./api-yvn34iKU.js";import{t as I}from"./dist-wxbqfqV1.js";import{a as L,i as R,n as z,r as B,t as V}from"./local-whisper-test-CqGlAOvK.js";import{i as H,r as U}from"./engines-pLQJYIu_.js";var W=e(C(),1),G=w(),K=[`setup`,`claude-sdk`];function q(e){let t=F();return n({queryKey:K,queryFn:()=>t.getClaudeSdkStatus(),enabled:e,refetchInterval:e=>e.state.data?.state===`installing`&&700})}function J(){let e=F(),n=t();return(0,W.useCallback)(async()=>{try{let t=await e.installClaudeSdk();return n.setQueryData(K,t),t}catch(e){return O.error(`Couldn't start the install`,{description:e.message}),null}},[e,n])}function Y(e){if(!e)return`Checking…`;switch(e.state){case`ready`:return e.source===`workspace`?`Agent SDK ${e.version} (development checkout)`:`Agent SDK ${e.version} installed`;case`installing`:return e.progress??`Installing…`;case`failed`:return e.error??`The install failed`;default:return`Installs the Claude Agent SDK from npm (about 5 MB) when you continue`}}function X(){let{data:e}=q(!0),t=J(),n=e?.state,r=`flex size-6 shrink-0 items-center justify-center rounded-full transition-all duration-300`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 pl-8`,"data-check":`claude-sdk`,children:[n===`ready`?(0,G.jsx)(`span`,{className:I(r,`bg-status-done/15 text-status-done`),children:(0,G.jsx)(b,{className:`size-3.5`,strokeWidth:3})}):n===`failed`?(0,G.jsx)(`span`,{className:I(r,`bg-status-failed/12 text-status-failed`),children:(0,G.jsx)(y,{className:`size-3.5`,strokeWidth:3})}):n===`installing`||!e?(0,G.jsx)(`span`,{className:I(r,`border border-border`),children:(0,G.jsx)(f,{className:`size-3.5 animate-spin text-muted-foreground`})}):(0,G.jsx)(`span`,{className:I(r,`border border-border text-muted-foreground`),children:(0,G.jsx)(h,{className:`size-3.5`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:`Claude Code support`}),(0,G.jsx)(`div`,{className:I(`text-2xs break-words`,n===`failed`?`text-status-failed/90`:`text-muted-foreground`),title:Y(e),"data-testid":`claude-sdk-message`,children:Y(e)})]}),n===`failed`&&(0,G.jsxs)(k,{size:`sm`,variant:`outline`,onClick:()=>void t(),children:[(0,G.jsx)(u,{}),` Retry`]}),n===`missing`&&(0,G.jsxs)(k,{size:`xs`,variant:`ghost`,onClick:()=>void t(),children:[(0,G.jsx)(h,{}),` Install now`]})]})}var re=[{id:`claude`,label:`Claude Code`},{id:`codex`,label:`Codex`},{id:`opencode`,label:`OpenCode`},{id:`cursor`,label:`Cursor`},{id:`gemini`,label:`Gemini CLI`},{id:`gh`,label:`GitHub CLI`},{id:`git`,label:`git identity`},{id:`browser`,label:`Browser for agents`}],Z={install:`Install`,login:`Sign in`,upgrade:`Upgrade`,configure:`Set up`};function ie({state:e}){let t=`flex size-6 shrink-0 items-center justify-center rounded-full transition-all duration-300`;return e===`checking`?(0,G.jsx)(`span`,{className:I(t,`border border-border`),children:(0,G.jsx)(f,{className:`size-3.5 animate-spin text-muted-foreground`})}):e===`ok`?(0,G.jsx)(`span`,{className:I(t,`bg-status-done/15 text-status-done`),children:(0,G.jsx)(b,{className:`size-3.5`,strokeWidth:3})}):e===`warning`?(0,G.jsx)(`span`,{className:I(t,`bg-status-waiting/15 text-status-waiting`),children:(0,G.jsx)(v,{className:`size-3.5`})}):(0,G.jsx)(`span`,{className:I(t,`bg-status-failed/12 text-status-failed`),children:(0,G.jsx)(y,{className:`size-3.5`,strokeWidth:3})})}function ae({check:e}){let t=e.broken??[];return t.length===0&&!e.detail?null:(0,G.jsxs)(`details`,{className:`mt-1 text-2xs text-muted-foreground`,"data-testid":`check-details`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer select-none`,children:`Details`}),t.length>0&&(0,G.jsx)(`ul`,{className:`mt-1 space-y-1`,children:t.map(e=>(0,G.jsxs)(`li`,{className:`break-all`,children:[(0,G.jsx)(`code`,{className:`font-mono`,children:e.path}),` `,e.reason,e.target?(0,G.jsxs)(G.Fragment,{children:[`: `,(0,G.jsx)(`code`,{className:`font-mono`,children:e.target})]}):null]},e.path))}),e.detail&&(0,G.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-all rounded bg-muted/50 p-2 font-mono`,children:e.detail})]})}function oe(){let e=F(),n=t(),[r,a]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),{data:l}=E(),u=T(e=>e.runner.providers,[]),f=new Set(u.map(e=>e.id)),m=async t=>{c(!0);try{let r=await e.getSetupStatus({refresh:!0});n.setQueryData([`setup`],r);let i=t&&r.checks.find(e=>e.id===t.id);t&&i?.state===`ok`&&O.success(`${t.label} is ready`)}catch(e){O.error(`Couldn't re-check`,{description:e.message})}finally{c(!1)}},_=()=>{let e=r;a(null),e&&m(e)},v=l?l.checks.map(e=>({id:e.id,label:e.label,check:e})):re;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`divide-y divide-border overflow-hidden rounded-xl border border-border bg-card`,"data-testid":`setup-checklist`,children:v.map(({id:e,label:t,check:n})=>{let r=!n||s?`checking`:n.state,o=r!==`ok`&&r!==`checking`;return(0,G.jsxs)(W.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-3 sm:flex-nowrap`,"data-check":e,children:[(0,G.jsx)(ie,{state:r}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[13.5px] font-medium`,children:[t,f.has(e)?(0,G.jsx)(`span`,{className:`text-3xs font-normal text-muted-foreground`,children:`provider`}):null]}),(0,G.jsx)(`div`,{className:I(`text-2xs`,o?`break-words`:`truncate`,r===`missing`||r===`error`?`text-status-failed/90`:`text-muted-foreground`),title:n?.message,children:r===`checking`?`Checking…`:n?.message}),n&&o&&(0,G.jsx)(ae,{check:n})]}),n?.fix&&o&&(0,G.jsxs)(`div`,{className:`flex min-w-0 basis-full items-center gap-1.5 pl-9 sm:basis-auto sm:pl-0`,children:[(0,G.jsxs)(k,{size:`xs`,variant:`ghost`,className:`min-w-0 max-w-56 shrink font-mono text-muted-foreground`,title:n.fix.command,onClick:()=>void i(n.fix?.command??``,`Command copied`),children:[(0,G.jsx)(d,{}),` `,(0,G.jsx)(`span`,{className:`truncate`,children:n.fix.command})]}),(0,G.jsxs)(k,{size:`sm`,onClick:()=>a(n),children:[n.fix.kind===`login`?(0,G.jsx)(p,{}):n.fix.kind===`install`?(0,G.jsx)(h,{}):(0,G.jsx)(x,{}),Z[n.fix.kind]]})]})]}),e===`claude`&&n?.installed&&(0,G.jsx)(X,{})]},e)})}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-start gap-3`,children:[(0,G.jsx)(`p`,{className:`flex-1 text-2xs text-muted-foreground`,children:`CodeDen reuses your existing logins and never stores provider or GitHub credentials. At least one agent provider is required; GitHub is recommended.`}),(0,G.jsxs)(k,{size:`xs`,variant:`ghost`,className:`text-muted-foreground`,disabled:s,onClick:()=>void m(),children:[(0,G.jsx)(g,{className:I(s&&`animate-spin`)}),` Re-check`]})]}),(0,G.jsx)(ne,{open:r!==null,onOpenChange:e=>!e&&_(),children:(0,G.jsxs)(ee,{className:`sm:max-w-2xl`,children:[(0,G.jsxs)(N,{children:[(0,G.jsxs)(P,{children:[r?.fix?Z[r.fix.kind]:``,` · `,r?.label]}),(0,G.jsx)(te,{children:r?.fix?.kind===`login`?`Runs the tool's own login. Finish in your browser, then close this window.`:`Runs the command in a terminal on this machine. Close this window when it's done.`})]}),(0,G.jsx)(`div`,{className:`h-64 overflow-hidden rounded-lg border border-border`,children:r&&(0,G.jsx)(M,{sessionId:null,command:r.fix?.command,ephemeral:!0})}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[r?.fix?.url?(0,G.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>r.fix?.url&&o.openExternal(r.fix.url),children:`Install guide`}):(0,G.jsx)(`span`,{}),(0,G.jsx)(k,{onClick:_,children:`Done, re-check`})]})]})})]})}function se({recommended:e}){let{settings:t,update:n}=A(),r=R(),i=L(),a=t.voice.dictation,o=a.engine===`local`,c=r.data?.models.find(e=>e.id===a.local.model),u=r.data?.supported??!0;return(0,G.jsxs)(`div`,{className:`px-4 py-3.5`,"data-testid":`local-whisper-card`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(l,{className:`size-4 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:`Use local Whisper for dictation`}),(0,G.jsx)(`div`,{className:`text-2xs text-muted-foreground`,children:u?e?`Recommended here: this browser has no speech recognition. Runs offline on this machine.`:`Optional. Private and offline: transcribes on this machine and works in any browser.`:r.data?.unsupportedReason??`Not available on this machine.`})]}),(0,G.jsx)(s,{"aria-label":`Use local Whisper for dictation`,checked:o,disabled:!u,onCheckedChange:e=>{n({voice:{dictation:{engine:e?`local`:`browser`}}}),e&&(c?.state===`missing`||c?.state===`failed`)&&i.download(c.id)}})]}),o&&(0,G.jsxs)(`div`,{className:`mt-3 flex flex-col gap-3 pl-7`,children:[(0,G.jsx)(z,{status:r.data,value:a.local.model,onChange:e=>n({voice:{dictation:{local:{model:e}}}})}),(0,G.jsx)(B,{status:r.data,modelId:a.local.model}),(0,G.jsx)(V,{disabled:c?.state!==`installed`,language:a.language})]})]})}function Q(e){return e?`Turned off for CodeDen in your system's notification settings. Turn them on there, then check again.`:`Blocked for this site. To allow them, open the site settings (the icon left of the address bar), allow notifications, then check again.`}function ce(){let[e,t]=(0,W.useState)(o.notificationPermission()),n=typeof window<`u`&&window.isSecureContext===!1,r=e!==`granted`&&n&&!o.capabilities.osIntegration;return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5`,"data-testid":`setup-notifications`,children:[(0,G.jsx)(c,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:`Browser notifications`}),(0,G.jsx)(`div`,{className:`text-2xs text-muted-foreground`,children:r?`Browsers only allow notifications on secure pages, and this one is plain http. Open CodeDen on the computer that runs it to get them.`:e===`denied`?Q(o.capabilities.osIntegration):`Know when an agent needs you, even in another tab.`})]}),e===`granted`?(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-2xs text-status-done`,children:[(0,G.jsx)(b,{className:`size-3`}),` Allowed`]}):r?(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:`Unavailable`}):e===`denied`?(0,G.jsxs)(k,{size:`sm`,variant:`outline`,onClick:()=>{let e=o.notificationPermission();t(e),e===`denied`&&O(`Notifications are still blocked`,{description:`If you just allowed them, reload the page.`})},children:[(0,G.jsx)(u,{}),` Check again`]}):(0,G.jsx)(k,{size:`sm`,variant:`outline`,disabled:e===`unsupported`,onClick:async()=>t(await o.requestNotificationPermission()),children:`Allow`})]})}var $=[`Check your tools`,`Voice & notifications`,`First project`];function le(){let{settings:e,update:t}=A(),n=(0,W.useId)(),r=`flex items-center gap-3 px-4 py-3.5`,i=U.supported;return(0,G.jsxs)(`div`,{className:`divide-y divide-border rounded-xl border border-border bg-card`,children:[(0,G.jsxs)(`div`,{className:r,children:[(0,G.jsx)(m,{className:`size-4 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13.5px] font-medium`,children:`Dictation`}),(0,G.jsx)(`div`,{className:`text-2xs text-muted-foreground`,children:i?`Your browser supports speech to text. Press Ctrl Shift M in the composer.`:`This browser has no speech recognition. Use local Whisper below, or a cloud engine in Settings.`})]}),(0,G.jsx)(`span`,{className:I(`text-2xs`,i?`text-status-done`:`text-muted-foreground`),children:i?`Available`:`Unavailable`})]}),(0,G.jsx)(se,{recommended:!i}),(0,G.jsxs)(`div`,{className:r,children:[(0,G.jsx)(S,{className:`size-4 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{id:`${n}-label`,className:`text-[13.5px] font-medium`,children:`Read final messages aloud`}),(0,G.jsx)(`div`,{id:`${n}-hint`,className:`text-2xs text-muted-foreground`,children:`When a turn completes and you're in another tab.`})]}),(0,G.jsx)(k,{size:`xs`,variant:`ghost`,disabled:!H.supported,onClick:()=>H.speak(`Hi! I'll read agent summaries like this.`),children:`Test`}),(0,G.jsx)(s,{"aria-labelledby":`${n}-label`,"aria-describedby":`${n}-hint`,checked:e.voice.readAloud.enabled,onCheckedChange:e=>t({voice:{readAloud:{enabled:e}}})})]}),(0,G.jsx)(ce,{})]})}function ue(){let e=F(),n=t(),i=r(),[o,s]=(0,W.useState)(0),c=E(),l=c.data?.ready??!1,u=c.data?.checks.some(e=>e.id===`claude`&&e.installed),d=q(u===!0).data,p=J(),[m,h]=(0,W.useState)(!1);(0,W.useEffect)(()=>{m&&d?.state!==`installing`&&(h(!1),d?.state===`ready`&&s(1))},[m,d?.state]);let g=async()=>{if(o===0&&u&&(d?.state===`missing`||d?.state===`installing`)){let e=d.state===`missing`?await p():d;e?.state===`ready`?s(1):e?.state===`installing`&&h(!0)}else s(o+1)},v=async t=>{let r=new Date().toISOString();n.setQueryData(D,e=>e&&{...e,settings:{...e.settings,setup:{completed:!0,completedAt:r}}});try{await e.completeSetup();let t=await e.updateSettings({setup:{completed:!0,completedAt:r}});n.setQueryData(D,e=>e&&{...e,settings:t})}catch(e){O.error(`Setup wasn't saved`,{description:e instanceof Error?e.message:String(e)})}i(t?{to:`/projects/$projectId/new`,params:{projectId:t}}:{to:`/`})};return(0,G.jsxs)(`div`,{className:`relative flex min-h-dvh flex-col items-center overflow-y-auto bg-background px-6 py-12`,children:[(0,G.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-96 bg-[radial-gradient(50%_100%_at_50%_0%,var(--glow),transparent)]`}),(0,G.jsxs)(`div`,{className:`relative w-full max-w-2xl`,children:[(0,G.jsxs)(`div`,{className:`mb-8 flex flex-col items-center text-center`,children:[(0,G.jsx)(a,{className:`mb-4 size-12`}),(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Welcome to CodeDen`}),(0,G.jsx)(`p`,{className:`mt-1.5 max-w-md text-sm text-muted-foreground`,children:`We'll reuse what's already set up on this machine. Nothing to type if you're already signed in.`})]}),(0,G.jsx)(`ol`,{className:`mb-6 flex items-center justify-center gap-2`,children:$.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t<=o&&s(t),className:I(`flex items-center gap-2 rounded-full py-1 pr-3 pl-1 text-xs transition-colors`,t===o?`bg-accent text-foreground`:`text-muted-foreground`),children:[(0,G.jsx)(`span`,{className:I(`flex size-5 items-center justify-center rounded-full text-3xs font-semibold`,t<o?`bg-status-done/15 text-status-done`:t===o?`bg-primary text-primary-foreground`:`border border-border`),children:t<o?(0,G.jsx)(b,{className:`size-3`,strokeWidth:3}):t+1}),e]}),t<$.length-1&&(0,G.jsx)(`span`,{className:`h-px w-6 bg-border`})]},e))}),o===0&&(0,G.jsx)(oe,{}),o===1&&(0,G.jsx)(le,{}),o===2&&(0,G.jsx)(j,{submitLabel:`Add project & finish`,onCreated:e=>void v(e)}),(0,G.jsxs)(`div`,{className:`mt-6 flex items-center justify-between`,children:[(0,G.jsx)(k,{variant:`ghost`,className:`text-muted-foreground`,onClick:()=>void v(),children:`Skip setup`}),o<2?(0,G.jsxs)(k,{disabled:o===0&&!l||m,onClick:()=>void g(),children:[m?`Installing Claude Code support…`:o===0&&u&&d?.state===`failed`?`Continue anyway`:o===1||l?`Continue`:`Waiting for a provider…`,` `,m?(0,G.jsx)(f,{className:`animate-spin`}):(0,G.jsx)(_,{})]}):(0,G.jsx)(k,{variant:`outline`,onClick:()=>void v(),children:`I'll add a project later`})]})]})]})}export{ue as SetupPage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{At as t,B as n,J as r,V as i,a,i as o,jt as s,v as c}from"./api-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{At as t,B as n,J as r,V as i,a,i as o,jt as s,v as c}from"./api-yvn34iKU.js";import{n as l}from"./jsx-runtime-C3cWAN_r.js";import{F as u,t as d}from"./useQuery-VSotSwry.js";import{_ as f,j as p,k as m}from"./format-D3kairnQ.js";import{b as h}from"./dropdown-menu-Bflkx6wY.js";import{t as g}from"./archived-sessions-C1-stU7x.js";import{n as _}from"./factory-DVCs5zxg.js";import{i as v}from"./updates-4l7pwDq1.js";import{r as y,t as b}from"./composer-B1tdNGSi.js";var x=e(l(),1),S=new Set(r),C=new Set;function w(e){return C.add(e),()=>C.delete(e)}function T(e,t){if(t.type===`checkpoint.created`){let n=t.payload.checkpoint.sessionId;for(let t of[`diff`,`files`,`file`,`git-status`])e.invalidateQueries({queryKey:[t,n]})}if(t.type===`conflict.created`&&e.invalidateQueries({queryKey:[`conflicts`]}),(t.type===`inbox.created`||t.type===`inbox.updated`)&&t.payload.item.kind===`conflict`&&e.invalidateQueries({queryKey:[`conflicts`]}),(t.type===`session.created`||t.type===`session.updated`)&&e.invalidateQueries({queryKey:[`project-status`]}),S.has(t.type)&&e.invalidateQueries({queryKey:[`github`]}),t.type===`message.queued`||t.type===`message.dequeued`){let n=t.type===`message.queued`?t.payload.message.sessionId:t.payload.sessionId;e.invalidateQueries({queryKey:[`session-detail`,n]})}}function E(e,r){let o=t.getState,s,c=!1;o().setSocket(`connecting`);let l=e.onConnectionChange(e=>o().setSocket(e)),u=e=>{let t=n.safeParse(e);if(!t.success)return;let s=t.data;i(s)?m.getState().apply(s.sessionId,s.payload,s.seq,s.ts):(r.setQueryData(f,e=>e&&a(e,s)),g(r,s),T(r,s),h(r,s),_(r,s)),s.seq>o().seq&&o().setSeq(s.seq);for(let e of C)e(s)},d=()=>r.fetchQuery({queryKey:f,queryFn:()=>e.getSnapshot(),staleTime:0}),p=t=>{s?.(),s=e.subscribe(t,e=>{switch(e.type){case`runner`:o().setRunner(e.runner,e.runners),r.setQueryData(f,t=>t&&{...t,runner:e.runner,runners:e.runners??t.runners});break;case`update`:r.setQueryData(v,e.update);break;case`events`:for(let t of e.events)u(t);break;case`resync`:d().then(e=>{c||(o().setSeq(e.seq),r.invalidateQueries({predicate:e=>e.queryKey[0]!==`snapshot`}),p(e.seq))})}})};return d().then(e=>{c||(o().setAuth(`ok`),o().setSeq(e.seq),o().setRunner(e.runner,e.runners),p(e.seq))}).catch(()=>o().setSocket(`closed`)),()=>{c=!0,l(),s?.()}}var D=s()(e=>({asked:{},ask:(t,n)=>e(e=>({asked:{...e.asked,[t]:n}})),forget:t=>e(e=>{if(!(t in e.asked))return e;let{[t]:n,...r}=e.asked;return{asked:r}})})),O="Open a pull request for this work with `create_pull_request`. Commit anything uncommitted first, and write a title and description that say what changed, why, and how it was tested.",k=e=>e.trim()===O;function A(e){return e?.state===`open`||e?.state===`draft`}function j(e,t,n=e?.pr){return!e||t?.kind!==`github`||e.role!==`agent`||e.startedBy.kind!==`user`||e.autonomy===`read_only`||e.archivedAt||!e.worktreePath||!e.branch||e.branch===e.baseBranch?!1:!A(n)}function M(e){let t=e?.rootThreadId?e.threads[e.rootThreadId]:void 0;if(!e||!t)return null;for(let n=t.itemIds.length-1;n>=0;n--){let r=e.items[t.itemIds[n]??``];if(r?.item.kind===`user_message`)return{id:r.item.id,asksForPr:k(r.item.input.text),running:e.turns[r.turnId]?.status===`running`}}return null}function N(e){return e.queue?.some(e=>k(e.input.text))?`queued`:e.latest?.asksForPr&&e.latest.running||e.asked&&(e.latest?.id??null)===e.asked.after?`sent`:null}function P(e){let t=e.connected&&j(e.session,e.project,e.pr),n=t?N(e):null;return{canAsk:t&&!n,requested:n,pr:A(e.pr)?e.pr:null}}function F(e){return e===`queued`?`Queued behind the running turn: the agent opens the pull request when that turn ends`:`The agent is opening a pull request`}var I=e=>[`session-queue`,e];function L(e){if(e.type===`message.queued`)return e.payload.message.sessionId;if(e.type===`message.dequeued`||e.type===`message.edited`)return e.payload.sessionId}function R(e){if(e===0)return`Next`;let t=e+1,n=t%100;return`${t}${n>=11&&n<=13?`th`:{1:`st`,2:`nd`,3:`rd`}[t%10]??`th`}`}var z={user:null,orchestrator:`From the orchestrator`,pm:`From the PM`,factory:`From the factory`,automation:`From an automation`,codeden:`From CodeDen`},B=e=>z[e];function V(e){let t=o(),n=u();return(0,x.useEffect)(()=>{let t=H(n,e);return w(r=>{if(L(r)===e){if(r.type===`message.dequeued`&&r.payload.reason!==`sent`){let{messageId:i,reason:a}=r.payload,o=n.getQueryData(I(e))?.find(e=>e.id===i);o&&k(o.input.text)&&D.getState().forget(e),a===`dropped`&&t(i)}n.invalidateQueries({queryKey:I(e)})}})},[n,e]),d({queryKey:I(e),queryFn:()=>t.queue.list(e)})}function H(e,t){let n=[],r=()=>{let e=n;n=[];let r=e.map(e=>e.input.text.trim()).filter(Boolean);if(r.length===0)return;let i=y.getState(),a=b(i,t).text.trim();i.setText(t,[...r,a].filter(Boolean).join(`
|
|
2
2
|
|
|
3
3
|
`));let o=e.some(e=>e.input.attachments.length>0);p(`Queued messages moved back to the composer`,{description:`The turn stopped before ${r.length===1?`it was`:`they were`} sent.${o?` Attachments were not kept.`:``}`})};return i=>{let a=e.getQueryData(I(t))?.find(e=>e.id===i);a?.from===`user`&&(n.length===0&&setTimeout(r,0),n.push(a))}}function U(e){return e?.role===`agent`?e.worktreePath!==null||e.rootThreadId!==null:!1}function W(e){return e instanceof c&&e.code===`not_a_repo`}var G=e=>Symbol.iterator in e,K=e=>`entries`in e,q=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},J=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function Y(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:G(e)&&G(t)?K(e)&&K(t)?q(e,t):J(e,t):q({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function X(e){let t=x.useRef(void 0);return n=>{let r=e(n);return Y(t.current,r)?t.current:t.current=r}}export{R as a,O as c,F as d,P as f,E as g,w as h,I as i,j as l,D as m,U as n,B as o,N as p,W as r,V as s,X as t,M as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t}from"./api-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t}from"./api-yvn34iKU.js";import{j as n,m as r,n as i,yt as a}from"./format-D3kairnQ.js";import{F as o}from"./useQuery-VSotSwry.js";import{Dt as s,pr as c,st as l}from"./icons-COCLuOtb.js";import{n as u,t as d}from"./jsx-runtime-C3cWAN_r.js";import{o as f}from"./bits-B2GRjm37.js";import{t as p}from"./textarea-gD4G5Znx.js";import{t as m}from"./factory-DVCs5zxg.js";var h=e(u(),1),g=d();function _({projectId:e,itemId:i,version:s,compact:u=!1}){let d=t(),f=o(),[_,v]=(0,h.useState)(!1),[y,b]=(0,h.useState)(``),x=a({mutationFn:t=>d.factory.decideSpec(e,i,{...t,version:s}),onSuccess:(e,t)=>{n.success(t.decision===`approve`?`Spec approved: the agent builds it next`:`Changes requested: the agent revises the spec`),v(!1),b(``),f.invalidateQueries({queryKey:m.all})},onError:e=>{n.error(`Couldn't record your decision`,{description:e.message}),f.invalidateQueries({queryKey:m.all})}}),S=u?`sm`:`default`,C=y.trim();return(0,g.jsxs)(`div`,{className:`space-y-2`,"data-testid":`spec-decision`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,g.jsxs)(r,{size:S,onClick:()=>x.mutate({decision:`approve`}),disabled:x.isPending,children:[(0,g.jsx)(c,{}),` Approve spec`]}),(0,g.jsxs)(r,{size:S,variant:_?`secondary`:`outline`,onClick:()=>v(e=>!e),disabled:x.isPending,"aria-expanded":_,children:[(0,g.jsx)(l,{}),` Request changes`]})]}),_&&(0,g.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,g.jsx)(p,{value:y,onChange:e=>b(e.target.value),maxLength:4e3,placeholder:`What should change? The agent revises its analysis and asks you again.`,"aria-label":`What to change in the spec`,className:`min-h-20 text-[13px]`,autoFocus:!0}),(0,g.jsx)(r,{size:`sm`,onClick:()=>x.mutate({decision:`request_changes`,feedback:C}),disabled:x.isPending||!C,children:`Send to the agent`})]})]})}var v={already_done:`it is already possible`,needs_info:`it needs more information`,out_of_scope:`it is out of scope for the vision`};function y({item:e,spec:t}){let n=`Changes requested${t.decidedAt?` ${i(t.decidedAt)}`:``}`,r=e.investigation,a=r?.kind===`analysis`&&r.outcome!==`implement`,o=e.stage===`building`?`${n}: the agent revises its analysis, then asks you again.`:a?`${n}. The revised analysis decided not to build it: ${v[r.outcome]??r.outcome}.`:`${n}. The item stopped before the agent submitted a revised spec.`;return(0,g.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,g.jsx)(s,{className:`mt-0.5 size-3.5 shrink-0 text-status-waiting`}),(0,g.jsxs)(`span`,{children:[o,t.feedback&&(0,g.jsx)(`span`,{className:`mt-1 block text-2xs text-muted-foreground`,children:t.feedback})]})]})}function b({item:e,projectId:t}){let n=e.specApproval;if(!n)return null;let r=n.state===`pending`&&e.stage===`building`;return(0,g.jsxs)(`section`,{"data-testid":`spec-approval`,children:[(0,g.jsx)(f,{className:`mb-2`,children:`Spec approval`}),r?(0,g.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-status-waiting/35 bg-status-waiting/[0.06] p-4 text-[13px]`,children:[(0,g.jsxs)(`p`,{className:`leading-relaxed`,children:[(0,g.jsx)(`span`,{className:`font-medium`,children:`The spec waits for you`}),(0,g.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,`(submitted `,i(n.requestedAt),`). Read the analysis and the acceptance criteria above. Approve it and the agent builds it; ask for changes and it revises the spec first.`]})]}),n.feedback&&(0,g.jsxs)(`p`,{className:`text-2xs text-muted-foreground`,children:[`You asked earlier: `,(0,g.jsx)(`span`,{className:`text-foreground`,children:n.feedback})]}),(0,g.jsx)(_,{projectId:t,itemId:e.id,version:n.requestedAt})]}):(0,g.jsx)(`div`,{className:`rounded-xl border border-border bg-card p-4 text-[13px]`,children:n.state===`changes_requested`?(0,g.jsx)(y,{item:e,spec:n}):n.state===`approved`?(0,g.jsxs)(`p`,{className:`flex items-start gap-2`,children:[(0,g.jsx)(c,{className:`mt-0.5 size-3.5 shrink-0 text-status-done`}),(0,g.jsxs)(`span`,{children:[n.by===`auto`?`Approved automatically: spec approval was turned off while it waited.`:`Approved by you${n.decidedAt?` ${i(n.decidedAt)}`:``}.`,n.rounds>0&&` After ${n.rounds} round${n.rounds===1?``:`s`} of changes.`]})]}):(0,g.jsx)(`p`,{className:`text-muted-foreground`,children:`It was waiting for approval when the item stopped.`})})]})}export{_ as n,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Q as t,Y as n,i as r}from"./api-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Q as t,Y as n,i as r}from"./api-yvn34iKU.js";import{j as i,m as a,yt as o}from"./format-D3kairnQ.js";import{F as s}from"./useQuery-VSotSwry.js";import{An as c,cn as l,m as u,pr as d}from"./icons-COCLuOtb.js";import{n as f,t as p}from"./jsx-runtime-C3cWAN_r.js";import{t as m}from"./pr-details-1hhbiFWa.js";import{a as h,c as g,i as _,n as v,r as y,t as b}from"./dialog-Cvj_lHPY.js";import{t as x}from"./switch-BHplnCdo.js";import{t as S}from"./textarea-gD4G5Znx.js";import{t as C}from"./factory-DVCs5zxg.js";var w=e(f(),1),T=p();function E(e,t){let n=r(),a=s(),c=(e,t)=>{e.issueError?i.warning(`Recorded, but the issue wasn't filed`,{description:`${e.issueError}. Use File issue to try again.`}):i.success(t),a.invalidateQueries({queryKey:C.all})},l=e=>t=>{i.error(e,{description:t.message}),a.invalidateQueries({queryKey:C.all})};return{decide:o({mutationFn:r=>n.factory.spotCheck(e,t,r),onSuccess:(e,t)=>c(e,t.verdict===`looks_good`?`Spot-check recorded: looks good`:e.item.spotCheck?.issue?`Problem recorded and filed as #${e.item.spotCheck.issue.number}`:`Problem recorded`),onError:l(`Couldn't record the spot-check`)}),fileIssue:o({mutationFn:()=>n.factory.fileSpotCheckIssue(e,t),onSuccess:e=>c(e,`Filed as #${e.item.spotCheck?.issue?.number??`?`}: the factory takes it on`),onError:l(`Couldn't file the issue`)})}}function D({projectId:e,pr:t,itemId:r,title:i}){let[o,s]=(0,w.useState)(!1);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(a,{size:`xs`,variant:`outline`,onClick:()=>s(!0),children:[(0,T.jsx)(l,{}),` Open PR`]}),(0,T.jsx)(b,{open:o,onOpenChange:s,children:(0,T.jsxs)(v,{className:`flex max-h-[85vh] flex-col sm:max-w-4xl`,onOpenAutoFocus:e=>{e.preventDefault(),e.currentTarget.focus()},children:[(0,T.jsxs)(h,{children:[(0,T.jsxs)(g,{children:[`Pull request #`,t.number]}),(0,T.jsx)(y,{className:`truncate`,children:i})]}),(0,T.jsx)(`div`,{className:`-mx-4 min-h-0 flex-1 overflow-y-auto px-4 scroll-thin`,children:o&&(0,T.jsx)(m,{prId:n(e,t.number)})}),(0,T.jsxs)(_,{className:`items-center sm:justify-between`,children:[(0,T.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:`Read the change, then record what you found.`}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(0,T.jsx)(O,{projectId:e,itemId:r,title:i,size:`sm`,onDecided:()=>s(!1)})})]})]})})]})}function O({projectId:e,itemId:n,title:r,size:i=`xs`,onDecided:o}){let{decide:s}=E(e,n),[c,l]=(0,w.useState)(!1),[f,p]=(0,w.useState)(``),[m,C]=(0,w.useState)(!0),D=(0,w.useId)(),O=f.trim();return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(a,{size:i,variant:`outline`,onClick:()=>s.mutate({verdict:`looks_good`},{onSuccess:o}),disabled:s.isPending,children:[(0,T.jsx)(d,{}),` Looks good`]}),(0,T.jsxs)(a,{size:i,variant:`outline`,onClick:()=>l(!0),disabled:s.isPending,children:[(0,T.jsx)(u,{}),` Found a problem`]}),(0,T.jsx)(b,{open:c,onOpenChange:l,children:(0,T.jsxs)(v,{className:`sm:max-w-lg`,children:[(0,T.jsxs)(h,{children:[(0,T.jsx)(g,{children:`Found a problem`}),(0,T.jsxs)(y,{children:[`What's wrong with "`,r,`"? It's recorded on the item and counts against its builder and reviewer in the scorecard.`]})]}),(0,T.jsx)(S,{value:f,onChange:e=>p(e.target.value),maxLength:t,placeholder:`What you found, specific enough for an agent to fix it`,"aria-label":`What you found`,className:`min-h-28 text-[13px]`,autoFocus:!0}),(0,T.jsxs)(`label`,{htmlFor:D,className:`flex items-start gap-2 text-xs`,children:[(0,T.jsx)(x,{id:D,checked:m,onCheckedChange:C,className:`mt-0.5`}),(0,T.jsxs)(`span`,{children:[`File a follow-up issue with this note`,(0,T.jsx)(`span`,{className:`block text-3xs text-muted-foreground`,children:`Labelled for the factory, which takes it on as new work.`})]})]}),(0,T.jsxs)(_,{children:[(0,T.jsx)(a,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,T.jsx)(a,{onClick:()=>s.mutate({verdict:`problem`,note:O,fileIssue:m},{onSuccess:()=>{l(!1),p(``),o?.()}}),disabled:s.isPending||!O,children:s.isPending?`Recording…`:`Record problem`})]})]})})]})}function k({projectId:e,itemId:t}){let{fileIssue:n}=E(e,t);return(0,T.jsxs)(a,{size:`xs`,variant:`outline`,onClick:()=>n.mutate(),disabled:n.isPending,children:[(0,T.jsx)(c,{}),` `,n.isPending?`Filing…`:`File issue`]})}export{D as n,O as r,k as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e}from"./api-
|
|
1
|
+
import{$ as e}from"./api-yvn34iKU.js";var t=`spot-checks`,n={sampled:{label:`Sampled`,title:`Picked by the share of automatic merges set aside for a person's look`},untrusted_author:{label:`Untrusted author`,title:`Its issue came from an untrusted author and was let in by hand: always checked`},large_change:{label:`Large change`,title:`It was allowed past the size limit: always checked`}};function r(e){return e===0?`Off: no merge is set aside`:`${e}% of automatic merges, plus untrusted-author work and large changes`}function i(t){let n=e(t.checked30d,t.problems30d);if(n===null)return`None checked in the last 30 days`;let r=`${t.checked30d} checked merge${t.checked30d===1?``:`s`}`;return`A person found a problem in ${t.problems30d} of ${r} (${n}%) over 30 days`}function a(e){return e.percent>0||e.pending.length>0||e.recent.length>0}export{r as a,i,n,a as r,t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{N as t,P as n,f as r}from"./api-B620HpC2.js";import{n as i,t as a}from"./jsx-runtime-C3cWAN_r.js";import{O as o}from"./format-D1ma_o2D.js";import{L as s}from"./dropdown-menu-C4XI7F63.js";import{Cr as c,Or as l}from"./icons-COCLuOtb.js";import{i as u}from"./new-session-GpxXZWbB.js";import{t as d}from"./skeleton-D8Sbd2jT.js";import{i as f,n as p}from"./thread-view-CPlJsMhl.js";import{n as m,r as ee}from"./role-chat-CeJXMsYB.js";import{C as te,n as h}from"./use-retry-item-CWwb3JGo.js";var g=e(i(),1);function _(e,t){return(0,g.useSyncExternalStore)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},()=>window.matchMedia(e).matches,()=>t)}function v(){return _(`(min-width: 1024px)`,!0)}function y(){return _(`(min-width: 1280px)`,!0)}function b(){return _(`(min-width: 640px)`,!0)}function x(e=3e4){let[t,n]=(0,g.useState)(()=>Date.now());return(0,g.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var S=[{id:`intake`,label:`Intake`,hint:`New issues from trusted authors (and the scout in a dark factory), before their type is known.`},{id:`type`,label:`Identify type`,hint:`Sorted into bug, feature or docs, and waiting for a free agent, in the order agents take them.`},{id:`building`,label:`Building`,hint:`An agent reproduces the bug or analyzes the feature, then implements it and opens a pull request.`},{id:`reviewing`,label:`Reviewing`,hint:`The independent reviewer, the merge checks and CI.`},{id:`merge`,label:`Merge queue`,hint:`Every check passed and auto-merge is on: they merge in this order, seconds apart. Pull requests a person merges wait in Needs you.`},{id:`merged`,label:`Merged`,hint:`Merged today. Right after an automatic merge, CI on the default branch is watched.`}],C=`Needs you`,ne={running:`Running`,waiting:`Waiting`,person:`Needs a person`,failed:`Failed`},re=864e5,w=new Set([`merged`,`superseded`]);function T(e,t){return new Date(e).toDateString()===new Date(t).toDateString()}function E(e,t){let n=t.filter(t=>t.itemId===e.id);return n.find(t=>e.pr!==null&&t.pr.number===e.pr.number)??n.find(e=>e.state!==`superseded`)??n[0]??null}function D(e,t){return t?!w.has(t.state):e.ownedPr!==null||e.pr?.state===`open`||e.pr?.state===`draft`}function O(e,t){return t?t.state===`stuck`:e.stage===`failed`&&e.failureKind===`stuck`}function k(e,t){return t?w.has(t.state)?null:t.pr.number:e.ownedPr?.number??e.pr?.number??null}function A(e,r,i,a){let o=t(e,{now:a,ownsOpenPr:D(e,r),recovering:e.recovering,prWaitsForYou:r?.state===`waiting_for_you`,agentWaiting:i?.status===`waiting`,specPending:e.specApproval===`pending`});if(!o)return null;let s=k(e,r);return{kind:o,label:n(o,{attempts:e.attempts,prNumber:s})}}function j(e,t,n,r=null){if(r)return`needs_you`;switch(e.stage){case`candidate`:return`intake`;case`backlog`:return`type`;case`building`:return`building`;case`verifying`:return e.step===`merge`?`merge`:`reviewing`;case`watching`:return`merged`;case`merged`:return T(e.mergedAt??e.updatedAt,n)?`merged`:null;case`failed`:return e.recovering?D(e,t)?`reviewing`:n-Date.parse(e.finishedAt??e.updatedAt)<re?`building`:null:null;default:return null}}function M(e,t,n){return e.stage===`escalated`||O(e,t)?`person`:e.stage===`failed`?`failed`:e.stage===`building`&&e.specApproval===`pending`?`person`:e.stage===`merged`?`waiting`:t?.state===`waiting_for_you`?`person`:e.stage===`watching`?`running`:n?.status===`waiting`?`person`:n?.status===`failed`?`failed`:n?.status===`running`||n?.status===`starting`?`running`:`waiting`}function N(e,t,n){return(e.stage===`failed`||e.stage===`escalated`?e.reason??e.note:null)??n?.progress??t?.note??e.note??(e.stage===`watching`?`Watching CI on the default branch`:null)??(e.stage===`merged`?`Merged`:te(e.step,e.type))}function P(e,t,n=Date.now()){let r={intake:[],type:[],building:[],reviewing:[],merge:[],merged:[]},i=[],a=new Set;for(let o of[...e.backlog,...e.inProgress,...e.viewRecent,...e.recent]){if(a.has(o.id))continue;a.add(o.id);let s=E(o,e.pullRequests),c=o.activeSessionId??o.sessionId,l=c?t.get(c):void 0,u=A(o,s,l,n),d=j(o,s,n,u);if(!d)continue;let f={item:o,place:d,state:M(o,s,l),pr:s,activity:N(o,s,l),since:o.stepSince??o.updatedAt,sessionId:c,need:u};(d===`needs_you`?i:r[d]).push(f)}let o=(e,t)=>Date.parse(e.since)-Date.parse(t.since);r.building.sort(o),r.reviewing.sort(o);let s=1/0,c=t=>{let n=t.pr?e.pullRequests.indexOf(t.pr):-1;return n===-1?s:n};r.merge.sort((e,t)=>{let n=e.pr?.queuePosition??s,r=t.pr?.queuePosition??s;if(n!==r)return n-r;let i=c(e),a=c(t);return i===a?0:i-a}),r.merged.sort((e,t)=>Date.parse(t.item.mergedAt??t.item.updatedAt)-Date.parse(e.item.mergedAt??e.item.updatedAt));let l=[...Object.values(r).flat(),...i];return{stages:r,needsYou:i,needsPerson:i.length,failed:l.filter(e=>e.state===`failed`||e.item.stage===`failed`).length}}function F(e){return e.issue?`#${e.issue.number}`:e.pr?`PR #${e.pr.number}`:e.title.slice(0,18)}function I(e){let t=ne[e.state];return e.item.stage===`merged`?`${t}, merged`:t}function L(e,t){if(!e||e.state===`checking`||e.state===`merged`||e.state===`superseded`)return null;if(e.state===`queued`)return e.queuePosition?`Queued #${e.queuePosition}`:`Queued`;let n=t[e.state]??e.state;return e.queuePosition?`${n} · #${e.queuePosition}`:n}function R(e){let t=new Map;for(let n of[...Object.values(e.stages).flat(),...e.needsYou])t.set(n.item.id,n.place);return t}function z(e){return e===`needs_you`?C:S.find(t=>t.id===e)?.label??e}function ie(e,t){let n=[];for(let r of[...Object.values(t.stages).flat(),...t.needsYou]){let t=e.get(r.item.id);if(t===r.place)continue;let i=F(r.item);n.push(t?`${i} moved to ${z(r.place)}.`:`${i} arrived in ${z(r.place)}.`)}return n}var B=new Set([`rebasing`,`updating`]);function V(e,t){let n=t?.workKey??``,r=e.item;if(n.startsWith(`factory:integrate:`))return`integrator`;let i=e.pr?.state;return i&&(B.has(i)||i===`rebuilding`&&r.stage!==`building`)?`rebaser`:n.startsWith(`factory:review:`)?`reviewer`:r.stage===`building`||r.stage===`failed`&&e.place===`building`?`builder`:`reviewer`}function H(e,t){let n=e.item;return t===`rebaser`||t===`integrator`?`rebasing`:t===`builder`?n.step===`reproduce`?`reproducing`:n.step===`analyze`?`analyzing`:n.attempts>0?`revising`:`implementing`:n.stage===`watching`||e.pr?.state===`waiting_ci`?`watching_ci`:n.step===`merge`?`merging`:`reviewing`}function U(e,t){return!e.progress||!e.progressAt?!1:t===null||Date.parse(e.progressAt)>=Date.parse(t)}function W(e,t){return e.status===`starting`?`thinking`:e.status===`running`?U(e,t)?`working`:`thinking`:null}function G(e,t){let n=e.item,r=e=>({status:`blocked`,blockedOn:e});if(n.stage===`merged`||n.stage===`watching`)return{status:`done`,blockedOn:null};if(t?.status===`waiting`)return{status:`approval`,blockedOn:null};if(e.state===`failed`||t?.status===`failed`)return r(`failed`);if(t?.status===`interrupted`)return r(`cut_off`);if(e.state===`person`)return r(`person`);let i=e.pr?.state;if(i===`waiting_ci`)return r(`ci`);let a=t?W(t,e.since):null;return a?{status:a,blockedOn:null}:i===`updating`?{status:`working`,blockedOn:null}:r(i===`rebasing`||i===`rebuilding`?`conflicts`:i===`queued`?`turn`:`agent`)}function K(e,t,n){let r=e.item;if(t!==`reviewer`)return e.sessionId;if(r.reviewerSessionId)return r.reviewerSessionId;let i=e.sessionId?n.get(e.sessionId):void 0;return r.step===`review`||i?.workKey?.startsWith(`factory:review:`)?e.sessionId:null}function q(e){let t=e.stages.merged.filter(e=>e.item.stage===`watching`),n=e.needsYou.filter(e=>e.need?.kind===`answer`||e.need?.kind===`approve_spec`);return[...e.stages.building,...e.stages.reviewing,...e.stages.merge,...t,...n].filter(e=>e.pr?.state!==`stuck`)}var J={idle:`Between rounds`,planning:`Planning the round`,reviewing:`Reviewing the areas`,filing:`Filing issues`};function Y({f:e,pipeline:t,sessions:n,pmSessionId:r}){let i=[],a=e=>{let t=e?n.get(e):void 0;return{session:t,provider:t?.provider??null,providerId:t?.providerId??null,model:t?.model??null,progress:t?.progress??null}};for(let e of q(t)){let t=V(e,e.sessionId?n.get(e.sessionId):void 0),r=K(e,t,n),{session:o,...s}=a(r),c=`item:${e.item.id}:${t}`;i.push({key:c,role:t,sessionId:r,card:e,step:H(e,t),activity:null,...G(e,o),failed:e.state===`failed`||o?.status===`failed`,...s,since:e.since,seed:r??c,area:null})}let o=a(r),s=o.session?W(o.session,null):null;i.push({key:`pm`,role:`pm`,sessionId:r,card:null,step:null,activity:s?`Answering`:`Listening`,status:o.session?.status===`waiting`?`approval`:s?`working`:`idle`,blockedOn:null,failed:o.session?.status===`failed`,provider:o.provider,providerId:o.providerId,model:o.model,progress:o.progress,since:null,seed:r??`pm`,area:null});let c=e.mode===`dark_factory`?e.scout:null;if(!c)return i;let l=a(c.sessionId),u=l.session?W(l.session,null):null;i.push({key:`scout`,role:`scout`,sessionId:c.sessionId,card:null,step:null,activity:`${J[c.phase]} (round ${c.rounds})`,status:c.phase===`idle`?`idle`:u??`working`,blockedOn:null,failed:!1,provider:l.provider,providerId:l.providerId,model:l.model,progress:l.progress,since:c.lastRoundAt,seed:c.sessionId??`scout`,area:null});for(let e of c.lenses.slice(0,8)){let t=a(e.sessionId),n=t.session?W(t.session,null):null;i.push({key:`area:${e.area}`,role:`area`,sessionId:e.sessionId,card:null,step:null,activity:`Reviewing ${h[e.area]}`,status:e.reported?`done`:e.active?n??`working`:`blocked`,blockedOn:e.reported||e.active?null:`agent`,failed:!1,provider:t.provider,providerId:t.providerId,model:t.model,progress:t.progress,since:null,seed:e.sessionId,area:e.area})}return i}function ae(e,t,n){let r=e.threads[t],i=t===e.rootThreadId?e.earlierTurns:0;if(!r||r.turnIds.length<=n)return{transcript:e,hidden:i};let a=r.turnIds.slice(-n),o=new Set(a),s=r.itemIds.filter(t=>{let n=e.items[t];return n!==void 0&&o.has(n.turnId)});return{transcript:{...e,threads:{...e.threads,[t]:{...r,turnIds:a,itemIds:s}}},hidden:r.turnIds.length-n+i}}var X=a(),Z=3;function oe({session:e,projectId:t}){let{transcript:n,isLoading:i}=o(e.id,{turns:Z}),a=n?.rootThreadId??e.rootThreadId??null,c=!!(n&&a&&r(n,a)),l=(0,g.useMemo)(()=>n&&a?ae(n,a,Z):null,[n,a]),m=!!(l&&a&&(l.transcript.threads[a]?.itemIds.length??0)>0);return(0,X.jsxs)(X.Fragment,{children:[l&&l.hidden>0&&(0,X.jsxs)(s,{to:`/projects/$projectId/pm`,params:{projectId:t},className:`shrink-0 border-b border-border px-3 py-1.5 text-center text-3xs text-muted-foreground hover:text-foreground`,"data-testid":`factory-view-chat-earlier`,children:[l.hidden,` earlier `,l.hidden===1?`turn`:`turns`,` in the full chat`]}),m&&l&&a?(0,X.jsx)(p,{transcript:l.transcript,threadId:a,sessionId:e.id,contentClassName:`max-w-none px-3 pt-3 pb-2 text-[13px]`}):i?(0,X.jsxs)(`div`,{className:`flex-1 space-y-3 p-3`,children:[(0,X.jsx)(d,{className:`ml-auto h-8 w-2/3 rounded-xl`}),(0,X.jsx)(d,{className:`h-4 w-5/6`})]}):(0,X.jsx)(`p`,{className:`flex-1 p-3 text-2xs text-muted-foreground`,children:`No messages yet.`}),(0,X.jsx)(f,{session:e,running:c}),(0,X.jsx)(u,{session:e,running:c})]})}function se({projectId:e,onCollapse:t,header:n=!0}){let r=ee(`pm`,e);return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`factory-view-chat`,children:[(0,X.jsxs)(`header`,{className:n?`flex h-10 shrink-0 items-center gap-2 border-b border-border px-3`:`hidden`,children:[(0,X.jsx)(c,{className:`size-4 text-primary`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`text-[13px] font-medium`,children:`Project manager`}),r&&(0,X.jsx)(`span`,{className:`text-3xs text-muted-foreground`,children:r.status===`running`?`answering…`:null}),(0,X.jsxs)(s,{to:`/projects/$projectId/pm`,params:{projectId:e},className:`ml-auto inline-flex items-center gap-0.5 text-2xs text-primary hover:underline`,children:[`Open full chat `,(0,X.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}),t&&(0,X.jsx)(`button`,{type:`button`,onClick:t,className:`text-2xs text-muted-foreground hover:text-foreground`,children:`Hide`})]}),r?(0,X.jsx)(oe,{session:r,projectId:e}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`flex-1 p-3 text-2xs text-muted-foreground`,children:`Ask the PM what the factory is doing, or to let an issue in. Your first message starts it.`}),(0,X.jsx)(m,{kind:`pm`,projectId:e})]})]})}var Q={workshop:`Workshop`,lookout:`Lookout`,both:`Both`};function $(e){return e.role===`scout`||e.role===`area`?`lookout`:`workshop`}function ce(e){return e.status===`approval`||e.blockedOn===`person`}function le(e,t,n=!1){return t?(n?[`workshop`,`lookout`]:[`workshop`,`lookout`,`both`]).map(t=>{let n=e.filter(e=>t===`both`||$(e)===t);return{id:t,label:Q[t],count:n.length,waiting:n.some(ce)}}):[]}function ue(e,t,n=!1){return t?e===null?n?`workshop`:`both`:n&&e===`both`?`workshop`:e:`workshop`}export{b as _,se as a,S as c,ie as d,R as f,x as g,y as h,le as i,F as l,P as m,ue as n,Y as o,L as p,$ as r,C as s,Q as t,I as u,v};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{M as t,f as n,j as r}from"./api-yvn34iKU.js";import{n as i,t as a}from"./jsx-runtime-C3cWAN_r.js";import{O as o}from"./format-D3kairnQ.js";import{L as s}from"./dropdown-menu-Bflkx6wY.js";import{Cr as c,Or as l}from"./icons-COCLuOtb.js";import{i as u}from"./new-session-CUpOffXI.js";import{t as d}from"./skeleton-D8Sbd2jT.js";import{i as f,n as p}from"./thread-view-AQKzJlKb.js";import{n as m,r as ee}from"./role-chat-nIyzM-vQ.js";import{C as te,n as h}from"./use-retry-item-3n4BD_3J.js";var g=e(i(),1);function _(e,t){return(0,g.useSyncExternalStore)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},()=>window.matchMedia(e).matches,()=>t)}function v(){return _(`(min-width: 1024px)`,!0)}function y(){return _(`(min-width: 1280px)`,!0)}function b(){return _(`(min-width: 640px)`,!0)}function x(e=3e4){let[t,n]=(0,g.useState)(()=>Date.now());return(0,g.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var S=[{id:`intake`,label:`Intake`,hint:`New issues from trusted authors (and the scout in a dark factory), before their type is known.`},{id:`type`,label:`Identify type`,hint:`Sorted into bug, feature or docs, and waiting for a free agent, in the order agents take them.`},{id:`building`,label:`Building`,hint:`An agent reproduces the bug or analyzes the feature, then implements it and opens a pull request.`},{id:`reviewing`,label:`Reviewing`,hint:`The independent reviewer, the merge checks and CI.`},{id:`merge`,label:`Merge queue`,hint:`Every check passed and auto-merge is on: they merge in this order, seconds apart. Pull requests a person merges wait in Needs you.`},{id:`merged`,label:`Merged`,hint:`Merged today. Right after an automatic merge, CI on the default branch is watched.`}],C=`Needs you`,ne={running:`Running`,waiting:`Waiting`,person:`Needs a person`,failed:`Failed`},re=864e5,w=new Set([`merged`,`superseded`]);function T(e,t){return new Date(e).toDateString()===new Date(t).toDateString()}function E(e,t){let n=t.filter(t=>t.itemId===e.id);return n.find(t=>e.pr!==null&&t.pr.number===e.pr.number)??n.find(e=>e.state!==`superseded`)??n[0]??null}function D(e,t){return t?!w.has(t.state):e.ownedPr!==null||e.pr?.state===`open`||e.pr?.state===`draft`}function O(e,t){return t?t.state===`stuck`:e.stage===`failed`&&e.failureKind===`stuck`}function k(e,t){return t?w.has(t.state)?null:t.pr.number:e.ownedPr?.number??e.pr?.number??null}function A(e,n,i,a){let o=r(e,{now:a,ownsOpenPr:D(e,n),recovering:e.recovering,prWaitsForYou:n?.state===`waiting_for_you`,agentWaiting:i?.status===`waiting`,specPending:e.specApproval===`pending`});if(!o)return null;let s=k(e,n);return{kind:o,label:t(o,{attempts:e.attempts,prNumber:s})}}function j(e,t,n,r=null){if(r)return`needs_you`;switch(e.stage){case`candidate`:return`intake`;case`backlog`:return`type`;case`building`:return`building`;case`verifying`:return e.step===`merge`?`merge`:`reviewing`;case`watching`:return`merged`;case`merged`:return T(e.mergedAt??e.updatedAt,n)?`merged`:null;case`failed`:return e.recovering?D(e,t)?`reviewing`:n-Date.parse(e.finishedAt??e.updatedAt)<re?`building`:null:null;default:return null}}function M(e,t,n){return e.stage===`escalated`||O(e,t)?`person`:e.stage===`failed`?`failed`:e.stage===`building`&&e.specApproval===`pending`?`person`:e.stage===`merged`?`waiting`:t?.state===`waiting_for_you`?`person`:e.stage===`watching`?`running`:n?.status===`waiting`?`person`:n?.status===`failed`?`failed`:n?.status===`running`||n?.status===`starting`?`running`:`waiting`}function N(e,t,n){return(e.stage===`failed`||e.stage===`escalated`?e.reason??e.note:null)??n?.progress??t?.note??e.note??(e.stage===`watching`?`Watching CI on the default branch`:null)??(e.stage===`merged`?`Merged`:te(e.step,e.type))}function P(e,t,n=Date.now()){let r={intake:[],type:[],building:[],reviewing:[],merge:[],merged:[]},i=[],a=new Set;for(let o of[...e.backlog,...e.inProgress,...e.viewRecent,...e.recent]){if(a.has(o.id))continue;a.add(o.id);let s=E(o,e.pullRequests),c=o.activeSessionId??o.sessionId,l=c?t.get(c):void 0,u=A(o,s,l,n),d=j(o,s,n,u);if(!d)continue;let f={item:o,place:d,state:M(o,s,l),pr:s,activity:N(o,s,l),since:o.stepSince??o.updatedAt,sessionId:c,need:u};(d===`needs_you`?i:r[d]).push(f)}let o=(e,t)=>Date.parse(e.since)-Date.parse(t.since);r.building.sort(o),r.reviewing.sort(o);let s=1/0,c=t=>{let n=t.pr?e.pullRequests.indexOf(t.pr):-1;return n===-1?s:n};r.merge.sort((e,t)=>{let n=e.pr?.queuePosition??s,r=t.pr?.queuePosition??s;if(n!==r)return n-r;let i=c(e),a=c(t);return i===a?0:i-a}),r.merged.sort((e,t)=>Date.parse(t.item.mergedAt??t.item.updatedAt)-Date.parse(e.item.mergedAt??e.item.updatedAt));let l=[...Object.values(r).flat(),...i];return{stages:r,needsYou:i,needsPerson:i.length,failed:l.filter(e=>e.state===`failed`||e.item.stage===`failed`).length}}function F(e){return e.issue?`#${e.issue.number}`:e.pr?`PR #${e.pr.number}`:e.title.slice(0,18)}function I(e){let t=ne[e.state];return e.item.stage===`merged`?`${t}, merged`:t}function L(e,t){if(!e||e.state===`checking`||e.state===`merged`||e.state===`superseded`)return null;if(e.state===`queued`)return e.queuePosition?`Queued #${e.queuePosition}`:`Queued`;let n=t[e.state]??e.state;return e.queuePosition?`${n} · #${e.queuePosition}`:n}function R(e){let t=new Map;for(let n of[...Object.values(e.stages).flat(),...e.needsYou])t.set(n.item.id,n.place);return t}function z(e){return e===`needs_you`?C:S.find(t=>t.id===e)?.label??e}function ie(e,t){let n=[];for(let r of[...Object.values(t.stages).flat(),...t.needsYou]){let t=e.get(r.item.id);if(t===r.place)continue;let i=F(r.item);n.push(t?`${i} moved to ${z(r.place)}.`:`${i} arrived in ${z(r.place)}.`)}return n}var B=new Set([`rebasing`,`updating`]);function V(e,t){let n=t?.workKey??``,r=e.item;if(n.startsWith(`factory:integrate:`))return`integrator`;let i=e.pr?.state;return i&&(B.has(i)||i===`rebuilding`&&r.stage!==`building`)?`rebaser`:n.startsWith(`factory:review:`)?`reviewer`:r.stage===`building`||r.stage===`failed`&&e.place===`building`?`builder`:`reviewer`}function H(e,t){let n=e.item;return t===`rebaser`||t===`integrator`?`rebasing`:t===`builder`?n.step===`reproduce`?`reproducing`:n.step===`analyze`?`analyzing`:n.attempts>0?`revising`:`implementing`:n.stage===`watching`||e.pr?.state===`waiting_ci`?`watching_ci`:n.step===`merge`?`merging`:`reviewing`}function U(e,t){return!e.progress||!e.progressAt?!1:t===null||Date.parse(e.progressAt)>=Date.parse(t)}function W(e,t){return e.status===`starting`?`thinking`:e.status===`running`?U(e,t)?`working`:`thinking`:null}function G(e,t){let n=e.item,r=e=>({status:`blocked`,blockedOn:e});if(n.stage===`merged`||n.stage===`watching`)return{status:`done`,blockedOn:null};if(t?.status===`waiting`)return{status:`approval`,blockedOn:null};if(e.state===`failed`||t?.status===`failed`)return r(`failed`);if(t?.status===`interrupted`)return r(`cut_off`);if(e.state===`person`)return r(`person`);let i=e.pr?.state;if(i===`waiting_ci`)return r(`ci`);let a=t?W(t,e.since):null;return a?{status:a,blockedOn:null}:i===`updating`?{status:`working`,blockedOn:null}:r(i===`rebasing`||i===`rebuilding`?`conflicts`:i===`queued`?`turn`:`agent`)}function K(e,t,n){let r=e.item;if(t!==`reviewer`)return e.sessionId;if(r.reviewerSessionId)return r.reviewerSessionId;let i=e.sessionId?n.get(e.sessionId):void 0;return r.step===`review`||i?.workKey?.startsWith(`factory:review:`)?e.sessionId:null}function q(e){let t=e.stages.merged.filter(e=>e.item.stage===`watching`),n=e.needsYou.filter(e=>e.need?.kind===`answer`||e.need?.kind===`approve_spec`);return[...e.stages.building,...e.stages.reviewing,...e.stages.merge,...t,...n].filter(e=>e.pr?.state!==`stuck`)}var J={idle:`Between rounds`,planning:`Planning the round`,reviewing:`Reviewing the areas`,filing:`Filing issues`};function Y({f:e,pipeline:t,sessions:n,pmSessionId:r}){let i=[],a=e=>{let t=e?n.get(e):void 0;return{session:t,provider:t?.provider??null,providerId:t?.providerId??null,model:t?.model??null,progress:t?.progress??null}};for(let e of q(t)){let t=V(e,e.sessionId?n.get(e.sessionId):void 0),r=K(e,t,n),{session:o,...s}=a(r),c=`item:${e.item.id}:${t}`;i.push({key:c,role:t,sessionId:r,card:e,step:H(e,t),activity:null,...G(e,o),failed:e.state===`failed`||o?.status===`failed`,...s,since:e.since,seed:r??c,area:null})}let o=a(r),s=o.session?W(o.session,null):null;i.push({key:`pm`,role:`pm`,sessionId:r,card:null,step:null,activity:s?`Answering`:`Listening`,status:o.session?.status===`waiting`?`approval`:s?`working`:`idle`,blockedOn:null,failed:o.session?.status===`failed`,provider:o.provider,providerId:o.providerId,model:o.model,progress:o.progress,since:null,seed:r??`pm`,area:null});let c=e.mode===`dark_factory`?e.scout:null;if(!c)return i;let l=a(c.sessionId),u=l.session?W(l.session,null):null;i.push({key:`scout`,role:`scout`,sessionId:c.sessionId,card:null,step:null,activity:`${J[c.phase]} (round ${c.rounds})`,status:c.phase===`idle`?`idle`:u??`working`,blockedOn:null,failed:!1,provider:l.provider,providerId:l.providerId,model:l.model,progress:l.progress,since:c.lastRoundAt,seed:c.sessionId??`scout`,area:null});for(let e of c.lenses.slice(0,8)){let t=a(e.sessionId),n=t.session?W(t.session,null):null;i.push({key:`area:${e.area}`,role:`area`,sessionId:e.sessionId,card:null,step:null,activity:`Reviewing ${h[e.area]}`,status:e.reported?`done`:e.active?n??`working`:`blocked`,blockedOn:e.reported||e.active?null:`agent`,failed:!1,provider:t.provider,providerId:t.providerId,model:t.model,progress:t.progress,since:null,seed:e.sessionId,area:e.area})}return i}function ae(e,t,n){let r=e.threads[t],i=t===e.rootThreadId?e.earlierTurns:0;if(!r||r.turnIds.length<=n)return{transcript:e,hidden:i};let a=r.turnIds.slice(-n),o=new Set(a),s=r.itemIds.filter(t=>{let n=e.items[t];return n!==void 0&&o.has(n.turnId)});return{transcript:{...e,threads:{...e.threads,[t]:{...r,turnIds:a,itemIds:s}}},hidden:r.turnIds.length-n+i}}var X=a(),Z=3;function oe({session:e,projectId:t}){let{transcript:r,isLoading:i}=o(e.id,{turns:Z}),a=r?.rootThreadId??e.rootThreadId??null,c=!!(r&&a&&n(r,a)),l=(0,g.useMemo)(()=>r&&a?ae(r,a,Z):null,[r,a]),m=!!(l&&a&&(l.transcript.threads[a]?.itemIds.length??0)>0);return(0,X.jsxs)(X.Fragment,{children:[l&&l.hidden>0&&(0,X.jsxs)(s,{to:`/projects/$projectId/pm`,params:{projectId:t},className:`shrink-0 border-b border-border px-3 py-1.5 text-center text-3xs text-muted-foreground hover:text-foreground`,"data-testid":`factory-view-chat-earlier`,children:[l.hidden,` earlier `,l.hidden===1?`turn`:`turns`,` in the full chat`]}),m&&l&&a?(0,X.jsx)(p,{transcript:l.transcript,threadId:a,sessionId:e.id,contentClassName:`max-w-none px-3 pt-3 pb-2 text-[13px]`}):i?(0,X.jsxs)(`div`,{className:`flex-1 space-y-3 p-3`,children:[(0,X.jsx)(d,{className:`ml-auto h-8 w-2/3 rounded-xl`}),(0,X.jsx)(d,{className:`h-4 w-5/6`})]}):(0,X.jsx)(`p`,{className:`flex-1 p-3 text-2xs text-muted-foreground`,children:`No messages yet.`}),(0,X.jsx)(f,{session:e,running:c}),(0,X.jsx)(u,{session:e,running:c})]})}function se({projectId:e,onCollapse:t,header:n=!0}){let r=ee(`pm`,e);return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`factory-view-chat`,children:[(0,X.jsxs)(`header`,{className:n?`flex h-10 shrink-0 items-center gap-2 border-b border-border px-3`:`hidden`,children:[(0,X.jsx)(c,{className:`size-4 text-primary`,"aria-hidden":!0}),(0,X.jsx)(`h2`,{className:`text-[13px] font-medium`,children:`Project manager`}),r&&(0,X.jsx)(`span`,{className:`text-3xs text-muted-foreground`,children:r.status===`running`?`answering…`:null}),(0,X.jsxs)(s,{to:`/projects/$projectId/pm`,params:{projectId:e},className:`ml-auto inline-flex items-center gap-0.5 text-2xs text-primary hover:underline`,children:[`Open full chat `,(0,X.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}),t&&(0,X.jsx)(`button`,{type:`button`,onClick:t,className:`text-2xs text-muted-foreground hover:text-foreground`,children:`Hide`})]}),r?(0,X.jsx)(oe,{session:r,projectId:e}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`flex-1 p-3 text-2xs text-muted-foreground`,children:`Ask the PM what the factory is doing, or to let an issue in. Your first message starts it.`}),(0,X.jsx)(m,{kind:`pm`,projectId:e})]})]})}var Q={workshop:`Workshop`,lookout:`Lookout`,both:`Both`};function $(e){return e.role===`scout`||e.role===`area`?`lookout`:`workshop`}function ce(e){return e.status===`approval`||e.blockedOn===`person`}function le(e,t,n=!1){return t?(n?[`workshop`,`lookout`]:[`workshop`,`lookout`,`both`]).map(t=>{let n=e.filter(e=>t===`both`||$(e)===t);return{id:t,label:Q[t],count:n.length,waiting:n.some(ce)}}):[]}function ue(e,t,n=!1){return t?e===null?n?`workshop`:`both`:n&&e===`both`?`workshop`:e:`workshop`}export{b as _,se as a,S as c,ie as d,R as f,x as g,y as h,le as i,F as l,P as m,ue as n,Y as o,L as p,$ as r,C as s,Q as t,I as u,v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{jt as t}from"./api-B620HpC2.js";import{n,t as r}from"./jsx-runtime-C3cWAN_r.js";import{L as i,_t as a,dt as o,gt as s,j as c,ot as l,st as u,ut as d}from"./format-D1ma_o2D.js";import{t as f}from"./dist-wxbqfqV1.js";var p=e(n(),1);function m(e){let t=a();return p.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var h=r(),g=Object.defineProperty,_=(e,t)=>g(e,`name`,{value:t,configurable:!0}),v=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),y=p.forwardRef(_(function(e,t){return(0,h.jsx)(o.span,{...e,ref:t,style:{...v,...e.style}})},`VisuallyHidden`)),b=Object.defineProperty,x=(e,t)=>b(e,`name`,{value:t,configurable:!0});function S(e,[t,n]){return Math.min(n,Math.max(t,e))}x(S,`clamp`);var C=Object.defineProperty,w=(e,t)=>C(e,`name`,{value:t,configurable:!0}),T=`Switch`,[E,D]=d(T),[O,k]=E(T);function A(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[m,g]=l({prop:n,defaultProp:i??!1,onChange:c,caller:T}),[_,v]=p.useState(null),[y,b]=p.useState(null),[x,S]=p.useState(null),C={checked:m,setChecked:g,disabled:a,control:_,setControl:v,name:s,form:o,value:d,userClick:x,onUserClick:S,required:u,defaultChecked:i,isFormControl:!_||!!o||!!_.closest(`form`),bubbleInput:y,setBubbleInput:b};return(0,h.jsx)(O,{scope:t,...C,children:R(f)?f(C):r})}w(A,`SwitchProvider`);var j=`SwitchTrigger`,M=p.forwardRef(w(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:c,disabled:l,checked:d,required:f,setControl:m,setChecked:g,onUserClick:_,isFormControl:v,bubbleInput:y}=k(j,e),b=s(r,m),x=p.useRef(d);return p.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=w(()=>g(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,g]),(0,h.jsx)(o.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":z(d),"data-disabled":l?``:void 0,disabled:l,value:c,...n,ref:b,onClick:u(t,e=>{let t=e.isPropagationStopped();_({requestedChecked:!d,hasConsumerStoppedPropagation:t}),g(e=>!e),y&&v&&(t||e.stopPropagation())})})},`SwitchTrigger`)),N=p.forwardRef(w(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,h.jsx)(A,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(M,{...d,ref:t,__scopeSwitch:n}),e&&(0,h.jsx)(L,{__scopeSwitch:n})]})})},`Switch`)),P=`SwitchThumb`,F=p.forwardRef(w(function(e,t){let{__scopeSwitch:n,...r}=e,i=k(P,n);return(0,h.jsx)(o.span,{"data-state":z(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),I=`SwitchBubbleInput`,L=p.forwardRef(w(function({__scopeSwitch:e,onClick:t,...n},r){let{control:a,userClick:c,checked:l,defaultChecked:d,required:f,disabled:m,name:g,value:_,form:v,bubbleInput:y,setBubbleInput:b}=k(I,e),x=s(r,b),S=i(a),C=p.useRef(!1),w=p.useRef(l),T=p.useRef(c),E=p.useRef(null);p.useEffect(()=>{let e=y;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=w.current!==l;w.current=l;let i=c!==null&&c!==T.current;if(T.current=c,i)E.current=r?null:c,r&&n.call(e,l),e.dispatchEvent(new Event(`click`,{bubbles:!c.hasConsumerStoppedPropagation}));else if(r){let t=E.current;E.current=null;let r=t?.requestedChecked===l;C.current=!0,n.call(e,l),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),C.current=!1}},[y,l,c]);let D=p.useRef(l);return(0,h.jsx)(o.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:d??D.current,required:f,disabled:m,name:g,value:_,form:v,...n,tabIndex:-1,ref:x,onClick:u(t,e=>{C.current&&e.stopPropagation()}),style:{...n.style,...S,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function R(e){return typeof e==`function`}w(R,`isFunction`);function z(e){return e?`checked`:`unchecked`}w(z,`getState`);function B(){return{isSecureContext:typeof window<`u`&&window.isSecureContext,clipboard:typeof navigator<`u`?navigator.clipboard:void 0,fallback:H}}async function V(e,t=B()){if(t.isSecureContext&&t.clipboard?.writeText)try{return await t.clipboard.writeText(e),!0}catch{}try{return t.fallback(e)}catch{return!1}}function H(e,t=document){if(!t.body)return!1;let n=t.activeElement instanceof HTMLElement?t.activeElement:null,r=t.getSelection(),i=[];for(let e=0;e<(r?.rangeCount??0);e++){let t=r?.getRangeAt(e);t&&i.push(t)}let a=t.createElement(`textarea`);a.value=e,a.setAttribute(`readonly`,``),a.setAttribute(`aria-hidden`,`true`),a.tabIndex=-1;let o=t.defaultView?.scrollY??0;Object.assign(a.style,{position:`absolute`,left:`-9999px`,top:`${o}px`,fontSize:`16px`,border:`0`,padding:`0`,margin:`0`,whiteSpace:`pre`}),(n?.closest(`[role="dialog"], [role="alertdialog"], [role="menu"]`)??t.body).appendChild(a);let s=!1;try{a.focus({preventScroll:!0}),a.select(),a.setSelectionRange(0,e.length),s=t.execCommand(`copy`)}catch{s=!1}finally{if(a.remove(),r){r.removeAllRanges();for(let e of i)r.addRange(e)}n?.focus({preventScroll:!0})}return s}function U(e){typeof navigator>`u`||navigator.clipboard||Object.defineProperty(navigator,"clipboard",{configurable:!0,value:{writeText:async t=>{if(!H(t))throw e(),Error(`Copy failed`)}}})}var W=50;function G(e,t){let n=new Map,r=0;e.onNotificationClick(e=>{let t=n.get(e);n.delete(e),t?.()});let i;return e.browser?.onShortcut(e=>{window.dispatchEvent(new KeyboardEvent(`keydown`,{...e,bubbles:!0,cancelable:!0}))}),{capabilities:{notifications:!0,badge:!0,clipboardImages:t.capabilities.clipboardImages,folderPicker:!0,osIntegration:!0,nativeBrowser:!!e.browser},nativeBrowser:e.browser??null,notificationPermission:()=>`granted`,requestNotificationPermission:async()=>`granted`,notify(t,i){let a=i?.tag??`n${++r}`;if(i?.onClick)for(n.delete(a),n.set(a,i.onClick);n.size>W;){let e=n.keys().next().value;if(e===void 0)break;n.delete(e)}e.notify({title:t,body:i?.body,tag:a})},openExternal:t=>e.openExternal(t),setBadge(t){e.setBadge(t)},writeClipboard:e=>t.writeClipboard(e),readClipboardImage:()=>t.readClipboardImage(),isFocused:()=>t.isFocused(),pickFolder:t=>e.pickFolder(t),onNavigate:t=>e.onNavigate(t),launchAtLoginSupported(){return i??=e.info().then(e=>e.launchAtLoginSupported,()=>!1),i}}}var K=typeof document<`u`?document.title:`CodeDen`;function q(){let e=typeof window<`u`&&`Notification`in window,t=typeof navigator<`u`?navigator:void 0;return{capabilities:{notifications:e,badge:!!t?.setAppBadge,clipboardImages:!!(t?.clipboard&&`read`in t.clipboard),folderPicker:!1,osIntegration:!1,nativeBrowser:!1},nativeBrowser:null,notificationPermission:()=>e?Notification.permission:`unsupported`,async requestNotificationPermission(){return e?Notification.requestPermission():`unsupported`},notify(t,n){if(!e||Notification.permission!==`granted`)return;let r=new Notification(t,{body:n?.body,tag:n?.tag,icon:`/favicon.svg`});r.onclick=()=>{window.focus(),n?.onClick?.(),r.close()}},openExternal(e){window.open(e,`_blank`,`noopener,noreferrer`)},setBadge(e){document.title=e>0?`(${e}) ${K}`:K,t?.setAppBadge&&(e>0?t.setAppBadge(e):t.clearAppBadge?.())},writeClipboard:e=>V(e),async readClipboardImage(){if(!t?.clipboard||!(`read`in t.clipboard))return null;let e=await t.clipboard.read();for(let t of e){let e=t.types.find(e=>e.startsWith(`image/`));if(e)return t.getType(e)}return null},isFocused:()=>document.hasFocus()&&document.visibilityState===`visible`,pickFolder:async()=>null,onNavigate:()=>()=>{},launchAtLoginSupported:async()=>!1}}function J(e){let t=q();return e?.codedenDesktop?G(e.codedenDesktop,t):t}var Y=J(typeof window<`u`?window:void 0);function X(){c.error(`Couldn't copy. Select the text and copy it manually.`)}async function Z(e,t){let n=await Y.writeClipboard(e);return n?t&&c.success(t):X(),n}var Q=(e,t)=>e===t||e!==null&&t!==null&&e.top===t.top&&e.left===t.left&&e.right===t.right&&e.viewportWidth===t.viewportWidth&&e.viewportHeight===t.viewportHeight,$=t()((e,t)=>({paletteOpen:!1,handoff:null,review:null,addProjectOpen:!1,shortcutsOpen:!1,navOpen:!1,nativeBrowserShown:!1,composerBounds:null,setPaletteOpen:t=>e({paletteOpen:t}),setHandoff:t=>e({handoff:t}),setReview:t=>e({review:t}),setAddProjectOpen:t=>e({addProjectOpen:t}),setShortcutsOpen:t=>e({shortcutsOpen:t}),setNavOpen:t=>e({navOpen:t}),setNativeBrowserShown:t=>e({nativeBrowserShown:t}),setComposerBounds:n=>{Q(t().composerBounds,n)||e({composerBounds:n})}})),ee=`M15.04 5.78L10.7 5.78A1.04 1.04 0 0 0 9.8 6.3L4.5 15.48A1.04 1.04 0 0 0 4.5 16.52L9.8 25.7A1.04 1.04 0 0 0 10.7 26.22L15.04 26.22L15.04 21.54L13.1 21.54A0.52 0.52 0 0 1 12.65 21.28L9.75 16.26A0.52 0.52 0 0 1 9.75 15.74L12.65 10.72A0.52 0.52 0 0 1 13.1 10.46L15.04 10.46ZM16.96 5.78L21.3 5.78A1.04 1.04 0 0 1 22.2 6.3L27.5 15.48A1.04 1.04 0 0 1 27.5 16.52L22.2 25.7A1.04 1.04 0 0 1 21.3 26.22L16.96 26.22ZM19.32 12.22A0.42 0.42 0 0 1 20.1 12.01L22.25 15.74A0.52 0.52 0 0 1 22.25 16.26L20.1 19.99A0.42 0.42 0 0 1 19.32 19.78Z`;function te({className:e}){return(0,h.jsxs)(`svg`,{viewBox:`0 0 32 32`,className:f(`shrink-0`,e),"aria-hidden":`true`,children:[(0,h.jsx)(`rect`,{width:`32`,height:`32`,rx:`8`,className:`fill-foreground/[0.06]`}),(0,h.jsx)(`path`,{d:ee,fillRule:`evenodd`,className:`fill-primary`})]})}function ne({className:e,size:t=`default`,...n}){return(0,h.jsx)(N,{"data-slot":`switch`,"data-size":t,className:f(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,h.jsx)(F,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}export{X as a,S as c,m as d,Z as i,v as l,te as n,Y as o,$ as r,U as s,ne as t,y as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{jt as t}from"./api-yvn34iKU.js";import{n,t as r}from"./jsx-runtime-C3cWAN_r.js";import{L as i,_t as a,dt as o,gt as s,j as c,ot as l,st as u,ut as d}from"./format-D3kairnQ.js";import{t as f}from"./dist-wxbqfqV1.js";var p=e(n(),1);function m(e){let t=a();return p.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var h=r(),g=Object.defineProperty,_=(e,t)=>g(e,`name`,{value:t,configurable:!0}),v=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),y=p.forwardRef(_(function(e,t){return(0,h.jsx)(o.span,{...e,ref:t,style:{...v,...e.style}})},`VisuallyHidden`)),b=Object.defineProperty,x=(e,t)=>b(e,`name`,{value:t,configurable:!0});function S(e,[t,n]){return Math.min(n,Math.max(t,e))}x(S,`clamp`);var C=Object.defineProperty,w=(e,t)=>C(e,`name`,{value:t,configurable:!0}),T=`Switch`,[E,D]=d(T),[O,k]=E(T);function A(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[m,g]=l({prop:n,defaultProp:i??!1,onChange:c,caller:T}),[_,v]=p.useState(null),[y,b]=p.useState(null),[x,S]=p.useState(null),C={checked:m,setChecked:g,disabled:a,control:_,setControl:v,name:s,form:o,value:d,userClick:x,onUserClick:S,required:u,defaultChecked:i,isFormControl:!_||!!o||!!_.closest(`form`),bubbleInput:y,setBubbleInput:b};return(0,h.jsx)(O,{scope:t,...C,children:R(f)?f(C):r})}w(A,`SwitchProvider`);var j=`SwitchTrigger`,M=p.forwardRef(w(function({__scopeSwitch:e,onClick:t,...n},r){let{control:i,form:a,value:c,disabled:l,checked:d,required:f,setControl:m,setChecked:g,onUserClick:_,isFormControl:v,bubbleInput:y}=k(j,e),b=s(r,m),x=p.useRef(d);return p.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=w(()=>g(x.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,g]),(0,h.jsx)(o.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":z(d),"data-disabled":l?``:void 0,disabled:l,value:c,...n,ref:b,onClick:u(t,e=>{let t=e.isPropagationStopped();_({requestedChecked:!d,hasConsumerStoppedPropagation:t}),g(e=>!e),y&&v&&(t||e.stopPropagation())})})},`SwitchTrigger`)),N=p.forwardRef(w(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,h.jsx)(A,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(M,{...d,ref:t,__scopeSwitch:n}),e&&(0,h.jsx)(L,{__scopeSwitch:n})]})})},`Switch`)),P=`SwitchThumb`,F=p.forwardRef(w(function(e,t){let{__scopeSwitch:n,...r}=e,i=k(P,n);return(0,h.jsx)(o.span,{"data-state":z(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})},`SwitchThumb`)),I=`SwitchBubbleInput`,L=p.forwardRef(w(function({__scopeSwitch:e,onClick:t,...n},r){let{control:a,userClick:c,checked:l,defaultChecked:d,required:f,disabled:m,name:g,value:_,form:v,bubbleInput:y,setBubbleInput:b}=k(I,e),x=s(r,b),S=i(a),C=p.useRef(!1),w=p.useRef(l),T=p.useRef(c),E=p.useRef(null);p.useEffect(()=>{let e=y;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set;if(!n)return;let r=w.current!==l;w.current=l;let i=c!==null&&c!==T.current;if(T.current=c,i)E.current=r?null:c,r&&n.call(e,l),e.dispatchEvent(new Event(`click`,{bubbles:!c.hasConsumerStoppedPropagation}));else if(r){let t=E.current;E.current=null;let r=t?.requestedChecked===l;C.current=!0,n.call(e,l),e.dispatchEvent(new Event(`click`,{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),C.current=!1}},[y,l,c]);let D=p.useRef(l);return(0,h.jsx)(o.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:d??D.current,required:f,disabled:m,name:g,value:_,form:v,...n,tabIndex:-1,ref:x,onClick:u(t,e=>{C.current&&e.stopPropagation()}),style:{...n.style,...S,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function R(e){return typeof e==`function`}w(R,`isFunction`);function z(e){return e?`checked`:`unchecked`}w(z,`getState`);function B(){return{isSecureContext:typeof window<`u`&&window.isSecureContext,clipboard:typeof navigator<`u`?navigator.clipboard:void 0,fallback:H}}async function V(e,t=B()){if(t.isSecureContext&&t.clipboard?.writeText)try{return await t.clipboard.writeText(e),!0}catch{}try{return t.fallback(e)}catch{return!1}}function H(e,t=document){if(!t.body)return!1;let n=t.activeElement instanceof HTMLElement?t.activeElement:null,r=t.getSelection(),i=[];for(let e=0;e<(r?.rangeCount??0);e++){let t=r?.getRangeAt(e);t&&i.push(t)}let a=t.createElement(`textarea`);a.value=e,a.setAttribute(`readonly`,``),a.setAttribute(`aria-hidden`,`true`),a.tabIndex=-1;let o=t.defaultView?.scrollY??0;Object.assign(a.style,{position:`absolute`,left:`-9999px`,top:`${o}px`,fontSize:`16px`,border:`0`,padding:`0`,margin:`0`,whiteSpace:`pre`}),(n?.closest(`[role="dialog"], [role="alertdialog"], [role="menu"]`)??t.body).appendChild(a);let s=!1;try{a.focus({preventScroll:!0}),a.select(),a.setSelectionRange(0,e.length),s=t.execCommand(`copy`)}catch{s=!1}finally{if(a.remove(),r){r.removeAllRanges();for(let e of i)r.addRange(e)}n?.focus({preventScroll:!0})}return s}function U(e){typeof navigator>`u`||navigator.clipboard||Object.defineProperty(navigator,"clipboard",{configurable:!0,value:{writeText:async t=>{if(!H(t))throw e(),Error(`Copy failed`)}}})}var W=50;function G(e,t){let n=new Map,r=0;e.onNotificationClick(e=>{let t=n.get(e);n.delete(e),t?.()});let i;return e.browser?.onShortcut(e=>{window.dispatchEvent(new KeyboardEvent(`keydown`,{...e,bubbles:!0,cancelable:!0}))}),{capabilities:{notifications:!0,badge:!0,clipboardImages:t.capabilities.clipboardImages,folderPicker:!0,osIntegration:!0,nativeBrowser:!!e.browser},nativeBrowser:e.browser??null,notificationPermission:()=>`granted`,requestNotificationPermission:async()=>`granted`,notify(t,i){let a=i?.tag??`n${++r}`;if(i?.onClick)for(n.delete(a),n.set(a,i.onClick);n.size>W;){let e=n.keys().next().value;if(e===void 0)break;n.delete(e)}e.notify({title:t,body:i?.body,tag:a})},openExternal:t=>e.openExternal(t),setBadge(t){e.setBadge(t)},writeClipboard:e=>t.writeClipboard(e),readClipboardImage:()=>t.readClipboardImage(),isFocused:()=>t.isFocused(),pickFolder:t=>e.pickFolder(t),onNavigate:t=>e.onNavigate(t),launchAtLoginSupported(){return i??=e.info().then(e=>e.launchAtLoginSupported,()=>!1),i}}}var K=typeof document<`u`?document.title:`CodeDen`;function q(){let e=typeof window<`u`&&`Notification`in window,t=typeof navigator<`u`?navigator:void 0;return{capabilities:{notifications:e,badge:!!t?.setAppBadge,clipboardImages:!!(t?.clipboard&&`read`in t.clipboard),folderPicker:!1,osIntegration:!1,nativeBrowser:!1},nativeBrowser:null,notificationPermission:()=>e?Notification.permission:`unsupported`,async requestNotificationPermission(){return e?Notification.requestPermission():`unsupported`},notify(t,n){if(!e||Notification.permission!==`granted`)return;let r=new Notification(t,{body:n?.body,tag:n?.tag,icon:`/favicon.svg`});r.onclick=()=>{window.focus(),n?.onClick?.(),r.close()}},openExternal(e){window.open(e,`_blank`,`noopener,noreferrer`)},setBadge(e){document.title=e>0?`(${e}) ${K}`:K,t?.setAppBadge&&(e>0?t.setAppBadge(e):t.clearAppBadge?.())},writeClipboard:e=>V(e),async readClipboardImage(){if(!t?.clipboard||!(`read`in t.clipboard))return null;let e=await t.clipboard.read();for(let t of e){let e=t.types.find(e=>e.startsWith(`image/`));if(e)return t.getType(e)}return null},isFocused:()=>document.hasFocus()&&document.visibilityState===`visible`,pickFolder:async()=>null,onNavigate:()=>()=>{},launchAtLoginSupported:async()=>!1}}function J(e){let t=q();return e?.codedenDesktop?G(e.codedenDesktop,t):t}var Y=J(typeof window<`u`?window:void 0);function X(){c.error(`Couldn't copy. Select the text and copy it manually.`)}async function Z(e,t){let n=await Y.writeClipboard(e);return n?t&&c.success(t):X(),n}var Q=(e,t)=>e===t||e!==null&&t!==null&&e.top===t.top&&e.left===t.left&&e.right===t.right&&e.viewportWidth===t.viewportWidth&&e.viewportHeight===t.viewportHeight,$=t()((e,t)=>({paletteOpen:!1,handoff:null,review:null,addProjectOpen:!1,shortcutsOpen:!1,navOpen:!1,nativeBrowserShown:!1,composerBounds:null,setPaletteOpen:t=>e({paletteOpen:t}),setHandoff:t=>e({handoff:t}),setReview:t=>e({review:t}),setAddProjectOpen:t=>e({addProjectOpen:t}),setShortcutsOpen:t=>e({shortcutsOpen:t}),setNavOpen:t=>e({navOpen:t}),setNativeBrowserShown:t=>e({nativeBrowserShown:t}),setComposerBounds:n=>{Q(t().composerBounds,n)||e({composerBounds:n})}})),ee=`M15.04 5.78L10.7 5.78A1.04 1.04 0 0 0 9.8 6.3L4.5 15.48A1.04 1.04 0 0 0 4.5 16.52L9.8 25.7A1.04 1.04 0 0 0 10.7 26.22L15.04 26.22L15.04 21.54L13.1 21.54A0.52 0.52 0 0 1 12.65 21.28L9.75 16.26A0.52 0.52 0 0 1 9.75 15.74L12.65 10.72A0.52 0.52 0 0 1 13.1 10.46L15.04 10.46ZM16.96 5.78L21.3 5.78A1.04 1.04 0 0 1 22.2 6.3L27.5 15.48A1.04 1.04 0 0 1 27.5 16.52L22.2 25.7A1.04 1.04 0 0 1 21.3 26.22L16.96 26.22ZM19.32 12.22A0.42 0.42 0 0 1 20.1 12.01L22.25 15.74A0.52 0.52 0 0 1 22.25 16.26L20.1 19.99A0.42 0.42 0 0 1 19.32 19.78Z`;function te({className:e}){return(0,h.jsxs)(`svg`,{viewBox:`0 0 32 32`,className:f(`shrink-0`,e),"aria-hidden":`true`,children:[(0,h.jsx)(`rect`,{width:`32`,height:`32`,rx:`8`,className:`fill-foreground/[0.06]`}),(0,h.jsx)(`path`,{d:ee,fillRule:`evenodd`,className:`fill-primary`})]})}function ne({className:e,size:t=`default`,...n}){return(0,h.jsx)(N,{"data-slot":`switch`,"data-size":t,className:f(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,h.jsx)(F,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}export{X as a,S as c,m as d,Z as i,v as l,te as n,Y as o,$ as r,U as s,ne as t,y as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./jsx-runtime-C3cWAN_r.js";import{i as r}from"./api-B620HpC2.js";import{t as i}from"./dist-wxbqfqV1.js";import{r as a}from"./theme-DsW-i9mD.js";var o=2,s=1,c=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),c={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},l=c.top+c.bottom,u=c.right+c.left,d=r-l,f=i-u-t;return{cols:Math.max(o,Math.floor(f/e.css.cell.width)),rows:Math.max(s,Math.floor(d/e.css.cell.height))}}},l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,r)=>{for(var i=r>1?void 0:r?u(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&l(t,n,i),i},p=(e,t)=>(n,r)=>t(n,r,e),m=`Terminal input`,h={get:()=>m,set:e=>m=e},g=`Too much output to announce, navigate to rows manually to read`,_={get:()=>g,set:e=>g=e};function ee(e){return e.replace(/\r?\n/g,`\r`)}function te(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ne(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function re(e,t,n,r){e.stopPropagation(),e.clipboardData&&ie(e.clipboardData.getData(`text/plain`),t,n,r)}function ie(e,t,n,r){e=ee(e),e=te(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ae(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function oe(e,t,n,r,i){ae(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function v(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function se(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var y=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},ce=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128||(c=(i&31)<<6|a&63,c<128)){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},b=``,le=` `,ue=class e{constructor(){this.fg=0,this.bg=0,this.extended=new de}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},de=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},x=class e extends ue{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new de,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?v(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fe=`di$target`,S=`di$dependencies`,pe=new Map;function me(e){return e[S]||[]}function C(e){if(pe.has(e))return pe.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);he(t,e,r)};return t._id=e,pe.set(e,t),t}function he(e,t,n){t[fe]===t?t[S].push({id:e,index:n}):(t[S]=[{id:e,index:n}],t[fe]=t)}var w=C(`BufferService`),T=C(`CoreMouseService`),ge=C(`CoreService`),_e=C(`CharsetService`),ve=C(`InstantiationService`),ye=C(`LogService`),E=C(`OptionsService`),be=C(`OscLinkService`),xe=C(`UnicodeService`),D=C(`DecorationService`),Se=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new x,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ce(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Se=f([p(0,w),p(1,E),p(2,be)],Se);function Ce(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./jsx-runtime-C3cWAN_r.js";import{i as r}from"./api-yvn34iKU.js";import{t as i}from"./dist-wxbqfqV1.js";import{r as a}from"./theme-3eeE0sp4.js";var o=2,s=1,c=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),c={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},l=c.top+c.bottom,u=c.right+c.left,d=r-l,f=i-u-t;return{cols:Math.max(o,Math.floor(f/e.css.cell.width)),rows:Math.max(s,Math.floor(d/e.css.cell.height))}}},l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,r)=>{for(var i=r>1?void 0:r?u(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&l(t,n,i),i},p=(e,t)=>(n,r)=>t(n,r,e),m=`Terminal input`,h={get:()=>m,set:e=>m=e},g=`Too much output to announce, navigate to rows manually to read`,_={get:()=>g,set:e=>g=e};function ee(e){return e.replace(/\r?\n/g,`\r`)}function te(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ne(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function re(e,t,n,r){e.stopPropagation(),e.clipboardData&&ie(e.clipboardData.getData(`text/plain`),t,n,r)}function ie(e,t,n,r){e=ee(e),e=te(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ae(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function oe(e,t,n,r,i){ae(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function v(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function se(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var y=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},ce=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128||(c=(i&31)<<6|a&63,c<128)){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},b=``,le=` `,ue=class e{constructor(){this.fg=0,this.bg=0,this.extended=new de}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},de=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},x=class e extends ue{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new de,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?v(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fe=`di$target`,S=`di$dependencies`,pe=new Map;function me(e){return e[S]||[]}function C(e){if(pe.has(e))return pe.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);he(t,e,r)};return t._id=e,pe.set(e,t),t}function he(e,t,n){t[fe]===t?t[S].push({id:e,index:n}):(t[S]=[{id:e,index:n}],t[fe]=t)}var w=C(`BufferService`),T=C(`CoreMouseService`),ge=C(`CoreService`),_e=C(`CharsetService`),ve=C(`InstantiationService`),ye=C(`LogService`),E=C(`OptionsService`),be=C(`OscLinkService`),xe=C(`UnicodeService`),D=C(`DecorationService`),Se=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new x,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ce(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Se=f([p(0,w),p(1,E),p(2,be)],Se);function Ce(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
2
2
|
|
|
3
3
|
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var we=C(`CharSizeService`),Te=C(`CoreBrowserService`),Ee=C(`MouseService`),De=C(`RenderService`),Oe=C(`SelectionService`),ke=C(`CharacterJoinerService`),Ae=C(`ThemeService`),je=C(`LinkProviderService`),Me=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Re.isErrorNoTelemetry(e)?new Re(e.message+`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jt as e}from"./api-
|
|
1
|
+
import{jt as e}from"./api-yvn34iKU.js";function t(e,t){let r;try{r=e()}catch{return}return{getItem:e=>{let i=e=>e===null?null:JSON.parse(e,t?.reviver),a=r.getItem(e)??null;return n(a)?a.then(i):i(a)},setItem:(e,n)=>r.setItem(e,JSON.stringify(n,t?.replacer)),removeItem:e=>r.removeItem(e)}}var n=e=>typeof e?.then==`function`,r=e=>({then(t){return t?i(t)(e):this}}),i=e=>t=>{try{let i=e(t);return n(i)?i:r(i)}catch(e){return{then(t,n){return n?i(n)(e):this}}}},a=(e,r)=>(a,o,s)=>{let c={storage:t(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...r},l=!1,u=0,d=new Set,f=new Set,p=c.storage;if(!p)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),a(...e)},o,s);let m=()=>{let e=c.partialize({...o()});return p.setItem(c.name,{state:e,version:c.version})},h=s.setState;s.setState=(...e)=>(h(...e),m());let g=e((...e)=>(a(...e),m()),o,s);s.getInitialState=()=>g;let _,v=()=>{if(!p)return;let e=++u;l=!1,d.forEach(e=>e(o()??g));let t=c.onRehydrateStorage?.call(c,o()??g)||void 0;return i(p.getItem.bind(p))(c.name).then(e=>{if(e){if(typeof e.version==`number`&&e.version!==c.version){if(c.migrate){let t=c.migrate(e.state,e.version);return n(t)?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state]}return[!1,void 0]}).then(t=>{if(e!==u)return;let[n,r]=t;if(_=c.merge(r,o()??g),a(_,!0),n)return m()}).then(()=>{e===u&&(t?.(o(),void 0),_=o(),l=!0,f.forEach(e=>e(_)))}).then(()=>void 0,n=>{e===u&&t?.(void 0,n)})};return s.persist={setOptions:e=>{c={...c,...e},e.storage&&(p=e.storage)},clearStorage:()=>{++u,p?.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>{try{return Promise.resolve(v())}catch(e){return Promise.reject(e)}},hasHydrated:()=>l,onHydrate:e=>(d.add(e),()=>{d.delete(e)}),onFinishHydration:e=>(f.add(e),()=>{f.delete(e)})},c.skipHydration||v(),_||g};function o(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`:e}function s(e){document.documentElement.classList.toggle(`dark`,o(e)===`dark`)}function c(){return o(l(e=>e.preference))}var l=e()(a((e,t)=>({preference:`dark`,setPreference:t=>e({preference:t}),toggle:()=>e({preference:o(t().preference)===`dark`?`light`:`dark`})}),{name:`codeden.theme`}));export{a,l as i,o as n,c as r,s as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{B as t,C as n,D as r,O as i,S as a,a as o,c as s,d as c,i as l,j as u,k as d,m as f,n as p,s as m,u as h,v as g,y as _,yt as v,z as y}from"./format-D1ma_o2D.js";import{Ar as b,B as x,Cr as S,Dr as ee,E as C,Fr as te,Ft as ne,Ht as re,Jn as ie,Kn as ae,Kt as oe,Lr as se,Lt as w,Mr as ce,Nn as le,O as ue,On as T,Or as de,P as fe,Pn as pe,Pr as me,Qn as he,Qt as ge,Rn as _e,Rr as ve,S as ye,T as be,Tt as xe,U as Se,Un as Ce,V as we,Vt as Te,Wn as Ee,Yt as De,Zn as Oe,ar as ke,br as Ae,cn as je,dn as E,dr as Me,er as Ne,et as Pe,gt as Fe,h as Ie,hn as Le,i as Re,j as ze,jn as Be,kt as Ve,m as He,mn as Ue,mt as We,n as Ge,nn as Ke,nr as qe,nt as Je,o as Ye,or as Xe,ot as Ze,q as Qe,r as $e,sn as et,sr as D,tr as O,un as tt,ur as k,ut as nt,wt as rt,yn as it,zt as at}from"./icons-COCLuOtb.js";import{n as ot,t as st}from"./jsx-runtime-C3cWAN_r.js";import{i as ct,r as lt,t as ut}from"./bits-B2GRjm37.js";import{i as dt,n as ft}from"./new-session-GpxXZWbB.js";import{t as A}from"./skeleton-D8Sbd2jT.js";import{E as pt,_t as mt,bt as ht,f as gt,gt as _t,h as j,ht as vt,i as M,q as yt,xt as bt}from"./api-B620HpC2.js";import{r as xt}from"./composer-Dd8joSgj.js";import{c as St,o as Ct,r as wt,s as Tt,t as Et}from"./dialog-Dyw3b_Tu.js";import{t as N}from"./dist-wxbqfqV1.js";import{i as Dt,o as Ot}from"./switch-DuBpF2_h.js";import{t as kt}from"./orchestration-pknfiYFr.js";import{t as At}from"./markdown-ad2jia51.js";import{F as P,I as F,O as jt,R as I,a as Mt,c as Nt,k as Pt,o as Ft,t as It,u as Lt}from"./mobile-nav-D8FZcJzG.js";import{L,c as Rt,f as zt,i as R,l as Bt,p as Vt,r as Ht,t as Ut,u as Wt,v as z}from"./dropdown-menu-C4XI7F63.js";import{F as Gt,t as Kt}from"./useQuery-VSotSwry.js";import{t as qt}from"./textarea-gD4G5Znx.js";import{a as Jt,i as Yt,n as Xt,o as Zt,s as Qt,t as $t}from"./shallow-CbfSRfYC.js";import{o as en,t as tn}from"./api-jkvqht5P.js";import{d as nn,f as B,o as rn,p as an,s as on,u as sn}from"./format-CPIs7kVL.js";import{r as cn}from"./github-bits-BLf93Pkz.js";import{n as ln}from"./clsx-BxLRjTE8.js";import{n as un,t as dn}from"./question-card-4aNx5IRX.js";var V=e(ot(),1);function fn(e){if(e.code!==`check_run`)return null;let t=vt.safeParse(e.data);return t.success?t.data:null}function pn(e,t){let n=e.threads[t]?.turnIds.at(-1);if(!n)return!1;let r=e.items[_t(n)]?.item;return r?.kind===`notice`&&r.status===`in_progress`&&fn(r)!==null}var mn=new Set([`plan`,`todo_list`,`approval_request`,`user_question`,`subagent`,`notice`,`error`]);function hn(e){return e.outcome===`failed`||e.outcome===`blocked`}function gn(e){return e.kind===`tool_call`||e.kind===`reasoning`||e.kind===`hook_run`}function _n(e,t){let n=j(e,t),r=[],i=null,a=new Map,o=()=>{if(!i)return;let e=i.entries.some(e=>e.status===`in_progress`);r.push({key:`work:${i.firstId}`,type:`work`,turnId:i.turnId,entries:i.entries,live:e}),i=null},s=n=>{if(!n)return;let i=e.turns[n];if(!i)return;if(i.status===`running`){r.push({key:`working:${n}`,type:`working`,turn:i});return}let o=i.completedAt&&i.startedAt?Date.parse(i.completedAt)-Date.parse(i.startedAt):null;r.push({key:`end:${n}`,type:`turn-end`,turn:i,filesChanged:a.get(n)?.size??0,durationMs:o,latest:e.threads[t]?.turnIds.at(-1)===n})},c=null;for(let e of n){let{item:t,turnId:n}=e;if(t.kind!==`followups`){if(c!==null&&n!==c&&(o(),s(c)),c=n,t.kind===`tool_call`&&t.toolKind===`file_edit`){let e=a.get(n)??new Set;for(let n of t.changes)e.add(n.path);a.set(n,e)}t.kind===`hook_run`&&hn(t)?(o(),r.push({key:t.id,type:`hook`,item:t})):gn(t)?i&&i.turnId===n?i.entries.push(t):(o(),i={turnId:n,entries:[t],firstId:t.id}):(o(),t.kind===`user_message`?r.push({key:t.id,type:`user`,item:t}):t.kind===`assistant_message`?r.push({key:t.id,type:`assistant`,item:t,streaming:t.status===`in_progress`}):mn.has(t.kind)&&r.push({key:t.id,type:`card`,item:t}))}}return o(),s(c),r}function vn(e,t){return e.findIndex(e=>{switch(e.type){case`user`:case`assistant`:case`hook`:case`card`:return e.item.id===t;case`work`:return e.entries.some(e=>e.id===t);default:return!1}})}function yn(e,t){let n=e.threads[t]?.turnIds.at(-1);if(!n||e.turns[n]?.status!==`completed`)return null;let r=j(e,t).filter(e=>e.turnId===n);for(let e=r.length-1;e>=0;e--){let t=r[e]?.item;if(t?.kind===`followups`)return t.suggestions}return null}function bn(e,t){let n=e.turns[t];if(!n)return null;let r=j(e,n.threadId).filter(e=>e.turnId===t);for(let e=r.length-1;e>=0;e--){let t=r[e]?.item;if(t?.kind===`assistant_message`)return t.text}return null}var xn={command:[`Ran`,`command`,`commands`],file_edit:[`Edited`,`file`,`files`],file_read:[`Read`,`file`,`files`],search:[`Searched`,`time`,`times`],web:[`Fetched`,`page`,`pages`],mcp:[`Called`,`tool`,`tools`],browser:[`Used the browser`,`time`,`times`],other:[`Ran`,`action`,`actions`]},Sn=[`file_edit`,`command`,`browser`,`mcp`,`search`,`file_read`,`web`,`other`];function Cn(e){let t=new Map,n=0,r=e.filter(e=>e.kind!==`hook_run`);if(r.length===0)return wn(e.length);for(let e of r)e.kind===`reasoning`?n++:e.toolKind===`file_edit`?t.set(`file_edit`,(t.get(`file_edit`)??0)+Math.max(1,e.changes.length)):t.set(e.toolKind,(t.get(e.toolKind)??0)+1);if(t.size===0)return n>1?`Thought ${n} times`:`Thought`;let i=Sn.filter(e=>t.has(e)),a=i.slice(0,2).map((e,n)=>{let r=t.get(e)??0,[i,a,o]=xn[e],s=n===0?i:i.toLowerCase();return e===`browser`?`${s} ${r>1?`${r} ${o}`:``}`.trim():`${s} ${r} ${r===1?a:o}`}),o=i.slice(2).reduce((e,n)=>e+(t.get(n)??0),0);return o>0?`${a.join(`, `)} and ${o} more`:a.join(` and `).replace(/^(\w)/,e=>e.toUpperCase())}function wn(e){return`${e} ${e===1?`hook`:`hooks`} ran`}function Tn(e){let t=[],n=[],r=()=>{let[e]=n;n.length===1&&e?t.push({type:`step`,step:e}):e&&t.push({type:`hooks`,key:`hooks:${e.id}`,runs:n}),n=[]};for(let i of e)i.kind===`hook_run`&&i.outcome===`succeeded`?n.push(i):(r(),t.push({type:`step`,step:i}));return r(),t}var H=st(),En=(0,V.createContext)(null);function U({images:e,children:t}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(0),o=(0,V.useRef)(new Map),s={images:e,open:e=>{a(e),r(!0)},register:(e,t)=>{t?o.current.set(e,t):o.current.delete(e)}};return(0,H.jsxs)(En.Provider,{value:s,children:[t,(0,H.jsx)(Dn,{images:e,index:Math.min(i,e.length-1),open:n&&e.length>0,onIndexChange:a,onOpenChange:r,returnFocus:()=>o.current.get(i)?.focus()})]})}function W({index:e,className:t,children:n}){let r=(0,V.useContext)(En);if(!r)throw Error(`ImageThumbnail must be inside an ImageGallery`);let i=r.images[e];return(0,H.jsx)(`button`,{type:`button`,ref:t=>r.register(e,t),"aria-label":`View ${i?.name??`image`}`,title:`View full screen`,onClick:()=>r.open(e),className:N(`cursor-zoom-in outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,t),children:n})}var G=`text-white/80 hover:bg-white/10 hover:text-white dark:hover:bg-white/10`;function Dn({images:e,index:n,open:r,onIndexChange:i,onOpenChange:a,returnFocus:o}){let s=(0,V.useRef)(null),c=e[n],l=e.length>1,u=t=>i((n+t+e.length)%e.length);return c?(0,H.jsx)(Et,{open:r,onOpenChange:a,children:(0,H.jsxs)(Tt,{children:[(0,H.jsx)(Ct,{className:`bg-black/85 supports-backdrop-filter:backdrop-blur-sm`}),(0,H.jsxs)(t,{"data-testid":`image-viewer`,"data-backdrop":!0,onKeyDown:e=>{if(l){if(e.key===`ArrowLeft`)u(-1);else if(e.key===`ArrowRight`)u(1);else return;e.preventDefault()}},onClick:e=>{e.target instanceof HTMLElement&&e.target.dataset.backdrop!==void 0&&a(!1)},onOpenAutoFocus:e=>{e.preventDefault(),s.current?.focus()},onCloseAutoFocus:e=>{e.preventDefault(),o()},...c.caption?{}:{"aria-describedby":void 0},className:`fixed inset-0 z-50 flex flex-col text-white outline-none duration-150 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0`,children:[(0,H.jsxs)(`header`,{"data-backdrop":!0,className:`flex shrink-0 items-center gap-3 px-4 py-3`,children:[(0,H.jsx)(St,{className:`min-w-0 truncate text-sm font-medium text-white/90`,children:c.name}),l&&(0,H.jsxs)(`span`,{className:`shrink-0 text-xs text-white/60 tabular-nums`,children:[n+1,` / `,e.length]}),(0,H.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(f,{variant:`ghost`,size:`sm`,className:G,asChild:!0,children:(0,H.jsxs)(`a`,{href:c.src,download:c.downloadName??``,children:[(0,H.jsx)(Ee,{}),` Download`]})}),(0,H.jsx)(y,{asChild:!0,children:(0,H.jsx)(f,{ref:s,variant:`ghost`,size:`icon-sm`,className:G,"aria-label":`Close`,children:(0,H.jsx)(Ge,{})})})]})]}),(0,H.jsxs)(`div`,{"data-backdrop":!0,className:`relative flex min-h-0 flex-1 items-center justify-center px-4 pb-4 sm:px-16`,children:[(0,H.jsx)(`img`,{src:c.src,alt:c.caption??c.name,className:`max-h-full max-w-full rounded-md object-contain shadow-2xl`}),l&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{variant:`ghost`,size:`icon-lg`,"aria-label":`Previous image`,onClick:()=>u(-1),className:N(G,`absolute top-1/2 left-2 -translate-y-1/2 rounded-full`),children:(0,H.jsx)(Me,{className:`size-6`})}),(0,H.jsx)(f,{variant:`ghost`,size:`icon-lg`,"aria-label":`Next image`,onClick:()=>u(1),className:N(G,`absolute top-1/2 right-2 -translate-y-1/2 rounded-full`),children:(0,H.jsx)(k,{className:`size-6`})})]})]}),c.caption&&(0,H.jsx)(wt,{"data-backdrop":!0,className:`shrink-0 px-4 pb-4 text-center text-xs text-white/70`,children:c.caption})]})]})}):null}function On(e,t){if(e.type!==`image`)return null;let{source:n}=e;return n.type===`base64`?`data:${e.mediaType};base64,${n.data}`:n.type===`artifact`?t(n.artifactId):null}function kn(e,t){let n=[];return{images:n,positions:e.map(e=>{let r=On(e,t);if(!r||e.type!==`image`)return-1;let i=e.mediaType.split(`/`)[1]??`png`;return n.push({src:r,name:e.name??`Attached image`,downloadName:e.name??`image.${i}`}),n.length-1})}}function An({folded:e}){let[t,n]=(0,V.useState)(!1);if(!e.status&&!e.updates)return null;let r=e.updates?.match(/^- \(/gm)?.length??0;return(0,H.jsxs)(`div`,{className:`flex max-w-[80%] flex-col items-end`,"data-testid":`digest-disclosure`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`inline-flex h-6 items-center gap-1 rounded-full border border-border/70 bg-muted/30 px-2 text-3xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,H.jsx)(Le,{className:`size-3`}),`Status sent to agent`,r>0&&(0,H.jsxs)(`span`,{className:`opacity-70`,children:[`· `,r,` `,r===1?`update`:`updates`]}),(0,H.jsx)(k,{className:N(`size-3 transition-transform`,t&&`rotate-90`)})]}),t&&(0,H.jsx)(`pre`,{className:`mt-1.5 max-h-80 w-full overflow-auto rounded-lg border border-border bg-surface px-3 py-2 font-mono text-3xs leading-relaxed whitespace-pre-wrap text-muted-foreground scroll-thin`,children:[e.status,e.updates].filter(Boolean).join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{B as t,C as n,D as r,O as i,S as a,a as o,c as s,d as c,i as l,j as u,k as d,m as f,n as p,s as m,u as h,v as g,y as _,yt as v,z as y}from"./format-D3kairnQ.js";import{Ar as b,B as x,Cr as S,Dr as ee,E as C,Fr as te,Ft as ne,Ht as re,Jn as ie,Kn as ae,Kt as oe,Lr as se,Lt as w,Mr as ce,Nn as le,O as ue,On as T,Or as de,P as fe,Pn as pe,Pr as me,Qn as he,Qt as ge,Rn as _e,Rr as ve,S as ye,T as be,Tt as xe,U as Se,Un as Ce,V as we,Vt as Te,Wn as Ee,Yt as De,Zn as Oe,ar as ke,br as Ae,cn as je,dn as E,dr as Me,er as Ne,et as Pe,gt as Fe,h as Ie,hn as Le,i as Re,j as ze,jn as Be,kt as Ve,m as He,mn as Ue,mt as We,n as Ge,nn as Ke,nr as qe,nt as Je,o as Ye,or as Xe,ot as Ze,q as Qe,r as $e,sn as et,sr as D,tr as O,un as tt,ur as k,ut as nt,wt as rt,yn as it,zt as at}from"./icons-COCLuOtb.js";import{n as ot,t as st}from"./jsx-runtime-C3cWAN_r.js";import{i as ct,r as lt,t as ut}from"./bits-B2GRjm37.js";import{i as dt,n as ft}from"./new-session-CUpOffXI.js";import{t as A}from"./skeleton-D8Sbd2jT.js";import{E as pt,_t as mt,bt as ht,f as gt,gt as _t,h as j,ht as vt,i as M,q as yt,xt as bt}from"./api-yvn34iKU.js";import{r as xt}from"./composer-B1tdNGSi.js";import{c as St,o as Ct,r as wt,s as Tt,t as Et}from"./dialog-Cvj_lHPY.js";import{t as N}from"./dist-wxbqfqV1.js";import{i as Dt,o as Ot}from"./switch-BHplnCdo.js";import{t as kt}from"./orchestration-BZj0HlxR.js";import{t as At}from"./markdown-DGHfubu-.js";import{F as P,I as F,O as jt,R as I,a as Mt,c as Nt,k as Pt,o as Ft,t as It,u as Lt}from"./mobile-nav-CrjrDJZ5.js";import{L,c as Rt,f as zt,i as R,l as Bt,p as Vt,r as Ht,t as Ut,u as Wt,v as z}from"./dropdown-menu-Bflkx6wY.js";import{F as Gt,t as Kt}from"./useQuery-VSotSwry.js";import{t as qt}from"./textarea-gD4G5Znx.js";import{a as Jt,i as Yt,n as Xt,o as Zt,s as Qt,t as $t}from"./shallow-BUNpybIA.js";import{o as en,t as tn}from"./api-B9OffDXw.js";import{d as nn,f as B,o as rn,p as an,s as on,u as sn}from"./format-CPIs7kVL.js";import{r as cn}from"./github-bits-BLf93Pkz.js";import{n as ln}from"./clsx-BxLRjTE8.js";import{n as un,t as dn}from"./question-card-ldxLXNS_.js";var V=e(ot(),1);function fn(e){if(e.code!==`check_run`)return null;let t=vt.safeParse(e.data);return t.success?t.data:null}function pn(e,t){let n=e.threads[t]?.turnIds.at(-1);if(!n)return!1;let r=e.items[_t(n)]?.item;return r?.kind===`notice`&&r.status===`in_progress`&&fn(r)!==null}var mn=new Set([`plan`,`todo_list`,`approval_request`,`user_question`,`subagent`,`notice`,`error`]);function hn(e){return e.outcome===`failed`||e.outcome===`blocked`}function gn(e){return e.kind===`tool_call`||e.kind===`reasoning`||e.kind===`hook_run`}function _n(e,t){let n=j(e,t),r=[],i=null,a=new Map,o=()=>{if(!i)return;let e=i.entries.some(e=>e.status===`in_progress`);r.push({key:`work:${i.firstId}`,type:`work`,turnId:i.turnId,entries:i.entries,live:e}),i=null},s=n=>{if(!n)return;let i=e.turns[n];if(!i)return;if(i.status===`running`){r.push({key:`working:${n}`,type:`working`,turn:i});return}let o=i.completedAt&&i.startedAt?Date.parse(i.completedAt)-Date.parse(i.startedAt):null;r.push({key:`end:${n}`,type:`turn-end`,turn:i,filesChanged:a.get(n)?.size??0,durationMs:o,latest:e.threads[t]?.turnIds.at(-1)===n})},c=null;for(let e of n){let{item:t,turnId:n}=e;if(t.kind!==`followups`){if(c!==null&&n!==c&&(o(),s(c)),c=n,t.kind===`tool_call`&&t.toolKind===`file_edit`){let e=a.get(n)??new Set;for(let n of t.changes)e.add(n.path);a.set(n,e)}t.kind===`hook_run`&&hn(t)?(o(),r.push({key:t.id,type:`hook`,item:t})):gn(t)?i&&i.turnId===n?i.entries.push(t):(o(),i={turnId:n,entries:[t],firstId:t.id}):(o(),t.kind===`user_message`?r.push({key:t.id,type:`user`,item:t}):t.kind===`assistant_message`?r.push({key:t.id,type:`assistant`,item:t,streaming:t.status===`in_progress`}):mn.has(t.kind)&&r.push({key:t.id,type:`card`,item:t}))}}return o(),s(c),r}function vn(e,t){return e.findIndex(e=>{switch(e.type){case`user`:case`assistant`:case`hook`:case`card`:return e.item.id===t;case`work`:return e.entries.some(e=>e.id===t);default:return!1}})}function yn(e,t){let n=e.threads[t]?.turnIds.at(-1);if(!n||e.turns[n]?.status!==`completed`)return null;let r=j(e,t).filter(e=>e.turnId===n);for(let e=r.length-1;e>=0;e--){let t=r[e]?.item;if(t?.kind===`followups`)return t.suggestions}return null}function bn(e,t){let n=e.turns[t];if(!n)return null;let r=j(e,n.threadId).filter(e=>e.turnId===t);for(let e=r.length-1;e>=0;e--){let t=r[e]?.item;if(t?.kind===`assistant_message`)return t.text}return null}var xn={command:[`Ran`,`command`,`commands`],file_edit:[`Edited`,`file`,`files`],file_read:[`Read`,`file`,`files`],search:[`Searched`,`time`,`times`],web:[`Fetched`,`page`,`pages`],mcp:[`Called`,`tool`,`tools`],browser:[`Used the browser`,`time`,`times`],other:[`Ran`,`action`,`actions`]},Sn=[`file_edit`,`command`,`browser`,`mcp`,`search`,`file_read`,`web`,`other`];function Cn(e){let t=new Map,n=0,r=e.filter(e=>e.kind!==`hook_run`);if(r.length===0)return wn(e.length);for(let e of r)e.kind===`reasoning`?n++:e.toolKind===`file_edit`?t.set(`file_edit`,(t.get(`file_edit`)??0)+Math.max(1,e.changes.length)):t.set(e.toolKind,(t.get(e.toolKind)??0)+1);if(t.size===0)return n>1?`Thought ${n} times`:`Thought`;let i=Sn.filter(e=>t.has(e)),a=i.slice(0,2).map((e,n)=>{let r=t.get(e)??0,[i,a,o]=xn[e],s=n===0?i:i.toLowerCase();return e===`browser`?`${s} ${r>1?`${r} ${o}`:``}`.trim():`${s} ${r} ${r===1?a:o}`}),o=i.slice(2).reduce((e,n)=>e+(t.get(n)??0),0);return o>0?`${a.join(`, `)} and ${o} more`:a.join(` and `).replace(/^(\w)/,e=>e.toUpperCase())}function wn(e){return`${e} ${e===1?`hook`:`hooks`} ran`}function Tn(e){let t=[],n=[],r=()=>{let[e]=n;n.length===1&&e?t.push({type:`step`,step:e}):e&&t.push({type:`hooks`,key:`hooks:${e.id}`,runs:n}),n=[]};for(let i of e)i.kind===`hook_run`&&i.outcome===`succeeded`?n.push(i):(r(),t.push({type:`step`,step:i}));return r(),t}var H=st(),En=(0,V.createContext)(null);function U({images:e,children:t}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(0),o=(0,V.useRef)(new Map),s={images:e,open:e=>{a(e),r(!0)},register:(e,t)=>{t?o.current.set(e,t):o.current.delete(e)}};return(0,H.jsxs)(En.Provider,{value:s,children:[t,(0,H.jsx)(Dn,{images:e,index:Math.min(i,e.length-1),open:n&&e.length>0,onIndexChange:a,onOpenChange:r,returnFocus:()=>o.current.get(i)?.focus()})]})}function W({index:e,className:t,children:n}){let r=(0,V.useContext)(En);if(!r)throw Error(`ImageThumbnail must be inside an ImageGallery`);let i=r.images[e];return(0,H.jsx)(`button`,{type:`button`,ref:t=>r.register(e,t),"aria-label":`View ${i?.name??`image`}`,title:`View full screen`,onClick:()=>r.open(e),className:N(`cursor-zoom-in outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,t),children:n})}var G=`text-white/80 hover:bg-white/10 hover:text-white dark:hover:bg-white/10`;function Dn({images:e,index:n,open:r,onIndexChange:i,onOpenChange:a,returnFocus:o}){let s=(0,V.useRef)(null),c=e[n],l=e.length>1,u=t=>i((n+t+e.length)%e.length);return c?(0,H.jsx)(Et,{open:r,onOpenChange:a,children:(0,H.jsxs)(Tt,{children:[(0,H.jsx)(Ct,{className:`bg-black/85 supports-backdrop-filter:backdrop-blur-sm`}),(0,H.jsxs)(t,{"data-testid":`image-viewer`,"data-backdrop":!0,onKeyDown:e=>{if(l){if(e.key===`ArrowLeft`)u(-1);else if(e.key===`ArrowRight`)u(1);else return;e.preventDefault()}},onClick:e=>{e.target instanceof HTMLElement&&e.target.dataset.backdrop!==void 0&&a(!1)},onOpenAutoFocus:e=>{e.preventDefault(),s.current?.focus()},onCloseAutoFocus:e=>{e.preventDefault(),o()},...c.caption?{}:{"aria-describedby":void 0},className:`fixed inset-0 z-50 flex flex-col text-white outline-none duration-150 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0`,children:[(0,H.jsxs)(`header`,{"data-backdrop":!0,className:`flex shrink-0 items-center gap-3 px-4 py-3`,children:[(0,H.jsx)(St,{className:`min-w-0 truncate text-sm font-medium text-white/90`,children:c.name}),l&&(0,H.jsxs)(`span`,{className:`shrink-0 text-xs text-white/60 tabular-nums`,children:[n+1,` / `,e.length]}),(0,H.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[(0,H.jsx)(f,{variant:`ghost`,size:`sm`,className:G,asChild:!0,children:(0,H.jsxs)(`a`,{href:c.src,download:c.downloadName??``,children:[(0,H.jsx)(Ee,{}),` Download`]})}),(0,H.jsx)(y,{asChild:!0,children:(0,H.jsx)(f,{ref:s,variant:`ghost`,size:`icon-sm`,className:G,"aria-label":`Close`,children:(0,H.jsx)(Ge,{})})})]})]}),(0,H.jsxs)(`div`,{"data-backdrop":!0,className:`relative flex min-h-0 flex-1 items-center justify-center px-4 pb-4 sm:px-16`,children:[(0,H.jsx)(`img`,{src:c.src,alt:c.caption??c.name,className:`max-h-full max-w-full rounded-md object-contain shadow-2xl`}),l&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{variant:`ghost`,size:`icon-lg`,"aria-label":`Previous image`,onClick:()=>u(-1),className:N(G,`absolute top-1/2 left-2 -translate-y-1/2 rounded-full`),children:(0,H.jsx)(Me,{className:`size-6`})}),(0,H.jsx)(f,{variant:`ghost`,size:`icon-lg`,"aria-label":`Next image`,onClick:()=>u(1),className:N(G,`absolute top-1/2 right-2 -translate-y-1/2 rounded-full`),children:(0,H.jsx)(k,{className:`size-6`})})]})]}),c.caption&&(0,H.jsx)(wt,{"data-backdrop":!0,className:`shrink-0 px-4 pb-4 text-center text-xs text-white/70`,children:c.caption})]})]})}):null}function On(e,t){if(e.type!==`image`)return null;let{source:n}=e;return n.type===`base64`?`data:${e.mediaType};base64,${n.data}`:n.type===`artifact`?t(n.artifactId):null}function kn(e,t){let n=[];return{images:n,positions:e.map(e=>{let r=On(e,t);if(!r||e.type!==`image`)return-1;let i=e.mediaType.split(`/`)[1]??`png`;return n.push({src:r,name:e.name??`Attached image`,downloadName:e.name??`image.${i}`}),n.length-1})}}function An({folded:e}){let[t,n]=(0,V.useState)(!1);if(!e.status&&!e.updates)return null;let r=e.updates?.match(/^- \(/gm)?.length??0;return(0,H.jsxs)(`div`,{className:`flex max-w-[80%] flex-col items-end`,"data-testid":`digest-disclosure`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`inline-flex h-6 items-center gap-1 rounded-full border border-border/70 bg-muted/30 px-2 text-3xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,H.jsx)(Le,{className:`size-3`}),`Status sent to agent`,r>0&&(0,H.jsxs)(`span`,{className:`opacity-70`,children:[`· `,r,` `,r===1?`update`:`updates`]}),(0,H.jsx)(k,{className:N(`size-3 transition-transform`,t&&`rotate-90`)})]}),t&&(0,H.jsx)(`pre`,{className:`mt-1.5 max-h-80 w-full overflow-auto rounded-lg border border-border bg-surface px-3 py-2 font-mono text-3xs leading-relaxed whitespace-pre-wrap text-muted-foreground scroll-thin`,children:[e.status,e.updates].filter(Boolean).join(`
|
|
2
2
|
|
|
3
3
|
`)})]})}function jn({folded:e}){return(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,"data-testid":`wake-line`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-3xs text-muted-foreground`,children:[(0,H.jsx)(se,{className:`size-3`}),` Woken by new updates`]}),(0,H.jsx)(An,{folded:e})]})}var Mn={orchestrator:{label:`Orchestrator`,short:`Orchestrator`},pm:{label:`Project manager`,short:`PM`}},Nn=`inline-flex h-5 shrink-0 items-center gap-1 rounded-full border border-primary/25 bg-primary/10 px-1.5 text-3xs font-medium text-primary`;function Pn({role:e,short:t,className:n}){if(e===`agent`)return null;let r=Mn[e];return(0,H.jsxs)(`span`,{className:N(Nn,n),"data-role":e,children:[(0,H.jsx)(S,{className:`size-3`}),t?r.short:r.label]})}function Fn({className:e}){return(0,H.jsxs)(P,{children:[(0,H.jsx)(I,{asChild:!0,children:(0,H.jsxs)(`span`,{className:N(`inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-border/80 px-2 text-2xs text-muted-foreground`,e),"data-testid":`read-only-badge`,children:[(0,H.jsx)(ne,{className:`size-3`}),` Read-only`]})}),(0,H.jsx)(F,{className:`max-w-64`,children:`Reads the repo and runs read-only commands. Changes happen in agent sessions it starts.`})]})}var In=/^<\/?[A-Za-z][\w.:-]*(?:\s[^<>]*)?\/?>\s*$/,Ln=/^\s*(`{3,}|~{3,})/;function Rn(e){let t=[],n=null;for(let r of e.split(/\r?\n/)){let e=Ln.exec(r)?.[1];n?(e!==void 0&&e[0]===n[0]&&e.length>=n.length&&r.trim()===e&&(n=null),t.push(r)):e?(n=e,t.push(r)):In.test(r)?(t.length>0&&t[t.length-1]?.trim()!==``&&t.push(``),t.push(r,``)):t.push(r)}return t.join(`
|
|
4
4
|
`)}var zn=`(prefers-reduced-motion: reduce)`;function Bn(e){let t=window.matchMedia(zn);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function Vn(){return(0,V.useSyncExternalStore)(Bn,()=>window.matchMedia(zn).matches,()=>!1)}var Hn={factory:{label:`Factory`,icon:_e},automation:{label:`Automation`,icon:Re},codeden:{label:`CodeDen`,icon:Ke}},Un={pm:`the project manager`,orchestrator:`the orchestrator`,factory:`the factory`,automation:`an automation`,codeden:`CodeDen`},Wn=12,Gn=1500;function Kn({from:e}){if(e===`pm`||e===`orchestrator`)return(0,H.jsx)(Pn,{role:e});let{label:t,icon:n}=Hn[e];return(0,H.jsxs)(`span`,{className:Nn,"data-sender-badge":e,children:[(0,H.jsx)(n,{className:`size-3`}),t]})}function qn({from:e,text:t}){let n=Vn(),[r,i]=(0,V.useState)(!1),a=(0,V.useMemo)(()=>Rn(t),[t]),o=t.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t}from"./api-B620HpC2.js";import{n,t as r}from"./jsx-runtime-C3cWAN_r.js";import{t as i}from"./useQuery-VSotSwry.js";import{m as a}from"./format-D1ma_o2D.js";import{v as o}from"./dropdown-menu-C4XI7F63.js";import{d as s,r as c}from"./switch-DuBpF2_h.js";import{t as l}from"./dist-wxbqfqV1.js";import{a as u,c as d,n as f,o as p,r as m,s as h,t as ee}from"./updates-CQZDqpFF.js";import{Lt as g,Vn as _,cr as v,m as te,n as ne,sr as re}from"./icons-COCLuOtb.js";import{t as ie}from"./markdown-ad2jia51.js";import{a as y,c as b,i as x,n as S,r as C,t as w}from"./dialog-Dyw3b_Tu.js";import{i as T}from"./theme-DsW-i9mD.js";import{r as ae}from"./composer-Dd8joSgj.js";import{d as E,f as D,m as O,u as k}from"./model-picker-4yoJPkRY.js";import{i as A}from"./engines-Chq2ih3x.js";import{n as oe}from"./bits-B2GRjm37.js";var se=class{opts;pending=[];seen=new Set;current=null;running=!1;constructor(e){this.opts=e}has(e){return this.seen.has(e)}enqueue(e){if(this.seen.has(e.key))return!1;this.seen.add(e.key),this.pending.push(e);let t=this.opts.maxPending??3;return this.pending.length>t&&this.pending.splice(0,this.pending.length-t),this.pump(),!0}playNow(e){this.pending.unshift(e),this.stopCurrent(),this.pump()}clear(){this.pending=[],this.stopCurrent()}recheck(){this.current?.item.allowed&&!this.current.item.allowed()&&this.stopCurrent()}waiting(){return this.pending.map(e=>e.key)}get playing(){return this.current?.item.key??null}stopCurrent(){this.current&&(this.current.controller.abort(),this.opts.stopAudio())}async pump(){if(!this.running){this.running=!0;try{for(let e=this.pending.shift();e;e=this.pending.shift()){if(e.allowed&&!e.allowed())continue;let t=new AbortController;this.current={item:e,controller:t};try{await e.play(t.signal)}catch{}finally{this.current=null}}}finally{this.running=!1}}}},j=null,M=null,N=null;function P(){j?.pause(),j=null,M&&URL.revokeObjectURL(M),M=null}function F(){let e=N;N=null,e?.()}function I(){P(),A.cancel(),F()}var L=new se({stopAudio:I});async function R(e,t,n,r={}){let i=t.voice.readAloud,a=r.voice===void 0?i.voice:r.voice;I();let o=new Promise(e=>{N=e}),s=N,c=()=>{N===s&&F()};if(i.engine!==`elevenlabs`)return A.speak(n,{voice:a,onEnd:c}),o;let l=await e.voice.tts({text:n.slice(0,5e3),voiceId:a??void 0});if(N!==s)return;let u=URL.createObjectURL(l),d=new Audio(u);j=d,M=u,d.onended=d.onerror=()=>{j===d&&P(),c()};try{await d.play()}catch(e){throw j===d&&P(),c(),e}return o}var z=[{frequency:659.25,offset:0},{frequency:880,offset:.14}],B=.7,V=.2,H=1e3,U=3e3;function W(){let e=globalThis;return e.AudioContext??e.webkitAudioContext}function G(e){let t=e.currentTime+.02,n=e.createGain();n.gain.value=V,n.connect(e.destination);for(let r of z){let i=t+r.offset,a=e.createOscillator();a.type=`sine`,a.frequency.setValueAtTime(r.frequency,i);let o=e.createGain();o.gain.setValueAtTime(1e-4,i),o.gain.exponentialRampToValueAtTime(1,i+.012),o.gain.exponentialRampToValueAtTime(1e-4,i+B),a.connect(o).connect(n),a.start(i),a.stop(i+B+.05)}}function ce(e=W,t=()=>Date.now()){let n=null,r=()=>{if(n)return n;let t=e();if(!t)return null;try{n=new t}catch{return null}return n},i=e=>{try{return Promise.resolve(e.resume()).catch(()=>void 0)}catch{return Promise.resolve()}},a=()=>{let e=r();e&&e.state!==`running`&&i(e)};return{unlock:a,play(){try{let e=n;if(!e||e.state===`closed`)return;if(e.state===`running`)return G(e);let r=t();i(e).then(()=>{if(e.state===`running`&&t()-r<H)try{G(e)}catch{}})}catch{}},installUnlock(e=typeof window>`u`?void 0:window){if(!e)return()=>void 0;let t=[`pointerdown`,`pointerup`,`keydown`],r=()=>{a(),n?.state===`running`&&i()},i=()=>{for(let n of t)e.removeEventListener(n,r,!0)};for(let n of t)e.addEventListener(n,r,!0);return i}}}function le(e,t=U,n=()=>Date.now()){let r=-1/0;return()=>{let i=n();return i-r<t?!1:(r=i,e(),!0)}}var ue=ce(),K=e(n(),1),q=r(),de={tab1:`diff`,tab2:`files`,tab3:`browser`,tab4:`terminal`,tab5:`github`,tab6:`details`};function J(){let e=s();(0,K.useEffect)(()=>{let t={palette:()=>c.getState().setPaletteOpen(!c.getState().paletteOpen),help:()=>c.getState().setShortcutsOpen(!0),theme:()=>T.getState().toggle(),settings:()=>void e({to:`/settings/$section`,params:{section:`general`}}),orchestrator:()=>void e({to:`/`}),inbox:()=>void e({to:`/inbox`}),sidebar:()=>o.getState().toggleSidebar(),rightPanel:()=>o.getState().toggleRight(),terminal:()=>o.getState().toggleDrawer(),focusComposer:()=>ae.getState().focus()};for(let[e,n]of Object.entries(de))t[e]=()=>o.getState().openRightTab(n);let n=e=>{let n=D(e.target);for(let r of k){let i=t[r.id];if(i&&O(e,r.combo)&&(r.combo.includes(`mod`)||r.combo.includes(`alt`)||!n)){e.preventDefault(),i();return}}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e])}function Y(){return(0,q.jsx)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[`General`,`Navigation`,`Panels`,`Composer`].map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1.5 text-2xs font-medium tracking-wider text-muted-foreground uppercase`,children:e}),(0,q.jsx)(`div`,{className:`divide-y divide-border rounded-lg border border-border`,children:k.filter(t=>t.group===e).map(e=>(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 text-[13px]`,children:[(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(oe,{keys:E(e.combo)})]},e.id))})]},e))})}function fe(){let e=c(e=>e.shortcutsOpen),t=c(e=>e.setShortcutsOpen);return(0,q.jsx)(w,{open:e,onOpenChange:t,children:(0,q.jsxs)(S,{className:`max-h-[85dvh] overflow-y-auto sm:max-w-3xl`,children:[(0,q.jsxs)(y,{children:[(0,q.jsx)(b,{children:`Keyboard shortcuts`}),(0,q.jsx)(C,{children:`Everything important is one keystroke away.`})]}),(0,q.jsx)(Y,{})]})})}function pe({version:e,open:n,onOpenChange:r,onUpdate:o}){let s=t(),c=i({queryKey:[`update-notes`,e],queryFn:()=>s.updates.notes(e),enabled:n,staleTime:1/0,retry:!1});return(0,q.jsx)(w,{open:n,onOpenChange:r,children:(0,q.jsxs)(S,{className:`sm:max-w-xl`,"data-testid":`whats-new`,children:[(0,q.jsxs)(y,{children:[(0,q.jsxs)(b,{children:[`What's new in CodeDen `,e]}),(0,q.jsx)(C,{children:`Release notes from the CodeDen repository.`})]}),(0,q.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto text-sm`,children:c.isPending?(0,q.jsx)(`p`,{className:`text-muted-foreground`,children:`Loading the release notes...`}):c.data?.body?(0,q.jsx)(ie,{children:c.data.body}):(0,q.jsx)(`p`,{className:`text-muted-foreground`,children:`The release notes couldn't be loaded. Read them on the release page.`})}),(0,q.jsxs)(x,{children:[c.data?.url&&(0,q.jsx)(a,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`a`,{href:c.data.url,target:`_blank`,rel:`noreferrer`,children:[(0,q.jsx)(_,{}),` Release page`]})}),o&&(0,q.jsx)(a,{size:`sm`,onClick:()=>{r(!1),o()},children:`Update now`})]})]})})}var X=`mt-0.5 size-4 shrink-0 @[40rem]:mt-0`,me={info:(0,q.jsx)(v,{className:l(X,`text-status-running`)}),busy:(0,q.jsx)(g,{className:l(X,`animate-spin text-status-running`)}),done:(0,q.jsx)(re,{className:l(X,`text-status-done`)}),warn:(0,q.jsx)(te,{className:l(X,`text-status-failed`)})};function Z({tone:e,state:t,children:n,actions:r,onClose:i}){return(0,q.jsx)(`div`,{className:`@container shrink-0 px-3 pt-2`,children:(0,q.jsxs)(`div`,{role:`status`,"data-testid":`update-banner`,"data-state":t,className:l(`relative flex flex-col gap-1.5 rounded-lg border bg-card px-3 py-2 text-sm shadow-xs @[40rem]:flex-row @[40rem]:flex-wrap @[40rem]:items-center @[40rem]:gap-x-3`,e===`warn`&&`border-status-failed/40`),children:[(0,q.jsxs)(`div`,{className:l(`flex min-w-0 items-start gap-2 @[40rem]:flex-1 @[40rem]:items-center @[40rem]:gap-3`,i&&`pr-6 @[40rem]:pr-0`),children:[me[e],(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:n})]}),r&&(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pl-4 @[40rem]:pl-0`,children:r}),i&&(0,q.jsx)(a,{size:`icon-xs`,variant:`ghost`,"aria-label":`Dismiss`,className:`absolute top-1.5 right-1.5 @[40rem]:static`,onClick:i,children:(0,q.jsx)(ne,{})})]})})}var Q=({children:e})=>(0,q.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:e});function he(){let{data:e}=d(),t=h(),n=p(e=>e.phase),r=p(e=>e.target),[i,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null);if(u(e),!e)return null;let l=()=>t.install.mutate(),f=t.install.error??t.restart.error,m=ge(e,n,r);if(!m||s===m.key)return null;let g=()=>{e.latest&&ee(e.latest),c(m.key)};switch(m.kind){case`updated`:return(0,q.jsxs)(Z,{tone:`done`,state:`updated`,onClose:()=>c(m.key),children:[(0,q.jsxs)(`span`,{className:`font-medium`,children:[`CodeDen updated to `,m.version,`.`]}),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Running sessions carry on where they left off.`})]});case`handover`:return(0,q.jsxs)(Z,{tone:`busy`,state:`restarting`,children:[`Updating CodeDen to `,m.version,`... restarting. This page reloads when it is back.`]});case`timeout`:return(0,q.jsxs)(Z,{tone:`warn`,state:`timeout`,onClose:()=>c(m.key),children:[`Update installed. Restart CodeDen to finish: `,(0,q.jsx)(Q,{children:e.restartCommand})]});case`installing`:return(0,q.jsxs)(Z,{tone:`busy`,state:`installing`,children:[(0,q.jsxs)(`span`,{className:`font-medium`,children:[`Installing CodeDen `,m.version,`...`]}),` `,(0,q.jsx)(`span`,{className:`truncate text-muted-foreground`,"data-testid":`update-progress`,children:e.progress})]});case`failed`:return(0,q.jsxs)(Z,{tone:`warn`,state:`failed`,onClose:()=>c(m.key),actions:$(e)&&(0,q.jsx)(a,{size:`xs`,onClick:l,disabled:t.install.isPending,children:`Retry`}),children:[`Couldn't update to `,m.version,`: `,e.installError]});case`installed`:return e.canRestart?(0,q.jsxs)(Z,{tone:`done`,state:`installed`,onClose:()=>c(m.key),actions:(0,q.jsx)(a,{size:`xs`,onClick:()=>t.restart.mutate(),children:`Restart now`}),children:[`CodeDen `,m.version,` is installed and starts the next time you open CodeDen.`]}):(0,q.jsxs)(Z,{tone:`done`,state:`installed`,onClose:()=>c(m.key),children:[`Update installed. Restart CodeDen to finish: `,(0,q.jsx)(Q,{children:e.restartCommand})]});case`available`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Z,{tone:`info`,state:`available`,onClose:g,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(a,{size:`xs`,variant:`ghost`,onClick:()=>o(!0),children:`What's new`}),$(e)&&(0,q.jsx)(a,{size:`xs`,onClick:l,disabled:t.install.isPending,children:`Update now`}),(0,q.jsx)(a,{size:`xs`,variant:`ghost`,onClick:g,children:`Later`})]}),children:[(0,q.jsxs)(`span`,{className:`font-medium`,children:[`CodeDen `,m.version,` is available.`]}),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e.source===`source`?`You're running from source: pull and rebuild to update.`:`You're on ${e.current}. Updating takes a moment and restarts CodeDen.`}),f&&(0,q.jsx)(`span`,{className:`ml-1 text-status-failed`,children:f.message})]}),(0,q.jsx)(pe,{version:m.version,open:i,onOpenChange:o,onUpdate:$(e)?l:void 0})]})}}function $(e){return e.source!==`source`}function ge(e,t,n){let r=e.target??e.latest??e.current,i=(e,t=r)=>({kind:e,version:t,key:`${e}:${t}`});return t===`timeout`&&n?i(`timeout`,n):t===`waiting`&&n?i(`handover`,n):e.state===`restarting`?i(`handover`):e.state===`installing`?i(`installing`):e.state===`failed`?i(`failed`):e.state===`installed`?i(`installed`):m&&m===e.current?i(`updated`,m):e.updateAvailable&&e.latest&&!f(e.latest)?i(`available`,e.latest):null}export{J as a,le as c,fe as i,R as l,$ as n,U as o,Y as r,ue as s,he as t,L as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t}from"./api-yvn34iKU.js";import{n,t as r}from"./jsx-runtime-C3cWAN_r.js";import{t as i}from"./useQuery-VSotSwry.js";import{m as a}from"./format-D3kairnQ.js";import{v as o}from"./dropdown-menu-Bflkx6wY.js";import{d as s,r as c}from"./switch-BHplnCdo.js";import{t as l}from"./dist-wxbqfqV1.js";import{a as u,c as d,n as f,o as p,r as m,s as h,t as ee}from"./updates-4l7pwDq1.js";import{Lt as g,Vn as _,cr as v,m as te,n as ne,sr as re}from"./icons-COCLuOtb.js";import{t as ie}from"./markdown-DGHfubu-.js";import{a as y,c as b,i as x,n as S,r as C,t as w}from"./dialog-Cvj_lHPY.js";import{i as T}from"./theme-3eeE0sp4.js";import{r as ae}from"./composer-B1tdNGSi.js";import{d as E,f as D,m as O,u as k}from"./model-picker-DnKv2cbc.js";import{i as A}from"./engines-pLQJYIu_.js";import{n as oe}from"./bits-B2GRjm37.js";var se=class{opts;pending=[];seen=new Set;current=null;running=!1;constructor(e){this.opts=e}has(e){return this.seen.has(e)}enqueue(e){if(this.seen.has(e.key))return!1;this.seen.add(e.key),this.pending.push(e);let t=this.opts.maxPending??3;return this.pending.length>t&&this.pending.splice(0,this.pending.length-t),this.pump(),!0}playNow(e){this.pending.unshift(e),this.stopCurrent(),this.pump()}clear(){this.pending=[],this.stopCurrent()}recheck(){this.current?.item.allowed&&!this.current.item.allowed()&&this.stopCurrent()}waiting(){return this.pending.map(e=>e.key)}get playing(){return this.current?.item.key??null}stopCurrent(){this.current&&(this.current.controller.abort(),this.opts.stopAudio())}async pump(){if(!this.running){this.running=!0;try{for(let e=this.pending.shift();e;e=this.pending.shift()){if(e.allowed&&!e.allowed())continue;let t=new AbortController;this.current={item:e,controller:t};try{await e.play(t.signal)}catch{}finally{this.current=null}}}finally{this.running=!1}}}},j=null,M=null,N=null;function P(){j?.pause(),j=null,M&&URL.revokeObjectURL(M),M=null}function F(){let e=N;N=null,e?.()}function I(){P(),A.cancel(),F()}var L=new se({stopAudio:I});async function R(e,t,n,r={}){let i=t.voice.readAloud,a=r.voice===void 0?i.voice:r.voice;I();let o=new Promise(e=>{N=e}),s=N,c=()=>{N===s&&F()};if(i.engine!==`elevenlabs`)return A.speak(n,{voice:a,onEnd:c}),o;let l=await e.voice.tts({text:n.slice(0,5e3),voiceId:a??void 0});if(N!==s)return;let u=URL.createObjectURL(l),d=new Audio(u);j=d,M=u,d.onended=d.onerror=()=>{j===d&&P(),c()};try{await d.play()}catch(e){throw j===d&&P(),c(),e}return o}var z=[{frequency:659.25,offset:0},{frequency:880,offset:.14}],B=.7,V=.2,H=1e3,U=3e3;function W(){let e=globalThis;return e.AudioContext??e.webkitAudioContext}function G(e){let t=e.currentTime+.02,n=e.createGain();n.gain.value=V,n.connect(e.destination);for(let r of z){let i=t+r.offset,a=e.createOscillator();a.type=`sine`,a.frequency.setValueAtTime(r.frequency,i);let o=e.createGain();o.gain.setValueAtTime(1e-4,i),o.gain.exponentialRampToValueAtTime(1,i+.012),o.gain.exponentialRampToValueAtTime(1e-4,i+B),a.connect(o).connect(n),a.start(i),a.stop(i+B+.05)}}function ce(e=W,t=()=>Date.now()){let n=null,r=()=>{if(n)return n;let t=e();if(!t)return null;try{n=new t}catch{return null}return n},i=e=>{try{return Promise.resolve(e.resume()).catch(()=>void 0)}catch{return Promise.resolve()}},a=()=>{let e=r();e&&e.state!==`running`&&i(e)};return{unlock:a,play(){try{let e=n;if(!e||e.state===`closed`)return;if(e.state===`running`)return G(e);let r=t();i(e).then(()=>{if(e.state===`running`&&t()-r<H)try{G(e)}catch{}})}catch{}},installUnlock(e=typeof window>`u`?void 0:window){if(!e)return()=>void 0;let t=[`pointerdown`,`pointerup`,`keydown`],r=()=>{a(),n?.state===`running`&&i()},i=()=>{for(let n of t)e.removeEventListener(n,r,!0)};for(let n of t)e.addEventListener(n,r,!0);return i}}}function le(e,t=U,n=()=>Date.now()){let r=-1/0;return()=>{let i=n();return i-r<t?!1:(r=i,e(),!0)}}var ue=ce(),K=e(n(),1),q=r(),de={tab1:`diff`,tab2:`files`,tab3:`browser`,tab4:`terminal`,tab5:`github`,tab6:`details`};function J(){let e=s();(0,K.useEffect)(()=>{let t={palette:()=>c.getState().setPaletteOpen(!c.getState().paletteOpen),help:()=>c.getState().setShortcutsOpen(!0),theme:()=>T.getState().toggle(),settings:()=>void e({to:`/settings/$section`,params:{section:`general`}}),orchestrator:()=>void e({to:`/`}),inbox:()=>void e({to:`/inbox`}),sidebar:()=>o.getState().toggleSidebar(),rightPanel:()=>o.getState().toggleRight(),terminal:()=>o.getState().toggleDrawer(),focusComposer:()=>ae.getState().focus()};for(let[e,n]of Object.entries(de))t[e]=()=>o.getState().openRightTab(n);let n=e=>{let n=D(e.target);for(let r of k){let i=t[r.id];if(i&&O(e,r.combo)&&(r.combo.includes(`mod`)||r.combo.includes(`alt`)||!n)){e.preventDefault(),i();return}}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e])}function Y(){return(0,q.jsx)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[`General`,`Navigation`,`Panels`,`Composer`].map(e=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1.5 text-2xs font-medium tracking-wider text-muted-foreground uppercase`,children:e}),(0,q.jsx)(`div`,{className:`divide-y divide-border rounded-lg border border-border`,children:k.filter(t=>t.group===e).map(e=>(0,q.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 text-[13px]`,children:[(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(oe,{keys:E(e.combo)})]},e.id))})]},e))})}function fe(){let e=c(e=>e.shortcutsOpen),t=c(e=>e.setShortcutsOpen);return(0,q.jsx)(w,{open:e,onOpenChange:t,children:(0,q.jsxs)(S,{className:`max-h-[85dvh] overflow-y-auto sm:max-w-3xl`,children:[(0,q.jsxs)(y,{children:[(0,q.jsx)(b,{children:`Keyboard shortcuts`}),(0,q.jsx)(C,{children:`Everything important is one keystroke away.`})]}),(0,q.jsx)(Y,{})]})})}function pe({version:e,open:n,onOpenChange:r,onUpdate:o}){let s=t(),c=i({queryKey:[`update-notes`,e],queryFn:()=>s.updates.notes(e),enabled:n,staleTime:1/0,retry:!1});return(0,q.jsx)(w,{open:n,onOpenChange:r,children:(0,q.jsxs)(S,{className:`sm:max-w-xl`,"data-testid":`whats-new`,children:[(0,q.jsxs)(y,{children:[(0,q.jsxs)(b,{children:[`What's new in CodeDen `,e]}),(0,q.jsx)(C,{children:`Release notes from the CodeDen repository.`})]}),(0,q.jsx)(`div`,{className:`max-h-[50vh] overflow-y-auto text-sm`,children:c.isPending?(0,q.jsx)(`p`,{className:`text-muted-foreground`,children:`Loading the release notes...`}):c.data?.body?(0,q.jsx)(ie,{children:c.data.body}):(0,q.jsx)(`p`,{className:`text-muted-foreground`,children:`The release notes couldn't be loaded. Read them on the release page.`})}),(0,q.jsxs)(x,{children:[c.data?.url&&(0,q.jsx)(a,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`a`,{href:c.data.url,target:`_blank`,rel:`noreferrer`,children:[(0,q.jsx)(_,{}),` Release page`]})}),o&&(0,q.jsx)(a,{size:`sm`,onClick:()=>{r(!1),o()},children:`Update now`})]})]})})}var X=`mt-0.5 size-4 shrink-0 @[40rem]:mt-0`,me={info:(0,q.jsx)(v,{className:l(X,`text-status-running`)}),busy:(0,q.jsx)(g,{className:l(X,`animate-spin text-status-running`)}),done:(0,q.jsx)(re,{className:l(X,`text-status-done`)}),warn:(0,q.jsx)(te,{className:l(X,`text-status-failed`)})};function Z({tone:e,state:t,children:n,actions:r,onClose:i}){return(0,q.jsx)(`div`,{className:`@container shrink-0 px-3 pt-2`,children:(0,q.jsxs)(`div`,{role:`status`,"data-testid":`update-banner`,"data-state":t,className:l(`relative flex flex-col gap-1.5 rounded-lg border bg-card px-3 py-2 text-sm shadow-xs @[40rem]:flex-row @[40rem]:flex-wrap @[40rem]:items-center @[40rem]:gap-x-3`,e===`warn`&&`border-status-failed/40`),children:[(0,q.jsxs)(`div`,{className:l(`flex min-w-0 items-start gap-2 @[40rem]:flex-1 @[40rem]:items-center @[40rem]:gap-3`,i&&`pr-6 @[40rem]:pr-0`),children:[me[e],(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:n})]}),r&&(0,q.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pl-4 @[40rem]:pl-0`,children:r}),i&&(0,q.jsx)(a,{size:`icon-xs`,variant:`ghost`,"aria-label":`Dismiss`,className:`absolute top-1.5 right-1.5 @[40rem]:static`,onClick:i,children:(0,q.jsx)(ne,{})})]})})}var Q=({children:e})=>(0,q.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:e});function he(){let{data:e}=d(),t=h(),n=p(e=>e.phase),r=p(e=>e.target),[i,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(null);if(u(e),!e)return null;let l=()=>t.install.mutate(),f=t.install.error??t.restart.error,m=ge(e,n,r);if(!m||s===m.key)return null;let g=()=>{e.latest&&ee(e.latest),c(m.key)};switch(m.kind){case`updated`:return(0,q.jsxs)(Z,{tone:`done`,state:`updated`,onClose:()=>c(m.key),children:[(0,q.jsxs)(`span`,{className:`font-medium`,children:[`CodeDen updated to `,m.version,`.`]}),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Running sessions carry on where they left off.`})]});case`handover`:return(0,q.jsxs)(Z,{tone:`busy`,state:`restarting`,children:[`Updating CodeDen to `,m.version,`... restarting. This page reloads when it is back.`]});case`timeout`:return(0,q.jsxs)(Z,{tone:`warn`,state:`timeout`,onClose:()=>c(m.key),children:[`Update installed. Restart CodeDen to finish: `,(0,q.jsx)(Q,{children:e.restartCommand})]});case`installing`:return(0,q.jsxs)(Z,{tone:`busy`,state:`installing`,children:[(0,q.jsxs)(`span`,{className:`font-medium`,children:[`Installing CodeDen `,m.version,`...`]}),` `,(0,q.jsx)(`span`,{className:`truncate text-muted-foreground`,"data-testid":`update-progress`,children:e.progress})]});case`failed`:return(0,q.jsxs)(Z,{tone:`warn`,state:`failed`,onClose:()=>c(m.key),actions:$(e)&&(0,q.jsx)(a,{size:`xs`,onClick:l,disabled:t.install.isPending,children:`Retry`}),children:[`Couldn't update to `,m.version,`: `,e.installError]});case`installed`:return e.canRestart?(0,q.jsxs)(Z,{tone:`done`,state:`installed`,onClose:()=>c(m.key),actions:(0,q.jsx)(a,{size:`xs`,onClick:()=>t.restart.mutate(),children:`Restart now`}),children:[`CodeDen `,m.version,` is installed and starts the next time you open CodeDen.`]}):(0,q.jsxs)(Z,{tone:`done`,state:`installed`,onClose:()=>c(m.key),children:[`Update installed. Restart CodeDen to finish: `,(0,q.jsx)(Q,{children:e.restartCommand})]});case`available`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Z,{tone:`info`,state:`available`,onClose:g,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(a,{size:`xs`,variant:`ghost`,onClick:()=>o(!0),children:`What's new`}),$(e)&&(0,q.jsx)(a,{size:`xs`,onClick:l,disabled:t.install.isPending,children:`Update now`}),(0,q.jsx)(a,{size:`xs`,variant:`ghost`,onClick:g,children:`Later`})]}),children:[(0,q.jsxs)(`span`,{className:`font-medium`,children:[`CodeDen `,m.version,` is available.`]}),` `,(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:e.source===`source`?`You're running from source: pull and rebuild to update.`:`You're on ${e.current}. Updating takes a moment and restarts CodeDen.`}),f&&(0,q.jsx)(`span`,{className:`ml-1 text-status-failed`,children:f.message})]}),(0,q.jsx)(pe,{version:m.version,open:i,onOpenChange:o,onUpdate:$(e)?l:void 0})]})}}function $(e){return e.source!==`source`}function ge(e,t,n){let r=e.target??e.latest??e.current,i=(e,t=r)=>({kind:e,version:t,key:`${e}:${t}`});return t===`timeout`&&n?i(`timeout`,n):t===`waiting`&&n?i(`handover`,n):e.state===`restarting`?i(`handover`):e.state===`installing`?i(`installing`):e.state===`failed`?i(`failed`):e.state===`installed`?i(`installed`):m&&m===e.current?i(`updated`,m):e.updateAvailable&&e.latest&&!f(e.latest)?i(`available`,e.latest):null}export{J as a,le as c,fe as i,R as l,$ as n,U as o,Y as r,ue as s,he as t,L as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{yt as t}from"./format-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{yt as t}from"./format-D3kairnQ.js";import{F as n,t as r}from"./useQuery-VSotSwry.js";import{n as i}from"./jsx-runtime-C3cWAN_r.js";import{i as a,jt as o}from"./api-yvn34iKU.js";var s=e(i(),1),c=[`updates`];function l(){let e=a();return r({queryKey:c,queryFn:()=>e.getUpdates(),staleTime:216e5,refetchInterval:216e5,retry:!1})}function u(){let e=a(),r=n(),i=e=>r.setQueryData(c,e);return{install:t({mutationFn:()=>e.updates.install(),onSuccess:i}),restart:t({mutationFn:()=>e.updates.restart(),onSuccess:i}),rollback:t({mutationFn:()=>e.updates.rollback(),onSuccess:i})}}var d=o()(e=>({phase:`idle`,target:null,set:(t,n)=>e({phase:t,target:n})})),f=`codeden.updated-to`,p=12e4;function m(e){let t=a(),n=e?.state===`restarting`?e.target:null;(0,s.useEffect)(()=>{n&&h(n,()=>t.updates.serverVersion())},[n,t])}function h(e,t){let n=d.getState();if(n.phase===`waiting`&&n.target===e)return;n.set(`waiting`,e);let r=!1,i=Date.now(),a=async()=>{let n=await t();if(n===e)v(f,e),window.location.reload();else{if(n===null)r=!0;else if(r){window.location.reload();return}Date.now()-i>p?d.getState().set(`timeout`,e):setTimeout(()=>void a(),1e3)}};setTimeout(()=>void a(),800)}var g=_(f);function _(e){try{let t=sessionStorage.getItem(e);return sessionStorage.removeItem(e),t}catch{return null}}function v(e,t){try{sessionStorage.setItem(e,t)}catch{}}var y=`codeden.update-dismissed`;function b(e){try{return localStorage.getItem(y)===e}catch{return!1}}function x(e){try{localStorage.setItem(y,e)}catch{}}export{m as a,l as c,c as i,b as n,d as o,g as r,u as s,x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./api-B620HpC2.js";import{F as t}from"./useQuery-VSotSwry.js";import{j as n,yt as r}from"./format-D1ma_o2D.js";import{t as i}from"./factory-BBYEYI9i.js";var a=[{id:`manual`,label:`Manual`,summary:`You drive every session. Automations only run when you start them.`,finds:`You`,merges:`You`,experimental:!1},{id:`assisted`,label:`Assisted`,summary:`You, the PM and automations find work; you review and merge every PR.`,finds:`You, the PM, automations`,merges:`You`,experimental:!1},{id:`software_factory`,label:`Software factory`,summary:`Issues filed on GitHub by you or trusted people are classified as a bug, feature or docs change and built by a pool of agents. Each ends in a PR with test results and screenshots.`,finds:`You and trusted authors, on GitHub`,merges:`You (or CodeDen, with auto-merge)`,experimental:!0},{id:`dark_factory`,label:`Dark factory`,summary:`The software factory, plus a scheduled scout that reviews the app against the vision and files the issues itself. You can step away.`,finds:`The scout, you and trusted authors`,merges:`You (or CodeDen, with auto-merge)`,experimental:!0}],o={manual:`Manual`,assisted:`Assisted`,software_factory:`Software factory`,dark_factory:`Dark factory`},s={idle:{label:`Idle`,tone:`idle`},discovering:{label:`Scouting`,tone:`running`},building:{label:`Building`,tone:`running`},verifying:{label:`Verifying`,tone:`waiting`},paused:{label:`Paused`,tone:`waiting`},stopped:{label:`Stopped`,tone:`failed`},draining:{label:`Draining`,tone:`waiting`}},c={candidate:{label:`Identifying type`,tone:`idle`},ignored:{label:`Ignored (untrusted author)`,tone:`idle`},backlog:{label:`Queued`,tone:`idle`},building:{label:`Building`,tone:`running`},verifying:{label:`Verifying`,tone:`waiting`},watching:{label:`Watching main`,tone:`running`},merged:{label:`Merged`,tone:`done`},reverted:{label:`Reverted`,tone:`failed`},rejected:{label:`Stopped`,tone:`idle`},failed:{label:`Failed`,tone:`failed`},escalated:{label:`Needs you`,tone:`waiting`}},l={checking:{label:`Checking`,tone:`running`,help:`The merge checks are running: the review, tests and evidence.`},waiting_ci:{label:`Waiting for CI`,tone:`running`,help:`CI is running, or yet to start, on the newest commit.`},queued:{label:`Queued`,tone:`waiting`,help:`Every check passed. The factory merges every pull request that is ready, oldest approved first, seconds apart.`},updating:{label:`Updating`,tone:`running`,help:`Behind the default branch and due a re-test: GitHub merges the default branch in, then CI runs on the new head. No agent is needed.`},rebasing:{label:`Rebasing`,tone:`running`,help:`Merge conflicts with the default branch: the author (or an integrator, when the author's session is gone) rebases it. This isn't a revise round.`},rebuilding:{label:`Rebuilding`,tone:`running`,help:`It still conflicted after three requests to rebase, so the work is redone from the default branch. The new pull request replaces this one.`},superseded:{label:`Superseded`,tone:`idle`,help:`A newer pull request for the same work replaced this one. The factory closes it with a link to the new one.`},merged:{label:`Merged`,tone:`done`,help:`Merged today.`},waiting_for_you:{label:`Waiting for you`,tone:`waiting`,help:`A person merges this one (auto-merge is off, a protected area or an untrusted author), or its checks failed: then Retry sends it back to a fresh review, and new commits on it are re-reviewed by themselves. The factory keeps it free of merge conflicts meanwhile.`},stuck:{label:`Stuck`,tone:`failed`,help:`The factory can't settle this by itself: it was already rebuilt once, or CI can never run. It is in your inbox.`}},u={discovery:`Dark factory scout`,issue:`GitHub issue`,failed_check:`Failed check on main`,revert:`Revert`},d={bug:`Bug`,feature:`Feature`,docs:`Documentation`},f={reproduced:`Reproduced`,not_reproduced:`Not reproduced`,implement:`Build it`,already_done:`Already possible`,needs_info:`Needs more information`,out_of_scope:`Out of scope`},p={features:`Features`,ux:`UI & UX`,performance:`Performance`,tech_debt:`Code quality`,test_gaps:`Test gaps`,security:`Security`,bugs:`Bugs`,docs:`Docs`};function m(e,t){switch(e){case`intake`:return`Identify type`;case`queued`:return`Waiting for an agent`;case`reproduce`:return`Reproduce`;case`analyze`:return`Analyze feature`;case`implement`:return t===`bug`?`Create fix`:t===`docs`?`Implement docs change`:`Implement feature`;case`review`:return t===`bug`?`Review fix`:t===`docs`?`Checks`:`Review feature`;case`merge`:return`Merge`;case`ignored`:return`Ignored`;case`done`:return`Done`;case`stopped`:return`Stopped`}}var h=`Each issue is sorted into a lane by type, and each lane has its own steps.`,g={bug:`${h} Bugs are reproduced first, so the fix is proven against a failing test.`,feature:`${h} Features are analyzed first: does it exist already, and does it fit the vision?`,docs:`${h} Documentation changes go straight to implementation and only need the automated checks.`};function _(e){return e?`Work starts as a GitHub issue, filed by the scout, by you or by a trusted author. Issues from anyone else are ignored until you let them in.`:`Work starts as a GitHub issue filed by you or a trusted author. Issues from anyone else are ignored until you let them in.`}function v(e,t,n){switch(e){case`intake`:return`One quick model call reads each new issue and sorts it into the Bug, Feature or Documentation lane (a type label on the issue decides it instead). It then waits for a free agent.`;case`queued`:return`Waiting for a free agent. Reviews, revise rounds and rebases of open pull requests get free agents first; then items are picked by priority, then age. At the open pull request limit nothing new starts until one merges, and an item likely to touch the files of an open pull request waits behind items that don't.`;case`reproduce`:return`An agent writes a failing test or probe that shows the bug. Once it's reproduced, the same agent moves on to the fix; if it can't be, the work stops and the issue asks for more information.`;case`analyze`:return`An agent checks whether the feature exists already and fits the vision, then posts a spec with acceptance criteria on the issue. An accepted spec moves it on to Implement; otherwise the work stops with the reason.`;case`implement`:return t===`bug`?`The same agent fixes the bug in its own worktree and opens a pull request with its test results. The pull request moves it on to review.`:t===`docs`?`An agent makes the documentation change in its own worktree and opens a pull request. The pull request moves it on to the checks.`:`The same agent builds the feature to the spec in its own worktree and opens a pull request with test results, and screenshots for UI changes. The pull request moves it on to review.`;case`review`:return t===`docs`?`The merge checks run on the pull request; a change that touches only documentation skips the agent review. With every check green it moves on to Merge.`:`A separate reviewer agent checks the pull request while the merge checks run. Approved with every check green, it moves on to Merge; otherwise it goes back to the builder to revise.`;case`merge`:return n?`With every check green, CodeDen merges the pull request itself and watches CI on main; a regression opens a revert and pauses the factory. Work let in from an untrusted author always waits for you.`:`With every check green, the pull request is ready for you: review it and merge it on GitHub.`;case`ignored`:return`Opened by someone who isn't a trusted author, so the factory leaves it alone until you let it in.`;case`done`:return`Merged.`;case`stopped`:return`The work stopped: not reproduced, declined, failed or closed. Retry runs it again: with its pull request still open, that pull request goes back to a fresh review; otherwise the work starts over. A failed pull request that gets new commits is re-reviewed by itself.`}}var y=`When the reviewer asks for changes or a merge check fails, the work goes back to the same builder to revise it, a few times at most. The number is how many are being revised now.`,b=`An agent that periodically reviews the app against your vision and files issues for the work worth doing. It only looks when the queue runs low (the threshold is in Settings), or when you click Run scout now.`,x=`One pass of the scout: it plans what to look at, its area reviewers review, then it files the findings most worth doing as issues. A round starts on the schedule you set once the queue runs low, or right away with Run scout now.`;function S(e){return`Runs the factory's regular check immediately (it runs every 30 seconds): moves work in progress, picks up new issues, starts free agents${e?`, and starts the scout if it's due`:``}.`}var C=`The work-in-progress limit. With this many factory pull requests open, the factory finishes them before it starts more: no new build starts from the queue, the scout files nothing, and free agents go to reviews, fixes and rebases until one merges or closes. Builds that haven't opened their pull request yet take room too, since each will. Fixes for failing checks on the default branch still start. Pull requests of failed or escalated work, which wait for you, don't count (work that failed for a reason outside its code goes back by itself, so its pull request does, unless it waits on a provider that is signed out or at its usage limit). Fewer open PRs means fewer merge conflicts between them.`,w=`Work that failed for a reason outside its code, such as its agent's provider being signed out or at its usage limit, goes back by itself once that provider can work again. Until then its pull request doesn't count toward PRs open at most, so new work carries on with the other providers. Sign the provider in (or wait for its limit to reset) to let it continue.`;function T(e){return`Finishing open work (${e.openPrs} of ${e.limit} PRs open)`}var E=`How many focused reviewer agents the scout may use in a round, each looking at one area of the app: security, UI & UX, performance, docs and so on. Each costs tokens; 0 means the scout reviews by itself.`,D={ci:`CI`,tests:`Tests`,test_results:`Test results`,review:`Review`,security:`Security`,ui_evidence:`Screenshots`,size:`Size`,protected_paths:`Protected areas`},O={ci:`The PR's checks passed on GitHub.`,tests:`Tests changed with the code, or the change needs none.`,test_results:`The PR reports its test results (a Test results section or attached output).`,review:`An independent reviewer session approved it (docs-only changes skip it).`,security:`The audit command and the reviewer found no concerns.`,ui_evidence:`UI changes have screenshots attached.`,size:`Small enough for the factory.`,protected_paths:`Touches no protected area from the vision or the limits.`};function k(a,o,s){let c=e(),l=t();return r({mutationFn:()=>c.factory.retry(a,o,s?{mode:s}:{}),onSuccess:e=>{n.success(e.stage===`verifying`?`Back in review`:`Queued again`,{description:e.stage===`verifying`&&e.pr?`#${e.pr.number} gets a fresh review; no new build.`:`It starts over from the first step.`}),l.invalidateQueries({queryKey:i.all})},onError:e=>n.error(`Couldn't retry`,{description:e.message})})}export{m as C,v as S,c as _,g as a,S as b,o as c,l as d,E as f,u as g,b as h,D as i,f as l,x as m,p as n,s as o,y as p,O as r,a as s,k as t,w as u,d as v,T as w,_ as x,C as y};
|
|
1
|
+
import{i as e}from"./api-yvn34iKU.js";import{F as t}from"./useQuery-VSotSwry.js";import{j as n,yt as r}from"./format-D3kairnQ.js";import{t as i}from"./factory-DVCs5zxg.js";var a=[{id:`manual`,label:`Manual`,summary:`You drive every session. Automations only run when you start them.`,finds:`You`,merges:`You`,experimental:!1},{id:`assisted`,label:`Assisted`,summary:`You, the PM and automations find work; you review and merge every PR.`,finds:`You, the PM, automations`,merges:`You`,experimental:!1},{id:`software_factory`,label:`Software factory`,summary:`Issues filed on GitHub by you or trusted people are classified as a bug, feature or docs change and built by a pool of agents. Each ends in a PR with test results and screenshots.`,finds:`You and trusted authors, on GitHub`,merges:`You (or CodeDen, with auto-merge)`,experimental:!0},{id:`dark_factory`,label:`Dark factory`,summary:`The software factory, plus a scheduled scout that reviews the app against the vision and files the issues itself. You can step away.`,finds:`The scout, you and trusted authors`,merges:`You (or CodeDen, with auto-merge)`,experimental:!0}],o={manual:`Manual`,assisted:`Assisted`,software_factory:`Software factory`,dark_factory:`Dark factory`},s={idle:{label:`Idle`,tone:`idle`},discovering:{label:`Scouting`,tone:`running`},building:{label:`Building`,tone:`running`},verifying:{label:`Verifying`,tone:`waiting`},paused:{label:`Paused`,tone:`waiting`},stopped:{label:`Stopped`,tone:`failed`},draining:{label:`Draining`,tone:`waiting`}},c={candidate:{label:`Identifying type`,tone:`idle`},ignored:{label:`Ignored (untrusted author)`,tone:`idle`},backlog:{label:`Queued`,tone:`idle`},building:{label:`Building`,tone:`running`},verifying:{label:`Verifying`,tone:`waiting`},watching:{label:`Watching main`,tone:`running`},merged:{label:`Merged`,tone:`done`},reverted:{label:`Reverted`,tone:`failed`},rejected:{label:`Stopped`,tone:`idle`},failed:{label:`Failed`,tone:`failed`},escalated:{label:`Needs you`,tone:`waiting`}},l={checking:{label:`Checking`,tone:`running`,help:`The merge checks are running: the review, tests and evidence.`},waiting_ci:{label:`Waiting for CI`,tone:`running`,help:`CI is running, or yet to start, on the newest commit.`},queued:{label:`Queued`,tone:`waiting`,help:`Every check passed. The factory merges every pull request that is ready, oldest approved first, seconds apart.`},updating:{label:`Updating`,tone:`running`,help:`Behind the default branch and due a re-test: GitHub merges the default branch in, then CI runs on the new head. No agent is needed.`},rebasing:{label:`Rebasing`,tone:`running`,help:`Merge conflicts with the default branch: the author (or an integrator, when the author's session is gone) rebases it. This isn't a revise round.`},rebuilding:{label:`Rebuilding`,tone:`running`,help:`It still conflicted after three requests to rebase, so the work is redone from the default branch. The new pull request replaces this one.`},superseded:{label:`Superseded`,tone:`idle`,help:`A newer pull request for the same work replaced this one. The factory closes it with a link to the new one.`},merged:{label:`Merged`,tone:`done`,help:`Merged today.`},waiting_for_you:{label:`Waiting for you`,tone:`waiting`,help:`A person merges this one (auto-merge is off, a protected area or an untrusted author), or its checks failed: then Retry sends it back to a fresh review, and new commits on it are re-reviewed by themselves. The factory keeps it free of merge conflicts meanwhile.`},stuck:{label:`Stuck`,tone:`failed`,help:`The factory can't settle this by itself: it was already rebuilt once, or CI can never run. It is in your inbox.`}},u={discovery:`Dark factory scout`,issue:`GitHub issue`,failed_check:`Failed check on main`,revert:`Revert`},d={bug:`Bug`,feature:`Feature`,docs:`Documentation`},f={reproduced:`Reproduced`,not_reproduced:`Not reproduced`,implement:`Build it`,already_done:`Already possible`,needs_info:`Needs more information`,out_of_scope:`Out of scope`},p={features:`Features`,ux:`UI & UX`,performance:`Performance`,tech_debt:`Code quality`,test_gaps:`Test gaps`,security:`Security`,bugs:`Bugs`,docs:`Docs`};function m(e,t){switch(e){case`intake`:return`Identify type`;case`queued`:return`Waiting for an agent`;case`reproduce`:return`Reproduce`;case`analyze`:return`Analyze feature`;case`implement`:return t===`bug`?`Create fix`:t===`docs`?`Implement docs change`:`Implement feature`;case`review`:return t===`bug`?`Review fix`:t===`docs`?`Checks`:`Review feature`;case`merge`:return`Merge`;case`ignored`:return`Ignored`;case`done`:return`Done`;case`stopped`:return`Stopped`}}var h=`Each issue is sorted into a lane by type, and each lane has its own steps.`,g={bug:`${h} Bugs are reproduced first, so the fix is proven against a failing test.`,feature:`${h} Features are analyzed first: does it exist already, and does it fit the vision?`,docs:`${h} Documentation changes go straight to implementation and only need the automated checks.`};function _(e){return e?`Work starts as a GitHub issue, filed by the scout, by you or by a trusted author. Issues from anyone else are ignored until you let them in.`:`Work starts as a GitHub issue filed by you or a trusted author. Issues from anyone else are ignored until you let them in.`}function v(e,t,n){switch(e){case`intake`:return`One quick model call reads each new issue and sorts it into the Bug, Feature or Documentation lane (a type label on the issue decides it instead). It then waits for a free agent.`;case`queued`:return`Waiting for a free agent. Reviews, revise rounds and rebases of open pull requests get free agents first; then items are picked by priority, then age. At the open pull request limit nothing new starts until one merges, and an item likely to touch the files of an open pull request waits behind items that don't.`;case`reproduce`:return`An agent writes a failing test or probe that shows the bug. Once it's reproduced, the same agent moves on to the fix; if it can't be, the work stops and the issue asks for more information.`;case`analyze`:return`An agent checks whether the feature exists already and fits the vision, then posts a spec with acceptance criteria on the issue. An accepted spec moves it on to Implement; otherwise the work stops with the reason.`;case`implement`:return t===`bug`?`The same agent fixes the bug in its own worktree and opens a pull request with its test results. The pull request moves it on to review.`:t===`docs`?`An agent makes the documentation change in its own worktree and opens a pull request. The pull request moves it on to the checks.`:`The same agent builds the feature to the spec in its own worktree and opens a pull request with test results, and screenshots for UI changes. The pull request moves it on to review.`;case`review`:return t===`docs`?`The merge checks run on the pull request; a change that touches only documentation skips the agent review. With every check green it moves on to Merge.`:`A separate reviewer agent checks the pull request while the merge checks run. Approved with every check green, it moves on to Merge; otherwise it goes back to the builder to revise.`;case`merge`:return n?`With every check green, CodeDen merges the pull request itself and watches CI on main; a regression opens a revert and pauses the factory. Work let in from an untrusted author always waits for you.`:`With every check green, the pull request is ready for you: review it and merge it on GitHub.`;case`ignored`:return`Opened by someone who isn't a trusted author, so the factory leaves it alone until you let it in.`;case`done`:return`Merged.`;case`stopped`:return`The work stopped: not reproduced, declined, failed or closed. Retry runs it again: with its pull request still open, that pull request goes back to a fresh review; otherwise the work starts over. A failed pull request that gets new commits is re-reviewed by itself.`}}var y=`When the reviewer asks for changes or a merge check fails, the work goes back to the same builder to revise it, a few times at most. The number is how many are being revised now.`,b=`An agent that periodically reviews the app against your vision and files issues for the work worth doing. It only looks when the queue runs low (the threshold is in Settings), or when you click Run scout now.`,x=`One pass of the scout: it plans what to look at, its area reviewers review, then it files the findings most worth doing as issues. A round starts on the schedule you set once the queue runs low, or right away with Run scout now.`;function S(e){return`Runs the factory's regular check immediately (it runs every 30 seconds): moves work in progress, picks up new issues, starts free agents${e?`, and starts the scout if it's due`:``}.`}var C=`The work-in-progress limit. With this many factory pull requests open, the factory finishes them before it starts more: no new build starts from the queue, the scout files nothing, and free agents go to reviews, fixes and rebases until one merges or closes. Builds that haven't opened their pull request yet take room too, since each will. Fixes for failing checks on the default branch still start. Pull requests of failed or escalated work, which wait for you, don't count (work that failed for a reason outside its code goes back by itself, so its pull request does, unless it waits on a provider that is signed out or at its usage limit). Fewer open PRs means fewer merge conflicts between them.`,w=`Work that failed for a reason outside its code, such as its agent's provider being signed out or at its usage limit, goes back by itself once that provider can work again. Until then its pull request doesn't count toward PRs open at most, so new work carries on with the other providers. Sign the provider in (or wait for its limit to reset) to let it continue.`;function T(e){return`Finishing open work (${e.openPrs} of ${e.limit} PRs open)`}var E=`How many focused reviewer agents the scout may use in a round, each looking at one area of the app: security, UI & UX, performance, docs and so on. Each costs tokens; 0 means the scout reviews by itself.`,D={ci:`CI`,tests:`Tests`,test_results:`Test results`,review:`Review`,security:`Security`,ui_evidence:`Screenshots`,size:`Size`,protected_paths:`Protected areas`},O={ci:`The PR's checks passed on GitHub.`,tests:`Tests changed with the code, or the change needs none.`,test_results:`The PR reports its test results (a Test results section or attached output).`,review:`An independent reviewer session approved it (docs-only changes skip it).`,security:`The audit command and the reviewer found no concerns.`,ui_evidence:`UI changes have screenshots attached.`,size:`Small enough for the factory.`,protected_paths:`Touches no protected area from the vision or the limits.`};function k(a,o,s){let c=e(),l=t();return r({mutationFn:()=>c.factory.retry(a,o,s?{mode:s}:{}),onSuccess:e=>{n.success(e.stage===`verifying`?`Back in review`:`Queued again`,{description:e.stage===`verifying`&&e.pr?`#${e.pr.number} gets a fresh review; no new build.`:`It starts over from the first step.`}),l.invalidateQueries({queryKey:i.all})},onError:e=>n.error(`Couldn't retry`,{description:e.message})})}export{m as C,v as S,c as _,g as a,S as b,o as c,l as d,E as f,u as g,b as h,D as i,f as l,x as m,p as n,s as o,y as p,O as r,a as s,k as t,w as u,d as v,T as w,_ as x,C as y};
|