cezarion 0.19.0-dev.8724 → 0.19.0-dev.8731

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/{accounts-section-DDKrIQHV.js → accounts-section-DVJon113.js} +1 -1
  3. package/web/dist/assets/{activity-motion-BTEsjlIe.js → activity-motion-D_Mig_D4.js} +1 -1
  4. package/web/dist/assets/{activity-route-nAfZdSHs.js → activity-route-BvYIEdOs.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-SeeFuvxb.js → agent-config-section-BImy20b0.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-BfBT817S.js → agent-defaults-section-D30dOTKu.js} +1 -1
  7. package/web/dist/assets/{appearance-BTm4Q_SI.js → appearance-CHsrT2VO.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-D7-FuLiL.js → archive-on-merge-field-BT4e_k9f.js} +1 -1
  9. package/web/dist/assets/attention-CGsbqL2t.js +1 -0
  10. package/web/dist/assets/{automations-route-CBTOewMF.js → automations-route-BEhmjeVF.js} +1 -1
  11. package/web/dist/assets/{commit-list-DkFgC3zM.js → commit-list-02HM16KN.js} +1 -1
  12. package/web/dist/assets/{diff-is16ZW0n.js → diff-BmDcJsHL.js} +2 -2
  13. package/web/dist/assets/{diff-controls-Bg2hEd-d.js → diff-controls-HmgYRhy7.js} +1 -1
  14. package/web/dist/assets/{diff-view-Cr8XQJSx.js → diff-view-CRx2ZNOd.js} +1 -1
  15. package/web/dist/assets/{file-preview-Bnls5OJY.js → file-preview-B361k1Oo.js} +1 -1
  16. package/web/dist/assets/{folder-browser-6stmlyVQ.js → folder-browser-BJ3aXo9k.js} +1 -1
  17. package/web/dist/assets/{git-toolbar-CNKKRUHu.js → git-toolbar-DsNQUL5f.js} +1 -1
  18. package/web/dist/assets/{github-BqFTLhmt.js → github-DP2REdU5.js} +1 -1
  19. package/web/dist/assets/{global-activity-route-CWe04LvJ.js → global-activity-route-Iv0uN7Wy.js} +1 -1
  20. package/web/dist/assets/index-CVz-Ls8s.css +1 -0
  21. package/web/dist/assets/{index-CZ2f_VDZ.js → index-mCjln54E.js} +5 -5
  22. package/web/dist/assets/{label-BKUl84DF.js → label-CH-a6Jyv.js} +1 -1
  23. package/web/dist/assets/{markdown-BlP4Ruj9.js → markdown-DiMerfHU.js} +1 -1
  24. package/web/dist/assets/{notifications-section-D74r_7fK.js → notifications-section-DGH8tp1N.js} +1 -1
  25. package/web/dist/assets/{open-in-menu-N8rXgYSG.js → open-in-menu-CML2QKil.js} +1 -1
  26. package/web/dist/assets/{preview-pane-connected-Bmczg9HP.js → preview-pane-connected-Cl_6DHNm.js} +1 -1
  27. package/web/dist/assets/{project-location-CcmuGA5W.js → project-location-CZNz3wYW.js} +1 -1
  28. package/web/dist/assets/{project-router-CT6gVIcC.js → project-router-BvBqllk2.js} +1 -1
  29. package/web/dist/assets/{projects-section-nCxUoesH.js → projects-section-D3h_nr6-.js} +1 -1
  30. package/web/dist/assets/{prompt-templates-section-BrLXH68w.js → prompt-templates-section-DelsVm7I.js} +1 -1
  31. package/web/dist/assets/{queries-ClkIgWFx.js → queries-CYWRnyM5.js} +1 -1
  32. package/web/dist/assets/{reference-chip-D_AkXXCW.js → reference-chip-BdikRjql.js} +1 -1
  33. package/web/dist/assets/{remote-settings-notice-DgXTd6s8.js → remote-settings-notice-D2x0qeKt.js} +1 -1
  34. package/web/dist/assets/repo-git-DKkOxBOJ.js +1 -0
  35. package/web/dist/assets/{report-reader-CGmbDHza.js → report-reader-D2b9baRm.js} +1 -1
  36. package/web/dist/assets/{report-selection-D9xJZoKb.js → report-selection-D2RvkiGX.js} +1 -1
  37. package/web/dist/assets/{reports-CTFaCJWS.js → reports-CBP54u9k.js} +1 -1
  38. package/web/dist/assets/{resources-section-BhRQQrVy.js → resources-section-D86nQvrk.js} +1 -1
  39. package/web/dist/assets/{review-panel-DJN1QoGx.js → review-panel-BcuyfiuF.js} +1 -1
  40. package/web/dist/assets/{run-detail-refresh-Bo51TspT.js → run-detail-refresh-BNI7eMgG.js} +1 -1
  41. package/web/dist/assets/{run-header-CRtXOTxt.js → run-header-B2AfxeyZ.js} +1 -1
  42. package/web/dist/assets/{select-BfLaIiyd.js → select-KMLdkF0Y.js} +1 -1
  43. package/web/dist/assets/{session-context-section-CaPupOFU.js → session-context-section-Do5bNw8y.js} +1 -1
  44. package/web/dist/assets/{settings-agent-picker-CzE4qiW7.js → settings-agent-picker-Dtqb26Hz.js} +1 -1
  45. package/web/dist/assets/{settings-shell-CpEw1Yep.js → settings-shell-CWPwhUDh.js} +1 -1
  46. package/web/dist/assets/{sidebar-section-Ct0x6SOQ.js → sidebar-section-pLjtUKHT.js} +1 -1
  47. package/web/dist/assets/{skills-D2HTiFIT.js → skills-CaXsJiUU.js} +1 -1
  48. package/web/dist/assets/{tab-link-BMblA2WK.js → tab-link-B0pNjKxZ.js} +1 -1
  49. package/web/dist/assets/{task-changes-4SjmpLQN.js → task-changes-oogngDub.js} +1 -1
  50. package/web/dist/assets/{task-commits-C6CoCyG9.js → task-commits-_Aa8bkJq.js} +1 -1
  51. package/web/dist/assets/{task-file-scope-BkUJ30q2.js → task-file-scope-DY0ozMDn.js} +1 -1
  52. package/web/dist/assets/{task-files-CCX3HTxx.js → task-files-DxFFK3zI.js} +1 -1
  53. package/web/dist/assets/{task-github-item-DWLVVmvv.js → task-github-item-LSzJuoiu.js} +1 -1
  54. package/web/dist/assets/{task-groups-aquji1Kv.js → task-groups-lh9gz7TP.js} +1 -1
  55. package/web/dist/assets/{task-thread-EBqjZ5Vz.js → task-thread-BlThx_dR.js} +1 -1
  56. package/web/dist/assets/{tasks-table-BkjZYg2J.js → tasks-table-k18AuMR5.js} +1 -1
  57. package/web/dist/assets/{thread-state-DU6OEOIL.js → thread-state-DA2aAkKF.js} +1 -1
  58. package/web/dist/assets/{toaster-C-xqAWVX.js → toaster-B0kvcFif.js} +1 -1
  59. package/web/dist/assets/{use-hand-to-agent-state-DUkm37P-.js → use-hand-to-agent-state-dgiJEULj.js} +1 -1
  60. package/web/dist/assets/{workflows-CGHzfqLC.js → workflows-DNs9e08u.js} +1 -1
  61. package/web/dist/assets/{workspace-tools-9mkf36oR.js → workspace-tools-DHek4GFd.js} +1 -1
  62. package/web/dist/assets/{worktrees-section-B91kPX6V.js → worktrees-section-fLfqff8U.js} +1 -1
  63. package/web/dist/index.html +14 -14
  64. package/web/dist/assets/attention--Y0CyzCN.js +0 -1
  65. package/web/dist/assets/index-DefVZIaB.css +0 -1
  66. package/web/dist/assets/repo-git-kl6QizKC.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{$t as i,Wt as a,Zt as o,g as s,h as c,rn as l,x as u,yt as d}from"./queries-ClkIgWFx.js";import{Fn as f,hi as p,n as m}from"./toaster-C-xqAWVX.js";import{t as h}from"./button-B7MKxYjT.js";import{t as g}from"./badge-DQ3U69Ht.js";import{t as _}from"./centered-state-V15AR_qo.js";import{fn as v,k as y,sr as b}from"./index-CZ2f_VDZ.js";import{n as x,r as S,t as C}from"./remote-settings-notice-DgXTd6s8.js";import{t as w}from"./code-editor-B4baSOhz.js";var T=e(t(),1);function E(e){return t=>t.runners.includes(e)}function D(e,t){let n=E(e);return t===`mcp`?e=>n(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>n(e)&&e.kind===t}function O(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:D(e.id,t)}))}}function k(e){return o(e).map(O)}var A=n();function j(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function M(){let e=c(),t=S(),n=d(),r=l(),a=r.data,o=(0,T.useMemo)(()=>k(a),[a]),s=(0,T.useMemo)(()=>n.data?y(n.data.checks,a):i(a),[n.data,a]);return r.isError?(0,A.jsx)(_,{icon:(0,A.jsx)(b,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,A.jsx)(_,{icon:(0,A.jsx)(b,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||a===void 0?(0,A.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,A.jsx)(N,{listing:e.data,descriptors:o,installed:s,onOpenFile:t})}function N({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,T.useState)(`claude`),[s,c]=(0,T.useState)(null),l=t.find(e=>e.id===a)??t[0];if(l===void 0)return null;let u=P(l,e),d=u.find(e=>e.id===s)??F(u),f=e=>{o(e),c(null)};return(0,A.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,A.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,A.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,A.jsx)(`code`,{children:C}),`.`]}),(0,A.jsx)(x,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,A.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,A.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===l.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===l.id,onClick:()=>f(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===l.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,A.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),l.note&&(0,A.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:l.note}),(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,A.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,A.jsx)(R,{agent:l,listing:e,selectedId:d?.id??null,onSelect:e=>{c(e),i()}})}),(0,A.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:d?(0,A.jsx)(B,{file:d},d.id):(0,A.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]})]})}function P(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function F(e){return e.find(e=>e.scope===`project`)??e[0]??null}var I={project:`Project scope`,local:`Local scope`,user:`User scope`};function L(e,t){for(let n of t){if(!n.label.startsWith(`~/`))continue;let t=n.label.slice(1);if(!n.path.endsWith(t))continue;let r=n.path.slice(0,n.path.length-t.length);if(r&&(e===r||e.startsWith(`${r}/`)))return`~${e.slice(r.length)}`}return e.replace(/^\/(?:home|Users)\/[^/]+(?=\/|$)/,`~`)}function R({agent:e,listing:t,selectedId:n,onSelect:i}){return(0,A.jsx)(A.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,A.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,A.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,A.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.note}),o.length===0&&a.empty&&(0,A.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:a.empty}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),title:e.label,className:r(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,A.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,A.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,A.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),s&&(0,A.jsx)(z,{userMcp:s,path:L(s.path,t.files)})]},a.id)})})}function z({userMcp:e,path:t}){return(0,A.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,A.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,A.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,A.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,A.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,A.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function B({file:e}){let t=s(e.id),[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(!1),[o,c]=(0,T.useState)(null),l=t.data?.version??null,u=n??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable,p=e.kind===`mcp`||e.holdsMcp;v(f&&d);let{save:m,isSaving:h}=K({file:e,content:u,loadedVersion:l,setDraft:r,setConflict:a,setFormatError:c});return(0,T.useEffect)(()=>{t.data&&(r(t.data.content),a(!1),c(null))},[t.data?.version,t.data]),(0,A.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,A.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:I[e.scope]})]}),(0,A.jsx)(`p`,{"data-slot":`agent-config-path`,title:e.path,className:`font-mono text-xs text-foreground`,children:L(e.path,[e])}),(0,A.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,A.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,A.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,A.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,A.jsx)(`h3`,{children:p?`MCP configuration`:`File contents`}),p&&(0,A.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),t.isPending?(0,A.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,A.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,A.jsx)(V,{file:e,content:u,isMcp:p,onChange:r}),(0,A.jsx)(W,{formatError:o,conflict:i,onReload:()=>void t.refetch()}),f&&(0,A.jsx)(H,{exists:e.exists,dirty:d,isSaving:h,onSave:m,onReset:()=>r(null)}),(0,A.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,A.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,A.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[j(e),e.hotReload?` ${e.hotReload}`:``]}),(0,A.jsx)(G,{reason:e.readOnlyReason})]})]})}function V({file:e,content:t,isMcp:n,onChange:r}){return(0,A.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,A.jsx)(w,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,A.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-soft-foreground`,children:U(e,n)})]})}function H({exists:e,dirty:t,isSaving:n,onSave:r,onReset:i}){return(0,A.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,A.jsx)(h,{size:`sm`,onClick:r,disabled:!t||n,children:e?`Save file`:`Create file`}),(0,A.jsx)(h,{size:`sm`,variant:`outline`,onClick:i,disabled:!t||n,children:`Reset`}),!n&&(0,A.jsx)(`span`,{"data-slot":`agent-config-save-cue`,className:`self-center text-xs text-muted-foreground`,children:t?`Unsaved changes`:e?`No unsaved changes`:`Enter content above to create this file`})]})}function U(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{$t as i,Wt as a,Zt as o,g as s,h as c,rn as l,x as u,yt as d}from"./queries-CYWRnyM5.js";import{Fn as f,hi as p,n as m}from"./toaster-B0kvcFif.js";import{t as h}from"./button-B7MKxYjT.js";import{t as g}from"./badge-DQ3U69Ht.js";import{t as _}from"./centered-state-V15AR_qo.js";import{fn as v,k as y,sr as b}from"./index-mCjln54E.js";import{n as x,r as S,t as C}from"./remote-settings-notice-D2x0qeKt.js";import{t as w}from"./code-editor-B4baSOhz.js";var T=e(t(),1);function E(e){return t=>t.runners.includes(e)}function D(e,t){let n=E(e);return t===`mcp`?e=>n(e)&&(e.holdsMcp===!0||e.kind===`mcp`):e=>n(e)&&e.kind===t}function O(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:D(e.id,t)}))}}function k(e){return o(e).map(O)}var A=n();function j(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function M(){let e=c(),t=S(),n=d(),r=l(),a=r.data,o=(0,T.useMemo)(()=>k(a),[a]),s=(0,T.useMemo)(()=>n.data?y(n.data.checks,a):i(a),[n.data,a]);return r.isError?(0,A.jsx)(_,{icon:(0,A.jsx)(b,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,A.jsx)(_,{icon:(0,A.jsx)(b,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||a===void 0?(0,A.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,A.jsx)(N,{listing:e.data,descriptors:o,installed:s,onOpenFile:t})}function N({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,T.useState)(`claude`),[s,c]=(0,T.useState)(null),l=t.find(e=>e.id===a)??t[0];if(l===void 0)return null;let u=P(l,e),d=u.find(e=>e.id===s)??F(u),f=e=>{o(e),c(null)};return(0,A.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,A.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,A.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,A.jsx)(`code`,{children:C}),`.`]}),(0,A.jsx)(x,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,A.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,A.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===l.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===l.id,onClick:()=>f(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===l.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,A.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),l.note&&(0,A.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:l.note}),(0,A.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,A.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,A.jsx)(R,{agent:l,listing:e,selectedId:d?.id??null,onSelect:e=>{c(e),i()}})}),(0,A.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:d?(0,A.jsx)(B,{file:d},d.id):(0,A.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]})]})}function P(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function F(e){return e.find(e=>e.scope===`project`)??e[0]??null}var I={project:`Project scope`,local:`Local scope`,user:`User scope`};function L(e,t){for(let n of t){if(!n.label.startsWith(`~/`))continue;let t=n.label.slice(1);if(!n.path.endsWith(t))continue;let r=n.path.slice(0,n.path.length-t.length);if(r&&(e===r||e.startsWith(`${r}/`)))return`~${e.slice(r.length)}`}return e.replace(/^\/(?:home|Users)\/[^/]+(?=\/|$)/,`~`)}function R({agent:e,listing:t,selectedId:n,onSelect:i}){return(0,A.jsx)(A.Fragment,{children:e.groups.map(a=>{let o=t.files.filter(a.files),s=a.showsUserMcp?t.userMcp:void 0;return o.length===0&&!s&&!a.empty?null:(0,A.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":a.id,"data-agent":e.id,children:[(0,A.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:a.label}),a.note&&(0,A.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:a.note}),o.length===0&&a.empty&&(0,A.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:a.empty}),(0,A.jsx)(`ul`,{className:`flex flex-col gap-1`,children:o.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),title:e.label,className:r(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,A.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,A.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,A.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,A.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),s&&(0,A.jsx)(z,{userMcp:s,path:L(s.path,t.files)})]},a.id)})})}function z({userMcp:e,path:t}){return(0,A.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,A.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,A.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,A.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,A.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,A.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,A.jsx)(`li`,{children:(0,A.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,A.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function B({file:e}){let t=s(e.id),[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(!1),[o,c]=(0,T.useState)(null),l=t.data?.version??null,u=n??t.data?.content??``,d=t.data?u!==t.data.content:!1,f=e.writable,p=e.kind===`mcp`||e.holdsMcp;v(f&&d);let{save:m,isSaving:h}=K({file:e,content:u,loadedVersion:l,setDraft:r,setConflict:a,setFormatError:c});return(0,T.useEffect)(()=>{t.data&&(r(t.data.content),a(!1),c(null))},[t.data?.version,t.data]),(0,A.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,A.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:I[e.scope]})]}),(0,A.jsx)(`p`,{"data-slot":`agent-config-path`,title:e.path,className:`font-mono text-xs text-foreground`,children:L(e.path,[e])}),(0,A.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,A.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,A.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,A.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,A.jsx)(`h3`,{children:p?`MCP configuration`:`File contents`}),p&&(0,A.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),t.isPending?(0,A.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):t.isError?(0,A.jsx)(`p`,{className:`text-[13px] text-destructive`,children:t.error.message}):(0,A.jsx)(V,{file:e,content:u,isMcp:p,onChange:r}),(0,A.jsx)(W,{formatError:o,conflict:i,onReload:()=>void t.refetch()}),f&&(0,A.jsx)(H,{exists:e.exists,dirty:d,isSaving:h,onSave:m,onReset:()=>r(null)}),(0,A.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,A.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,A.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[j(e),e.hotReload?` ${e.hotReload}`:``]}),(0,A.jsx)(G,{reason:e.readOnlyReason})]})]})}function V({file:e,content:t,isMcp:n,onChange:r}){return(0,A.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,A.jsx)(w,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,A.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-soft-foreground`,children:U(e,n)})]})}function H({exists:e,dirty:t,isSaving:n,onSave:r,onReset:i}){return(0,A.jsxs)(`div`,{className:`settings-form-actions`,children:[(0,A.jsx)(h,{size:`sm`,onClick:r,disabled:!t||n,children:e?`Save file`:`Create file`}),(0,A.jsx)(h,{size:`sm`,variant:`outline`,onClick:i,disabled:!t||n,children:`Reset`}),!n&&(0,A.jsx)(`span`,{"data-slot":`agent-config-save-cue`,className:`self-center text-xs text-muted-foreground`,children:t?`Unsaved changes`:e?`No unsaved changes`:`Enter content above to create this file`})]})}function U(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
2
2
  "mcpServers": {}
3
3
  }`:`{
4
4
  "permissions": {}
@@ -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{$t as r,At as i,C as a,Ct as o,Gt as s,St as c,Tt as l,Wt as u,Xt as d,Zt as f,_ as p,an as m,dn as h,dt as g,jt as _,on as v,rn as y}from"./queries-ClkIgWFx.js";import{Fn as b,Jt as ee,P as x,Tr as S,a as C,hi as w,hn as T,n as E}from"./toaster-C-xqAWVX.js";import{s as D}from"./design-icons-CzEoMH9c.js";import{t as O}from"./button-B7MKxYjT.js";import{r as k}from"./switch-SP8pw5uU.js";import{t as A}from"./status-dot-BRzVlF2X.js";import{t as j}from"./centered-state-V15AR_qo.js";import{A as M,M as te,fn as ne,hn as re,wn as N}from"./index-CZ2f_VDZ.js";import{t as P}from"./textarea-vJt9undk.js";import{t as F}from"./settings-select-CCIMGnyA.js";import{a as I,i as L,n as R,r as z,t as B}from"./settings-agent-picker-CzE4qiW7.js";import{n as V}from"./saved-draft-BwzBc-_Y.js";import{t as H}from"./save-cue-Cd3ZAPBS.js";var U=e(t(),1),W=n(),G={connected:N(`connected`),disconnected:N(`disconnected`),"not-installed":N(`not-installed`),unknown:N(`unknown`)};function K(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function q(e,t){return e?G[e]:t?{label:`Checking…`,tone:`neutral`}:G.unknown}function J(e,t){return e===`unknown`||t&&!e}function Y({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,W.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,W.jsx)(`code`,{children:e.loginCommand}),`.`]}):J(t,r)?(0,W.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,W.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function ie({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,W.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,W.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>E(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,W.jsx)(R,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,W.jsx)(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,W.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>E(`${e.displayName} can be tried again.`),onError:e=>E(e.message,{tone:`danger`})}),children:`Try again`})]})}function ae({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,W.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,W.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,W.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function oe(){let e=y(),t=o(),n=l(),r=i(),a=w(),[c,u]=(0,U.useState)(null),p=(0,U.useRef)(Promise.resolve()),g=(0,U.useRef)({}),_=(0,U.useRef)({}),v=(0,U.useRef)(t.data);(0,U.useEffect)(()=>{c&&S(t.data,c.provider)?.status===`connected`&&u(null)},[c,t.data]),(0,U.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!v.current){v.current=t.data;return}v.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?S(v.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let x=(0,U.useCallback)((e,t)=>{let n=s.providerStatus,r=a.getQueryData(n);if(!r)return;v.current||=r;let i=K(r,e,t);_.current[e]=(_.current[e]??0)+1,a.setQueryData(n,i);let o=(g.current[e]??0)+1;g.current[e]=o,p.current=p.current.then(async()=>{try{let r=await T(e,t),i=S(r,e)?.enabled;if(i===void 0)return;if(v.current=K(v.current??r,e,i),o===g.current[e]){let t=a.getQueryData(n);a.setQueryData(n,t?K(t,e,i):r)}}catch(t){if(o===g.current[e]){let r=S(v.current,e)?.enabled,i=a.getQueryData(n);i&&r!==void 0?a.setQueryData(n,K(i,e,r)):v.current?a.setQueryData(n,v.current):a.removeQueries({queryKey:n,exact:!0}),E(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[a]),C=h({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{u(null),E(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await a.invalidateQueries({queryKey:s.providerStatus}),await m(a,t,`none`)},onError:(t,n)=>{if(t instanceof b&&t.command){let r=d(e.data,n);u({provider:n,label:r,message:t.message,command:t.command});return}E(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),E(`Command copied`)}catch{E(`Could not copy the command`,{tone:`danger`})}};return(0,W.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,W.jsxs)(`div`,{className:`mb-2`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,W.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,W.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:f(e.data).map(e=>{let i=S(t.data,e.id),a=i?.status,o=q(a,t.isPending),s=C.isPending&&C.variables===e.id,l=i?.authFailureId;return(0,W.jsxs)(U.Fragment,{children:[(0,W.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,W.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(A,{tone:o.tone,pulse:t.isPending}),(0,W.jsx)(`span`,{children:o.label}),i?.enabled===!1?(0,W.jsx)(`span`,{children:`Disabled`}):null]}),(0,W.jsx)(Y,{provider:e,state:a,current:i,statusIsError:t.isError})]}),(0,W.jsx)(ie,{provider:e,state:a,current:i,isConnecting:s,incidentId:l,refresh:n,connect:C,retry:r,queueToggle:x})]}),l===void 0?null:(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,W.jsx)(ae,{manual:c,provider:e.id,connected:a===`connected`,onCopy:D})]},e.id)})})]})}var X=2e4;function se(){let e=p(),t=y(),n=v(r(t.data)),i=o();return e.isPending?(0,W.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,W.jsx)(j,{icon:(0,W.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,W.jsx)(ce,{config:e.data,catalogs:n,providerStatus:i,runners:t.data})}function ce({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=w(),s=h({mutationFn:e=>x(e),onSuccess:e=>{o.setQueryData(u.config,e),o.invalidateQueries({queryKey:u.health}),o.invalidateQueries({queryKey:u.repo})},onError:e=>E(e.message,{tone:`danger`})}),[c,l]=V(e.systemPrompt??``),d=c.trim(),p=d===(e.systemPrompt??``),m=d.length>X;return ne(!p),(0,W.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,W.jsx)(Z,{defaultRunner:e.defaultRunner,providerStatus:n,saving:s.isPending,onPick:e=>s.mutate({defaultRunner:e})}),(0,W.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,W.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:f(r).map(i=>{let{providerConnected:a,providerReason:o}=I(n,i.id),c=t[i.id],l=M(i.id,r,c),u=te(i.id,r,c?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,W.jsxs)(`label`,{className:`settings-option-row`,children:[(0,W.jsx)(`div`,{children:(0,W.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,W.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,W.jsxs)(F,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:s.isPending||!a,onChange:e=>s.mutate({defaultModels:{[i.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,W.jsx)(`option`,{disabled:!0,children:l}):null]})]},i.id)})})}),(0,W.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,W.jsx)(P,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:c,onChange:e=>l(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,W.jsx)(le,{length:d.length,overLimit:m,saved:p,pending:s.isPending,onSave:()=>s.mutate({systemPrompt:d===``?null:d},{onSuccess:()=>E(d===``?`System prompt cleared`:`System prompt saved`)})})]}),(0,W.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,W.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,W.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,W.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({liveTitleUpdates:e},{onSuccess:()=>E(e?`Live title updates on`:`Live title updates off`)})}),(0,W.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,W.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,W.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,W.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:s.isPending,onCheckedChange:e=>s.mutate({reviewGate:e},{onSuccess:()=>E(e?`Review gate on`:`Review gate off`)})}),(0,W.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,W.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:i.data?.info?(0,W.jsxs)(F,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:s.isPending,onChange:e=>s.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,W.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),i.data.branches.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]}):(0,W.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:i.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,W.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,W.jsx)(`summary`,{children:`Provider connections`}),(0,W.jsx)(oe,{})]})]})}function Z({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=g(),o=c(),s=C(),l=a(),u=_(),d=s.projectId??`default`,f=l.data?.info?.root,p=re(i.data,s.projectId,f),m=y().data,h=z(i.data?.profiles??[],m),v=L(h,m);return(0,W.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,W.jsx)(B,{rows:h,runner:e,accountFor:e=>p?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||o.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:d,provider:t,profileId:n},{onError:e=>E(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&S(t.data,e)?.enabled===!1?(0,W.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,v?(0,W.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,reportsDirty:n,children:r}){return(0,W.jsxs)(`section`,{"data-reports-dirty":n?``:void 0,className:`settings-field flex flex-col gap-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),r]})}function $({title:e,hint:t,children:n}){return(0,W.jsxs)(`section`,{className:`settings-option-row`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{children:e}),(0,W.jsx)(`p`,{children:t})]}),n]})}function le({length:e,overLimit:t,saved:n,pending:r,onSave:i}){return(0,W.jsxs)(W.Fragment,{children:[t?(0,W.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,X.toLocaleString(),`.`]}):(0,W.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`}),(0,W.jsx)(`div`,{className:`settings-form-actions`,children:(0,W.jsx)(H,{show:n&&!t&&!r,children:(0,W.jsx)(O,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:n||t||r,onClick:i,children:`Save prompt`})})})]})}export{se as AgentDefaultsSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$t as r,At as i,C as a,Ct as o,Gt as s,St as c,Tt as l,Wt as u,Xt as d,Zt as f,_ as p,an as m,dn as h,dt as g,jt as _,on as v,rn as y}from"./queries-CYWRnyM5.js";import{Fn as b,Jt as ee,P as x,Tr as S,a as C,hi as w,hn as T,n as E}from"./toaster-B0kvcFif.js";import{s as D}from"./design-icons-CzEoMH9c.js";import{t as O}from"./button-B7MKxYjT.js";import{r as k}from"./switch-SP8pw5uU.js";import{t as A}from"./status-dot-BRzVlF2X.js";import{t as j}from"./centered-state-V15AR_qo.js";import{A as M,M as te,fn as ne,hn as re,wn as N}from"./index-mCjln54E.js";import{t as P}from"./textarea-vJt9undk.js";import{t as F}from"./settings-select-CCIMGnyA.js";import{a as I,i as L,n as R,r as z,t as B}from"./settings-agent-picker-Dtqb26Hz.js";import{n as V}from"./saved-draft-BwzBc-_Y.js";import{t as H}from"./save-cue-Cd3ZAPBS.js";var U=e(t(),1),W=n(),G={connected:N(`connected`),disconnected:N(`disconnected`),"not-installed":N(`not-installed`),unknown:N(`unknown`)};function K(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function q(e,t){return e?G[e]:t?{label:`Checking…`,tone:`neutral`}:G.unknown}function J(e,t){return e===`unknown`||t&&!e}function Y({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,W.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,W.jsx)(`code`,{children:e.loginCommand}),`.`]}):J(t,r)?(0,W.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,W.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function ie({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`;return(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,W.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t)}),l?(0,W.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>E(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,W.jsx)(R,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,W.jsx)(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,W.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>E(`${e.displayName} can be tried again.`),onError:e=>E(e.message,{tone:`danger`})}),children:`Try again`})]})}function ae({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,W.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,W.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,W.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,W.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function oe(){let e=y(),t=o(),n=l(),r=i(),a=w(),[c,u]=(0,U.useState)(null),p=(0,U.useRef)(Promise.resolve()),g=(0,U.useRef)({}),_=(0,U.useRef)({}),v=(0,U.useRef)(t.data);(0,U.useEffect)(()=>{c&&S(t.data,c.provider)?.status===`connected`&&u(null)},[c,t.data]),(0,U.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!v.current){v.current=t.data;return}v.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?S(v.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let x=(0,U.useCallback)((e,t)=>{let n=s.providerStatus,r=a.getQueryData(n);if(!r)return;v.current||=r;let i=K(r,e,t);_.current[e]=(_.current[e]??0)+1,a.setQueryData(n,i);let o=(g.current[e]??0)+1;g.current[e]=o,p.current=p.current.then(async()=>{try{let r=await T(e,t),i=S(r,e)?.enabled;if(i===void 0)return;if(v.current=K(v.current??r,e,i),o===g.current[e]){let t=a.getQueryData(n);a.setQueryData(n,t?K(t,e,i):r)}}catch(t){if(o===g.current[e]){let r=S(v.current,e)?.enabled,i=a.getQueryData(n);i&&r!==void 0?a.setQueryData(n,K(i,e,r)):v.current?a.setQueryData(n,v.current):a.removeQueries({queryKey:n,exact:!0}),E(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[a]),C=h({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{u(null),E(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await a.invalidateQueries({queryKey:s.providerStatus}),await m(a,t,`none`)},onError:(t,n)=>{if(t instanceof b&&t.command){let r=d(e.data,n);u({provider:n,label:r,message:t.message,command:t.command});return}E(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),E(`Command copied`)}catch{E(`Could not copy the command`,{tone:`danger`})}};return(0,W.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,W.jsxs)(`div`,{className:`mb-2`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,W.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,W.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:f(e.data).map(e=>{let i=S(t.data,e.id),a=i?.status,o=q(a,t.isPending),s=C.isPending&&C.variables===e.id,l=i?.authFailureId;return(0,W.jsxs)(U.Fragment,{children:[(0,W.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,W.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(A,{tone:o.tone,pulse:t.isPending}),(0,W.jsx)(`span`,{children:o.label}),i?.enabled===!1?(0,W.jsx)(`span`,{children:`Disabled`}):null]}),(0,W.jsx)(Y,{provider:e,state:a,current:i,statusIsError:t.isError})]}),(0,W.jsx)(ie,{provider:e,state:a,current:i,isConnecting:s,incidentId:l,refresh:n,connect:C,retry:r,queueToggle:x})]}),l===void 0?null:(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,W.jsx)(ae,{manual:c,provider:e.id,connected:a===`connected`,onCopy:D})]},e.id)})})]})}var X=2e4;function se(){let e=p(),t=y(),n=v(r(t.data)),i=o();return e.isPending?(0,W.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,W.jsx)(j,{icon:(0,W.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,W.jsx)(ce,{config:e.data,catalogs:n,providerStatus:i,runners:t.data})}function ce({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=w(),s=h({mutationFn:e=>x(e),onSuccess:e=>{o.setQueryData(u.config,e),o.invalidateQueries({queryKey:u.health}),o.invalidateQueries({queryKey:u.repo})},onError:e=>E(e.message,{tone:`danger`})}),[c,l]=V(e.systemPrompt??``),d=c.trim(),p=d===(e.systemPrompt??``),m=d.length>X;return ne(!p),(0,W.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,W.jsx)(Z,{defaultRunner:e.defaultRunner,providerStatus:n,saving:s.isPending,onPick:e=>s.mutate({defaultRunner:e})}),(0,W.jsx)(Q,{title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Auto lets the runner decide per task.`,children:(0,W.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:f(r).map(i=>{let{providerConnected:a,providerReason:o}=I(n,i.id),c=t[i.id],l=M(i.id,r,c),u=te(i.id,r,c?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`auto (default)`;return(0,W.jsxs)(`label`,{className:`settings-option-row`,children:[(0,W.jsx)(`div`,{children:(0,W.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,W.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,W.jsxs)(F,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:s.isPending||!a,onChange:e=>s.mutate({defaultModels:{[i.id]:e.target.value||null}}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[u.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.id===``?`Native agent default`:e.label},e.id)),l?(0,W.jsx)(`option`,{disabled:!0,children:l}):null]})]},i.id)})})}),(0,W.jsxs)(Q,{title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,W.jsx)(P,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:c,onChange:e=>l(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,W.jsx)(le,{length:d.length,overLimit:m,saved:p,pending:s.isPending,onSave:()=>s.mutate({systemPrompt:d===``?null:d},{onSuccess:()=>E(d===``?`System prompt cleared`:`System prompt saved`)})})]}),(0,W.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,W.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,children:(0,W.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,W.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({liveTitleUpdates:e},{onSuccess:()=>E(e?`Live title updates on`:`Live title updates off`)})}),(0,W.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,W.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,children:(0,W.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,W.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:s.isPending,onCheckedChange:e=>s.mutate({reviewGate:e},{onSuccess:()=>E(e?`Review gate on`:`Review gate off`)})}),(0,W.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,W.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,children:i.data?.info?(0,W.jsxs)(F,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:s.isPending,onChange:e=>s.mutate({baseBranch:e.target.value||null}),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,W.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),i.data.branches.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]}):(0,W.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:i.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,W.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,W.jsx)(`summary`,{children:`Provider connections`}),(0,W.jsx)(oe,{})]})]})}function Z({defaultRunner:e,providerStatus:t,saving:n,onPick:r}){let i=g(),o=c(),s=C(),l=a(),u=_(),d=s.projectId??`default`,f=l.data?.info?.root,p=re(i.data,s.projectId,f),m=y().data,h=z(i.data?.profiles??[],m),v=L(h,m);return(0,W.jsxs)(Q,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,children:[(0,W.jsx)(B,{rows:h,runner:e,accountFor:e=>p?.[e]??null,providerStatus:t,disabled:n,accountDisabled:u.isPending||o.data===void 0,onPick:(t,n,i)=>{t!==e&&r(t),i&&u.mutate({projectId:d,provider:t,profileId:n},{onError:e=>E(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&S(t.data,e)?.enabled===!1?(0,W.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,v?(0,W.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function Q({title:e,hint:t,reportsDirty:n,children:r}){return(0,W.jsxs)(`section`,{"data-reports-dirty":n?``:void 0,className:`settings-field flex flex-col gap-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,W.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),r]})}function $({title:e,hint:t,children:n}){return(0,W.jsxs)(`section`,{className:`settings-option-row`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{children:e}),(0,W.jsx)(`p`,{children:t})]}),n]})}function le({length:e,overLimit:t,saved:n,pending:r,onSave:i}){return(0,W.jsxs)(W.Fragment,{children:[t?(0,W.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,X.toLocaleString(),`.`]}):(0,W.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`}),(0,W.jsx)(`div`,{className:`settings-form-actions`,children:(0,W.jsx)(H,{show:n&&!t&&!r,children:(0,W.jsx)(O,{type:`button`,variant:`primary`,size:`sm`,"data-action":`agents-save-prompt`,disabled:n||t||r,onClick:i,children:`Save prompt`})})})]})}export{se as AgentDefaultsSection};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{St as n}from"./queries-ClkIgWFx.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-B7MKxYjT.js";import{Gn as s,lt as c,vn as l}from"./index-CZ2f_VDZ.js";var u=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),d=e(),f=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:u},{value:`dark`,label:`Dark`,icon:a}],p=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],m=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Ultra-compact`}],h=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function g({slot:e,label:n,value:r,options:i,onChange:a}){return(0,d.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-lg border border-border bg-muted/60 p-1 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,d.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`border border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,d.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function _({title:e,hint:t,children:n}){return(0,d.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,d.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function v(){let e=n(),{order:t,canReorder:r,reset:i}=l();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,d.jsx)(_,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,d.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function y(){let{theme:e,setTheme:t}=s(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:l}=c();return(0,d.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,d.jsx)(_,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,d.jsx)(g,{slot:`appearance-theme`,label:`Theme`,value:e,options:f,onChange:t})}),p.length>1?(0,d.jsx)(_,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,d.jsx)(g,{slot:`appearance-accent`,label:`Accent`,value:n,options:p,onChange:a})}):null,(0,d.jsx)(_,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,d.jsx)(g,{slot:`appearance-density`,label:`Density`,value:r,options:m,onChange:o})}),(0,d.jsx)(_,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,d.jsx)(g,{slot:`appearance-width`,label:`Reading width`,value:i,options:h,onChange:l})}),(0,d.jsx)(v,{}),(0,d.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,d.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,d.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,d.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-border bg-card px-4 py-3 text-xs text-foreground shadow-xs`,children:`Open task`})]}),(0,d.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{y as AppearanceSection};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{St as n}from"./queries-CYWRnyM5.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-B7MKxYjT.js";import{Gn as s,lt as c,vn as l}from"./index-mCjln54E.js";var u=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),d=e(),f=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:u},{value:`dark`,label:`Dark`,icon:a}],p=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],m=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Ultra-compact`}],h=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function g({slot:e,label:n,value:r,options:i,onChange:a}){return(0,d.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-lg border border-border bg-muted/60 p-1 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,d.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`border border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,d.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,d.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function _({title:e,hint:t,children:n}){return(0,d.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,d.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}function v(){let e=n(),{order:t,canReorder:r,reset:i}=l();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,d.jsx)(_,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,d.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function y(){let{theme:e,setTheme:t}=s(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:l}=c();return(0,d.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,d.jsx)(_,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,children:(0,d.jsx)(g,{slot:`appearance-theme`,label:`Theme`,value:e,options:f,onChange:t})}),p.length>1?(0,d.jsx)(_,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,children:(0,d.jsx)(g,{slot:`appearance-accent`,label:`Accent`,value:n,options:p,onChange:a})}):null,(0,d.jsx)(_,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,children:(0,d.jsx)(g,{slot:`appearance-density`,label:`Density`,value:r,options:m,onChange:o})}),(0,d.jsx)(_,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,children:(0,d.jsx)(g,{slot:`appearance-width`,label:`Reading width`,value:i,options:h,onChange:l})}),(0,d.jsx)(v,{}),(0,d.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,d.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,d.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,d.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,d.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-border bg-card px-4 py-3 text-xs text-foreground shadow-xs`,children:`Open task`})]}),(0,d.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{y as AppearanceSection};
@@ -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{Gt as r,It as i,Wt as a,_ as o,dn as s}from"./queries-ClkIgWFx.js";import{P as c,hi as l,sn as u}from"./toaster-C-xqAWVX.js";import{t as d}from"./settings-select-CCIMGnyA.js";var f=e(t(),1),p=n();function m(){let e=o();return e.isPending?(0,p.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,p.jsx)(g,{config:e.data,scope:`project`})}function h(){let e=i();return e.isPending?(0,p.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,p.jsx)(`div`,{className:`flex w-full flex-col gap-4`,children:(0,p.jsx)(g,{config:e.data,scope:`global`})})}function g({config:e,scope:t}){let n=(0,f.useId)(),i=l(),o=s({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):u({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?i.setQueryData(n,e):(i.setQueryData(r.config,e),i.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==r.config}))}});return(0,p.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,p.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,p.jsxs)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`min-h-11 w-64 max-w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-2 focus-visible:outline-ring active:bg-muted disabled:opacity-50`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:o.isPending,onChange:e=>o.mutate({archiveOnMerge:e.target.value===`inherit`?null:e.target.value===`enabled`,projectKey:a.config}),children:[(0,p.jsx)(`option`,{value:`inherit`,children:t===`project`?`Inherit global setting`:`Use default`}),(0,p.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,p.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,p.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,p.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),o.isPending?(0,p.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,o.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,o.error.message]}):null]})}export{m as ArchiveOnMergeField,h as TasksSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Gt as r,It as i,Wt as a,_ as o,dn as s}from"./queries-CYWRnyM5.js";import{P as c,hi as l,sn as u}from"./toaster-B0kvcFif.js";import{t as d}from"./settings-select-CCIMGnyA.js";var f=e(t(),1),p=n();function m(){let e=o();return e.isPending?(0,p.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,p.jsx)(g,{config:e.data,scope:`project`})}function h(){let e=i();return e.isPending?(0,p.jsx)(`p`,{role:`status`,className:`p-4 text-sm`,children:`Loading task settings…`}):e.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`p-4 text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,p.jsx)(`div`,{className:`flex w-full flex-col gap-4`,children:(0,p.jsx)(g,{config:e.data,scope:`global`})})}function g({config:e,scope:t}){let n=(0,f.useId)(),i=l(),o=s({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):u({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?i.setQueryData(n,e):(i.setQueryData(r.config,e),i.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==r.config}))}});return(0,p.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`flex min-w-0 flex-col gap-3`,children:[(0,p.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,p.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,p.jsx)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived.`})]}),(0,p.jsxs)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`min-h-11 w-64 max-w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus-visible:outline-2 focus-visible:outline-ring active:bg-muted disabled:opacity-50`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:o.isPending,onChange:e=>o.mutate({archiveOnMerge:e.target.value===`inherit`?null:e.target.value===`enabled`,projectKey:a.config}),children:[(0,p.jsx)(`option`,{value:`inherit`,children:t===`project`?`Inherit global setting`:`Use default`}),(0,p.jsx)(`option`,{value:`enabled`,children:`Enabled`}),(0,p.jsx)(`option`,{value:`disabled`,children:`Disabled`})]}),(0,p.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,p.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),o.isPending?(0,p.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,o.isError?(0,p.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,o.error.message]}):null]})}export{m as ArchiveOnMergeField,h as TasksSection};
@@ -0,0 +1 @@
1
+ import{An as e,Tn as t}from"./toaster-B0kvcFif.js";function n(n){return t[e(n).bucket]<=t.waiting}export{n as t};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{A as i,_ as a,nn as o,rn as s,sn as c,tn as l}from"./queries-ClkIgWFx.js";import{B as u,Fn as d,H as f,Ur as p,V as m,_ as h,ar as g,c as ee,d as _,g as v,ir as y,ni as b,nr as x,o as S,s as C,sr as te,ti as ne,v as re,z as ie}from"./toaster-C-xqAWVX.js";import{B as w,G as ae,H as oe,I as T,K as se,N as E,P as D,V as ce,W as O,j as k,z as A}from"./live-protocol-DMhTnCmf.js";import{h as le}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as ue,t as j}from"./label-BKUl84DF.js";import{I as de,J as fe,Y as pe,it as me,l as he,pt as ge,ut as _e,y as ve}from"./design-icons-CzEoMH9c.js";import{t as ye}from"./check-OP-CVgZG.js";import{t as M}from"./button-B7MKxYjT.js";import{n as be,r as xe,t as Se}from"./collapsible-BEV4FO-1.js";import{a as Ce,i as N,n as P,r as F,t as I}from"./select-BfLaIiyd.js";import{r as we}from"./switch-SP8pw5uU.js";import{c as Te,s as Ee,t as L}from"./project-router-CT6gVIcC.js";import{a as De,c as Oe,d as ke,n as Ae,s as R,u as z}from"./page-shell-7pLJMOgh.js";import{t as je}from"./centered-state-V15AR_qo.js";import{D as Me,Fn as Ne,In as Pe,K as Fe,M as Ie,O as Le,U as Re,W as ze,Xn as B,_n as Be,lr as Ve,pn as He,r as Ue,t as We,xn as Ge}from"./index-CZ2f_VDZ.js";import{t as Ke}from"./textarea-vJt9undk.js";import{_ as qe,a as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,i as et,l as tt,m as nt,n as rt,o as it,p as at,r as ot,s as st,t as V,u as ct,v as lt}from"./automation-format-DB34jUyF.js";var H=e(t(),1),U=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),ut=w({includeExisting:D().optional(),authors:E(O()).optional(),assignees:E(O()).optional(),requireCurrentLabels:D().optional(),allLabels:E(O()).optional(),anyLabels:E(O()).optional(),excludeLabels:E(O()).optional(),changedLabels:E(O()).optional(),lookbackDays:A(),maxRecords:A()}),dt=k([`github`,`schedule`]),ft=x.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:O(),variants:ae([T(1),T(2),T(3)]).optional(),systemPrompt:O().optional()}),pt=w({at:O(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}),W=w({id:O(),revision:A(),name:O(),description:O().optional(),enabled:D(),kind:dt,events:E(U).optional(),intervalSeconds:A().optional(),filters:ut.optional(),schedule:Ye.optional(),task:ft,archived:pt.optional(),createdAt:O(),updatedAt:O()}),G=w({timestamp:O(),tieBreaker:O().optional()}),mt=w({since:O().datetime(),until:O().datetime(),source:A().int().min(0).max(2),page:A().int().min(1).max(10),item:A().int().min(0).max(100),event:A().int().min(0).max(1e3),cursor:G.optional()}),ht={lastError:O().max(1e3).optional(),lastErrorAt:O().datetime().optional()},gt=w({revision:A().optional(),baselineAt:O().optional(),armedAt:O().optional(),historyScan:mt.optional(),cursor:G.optional(),frozenHighWatermark:G.extend({tieBreaker:O()}).optional(),backlogAfter:G.extend({tieBreaker:O()}).optional(),nextCheckAt:O().optional(),lastSuccessAt:O().optional(),nextRunAt:O().optional(),lastRunAt:O().optional(),etags:oe(O(),O()).optional(),backoffUntil:O().optional(),consecutiveFailures:A().optional(),...ht,onceOutcome:k([`failed`,`missed`]).optional()});function _t(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var vt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),yt=w({seq:A(),ts:O(),automationId:O(),revision:A(),event:U.optional(),result:vt,reason:O().optional(),durationMs:A().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().optional(),githubTitle:O().optional(),githubUrl:O().optional(),rateLimit:w({bucket:k([`core`,`search`]),remaining:A().optional(),resetAt:O().optional()}).optional()}),bt=w({matches:A(),launched:A(),duplicates:A(),errors:A()}),xt=W.extend({state:gt.optional(),latestLog:yt.optional(),counts:bt,nextRunAt:O().optional(),onceStatus:at.optional()});w({available:D(),reason:O().optional(),timeZone:O(),scheduler:w({state:k([`scheduled`,`idle`]),nextDue:O().optional()}),automations:E(xt)}),w({automation:W}).extend({once:w({dueAt:O(),timeZone:O(),resolvedInstant:O(),note:O()}).optional()}),w({automation:W,state:gt.optional(),latestLog:yt.optional(),onceStatus:at.optional()}),w({id:O(),automationId:O(),mode:k([`preview`,`execute`]),status:k([`queued`,`running`,`complete`,`error`]),createdAt:O(),completedAt:O().optional(),matches:A().optional(),truncated:D().optional(),error:O().optional()}),w({checkId:O()}),w({records:E(yt)}),w({receiptId:O(),runId:O()}),w({runId:O()}),W.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:dt.optional(),task:ft.omit({variants:!0}).strict(),enable:D().optional()}).omit({enable:!0}).extend({enabled:D().optional(),expectedRevision:A()}),w({archived:k([`include`,`only`]).optional()}),w({mode:k([`preview`,`execute`])});var K=n();function q({text:e}){return(0,K.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var St={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Ct={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function wt(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>h(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,H.useEffect)(()=>{a()},[a]),(0,H.useEffect)(()=>p(a),[a]),(0,H.useEffect)(()=>ue((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function Tt(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function Et({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&Tt(e,t),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ie(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,K.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(Ue,{dot:St[e.result],children:Ct[e.result]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:rt(e.ts,n,u)})]}),e.reason?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,K.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,K.jsx)(M,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var J=`all`;function Dt({label:e,value:t,onChange:n,options:r}){return(0,K.jsxs)(I,{value:t,onValueChange:n,children:[(0,K.jsx)(N,{"aria-label":e,className:`w-full sm:w-52`,children:(0,K.jsx)(Ce,{})}),(0,K.jsx)(P,{children:r.map(e=>(0,K.jsx)(F,{value:e.value,children:e.label},e.value))})]})}function Ot({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=wt(e),[s,c]=(0,H.useState)(J),[l,u]=(0,H.useState)(J),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===J||e.result===s)&&(l===J||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,K.jsx)(Oe,{route:`automations`,density:i?ke(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,K.jsx)(R,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:a}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,K.jsx)(q,{text:`Nothing has run yet.`}):(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Dt,{label:`Result`,value:s,onChange:c,options:[{value:J,label:`All results`},...vt.options.map(e=>({value:e,label:Ct[e]}))]}),f?(0,K.jsx)(Dt,{label:`Event`,value:l,onChange:u,options:[{value:J,label:`All events`},...U.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,K.jsx)(q,{text:`No rows match these filters.`}):(0,K.jsx)(Et,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,K.jsx)(q,{text:`Loading execution log…`})})}function kt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=wt(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,K.jsx)(Et,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function At({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?ot(i):null,[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await _(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,K.jsx)(Oe,{route:`automations`,density:`sparse`,header:{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`},children:(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,K.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${V(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,K.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,K.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,K.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(kt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,K.jsx)(M,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,K.jsx)(M,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,K.jsx)(M,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})]}),u?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var jt=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Y=E(O().trim().min(1).max(200)).max(100).optional(),Mt=w({includeExisting:D().optional(),requireCurrentLabels:D().optional(),authors:Y,assignees:Y,allLabels:Y,anyLabels:Y,excludeLabels:Y,changedLabels:Y,lookbackDays:A().int().min(1).max(90).default(7),maxRecords:A().int().min(1).max(100).default(25)}).passthrough(),Nt=w({prompt:O().min(1).max(1e5),workflow:O().trim().min(1).max(200).optional(),steps:E(y).min(1).max(100).optional(),runner:ne.optional(),model:O().trim().min(1).max(200).optional(),effort:O().trim().min(1).max(32).optional(),variants:ae([T(1),T(2),T(3)]).optional(),worktree:D().optional(),autonomous:D().optional(),...g,...te,systemPrompt:O().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Pt=new Set(Object.keys(Nt.shape).filter(e=>e!==`variants`));function Ft(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Pt.has(e)))}ce(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},w({id:O().min(1).max(100),revision:A().int().positive(),name:O().trim().min(1).max(200),description:O().max(2e3).optional(),enabled:D().default(!1),kind:dt.default(`github`),events:E(jt).min(1).max(4).optional(),intervalSeconds:A().int().min(60).max(86400).optional(),filters:Mt.optional(),schedule:Ye.passthrough().optional(),task:Nt,archived:w({at:O().datetime(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:O().datetime(),updatedAt:O().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:b.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:b.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:b.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:b.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:b.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),w({version:T(1).default(1),automations:E(se()).default([]),tombstones:oe(O(),O().datetime()).optional()}).passthrough();var It=w({timestamp:O().datetime(),tieBreaker:O().optional()}).passthrough(),Lt=mt.extend({cursor:It.optional()}),Rt=w({revision:A().int().positive().optional(),baselineAt:O().datetime().optional(),armedAt:O().datetime().optional(),historyScan:Lt.optional(),cursor:It.optional(),frozenHighWatermark:It.extend({tieBreaker:O()}).optional(),backlogAfter:It.extend({tieBreaker:O()}).optional(),nextCheckAt:O().datetime().optional(),lastSuccessAt:O().datetime().optional(),nextRunAt:O().datetime().optional(),lastRunAt:O().datetime().optional(),etags:oe(O(),O()).optional(),backoffUntil:O().datetime().optional(),consecutiveFailures:A().int().nonnegative().optional(),...ht,onceOutcome:k([`failed`,`missed`]).optional()}).passthrough();w({version:T(1).default(1),states:oe(O(),Rt).default({})}).passthrough(),w({receiptId:O().min(1),receiptKey:O().min(1),eventId:O().min(1),automationId:O().min(1),revision:A().int().positive(),status:k([`reserved`,`launched`,`launch-error`,`released`]),runId:O().optional(),observedAt:O().datetime(),updatedAt:O().datetime(),error:O().max(2e3).optional(),occurrenceAt:O().datetime().optional(),candidate:w({eventId:O(),event:jt,timestamp:O().datetime(),tieBreaker:O(),repo:O(),nodeId:O(),number:A().int().positive(),title:O().max(500),url:O().url(),author:O().max(200),assignees:E(O().max(200)).max(100),labels:E(O().max(200)).max(100),changedLabel:O().max(200).optional()}).passthrough().optional()}).passthrough();var zt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);w({seq:A().int().positive(),ts:O().datetime(),automationId:O().min(1),revision:A().int().positive(),event:jt.optional(),result:zt,reason:O().max(2e3).optional(),durationMs:A().int().nonnegative().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().int().positive().optional(),githubTitle:O().max(500).optional(),githubUrl:O().url().optional(),rateLimit:w({bucket:k([`core`,`search`]),remaining:A().int().nonnegative().optional(),resetAt:O().datetime().optional()}).passthrough().optional()}).passthrough();var Bt=`quick-task`;function Vt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Ft(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:ct(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Bt}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Ht(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Ut(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Wt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Ht(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Ut(e)}}function Gt(e){return{...Wt(e),enable:e.enabled}}function Kt(e,t){return{...Wt(e),task:{...Ut(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function X(e){return`'${e.replace(/'/g,`'\\''`)}'`}var qt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Jt=new Set([`anyLabels`,`authors`,`changedLabels`]);function Yt(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!qt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Jt.has(e)&&Array.isArray(t)&&t.length>0)}function Xt(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function Zt(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Z(e,t){return t.startsWith(`-`)?`--${e}=${X(t)}`:`--${e} ${X(t)}`}function Qt(e){let t=[`${He()} automation add`,Z(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Z(`at`,e.schedule.at),Z(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Z(`latest-start`,Zt(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Z(`cron`,tt(e.schedule)));else{t.push(Z(`on`,e.events.join(`,`)),`--every ${Xt(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Z(`label`,n));for(let n of e.filters?.authors??[])t.push(Z(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Z(`changed-label`,n))}return t.push(...$t(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Z(`prompt`,e.task.prompt)),t.join(` `)}function $t(e){let t=[];return e.workflow&&t.push(Z(`workflow`,e.workflow)),e.runner&&t.push(Z(`runner`,e.runner)),e.model&&t.push(Z(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function en(e,t){let n=Gt(e),r=Yt(n)?Qt(n):`${He()} automation create --json ${X(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${X(t.origin)} CEZ_PROJECT_ID=${X(t.projectId)} HSQ_COCKPIT_URL=${X(t.origin)} HSQ_PROJECT_ID=${X(t.projectId)} ${r}`:r}function tn(e){let t=[],n=!1;for(let r of nn(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{A as i,_ as a,nn as o,rn as s,sn as c,tn as l}from"./queries-CYWRnyM5.js";import{B as u,Fn as d,H as f,Ur as p,V as m,_ as h,ar as g,c as ee,d as _,g as v,ir as y,ni as b,nr as x,o as S,s as C,sr as te,ti as ne,v as re,z as ie}from"./toaster-B0kvcFif.js";import{B as w,G as ae,H as oe,I as T,K as se,N as E,P as D,V as ce,W as O,j as k,z as A}from"./live-protocol-DMhTnCmf.js";import{h as le}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as ue,t as j}from"./label-CH-a6Jyv.js";import{I as de,J as fe,Y as pe,it as me,l as he,pt as ge,ut as _e,y as ve}from"./design-icons-CzEoMH9c.js";import{t as ye}from"./check-OP-CVgZG.js";import{t as M}from"./button-B7MKxYjT.js";import{n as be,r as xe,t as Se}from"./collapsible-BEV4FO-1.js";import{a as Ce,i as N,n as P,r as F,t as I}from"./select-KMLdkF0Y.js";import{r as we}from"./switch-SP8pw5uU.js";import{c as Te,s as Ee,t as L}from"./project-router-BvBqllk2.js";import{a as De,c as Oe,d as ke,n as Ae,s as R,u as z}from"./page-shell-7pLJMOgh.js";import{t as je}from"./centered-state-V15AR_qo.js";import{D as Me,Fn as Ne,In as Pe,K as Fe,M as Ie,O as Le,U as Re,W as ze,Xn as B,_n as Be,lr as Ve,pn as He,r as Ue,t as We,xn as Ge}from"./index-mCjln54E.js";import{t as Ke}from"./textarea-vJt9undk.js";import{_ as qe,a as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,i as et,l as tt,m as nt,n as rt,o as it,p as at,r as ot,s as st,t as V,u as ct,v as lt}from"./automation-format-DB34jUyF.js";var H=e(t(),1),U=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),ut=w({includeExisting:D().optional(),authors:E(O()).optional(),assignees:E(O()).optional(),requireCurrentLabels:D().optional(),allLabels:E(O()).optional(),anyLabels:E(O()).optional(),excludeLabels:E(O()).optional(),changedLabels:E(O()).optional(),lookbackDays:A(),maxRecords:A()}),dt=k([`github`,`schedule`]),ft=x.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:O(),variants:ae([T(1),T(2),T(3)]).optional(),systemPrompt:O().optional()}),pt=w({at:O(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}),W=w({id:O(),revision:A(),name:O(),description:O().optional(),enabled:D(),kind:dt,events:E(U).optional(),intervalSeconds:A().optional(),filters:ut.optional(),schedule:Ye.optional(),task:ft,archived:pt.optional(),createdAt:O(),updatedAt:O()}),G=w({timestamp:O(),tieBreaker:O().optional()}),mt=w({since:O().datetime(),until:O().datetime(),source:A().int().min(0).max(2),page:A().int().min(1).max(10),item:A().int().min(0).max(100),event:A().int().min(0).max(1e3),cursor:G.optional()}),ht={lastError:O().max(1e3).optional(),lastErrorAt:O().datetime().optional()},gt=w({revision:A().optional(),baselineAt:O().optional(),armedAt:O().optional(),historyScan:mt.optional(),cursor:G.optional(),frozenHighWatermark:G.extend({tieBreaker:O()}).optional(),backlogAfter:G.extend({tieBreaker:O()}).optional(),nextCheckAt:O().optional(),lastSuccessAt:O().optional(),nextRunAt:O().optional(),lastRunAt:O().optional(),etags:oe(O(),O()).optional(),backoffUntil:O().optional(),consecutiveFailures:A().optional(),...ht,onceOutcome:k([`failed`,`missed`]).optional()});function _t(e){let t=e?.consecutiveFailures??0;if(!(t<3||!e?.lastError))return{consecutiveFailures:t,lastError:e.lastError,...e.lastErrorAt?{lastErrorAt:e.lastErrorAt}:{},...e.backoffUntil?{retryAt:e.backoffUntil}:{}}}var vt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),yt=w({seq:A(),ts:O(),automationId:O(),revision:A(),event:U.optional(),result:vt,reason:O().optional(),durationMs:A().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().optional(),githubTitle:O().optional(),githubUrl:O().optional(),rateLimit:w({bucket:k([`core`,`search`]),remaining:A().optional(),resetAt:O().optional()}).optional()}),bt=w({matches:A(),launched:A(),duplicates:A(),errors:A()}),xt=W.extend({state:gt.optional(),latestLog:yt.optional(),counts:bt,nextRunAt:O().optional(),onceStatus:at.optional()});w({available:D(),reason:O().optional(),timeZone:O(),scheduler:w({state:k([`scheduled`,`idle`]),nextDue:O().optional()}),automations:E(xt)}),w({automation:W}).extend({once:w({dueAt:O(),timeZone:O(),resolvedInstant:O(),note:O()}).optional()}),w({automation:W,state:gt.optional(),latestLog:yt.optional(),onceStatus:at.optional()}),w({id:O(),automationId:O(),mode:k([`preview`,`execute`]),status:k([`queued`,`running`,`complete`,`error`]),createdAt:O(),completedAt:O().optional(),matches:A().optional(),truncated:D().optional(),error:O().optional()}),w({checkId:O()}),w({records:E(yt)}),w({receiptId:O(),runId:O()}),w({runId:O()}),W.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:dt.optional(),task:ft.omit({variants:!0}).strict(),enable:D().optional()}).omit({enable:!0}).extend({enabled:D().optional(),expectedRevision:A()}),w({archived:k([`include`,`only`]).optional()}),w({mode:k([`preview`,`execute`])});var K=n();function q({text:e}){return(0,K.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var St={launched:`success`,manual:`success`,"catch-up":`success`,skipped:`neutral`,missed:`pending`,"no-match":`neutral`,preview:`neutral`,baseline:`neutral`,duplicate:`neutral`,failed:`danger`,error:`danger`,"rate-limited":`danger`},Ct={launched:`Launched`,manual:`Manual`,"catch-up":`Catch up`,skipped:`Skipped`,missed:`Missed`,"no-match":`No match`,preview:`Preview`,baseline:`Baseline`,duplicate:`Duplicate`,failed:`Failed`,error:`Error`,"rate-limited":`Rate limited`};function wt(e){let[t,n]=(0,H.useState)(),[r,i]=(0,H.useState)(``),a=(0,H.useCallback)(t=>h(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,H.useEffect)(()=>{a()},[a]),(0,H.useEffect)(()=>p(a),[a]),(0,H.useEffect)(()=>ue((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function Tt(e,t){return e.result!==`failed`&&e.result!==`error`||!e.receiptId||e.runId?!1:!t.some(t=>t.receiptId===e.receiptId&&(t.runId||t.seq>e.seq))}function Et({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&Tt(e,t),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await ie(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,K.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(Ue,{dot:St[e.result],children:Ct[e.result]}),(0,K.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:rt(e.ts,n,u)})]}),e.reason?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,K.jsx)(`a`,{className:`inline-flex min-h-11 items-center underline underline-offset-4 break-all`,href:e.githubUrl,target:`_blank`,rel:`noreferrer`,children:e.githubTitle??`GitHub #${e.githubNumber??``}`}):null,e.runId?(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,K.jsx)(M,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var J=`all`;function Dt({label:e,value:t,onChange:n,options:r}){return(0,K.jsxs)(I,{value:t,onValueChange:n,children:[(0,K.jsx)(N,{"aria-label":e,className:`w-full sm:w-52`,children:(0,K.jsx)(Ce,{})}),(0,K.jsx)(P,{children:r.map(e=>(0,K.jsx)(F,{value:e.value,children:e.label},e.value))})]})}function Ot({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=wt(e),[s,c]=(0,H.useState)(J),[l,u]=(0,H.useState)(J),d=(0,H.useMemo)(()=>(i??[]).filter(e=>(s===J||e.result===s)&&(l===J||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,K.jsx)(Oe,{route:`automations`,density:i?ke(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,K.jsx)(R,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:a}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,K.jsx)(q,{text:`Nothing has run yet.`}):(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Dt,{label:`Result`,value:s,onChange:c,options:[{value:J,label:`All results`},...vt.options.map(e=>({value:e,label:Ct[e]}))]}),f?(0,K.jsx)(Dt,{label:`Event`,value:l,onChange:u,options:[{value:J,label:`All events`},...U.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,K.jsx)(q,{text:`No rows match these filters.`}):(0,K.jsx)(Et,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,K.jsx)(q,{text:`Loading execution log…`})})}function kt({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=wt(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`flex flex-wrap items-center gap-x-2 border-t border-border pt-2.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,K.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,K.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,K.jsx)(Et,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function At({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?ot(i):null,[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(``),f=(0,H.useRef)(null),p=(0,H.useRef)(null),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=m.current===`keep`?p.current:m.current===`delete`?f.current:null;m.current=null,e?.focus()},[o]);let h=async()=>{l(!0);try{await _(e.id),n()}catch(e){d(e instanceof Error?e.message:String(e)),l(!1)}},g=[[`Workflow`,e.task.workflow],[`Runner`,e.task.runner],[`Model`,e.task.model],[`Effort`,e.task.effort]];return(0,K.jsx)(Oe,{route:`automations`,density:`sparse`,header:{title:e.name,subtitle:`Archived one-time schedule. It cannot change; delete it when you no longer need the record.`},children:(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,K.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${V(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,K.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,K.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,K.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,K.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,K.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,K.jsxs)(`div`,{className:`grid gap-1`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,K.jsxs)(`section`,{className:`min-w-0`,children:[(0,K.jsx)(kt,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,K.jsx)(M,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,K.jsx)(M,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,K.jsx)(M,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})]}),u?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var jt=k([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Y=E(O().trim().min(1).max(200)).max(100).optional(),Mt=w({includeExisting:D().optional(),requireCurrentLabels:D().optional(),authors:Y,assignees:Y,allLabels:Y,anyLabels:Y,excludeLabels:Y,changedLabels:Y,lookbackDays:A().int().min(1).max(90).default(7),maxRecords:A().int().min(1).max(100).default(25)}).passthrough(),Nt=w({prompt:O().min(1).max(1e5),workflow:O().trim().min(1).max(200).optional(),steps:E(y).min(1).max(100).optional(),runner:ne.optional(),model:O().trim().min(1).max(200).optional(),effort:O().trim().min(1).max(32).optional(),variants:ae([T(1),T(2),T(3)]).optional(),worktree:D().optional(),autonomous:D().optional(),...g,...te,systemPrompt:O().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Pt=new Set(Object.keys(Nt.shape).filter(e=>e!==`variants`));function Ft(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Pt.has(e)))}ce(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let t=e;return t.kind===`schedule`?e:{...t,intervalSeconds:t.intervalSeconds??300,filters:t.filters??{}}},w({id:O().min(1).max(100),revision:A().int().positive(),name:O().trim().min(1).max(200),description:O().max(2e3).optional(),enabled:D().default(!1),kind:dt.default(`github`),events:E(jt).min(1).max(4).optional(),intervalSeconds:A().int().min(60).max(86400).optional(),filters:Mt.optional(),schedule:Ye.passthrough().optional(),task:Nt,archived:w({at:O().datetime(),outcome:k([`launched`,`cancelled`]),runId:O().optional(),receiptId:O().optional(),trigger:k([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:O().datetime(),updatedAt:O().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:b.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:b.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:b.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:b.custom,path:[`filters`],message:`a GitHub automation needs its bounded filter`}),e.events?.some(e=>e===`issue.labeled`||e===`issue.unlabeled`)&&!e.filters?.changedLabels?.length&&t.addIssue({code:b.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),w({version:T(1).default(1),automations:E(se()).default([]),tombstones:oe(O(),O().datetime()).optional()}).passthrough();var It=w({timestamp:O().datetime(),tieBreaker:O().optional()}).passthrough(),Lt=mt.extend({cursor:It.optional()}),Rt=w({revision:A().int().positive().optional(),baselineAt:O().datetime().optional(),armedAt:O().datetime().optional(),historyScan:Lt.optional(),cursor:It.optional(),frozenHighWatermark:It.extend({tieBreaker:O()}).optional(),backlogAfter:It.extend({tieBreaker:O()}).optional(),nextCheckAt:O().datetime().optional(),lastSuccessAt:O().datetime().optional(),nextRunAt:O().datetime().optional(),lastRunAt:O().datetime().optional(),etags:oe(O(),O()).optional(),backoffUntil:O().datetime().optional(),consecutiveFailures:A().int().nonnegative().optional(),...ht,onceOutcome:k([`failed`,`missed`]).optional()}).passthrough();w({version:T(1).default(1),states:oe(O(),Rt).default({})}).passthrough(),w({receiptId:O().min(1),receiptKey:O().min(1),eventId:O().min(1),automationId:O().min(1),revision:A().int().positive(),status:k([`reserved`,`launched`,`launch-error`,`released`]),runId:O().optional(),observedAt:O().datetime(),updatedAt:O().datetime(),error:O().max(2e3).optional(),occurrenceAt:O().datetime().optional(),candidate:w({eventId:O(),event:jt,timestamp:O().datetime(),tieBreaker:O(),repo:O(),nodeId:O(),number:A().int().positive(),title:O().max(500),url:O().url(),author:O().max(200),assignees:E(O().max(200)).max(100),labels:E(O().max(200)).max(100),changedLabel:O().max(200).optional()}).passthrough().optional()}).passthrough();var zt=k([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);w({seq:A().int().positive(),ts:O().datetime(),automationId:O().min(1),revision:A().int().positive(),event:jt.optional(),result:zt,reason:O().max(2e3).optional(),durationMs:A().int().nonnegative().optional(),receiptId:O().optional(),runId:O().optional(),githubNumber:A().int().positive().optional(),githubTitle:O().max(500).optional(),githubUrl:O().url().optional(),rateLimit:w({bucket:k([`core`,`search`]),remaining:A().int().nonnegative().optional(),resetAt:O().datetime().optional()}).passthrough().optional()}).passthrough();var Bt=`quick-task`;function Vt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Ft(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:ct(e.schedule??{type:`daily`}),events:e.events??[`issue.opened`],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Bt}:{}:{workflow:n},...r===void 0?{}:{runner:r},...i===void 0?{}:{model:i},autonomous:a??!0,archiveWhenDone:o??!1,autoMergePr:s??!1,allowWorkers:c!==!1,allowMessaging:l!==!1,enabled:e.enabled??e.enable??!1,taskExtra:u}}function Ht(e){switch(e.type){case`daily`:case`weekdays`:return{type:e.type,hour:e.hour,minute:e.minute};case`weekly`:return{type:`weekly`,hour:e.hour,minute:e.minute,day:e.day};case`hours`:return{type:`hours`,every:e.every};case`once`:return{type:`once`,at:e.at??``,timeZone:e.timeZone??``,...e.latestStartMinutes===void 0?{}:{latestStartMinutes:e.latestStartMinutes}}}}function Ut(e){return{...e.taskExtra,prompt:e.prompt,...e.workflow?{workflow:e.workflow}:{},...e.runner?{runner:e.runner}:{},...e.model?{model:e.model}:{},autonomous:e.autonomous,...e.archiveWhenDone?{archiveWhenDone:!0}:{},...e.autoMergePr?{autoMergePr:!0}:{},...e.allowWorkers?{}:{allowWorkers:!1},...e.allowMessaging?{}:{allowMessaging:!1}}}function Wt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:Ht(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Ut(e)}}function Gt(e){return{...Wt(e),enable:e.enabled}}function Kt(e,t){return{...Wt(e),task:{...Ut(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function X(e){return`'${e.replace(/'/g,`'\\''`)}'`}var qt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),Jt=new Set([`anyLabels`,`authors`,`changedLabels`]);function Yt(e){if(e.description!==void 0||!e.name.trim()||!e.task.prompt.trim())return!1;let t=e.task;if(Object.keys(t).some(e=>!qt.has(e))||t.archiveWhenDone===!1||t.autoMergePr===!1||t.allowWorkers===!0||t.allowMessaging===!0||t.worktree!==!0)return!1;if(e.kind===`schedule`)return e.schedule!==void 0;let{events:n,filters:r}=e;return!n?.length||n.some(e=>e.includes(`,`))||!r||r.lookbackDays!==7||r.maxRecords!==25?!1:Object.entries(r).every(([e,t])=>e===`lookbackDays`||e===`maxRecords`||e===`includeExisting`&&t===!0||Jt.has(e)&&Array.isArray(t)&&t.length>0)}function Xt(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function Zt(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function Z(e,t){return t.startsWith(`-`)?`--${e}=${X(t)}`:`--${e} ${X(t)}`}function Qt(e){let t=[`${He()} automation add`,Z(`name`,e.name)];if(e.schedule?.type===`once`)t.push(Z(`at`,e.schedule.at),Z(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(Z(`latest-start`,Zt(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(Z(`cron`,tt(e.schedule)));else{t.push(Z(`on`,e.events.join(`,`)),`--every ${Xt(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(Z(`label`,n));for(let n of e.filters?.authors??[])t.push(Z(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(Z(`changed-label`,n))}return t.push(...$t(e.task)),e.enable===!0&&t.push(`--enable`),t.push(Z(`prompt`,e.task.prompt)),t.join(` `)}function $t(e){let t=[];return e.workflow&&t.push(Z(`workflow`,e.workflow)),e.runner&&t.push(Z(`runner`,e.runner)),e.model&&t.push(Z(`model`,e.model)),e.autonomous===!1&&t.push(`--no-autonomous`),e.archiveWhenDone&&t.push(`--archive-when-done`),e.autoMergePr&&t.push(`--auto-merge-pr`),e.allowWorkers===!1&&t.push(`--no-workers`),e.allowMessaging===!1&&t.push(`--no-messaging`),t}function en(e,t){let n=Gt(e),r=Yt(n)?Qt(n):`${He()} automation create --json ${X(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${X(t.origin)} CEZ_PROJECT_ID=${X(t.projectId)} HSQ_COCKPIT_URL=${X(t.origin)} HSQ_PROJECT_ID=${X(t.projectId)} ${r}`:r}function tn(e){let t=[],n=!1;for(let r of nn(e)){let e=t.length-1;!n&&/^[A-Z_][A-Z0-9_]*=/.test(r)?t.push(r):r.startsWith(`--`)||!n?(t.push(r),n=!0):t[e]=`${t[e]} ${r}`}return t.map((e,t)=>t===0?e:` ${e}`).join(` \\
2
2
  `)}function nn(e){let t=[],n=``,r=!1;for(let i=0;i<e.length;i+=1){let a=e[i];!r&&a===`\\`&&i+1<e.length?(n+=a+e[i+1],i+=1):a===`'`?(r=!r,n+=a):a===` `&&!r?(n&&t.push(n),n=``):n+=a}return n&&t.push(n),t}function rn({draft:e}){let t=Ee(),n=window.location.origin,i=(0,H.useMemo)(()=>{let r=en(e);return t?`HSQ_COCKPIT_URL=${X(n)} HSQ_PROJECT_ID=${X(t)} ${r}`:r},[e,n,t]),a=(0,H.useMemo)(()=>tn(i),[i]),[o,s]=(0,H.useState)(`idle`),[c,l]=(0,H.useState)(!1),u=(0,H.useId)(),d=(0,H.useRef)(void 0);(0,H.useEffect)(()=>()=>clearTimeout(d.current),[]),(0,H.useEffect)(()=>s(`idle`),[i]);let f=async()=>{clearTimeout(d.current);try{await navigator.clipboard.writeText(a),s(`copied`),d.current=setTimeout(()=>s(`idle`),1600)}catch{s(`failed`)}};return(0,K.jsxs)(`section`,{"aria-labelledby":`copy-as-cli-heading`,"data-slot":`copy-as-cli`,className:`min-w-0 max-w-full overflow-hidden rounded-xl border border-card-edge bg-card shadow-card px-4 py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,K.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,K.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":c,"aria-controls":u,"aria-label":c?`Hide command`:`Show command`,className:`min-w-0 shrink gap-1 px-1.5 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>l(e=>!e),children:[(0,K.jsx)(`span`,{className:`truncate`,children:c?`Hide`:`Show`}),(0,K.jsx)(he,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform`,c&&`rotate-180`)})]}),(0,K.jsxs)(M,{type:`button`,variant:`outline`,size:`sm`,className:`ms-auto gap-1.5 px-2 text-[12px] font-medium max-md:h-11 no-hover:h-11`,onClick:()=>void f(),children:[o===`copied`?(0,K.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5`}):(0,K.jsx)(Ve,{"aria-hidden":`true`,className:`size-3.5`}),o===`copied`?`Copied`:`Copy`]})]}),(0,K.jsx)(`div`,{id:u,hidden:!c,className:`mbs-2 max-w-full rounded-lg border border-border bg-muted has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-ring`,children:(0,K.jsx)(`pre`,{"data-slot":`copy-as-cli-line`,tabIndex:0,"aria-label":`Command line`,className:`m-0 max-w-full px-3 pt-2.5 pb-3 font-mono text-xs leading-5 break-all whitespace-pre-wrap text-muted-foreground outline-none`,children:a})}),(0,K.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:o===`failed`?`Could not copy — select the line and copy it by hand.`:(0,K.jsxs)(K.Fragment,{children:[`The definition Save paused would create. `,(0,K.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${He()} automation schema`}),` prints its shape.`]})})]})}function an({pressed:e,onClick:t,disabled:n,children:i}){return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":e,disabled:n,onClick:t,className:r(`inline-flex min-h-11 items-center justify-center rounded-md border px-3.5 text-[13px] font-medium transition-colors outline-hidden focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50`,e?`border-border bg-card font-semibold text-foreground shadow-xs`:`border-transparent bg-transparent text-muted-foreground hover:text-foreground`),children:i})}var on={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},sn={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function cn(e){let t=e.map(e=>on[e]);if(t.length===0)return`When GitHub changes`;let n=t.slice(0,-1),r=t[t.length-1];return`When ${n.length>0?`${n.join(`, `)} or ${r}`:r}`}var ln=U.options,un=[{seconds:60,label:`1 minute`},{seconds:300,label:`5 minutes`},{seconds:900,label:`15 minutes`},{seconds:1800,label:`30 minutes`},{seconds:3600,label:`1 hour`}],dn=[{key:`authors`,label:`Authors`},{key:`assignees`,label:`Assignees`},{key:`allLabels`,label:`Has all labels`},{key:`anyLabels`,label:`Has any label`},{key:`excludeLabels`,label:`Excludes labels`},{key:`changedLabels`,label:`Changed labels`,hint:`Required for the two label events.`}],fn=e=>(e??[]).join(`, `),pn=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function mn(e){return e?`Existing matches within the lookback are eligible on the next check. Previously processed matches will not run again.`:`Enabling starts from a current-time baseline. Existing matches will not launch tasks.`}function hn(e){let t=Math.max(1,Math.round(e.intervalSeconds/60));return`Polls GitHub every ${t} minute${t===1?``:`s`} for ${e.events.join(`, `)||`no events`}. ${mn(e.filters.includeExisting)}`}function gn({draft:e,onChange:t,disabledReason:n}){let r=n=>{t({events:e.events.includes(n)?e.events.filter(e=>e!==n):[...e.events,n]})},i=n=>t({filters:{...e.filters,...n}}),a=(n,r)=>{let i=pn(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=un.some(t=>t.seconds===e.intervalSeconds)?un:[...un,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,K.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,K.jsx)(`div`,{role:`group`,"aria-label":`GitHub events`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:ln.map(t=>(0,K.jsx)(an,{pressed:e.events.includes(t),onClick:()=>r(t),children:sn[t]},t))}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-interval`,children:`Check every`}),(0,K.jsxs)(I,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,K.jsx)(N,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,K.jsx)(Ce,{})}),(0,K.jsx)(P,{children:o.map(e=>(0,K.jsx)(F,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,K.jsx)(`span`,{children:`Include existing items`})]}),(0,K.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:mn(e.filters.includeExisting)})]}),(0,K.jsxs)(Se,{children:[(0,K.jsxs)(xe,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,K.jsx)(he,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,K.jsx)(be,{children:(0,K.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[dn.map(t=>(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,K.jsx)(B,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:fn(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,K.jsx)(B,{id:`automation-filter-lookback`,className:`border-border`,type:`number`,min:1,value:e.filters.lookbackDays,onChange:e=>i({lookbackDays:Math.max(1,Number(e.target.value)||1)})})]}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,K.jsx)(B,{id:`automation-filter-max`,className:`border-border`,type:`number`,min:1,value:e.filters.maxRecords,onChange:e=>i({maxRecords:Math.max(1,Number(e.target.value)||1)})})]})]})})]})]})}var _n=e=>String(e).padStart(2,`0`);function Q({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,H.useState)(_n(t)),o=(0,H.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${_n(n)}.`,l=(0,H.useId)();return(0,H.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{ref:o,"aria-label":e,"aria-invalid":s||void 0,"aria-describedby":s?l:void 0,inputMode:`numeric`,maxLength:2,className:`w-20 border-border text-center tabular-nums`,value:i,onChange:e=>{a(e.target.value),/^\d{1,2}$/.test(e.target.value)&&Number(e.target.value)<=n&&r(Number(e.target.value))},onBlur:()=>a(_n(t))}),s?(0,K.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var vn=[{minutes:void 0,label:`No limit`},{minutes:30,label:`30 minutes`},{minutes:120,label:`2 hours`},{minutes:360,label:`6 hours`},{minutes:1440,label:`1 day`},{minutes:10080,label:`7 days`}],yn=`none`,bn=e=>String(e).padStart(2,`0`);function xn(e,t=Date.now()){let n=lt(t,e)??lt(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${bn(r.getUTCMonth()+1)}-${bn(r.getUTCDate())}T09:00`}function Sn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function Cn({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?nt(e.at):null,a=e.at?.slice(0,10)??``,o=i?.hour??9,s=i?.minute??0,c=(e,t,n)=>r({at:`${e}T${bn(t)}:${bn(n)}`}),l=(0,H.useRef)(null),u=(0,H.useId)(),d=Ze(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,H.useEffect)(()=>{l.current?.setCustomValidity(f?Je:``)},[f]);let p=ot(e);return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-date`,children:`Date`}),(0,K.jsx)(B,{ref:l,id:`automation-once-date`,type:`date`,className:`w-44 max-w-full border-border`,value:a,"aria-invalid":f||void 0,"aria-describedby":f?u:void 0,onChange:e=>{/^\d{4}-\d{2}-\d{2}$/.test(e.target.value)&&c(e.target.value,o,s)},required:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(Q,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(Q,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,K.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:Je}):null,(0,K.jsx)(Tn,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,K.jsx)(En,{value:e.latestStartMinutes,onChange:t=>n(wn(e,t))}),p?(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Runs once at ${p.time} on ${p.date} (${e.timeZone}). ${p.note?`${p.note} `:``}Squawk must be running then.`}):null]})}function wn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function Tn({value:e,onCommit:t}){let[n,r]=(0,H.useState)(e),i=(0,H.useRef)(null),a=(0,H.useId)(),o=(0,H.useId)(),[s]=(0,H.useState)(Sn),c=n!==e||!qe(n),l=Qe(n);return(0,H.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,K.jsx)(B,{ref:i,id:`automation-once-zone`,list:a,autoComplete:`off`,spellCheck:!1,className:`w-full border-border sm:w-72`,value:n,"aria-invalid":c||void 0,"aria-describedby":c?o:void 0,onChange:e=>{r(e.target.value),qe(e.target.value)&&t(e.target.value)}}),(0,K.jsx)(`datalist`,{id:a,children:s.map(e=>(0,K.jsx)(`option`,{value:e},e))}),c?(0,K.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function En({value:e,onChange:t}){let n=vn.some(t=>t.minutes===e)||e===void 0?vn:[...vn,{minutes:e,label:`${e} minutes`}];return(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,K.jsxs)(I,{value:e===void 0?yn:String(e),onValueChange:e=>t(e===yn?void 0:Number(e)),children:[(0,K.jsx)(N,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,K.jsx)(Ce,{})}),(0,K.jsx)(P,{children:n.map(e=>(0,K.jsx)(F,{value:e.minutes===void 0?yn:String(e.minutes),children:e.label},e.label))})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`If Squawk was not running at the time, it still starts the task this long afterwards; later, the schedule is marked missed.`})]})}var Dn=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function On({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??xn(r),timeZone:e.timeZone??r}:{type:t});return(0,K.jsxs)(`div`,{className:`grid gap-4`,children:[(0,K.jsx)(`div`,{role:`group`,"aria-label":`Repeat`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:Dn.map(t=>(0,K.jsx)(an,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,K.jsx)(Cn,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,K.jsx)(`div`,{role:`group`,"aria-label":`Day of the week`,className:`inline-flex w-fit max-w-full flex-wrap gap-1 rounded-lg border border-border bg-muted/60 p-1`,children:st.map((t,n)=>(0,K.jsx)(an,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,K.jsxs)(`div`,{className:`grid gap-2`,children:[(0,K.jsx)(j,{htmlFor:`automation-every`,children:`Run every`}),(0,K.jsxs)(I,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,K.jsx)(N,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,K.jsx)(Ce,{})}),(0,K.jsx)(P,{children:it.map(e=>(0,K.jsx)(F,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Counted from midnight, so “every 6 hours” runs at 00:00, 06:00, 12:00 and 18:00.`})]}):(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,K.jsx)(Q,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,K.jsx)(Q,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,K.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,K.jsx)(`code`,{className:`font-mono text-foreground`,children:tt(e)})]})]})}var kn=40*864e5,An=5;function jn({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,K.jsx)(Mn,{schedule:e,now:n});let r=Xe(e,n+1,n+kn,t,An);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,K.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,K.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,K.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:V(new Date(e).toISOString(),t)}),(0,K.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:et(n,e)})]},e))}),(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Mn({schedule:e,now:t}){let n=Ze(e),r=ot(e);return(0,K.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,K.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,K.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:et(t,n)}):null]}),r?.note?(0,K.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,K.jsx)(`p`,{className:`mt-3 text-xs break-words text-muted-foreground`,children:`Times are in ${e.timeZone??`UTC`}. Squawk must be running then; afterwards the schedule is archived with its task.`})]})}var Nn={schedule:`On a schedule`,github:`When GitHub changes`};function Pn(e){return/time zone|due time/i.test(e)?`when`:/placeholder|prompt|workflow|runner|model|task|autonomous/i.test(e)?`run`:/\bname\b/i.test(e)?`name`:/schedule|github|event|filter|label|interval|remote|forge|lookback|records?|hour|minute|poll|kind|archived/i.test(e)?`when`:`form`}function Fn({title:e,hideLegend:t=!1,failure:n,section:r,children:i}){let a=(0,H.useId)();return(0,K.jsxs)(`section`,{role:t?void 0:`group`,"aria-labelledby":t?void 0:a,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[t?null:(0,K.jsx)(`h2`,{id:a,className:`text-sm font-semibold text-foreground`,children:e}),i,n?.section===r&&!n.conflict?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:n.message}):null]})}function In({draft:e,patch:t,forge:n,automation:r}){return(0,K.jsx)(K.Fragment,{children:r?(0,K.jsxs)(`p`,{className:`text-sm`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Nn[e.kind]]}):(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(We,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:Nn.schedule},{value:`github`,label:Nn.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Ln({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,K.jsx)(On,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,K.jsx)(gn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Rn({draft:e,patch:t,saving:n,automation:r}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(j,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,K.jsx)(Ke,{id:`automation-prompt`,value:e.prompt,onChange:e=>t({prompt:e.target.value}),rows:3,className:`[field-sizing:fixed] min-h-[88px] resize-none border-border bg-background`,required:!0}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,K.jsxs)(K.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),(0,K.jsx)(Un,{draft:e,patch:t}),(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":`Autonomous`,checked:e.autonomous,onCheckedChange:e=>t({autonomous:e})}),(0,K.jsxs)(`span`,{children:[`Autonomous `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`· runs without waiting for answers`})]})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`Each run is an ordinary task in its own worktree, queued behind the parallel cap.`}),(0,K.jsx)(Le,{archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,K.jsx)(Me,{allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),r?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function zn({draft:e,patch:t,automation:n}){let r=e.kind===`schedule`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,K.jsx)(we,{"aria-label":n?`Enabled`:`Enable after saving`,checked:e.enabled,onCheckedChange:e=>t({enabled:e})}),(0,K.jsx)(`span`,{children:n?`Enabled`:`Enable after saving`})]}),(0,K.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:r&&e.schedule.type===`once`?`It runs once at the time set above, then moves to Archived with its task.`:r?`The first run is the next occurrence shown beside the schedule.`:mn(e.filters.includeExisting)})]})}function Bn({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,H.useState)(()=>Vt(e)),[s,c]=(0,H.useState)(e?.revision),[l,u]=(0,H.useState)(),[p,h]=(0,H.useState)(!1),[g,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(!1),[x,S]=(0,H.useState)(``),C=e=>o(t=>({...t,...e})),te=async t=>{if(t.preventDefault(),p)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}h(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await f(e.id,Kt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await m(e.id,a.enabled))}else await ee(Gt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof d&&t.status===409&&/revision conflict/i.test(n)?u({section:`form`,message:`Edited elsewhere — reload to see the latest version`,conflict:!0}):u({section:i===`enable`?`enable`:Pn(n),message:n})}finally{h(!1)}},ne=async()=>{if(!(!e||y)){b(!0),S(``);try{await _(e.id),r()}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(!1)}}},re=(0,H.useId)(),ie=(0,H.useId)(),w=a.kind===`schedule`;return(0,K.jsx)(De,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Hn({automation:e,draft:a,formId:re,saveHintId:ie,saving:p}),children:(0,K.jsxs)(`form`,{id:re,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:items-start`,onSubmit:te,children:[(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,K.jsx)(Fn,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(j,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,K.jsx)(B,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>C({name:e.target.value}),required:!0})]})}),(0,K.jsxs)(Fn,{title:`When`,section:`when`,failure:l,children:[(0,K.jsx)(In,{draft:a,patch:C,forge:t,automation:e}),(0,K.jsx)(Ln,{draft:a,patch:C,forge:t,timeZone:n,automation:e})]}),(0,K.jsx)(Fn,{title:`What to run`,section:`run`,failure:l,children:(0,K.jsx)(Rn,{draft:a,patch:C,saving:p,automation:e})}),(0,K.jsx)(Fn,{title:`Enable`,section:`enable`,failure:l,children:(0,K.jsx)(zn,{draft:a,patch:C,automation:e})}),l?.section===`form`?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,K.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,K.jsx)(M,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:y,onClick:()=>void ne(),children:`Delete automation`}),(0,K.jsx)(M,{type:`button`,variant:`outline`,disabled:y,onClick:()=>{v(!1),S(``)},children:`Keep`})]})]}):(0,K.jsx)(M,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>v(!0),children:`Delete`}),x?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:x}):null]}):null]}),(0,K.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4`,children:[w?(0,K.jsx)(jn,{schedule:a.schedule,timeZone:n}):(0,K.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,K.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,K.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:hn(a)})]}),(0,K.jsx)(rn,{draft:a})]})]})})}function Vn(e){let t=[!e.name.trim()&&`a name`,!e.prompt.trim()&&`a prompt`].filter(Boolean);return t.length?`Add ${t.join(` and `)} to save.`:``}function Hn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Vn(t),s=e?`Save changes`:t.enabled?`Save and enable`:`Save paused`;return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:o?(0,K.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`text-xs text-muted-foreground`,children:o}):void 0,secondaryActions:(0,K.jsx)(R,{type:`button`,variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,K.jsx)(R,{type:`submit`,form:n,variant:`primary`,disabled:i||a!==``,title:a?`${a} is required`:void 0,"aria-describedby":o?r:void 0,children:i?`Saving…`:s})}}function Un({draft:e,patch:t}){let n=i(),r=Be(),{runners:u,signedOut:d}=r.runnersOn(e=>r.repoAccount?.[e]),f=a(),p=s(),{runner:m,ready:h}=o(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,r.repoAccount?.[m]),ee=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],_=[...new Set([...u,...e.runner?[e.runner]:[]])],v=Ie(m,p.data,g.data,[e.model]),y=v.find(t=>t.id===(e.model??``))?.label??e.model??`auto`,b=e=>(0,K.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,K.jsx)(ze,{children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Re,{slot:`automation-workflow-pill`,icon:b(_e),fieldLabel:!0,ariaLabel:`Workflow`,label:e.workflow??`inline steps`,value:e.workflow??``,disabled:e.workflow===void 0,disabledHint:`This automation carries its own steps.`,options:ee.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,K.jsx)(Re,{slot:`automation-runner-pill`,icon:b(me),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?l(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},..._.map(e=>({value:e,label:l(p.data,e)}))],footer:(0,K.jsx)(Fe,{uninstalled:r.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,K.jsx)(Re,{slot:`automation-model-pill`,icon:b(ve),fieldLabel:!0,ariaLabel:`Model`,label:y,value:e.model??``,options:v.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Wn({data:e,error:t,refresh:n,archived:i=!1,onArchivedChange:a}){let[o,s]=(0,H.useState)({}),[c,l]=(0,H.useState)({}),d=(e,t)=>s(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),f=async(e,t)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){d(e,{text:t instanceof Error?t.message:String(t),tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},p=e=>f(e.id,async()=>{d(e.id,{text:`Starting…`,tone:`info`});let{runId:t}=await u(e.id);d(e.id,{text:`Started task`,tone:`info`,runId:t}),n()}),h=e=>f(e.id,async()=>{d(e.id,void 0),await m(e.id,!e.enabled),await n()}),g=e=>f(e.id,async()=>{d(e.id,void 0),await S(e.id),await n()}),ee=e=>f(e.id,async()=>{d(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await C(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await v(t);if(r.status===`complete`){d(e.id,{text:`${r.matches??0} filter match${r.matches===1?``:`es`} found; no tasks launched. Counts can include closed items and previously processed events.`,tone:`info`}),n();return}if(r.status===`error`)throw Error(r.error??`Preview failed`);await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)}),_=e?.automations??[],y=_.filter(e=>!e.archived),b=_.filter(e=>!!e.archived),x=i?b:y;return(0,K.jsx)(z,{route:`automations`,density:e?ke(x.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,K.jsx)(R,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(L,{to:`/automations/new`,children:[(0,K.jsx)(fe,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&x.length>0&&!i?(0,K.jsx)(Ae,{summary:`${x.length} active ${x.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,K.jsx)(M,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,K.jsx)(L,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:t}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[a?(0,K.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`active`,"aria-pressed":!i,onClick:()=>a(!1),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,!i&&`border-accent-text text-foreground`),children:[`Current`,(0,K.jsx)(Gn,{count:y.length})]}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`automations-tab`,"data-view":`archived`,"aria-pressed":i,onClick:()=>a(!0),className:r(`-mb-px flex min-h-11 items-center justify-center gap-1.5 border-b-2 border-transparent text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground`,i&&`border-accent-text text-foreground`),children:[`Archived`,(0,K.jsx)(Gn,{count:b.length})]})]}):(0,K.jsx)(`span`,{}),(0,K.jsx)(`div`,{className:`pb-2.5`,children:(0,K.jsx)(Kn,{data:e})})]}),i&&x.length===0?(0,K.jsx)(q,{text:`No archived one-time schedules.`}):x.length===0?(0,K.jsx)(je,{icon:(0,K.jsx)(ge,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,K.jsx)(M,{variant:`primary`,asChild:!0,children:(0,K.jsxs)(L,{to:`/automations/new`,children:[(0,K.jsx)(fe,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,K.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:x.map(t=>(0,K.jsx)(tr,{automation:t,timeZone:e.timeZone,note:o[t.id],busy:c[t.id]===!0,onRun:()=>void p(t),onToggle:()=>void h(t),onPreview:()=>void ee(t),onCancel:()=>void g(t)},t.id))})]}):(0,K.jsx)(q,{text:`Loading automations…`})})}function Gn({count:e}){return e===0?null:(0,K.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function Kn({data:e}){return(0,K.jsx)(`p`,{"data-slot":`automation-scheduler`,className:r(`text-xs break-words`,e.scheduler.state===`scheduled`?`text-success`:`text-muted-foreground`),children:`Scheduler ${e.scheduler.state===`scheduled`?`running`:`idle`} · GitHub ${e.available?`available`:`unavailable`}${e.reason?` · ${e.reason}`:``} · ${e.timeZone}`})}function qn(e){return e.kind===`schedule`&&e.schedule?$e(e.schedule):`${cn(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function Jn({automation:e,nextRun:t}){let n=e.kind===`schedule`?pe:de,r=Ge(e);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,K.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,K.jsxs)(`p`,{"data-slot":`automation-meta`,className:`mt-1 flex flex-wrap items-baseline gap-x-1.5 ps-6 text-xs break-words text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:qn(e)}),t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,K.jsx)(Ue,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function Yn({automation:e,archive:t}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,K.jsx)(M,{variant:`outline`,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}`,children:`Details`})})})]})}function Xn({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,K.jsx)(`span`,{children:`continuous`}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${V(r,t)}`}),(0,K.jsx)(`span`,{children:`· ${et(Date.now(),Date.parse(r))}`})]}):(0,K.jsx)(`span`,{children:`Next run: —`})}function Zn({automation:e,timeZone:t}){let n=e.enabled?_t(e.state):void 0;return n?(0,K.jsxs)(`p`,{role:`alert`,"data-slot":`automation-failing`,className:`text-sm break-words text-destructive`,children:[`The last ${n.consecutiveFailures} checks failed: ${n.lastError}`,n.retryAt?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${V(n.retryAt,t)}`}):null]}):null}var $=`h-8 px-3 max-md:h-11 no-hover:h-11`;function Qn({automation:e,busy:t,confirmingCancel:n,cancelRef:i,onToggle:a,onRun:o,onPreview:s,onOpenCancel:c}){let l=e.kind===`schedule`,u=e.schedule?.type===`once`;return(0,K.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:a,children:e.enabled?`Pause`:`Enable`}),l?(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:o,children:`Run now`}):(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:s,children:`Test filter`}),(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}`,children:`Edit`})}),u&&!n?(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:r($,`text-destructive`),ref:i,"data-action":`automation-cancel`,disabled:t,onClick:c,children:`Cancel`}):null,(0,K.jsx)(M,{variant:`outline`,size:`sm`,className:r($,`sm:ms-auto`),asChild:!0,children:(0,K.jsx)(L,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function $n({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,K.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(M,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,K.jsx)(M,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function er({note:e}){return(0,K.jsxs)(`p`,{role:e.tone===`error`?`alert`:`status`,className:r(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.runId?(0,K.jsxs)(K.Fragment,{children:[` · `,(0,K.jsx)(L,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function tr({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(null),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=f.current===`keep`?d.current:f.current===`cancel`?u.current:null;f.current=null,e?.focus()},[c]);let p=()=>{f.current=`keep`,l(!0)},m=()=>{f.current=`cancel`,l(!1)},h=e.archived;return(0,K.jsxs)(`li`,{"data-slot":`automation-card`,"data-kind":e.kind,className:`flex min-w-0 flex-col gap-2.5 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,K.jsx)(Jn,{automation:e,nextRun:h?void 0:(0,K.jsx)(Xn,{automation:e,timeZone:t})}),h?(0,K.jsx)(Yn,{automation:e,archive:h}):null,h?null:(0,K.jsx)(Zn,{automation:e,timeZone:t}),h?null:(0,K.jsx)(Qn,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,K.jsx)($n,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,K.jsx)(er,{note:n}):null,(0,K.jsx)(kt,{automationId:e.id,automationName:e.name,timeZone:t})]})}function nr(e){let t=Ee(),n=Pe(),[r,i]=(0,H.useState)(),[a,o]=(0,H.useState)(``),s=(0,H.useCallback)(t=>re({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,H.useEffect)(()=>{n&&s()},[n,s]),(0,H.useEffect)(()=>p(async e=>{n&&await s(e)}),[n,s]),(0,H.useEffect)(()=>ue((e,n)=>{if(e!==`automation-change`)return;let r=n;typeof r.project==`string`&&(t===null||r.project===t)&&s()}),[t,s]),{data:r,error:a,refresh:s}}function rr({mode:e=`list`}){let{automationId:t}=le(),n=Te(),[r,i]=(0,H.useState)(!1),{data:a,error:o,refresh:s}=nr(`include`),[c,l]=(0,H.useState)(0),u=Ne();if(u===`unknown`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});if(u===`unavailable`)return(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(je,{icon:(0,K.jsx)(ge,{}),tone:`neutral`,title:`Automations are off`,subtitle:`This server does not run schedules, poll GitHub or launch tasks from them. Unset CEZ_AUTOMATIONS or set it to 1 and restart Squawk to turn automations on.`,heading:`h2`})});let d=()=>{n(`/automations`),s()},f=a?.automations.find(e=>e.id===t);if(e===`list`)return(0,K.jsx)(Wn,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,K.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,K.jsx)(q,{text:o}),(0,K.jsx)(M,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,K.jsx)(z,{route:`automations`,density:`empty`,children:(0,K.jsx)(q,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,K.jsx)(Bn,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,K.jsx)(At,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,K.jsx)(Bn,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,K.jsx)(z,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,K.jsx)(M,{asChild:!0,variant:`outline`,children:(0,K.jsx)(L,{to:`/automations`,children:`Back to automations`})})}):t?(0,K.jsx)(Ot,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,K.jsx)(q,{text:`Automation not found.`})}export{rr as AutomationsRoute};
@@ -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{t as r}from"./utils-DSMR_WLb.js";import{Fn as i}from"./toaster-C-xqAWVX.js";import{X as a,j as o,ot as s,r as c}from"./design-icons-CzEoMH9c.js";import{n as l}from"./diff-controls-Bg2hEd-d.js";import{l as u}from"./reference-chip-D_AkXXCW.js";import{t as d}from"./button-B7MKxYjT.js";import{t as f}from"./project-router-CT6gVIcC.js";import{t as p}from"./centered-state-V15AR_qo.js";import{Mn as m,Rt as h,Xn as g,Xt as _,kn as v,s as y,zt as b}from"./index-CZ2f_VDZ.js";import{t as x}from"./diff-is16ZW0n.js";var S=e(t(),1),C=n();function w({commit:e,sha:t,backTo:n,backLabel:r,slot:a,className:g,diffClassName:y}){let b=_(),[w,T]=(0,S.useState)(`unified`),[E,D]=(0,S.useState)(!0),O=e.isError&&e.error instanceof i&&e.error.status===409,k=b?w:`unified`;return(0,C.jsxs)(`section`,{"data-slot":a,"data-sha":t,className:g,children:[(0,C.jsxs)(`div`,{className:`mx-4 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border py-2 md:mx-9`,children:[(0,C.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,C.jsxs)(f,{to:n,children:[(0,C.jsx)(c,{size:16,"aria-hidden":`true`}),r]})}),(0,C.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,C.jsx)(l,{mode:w,wrap:E,onModeChange:T,onWrapChange:D})})]}),e.isPending?(0,C.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-muted-foreground md:px-9`,children:`Loading commit…`}):e.isError?(0,C.jsx)(p,{icon:O?(0,C.jsx)(u,{}):(0,C.jsx)(s,{size:16}),tone:O?`neutral`:`danger`,heading:`h2`,title:O?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{"data-slot":`commit-meta`,className:`mx-4 border-b border-border py-3 md:mx-9`,children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,C.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(`span`,{children:e.data.author}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{title:e.data.when,children:h(e.data.when)}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(m,{sha:e.data.sha,variant:`inline`}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,C.jsx)(v,{stat:e.data.stat})})]})]}),e.data.files.length===0?(0,C.jsx)(p,{icon:(0,C.jsx)(o,{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,C.jsx)(`div`,{className:y,children:(0,C.jsx)(x,{files:e.data.files,mode:k,wrap:E,totals:!1,className:`min-w-0`})})]})]})}var T=56;function E({slot:e,commits:t,selectedSha:n,className:i,heading:o}){let[s,c]=(0,S.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,S.useRef)(null),p=(0,S.useRef)(null),[m,h]=(0,S.useState)(0);(0,S.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 _=u.map(e=>(0,C.jsx)(D,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,C.jsx)(a,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,C.jsx)(g,{"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,C.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:[o?(0,C.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:o}):null,u.length===0?(0,C.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,C.jsx)(y,{scrollRef:p,startMargin:m,itemSize:T,children:_}):_]})]})}function D({commit:e,selected:t}){return(0,C.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,C.jsxs)(f,{"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,C.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.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,C.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(O,{sha:e.sha}),(0,C.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,C.jsx)(`span`,{title:b(e.when,e.at),children:h(e.when,e.at)})]}),e.stat?(0,C.jsx)(v,{stat:e.stat}):null]})]})]})})}function O({sha:e}){return(0,C.jsx)(m,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{O as n,w as r,E as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Fn as i}from"./toaster-B0kvcFif.js";import{X as a,j as o,ot as s,r as c}from"./design-icons-CzEoMH9c.js";import{n as l}from"./diff-controls-HmgYRhy7.js";import{l as u}from"./reference-chip-BdikRjql.js";import{t as d}from"./button-B7MKxYjT.js";import{t as f}from"./project-router-BvBqllk2.js";import{t as p}from"./centered-state-V15AR_qo.js";import{Mn as m,Rt as h,Xn as g,Xt as _,kn as v,s as y,zt as b}from"./index-mCjln54E.js";import{t as x}from"./diff-BmDcJsHL.js";var S=e(t(),1),C=n();function w({commit:e,sha:t,backTo:n,backLabel:r,slot:a,className:g,diffClassName:y}){let b=_(),[w,T]=(0,S.useState)(`unified`),[E,D]=(0,S.useState)(!0),O=e.isError&&e.error instanceof i&&e.error.status===409,k=b?w:`unified`;return(0,C.jsxs)(`section`,{"data-slot":a,"data-sha":t,className:g,children:[(0,C.jsxs)(`div`,{className:`mx-4 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border py-2 md:mx-9`,children:[(0,C.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,C.jsxs)(f,{to:n,children:[(0,C.jsx)(c,{size:16,"aria-hidden":`true`}),r]})}),(0,C.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,C.jsx)(l,{mode:w,wrap:E,onModeChange:T,onWrapChange:D})})]}),e.isPending?(0,C.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-muted-foreground md:px-9`,children:`Loading commit…`}):e.isError?(0,C.jsx)(p,{icon:O?(0,C.jsx)(u,{}):(0,C.jsx)(s,{size:16}),tone:O?`neutral`:`danger`,heading:`h2`,title:O?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{"data-slot":`commit-meta`,className:`mx-4 border-b border-border py-3 md:mx-9`,children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,C.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(`span`,{children:e.data.author}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{title:e.data.when,children:h(e.data.when)}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(m,{sha:e.data.sha,variant:`inline`}),(0,C.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,C.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,C.jsx)(v,{stat:e.data.stat})})]})]}),e.data.files.length===0?(0,C.jsx)(p,{icon:(0,C.jsx)(o,{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,C.jsx)(`div`,{className:y,children:(0,C.jsx)(x,{files:e.data.files,mode:k,wrap:E,totals:!1,className:`min-w-0`})})]})]})}var T=56;function E({slot:e,commits:t,selectedSha:n,className:i,heading:o}){let[s,c]=(0,S.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,S.useRef)(null),p=(0,S.useRef)(null),[m,h]=(0,S.useState)(0);(0,S.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 _=u.map(e=>(0,C.jsx)(D,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,C.jsx)(a,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,C.jsx)(g,{"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,C.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:[o?(0,C.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:o}):null,u.length===0?(0,C.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,C.jsx)(y,{scrollRef:p,startMargin:m,itemSize:T,children:_}):_]})]})}function D({commit:e,selected:t}){return(0,C.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,C.jsxs)(f,{"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,C.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.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,C.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(O,{sha:e.sha}),(0,C.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,C.jsx)(`span`,{title:b(e.when,e.at),children:h(e.when,e.at)})]}),e.stat?(0,C.jsx)(v,{stat:e.stat}):null]})]})]})})}function O({sha:e}){return(0,C.jsx)(m,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{O as n,w as r,E as t};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-Cr8XQJSx.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils-DSMR_WLb.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/diff-stat-C7KB1kDX.js","assets/index-CZ2f_VDZ.js","assets/queries-ClkIgWFx.js","assets/toaster-C-xqAWVX.js","assets/live-protocol-DMhTnCmf.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-BKUl84DF.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-Bo51TspT.js","assets/dist-C5mlVBmd.js","assets/dist-BW234Kg5.js","assets/tasks-table-BkjZYg2J.js","assets/task-groups-aquji1Kv.js","assets/attention--Y0CyzCN.js","assets/design-icons-CzEoMH9c.js","assets/open-in-menu-N8rXgYSG.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/button-B7MKxYjT.js","assets/dropdown-menu-4e2iKSMT.js","assets/es2015-CQth82uv.js","assets/dist-BAoXdNsT.js","assets/dist-DXO3xwbC.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-D5HpOmDZ.js","assets/folder-browser-6stmlyVQ.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/reference-chip-D_AkXXCW.js","assets/popover-CZV6tz9i.js","assets/dist-Da4ckcJG.js","assets/switch-SP8pw5uU.js","assets/dist-Czz3Y5qH.js","assets/badge-DQ3U69Ht.js","assets/dialog-B531GGAo.js","assets/project-router-CT6gVIcC.js","assets/status-dot-BRzVlF2X.js","assets/report-selection-D9xJZoKb.js","assets/use-search-params-writer-ClMScnNe.js","assets/format-BU7D3IfE.js","assets/command-KdW7aO0N.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/page-shell-7pLJMOgh.js","assets/page-shell-DQPYcKyL.css","assets/centered-state-V15AR_qo.js","assets/index-DefVZIaB.css","assets/highlighter-DvLzHjjY.js","assets/image-preview-DCUeM8u3.js","assets/zoomable-image-6RTKhLGE.js","assets/markdown-BBDDg-4t.js","assets/markdown-BlP4Ruj9.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/html-report-BX3msvci.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-C7KB1kDX.js";import{n as o,r as s,t as c}from"./image-preview-DCUeM8u3.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-Cr8XQJSx.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,u.jsx)(f,{...e}):t===null?(0,u.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`Loading diff…`}):(0,u.jsx)(t.View,{...e})}function f({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:a,totals:o=!0,actions:c,className:d}){let f={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,l.useRef)(null);return(0,l.useImperativeHandle)(a,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,u.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,d),children:[(0,u.jsxs)(`div`,{"data-slot":`diff-header`,hidden:!o&&!c,className:`flex min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-1`,children:[(0,u.jsx)(s,{stat:f,hidden:!o}),c?(0,u.jsx)(`div`,{"data-slot":`diff-actions`,className:`ms-auto flex items-center gap-1.5`,children:c}):null]}),e.map(e=>(0,u.jsx)(p,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){let s=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,u.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,u.jsxs)(`header`,{className:`flex items-start gap-2 border-b border-border px-3 py-2`,children:[(0,u.jsx)(`span`,{"data-slot":`diff-file-path`,title:s,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:s}),(0,u.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,u.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-xs`})})]}),o(e)?(0,u.jsx)(c,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes (metadata only).`}):(0,u.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-CRx2ZNOd.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils-DSMR_WLb.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/diff-stat-C7KB1kDX.js","assets/index-mCjln54E.js","assets/queries-CYWRnyM5.js","assets/toaster-B0kvcFif.js","assets/live-protocol-DMhTnCmf.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-CH-a6Jyv.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-BNI7eMgG.js","assets/dist-C5mlVBmd.js","assets/dist-BW234Kg5.js","assets/tasks-table-k18AuMR5.js","assets/task-groups-lh9gz7TP.js","assets/attention-CGsbqL2t.js","assets/design-icons-CzEoMH9c.js","assets/open-in-menu-CML2QKil.js","assets/bot-TkDIw4y-.js","assets/external-link-BE6y205O.js","assets/folder-o-AvL3y3.js","assets/smartphone-Lr8Ug2z_.js","assets/square-terminal-B6RYYieR.js","assets/button-B7MKxYjT.js","assets/dropdown-menu-4e2iKSMT.js","assets/es2015-CQth82uv.js","assets/dist-BAoXdNsT.js","assets/dist-DXO3xwbC.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-D5HpOmDZ.js","assets/folder-browser-BJ3aXo9k.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/reference-chip-BdikRjql.js","assets/popover-CZV6tz9i.js","assets/dist-Da4ckcJG.js","assets/switch-SP8pw5uU.js","assets/dist-Czz3Y5qH.js","assets/badge-DQ3U69Ht.js","assets/dialog-B531GGAo.js","assets/project-router-BvBqllk2.js","assets/status-dot-BRzVlF2X.js","assets/report-selection-D2RvkiGX.js","assets/use-search-params-writer-ClMScnNe.js","assets/format-BU7D3IfE.js","assets/command-KdW7aO0N.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/page-shell-7pLJMOgh.js","assets/page-shell-DQPYcKyL.css","assets/centered-state-V15AR_qo.js","assets/index-CVz-Ls8s.css","assets/highlighter-DvLzHjjY.js","assets/image-preview-DCUeM8u3.js","assets/zoomable-image-6RTKhLGE.js","assets/markdown-BBDDg-4t.js","assets/markdown-DiMerfHU.js","assets/chunk-BO2N2NFS-DQrpGzb-.js","assets/lib-DrPFkMXk.js","assets/html-report-BX3msvci.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-C7KB1kDX.js";import{n as o,r as s,t as c}from"./image-preview-DCUeM8u3.js";var l=e(t(),1),u=n();function d(e){let[t,n]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-CRx2ZNOd.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69])),()=>{e=!0}},[]),e.files.length===0?(0,u.jsx)(`p`,{"data-slot":`diff-empty`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,u.jsx)(f,{...e}):t===null?(0,u.jsx)(`p`,{"data-slot":`diff-loading`,className:r(`px-1 text-xs text-muted-foreground`,e.className),children:`Loading diff…`}):(0,u.jsx)(t.View,{...e})}function f({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:i,viewRef:a,totals:o=!0,actions:c,className:d}){let f={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},m=(0,l.useRef)(null);return(0,l.useImperativeHandle)(a,()=>({scrollToPath:e=>{for(let t of m.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,u.jsxs)(`div`,{ref:m,"data-slot":`diff`,"data-fallback":`true`,className:r(`flex min-w-0 flex-col gap-3`,d),children:[(0,u.jsxs)(`div`,{"data-slot":`diff-header`,hidden:!o&&!c,className:`flex min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-1`,children:[(0,u.jsx)(s,{stat:f,hidden:!o}),c?(0,u.jsx)(`div`,{"data-slot":`diff-actions`,className:`ms-auto flex items-center gap-1.5`,children:c}):null]}),e.map(e=>(0,u.jsx)(p,{file:e,wrap:t,imageSrc:n,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function p({file:e,wrap:t,imageSrc:n,onOpenInApp:i}){let s=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,u.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,u.jsxs)(`header`,{className:`flex items-start gap-2 border-b border-border px-3 py-2`,children:[(0,u.jsx)(`span`,{"data-slot":`diff-file-path`,title:s,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:s}),(0,u.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,u.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-xs`})})]}),o(e)?(0,u.jsx)(c,{file:e,imageSrc:n,onOpenInApp:i}):e.binary?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,u.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes (metadata only).`}):(0,u.jsx)(`pre`,{className:r(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
3
  `).map((e,t)=>(0,u.jsxs)(`span`,{className:r(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-muted-foreground`),children:[e,e===``?` `:``]},t))})]})}export{d as t};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{A as n,_ as r}from"./design-icons-CzEoMH9c.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./button-B7MKxYjT.js";import{ar as o}from"./index-CZ2f_VDZ.js";var s=i(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=e();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:r}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5 max-md:hidden`,children:[(0,l.jsx)(p,{current:e,value:`unified`,onModeChange:n}),(0,l.jsx)(p,{current:e,value:`split`,onModeChange:n})]}),(0,l.jsx)(d,{wrap:t,onWrapChange:r})]})}function d({wrap:e,onWrapChange:n,className:r=`size-11 rounded-lg`}){return(0,l.jsx)(a,{variant:`outline`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":e,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:t(r,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:(0,l.jsx)(c,{"aria-hidden":`true`})})}function f({preview:e,onPreviewChange:n}){return(0,l.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":e,"aria-label":`Preview Markdown`,title:e?`Show Markdown as a diff`:`Preview Markdown`,className:t(`h-11 min-w-11 gap-1.5 rounded-lg px-0 text-xs font-medium sm:px-3`,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`max-sm:hidden`,children:`Preview MD`})]})}function p({current:e,value:n,onModeChange:i}){let a=e===n;return(0,l.jsxs)(`button`,{type:`button`,"data-mode":n,"aria-pressed":a,onClick:()=>i(n),className:t(`inline-flex min-h-11 items-center gap-1.5 rounded-md px-3 text-xs font-medium capitalize transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring/50`,a?`bg-muted text-foreground`:`text-muted-foreground pointer-hover:text-foreground`),children:[n===`unified`?(0,l.jsx)(s,{"aria-hidden":`true`,className:`size-4`}):(0,l.jsx)(r,{size:16,"aria-hidden":`true`,className:`size-4`}),n]})}function m({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium`,children:[(0,l.jsx)(n,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}export{d as i,u as n,f as r,m as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{A as n,_ as r}from"./design-icons-CzEoMH9c.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./button-B7MKxYjT.js";import{ar as o}from"./index-mCjln54E.js";var s=i(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=e();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:r}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5 max-md:hidden`,children:[(0,l.jsx)(p,{current:e,value:`unified`,onModeChange:n}),(0,l.jsx)(p,{current:e,value:`split`,onModeChange:n})]}),(0,l.jsx)(d,{wrap:t,onWrapChange:r})]})}function d({wrap:e,onWrapChange:n,className:r=`size-11 rounded-lg`}){return(0,l.jsx)(a,{variant:`outline`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":e,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:t(r,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:(0,l.jsx)(c,{"aria-hidden":`true`})})}function f({preview:e,onPreviewChange:n}){return(0,l.jsxs)(a,{variant:`outline`,size:`sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":e,"aria-label":`Preview Markdown`,title:e?`Show Markdown as a diff`:`Preview Markdown`,className:t(`h-11 min-w-11 gap-1.5 rounded-lg px-0 text-xs font-medium sm:px-3`,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),(0,l.jsx)(`span`,{"aria-hidden":`true`,className:`max-sm:hidden`,children:`Preview MD`})]})}function p({current:e,value:n,onModeChange:i}){let a=e===n;return(0,l.jsxs)(`button`,{type:`button`,"data-mode":n,"aria-pressed":a,onClick:()=>i(n),className:t(`inline-flex min-h-11 items-center gap-1.5 rounded-md px-3 text-xs font-medium capitalize transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring/50`,a?`bg-muted text-foreground`:`text-muted-foreground pointer-hover:text-foreground`),children:[n===`unified`?(0,l.jsx)(s,{"aria-hidden":`true`,className:`size-4`}):(0,l.jsx)(r,{size:16,"aria-hidden":`true`,className:`size-4`}),n]})}function m({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium`,children:[(0,l.jsx)(n,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}export{d as i,u as n,f as r,m as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./diff-stat-C7KB1kDX.js";import{s}from"./index-CZ2f_VDZ.js";import{a as c,i as l,r as u}from"./highlighter-DvLzHjjY.js";import{n as d,r as f,t as p}from"./image-preview-DCUeM8u3.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";import{t as g}from"./markdown-BlP4Ruj9.js";var _=e(t(),1),v=44;function y(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./diff-stat-C7KB1kDX.js";import{s}from"./index-mCjln54E.js";import{a as c,i as l,r as u}from"./highlighter-DvLzHjjY.js";import{n as d,r as f,t as p}from"./image-preview-DCUeM8u3.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";import{t as g}from"./markdown-DiMerfHU.js";var _=e(t(),1),v=44;function y(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
2
2
  `),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function b(e){return y(e)*20+v}function x(e){return e.reduce((e,t)=>e+y(t),0)}function S(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function C(e){return`${e.oldPath??``}→${e.path}`}function w(e){let t=0;for(let n of e.split(`
3
3
  `))n.length>t&&(t=n.length);return t}var T=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,E=300,D=.3;function O(e,t){if(e===t)return null;let n=e.match(T)??[],r=t.match(T)??[];if(n.length===0||r.length===0||n.length>E||r.length>E)return null;let i=k(n,r),a=r.length+1;return(i[n.length*a+r.length]??0)/Math.max(n.length,r.length)<D?null:A(n,r,i)}function k(e,t){let n=t.length+1,r=new Uint16Array((e.length+1)*n);for(let i=1;i<=e.length;i++)for(let a=1;a<=t.length;a++)r[i*n+a]=e[i-1]===t[a-1]?(r[(i-1)*n+(a-1)]??0)+1:Math.max(r[(i-1)*n+a]??0,r[i*n+(a-1)]??0);return r}function A(e,t,n){let r=t.length+1,i=Array.from({length:e.length},()=>!1),a=Array.from({length:t.length},()=>!1),o=e.length,s=t.length;for(;o>0&&s>0;)e[o-1]===t[s-1]?(i[o-1]=!0,a[s-1]=!0,o--,s--):(n[(o-1)*r+s]??0)>=(n[o*r+(s-1)]??0)?o--:s--;return{del:j(e,i),add:j(t,a)}}function j(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function M(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var N=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,P=`… (patch truncated)`;function F(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
4
4
  `);o.at(-1)===``&&o.pop();for(let e of o){let o=N.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(P)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function I(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function L(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function R(e,t){let n=Array.from({length:e.length}),r=Array.from({length:t.length}),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=O(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function z(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(R(t,i))}else t(i),r++}}function B(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),z(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function V(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),z(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var H=n();function U({file:e,loadFileText:t,imageSrc:n}){let r=(0,_.useMemo)(()=>W(e),[e]),i=(0,_.useRef)(t);i.current=t;let a=(0,_.useRef)(n);a.current=n;let o=t!==void 0,[s,c]=(0,_.useState)(null);(0,_.useEffect)(()=>{let t=i.current;if(!t)return;let n=!1;return t(e.path).then(t=>!n&&c({path:e.path,text:t}),()=>!n&&c({path:e.path,text:null})),()=>{n=!0}},[e.path,e.patch,o]);let l=(0,_.useCallback)(t=>{let n=a.current,r=n?m(e.path,t):null;return r===null||!n?null:n(r)},[e.path]),u=s?.path===e.path?s:null;if(o&&u===null)return(0,H.jsx)(`p`,{role:`status`,className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`Loading preview…`});let d=u?.text??null;if(d===null&&r.text===``)return(0,H.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-muted-foreground`,children:`No content changes to preview.`});let f=d!==null||r.complete?null:o?`The full file could not be loaded. Showing the changed sections only.`:`Showing the changed sections only.`;return(0,H.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,H.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[f?(0,H.jsx)(`p`,{className:`mb-4 text-xs text-muted-foreground`,children:f}):null,(0,H.jsx)(g,{document:!0,imageSrc:l,children:d??r.text})]})})}function W(e){let t=F(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{et as i}from"./queries-ClkIgWFx.js";import{Fn as a,Ht as o}from"./toaster-C-xqAWVX.js";import{f as s,p as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as l,w as u}from"./design-icons-CzEoMH9c.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{i as f}from"./diff-controls-Bg2hEd-d.js";import{t as p}from"./centered-state-V15AR_qo.js";import{a as m,i as h,r as g}from"./highlighter-DvLzHjjY.js";import{n as _,t as v}from"./markdown-BlP4Ruj9.js";import{r as y}from"./html-report-BX3msvci.js";import{t as b}from"./html-report-frame-uuqkBC0u.js";var x=d(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),S=d(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),C=d(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),w=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function T(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:w.has(t.slice(n+1).toLowerCase())}function E(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return T(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}var D=e(t(),1);function O(e){return e.tooLarge?`too-large`:E(e.path)?`image`:e.binary?`binary`:`text`}function k(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var A=n();function j({runId:e,path:t,className:n}){let r=i(e,t??void 0);if(t===null)return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.jsx)(u,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,A.jsx)(R,{className:n,children:(0,A.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof a&&r.error.status===409;return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:e?(0,A.jsx)(C,{}):(0,A.jsx)(l,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,A.jsx)(P,{runId:e,entry:r.data,className:n}):(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function M(e,t,n){let r=t?.replace(/\/+$/,``);if(r&&e.startsWith(`${r}/`))return e.slice(r.length+1);let i=/^.*\/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+\/(.+)$/.exec(e);if(i?.[1])return i[1];if(e.startsWith(`/`)&&n&&!n.startsWith(`/`)){let t=n.replace(/^\.?\//,``);if(t&&(e===`/${t}`||e.endsWith(`/${t}`)))return t}return e}function N(e,t,n){let r=t&&/\.(?:md|markdown)$/i.test(e.path),i=t&&y(e.path),a=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(e.path),o=t&&a&&e.size<=10*1024*1024?`image`:O(e);return{html:i,kind:o,toggle:(r||i)&&o===`text`,showImage:o===`image`&&(!t||a),rendered:n?null:r?`markdown`:i?`html`:null}}function P({runId:e,entry:t,displayPath:n,className:i,imageUrl:a,downloadUrl:o,snapshot:s,readerHref:c,documentPreview:l=!1}){let[u,d]=(0,D.useState)(!1),[p,m]=(0,D.useState)(!0),h=n??M(t.path),g=N(t,l,u),_=!!(s||o||g.toggle),v=!g.showImage&&g.kind===`text`&&g.rendered===null;return(0,A.jsxs)(R,{className:i,children:[(0,A.jsxs)(`header`,{"data-slot":`file-preview-head`,className:r(`flex min-h-11 items-center gap-2 border-b border-border bg-muted/40 ps-4 text-xs`,v?`pe-2 py-1`:`pe-4 py-2.5`),children:[(0,A.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium text-foreground`,title:h,children:h}),(0,A.jsx)(`span`,{"data-slot":`file-preview-size`,className:`ml-auto shrink-0 font-mono text-xs tabular-nums text-muted-foreground`,children:k(t.size)}),v?(0,A.jsx)(f,{wrap:p,onWrapChange:m,className:`size-8 rounded-md max-md:size-11 pointer-coarse:size-11`}):null]}),_?(0,A.jsx)(I,{snapshot:s,downloadUrl:o,source:g.toggle?u:null,onSource:()=>d(e=>!e),readerHref:g.html&&g.kind===`text`?c:void 0}):null,(0,A.jsx)(F,{runId:e,entry:t,kind:g.kind,showImage:g.showImage,rendered:g.rendered,imageUrl:a,wrap:p})]})}function F({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a,wrap:s}){return r?(0,A.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,A.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,A.jsx)(p,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${k(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${k(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,A.jsx)(`div`,{className:`p-4`,children:(0,A.jsx)(v,{document:!0,children:t.content??``})}):i===`html`?(0,A.jsx)(b,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,A.jsx)(V,{path:t.path,text:t.content??``,wrap:s})}function I({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,A.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,A.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,A.jsx)(L,{href:i}):null]})}function L({href:e}){let t=c(),n=s();return(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:r=>_(r,t,e,n),children:`Open reader`})}function R({className:e,children:t}){return(0,A.jsx)(`section`,{"data-slot":`file-preview`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,D.useMemo)(()=>t.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{et as i}from"./queries-CYWRnyM5.js";import{Fn as a,Ht as o}from"./toaster-B0kvcFif.js";import{f as s,p as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as l,w as u}from"./design-icons-CzEoMH9c.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{i as f}from"./diff-controls-HmgYRhy7.js";import{t as p}from"./centered-state-V15AR_qo.js";import{a as m,i as h,r as g}from"./highlighter-DvLzHjjY.js";import{n as _,t as v}from"./markdown-DiMerfHU.js";import{r as y}from"./html-report-BX3msvci.js";import{t as b}from"./html-report-frame-uuqkBC0u.js";var x=d(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),S=d(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),C=d(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),w=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function T(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:w.has(t.slice(n+1).toLowerCase())}function E(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return T(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}var D=e(t(),1);function O(e){return e.tooLarge?`too-large`:E(e.path)?`image`:e.binary?`binary`:`text`}function k(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var A=n();function j({runId:e,path:t,className:n}){let r=i(e,t??void 0);if(t===null)return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.jsx)(u,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,A.jsx)(R,{className:n,children:(0,A.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof a&&r.error.status===409;return(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:e?(0,A.jsx)(C,{}):(0,A.jsx)(l,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,A.jsx)(P,{runId:e,entry:r.data,className:n}):(0,A.jsx)(R,{className:n,children:(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function M(e,t,n){let r=t?.replace(/\/+$/,``);if(r&&e.startsWith(`${r}/`))return e.slice(r.length+1);let i=/^.*\/\.ai\/(?:cezar|squawk)\/worktrees\/[^/]+\/(.+)$/.exec(e);if(i?.[1])return i[1];if(e.startsWith(`/`)&&n&&!n.startsWith(`/`)){let t=n.replace(/^\.?\//,``);if(t&&(e===`/${t}`||e.endsWith(`/${t}`)))return t}return e}function N(e,t,n){let r=t&&/\.(?:md|markdown)$/i.test(e.path),i=t&&y(e.path),a=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(e.path),o=t&&a&&e.size<=10*1024*1024?`image`:O(e);return{html:i,kind:o,toggle:(r||i)&&o===`text`,showImage:o===`image`&&(!t||a),rendered:n?null:r?`markdown`:i?`html`:null}}function P({runId:e,entry:t,displayPath:n,className:i,imageUrl:a,downloadUrl:o,snapshot:s,readerHref:c,documentPreview:l=!1}){let[u,d]=(0,D.useState)(!1),[p,m]=(0,D.useState)(!0),h=n??M(t.path),g=N(t,l,u),_=!!(s||o||g.toggle),v=!g.showImage&&g.kind===`text`&&g.rendered===null;return(0,A.jsxs)(R,{className:i,children:[(0,A.jsxs)(`header`,{"data-slot":`file-preview-head`,className:r(`flex min-h-11 items-center gap-2 border-b border-border bg-muted/40 ps-4 text-xs`,v?`pe-2 py-1`:`pe-4 py-2.5`),children:[(0,A.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium text-foreground`,title:h,children:h}),(0,A.jsx)(`span`,{"data-slot":`file-preview-size`,className:`ml-auto shrink-0 font-mono text-xs tabular-nums text-muted-foreground`,children:k(t.size)}),v?(0,A.jsx)(f,{wrap:p,onWrapChange:m,className:`size-8 rounded-md max-md:size-11 pointer-coarse:size-11`}):null]}),_?(0,A.jsx)(I,{snapshot:s,downloadUrl:o,source:g.toggle?u:null,onSource:()=>d(e=>!e),readerHref:g.html&&g.kind===`text`?c:void 0}):null,(0,A.jsx)(F,{runId:e,entry:t,kind:g.kind,showImage:g.showImage,rendered:g.rendered,imageUrl:a,wrap:p})]})}function F({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a,wrap:s}){return r?(0,A.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,A.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,A.jsx)(p,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${k(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,A.jsx)(p,{icon:(0,A.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${k(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,A.jsx)(`div`,{className:`p-4`,children:(0,A.jsx)(v,{document:!0,children:t.content??``})}):i===`html`?(0,A.jsx)(b,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,A.jsx)(V,{path:t.path,text:t.content??``,wrap:s})}function I({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,A.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,A.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,A.jsx)(L,{href:i}):null]})}function L({href:e}){let t=c(),n=s();return(0,A.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:r=>_(r,t,e,n),children:`Open reader`})}function R({className:e,children:t}){return(0,A.jsx)(`section`,{"data-slot":`file-preview`,className:r(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,D.useMemo)(()=>t.split(`
2
2
  `).map(e=>[{content:e}]),[t]),r=(0,D.useMemo)(()=>m(e),[e]),i=n.length>z,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let n=!1;return g(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:h(t,r)?.tokens??n}function V({path:e,text:t,wrap:n=!1}){let i=B(e,t);return(0,A.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":m(e)??`plaintext`,className:`overflow-x-auto overscroll-x-contain py-2 font-mono text-xs leading-[1.7] [scrollbar-width:thin]`,children:(0,A.jsx)(`div`,{className:n?`min-w-0`:`w-max min-w-full`,children:i.map((e,t)=>(0,A.jsxs)(`div`,{className:`flex`,children:[(0,A.jsx)(`span`,{className:`sticky left-0 w-14 shrink-0 select-none bg-card pr-3 pl-4 text-right tabular-nums text-muted-foreground`,children:t+1}),(0,A.jsx)(`span`,{className:r(`min-w-0 flex-1 pr-6`,n?`whitespace-pre-wrap wrap-anywhere`:`whitespace-pre`),children:e.map((e,t)=>(0,A.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})})}export{k as a,S as c,M as i,x as l,P as n,E as o,j as r,C as s,V as t};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{_t as n}from"./queries-ClkIgWFx.js";import{Fn as r}from"./toaster-C-xqAWVX.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./chevron-right-BENZ-1ZN.js";import{t as o}from"./folder-o-AvL3y3.js";var s=i(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),c=e(),l=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,u=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function d(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function f({path:e,selected:r,onSelect:i,onEnter:l,decorate:u,emptyHint:d,showHidden:f=!1}){let m=n(e,f),h=m.data?.parent??null;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-xs text-soft-foreground`,title:m.data?.path??void 0,children:m.data?.path??(m.isError?``:`Loading…`)}),m.isError?(0,c.jsx)(p,{error:m.error,path:e,onEnter:l,onRetry:()=>void m.refetch()}):(0,c.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[h===null?null:(0,c.jsx)(`li`,{className:`flex`,children:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>l(h),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,c.jsx)(s,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(m.data?.dirs??[]).map(e=>(0,c.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":r?.path===e.path,onClick:()=>i(e),onDoubleClick:()=>l(e.path),className:t(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,r?.path===e.path&&`bg-muted`),children:[(0,c.jsx)(o,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{className:`truncate`,children:e.name}),u?.(e)]}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>l(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,c.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),m.data&&m.data.dirs.length===0?(0,c.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:d}):null]}),m.data?.truncated?(0,c.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-xs text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function p({error:e,path:t,onEnter:n,onRetry:i}){let a=e instanceof r&&e.status===403,o=t===null?null:d(t);return(0,c.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,c.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:e instanceof Error?e.message:`could not list that folder`}),a?(0,c.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[o===null?null:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>n(o),className:u,children:[(0,c.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),a?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:l,target:`_blank`,rel:`noreferrer`,className:u,children:`Open Privacy Settings`}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:i,className:u,children:`Try again`})]}):null]})]})}function m(e,t,r=!1){let i=n(e,r);return t?.path??i.data?.path??null}export{m as n,f as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{_t as n}from"./queries-CYWRnyM5.js";import{Fn as r}from"./toaster-B0kvcFif.js";import{t as i}from"./createLucideIcon-BHp8sXmF.js";import{t as a}from"./chevron-right-BENZ-1ZN.js";import{t as o}from"./folder-o-AvL3y3.js";var s=i(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),c=e(),l=`x-apple.systempreferences:com.apple.preference.security?Privacy_FilesAndFolders`,u=`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-foreground hover:bg-muted`;function d(e){let t=e.replace(/[\\/]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?null:n===0?t.slice(0,1):t.slice(0,n)}function f({path:e,selected:r,onSelect:i,onEnter:l,decorate:u,emptyHint:d,showHidden:f=!1}){let m=n(e,f),h=m.data?.parent??null;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`p`,{"data-slot":`fs-breadcrumb`,className:`truncate font-mono text-xs text-soft-foreground`,title:m.data?.path??void 0,children:m.data?.path??(m.isError?``:`Loading…`)}),m.isError?(0,c.jsx)(p,{error:m.error,path:e,onEnter:l,onRetry:()=>void m.refetch()}):(0,c.jsxs)(`ul`,{"data-slot":`fs-listing`,className:`max-h-64 divide-y divide-border/60 overflow-y-auto overscroll-contain rounded-md border border-border`,children:[h===null?null:(0,c.jsx)(`li`,{className:`flex`,children:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-up`,onClick:()=>l(h),className:`flex flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,children:[(0,c.jsx)(s,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),`Up one level`]})}),(m.data?.dirs??[]).map(e=>(0,c.jsxs)(`li`,{className:`flex items-stretch`,children:[(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-dir`,"aria-pressed":r?.path===e.path,onClick:()=>i(e),onDoubleClick:()=>l(e.path),className:t(`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left text-[13px] hover:bg-muted`,r?.path===e.path&&`bg-muted`),children:[(0,c.jsx)(o,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{className:`truncate`,children:e.name}),u?.(e)]}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-enter`,"aria-label":`Open ${e.name}`,onClick:()=>l(e.path),className:`flex shrink-0 items-center px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,c.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})})]},e.path)),m.data&&m.data.dirs.length===0?(0,c.jsx)(`li`,{className:`px-3 py-2 text-[13px] text-muted-foreground`,children:d}):null]}),m.data?.truncated?(0,c.jsx)(`p`,{"data-slot":`fs-truncated`,className:`text-xs text-muted-foreground`,children:`Too many folders to list — only the first ones are shown.`}):null]})}function p({error:e,path:t,onEnter:n,onRetry:i}){let a=e instanceof r&&e.status===403,o=t===null?null:d(t);return(0,c.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,c.jsx)(`p`,{"data-slot":`fs-error`,className:`min-w-0 break-words text-[13px] text-danger`,children:e instanceof Error?e.message:`could not list that folder`}),a?(0,c.jsx)(`p`,{"data-slot":`fs-privacy-hint`,className:`text-[12.5px] text-soft-foreground`,children:`Allow it under Privacy & Security ▸ Files & Folders, then try again.`}):null,(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[12.5px]`,children:[o===null?null:(0,c.jsxs)(`button`,{type:`button`,"data-slot":`fs-error-back`,onClick:()=>n(o),className:u,children:[(0,c.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),`Back`]}),a?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`a`,{"data-slot":`fs-privacy-settings`,href:l,target:`_blank`,rel:`noreferrer`,className:u,children:`Open Privacy Settings`}),(0,c.jsx)(`button`,{type:`button`,"data-slot":`fs-retry`,onClick:i,className:u,children:`Try again`})]}):null]})]})}function m(e,t,r=!1){let i=n(e,r);return t?.path??i.data?.path??null}export{m as n,f as t};