cezarion 0.19.0-dev.8640 → 0.19.0-dev.8642
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/package.json +3 -3
- package/web/dist/assets/{accounts-section-D7EK3_7b.js → accounts-section-RDVTJfi7.js} +1 -1
- package/web/dist/assets/{activity-motion-2BQBW4lA.js → activity-motion-B7km8QVK.js} +1 -1
- package/web/dist/assets/{activity-route-Ct06t8Y9.js → activity-route-CjE0yxn0.js} +1 -1
- package/web/dist/assets/{agent-config-section-D6Lcc7c5.js → agent-config-section-DQ1RaVK2.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BnDBbzuG.js → agent-defaults-section-Dzm7jIza.js} +1 -1
- package/web/dist/assets/{appearance-CM6ahUyy.js → appearance-DQLHHfI4.js} +1 -1
- package/web/dist/assets/{automations-route-7B_DF4O1.js → automations-route-BcdL5f0K.js} +1 -1
- package/web/dist/assets/{commit-list-O4ugJ12w.js → commit-list-CN1zX-0X.js} +1 -1
- package/web/dist/assets/{diff-controls-BpTFu29H.js → diff-controls-BRa3141W.js} +1 -1
- package/web/dist/assets/{diff-DKZvZQ2G.js → diff-hxqBOfZH.js} +2 -2
- package/web/dist/assets/{diff-view-D4yXb2w7.js → diff-view-CwlKCj5V.js} +1 -1
- package/web/dist/assets/{file-preview-CUhut4J9.js → file-preview-VvCzp02k.js} +1 -1
- package/web/dist/assets/{git-toolbar-po0QJciG.js → git-toolbar-BulcGzsv.js} +1 -1
- package/web/dist/assets/{github-TgLTixC7.js → github-By3yOcFH.js} +1 -1
- package/web/dist/assets/{global-activity-route-OHCmn0ZO.js → global-activity-route-C4-bmfh_.js} +1 -1
- package/web/dist/assets/{image-preview-Sisptm3b.js → image-preview-Pgf8bnzY.js} +1 -1
- package/web/dist/assets/{index-CvVmG4Yu.js → index-DNQcTHxV.js} +5 -5
- package/web/dist/assets/{markdown-jle_P0a2.js → markdown-9L65ixU6.js} +1 -1
- package/web/dist/assets/{notifications-section-Bhqr3yOz.js → notifications-section-QWmuj2j2.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-CBt_nlmX.js → preview-pane-connected-DAM2Snwh.js} +1 -1
- package/web/dist/assets/{projects-section-DnGSWHZJ.js → projects-section-DxubjpZI.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-8kBTviSw.js → prompt-templates-section-CkQneT1G.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-D7G8cXSx.js → remote-settings-notice-COojb6XK.js} +1 -1
- package/web/dist/assets/{repo-git-DqBUjQMh.js → repo-git-Mgk4Qcmo.js} +1 -1
- package/web/dist/assets/{report-reader-DtSBGt0O.js → report-reader-zWwalJDN.js} +1 -1
- package/web/dist/assets/{reports-ea3-iuBm.js → reports-BCHWt3zy.js} +1 -1
- package/web/dist/assets/{resources-section-CpXFFHXl.js → resources-section-Cb2WIqNv.js} +1 -1
- package/web/dist/assets/{run-header-BWTrj0_2.js → run-header-DeprqSP7.js} +1 -1
- package/web/dist/assets/{select-aiSr0uTB.js → select-y3oRuA2s.js} +1 -1
- package/web/dist/assets/{session-context-section-BRaZbxVO.js → session-context-section-CiPNMiL7.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-DMIqQhkC.js → settings-agent-picker-CJJJncuA.js} +1 -1
- package/web/dist/assets/{settings-shell-DwMbZhxp.js → settings-shell-CLToW28f.js} +1 -1
- package/web/dist/assets/{sidebar-section-ClrORHpO.js → sidebar-section-VOYJarPd.js} +1 -1
- package/web/dist/assets/{skills-B97qjJ7j.js → skills-BySF3yBA.js} +1 -1
- package/web/dist/assets/{task-changes-BEfLx9dF.js → task-changes-NUwvUglx.js} +1 -1
- package/web/dist/assets/{task-commits-6f0GpNF7.js → task-commits-CpV1Hz9L.js} +1 -1
- package/web/dist/assets/{task-files-CA2xTRaM.js → task-files-Bu-L_NRW.js} +1 -1
- package/web/dist/assets/{task-github-item-BWapcDJr.js → task-github-item-DhiTqCjk.js} +1 -1
- package/web/dist/assets/{task-thread-0rKVutjQ.js → task-thread-CKkTeQdi.js} +1 -1
- package/web/dist/assets/{thread-state-C3eDWXYs.js → thread-state-B_ZqjjRr.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DrAmCxn8.js → use-hand-to-agent-state-K864D69i.js} +1 -1
- package/web/dist/assets/{workflows-CW-1K6tq.js → workflows-DlTkuM0J.js} +1 -1
- package/web/dist/assets/{workspace-tools-BzDQrP3y.js → workspace-tools-BRK7f1Hk.js} +1 -1
- package/web/dist/assets/{worktrees-section-ay1jJn_w.js → worktrees-section-BXI0-7HH.js} +1 -1
- package/web/dist/index.html +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.19.0-dev.
|
|
2
|
+
"version": "0.19.0-dev.8642",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"node": ">=24.21.0"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@hearsay-tools/squawk": "0.19.0-dev.
|
|
15
|
-
"@wjarka/cezarion": "0.19.0-dev.
|
|
14
|
+
"@hearsay-tools/squawk": "0.19.0-dev.8642",
|
|
15
|
+
"@wjarka/cezarion": "0.19.0-dev.8642"
|
|
16
16
|
},
|
|
17
17
|
"bin": {
|
|
18
18
|
"cezarion": "dist/index.js",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,m as i,o as a,s as o,u as s}from"./live-reads-Crd6fVGH.js";import{Ln as c,Nn as l,Nr as u,Pn as d,an as f,pi as p,ti as m}from"./project-scope-context-Rv6S_BXt.js";import{n as h}from"./toaster-BXnLIU3z.js";import{Ct as g,Et as _,Ft as v,Mt as y,Qt as b,St as x,Vt as S,ft as ee,lt as te,pt as C,qt as w,ut as T,vt as E}from"./queries-qCF-eOqZ.js";import{f as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as re}from"./design-icons-CzEoMH9c.js";import{t as ie}from"./createLucideIcon-BHp8sXmF.js";import{t as ae}from"./folder-browser-B7IbnF0d.js";import{t as D}from"./button-B7MKxYjT.js";import{t as oe}from"./badge-DQ3U69Ht.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dialog-B531GGAo.js";import{t as P}from"./status-dot-BRzVlF2X.js";import{n as F}from"./agents-settings-path-7X6_cvUg.js";import{t as I}from"./centered-state-V15AR_qo.js";import{Gt as L,Ht as R,Jt as z,Kt as B,N as V,Ut as H,Wt as U,Yt as W,j as G,qt as K}from"./index-CvVmG4Yu.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-DMIqQhkC.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-D7G8cXSx.js";var fe=ie(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),pe=`~/.claude-second`;function me({open:e,onOpenChange:t,providers:n,initialProvider:a}){let s=i().data,[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(a??n[0]??`claude`),[m,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=C(),S=_.trim();return(0,X.jsx)(N,{open:e,onOpenChange:t,children:(0,X.jsxs)(j,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(A,{children:[(0,X.jsx)(M,{children:`Add agent account`}),(0,X.jsx)(k,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:f,onChange:e=>p(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:o(s,e)},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:m,placeholder:`Work`,onChange:e=>g(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:_,placeholder:r(s,f)?.accountFolderExample??pe,onChange:e=>{v(e.target.value),d(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ae,{path:c,selected:u,onSelect:e=>{d(e),v(e.path),x.reset()},onEnter:e=>{l(e),d(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(O,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(D,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(D,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:f,configDir:S,...m.trim()?{label:m.trim()}:{}},{onSuccess:()=>{t(!1),g(``),v(``),d(null),b(!1),h(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function he(e){return c(await d.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ge(e,t){return c(await d.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var _e={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function ve(e){let t=E().data?.capabilities?.settingsAdmin===!0,n=p(),r=[`runner-install`,e],i=m({queryKey:r,queryFn:()=>he(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=b({mutationFn:t=>ge(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function ye({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(D,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(D,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(D,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function be({runner:e}){let t=ve(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${_e[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(ye,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var xe={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Se(){let e=T(),t=i();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(I,{icon:(0,X.jsx)(fe,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Te,{data:e.data,runners:t.data})}function Ce(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function we(){let{hash:e}=ne();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function Te({data:e,runners:t}){let n=E(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(null),s=_();return we(),ue(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(le,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:de}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Ae,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:o},r.id))}),(0,X.jsx)(je,{runners:t}),r===null?null:(0,X.jsx)(me,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(R,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,X.jsxs)(L,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(z,{children:[(0,X.jsxs)(W,{children:[`Remove “`,a?.label,`”?`]}),(0,X.jsxs)(B,{children:[`This only forgets the account. Nothing in `,a?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(K,{children:[(0,X.jsx)(U,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),h(`Removed ${e.label}`)},onError:e=>h(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Ee({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Oe,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}var De=/^mock \(\w*DRY_RUN=1\)$/;function Oe({version:e}){return De.test(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded bg-muted/60 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:`Dry run`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function ke({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Z({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(ke,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Ae({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${F(l)}-title`,m=i&&o?(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Ee,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:F(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Z,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(be,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function je({runners:e}){let[t,n]=(0,Y.useState)(null),r=p(),i=v(),o=x(),c=w(s(e)),l=b({mutationFn:e=>f(e),onSuccess:e=>r.setQueryData(S.config,e),onError:e=>h(e.message,{tone:`danger`})});if(i.data===void 0)return null;let u=se([],e),d=i.data.agentDefaults.runner??`claude`,m=a(t??d,s(e))??t??d,g=i.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,X.jsx)(ce,{rows:u,runner:d,accountFor:()=>null,providerStatus:o,disabled:l.isPending,onPick:e=>{e!==d&&l.mutate({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,value:m,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===m).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(re,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsxs)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:g[t.id]??``,disabled:l.isPending,onChange:e=>l.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-64 max-w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[V(t.id,e,c[t.id]?.data,[g[t.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,X.jsx)(Q,{runner:t.id,runners:e,catalog:c[t.id]})]})]},t.id))]})]})}function Q({runner:e,runners:t,catalog:n}){let r=G(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Me({account:e,runners:t,status:n,editable:i}){let a=ee();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&r(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,i&&n&&n.status!==`connected`&&r(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(D,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>h(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>h(e instanceof l&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Ne(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${o(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let a=u(e),o=g(),s=te(a,e.status===void 0),c=e.status??s.data?.status,l=c?xe[c.status]:void 0,d=Ne(e,t,c,n),f=d?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:l?`Sign-in: ${l.label}`:void 0,children:[(0,X.jsx)(P,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":d.slot,className:`text-foreground`,children:d.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(P,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:l?.label??`Checking…`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>h(e.message,{tone:`danger`})}),children:`Check again`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(oe,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-[11px] font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Ce(e.configDir)}):null,v=d?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:d.guidance}):null,y=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Pe,{account:e,onRemove:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[m,f]}),_,v,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Z,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[p,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[p,b]})]})}function Pe({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=y();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(D,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>h(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{Se as GlobalAgentsSection};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,m as i,o as a,s as o,u as s}from"./live-reads-Crd6fVGH.js";import{Ln as c,Nn as l,Nr as u,Pn as d,an as f,pi as p,ti as m}from"./project-scope-context-Rv6S_BXt.js";import{n as h}from"./toaster-BXnLIU3z.js";import{Ct as g,Et as _,Ft as v,Mt as y,Qt as b,St as x,Vt as S,ft as ee,lt as te,pt as C,qt as w,ut as T,vt as E}from"./queries-qCF-eOqZ.js";import{f as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{y as re}from"./design-icons-CzEoMH9c.js";import{t as ie}from"./createLucideIcon-BHp8sXmF.js";import{t as ae}from"./folder-browser-B7IbnF0d.js";import{t as D}from"./button-B7MKxYjT.js";import{t as oe}from"./badge-DQ3U69Ht.js";import{a as O,i as k,o as A,r as j,s as M,t as N}from"./dialog-B531GGAo.js";import{t as P}from"./status-dot-BRzVlF2X.js";import{n as F}from"./agents-settings-path-7X6_cvUg.js";import{t as I}from"./centered-state-V15AR_qo.js";import{Gt as L,Ht as R,Jt as z,Kt as B,N as V,Ut as H,Wt as U,Yt as W,j as G,qt as K}from"./index-DNQcTHxV.js";import{t as q}from"./settings-select-CCIMGnyA.js";import{n as J,r as se,t as ce}from"./settings-agent-picker-CJJJncuA.js";import{n as le,r as ue,t as de}from"./remote-settings-notice-COojb6XK.js";var fe=ie(`id-card`,[[`path`,{d:`M16 10h2`,key:`8sgtl7`}],[`path`,{d:`M16 14h2`,key:`epxaof`}],[`path`,{d:`M6.17 15a3 3 0 0 1 5.66 0`,key:`n6f512`}],[`circle`,{cx:`9`,cy:`11`,r:`2`,key:`yxgjnd`}],[`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`,key:`qneu4z`}]]),Y=e(t(),1),X=n(),pe=`~/.claude-second`;function me({open:e,onOpenChange:t,providers:n,initialProvider:a}){let s=i().data,[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(a??n[0]??`claude`),[m,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1),x=C(),S=_.trim();return(0,X.jsx)(N,{open:e,onOpenChange:t,children:(0,X.jsxs)(j,{"data-slot":`add-account-dialog`,className:`sm:max-w-lg`,children:[(0,X.jsxs)(A,{children:[(0,X.jsx)(M,{children:`Add agent account`}),(0,X.jsx)(k,{children:`The config folder this account uses. It does not have to exist yet — Connect signs in and the CLI creates it.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Agent`}),(0,X.jsx)(q,{"aria-label":`Agent`,"data-slot":`add-account-provider`,value:f,onChange:e=>p(e.target.value),className:`rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`,children:n.map(e=>(0,X.jsx)(`option`,{value:e,children:o(s,e)},e))})]}),(0,X.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Name`}),(0,X.jsx)(`input`,{type:`text`,"aria-label":`Account name`,"data-slot":`add-account-label`,value:m,placeholder:`Work`,onChange:e=>g(e.target.value),className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 text-[13px] outline-none focus-visible:border-ring`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`Folder`}),(0,X.jsx)(`input`,{type:`text`,spellCheck:!1,autoComplete:`off`,"aria-label":`Config folder`,"data-slot":`add-account-dir`,value:_,placeholder:r(s,f)?.accountFolderExample??pe,onChange:e=>{v(e.target.value),d(null),x.reset()},className:`min-w-0 flex-1 rounded-md border border-input bg-card px-2 py-1 font-mono text-[13px] outline-none focus-visible:border-ring`}),(0,X.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`add-account-browse`,"aria-expanded":y,onClick:()=>b(e=>!e),children:y?`Hide folders`:`Browse…`})]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[`A `,(0,X.jsx)(`code`,{children:`~`}),` is kept as written and expanded when the agent runs.`]})]}),y?(0,X.jsx)(ae,{path:c,selected:u,onSelect:e=>{d(e),v(e.path),x.reset()},onEnter:e=>{l(e),d(null),x.reset()},showHidden:!0,emptyHint:`No subfolders here — pick this folder by typing its path above.`}):null,x.isError?(0,X.jsx)(`p`,{"data-slot":`add-account-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:x.error instanceof Error?x.error.message:`could not add that folder`}):null,(0,X.jsxs)(O,{className:`min-w-0 sm:items-center sm:justify-end`,children:[(0,X.jsx)(D,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsx)(D,{"data-slot":`add-account-confirm`,disabled:S===``||x.isPending,onClick:()=>{S===``||x.isPending||x.mutate({provider:f,configDir:S,...m.trim()?{label:m.trim()}:{}},{onSuccess:()=>{t(!1),g(``),v(``),d(null),b(!1),h(`Account added — use Connect to sign in`)}})},children:x.isPending?`Adding…`:`Add account`})]})]})})}async function he(e){return c(await d.api.v1[`runner-install`][`:runner`].$get({param:{runner:e}}),`/runner-install/:runner`)}async function ge(e,t){return c(await d.api.v1[`runner-install`][`:runner`].$post({param:{runner:e},json:{action:t}}),`/runner-install/:runner`)}var _e={idle:``,checking:`Checking for updates…`,downloading:`Downloading CLI…`,verifying:`Verifying CLI…`,extracting:`Extracting CLI…`,activating:`Activating CLI…`,removing:`Removing CLI…`,failed:``};function ve(e){let t=E().data?.capabilities?.settingsAdmin===!0,n=p(),r=[`runner-install`,e],i=m({queryKey:r,queryFn:()=>he(e),enabled:t,retry:!1,refetchInterval:e=>{if(e.state.error)return!1;let t=e.state.data?.phase;return t&&t!==`idle`&&t!==`failed`?1e3:6e4}}),a=b({mutationFn:t=>ge(e,t),retry:!1,onSuccess:e=>{n.setQueryData(r,e)}}),o=i.data;return{allowed:t,data:o,busy:a.isPending||!!o&&o.phase!==`idle`&&o.phase!==`failed`,error:a.error?.message??i.error?.message??o?.error,action:a,status:i}}function ye({state:e}){let{data:t,busy:n,action:r,status:i}=e;if(t?.supported===!1)return(0,X.jsx)(`p`,{children:`This host is not supported by the CLI installer.`});let a=!!t?.installedVersion;return(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(D,{className:`min-h-11 active:opacity-80`,disabled:n||!t,onClick:()=>r.mutate(a?`update`:`install`),children:a?`Update CLI`:`Install CLI`}),a?(0,X.jsx)(D,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>r.mutate(`remove`),children:`Remove CLI`}):null,(0,X.jsx)(D,{className:`min-h-11 active:opacity-80`,variant:`outline`,disabled:n,onClick:()=>{i.isError?i.refetch():r.mutate(`check`)},children:`Check for updates`})]})}function be({runner:e}){let t=ve(e),{allowed:n,data:r,busy:i,error:a}=t;return n?(0,X.jsxs)(`section`,{"aria-label":`CLI installation`,className:`grid gap-3`,children:[(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[r?.installedVersion?`Installed CLI ${r.installedVersion}`:`CLI not installed`,r?.latestVersion?` · Latest ${r.latestVersion}`:``,i&&r?` · ${_e[r.phase]}`:``]}),a?(0,X.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:a}):null,(0,X.jsx)(ye,{state:t}),r?.installedVersion?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Removing the CLI keeps account data and lets running tasks finish.`}):null]}):null}var xe={connected:{label:`Connected`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function Se(){let e=T(),t=i();if(e.isPending||t.isPending)return(0,X.jsx)(`p`,{"data-slot":`accounts-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agents…`});let n=e.error??t.error;return n?(0,X.jsx)(I,{icon:(0,X.jsx)(fe,{}),tone:`danger`,title:`Agents did not load`,subtitle:n.message,heading:`h2`}):(0,X.jsx)(Te,{data:e.data,runners:t.data})}function Ce(e){let t=e.replace(/^\/(?:home|Users)\/[^/]+/,`~`),n=t.split(`/`);return n.length>4?`…/${n.slice(-3).join(`/`)}`:t}function we(){let{hash:e}=ne();(0,Y.useEffect)(()=>{if(!e)return;let t=document.getElementById(decodeURIComponent(e.slice(1)));t&&(t.scrollIntoView?.({block:`start`}),t.focus({preventScroll:!0}))},[e])}function Te({data:e,runners:t}){let n=E(),[r,i]=(0,Y.useState)(null),[a,o]=(0,Y.useState)(null),s=_();return we(),ue(),(0,X.jsxs)(`div`,{"data-slot":`accounts-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-5 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,X.jsx)(le,{risk:`Agent accounts run each CLI with the configured host folder`}),e.editable?null:(0,X.jsxs)(`p`,{"data-slot":`accounts-hosted`,className:`text-[13px] text-muted-foreground`,children:[`Agent accounts are read-only on this remote cockpit. Run`,` `,(0,X.jsx)(`code`,{children:de}),` on the host to add, edit, or sign in to accounts here.`]}),(0,X.jsx)(`div`,{"data-slot":`agent-cards`,className:`flex flex-col gap-3`,children:t.runners.map(r=>(0,X.jsx)(Ae,{entry:r,check:n.data?.checks?.find(e=>e.name===r.id),settingsAdmin:n.data?.capabilities?.settingsAdmin===!0,runners:t,editable:e.editable,accounts:e.profiles.filter(e=>e.provider===r.id),canCarryAccounts:e.profileCapableProviders.includes(r.id),onAdd:()=>i(r.id),onRemove:o},r.id))}),(0,X.jsx)(je,{runners:t}),r===null?null:(0,X.jsx)(me,{open:!0,onOpenChange:e=>!e&&i(null),providers:e.profileCapableProviders,initialProvider:r},r),(0,X.jsx)(R,{open:a!==null,onOpenChange:e=>!e&&o(null),children:(0,X.jsxs)(L,{"data-slot":`accounts-remove-confirm`,children:[(0,X.jsxs)(z,{children:[(0,X.jsxs)(W,{children:[`Remove “`,a?.label,`”?`]}),(0,X.jsxs)(B,{children:[`This only forgets the account. Nothing in `,a?.configDir??`this account’s folder`,` is deleted — not your login, not your sessions. Projects using it fall back to the default account, and tasks that ran under it can no longer be resumed from here.`]})]}),(0,X.jsxs)(K,{children:[(0,X.jsx)(U,{children:`Cancel`}),(0,X.jsx)(H,{"data-action":`accounts-remove-confirm`,disabled:s.isPending,onClick:()=>{let e=a;e&&s.mutate(e.id,{onSuccess:()=>{o(null),h(`Removed ${e.label}`)},onError:e=>h(e.message,{tone:`danger`})})},children:`Remove`})]})]})})]})}function Ee({entry:e,check:t}){return t===void 0?(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`Checking CLI…`}):t.available?(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`agent-installed`,children:`CLI installed`}),t.version?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}),(0,X.jsx)(Oe,{version:t.version})]}):null]}):(0,X.jsxs)(`span`,{"data-slot":`agent-installed`,children:[`CLI not installed`,e.installHint?(0,X.jsxs)(X.Fragment,{children:[` — `,(0,X.jsx)(`code`,{className:`break-all`,children:e.installHint})]}):null]})}var De=/^mock \(\w*DRY_RUN=1\)$/;function Oe({version:e}){return De.test(e)?(0,X.jsx)(`span`,{"data-slot":`agent-version`,"data-dry-run":``,title:e,className:`rounded bg-muted/60 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground`,children:`Dry run`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`, version `}),(0,X.jsx)(`span`,{"data-slot":`agent-version`,className:`text-muted-foreground`,children:e})]})}function ke({items:e}){let t=e.filter(e=>e!=null&&e!==!1);return t.length===0?null:(0,X.jsx)(`p`,{"data-slot":`agent-summary`,className:`settings-agent-summary`,children:t.map((e,t)=>(0,X.jsxs)(`span`,{className:`settings-agent-summary-item`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`settings-agent-summary-sep`,children:`·`}):null,e]},t))})}function Z({titleId:e,title:t,summary:n,actions:r,actionsSlot:i}){return(0,X.jsxs)(`div`,{"data-slot":`agent-head`,className:`settings-agent-head`,children:[(0,X.jsxs)(`div`,{className:`settings-agent-heading`,children:[(0,X.jsx)(`h3`,{id:e,className:`settings-account-provider-title`,children:t}),(0,X.jsx)(ke,{items:n})]}),r?(0,X.jsx)(`div`,{"data-slot":i,className:`settings-account-actions`,children:r}):null]})}function Ae({entry:e,check:t,settingsAdmin:n,runners:r,editable:i,accounts:a,canCarryAccounts:o,onAdd:s,onRemove:c}){let l=e.id,u=e.displayName,d=e.managedInstall===!0&&n,f=a.filter(e=>e.isDefault).length,p=`${F(l)}-title`,m=i&&o?(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`accounts-add`,"data-provider":l,onClick:s,children:`Add account`}):null,h={titleId:p,title:u,facts:[d?null:(0,X.jsx)(Ee,{entry:e,check:t}),i||a.length>0?(0,X.jsxs)(`span`,{className:`settings-account-count`,title:`${f} discovered, ${a.length-f} added`,children:[a.length,` `,a.length===1?`account`:`accounts`]}):null],addButton:m},[g,..._]=a;return(0,X.jsxs)(`section`,{id:F(l),tabIndex:-1,"aria-labelledby":p,"data-slot":`accounts-provider`,"data-provider":l,className:`settings-agent-card flex flex-col rounded-lg border border-border bg-card`,children:[g===void 0?(0,X.jsx)(Z,{titleId:p,title:u,summary:h.facts,actions:m,actionsSlot:`accounts-actions`}):null,d?(0,X.jsx)(be,{runner:l}):null,g===void 0?null:(0,X.jsxs)(`ul`,{className:`settings-agent-accounts`,children:[(0,X.jsx)($,{account:g,runners:r,editable:i,onRemove:()=>c(g),agent:h}),_.map(e=>(0,X.jsx)($,{account:e,runners:r,editable:i,onRemove:()=>c(e)},e.id))]}),i&&!o?(0,X.jsxs)(`p`,{"data-slot":`accounts-single-only`,className:`settings-agent-note`,children:[`One account only: `,u,` keeps its login outside its config folder, so a second folder would change settings without changing who is billed.`]}):!i&&a.length===0&&e.browserLogin?(0,X.jsxs)(`div`,{"data-slot":`hosted-sign-in`,className:`settings-agent-note flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`span`,{children:`Discovered account`}),(0,X.jsx)(J,{provider:l,label:u})]}):null]})}function je({runners:e}){let[t,n]=(0,Y.useState)(null),r=p(),i=v(),o=x(),c=w(s(e)),l=b({mutationFn:e=>f(e),onSuccess:e=>r.setQueryData(S.config,e),onError:e=>h(e.message,{tone:`danger`})});if(i.data===void 0)return null;let u=se([],e),d=i.data.agentDefaults.runner??`claude`,m=a(t??d,s(e))??t??d,g=i.data.agentDefaults.models??{};return(0,X.jsxs)(`section`,{"data-slot":`accounts-defaults`,className:`flex flex-col gap-3 rounded-lg border border-border bg-card/40 p-3.5`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:`Defaults for new projects`}),(0,X.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`What a project runs when it has not chosen for itself — set once instead of per repository. A project that has chosen keeps its own.`})]}),(0,X.jsx)(ce,{rows:u,runner:d,accountFor:()=>null,providerStatus:o,disabled:l.isPending,onPick:e=>{e!==d&&l.mutate({agentDefaults:{runner:e}})}}),(0,X.jsxs)(`div`,{className:`settings-account-models flex flex-col gap-2`,children:[(0,X.jsxs)(`label`,{className:`settings-model-agent-choice`,children:[(0,X.jsx)(`span`,{children:`Default model for`}),(0,X.jsx)(q,{"aria-label":`Model agent`,value:m,onChange:e=>n(e.target.value),children:e.runners.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.displayName},e.id))})]}),e.runners.filter(e=>e.id===m).map(t=>(0,X.jsxs)(`label`,{className:`settings-account-model flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(re,{className:`size-4 text-accent-icon shrink-0`}),(0,X.jsx)(`span`,{className:`w-28 shrink-0 text-xs text-muted-foreground`,children:t.displayName}),(0,X.jsxs)(q,{"aria-label":`Default model for ${t.pickerLabel}`,"data-slot":`accounts-default-model`,"data-runner":t.id,value:g[t.id]??``,disabled:l.isPending,onChange:e=>l.mutate({agentDefaults:{models:{[t.id]:e.target.value||null}}}),className:`block w-64 max-w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[V(t.id,e,c[t.id]?.data,[g[t.id]]).map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.id===``?`Native default`:e.label},e.id)),(0,X.jsx)(Q,{runner:t.id,runners:e,catalog:c[t.id]})]})]},t.id))]})]})}function Q({runner:e,runners:t,catalog:n}){let r=G(e,t,n);return r?(0,X.jsx)(`option`,{disabled:!0,children:r}):null}function Me({account:e,runners:t,status:n,editable:i}){let a=ee();return(0,X.jsxs)(X.Fragment,{children:[n&&n.status!==`connected`&&r(t,e.provider)?.browserLogin?(0,X.jsx)(J,{provider:e.provider,...e.isDefault?{}:{profileId:e.id},label:e.label}):null,i&&n&&n.status!==`connected`&&r(t,e.provider)?.terminalLogin!==!1?(0,X.jsx)(D,{type:`button`,size:`sm`,"data-action":`account-connect`,disabled:a.isPending,onClick:()=>a.mutate({provider:e.provider,...e.isDefault?{}:{profileId:e.id}},{onSuccess:e=>h(e.opened?`Finish signing in in the terminal, then Check again.`:`This account is already connected.`),onError:e=>h(e instanceof l&&e.command?`${e.message} — run: ${e.command}`:e.message,{tone:`danger`})}),children:`Connect`}):null]})}function Ne(e,t,n,r){return!n||n.requiresAccountHome===!1?null:e.exists?!e.looksValid&&e.configDir?{slot:`account-unrecognised`,label:`Unrecognized folder`,guidance:`This folder does not look like ${o(t,e.provider)} config yet.`}:null:{slot:`account-missing`,label:`Not initialized`,guidance:r?n.status===`connected`?`Folder not created yet. Use Check again to refresh.`:`Folder not created yet. Connect will make it.`:`Folder not created on the host yet.`}}function $({account:e,runners:t,editable:n,onRemove:r,agent:i}){let a=u(e),o=g(),s=te(a,e.status===void 0),c=e.status??s.data?.status,l=c?xe[c.status]:void 0,d=Ne(e,t,c,n),f=d?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:l?`Sign-in: ${l.label}`:void 0,children:[(0,X.jsx)(P,{tone:`pending`}),(0,X.jsx)(`span`,{"data-slot":d.slot,className:`text-foreground`,children:d.label})]}):(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,X.jsx)(P,{tone:l?.tone??`neutral`,pulse:l===void 0}),(0,X.jsx)(`span`,{"data-slot":`account-status`,className:`text-foreground`,children:l?.label??`Checking…`})]}),p=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{account:e,runners:t,status:c,editable:n}),(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-recheck`,disabled:o.isPending,title:`Re-probe this account's login now, instead of waiting for the cached answer`,onClick:()=>o.mutate(a,{onError:e=>h(e.message,{tone:`danger`})}),children:`Check again`})]}),m=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`settings-account-label`,children:e.label}),e.isDefault?(0,X.jsx)(oe,{variant:`outline`,"data-slot":`account-discovered`,className:`shrink-0 text-[11px] font-normal text-muted-foreground`,children:`discovered`}):null]}),_=e.configDir?(0,X.jsx)(`span`,{"data-slot":`account-path`,className:`settings-account-path`,title:e.path,children:Ce(e.configDir)}):null,v=d?(0,X.jsx)(`p`,{"data-slot":`account-folder-guidance`,className:`settings-account-hint`,children:d.guidance}):null,y=c?.hint?(0,X.jsx)(`p`,{className:`settings-account-hint`,children:c.hint}):null,b=n&&!e.isDefault?(0,X.jsx)(Pe,{account:e,onRemove:r}):null,x=(0,X.jsxs)(`div`,{className:`settings-account-readout`,children:[(0,X.jsxs)(`div`,{className:`settings-account-meta-line`,children:[m,f]}),_,v,y]});return i?(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,"data-primary":``,className:`settings-account-primary`,children:[(0,X.jsx)(Z,{titleId:i.titleId,title:i.title,summary:i.facts,actions:(0,X.jsxs)(X.Fragment,{children:[p,i.addButton]}),actionsSlot:`account-actions`}),(0,X.jsxs)(`div`,{className:`settings-account-meta`,children:[x,b?(0,X.jsx)(`div`,{className:`settings-account-actions`,children:b}):null]})]}):(0,X.jsxs)(`li`,{"data-slot":`account-row`,"data-account":e.id,className:`settings-account-line`,children:[x,(0,X.jsxs)(`div`,{"data-slot":`account-actions`,className:`settings-account-actions`,children:[p,b]})]})}function Pe({account:e,onRemove:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(e.label),o=y();return(0,X.jsx)(X.Fragment,{children:e.isDefault?null:(0,X.jsx)(`div`,{"data-slot":`account-manage`,className:`settings-account-management`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`input`,{type:`text`,autoFocus:!0,"aria-label":`Name for ${e.label}`,"data-slot":`account-rename-input`,value:i,onChange:e=>a(e.target.value),className:`w-48 rounded-md border border-input bg-card px-2 py-1 text-xs outline-none focus-visible:border-ring`}),(0,X.jsx)(D,{type:`button`,size:`sm`,"data-action":`account-rename-save`,disabled:o.isPending||i.trim()===``||i.trim()===e.label,onClick:()=>o.mutate({id:e.id,label:i.trim()},{onSuccess:()=>r(!1),onError:e=>h(e.message,{tone:`danger`})}),children:`Save`}),(0,X.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{a(e.label),r(!1)},children:`Cancel`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-rename`,onClick:()=>r(!0),children:`Rename`}),(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-action":`account-remove`,onClick:t,children:`Remove account`}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Renaming changes what Squawk calls this account, not its folder.`})]})})})}export{Se as GlobalAgentsSection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i,m as a,r as o,s,t as c}from"./live-reads-Crd6fVGH.js";import{$n as l,$r as u,An as d,Br as f,Dn as p,Fn as m,Hr as ee,Ln as te,Nn as ne,Pn as re,Yr as ie,pi as ae,ti as oe,vn as se,vr as ce,wn as le}from"./project-scope-context-Rv6S_BXt.js";import{B as h,F as ue,G as de,I as g,J as fe,N as _,P as pe,S as me,T as he,W as v,Y as ge,j as y,z as b}from"./live-protocol-DMhTnCmf.js";import{n as _e}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as ve}from"./arrow-up-right-DKGzsMqY.js";import{t as S}from"./bot-TkDIw4y-.js";import{n as ye,t as be}from"./circle-x-7nTlobAF.js";import{t as xe}from"./eye-B8okNWXU.js";import{t as Se}from"./hourglass-CikYdGGQ.js";import{t as Ce}from"./message-square-B-MD-8rD.js";import{t as we}from"./button-B7MKxYjT.js";import{t as C}from"./project-router-CLJTc7gv.js";import"./attention-CBCeJN5w.js";import{t as w}from"./status-dot-BRzVlF2X.js";import{$t as Te}from"./index-CvVmG4Yu.js";var Ee=x(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),De=x(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Oe=x(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),ke=x(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Ae=x(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),je=x(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Me=x(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ne=x(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Pe=x(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),T=e(t(),1),E=n(),D=ge(),O=b().int().nonnegative(),k=v().min(1),Fe=h({title:v().max(160),toolKind:y([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:y([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:D,endedAt:D.optional()}).strict(),Ie=y([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Le=h({checks:_(h({name:v().max(100),bucket:Ie}).strict()).max(100),counts:h({pass:O,fail:O,pending:O,skipping:O,cancel:O}).strict(),truncated:g(!0).optional()}).strict(),Re=ue(`kind`,[h({kind:g(`human`),since:D,detail:h({question:v().max(500).optional(),reason:y([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:b().int().positive().optional()}).strict()}).strict(),h({kind:g(`usage-limit`),detail:h({resumeAt:v()}).strict()}).strict(),h({kind:g(`workers`),since:D,deadline:D.optional(),detail:h({owed:O,total:O,settled:O,replies:g(!0).optional(),mode:me.optional(),recipientRunIds:_(k)}).strict()}).strict(),h({kind:g(`peers`),since:D,deadline:D,detail:h({peerRunIds:_(k)}).strict()}).strict(),h({kind:g(`subagents`),since:D,deadline:D,detail:h({running:O}).strict()}).strict(),h({kind:g(`pr`),since:D,deadline:D,detail:h({number:b().int().positive(),target:l,checks:Le.shape.checks.optional(),counts:Le.shape.counts.optional(),truncated:g(!0).optional()}).strict()}).strict(),h({kind:g(`process`),since:D,deadline:D,detail:h({pid:b().int(),note:v().optional()}).strict()}).strict(),h({kind:g(`plugin`),since:D,deadline:D.optional(),detail:h({pluginKind:v().min(1).max(64),summary:v().max(256)}).strict()}).strict(),h({kind:g(`timer`),since:D,deadline:D,detail:h({wakeAt:D,note:v().optional()}).strict()}).strict()]),ze={runId:k,title:v(),status:ce,rung:y(le),runner:u.optional(),model:v().optional(),currentStepId:v().optional(),startedAt:v().optional(),wait:Re.optional(),tool:Fe.optional(),rate:_(O).length(30),error:v().max(200).optional()},Be=h({...ze,revision:O,collected:pe()}).strict(),Ve=h({...ze,workers:_(Be)}).strict(),He=h({requestId:fe(),relationship:y([`family`,`peer`]),senderRunId:k,recipientRunId:k,text:v().max(500),senderTitle:v().optional(),recipientTitle:v().optional(),createdAt:D,deadline:D.optional()}).strict(),Ue=h({requestId:fe(),senderRunId:k,recipientRunId:k,status:he.shape.status,observedAt:D}).strict(),We=h({generatedAt:D,projects:_(h({projectId:v(),name:v(),loaded:pe(),unavailable:h({status:de([g(404),g(409),g(503)]),error:v()}).strict().optional(),inReview:O,tasks:_(Ve),requests:_(He),closed:_(Ue)}).strict())}).strict();h({project:de([g(`default`),v().regex(se)]).optional()});var Ge=5e3,Ke=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],qe=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Je=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,Ye=`the Squawk server answered /workspace/activity with an unexpected body`;function Xe(e){let t=We.safeParse(e);if(!t.success)throw new ne(200,Ye);return t.data}async function Ze(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return Xe(await te(await re.api.v1.workspace.activity.$get({query:n},m(t)),`/workspace/activity`))}function Qe(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var $e=new Date(0).toISOString();function et(e){return e!==void 0&&e!==$e&&!Number.isNaN(Date.parse(e))}var tt=new Set([404,409,503]);function nt(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??$e,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function rt(e,t){return new ne(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var it=(e,t)=>e.kind===`project`&&tt.has(t.status)?t.status:void 0;function at(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,T.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,T.useMemo)(()=>Ke(n),[n]),a=ae(),s=oe({queryKey:r,queryFn:async({signal:e})=>{let t=a.getQueryData(r);try{return Qe(t,await Ze(n,{signal:e}))}catch(e){let r=e instanceof ne?it(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return nt(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,T.useEffect)(()=>{let e=!0,t=t=>{a.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let i=it(n,t);if(i!==void 0&&n.kind===`project`){a.setQueryData(r,e=>nt(e,n.projectId,i,t.message));return}let o=a.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},s=n=>{let i;try{i=Xe(n)}catch(e){t(e);return}a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,e=>Qe(e,i))})},l=o(qe(n),s),u=i(Ge),d,p=()=>{let e=f()===`finite`&&u!==!1;e&&!d?d=c({path:Je(n),intervalMs:u},(e,n)=>{n===void 0?s(e):t(rt(e,n))}):!e&&d&&(d(),d=void 0)};p();let m=ee(p);return()=>{e=!1,m(),d?.(),l()}},[a,r,n]),s}var ot=e=>String(e).padStart(2,`0`);function A(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${ot(r)}:${ot(i)}`:`${r}:${ot(i)}`}function j(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r>=24)return`${Math.floor(r/24)}d`;let i=n%60;return r<6&&i>0?`${r}h ${i}m`:`${r}h`}function M(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var st=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function N(e){let t=Date.parse(e);return Number.isNaN(t)?e:st.format(t)}var ct=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}),lt=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`});function ut(e){let t=typeof e==`number`?e:Date.parse(e);return Number.isNaN(t)?String(e):`${ct.format(t)}, ${lt.format(t)} ${ft()}`}function dt(e){let t=Math.max(0,Math.floor(e/1e3));return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function ft(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var pt=new Set([`queued`,`running`,`waiting`]),mt={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},ht={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},P=e=>pt.has(e),F=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,I=e=>p(e.rung).tone,L=(e,t=`Deadline`)=>e?`${t} ${N(e)}`:void 0;function gt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${F(t.length,`task`)}`}function _t(e,t){let n=e.tool,r={verb:`Running`,tone:I(e),icon:`tool`},i=n?.endedAt!==void 0&&M(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${j(M(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function vt(e,t){let n={verb:`Needs you`,tone:I(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${F(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function yt(e){return{verb:`Needs you`,tone:I(e),icon:`user`,main:`Permission`,action:`open`}}function bt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:I(e),since:t.since};if(o){let e=c.length>0?gt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...R(`detail`,L(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${xt[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...R(`detail`,L(t.deadline))}}var xt={one:`One`,any:`Any`,all:`All`};function St(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var Ct=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function wt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=Ct.reduce((e,t)=>e+i(t),0),o=Ct.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var Tt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function Et(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=Tt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=wt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function Dt(e,t){let n={tone:I(e),since:t.since,...R(`detail`,L(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:St(t),...R(`checks`,r),...R(`overflow`,wt(t)),...R(`checkSummary`,Et(t))}}function R(e,t){return t===void 0?{}:{[e]:t}}function Ot(e,t,n){let r=I(e);switch(t.kind){case`workers`:return bt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:gt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${N(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:F(t.detail.running,`native subagent`),detail:`Deadline ${N(t.deadline)}`};case`pr`:return Dt(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${A(M(t.since,n.now))} · deadline ${N(t.deadline)}`};case`plugin`:return{verb:`Waiting`,tone:r,icon:`timer`,since:t.since,main:t.detail.summary,...R(`detail`,L(t.deadline))};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${N(t.detail.wakeAt)} · in ${A(-M(t.detail.wakeAt,n.now))}`};case`usage-limit`:return kt(e,t.detail.resumeAt,n);case`human`:return}}function kt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${N(t)} · in ${A(r-n.now)}`;return{verb:`Paused`,tone:I(e),icon:`pause`,main:`Usage limit`,detail:i}}function At(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:I(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${j(M(n,t.now))}`}:{}}}function z(e,t){return{verb:mt[e.status]??e.status,tone:I(e),icon:ht[e.status]??`done`,main:t}}function jt(e,t){return P(e.status)?Mt(e,t):z(e,F(e.workers.filter(e=>P(e.status)).length,`live worker`))}function Mt(e,t){let n=e.wait;switch(e.rung){case`running`:return _t(e,t);case`needs-permission`:return yt(e);case`needs-you`:return vt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?kt(e,n.detail.resumeAt,t):{verb:`Paused`,tone:I(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return At(e,t);default:return(n&&Ot(e,n,t))??At(e,t)}}function Nt(e,t,n){if(n!==void 0&&P(e.status))return{verb:`Asks parent`,tone:I(e),main:`“${n}”`,asks:!0};let r=Pt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Pt(e,t){switch(e.status){case`done`:return z(e,e.collected?`Collected`:`Ready to collect`);case`review`:return z(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return z(e,e.error??mt[e.status]??e.status);default:return Mt({...e,workers:[]},t)}}function Ft(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function It(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function B(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var Lt=(e,t)=>B(e,t.senderRunId,t.senderTitle),V=(e,t)=>B(e,t.recipientRunId,t.recipientTitle),Rt=(e,t)=>`wait:${e}:${t}`;function H(e){let t=[];for(let n of e){let e=n.wait;if(!(!P(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:Rt(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function zt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Bt(e,t){return t.filter(t=>t.waiterRunId===e)}function Vt(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${V(n,r)}`),r.recipientRunId===e&&i.push(`${Lt(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${B(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${B(n,t.waiterRunId)} waits for you to write`);return i}function Ht(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Ut(e,t){let n=-M(e,t);return n>=1e3?`reply due in ${A(n)}`:`reply overdue`}function Wt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Gt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Kt[qt(e,t)]}}var Kt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function qt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Jt=new Set([`queued`,`waiting-for-capacity`]);function Yt(e){if(P(e.status))return d(e.rung)?`needsYou`:e.rung===`running`?`working`:Jt.has(e.rung)?`queued`:`waiting`}function Xt(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Yt(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>P(e.status)).length}}return t}function Zt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Qt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var U={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},W={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},$t=(e,t)=>`${e}\n${t}`;function en(e,t){let n=$t(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var tn=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},nn={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function rn(e,t){let n=nn[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},U.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},U.workerHold+U.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},U.workerHold)}function an(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},U.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},U.comet)}function on(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},U.fade);return}let a=U.comet+U.replied+U.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},U.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},U.comet+U.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},U.comet)}function sn(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:p(t.task.rung).tone},U.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},U.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},U.workerEnter);case`worker-settled`:return rn(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},U.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},U.cardLeave);case`check-passed`:return e.timed(`checks`,$t(t.runId,t.name),{},U.check);case`request-opened`:return an(e,t.request);case`request-closed`:return on(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},U.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},U.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},U.fade)}}function cn(e,t,n){let r=new tn(t);if(!n)for(let t of e)sn(r,t);return{changes:r.changes,timers:r.timers}}function ln(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function un(e,t){return t.reduce(ln,e)}function dn(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var fn={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function pn({tone:e,className:t,children:n,...i}){return(0,E.jsx)(`span`,{...i,className:r(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var mn={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},hn={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},gn={tool:Pe,user:Ne,workers:S,reply:Ce,peer:Ae,subagents:S,ci:ke,merge:Oe,command:Me,timer:De,pause:je,queued:Se,review:xe,failed:be,done:ye,cancelled:Ee};function _n(e,t){let n=p(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:yn(e,t)??n.label}}var G=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function vn(e){return e?.kind===`workers`&&!e.detail.replies&&e.detail.owed>0}function yn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`&&!vn(n))return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return G(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return G(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return G(`waiting for`,n.detail.running,`subagent`)}function bn(e,t){if(P(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function K({run:e,role:t}){let{tone:n,shape:i,label:a}=_n(e,t);return(0,E.jsx)(`span`,{"data-activity-anchor":e.runId,className:r(`inline-flex size-[12px] shrink-0 items-center justify-center`,bn(e,i)),children:(0,E.jsx)(w,{tone:n,shape:i,role:`img`,"aria-label":a})})}function xn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Wt(e,t),l=Bt(e,n);return c.length===0&&l.length===0?null:(0,E.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,V(r,e)]})},e.requestId)),l.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,B(r,e.peerRunId)]})},e.id))]})}var Sn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},Cn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function wn({checks:e,overflow:t,passed:n}){return(0,E.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:r(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,E.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:r(`h-[5px] min-w-px flex-1 rounded-[2px]`,Sn[e.bucket],Cn(e.bucket,n.has(e.name)))},e.name)),t?(0,E.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`i`,{className:r(`h-[5px] w-2 rounded-[2px]`,Sn[t.bucket])}),`+`,t.count]}):null]})}function Tn({value:e,ink:t}){return(0,E.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:r(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var En=new Set;function Dn({box:e,now:t,dense:n,motion:i={}}){let a=gn[e.icon],o=fn[e.tone];return(0,E.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[i.sweep?(0,E.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,E.jsx)(a,{"aria-hidden":`true`,className:r(`mt-px size-[15px]`,o)}),(0,E.jsxs)(pn,{tone:e.tone,className:`flex gap-2 text-[12px] font-semibold`,children:[(0,E.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,E.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium text-muted-foreground tabular-nums`,children:j(M(e.since,t))}):null]}),(0,E.jsx)(`span`,{"data-slot":`activity-main`,className:r(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,i.slideKey!==void 0&&`activity-slide`),children:e.main},i.slideKey??`still`),e.checks?(0,E.jsx)(wn,{checks:e.checks,overflow:e.overflow,passed:i.passed??En}):null,e.checkSummary?(0,E.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,E.jsx)(Tn,{value:e.bar,ink:o}),e.detail&&!n?(0,E.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function On({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),i=Math.max(4,...e);return(0,E.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:r(`block h-4 w-[62px] shrink-0`,t),children:[n>0?(0,E.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}):null,e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/i*14);return(0,E.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var q=e=>`/tasks/${encodeURIComponent(e)}`;function kn(e,t,n){return[e.runner?s(n,e.runner):void 0,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?j(M(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function An({texts:e}){return e.length===0?null:(0,E.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,E.jsx)(`li`,{children:e},t))})}function jn({worker:e,parentId:t,requests:n,index:i,ctx:o,motion:c}){let l=Nt(e,o,Ht(e.runId,t,n)?.text),u=c.workerHold[e.runId],d=a().data;return(0,E.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":l.asks?`true`:void 0,"data-hold":u?.phase,className:r(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,l.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in c.workerEnter&&`activity-row-enter`,u?.phase===`fold`&&`activity-row-fold`),children:[u?(0,E.jsx)(`span`,{"aria-hidden":`true`,className:r(`activity-row-flash`,hn[u.tone])},u.key):null,(0,E.jsx)(`span`,{className:`mt-[3px]`,children:(0,E.jsx)(K,{run:e,role:`worker`})}),(0,E.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,E.jsx)(C,{to:q(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,E.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner?s(d,e.runner):void 0,e.model].filter(Boolean).join(` · `)})]}),(0,E.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`b`,{className:r(`font-semibold`,fn[l.tone]),children:l.verb}),` · `,(0,E.jsx)(`span`,{className:r(l.mono&&`font-mono`),children:l.main})]}),(0,E.jsx)(An,{texts:Vt(e.runId,n,i)})]})}function Mn({workers:e}){return(0,E.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,E.jsx)(K,{run:e,role:`worker`},e.runId)),(0,E.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function Nn({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>P(e.status)||e.status===`review`||o(e.runId)),c=Qt(Zt(e,o));return(0,E.jsxs)(E.Fragment,{children:[s.length>0&&i?(0,E.jsx)(Mn,{workers:s}):null,s.length>0&&!i?(0,E.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,E.jsx)(jn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,E.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var Pn=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function Fn(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function In(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function Ln({task:e,motion:t,glow:n}){let i=t.flash[e.runId];return(0,E.jsxs)(E.Fragment,{children:[n?(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,i?(0,E.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":i.tone,"aria-hidden":`true`,className:r(`activity-flash`,mn[i.tone])},i.key):null]})}var Rn=[];function zn({task:e,requests:t,waits:n=Rn,index:i,ctx:o,dense:s,narrow:c,motion:l=W,ghost:u=!1,linked:d=!1,onHover:f}){let p=jt(e,o),m=a().data,ee=u?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},te={sweep:e.rung===`running`&&P(e.status),slideKey:l.slides[e.runId]?.key,passed:en(l,e.runId)};return(0,E.jsxs)(`article`,{...ee,"data-flip":e.runId,"data-rung":e.rung,"data-action":p.action,"data-linked":d&&!u?`true`:void 0,...u?{}:Fn(e.runId,f),className:r(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,p.action?`border-pending/70`:te.sweep?`border-status-running/60`:`border-border`,d&&!u&&`outline-2 outline-offset-2 outline-message-peer-accent`,In(e,l,u)),children:[(0,E.jsx)(Ln,{task:e,motion:l,glow:p.action!==void 0&&!u}),(0,E.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(K,{run:e,role:`root`}),(0,E.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,E.jsx)(C,{to:q(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})})]}),(0,E.jsxs)(`div`,{className:`mt-0.5 mb-2 ml-5 flex items-center gap-2`,children:[(0,E.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11.5px] text-muted-foreground`,children:kn(e,o.now,m)}),(0,E.jsx)(On,{rate:e.rate})]}),(0,E.jsx)(An,{texts:Vt(e.runId,t,i,n)}),(0,E.jsx)(Dn,{box:p,now:o.now,dense:s,motion:te}),p.action?(0,E.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,E.jsx)(we,{asChild:!0,size:`sm`,variant:p.action===`answer`?`primary`:`outline`,className:`relative z-[1] h-8 max-md:min-h-11`,children:(0,E.jsx)(C,{to:q(e.runId),children:p.action===`answer`?`Answer`:`Open task`})})}):null,c?(0,E.jsx)(xn,{runId:e.runId,requests:t,waits:n,index:i,link:C,pathOf:q,className:`mt-2 flex flex-col gap-1`,linkClassName:Pn}):null,(0,E.jsx)(Nn,{task:e,requests:t,index:i,ctx:o,dense:s,motion:l})]})}var Bn=`inline-flex min-w-0 items-center rounded-md border px-3 py-1 text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function Vn({scope:e,projectId:t,projectName:n}){let i=e=>r(Bn,e?`border-border bg-card text-foreground shadow-xs`:`border-transparent text-muted-foreground hover:text-foreground`);return(0,E.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex max-w-full rounded-lg border border-border bg-muted/60 p-1`,children:[t===null?null:(0,E.jsx)(_e,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:i(e===`project`),children:(0,E.jsx)(`span`,{className:`max-w-40 truncate`,title:n??t,children:n??t})}),(0,E.jsx)(_e,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:i(e===`all`),children:`All projects`})]})}function Hn({now:e,updatedAt:t,stale:n}){let i=t!==void 0&&!Number.isNaN(Date.parse(t));return(0,E.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":n?`true`:void 0,title:ut(e),className:`inline-flex items-center gap-1.5 text-[13px] text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`span`,{"data-tone":`success`,className:r(`inline-flex size-[12px] items-center justify-center`,!n&&`activity-pulse`),children:(0,E.jsx)(w,{tone:n?`neutral`:`success`,"aria-hidden":`true`})}),(0,E.jsx)(`b`,{className:r(`font-semibold`,n?`text-muted-foreground`:`text-success`),children:n?`Not updating`:`Live`}),i?(0,E.jsxs)(`span`,{children:[`· updated `,dt(M(t,e))]}):null]})}function Un({name:e,now:t,updatedAt:n,stale:r=!1,scopeSwitch:i}){return{title:`Activity`,scope:e,subtitle:t===void 0?void 0:(0,E.jsx)(Hn,{now:t,updatedAt:n,stale:r}),secondaryActions:i}}function Wn({primary:e=!1}){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(we,{variant:e?`primary`:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 py-1.5 max-md:min-h-11`,children:(0,E.jsx)(C,{to:`/new`,children:`New task`})}),(0,E.jsx)(we,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 py-1.5 max-md:min-h-11`,children:(0,E.jsx)(C,{to:`/`,children:`View tasks`})})]})}function Gn({value:e,bump:t}){return(0,E.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:r(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function J({icon:e,count:t,label:n,bump:r}){return(0,E.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,E.jsx)(Gn,{value:t,bump:r}),` `,n]})}function Kn({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,E.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,E.jsx)(J,{icon:(0,E.jsx)(w,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(w,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(w,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(w,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(S,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,E.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,E.jsxs)(C,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground transition-colors hover:border-accent-text/40 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,E.jsx)(w,{tone:`info`,"aria-hidden":`true`}),(0,E.jsx)(Gn,{value:e.inReview,bump:r(`inReview`)}),` in review`,(0,E.jsx)(ve,{"aria-hidden":`true`,className:`size-3 text-soft-foreground`})]})})]})}function qn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function Jn(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function Yn(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(Jn(o,r).push(e),s.add(e));return o}function Xn(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var Zn=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function Qn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var $n=(e,...t)=>e.filter(e=>!t.some(t=>er(e,t))),er=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,tr=e=>Math.round(e*10)/10,Y=e=>`${tr(e.x)} ${tr(e.y)}`;function nr(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function rr(e,t=8){let n=nr(e),r=n[0];if(!r)return``;let i=`M${Y(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${Y(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${Y(c(r,a,s))} Q ${Y(r)}, ${Y(c(r,o,s))}`}return i}function ir(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function ar(e){return{rows:ir(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:ir(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var X=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),Z=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function or(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function sr(e,t,n,r=0){let i=ar(n),a=X(i.rows,e=>e.top,e.y),o=X(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?Z(i,a):Z(i,a-1))+r/2,d=(s?Z(i,o-1):Z(i,o))+r/2,f=or(i,X(i.cols,e=>e.left,e.x),X(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var cr=15;function lr(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-cr,e.y+e.h+cr])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function ur(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=lr(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),cr-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function dr(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{i,m as a,r as o,s,t as c}from"./live-reads-Crd6fVGH.js";import{$n as l,$r as u,An as d,Br as f,Dn as p,Fn as m,Hr as ee,Ln as te,Nn as ne,Pn as re,Yr as ie,pi as ae,ti as oe,vn as se,vr as ce,wn as le}from"./project-scope-context-Rv6S_BXt.js";import{B as h,F as ue,G as de,I as g,J as fe,N as _,P as pe,S as me,T as he,W as v,Y as ge,j as y,z as b}from"./live-protocol-DMhTnCmf.js";import{n as _e}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as ve}from"./arrow-up-right-DKGzsMqY.js";import{t as S}from"./bot-TkDIw4y-.js";import{n as ye,t as be}from"./circle-x-7nTlobAF.js";import{t as xe}from"./eye-B8okNWXU.js";import{t as Se}from"./hourglass-CikYdGGQ.js";import{t as Ce}from"./message-square-B-MD-8rD.js";import{t as we}from"./button-B7MKxYjT.js";import{t as C}from"./project-router-CLJTc7gv.js";import"./attention-CBCeJN5w.js";import{t as w}from"./status-dot-BRzVlF2X.js";import{$t as Te}from"./index-DNQcTHxV.js";var Ee=x(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),De=x(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Oe=x(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),ke=x(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),Ae=x(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),je=x(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),Me=x(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ne=x(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),Pe=x(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),T=e(t(),1),E=n(),D=ge(),O=b().int().nonnegative(),k=v().min(1),Fe=h({title:v().max(160),toolKind:y([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:y([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:D,endedAt:D.optional()}).strict(),Ie=y([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Le=h({checks:_(h({name:v().max(100),bucket:Ie}).strict()).max(100),counts:h({pass:O,fail:O,pending:O,skipping:O,cancel:O}).strict(),truncated:g(!0).optional()}).strict(),Re=ue(`kind`,[h({kind:g(`human`),since:D,detail:h({question:v().max(500).optional(),reason:y([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:b().int().positive().optional()}).strict()}).strict(),h({kind:g(`usage-limit`),detail:h({resumeAt:v()}).strict()}).strict(),h({kind:g(`workers`),since:D,deadline:D.optional(),detail:h({owed:O,total:O,settled:O,replies:g(!0).optional(),mode:me.optional(),recipientRunIds:_(k)}).strict()}).strict(),h({kind:g(`peers`),since:D,deadline:D,detail:h({peerRunIds:_(k)}).strict()}).strict(),h({kind:g(`subagents`),since:D,deadline:D,detail:h({running:O}).strict()}).strict(),h({kind:g(`pr`),since:D,deadline:D,detail:h({number:b().int().positive(),target:l,checks:Le.shape.checks.optional(),counts:Le.shape.counts.optional(),truncated:g(!0).optional()}).strict()}).strict(),h({kind:g(`process`),since:D,deadline:D,detail:h({pid:b().int(),note:v().optional()}).strict()}).strict(),h({kind:g(`plugin`),since:D,deadline:D.optional(),detail:h({pluginKind:v().min(1).max(64),summary:v().max(256)}).strict()}).strict(),h({kind:g(`timer`),since:D,deadline:D,detail:h({wakeAt:D,note:v().optional()}).strict()}).strict()]),ze={runId:k,title:v(),status:ce,rung:y(le),runner:u.optional(),model:v().optional(),currentStepId:v().optional(),startedAt:v().optional(),wait:Re.optional(),tool:Fe.optional(),rate:_(O).length(30),error:v().max(200).optional()},Be=h({...ze,revision:O,collected:pe()}).strict(),Ve=h({...ze,workers:_(Be)}).strict(),He=h({requestId:fe(),relationship:y([`family`,`peer`]),senderRunId:k,recipientRunId:k,text:v().max(500),senderTitle:v().optional(),recipientTitle:v().optional(),createdAt:D,deadline:D.optional()}).strict(),Ue=h({requestId:fe(),senderRunId:k,recipientRunId:k,status:he.shape.status,observedAt:D}).strict(),We=h({generatedAt:D,projects:_(h({projectId:v(),name:v(),loaded:pe(),unavailable:h({status:de([g(404),g(409),g(503)]),error:v()}).strict().optional(),inReview:O,tasks:_(Ve),requests:_(He),closed:_(Ue)}).strict())}).strict();h({project:de([g(`default`),v().regex(se)]).optional()});var Ge=5e3,Ke=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],qe=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Je=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,Ye=`the Squawk server answered /workspace/activity with an unexpected body`;function Xe(e){let t=We.safeParse(e);if(!t.success)throw new ne(200,Ye);return t.data}async function Ze(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return Xe(await te(await re.api.v1.workspace.activity.$get({query:n},m(t)),`/workspace/activity`))}function Qe(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var $e=new Date(0).toISOString();function et(e){return e!==void 0&&e!==$e&&!Number.isNaN(Date.parse(e))}var tt=new Set([404,409,503]);function nt(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??$e,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function rt(e,t){return new ne(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var it=(e,t)=>e.kind===`project`&&tt.has(t.status)?t.status:void 0;function at(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,T.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,T.useMemo)(()=>Ke(n),[n]),a=ae(),s=oe({queryKey:r,queryFn:async({signal:e})=>{let t=a.getQueryData(r);try{return Qe(t,await Ze(n,{signal:e}))}catch(e){let r=e instanceof ne?it(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return nt(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,T.useEffect)(()=>{let e=!0,t=t=>{a.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let i=it(n,t);if(i!==void 0&&n.kind===`project`){a.setQueryData(r,e=>nt(e,n.projectId,i,t.message));return}let o=a.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},s=n=>{let i;try{i=Xe(n)}catch(e){t(e);return}a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,e=>Qe(e,i))})},l=o(qe(n),s),u=i(Ge),d,p=()=>{let e=f()===`finite`&&u!==!1;e&&!d?d=c({path:Je(n),intervalMs:u},(e,n)=>{n===void 0?s(e):t(rt(e,n))}):!e&&d&&(d(),d=void 0)};p();let m=ee(p);return()=>{e=!1,m(),d?.(),l()}},[a,r,n]),s}var ot=e=>String(e).padStart(2,`0`);function A(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${ot(r)}:${ot(i)}`:`${r}:${ot(i)}`}function j(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r>=24)return`${Math.floor(r/24)}d`;let i=n%60;return r<6&&i>0?`${r}h ${i}m`:`${r}h`}function M(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var st=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function N(e){let t=Date.parse(e);return Number.isNaN(t)?e:st.format(t)}var ct=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`}),lt=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`});function ut(e){let t=typeof e==`number`?e:Date.parse(e);return Number.isNaN(t)?String(e):`${ct.format(t)}, ${lt.format(t)} ${ft()}`}function dt(e){let t=Math.max(0,Math.floor(e/1e3));return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function ft(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var pt=new Set([`queued`,`running`,`waiting`]),mt={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},ht={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},P=e=>pt.has(e),F=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,I=e=>p(e.rung).tone,L=(e,t=`Deadline`)=>e?`${t} ${N(e)}`:void 0;function gt(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${F(t.length,`task`)}`}function _t(e,t){let n=e.tool,r={verb:`Running`,tone:I(e),icon:`tool`},i=n?.endedAt!==void 0&&M(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${j(M(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function vt(e,t){let n={verb:`Needs you`,tone:I(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${F(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function yt(e){return{verb:`Needs you`,tone:I(e),icon:`user`,main:`Permission`,action:`open`}}function bt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:I(e),since:t.since};if(o){let e=c.length>0?gt(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...R(`detail`,L(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${xt[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...R(`detail`,L(t.deadline))}}var xt={one:`One`,any:`Any`,all:`All`};function St(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var Ct=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function wt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=Ct.reduce((e,t)=>e+i(t),0),o=Ct.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var Tt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function Et(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=Tt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=wt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function Dt(e,t){let n={tone:I(e),since:t.since,...R(`detail`,L(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:St(t),...R(`checks`,r),...R(`overflow`,wt(t)),...R(`checkSummary`,Et(t))}}function R(e,t){return t===void 0?{}:{[e]:t}}function Ot(e,t,n){let r=I(e);switch(t.kind){case`workers`:return bt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:gt(`For`,t.detail.peerRunIds,n),detail:`Deadline ${N(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:F(t.detail.running,`native subagent`),detail:`Deadline ${N(t.deadline)}`};case`pr`:return Dt(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${A(M(t.since,n.now))} · deadline ${N(t.deadline)}`};case`plugin`:return{verb:`Waiting`,tone:r,icon:`timer`,since:t.since,main:t.detail.summary,...R(`detail`,L(t.deadline))};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${N(t.detail.wakeAt)} · in ${A(-M(t.detail.wakeAt,n.now))}`};case`usage-limit`:return kt(e,t.detail.resumeAt,n);case`human`:return}}function kt(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${N(t)} · in ${A(r-n.now)}`;return{verb:`Paused`,tone:I(e),icon:`pause`,main:`Usage limit`,detail:i}}function At(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:I(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${j(M(n,t.now))}`}:{}}}function z(e,t){return{verb:mt[e.status]??e.status,tone:I(e),icon:ht[e.status]??`done`,main:t}}function jt(e,t){return P(e.status)?Mt(e,t):z(e,F(e.workers.filter(e=>P(e.status)).length,`live worker`))}function Mt(e,t){let n=e.wait;switch(e.rung){case`running`:return _t(e,t);case`needs-permission`:return yt(e);case`needs-you`:return vt(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?kt(e,n.detail.resumeAt,t):{verb:`Paused`,tone:I(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return At(e,t);default:return(n&&Ot(e,n,t))??At(e,t)}}function Nt(e,t,n){if(n!==void 0&&P(e.status))return{verb:`Asks parent`,tone:I(e),main:`“${n}”`,asks:!0};let r=Pt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Pt(e,t){switch(e.status){case`done`:return z(e,e.collected?`Collected`:`Ready to collect`);case`review`:return z(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return z(e,e.error??mt[e.status]??e.status);default:return Mt({...e,workers:[]},t)}}function Ft(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function It(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function B(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var Lt=(e,t)=>B(e,t.senderRunId,t.senderTitle),V=(e,t)=>B(e,t.recipientRunId,t.recipientTitle),Rt=(e,t)=>`wait:${e}:${t}`;function H(e){let t=[];for(let n of e){let e=n.wait;if(!(!P(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:Rt(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function zt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Bt(e,t){return t.filter(t=>t.waiterRunId===e)}function Vt(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${V(n,r)}`),r.recipientRunId===e&&i.push(`${Lt(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${B(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${B(n,t.waiterRunId)} waits for you to write`);return i}function Ht(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Ut(e,t){let n=-M(e,t);return n>=1e3?`reply due in ${A(n)}`:`reply overdue`}function Wt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function Gt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Kt[qt(e,t)]}}var Kt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function qt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Jt=new Set([`queued`,`waiting-for-capacity`]);function Yt(e){if(P(e.status))return d(e.rung)?`needsYou`:e.rung===`running`?`working`:Jt.has(e.rung)?`queued`:`waiting`}function Xt(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Yt(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>P(e.status)).length}}return t}function Zt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Qt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var U={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},W={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},$t=(e,t)=>`${e}\n${t}`;function en(e,t){let n=$t(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var tn=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},nn={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function rn(e,t){let n=nn[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},U.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},U.workerHold+U.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},U.workerHold)}function an(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},U.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},U.comet)}function on(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},U.fade);return}let a=U.comet+U.replied+U.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},U.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},U.comet+U.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},U.comet)}function sn(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:p(t.task.rung).tone},U.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},U.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},U.workerEnter);case`worker-settled`:return rn(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},U.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},U.cardLeave);case`check-passed`:return e.timed(`checks`,$t(t.runId,t.name),{},U.check);case`request-opened`:return an(e,t.request);case`request-closed`:return on(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},U.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},U.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},U.fade)}}function cn(e,t,n){let r=new tn(t);if(!n)for(let t of e)sn(r,t);return{changes:r.changes,timers:r.timers}}function ln(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function un(e,t){return t.reduce(ln,e)}function dn(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var fn={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function pn({tone:e,className:t,children:n,...i}){return(0,E.jsx)(`span`,{...i,className:r(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var mn={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},hn={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},gn={tool:Pe,user:Ne,workers:S,reply:Ce,peer:Ae,subagents:S,ci:ke,merge:Oe,command:Me,timer:De,pause:je,queued:Se,review:xe,failed:be,done:ye,cancelled:Ee};function _n(e,t){let n=p(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:yn(e,t)??n.label}}var G=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function vn(e){return e?.kind===`workers`&&!e.detail.replies&&e.detail.owed>0}function yn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`&&!vn(n))return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return G(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return G(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return G(`waiting for`,n.detail.running,`subagent`)}function bn(e,t){if(P(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function K({run:e,role:t}){let{tone:n,shape:i,label:a}=_n(e,t);return(0,E.jsx)(`span`,{"data-activity-anchor":e.runId,className:r(`inline-flex size-[12px] shrink-0 items-center justify-center`,bn(e,i)),children:(0,E.jsx)(w,{tone:n,shape:i,role:`img`,"aria-label":a})})}function xn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Wt(e,t),l=Bt(e,n);return c.length===0&&l.length===0?null:(0,E.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,V(r,e)]})},e.requestId)),l.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,B(r,e.peerRunId)]})},e.id))]})}var Sn={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},Cn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function wn({checks:e,overflow:t,passed:n}){return(0,E.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:r(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,E.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:r(`h-[5px] min-w-px flex-1 rounded-[2px]`,Sn[e.bucket],Cn(e.bucket,n.has(e.name)))},e.name)),t?(0,E.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`i`,{className:r(`h-[5px] w-2 rounded-[2px]`,Sn[t.bucket])}),`+`,t.count]}):null]})}function Tn({value:e,ink:t}){return(0,E.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:r(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var En=new Set;function Dn({box:e,now:t,dense:n,motion:i={}}){let a=gn[e.icon],o=fn[e.tone];return(0,E.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[i.sweep?(0,E.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,E.jsx)(a,{"aria-hidden":`true`,className:r(`mt-px size-[15px]`,o)}),(0,E.jsxs)(pn,{tone:e.tone,className:`flex gap-2 text-[12px] font-semibold`,children:[(0,E.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,E.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium text-muted-foreground tabular-nums`,children:j(M(e.since,t))}):null]}),(0,E.jsx)(`span`,{"data-slot":`activity-main`,className:r(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,i.slideKey!==void 0&&`activity-slide`),children:e.main},i.slideKey??`still`),e.checks?(0,E.jsx)(wn,{checks:e.checks,overflow:e.overflow,passed:i.passed??En}):null,e.checkSummary?(0,E.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,E.jsx)(Tn,{value:e.bar,ink:o}),e.detail&&!n?(0,E.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function On({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),i=Math.max(4,...e);return(0,E.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:r(`block h-4 w-[62px] shrink-0`,t),children:[n>0?(0,E.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}):null,e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/i*14);return(0,E.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var q=e=>`/tasks/${encodeURIComponent(e)}`;function kn(e,t,n){return[e.runner?s(n,e.runner):void 0,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?j(M(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function An({texts:e}){return e.length===0?null:(0,E.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,E.jsx)(`li`,{children:e},t))})}function jn({worker:e,parentId:t,requests:n,index:i,ctx:o,motion:c}){let l=Nt(e,o,Ht(e.runId,t,n)?.text),u=c.workerHold[e.runId],d=a().data;return(0,E.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":l.asks?`true`:void 0,"data-hold":u?.phase,className:r(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,l.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in c.workerEnter&&`activity-row-enter`,u?.phase===`fold`&&`activity-row-fold`),children:[u?(0,E.jsx)(`span`,{"aria-hidden":`true`,className:r(`activity-row-flash`,hn[u.tone])},u.key):null,(0,E.jsx)(`span`,{className:`mt-[3px]`,children:(0,E.jsx)(K,{run:e,role:`worker`})}),(0,E.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,E.jsx)(C,{to:q(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,E.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner?s(d,e.runner):void 0,e.model].filter(Boolean).join(` · `)})]}),(0,E.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`b`,{className:r(`font-semibold`,fn[l.tone]),children:l.verb}),` · `,(0,E.jsx)(`span`,{className:r(l.mono&&`font-mono`),children:l.main})]}),(0,E.jsx)(An,{texts:Vt(e.runId,n,i)})]})}function Mn({workers:e}){return(0,E.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,E.jsx)(K,{run:e,role:`worker`},e.runId)),(0,E.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function Nn({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>P(e.status)||e.status===`review`||o(e.runId)),c=Qt(Zt(e,o));return(0,E.jsxs)(E.Fragment,{children:[s.length>0&&i?(0,E.jsx)(Mn,{workers:s}):null,s.length>0&&!i?(0,E.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,E.jsx)(jn,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,E.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var Pn=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function Fn(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function In(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function Ln({task:e,motion:t,glow:n}){let i=t.flash[e.runId];return(0,E.jsxs)(E.Fragment,{children:[n?(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,i?(0,E.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":i.tone,"aria-hidden":`true`,className:r(`activity-flash`,mn[i.tone])},i.key):null]})}var Rn=[];function zn({task:e,requests:t,waits:n=Rn,index:i,ctx:o,dense:s,narrow:c,motion:l=W,ghost:u=!1,linked:d=!1,onHover:f}){let p=jt(e,o),m=a().data,ee=u?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},te={sweep:e.rung===`running`&&P(e.status),slideKey:l.slides[e.runId]?.key,passed:en(l,e.runId)};return(0,E.jsxs)(`article`,{...ee,"data-flip":e.runId,"data-rung":e.rung,"data-action":p.action,"data-linked":d&&!u?`true`:void 0,...u?{}:Fn(e.runId,f),className:r(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,p.action?`border-pending/70`:te.sweep?`border-status-running/60`:`border-border`,d&&!u&&`outline-2 outline-offset-2 outline-message-peer-accent`,In(e,l,u)),children:[(0,E.jsx)(Ln,{task:e,motion:l,glow:p.action!==void 0&&!u}),(0,E.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(K,{run:e,role:`root`}),(0,E.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,E.jsx)(C,{to:q(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})})]}),(0,E.jsxs)(`div`,{className:`mt-0.5 mb-2 ml-5 flex items-center gap-2`,children:[(0,E.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11.5px] text-muted-foreground`,children:kn(e,o.now,m)}),(0,E.jsx)(On,{rate:e.rate})]}),(0,E.jsx)(An,{texts:Vt(e.runId,t,i,n)}),(0,E.jsx)(Dn,{box:p,now:o.now,dense:s,motion:te}),p.action?(0,E.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,E.jsx)(we,{asChild:!0,size:`sm`,variant:p.action===`answer`?`primary`:`outline`,className:`relative z-[1] h-8 max-md:min-h-11`,children:(0,E.jsx)(C,{to:q(e.runId),children:p.action===`answer`?`Answer`:`Open task`})})}):null,c?(0,E.jsx)(xn,{runId:e.runId,requests:t,waits:n,index:i,link:C,pathOf:q,className:`mt-2 flex flex-col gap-1`,linkClassName:Pn}):null,(0,E.jsx)(Nn,{task:e,requests:t,index:i,ctx:o,dense:s,motion:l})]})}var Bn=`inline-flex min-w-0 items-center rounded-md border px-3 py-1 text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function Vn({scope:e,projectId:t,projectName:n}){let i=e=>r(Bn,e?`border-border bg-card text-foreground shadow-xs`:`border-transparent text-muted-foreground hover:text-foreground`);return(0,E.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex max-w-full rounded-lg border border-border bg-muted/60 p-1`,children:[t===null?null:(0,E.jsx)(_e,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:i(e===`project`),children:(0,E.jsx)(`span`,{className:`max-w-40 truncate`,title:n??t,children:n??t})}),(0,E.jsx)(_e,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:i(e===`all`),children:`All projects`})]})}function Hn({now:e,updatedAt:t,stale:n}){let i=t!==void 0&&!Number.isNaN(Date.parse(t));return(0,E.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":n?`true`:void 0,title:ut(e),className:`inline-flex items-center gap-1.5 text-[13px] text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`span`,{"data-tone":`success`,className:r(`inline-flex size-[12px] items-center justify-center`,!n&&`activity-pulse`),children:(0,E.jsx)(w,{tone:n?`neutral`:`success`,"aria-hidden":`true`})}),(0,E.jsx)(`b`,{className:r(`font-semibold`,n?`text-muted-foreground`:`text-success`),children:n?`Not updating`:`Live`}),i?(0,E.jsxs)(`span`,{children:[`· updated `,dt(M(t,e))]}):null]})}function Un({name:e,now:t,updatedAt:n,stale:r=!1,scopeSwitch:i}){return{title:`Activity`,scope:e,subtitle:t===void 0?void 0:(0,E.jsx)(Hn,{now:t,updatedAt:n,stale:r}),secondaryActions:i}}function Wn({primary:e=!1}){return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(we,{variant:e?`primary`:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 py-1.5 max-md:min-h-11`,children:(0,E.jsx)(C,{to:`/new`,children:`New task`})}),(0,E.jsx)(we,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 py-1.5 max-md:min-h-11`,children:(0,E.jsx)(C,{to:`/`,children:`View tasks`})})]})}function Gn({value:e,bump:t}){return(0,E.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:r(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function J({icon:e,count:t,label:n,bump:r}){return(0,E.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,E.jsx)(Gn,{value:t,bump:r}),` `,n]})}function Kn({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,E.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,E.jsx)(J,{icon:(0,E.jsx)(w,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(w,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(w,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(w,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(S,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,E.jsx)(J,{icon:(0,E.jsx)(Ce,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,E.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,E.jsxs)(C,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground transition-colors hover:border-accent-text/40 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,E.jsx)(w,{tone:`info`,"aria-hidden":`true`}),(0,E.jsx)(Gn,{value:e.inReview,bump:r(`inReview`)}),` in review`,(0,E.jsx)(ve,{"aria-hidden":`true`,className:`size-3 text-soft-foreground`})]})})]})}function qn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function Jn(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function Yn(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(Jn(o,r).push(e),s.add(e));return o}function Xn(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var Zn=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function Qn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var $n=(e,...t)=>e.filter(e=>!t.some(t=>er(e,t))),er=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,tr=e=>Math.round(e*10)/10,Y=e=>`${tr(e.x)} ${tr(e.y)}`;function nr(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function rr(e,t=8){let n=nr(e),r=n[0];if(!r)return``;let i=`M${Y(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${Y(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${Y(c(r,a,s))} Q ${Y(r)}, ${Y(c(r,o,s))}`}return i}function ir(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function ar(e){return{rows:ir(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:ir(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var X=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),Z=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function or(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function sr(e,t,n,r=0){let i=ar(n),a=X(i.rows,e=>e.top,e.y),o=X(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?Z(i,a):Z(i,a-1))+r/2,d=(s?Z(i,o-1):Z(i,o))+r/2,f=or(i,X(i.cols,e=>e.left,e.x),X(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var cr=15;function lr(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-cr,e.y+e.h+cr])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function ur(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=lr(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),cr-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function dr(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
|
|
2
2
|
`);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function fr(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var pr=e=>Math.round(e*10)/10,Q=e=>`${pr(e.x)} ${pr(e.y)}`;function mr(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function hr(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${Q({x:o,y:i})} C ${Q({x:o+s,y:i})}, ${Q({x:o+s,y:a})}, ${Q({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function gr(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return hr(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(Qn(Zn({x:c,y:a},{x:l,y:o}),$n(n,e,t))){let i=ur({x:c,y:a},{x:l,y:o},96,$n(n,e,t),r);return{d:rr(i.points),label:i.label}}return{d:`M${Q({x:c,y:a})} C ${Q({x:c+u,y:a})}, ${Q({x:l-u,y:o})}, ${Q({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function _r(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?vr(a,n.y0+i,n.y1-i):a}var vr=(e,t,n)=>Math.max(t,Math.min(n,e));function yr(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:_r(i,n)};return{d:rr(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function br(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${Q(i)} C ${Q({x:o,y:i.y})}, ${Q({x:o,y:a.y})}, ${Q(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function xr(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(Qn(Zn({x:i,y:s},{x:a,y:c}),$n(n,e,t))){let i=sr(e,t,n,r);return{d:rr(i.points),label:i.label}}return{d:`M${Q({x:i,y:s})} C ${Q({x:i,y:s+l})}, ${Q({x:a,y:c-l})}, ${Q({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${Q({x:i,y:o})} C ${Q({x:i,y:c-l})}, ${Q({x:a,y:c-l})}, ${Q({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function Sr(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function Cr(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function wr(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function Tr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of Cr(e,t.w+r))for(let e of wr(n,t.h+r,i,a))o.set(e.id,e.at);return o}var Er=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function Dr(e,t,n){let r=e!==void 0&&Er(e,n),i=t!==void 0&&Er(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var Or=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function kr(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)Or(n)&&t.push(n);return t}function Ar(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function jr(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of kr(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=Ar(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var $={w:88,h:40};function Mr(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,Sr(i.getBoundingClientRect(),n))}return r}function Nr({base:e,from:t,to:n,fromName:r,toName:i},a,o,s){let c=a.get(t),l=a.get(n),u=s.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},d=(e,t)=>({side:mr(e,t,s.width),labelHeight:$.h,lane:o??0,view:u,...t?{other:t}:{}});switch(Dr(c,l,u)){case`both`:return c&&l?{...e,...gr(c,l,[...a.values()],o,mr(c,void 0,s.width))}:void 0;case`sender`:return c?{...e,...yr(c,`sender`,d(c,l)),away:i()}:void 0;case`recipient`:return l?{...e,...yr(l,`recipient`,d(l,c)),away:r()}:void 0;case`none`:return}}var Pr=(e,t)=>({base:{id:e.requestId,kind:`peer`},from:e.senderRunId,to:e.recipientRunId,fromName:()=>Lt(t,e),toName:()=>V(t,e)}),Fr=(e,t)=>({base:{id:e.id,kind:`wait`},from:e.peerRunId,to:e.waiterRunId,fromName:()=>B(t,e.peerRunId),toName:()=>B(t,e.waiterRunId)}),Ir=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function Lr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function Rr(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function zr(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!Er(s,a)))return{id:e.requestId,kind:`family`,...br(c,l,s,i)}}function Br(e,t,n,{peers:r,frame:i={width:e.clientWidth},waits:a=[]}){let o=Mr(e,`data-activity-card`),s=Mr(e,`data-activity-anchor`),c=dr([...t,...a.map(Ir)]),l=[];for(let e of t){let t=c.get(e.requestId),a=e.relationship===`peer`?r?Nr(Pr(e,n),o,t,i):void 0:zr(e,o,s,n,t,i.view);a&&l.push(a)}for(let e of r?a:[]){let t=Nr(Fr(e,n),o,c.get(e.id),i);t&&l.push(t)}let u=Lr(o,i.width),d=Tr(l.filter(e=>e.kind!==`family`).map(e=>({id:e.id,at:Rr(e.label,u)})),$,i.view);return l.map(e=>({...e,label:d.get(e.id)??e.label}))}function Vr(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function Hr({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var Ur=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function Wr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,Ur(r)-n);return e.reverse?1-i:i}var Gr=`http://www.w3.org/2000/svg`,Kr=[0,.03,.06,.09,.12],qr=[4.5,3.5,3,2.5,2],Jr={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function Yr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(Gr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(Gr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Jr[t.tone]} opacity-35`),r.append(i),Kr.forEach((e,n)=>{let i=document.createElementNS(Gr,`circle`);i.setAttribute(`r`,String(qr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Jr[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Xr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();Yr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(Wr(r,n,Kr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var Zr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),Qr=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function $r(e,t,n){let r=T.useRef(null),i=T.useRef(void 0),a=T.useRef(new Set);return T.useEffect(()=>{let e=r.current;if(!e)return;let t=Hr({frame:Zr,cancel:Qr,draw:(t,n)=>Xr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),T.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:U.comet}))},[e,t,n]),r}function ei(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function ti(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var ni=`activity-layout-settled`;function ri(e,t,n,r){let i=T.useRef(void 0),a=T.useRef(new Set);T.useLayoutEffect(()=>{let o=e.current;if(!o)return;if(n===void 0){i.current=void 0;return}let s=ti(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of ei(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&ii(n,a.current,o)}}),T.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function ii(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(ni))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function ai(e,t,n,r,i,a=!1){let[o,s]=T.useState([]);return T.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?oi(i,o):void 0;i.addEventListener(ni,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(ni,o),c?.()}},[e,t,n,r,i,a]),o}function oi(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[...kr(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var si=28;function ci(e){let t=e.replace(/\s+/g,` `).trim();return t.length>si?`${t.slice(0,si-1).trimEnd()}…`:t}function li(e,t){if(e.deadline!==void 0)return ui(e.createdAt,e.deadline,t)}function ui(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function di(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return r(`activity-march`,t&&`activity-line-in`)}function fi(e,t){return t in e.waitsClosing?`activity-line-out`:r(`activity-drift`,t in e.opening&&`activity-line-in`)}var pi=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`;function mi({line:e,wait:t,now:n,motion:i}){return(0,E.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:$.w},className:r(pi,`border-dashed border-message-peer-accent`,t.id in i.waitsClosing&&`activity-line-out`),children:[(0,E.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[(0,E.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Waiting`}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0`,children:A(M(t.since,n))})]}),e.away?(0,E.jsx)(`span`,{className:`block truncate`,children:e.away}):null,(0,E.jsx)(`span`,{"data-slot":`activity-wait-bar`,className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:`block h-full bg-message-peer-accent opacity-70`,style:{width:`${Math.round(ui(t.since,t.deadline,n)*100)}%`}})})]})}function hi({line:e,request:t,now:n,phase:i,replied:a}){let o=li(t,n);return(0,E.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":i,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:$.w},className:r(pi,a?`border-success`:`border-message-peer-accent`,i===`fade`&&`activity-line-out`),children:[(0,E.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[a?(0,E.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,E.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0`,children:A(M(t.createdAt,n))})]}),(0,E.jsx)(`span`,{className:`block truncate`,children:e.away??ci(t.text)}),o===void 0||a?null:(0,E.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var gi=(e,t)=>e.closing[t]?.phase??`open`;function _i(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}var vi=new Set;function yi({line:e,motion:t}){let n=gi(t,e.id);return(0,E.jsx)(`path`,{"data-request":e.id,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:r(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,di(n,e.id in t.opening))})}function bi({line:e,motion:t,active:n}){return(0,E.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":n?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:n?3.2:2.4,markerEnd:`url(#activity-ring-wait)`,className:r(`stroke-message-peer-accent`,n?`opacity-100`:`opacity-80`,fi(t,e.id))})}function xi({id:e}){return(0,E.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,E.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}var Si=[];function Ci({requests:e,waits:t=Si,active:n=vi,index:r,peers:i,layoutKey:a,now:o,motion:s=W,paused:c=!1}){let l=T.useRef(null),u=ai(l,T.useCallback(n=>Br(n,e,r,{peers:i,waits:t,frame:{width:n.clientWidth,view:jr(n)}}),[e,t,r,i]),Vr,`[data-activity-card]`,a,!0),d=T.useMemo(()=>new Set(u.map(e=>e.id)),[u]),f=$r(s.comets,d,c),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e]));return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`svg`,{ref:l,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,E.jsxs)(`defs`,{children:[(0,E.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,E.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,E.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,E.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})}),(0,E.jsx)(xi,{id:`activity-ring-wait`})]}),u.map(e=>e.kind===`wait`?(0,E.jsx)(bi,{line:e,motion:s,active:n.has(e.id)},e.id):(0,E.jsx)(yi,{line:e,motion:s},e.id)),(0,E.jsx)(`g`,{ref:f,"data-slot":`activity-comets`})]}),u.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,E.jsx)(mi,{line:e,wait:t,now:o,motion:s},e.id);let n=p.get(e.id);return e.kind===`peer`&&n?(0,E.jsx)(hi,{line:e,request:n,now:o,phase:gi(s,e.id),replied:_i(s,e.id)},e.id):null})]})}function wi(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of It(r))n.set(e,t);return n}var Ti={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function Ei(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${Ti[t??``]??`closed`}`}var Di={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},Oi=e=>e.relationship===`peer`?`peer`:`family`;function ki(e,t,n){let r=(e,n)=>B(t,e,n);switch(e.kind){case`request-opened`:return{tone:Oi(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:Ei(e.request,e.status,r)};case`rung-changed`:return{tone:p(e.task.rung).tone,text:`${e.task.title}: ${jt(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=Di[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:p(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function Ai(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function ji(e){return Math.max(0,Math.floor(e/1e3))<5?`now`:j(e)}var Mi=new Set;function Ni(e){let[t,n]=T.useState({}),r=t.pointer??t.focus,i=T.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:T.useMemo(()=>r===void 0?Mi:zt(r,e),[r,e]),active:T.useMemo(()=>r===void 0?Mi:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}var Pi=e=>new Map(e.map(e=>[e.runId,e])),Fi=e=>e!==void 0&&Ft(e)===void 0;function Ii(e,t,n,r){let i=Pi(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&P(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&P(a.status)&&!P(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Li(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var Ri=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function zi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),Ri(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),Ii(e,t,n,r),Li(e,t,n,r)}function Bi(e,t,n){let r=Pi(e.tasks),i=Pi(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?zi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function Vi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function Hi(e,t,n){let r=H(e.tasks),i=H(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var Ui=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function Wi(e,t,n){let r=Xt(e),i=Xt(t);for(let e of Ui)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function Gi(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!Fi(t)||!Fi(e)||(Bi(t,e,r),Vi(t,e,r),Hi(t,e,r))}return Wi(e.projects,t.projects,r),n}function Ki(e){return{input:e,reconcile:!1,seq:0,motion:W,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function qi(e){let{plan:t,...n}=e;return{...n,motion:W,epoch:e.epoch+1}}function Ji(e,t,n){let r=Gi(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=wi(t,n),o=r.flatMap(e=>ki(e,a,i)??[]),s=e.seq+o.length+1,c=cn(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?Ai(e.feed,o,i,e.seq+1):e.feed,motion:un(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function Yi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:Ji(r,n,t)}function Xi(e,t){let n=e.input;if(t.scope!==n.scope)return{...Ki(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...qi(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=qi(r)),Yi(r,t.snapshot)}var Zi=`(prefers-reduced-motion: reduce)`,Qi=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(Zi):void 0;function $i(e){let t=Qi();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function ea(){return Qi()?.matches??!1}function ta(){return(0,T.useSyncExternalStore)($i,ea,()=>!1)}function na(e,t){let n=T.useRef(new Set);T.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),T.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:un(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function ra(e,t){let n=ta(),r=ie(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=T.useState(()=>Ki(i)),s=Xi(a,i);return s!==a&&o(s),na(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function ia(e,t){let n=Te(1e3),[r,i]=T.useState({offset:0}),a=r.offset;return et(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{M as $,Fn as A,B,Wn as C,zn as D,Un as E,pn as F,It as G,Ft as H,W as I,P as J,Lt as K,dn as L,xn as M,K as N,Ln as O,hn as P,ut as Q,Gt as R,Xn as S,Kn as T,V as U,H as V,Ut as W,N as X,jt as Y,A as Z,Sr as _,Ci as a,qn as b,gi as c,li as d,j as et,ai as f,xr as g,Ir as h,ji as i,On as j,An as k,_i as l,$r as m,ra as n,xi as o,ri as p,Xt as q,Ni as r,di as s,ia as t,at as tt,fi as u,dr as v,Vn as w,Yn as x,fr as y,Vt as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{t as a}from"./arrow-right-Dh_Lx3um.js";import{$ as o,B as s,C as c,D as l,E as u,G as d,H as f,I as p,K as m,L as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Z as T,a as E,b as ee,d as D,i as O,j as k,n as A,p as j,q as M,r as N,t as P,tt as F,w as I,x as L}from"./activity-motion-2BQBW4lA.js";import{t as R}from"./chevron-down-CHGyCDBH.js";import{t as z}from"./info-DA1x_4bz.js";import{t as B}from"./button-B7MKxYjT.js";import{s as te}from"./project-router-CLJTc7gv.js";import{t as V}from"./status-dot-BRzVlF2X.js";import{d as H,i as U,n as W,t as G}from"./page-shell-7pLJMOgh.js";import{st as K}from"./index-CvVmG4Yu.js";var q=e(t(),1),J=n(),Y=`rounded-xl border border-border bg-card px-3.5 py-3`,X=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function Z({request:e,index:t,now:n,motion:r}){let{kind:s,relation:c}=v(e,t),l=D(e,n),u=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,J.jsxs)(`li`,{"data-slot":r===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":r===`fold`||void 0,className:i(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,r===`enter`&&`activity-row-enter`,r===`fold`&&`activity-row-fold`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:m(t,e)}),(0,J.jsx)(a,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:x(t,e)}),(0,J.jsx)(`span`,{className:i(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,u),children:s})]}),(0,J.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,J.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,J.jsxs)(`span`,{children:[c,` · open `,T(o(e.createdAt,n))]}),e.deadline?(0,J.jsx)(`span`,{className:`ml-auto`,children:C(e.deadline,n)}):null]}),l===void 0?null:(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,J.jsx)(`span`,{className:i(`block h-full bg-current`,u),style:{width:`${Math.round(l*100)}%`}})})]})}function Q({className:e}){return(0,J.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,J.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function ne(){return(0,J.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,J.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,J.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]})}function re(){let e=`flex items-center gap-2`;return(0,J.jsxs)(`details`,{"data-slot":`activity-legend`,className:`text-[11.5px] text-muted-foreground md:col-span-2`,children:[(0,J.jsxs)(`summary`,{className:`group inline-flex cursor-pointer list-none items-center gap-1.5 rounded-full border border-border bg-card px-2.5 py-1 font-medium text-foreground shadow-xs hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 [&::-webkit-details-marker]:hidden`,children:[(0,J.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),`Legend`,(0,J.jsx)(R,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-5 gap-y-1.5`,children:[(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(V,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(V,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(V,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(k,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(Q,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(ne,{}),`Waits for a peer to write`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(Q,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,J.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})]})}var ie={...g,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function ae({feed:e,now:t,watchingSince:n}){return(0,J.jsxs)(`section`,{"data-slot":`activity-just-now`,className:Y,children:[(0,J.jsx)(`h2`,{className:X,children:`Just now`}),e.length>0?(0,J.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,J.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:i(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:i(`size-[7px] -translate-y-px rounded-full`,ie[e.tone])}),(0,J.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,J.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:O(t-e.at)})]},e.id))}):null,(0,J.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,(0,J.jsx)(`span`,{title:_(n),children:w(n)})]})]})}function oe({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=p,columnGap:s}){return(0,J.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,style:s===void 0?void 0:{columnGap:s},className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start items-start gap-4 md:grid-cols-2`,children:[(0,J.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:Y,children:[(0,J.jsxs)(`h2`,{className:X,children:[`Open requests `,(0,J.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,J.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,J.jsxs)(`ul`,{children:[e.map(e=>(0,J.jsx)(Z,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,J.jsx)(Z,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,J.jsx)(ae,{feed:a,now:r,watchingSince:i}),(0,J.jsx)(re,{})]})}function $(e){let[t,n]=q.useState(0);return q.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function se(e,t,n){let[r,i]=q.useState(void 0),a=L(r,e,t,n);return y(r,a)||i(a),a}function ce(e,t,n=S(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:h(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function le({project:e,now:t,watchingSince:n,motion:r=p,feed:a,still:o=!1,paused:u=!1}){let f=q.useRef(null),m=$(f),h=q.useMemo(()=>d(e),[e]),g=q.useMemo(()=>S(e.tasks),[e.tasks]),_=q.useMemo(()=>ce(e,r,g),[e,r,g]),v=q.useMemo(()=>[...e.requests,..._.requests],[e.requests,_.requests]),y=q.useMemo(()=>[...g,..._.waits],[g,_.waits]),b=N(g),x=new Map([..._.cards,...e.tasks].map(e=>[e.runId,e])),C=new Set(_.cards.map(e=>e.runId)),w=ee(m),T=Math.min(w,Math.max(1,x.size)),D=e=>1+.35*(x.get(e)?.workers.length??0),O=se([...x.keys()],T,D),k=w===1,A=T>1&&O.every(e=>e.length<=1),M=e.tasks.length>12,P={now:t,titleOf:e=>s(h,e)},F=O.map(e=>e.join(`,`)).join(`|`),I=k?0:v.length+y.length>0?96:16,L=`${e.tasks.length}:${T}:${M}:${F}:${v.map(e=>e.requestId).join(`,`)}:${y.map(e=>e.id).join(`,`)}`;return j(f,`data-flip`,m>0?F:void 0,!o&&!u),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[e.tasks.length===0?(0,J.jsx)(G,{slot:`activity-empty`,title:`No active work in this project.`,description:`Start a new task to watch live agents, workers, and peer requests appear on this board.`,actions:(0,J.jsx)(c,{primary:!0})}):null,(0,J.jsxs)(`div`,{ref:f,"data-slot":`activity-graph`,"data-columns":T,"data-dense":M?`true`:void 0,"data-one-row":A?`true`:void 0,className:i(`relative grid`,A?`items-stretch`:`items-start`),style:{gridTemplateColumns:`repeat(${T}, minmax(0, 1fr))`,columnGap:I},children:[O.map((t,n)=>(0,J.jsx)(`div`,{"data-slot":`activity-column`,className:i(`grid min-w-0 grid-cols-[minmax(0,1fr)] gap-[30px] max-md:gap-4`,A?`content-stretch`:`content-start`),children:t.map(t=>{let n=x.get(t);return n?(0,J.jsx)(l,{task:n,requests:e.requests,waits:g,index:h,ctx:P,dense:M,narrow:k,motion:r,ghost:C.has(t),linked:b.linked.has(t),onHover:b.onHover},t):null})},n)),(0,J.jsx)(E,{requests:v,waits:y,active:b.active,index:h,peers:!k,layoutKey:L,now:t,motion:r,paused:u||o})]})]}),(0,J.jsx)(oe,{columnGap:T===2?I:void 0,requests:e.requests,closing:_.folding,index:h,now:t,watchingSince:n,feed:a,motion:r})]})}function ue(){let e=r(),t=F({kind:`project`,projectId:e}),n=te(),[i]=q.useState(()=>new Date().toISOString()),a=P(t.data?.generatedAt,t.dataUpdatedAt),{motion:o,feed:s,reduced:l,paused:d}=A(t.data,e),p=t.data?.projects[0];if(t.isPending)return(0,J.jsx)(K,{});let m=p?f(p):void 0;return p?(0,J.jsxs)(U,{route:`activity`,density:H(p.tasks.length),headerSpacing:`compact`,rootProps:{"data-activity-paused":d?`true`:void 0},bodyClassName:`gap-3.5`,header:u({name:p.name,now:a,updatedAt:t.data?.generatedAt,stale:t.isError,scopeSwitch:(0,J.jsx)(I,{scope:`project`,projectId:n??p.projectId,projectName:p.name})}),sparseFooter:!m&&p.tasks.length>0?(0,J.jsx)(W,{summary:`${p.tasks.length} active ${p.tasks.length===1?`task`:`tasks`} running in ${p.name}. Start more work in parallel or inspect all tasks.`,actions:(0,J.jsx)(c,{})}):void 0,children:[(0,J.jsx)(b,{summary:M([p]),tasksTo:`/`,bumps:o.bumps}),m?(0,J.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:m}):(0,J.jsx)(le,{project:p,now:a,watchingSince:i,motion:o,feed:s,still:l,paused:d})]}):(0,J.jsx)(U,{route:`activity`,density:`empty`,header:u({name:n??`project`,scopeSwitch:(0,J.jsx)(I,{scope:`project`,projectId:n})}),children:(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,J.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})})}export{ue as ProjectActivityRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{t as a}from"./arrow-right-Dh_Lx3um.js";import{$ as o,B as s,C as c,D as l,E as u,G as d,H as f,I as p,K as m,L as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Z as T,a as E,b as ee,d as D,i as O,j as k,n as A,p as j,q as M,r as N,t as P,tt as F,w as I,x as L}from"./activity-motion-B7km8QVK.js";import{t as R}from"./chevron-down-CHGyCDBH.js";import{t as z}from"./info-DA1x_4bz.js";import{t as B}from"./button-B7MKxYjT.js";import{s as te}from"./project-router-CLJTc7gv.js";import{t as V}from"./status-dot-BRzVlF2X.js";import{d as H,i as U,n as W,t as G}from"./page-shell-7pLJMOgh.js";import{st as K}from"./index-DNQcTHxV.js";var q=e(t(),1),J=n(),Y=`rounded-xl border border-border bg-card px-3.5 py-3`,X=`mb-2 flex gap-2 text-[11.5px] font-semibold tracking-[0.06em] text-muted-foreground uppercase`;function Z({request:e,index:t,now:n,motion:r}){let{kind:s,relation:c}=v(e,t),l=D(e,n),u=e.relationship===`peer`?`text-message-peer-accent`:`text-message-inbound-accent`;return(0,J.jsxs)(`li`,{"data-slot":r===`fold`?`activity-request-closing`:`activity-request`,"data-request":e.requestId,"aria-hidden":r===`fold`||void 0,className:i(`border-t border-border py-2.5 first:border-t-0 first:pt-0`,r===`enter`&&`activity-row-enter`,r===`fold`&&`activity-row-fold`),children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[12px] font-medium`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:m(t,e)}),(0,J.jsx)(a,{"aria-label":`to`,className:`size-3 shrink-0 text-muted-foreground`}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:x(t,e)}),(0,J.jsx)(`span`,{className:i(`ml-auto shrink-0 text-[10px] font-semibold tracking-[0.05em] uppercase`,u),children:s})]}),(0,J.jsxs)(`p`,{className:`my-1 line-clamp-3 text-[12px] text-muted-foreground`,children:[`“`,e.text,`”`]}),(0,J.jsxs)(`div`,{className:`flex gap-1.5 text-[11px] text-muted-foreground tabular-nums`,children:[(0,J.jsxs)(`span`,{children:[c,` · open `,T(o(e.createdAt,n))]}),e.deadline?(0,J.jsx)(`span`,{className:`ml-auto`,children:C(e.deadline,n)}):null]}),l===void 0?null:(0,J.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1.5 h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,J.jsx)(`span`,{className:i(`block h-full bg-current`,u),style:{width:`${Math.round(l*100)}%`}})})]})}function Q({className:e}){return(0,J.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,J.jsx)(`path`,{d:`M2 5h30`,strokeWidth:2,strokeDasharray:`6 5`,className:e})})}function ne(){return(0,J.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:[(0,J.jsx)(`path`,{d:`M2 5h24`,strokeWidth:2.2,strokeLinecap:`round`,strokeDasharray:`0 6`,className:`stroke-message-peer-accent opacity-80`}),(0,J.jsx)(`circle`,{cx:`29.5`,cy:`5`,r:`3`,strokeWidth:1.6,className:`fill-card stroke-message-peer-accent`})]})}function re(){let e=`flex items-center gap-2`;return(0,J.jsxs)(`details`,{"data-slot":`activity-legend`,className:`text-[11.5px] text-muted-foreground md:col-span-2`,children:[(0,J.jsxs)(`summary`,{className:`group inline-flex cursor-pointer list-none items-center gap-1.5 rounded-full border border-border bg-card px-2.5 py-1 font-medium text-foreground shadow-xs hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 [&::-webkit-details-marker]:hidden`,children:[(0,J.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),`Legend`,(0,J.jsx)(R,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-5 gap-y-1.5`,children:[(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(V,{tone:`running`,"aria-hidden":`true`}),`Filled: working now`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(V,{tone:`info`,shape:`ring`,"aria-hidden":`true`}),`Ring: waiting for something outside`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(V,{tone:`running`,shape:`workers`,"aria-hidden":`true`}),`Robot: waiting for its own workers`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(k,{rate:[0,2,5,1,3,0,4,2],className:`w-[34px]`}),`Heartbeat: tool calls, last 30 s`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(Q,{className:`stroke-message-peer-accent`}),`Open request, task to task`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(ne,{}),`Waits for a peer to write`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(Q,{className:`stroke-message-inbound-accent`}),`Open question, worker to parent`]}),(0,J.jsxs)(`div`,{className:e,children:[(0,J.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 34 10`,className:`h-2.5 w-[34px] shrink-0`,children:(0,J.jsx)(`circle`,{cx:`17`,cy:`5`,r:`4`,className:`fill-foreground`})}),`Comet: a message is travelling`]})]})]})}var ie={...g,peer:`bg-message-peer-accent`,family:`bg-message-inbound-accent`};function ae({feed:e,now:t,watchingSince:n}){return(0,J.jsxs)(`section`,{"data-slot":`activity-just-now`,className:Y,children:[(0,J.jsx)(`h2`,{className:X,children:`Just now`}),e.length>0?(0,J.jsx)(`ul`,{"data-slot":`activity-feed`,children:e.map((e,n)=>(0,J.jsxs)(`li`,{"data-slot":`activity-feed-entry`,className:i(`grid grid-cols-[10px_minmax(0,1fr)_auto] items-baseline gap-2 py-1 text-[12px] text-muted-foreground`,n===0&&`activity-feed-enter`),children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:i(`size-[7px] -translate-y-px rounded-full`,ie[e.tone])}),(0,J.jsx)(`span`,{className:`min-w-0`,children:e.text}),(0,J.jsx)(`span`,{"data-slot":`activity-feed-age`,className:`text-[11px] tabular-nums`,children:O(t-e.at)})]},e.id))}):null,(0,J.jsxs)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:[`Watching since `,(0,J.jsx)(`span`,{title:_(n),children:w(n)})]})]})}function oe({requests:e,closing:t=[],index:n,now:r,watchingSince:i,feed:a=[],motion:o=p,columnGap:s}){return(0,J.jsxs)(`aside`,{"data-slot":`activity-rail`,"aria-label":`Activity details`,style:s===void 0?void 0:{columnGap:s},className:`grid min-w-0 grid-cols-[minmax(0,1fr)] content-start items-start gap-4 md:grid-cols-2`,children:[(0,J.jsxs)(`section`,{"data-slot":`activity-open-requests`,className:Y,children:[(0,J.jsxs)(`h2`,{className:X,children:[`Open requests `,(0,J.jsx)(`b`,{className:`text-foreground`,children:e.length})]}),e.length===0&&t.length===0?(0,J.jsx)(`p`,{className:`py-1.5 text-[12px] text-muted-foreground`,children:`No task waits for a reply.`}):(0,J.jsxs)(`ul`,{children:[e.map(e=>(0,J.jsx)(Z,{request:e,index:n,now:r,motion:e.requestId in o.opening?`enter`:void 0},e.requestId)),t.map(e=>(0,J.jsx)(Z,{request:e,index:n,now:r,motion:`fold`},e.requestId))]})]}),(0,J.jsx)(ae,{feed:a,now:r,watchingSince:i}),(0,J.jsx)(re,{})]})}function $(e){let[t,n]=q.useState(0);return q.useLayoutEffect(()=>{let t=e.current;if(!t)return;let r=()=>n(t.clientWidth);if(r(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),t}function se(e,t,n){let[r,i]=q.useState(void 0),a=L(r,e,t,n);return y(r,a)||i(a),a}function ce(e,t,n=S(e.tasks)){let r=new Set(e.tasks.map(e=>e.runId)),i=new Set(e.requests.map(e=>e.requestId)),a=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!i.has(t.request.requestId));return{cards:Object.values(t.leaving).filter(t=>t.projectId===e.projectId&&!r.has(t.task.runId)).map(e=>e.task),requests:a.map(e=>e.request),waits:h(e.projectId,n,t),folding:a.filter(e=>e.phase===`reply`||!e.replied).map(e=>e.request)}}function le({project:e,now:t,watchingSince:n,motion:r=p,feed:a,still:o=!1,paused:u=!1}){let f=q.useRef(null),m=$(f),h=q.useMemo(()=>d(e),[e]),g=q.useMemo(()=>S(e.tasks),[e.tasks]),_=q.useMemo(()=>ce(e,r,g),[e,r,g]),v=q.useMemo(()=>[...e.requests,..._.requests],[e.requests,_.requests]),y=q.useMemo(()=>[...g,..._.waits],[g,_.waits]),b=N(g),x=new Map([..._.cards,...e.tasks].map(e=>[e.runId,e])),C=new Set(_.cards.map(e=>e.runId)),w=ee(m),T=Math.min(w,Math.max(1,x.size)),D=e=>1+.35*(x.get(e)?.workers.length??0),O=se([...x.keys()],T,D),k=w===1,A=T>1&&O.every(e=>e.length<=1),M=e.tasks.length>12,P={now:t,titleOf:e=>s(h,e)},F=O.map(e=>e.join(`,`)).join(`|`),I=k?0:v.length+y.length>0?96:16,L=`${e.tasks.length}:${T}:${M}:${F}:${v.map(e=>e.requestId).join(`,`)}:${y.map(e=>e.id).join(`,`)}`;return j(f,`data-flip`,m>0?F:void 0,!o&&!u),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[e.tasks.length===0?(0,J.jsx)(G,{slot:`activity-empty`,title:`No active work in this project.`,description:`Start a new task to watch live agents, workers, and peer requests appear on this board.`,actions:(0,J.jsx)(c,{primary:!0})}):null,(0,J.jsxs)(`div`,{ref:f,"data-slot":`activity-graph`,"data-columns":T,"data-dense":M?`true`:void 0,"data-one-row":A?`true`:void 0,className:i(`relative grid`,A?`items-stretch`:`items-start`),style:{gridTemplateColumns:`repeat(${T}, minmax(0, 1fr))`,columnGap:I},children:[O.map((t,n)=>(0,J.jsx)(`div`,{"data-slot":`activity-column`,className:i(`grid min-w-0 grid-cols-[minmax(0,1fr)] gap-[30px] max-md:gap-4`,A?`content-stretch`:`content-start`),children:t.map(t=>{let n=x.get(t);return n?(0,J.jsx)(l,{task:n,requests:e.requests,waits:g,index:h,ctx:P,dense:M,narrow:k,motion:r,ghost:C.has(t),linked:b.linked.has(t),onHover:b.onHover},t):null})},n)),(0,J.jsx)(E,{requests:v,waits:y,active:b.active,index:h,peers:!k,layoutKey:L,now:t,motion:r,paused:u||o})]})]}),(0,J.jsx)(oe,{columnGap:T===2?I:void 0,requests:e.requests,closing:_.folding,index:h,now:t,watchingSince:n,feed:a,motion:r})]})}function ue(){let e=r(),t=F({kind:`project`,projectId:e}),n=te(),[i]=q.useState(()=>new Date().toISOString()),a=P(t.data?.generatedAt,t.dataUpdatedAt),{motion:o,feed:s,reduced:l,paused:d}=A(t.data,e),p=t.data?.projects[0];if(t.isPending)return(0,J.jsx)(K,{});let m=p?f(p):void 0;return p?(0,J.jsxs)(U,{route:`activity`,density:H(p.tasks.length),headerSpacing:`compact`,rootProps:{"data-activity-paused":d?`true`:void 0},bodyClassName:`gap-3.5`,header:u({name:p.name,now:a,updatedAt:t.data?.generatedAt,stale:t.isError,scopeSwitch:(0,J.jsx)(I,{scope:`project`,projectId:n??p.projectId,projectName:p.name})}),sparseFooter:!m&&p.tasks.length>0?(0,J.jsx)(W,{summary:`${p.tasks.length} active ${p.tasks.length===1?`task`:`tasks`} running in ${p.name}. Start more work in parallel or inspect all tasks.`,actions:(0,J.jsx)(c,{})}):void 0,children:[(0,J.jsx)(b,{summary:M([p]),tasksTo:`/`,bumps:o.bumps}),m?(0,J.jsx)(`p`,{"data-slot":`activity-project-notice`,role:`status`,className:`rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:m}):(0,J.jsx)(le,{project:p,now:a,watchingSince:i,motion:o,feed:s,still:l,paused:d})]}):(0,J.jsx)(U,{route:`activity`,density:`empty`,header:u({name:n??`project`,scopeSwitch:(0,J.jsx)(I,{scope:`project`,projectId:n})}),children:(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:[t.error?`Could not load activity: ${t.error.message}`:`This project has no activity snapshot.`,(0,J.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void t.refetch(),className:`max-md:min-h-11`,children:`Retry`})]})})}export{ue as ProjectActivityRoute};
|
package/web/dist/assets/{agent-config-section-D6Lcc7c5.js → agent-config-section-DQ1RaVK2.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{c as i,m as a,u as o}from"./live-reads-Crd6fVGH.js";import{Nn as s,pi as c}from"./project-scope-context-Rv6S_BXt.js";import{n as l}from"./toaster-BXnLIU3z.js";import{Bt as u,g as d,h as f,vt as p,x as m}from"./queries-qCF-eOqZ.js";import{t as h}from"./button-B7MKxYjT.js";import{t as g}from"./badge-DQ3U69Ht.js";import{t as _}from"./centered-state-V15AR_qo.js";import{A as v,gn as y,tr as b}from"./index-CvVmG4Yu.js";import{n as x,r as S,t as C}from"./remote-settings-notice-D7G8cXSx.js";import{t as w}from"./code-editor-B4baSOhz.js";var T=e(t(),1);function E(e){return t=>t.runners.includes(e)}function D(e,t){let n=E(e);return t===`mcp`?e=>n(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>n(e)&&e.kind===t}function O(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:D(e.id,t)}))}}function k(e){return i(e).map(O)}var A=n();function j(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function M(){let e=f(),t=S(),n=p(),r=a(),i=r.data,s=(0,T.useMemo)(()=>k(i),[i]),c=(0,T.useMemo)(()=>n.data?v(n.data.checks,i):o(i),[n.data,i]);return r.isError?(0,A.jsx)(_,{icon:(0,A.jsx)(b,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,A.jsx)(_,{icon:(0,A.jsx)(b,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||i===void 0?(0,A.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,A.jsx)(N,{listing:e.data,descriptors:s,installed:c,onOpenFile:t})}function N({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,T.useState)(`claude`),[s,c]=(0,T.useState)(null),l=t.find(e=>e.id===a)??t[0];if(l===void 0)return null;let u=P(l,e),d=u.find(e=>e.id===s)??F(u),f=e=>{o(e),c(null)};return(0,A.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,A.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,A.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,A.jsx)(`code`,{children:C}),`.`]}),(0,A.jsx)(x,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,A.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,A.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===l.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===l.id,onClick:()=>f(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===l.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,A.jsx)(g,{variant:`outline`,className:`text-[12px] text-soft-foreground`,children:`not installed`})]},e.id))}),l.note&&(0,A.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:l.note}),(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,A.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,A.jsx)(R,{agent:l,listing:e,selectedId:d?.id??null,onSelect:e=>{c(e),i()}})}),(0,A.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:d?(0,A.jsx)(B,{file:d},d.id):(0,A.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]})]})}function P(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function F(e){return e.find(e=>e.scope===`project`)??e[0]??null}var I={project:`Project scope`,local:`Local scope`,user:`User scope`};function L(e,t){for(let n of t){if(!n.label.startsWith(`~/`))continue;let t=n.label.slice(1);if(!n.path.endsWith(t))continue;let r=n.path.slice(0,n.path.length-t.length);if(r&&(e===r||e.startsWith(`${r}/`)))return`~${e.slice(r.length)}`}return e.replace(/^\/(?:home|Users)\/[^/]+(?=\/|$)/,`~`)}function R({agent:e,listing:t,selectedId:n,onSelect:i}){return(0,A.jsx)(A.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,A.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,A.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,A.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.note}),o.length===0&&a.empty&&(0,A.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:a.empty}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),title:e.label,className:r(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,A.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,A.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,A.jsx)(g,{variant:`outline`,className:`text-[11px]`,children:`Default template`}),!e.exists&&(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),s&&(0,A.jsx)(z,{userMcp:s,path:L(s.path,t.files)})]},a.id)})})}function z({userMcp:e,path:t}){return(0,A.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,A.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,A.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,A.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,A.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground/80`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,A.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsx)(g,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function B({file:e}){let t=d(e.id),[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(!1),[o,s]=(0,T.useState)(null),c=t.data?.version??null,l=n??t.data?.content??``,u=t.data?l!==t.data.content:!1,f=e.writable,p=e.kind===`mcp`||e.holdsMcp;y(f&&u);let{save:m,isSaving:h}=K({file:e,content:l,loadedVersion:c,setDraft:r,setConflict:a,setFormatError:s});return(0,T.useEffect)(()=>{t.data&&(r(t.data.content),a(!1),s(null))},[t.data?.version,t.data]),(0,A.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,A.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:I[e.scope]})]}),(0,A.jsx)(`p`,{"data-slot":`agent-config-path`,title:e.path,className:`font-mono text-xs text-foreground/80`,children:L(e.path,[e])}),(0,A.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,A.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,A.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,A.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,A.jsx)(`h3`,{children:p?`MCP configuration`:`File contents`}),p&&(0,A.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),t.isPending?(0,A.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,A.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,A.jsx)(V,{file:e,content:l,isMcp:p,onChange:r}),(0,A.jsx)(W,{formatError:o,conflict:i,onReload:()=>void t.refetch()}),f&&(0,A.jsx)(H,{exists:e.exists,dirty:u,isSaving:h,onSave:m,onReset:()=>r(null)}),(0,A.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,A.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,A.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground/80`,children:[j(e),e.hotReload?` ${e.hotReload}`:``]}),(0,A.jsx)(G,{reason:e.readOnlyReason})]})]})}function V({file:e,content:t,isMcp:n,onChange:r}){return(0,A.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,A.jsx)(w,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,A.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-muted-foreground/80`,children:U(e,n)})]})}function H({exists:e,dirty:t,isSaving:n,onSave:r,onReset:i}){return(0,A.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,A.jsx)(h,{size:`sm`,onClick:r,disabled:!t||n,children:e?`Save file`:`Create file`}),(0,A.jsx)(h,{size:`sm`,variant:`outline`,onClick:i,disabled:!t||n,children:`Reset`}),!n&&(0,A.jsx)(`span`,{"data-slot":`agent-config-save-cue`,className:`self-center text-xs text-muted-foreground`,children:t?`Unsaved changes`:e?`No unsaved changes`:`Enter content above to create this file`})]})}function U(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{c as i,m as a,u as o}from"./live-reads-Crd6fVGH.js";import{Nn as s,pi as c}from"./project-scope-context-Rv6S_BXt.js";import{n as l}from"./toaster-BXnLIU3z.js";import{Bt as u,g as d,h as f,vt as p,x as m}from"./queries-qCF-eOqZ.js";import{t as h}from"./button-B7MKxYjT.js";import{t as g}from"./badge-DQ3U69Ht.js";import{t as _}from"./centered-state-V15AR_qo.js";import{A as v,gn as y,tr as b}from"./index-DNQcTHxV.js";import{n as x,r as S,t as C}from"./remote-settings-notice-COojb6XK.js";import{t as w}from"./code-editor-B4baSOhz.js";var T=e(t(),1);function E(e){return t=>t.runners.includes(e)}function D(e,t){let n=E(e);return t===`mcp`?e=>n(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>n(e)&&e.kind===t}function O(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:D(e.id,t)}))}}function k(e){return i(e).map(O)}var A=n();function j(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function M(){let e=f(),t=S(),n=p(),r=a(),i=r.data,s=(0,T.useMemo)(()=>k(i),[i]),c=(0,T.useMemo)(()=>n.data?v(n.data.checks,i):o(i),[n.data,i]);return r.isError?(0,A.jsx)(_,{icon:(0,A.jsx)(b,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,A.jsx)(_,{icon:(0,A.jsx)(b,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||i===void 0?(0,A.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,A.jsx)(N,{listing:e.data,descriptors:s,installed:c,onOpenFile:t})}function N({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,T.useState)(`claude`),[s,c]=(0,T.useState)(null),l=t.find(e=>e.id===a)??t[0];if(l===void 0)return null;let u=P(l,e),d=u.find(e=>e.id===s)??F(u),f=e=>{o(e),c(null)};return(0,A.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,A.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,A.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,A.jsx)(`code`,{children:C}),`.`]}),(0,A.jsx)(x,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,A.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,A.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===l.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===l.id,onClick:()=>f(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===l.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,A.jsx)(g,{variant:`outline`,className:`text-[12px] text-soft-foreground`,children:`not installed`})]},e.id))}),l.note&&(0,A.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:l.note}),(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,A.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,A.jsx)(R,{agent:l,listing:e,selectedId:d?.id??null,onSelect:e=>{c(e),i()}})}),(0,A.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:d?(0,A.jsx)(B,{file:d},d.id):(0,A.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]})]})}function P(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function F(e){return e.find(e=>e.scope===`project`)??e[0]??null}var I={project:`Project scope`,local:`Local scope`,user:`User scope`};function L(e,t){for(let n of t){if(!n.label.startsWith(`~/`))continue;let t=n.label.slice(1);if(!n.path.endsWith(t))continue;let r=n.path.slice(0,n.path.length-t.length);if(r&&(e===r||e.startsWith(`${r}/`)))return`~${e.slice(r.length)}`}return e.replace(/^\/(?:home|Users)\/[^/]+(?=\/|$)/,`~`)}function R({agent:e,listing:t,selectedId:n,onSelect:i}){return(0,A.jsx)(A.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,A.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,A.jsx)(`p`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,A.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.note}),o.length===0&&a.empty&&(0,A.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:a.empty}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),title:e.label,className:r(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,A.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,A.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,A.jsx)(g,{variant:`outline`,className:`text-[11px]`,children:`Default template`}),!e.exists&&(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),s&&(0,A.jsx)(z,{userMcp:s,path:L(s.path,t.files)})]},a.id)})})}function z({userMcp:e,path:t}){return(0,A.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,A.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,A.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,A.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,A.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground/80`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,A.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsx)(g,{variant:`outline`,className:`font-mono text-[11px]`,children:e})},e))}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function B({file:e}){let t=d(e.id),[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(!1),[o,s]=(0,T.useState)(null),c=t.data?.version??null,l=n??t.data?.content??``,u=t.data?l!==t.data.content:!1,f=e.writable,p=e.kind===`mcp`||e.holdsMcp;y(f&&u);let{save:m,isSaving:h}=K({file:e,content:l,loadedVersion:c,setDraft:r,setConflict:a,setFormatError:s});return(0,T.useEffect)(()=>{t.data&&(r(t.data.content),a(!1),s(null))},[t.data?.version,t.data]),(0,A.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,A.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:I[e.scope]})]}),(0,A.jsx)(`p`,{"data-slot":`agent-config-path`,title:e.path,className:`font-mono text-xs text-foreground/80`,children:L(e.path,[e])}),(0,A.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,A.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,A.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,A.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,A.jsx)(`h3`,{children:p?`MCP configuration`:`File contents`}),p&&(0,A.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),t.isPending?(0,A.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,A.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,A.jsx)(V,{file:e,content:l,isMcp:p,onChange:r}),(0,A.jsx)(W,{formatError:o,conflict:i,onReload:()=>void t.refetch()}),f&&(0,A.jsx)(H,{exists:e.exists,dirty:u,isSaving:h,onSave:m,onReset:()=>r(null)}),(0,A.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,A.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,A.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground/80`,children:[j(e),e.hotReload?` ${e.hotReload}`:``]}),(0,A.jsx)(G,{reason:e.readOnlyReason})]})]})}function V({file:e,content:t,isMcp:n,onChange:r}){return(0,A.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,A.jsx)(w,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,A.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-muted-foreground/80`,children:U(e,n)})]})}function H({exists:e,dirty:t,isSaving:n,onSave:r,onReset:i}){return(0,A.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,A.jsx)(h,{size:`sm`,onClick:r,disabled:!t||n,children:e?`Save file`:`Create file`}),(0,A.jsx)(h,{size:`sm`,variant:`outline`,onClick:i,disabled:!t||n,children:`Reset`}),!n&&(0,A.jsx)(`span`,{"data-slot":`agent-config-save-cue`,className:`self-center text-xs text-muted-foreground`,children:t?`Unsaved changes`:e?`No unsaved changes`:`Enter content above to create this file`})]})}function U(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
|
|
2
2
|
"mcpServers": {}
|
|
3
3
|
}`:`{
|
|
4
4
|
"permissions": {}
|
package/web/dist/assets/{agent-defaults-section-BnDBbzuG.js → agent-defaults-section-Dzm7jIza.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,m as i,s as a,u as o}from"./live-reads-Crd6fVGH.js";import{Cr as s,Kt as c,M as l,Nn as u,pi as d,pn as f,r as p}from"./project-scope-context-Rv6S_BXt.js";import{n as m}from"./toaster-BXnLIU3z.js";import{At as h,Bt as g,C as _,Kt as v,Qt as y,St as b,Vt as x,_ as S,kt as C,qt as w,ut as T,wt as E,xt as D}from"./queries-qCF-eOqZ.js";import{s as O}from"./design-icons-CzEoMH9c.js";import{t as k}from"./button-B7MKxYjT.js";import{r as A}from"./switch-SP8pw5uU.js";import{t as j}from"./status-dot-BRzVlF2X.js";import{t as M}from"./centered-state-V15AR_qo.js";import{N,gn as P,j as ee,yn as te}from"./index-CvVmG4Yu.js";import{t as ne}from"./textarea-vJt9undk.js";import{t as F}from"./settings-select-CCIMGnyA.js";import{a as I,i as L,n as R,r as z,t as B}from"./settings-agent-picker-DMIqQhkC.js";import{n as V}from"./saved-draft-BwzBc-_Y.js";import{t as H}from"./save-cue-Cd3ZAPBS.js";var U=e(t(),1),W=n(),G={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function K(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function q(e,t){return e?G[e]:t?{label:`Checking…`,tone:`neutral`}:G.unknown}function J(e,t){return e===`unknown`||t&&!e}function Y({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,W.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,W.jsx)(`code`,{children:e.loginCommand}),`.`]}):J(t,r)?(0,W.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,W.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function X({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,W.jsx)(A,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,W.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>m(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,W.jsx)(R,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,W.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,W.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>m(`${e.displayName} can be tried again.`),onError:e=>m(e.message,{tone:`danger`})}),children:`Try again`})]})}function re({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,W.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,W.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,W.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ie(){let e=i(),t=b(),n=E(),o=C(),l=d(),[p,h]=(0,U.useState)(null),g=(0,U.useRef)(Promise.resolve()),_=(0,U.useRef)({}),S=(0,U.useRef)({}),w=(0,U.useRef)(t.data);(0,U.useEffect)(()=>{p&&s(t.data,p.provider)?.status===`connected`&&h(null)},[p,t.data]),(0,U.useEffect)(()=>{if(t.data){if(Object.values(S.current).every(e=>e===0)||!w.current){w.current=t.data;return}w.current={providers:t.data.providers.map(e=>({...e,enabled:(S.current[e.provider]??0)>0?s(w.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let T=(0,U.useCallback)((e,t)=>{let n=x.providerStatus,r=l.getQueryData(n);if(!r)return;w.current||=r;let i=K(r,e,t);S.current[e]=(S.current[e]??0)+1,l.setQueryData(n,i);let a=(_.current[e]??0)+1;_.current[e]=a,g.current=g.current.then(async()=>{try{let r=await f(e,t),i=s(r,e)?.enabled;if(i===void 0)return;if(w.current=K(w.current??r,e,i),a===_.current[e]){let t=l.getQueryData(n);l.setQueryData(n,t?K(t,e,i):r)}}catch(t){if(a===_.current[e]){let r=s(w.current,e)?.enabled,i=l.getQueryData(n);i&&r!==void 0?l.setQueryData(n,K(i,e,r)):w.current?l.setQueryData(n,w.current):l.removeQueries({queryKey:n,exact:!0}),m(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{S.current[e]=(S.current[e]??0)-1}})},[l]),D=y({mutationFn:e=>c(e),onSuccess:async(e,t)=>{h(null),m(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await l.invalidateQueries({queryKey:x.providerStatus}),await v(l,t,`none`)},onError:(t,n)=>{if(t instanceof u&&t.command){let r=a(e.data,n);h({provider:n,label:r,message:t.message,command:t.command});return}m(t.message,{tone:`danger`})}}),O=async e=>{try{await navigator.clipboard.writeText(e),m(`Command copied`)}catch{m(`Could not copy the command`,{tone:`danger`})}};return(0,W.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,W.jsxs)(`div`,{className:`mb-2`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,W.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,W.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:r(e.data).map(e=>{let r=s(t.data,e.id),i=r?.status,a=q(i,t.isPending),c=D.isPending&&D.variables===e.id,l=r?.authFailureId;return(0,W.jsxs)(U.Fragment,{children:[(0,W.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,W.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(j,{tone:a.tone,pulse:t.isPending}),(0,W.jsx)(`span`,{children:a.label}),r?.enabled===!1?(0,W.jsx)(`span`,{children:`Disabled`}):null]}),(0,W.jsx)(Y,{provider:e,state:i,current:r,statusIsError:t.isError})]}),(0,W.jsx)(X,{provider:e,state:i,current:r,isConnecting:c,incidentId:l,refresh:n,connect:D,retry:o,queueToggle:T})]}),l===void 0?null:(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,W.jsx)(re,{manual:p,provider:e.id,connected:i===`connected`,onCopy:O})]},e.id)})})]})}var Z=2e4;function ae(){let e=S(),t=i(),n=w(o(t.data)),r=b();return e.isPending?(0,W.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,W.jsx)(M,{icon:(0,W.jsx)(O,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,W.jsx)(oe,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function oe({config:e,catalogs:t,providerStatus:n,runners:i}){let a=_(),o=d(),s=y({mutationFn:e=>l(e),onSuccess:e=>{o.setQueryData(g.config,e),o.invalidateQueries({queryKey:g.health}),o.invalidateQueries({queryKey:g.repo})},onError:e=>m(e.message,{tone:`danger`})}),[c,u]=V(e.systemPrompt??``),f=c.trim(),p=f===(e.systemPrompt??``),h=f.length>Z;return P(!p),(0,W.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,W.jsx)(se,{defaultRunner:e.defaultRunner,providerStatus:n,saving:s.isPending,onPick:e=>s.mutate({defaultRunner:e})}),(0,W.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,W.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:r(i).map(r=>{let{providerConnected:a,providerReason:o}=I(n,r.id),c=t[r.id],l=ee(r.id,i,c),u=N(r.id,i,c?.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,W.jsxs)(`label`,{className:`settings-option-row`,children:[(0,W.jsx)(`div`,{children:(0,W.jsx)(`h3`,{children:r.displayName})}),e.modelsLocked?(0,W.jsx)(`output`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,W.jsxs)(F,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,title:o??r.pickerDescription,disabled:s.isPending||!a,onChange:e=>s.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,W.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,W.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,W.jsx)(ne,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:c,onChange:e=>u(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,W.jsx)(ce,{length:f.length,overLimit:h,saved:p,pending:s.isPending,onSave:()=>s.mutate({systemPrompt:f===``?null:f},{onSuccess:()=>m(f===``?`System prompt cleared`:`System prompt saved`)})})]}),(0,W.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,W.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,W.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,W.jsx)(A,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({liveTitleUpdates:e},{onSuccess:()=>m(e?`Live title updates on`:`Live title updates off`)})}),(0,W.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,W.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,W.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,W.jsx)(A,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:s.isPending,onCheckedChange:e=>s.mutate({reviewGate:e},{onSuccess:()=>m(e?`Review gate on`:`Review gate off`)})}),(0,W.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,W.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:a.data?.info?(0,W.jsxs)(F,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:s.isPending,onChange:e=>s.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,W.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),a.data.branches.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]}):(0,W.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:a.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,W.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,W.jsx)(`summary`,{children:`Provider connections`}),(0,W.jsx)(ie,{})]})]})}function se({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let a=T(),o=D(),c=p(),l=_(),u=h(),d=c.projectId??`default`,f=l.data?.info?.root,g=te(a.data,c.projectId,f),v=i().data,y=z(a.data?.profiles??[],v),b=L(y,v);return(0,W.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,W.jsx)(B,{rows:y,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||o.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:d,provider:t,profileId:n},{onError:e=>m(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&s(t.data,e)?.enabled===!1?(0,W.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,b?(0,W.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,reportsDirty:n,children:r}){return(0,W.jsxs)(`section`,{"data-reports-dirty":n?``:void 0,className:`settings-field flex flex-col gap-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),r]})}function $({title:e,hint:t,children:n}){return(0,W.jsxs)(`section`,{className:`settings-option-row`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{children:e}),(0,W.jsx)(`p`,{children:t})]}),n]})}function ce({length:e,overLimit:t,saved:n,pending:r,onSave:i}){return(0,W.jsxs)(W.Fragment,{children:[t?(0,W.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Z.toLocaleString(),`.`]}):(0,W.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`}),(0,W.jsx)(`div`,{className:`settings-form-actions`,children:(0,W.jsx)(H,{show:n&&!t&&!r,children:(0,W.jsx)(k,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:n||t||r,onClick:i,children:`Save prompt`})})})]})}export{ae as AgentDefaultsSection};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,m as i,s as a,u as o}from"./live-reads-Crd6fVGH.js";import{Cr as s,Kt as c,M as l,Nn as u,pi as d,pn as f,r as p}from"./project-scope-context-Rv6S_BXt.js";import{n as m}from"./toaster-BXnLIU3z.js";import{At as h,Bt as g,C as _,Kt as v,Qt as y,St as b,Vt as x,_ as S,kt as C,qt as w,ut as T,wt as E,xt as D}from"./queries-qCF-eOqZ.js";import{s as O}from"./design-icons-CzEoMH9c.js";import{t as k}from"./button-B7MKxYjT.js";import{r as A}from"./switch-SP8pw5uU.js";import{t as j}from"./status-dot-BRzVlF2X.js";import{t as M}from"./centered-state-V15AR_qo.js";import{N,gn as P,j as ee,yn as te}from"./index-DNQcTHxV.js";import{t as ne}from"./textarea-vJt9undk.js";import{t as F}from"./settings-select-CCIMGnyA.js";import{a as I,i as L,n as R,r as z,t as B}from"./settings-agent-picker-CJJJncuA.js";import{n as V}from"./saved-draft-BwzBc-_Y.js";import{t as H}from"./save-cue-Cd3ZAPBS.js";var U=e(t(),1),W=n(),G={connected:{label:`Credentials found`,tone:`success`},disconnected:{label:`Not connected`,tone:`pending`},"not-installed":{label:`Not installed`,tone:`neutral`},unknown:{label:`Could not verify`,tone:`danger`}};function K(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function q(e,t){return e?G[e]:t?{label:`Checking…`,tone:`neutral`}:G.unknown}function J(e,t){return e===`unknown`||t&&!e}function Y({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,W.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,W.jsx)(`code`,{children:e.loginCommand}),`.`]}):J(t,r)?(0,W.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,W.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function X({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,W.jsx)(A,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,W.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>m(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,W.jsx)(R,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,W.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,W.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>m(`${e.displayName} can be tried again.`),onError:e=>m(e.message,{tone:`danger`})}),children:`Try again`})]})}function re({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,W.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,W.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,W.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ie(){let e=i(),t=b(),n=E(),o=C(),l=d(),[p,h]=(0,U.useState)(null),g=(0,U.useRef)(Promise.resolve()),_=(0,U.useRef)({}),S=(0,U.useRef)({}),w=(0,U.useRef)(t.data);(0,U.useEffect)(()=>{p&&s(t.data,p.provider)?.status===`connected`&&h(null)},[p,t.data]),(0,U.useEffect)(()=>{if(t.data){if(Object.values(S.current).every(e=>e===0)||!w.current){w.current=t.data;return}w.current={providers:t.data.providers.map(e=>({...e,enabled:(S.current[e.provider]??0)>0?s(w.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let T=(0,U.useCallback)((e,t)=>{let n=x.providerStatus,r=l.getQueryData(n);if(!r)return;w.current||=r;let i=K(r,e,t);S.current[e]=(S.current[e]??0)+1,l.setQueryData(n,i);let a=(_.current[e]??0)+1;_.current[e]=a,g.current=g.current.then(async()=>{try{let r=await f(e,t),i=s(r,e)?.enabled;if(i===void 0)return;if(w.current=K(w.current??r,e,i),a===_.current[e]){let t=l.getQueryData(n);l.setQueryData(n,t?K(t,e,i):r)}}catch(t){if(a===_.current[e]){let r=s(w.current,e)?.enabled,i=l.getQueryData(n);i&&r!==void 0?l.setQueryData(n,K(i,e,r)):w.current?l.setQueryData(n,w.current):l.removeQueries({queryKey:n,exact:!0}),m(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{S.current[e]=(S.current[e]??0)-1}})},[l]),D=y({mutationFn:e=>c(e),onSuccess:async(e,t)=>{h(null),m(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await l.invalidateQueries({queryKey:x.providerStatus}),await v(l,t,`none`)},onError:(t,n)=>{if(t instanceof u&&t.command){let r=a(e.data,n);h({provider:n,label:r,message:t.message,command:t.command});return}m(t.message,{tone:`danger`})}}),O=async e=>{try{await navigator.clipboard.writeText(e),m(`Command copied`)}catch{m(`Could not copy the command`,{tone:`danger`})}};return(0,W.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,W.jsxs)(`div`,{className:`mb-2`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,W.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,W.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:r(e.data).map(e=>{let r=s(t.data,e.id),i=r?.status,a=q(i,t.isPending),c=D.isPending&&D.variables===e.id,l=r?.authFailureId;return(0,W.jsxs)(U.Fragment,{children:[(0,W.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,W.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(j,{tone:a.tone,pulse:t.isPending}),(0,W.jsx)(`span`,{children:a.label}),r?.enabled===!1?(0,W.jsx)(`span`,{children:`Disabled`}):null]}),(0,W.jsx)(Y,{provider:e,state:i,current:r,statusIsError:t.isError})]}),(0,W.jsx)(X,{provider:e,state:i,current:r,isConnecting:c,incidentId:l,refresh:n,connect:D,retry:o,queueToggle:T})]}),l===void 0?null:(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,W.jsx)(re,{manual:p,provider:e.id,connected:i===`connected`,onCopy:O})]},e.id)})})]})}var Z=2e4;function ae(){let e=S(),t=i(),n=w(o(t.data)),r=b();return e.isPending?(0,W.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,W.jsx)(M,{icon:(0,W.jsx)(O,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,W.jsx)(oe,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function oe({config:e,catalogs:t,providerStatus:n,runners:i}){let a=_(),o=d(),s=y({mutationFn:e=>l(e),onSuccess:e=>{o.setQueryData(g.config,e),o.invalidateQueries({queryKey:g.health}),o.invalidateQueries({queryKey:g.repo})},onError:e=>m(e.message,{tone:`danger`})}),[c,u]=V(e.systemPrompt??``),f=c.trim(),p=f===(e.systemPrompt??``),h=f.length>Z;return P(!p),(0,W.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,W.jsx)(se,{defaultRunner:e.defaultRunner,providerStatus:n,saving:s.isPending,onPick:e=>s.mutate({defaultRunner:e})}),(0,W.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,W.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:r(i).map(r=>{let{providerConnected:a,providerReason:o}=I(n,r.id),c=t[r.id],l=ee(r.id,i,c),u=N(r.id,i,c?.data,[e.defaultModels[r.id]]),d=e.defaultModels[r.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,W.jsxs)(`label`,{className:`settings-option-row`,children:[(0,W.jsx)(`div`,{children:(0,W.jsx)(`h3`,{children:r.displayName})}),e.modelsLocked?(0,W.jsx)(`output`,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,W.jsxs)(F,{"aria-label":`Default model for ${r.pickerLabel}`,"data-slot":`agents-model`,"data-runner":r.id,value:d,title:o??r.pickerDescription,disabled:s.isPending||!a,onChange:e=>s.mutate({defaultModels:{[r.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,W.jsx)(`option`,{disabled:!0,children:l}):null]})]},r.id)})})}),(0,W.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,W.jsx)(ne,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:c,onChange:e=>u(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,W.jsx)(ce,{length:f.length,overLimit:h,saved:p,pending:s.isPending,onSave:()=>s.mutate({systemPrompt:f===``?null:f},{onSuccess:()=>m(f===``?`System prompt cleared`:`System prompt saved`)})})]}),(0,W.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,W.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,W.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,W.jsx)(A,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({liveTitleUpdates:e},{onSuccess:()=>m(e?`Live title updates on`:`Live title updates off`)})}),(0,W.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,W.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,W.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,W.jsx)(A,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:s.isPending,onCheckedChange:e=>s.mutate({reviewGate:e},{onSuccess:()=>m(e?`Review gate on`:`Review gate off`)})}),(0,W.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,W.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:a.data?.info?(0,W.jsxs)(F,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:s.isPending,onChange:e=>s.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,W.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),a.data.branches.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]}):(0,W.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:a.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,W.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,W.jsx)(`summary`,{children:`Provider connections`}),(0,W.jsx)(ie,{})]})]})}function se({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let a=T(),o=D(),c=p(),l=_(),u=h(),d=c.projectId??`default`,f=l.data?.info?.root,g=te(a.data,c.projectId,f),v=i().data,y=z(a.data?.profiles??[],v),b=L(y,v);return(0,W.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,W.jsx)(B,{rows:y,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||o.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:d,provider:t,profileId:n},{onError:e=>m(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&s(t.data,e)?.enabled===!1?(0,W.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,b?(0,W.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,reportsDirty:n,children:r}){return(0,W.jsxs)(`section`,{"data-reports-dirty":n?``:void 0,className:`settings-field flex flex-col gap-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),r]})}function $({title:e,hint:t,children:n}){return(0,W.jsxs)(`section`,{className:`settings-option-row`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{children:e}),(0,W.jsx)(`p`,{children:t})]}),n]})}function ce({length:e,overLimit:t,saved:n,pending:r,onSave:i}){return(0,W.jsxs)(W.Fragment,{children:[t?(0,W.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Z.toLocaleString(),`.`]}):(0,W.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`}),(0,W.jsx)(`div`,{className:`settings-form-actions`,children:(0,W.jsx)(H,{show:n&&!t&&!r,children:(0,W.jsx)(k,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:n||t||r,onClick:i,children:`Save prompt`})})})]})}export{ae as AgentDefaultsSection};
|