@hearsay-tools/squawk 0.19.0-dev.9032 → 0.19.0-dev.9036
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/delegation.d.ts +30 -0
- package/dist/contract/index.js +34 -1
- package/dist/delegation/cli.js +12 -7
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/provision.js +1 -1
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/results.d.ts +10 -0
- package/dist/delegation/results.js +23 -12
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/routes.d.ts +58 -11
- package/dist/delegation/routes.js +2 -1
- package/dist/delegation/routes.js.map +1 -1
- package/dist/delegation/service.d.ts +3 -1
- package/dist/delegation/service.js +13 -2
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +51 -4
- package/dist/delegation/worker-summary.d.ts +11 -0
- package/dist/delegation/worker-summary.js +35 -0
- package/dist/delegation/worker-summary.js.map +1 -0
- package/dist/runs/run-archive.d.ts +72 -72
- package/dist/server/runs-routes.d.ts +21 -21
- package/dist/server/server.d.ts +1400 -1400
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-DINhWaKE.js → accounts-section-JYR2cUD1.js} +1 -1
- package/web/dist/assets/{activity-motion-BzO8epGW.js → activity-motion-CNYtkGbr.js} +1 -1
- package/web/dist/assets/{activity-route-BTHXYoE4.js → activity-route-DaOODJfE.js} +1 -1
- package/web/dist/assets/{agent-config-section-tjZMzOZC.js → agent-config-section-ChCUYJvh.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-CYGoNzJ-.js → agent-defaults-section-D36po1w1.js} +1 -1
- package/web/dist/assets/{appearance-CCuTu0sL.js → appearance-BaKisvC2.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-CeUWkcwK.js → archive-on-merge-field-UIiTWcbw.js} +1 -1
- package/web/dist/assets/attention-xl4bwNkx.js +1 -0
- package/web/dist/assets/{automations-route-CJmcm2Vr.js → automations-route-CGSoXi8F.js} +1 -1
- package/web/dist/assets/{commit-list-DHm1bCGH.js → commit-list-D5mq6f1e.js} +1 -1
- package/web/dist/assets/{diff-CZJXpxat.js → diff-D09l13xg.js} +2 -2
- package/web/dist/assets/{diff-controls-Cr1qbI1O.js → diff-controls-6choyWOW.js} +1 -1
- package/web/dist/assets/{diff-view-BxzlLybI.js → diff-view-DpEo21jl.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-aAzdjye-.js → discard-changes-dialog-CV4M8057.js} +1 -1
- package/web/dist/assets/{file-preview-DE1-2MRD.js → file-preview-BuhO1VP-.js} +1 -1
- package/web/dist/assets/{folder-browser-DcR_vo2i.js → folder-browser-CUUWpb8F.js} +1 -1
- package/web/dist/assets/{git-toolbar-CKcT_0rO.js → git-toolbar-CO6UuTb4.js} +1 -1
- package/web/dist/assets/{github-DYJRmmIn.js → github-B889h5f5.js} +1 -1
- package/web/dist/assets/{global-activity-route-BsG3-J8A.js → global-activity-route-BkpZPyJJ.js} +1 -1
- package/web/dist/assets/{index-lCPcoWSv.js → index-ChOV2nBM.js} +5 -5
- package/web/dist/assets/{label-CqoNP6Yh.js → label-DRXJ8ljY.js} +1 -1
- package/web/dist/assets/{markdown-CfYkmPQA.js → markdown-C5Y3C4ot.js} +1 -1
- package/web/dist/assets/{open-in-menu-CsH3KL0z.js → open-in-menu-CI3ceNjU.js} +1 -1
- package/web/dist/assets/{option-select-BakZdSgu.js → option-select-B70jYJmb.js} +1 -1
- package/web/dist/assets/{preferences-section-D8yX5A40.js → preferences-section-BqkzoH2b.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-677KPPpd.js → preview-pane-connected-BJOWI8lQ.js} +1 -1
- package/web/dist/assets/{project-location-l_7MLXzp.js → project-location-6FRHBXD1.js} +1 -1
- package/web/dist/assets/{project-router-DvfVUjon.js → project-router-C53GCY_8.js} +1 -1
- package/web/dist/assets/{projects-section-aX9WMTbw.js → projects-section-BqJfeeng.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-DV_VhZ8D.js → prompt-templates-section-D76qYrSf.js} +1 -1
- package/web/dist/assets/{queries-B8INH8MM.js → queries-jsRcJKo6.js} +1 -1
- package/web/dist/assets/{reference-chip-BkfQoMvT.js → reference-chip-95DURw1q.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-9x62rpqO.js → remote-settings-notice-DnWNbH2y.js} +1 -1
- package/web/dist/assets/{repo-git-m0GYtWKT.js → repo-git-BeRg8mHS.js} +1 -1
- package/web/dist/assets/{report-reader-C-YM9WMx.js → report-reader-CpJLRVEU.js} +1 -1
- package/web/dist/assets/{report-selection-fGMhVMQi.js → report-selection-DAPzf1Aa.js} +1 -1
- package/web/dist/assets/{reports-Bdpvl1tm.js → reports-BfFbGW9C.js} +1 -1
- package/web/dist/assets/{resources-section-CIrP33CN.js → resources-section-Dy4MvxQ3.js} +1 -1
- package/web/dist/assets/{review-panel-B8zs0CSP.js → review-panel-yvq4rZum.js} +1 -1
- package/web/dist/assets/{run-detail-refresh-CMG0OiqX.js → run-detail-refresh-DYY7EWeq.js} +1 -1
- package/web/dist/assets/{run-header-B6l8_e9X.js → run-header-Ceq-E2oX.js} +1 -1
- package/web/dist/assets/{select-fYRFfIZp.js → select-8oIZpehA.js} +1 -1
- package/web/dist/assets/{session-context-section-DwmxBYhL.js → session-context-section-CZqQQJGv.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-B0Q0ke-Q.js → settings-agent-picker-BaGf1RsO.js} +1 -1
- package/web/dist/assets/{settings-save-bar-D_OxLOmj.js → settings-save-bar-Cf4yhgkq.js} +1 -1
- package/web/dist/assets/{settings-shell-tteBTOed.js → settings-shell-z82OVv2a.js} +1 -1
- package/web/dist/assets/{sidebar-section-gGolq8j8.js → sidebar-section-qfOGEVL3.js} +1 -1
- package/web/dist/assets/{skills-BB3x_sd8.js → skills-2MhY3En5.js} +1 -1
- package/web/dist/assets/{tab-link-D97ij5JR.js → tab-link-BGfSJ-ah.js} +1 -1
- package/web/dist/assets/{task-changes-Yj9HftST.js → task-changes-lt1cfvG6.js} +1 -1
- package/web/dist/assets/{task-commits-D_J1D_WR.js → task-commits-BctQpv8y.js} +1 -1
- package/web/dist/assets/{task-file-scope-BZFb10De.js → task-file-scope-D5aDzxzp.js} +1 -1
- package/web/dist/assets/{task-files-Cc4ZU-AA.js → task-files-DSBZuGO1.js} +1 -1
- package/web/dist/assets/{task-github-item-DSuJFWRJ.js → task-github-item-DnNiAi4a.js} +1 -1
- package/web/dist/assets/{task-groups-COb-xWM_.js → task-groups-7p6Gvpg8.js} +1 -1
- package/web/dist/assets/{task-thread-D2korRS1.js → task-thread-DhI_-n7G.js} +1 -1
- package/web/dist/assets/{thread-state-C3TBW7mO.js → thread-state-BcHmo8Fn.js} +1 -1
- package/web/dist/assets/{toaster-Cjr2jC1Q.js → toaster-C1BFyQ8i.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-CQB8qtWC.js → use-hand-to-agent-state-KMwiaQ7P.js} +1 -1
- package/web/dist/assets/use-path-bases-DRgUcnZ6.js +1 -0
- package/web/dist/assets/use-workspace-config-save-D2fOudMd.js +1 -0
- package/web/dist/assets/{workflows-m3fecleC.js → workflows-CRHgSxlj.js} +1 -1
- package/web/dist/assets/{workspace-tools-B0HwrAFS.js → workspace-tools-D0zfWP2r.js} +1 -1
- package/web/dist/assets/{worktrees-section-D92EMSjm.js → worktrees-section-CtUlEBb7.js} +1 -1
- package/web/dist/index.html +12 -12
- package/web/dist/assets/attention-vW5nmGoK.js +0 -1
- package/web/dist/assets/use-path-bases-BYeWywf7.js +0 -1
- package/web/dist/assets/use-workspace-config-save-Do4bGg72.js +0 -1
package/web/dist/assets/{agent-config-section-tjZMzOZC.js → agent-config-section-ChCUYJvh.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Qt as i,Ut as a,Xt as o,b as s,h as c,m as l,nn as u,vt as d}from"./queries-B8INH8MM.js";import{Rn as f,n as p,vi as m}from"./toaster-Cjr2jC1Q.js";import{t as h}from"./button-C8jUIs8Q.js";import{t as g}from"./badge-B6B-xYQQ.js";import{t as _}from"./centered-state-BgSV4e79.js";import{Hn as v,Rn as y,gr as b,j as x}from"./index-lCPcoWSv.js";import{n as S,r as C,t as w}from"./remote-settings-notice-9x62rpqO.js";import{t as T}from"./use-path-bases-BYeWywf7.js";import{t as E}from"./code-editor-GfQChdgl.js";import{t as D}from"./discard-changes-dialog-aAzdjye-.js";import{r as O}from"./settings-save-bar-D_OxLOmj.js";var k=e(t(),1);function A(e){return t=>t.runners.includes(e)}function j(e,t){let n=A(e);return e=>n(e)&&e.kind===t}function M(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:j(e.id,t)}))}}function N(e){return o(e).map(M)}var P=n();function F(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 I(){let e=l(),t=C(),n=d(),r=u(),a=r.data,o=(0,k.useMemo)(()=>N(a),[a]),s=(0,k.useMemo)(()=>n.data?x(n.data.checks,a):i(a),[n.data,a]);return r.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(b,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(b,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||a===void 0?(0,P.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,P.jsx)(L,{listing:e.data,descriptors:o,installed:s,onOpenFile:t})}function L({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,k.useState)(`claude`),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)(null),p=t.find(e=>e.id===a)??t[0];if(p===void 0)return null;let m=R(p,e),h=m.find(e=>e.id===s)??z(m),_=e=>{l?f(()=>e):e()},v=e=>{e!==p.id&&_(()=>{o(e),c(null)})};return(0,P.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,P.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,P.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,P.jsx)(`code`,{children:w}),`.`]}),(0,P.jsx)(S,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,P.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===p.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===p.id,onClick:()=>v(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===p.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),p.note&&(0,P.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:p.note}),(0,P.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,P.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,P.jsx)(V,{agent:p,listing:e,selectedId:h?.id??null,onSelect:e=>{if(e===h?.id){i();return}_(()=>{c(e),i()})}})}),(0,P.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:h?(0,P.jsx)(U,{file:h,onDirtyChange:u},h.id):(0,P.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.`})})]}),(0,P.jsx)(D,{open:d!==null,subject:h?.label??`this file`,onKeep:()=>f(null),onDiscard:()=>{let e=d;f(null),u(!1),e?.()}})]})}function R(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function z(e){return e.find(e=>e.scope===`project`)??e[0]??null}var B={project:`Project scope`,local:`Local scope`,user:`User scope`};function V({agent:e,listing:t,selectedId:n,onSelect:i}){let a=T();return(0,P.jsx)(P.Fragment,{children:e.groups.map(o=>{let s=t.files.filter(o.files),c=o.showsUserMcp?t.userMcp:void 0;return s.length===0&&!c&&!o.empty?null:(0,P.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":o.id,"data-agent":e.id,children:[(0,P.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:o.label}),o.note&&(0,P.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:o.note}),s.length===0&&o.empty&&(0,P.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:o.empty}),(0,P.jsx)(`ul`,{className:`flex flex-col gap-1`,children:s.map(e=>(0,P.jsx)(`li`,{children:(0,P.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,P.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,P.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),c&&(0,P.jsx)(H,{userMcp:c,path:v(c.path,a)})]},o.id)})})}function H({userMcp:e,path:t}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,P.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,P.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,P.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,P.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function U({file:e,onDirtyChange:t}){let n=c(e.id),r=T(),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(!1),[l,u]=(0,k.useState)(null),d=n.data?.version??null,f=i??n.data?.content??``,p=n.data?f!==n.data.content:!1,m=e.writable,h=e.kind===`mcp`||e.holdsMcp,_=m&&p;(0,k.useEffect)(()=>{t?.(_)},[_,t]),(0,k.useEffect)(()=>()=>t?.(!1),[t]);let{save:v}=J({file:e,content:f,loadedVersion:d,setDraft:a,setConflict:s,setFormatError:u});return O({dirty:m&&p,save:v,discard:()=>a(null)}),(0,k.useEffect)(()=>{n.data&&(a(n.data.content),s(!1),u(null))},[n.data?.version,n.data]),(0,P.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,P.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:B[e.scope]})]}),(0,P.jsx)(y,{"data-slot":`agent-config-path`,value:e.path,bases:r,className:`text-xs text-foreground`}),(0,P.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,P.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,P.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,P.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,P.jsx)(`h3`,{children:h?`MCP configuration`:`File contents`}),h&&(0,P.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),n.isPending?(0,P.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):n.isError?(0,P.jsx)(`p`,{className:`text-[13px] text-destructive`,children:n.error.message}):(0,P.jsx)(W,{file:e,content:f,isMcp:h,onChange:a}),(0,P.jsx)(K,{formatError:l,conflict:o,onReload:()=>void n.refetch()}),m&&!e.exists&&!p?(0,P.jsx)(`p`,{"data-slot":`agent-config-save-cue`,className:`text-xs text-muted-foreground`,children:`Enter content above to create this file.`}):null,(0,P.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,P.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,P.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[F(e),e.hotReload?` ${e.hotReload}`:``]}),(0,P.jsx)(q,{reason:e.readOnlyReason})]})]})}function W({file:e,content:t,isMcp:n,onChange:r}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,P.jsx)(E,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,P.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:G(e,n)})]})}function G(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{o as r}from"./dist-C_rn70hE.js";import{Qt as i,Ut as a,Xt as o,b as s,h as c,m as l,nn as u,vt as d}from"./queries-jsRcJKo6.js";import{Rn as f,n as p,vi as m}from"./toaster-C1BFyQ8i.js";import{t as h}from"./button-C8jUIs8Q.js";import{t as g}from"./badge-B6B-xYQQ.js";import{t as _}from"./centered-state-BgSV4e79.js";import{Hn as v,Rn as y,gr as b,j as x}from"./index-ChOV2nBM.js";import{n as S,r as C,t as w}from"./remote-settings-notice-DnWNbH2y.js";import{t as T}from"./use-path-bases-DRgUcnZ6.js";import{t as E}from"./code-editor-GfQChdgl.js";import{t as D}from"./discard-changes-dialog-CV4M8057.js";import{r as O}from"./settings-save-bar-Cf4yhgkq.js";var k=e(t(),1);function A(e){return t=>t.runners.includes(e)}function j(e,t){let n=A(e);return e=>n(e)&&e.kind===t}function M(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:j(e.id,t)}))}}function N(e){return o(e).map(M)}var P=n();function F(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 I(){let e=l(),t=C(),n=d(),r=u(),a=r.data,o=(0,k.useMemo)(()=>N(a),[a]),s=(0,k.useMemo)(()=>n.data?x(n.data.checks,a):i(a),[n.data,a]);return r.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(b,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(b,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||a===void 0?(0,P.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,P.jsx)(L,{listing:e.data,descriptors:o,installed:s,onOpenFile:t})}function L({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,k.useState)(`claude`),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)(null),p=t.find(e=>e.id===a)??t[0];if(p===void 0)return null;let m=R(p,e),h=m.find(e=>e.id===s)??z(m),_=e=>{l?f(()=>e):e()},v=e=>{e!==p.id&&_(()=>{o(e),c(null)})};return(0,P.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,P.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,P.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,P.jsx)(`code`,{children:w}),`.`]}),(0,P.jsx)(S,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,P.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===p.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===p.id,onClick:()=>v(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===p.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),p.note&&(0,P.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:p.note}),(0,P.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,P.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,P.jsx)(V,{agent:p,listing:e,selectedId:h?.id??null,onSelect:e=>{if(e===h?.id){i();return}_(()=>{c(e),i()})}})}),(0,P.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:h?(0,P.jsx)(U,{file:h,onDirtyChange:u},h.id):(0,P.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.`})})]}),(0,P.jsx)(D,{open:d!==null,subject:h?.label??`this file`,onKeep:()=>f(null),onDiscard:()=>{let e=d;f(null),u(!1),e?.()}})]})}function R(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function z(e){return e.find(e=>e.scope===`project`)??e[0]??null}var B={project:`Project scope`,local:`Local scope`,user:`User scope`};function V({agent:e,listing:t,selectedId:n,onSelect:i}){let a=T();return(0,P.jsx)(P.Fragment,{children:e.groups.map(o=>{let s=t.files.filter(o.files),c=o.showsUserMcp?t.userMcp:void 0;return s.length===0&&!c&&!o.empty?null:(0,P.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":o.id,"data-agent":e.id,children:[(0,P.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:o.label}),o.note&&(0,P.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:o.note}),s.length===0&&o.empty&&(0,P.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:o.empty}),(0,P.jsx)(`ul`,{className:`flex flex-col gap-1`,children:s.map(e=>(0,P.jsx)(`li`,{children:(0,P.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,P.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,P.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),c&&(0,P.jsx)(H,{userMcp:c,path:v(c.path,a)})]},o.id)})})}function H({userMcp:e,path:t}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,P.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,P.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,P.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,P.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function U({file:e,onDirtyChange:t}){let n=c(e.id),r=T(),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(!1),[l,u]=(0,k.useState)(null),d=n.data?.version??null,f=i??n.data?.content??``,p=n.data?f!==n.data.content:!1,m=e.writable,h=e.kind===`mcp`||e.holdsMcp,_=m&&p;(0,k.useEffect)(()=>{t?.(_)},[_,t]),(0,k.useEffect)(()=>()=>t?.(!1),[t]);let{save:v}=J({file:e,content:f,loadedVersion:d,setDraft:a,setConflict:s,setFormatError:u});return O({dirty:m&&p,save:v,discard:()=>a(null)}),(0,k.useEffect)(()=>{n.data&&(a(n.data.content),s(!1),u(null))},[n.data?.version,n.data]),(0,P.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,P.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:B[e.scope]})]}),(0,P.jsx)(y,{"data-slot":`agent-config-path`,value:e.path,bases:r,className:`text-xs text-foreground`}),(0,P.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,P.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,P.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,P.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,P.jsx)(`h3`,{children:h?`MCP configuration`:`File contents`}),h&&(0,P.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),n.isPending?(0,P.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):n.isError?(0,P.jsx)(`p`,{className:`text-[13px] text-destructive`,children:n.error.message}):(0,P.jsx)(W,{file:e,content:f,isMcp:h,onChange:a}),(0,P.jsx)(K,{formatError:l,conflict:o,onReload:()=>void n.refetch()}),m&&!e.exists&&!p?(0,P.jsx)(`p`,{"data-slot":`agent-config-save-cue`,className:`text-xs text-muted-foreground`,children:`Enter content above to create this file.`}):null,(0,P.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,P.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,P.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[F(e),e.hotReload?` ${e.hotReload}`:``]}),(0,P.jsx)(q,{reason:e.readOnlyReason})]})]})}function W({file:e,content:t,isMcp:n,onChange:r}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,P.jsx)(E,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,P.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:G(e,n)})]})}function G(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
|
|
2
2
|
"mcpServers": {}
|
|
3
3
|
}`:`{
|
|
4
4
|
"permissions": {}
|
package/web/dist/assets/{agent-defaults-section-CYGoNzJ-.js → agent-defaults-section-D36po1w1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,Qt as i,S as a,St as o,Ut as s,Wt as c,Xt as l,Yt as u,an as d,g as f,in as p,kt as m,nn as h,un as g,ut as _,wt as v,xt as y}from"./queries-B8INH8MM.js";import{I as b,Or as x,Rn as S,Zt as C,a as w,n as T,vi as E,vn as D}from"./toaster-Cjr2jC1Q.js";import{c as O}from"./design-icons-QbNMZniQ.js";import{t as k}from"./button-C8jUIs8Q.js";import{t as A}from"./switch-CAKeV99j.js";import{t as j}from"./status-dot-BXf-Ubd0.js";import{t as M}from"./centered-state-BgSV4e79.js";import{A as ee,Cn as te,M as N,Mn as P,P as F}from"./index-lCPcoWSv.js";import{t as I}from"./textarea-vEsJAUAV.js";import{t as L}from"./option-select-BakZdSgu.js";import{a as R,i as z,n as B,r as V,t as H}from"./settings-agent-picker-B0Q0ke-Q.js";import{n as U,t as W}from"./save-cue-CpHgT93o.js";import{n as G}from"./settings-field-Bhh8I9fJ.js";import{r as K}from"./settings-save-bar-D_OxLOmj.js";import{n as q}from"./saved-draft-BwzBc-_Y.js";var J=e(t(),1),Y=n(),X={connected:P(`connected`),disconnected:P(`disconnected`),"not-installed":P(`not-installed`),unknown:P(`unknown`)};function Z(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function ne(e,t){return e?X[e]:t?{label:`Checking…`,tone:`neutral`}:X.unknown}function re(e,t){return e===`unknown`||t&&!e}function ie({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,Y.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,Y.jsx)(`code`,{children:e.loginCommand}),`.`]}):re(t,r)?(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function ae({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`,u=U();return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{saved:u.saved}),(0,Y.jsx)(A,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t,u.flash)})]}),l?(0,Y.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>T(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,Y.jsx)(B,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,Y.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,Y.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>T(`${e.displayName} can be tried again.`),onError:e=>T(e.message,{tone:`danger`})}),children:`Try again`})]})}function oe({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,Y.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,Y.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Y.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,Y.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function se(){let e=h(),t=o(),n=v(),r=m(),i=E(),[a,s]=(0,J.useState)(null),d=(0,J.useRef)(Promise.resolve()),f=(0,J.useRef)({}),_=(0,J.useRef)({}),y=(0,J.useRef)(t.data);(0,J.useEffect)(()=>{a&&x(t.data,a.provider)?.status===`connected`&&s(null)},[a,t.data]),(0,J.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!y.current){y.current=t.data;return}y.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?x(y.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let b=(0,J.useCallback)((e,t,n)=>{let r=c.providerStatus,a=i.getQueryData(r);if(!a)return;y.current||=a;let o=Z(a,e,t);_.current[e]=(_.current[e]??0)+1,i.setQueryData(r,o);let s=(f.current[e]??0)+1;f.current[e]=s,d.current=d.current.then(async()=>{try{let a=await D(e,t),o=x(a,e)?.enabled;if(o===void 0)return;if(y.current=Z(y.current??a,e,o),s===f.current[e]){let t=i.getQueryData(r);i.setQueryData(r,t?Z(t,e,o):a),n()}}catch(t){if(s===f.current[e]){let n=x(y.current,e)?.enabled,a=i.getQueryData(r);a&&n!==void 0?i.setQueryData(r,Z(a,e,n)):y.current?i.setQueryData(r,y.current):i.removeQueries({queryKey:r,exact:!0}),T(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[i]),w=g({mutationFn:e=>C(e),onSuccess:async(e,t)=>{s(null),T(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await i.invalidateQueries({queryKey:c.providerStatus}),await p(i,t,`none`)},onError:(t,n)=>{if(t instanceof S&&t.command){let r=u(e.data,n);s({provider:n,label:r,message:t.message,command:t.command});return}T(t.message,{tone:`danger`})}}),O=async e=>{try{await navigator.clipboard.writeText(e),T(`Command copied`)}catch{T(`Could not copy the command`,{tone:`danger`})}};return(0,Y.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,Y.jsxs)(`div`,{className:`mb-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,Y.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,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,Y.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:l(e.data).map(e=>{let i=x(t.data,e.id),o=i?.status,s=ne(o,t.isPending),c=w.isPending&&w.variables===e.id,l=i?.authFailureId;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,Y.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(j,{tone:s.tone,pulse:t.isPending}),(0,Y.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,Y.jsx)(`span`,{children:`Disabled`}):null]}),(0,Y.jsx)(ie,{provider:e,state:o,current:i,statusIsError:t.isError})]}),(0,Y.jsx)(ae,{provider:e,state:o,current:i,isConnecting:c,incidentId:l,refresh:n,connect:w,retry:r,queueToggle:b})]}),l===void 0?null:(0,Y.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,Y.jsx)(oe,{manual:a,provider:e.id,connected:o===`connected`,onCopy:O})]},e.id)})})]})}var Q=2e4;function ce(){let e=f(),t=h(),n=d(i(t.data)),r=o();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,Y.jsx)(M,{icon:(0,Y.jsx)(O,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(le,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function le({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=E(),c=g({mutationFn:e=>b(e),onSuccess:e=>{o.setQueryData(s.config,e),o.invalidateQueries({queryKey:s.health}),o.invalidateQueries({queryKey:s.repo})},onError:e=>T(e.message,{tone:`danger`})}),[u,d]=q(e.systemPrompt??``),f=u.trim(),p=f===(e.systemPrompt??``),m=f.length>Q;K({dirty:!p,invalid:m,busy:c.isPending,save:()=>c.mutateAsync({systemPrompt:f===``?null:f}),discard:()=>d(e.systemPrompt??``)});let h=U(),_=U(),v=U(),y=U(),x=U(),S=(e,t)=>c.mutate(e,{onSuccess:t});return(0,Y.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,Y.jsx)(ue,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,saved:h.saved,onSaved:h.flash,onPick:e=>S({defaultRunner:e},h.flash)}),(0,Y.jsx)(G,{wide:!0,title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Runner default lets the runner decide per task.`,saved:e.modelsLocked?void 0:_.saved,children:(0,Y.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:l(r).map(i=>{let{providerConnected:a,providerReason:o}=R(n,i.id),s=t[i.id],l=N(i.id,r,s),u=F(i.id,r,s?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`Runner default`;return(0,Y.jsxs)(`label`,{className:`settings-option-row`,children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,Y.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,Y.jsx)(L,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:c.isPending||!a,onValueChange:e=>S({defaultModels:{[i.id]:e||null}},_.flash),className:`settings-select max-w-full bg-card`,options:[...u.map(e=>({value:e.id,label:e.label})),...l?[{value:ee,label:l,disabled:!0}]:[]]})]},i.id)})})}),(0,Y.jsxs)(G,{wide:!0,title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,Y.jsx)(I,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,Y.jsx)(de,{length:f.length,overLimit:m})]}),(0,Y.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,Y.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,saved:v.saved,children:(0,Y.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Y.jsx)(A,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>S({liveTitleUpdates:e},v.flash)}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,Y.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,saved:y.saved,children:(0,Y.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Y.jsx)(A,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>S({reviewGate:e},y.flash)}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,Y.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,saved:x.saved,children:i.data?.info?(0,Y.jsx)(L,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onValueChange:e=>S({baseBranch:e||null},x.flash),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...i.data.branches.map(e=>({value:e,label:e}))]}):(0,Y.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,Y.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,Y.jsx)(`summary`,{children:`Provider connections`}),(0,Y.jsx)(se,{})]})]})}function ue({defaultRunner:e,providerStatus:t,saving:n,saved:i,onSaved:o,onPick:s}){let c=_(),l=y(),u=w(),d=a(),f=r(),p=u.projectId??`default`,m=d.data?.info?.root,g=te(c.data,u.projectId,m),v=h().data,b=V(c.data?.profiles??[],v),S=z(b,v);return(0,Y.jsxs)(G,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,saved:i,children:[(0,Y.jsx)(H,{rows:b,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:f.isPending||l.data===void 0,onPick:(t,n,r)=>{t!==e&&s(t),r&&f.mutate({projectId:p,provider:t,profileId:n},{onSuccess:o,onError:e=>T(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&x(t.data,e)?.enabled===!1?(0,Y.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,S?(0,Y.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function $({title:e,hint:t,saved:n,children:r}){return(0,Y.jsxs)(`section`,{className:`settings-option-row`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:e}),(0,Y.jsxs)(`p`,{children:[t,` `,(0,Y.jsx)(W,{saved:n})]})]}),r]})}function de({length:e,overLimit:t}){return(0,Y.jsx)(Y.Fragment,{children:t?(0,Y.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Q.toLocaleString(),`.`]}):(0,Y.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})})}export{ce 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{At as r,Qt as i,S as a,St as o,Ut as s,Wt as c,Xt as l,Yt as u,an as d,g as f,in as p,kt as m,nn as h,un as g,ut as _,wt as v,xt as y}from"./queries-jsRcJKo6.js";import{I as b,Or as x,Rn as S,Zt as C,a as w,n as T,vi as E,vn as D}from"./toaster-C1BFyQ8i.js";import{c as O}from"./design-icons-QbNMZniQ.js";import{t as k}from"./button-C8jUIs8Q.js";import{t as A}from"./switch-CAKeV99j.js";import{t as j}from"./status-dot-BXf-Ubd0.js";import{t as M}from"./centered-state-BgSV4e79.js";import{A as ee,Cn as te,M as N,Mn as P,P as F}from"./index-ChOV2nBM.js";import{t as I}from"./textarea-vEsJAUAV.js";import{t as L}from"./option-select-B70jYJmb.js";import{a as R,i as z,n as B,r as V,t as H}from"./settings-agent-picker-BaGf1RsO.js";import{n as U,t as W}from"./save-cue-CpHgT93o.js";import{n as G}from"./settings-field-Bhh8I9fJ.js";import{r as K}from"./settings-save-bar-Cf4yhgkq.js";import{n as q}from"./saved-draft-BwzBc-_Y.js";var J=e(t(),1),Y=n(),X={connected:P(`connected`),disconnected:P(`disconnected`),"not-installed":P(`not-installed`),unknown:P(`unknown`)};function Z(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function ne(e,t){return e?X[e]:t?{label:`Checking…`,tone:`neutral`}:X.unknown}function re(e,t){return e===`unknown`||t&&!e}function ie({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,Y.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,Y.jsx)(`code`,{children:e.loginCommand}),`.`]}):re(t,r)?(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,Y.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function ae({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`,u=U();return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(W,{saved:u.saved}),(0,Y.jsx)(A,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t,u.flash)})]}),l?(0,Y.jsx)(k,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>T(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,Y.jsx)(B,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,Y.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,Y.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>T(`${e.displayName} can be tried again.`),onError:e=>T(e.message,{tone:`danger`})}),children:`Try again`})]})}function oe({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,Y.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,Y.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,Y.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,Y.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function se(){let e=h(),t=o(),n=v(),r=m(),i=E(),[a,s]=(0,J.useState)(null),d=(0,J.useRef)(Promise.resolve()),f=(0,J.useRef)({}),_=(0,J.useRef)({}),y=(0,J.useRef)(t.data);(0,J.useEffect)(()=>{a&&x(t.data,a.provider)?.status===`connected`&&s(null)},[a,t.data]),(0,J.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!y.current){y.current=t.data;return}y.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?x(y.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let b=(0,J.useCallback)((e,t,n)=>{let r=c.providerStatus,a=i.getQueryData(r);if(!a)return;y.current||=a;let o=Z(a,e,t);_.current[e]=(_.current[e]??0)+1,i.setQueryData(r,o);let s=(f.current[e]??0)+1;f.current[e]=s,d.current=d.current.then(async()=>{try{let a=await D(e,t),o=x(a,e)?.enabled;if(o===void 0)return;if(y.current=Z(y.current??a,e,o),s===f.current[e]){let t=i.getQueryData(r);i.setQueryData(r,t?Z(t,e,o):a),n()}}catch(t){if(s===f.current[e]){let n=x(y.current,e)?.enabled,a=i.getQueryData(r);a&&n!==void 0?i.setQueryData(r,Z(a,e,n)):y.current?i.setQueryData(r,y.current):i.removeQueries({queryKey:r,exact:!0}),T(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[i]),w=g({mutationFn:e=>C(e),onSuccess:async(e,t)=>{s(null),T(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await i.invalidateQueries({queryKey:c.providerStatus}),await p(i,t,`none`)},onError:(t,n)=>{if(t instanceof S&&t.command){let r=u(e.data,n);s({provider:n,label:r,message:t.message,command:t.command});return}T(t.message,{tone:`danger`})}}),O=async e=>{try{await navigator.clipboard.writeText(e),T(`Command copied`)}catch{T(`Could not copy the command`,{tone:`danger`})}};return(0,Y.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,Y.jsxs)(`div`,{className:`mb-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,Y.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,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,Y.jsx)(k,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:l(e.data).map(e=>{let i=x(t.data,e.id),o=i?.status,s=ne(o,t.isPending),c=w.isPending&&w.variables===e.id,l=i?.authFailureId;return(0,Y.jsxs)(J.Fragment,{children:[(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,Y.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,Y.jsx)(j,{tone:s.tone,pulse:t.isPending}),(0,Y.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,Y.jsx)(`span`,{children:`Disabled`}):null]}),(0,Y.jsx)(ie,{provider:e,state:o,current:i,statusIsError:t.isError})]}),(0,Y.jsx)(ae,{provider:e,state:o,current:i,isConnecting:c,incidentId:l,refresh:n,connect:w,retry:r,queueToggle:b})]}),l===void 0?null:(0,Y.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,Y.jsx)(oe,{manual:a,provider:e.id,connected:o===`connected`,onCopy:O})]},e.id)})})]})}var Q=2e4;function ce(){let e=f(),t=h(),n=d(i(t.data)),r=o();return e.isPending?(0,Y.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,Y.jsx)(M,{icon:(0,Y.jsx)(O,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,Y.jsx)(le,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function le({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=E(),c=g({mutationFn:e=>b(e),onSuccess:e=>{o.setQueryData(s.config,e),o.invalidateQueries({queryKey:s.health}),o.invalidateQueries({queryKey:s.repo})},onError:e=>T(e.message,{tone:`danger`})}),[u,d]=q(e.systemPrompt??``),f=u.trim(),p=f===(e.systemPrompt??``),m=f.length>Q;K({dirty:!p,invalid:m,busy:c.isPending,save:()=>c.mutateAsync({systemPrompt:f===``?null:f}),discard:()=>d(e.systemPrompt??``)});let h=U(),_=U(),v=U(),y=U(),x=U(),S=(e,t)=>c.mutate(e,{onSuccess:t});return(0,Y.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,Y.jsx)(ue,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,saved:h.saved,onSaved:h.flash,onPick:e=>S({defaultRunner:e},h.flash)}),(0,Y.jsx)(G,{wide:!0,title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Runner default lets the runner decide per task.`,saved:e.modelsLocked?void 0:_.saved,children:(0,Y.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:l(r).map(i=>{let{providerConnected:a,providerReason:o}=R(n,i.id),s=t[i.id],l=N(i.id,r,s),u=F(i.id,r,s?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`Runner default`;return(0,Y.jsxs)(`label`,{className:`settings-option-row`,children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,Y.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,Y.jsx)(L,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:c.isPending||!a,onValueChange:e=>S({defaultModels:{[i.id]:e||null}},_.flash),className:`settings-select max-w-full bg-card`,options:[...u.map(e=>({value:e.id,label:e.label})),...l?[{value:ee,label:l,disabled:!0}]:[]]})]},i.id)})})}),(0,Y.jsxs)(G,{wide:!0,title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,Y.jsx)(I,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,Y.jsx)(de,{length:f.length,overLimit:m})]}),(0,Y.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,Y.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,saved:v.saved,children:(0,Y.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Y.jsx)(A,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>S({liveTitleUpdates:e},v.flash)}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,Y.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,saved:y.saved,children:(0,Y.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,Y.jsx)(A,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>S({reviewGate:e},y.flash)}),(0,Y.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,Y.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,saved:x.saved,children:i.data?.info?(0,Y.jsx)(L,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onValueChange:e=>S({baseBranch:e||null},x.flash),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...i.data.branches.map(e=>({value:e,label:e}))]}):(0,Y.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,Y.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,Y.jsx)(`summary`,{children:`Provider connections`}),(0,Y.jsx)(se,{})]})]})}function ue({defaultRunner:e,providerStatus:t,saving:n,saved:i,onSaved:o,onPick:s}){let c=_(),l=y(),u=w(),d=a(),f=r(),p=u.projectId??`default`,m=d.data?.info?.root,g=te(c.data,u.projectId,m),v=h().data,b=V(c.data?.profiles??[],v),S=z(b,v);return(0,Y.jsxs)(G,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,saved:i,children:[(0,Y.jsx)(H,{rows:b,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:f.isPending||l.data===void 0,onPick:(t,n,r)=>{t!==e&&s(t),r&&f.mutate({projectId:p,provider:t,profileId:n},{onSuccess:o,onError:e=>T(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&x(t.data,e)?.enabled===!1?(0,Y.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,S?(0,Y.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function $({title:e,hint:t,saved:n,children:r}){return(0,Y.jsxs)(`section`,{className:`settings-option-row`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{children:e}),(0,Y.jsxs)(`p`,{children:[t,` `,(0,Y.jsx)(W,{saved:n})]})]}),r]})}function de({length:e,overLimit:t}){return(0,Y.jsx)(Y.Fragment,{children:t?(0,Y.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Q.toLocaleString(),`.`]}):(0,Y.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})})}export{ce as AgentDefaultsSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{xt as n}from"./queries-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{xt as n}from"./queries-jsRcJKo6.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-C8jUIs8Q.js";import{En as s,er as c,ft as l}from"./index-ChOV2nBM.js";import{n as u}from"./save-cue-CpHgT93o.js";import{n as d}from"./settings-field-Bhh8I9fJ.js";var f=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`}]]),p=e(),m=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:f},{value:`dark`,label:`Dark`,icon:a}],h=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],g=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Ultra-compact`}],_=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function v({slot:e,label:n,value:r,options:i,onChange:a}){return(0,p.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,p.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,p.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function y(){let e=n(),{order:t,canReorder:r,reset:i}=s();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,p.jsx)(d,{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,p.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 b(){let{theme:e,setTheme:t}=c(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=l(),f=u(),b=u(),x=u(),S=u(),C=e=>t=>{t&&e()};return(0,p.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,p.jsx)(d,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,saved:f.saved,children:(0,p.jsx)(v,{slot:`appearance-theme`,label:`Theme`,value:e,options:m,onChange:e=>{t(e)&&f.flash()}})}),h.length>1?(0,p.jsx)(d,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,saved:b.saved,children:(0,p.jsx)(v,{slot:`appearance-accent`,label:`Accent`,value:n,options:h,onChange:e=>void a(e).then(C(b.flash))})}):null,(0,p.jsx)(d,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,saved:x.saved,children:(0,p.jsx)(v,{slot:`appearance-density`,label:`Density`,value:r,options:g,onChange:e=>void o(e).then(C(x.flash))})}),(0,p.jsx)(d,{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.`,saved:S.saved,children:(0,p.jsx)(v,{slot:`appearance-width`,label:`Reading width`,value:i,options:_,onChange:e=>void s(e).then(C(S.flash))})}),(0,p.jsx)(y,{}),(0,p.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,p.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,p.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,p.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,p.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{b as AppearanceSection};
|
package/web/dist/assets/{archive-on-merge-field-CeUWkcwK.js → archive-on-merge-field-UIiTWcbw.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,Ut as i,Wt as a,g as o,un as s}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,Ut as i,Wt as a,g as o,un as s}from"./queries-jsRcJKo6.js";import{I as c,un as l,vi as u}from"./toaster-C1BFyQ8i.js";import{t as d}from"./option-select-B70jYJmb.js";import{n as f,t as p}from"./save-cue-CpHgT93o.js";var m=e(t(),1),h=n();function g(){let e=o();return e.isPending?(0,h.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`project`})}function _(){let e=r();return e.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`global`})}function v({config:e,scope:t}){let n=(0,m.useId)(),r=u(),o=f(),g=s({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):l({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?r.setQueryData(n,e):(r.setQueryData(a.config,e),r.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==a.config})),o.flash()}});return(0,h.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`settings-field flex min-w-0 flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,h.jsxs)(`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,h.jsx)(p,{saved:o.saved})]})]}),(0,h.jsx)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`settings-select w-64 max-w-full bg-background`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:g.isPending,onValueChange:e=>g.mutate({archiveOnMerge:e===`inherit`?null:e===`enabled`,projectKey:i.config}),options:[{value:`inherit`,label:t===`project`?`Inherit global setting`:`Use default`},{value:`enabled`,label:`Enabled`},{value:`disabled`,label:`Disabled`}]}),(0,h.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,h.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),g.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,g.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,g.error.message]}):null]})}export{_ as n,g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Nn as e,On as t}from"./toaster-C1BFyQ8i.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{o as r}from"./dist-C_rn70hE.js";import{en as i,g as a,k as o,nn as s,on as c,tn as l}from"./queries-B8INH8MM.js";import{H as u,Kr as d,Rn as f,U as p,V as m,W as h,_ as g,ai as _,ar as v,c as y,cr as b,d as x,g as ee,ii as te,o as ne,s as re,sr as ie,ur as ae,v as oe}from"./toaster-Cjr2jC1Q.js";import{B as S,G as se,H as C,I as w,K as ce,N as T,P as E,V as le,W as D,j as O,z as k}from"./live-protocol-DMhTnCmf.js";import{h as ue,n as de}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as fe,t as A}from"./label-CqoNP6Yh.js";import{L as pe,X as me,Z as he,b as ge,ft as _e,ht as ve,nt as ye,ot as be,u as xe}from"./design-icons-QbNMZniQ.js";import{t as Se}from"./check-OP-CVgZG.js";import{t as j}from"./button-C8jUIs8Q.js";import{n as Ce,r as we,t as Te}from"./collapsible-Bx2vViFx.js";import{a as M,i as N,n as P,r as Ee,t as De}from"./select-fYRFfIZp.js";import{t as Oe}from"./switch-CAKeV99j.js";import{c as ke,s as Ae,t as F}from"./project-router-DvfVUjon.js";import{c as I,d as L,f as je,l as Me,n as Ne,o as Pe}from"./page-shell-Dky5crRl.js";import{r as Fe}from"./agents-settings-path-7X6_cvUg.js";import{t as Ie}from"./centered-state-BgSV4e79.js";import{D as Le,Gn as Re,K as ze,O as Be,P as Ve,Tn as He,Wn as Ue,Y as We,ar as R,k as Ge,kn as Ke,q as qe,r as Je,t as Ye,vr as Xe,xn as Ze}from"./index-lCPcoWSv.js";import{t as Qe}from"./textarea-vEsJAUAV.js";import{_ as $e,a as et,c as tt,d as nt,f as rt,g as it,h as at,i as ot,l as st,m as ct,n as lt,o as ut,p as dt,r as ft,s as pt,t as z,u as mt,v as ht}from"./automation-format-DB34jUyF.js";var B=e(t(),1),V=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),gt=S({includeExisting:E().optional(),authors:T(D()).optional(),assignees:T(D()).optional(),requireCurrentLabels:E().optional(),allLabels:T(D()).optional(),anyLabels:T(D()).optional(),excludeLabels:T(D()).optional(),changedLabels:T(D()).optional(),lookbackDays:k(),maxRecords:k()}),_t=O([`github`,`schedule`]),vt=v.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:D(),variants:se([w(1),w(2),w(3)]).optional(),systemPrompt:D().optional()}),yt=S({at:D(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}),H=S({id:D(),revision:k(),name:D(),description:D().optional(),enabled:E(),kind:_t,events:T(V).optional(),intervalSeconds:k().optional(),filters:gt.optional(),schedule:tt.optional(),task:vt,archived:yt.optional(),createdAt:D(),updatedAt:D()}),U=S({timestamp:D(),tieBreaker:D().optional()}),bt=S({since:D().datetime(),until:D().datetime(),source:k().int().min(0).max(2),page:k().int().min(1).max(10),item:k().int().min(0).max(100),event:k().int().min(0).max(1e3),cursor:U.optional()}),xt={lastError:D().max(1e3).optional(),lastErrorAt:D().datetime().optional()},St=S({revision:k().optional(),baselineAt:D().optional(),armedAt:D().optional(),historyScan:bt.optional(),cursor:U.optional(),frozenHighWatermark:U.extend({tieBreaker:D()}).optional(),backlogAfter:U.extend({tieBreaker:D()}).optional(),nextCheckAt:D().optional(),lastSuccessAt:D().optional(),nextRunAt:D().optional(),lastRunAt:D().optional(),etags:C(D(),D()).optional(),backoffUntil:D().optional(),consecutiveFailures:k().optional(),...xt,onceOutcome:O([`failed`,`missed`]).optional()});function Ct(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 wt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),Tt=S({seq:k(),ts:D(),automationId:D(),revision:k(),event:V.optional(),result:wt,reason:D().optional(),durationMs:k().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().optional(),githubTitle:D().optional(),githubUrl:D().optional(),rateLimit:S({bucket:O([`core`,`search`]),remaining:k().optional(),resetAt:D().optional()}).optional()}),Et=S({matches:k(),launched:k(),duplicates:k(),errors:k()}),Dt=H.extend({state:St.optional(),latestLog:Tt.optional(),counts:Et,nextRunAt:D().optional(),onceStatus:dt.optional()});S({available:E(),reason:D().optional(),timeZone:D(),scheduler:S({state:O([`scheduled`,`idle`]),nextDue:D().optional()}),automations:T(Dt)}),S({automation:H}).extend({once:S({dueAt:D(),timeZone:D(),resolvedInstant:D(),note:D()}).optional()}),S({automation:H,state:St.optional(),latestLog:Tt.optional(),onceStatus:dt.optional()}),S({id:D(),automationId:D(),mode:O([`preview`,`execute`]),status:O([`queued`,`running`,`complete`,`error`]),createdAt:D(),completedAt:D().optional(),matches:k().optional(),truncated:E().optional(),error:D().optional()}),S({checkId:D()}),S({records:T(Tt)}),S({receiptId:D(),runId:D()}),S({runId:D()}),H.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:_t.optional(),task:vt.omit({variants:!0}).strict(),enable:E().optional()}).omit({enable:!0}).extend({enabled:E().optional(),expectedRevision:k()}),S({archived:O([`include`,`only`]).optional()}),S({mode:O([`preview`,`execute`])});var W=n();function G({text:e}){return(0,W.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Ot={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`},kt={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 At(e){let[t,n]=(0,B.useState)(),[r,i]=(0,B.useState)(``),a=(0,B.useCallback)(t=>g(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,B.useEffect)(()=>{a()},[a]),(0,B.useEffect)(()=>d(a),[a]),(0,B.useEffect)(()=>fe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function jt(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 Mt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&jt(e,t),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await m(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,W.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,W.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(Je,{dot:Ot[e.result],children:kt[e.result]}),(0,W.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:lt(e.ts,n,u)})]}),e.reason?(0,W.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,W.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,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,W.jsx)(j,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,W.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var K=`all`;function Nt({label:e,value:t,onChange:n,options:r}){return(0,W.jsxs)(De,{value:t,onValueChange:n,children:[(0,W.jsx)(N,{"aria-label":e,className:`w-full sm:w-52`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:r.map(e=>(0,W.jsx)(Ee,{value:e.value,children:e.label},e.value))})]})}function Pt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=At(e),[s,c]=(0,B.useState)(K),[l,u]=(0,B.useState)(K),d=(0,B.useMemo)(()=>(i??[]).filter(e=>(s===K||e.result===s)&&(l===K||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,W.jsx)(Me,{route:`automations`,density:i?je(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,W.jsx)(I,{variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,W.jsx)(G,{text:a}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,W.jsx)(G,{text:`Nothing has run yet.`}):(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(Nt,{label:`Result`,value:s,onChange:c,options:[{value:K,label:`All results`},...wt.options.map(e=>({value:e,label:kt[e]}))]}),f?(0,W.jsx)(Nt,{label:`Event`,value:l,onChange:u,options:[{value:K,label:`All events`},...V.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,W.jsx)(G,{text:`No rows match these filters.`}):(0,W.jsx)(Mt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,W.jsx)(G,{text:`Loading execution log…`})})}function Ft({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=At(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,W.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,W.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,W.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,W.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,W.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,W.jsx)(G,{text:o}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,W.jsx)(Mt,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function It({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?ft(i):null,[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null),p=(0,B.useRef)(null),m=(0,B.useRef)(null);(0,B.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 x(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,W.jsx)(Me,{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,W.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,W.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,W.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,W.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${z(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,W.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,W.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,W.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`grid gap-1`,children:[(0,W.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,W.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,W.jsxs)(`div`,{className:`grid gap-1`,children:[(0,W.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,W.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,W.jsxs)(`section`,{className:`min-w-0`,children:[(0,W.jsx)(Ft,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,W.jsx)(j,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,W.jsx)(F,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,W.jsx)(j,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,W.jsx)(j,{variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations`,children:`Back to automations`})})]}),u?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var Lt=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),q=T(D().trim().min(1).max(200)).max(100).optional(),Rt=S({includeExisting:E().optional(),requireCurrentLabels:E().optional(),authors:q,assignees:q,allLabels:q,anyLabels:q,excludeLabels:q,changedLabels:q,lookbackDays:k().int().min(1).max(90).default(7),maxRecords:k().int().min(1).max(100).default(25)}).passthrough(),zt=S({prompt:D().min(1).max(1e5),workflow:D().trim().min(1).max(200).optional(),steps:T(ie).min(1).max(100).optional(),runner:te.optional(),model:D().trim().min(1).max(200).optional(),effort:D().trim().min(1).max(32).optional(),variants:se([w(1),w(2),w(3)]).optional(),worktree:E().optional(),autonomous:E().optional(),...b,...ae,systemPrompt:D().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Bt=new Set(Object.keys(zt.shape).filter(e=>e!==`variants`));function Vt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Bt.has(e)))}le(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??{}}},S({id:D().min(1).max(100),revision:k().int().positive(),name:D().trim().min(1).max(200),description:D().max(2e3).optional(),enabled:E().default(!1),kind:_t.default(`github`),events:T(Lt).min(1).max(4).optional(),intervalSeconds:k().int().min(60).max(86400).optional(),filters:Rt.optional(),schedule:tt.passthrough().optional(),task:zt,archived:S({at:D().datetime(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:D().datetime(),updatedAt:D().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:_.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:_.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:_.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:_.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:_.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),S({version:w(1).default(1),automations:T(ce()).default([]),tombstones:C(D(),D().datetime()).optional()}).passthrough();var J=S({timestamp:D().datetime(),tieBreaker:D().optional()}).passthrough(),Ht=bt.extend({cursor:J.optional()}),Ut=S({revision:k().int().positive().optional(),baselineAt:D().datetime().optional(),armedAt:D().datetime().optional(),historyScan:Ht.optional(),cursor:J.optional(),frozenHighWatermark:J.extend({tieBreaker:D()}).optional(),backlogAfter:J.extend({tieBreaker:D()}).optional(),nextCheckAt:D().datetime().optional(),lastSuccessAt:D().datetime().optional(),nextRunAt:D().datetime().optional(),lastRunAt:D().datetime().optional(),etags:C(D(),D()).optional(),backoffUntil:D().datetime().optional(),consecutiveFailures:k().int().nonnegative().optional(),...xt,onceOutcome:O([`failed`,`missed`]).optional()}).passthrough();S({version:w(1).default(1),states:C(D(),Ut).default({})}).passthrough(),S({receiptId:D().min(1),receiptKey:D().min(1),eventId:D().min(1),automationId:D().min(1),revision:k().int().positive(),status:O([`reserved`,`launched`,`launch-error`,`released`]),runId:D().optional(),observedAt:D().datetime(),updatedAt:D().datetime(),error:D().max(2e3).optional(),occurrenceAt:D().datetime().optional(),candidate:S({eventId:D(),event:Lt,timestamp:D().datetime(),tieBreaker:D(),repo:D(),nodeId:D(),number:k().int().positive(),title:D().max(500),url:D().url(),author:D().max(200),assignees:T(D().max(200)).max(100),labels:T(D().max(200)).max(100),changedLabel:D().max(200).optional()}).passthrough().optional()}).passthrough();var Wt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);S({seq:k().int().positive(),ts:D().datetime(),automationId:D().min(1),revision:k().int().positive(),event:Lt.optional(),result:Wt,reason:D().max(2e3).optional(),durationMs:k().int().nonnegative().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().int().positive().optional(),githubTitle:D().max(500).optional(),githubUrl:D().url().optional(),rateLimit:S({bucket:O([`core`,`search`]),remaining:k().int().nonnegative().optional(),resetAt:D().datetime().optional()}).passthrough().optional()}).passthrough();var Gt=`quick-task`;function Kt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Vt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:mt(e.schedule??{type:`daily`}),events:e.events??[V.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Gt}:{}:{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 qt(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 Jt(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 Yt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:qt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Jt(e)}}function Xt(e){return{...Yt(e),enable:e.enabled}}function Zt(e,t){return{...Yt(e),task:{...Jt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Y(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Qt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),$t=new Set([`anyLabels`,`authors`,`changedLabels`]);function en(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||$t.has(e)&&Array.isArray(t)&&t.length>0)}function tn(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function nn(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function X(e,t){return t.startsWith(`-`)?`--${e}=${Y(t)}`:`--${e} ${Y(t)}`}function rn(e){let t=[`${Ze()} automation add`,X(`name`,e.name)];if(e.schedule?.type===`once`)t.push(X(`at`,e.schedule.at),X(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(X(`latest-start`,nn(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(X(`cron`,st(e.schedule)));else{t.push(X(`on`,e.events.join(`,`)),`--every ${tn(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(X(`label`,n));for(let n of e.filters?.authors??[])t.push(X(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(X(`changed-label`,n))}return t.push(...an(e.task)),e.enable===!0&&t.push(`--enable`),t.push(X(`prompt`,e.task.prompt)),t.join(` `)}function an(e){let t=[];return e.workflow&&t.push(X(`workflow`,e.workflow)),e.runner&&t.push(X(`runner`,e.runner)),e.model&&t.push(X(`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 on(e,t){let n=Xt(e),r=en(n)?rn(n):`${Ze()} automation create --json ${Y(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Y(t.origin)} CEZ_PROJECT_ID=${Y(t.projectId)} HSQ_COCKPIT_URL=${Y(t.origin)} HSQ_PROJECT_ID=${Y(t.projectId)} ${r}`:r}function sn(e){let t=[],n=!1;for(let r of cn(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{o as r}from"./dist-C_rn70hE.js";import{en as i,g as a,k as o,nn as s,on as c,tn as l}from"./queries-jsRcJKo6.js";import{H as u,Kr as d,Rn as f,U as p,V as m,W as h,_ as g,ai as _,ar as v,c as y,cr as b,d as x,g as ee,ii as te,o as ne,s as re,sr as ie,ur as ae,v as oe}from"./toaster-C1BFyQ8i.js";import{B as S,G as se,H as C,I as w,K as ce,N as T,P as E,V as le,W as D,j as O,z as k}from"./live-protocol-DMhTnCmf.js";import{h as ue,n as de}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as fe,t as A}from"./label-DRXJ8ljY.js";import{L as pe,X as me,Z as he,b as ge,ft as _e,ht as ve,nt as ye,ot as be,u as xe}from"./design-icons-QbNMZniQ.js";import{t as Se}from"./check-OP-CVgZG.js";import{t as j}from"./button-C8jUIs8Q.js";import{n as Ce,r as we,t as Te}from"./collapsible-Bx2vViFx.js";import{a as M,i as N,n as P,r as Ee,t as De}from"./select-8oIZpehA.js";import{t as Oe}from"./switch-CAKeV99j.js";import{c as ke,s as Ae,t as F}from"./project-router-C53GCY_8.js";import{c as I,d as L,f as je,l as Me,n as Ne,o as Pe}from"./page-shell-Dky5crRl.js";import{r as Fe}from"./agents-settings-path-7X6_cvUg.js";import{t as Ie}from"./centered-state-BgSV4e79.js";import{D as Le,Gn as Re,K as ze,O as Be,P as Ve,Tn as He,Wn as Ue,Y as We,ar as R,k as Ge,kn as Ke,q as qe,r as Je,t as Ye,vr as Xe,xn as Ze}from"./index-ChOV2nBM.js";import{t as Qe}from"./textarea-vEsJAUAV.js";import{_ as $e,a as et,c as tt,d as nt,f as rt,g as it,h as at,i as ot,l as st,m as ct,n as lt,o as ut,p as dt,r as ft,s as pt,t as z,u as mt,v as ht}from"./automation-format-DB34jUyF.js";var B=e(t(),1),V=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),gt=S({includeExisting:E().optional(),authors:T(D()).optional(),assignees:T(D()).optional(),requireCurrentLabels:E().optional(),allLabels:T(D()).optional(),anyLabels:T(D()).optional(),excludeLabels:T(D()).optional(),changedLabels:T(D()).optional(),lookbackDays:k(),maxRecords:k()}),_t=O([`github`,`schedule`]),vt=v.omit({task:!0,images:!0,systemPrompt:!0}).extend({prompt:D(),variants:se([w(1),w(2),w(3)]).optional(),systemPrompt:D().optional()}),yt=S({at:D(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}),H=S({id:D(),revision:k(),name:D(),description:D().optional(),enabled:E(),kind:_t,events:T(V).optional(),intervalSeconds:k().optional(),filters:gt.optional(),schedule:tt.optional(),task:vt,archived:yt.optional(),createdAt:D(),updatedAt:D()}),U=S({timestamp:D(),tieBreaker:D().optional()}),bt=S({since:D().datetime(),until:D().datetime(),source:k().int().min(0).max(2),page:k().int().min(1).max(10),item:k().int().min(0).max(100),event:k().int().min(0).max(1e3),cursor:U.optional()}),xt={lastError:D().max(1e3).optional(),lastErrorAt:D().datetime().optional()},St=S({revision:k().optional(),baselineAt:D().optional(),armedAt:D().optional(),historyScan:bt.optional(),cursor:U.optional(),frozenHighWatermark:U.extend({tieBreaker:D()}).optional(),backlogAfter:U.extend({tieBreaker:D()}).optional(),nextCheckAt:D().optional(),lastSuccessAt:D().optional(),nextRunAt:D().optional(),lastRunAt:D().optional(),etags:C(D(),D()).optional(),backoffUntil:D().optional(),consecutiveFailures:k().optional(),...xt,onceOutcome:O([`failed`,`missed`]).optional()});function Ct(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 wt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]),Tt=S({seq:k(),ts:D(),automationId:D(),revision:k(),event:V.optional(),result:wt,reason:D().optional(),durationMs:k().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().optional(),githubTitle:D().optional(),githubUrl:D().optional(),rateLimit:S({bucket:O([`core`,`search`]),remaining:k().optional(),resetAt:D().optional()}).optional()}),Et=S({matches:k(),launched:k(),duplicates:k(),errors:k()}),Dt=H.extend({state:St.optional(),latestLog:Tt.optional(),counts:Et,nextRunAt:D().optional(),onceStatus:dt.optional()});S({available:E(),reason:D().optional(),timeZone:D(),scheduler:S({state:O([`scheduled`,`idle`]),nextDue:D().optional()}),automations:T(Dt)}),S({automation:H}).extend({once:S({dueAt:D(),timeZone:D(),resolvedInstant:D(),note:D()}).optional()}),S({automation:H,state:St.optional(),latestLog:Tt.optional(),onceStatus:dt.optional()}),S({id:D(),automationId:D(),mode:O([`preview`,`execute`]),status:O([`queued`,`running`,`complete`,`error`]),createdAt:D(),completedAt:D().optional(),matches:k().optional(),truncated:E().optional(),error:D().optional()}),S({checkId:D()}),S({records:T(Tt)}),S({receiptId:D(),runId:D()}),S({runId:D()}),H.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0,kind:!0,archived:!0}).extend({kind:_t.optional(),task:vt.omit({variants:!0}).strict(),enable:E().optional()}).omit({enable:!0}).extend({enabled:E().optional(),expectedRevision:k()}),S({archived:O([`include`,`only`]).optional()}),S({mode:O([`preview`,`execute`])});var W=n();function G({text:e}){return(0,W.jsx)(`div`,{role:`status`,className:`rounded-xl border border-border bg-card p-6 text-sm text-muted-foreground`,children:e})}var Ot={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`},kt={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 At(e){let[t,n]=(0,B.useState)(),[r,i]=(0,B.useState)(``),a=(0,B.useCallback)(t=>g(e,{signal:t}).then(({records:e})=>{t?.aborted||(n(e),i(``))}).catch(e=>{t?.aborted||i(String(e))}),[e]);return(0,B.useEffect)(()=>{a()},[a]),(0,B.useEffect)(()=>d(a),[a]),(0,B.useEffect)(()=>fe((t,n)=>{t===`automation-change`&&n.automationId===e&&a()}),[e,a]),{records:t,error:r,refresh:a}}function jt(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 Mt({records:e,all:t,timeZone:n,onRetried:r,readOnly:i=!1}){let a=e=>!i&&jt(e,t),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(),u=Date.now(),d=async e=>{s(e),l(void 0);try{await m(e),r()}catch(t){l({receiptId:e,message:t instanceof Error?t.message:String(t)})}finally{s(void 0)}};return(0,W.jsx)(`ol`,{className:`grid gap-3`,"aria-label":`Automation execution log`,children:e.map(e=>(0,W.jsxs)(`li`,{className:`min-w-0 rounded-xl border border-card-edge bg-card p-4 shadow-card`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,W.jsx)(Je,{dot:Ot[e.result],children:kt[e.result]}),(0,W.jsx)(`time`,{className:`text-xs text-muted-foreground`,dateTime:e.ts,title:e.ts,children:lt(e.ts,n,u)})]}),e.reason?(0,W.jsx)(`p`,{className:`mt-2 text-sm break-words text-muted-foreground`,children:e.reason}):null,e.githubUrl||e.runId||a(e)?(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm`,children:[e.githubUrl?(0,W.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,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`}):null,a(e)?(0,W.jsx)(j,{variant:`outline`,disabled:o===e.receiptId,onClick:()=>void d(e.receiptId),children:`Retry task`}):null]}):null,c&&c.receiptId===e.receiptId?(0,W.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm break-words text-destructive`,children:c.message}):null]},e.seq))})}var K=`all`;function Nt({label:e,value:t,onChange:n,options:r}){return(0,W.jsxs)(De,{value:t,onValueChange:n,children:[(0,W.jsx)(N,{"aria-label":e,className:`w-full sm:w-52`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:r.map(e=>(0,W.jsx)(Ee,{value:e.value,children:e.label},e.value))})]})}function Pt({automationId:e,automationName:t,timeZone:n,readOnly:r=!1}){let{records:i,error:a,refresh:o}=At(e),[s,c]=(0,B.useState)(K),[l,u]=(0,B.useState)(K),d=(0,B.useMemo)(()=>(i??[]).filter(e=>(s===K||e.result===s)&&(l===K||e.event===l)),[i,s,l]),f=(i??[]).some(e=>e.event);return(0,W.jsx)(Me,{route:`automations`,density:i?je(d.length):`full`,header:{title:`Execution log`,subtitle:t??`Automation activity`,secondaryActions:(0,W.jsx)(I,{variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations`,children:`Back to automations`})})},children:a&&!i?(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,W.jsx)(G,{text:a}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void o(),children:`Retry`})]}):i?i.length===0?(0,W.jsx)(G,{text:`Nothing has run yet.`}):(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(Nt,{label:`Result`,value:s,onChange:c,options:[{value:K,label:`All results`},...wt.options.map(e=>({value:e,label:kt[e]}))]}),f?(0,W.jsx)(Nt,{label:`Event`,value:l,onChange:u,options:[{value:K,label:`All events`},...V.options.map(e=>({value:e,label:e}))]}):null]}),d.length===0?(0,W.jsx)(G,{text:`No rows match these filters.`}):(0,W.jsx)(Mt,{records:d,all:i,timeZone:n,onRetried:()=>void o(),readOnly:r})]}):(0,W.jsx)(G,{text:`Loading execution log…`})})}function Ft({automationId:e,automationName:t,timeZone:n,showName:r=!1,readOnly:i=!1}){let{records:a,error:o,refresh:s}=At(e),c=`Recent activity${r&&t?` · ${t}`:``}`;return!o&&a&&a.length===0?(0,W.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,W.jsx)(`h3`,{className:`font-medium text-foreground`,children:c}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,W.jsx)(`p`,{children:`Nothing has run yet.`})]}):(0,W.jsxs)(`section`,{"data-slot":`automation-inline-log`,className:`min-w-0 border-t border-border pt-2.5`,children:[(0,W.jsx)(`h3`,{className:`mb-1.5 text-xs font-medium text-muted-foreground`,children:c}),o&&!a?(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,W.jsx)(G,{text:o}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]}):a?(0,W.jsx)(Mt,{records:a.slice(0,5),all:a,timeZone:n,onRetried:()=>void s(),readOnly:i}):(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading activity…`})]})}function It({automation:e,timeZone:t,onDeleted:n}){let r=e.archived,i=e.schedule,a=i?ft(i):null,[o,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null),p=(0,B.useRef)(null),m=(0,B.useRef)(null);(0,B.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 x(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,W.jsx)(Me,{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,W.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[(0,W.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,W.jsxs)(`p`,{className:`text-sm break-words`,children:[(0,W.jsx)(`span`,{children:r.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`}),r.runId?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${r.runId}`,children:`Open task`})]}):null]}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Archived ${z(r.at,t)} (${t}).`}),a&&i?.timeZone?(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Was due ${a.date} ${a.time} (${i.timeZone}).`}):null]}),(0,W.jsxs)(`section`,{"aria-labelledby":`archived-inputs`,className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-4`,children:[(0,W.jsx)(`h2`,{id:`archived-inputs`,className:`mb-3 text-[15px] font-medium`,children:`What it ran with`}),(0,W.jsxs)(`dl`,{className:`grid gap-3 text-sm`,children:[(0,W.jsxs)(`div`,{className:`grid gap-1`,children:[(0,W.jsx)(`dt`,{className:`text-muted-foreground`,children:`Prompt`}),(0,W.jsx)(`dd`,{className:`break-words whitespace-pre-wrap`,children:e.task.prompt})]}),g.filter(([,e])=>e).map(([e,t])=>(0,W.jsxs)(`div`,{className:`grid gap-1`,children:[(0,W.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,W.jsx)(`dd`,{className:`break-words`,children:t})]},e))]})]}),(0,W.jsxs)(`section`,{className:`min-w-0`,children:[(0,W.jsx)(Ft,{automationId:e.id,automationName:e.name,timeZone:t,readOnly:!0}),(0,W.jsx)(j,{variant:`outline`,asChild:!0,className:`mt-3`,children:(0,W.jsx)(F,{to:`/automations/${e.id}/log`,children:`Execution log`})})]}),(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[o?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? Its record and log are removed; the task stays.`}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:c,onClick:()=>void h(),children:`Delete schedule`}),(0,W.jsx)(j,{ref:p,variant:`outline`,disabled:c,onClick:()=>{m.current=`delete`,s(!1)},children:`Keep`})]})]}):(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{ref:f,variant:`outline`,"data-action":`automation-delete`,onClick:()=>{m.current=`keep`,s(!0)},children:`Delete`}),(0,W.jsx)(j,{variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations`,children:`Back to automations`})})]}),u?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:u}):null]})]})})}var Lt=O([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),q=T(D().trim().min(1).max(200)).max(100).optional(),Rt=S({includeExisting:E().optional(),requireCurrentLabels:E().optional(),authors:q,assignees:q,allLabels:q,anyLabels:q,excludeLabels:q,changedLabels:q,lookbackDays:k().int().min(1).max(90).default(7),maxRecords:k().int().min(1).max(100).default(25)}).passthrough(),zt=S({prompt:D().min(1).max(1e5),workflow:D().trim().min(1).max(200).optional(),steps:T(ie).min(1).max(100).optional(),runner:te.optional(),model:D().trim().min(1).max(200).optional(),effort:D().trim().min(1).max(32).optional(),variants:se([w(1),w(2),w(3)]).optional(),worktree:E().optional(),autonomous:E().optional(),...b,...ae,systemPrompt:D().max(1e5).optional()}).passthrough().refine(e=>!(e.workflow&&e.steps),{message:`task selects either a named workflow or inline steps, not both`}),Bt=new Set(Object.keys(zt.shape).filter(e=>e!==`variants`));function Vt(e){return Object.fromEntries(Object.entries(e).filter(([e])=>Bt.has(e)))}le(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??{}}},S({id:D().min(1).max(100),revision:k().int().positive(),name:D().trim().min(1).max(200),description:D().max(2e3).optional(),enabled:E().default(!1),kind:_t.default(`github`),events:T(Lt).min(1).max(4).optional(),intervalSeconds:k().int().min(60).max(86400).optional(),filters:Rt.optional(),schedule:tt.passthrough().optional(),task:zt,archived:S({at:D().datetime(),outcome:O([`launched`,`cancelled`]),runId:D().optional(),receiptId:D().optional(),trigger:O([`schedule`,`late`,`manual`,`retry`]).optional()}).passthrough().optional(),createdAt:D().datetime(),updatedAt:D().datetime()}).passthrough().superRefine((e,t)=>{if(e.kind===`schedule`){e.schedule||t.addIssue({code:_.custom,path:[`schedule`],message:`a scheduled automation needs a schedule`});return}e.events?.length||t.addIssue({code:_.custom,path:[`events`],message:`a GitHub automation needs at least one event`}),e.intervalSeconds===void 0&&t.addIssue({code:_.custom,path:[`intervalSeconds`],message:`a GitHub automation needs a poll interval`}),e.filters||t.addIssue({code:_.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:_.custom,path:[`filters`,`changedLabels`],message:`changedLabels is required for issue label events`})})),S({version:w(1).default(1),automations:T(ce()).default([]),tombstones:C(D(),D().datetime()).optional()}).passthrough();var J=S({timestamp:D().datetime(),tieBreaker:D().optional()}).passthrough(),Ht=bt.extend({cursor:J.optional()}),Ut=S({revision:k().int().positive().optional(),baselineAt:D().datetime().optional(),armedAt:D().datetime().optional(),historyScan:Ht.optional(),cursor:J.optional(),frozenHighWatermark:J.extend({tieBreaker:D()}).optional(),backlogAfter:J.extend({tieBreaker:D()}).optional(),nextCheckAt:D().datetime().optional(),lastSuccessAt:D().datetime().optional(),nextRunAt:D().datetime().optional(),lastRunAt:D().datetime().optional(),etags:C(D(),D()).optional(),backoffUntil:D().datetime().optional(),consecutiveFailures:k().int().nonnegative().optional(),...xt,onceOutcome:O([`failed`,`missed`]).optional()}).passthrough();S({version:w(1).default(1),states:C(D(),Ut).default({})}).passthrough(),S({receiptId:D().min(1),receiptKey:D().min(1),eventId:D().min(1),automationId:D().min(1),revision:k().int().positive(),status:O([`reserved`,`launched`,`launch-error`,`released`]),runId:D().optional(),observedAt:D().datetime(),updatedAt:D().datetime(),error:D().max(2e3).optional(),occurrenceAt:D().datetime().optional(),candidate:S({eventId:D(),event:Lt,timestamp:D().datetime(),tieBreaker:D(),repo:D(),nodeId:D(),number:k().int().positive(),title:D().max(500),url:D().url(),author:D().max(200),assignees:T(D().max(200)).max(100),labels:T(D().max(200)).max(100),changedLabel:D().max(200).optional()}).passthrough().optional()}).passthrough();var Wt=O([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`,`skipped`,`manual`,`catch-up`,`failed`,`missed`]);S({seq:k().int().positive(),ts:D().datetime(),automationId:D().min(1),revision:k().int().positive(),event:Lt.optional(),result:Wt,reason:D().max(2e3).optional(),durationMs:k().int().nonnegative().optional(),receiptId:D().optional(),runId:D().optional(),githubNumber:k().int().positive().optional(),githubTitle:D().max(500).optional(),githubUrl:D().url().optional(),rateLimit:S({bucket:O([`core`,`search`]),remaining:k().int().nonnegative().optional(),resetAt:D().datetime().optional()}).passthrough().optional()}).passthrough();var Gt=`quick-task`;function Kt(e={}){let{prompt:t,workflow:n,runner:r,model:i,autonomous:a,archiveWhenDone:o,autoMergePr:s,allowWorkers:c,allowMessaging:l,...u}=Vt(e.task??{prompt:``}),d=e.task===void 0;return{name:e.name??``,description:e.description??``,kind:e.kind??`schedule`,schedule:mt(e.schedule??{type:`daily`}),events:e.events??[V.options[0]],intervalSeconds:e.intervalSeconds??300,filters:e.filters??{lookbackDays:7,maxRecords:25},prompt:t,...n===void 0?d?{workflow:Gt}:{}:{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 qt(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 Jt(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 Yt(e){return{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},kind:e.kind,...e.kind===`schedule`?{schedule:qt(e.schedule)}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:Jt(e)}}function Xt(e){return{...Yt(e),enable:e.enabled}}function Zt(e,t){return{...Yt(e),task:{...Jt(e),archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging},enabled:e.enabled,expectedRevision:t}}function Y(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Qt=new Set([`prompt`,`workflow`,`runner`,`model`,`autonomous`,`worktree`,`archiveWhenDone`,`autoMergePr`,`allowWorkers`,`allowMessaging`]),$t=new Set([`anyLabels`,`authors`,`changedLabels`]);function en(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||$t.has(e)&&Array.isArray(t)&&t.length>0)}function tn(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function nn(e){return e%1440==0?`${e/1440}d`:e%60==0?`${e/60}h`:`${e}m`}function X(e,t){return t.startsWith(`-`)?`--${e}=${Y(t)}`:`--${e} ${Y(t)}`}function rn(e){let t=[`${Ze()} automation add`,X(`name`,e.name)];if(e.schedule?.type===`once`)t.push(X(`at`,e.schedule.at),X(`tz`,e.schedule.timeZone)),e.schedule.latestStartMinutes!==void 0&&t.push(X(`latest-start`,nn(e.schedule.latestStartMinutes)));else if(e.kind===`schedule`)t.push(X(`cron`,st(e.schedule)));else{t.push(X(`on`,e.events.join(`,`)),`--every ${tn(e.intervalSeconds??300)}`),e.filters?.includeExisting&&t.push(`--include-existing`);for(let n of e.filters?.anyLabels??[])t.push(X(`label`,n));for(let n of e.filters?.authors??[])t.push(X(`author`,n));for(let n of e.filters?.changedLabels??[])t.push(X(`changed-label`,n))}return t.push(...an(e.task)),e.enable===!0&&t.push(`--enable`),t.push(X(`prompt`,e.task.prompt)),t.join(` `)}function an(e){let t=[];return e.workflow&&t.push(X(`workflow`,e.workflow)),e.runner&&t.push(X(`runner`,e.runner)),e.model&&t.push(X(`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 on(e,t){let n=Xt(e),r=en(n)?rn(n):`${Ze()} automation create --json ${Y(JSON.stringify(n))}`;return t?`CEZ_COCKPIT_URL=${Y(t.origin)} CEZ_PROJECT_ID=${Y(t.projectId)} HSQ_COCKPIT_URL=${Y(t.origin)} HSQ_PROJECT_ID=${Y(t.projectId)} ${r}`:r}function sn(e){let t=[],n=!1;for(let r of cn(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 cn(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 ln({draft:e,saveLabel:t,editing:n}){let i=Ae(),a=window.location.origin,o=(0,B.useMemo)(()=>{let t=on(e);return i?`HSQ_COCKPIT_URL=${Y(a)} HSQ_PROJECT_ID=${Y(i)} ${t}`:t},[e,a,i]),s=(0,B.useMemo)(()=>sn(o),[o]),[c,l]=(0,B.useState)(`idle`),[u,d]=(0,B.useState)(!1),f=(0,B.useId)(),p=(0,B.useRef)(void 0);(0,B.useEffect)(()=>()=>clearTimeout(p.current),[]),(0,B.useEffect)(()=>l(`idle`),[o]);let m=async()=>{clearTimeout(p.current);try{await navigator.clipboard.writeText(s),l(`copied`),p.current=setTimeout(()=>l(`idle`),1600)}catch{l(`failed`)}};return(0,W.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,W.jsxs)(`div`,{className:`flex min-h-8 min-w-0 flex-nowrap items-center justify-between gap-x-2`,children:[(0,W.jsx)(`h2`,{id:`copy-as-cli-heading`,className:`shrink-0 text-[13px] font-medium text-muted-foreground`,children:`Copy as CLI`}),(0,W.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`copy-as-cli-toggle`,"aria-expanded":u,"aria-controls":f,"aria-label":u?`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:()=>d(e=>!e),children:[(0,W.jsx)(`span`,{className:`truncate`,children:u?`Hide`:`Show`}),(0,W.jsx)(xe,{"aria-hidden":`true`,className:r(`size-3.5 transition-transform`,u&&`rotate-180`)})]}),(0,W.jsxs)(j,{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 m(),children:[c===`copied`?(0,W.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5`}):(0,W.jsx)(Xe,{"aria-hidden":`true`,className:`size-3.5`}),c===`copied`?`Copied`:`Copy`]})]}),(0,W.jsx)(`div`,{id:f,hidden:!u,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,W.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:s})}),(0,W.jsx)(`p`,{role:`status`,className:`mbs-2 text-xs break-words text-muted-foreground`,children:c===`failed`?`Could not copy — select the line and copy it by hand.`:(0,W.jsxs)(W.Fragment,{children:[`The definition ${t} would ${n?`save`:`create`}.`,` `,(0,W.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-px font-mono text-xs whitespace-nowrap text-foreground [word-spacing:-0.2em]`,children:`${Ze()} automation schema`}),` prints its shape.`]})})]})}function un({pressed:e,onClick:t,disabled:n,children:i}){return(0,W.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 dn={"pull_request.opened":`a pull request opens`,"issue.opened":`an issue opens`,"issue.labeled":`an issue is labeled`,"issue.unlabeled":`an issue is unlabeled`},fn={"pull_request.opened":`Pull request opened`,"issue.opened":`Issue opened`,"issue.labeled":`Issue labeled`,"issue.unlabeled":`Issue unlabeled`};function pn(e){let t=e.map(e=>dn[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 mn=V.options,hn=[{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`}],gn=[{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.`}],_n=e=>(e??[]).join(`, `),vn=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function yn(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 bn(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`}. ${yn(e.filters.includeExisting)}`}function xn({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=vn(r),{[n]:a,...o}=e.filters;t({filters:i.length?{...o,[n]:i}:o})},o=hn.some(t=>t.seconds===e.intervalSeconds)?hn:[...hn,{seconds:e.intervalSeconds,label:`${Math.round(e.intervalSeconds/60)} minutes`}].sort((e,t)=>e.seconds-t.seconds);return(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[n?(0,W.jsx)(`p`,{className:`text-xs text-pending-strong`,children:`GitHub unavailable · ${n}`}):null,(0,W.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:mn.map(t=>(0,W.jsx)(un,{pressed:e.events.includes(t),onClick:()=>r(t),children:fn[t]},t))}),(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-interval`,children:`Check every`}),(0,W.jsxs)(De,{value:String(e.intervalSeconds),onValueChange:e=>t({intervalSeconds:Number(e)}),children:[(0,W.jsx)(N,{id:`automation-interval`,className:`w-full sm:w-48`,"aria-label":`Check every`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:o.map(e=>(0,W.jsx)(Ee,{value:String(e.seconds),children:e.label},e.seconds))})]})]}),(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm`,children:[(0,W.jsx)(Oe,{"aria-label":`Include existing items`,"aria-describedby":`automation-history-hint`,checked:e.filters.includeExisting??!1,onCheckedChange:e=>i({includeExisting:e})}),(0,W.jsx)(`span`,{children:`Include existing items`})]}),(0,W.jsx)(`p`,{id:`automation-history-hint`,className:`text-xs text-muted-foreground`,children:yn(e.filters.includeExisting)})]}),(0,W.jsxs)(Te,{children:[(0,W.jsxs)(we,{className:`group flex min-h-11 items-center gap-2 text-sm font-medium`,children:[`Filters`,(0,W.jsx)(xe,{"aria-hidden":`true`,className:`size-4 text-soft-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-180`})]}),(0,W.jsx)(Ce,{children:(0,W.jsxs)(`div`,{className:`grid gap-4 pt-2 sm:grid-cols-2`,children:[gn.map(t=>(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-filter-${t.key}`,children:t.label}),(0,W.jsx)(R,{id:`automation-filter-${t.key}`,className:`border-border`,placeholder:`comma separated`,value:_n(e.filters[t.key]),onChange:e=>a(t.key,e.target.value)}),t.hint?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.hint}):null]},t.key)),(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-filter-lookback`,children:`Look back (days)`}),(0,W.jsx)(R,{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,W.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-filter-max`,children:`Max records per check`}),(0,W.jsx)(R,{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 Sn=e=>String(e).padStart(2,`0`);function Z({label:e,value:t,max:n,onCommit:r}){let[i,a]=(0,B.useState)(Sn(t)),o=(0,B.useRef)(null),s=!(/^\d{1,2}$/.test(i)&&Number(i)===t),c=`${e} must be 00–${Sn(n)}.`,l=(0,B.useId)();return(0,B.useEffect)(()=>{o.current?.setCustomValidity(s?c:``)},[s,c]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R,{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(Sn(t))}),s?(0,W.jsx)(`p`,{id:l,className:`order-last basis-full text-xs text-destructive`,children:c}):null]})}var Cn=[{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`}],wn=`none`,Tn=e=>String(e).padStart(2,`0`);function En(e,t=Date.now()){let n=ht(t,e)??ht(t,`UTC`),r=new Date(Date.UTC(n.year,n.month-1,n.day+1));return`${r.getUTCFullYear()}-${Tn(r.getUTCMonth()+1)}-${Tn(r.getUTCDate())}T09:00`}function Dn(){let e=typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[];return e.includes(`UTC`)?e:[`UTC`,...e]}function On({value:e,stored:t,onChange:n}){let r=t=>n({...e,...t}),i=e.at?ct(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${Tn(t)}:${Tn(n)}`}),l=(0,B.useRef)(null),u=(0,B.useId)(),d=rt(e),f=!(t?.type===`once`&&t.at===e.at&&t.timeZone===e.timeZone)&&d!==null&&d<=Date.now();(0,B.useEffect)(()=>{l.current?.setCustomValidity(f?et:``)},[f]);let p=ft(e);return(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-4 gap-y-3`,children:[(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-once-date`,children:`Date`}),(0,W.jsx)(R,{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,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,W.jsx)(Z,{label:`Hour`,value:o,max:23,onCommit:e=>c(a,e,s)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,W.jsx)(Z,{label:`Minute`,value:s,max:59,onCommit:e=>c(a,o,e)})]})]}),f?(0,W.jsx)(`p`,{id:u,className:`text-xs text-destructive`,children:et}):null,(0,W.jsx)(An,{value:e.timeZone??``,onCommit:e=>r({timeZone:e})}),(0,W.jsx)(jn,{value:e.latestStartMinutes,onChange:t=>n(kn(e,t))}),p?(0,W.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 kn(e,t){let{latestStartMinutes:n,...r}=e;return t===void 0?r:{...r,latestStartMinutes:t}}function An({value:e,onCommit:t}){let[n,r]=(0,B.useState)(e),i=(0,B.useRef)(null),a=(0,B.useId)(),o=(0,B.useId)(),[s]=(0,B.useState)(Dn),c=n!==e||!$e(n),l=it(n);return(0,B.useEffect)(()=>{i.current?.setCustomValidity(c?l:``)},[c,l]),(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-once-zone`,children:`Time zone`}),(0,W.jsx)(R,{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),$e(e.target.value)&&t(e.target.value)}}),(0,W.jsx)(`datalist`,{id:a,children:s.map(e=>(0,W.jsx)(`option`,{value:e},e))}),c?(0,W.jsx)(`p`,{id:o,className:`text-xs break-words text-destructive`,children:l}):null]})}function jn({value:e,onChange:t}){let n=Cn.some(t=>t.minutes===e)||e===void 0?Cn:[...Cn,{minutes:e,label:`${e} minutes`}];return(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-once-latest`,children:`Latest start`}),(0,W.jsxs)(De,{value:e===void 0?wn:String(e),onValueChange:e=>t(e===wn?void 0:Number(e)),children:[(0,W.jsx)(N,{id:`automation-once-latest`,className:`w-full sm:w-48`,"aria-label":`Latest start`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:n.map(e=>(0,W.jsx)(Ee,{value:e.minutes===void 0?wn:String(e.minutes),children:e.label},e.label))})]}),(0,W.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 Mn=[{type:`daily`,label:`Every day`},{type:`weekdays`,label:`Weekdays`},{type:`weekly`,label:`Weekly`},{type:`hours`,label:`Every N hours`},{type:`once`,label:`Once`}];function Nn({value:e,stored:t,onChange:n,timeZone:r}){let i=t=>n({...e,...t}),a=t=>i(t===`once`?{type:t,at:e.at??En(r),timeZone:e.timeZone??r}:{type:t});return(0,W.jsxs)(`div`,{className:`grid gap-4`,children:[(0,W.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:Mn.map(t=>(0,W.jsx)(un,{pressed:e.type===t.type,onClick:()=>a(t.type),children:t.label},t.type))}),e.type===`once`?(0,W.jsx)(On,{value:e,stored:t,onChange:n}):null,e.type===`weekly`?(0,W.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:pt.map((t,n)=>(0,W.jsx)(un,{pressed:e.day===n+1,onClick:()=>i({day:n+1}),children:t},t))}):null,e.type===`once`?null:e.type===`hours`?(0,W.jsxs)(`div`,{className:`grid gap-2`,children:[(0,W.jsx)(A,{htmlFor:`automation-every`,children:`Run every`}),(0,W.jsxs)(De,{value:String(e.every),onValueChange:e=>i({every:Number(e)}),children:[(0,W.jsx)(N,{id:`automation-every`,className:`w-full sm:w-48`,"aria-label":`Run every`,children:(0,W.jsx)(M,{})}),(0,W.jsx)(P,{children:ut.map(e=>(0,W.jsx)(Ee,{value:String(e),children:e===1?`hour`:`${e} hours`},e))})]}),(0,W.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,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`at`}),(0,W.jsx)(Z,{label:`Hour`,value:e.hour,max:23,onCommit:e=>i({hour:e})}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`:`}),(0,W.jsx)(Z,{label:`Minute`,value:e.minute,max:59,onCommit:e=>i({minute:e})}),(0,W.jsx)(`span`,{className:`text-sm break-all text-muted-foreground`,children:r})]}),e.type===`once`?null:(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Cron: `,(0,W.jsx)(`code`,{className:`font-mono text-foreground`,children:st(e)})]})]})}var Pn=40*864e5,Fn=5;function In({schedule:e,timeZone:t,now:n=Date.now()}){if(e.type===`once`)return(0,W.jsx)(Ln,{schedule:e,now:n});let r=nt(e,n+1,n+Pn,t,Fn);return(0,W.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,W.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-2 text-base font-semibold`,children:`Next 5 runs`}),r.length===0?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No runs in the next 40 days.`}):(0,W.jsx)(`ol`,{"aria-label":`Next 5 runs`,className:`grid divide-y divide-border text-sm`,children:r.map((e,r)=>(0,W.jsxs)(`li`,{className:`flex min-h-10 items-center justify-between gap-3 py-1.5`,children:[(0,W.jsx)(`span`,{className:r===0?`font-semibold tabular-nums text-foreground`:`font-medium tabular-nums`,children:z(new Date(e).toISOString(),t)}),(0,W.jsx)(`span`,{className:r===0?`font-medium text-accent-text`:`text-muted-foreground`,children:ot(n,e)})]},e))}),(0,W.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Times are in `,t,`, the zone this Squawk runs in.`]})]})}function Ln({schedule:e,now:t}){let n=rt(e),r=ft(e);return(0,W.jsxs)(`section`,{"aria-labelledby":`next-runs-heading`,"data-slot":`next-runs`,className:`min-w-0 rounded-xl border bg-card p-5`,children:[(0,W.jsx)(`h2`,{id:`next-runs-heading`,className:`mb-3 text-base font-semibold`,children:`Runs once`}),n===null||!r?(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Pick a date, a time and a time zone.`}):(0,W.jsxs)(`p`,{className:`flex flex-wrap items-baseline justify-between gap-x-3 text-sm`,children:[(0,W.jsx)(`span`,{className:`font-medium tabular-nums`,children:`${r.date} ${r.time}`}),n>t?(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:ot(t,n)}):null]}),r?.note?(0,W.jsx)(`p`,{className:`mt-2 text-sm break-words`,children:r.note}):null,n!==null&&n<=t?(0,W.jsx)(`p`,{className:`mt-2 text-sm text-destructive`,children:`The due time has passed.`}):null,(0,W.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 Rn={schedule:`On a schedule`,github:`When GitHub changes`};function zn(e){return/time zone|due time/i.test(e)?`when`:/autonomous/i.test(e)?`execution`:/placeholder|prompt|workflow|runner|model|task/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 Q({title:e,icon:t,hideLegend:n=!1,failure:r,section:i,children:a}){let o=(0,B.useId)();return(0,W.jsxs)(`section`,{role:n?void 0:`group`,"aria-labelledby":n?void 0:o,className:`grid min-w-0 gap-3.5 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[n?null:t?(0,W.jsxs)(`h2`,{id:o,className:`flex items-center gap-2 text-base font-semibold text-foreground`,children:[t,e]}):(0,W.jsx)(`h2`,{id:o,className:`text-sm font-semibold text-foreground`,children:e}),a,r?.section===i&&!r.conflict?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:r.message}):null]})}function Bn({draft:e,patch:t,forge:n,automation:r}){return(0,W.jsx)(W.Fragment,{children:r?(0,W.jsxs)(`p`,{className:`text-sm`,children:[(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`Trigger · `}),Rn[e.kind]]}):(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,W.jsx)(Ye,{slot:`automation-kind`,label:`Trigger`,size:`touch`,value:e.kind,onChange:e=>t({kind:e}),options:[{value:`schedule`,label:Rn.schedule},{value:`github`,label:Rn.github,disabled:!n.available,...n.available?{}:{title:n.reason??`GitHub is unavailable`}}]}),n.available?null:(0,W.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`GitHub unavailable · ${n.reason??`no GitHub access`}`})]})})}function Vn({draft:e,patch:t,forge:n,timeZone:r,automation:i}){return e.kind===`schedule`?(0,W.jsx)(Nn,{value:e.schedule,stored:i?.schedule,onChange:e=>t({schedule:e}),timeZone:r}):(0,W.jsx)(xn,{draft:e,onChange:t,...n.available?{}:{disabledReason:n.reason??`no GitHub access`}})}function Hn({draft:e,patch:t}){let n=e.kind===`schedule`?[`date`,`time`,`project`,`automation`]:[`github.kind`,`github.number`,`github.title`,`github.url`,`github.author`,`github.assignees`,`github.labels`,`github.event`],r=[...new Set([...e.prompt.matchAll(/\{\{([^{}]+)\}\}/g)].map(e=>e[1]))].filter(e=>!n.includes(e));return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,W.jsx)(A,{htmlFor:`automation-prompt`,children:`Prompt`}),(0,W.jsx)(Qe,{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,W.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:e.kind===`schedule`?(0,W.jsxs)(W.Fragment,{children:[`Available: `,`{{date}}`,` `,`{{time}}`,` `,`{{project}}`,` `,`{{automation}}`,`. A run-context block is appended automatically.`]}):(0,W.jsxs)(W.Fragment,{children:[`Available: `,`{{github.number}}`,` `,`{{github.title}}`,` `,`{{github.url}}`,` `,`{{github.labels}}`,`. GitHub content is appended as untrusted context.`]})})]}),r.length?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:`Unavailable for this trigger: ${r.map(e=>`{{${e}}}`).join(`, `)}`}):null,(0,W.jsx)(Xn,{draft:e,patch:t})]})}function Un({label:e,help:t,checked:n,onChange:r}){let i=(0,B.useId)();return(0,W.jsxs)(`label`,{htmlFor:i,className:`completion-control flex min-h-11 min-w-0 items-center justify-between gap-3 rounded-md text-sm`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,W.jsx)(`span`,{id:`${i}-label`,children:e}),(0,W.jsx)(`span`,{id:`${i}-help`,className:`completion-control-help`,children:t})]}),(0,W.jsx)(Oe,{id:i,className:`completion-switch shrink-0`,checked:n,"aria-labelledby":`${i}-label`,"aria-describedby":`${i}-help`,onCheckedChange:r})]})}function Wn({draft:e,patch:t,saving:n,automation:r}){let i=e.kind===`schedule`,a=r?`Enabled`:`Enable after saving`,o=i&&e.schedule.type===`once`?`It runs once at the time set under When, then moves to Archived with its task.`:i?`The first run is the next occurrence in Next 5 runs.`:yn(e.filters.includeExisting);return(0,W.jsxs)(W.Fragment,{children:[(0,W.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,W.jsxs)(`div`,{"data-embedded":``,className:`grid min-w-0`,children:[(0,W.jsx)(Un,{label:`Autonomous`,help:`Runs without waiting for answers.`,checked:e.autonomous,onChange:e=>t({autonomous:e})}),(0,W.jsx)(Ge,{embedded:!0,archiveWhenDone:e.archiveWhenDone,autoMergePr:e.autoMergePr,onChange:t,disabled:n}),(0,W.jsx)(Be,{embedded:!0,allowWorkers:e.allowWorkers,allowMessaging:e.allowMessaging,onChange:t,disabled:n}),(0,W.jsx)(Un,{label:a,help:o,checked:e.enabled,onChange:e=>t({enabled:e})})]}),r?(0,W.jsx)(`p`,{className:`text-xs break-words text-muted-foreground`,children:`These settings apply to future tasks. Existing tasks keep their settings.`}):null]})}function Gn({automation:e,forge:t,timeZone:n,onSaved:r,onReload:i}){let[a,o]=(0,B.useState)(()=>Kt(e)),[s,c]=(0,B.useState)(e?.revision),[l,u]=(0,B.useState)(),[d,m]=(0,B.useState)(!1),g=e=>o(t=>({...t,...e})),_=async t=>{if(t.preventDefault(),d)return;let n=t.currentTarget;if(n instanceof HTMLFormElement&&!n.checkValidity()){n.reportValidity();return}m(!0),u(void 0);let i=`save`;try{if(e&&s!==void 0){let{automation:t}=await h(e.id,Zt({...a,enabled:e.enabled},s));c(t.revision),a.enabled!==e.enabled&&(i=`enable`,await p(e.id,a.enabled))}else await y(Xt(a));r()}catch(t){let n=t instanceof Error?t.message:String(t);i===`save`&&e&&t instanceof f&&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`?`execution`:zn(n),message:n})}finally{m(!1)}},v=(0,B.useId)(),b=(0,B.useId)(),x=a.kind===`schedule`;return(0,W.jsx)(Pe,{route:`automations`,density:a.name.trim()===``&&a.prompt.trim()===``?`sparse`:`full`,header:Yn({automation:e,draft:a,formId:v,saveHintId:b,saving:d}),children:(0,W.jsxs)(`form`,{id:v,className:`automation-editor grid min-w-0 gap-4 md:grid-cols-[minmax(0,1fr)_320px] md:grid-rows-[auto_1fr] md:items-start`,onSubmit:_,children:[(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-3.5`,children:[(0,W.jsx)(Q,{title:`Name`,hideLegend:!0,section:`name`,failure:l,children:(0,W.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,W.jsx)(A,{htmlFor:`automation-name`,className:`text-sm font-semibold text-foreground`,children:`Name`}),(0,W.jsx)(R,{id:`automation-name`,className:`border-border`,value:a.name,placeholder:`Daily dependency audit`,onChange:e=>g({name:e.target.value}),required:!0})]})}),(0,W.jsxs)(Q,{title:`When`,section:`when`,failure:l,children:[(0,W.jsx)(Bn,{draft:a,patch:g,forge:t,automation:e}),(0,W.jsx)(Vn,{draft:a,patch:g,forge:t,timeZone:n,automation:e})]}),(0,W.jsx)(Q,{title:`What to run`,section:`run`,failure:l,children:(0,W.jsx)(Hn,{draft:a,patch:g})})]}),(0,W.jsxs)(`aside`,{className:`grid min-w-0 max-w-full grid-cols-[minmax(0,1fr)] gap-4 md:sticky md:top-4 md:col-start-2 md:row-span-2 md:row-start-1`,children:[(0,W.jsx)(Q,{title:`Execution settings`,icon:(0,W.jsx)(ye,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),section:`execution`,failure:l,children:(0,W.jsx)(Wn,{draft:a,patch:g,saving:d,automation:e})}),x?(0,W.jsx)(In,{schedule:a.schedule,timeZone:n}):(0,W.jsxs)(`section`,{className:`min-w-0 rounded-xl border border-card-edge bg-card shadow-card p-5`,children:[(0,W.jsx)(`h2`,{className:`mb-2 text-base font-semibold`,children:`How it polls`}),(0,W.jsx)(`p`,{className:`text-sm break-words text-muted-foreground`,children:bn(a)})]}),(0,W.jsx)(ln,{draft:a,saveLabel:qn(e,a),editing:e!==void 0})]}),l?.section===`form`||e?(0,W.jsxs)(`div`,{className:`grid min-w-0 gap-3.5 md:col-start-1`,children:[l?.section===`form`?(0,W.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 text-sm text-destructive`,children:[(0,W.jsx)(`span`,{className:`break-words`,children:l.message}),l.conflict&&i?(0,W.jsx)(j,{type:`button`,variant:`outline`,onClick:i,children:`Reload`}):null]}):null,e?(0,W.jsx)(Kn,{automation:e,onDeleted:r}):null]}):null]})})}function Kn({automation:e,onDeleted:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``),c=async()=>{if(!i){a(!0),s(``);try{await x(e.id),t()}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}};return(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2 border-t pt-4`,children:[n?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-sm break-words`,children:`Delete “${e.name}”? It will stop running and cannot be restored.`}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{type:`button`,variant:`danger-ghost`,"data-action":`automation-delete-confirm`,disabled:i,onClick:()=>void c(),children:`Delete automation`}),(0,W.jsx)(j,{type:`button`,variant:`outline`,disabled:i,onClick:()=>{r(!1),s(``)},children:`Keep`})]})]}):(0,W.jsx)(j,{type:`button`,variant:`outline`,"data-action":`automation-delete`,onClick:()=>r(!0),children:`Delete`}),o?(0,W.jsx)(`p`,{role:`alert`,className:`text-sm break-words text-destructive`,children:o}):null]})}function qn(e,t){return e?`Save changes`:t.enabled?`Save and enable`:`Save paused`}function Jn(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 Yn({automation:e,draft:t,formId:n,saveHintId:r,saving:i}){let a=t.name.trim()?t.prompt.trim()?``:`Prompt`:`Name`,o=Jn(t),s=qn(e,t);return{title:e?`Edit automation`:`New automation`,subtitle:`Define when it runs and the ordinary task it launches.`,status:(0,W.jsx)(`p`,{id:r,"data-slot":`automation-save-hint`,className:`min-h-[1lh] text-xs text-muted-foreground`,children:o}),secondaryActions:(0,W.jsx)(I,{type:`button`,variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations`,children:`Cancel`})}),primaryAction:(0,W.jsx)(I,{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 Xn({draft:e,patch:t}){let n=o(),r=He(),{runners:u,signedOut:d}=r.runnersOn(e=>r.repoAccount?.[e]),f=a(),p=s(),{runner:m,ready:h}=l(e.runner??f.data?.defaultRunner??`claude`),g=c(m,h,r.repoAccount?.[m]),_=[...new Set([...(n.data?.workflows??[]).map(e=>e.name),...e.workflow?[e.workflow]:[]])],v=[...new Set([...u,...e.runner?[e.runner]:[]])],y=Ve(m,p.data,g.data,[e.model]),b=y.find(t=>t.id===(e.model??``))?.label??e.model??`Runner default`,x=e=>(0,W.jsx)(e,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`});return(0,W.jsx)(qe,{children:(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(ze,{slot:`automation-workflow-pill`,icon:x(_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:_.map(e=>({value:e,label:e})),onPick:e=>t({workflow:e})}),(0,W.jsx)(ze,{slot:`automation-runner-pill`,icon:x(be),fieldLabel:!0,ariaLabel:`Runner`,label:e.runner?i(p.data,e.runner):`default`,value:e.runner??``,disabled:!p.data,options:[{value:``,label:`default`,desc:`The project’s default runner`},...v.map(e=>({value:e,label:i(p.data,e)}))],footer:(0,W.jsx)(We,{uninstalled:r.uninstalled,signedOut:d.filter(t=>t!==e.runner)}),onPick:e=>{t({runner:e||void 0,model:void 0})}}),(0,W.jsx)(ze,{slot:`automation-model-pill`,icon:x(ge),fieldLabel:!0,ariaLabel:`Model`,label:b,value:e.model??``,options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),onPick:e=>t({model:e||void 0})})]})})}function Zn(e){return{text:/\bauth\b|sign.?in|\blogin\b|\btoken\b|credentials|HTTP 401/i.test(e)?`GitHub CLI is not signed in`:/ENOENT|not found.*gh|gh.*not found/i.test(e)?`GitHub CLI is not installed`:`GitHub filter check failed`,tone:`error`,details:e}}function Qn({data:e,error:t,refresh:n,archived:i=!1,onArchivedChange:a}){let[o,s]=(0,B.useState)({}),[c,l]=(0,B.useState)({}),d=(e,t)=>s(n=>{let{[e]:r,...i}=n;return t?{...i,[e]:t}:i}),f=async(e,t,n=!1)=>{l(t=>({...t,[e]:!0}));try{await t()}catch(t){let r=t instanceof Error?t.message:String(t);d(e,n?Zn(r):{text:r,tone:`error`})}finally{l(t=>({...t,[e]:!1}))}},m=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 p(e.id,!e.enabled),await n()}),g=e=>f(e.id,async()=>{d(e.id,void 0),await ne(e.id),await n()}),_=e=>f(e.id,async()=>{d(e.id,{text:`Checking…`,tone:`info`});let{checkId:t}=await re(e.id,`preview`);for(let r=0;r<60;r+=1){let r=await ee(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`){let t=r.error??`Preview failed`;d(e.id,Zn(t));return}await new Promise(e=>setTimeout(e,500))}throw Error(`Preview is still running`)},!0),v=e?.automations??[],y=v.filter(e=>!e.archived),b=v.filter(e=>!!e.archived),x=i?b:y;return(0,W.jsx)(L,{route:`automations`,density:e?je(x.length):`full`,headerSpacing:`compact`,header:{title:`Automations`,subtitle:`Schedules and GitHub checks run while Squawk is open.`,primaryAction:(0,W.jsx)(I,{variant:`primary`,asChild:!0,children:(0,W.jsxs)(F,{to:`/automations/new`,children:[(0,W.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})},sparseFooter:e&&x.length>0&&!i?(0,W.jsx)(Ne,{summary:`${x.length} active ${x.length===1?`automation`:`automations`} configured. New automations start paused so you can test filters before enabling them.`,actions:(0,W.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,W.jsx)(F,{to:`/automations/new`,children:`Add another`})})}):void 0,children:t&&!e?(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,W.jsx)(G,{text:t}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void n(),children:`Retry`})]}):e?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border`,children:[a?(0,W.jsxs)(`div`,{className:`flex gap-6`,role:`group`,"aria-label":`Filter automations`,children:[(0,W.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,W.jsx)($n,{count:y.length})]}),(0,W.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,W.jsx)($n,{count:b.length})]})]}):(0,W.jsx)(`span`,{}),(0,W.jsx)(`div`,{className:`pb-2.5`,children:(0,W.jsx)(er,{data:e})})]}),i&&x.length===0?(0,W.jsx)(G,{text:`No archived automations.`}):x.length===0?(0,W.jsx)(Ie,{icon:(0,W.jsx)(ve,{}),tone:`neutral`,title:`No automations yet`,subtitle:`Create one paused, preview it, then enable it.`,heading:`h2`,actions:(0,W.jsx)(j,{variant:`primary`,asChild:!0,children:(0,W.jsxs)(F,{to:`/automations/new`,children:[(0,W.jsx)(me,{"aria-hidden":`true`,className:`size-4`}),`New automation`]})})}):(0,W.jsx)(`ul`,{className:`grid gap-3`,"aria-label":`Automations`,children:x.map(t=>(0,W.jsx)(lr,{automation:t,timeZone:e.timeZone,note:o[t.id],busy:c[t.id]===!0,onRun:()=>void m(t),onToggle:()=>void h(t),onPreview:()=>void _(t),onCancel:()=>void g(t)},t.id))})]}):(0,W.jsx)(G,{text:`Loading automations…`})})}function $n({count:e}){return e===0?null:(0,W.jsx)(`span`,{"data-slot":`automations-tab-count`,className:`tabular-nums text-muted-foreground`,children:`· ${e}`})}function er({data:e}){return(0,W.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 tr(e){return e.kind===`schedule`&&e.schedule?at(e.schedule):`${pn(e.events??[])} · every ${Math.round((e.intervalSeconds??300)/60)} min`}function nr({automation:e,nextRun:t}){let n=e.kind===`schedule`?he:pe,r=Ke(e);return(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.jsxs)(`h2`,{className:`flex items-center gap-2 font-semibold break-words`,children:[(0,W.jsx)(n,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),e.name]}),(0,W.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,W.jsx)(`span`,{children:tr(e)}),t?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t]}):null]})]}),(0,W.jsx)(Je,{dot:r.tone,shape:r.shape,pulse:r.pulse,children:r.label})]})}function rr({automation:e,archive:t}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`text-sm break-words`,children:[t.outcome===`launched`?`Started its task.`:`Cancelled — no task was started.`,t.runId?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${t.runId}`,children:`Open task`})]}):null]}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,W.jsx)(j,{variant:`outline`,asChild:!0,children:(0,W.jsx)(F,{to:`/automations/${e.id}`,children:`Details`})})})]})}function ir({automation:e,timeZone:t}){let n=e.kind===`schedule`,r=e.enabled&&n?e.nextRunAt:void 0;return!n&&e.enabled?(0,W.jsx)(`span`,{children:`continuous`}):r?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`text-foreground`,children:`Next run: ${z(r,t)}`}),(0,W.jsx)(`span`,{children:`· ${ot(Date.now(),Date.parse(r))}`})]}):(0,W.jsx)(`span`,{children:`Next run: —`})}function ar({automation:e,timeZone:t}){let n=e.enabled?Ct(e.state):void 0;return n?(0,W.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,W.jsx)(`span`,{className:`text-muted-foreground`,children:` · Next try ${z(n.retryAt,t)}`}):null]}):null}var $=`h-8 px-3 max-md:h-11 no-hover:h-11`;function or({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,W.jsxs)(`div`,{"data-slot":`automation-actions`,className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-toggle`,disabled:t,onClick:a,children:e.enabled?`Pause`:`Enable`}),l?(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-run`,disabled:t,onClick:o,children:`Run now`}):(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:$,"data-action":`automation-preview`,disabled:t,onClick:s,children:`Test filter`}),(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:$,asChild:!0,children:(0,W.jsx)(F,{to:`/automations/${e.id}`,children:`Edit`})}),u&&!n?(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:r($,`text-destructive`),ref:i,"data-action":`automation-cancel`,disabled:t,onClick:c,children:`Cancel`}):null,(0,W.jsx)(j,{variant:`outline`,size:`sm`,className:r($,`sm:ms-auto`),asChild:!0,children:(0,W.jsx)(F,{to:`/automations/${e.id}/log`,children:`Execution log`})})]})}function sr({automation:e,busy:t,keepRef:n,onConfirm:r,onKeep:i}){return(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-2`,children:[(0,W.jsx)(`p`,{className:`text-sm break-words`,children:`Cancel “${e.name}”? It will never run, and it moves to Archived.`}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(j,{variant:`danger-ghost`,"data-action":`automation-cancel-confirm`,disabled:t,onClick:r,children:`Cancel schedule`}),(0,W.jsx)(j,{ref:n,variant:`outline`,disabled:t,onClick:i,children:`Keep`})]})]})}function cr({note:e}){return(0,W.jsxs)(`div`,{role:e.tone===`error`?`alert`:`status`,className:r(`text-sm break-words`,e.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[e.text,e.details?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(de,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:Fe(`gh`),children:`Set up`}),(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{className:`min-h-11 cursor-pointer`,children:`Command details`}),(0,W.jsx)(`pre`,{className:`whitespace-pre-wrap break-words`,children:e.details})]})]}):null,e.runId?(0,W.jsxs)(W.Fragment,{children:[` · `,(0,W.jsx)(F,{className:`inline-flex min-h-11 items-center underline underline-offset-4`,to:`/tasks/${e.runId}`,children:`Open task`})]}):null]})}function lr({automation:e,timeZone:t,note:n,busy:r,onRun:i,onToggle:a,onPreview:o,onCancel:s}){let[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=(0,B.useRef)(null),f=(0,B.useRef)(null);(0,B.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,W.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,W.jsx)(nr,{automation:e,nextRun:h?void 0:(0,W.jsx)(ir,{automation:e,timeZone:t})}),h?(0,W.jsx)(rr,{automation:e,archive:h}):null,h?null:(0,W.jsx)(ar,{automation:e,timeZone:t}),h?null:(0,W.jsx)(or,{automation:e,busy:r,confirmingCancel:c,cancelRef:u,onToggle:a,onRun:i,onPreview:o,onOpenCancel:p}),e.schedule?.type===`once`&&!h&&c?(0,W.jsx)(sr,{automation:e,busy:r,keepRef:d,onConfirm:()=>{l(!1),s()},onKeep:m}):null,n?(0,W.jsx)(cr,{note:n}):null,(0,W.jsx)(Ft,{automationId:e.id,automationName:e.name,timeZone:t})]})}function ur(e){let t=Ae(),n=Re(),[r,i]=(0,B.useState)(),[a,o]=(0,B.useState)(``),s=(0,B.useCallback)(t=>oe({signal:t,...e?{archived:e}:{}}).then(e=>{t?.aborted||(i(e),o(``))}).catch(e=>{t?.aborted||o(String(e))}),[e]);return(0,B.useEffect)(()=>{n&&s()},[n,s]),(0,B.useEffect)(()=>d(async e=>{n&&await s(e)}),[n,s]),(0,B.useEffect)(()=>fe((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 dr({mode:e=`list`}){let{automationId:t}=ue(),n=ke(),[r,i]=(0,B.useState)(!1),{data:a,error:o,refresh:s}=ur(`include`),[c,l]=(0,B.useState)(0),u=Ue();if(u===`unknown`)return(0,W.jsx)(L,{route:`automations`,density:`empty`,children:(0,W.jsx)(G,{text:`Loading automations…`})});if(u===`absent`)return(0,W.jsx)(Le,{});if(u===`disabled`)return(0,W.jsx)(L,{route:`automations`,density:`empty`,children:(0,W.jsx)(Ie,{icon:(0,W.jsx)(ve,{}),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,W.jsx)(Qn,{data:a,error:o,refresh:s,archived:r,onArchivedChange:i});if(!a)return o?(0,W.jsx)(L,{route:`automations`,density:`empty`,header:{title:`Automations`,subtitle:`Could not load automations.`},children:(0,W.jsxs)(`div`,{className:`grid justify-items-start gap-3`,children:[(0,W.jsx)(G,{text:o}),(0,W.jsx)(j,{variant:`outline`,onClick:()=>void s(),children:`Retry`})]})}):(0,W.jsx)(L,{route:`automations`,density:`empty`,children:(0,W.jsx)(G,{text:`Loading automations…`})});let p={available:a.available,...a.reason?{reason:a.reason}:{}};return e===`new`?(0,W.jsx)(Gn,{forge:p,timeZone:a.timeZone,onSaved:d}):e===`edit`?f?f.archived?(0,W.jsx)(It,{automation:f,timeZone:a.timeZone,onDeleted:d}):(0,W.jsx)(Gn,{automation:f,forge:p,timeZone:a.timeZone,onSaved:d,onReload:()=>void s().then(()=>l(e=>e+1))},`${f.id}:${c}`):(0,W.jsx)(L,{route:`automations`,density:`empty`,header:{title:`Automation not found`,subtitle:`This automation may have been removed.`},children:(0,W.jsx)(j,{asChild:!0,variant:`outline`,children:(0,W.jsx)(F,{to:`/automations`,children:`Back to automations`})})}):t?(0,W.jsx)(Pt,{automationId:t,automationName:f?.name,timeZone:a.timeZone,readOnly:!!f?.archived}):(0,W.jsx)(G,{text:`Automation not found.`})}export{dr 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{o as r}from"./dist-C_rn70hE.js";import{Rn as i}from"./toaster-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{Rn as i}from"./toaster-C1BFyQ8i.js";import{M as a,Q as o,ct as s,r as c}from"./design-icons-QbNMZniQ.js";import{n as l,r as u}from"./diff-controls-6choyWOW.js";import{t as d}from"./search-x-I9Q8pgUa.js";import{t as f}from"./button-C8jUIs8Q.js";import{t as p}from"./project-router-C53GCY_8.js";import{m}from"./page-shell-Dky5crRl.js";import{t as h}from"./centered-state-BgSV4e79.js";import{Bn as g,Gt as _,Kt as v,Ln as y,ar as b,s as x}from"./index-ChOV2nBM.js";import{t as S}from"./diff-D09l13xg.js";var C=e(t(),1),w=n();function T({commit:e,sha:t,slot:n,heading:o=`h2`,diffRef:c,loadFileText:f,className:p}){let v=m(),[b,x]=(0,C.useState)(`unified`),[T,D]=(0,C.useState)(!0),O=(0,C.useRef)(null);E(O,t);let k=e.isError&&e.error instanceof i&&e.error.status===409;return(0,w.jsx)(`section`,{ref:O,"data-slot":n,"data-sha":t,"aria-label":`Selected commit`,className:r(`min-w-0 flex-1 scroll-mt-4 overflow-clip rounded-xl border border-border bg-card`,p),children:e.isPending?(0,w.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):e.isError?(0,w.jsx)(h,{icon:k?(0,w.jsx)(d,{}):(0,w.jsx)(s,{size:16}),tone:k?`neutral`:`danger`,heading:`h2`,title:k?`Commit not found`:`Could not load commit diff`,subtitle:e.error.message}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{"data-slot":`commit-meta`,className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(o,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:e.data.subject}),(0,w.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(`span`,{children:e.data.author}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{title:e.data.when,children:_(e.data.when)}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(g,{sha:e.data.sha,variant:`inline`}),(0,w.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,w.jsx)(`span`,{"data-slot":`commit-stat`,children:(0,w.jsx)(y,{stat:e.data.stat})})]})]}),(0,w.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,w.jsx)(u,{mode:b,wrap:T,onModeChange:x,onWrapChange:D}),(0,w.jsx)(l,{wrap:T,onWrapChange:D})]})]}),e.data.files.length===0?(0,w.jsx)(h,{icon:(0,w.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,w.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px]`,children:(0,w.jsx)(S,{...c?{viewRef:c}:{},...f?{loadFileText:f}:{},files:e.data.files,mode:v?b:`unified`,wrap:T,totals:!1,className:`min-w-0`},t)})]})})}function E(e,t){let n=(0,C.useRef)(t);(0,C.useLayoutEffect)(()=>{if(n.current===t)return;n.current=``;let r=e.current,i=r?.closest(`[data-slot="main"]`);if(!(!r||!i)&&r.getBoundingClientRect().top<i.getBoundingClientRect().top){let e=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView?.({block:`start`,behavior:e?`auto`:`smooth`})}},[e,t])}function D({commit:e,sha:t,backTo:n,backLabel:r,slot:i,loadFileText:a}){return(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,w.jsx)(`div`,{className:`mx-4 border-b border-border py-2`,children:(0,w.jsx)(f,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,w.jsxs)(p,{to:n,children:[(0,w.jsx)(c,{size:16,"aria-hidden":`true`}),r]})})}),(0,w.jsx)(T,{commit:e,sha:t,slot:i,loadFileText:a,className:`rounded-none border-0 bg-transparent`})]})}var O=56;function k({slot:e,commits:t,selectedSha:n,className:i,heading:a}){let[s,c]=(0,C.useState)(``),l=s.trim().toLowerCase(),u=l?t.filter(e=>e.subject.toLowerCase().includes(l)):t,d=u.length>150,f=(0,C.useRef)(null),p=(0,C.useRef)(null),[m,h]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!d)return;let e=()=>{let e=f.current,t=p.current;!e||!t||h(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d]);let g=u.map(e=>(0,w.jsx)(A,{commit:e,selected:n!==void 0&&e.sha===n},e.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-3 block`,children:[(0,w.jsx)(o,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(b,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:s,onChange:e=>c(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{f.current=e,e&&(p.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":d,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-3 py-1 md:px-4`,i),children:[a?(0,w.jsx)(`div`,{className:`flex min-h-11 flex-wrap items-center gap-2 py-2.5`,children:a}):null,u.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,d?(0,w.jsx)(x,{scrollRef:p,startMargin:m,itemSize:O,children:g}):g]})]})}function A({commit:e,selected:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_56px] [content-visibility:auto]`,children:(0,w.jsxs)(p,{"data-slot":`commit-row`,"data-sha":e.sha,"data-selected":t?`true`:void 0,"aria-current":t?`true`:void 0,to:e.href,className:r(`flex min-h-11 min-w-0 items-start gap-2.5 rounded-md px-2 py-2.5 transition-colors hover:bg-muted`,t&&`bg-muted/70`),children:[(0,w.jsx)(a,{size:16,"aria-hidden":`true`,className:`mt-px size-4 shrink-0 text-accent-text`}),(0,w.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`span`,{"data-slot":`commit-row-subject`,title:e.subject,className:`line-clamp-2 text-[13px] leading-snug font-medium break-words text-foreground`,children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground`,children:[(0,w.jsx)(j,{sha:e.sha}),(0,w.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.author,` · `,(0,w.jsx)(`span`,{title:v(e.when,e.at),children:_(e.when,e.at)})]}),e.stat?(0,w.jsx)(y,{stat:e.stat}):null]})]})]})})}function j({sha:e}){return(0,w.jsx)(g,{"data-slot":`commit-sha`,sha:e,variant:`chip`})}export{T as i,j as n,D as r,k as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-Dy4uLuyP.js";import{n as o,r as s,t as c}from"./image-preview-CeEKI2T5.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-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-DpEo21jl.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/dist-C_rn70hE.js","assets/bundle-mjs-rHxsej31.js","assets/chevron-right-BENZ-1ZN.js","assets/createLucideIcon-BHp8sXmF.js","assets/eye-B8okNWXU.js","assets/diff-stat-Dy4uLuyP.js","assets/index-ChOV2nBM.js","assets/queries-jsRcJKo6.js","assets/toaster-C1BFyQ8i.js","assets/live-protocol-DMhTnCmf.js","assets/preload-helper-Czpn1I53.js","assets/chunk-KS7C4IRE-Cg8l-LDN.js","assets/label-DRXJ8ljY.js","assets/cez-idle-CdswdDRd.js","assets/run-detail-refresh-DYY7EWeq.js","assets/es2015-CUEfzDjB.js","assets/reference-chip-95DURw1q.js","assets/design-icons-QbNMZniQ.js","assets/popover-CvL6hQ5c.js","assets/dist-DudPJH39.js","assets/dist-BuF3mvCA.js","assets/attention-xl4bwNkx.js","assets/task-groups-7p6Gvpg8.js","assets/open-in-menu-CI3ceNjU.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-C8jUIs8Q.js","assets/dropdown-menu-DjtKUK8F.js","assets/dist-BSUJIXeE.js","assets/own-lookup-DS54wXvD.js","assets/check-OP-CVgZG.js","assets/chevron-down-CHGyCDBH.js","assets/nav-row-styles-CgP5uNp4.js","assets/folder-browser-CUUWpb8F.js","assets/loader-circle-CPBhhDbB.js","assets/play-CmVAj_fu.js","assets/search-x-I9Q8pgUa.js","assets/dist--f2yFdPY.js","assets/switch-CAKeV99j.js","assets/dist-Czz3Y5qH.js","assets/badge-B6B-xYQQ.js","assets/dialog-DRZuXvul.js","assets/project-router-C53GCY_8.js","assets/status-dot-BXf-Ubd0.js","assets/report-selection-DAPzf1Aa.js","assets/use-search-params-writer-ClMScnNe.js","assets/page-shell-Dky5crRl.js","assets/page-shell-DQPYcKyL.css","assets/format-BU7D3IfE.js","assets/command-BiBq24zL.js","assets/project-order-AcHI4Dcl.js","assets/skills-pM_PouEs.js","assets/agents-settings-path-7X6_cvUg.js","assets/centered-state-BgSV4e79.js","assets/index-aGnZVJo_.css","assets/highlighter-Cfo7mLVB.js","assets/image-preview-CeEKI2T5.js","assets/zoomable-image-BUTgYpld.js","assets/markdown-BBDDg-4t.js","assets/markdown-C5Y3C4ot.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{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./diff-stat-Dy4uLuyP.js";import{n as o,r as s,t as c}from"./image-preview-CeEKI2T5.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-DpEo21jl.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])),()=>{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{o as t}from"./dist-C_rn70hE.js";import{j as n,nt as r,u as i,v as a}from"./design-icons-QbNMZniQ.js";import{t as o}from"./createLucideIcon-BHp8sXmF.js";import{t as s}from"./button-C8jUIs8Q.js";import{n as c,p as l,r as u,t as d}from"./dropdown-menu-DjtKUK8F.js";import{mr as f}from"./index-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{j as n,nt as r,u as i,v as a}from"./design-icons-QbNMZniQ.js";import{t as o}from"./createLucideIcon-BHp8sXmF.js";import{t as s}from"./button-C8jUIs8Q.js";import{n as c,p as l,r as u,t as d}from"./dropdown-menu-DjtKUK8F.js";import{mr as f}from"./index-ChOV2nBM.js";var p=o(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),m=o(`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`}]]),h=e();function g({mode:e,wrap:t,onModeChange:n,onWrapChange:r,disabled:i=!1}){return(0,h.jsxs)(`span`,{className:`flex items-center gap-1.5 max-md:hidden`,children:[(0,h.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`,children:[(0,h.jsx)(S,{current:e,value:`unified`,onModeChange:n,disabled:i}),(0,h.jsx)(S,{current:e,value:`split`,onModeChange:n,disabled:i})]}),(0,h.jsx)(b,{wrap:t,onWrapChange:r,disabled:i,labelled:!0,className:`h-11 w-auto min-w-11 gap-1.5 rounded-lg px-3 text-xs font-medium`})]})}function _({wrap:e,onWrapChange:t,preview:n=!1,onPreviewChange:a,disabled:o=!1}){return(0,h.jsxs)(d,{children:[(0,h.jsx)(l,{asChild:!0,children:(0,h.jsxs)(s,{variant:`outline`,size:`sm`,"data-slot":`diff-view-menu`,className:`h-11 gap-1.5 rounded-lg px-3 text-xs font-medium md:hidden`,children:[(0,h.jsx)(r,{size:16,"aria-hidden":`true`,className:`size-4`}),`View`,(0,h.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`})]})}),(0,h.jsxs)(u,{align:`end`,"data-slot":`diff-view-menu-content`,children:[(0,h.jsx)(c,{"data-slot":`diff-view-wrap`,className:`min-h-11`,checked:e,disabled:o,onCheckedChange:e=>t(e===!0),children:`Wrap long lines`}),a?(0,h.jsx)(c,{"data-slot":`diff-view-preview`,className:`min-h-11`,checked:n,onCheckedChange:e=>a(e===!0),children:`Preview Markdown`}):null]})]})}var v=`Unavailable while Markdown preview is on`;function y(){return(0,h.jsx)(`span`,{"data-slot":`markdown-preview-hint`,role:`status`,className:`text-xs text-muted-foreground max-sm:sr-only`,children:`Full-document preview — layout and wrap are off`})}function b({wrap:e,onWrapChange:n,className:r=`size-11 rounded-lg`,disabled:i=!1,labelled:a=!1}){return(0,h.jsxs)(s,{variant:`outline`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":e,"aria-label":`Wrap long lines`,title:i?v:`Wrap long lines`,disabled:i,className:t(r,e?`border-accent-text/40 bg-muted text-accent-text`:`text-muted-foreground hover:text-foreground`),onClick:()=>n(!e),children:[(0,h.jsx)(m,{"aria-hidden":`true`}),a?(0,h.jsx)(`span`,{"aria-hidden":`true`,children:`Wrap`}):null]})}function x({preview:e,onPreviewChange:n}){return(0,h.jsxs)(s,{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,h.jsx)(f,{"aria-hidden":`true`,className:`size-4`}),(0,h.jsx)(`span`,{"aria-hidden":`true`,className:`max-sm:hidden`,children:`Preview MD`})]})}function S({current:e,value:n,onModeChange:r,disabled:i}){let o=e===n;return(0,h.jsxs)(`button`,{type:`button`,"data-mode":n,"aria-pressed":o,disabled:i,title:i?v:void 0,onClick:()=>r(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 disabled:opacity-50`,o?`bg-muted text-foreground`:`text-muted-foreground pointer-hover:text-foreground`),children:[n===`unified`?(0,h.jsx)(p,{"aria-hidden":`true`,className:`size-4`}):(0,h.jsx)(a,{size:16,"aria-hidden":`true`,className:`size-4`}),n]})}function C({branch:e}){return(0,h.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,h.jsx)(n,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:e})]})}export{x as a,y as i,_ as n,b as o,g as r,C 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{o as r}from"./dist-C_rn70hE.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-Dy4uLuyP.js";import{s}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{t as i}from"./chevron-right-BENZ-1ZN.js";import{t as a}from"./eye-B8okNWXU.js";import{t as o}from"./diff-stat-Dy4uLuyP.js";import{s}from"./index-ChOV2nBM.js";import{a as c,i as l,r as u}from"./highlighter-Cfo7mLVB.js";import{n as d,r as f,t as p}from"./image-preview-CeEKI2T5.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";import{t as g}from"./markdown-C5Y3C4ot.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(`
|
package/web/dist/assets/{discard-changes-dialog-aAzdjye-.js → discard-changes-dialog-CV4M8057.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{$t as t,Jt as n,Qt as r,Xt as i,Yt as a,Zt as o,en as s,tn as c}from"./index-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{$t as t,Jt as n,Qt as r,Xt as i,Yt as a,Zt as o,en as s,tn as c}from"./index-ChOV2nBM.js";var l=e();function u({open:e,subject:u,onKeep:d,onDiscard:f}){return(0,l.jsx)(n,{open:e,onOpenChange:e=>!e&&d(),children:(0,l.jsxs)(o,{"data-slot":`discard-changes-dialog`,className:`sm:max-w-[560px]`,children:[(0,l.jsxs)(s,{children:[(0,l.jsx)(c,{children:`Discard unsaved changes?`}),(0,l.jsxs)(r,{children:[`Your edits to `,(0,l.jsx)(`span`,{className:`font-medium text-foreground`,children:u}),` are not saved. They are lost if you continue.`]})]}),(0,l.jsxs)(t,{children:[(0,l.jsx)(i,{"data-slot":`discard-changes-keep`,children:`Keep editing`}),(0,l.jsx)(a,{"data-slot":`discard-changes-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:f,children:`Discard changes`})]})]})})}export{u as t};
|
|
@@ -1,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{o as r}from"./dist-C_rn70hE.js";import{$ as i}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{$ as i}from"./queries-jsRcJKo6.js";import{Gt as a,Rn as o}from"./toaster-C1BFyQ8i.js";import{f as s,p as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{T as l,ct as u}from"./design-icons-QbNMZniQ.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{o as f}from"./diff-controls-6choyWOW.js";import{t as p}from"./centered-state-BgSV4e79.js";import{a as m,i as h,r as g}from"./highlighter-Cfo7mLVB.js";import{n as _,t as v}from"./markdown-C5Y3C4ot.js";import{r as y}from"./html-report-BX3msvci.js";import{t as b}from"./html-report-frame-Ck76gKfA.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)(l,{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 o&&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)(u,{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:o,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:o??a(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};
|