@hearsay-tools/squawk 0.19.0-dev.9008 → 0.19.0-dev.9021
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/dist/server/providers-routes.d.ts +57 -57
- package/dist/server/repo-routes.d.ts +13 -13
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +16 -16
- package/dist/server/server.d.ts +58 -58
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-C_QnLX6N.js → accounts-section-DINhWaKE.js} +1 -1
- package/web/dist/assets/{activity-motion-rKFPFRvk.js → activity-motion-BzO8epGW.js} +1 -1
- package/web/dist/assets/{activity-route-K2ZAKyOc.js → activity-route-BTHXYoE4.js} +1 -1
- package/web/dist/assets/{agent-config-section-CSJ8ASHu.js → agent-config-section-tjZMzOZC.js} +1 -1
- package/web/dist/assets/agent-defaults-section-CYGoNzJ-.js +1 -0
- package/web/dist/assets/{appearance-Be2bW15h.js → appearance-CCuTu0sL.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-BKHI2T3s.js → archive-on-merge-field-CeUWkcwK.js} +1 -1
- package/web/dist/assets/{automations-route-ukupzTDL.js → automations-route-CJmcm2Vr.js} +2 -2
- package/web/dist/assets/commit-list-DHm1bCGH.js +1 -0
- package/web/dist/assets/{diff-DYxPunyH.js → diff-CZJXpxat.js} +2 -2
- package/web/dist/assets/{diff-controls-BdfWJmNM.js → diff-controls-Cr1qbI1O.js} +1 -1
- package/web/dist/assets/{diff-view-DBTDxo57.js → diff-view-BxzlLybI.js} +1 -1
- package/web/dist/assets/discard-changes-dialog-aAzdjye-.js +1 -0
- package/web/dist/assets/{file-preview-SOIk_PH0.js → file-preview-DE1-2MRD.js} +1 -1
- package/web/dist/assets/{git-toolbar-CqWXQnFd.js → git-toolbar-CKcT_0rO.js} +1 -1
- package/web/dist/assets/github-DYJRmmIn.js +1 -0
- package/web/dist/assets/{global-activity-route-BGvoNYDr.js → global-activity-route-BsG3-J8A.js} +1 -1
- package/web/dist/assets/index-aGnZVJo_.css +1 -0
- package/web/dist/assets/index-lCPcoWSv.js +21 -0
- package/web/dist/assets/{markdown-CiWKjopy.js → markdown-CfYkmPQA.js} +1 -1
- package/web/dist/assets/{option-select-CdY1rB1x.js → option-select-BakZdSgu.js} +1 -1
- package/web/dist/assets/{preferences-section-D8jL-9hG.js → preferences-section-D8yX5A40.js} +1 -1
- package/web/dist/assets/preview-pane-connected-677KPPpd.js +3 -0
- package/web/dist/assets/{project-location-DKOqYVyP.js → project-location-l_7MLXzp.js} +1 -1
- package/web/dist/assets/{projects-section-C1W7Hasz.js → projects-section-aX9WMTbw.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-DFXqV8TR.js → prompt-templates-section-DV_VhZ8D.js} +2 -2
- package/web/dist/assets/reference-chip-BkfQoMvT.js +1 -0
- package/web/dist/assets/{remote-settings-notice-DfgdcIfD.js → remote-settings-notice-9x62rpqO.js} +1 -1
- package/web/dist/assets/repo-git-m0GYtWKT.js +1 -0
- package/web/dist/assets/{report-reader-B-uJpS4a.js → report-reader-C-YM9WMx.js} +1 -1
- package/web/dist/assets/{reports-COPIytLU.js → reports-Bdpvl1tm.js} +1 -1
- package/web/dist/assets/{resources-section-D8qMya0U.js → resources-section-CIrP33CN.js} +1 -1
- package/web/dist/assets/{review-panel-D-bDi48m.js → review-panel-B8zs0CSP.js} +4 -4
- package/web/dist/assets/run-header-B6l8_e9X.js +2 -0
- package/web/dist/assets/search-x-I9Q8pgUa.js +1 -0
- package/web/dist/assets/{select-B27amFsE.js → select-fYRFfIZp.js} +1 -1
- package/web/dist/assets/{session-context-section-Ws_K5zmI.js → session-context-section-DwmxBYhL.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-D8SLzhIg.js → settings-agent-picker-B0Q0ke-Q.js} +1 -1
- package/web/dist/assets/{settings-save-bar-CwMFlv_U.js → settings-save-bar-D_OxLOmj.js} +1 -1
- package/web/dist/assets/{settings-shell-CDEgqoql.js → settings-shell-tteBTOed.js} +1 -1
- package/web/dist/assets/{sidebar-section-sgVglrtK.js → sidebar-section-gGolq8j8.js} +1 -1
- package/web/dist/assets/{skills-BdUNA_WG.js → skills-BB3x_sd8.js} +1 -1
- package/web/dist/assets/{task-changes-B7xspQ98.js → task-changes-Yj9HftST.js} +1 -1
- package/web/dist/assets/task-commits-D_J1D_WR.js +1 -0
- package/web/dist/assets/{task-file-scope-CvLuxpi4.js → task-file-scope-BZFb10De.js} +1 -1
- package/web/dist/assets/{task-files-BwQVO9Jc.js → task-files-Cc4ZU-AA.js} +1 -1
- package/web/dist/assets/task-github-item-DSuJFWRJ.js +1 -0
- package/web/dist/assets/task-thread-D2korRS1.js +2 -0
- package/web/dist/assets/thread-state-C3TBW7mO.js +4 -0
- package/web/dist/assets/use-hand-to-agent-state-CQB8qtWC.js +1 -0
- package/web/dist/assets/use-hand-to-agent-state-DZZUsUAd.css +1 -0
- package/web/dist/assets/use-path-bases-BYeWywf7.js +1 -0
- package/web/dist/assets/{workflows-BJHvZ7G4.js → workflows-m3fecleC.js} +2 -2
- package/web/dist/assets/{workspace-tools-DtdDi369.js → workspace-tools-B0HwrAFS.js} +1 -1
- package/web/dist/assets/{worktrees-section-jmJugevp.js → worktrees-section-D92EMSjm.js} +1 -1
- package/web/dist/index.html +8 -8
- package/web/dist/assets/agent-defaults-section-CMCpZ7hZ.js +0 -1
- package/web/dist/assets/commit-list-Cf0x1qOz.js +0 -1
- package/web/dist/assets/discard-changes-dialog-CcVp1Cu8.js +0 -1
- package/web/dist/assets/github-pASZ8oMj.js +0 -1
- package/web/dist/assets/index-CzyjmihQ.css +0 -1
- package/web/dist/assets/index-DdN1zBQ0.js +0 -21
- package/web/dist/assets/preview-pane-connected-BEOa9WCZ.js +0 -3
- package/web/dist/assets/reference-chip-DDv209Ry.js +0 -1
- package/web/dist/assets/repo-git-C0-1xrBN.js +0 -1
- package/web/dist/assets/run-header-CgD5yNgy.js +0 -2
- package/web/dist/assets/task-commits-BCi7CKoE.js +0 -1
- package/web/dist/assets/task-github-item-Bpys4CTO.js +0 -1
- package/web/dist/assets/task-thread-BERX6vrL.js +0 -2
- package/web/dist/assets/tasks-table-CyUTCD9k.js +0 -1
- package/web/dist/assets/thread-state-B6JqvI7V.js +0 -4
- package/web/dist/assets/use-hand-to-agent-state-CqiCI37V.css +0 -1
- package/web/dist/assets/use-hand-to-agent-state-CvkdAvTh.js +0 -1
- package/web/dist/assets/use-path-bases-CGAbJheM.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{O as i,Ut as a,k as o,qt as s,un as c}from"./queries-B8INH8MM.js";import{M as l,Rn as u,j as d,n as f,p,u as m,vi as h}from"./toaster-Cjr2jC1Q.js";import{h as g}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as _,K as v,Q as y,R as ee,W as te,X as ne,Z as re,a as b,ct as ie,dt as x,l as ae,lt as oe,mt as se,n as ce,ot as le,rt as S,st as ue,x as de,y as fe}from"./design-icons-QbNMZniQ.js";import{t as C}from"./button-C8jUIs8Q.js";import{i as w,o as pe,r as T,s as me,t as E}from"./dialog-DRZuXvul.js";import{c as D,f as he,u as ge}from"./page-shell-Dky5crRl.js";import{i as
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{O as i,Ut as a,k as o,qt as s,un as c}from"./queries-B8INH8MM.js";import{M as l,Rn as u,j as d,n as f,p,u as m,vi as h}from"./toaster-Cjr2jC1Q.js";import{h as g}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as _,K as v,Q as y,R as ee,W as te,X as ne,Z as re,a as b,ct as ie,dt as x,l as ae,lt as oe,mt as se,n as ce,ot as le,rt as S,st as ue,x as de,y as fe}from"./design-icons-QbNMZniQ.js";import{t as C}from"./button-C8jUIs8Q.js";import{i as w,o as pe,r as T,s as me,t as E}from"./dialog-DRZuXvul.js";import{c as D,f as he,u as ge}from"./page-shell-Dky5crRl.js";import{i as O,l as _e,o as ve}from"./skills-pM_PouEs.js";import{t as ye}from"./centered-state-BgSV4e79.js";import{$t as k,Jt as A,Qt as j,Xt as be,Yt as M,Zt as xe,ar as N,bn as Se,en as P,tn as F,w as Ce}from"./index-lCPcoWSv.js";import{_ as we,a as Te,c as Ee,f as De,g as Oe,h as ke,i as I,m as Ae,n as je,o as Me,p as Ne,r as Pe,t as L,u as Fe}from"./sortable.esm-CAVTYaA3.js";import{t as R}from"./textarea-vEsJAUAV.js";import{t as Ie}from"./option-select-BakZdSgu.js";import{t as Le}from"./discard-changes-dialog-aAzdjye-.js";var z=e(t(),1);function B(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Re(e,t){return{id:V(e,t),name:e,skill:e,prompt:`{{task}}`}}function V(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return r}function ze(e,t,n){return{id:V(e,n),[e]:t.trim()}}function H(e){if(!(e.kind===`plugin`||e.skill))return e.command===void 0?e.prompt===void 0?void 0:`prompt`:`command`}function Be(e,t,n){let r=e[t],i=r&&H(r);return!r||!i?[...e]:e.map((e,r)=>r===t?{...e,[i]:n}:e)}function U(e){return e.some(e=>{let t=H(e);return t!==void 0&&!e[t]?.trim()})}function Ve(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function He(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Ue(e,t){return e.filter((e,n)=>n!==t)}function We(e){let t=e.map(e=>e.id),n=e.map(()=>({sources:[]}));return e.forEach((e,r)=>{if(!e.onFail)return;let i=e.onFail.retry,a=e.onFail.max??2,o=t.indexOf(i),s=n[r]?.sources??[];if(o===-1||o>=r){n[r]={link:{kind:o===-1?`missing`:`not-earlier`,target:i,max:a},sources:s};return}n[r]={link:{kind:`ok`,target:i,targetIndex:o,max:a},sources:s},n[o]?.sources.push(r)}),n}function W(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function G(e,t,n){let r=` `.repeat(n);return!t.includes(`
|
|
2
2
|
`)||/^\s/.test(t)?[`${r}${e}: ${W(t)}`]:[`${r}${e}: |`,...t.split(`
|
|
3
3
|
`).map(e=>`${r} ${e}`)]}function K(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${W(e.name)}`),e.skill&&t.push(` skill: ${W(e.skill)}`),t}function q(e){let t=[];return e.model&&t.push(` model: ${W(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${W(e.effort)}`),e.runner&&t.push(` runner: ${W(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${W(e.agentProfile)}`),t}function J(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(W).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(W).join(`, `)}]`),t}function Y(e){return e.onFail?[` onFail:`,` retry: ${W(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Ge(e){return[` - id: ${W(e.id)}`,...K(e),...e.prompt?G(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${W(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...q(e),...J(e),...e.command?G(`command`,e.command,4):[],...Y(e)]}function Ke(e,t,n){let r=[`name: ${W(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...G(`description`,t.trim(),0));let i=B(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${W(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Ge(e))}else r.push(`skills: []`);return`${r.join(`
|
|
4
4
|
`)}\n`}function qe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`chain`}function Je(e){let t=B(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ye(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Xe(e,t,n){let r=B(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var X=n(),Z=[{value:`skill`,label:`Skill`,icon:S},{value:`prompt`,label:`Prompt`,icon:te},{value:`command`,label:`Command`,icon:le}],Q={prompt:{field:`Prompt the agent runs`,placeholder:`Review the change for {{task}}…`,add:`Add prompt step`,blank:`A prompt step needs text.`},command:{field:`Shell command`,placeholder:`npm test`,add:`Add command step`,blank:`A command step needs text.`}};function Ze({kind:e,onKindChange:t}){return(0,X.jsx)(`div`,{role:`radiogroup`,"aria-label":`Step kind`,"data-slot":`wb-add-kind`,className:`grid grid-cols-3 gap-0.5 rounded-lg border border-border bg-muted/60 p-1 sm:inline-flex sm:w-fit`,children:Z.map(n=>(0,X.jsxs)(`label`,{className:r(`flex min-h-11 cursor-pointer items-center justify-center gap-2 rounded-md border border-transparent px-2 py-1.5 sm:px-3 text-[13px] font-medium transition-colors has-[:focus-visible]:outline-2`,e===n.value?`border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,X.jsx)(`input`,{type:`radio`,name:`workflow-add-kind`,className:`sr-only`,value:n.value,checked:e===n.value,onChange:()=>t(n.value)}),(0,X.jsx)(n.icon,{"aria-hidden":`true`,className:`size-3.5 max-sm:hidden`}),n.label]},n.value))})}function Qe({query:e,onQueryChange:t,matches:n,skillsCount:r,error:i,selectedSkill:a,onSelectSkill:o}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:e,onChange:e=>t(e.target.value)}),i===null?(0,X.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[n.map(e=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,X.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:a===e.id,onChange:()=>o(e.id)}),(0,X.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,X.jsx)(`span`,{className:`block`,children:e.name}),(0,X.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,X.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),n.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,X.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,i]}),e.trim()&&!n.some(t=>t.id===e.trim())?(0,X.jsxs)(C,{onClick:()=>o(e.trim()),children:[`Use skill id “`,e.trim(),`” (unchecked)`]}):null]})}function $e({open:e,onOpenChange:t,kind:n,onKindChange:i,text:a,onTextChange:o,stepsCount:s,onCloseAutoFocus:c,onCancel:l,onAdd:u,onAddText:d,...f}){let p=s>=8,m=f.selectedSkill;return(0,X.jsx)(E,{open:e,onOpenChange:t,children:(0,X.jsxs)(T,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:c,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,X.jsxs)(pe,{children:[(0,X.jsx)(me,{className:`text-xl font-normal`,children:`Add step`}),(0,X.jsx)(w,{className:`sr-only`,children:`Choose a skill, write a prompt or a shell command to append to this workflow.`})]}),(0,X.jsx)(Ze,{kind:n,onKindChange:i}),n===`skill`?(0,X.jsx)(Qe,{...f}):(0,X.jsx)(R,{"aria-label":Q[n].field,placeholder:Q[n].placeholder,value:a,rows:4,className:r(n===`command`&&`font-mono`),onChange:e=>o(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,X.jsx)(C,{variant:`outline`,onClick:l,children:`Cancel`}),n===`skill`?(0,X.jsx)(C,{variant:`primary`,disabled:!m||p,onClick:()=>{m&&u(m)},children:`Add selected skill`}):(0,X.jsx)(C,{variant:`primary`,disabled:!a.trim()||p,onClick:()=>d(n,a),children:Q[n].add})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the new step, then reorder it in the existing canvas.`}),p?(0,X.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function et({kind:e,text:t,index:n,editing:i,onTextChange:a}){let o=(0,z.useId)(),s=!t.trim();return(0,X.jsxs)(X.Fragment,{children:[i?(0,X.jsx)(R,{"data-slot":`wb-step-text`,"aria-label":`Step ${n+1} ${e}`,"aria-invalid":s||void 0,"aria-describedby":s?o:void 0,value:t,rows:3,className:r(`mt-2`,e===`command`&&`font-mono`),onChange:e=>a(e.target.value)}):null,s?(0,X.jsx)(`p`,{id:o,"data-slot":`wb-step-text-error`,className:`mt-1 text-xs text-danger`,children:Q[e].blank}):null]})}function tt({kind:e,index:t,editing:n,onEditingChange:r}){return(0,X.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"data-slot":`wb-step-edit`,"aria-label":n?`Done editing step ${t+1}`:`Edit ${e} of step ${t+1}`,"aria-expanded":n,onClick:()=>r(!n),children:[n?(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}):(0,X.jsx)(v,{"aria-hidden":`true`,className:`size-4`}),n?`Done`:`Edit ${e}`]})}function nt({workflows:e,trimmedName:t,onLoadWorkflow:n}){return(0,X.jsx)(Ie,{id:`workflow-load`,"data-slot":`wb-load-picker`,"data-page-shell-action":``,"aria-label":`Workflow`,value:e.some(e=>e.name===t)?t:``,placeholder:`Choose a workflow`,onValueChange:t=>{let r=e.find(e=>e.name===t);r&&n(r)},options:e.map(e=>({value:e.name,label:e.name})),className:`w-56 max-w-full min-w-0 border-border bg-card font-medium text-foreground max-md:w-full`})}function rt({draft:e,trimmedName:t,nameRef:n,onDraft:r,renamedFrom:i}){return(0,X.jsxs)(`section`,{"data-slot":`wb-details`,"data-reports-dirty":``,className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsxs)(`div`,{"data-slot":`wb-details-line`,className:`grid min-w-0 gap-1.5 @xl:grid-cols-[96px_minmax(0,1fr)] @xl:items-center @xl:gap-x-3`,children:[(0,X.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Name`}),(0,X.jsx)(N,{id:`workflow-name`,ref:n,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:e.name,"aria-describedby":i===void 0?void 0:`workflow-rename-note`,onChange:t=>r({...e,name:t.target.value}),className:`h-10 bg-card text-sm max-md:h-11 @xl:max-w-sm`}),(0,X.jsx)(`p`,{id:`workflow-rename-note`,"aria-live":`polite`,className:`text-xs text-muted-foreground empty:hidden @xl:col-start-2`,children:i===void 0?null:(0,X.jsxs)(`span`,{"data-slot":`wb-rename-note`,children:[`Saving creates a new workflow “`,t,`”. “`,i,`” stays as it is.`]})})]}),(0,X.jsxs)(`div`,{"data-slot":`wb-details-line`,className:`grid min-w-0 gap-1.5 @xl:grid-cols-[96px_minmax(0,1fr)] @xl:items-center @xl:gap-x-3`,children:[(0,X.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,X.jsx)(R,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,placeholder:`What this workflow does`,value:e.description,onChange:t=>r({...e,description:t.target.value}),className:`min-h-10 w-full bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function it({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,X.jsxs)(`div`,{"data-slot":`wb-actions`,className:`contents`,children:[(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-import`,onClick:n,children:[(0,X.jsx)(oe,{"aria-hidden":`true`,className:`size-4`}),`Import`]}),(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-export`,title:`Download workflow.yaml`,onClick:r,children:[(0,X.jsx)(de,{"aria-hidden":`true`,className:`size-4`}),`Export`]}),(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-auto`,"aria-expanded":t,"aria-describedby":`wb-auto-hint`,title:`Auto-build: describe the chain in words and an agent drafts its steps for you to review`,onClick:i,children:[(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-4`}),`Auto-build`]}),(0,X.jsx)(`span`,{id:`wb-auto-hint`,className:`sr-only`,children:`Describe the chain in words and an agent drafts its steps for you to review.`}),e?(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:a,children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-4`}),`Delete`]}):null]})}function at({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,X.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,X.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,X.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,X.jsx)(R,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,X.jsxs)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,X.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,X.jsx)(se,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,X.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function ot({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,X.jsx)(E,{open:e,onOpenChange:t,children:(0,X.jsxs)(T,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,X.jsx)(me,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,X.jsx)(w,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,X.jsx)(R,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
5
5
|
skills:
|
|
6
6
|
- test-conventions
|
|
7
|
-
- commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,X.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,X.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,X.jsx)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,X.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function st({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,X.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,X.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,X.jsx)(y,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,X.jsx)(N,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,X.jsx)(wt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,X.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,X.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,X.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,X.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(_,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsx)(Et,{yaml:o})}),(0,X.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-xs leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function ct({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,X.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,X.jsx)(Ct,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function lt({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{open:n,onOpenChange:e=>!e&&r(),children:(0,X.jsxs)(xe,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(O,{children:[(0,X.jsxs)(M,{children:[`“`,e,`” already exists`]}),(0,X.jsx)(Se,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,X.jsxs)(A,{children:[(0,X.jsx)(j,{children:`Keep the file`}),(0,X.jsx)(k,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,X.jsx)(P,{open:i,onOpenChange:e=>!e&&a(),children:(0,X.jsxs)(xe,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(O,{children:[(0,X.jsxs)(M,{children:[`Delete workflow “`,e,`”?`]}),(0,X.jsxs)(Se,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,X.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,X.jsxs)(A,{children:[(0,X.jsx)(j,{children:`Keep the file`}),(0,X.jsx)(k,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function ut(e){return e.name??e.skill??e.id}function dt(e){return e.skill&&e.name&&e.name!==e.skill?e.skill:void 0}function ft(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function pt(e){return`$ ${e.command}`}function mt(e,t){return ft(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function ht(e,t){return e.command===void 0?e.skill?mt(e,t):e.prompt??``:pt(e)}function gt(e,t){return e.skill&&!t?`unknown`:null}function _t(e){return e.command===void 0?e.skill?`Skill step`:`Prompt step`:`Command step`}function vt(e){return String(e+1).padStart(2,`0`)}function yt({link:e}){let t=e.kind!==`ok`;return(0,X.jsxs)(`p`,{"data-slot":`wb-step-retry`,"data-state":e.kind,className:r(`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium [overflow-wrap:anywhere]`,t?`border-danger/40 text-danger`:`border-accent-strong/40 bg-accent-strong/10 text-link-foreground`),children:[t?(0,X.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}):(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e.kind===`ok`?`Retry from ${vt(e.targetIndex)} · up to ×${e.max}`:e.kind===`missing`?`Retry target “${e.target}” is missing`:`Retry target “${e.target}” must come before this step`]})}function bt({sources:e}){return(0,X.jsxs)(`p`,{"data-slot":`wb-step-retry-target`,className:`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border border-dashed border-accent-strong/40 px-2.5 py-1 text-xs text-link-foreground`,children:[(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0 -scale-x-100`}),`Retry target of `,e.map(vt).join(`, `)]})}function xt({index:e,title:t,badge:n,onRemove:i,gripProps:a}){return(0,X.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`group/grip inline-flex h-[26px] shrink-0 cursor-grab items-center justify-center gap-0.5 rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 active:cursor-grabbing`,...a,children:[(0,X.jsx)(ee,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,X.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:vt(e)})]}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,X.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-xs`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,i?(0,X.jsxs)(C,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:i,children:[(0,X.jsx)(ue,{"aria-hidden":`true`}),` Remove`]}):null]})}function St({index:e,inRow:t=!1,onMoveUp:n,onMoveDown:i}){return(0,X.jsxs)(`div`,{className:r(`flex flex-wrap gap-2 @min-[900px]:hidden`,!t&&`mt-3`),children:[(0,X.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!n,onClick:n,children:[(0,X.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,X.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!i,onClick:i,children:[(0,X.jsx)(ce,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function Ct({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,retry:c,onTextChange:l,overlay:u=!1}){let d=n.find(t=>t.id===e.skill),f=ut(e),p=ht(e,d),m=gt(e,d),h=l&&!u?H(e):void 0,[g,_]=(0,z.useState)(!1);return(0,X.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,u&&`shadow-md`),children:[(0,X.jsx)(xt,{index:t,title:f,badge:m,onRemove:i,gripProps:a}),p&&!(h&&g)?(0,X.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:p}):null,(0,X.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-xs text-link-foreground`,children:_t(e)}),dt(e)?(0,X.jsx)(`p`,{"data-slot":`wb-step-skill`,className:`mt-1 font-mono text-xs text-muted-foreground`,children:dt(e)}):null,c?.link||c?.sources.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.link?(0,X.jsx)(yt,{link:c.link}):null,c.sources.length>0?(0,X.jsx)(bt,{sources:c.sources}):null]}):null,h&&l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(et,{kind:h,text:e[h]??``,index:t,editing:g,onTextChange:l}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,X.jsx)(tt,{kind:h,index:t,editing:g,onEditingChange:_}),(0,X.jsx)(St,{index:t,inRow:!0,onMoveUp:o,onMoveDown:s})]})]}):u?null:(0,X.jsx)(St,{index:t,onMoveUp:o,onMoveDown:s})]})}function wt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,X.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=ve(e,t);return(0,X.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,X.jsx)(Tt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,X.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function Tt({skill:e,inFlow:t,onAdd:n}){let{listeners:i,setNodeRef:a,isDragging:o}=Ne({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,X.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,o&&`opacity-40`),...i,children:[(0,X.jsxs)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,_e(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,X.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`})})]})}function Et({yaml:e}){let[t,n]=(0,z.useState)(!1),r=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,X.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}function Dt(e,t){return{yaml:Ke(e.name,e.description,e.steps),loadedName:t}}function Ot(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),o=(0,z.useRef)(0),s=e!==null&&n!==null&&Dt(e,void 0).yaml!==n.yaml;F(s);let c=(e,n)=>{o.current+=1,t(e),r(Dt(e,n))};return{draft:e,setDraft:t,dirty:s,replace:c,guardedReplace:(e,t)=>{s?a({draft:e,loadedName:t}):c(e,t)},sending:()=>e===null?null:{baseline:Dt(e,e.name.trim()),replacement:o.current},saved:e=>{e&&e.replacement===o.current&&r(e.baseline)},renamedFrom:e=>{let t=n?.loadedName;if(!(t===void 0||e===``))return qe(e)===qe(t)?void 0:t},discardOpen:i!==null,keepEditing:()=>a(null),discard:()=>{i&&c(i.draft,i.loadedName),a(null)}}}var kt=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function At(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function jt(e,t){return e?`No unsaved changes`:U(t)?`A step has no text`:void 0}function Mt(){let{name:e}=g();return(0,X.jsx)(Nt,{routeName:e},e??``)}function Nt({routeName:e}){let t=o(),n=s(),r=i(),g=h(),_=Ot(),{draft:v,setDraft:y}=_,[ee,te]=(0,z.useState)(``),[re,b]=(0,z.useState)(!1),[x,oe]=(0,z.useState)(``),[se,ce]=(0,z.useState)(null),[le,S]=(0,z.useState)(`skill`),[ue,de]=(0,z.useState)(``),[fe,w]=(0,z.useState)(!1),[pe,T]=(0,z.useState)(``),[me,E]=(0,z.useState)(``),[_e,O]=(0,z.useState)(!1),[k,A]=(0,z.useState)(``),[xe,j]=(0,z.useState)(!1),[Se,M]=(0,z.useState)(!1),N=(0,z.useId)(),[P,F]=(0,z.useState)(null),[we,I]=(0,z.useState)(null),Ae=(0,z.useRef)(null),Ne=(0,z.useRef)(null),Pe=t.data?.workflows??[],L=n.data??[],R=ye(L,r.data?.skillUsage),Ie=ve(R,x,r.data?.skillUsage);(0,z.useEffect)(()=>{if(v!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);_.replace(r?At(r):$(),r?.name)},[v,t.data,e,_.replace]);let B=e=>y(t=>t===null?t:{...t,steps:e}),V=c({mutationFn:e=>d(e),onSuccess:e=>{y({name:e.name,description:e.description??``,steps:e.steps}),w(!1),T(``),E(``),f(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),H=c({mutationFn:e=>l(e),onSuccess:e=>{y(t=>{let n=t??$(),{name:r,steps:i}=Ye(e,n.name);return{...n,name:r,steps:i}}),O(!1),A(``),f(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??v?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>f(e instanceof Error?e.message:String(e),{tone:`danger`})}),U=c({onMutate:()=>_.sending(),mutationFn:e=>m({...Xe(v?.name??``,v?.description??``,v?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:(e,t,n)=>{j(!1),_.saved(n),f(`Saved — ${e.path.split(`/`).pop()??e.path}`),g.invalidateQueries({queryKey:a.workflows})},onError:e=>{e instanceof u&&e.exists===!0?j(!0):f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),We=c({mutationFn:e=>p(e),onSuccess:(e,t)=>{M(!1),f(`Deleted "${t}".`),_.replace($(),void 0),g.invalidateQueries({queryKey:a.workflows})},onError:e=>{M(!1),f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),W=Oe(ke(Fe,{activationConstraint:{distance:4}}),ke(Ee,{coordinateGetter:je}));if(t.isError)return(0,X.jsx)(ge,{route:`workflows`,density:`empty`,className:`@container`,children:(0,X.jsx)(be,{icon:(0,X.jsx)(ie,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(v===null)return(0,X.jsx)(Ce,{});let G=v.steps,K=v.name.trim(),q=Pe.find(e=>e.name===K&&e.source===`file`),J=Ke(v.name,v.description,G),Y=jt(q!==void 0&&Ke(q.name,q.description??``,q.steps??[])===J,G),Ge=(e,t=G.length)=>{if(G.length>=8){f(`A workflow holds at most 8 steps.`,{tone:`danger`});return}B(Ve(G,e,t))},Z=(e,t=G.length)=>Ge(Re(e,G),t);return(0,X.jsxs)(ge,{route:`workflows`,density:he(G.length),className:`@container`,header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`,status:Y?(0,X.jsx)(`span`,{id:N,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:Y}):void 0,secondaryActions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nt,{workflows:Pe,trimmedName:K,onLoadWorkflow:e=>_.guardedReplace(At(e),e.name)}),(0,X.jsx)(it,{savedFile:q,autoOpen:_e,onImportToggle:()=>{E(``),O(!1),w(e=>!e)},onExport:()=>{let e=new Blob([J],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${qe(v.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{w(!1),O(e=>!e)},onDeleteRequest:()=>M(!0)}),(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-new`,onClick:()=>_.guardedReplace($(),void 0),children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),primaryAction:(0,X.jsxs)(D,{type:`button`,variant:`primary`,"data-slot":`wb-save`,disabled:U.isPending||Y!==void 0,"aria-describedby":Y?N:void 0,onClick:()=>{if(K===``){Ae.current?.focus();return}if(G.length===0){f(`Add at least one step first.`,{tone:`danger`});return}U.mutate(!1)},children:[(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]})},children:[(0,X.jsxs)(Te,{sensors:W,collisionDetection:De,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===kt?G.length:G.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?G.length:e);return}if(n.id===t.id)return;let i=G.findIndex(e=>e.id===t.id),a=G.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&B(He(G,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,X.jsx)(rt,{draft:v,trimmedName:K,nameRef:Ae,onDraft:y,renamedFrom:_.renamedFrom(K)}),_e?(0,X.jsx)(at,{text:k,onTextChange:A,pending:H.isPending,onRun:()=>{let e=k.trim();e===``||H.isPending||H.mutate(e)},onCancel:()=>{O(!1),A(``)}}):null,(0,X.jsx)(ot,{open:fe,onOpenChange:w,text:pe,onTextChange:T,error:me,pending:V.isPending,onRun:()=>{let e=pe.trim();e!==``&&V.mutate(e)},onCancel:()=>{w(!1),T(``),E(``)}}),(0,X.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,X.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,G.length,` of `,8,` max`,(0,X.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Je(G)})]}),(0,X.jsx)(Pt,{steps:G,skills:L,dragging:P!==null,overId:we,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>B(Ue(G,e)),onTextChange:(e,t)=>B(Be(G,e,t)),onMove:(e,t)=>B(He(G,e,t))}),(0,X.jsxs)(C,{ref:Ne,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{ce(null),oe(``),S(`skill`),de(``),b(!0)},children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,X.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,X.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]})]}),(0,X.jsx)(st,{paletteSkills:R,query:ee,onQueryChange:te,error:n.isError?n.error.message:null,inFlow:new Set(G.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:J})]})]}),(0,X.jsx)(Me,{children:(0,X.jsx)(It,{dragging:P,steps:G,skills:L})})]}),(0,X.jsx)($e,{open:re,onOpenChange:b,query:x,onQueryChange:oe,matches:Ie,skillsCount:L.length,error:n.isError?n.error.message:null,selectedSkill:se,onSelectSkill:ce,kind:le,onKindChange:S,text:ue,onTextChange:de,stepsCount:G.length,onCloseAutoFocus:e=>{e.preventDefault(),Ne.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)},onAddText:(e,t)=>{Ge(ze(e,t,G)),b(!1)}}),(0,X.jsx)(lt,{trimmedName:K,savedFile:q,overwriteOpen:xe,onOverwriteDismiss:()=>j(!1),deleteOpen:Se,onDeleteDismiss:()=>M(!1),onOverwrite:()=>U.mutate(!0),onDelete:()=>We.mutate(K)}),(0,X.jsx)(Le,{open:_.discardOpen,subject:K===``?`this workflow`:`“${K}”`,onKeep:_.keepEditing,onDiscard:_.discard})]})}function Pt({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onTextChange:s,onMove:c}){let{setNodeRef:l,isOver:u}=Ae({id:kt}),d=n&&i===kt,f=We(e);return(0,X.jsx)(`div`,{ref:l,"data-slot":`wb-steps`,"data-reports-dirty":``,"data-dragging":n||void 0,className:r(`relative mt-3 rounded-lg transition-colors`,u?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,X.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,u?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,X.jsxs)(L,{items:e.map(e=>e.id),strategy:I,children:[(0,X.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,l)=>(0,X.jsx)(Ft,{step:r,index:l,skills:t,retry:f[l],dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(l),onTextChange:e=>s(l,e),onMoveUp:l>0?()=>c(l,l-1):void 0,onMoveDown:l<e.length-1?()=>c(l,l+1):void 0},r.id))}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,d?`bg-accent-strong`:`bg-transparent`)})]})})}function Ft({step:e,index:t,retry:n,dragging:i,insertBefore:a,onRemove:o,onTextChange:c,onMoveUp:l,onMoveDown:u}){let d=s(e.runner,e.agentProfile),{attributes:f,listeners:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=Pe({id:e.id,data:{type:`step`,step:e}});return(0,X.jsxs)(`li`,{ref:m,style:{transform:we.Transform.toString(h),transition:g},className:r(`relative`,_&&`opacity-40`),children:[t>0&&!i?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-step-connector`,className:`pointer-events-none absolute -top-4 left-[48px] h-4 w-0.5 rounded-full bg-border`}):null,a?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[10px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,X.jsx)(Ct,{step:e,index:t,skills:d.data??[],onRemove:o,onTextChange:c,onMoveUp:l,onMoveDown:u,retry:n,gripProps:{...f,...p}})]})}function It(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=s(t?.runner,t?.agentProfile,!!t);return(0,X.jsx)(ct,{...e,skills:t?n.data??[]:e.skills})}export{Mt as WorkflowsRoute};
|
|
7
|
+
- commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,X.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,X.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,X.jsx)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,X.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function st({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,X.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,X.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,X.jsx)(y,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,X.jsx)(N,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,X.jsx)(wt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,X.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,X.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,X.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,X.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(_,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,X.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,X.jsx)(Et,{yaml:o})}),(0,X.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-xs leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function ct({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,X.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,X.jsx)(Ct,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function lt({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{open:n,onOpenChange:e=>!e&&r(),children:(0,X.jsxs)(xe,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(P,{children:[(0,X.jsxs)(F,{children:[`“`,e,`” already exists`]}),(0,X.jsx)(j,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(be,{children:`Keep the file`}),(0,X.jsx)(M,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,X.jsx)(A,{open:i,onOpenChange:e=>!e&&a(),children:(0,X.jsxs)(xe,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,X.jsxs)(P,{children:[(0,X.jsxs)(F,{children:[`Delete workflow “`,e,`”?`]}),(0,X.jsxs)(j,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,X.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(be,{children:`Keep the file`}),(0,X.jsx)(M,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function ut(e){return e.name??e.skill??e.id}function dt(e){return e.skill&&e.name&&e.name!==e.skill?e.skill:void 0}function ft(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function pt(e){return`$ ${e.command}`}function mt(e,t){return ft(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function ht(e,t){return e.command===void 0?e.skill?mt(e,t):e.prompt??``:pt(e)}function gt(e,t){return e.skill&&!t?`unknown`:null}function _t(e){return e.command===void 0?e.skill?`Skill step`:`Prompt step`:`Command step`}function vt(e){return String(e+1).padStart(2,`0`)}function yt({link:e}){let t=e.kind!==`ok`;return(0,X.jsxs)(`p`,{"data-slot":`wb-step-retry`,"data-state":e.kind,className:r(`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium [overflow-wrap:anywhere]`,t?`border-danger/40 text-danger`:`border-accent-strong/40 bg-accent-strong/10 text-link-foreground`),children:[t?(0,X.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}):(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e.kind===`ok`?`Retry from ${vt(e.targetIndex)} · up to ×${e.max}`:e.kind===`missing`?`Retry target “${e.target}” is missing`:`Retry target “${e.target}” must come before this step`]})}function bt({sources:e}){return(0,X.jsxs)(`p`,{"data-slot":`wb-step-retry-target`,className:`mt-2 inline-flex max-w-full items-center gap-1.5 rounded-full border border-dashed border-accent-strong/40 px-2.5 py-1 text-xs text-link-foreground`,children:[(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5 shrink-0 -scale-x-100`}),`Retry target of `,e.map(vt).join(`, `)]})}function xt({index:e,title:t,badge:n,onRemove:i,gripProps:a}){return(0,X.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`group/grip inline-flex h-[26px] shrink-0 cursor-grab items-center justify-center gap-0.5 rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 active:cursor-grabbing`,...a,children:[(0,X.jsx)(ee,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,X.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:vt(e)})]}),(0,X.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,X.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-xs`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,i?(0,X.jsxs)(C,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:i,children:[(0,X.jsx)(ue,{"aria-hidden":`true`}),` Remove`]}):null]})}function St({index:e,inRow:t=!1,onMoveUp:n,onMoveDown:i}){return(0,X.jsxs)(`div`,{className:r(`flex flex-wrap gap-2 @min-[900px]:hidden`,!t&&`mt-3`),children:[(0,X.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!n,onClick:n,children:[(0,X.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,X.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!i,onClick:i,children:[(0,X.jsx)(ce,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function Ct({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,retry:c,onTextChange:l,overlay:u=!1}){let d=n.find(t=>t.id===e.skill),f=ut(e),p=ht(e,d),m=gt(e,d),h=l&&!u?H(e):void 0,[g,_]=(0,z.useState)(!1);return(0,X.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,u&&`shadow-md`),children:[(0,X.jsx)(xt,{index:t,title:f,badge:m,onRemove:i,gripProps:a}),p&&!(h&&g)?(0,X.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:p}):null,(0,X.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-xs text-link-foreground`,children:_t(e)}),dt(e)?(0,X.jsx)(`p`,{"data-slot":`wb-step-skill`,className:`mt-1 font-mono text-xs text-muted-foreground`,children:dt(e)}):null,c?.link||c?.sources.length?(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.link?(0,X.jsx)(yt,{link:c.link}):null,c.sources.length>0?(0,X.jsx)(bt,{sources:c.sources}):null]}):null,h&&l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(et,{kind:h,text:e[h]??``,index:t,editing:g,onTextChange:l}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,X.jsx)(tt,{kind:h,index:t,editing:g,onEditingChange:_}),(0,X.jsx)(St,{index:t,inRow:!0,onMoveUp:o,onMoveDown:s})]})]}):u?null:(0,X.jsx)(St,{index:t,onMoveUp:o,onMoveDown:s})]})}function wt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,X.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=_e(e,t);return(0,X.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,X.jsx)(Tt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,X.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function Tt({skill:e,inFlow:t,onAdd:n}){let{listeners:i,setNodeRef:a,isDragging:o}=Ne({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,X.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,o&&`opacity-40`),...i,children:[(0,X.jsxs)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,O(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,X.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`})})]})}function Et({yaml:e}){let[t,n]=(0,z.useState)(!1),r=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,X.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}function Dt(e,t){return{yaml:Ke(e.name,e.description,e.steps),loadedName:t}}function Ot(){let[e,t]=(0,z.useState)(null),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null),o=(0,z.useRef)(0),s=e!==null&&n!==null&&Dt(e,void 0).yaml!==n.yaml;Se(s);let c=(e,n)=>{o.current+=1,t(e),r(Dt(e,n))};return{draft:e,setDraft:t,dirty:s,replace:c,guardedReplace:(e,t)=>{s?a({draft:e,loadedName:t}):c(e,t)},sending:()=>e===null?null:{baseline:Dt(e,e.name.trim()),replacement:o.current},saved:e=>{e&&e.replacement===o.current&&r(e.baseline)},renamedFrom:e=>{let t=n?.loadedName;if(!(t===void 0||e===``))return qe(e)===qe(t)?void 0:t},discardOpen:i!==null,keepEditing:()=>a(null),discard:()=>{i&&c(i.draft,i.loadedName),a(null)}}}var kt=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function At(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function jt(e,t){return e?`No unsaved changes`:U(t)?`A step has no text`:void 0}function Mt(){let{name:e}=g();return(0,X.jsx)(Nt,{routeName:e},e??``)}function Nt({routeName:e}){let t=o(),n=s(),r=i(),g=h(),_=Ot(),{draft:v,setDraft:y}=_,[ee,te]=(0,z.useState)(``),[re,b]=(0,z.useState)(!1),[x,oe]=(0,z.useState)(``),[se,ce]=(0,z.useState)(null),[le,S]=(0,z.useState)(`skill`),[ue,de]=(0,z.useState)(``),[fe,w]=(0,z.useState)(!1),[pe,T]=(0,z.useState)(``),[me,E]=(0,z.useState)(``),[O,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[be,M]=(0,z.useState)(!1),[xe,N]=(0,z.useState)(!1),Se=(0,z.useId)(),[P,F]=(0,z.useState)(null),[we,I]=(0,z.useState)(null),Ae=(0,z.useRef)(null),Ne=(0,z.useRef)(null),Pe=t.data?.workflows??[],L=n.data??[],R=ve(L,r.data?.skillUsage),Ie=_e(R,x,r.data?.skillUsage);(0,z.useEffect)(()=>{if(v!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);_.replace(r?At(r):$(),r?.name)},[v,t.data,e,_.replace]);let B=e=>y(t=>t===null?t:{...t,steps:e}),V=c({mutationFn:e=>d(e),onSuccess:e=>{y({name:e.name,description:e.description??``,steps:e.steps}),w(!1),T(``),E(``),f(`Imported "${e.name}" — review, then Save.`)},onError:e=>E(e.message)}),H=c({mutationFn:e=>l(e),onSuccess:e=>{y(t=>{let n=t??$(),{name:r,steps:i}=Ye(e,n.name);return{...n,name:r,steps:i}}),k(!1),j(``),f(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??v?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>f(e instanceof Error?e.message:String(e),{tone:`danger`})}),U=c({onMutate:()=>_.sending(),mutationFn:e=>m({...Xe(v?.name??``,v?.description??``,v?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:(e,t,n)=>{M(!1),_.saved(n),f(`Saved — ${e.path.split(`/`).pop()??e.path}`),g.invalidateQueries({queryKey:a.workflows})},onError:e=>{e instanceof u&&e.exists===!0?M(!0):f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),We=c({mutationFn:e=>p(e),onSuccess:(e,t)=>{N(!1),f(`Deleted "${t}".`),_.replace($(),void 0),g.invalidateQueries({queryKey:a.workflows})},onError:e=>{N(!1),f(e instanceof Error?e.message:String(e),{tone:`danger`})}}),W=Oe(ke(Fe,{activationConstraint:{distance:4}}),ke(Ee,{coordinateGetter:je}));if(t.isError)return(0,X.jsx)(ge,{route:`workflows`,density:`empty`,className:`@container`,children:(0,X.jsx)(ye,{icon:(0,X.jsx)(ie,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(v===null)return(0,X.jsx)(Ce,{});let G=v.steps,K=v.name.trim(),q=Pe.find(e=>e.name===K&&e.source===`file`),J=Ke(v.name,v.description,G),Y=jt(q!==void 0&&Ke(q.name,q.description??``,q.steps??[])===J,G),Ge=(e,t=G.length)=>{if(G.length>=8){f(`A workflow holds at most 8 steps.`,{tone:`danger`});return}B(Ve(G,e,t))},Z=(e,t=G.length)=>Ge(Re(e,G),t);return(0,X.jsxs)(ge,{route:`workflows`,density:he(G.length),className:`@container`,header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`,status:Y?(0,X.jsx)(`span`,{id:Se,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:Y}):void 0,secondaryActions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(nt,{workflows:Pe,trimmedName:K,onLoadWorkflow:e=>_.guardedReplace(At(e),e.name)}),(0,X.jsx)(it,{savedFile:q,autoOpen:O,onImportToggle:()=>{E(``),k(!1),w(e=>!e)},onExport:()=>{let e=new Blob([J],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${qe(v.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{w(!1),k(e=>!e)},onDeleteRequest:()=>N(!0)}),(0,X.jsxs)(D,{type:`button`,variant:`outline`,"data-slot":`wb-new`,onClick:()=>_.guardedReplace($(),void 0),children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),primaryAction:(0,X.jsxs)(D,{type:`button`,variant:`primary`,"data-slot":`wb-save`,disabled:U.isPending||Y!==void 0,"aria-describedby":Y?Se:void 0,onClick:()=>{if(K===``){Ae.current?.focus();return}if(G.length===0){f(`Add at least one step first.`,{tone:`danger`});return}U.mutate(!1)},children:[(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]})},children:[(0,X.jsxs)(Te,{sensors:W,collisionDetection:De,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===kt?G.length:G.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?G.length:e);return}if(n.id===t.id)return;let i=G.findIndex(e=>e.id===t.id),a=G.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&B(He(G,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,X.jsx)(rt,{draft:v,trimmedName:K,nameRef:Ae,onDraft:y,renamedFrom:_.renamedFrom(K)}),O?(0,X.jsx)(at,{text:A,onTextChange:j,pending:H.isPending,onRun:()=>{let e=A.trim();e===``||H.isPending||H.mutate(e)},onCancel:()=>{k(!1),j(``)}}):null,(0,X.jsx)(ot,{open:fe,onOpenChange:w,text:pe,onTextChange:T,error:me,pending:V.isPending,onRun:()=>{let e=pe.trim();e!==``&&V.mutate(e)},onCancel:()=>{w(!1),T(``),E(``)}}),(0,X.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,X.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,G.length,` of `,8,` max`,(0,X.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Je(G)})]}),(0,X.jsx)(Pt,{steps:G,skills:L,dragging:P!==null,overId:we,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>B(Ue(G,e)),onTextChange:(e,t)=>B(Be(G,e,t)),onMove:(e,t)=>B(He(G,e,t))}),(0,X.jsxs)(C,{ref:Ne,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{ce(null),oe(``),S(`skill`),de(``),b(!0)},children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,X.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,X.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]})]}),(0,X.jsx)(st,{paletteSkills:R,query:ee,onQueryChange:te,error:n.isError?n.error.message:null,inFlow:new Set(G.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:J})]})]}),(0,X.jsx)(Me,{children:(0,X.jsx)(It,{dragging:P,steps:G,skills:L})})]}),(0,X.jsx)($e,{open:re,onOpenChange:b,query:x,onQueryChange:oe,matches:Ie,skillsCount:L.length,error:n.isError?n.error.message:null,selectedSkill:se,onSelectSkill:ce,kind:le,onKindChange:S,text:ue,onTextChange:de,stepsCount:G.length,onCloseAutoFocus:e=>{e.preventDefault(),Ne.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)},onAddText:(e,t)=>{Ge(ze(e,t,G)),b(!1)}}),(0,X.jsx)(lt,{trimmedName:K,savedFile:q,overwriteOpen:be,onOverwriteDismiss:()=>M(!1),deleteOpen:xe,onDeleteDismiss:()=>N(!1),onOverwrite:()=>U.mutate(!0),onDelete:()=>We.mutate(K)}),(0,X.jsx)(Le,{open:_.discardOpen,subject:K===``?`this workflow`:`“${K}”`,onKeep:_.keepEditing,onDiscard:_.discard})]})}function Pt({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onTextChange:s,onMove:c}){let{setNodeRef:l,isOver:u}=Ae({id:kt}),d=n&&i===kt,f=We(e);return(0,X.jsx)(`div`,{ref:l,"data-slot":`wb-steps`,"data-reports-dirty":``,"data-dragging":n||void 0,className:r(`relative mt-3 rounded-lg transition-colors`,u?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,X.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,u?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,X.jsxs)(L,{items:e.map(e=>e.id),strategy:I,children:[(0,X.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((r,l)=>(0,X.jsx)(Ft,{step:r,index:l,skills:t,retry:f[l],dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(l),onTextChange:e=>s(l,e),onMoveUp:l>0?()=>c(l,l-1):void 0,onMoveDown:l<e.length-1?()=>c(l,l+1):void 0},r.id))}),(0,X.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,d?`bg-accent-strong`:`bg-transparent`)})]})})}function Ft({step:e,index:t,retry:n,dragging:i,insertBefore:a,onRemove:o,onTextChange:c,onMoveUp:l,onMoveDown:u}){let d=s(e.runner,e.agentProfile),{attributes:f,listeners:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=Pe({id:e.id,data:{type:`step`,step:e}});return(0,X.jsxs)(`li`,{ref:m,style:{transform:we.Transform.toString(h),transition:g},className:r(`relative`,_&&`opacity-40`),children:[t>0&&!i?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-step-connector`,className:`pointer-events-none absolute -top-4 left-[48px] h-4 w-0.5 rounded-full bg-border`}):null,a?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[10px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,X.jsx)(Ct,{step:e,index:t,skills:d.data??[],onRemove:o,onTextChange:c,onMoveUp:l,onMoveDown:u,retry:n,gripProps:{...f,...p}})]})}function It(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=s(t?.runner,t?.agentProfile,!!t);return(0,X.jsx)(ct,{...e,skills:t?n.data??[]:e.skills})}export{Mt as WorkflowsRoute};
|
|
@@ -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{Ft as r,Zt as i,nn as a,vt as o,xt as s}from"./queries-B8INH8MM.js";import{n as c}from"./toaster-Cjr2jC1Q.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./external-link-BE6y205O.js";import{t as f}from"./button-C8jUIs8Q.js";import{t as p}from"./status-dot-BXf-Ubd0.js";import{f as m,o as h}from"./page-shell-Dky5crRl.js";import{t as g}from"./agents-settings-path-7X6_cvUg.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,Zt as i,nn as a,vt as o,xt as s}from"./queries-B8INH8MM.js";import{n as c}from"./toaster-Cjr2jC1Q.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./external-link-BE6y205O.js";import{t as f}from"./button-C8jUIs8Q.js";import{t as p}from"./status-dot-BXf-Ubd0.js";import{f as m,o as h}from"./page-shell-Dky5crRl.js";import{t as g}from"./agents-settings-path-7X6_cvUg.js";import{In as _,Rn as v,ir as y,nn as b,nr as x,or as S,rn as C}from"./index-lCPcoWSv.js";var w=e(t(),1),T=n();function E(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e},t):(0,T.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,T.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e.slice(1,-1)},t):e?(0,T.jsx)(`span`,{children:e},t):null)}function D(e,t){let n=i(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}function O({mode:e,version:t,rawVersion:n}){return e?(0,T.jsx)(`span`,{"data-slot":`tool-dry-run`,title:n,className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:e.label}):t?(0,T.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,t]}):null}var k=`h-8 text-xs font-medium max-md:h-11 no-hover:h-11`;function A({projectsDir:e,home:t,onAction:n}){return(0,T.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-card-edge bg-card px-6 py-4 shadow-card max-md:px-4`,"aria-labelledby":`projects-heading`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`h2`,{id:`projects-heading`,className:`text-sm font-semibold text-foreground`,children:`Projects`}),(0,T.jsx)(`p`,{className:`mt-0.5 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a repository, open a local folder, or clone from GitHub.`})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,"data-action":`new-project`,onClick:()=>n(`new`),children:`New project`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`local`),children:`Open local folder`}),(0,T.jsx)(f,{variant:`outline`,size:`sm`,className:k,onClick:()=>n(`clone`),children:`Clone from GitHub`})]})]}),e?(0,T.jsxs)(`p`,{"data-slot":`projects-checkout`,className:`flex min-w-0 items-baseline gap-1.5 text-xs text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:`New clones go to`}),(0,T.jsx)(v,{value:e,bases:{home:t,root:null},className:`text-foreground`})]}):null]})}function j({recovery:e}){let t=`${k} ml-auto`;return e.kind===`settings`?(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(l,{to:e.to,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})}):(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:t,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,"data-slot":`tool-setup`,children:[e.label,(0,T.jsx)(d,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,T.jsx)(`span`,{className:`sr-only`,children:` (opens in a new tab)`})]})})}function M({health:e,runners:t,copying:n,onCopy:r,recheckStatus:i,onRecheck:a}){return(0,T.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,T.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,T.jsx)(f,{asChild:!0,variant:`outline`,size:`sm`,className:k,children:(0,T.jsxs)(l,{to:g,"data-slot":`tools-settings`,children:[`Tool settings`,(0,T.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,T.jsx)(`p`,{role:`alert`,className:`text-sm text-semantic-red`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,T.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,T.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=b(e),r=D(e.name,t),i=_(e),a=C(e,t);return(0,T.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,T.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,T.jsx)(p,{tone:i.availability.tone,shape:i.availability.shape}),(0,T.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,T.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`shrink-0`,children:i.availability.label}),(0,T.jsx)(O,{mode:i.mode,version:i.version,rawVersion:i.rawVersion}),a?(0,T.jsx)(j,{recovery:a}):null]}),n?(0,T.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:E(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,T.jsx)(f,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:e.isFetching,onClick:()=>void a(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,T.jsx)(f,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`}),(0,T.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:i?(0,T.jsx)(`span`,{"data-slot":`recheck-status`,children:i}):null})]})]})}function N(e,t){let n=e.filter(e=>e.available).length;return`Rechecked at ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})} — ${n} of ${e.length} ${e.length===1?`tool`:`tools`} available.`}function P(){let e=o(),t=s().data?.projectsDir,n=r().data?.homeDir??null,i=a().data,[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(!1),[p,g]=(0,w.useState)(null),_=async()=>{g(null);let t=await e.refetch();t.isError||!t.data||g(N(t.data.checks,new Date))},v=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),c(`Diagnostics copied`)}catch{c(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},b=e.data?.checks.length??4;return(0,T.jsxs)(h,{route:`workspace-tools`,density:e.data?m(b):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Check local CLI tools, then add projects.`},children:[(0,T.jsx)(M,{health:e,runners:i,copying:d,onCopy:v,recheckStatus:p,onRecheck:_}),(0,T.jsx)(A,{projectsDir:t,home:n,onAction:u}),l===`new`?(0,T.jsx)(x,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,T.jsx)(S,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,T.jsx)(y,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{P as WorkspaceToolsRoute};
|
|
@@ -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{Ut as r,g as i,un as a,vt as o}from"./queries-B8INH8MM.js";import{Br as s,I as c,Rn as l,n as u,vi as d,zr as f}from"./toaster-Cjr2jC1Q.js";import{d as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./project-router-DvfVUjon.js";import{t as h}from"./centered-state-BgSV4e79.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ut as r,g as i,un as a,vt as o}from"./queries-B8INH8MM.js";import{Br as s,I as c,Rn as l,n as u,vi as d,zr as f}from"./toaster-Cjr2jC1Q.js";import{d as p}from"./design-icons-QbNMZniQ.js";import{t as m}from"./project-router-DvfVUjon.js";import{t as h}from"./centered-state-BgSV4e79.js";import{pr as g}from"./index-lCPcoWSv.js";import{n as _,r as v,t as y}from"./remote-settings-notice-9x62rpqO.js";import{n as b}from"./settings-field-Bhh8I9fJ.js";import{n as x}from"./project-location-l_7MLXzp.js";import{r as S}from"./settings-save-bar-D_OxLOmj.js";import{n as C}from"./saved-draft-BwzBc-_Y.js";var w=e(t(),1),T=n();function E({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,T.jsxs)(T.Fragment,{children:[t===0&&i===null?(0,T.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,T.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,T.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,T.jsxs)(T.Fragment,{children:[`the project’s `,(0,T.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,T.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,T.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,T.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,T.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function D(e,t){let n=e.split(`
|
|
2
2
|
`).map(e=>e.trim()).filter(e=>e!==``),r=Number(t);return{commands:n,timeoutSeconds:r,invalid:n.length>20?`Enter at most 20 commands.`:n.some(e=>e.length>4e3)?`Keep each command under ${f.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${s}.`:null}}var O={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in order in every new task and worker worktree before the agent starts. The first failure stops setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in order in a worker’s worktree when the worker is destroyed, before its processes stop. The first failure stops teardown; destroy goes on and records it on the worker.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`}};function k(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function A({config:e,copy:t}){let n=d(),i=o(),f=v(),p=x(),m=p===null?null:`${p.replace(/\/$/,``)}/.ai/cezar/config.json`,h=i.data?.capabilities?.settingsAdmin===!0,g=e[t.key],y=e[t.issueKey],O=g?.commands??[],A=g?.timeoutSeconds??900,[j,M]=C(O.join(`
|
|
3
3
|
`)),[N,P]=C(String(A)),{commands:F,timeoutSeconds:I,invalid:L}=D(j,N),R=F.length===O.length&&F.every((e,t)=>e===O[t])&&(F.length===0||I===A),z=a({mutationFn:e=>c(e),onSuccess:e=>{n.setQueryData(r.config,e),M(F.join(`
|
|
4
4
|
`))},onError:e=>{u(e.message,{tone:`danger`}),e instanceof l&&e.status===409&&f()}}),B=()=>z.mutateAsync({[t.key]:F.length===0?null:{commands:F,...I===900?{}:{timeoutSeconds:I}}}),[V,H]=(0,w.useState)(null);S({dirty:h&&(y!==null&&y!==V||!R),holdsReload:h&&!R,invalid:L!==null,save:B,discard:()=>{M(O.join(`
|
package/web/dist/index.html
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
})()
|
|
61
61
|
</script>
|
|
62
|
-
<script type="module" crossorigin src="/assets/index-
|
|
62
|
+
<script type="module" crossorigin src="/assets/index-lCPcoWSv.js"></script>
|
|
63
63
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-rHxsej31.js">
|
|
@@ -73,10 +73,13 @@
|
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/run-detail-refresh-CMG0OiqX.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/es2015-CUEfzDjB.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="/assets/label-CqoNP6Yh.js">
|
|
76
|
+
<link rel="modulepreload" crossorigin href="/assets/design-icons-QbNMZniQ.js">
|
|
77
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-BuF3mvCA.js">
|
|
78
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-DudPJH39.js">
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/assets/popover-CvL6hQ5c.js">
|
|
76
80
|
<link rel="modulepreload" crossorigin href="/assets/attention-vW5nmGoK.js">
|
|
77
81
|
<link rel="modulepreload" crossorigin href="/assets/task-groups-COb-xWM_.js">
|
|
78
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/assets/design-icons-QbNMZniQ.js">
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/reference-chip-BkfQoMvT.js">
|
|
80
83
|
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
|
|
81
84
|
<link rel="modulepreload" crossorigin href="/assets/bot-TkDIw4y-.js">
|
|
82
85
|
<link rel="modulepreload" crossorigin href="/assets/external-link-BE6y205O.js">
|
|
@@ -85,8 +88,6 @@
|
|
|
85
88
|
<link rel="modulepreload" crossorigin href="/assets/square-terminal-B6RYYieR.js">
|
|
86
89
|
<link rel="modulepreload" crossorigin href="/assets/button-C8jUIs8Q.js">
|
|
87
90
|
<link rel="modulepreload" crossorigin href="/assets/dist-BSUJIXeE.js">
|
|
88
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-BuF3mvCA.js">
|
|
89
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-DudPJH39.js">
|
|
90
91
|
<link rel="modulepreload" crossorigin href="/assets/dropdown-menu-DjtKUK8F.js">
|
|
91
92
|
<link rel="modulepreload" crossorigin href="/assets/own-lookup-DS54wXvD.js">
|
|
92
93
|
<link rel="modulepreload" crossorigin href="/assets/open-in-menu-CsH3KL0z.js">
|
|
@@ -98,8 +99,7 @@
|
|
|
98
99
|
<link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
|
|
99
100
|
<link rel="modulepreload" crossorigin href="/assets/loader-circle-CPBhhDbB.js">
|
|
100
101
|
<link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
|
|
101
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
102
|
-
<link rel="modulepreload" crossorigin href="/assets/reference-chip-DDv209Ry.js">
|
|
102
|
+
<link rel="modulepreload" crossorigin href="/assets/search-x-I9Q8pgUa.js">
|
|
103
103
|
<link rel="modulepreload" crossorigin href="/assets/dist--f2yFdPY.js">
|
|
104
104
|
<link rel="modulepreload" crossorigin href="/assets/dist-Czz3Y5qH.js">
|
|
105
105
|
<link rel="modulepreload" crossorigin href="/assets/switch-CAKeV99j.js">
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
<link rel="modulepreload" crossorigin href="/assets/agents-settings-path-7X6_cvUg.js">
|
|
119
119
|
<link rel="modulepreload" crossorigin href="/assets/centered-state-BgSV4e79.js">
|
|
120
120
|
<link rel="stylesheet" crossorigin href="/assets/page-shell-DQPYcKyL.css">
|
|
121
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
121
|
+
<link rel="stylesheet" crossorigin href="/assets/index-aGnZVJo_.css">
|
|
122
122
|
</head>
|
|
123
123
|
<body>
|
|
124
124
|
<div id="root"></div>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,Qt as i,S as a,St as o,Ut as s,Wt as c,Xt as l,Yt as u,an as d,g as f,in as p,kt as m,nn as h,un as g,ut as _,wt as v,xt as y}from"./queries-B8INH8MM.js";import{I as b,Or as x,Rn as S,Zt as ee,a as C,n as w,vi as T,vn as E}from"./toaster-Cjr2jC1Q.js";import{c as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./button-C8jUIs8Q.js";import{t as k}from"./switch-CAKeV99j.js";import{t as A}from"./status-dot-BXf-Ubd0.js";import{t as j}from"./centered-state-BgSV4e79.js";import{A as M,M as N,P,Sn as F,jn as I}from"./index-DdN1zBQ0.js";import{t as te}from"./textarea-vEsJAUAV.js";import{t as L}from"./option-select-CdY1rB1x.js";import{a as ne,i as R,n as z,r as B,t as V}from"./settings-agent-picker-D8SLzhIg.js";import{n as H,t as U}from"./save-cue-CpHgT93o.js";import{n as W}from"./settings-field-Bhh8I9fJ.js";import{r as G}from"./settings-save-bar-CwMFlv_U.js";import{n as K}from"./saved-draft-BwzBc-_Y.js";var q=e(t(),1),J=n(),Y={connected:I(`connected`),disconnected:I(`disconnected`),"not-installed":I(`not-installed`),unknown:I(`unknown`)};function X(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function re(e,t){return e?Y[e]:t?{label:`Checking…`,tone:`neutral`}:Y.unknown}function ie(e,t){return e===`unknown`||t&&!e}function ae({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,J.jsx)(`code`,{children:e.loginCommand}),`.`]}):ie(t,r)?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function oe({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`,u=H();return(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{saved:u.saved}),(0,J.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t,u.flash)})]}),l?(0,J.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>w(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,J.jsx)(z,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>w(`${e.displayName} can be tried again.`),onError:e=>w(e.message,{tone:`danger`})}),children:`Try again`})]})}function se({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,J.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,J.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.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,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ce(){let e=h(),t=o(),n=v(),r=m(),i=T(),[a,s]=(0,q.useState)(null),d=(0,q.useRef)(Promise.resolve()),f=(0,q.useRef)({}),_=(0,q.useRef)({}),y=(0,q.useRef)(t.data);(0,q.useEffect)(()=>{a&&x(t.data,a.provider)?.status===`connected`&&s(null)},[a,t.data]),(0,q.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!y.current){y.current=t.data;return}y.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?x(y.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let b=(0,q.useCallback)((e,t,n)=>{let r=c.providerStatus,a=i.getQueryData(r);if(!a)return;y.current||=a;let o=X(a,e,t);_.current[e]=(_.current[e]??0)+1,i.setQueryData(r,o);let s=(f.current[e]??0)+1;f.current[e]=s,d.current=d.current.then(async()=>{try{let a=await E(e,t),o=x(a,e)?.enabled;if(o===void 0)return;if(y.current=X(y.current??a,e,o),s===f.current[e]){let t=i.getQueryData(r);i.setQueryData(r,t?X(t,e,o):a),n()}}catch(t){if(s===f.current[e]){let n=x(y.current,e)?.enabled,a=i.getQueryData(r);a&&n!==void 0?i.setQueryData(r,X(a,e,n)):y.current?i.setQueryData(r,y.current):i.removeQueries({queryKey:r,exact:!0}),w(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[i]),C=g({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{s(null),w(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await i.invalidateQueries({queryKey:c.providerStatus}),await p(i,t,`none`)},onError:(t,n)=>{if(t instanceof S&&t.command){let r=u(e.data,n);s({provider:n,label:r,message:t.message,command:t.command});return}w(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),w(`Command copied`)}catch{w(`Could not copy the command`,{tone:`danger`})}};return(0,J.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,J.jsxs)(`div`,{className:`mb-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,J.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,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:l(e.data).map(e=>{let i=x(t.data,e.id),o=i?.status,s=re(o,t.isPending),c=C.isPending&&C.variables===e.id,l=i?.authFailureId;return(0,J.jsxs)(q.Fragment,{children:[(0,J.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,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{tone:s.tone,pulse:t.isPending}),(0,J.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,J.jsx)(`span`,{children:`Disabled`}):null]}),(0,J.jsx)(ae,{provider:e,state:o,current:i,statusIsError:t.isError})]}),(0,J.jsx)(oe,{provider:e,state:o,current:i,isConnecting:c,incidentId:l,refresh:n,connect:C,retry:r,queueToggle:b})]}),l===void 0?null:(0,J.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,J.jsx)(se,{manual:a,provider:e.id,connected:o===`connected`,onCopy:D})]},e.id)})})]})}var Z=2e4;function le(){let e=f(),t=h(),n=d(i(t.data)),r=o();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,J.jsx)(j,{icon:(0,J.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(ue,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function ue({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=T(),c=g({mutationFn:e=>b(e),onSuccess:e=>{o.setQueryData(s.config,e),o.invalidateQueries({queryKey:s.health}),o.invalidateQueries({queryKey:s.repo})},onError:e=>w(e.message,{tone:`danger`})}),[u,d]=K(e.systemPrompt??``),f=u.trim(),p=f===(e.systemPrompt??``),m=f.length>Z;G({dirty:!p,invalid:m,busy:c.isPending,save:()=>c.mutateAsync({systemPrompt:f===``?null:f}),discard:()=>d(e.systemPrompt??``)});let h=H(),_=H(),v=H(),y=H(),x=H(),S=(e,t)=>c.mutate(e,{onSuccess:t});return(0,J.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,J.jsx)(Q,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,saved:h.saved,onSaved:h.flash,onPick:e=>S({defaultRunner:e},h.flash)}),(0,J.jsx)(W,{wide:!0,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. Runner default lets the runner decide per task.`,saved:e.modelsLocked?void 0:_.saved,children:(0,J.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:l(r).map(i=>{let{providerConnected:a,providerReason:o}=ne(n,i.id),s=t[i.id],l=N(i.id,r,s),u=P(i.id,r,s?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`Runner default`;return(0,J.jsxs)(`label`,{className:`settings-option-row`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,J.jsx)(`output`,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.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,J.jsx)(L,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:c.isPending||!a,onValueChange:e=>S({defaultModels:{[i.id]:e||null}},_.flash),className:`settings-select max-w-full bg-card`,options:[...u.map(e=>({value:e.id,label:e.label})),...l?[{value:M,label:l,disabled:!0}]:[]]})]},i.id)})})}),(0,J.jsxs)(W,{wide:!0,title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,J.jsx)(te,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,J.jsx)(de,{length:f.length,overLimit:m})]}),(0,J.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,J.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.`,saved:v.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>S({liveTitleUpdates:e},v.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,J.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.`,saved:y.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>S({reviewGate:e},y.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,saved:x.saved,children:i.data?.info?(0,J.jsx)(L,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onValueChange:e=>S({baseBranch:e||null},x.flash),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...i.data.branches.map(e=>({value:e,label:e}))]}):(0,J.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:i.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,J.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,J.jsx)(`summary`,{children:`Provider connections`}),(0,J.jsx)(ce,{})]})]})}function Q({defaultRunner:e,providerStatus:t,saving:n,saved:i,onSaved:o,onPick:s}){let c=_(),l=y(),u=C(),d=a(),f=r(),p=u.projectId??`default`,m=d.data?.info?.root,g=F(c.data,u.projectId,m),v=h().data,b=B(c.data?.profiles??[],v),S=R(b,v);return(0,J.jsxs)(W,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,saved:i,children:[(0,J.jsx)(V,{rows:b,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:f.isPending||l.data===void 0,onPick:(t,n,r)=>{t!==e&&s(t),r&&f.mutate({projectId:p,provider:t,profileId:n},{onSuccess:o,onError:e=>w(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&x(t.data,e)?.enabled===!1?(0,J.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,S?(0,J.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 $({title:e,hint:t,saved:n,children:r}){return(0,J.jsxs)(`section`,{className:`settings-option-row`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{children:e}),(0,J.jsxs)(`p`,{children:[t,` `,(0,J.jsx)(U,{saved:n})]})]}),r]})}function de({length:e,overLimit:t}){return(0,J.jsx)(J.Fragment,{children:t?(0,J.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Z.toLocaleString(),`.`]}):(0,J.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.`})})}export{le as AgentDefaultsSection};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Rn as i}from"./toaster-Cjr2jC1Q.js";import{M as a,Q as o,ct as s,r as c}from"./design-icons-QbNMZniQ.js";import{n as l,r as u}from"./diff-controls-BdfWJmNM.js";import{l as d}from"./reference-chip-DDv209Ry.js";import{t as f}from"./button-C8jUIs8Q.js";import{t as p}from"./project-router-DvfVUjon.js";import{m}from"./page-shell-Dky5crRl.js";import{t as h}from"./centered-state-BgSV4e79.js";import{Gt as g,In as _,Wt as v,ir as y,s as b,zn as x}from"./index-DdN1zBQ0.js";import{t as S}from"./diff-DYxPunyH.js";var C=e(t(),1),w=n();function T({commit:e,sha:t,slot:n,heading:o=`h2`,diffRef:c,loadFileText:f,className:p}){let g=m(),[y,b]=(0,C.useState)(`unified`),[T,D]=(0,C.useState)(!0),O=(0,C.useRef)(null);E(O,t);let k=e.isError&&e.error instanceof i&&e.error.status===409;return(0,w.jsx)(`section`,{ref:O,"data-slot":n,"data-sha":t,"aria-label":`Selected commit`,className:r(`min-w-0 flex-1 scroll-mt-4 overflow-clip rounded-xl border border-border bg-card`,p),children:e.isPending?(0,w.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):e.isError?(0,w.jsx)(h,{icon:k?(0,w.jsx)(d,{}):(0,w.jsx)(s,{size:16}),tone:k?`neutral`:`danger`,heading:`h2`,title:k?`Commit not found`:`Could not load commit diff`,subtitle:e.error.message}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{"data-slot":`commit-meta`,className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(o,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:e.data.subject}),(0,w.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{children:e.data.author}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{title:e.data.when,children:v(e.data.when)}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(x,{sha:e.data.sha,variant:`inline`}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,w.jsx)(_,{stat:e.data.stat})})]})]}),(0,w.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,w.jsx)(u,{mode:y,wrap:T,onModeChange:b,onWrapChange:D}),(0,w.jsx)(l,{wrap:T,onWrapChange:D})]})]}),e.data.files.length===0?(0,w.jsx)(h,{icon:(0,w.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,w.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px]`,children:(0,w.jsx)(S,{...c?{viewRef:c}:{},...f?{loadFileText:f}:{},files:e.data.files,mode:g?y:`unified`,wrap:T,totals:!1,className:`min-w-0`},t)})]})})}function E(e,t){let n=(0,C.useRef)(t);(0,C.useLayoutEffect)(()=>{if(n.current===t)return;n.current=``;let r=e.current,i=r?.closest(`[data-slot="main"]`);if(!(!r||!i)&&r.getBoundingClientRect().top<i.getBoundingClientRect().top){let e=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView?.({block:`start`,behavior:e?`auto`:`smooth`})}},[e,t])}function D({commit:e,sha:t,backTo:n,backLabel:r,slot:i,loadFileText:a}){return(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,w.jsx)(`div`,{className:`mx-4 border-b border-border py-2`,children:(0,w.jsx)(f,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,w.jsxs)(p,{to:n,children:[(0,w.jsx)(c,{size:16,"aria-hidden":`true`}),r]})})}),(0,w.jsx)(T,{commit:e,sha:t,slot:i,loadFileText:a,className:`rounded-none border-0 bg-transparent`})]})}var O=56;function k({slot:e,commits:t,selectedSha:n,className:i,heading:a}){let[s,c]=(0,C.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,C.useRef)(null),p=(0,C.useRef)(null),[m,h]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=f.current,t=p.current;!e||!t||h(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]);let g=u.map(e=>(0,w.jsx)(A,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,w.jsx)(o,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(y,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:s,onChange:e=>c(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{f.current=e,e&&(p.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":d,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-3 py-1 md:px-4`,i),children:[a?(0,w.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:a}):null,u.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,w.jsx)(b,{scrollRef:p,startMargin:m,itemSize:O,children:g}):g]})]})}function A({commit:e,selected:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,w.jsxs)(p,{"data-slot":`commit-row`,"data-sha":e.sha,"data-selected":t?`true`:void 0,"aria-current":t?`true`:void 0,to:e.href,className:r(`flex min-h-11 min-w-0 items-start gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-muted`,t&&`bg-muted/70`),children:[(0,w.jsx)(a,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,w.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`span`,{"data-slot":`commit-row-subject`,title:e.subject,className:`line-clamp-2 text-[13px] leading-snug font-medium break-words text-foreground`,children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(j,{sha:e.sha}),(0,w.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,w.jsx)(`span`,{title:g(e.when,e.at),children:v(e.when,e.at)})]}),e.stat?(0,w.jsx)(_,{stat:e.stat}):null]})]})]})})}function j({sha:e}){return(0,w.jsx)(x,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{T as i,j as n,D as r,k as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{$t as t,Jt as n,Qt as r,Xt as i,Yt as a,Zt as o,en as s,qt as c}from"./index-DdN1zBQ0.js";var l=e();function u({open:e,subject:u,onKeep:d,onDiscard:f}){return(0,l.jsx)(c,{open:e,onOpenChange:e=>!e&&d(),children:(0,l.jsxs)(i,{"data-slot":`discard-changes-dialog`,className:`sm:max-w-[560px]`,children:[(0,l.jsxs)(t,{children:[(0,l.jsx)(s,{children:`Discard unsaved changes?`}),(0,l.jsxs)(o,{children:[`Your edits to `,(0,l.jsx)(`span`,{className:`font-medium text-foreground`,children:u}),` are not saved. They are lost if you continue.`]})]}),(0,l.jsxs)(r,{children:[(0,l.jsx)(a,{"data-slot":`discard-changes-keep`,children:`Keep editing`}),(0,l.jsx)(n,{"data-slot":`discard-changes-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:f,children:`Discard changes`})]})]})})}export{u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,p as i}from"./dist-C_rn70hE.js";import{O as a,Ut as o,a as s,c,i as l,j as u,n as d,o as f,r as p,sn as m,un as h}from"./queries-B8INH8MM.js";import{G as g,J as _,Nn as v,R as ee,Ti as y,Y as b,n as x,q as S,vi as C}from"./toaster-Cjr2jC1Q.js";import{f as w,h as te}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{I as T,L as ne,Q as re,Z as E,ct as D,i as O,l as k,m as A,r as j,u as M,ut as ie}from"./design-icons-QbNMZniQ.js";import{t as ae}from"./chevron-down-CHGyCDBH.js";import{t as N}from"./chevron-right-BENZ-1ZN.js";import{t as P}from"./loader-circle-CPBhhDbB.js";import{t as F}from"./play-CmVAj_fu.js";import{t as I}from"./button-C8jUIs8Q.js";import{a as oe,i as se,n as ce,r as L,t as le}from"./select-B27amFsE.js";import{i as R,r as z,t as B}from"./popover-CvL6hQ5c.js";import{r as ue,t as V}from"./project-router-DvfVUjon.js";import"./attention-vW5nmGoK.js";import{f as de,v as fe}from"./task-groups-COb-xWM_.js";import{t as pe}from"./status-dot-BXf-Ubd0.js";import{c as H,d as U,f as me,m as he}from"./page-shell-Dky5crRl.js";import{a as ge,o as _e,r as ve,s as ye,t as be}from"./command-BiBq24zL.js";import{t as W}from"./centered-state-BgSV4e79.js";import{t as xe}from"./use-search-params-writer-ClMScnNe.js";import{At as Se,Ct as Ce,Dt as we,En as G,Et as Te,Ot as Ee,Pn as De,Rn as Oe,St as ke,Tt as K,Wn as Ae,_t as je,bt as Me,ct as Ne,gt as Pe,jt as Fe,kt as Ie,nr as Le,r as Re,s as ze,vt as Be,wt as Ve,xt as He,yt as Ue}from"./index-DdN1zBQ0.js";import{t as We}from"./markdown-CiWKjopy.js";import{a as Ge,c as Ke,d as qe,f as q,i as Je,l as Ye,m as Xe,n as Ze,o as Qe,p as $e,r as et,s as tt,t as nt}from"./use-hand-to-agent-state-CvkdAvTh.js";import{t as rt}from"./tab-link-D97ij5JR.js";var J=e(t(),1),Y=n();function it({number:e,repo:t}){let n=i();return(0,Y.jsx)(at,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function at({number:e,repo:t,scope:n}){let i=(0,J.useId)(),a=(0,J.useId)(),[o,s]=(0,J.useState)(!1),c=o?ae:N,l=m(n,!0,n==="default"),d=u(`#${e}`,!0),f=(0,J.useMemo)(()=>Ee(fe(l.data??[],d.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[l.data,d.data,e,t,n]);return(0,Y.jsxs)(`section`,{"aria-labelledby":i,className:r(`mt-4 min-w-0 rounded-lg border border-border`,o?`p-3`:`p-0.5`),children:[(0,Y.jsx)(`h3`,{id:i,className:`text-xs font-semibold text-muted-foreground`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Y.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Y.jsxs)(`span`,{children:[`Linked tasks`,l.data?` (${f.length}${d.hasNextPage||d.isError?`+`:``})`:``]})]})}),(0,Y.jsx)(`div`,{id:a,children:o?(0,Y.jsxs)(Y.Fragment,{children:[l.isPending?(0,Y.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,l.isError?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,Y.jsx)(I,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void l.refetch(),disabled:l.isFetching,children:`Retry linked tasks`})]}):null,l.data&&f.length===0&&!l.isError?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,f.length>0?(0,Y.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:f.map(e=>{let t=De(e,v(e));return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(V,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:de(e)}),(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(pe,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,Y.jsx)(Re,{"data-slot":`linked-task-archived`,dot:G.tone,shape:G.shape,className:`px-2 py-px`,children:G.label}):null,(0,Y.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,d.isError?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,Y.jsx)(I,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry older linked tasks`})]}):d.hasNextPage?(0,Y.jsx)(I,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:d.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var ot=`w-44 max-w-full`,X=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-ring disabled:opacity-60`,Z=`__all__`;function st(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function ct(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function lt(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function ut(e){return[e.viewerLogin?``:`GitHub login unavailable.`,lt(e)].filter(Boolean).join(` `)}function dt({options:e,assignees:t,onAssigneesChange:n}){return(0,Y.jsxs)(B,{children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:`${X} inline-flex items-center gap-1.5`,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,Y.jsx)(M,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,Y.jsx)(z,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Y.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Y.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Y.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Y.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function ft({data:e,projectId:t,onProjectChange:n,pickerRef:r}){if(e.projects?.length)return(0,Y.jsxs)(le,{value:t||Z,onValueChange:e=>n(e===Z?``:e),children:[(0,Y.jsx)(se,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":t,className:`${X} ${ot} justify-between`,children:(0,Y.jsx)(oe,{placeholder:`All boards`})}),(0,Y.jsxs)(ce,{align:`start`,children:[(0,Y.jsx)(L,{value:Z,children:`All boards`}),e.projects.map(e=>(0,Y.jsx)(L,{value:e.id,"data-board":e.id,children:e.title},e.id))]})]});if(e.projects||e.projectsState){let t=e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`;return(0,Y.jsxs)(le,{disabled:!0,value:Z,children:[(0,Y.jsx)(se,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":``,className:`${X} ${ot} justify-between`,children:(0,Y.jsx)(oe,{placeholder:t,children:t})}),(0,Y.jsx)(ce,{align:`start`,children:(0,Y.jsx)(L,{value:Z,children:t})})]})}return null}function pt({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,Y.jsxs)(B,{open:i,onOpenChange:a,children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsx)(`button`,{ref:o,type:`button`,className:`${X} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,Y.jsx)(E,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,Y.jsx)(D,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,Y.jsx)(z,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function mt({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=st(e.issues,t),f=ct(e.viewerLogin,t),p=ut(e),m=p!==``,h=(0,J.useRef)(p);m&&(h.current=p);let g=(0,J.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,J.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,J.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,Y.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,Y.jsx)(dt,{options:d,assignees:t,onAssigneesChange:r}),(0,Y.jsxs)(`button`,{ref:u,type:`button`,"data-slot":`gh-assigned-me`,className:`${X} inline-flex items-center gap-1.5 rounded-full aria-pressed:border-accent-strong aria-pressed:bg-accent-strong aria-pressed:text-accent-strong-foreground aria-pressed:hover:bg-accent-strong`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:[(0,Y.jsx)(ie,{size:14,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Assigned to me`]}),(0,Y.jsx)(ft,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,Y.jsx)(pt,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function ht({onRefresh:e,refreshing:t}){let n=Pe(i());return(0,Y.jsx)(U,{route:`github`,density:`full`,headerSpacing:`compact`,header:{title:`GitHub`,secondaryActions:(0,Y.jsx)(H,{type:`button`,variant:`ghost`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,children:(0,Y.jsx)(E,{size:17,"aria-hidden":`true`,className:r(`size-[17px]`,t&&`motion-safe:animate-spin`)})})},children:(0,Y.jsx)(`div`,{"data-slot":`github-filter-screen`,children:(0,Y.jsx)(je,{model:n,variant:`screen`})})})}function gt({view:e,activeFilter:t,isDesktop:n,listInUrl:r,n:i,gh:a,actions:o}){return{headerSlot:`gh-masthead`,title:n?e===`issues`?`Issues`:`Pull requests`:`GitHub`,scope:n?Be[t]:void 0,scopeSlot:`gh-title-qualifier`,subtitle:a.repo?(0,Y.jsxs)(`span`,{className:`block min-w-0 truncate`,children:[(0,Y.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,Y.jsxs)(`span`,{"data-slot":`gh-synced`,title:a.syncedAt?new Date(a.syncedAt).toLocaleString():void 0,children:[` `,`· `,a.syncedAt?(0,Y.jsx)(Oe,{iso:a.syncedAt,prefix:`Synced `}):`Not synced yet`]})]}):void 0,secondaryActions:(0,Y.jsx)(_t,{...o}),headerExtra:r&&i===void 0?(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`mt-1 flex min-w-0 items-center gap-3 md:hidden`,children:[(0,Y.jsxs)(V,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(j,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,Y.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-muted-foreground`,children:[...He,...ke].find(e=>e.id===t)?.label})]}):void 0}}function _t({automationsAvailable:e,refreshing:t,onRefresh:n}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-page-actions`,className:`flex shrink-0 flex-wrap items-center gap-2`,children:[e?(0,Y.jsx)(H,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(V,{to:`/automations/new`,children:`Set up automations`})}):null,(0,Y.jsxs)(H,{type:`button`,variant:`outline`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:t,onClick:n,children:[(0,Y.jsx)(E,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,t&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function vt({view:e,number:t}){return(0,Y.jsx)(W,{icon:e===`issues`?(0,Y.jsx)(A,{size:16}):(0,Y.jsx)(T,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Go back to the list and search for ${t} to look it up on GitHub, closed and merged included.`})}function yt({item:e,view:t,filter:n,narrows:i,colors:a,expanded:s,onToggle:c,queuedRunId:l,checks:u,comments:d}){let f=e.kind===`issue`?A:T,p=C(),m=`gh-row-summary-${e.kind}-${e.number}`,h=()=>{p.prefetchQuery({queryKey:o.githubComments(e.kind,e.number),queryFn:({signal:t})=>_(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Y.jsxs)(`div`,{"data-slot":`gh-row-shell`,"data-expanded":s||void 0,className:r(`rounded-md`,s&&`bg-sidebar-row-selected`),children:[(0,Y.jsxs)(`button`,{type:`button`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,et(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:h,onFocus:h,onClick:c,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-expanded":s,"aria-controls":s?m:void 0,title:`Drag into the composer to prefill a task`,className:`flex w-full flex-col gap-2 rounded-md px-3 py-4 text-left transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:-outline-offset-2`,children:[(0,Y.jsxs)(`span`,{className:`flex w-full min-w-0 items-start gap-2 md:items-center`,children:[(0,Y.jsx)(f,{"aria-hidden":`true`,"data-slot":`gh-row-icon`,className:r(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Y.jsx)(`span`,{"data-slot":`gh-row-title`,className:r(`line-clamp-2 min-w-0 flex-1 text-[13px] font-medium md:block md:truncate`,s&&`font-semibold`),children:e.title}),(0,Y.jsx)(M,{"data-slot":`gh-row-cue`,"aria-hidden":`true`,className:r(`mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none md:mt-0`,s&&`rotate-180`)})]}),(0,Y.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 pl-[22px] text-xs text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,Y.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[`#`,e.number]}),(0,Y.jsx)(Q,{}),(0,Y.jsx)(`span`,{"data-slot":`gh-row-author`,className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Y.jsx)(Q,{}),(0,Y.jsx)(Oe,{iso:e.createdAt,className:`shrink-0`}),d?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(Qe,{count:d})]}):null,u?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(Ge,{checks:u})]}):null,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`shrink-0 font-sans font-medium text-accent-text`,children:`↗ run queued`})]}):null]}),e.labels.length>0&&!s?(0,Y.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Y.jsx)(Ye,{label:e,color:a[e],plain:!0},e))}):null]}),s?(0,Y.jsx)(bt,{id:m,item:e,colors:a,checks:u,detailPath:Ve(t,n,e.number,``,i),queuedRunId:l}):null]})}function bt({id:e,item:t,colors:n,checks:r,detailPath:i,queuedRunId:a}){let o=l(t.kind,t.number),s=(o.data?.detail?.body??t.body)?.trim(),c=t.kind===`pr`?`PR`:`issue`;return(0,Y.jsxs)(`div`,{id:e,"data-slot":`gh-row-summary`,className:`flex flex-col gap-3 px-3 pb-4 md:pl-[34px]`,children:[(0,Y.jsx)(`div`,{"data-slot":`gh-row-body`,className:`text-[13px] leading-relaxed text-soft-foreground`,children:s?(0,Y.jsx)(`div`,{"data-slot":`gh-row-excerpt`,inert:!0,className:xt,children:(0,Y.jsx)(We,{document:!0,children:s})}):o.isPending?(0,Y.jsx)(Le,{className:`h-4 w-2/3`}):o.isError||o.data?.available===!1?(0,Y.jsx)(`p`,{"data-slot":`gh-row-body-unavailable`,className:`text-muted-foreground`,children:`Description unavailable. Use Refresh to try again.`}):(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),t.labels.length>0||r?(0,Y.jsxs)(`div`,{"data-slot":`gh-row-facts`,className:`flex flex-wrap items-center gap-1.5`,children:[t.labels.map(e=>(0,Y.jsx)(Ye,{label:e,color:n[e]},e)),r?(0,Y.jsx)(Je,{checks:r,url:t.url}):null]}):null,(0,Y.jsxs)(`div`,{"data-slot":`gh-row-actions`,className:`flex flex-wrap items-center gap-2`,children:[a?(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,className:`max-md:h-11`,children:(0,Y.jsxs)(V,{to:`/tasks/${a}`,"data-action":`gh-row-view-task`,children:[(0,Y.jsx)(k,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,Y.jsx)(I,{asChild:!0,variant:`primary`,size:`sm`,className:`max-md:h-11`,children:(0,Y.jsxs)(V,{to:i,state:{focusHandoff:!0},"data-action":`gh-row-handoff`,title:`Open this ${c} and write the prompt for an agent`,children:[(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}),(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,className:`max-md:h-11`,children:(0,Y.jsxs)(V,{to:i,"data-action":`gh-row-open`,children:[`Open `,c,(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`})]})})]})]})}var xt=r(`max-h-[calc(3lh)] overflow-hidden [overflow-wrap:anywhere]`,`[&_*]:!my-0 [&_p+*]:!mt-1 [&_ul]:list-inside [&_ol]:list-inside`,`[&_:is(h1,h2,h3,h4,h5,h6,pre,img,table,hr,[data-streamdown="code-block"],[data-streamdown="table-wrapper"],[data-streamdown="image-wrapper"],[data-streamdown="mermaid-block"])]:hidden`);function Q(){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-dot`,"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function St(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function Ct(e){let[t,n]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(St(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function wt(e,t){let[n,r]=(0,J.useState)(0);return(0,J.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function Tt(e,t,n){let[r,i]=(0,J.useState)(null),a=(0,J.useRef)(n);return(0,J.useEffect)(()=>{a.current=n}),(0,J.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function Et(e,t,n,r,i){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=Ct(a),u=(0,J.useRef)(null);u.current=l;let d=wt(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:Tt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}function Dt({item:e,queuedRunId:t}){return t?(0,Y.jsx)(I,{asChild:!0,variant:`outline`,size:`sm`,className:`max-md:h-11 no-hover:h-11`,children:(0,Y.jsxs)(V,{to:`/tasks/${t}`,"data-action":`gh-header-view-task`,children:[(0,Y.jsx)(k,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,Y.jsxs)(I,{type:`button`,variant:`primary`,size:`sm`,"data-action":`gh-header-handoff`,title:`Write the prompt and pick the workflow and runner for this ${e.kind===`pr`?`PR`:`issue`}`,className:`max-md:h-11 no-hover:h-11`,onClick:$,children:[(0,Y.jsx)(F,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}function $(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}var Ot=100;function kt(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=Ot)break;a.add(t.number)}return[...a]}function At(e,t,n,r,i,a){let o=kt(n,e,r,i,a),s=d(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=p(e===`issues`?`issue`:`pr`,(0,J.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,J.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function jt(e){let[t,n]=xe(),r=t.get(`filter`),i=Ie(e,r),a=i??`all`,o=e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n}),s=K(t);return{rawFilterParam:r,filter:i,activeFilter:a,setFilterParam:o,narrows:s,url:(0,J.useMemo)(()=>{let t=new URLSearchParams(s);return{query:t.get(`q`)??``,labels:t.getAll(`label`),assignees:e===`issues`?t.getAll(`assignee`):[],board:e===`issues`?t.get(`board`)??``:``}},[s,e]),writeNarrows:(0,J.useCallback)(e=>n(t=>{let n=e(t);return(t.has(`filter`)||K(t)!==``)&&!n.has(`filter`)&&K(n)===``&&n.set(`filter`,`all`),n}),[n])}}function Mt(e,t){return n=>{let r=new URLSearchParams(n);r.delete(e);for(let n of t)r.append(e,n);return r}}function Nt(e,t,{rawFilterParam:n,filter:r,activeFilter:i,setFilterParam:a,narrows:o,url:s,writeNarrows:c}){let l=Ft(s.query,n!==null||o!==``,c),{query:u,setQuery:d}=l,f=s.labels,p=s.assignees,m=e=>c(Mt(`label`,e)),{setProjectFilter:h,activeProject:g}=It(t,s.board,c),_=e===`issues`&&i===`assigned`,v=_?t?.viewerLogin?[t.viewerLogin]:[]:p;return{query:u,setQuery:d,labelFilter:f,setLabelFilter:m,setProjectFilter:h,activeProject:g,isAssignedFilter:_,effectiveAssignees:v,changeAssignees:e=>{c(Mt(`assignee`,e)),_&&a(`all`)},clearFilters:()=>{l.clear(),c(e=>{let t=new URLSearchParams(e);for(let e of Me)t.delete(e);return r!==null&&r!==`all`&&t.set(`filter`,`all`),t})},filtering:u.trim()!==``||f.length>0||e===`issues`&&(v.length>0||g!==``)||r!==null&&r!==`all`,narrowing:u.trim()!==``||f.length>0||e===`issues`&&(!_&&p.length>0||g!==``)}}var Pt=250;function Ft(e,t,n){let r=`${w().pathname}${t?``:`#entry`}`,[i,a]=(0,J.useState)(e),o=(0,J.useRef)(e),s=(0,J.useRef)(void 0),c=(0,J.useRef)(r);return(0,J.useEffect)(()=>{e===o.current&&r===c.current||(clearTimeout(s.current),c.current=r,o.current=e,a(e))},[e,r]),(0,J.useEffect)(()=>()=>clearTimeout(s.current),[]),{query:i,setQuery:e=>{a(e),clearTimeout(s.current),s.current=setTimeout(()=>{let t=e.trim();o.current=t,n(e=>{let n=new URLSearchParams(e);return t===``?n.delete(`q`):n.set(`q`,t),n})},Pt)},clear:()=>{clearTimeout(s.current),o.current=``,a(``)}}}function It(e,t,n){let r=e=>n(t=>{let n=new URLSearchParams(t);return e===``?n.delete(`board`):n.set(`board`,e),n}),i=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,a=i||e?.projects?.some(e=>e.id===t)===!0,o=e?.available===!0&&!i&&t!==``&&!a,[s,c]=(0,J.useState)(``);s!==``&&s!==t&&c(``),o&&s!==t&&c(t);let l=o||s!==``&&s===t,u=a&&!l?t:``;return(0,J.useEffect)(()=>{l&&n(e=>{let t=new URLSearchParams(e);return t.delete(`board`),t})},[l,n]),{setProjectFilter:r,activeProject:u}}function Lt(e,t,{filter:n,activeFilter:r},a){let o=i(),s=e===`issues`&&(r===`no-task`||r===`has-task`),l=m(o,s,o==="default"),u=(0,J.useMemo)(()=>l.data?we(l.data,t?.repo,o):null,[l.data,t?.repo,o]),d=Te(e,n)?Fe(n):null,f=c(`pr`,d??``,d!==null&&t?.available===!0),p=d!==null&&f.data?.available?f.data.items:null,h=(0,J.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),g=(0,J.useMemo)(()=>p?Se(p,h):null,[p,h]),_=Rt({view:e,gh:t,activeFilter:r,isAssignedFilter:a,taskFilter:s,taskNumbers:u,runsQuery:l,backedQuery:d,filterHits:p,filterSearch:f});return{backedQuery:d,filterSearch:f,fullList:h,filterRows:g,filterGate:_,openItems:(0,J.useMemo)(()=>_?[]:g??h,[_,g,h]),narrow:(0,J.useMemo)(()=>e===`issues`?r===`no-task`&&u?{excludeNumbers:u}:r===`has-task`&&u?{includeNumbers:u}:{}:r===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:p?{includeNumbers:new Set(p.map(e=>e.number))}:{},[e,r,u,t?.viewerLogin,p])}}function Rt({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function zt(e,t){return t?b(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function Bt(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let s=o.github()[0],c=t===void 0?null:Number.parseInt(t,10),l=!r&&n.data?.available?n.data.items.find(e=>e.number===c):void 0,u=i&&c!==null&&!a.some(e=>e.number===c)?i.find(e=>e.number===c):void 0,d=l??u,[f,p]=(0,J.useState)(null);return(0,J.useEffect)(()=>{d&&p({scope:s,view:e,item:d})},[s,e,d]),{selectedNumber:c,remoteDetail:d??(f?.scope===s&&f.view===e&&f.item.number===c?f.item:null)}}function Vt(e,t,n,{fullList:r,filterRows:i},a){let c=C(),l=(0,J.useRef)(null),u=e===`issues`?`issue`:`pr`,d=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,f=s(u,n??0,d),p=d&&f.data?.available&&f.data.item?.kind===u?f.data.item:null;l.current=d&&n!==null?{kind:u,number:n,key:o.githubItem(u,n)}:null;let[m,h]=(0,J.useState)(!1);return{exactWanted:d,exactItem:f,exactDetail:p,exactTargetRef:l,retryingExact:m,retryExact:()=>{h(!0),zt(c,l.current).then(e=>{h(!1),e||x(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function Ht(e,t,n){let r=C(),i=(0,J.useRef)(null);return{refresh:h({mutationFn:e=>(zt(r,e),g({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:o.githubPages(50),exact:!0}),r.setQueryData(o.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:o.githubChecks(t)});let s=e===`issues`?`issue`:`pr`,c=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=o.githubCommentCounts(s,c);r.removeQueries({queryKey:o.githubCommentCounts(s,[]).slice(0,4),predicate:e=>e.queryHash!==y(l)}),a.available&&a.commentsDeferred&&c.length>0&&S(s,c,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:o.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:o.githubSearch(`pr`,Ce)}),r.invalidateQueries({queryKey:o.githubSearch(`pr`,Ue)});let u=i.current,d=o.githubComments(`issue`,0).slice(0,3);if(!u){r.removeQueries({queryKey:d});return}let f=o.githubComments(u.kind,u.number);_(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:d,predicate:e=>e.queryHash!==y(f)})},onError:e=>x(e.message,{tone:`danger`})}),openThreadRef:i}}var Ut=350;function Wt(e,t){let[n,r]=(0,J.useState)(e);return(0,J.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Gt(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:l}){let u=Wt(n,Ut),d=(0,J.useMemo)(()=>q(o,{query:u,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,u,r,e,i,a,s]),f=n.trim()===u.trim(),p=t?.available===!0&&!l&&f&&Xe(u,d),m=c(e===`issues`?`issue`:`pr`,u,p),h=q(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),g=p&&m.data?.available?m.data:null,_=new Set(h.map(e=>e.number)),v=Kt(e,g,a,i);return{debouncedQuery:u,searchWanted:p,forgeSearch:m,items:h,searchPayload:g,metadataFailure:v,searchHits:g&&!v?q(g.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!_.has(e.number)):[],...qt(n,f,p,m)}}function Kt(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function qt(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function Jt({view:e,changes:t=!1,index:n=!1}){let{n:r}=te(),i=jt(e),{rawFilterParam:o,activeFilter:s,narrows:c}=i,l=o!==null||c!==``,u=he(),{pages:d,data:p}=f(50),m=Ae(),h=Xt(),g=nt(),_=Yt({index:n,isDesktop:u,listInUrl:l,n:r,rememberedView:a().data?.githubView}),[v,ee]=(0,J.useState)(null),y=Nt(e,p,i),b=Lt(e,p,i,y.isAssignedFilter),x=Gt(e,p,y,b),S=Bt(e,r,x.forgeSearch,b),C=Vt(e,p,S.selectedNumber,b,S.remoteDetail),w=At(e,d,p,S.selectedNumber,x.searchHits,b.openItems),{refresh:T,openThreadRef:ne}=Ht(e,w.checkPrNumbers,x.debouncedQuery),re=Et(e,d,p,b.backedQuery,y.narrowing);if(_.restorePrs)return(0,Y.jsx)(ue,{to:`/github/prs`,replace:!0});if(!p)return d.isError?(0,Y.jsx)(U,{route:`github`,density:`empty`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(D,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:d.error.message})}):(0,Y.jsx)(Ne,{});ne.current=null;let E=()=>T.mutate(C.exactTargetRef.current);if(_.filterScreen&&p.available)return(0,Y.jsx)(ht,{onRefresh:E,refreshing:T.isPending});if(!p.available)return(0,Y.jsx)(tn,{reason:p.reason,refreshing:T.isPending,onRetry:E});let{labelColors:O,labelOptions:k}=Zt(p,x.searchPayload,b.openItems,b.fullList),A=Qt({number:S.selectedNumber,fullList:b.fullList,filterRows:b.filterRows,remoteDetail:S.remoteDetail,exactDetail:C.exactDetail}),j=r===void 0?[...x.items,...x.searchHits].find(e=>e.url===v)??null:null,M=A??j;ne.current=M?{kind:M.kind,number:M.number}:null;let{linkFilter:ie,listPath:ae}=$t(e,o,s,u,c),N={view:e,filter:ie,narrows:c,colors:O,expandedUrl:j?.url??null,onToggle:e=>ee(t=>t===e.url?null:e.url),queued:g.queued,checksMap:w.checksMap,commentsOf:w.commentsOf},P=en(e,y,b.filterGate,x),F=gt({view:e,activeFilter:s,isDesktop:u,listInUrl:l,n:r,gh:p,actions:{automationsAvailable:m,refreshing:T.isPending,onRefresh:E}});return r===void 0?(0,Y.jsxs)(U,{route:`github`,density:me(x.items.length+x.searchHits.length),headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,bodyClassName:`gap-2.5`,header:F,children:[(0,Y.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-4`,children:[(0,Y.jsx)(nn,{view:e,isDesktop:u,gh:p,onSaveView:h}),(0,Y.jsx)(rn,{view:e,gh:p,filters:y,labelOptions:k,labelColors:O,searchPayload:x.searchPayload})]}),(0,Y.jsx)(sn,{view:e,rows:N,verdict:P,search:x,sidebar:b,list:d,paging:re})]}):(0,Y.jsx)(U,{route:`github`,density:`full`,headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,header:F,children:(0,Y.jsx)(fn,{view:e,selected:A,selectedNumber:S.selectedNumber,exact:C,repo:p.repo,rows:N,listPath:ae,changes:t,handToAgent:g})})}function Yt({index:e,isDesktop:t,listInUrl:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&!n&&r===void 0,restorePrs:e&&t&&!n&&i===`prs`}}function Xt(){let e=C();return t=>{e.setQueryData(o.uiState,e=>({...e,githubView:t})),ee({githubView:t}).then(t=>e.setQueryData(o.uiState,t)).catch(t=>{x(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:o.uiState})})}}function Zt(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:qe([...n,...r,...t?.items??[]])}}function Qt({number:e,fullList:t,filterRows:n,remoteDetail:r,exactDetail:i}){return e===null?null:t.find(t=>t.number===e)??n?.find(t=>t.number===e)??r??i??null}function $t(e,t,n,r,i){let a=t===null?null:n;return{linkFilter:a,listPath:Ve(e,a??(e===`issues`&&!r?`all`:null),void 0,``,i)}}function en(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,Y.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,Y.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,Y.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,Y.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,Y.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,Y.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,Y.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,Y.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,d,`.`]})}function tn({reason:e,refreshing:t,onRetry:n}){return(0,Y.jsx)(U,{route:`github`,density:`empty`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(ne,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,Y.jsx)(I,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`The tab needs the `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function nn({view:e,isDesktop:t,gh:n,onSaveView:r}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Y.jsxs)(rt,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>r(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,Y.jsxs)(rt,{to:`/github/prs`,active:e===`prs`,onClick:()=>r(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]})]})}function rn({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Y.jsx)(re,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,Y.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(e.target.value),className:`min-h-11 w-full rounded-lg border border-card-edge bg-card shadow-card py-1 pr-2.5 pl-8 text-[13px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Y.jsx)(hn,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,Y.jsx)(mt,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,Y.jsx)(`button`,{type:`button`,disabled:!n.filtering,"data-slot":`gh-clear-filters`,className:`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:border-border disabled:bg-transparent disabled:text-muted-foreground`,onClick:n.clearFilters,children:`Clear filters`})]})}function an(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function on(e,t){return(0,Y.jsx)(yt,{item:e,view:t.view,filter:t.filter,narrows:t.narrows,colors:t.colors,expanded:t.expandedUrl===e.url,onToggle:()=>t.onToggle(e),queuedRunId:t.queued.get(e.url)??null,checks:an(e,t.checksMap),comments:t.commentsOf(e)})}function sn({view:e,rows:t,verdict:n,search:r,sidebar:i,list:a,paging:o}){let{items:s,searchHits:c}=r;return(0,Y.jsxs)(`section`,{ref:o.setListEl,"data-slot":`gh-list`,className:`relative flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card p-3`,children:[s.length===0?n&&(0,Y.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):(0,Y.jsx)(cn,{items:s,rows:t,paging:o}),o.pagingAvailable?(0,Y.jsx)(ln,{view:e,list:a,paging:o}):null,(0,Y.jsx)(un,{backedQuery:i.backedQuery,filterSearch:i.filterSearch}),s.length>0&&r.searchWanted&&n?(0,Y.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):null,c.length>0?(0,Y.jsx)(dn,{hits:c,searchPayload:r.searchPayload,rows:t}):null]})}function cn({items:e,rows:t,paging:n}){let{setRowsEl:r,scrollOwner:i,listEl:a,scrollOwnerRef:o,startMargin:s}=n,c=(0,J.useRef)(null),l=(0,J.useRef)(!1);(0,J.useEffect)(()=>{if(l.current||!i)return;l.current=!0;let n=e.findIndex(e=>e.url===t.expandedUrl);n>=0&&c.current?.scrollToIndex(n,{align:`start`})},[i,e,t.expandedUrl]);let u=e.map((e,n)=>(0,Y.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":n>0||void 0,children:on(e,t)},e.url));return(0,Y.jsx)(`div`,{ref:r,"data-slot":`gh-rows`,"data-virtualized":i?`true`:void 0,role:`list`,children:i?(0,Y.jsx)(ze,{ref:c,scrollRef:o,startMargin:s,children:u},i===a?`list`:`main`):u})}function ln({view:e,list:t,paging:n}){return(0,Y.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-muted-foreground`,children:t.isFetchingNextPage?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,Y.jsxs)(Y.Fragment,{children:[`Could not load more.`,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,Y.jsxs)(Y.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function un({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-muted-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function dn({hits:e,searchPayload:t,rows:n}){let r=(0,J.useRef)(null),i=(0,J.useRef)(!1);return(0,J.useEffect)(()=>{i.current||(i.current=!0,(r.current?.querySelector(`[data-slot="gh-row"][aria-expanded="true"]`))?.scrollIntoView({block:`start`}))},[]),(0,Y.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Y.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,Y.jsx)(`ul`,{ref:r,className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,Y.jsx)(`li`,{children:on(e,n)},e.url))})]})}function fn({view:e,selected:t,selectedNumber:n,exact:r,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}){let{exactWanted:l,exactItem:u}=r;return(0,Y.jsxs)(`section`,{"data-slot":`gh-detail`,className:`flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card`,children:[t?null:(0,Y.jsx)(`div`,{className:`px-4 pt-4 md:px-7 md:pt-5`,children:(0,Y.jsx)(tt,{backLink:{to:o}})}),t?(0,Y.jsx)(pn,{item:t,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}):l&&u.isPending?(0,Y.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex flex-1 flex-col`,children:(0,Y.jsx)(W,{icon:(0,Y.jsx)(P,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${n}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):l&&(u.isError||u.data?.available===!1)?(0,Y.jsx)(mn,{number:n,exact:r}):(0,Y.jsx)(vt,{view:e,number:n})]})}function pn({item:e,repo:t,rows:n,listPath:r,changes:i,handToAgent:a}){let{workflows:o,skillList:s,workflow:c,setWorkflow:l,selectedSkills:u,setSelectedSkills:d,engine:f,setEngine:p,queued:m,onQueued:h}=a,g=w().state?.focusHandoff===!0;return(0,J.useEffect)(()=>{g&&$()},[g,e.url]),(0,Y.jsx)(Ke,{item:e,comments:n.commentsOf(e),afterHeading:e.kind===`issue`?(0,Y.jsx)(it,{number:e.number,repo:t},e.url):void 0,backLink:{to:r},subNav:{filter:n.filter,narrows:n.narrows,changes:i},onRunAgent:$,headerAction:(0,Y.jsx)(Dt,{item:e,queuedRunId:m.get(e.url)??null}),colors:n.colors,checks:an(e,n.checksMap),children:(0,Y.jsx)(Ze,{item:e,workflows:o.data?.workflows??[],skills:s,workflow:c,onWorkflowChange:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m.get(e.url)??null,onQueued:h},e.url)})}function mn({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,Y.jsx)(W,{icon:(0,Y.jsx)(D,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,Y.jsx)(I,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function hn({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,J.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Y.jsxs)(B,{open:a,onOpenChange:o,children:[(0,Y.jsx)(R,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:r(`inline-flex min-h-11 min-w-11 shrink-0 items-center gap-1.5 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-60`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,Y.jsx)(M,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,Y.jsx)(z,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Y.jsxs)(be,{children:[(0,Y.jsx)(ge,{placeholder:`Filter labels…`}),(0,Y.jsxs)(ye,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Y.jsx)(ve,{children:`No labels.`}),n.length>0?(0,Y.jsxs)(_e,{value:`__clear__`,onSelect:()=>i([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Y.jsxs)(_e,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`gh-label-dot`,className:`size-2.5 shrink-0 rounded-full ring-1 ring-foreground/30`,style:$e(t[e])}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Y.jsx)(k,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{Jt as GithubRoute};
|