@qodeca/xezar 0.11.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -18
- package/dist/core/provider-auth.js +23 -1
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/runs/task-refs.d.ts +8 -1
- package/dist/runs/task-refs.js +45 -10
- package/dist/runs/task-refs.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{compare-variants-Cp3Thwv2.js → compare-variants-et0mplGi.js} +1 -1
- package/web/dist/assets/{git-toolbar-BAZPUijR.js → git-toolbar-Q2kk2F7v.js} +1 -1
- package/web/dist/assets/{github-BBVKH-CW.js → github-DjEYCxwt.js} +1 -1
- package/web/dist/assets/index-Cz4GSAqV.js +7 -0
- package/web/dist/assets/{repo-git-C0lQ9_O3.js → repo-git-h1RFfly3.js} +1 -1
- package/web/dist/assets/{skills-BfcNlZEY.js → skills-BqAzyGS3.js} +1 -1
- package/web/dist/assets/{task-changes-DHpe4ZuJ.js → task-changes-DwXPFXqG.js} +1 -1
- package/web/dist/assets/{task-commits-DUWVyp0I.js → task-commits-Bessua-c.js} +1 -1
- package/web/dist/assets/{task-files-Do3S40OR.js → task-files-DxFIhRPP.js} +1 -1
- package/web/dist/assets/{task-thread-Bfyqqy-t.js → task-thread-Dhkupf1-.js} +1 -1
- package/web/dist/assets/thread-loading-ZhJref0J.js +1 -0
- package/web/dist/assets/{use-desktop-Cec0eUGX.js → use-desktop-Sr1QlxhT.js} +1 -1
- package/web/dist/assets/{workflows-CJ1FV1hP.js → workflows-9HC240Wx.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-GflrFgEB.js +0 -7
- package/web/dist/assets/thread-loading-GyH2Atwo.js +0 -1
|
@@ -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{A as r,Ct as i,G as a,Ln as o,St as s,Ur as c,Vr as l,Z as u,a as d,fr as f,i as p,j as m,qr as h,t as g,wn as _,xt as v}from"./centered-state-B_V_Ai2h.js";import{n as y,t as b}from"./utils-Bb8ohcr3.js";import{t as x}from"./arrow-left-BJsIW6A0.js";import{y as S}from"./dropdown-menu-Z80KMInL.js";import{i as C,n as w,r as T,t as E}from"./use-desktop-Cec0eUGX.js";import{t as D}from"./search-x-69n_672Y.js";import{t as O}from"./triangle-alert-D5tJwRD2.js";import{t as k}from"./project-router-BbCzrHKs.js";import{t as A}from"./diff-stat-btAmKFJr.js";import{S as j,a as M,g as N,x as P,y as F}from"./index-GflrFgEB.js";import{t as I}from"./diff-CbozNUJq.js";import{t as L}from"./tab-link-Cp2-CJS8.js";import{i as R,r as z,t as B}from"./git-toolbar-BAZPUijR.js";import{t as V}from"./commit-list-C4Dv6vUL.js";var H=e(t(),1),U=n();function W({repo:e,info:t}){let n=u(),i=h(),a=e=>p(e.message,{tone:`danger`}),s=c({mutationFn:e=>o({name:e}),onSuccess:async e=>{p(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([i.invalidateQueries({queryKey:m.repo}),i.invalidateQueries({queryKey:m.health})]),i.setQueryData(m.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),i.setQueryData(m.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:a}),l=c({mutationFn:e=>f({baseBranch:e}),onSuccess:e=>{p(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),i.invalidateQueries({queryKey:m.repo})},onError:a}),[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(``),x=v.trim().toLowerCase(),S=x?e.branches.filter(e=>e.toLowerCase().includes(x)):e.branches;return(0,U.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Branches`}),(0,U.jsx)(N,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:v,onChange:e=>y(e.target.value),className:`mt-2 max-w-xl`}),(0,U.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[S.map(e=>{let n=e===t.branch;return(0,U.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,U.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:b(`min-w-0 truncate font-mono text-xs`,n&&`font-semibold`),children:e}),n?(0,U.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:[(0,U.jsx)(r,{"aria-hidden":`true`,className:`size-3`}),`current`]}):(0,U.jsx)(d,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:s.isPending,onClick:()=>s.mutate(e),children:`Switch`})]},e)}),S.length===0?(0,U.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,v.trim(),`”.`]}):null]}),(0,U.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=g.trim();t&&s.mutate(t,{onSuccess:()=>_(``)})},children:[(0,U.jsx)(N,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:g,onChange:e=>_(e.target.value)}),(0,U.jsxs)(d,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!g.trim()||s.isPending,children:[(0,U.jsx)(F,{"aria-hidden":`true`}),`Create`]})]})]}),(0,U.jsxs)(`div`,{className:`max-w-md`,children:[(0,U.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Agents’ base branch`}),(0,U.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:l.isPending,onChange:e=>l.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,U.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n.data?.forge?.available?(0,U.jsx)(G,{}):null]})}function G(){let e=a({limit:20});return(0,U.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,U.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,U.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,U.jsx)(K,{pr:e},e.number))}):(0,U.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function K({pr:e}){let t=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,U.jsx)(q,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,U.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:y(e.url)?(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:b(n,`hover:bg-muted`),children:t}):(0,U.jsx)(`span`,{className:n,children:t})})}function q({checks:e}){return(0,U.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:b(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function J(){let e=s(),t=E(),[n,r]=(0,H.useState)(`unified`),[i,a]=(0,H.useState)(!1),[o,c]=(0,H.useState)(null),l=(0,H.useRef)(null),u=e.isError&&e.error instanceof _&&e.error.status===409,d=e.data?.files??[],f=(0,H.useMemo)(()=>z(d),[d]),p=t?n:`unified`,m=!t||i;return(0,U.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,U.jsx)(B,{stat:e.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(T,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,U.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,U.jsx)(g,{icon:u?(0,U.jsx)(j,{}):(0,U.jsx)(O,{}),tone:u?`neutral`:`danger`,heading:`h2`,title:u?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):d.length===0?(0,U.jsx)(g,{icon:(0,U.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:[(0,U.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`sticky top-28 hidden max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] w-60 shrink-0 overflow-y-auto overscroll-contain md:block lg:w-72`,children:(0,U.jsx)(R,{root:f,selected:o,onSelect:e=>{c(e),l.current?.scrollToPath(e)}})}),(0,U.jsx)(I,{files:d,viewRef:l,mode:p,wrap:m,className:`min-w-0 flex-1`})]})]})}function Y({log:e}){let{sha:t}=l();return t?(0,U.jsx)(X,{sha:t}):e.length===0?(0,U.jsx)(g,{icon:(0,U.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,U.jsx)(V,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})}function X({sha:e}){let t=i(e),n=E(),[r,a]=(0,H.useState)(`unified`),[o,s]=(0,H.useState)(!1),c=t.isError&&t.error instanceof _&&t.error.status===409,l=n?r:`unified`,u=!n||o;return(0,U.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,U.jsxs)(k,{to:`/git/commits`,children:[(0,U.jsx)(x,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,U.jsx)(A,{stat:t.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(T,{mode:r,wrap:o,onModeChange:a,onWrapChange:s})})]}),t.isPending?(0,U.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,U.jsx)(g,{icon:c?(0,U.jsx)(D,{}):(0,U.jsx)(O,{}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,U.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,U.jsx)(g,{icon:(0,U.jsx)(C,{}),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,U.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,U.jsx)(I,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function Z({tab:e}){let t=v();if(t.isPending)return(0,U.jsx)(M,{});if(t.isError)return(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(g,{icon:(0,U.jsx)(O,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,U.jsx)(Q,{repo:t.data,info:n,tab:e}):(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(g,{icon:(0,U.jsx)(P,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`xezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Q({repo:e,info:t,tab:n}){return(0,U.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,U.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,U.jsx)(w,{branch:t.branch}),t.remote?(0,U.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-[11px] text-soft-foreground md:inline`,children:t.remote}):null]}),(0,U.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,U.jsx)(L,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,U.jsx)(L,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,U.jsx)(L,{to:`/git/branches`,active:n===`branches`,children:`Branches`})]})]}),n===`changes`?(0,U.jsx)(J,{}):n===`commits`?(0,U.jsx)(Y,{log:e.log}):(0,U.jsx)(W,{repo:e,info:t})]})}export{Z as RepoGitRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Ct as i,G as a,Ln as o,St as s,Ur as c,Vr as l,Z as u,a as d,fr as f,i as p,j as m,qr as h,t as g,wn as _,xt as v}from"./centered-state-B_V_Ai2h.js";import{n as y,t as b}from"./utils-Bb8ohcr3.js";import{t as x}from"./arrow-left-BJsIW6A0.js";import{y as S}from"./dropdown-menu-Z80KMInL.js";import{i as C,n as w,r as T,t as E}from"./use-desktop-Sr1QlxhT.js";import{t as D}from"./search-x-69n_672Y.js";import{t as O}from"./triangle-alert-D5tJwRD2.js";import{t as k}from"./project-router-BbCzrHKs.js";import{t as A}from"./diff-stat-btAmKFJr.js";import{S as j,a as M,g as N,x as P,y as F}from"./index-Cz4GSAqV.js";import{t as I}from"./diff-CbozNUJq.js";import{t as L}from"./tab-link-Cp2-CJS8.js";import{i as R,r as z,t as B}from"./git-toolbar-Q2kk2F7v.js";import{t as V}from"./commit-list-C4Dv6vUL.js";var H=e(t(),1),U=n();function W({repo:e,info:t}){let n=u(),i=h(),a=e=>p(e.message,{tone:`danger`}),s=c({mutationFn:e=>o({name:e}),onSuccess:async e=>{p(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([i.invalidateQueries({queryKey:m.repo}),i.invalidateQueries({queryKey:m.health})]),i.setQueryData(m.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),i.setQueryData(m.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:a}),l=c({mutationFn:e=>f({baseBranch:e}),onSuccess:e=>{p(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),i.invalidateQueries({queryKey:m.repo})},onError:a}),[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(``),x=v.trim().toLowerCase(),S=x?e.branches.filter(e=>e.toLowerCase().includes(x)):e.branches;return(0,U.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Branches`}),(0,U.jsx)(N,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:v,onChange:e=>y(e.target.value),className:`mt-2 max-w-xl`}),(0,U.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[S.map(e=>{let n=e===t.branch;return(0,U.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,U.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:b(`min-w-0 truncate font-mono text-xs`,n&&`font-semibold`),children:e}),n?(0,U.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:[(0,U.jsx)(r,{"aria-hidden":`true`,className:`size-3`}),`current`]}):(0,U.jsx)(d,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:s.isPending,onClick:()=>s.mutate(e),children:`Switch`})]},e)}),S.length===0?(0,U.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,v.trim(),`”.`]}):null]}),(0,U.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=g.trim();t&&s.mutate(t,{onSuccess:()=>_(``)})},children:[(0,U.jsx)(N,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:g,onChange:e=>_(e.target.value)}),(0,U.jsxs)(d,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!g.trim()||s.isPending,children:[(0,U.jsx)(F,{"aria-hidden":`true`}),`Create`]})]})]}),(0,U.jsxs)(`div`,{className:`max-w-md`,children:[(0,U.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Agents’ base branch`}),(0,U.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:l.isPending,onChange:e=>l.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,U.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,U.jsx)(`option`,{value:e,children:e},e))]}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n.data?.forge?.available?(0,U.jsx)(G,{}):null]})}function G(){let e=a({limit:20});return(0,U.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,U.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,U.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,U.jsx)(K,{pr:e},e.number))}):(0,U.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function K({pr:e}){let t=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,U.jsx)(q,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,U.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:y(e.url)?(0,U.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:b(n,`hover:bg-muted`),children:t}):(0,U.jsx)(`span`,{className:n,children:t})})}function q({checks:e}){return(0,U.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:b(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function J(){let e=s(),t=E(),[n,r]=(0,H.useState)(`unified`),[i,a]=(0,H.useState)(!1),[o,c]=(0,H.useState)(null),l=(0,H.useRef)(null),u=e.isError&&e.error instanceof _&&e.error.status===409,d=e.data?.files??[],f=(0,H.useMemo)(()=>z(d),[d]),p=t?n:`unified`,m=!t||i;return(0,U.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,U.jsx)(B,{stat:e.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(T,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]}),e.isPending?(0,U.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,U.jsx)(g,{icon:u?(0,U.jsx)(j,{}):(0,U.jsx)(O,{}),tone:u?`neutral`:`danger`,heading:`h2`,title:u?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):d.length===0?(0,U.jsx)(g,{icon:(0,U.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:[(0,U.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`sticky top-28 hidden max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] w-60 shrink-0 overflow-y-auto overscroll-contain md:block lg:w-72`,children:(0,U.jsx)(R,{root:f,selected:o,onSelect:e=>{c(e),l.current?.scrollToPath(e)}})}),(0,U.jsx)(I,{files:d,viewRef:l,mode:p,wrap:m,className:`min-w-0 flex-1`})]})]})}function Y({log:e}){let{sha:t}=l();return t?(0,U.jsx)(X,{sha:t}):e.length===0?(0,U.jsx)(g,{icon:(0,U.jsx)(C,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,U.jsx)(V,{slot:`repo-commits`,commits:e.map(e=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`}))})}function X({sha:e}){let t=i(e),n=E(),[r,a]=(0,H.useState)(`unified`),[o,s]=(0,H.useState)(!1),c=t.isError&&t.error instanceof _&&t.error.status===409,l=n?r:`unified`,u=!n||o;return(0,U.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,U.jsx)(d,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,U.jsxs)(k,{to:`/git/commits`,children:[(0,U.jsx)(x,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,U.jsx)(A,{stat:t.data.stat}):null,(0,U.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,U.jsx)(T,{mode:r,wrap:o,onModeChange:a,onWrapChange:s})})]}),t.isPending?(0,U.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,U.jsx)(g,{icon:c?(0,U.jsx)(D,{}):(0,U.jsx)(O,{}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,U.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,U.jsx)(g,{icon:(0,U.jsx)(C,{}),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,U.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,U.jsx)(I,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function Z({tab:e}){let t=v();if(t.isPending)return(0,U.jsx)(M,{});if(t.isError)return(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(g,{icon:(0,U.jsx)(O,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,U.jsx)(Q,{repo:t.data,info:n,tab:e}):(0,U.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(g,{icon:(0,U.jsx)(P,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`xezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Q({repo:e,info:t,tab:n}){return(0,U.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,U.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,U.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,U.jsx)(w,{branch:t.branch}),t.remote?(0,U.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-[11px] text-soft-foreground md:inline`,children:t.remote}):null]}),(0,U.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,U.jsx)(L,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,U.jsx)(L,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,U.jsx)(L,{to:`/git/branches`,active:n===`branches`,children:`Branches`})]})]}),n===`changes`?(0,U.jsx)(J,{}):n===`commits`?(0,U.jsx)(Y,{log:e.log}):(0,U.jsx)(W,{repo:e,info:t})]})}export{Z as RepoGitRoute};
|
|
@@ -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{$ as r,Cn as i,Hr as a,Jt as o,Kt as s,Mn as c,Rn as l,Rt as u,Tn as d,Ur as f,Wt as p,_r as m,a as h,hr as g,i as _,j as v,qr as y,t as b,ut as x,zt as S}from"./centered-state-B_V_Ai2h.js";import{t as C}from"./utils-Bb8ohcr3.js";import{t as w}from"./arrow-left-BJsIW6A0.js";import{S as T,f as E,v as D}from"./new-task-form-BydHBbef.js";import{r as O,t as k}from"./skill-empty-hint-CL0g7WBL.js";import{t as A}from"./refresh-cw-DGliez3E.js";import{t as j}from"./sparkles-B8agSxBZ.js";import{t as M}from"./triangle-alert-D5tJwRD2.js";import{a as N,c as P,l as F,o as I,r as L,s as R}from"./use-submit-shortcut-JY8M_MPL.js";import{c as z,t as B}from"./project-router-BbCzrHKs.js";import{i as V,n as H,o as U,p as W}from"./skills-D4P-Hgey.js";import{c as G,g as K,o as q,t as ee}from"./index-GflrFgEB.js";var J=e(t(),1),Y=n(),te=`https://github.com/open-mercato/skills`;function ne(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return ne(e)??[...t]}function re({projectId:e}){let t=y(),n=s(),i=r(),[a,c]=(0,J.useState)(``),l=S(e,!!e),u=i.data??[],d=(0,J.useMemo)(()=>u.map(e=>e.name),[u]),f=(0,J.useRef)([]);f.current=d;let p=(0,J.useMemo)(()=>new Set(X(n.data,d)),[n.data,d]),m=(0,J.useRef)(Promise.resolve()),h=(0,J.useRef)(0),x=(0,J.useCallback)(e=>{let n=o.uiState,r=t.getQueryData(n),i=e(X(r,f.current));t.setQueryData(n,{...r,importedSkills:i});let a=++h.current;m.current=m.current.then(async()=>{try{let e=await g({importedSkills:i});a===h.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:v.skills}))}catch(e){_(e instanceof Error?e.message:String(e),{tone:`danger`}),a===h.current&&t.invalidateQueries({queryKey:n})}})},[t]),w=(0,J.useCallback)(e=>{x(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[x]),T=d.length>0&&d.every(e=>p.has(e)),E=(0,J.useCallback)(()=>{if(T){let e=new Set(f.current);x(t=>t.filter(t=>!e.has(t)))}else x(e=>[...new Set([...e,...f.current])])},[T,x]);if(i.isError)return(0,Y.jsx)(b,{icon:(0,Y.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:i.error.message});let D=a.trim().toLowerCase(),O=D?u.filter(e=>e.name.toLowerCase().includes(D)||(e.description??``).toLowerCase().includes(D)):u;return(0,Y.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Manage skills`}),(0,Y.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Reusable, technology-agnostic agent skills from`,` `,(0,Y.jsx)(`a`,{href:te,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`open-mercato/skills`}),` `,`— PR creation, code review, CI stabilisation, spec writing and more. They're all in your catalog and the composer picker by default; uncheck any you don't want.`]}),(0,Y.jsx)(ie,{projectId:e,state:l.data,loadError:l.error}),(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`These checkboxes choose what xezar shows; updates refresh installed skill files.`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,Y.jsx)(K,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:a,onChange:e=>c(e.target.value),className:`h-8 text-[13px]`}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`import-all`,disabled:d.length===0||n.isPending,onClick:E,className:`h-8 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:T?`Remove all`:`Enable all`})]}),(0,Y.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:i.isPending?(0,Y.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):O.length>0?O.map(e=>{let t=p.has(e.name);return(0,Y.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:C(`flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,Y.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>w(e.name),className:`mt-0.5 size-3.5 shrink-0`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),e.description?(0,Y.jsx)(`span`,{className:`mt-0.5 block pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,Y.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:u.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ie({projectId:e,state:t,loadError:n}){let r=y(),i=z(),a=(0,J.useRef)(0),[s,u]=(0,J.useState)(!1),p=f({mutationFn:()=>l({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{u(!1),i(E(e))},onError:e=>_(e.message,{tone:`danger`})}),m=(t,n)=>{n.seq===a.current&&(r.setQueryData(o.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:v.skills}),_(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),u(!0)))},g=(e,t)=>{t.seq===a.current&&_(e.message,{tone:`danger`})},b=f({mutationFn:t=>c(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>g(e,t)}),x=f({mutationFn:t=>d(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>g(e,t)}),S=e=>{let n=++a.current;e===`apply`?x.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):b.mutate({action:e,seq:n})},w=t?.scopes.some(e=>e.skills.length>0)??!1,D=t?.status===`error`,O=w&&(t?.available||D),k=x.isPending||t?.status===`updating`,j=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],M=t?.scopes.filter(e=>e.updatedAt&&!j.includes(e))??[],B=`Checking installed Open Mercato skills…`;return n?B=`Update status is unavailable right now.`:t?.status===`available`?B=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?B=`Updating installed Open Mercato skills…`:t?.status===`current`?B=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?B=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(B=`The update did not finish for every installation.`),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,Y.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,Y.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,j.length>0?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,j.map(e=>Z(e.scope)).join(`, `),M.length?`; updated: ${M.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),O?(0,Y.jsxs)(h,{"data-action":`skills-update-apply`,size:`sm`,disabled:k,onClick:()=>S(`apply`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`,className:C(`size-3.5`,k&&`motion-safe:animate-spin`)}),k?`Updating…`:D?`Retry`:`Update now`]}):t?.status===`current`?(0,Y.jsx)(h,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:b.isPending,onClick:()=>S(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,Y.jsx)(h,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:b.isPending,onClick:()=>S(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,Y.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,Y.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,Y.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,Y.jsx)(T,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,Y.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,Y.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,Y.jsx)(L,{open:s,onOpenChange:e=>p.isPending?void 0:u(e),children:(0,Y.jsxs)(N,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{children:`Apply the upgrade notes now?`}),(0,Y.jsxs)(I,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,Y.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,Y.jsxs)(R,{children:[(0,Y.jsx)(h,{type:`button`,variant:`outline`,disabled:p.isPending,onClick:()=>u(!1),children:`No`}),(0,Y.jsx)(h,{type:`button`,disabled:p.isPending,onClick:()=>p.mutate(),children:p.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function ae(){return(0,Y.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,Y.jsx)(oe,{})]})}function oe(){let e=u(),t=p(),n=r(),[o]=a(),[s,c]=(0,J.useState)(``),l=y(),d=x(),h=i().projectId??d.data?.bootProject??``,g=f({mutationFn:()=>m(),onSuccess:e=>{l.setQueryData(v.skills,e),_(`Team skills refreshed.`)},onError:e=>_(e.message,{tone:`danger`})});if(e.isError)return(0,Y.jsx)(b,{icon:(0,Y.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let S=U(e.data??[]),T=(n.data?.length??0)>0,E=o.get(`skill`),N=E===Q||E===$||E!==null&&S.some(e=>e.name===E)?E:S[0]?.name??(T?$:Q),P=S.find(e=>e.name===N)??null,F=H(S,s);return(0,Y.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,Y.jsxs)(`section`,{"data-slot":`skills-list`,className:C(`w-full flex-col border-border md:flex md:w-[320px] md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,E===null?`flex`:`hidden md:flex`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,Y.jsx)(K,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:s,onChange:e=>c(e.target.value),className:`h-8 text-[13px]`}),(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:g.isPending,onClick:()=>g.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,Y.jsx)(A,{"aria-hidden":`true`,className:C(`size-3`,g.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Y.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,children:e.isPending?(0,Y.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):F.length>0?F.map(e=>(0,Y.jsx)(se,{skill:e,active:N===e.name},e.path)):(0,Y.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:S.length>0?`(no skills match)`:(0,Y.jsx)(k,{})})}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-border p-2`,children:[T?(0,Y.jsxs)(B,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":N===$?`page`:void 0,className:C(`mb-1 flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===$&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Manage skills`}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`open-mercato`})]}),(0,Y.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`Choose which open-mercato skills appear in your catalog.`})]}):null,(0,Y.jsxs)(B,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":N===Q?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===Q&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(D,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Run from GitHub`}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`bookmarklets`})]}),(0,Y.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`One-click skill launch from any GitHub PR or issue.`})]})]})]}),(0,Y.jsx)(`section`,{"data-slot":`skills-detail`,className:C(`min-w-0 flex-1 flex-col`,E===null?`hidden md:flex`:`flex`),children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsxs)(B,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),N===$?(0,Y.jsx)(re,{projectId:h}):N===Q?(0,Y.jsx)(ee,{skills:S}):P?(0,Y.jsx)(q,{skill:P,usedBy:W(t.data?.workflows??[],P.name)}):e.isPending?null:(0,Y.jsx)(b,{icon:(0,Y.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})}function se({skill:e,active:t}){let n=V(e);return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(B,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":n?`true`:void 0,"aria-current":t?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(j,{"aria-hidden":`true`,className:C(`size-3.5 shrink-0`,n?`text-violet`:`text-soft-foreground`)}),(0,Y.jsx)(`span`,{className:C(`min-w-0 truncate font-mono text-[13px]`,n?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Y.jsx)(G,{source:e.source,className:`ml-auto`})]}),e.description?(0,Y.jsx)(`span`,{className:`line-clamp-2 pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})})}export{ae as SkillsRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,Cn as i,Hr as a,Jt as o,Kt as s,Mn as c,Rn as l,Rt as u,Tn as d,Ur as f,Wt as p,_r as m,a as h,hr as g,i as _,j as v,qr as y,t as b,ut as x,zt as S}from"./centered-state-B_V_Ai2h.js";import{t as C}from"./utils-Bb8ohcr3.js";import{t as w}from"./arrow-left-BJsIW6A0.js";import{S as T,f as E,v as D}from"./new-task-form-BydHBbef.js";import{r as O,t as k}from"./skill-empty-hint-CL0g7WBL.js";import{t as A}from"./refresh-cw-DGliez3E.js";import{t as j}from"./sparkles-B8agSxBZ.js";import{t as M}from"./triangle-alert-D5tJwRD2.js";import{a as N,c as P,l as F,o as I,r as L,s as R}from"./use-submit-shortcut-JY8M_MPL.js";import{c as z,t as B}from"./project-router-BbCzrHKs.js";import{i as V,n as H,o as U,p as W}from"./skills-D4P-Hgey.js";import{c as G,g as K,o as q,t as ee}from"./index-Cz4GSAqV.js";var J=e(t(),1),Y=n(),te=`https://github.com/open-mercato/skills`;function ne(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return ne(e)??[...t]}function re({projectId:e}){let t=y(),n=s(),i=r(),[a,c]=(0,J.useState)(``),l=S(e,!!e),u=i.data??[],d=(0,J.useMemo)(()=>u.map(e=>e.name),[u]),f=(0,J.useRef)([]);f.current=d;let p=(0,J.useMemo)(()=>new Set(X(n.data,d)),[n.data,d]),m=(0,J.useRef)(Promise.resolve()),h=(0,J.useRef)(0),x=(0,J.useCallback)(e=>{let n=o.uiState,r=t.getQueryData(n),i=e(X(r,f.current));t.setQueryData(n,{...r,importedSkills:i});let a=++h.current;m.current=m.current.then(async()=>{try{let e=await g({importedSkills:i});a===h.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:v.skills}))}catch(e){_(e instanceof Error?e.message:String(e),{tone:`danger`}),a===h.current&&t.invalidateQueries({queryKey:n})}})},[t]),w=(0,J.useCallback)(e=>{x(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[x]),T=d.length>0&&d.every(e=>p.has(e)),E=(0,J.useCallback)(()=>{if(T){let e=new Set(f.current);x(t=>t.filter(t=>!e.has(t)))}else x(e=>[...new Set([...e,...f.current])])},[T,x]);if(i.isError)return(0,Y.jsx)(b,{icon:(0,Y.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:i.error.message});let D=a.trim().toLowerCase(),O=D?u.filter(e=>e.name.toLowerCase().includes(D)||(e.description??``).toLowerCase().includes(D)):u;return(0,Y.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Manage skills`}),(0,Y.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Reusable, technology-agnostic agent skills from`,` `,(0,Y.jsx)(`a`,{href:te,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`open-mercato/skills`}),` `,`— PR creation, code review, CI stabilisation, spec writing and more. They're all in your catalog and the composer picker by default; uncheck any you don't want.`]}),(0,Y.jsx)(ie,{projectId:e,state:l.data,loadError:l.error}),(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`These checkboxes choose what xezar shows; updates refresh installed skill files.`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,Y.jsx)(K,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:a,onChange:e=>c(e.target.value),className:`h-8 text-[13px]`}),(0,Y.jsx)(`button`,{type:`button`,"data-slot":`import-all`,disabled:d.length===0||n.isPending,onClick:E,className:`h-8 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:T?`Remove all`:`Enable all`})]}),(0,Y.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:i.isPending?(0,Y.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):O.length>0?O.map(e=>{let t=p.has(e.name);return(0,Y.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:C(`flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,Y.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>w(e.name),className:`mt-0.5 size-3.5 shrink-0`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),e.description?(0,Y.jsx)(`span`,{className:`mt-0.5 block pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,Y.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:u.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ie({projectId:e,state:t,loadError:n}){let r=y(),i=z(),a=(0,J.useRef)(0),[s,u]=(0,J.useState)(!1),p=f({mutationFn:()=>l({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{u(!1),i(E(e))},onError:e=>_(e.message,{tone:`danger`})}),m=(t,n)=>{n.seq===a.current&&(r.setQueryData(o.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:v.skills}),_(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),u(!0)))},g=(e,t)=>{t.seq===a.current&&_(e.message,{tone:`danger`})},b=f({mutationFn:t=>c(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>g(e,t)}),x=f({mutationFn:t=>d(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>g(e,t)}),S=e=>{let n=++a.current;e===`apply`?x.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):b.mutate({action:e,seq:n})},w=t?.scopes.some(e=>e.skills.length>0)??!1,D=t?.status===`error`,O=w&&(t?.available||D),k=x.isPending||t?.status===`updating`,j=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],M=t?.scopes.filter(e=>e.updatedAt&&!j.includes(e))??[],B=`Checking installed Open Mercato skills…`;return n?B=`Update status is unavailable right now.`:t?.status===`available`?B=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?B=`Updating installed Open Mercato skills…`:t?.status===`current`?B=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?B=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(B=`The update did not finish for every installation.`),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,Y.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,Y.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,j.length>0?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,j.map(e=>Z(e.scope)).join(`, `),M.length?`; updated: ${M.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),O?(0,Y.jsxs)(h,{"data-action":`skills-update-apply`,size:`sm`,disabled:k,onClick:()=>S(`apply`),children:[(0,Y.jsx)(A,{"aria-hidden":`true`,className:C(`size-3.5`,k&&`motion-safe:animate-spin`)}),k?`Updating…`:D?`Retry`:`Update now`]}):t?.status===`current`?(0,Y.jsx)(h,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:b.isPending,onClick:()=>S(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,Y.jsx)(h,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:b.isPending,onClick:()=>S(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,Y.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,Y.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,Y.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,Y.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,Y.jsx)(T,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,Y.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,Y.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,Y.jsx)(L,{open:s,onOpenChange:e=>p.isPending?void 0:u(e),children:(0,Y.jsxs)(N,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{children:`Apply the upgrade notes now?`}),(0,Y.jsxs)(I,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,Y.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,Y.jsxs)(R,{children:[(0,Y.jsx)(h,{type:`button`,variant:`outline`,disabled:p.isPending,onClick:()=>u(!1),children:`No`}),(0,Y.jsx)(h,{type:`button`,disabled:p.isPending,onClick:()=>p.mutate(),children:p.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function ae(){return(0,Y.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,Y.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,Y.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,Y.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,Y.jsx)(oe,{})]})}function oe(){let e=u(),t=p(),n=r(),[o]=a(),[s,c]=(0,J.useState)(``),l=y(),d=x(),h=i().projectId??d.data?.bootProject??``,g=f({mutationFn:()=>m(),onSuccess:e=>{l.setQueryData(v.skills,e),_(`Team skills refreshed.`)},onError:e=>_(e.message,{tone:`danger`})});if(e.isError)return(0,Y.jsx)(b,{icon:(0,Y.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let S=U(e.data??[]),T=(n.data?.length??0)>0,E=o.get(`skill`),N=E===Q||E===$||E!==null&&S.some(e=>e.name===E)?E:S[0]?.name??(T?$:Q),P=S.find(e=>e.name===N)??null,F=H(S,s);return(0,Y.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,Y.jsxs)(`section`,{"data-slot":`skills-list`,className:C(`w-full flex-col border-border md:flex md:w-[320px] md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,E===null?`flex`:`hidden md:flex`),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,Y.jsx)(K,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:s,onChange:e=>c(e.target.value),className:`h-8 text-[13px]`}),(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:g.isPending,onClick:()=>g.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,Y.jsx)(A,{"aria-hidden":`true`,className:C(`size-3`,g.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Y.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,children:e.isPending?(0,Y.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):F.length>0?F.map(e=>(0,Y.jsx)(se,{skill:e,active:N===e.name},e.path)):(0,Y.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:S.length>0?`(no skills match)`:(0,Y.jsx)(k,{})})}),(0,Y.jsxs)(`div`,{className:`shrink-0 border-t border-border p-2`,children:[T?(0,Y.jsxs)(B,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":N===$?`page`:void 0,className:C(`mb-1 flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===$&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Manage skills`}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`open-mercato`})]}),(0,Y.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`Choose which open-mercato skills appear in your catalog.`})]}):null,(0,Y.jsxs)(B,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":N===Q?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===Q&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(D,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Run from GitHub`}),(0,Y.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`bookmarklets`})]}),(0,Y.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`One-click skill launch from any GitHub PR or issue.`})]})]})]}),(0,Y.jsx)(`section`,{"data-slot":`skills-detail`,className:C(`min-w-0 flex-1 flex-col`,E===null?`hidden md:flex`:`flex`),children:(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsxs)(B,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),N===$?(0,Y.jsx)(re,{projectId:h}):N===Q?(0,Y.jsx)(ee,{skills:S}):P?(0,Y.jsx)(q,{skill:P,usedBy:W(t.data?.workflows??[],P.name)}):e.isPending?null:(0,Y.jsx)(b,{icon:(0,Y.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})}function se({skill:e,active:t}){let n=V(e);return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(B,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":n?`true`:void 0,"aria-current":t?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(j,{"aria-hidden":`true`,className:C(`size-3.5 shrink-0`,n?`text-violet`:`text-soft-foreground`)}),(0,Y.jsx)(`span`,{className:C(`min-w-0 truncate font-mono text-[13px]`,n?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,Y.jsx)(G,{source:e.source,className:`ml-auto`})]}),e.description?(0,Y.jsx)(`span`,{className:`line-clamp-2 pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})})}export{ae as SkillsRoute};
|
|
@@ -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{Et as r,Nn as i,Qn as a,Tt as o,Ur as s,Vr as c,Z as l,_n as u,a as d,br as f,dr as p,i as m,ir as h,j as g,or as _,qr as v,t as y,wn as b,xt as x,zn as S}from"./centered-state-B_V_Ai2h.js";import{l as C,u as w}from"./editable-title-wS5NWwob.js";import{t as ee}from"./run-header-Cd8mSKBG.js";import{i as T,t as E}from"./use-desktop-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Et as r,Nn as i,Qn as a,Tt as o,Ur as s,Vr as c,Z as l,_n as u,a as d,br as f,dr as p,i as m,ir as h,j as g,or as _,qr as v,t as y,wn as b,xt as x,zn as S}from"./centered-state-B_V_Ai2h.js";import{l as C,u as w}from"./editable-title-wS5NWwob.js";import{t as ee}from"./run-header-Cd8mSKBG.js";import{i as T,t as E}from"./use-desktop-Sr1QlxhT.js";import{t as D}from"./textarea--cpYshee.js";import{a as O,c as k,l as A,o as j,r as M,s as N,t as P}from"./use-submit-shortcut-JY8M_MPL.js";import{S as F,n as I,r as L}from"./index-Cz4GSAqV.js";import{t as R}from"./diff-CbozNUJq.js";import{i as z,n as B,r as V}from"./git-toolbar-Q2kk2F7v.js";var H=e(t(),1),U=e=>e===`running`||e===`queued`||e===`waiting`,W=`no worktree — this task ran directly in the repo working tree`;function G(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${W}`)}function K(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${W}`)}function q(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${W}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?U(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function J(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:G(e),n=e.prUrl?[G(e),K(e)]:[K(e),q(e)],r=[];if(e.localHandoff){let t=e.hasSession?U(e.status)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Y=n();function te({run:e,open:t,onOpenChange:n}){let r=v(),[a,o]=(0,H.useState)(``),c=u(e),l=(0,H.useRef)(c);l.current=c,(0,H.useEffect)(()=>{t&&o(l.current)},[t]);let f=s({mutationFn:t=>i(e.id,t),onSuccess:t=>{m(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:g.runs.changes(e.id)}),r.invalidateQueries({queryKey:g.runs.all})},onError:e=>m(e.message,{tone:`danger`})}),p=()=>{let e=a.trim();e.length===0||f.isPending||f.mutate(e)};return(0,Y.jsx)(M,{open:t,onOpenChange:n,children:(0,Y.jsxs)(O,{"data-slot":`commit-dialog`,children:[(0,Y.jsxs)(k,{children:[(0,Y.jsx)(A,{children:`Commit changes`}),(0,Y.jsxs)(j,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Y.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Y.jsx)(D,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{P({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),p())}}),(0,Y.jsxs)(N,{children:[(0,Y.jsx)(d,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(d,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||f.isPending,onClick:p,children:f.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=c(),t=o(e);return t.isPending?(0,Y.jsx)(L,{tab:`changes`}):t.isError?(0,Y.jsx)(I,{tab:`changes`,error:t.error}):(0,Y.jsx)(Z,{run:t.data})}function Z({run:e}){let t=l(),n=x(),i=r(e.id,C(e.status)),a=E(),[o,c]=(0,H.useState)(`unified`),[u,d]=(0,H.useState)(!1),[D,O]=(0,H.useState)(null),[k,A]=(0,H.useState)(!1),j=(0,H.useRef)(null),M=v(),N=()=>M.invalidateQueries({queryKey:g.runs.all}),P=e=>m(e.message,{tone:`danger`}),I=s({mutationFn:()=>p(e.id),onSuccess:e=>m(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:P}),L=s({mutationFn:()=>S(e.id),onSuccess:e=>{m(`Draft PR created — ${e.url}`),N()},onError:P}),U=s({mutationFn:()=>_(e.id),onError:e=>{if(e instanceof b&&e.command){navigator.clipboard.writeText(e.command).then(()=>m(`No terminal found — command copied to clipboard.`)).catch(()=>m(`Run manually: ${e.command}`));return}P(e)}}),W=s({mutationFn:t=>h(e.id,t),onError:P}),G=i.isError&&i.error instanceof b&&i.error.status===409,K=J({status:e.status,hasWorktree:!!e.worktreePath&&!G,branch:e.branch,changedFiles:i.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:w(e)!==void 0,prUrl:e.pullRequestUrl}),q=e=>{switch(e){case`commit`:A(!0);break;case`push`:I.mutate();break;case`create-pr`:L.mutate();break;case`open-terminal`:U.mutate();break;case`view-pr`:break}},X=i.data?.files??[],Z=(0,H.useMemo)(()=>V(X),[X]),Q=a?o:`unified`,$=!a||u;return(0,Y.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Y.jsx)(ee,{run:e,tab:`changes`}),(0,Y.jsx)(B,{bar:K,branch:e.branch,stat:i.data?.stat,mode:Q,wrap:$,onModeChange:c,onWrapChange:d,onAction:q}),i.data?.repointedHead?(0,Y.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-6`,children:[`HEAD is on `,(0,Y.jsx)(`code`,{children:i.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Y.jsx)(`code`,{children:i.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,i.isPending?(0,Y.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):i.isError?(0,Y.jsx)(y,{icon:G?(0,Y.jsx)(F,{}):(0,Y.jsx)(T,{}),tone:G?`neutral`:`danger`,heading:`h2`,title:G?`No changes to show`:`Could not load the changes`,subtitle:i.error.message}):X.length===0?(0,Y.jsx)(y,{icon:(0,Y.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-5 px-4 py-4 [--diff-sticky-top:10rem] md:px-6`,children:[(0,Y.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`sticky top-40 hidden max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] w-60 shrink-0 overflow-y-auto overscroll-contain md:block lg:w-72`,children:(0,Y.jsx)(z,{root:Z,selected:D,onSelect:e=>{O(e),j.current?.scrollToPath(e)}})}),(0,Y.jsx)(R,{files:X,viewRef:j,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>f(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>W.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,Y.jsx)(te,{run:e,open:k,onOpenChange:A})]})}async function ne(e,t){try{let n=await a(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{X as TaskChangesRoute};
|
|
@@ -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{Dt as r,Ot as i,Tt as a,Vr as o,a as s,t as c,wn as l}from"./centered-state-B_V_Ai2h.js";import{l as u}from"./editable-title-wS5NWwob.js";import{t as d}from"./arrow-left-BJsIW6A0.js";import{t as f}from"./run-header-Cd8mSKBG.js";import{i as p,r as m,t as h}from"./use-desktop-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Dt as r,Ot as i,Tt as a,Vr as o,a as s,t as c,wn as l}from"./centered-state-B_V_Ai2h.js";import{l as u}from"./editable-title-wS5NWwob.js";import{t as d}from"./arrow-left-BJsIW6A0.js";import{t as f}from"./run-header-Cd8mSKBG.js";import{i as p,r as m,t as h}from"./use-desktop-Sr1QlxhT.js";import{t as g}from"./search-x-69n_672Y.js";import{t as _}from"./triangle-alert-D5tJwRD2.js";import{t as v}from"./project-router-BbCzrHKs.js";import{t as y}from"./diff-stat-btAmKFJr.js";import{n as b,r as x}from"./index-Cz4GSAqV.js";import{t as S}from"./diff-CbozNUJq.js";import{t as C}from"./commit-list-C4Dv6vUL.js";var w=e(t(),1),T=n();function E(){let{id:e}=o(),t=a(e);return t.isPending?(0,T.jsx)(x,{tab:`changes`}):t.isError?(0,T.jsx)(b,{tab:`changes`,error:t.error}):(0,T.jsx)(D,{run:t.data})}function D({run:e}){let{sha:t}=o(),n=i(e.id,u(e.status));return(0,T.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,T.jsx)(f,{run:e,tab:`commits`}),t?(0,T.jsx)(O,{runId:e.id,sha:t}):n.isPending?(0,T.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,T.jsx)(c,{icon:(0,T.jsx)(p,{}),tone:n.error instanceof l&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof l&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,T.jsx)(c,{icon:(0,T.jsx)(p,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,T.jsx)(C,{slot:`task-commits`,className:`mx-auto w-full max-w-[var(--measure)]`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))})]})}function O({runId:e,sha:t}){let n=r(e,t),i=h(),[a,o]=(0,w.useState)(`unified`),[u,f]=(0,w.useState)(!1),b=n.isError&&n.error instanceof l&&n.error.status===409,x=i?a:`unified`,C=!i||u;return(0,T.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,T.jsx)(s,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,T.jsxs)(v,{to:`/tasks/${e}/commits`,children:[(0,T.jsx)(d,{"aria-hidden":`true`}),`All commits`]})}),n.data?(0,T.jsx)(y,{stat:n.data.stat}):null,(0,T.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,T.jsx)(m,{mode:a,wrap:u,onModeChange:o,onWrapChange:f})})]}),n.isPending?(0,T.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,T.jsx)(c,{icon:b?(0,T.jsx)(g,{}):(0,T.jsx)(_,{}),tone:b?`neutral`:`danger`,heading:`h2`,title:b?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,T.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,T.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,T.jsx)(c,{icon:(0,T.jsx)(p,{}),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,T.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:10rem] md:px-6`,children:(0,T.jsx)(S,{files:n.data.files,mode:x,wrap:C,className:`min-w-0`})})]})]})}export{E as TaskCommitsRoute};
|
|
@@ -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{At as r,Tt as i,Vr as a,br as o,t as s,wn as c}from"./centered-state-B_V_Ai2h.js";import{r as l,t as u}from"./utils-Bb8ohcr3.js";import{t as d}from"./chevron-right-CFzn-von.js";import{t as f}from"./run-header-Cd8mSKBG.js";import{t as p}from"./file-DKoYWRsv.js";import{t as m}from"./folder-u01HScRT.js";import{t as h}from"./triangle-alert-D5tJwRD2.js";import{a as g,i as _,r as v}from"./highlighter-C8DK1_sG.js";import{n as y,r as b}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{At as r,Tt as i,Vr as a,br as o,t as s,wn as c}from"./centered-state-B_V_Ai2h.js";import{r as l,t as u}from"./utils-Bb8ohcr3.js";import{t as d}from"./chevron-right-CFzn-von.js";import{t as f}from"./run-header-Cd8mSKBG.js";import{t as p}from"./file-DKoYWRsv.js";import{t as m}from"./folder-u01HScRT.js";import{t as h}from"./triangle-alert-D5tJwRD2.js";import{a as g,i as _,r as v}from"./highlighter-C8DK1_sG.js";import{n as y,r as b}from"./index-Cz4GSAqV.js";var x=l(`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=l(`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=l(`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=l(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),T=l(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),E=l(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),D=e(t(),1),O=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function k(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:O.has(t.slice(n+1).toLowerCase())}function A(e){return e.tooLarge?`too-large`:k(e.path)?`image`:e.binary?`binary`:`text`}function j(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var M=n();function N({runId:e,path:t,className:n}){let i=r(e,t??void 0);if(t===null)return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(s,{icon:(0,M.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(i.isPending)return(0,M.jsx)(F,{className:n,children:(0,M.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(i.isError){let e=i.error instanceof c&&i.error.status===409;return(0,M.jsx)(F,{className:n,children:(0,M.jsx)(s,{icon:e?(0,M.jsx)(C,{}):(0,M.jsx)(h,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:i.error.message})})}return i.data.type===`file`?(0,M.jsx)(P,{runId:e,entry:i.data,className:n}):null}function P({runId:e,entry:t,className:n}){let r=A(t);return(0,M.jsxs)(F,{className:n,children:[(0,M.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,M.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,M.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:j(t.size)})]}),r===`image`?(0,M.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,M.jsx)(`img`,{"data-slot":`file-preview-image`,src:o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,M.jsx)(s,{icon:(0,M.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${j(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,M.jsx)(s,{icon:(0,M.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${j(t.size)} of binary data — no text preview.`}):(0,M.jsx)(R,{path:t.path,text:t.content??``})]})}function F({className:e,children:t}){return(0,M.jsx)(`section`,{"data-slot":`file-preview`,className:u(`overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var I=1500;function L(e,t){let n=(0,D.useMemo)(()=>t.split(`
|
|
2
2
|
`).map(e=>[{content:e}]),[t]),r=(0,D.useMemo)(()=>g(e),[e]),i=n.length>I,[a,o]=(0,D.useState)(null);return(0,D.useEffect)(()=>{if(r===null||i)return;let n=!1;return v(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:_(t,r)?.tokens??n}function R({path:e,text:t}){let n=L(e,t);return(0,M.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":g(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,M.jsxs)(`div`,{className:`flex px-4`,children:[(0,M.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,M.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function z({runId:e,selected:t,onSelect:n}){return(0,M.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function B({runId:e,path:t,depth:n,selected:i,onSelect:a}){let o=r(e,t);return o.isPending?(0,M.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Loading…`}):o.isError?(0,M.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${24+n*14}px`},children:o.error.message}):o.data.type===`dir`?o.data.entries.length===0?(0,M.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${24+n*14}px`},children:`Empty directory`}):(0,M.jsx)(M.Fragment,{children:o.data.entries.map(r=>r.type===`dir`?(0,M.jsx)(V,{runId:e,name:r.name,path:t===``?r.name:`${t}/${r.name}`,depth:n,selected:i,onSelect:a},r.name):(0,M.jsx)(H,{name:r.name,path:t===``?r.name:`${t}/${r.name}`,size:r.size,depth:n,selected:i,onSelect:a},r.name))}):null}function V({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,s]=(0,D.useState)(!1);return(0,M.jsxs)(`li`,{children:[(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":o?`open`:`closed`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,M.jsx)(d,{"aria-hidden":`true`,className:u(`size-3.5 shrink-0 transition-transform`,o&&`rotate-90`)}),(0,M.jsx)(m,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t})]}),o?(0,M.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,M.jsx)(B,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function H({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=k(t)?T:p;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:u(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+r*14}px`},children:[(0,M.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,M.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:j(n)})]})})}function U(){let{id:e}=a(),t=i(e);return t.isPending?(0,M.jsx)(b,{tab:`files`}):t.isError?(0,M.jsx)(y,{tab:`files`,error:t.error}):(0,M.jsx)(W,{run:t.data})}function W({run:e}){let t=r(e.id,``),[n,i]=(0,D.useState)(null),a=t.isError&&t.error instanceof c&&t.error.status===409;return(0,M.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,M.jsx)(f,{run:e,tab:`files`}),t.isPending?(0,M.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`}):t.isError?(0,M.jsx)(s,{icon:a?(0,M.jsx)(w,{}):(0,M.jsx)(h,{}),tone:a?`neutral`:`danger`,heading:`h2`,title:a?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,M.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,M.jsx)(`aside`,{"data-slot":`files-tree-pane`,className:`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:(0,M.jsx)(z,{runId:e.id,selected:n,onSelect:i})}),(0,M.jsx)(N,{runId:e.id,path:n,className:`min-w-0 flex-1`})]})]})}export{U as TaskFilesRoute};
|
|
@@ -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{$n as r,A as i,Fn as a,Gr as o,Lt as s,Mr as c,Nt as l,Pt as u,Qr as d,Tt as f,U as p,Ur as m,Vr as h,Wr as g,Yr as _,Zr as v,a as y,an as b,at as x,bt as S,er as C,i as w,j as T,k as E,kn as D,n as O,on as k,qr as A,st as ee,t as j,tt as te,wn as M,z as ne,zn as re,zr as ie}from"./centered-state-B_V_Ai2h.js";import{_ as N,a as P,c as ae,n as oe,r as F,t as I}from"./utils-Bb8ohcr3.js";import{E as se,S as ce,c as le,d as ue,g as de,k as L,o as fe,p as pe}from"./editable-title-wS5NWwob.js";import{t as me}from"./arrow-down-G8adPhbu.js";import{c as he,i as ge,l as _e,m as ve,n as ye,o as be,s as xe,t as Se}from"./thread-loading-GyH2Atwo.js";import{C as Ce,_ as we,a as Te,c as Ee,o as De}from"./new-task-form-BydHBbef.js";import{t as Oe}from"./chevron-right-CFzn-von.js";import{i as ke,n as Ae,r as je,t as Me}from"./run-header-Cd8mSKBG.js";import{b as Ne,y as Pe}from"./dropdown-menu-Z80KMInL.js";import{n as Fe,t as Ie}from"./trash-2--ZtrzUx3.js";import{C as Le,S as Re,c as ze,d as Be,f as Ve,s as He}from"./prompt-templates-B7Fs2b1S.js";import{t as Ue}from"./search-x-69n_672Y.js";import{t as We}from"./square-terminal-Cf4Og6ct.js";import{t as Ge}from"./textarea--cpYshee.js";import{n as R,r as z,t as B}from"./collapsible-B_8uYwHb.js";import{t as Ke}from"./use-submit-shortcut-JY8M_MPL.js";import{t as V}from"./project-router-BbCzrHKs.js";import{c as H}from"./pill-vNzaaYxj.js";import{t as U}from"./markdown-5FuCZDA4.js";import{t as qe}from"./lib-BQXq3kEf.js";import{t as Je}from"./zoomable-image-0G3IBXWC.js";import{t as Ye}from"./run-diff-Bq9vkSNK.js";var Xe=120;function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Xe?`${t.slice(0,Xe-1)}…`:t}function K(e,...t){if(W(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return G(t)}}function Ze(e){if(!W(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return G(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return G(e.join(` `))}}function Qe(e){if(!W(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)W(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function $e(e){return K(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function q(e,t){return t?`${e} ${t}`:e}function et(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:q(`Ran`,Ze(t)),subtitle:K(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:q(`Edit`,K(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:q(`Write`,K(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:q(`Edit`,K(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Qe(t);return{toolKind:`edit`,title:q(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:q(`Read`,K(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:q(`View image`,K(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:q(`Search`,K(t,`pattern`,`query`)),subtitle:K(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:q(`Fetch`,K(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:q(`Web search`,K(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=K(t,`subagent_type`,`subagentType`),i=K(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=K(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:K(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=K(t,`server`),n=K(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:$e(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?G(e):`Tool`,subtitle:$e(t)}}var tt=class extends _{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,f=o&&c===`backward`,p=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:d(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:s&&!l&&!f,isRefetching:a&&!u&&!p}}};function nt(e,t){return o(e,tt,t)}var rt=F(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),it=F(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),at=F(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ot=F(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),st=F(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),ct=F(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),lt=F(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),J=e(t(),1),ut=[`run-event`,`ui-event`];function dt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function ft(e,t={}){let[n,r]=(0,J.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,J.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=dt(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(P(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of ut)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var pt=5,mt=200,ht=5e3;function gt(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function _t(e){let t=ae(),n=A(),i=[`run-history`,t,e],a=[`run-history-context`,t,e],o=nt({queryKey:i,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>r(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:pt,retry:1}),s=g({queryKey:a,enabled:e!==void 0,queryFn:({signal:t})=>C(e,{signal:t}),retry:1}),c=o.isError||s.isError,l=ft(c?e:void 0),u=o.data?.pages??[],d=u.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),f=(0,J.useRef)(!1),p=(0,J.useCallback)(()=>{e===void 0||f.current||(f.current=!0,r(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>pt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{f.current=!1}))},[n,e,t]),m=ft(!c&&d?e:void 0,{cursor:d?.liveCursor,afterSeq:d?.asOfSeq,maxEvents:ht,compactAt:mt,onCompact:p}),h=(0,J.useMemo)(()=>gt(...u.map(e=>e.events)),[u]),_=(0,J.useMemo)(()=>c?l:gt(h,m),[c,l,h,m]),v=(0,J.useMemo)(()=>{if(c)return l;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return gt(e,_.filter(({seq:e})=>e>t))},[s.data,c,l,_]),y=(0,J.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),b=(0,J.useCallback)(async()=>{await n.resetQueries({queryKey:i,exact:!0})},[i,n]);return{visibleEvents:_,currentEvents:v,isPending:!c&&o.isPending,contextPending:!c&&s.isPending,fallback:c,hasOlder:!c&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:y,jumpToLatest:b,retainedPages:u.length}}var Y=n();function vt({run:e}){let t=A(),n=m({mutationFn:()=>D(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:T.runs.detail(e.id)}),t.invalidateQueries({queryKey:T.runs.list()}),w(`This task will not resume itself`)},onError:e=>w(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Y.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(H,{tone:`pending`,pulse:!0}),(0,Y.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Y.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Y.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Y.jsx)(c,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var yt=e=>e.kind===`tool`,bt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,xt=(e,t,n)=>`${e} ${e===1?t:n}`;function St(e,t){let n=[];return e>0&&n.push(xt(e,`file`,`files`)),t>0&&n.push(xt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Ct(e){return`${e} earlier tool call${e===1?``:`s`}`}var wt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Tt(e){for(let t of wt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function Et(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(yt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:St(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)yt(e)&&bt(e)&&!r.has(e.id)?o.push(e):(s(),yt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var Dt=new Map,Ot=(0,J.createContext)(null);function kt(){return(0,J.useContext)(Ot)}function At({runId:e,children:t}){let n=(0,J.useMemo)(()=>({get:t=>Dt.get(e)?.get(t),set:(t,n)=>{let r=Dt.get(e)??new Map;r.set(t,n),Dt.set(e,r)}}),[e]);return(0,Y.jsx)(Ot.Provider,{value:n,children:t})}function X(e){return e.scrollTop<Math.max(600,e.clientHeight)}function jt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Mt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Nt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Pt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Ft=new Map;function It(e,t){Ft.set(e,t)}function Lt(e){return Ft.get(e)}var Rt=new Map;function zt(e,t){Rt.set(e,t)}function Bt(e,t){let n=Rt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Vt({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(e),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(),g=()=>{d(e),h(void 0),l(!0)},_=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}p(!0),h(void 0);try{await r?.(t),l(!1)}catch(e){h(e instanceof Error?e.message:`Could not save the message`)}finally{p(!1)}},v=async()=>{p(!0),h(void 0);try{await i?.()}catch(e){h(e instanceof Error?e.message:`Could not remove the message`)}finally{p(!1)}};return c?(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,Y.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Y.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:f,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:f?(0,Y.jsx)(E,{className:`size-3.5 animate-spin`}):`Save`})]}),m?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:m}):null]}):(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[r||i?(0,Y.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,Y.jsx)(`button`,{type:`button`,"aria-label":a,onClick:g,disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(ct,{className:`size-3.5`})}):null,i?(0,Y.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void v(),disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(Ie,{className:`size-3.5`})}):null]}):null,m?(0,Y.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:m}):null,(0,Y.jsx)(U,{breaks:!0,children:e}),n.length>0?(0,Y.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>N(e.split(`/`).pop()??``)?(0,Y.jsx)(Je,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Y.jsxs)(`a`,{href:e,download:!0,"data-slot":`user-file`,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,s>0?(0,Y.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function Ht({text:e}){return(0,Y.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,Y.jsx)(U,{children:e})})}function Ut({note:e}){return(0,Y.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:I(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var Wt={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`};function Gt({incident:e}){let t=Wt[e.provider];return(0,Y.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Y.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Y.jsx)(V,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Kt({text:e}){let t=(0,J.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,A as i,Fn as a,Gr as o,Lt as s,Mr as c,Nt as l,Pt as u,Qr as d,Tt as f,U as p,Ur as m,Vr as h,Wr as g,Yr as _,Zr as v,a as y,an as b,at as x,bt as S,er as C,i as w,j as T,k as E,kn as D,n as O,on as k,qr as A,st as ee,t as j,tt as te,wn as M,z as ne,zn as re,zr as ie}from"./centered-state-B_V_Ai2h.js";import{_ as N,a as P,c as ae,n as oe,r as F,t as I}from"./utils-Bb8ohcr3.js";import{E as se,S as ce,c as le,d as ue,g as de,k as L,o as fe,p as pe}from"./editable-title-wS5NWwob.js";import{t as me}from"./arrow-down-G8adPhbu.js";import{c as he,i as ge,l as _e,m as ve,n as ye,o as be,s as xe,t as Se}from"./thread-loading-ZhJref0J.js";import{C as Ce,_ as we,a as Te,c as Ee,o as De}from"./new-task-form-BydHBbef.js";import{t as Oe}from"./chevron-right-CFzn-von.js";import{i as ke,n as Ae,r as je,t as Me}from"./run-header-Cd8mSKBG.js";import{b as Ne,y as Pe}from"./dropdown-menu-Z80KMInL.js";import{n as Fe,t as Ie}from"./trash-2--ZtrzUx3.js";import{C as Le,S as Re,c as ze,d as Be,f as Ve,s as He}from"./prompt-templates-B7Fs2b1S.js";import{t as Ue}from"./search-x-69n_672Y.js";import{t as We}from"./square-terminal-Cf4Og6ct.js";import{t as Ge}from"./textarea--cpYshee.js";import{n as R,r as z,t as B}from"./collapsible-B_8uYwHb.js";import{t as Ke}from"./use-submit-shortcut-JY8M_MPL.js";import{t as V}from"./project-router-BbCzrHKs.js";import{c as H}from"./pill-vNzaaYxj.js";import{t as U}from"./markdown-5FuCZDA4.js";import{t as qe}from"./lib-BQXq3kEf.js";import{t as Je}from"./zoomable-image-0G3IBXWC.js";import{t as Ye}from"./run-diff-Bq9vkSNK.js";var Xe=120;function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Xe?`${t.slice(0,Xe-1)}…`:t}function K(e,...t){if(W(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return G(t)}}function Ze(e){if(!W(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return G(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return G(e.join(` `))}}function Qe(e){if(!W(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)W(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function $e(e){return K(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function q(e,t){return t?`${e} ${t}`:e}function et(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:q(`Ran`,Ze(t)),subtitle:K(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:q(`Edit`,K(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:q(`Write`,K(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:q(`Edit`,K(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Qe(t);return{toolKind:`edit`,title:q(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:q(`Read`,K(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:q(`View image`,K(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:q(`Search`,K(t,`pattern`,`query`)),subtitle:K(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:q(`Fetch`,K(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:q(`Web search`,K(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=K(t,`subagent_type`,`subagentType`),i=K(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=K(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:K(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=K(t,`server`),n=K(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:$e(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?G(e):`Tool`,subtitle:$e(t)}}var tt=class extends _{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,f=o&&c===`backward`,p=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:d(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:s&&!l&&!f,isRefetching:a&&!u&&!p}}};function nt(e,t){return o(e,tt,t)}var rt=F(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),it=F(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),at=F(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ot=F(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),st=F(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),ct=F(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),lt=F(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),J=e(t(),1),ut=[`run-event`,`ui-event`];function dt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function ft(e,t={}){let[n,r]=(0,J.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,J.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=dt(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(P(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of ut)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var pt=5,mt=200,ht=5e3;function gt(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function _t(e){let t=ae(),n=A(),i=[`run-history`,t,e],a=[`run-history-context`,t,e],o=nt({queryKey:i,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>r(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:pt,retry:1}),s=g({queryKey:a,enabled:e!==void 0,queryFn:({signal:t})=>C(e,{signal:t}),retry:1}),c=o.isError||s.isError,l=ft(c?e:void 0),u=o.data?.pages??[],d=u.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),f=(0,J.useRef)(!1),p=(0,J.useCallback)(()=>{e===void 0||f.current||(f.current=!0,r(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>pt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{f.current=!1}))},[n,e,t]),m=ft(!c&&d?e:void 0,{cursor:d?.liveCursor,afterSeq:d?.asOfSeq,maxEvents:ht,compactAt:mt,onCompact:p}),h=(0,J.useMemo)(()=>gt(...u.map(e=>e.events)),[u]),_=(0,J.useMemo)(()=>c?l:gt(h,m),[c,l,h,m]),v=(0,J.useMemo)(()=>{if(c)return l;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return gt(e,_.filter(({seq:e})=>e>t))},[s.data,c,l,_]),y=(0,J.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),b=(0,J.useCallback)(async()=>{await n.resetQueries({queryKey:i,exact:!0})},[i,n]);return{visibleEvents:_,currentEvents:v,isPending:!c&&o.isPending,contextPending:!c&&s.isPending,fallback:c,hasOlder:!c&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:y,jumpToLatest:b,retainedPages:u.length}}var Y=n();function vt({run:e}){let t=A(),n=m({mutationFn:()=>D(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:T.runs.detail(e.id)}),t.invalidateQueries({queryKey:T.runs.list()}),w(`This task will not resume itself`)},onError:e=>w(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Y.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(H,{tone:`pending`,pulse:!0}),(0,Y.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Y.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Y.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Y.jsx)(c,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var yt=e=>e.kind===`tool`,bt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,xt=(e,t,n)=>`${e} ${e===1?t:n}`;function St(e,t){let n=[];return e>0&&n.push(xt(e,`file`,`files`)),t>0&&n.push(xt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Ct(e){return`${e} earlier tool call${e===1?``:`s`}`}var wt=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Tt(e){for(let t of wt)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function Et(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(yt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:St(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)yt(e)&&bt(e)&&!r.has(e.id)?o.push(e):(s(),yt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var Dt=new Map,Ot=(0,J.createContext)(null);function kt(){return(0,J.useContext)(Ot)}function At({runId:e,children:t}){let n=(0,J.useMemo)(()=>({get:t=>Dt.get(e)?.get(t),set:(t,n)=>{let r=Dt.get(e)??new Map;r.set(t,n),Dt.set(e,r)}}),[e]);return(0,Y.jsx)(Ot.Provider,{value:n,children:t})}function X(e){return e.scrollTop<Math.max(600,e.clientHeight)}function jt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Mt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Nt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Pt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Ft=new Map;function It(e,t){Ft.set(e,t)}function Lt(e){return Ft.get(e)}var Rt=new Map;function zt(e,t){Rt.set(e,t)}function Bt(e,t){let n=Rt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Vt({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(e),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(),g=()=>{d(e),h(void 0),l(!0)},_=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}p(!0),h(void 0);try{await r?.(t),l(!1)}catch(e){h(e instanceof Error?e.message:`Could not save the message`)}finally{p(!1)}},v=async()=>{p(!0),h(void 0);try{await i?.()}catch(e){h(e instanceof Error?e.message:`Could not remove the message`)}finally{p(!1)}};return c?(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,Y.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Y.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:f,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:f?(0,Y.jsx)(E,{className:`size-3.5 animate-spin`}):`Save`})]}),m?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:m}):null]}):(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[r||i?(0,Y.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,Y.jsx)(`button`,{type:`button`,"aria-label":a,onClick:g,disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(ct,{className:`size-3.5`})}):null,i?(0,Y.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void v(),disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(Ie,{className:`size-3.5`})}):null]}):null,m?(0,Y.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:m}):null,(0,Y.jsx)(U,{breaks:!0,children:e}),n.length>0?(0,Y.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>N(e.split(`/`).pop()??``)?(0,Y.jsx)(Je,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Y.jsxs)(`a`,{href:e,download:!0,"data-slot":`user-file`,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Y.jsx)(ve,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,s>0?(0,Y.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function Ht({text:e}){return(0,Y.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,Y.jsx)(U,{children:e})})}function Ut({note:e}){return(0,Y.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:I(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var Wt={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`};function Gt({incident:e}){let t=Wt[e.provider];return(0,Y.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Y.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Y.jsx)(V,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Kt({text:e}){let t=(0,J.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
2
|
`,1)[0]??``,r=n.length<e.length;return(0,Y.jsxs)(B,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,Y.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,Y.jsx)(Oe,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,Y.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,Y.jsx)(U,{inline:!0,children:n})}),r?(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Y.jsx)(z,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,Y.jsx)(R,{children:(0,Y.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,Y.jsx)(U,{children:e})})})]})}function qt(){return(0,Y.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,Y.jsx)(E,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Y.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Jt={read:ke,edit:ct,delete:Ie,move:at,search:Re,execute:We,think:rt,fetch:se,task:L,plan:ot,other:lt},Yt=e=>e.split(`
|
|
3
3
|
`).length;function Xt({text:e,streaming:t}){let[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(null),a=(0,J.useRef)(!0);(0,J.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Yt(e),s=!t&&!n&&o>12;return(0,Y.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Nt(e.currentTarget)}:void 0,className:I(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,Y.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,Y.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,Y.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Zt({diffs:e}){return(0,Y.jsx)(Y.Fragment,{children:e.map((e,t)=>(0,Y.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,Y.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Qt(e.oldText).map((e,t)=>(0,Y.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Qt(e.newText).map((e,t)=>(0,Y.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
4
|
`).map((e,t)=>(0,Y.jsx)($t,{text:e},t))})]},`${e.path}:${t}`))})}function Qt(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Rt as i,Vt as a,a as o,i as s,j as ee,k as c,pr as te,qr as ne,t as l}from"./centered-state-B_V_Ai2h.js";import{g as re,h as u,r as d,t as f,v as p}from"./utils-Bb8ohcr3.js";import{h as ie,m as ae,p as oe}from"./new-task-form-BydHBbef.js";import{p as se,r as ce,v as le,y as ue}from"./prompt-templates-B7Fs2b1S.js";import{n as m}from"./textarea--cpYshee.js";import{d as de,f as fe,g as h,h as g,l as _,m as pe,p as me,u as v}from"./alert-dialog-CGskMvgc.js";import{t as he}from"./use-submit-shortcut-JY8M_MPL.js";import{i as ge,n as _e,r as ve,t as ye}from"./skills-D4P-Hgey.js";var y=d(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),be=d(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),b=d(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),x=n(),S=e(t(),1);function C(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function w(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function T(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||C(e.target)&&!w(e.target))}function E(e,t){let n=S.useRef(t);S.useLayoutEffect(()=>{n.current=t}),S.useEffect(()=>{let t=t=>{T(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function D(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||C(e.target))}function O(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function k(e,t){let n=S.useRef(t);S.useLayoutEffect(()=>{n.current=t}),S.useEffect(()=>{let t=t=>{D(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function A({...e}){return(0,x.jsx)(_,{"data-slot":`sheet`,...e})}function j({...e}){return(0,x.jsx)(h,{"data-slot":`sheet-trigger`,...e})}function M({...e}){return(0,x.jsx)(v,{"data-slot":`sheet-close`,...e})}function N({...e}){return(0,x.jsx)(pe,{"data-slot":`sheet-portal`,...e})}function P({className:e,...t}){return(0,x.jsx)(me,{"data-slot":`sheet-overlay`,className:f(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function F({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,x.jsxs)(N,{children:[(0,x.jsx)(P,{}),(0,x.jsxs)(de,{"data-slot":`sheet-content`,className:f(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,x.jsxs)(v,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,x.jsx)(m,{className:`size-4`}),(0,x.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function I({className:e,...t}){return(0,x.jsx)(`div`,{"data-slot":`sheet-header`,className:f(`flex flex-col gap-1.5 p-4`,e),...t})}function L({className:e,...t}){return(0,x.jsx)(g,{"data-slot":`sheet-title`,className:f(`font-semibold text-foreground`,e),...t})}function R({className:e,...t}){return(0,x.jsx)(fe,{"data-slot":`sheet-description`,className:f(`text-sm text-muted-foreground`,e),...t})}function z(e){let[t,n]=S.useState(()=>Date.now());return S.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var B={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function V(e){return re(e.type)?e.type:B[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function xe(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=V(e)??`application/octet-stream`,a=p(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${u(i)}`),isImage:a}}function Se(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(V(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var H=new Set([`/`,`@`]);function Ce(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(H.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function we(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function U(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Te(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Ee(e){let[t,n]=S.useState(null),r=S.useRef(null),i=S.useRef(``),[a]=S.useState(()=>U()!==void 0),o=S.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return S.useEffect(()=>o,[o]),{supported:a,recording:t,start:S.useCallback(()=>{if(r.current)return;let t=U();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=Te(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:S.useCallback(()=>o(),[o]),finish:S.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function W(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var De={KeyA:`Yes, approved.`,KeyC:`Continue.`};function G({onSubmit:e,value:t,onValueChange:n,autoFocus:r=!1,footerStart:c,footerEnd:l,sendAriaLabel:re=`Send`,disabled:u=!1,disabledReason:d=`Session closed — Continue to reopen.`,allowEmptySubmit:p=!1,placeholder:de=`Reply — / for skills, @ for files…`,ariaLabel:fe=`Reply to the agent`,autocompleteSkills:h=!0,quickReplies:g=!1,getMentionCandidates:_,ref:pe}){let[me,v]=(0,S.useState)(``),w=t??me,T=(0,S.useRef)(w);T.current=w;let E=(0,S.useRef)(n);E.current=n;let D=(0,S.useCallback)(e=>{let t=typeof e==`function`?e(T.current):e;v(t),E.current?.(t)},[]),[O,k]=(0,S.useState)([]),A=(0,S.useRef)(O);A.current=O;let[j,M]=(0,S.useState)(!1),[N,P]=(0,S.useState)(null),[F,I]=(0,S.useState)(``),[L,R]=(0,S.useState)(!1),z=(0,S.useRef)(null),B=(0,S.useRef)(null),V=(0,S.useRef)(null),H=i(h&&L),U=a(),Te=ne(),W=Ee(e=>s(e,{tone:`danger`}));(0,S.useEffect)(()=>{r&&z.current?.focus()},[]),(0,S.useImperativeHandle)(pe,()=>({insertAtCaret:e=>{let t=z.current,n=ce(T.current,t?.selectionStart??T.current.length,e);D(n.text),V.current=n.caret,t?.focus()}}),[D]);let G=(0,S.useCallback)(()=>{let e=z.current;if(!e||u){P(null);return}let t=Ce(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!h||t?.trigger===`@`&&_===void 0)return P(null);t?.trigger===`/`&&R(!0),P(t)},[h,u,_]),K=(0,S.useRef)(()=>{});K.current=()=>{let e=z.current;!e||e.value===T.current||(T.current=e.value,D(e.value),G())},(0,S.useEffect)(()=>{let e=z.current;if(!e)return;let t=()=>K.current();return e.addEventListener(`input`,t),()=>e.removeEventListener(`input`,t)},[]);let q=(0,S.useMemo)(()=>N===null?[]:N.trigger===`/`?_e(H.data??[],N.query,U.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:ge(e)})):(_?.()??[]).filter(e=>ve(e,N.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[_,H.data,N,U.data?.skillUsage]),J=q.some(e=>e.value===F)?F:q[0]?.value,Ae=N!==null,Y=(0,S.useCallback)(()=>P(null),[]),je=e=>{let t=z.current;if(!t||N===null)return;let n=t.selectionStart??t.value.length,r=we(t.value,N,n,e.insert);N.trigger===`/`&&U.data!==void 0&&te({skillUsage:ye(U.data.skillUsage,e.insert)}).then(()=>Te.invalidateQueries({queryKey:ee.uiState})).catch(()=>{}),D(r.text),V.current=r.caret,P(null),t.focus()};(0,S.useLayoutEffect)(()=>{let e=V.current,t=z.current;e!==null&&t&&(t.setSelectionRange(e,e),V.current=null)},[w]),(0,S.useLayoutEffect)(()=>{let e=z.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[w]);let X=(0,S.useCallback)(e=>{if(u)return;let t=Se(e,A.current.length);for(let e of t.rejected)s(e,{tone:`danger`});for(let e of t.accepted)xe(e).then(e=>k(t=>t.length>=4?t:[...t,e]))},[u]),Me=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),X(t))},Ne=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),X(t))},Z=(0,S.useCallback)(async(t,n,r)=>{let i=t.trim();if(!(u||j)&&!(i===``&&n.length===0&&!p)){M(!0);try{await e(i,n.map(({mediaType:e,data:t})=>({mediaType:e,data:t})))}catch(e){s(e instanceof Error?e.message:String(e),{tone:`danger`}),r&&(D(e=>e===``?t:`${t}\n${e}`),k(e=>[...n,...e].slice(0,4)))}finally{M(!1)}}},[p,j,u,e]),Pe=(0,S.useCallback)(()=>{if(w.trim()===``&&O.length===0&&!p)return;let e=w,t=O;D(``),k([]),P(null),Z(e,t,!0)},[p,O,Z,w]),Fe=e=>{if(Ae){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),q.length===0)return;let t=q.findIndex(e=>e.value===J),n=e.key===`ArrowDown`?1:-1,r=q[(t+n+q.length)%q.length];I(r.value);return}if(e.key===`Escape`){e.preventDefault(),Y();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=q.find(e=>e.value===J);if(t){e.preventDefault(),je(t);return}Y()}}he({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Pe())};(0,S.useEffect)(()=>{if(!g||u)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||C(e.target))return;let t=De[e.code];t!==void 0&&(e.preventDefault(),Z(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[u,g,Z]);let Q=e=>{let t=W.finish();if(t===``)return;let n=w.trim()===``?t:`${w.replace(/\s*$/,``)} ${t}`;if(e){D(``),k([]),Z(n,O,!0);return}D(n),V.current=n.length,z.current?.focus()},$=W.recording;return(0,x.jsxs)(oe,{open:Ae,onOpenChange:e=>e?void 0:Y(),children:[(0,x.jsx)(ae,{asChild:!0,children:(0,x.jsxs)(`div`,{ref:B,"data-slot":`composer`,"data-disabled":u||void 0,onDrop:Ne,onDragOver:e=>e.preventDefault(),className:f(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,u&&`opacity-80`),children:[O.length>0?(0,x.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap items-center gap-2 px-4 pt-3`,children:O.map((e,t)=>(0,x.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:f(`group relative overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>k(e=>e.filter((e,n)=>n!==t)),children:[e.isImage?(0,x.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,x.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,x.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,x.jsx)(m,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,x.jsx)(`textarea`,{ref:z,rows:1,value:w,disabled:u,"aria-label":fe,placeholder:u?d:de,className:`block max-h-[220px] min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,onChange:e=>{e.target.value!==T.current&&D(e.target.value),G()},onKeyDown:Fe,onSelect:G,onPaste:Me}),$?(0,x.jsx)(ke,{transcript:$.transcript,startedAt:$.startedAt,onCancel:W.cancel,onInsert:()=>Q(!1),onInsertAndSend:()=>Q(!0)}):(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[(0,x.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,x.jsx)(Oe,{disabled:u,onFiles:X}),c]}),(0,x.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[W.supported?(0,x.jsxs)(o,{type:`button`,variant:`ghost`,size:`sm`,disabled:u,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:W.start,children:[(0,x.jsx)(be,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,l?(0,x.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:l}):null,(0,x.jsx)(o,{type:`button`,size:`icon-sm`,"aria-label":re,disabled:u||j||w.trim()===``&&O.length===0&&!p,className:`size-8`,onClick:Pe,children:(0,x.jsx)(y,{"aria-hidden":`true`})})]})]})]})}),(0,x.jsx)(ie,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{B.current?.contains(e.target)&&e.preventDefault()},children:(0,x.jsx)(se,{shouldFilter:!1,value:J??``,onValueChange:I,children:(0,x.jsx)(ue,{"data-slot":`composer-menu`,"data-trigger":N?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:q.length===0?(0,x.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:N?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:H.isPending?`Loading skills…`:`No matching skills.`}):q.map(e=>(0,x.jsxs)(le,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>je(e),children:[(0,x.jsx)(`span`,{className:f(`shrink-0 truncate`,e.emphasized&&`font-semibold`,N?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,x.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Oe({disabled:e,onFiles:t}){let n=(0,S.useRef)(null);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,x.jsx)(b,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,x.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function ke({transcript:e,startedAt:t,onCancel:n,onInsert:i,onInsertAndSend:a}){let s=z(1e3);return(0,x.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,x.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:W(t,s)}),(0,x.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,x.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,x.jsx)(m,{"aria-hidden":`true`})}),(0,x.jsx)(o,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:i,children:(0,x.jsx)(r,{"aria-hidden":`true`})}),(0,x.jsx)(o,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:a,children:(0,x.jsx)(y,{"aria-hidden":`true`})})]})}function K(){return(0,x.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,x.jsx)(l,{icon:(0,x.jsx)(c,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{M as a,I as c,O as d,E as f,y as h,A as i,L as l,b as m,G as n,F as o,k as p,z as r,R as s,K as t,j as u};
|
|
@@ -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{a as r}from"./centered-state-B_V_Ai2h.js";import{r as i,t as a}from"./utils-Bb8ohcr3.js";import{x as o}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{a as r}from"./centered-state-B_V_Ai2h.js";import{r as i,t as a}from"./utils-Bb8ohcr3.js";import{x as o}from"./index-Cz4GSAqV.js";var s=i(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=n();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:i}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,l.jsx)(d,{current:e,value:`unified`,onModeChange:n}),(0,l.jsx)(d,{current:e,value:`split`,onModeChange:n})]}),(0,l.jsx)(r,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:a(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,l.jsx)(c,{"aria-hidden":`true`})})]})}function d({current:e,value:t,onModeChange:n}){let r=e===t;return(0,l.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:a(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function f({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}var p=e(t(),1);function m(){let[e,t]=(0,p.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,p.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{s as i,f as n,u as r,m as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{A as i,Bn as a,Hn as o,Rt as s,Ur as c,Vr as l,Vt as u,Wt as d,a as f,i as p,j as m,qr as h,sr as g,t as _,ur as v,wn as y}from"./centered-state-B_V_Ai2h.js";import{r as b,t as x}from"./utils-Bb8ohcr3.js";import{t as S}from"./arrow-down-G8adPhbu.js";import{n as C,t as w}from"./trash-2--ZtrzUx3.js";import{n as ee,r as te}from"./skill-empty-hint-CL0g7WBL.js";import{t as T}from"./sparkles-B8agSxBZ.js";import{t as ne}from"./square-terminal-Cf4Og6ct.js";import{t as re}from"./triangle-alert-D5tJwRD2.js";import{t as ie}from"./upload-SnwVxKOA.js";import{n as ae,t as oe}from"./textarea--cpYshee.js";import{a as E,c as se,i as ce,n as D,o as le,r as O,s as ue,t as k}from"./alert-dialog-CGskMvgc.js";import{i as de,s as A}from"./skills-D4P-Hgey.js";import{b as j,g as M,i as fe,y as N}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{A as i,Bn as a,Hn as o,Rt as s,Ur as c,Vr as l,Vt as u,Wt as d,a as f,i as p,j as m,qr as h,sr as g,t as _,ur as v,wn as y}from"./centered-state-B_V_Ai2h.js";import{r as b,t as x}from"./utils-Bb8ohcr3.js";import{t as S}from"./arrow-down-G8adPhbu.js";import{n as C,t as w}from"./trash-2--ZtrzUx3.js";import{n as ee,r as te}from"./skill-empty-hint-CL0g7WBL.js";import{t as T}from"./sparkles-B8agSxBZ.js";import{t as ne}from"./square-terminal-Cf4Og6ct.js";import{t as re}from"./triangle-alert-D5tJwRD2.js";import{t as ie}from"./upload-SnwVxKOA.js";import{n as ae,t as oe}from"./textarea--cpYshee.js";import{a as E,c as se,i as ce,n as D,o as le,r as O,s as ue,t as k}from"./alert-dialog-CGskMvgc.js";import{i as de,s as A}from"./skills-D4P-Hgey.js";import{b as j,g as M,i as fe,y as N}from"./index-Cz4GSAqV.js";var pe=b(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),me=e(n()),P=e(t());function he(){var e=[...arguments];return(0,P.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var F=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function I(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function L(e){return`nodeType`in e}function R(e){return e?I(e)?e:L(e)?e.ownerDocument?.defaultView??window:window:window}function ge(e){let{Document:t}=R(e);return e instanceof t}function _e(e){return!I(e)&&e instanceof R(e).HTMLElement}function ve(e){return e instanceof R(e).SVGElement}function z(e){return e?I(e)?e.document:L(e)?ge(e)?e:_e(e)||ve(e)?e.ownerDocument:document:document:document}var B=F?P.useLayoutEffect:P.useEffect;function ye(e){let t=(0,P.useRef)(e);return B(()=>{t.current=e}),(0,P.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function be(){let e=(0,P.useRef)(null);return[(0,P.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,P.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function xe(e,t){t===void 0&&(t=[e]);let n=(0,P.useRef)(e);return B(()=>{n.current!==e&&(n.current=e)},t),n}function V(e,t){let n=(0,P.useRef)();return(0,P.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function H(e){let t=ye(e),n=(0,P.useRef)(null);return[n,(0,P.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Se(e){let t=(0,P.useRef)();return(0,P.useEffect)(()=>{t.current=e},[e]),t.current}var U={};function Ce(e,t){return(0,P.useMemo)(()=>{if(t)return t;let n=U[e]==null?0:U[e]+1;return U[e]=n,e+`-`+n},[e,t])}function we(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var Te=we(1),Ee=we(-1);function De(e){return`clientX`in e&&`clientY`in e}function W(e){if(!e)return!1;let{KeyboardEvent:t}=R(e.target);return t&&e instanceof t}function G(e){if(!e)return!1;let{TouchEvent:t}=R(e.target);return t&&e instanceof t}function Oe(e){if(G(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return De(e)?{x:e.clientX,y:e.clientY}:null}var K=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[K.Translate.toString(e),K.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),ke=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ae(e){return e.matches(ke)?e:e.querySelector(ke)}var je={display:`none`};function Me(e){let{id:t,value:n}=e;return P.createElement(`div`,{id:t,style:je},n)}function Ne(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return P.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Pe(){let[e,t]=(0,P.useState)(``);return{announce:(0,P.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Fe=(0,P.createContext)(null);function Ie(e){let t=(0,P.useContext)(Fe);(0,P.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Le(){let[e]=(0,P.useState)(()=>new Set),t=(0,P.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,P.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Re={draggable:`
|
|
2
2
|
To pick up a draggable item, press the space bar.
|
|
3
3
|
While dragging, use the arrow keys to move the item.
|
|
4
4
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/web/dist/index.html
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
})()
|
|
45
45
|
</script>
|
|
46
|
-
<script type="module" crossorigin src="/assets/index-
|
|
46
|
+
<script type="module" crossorigin src="/assets/index-Cz4GSAqV.js"></script>
|
|
47
47
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
48
48
|
<link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
|
|
49
49
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/use-submit-shortcut-JY8M_MPL.js">
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/prompt-templates-B7Fs2b1S.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/skills-D4P-Hgey.js">
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/thread-loading-
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/thread-loading-ZhJref0J.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/chevron-right-CFzn-von.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/search-x-69n_672Y.js">
|
|
73
73
|
<link rel="modulepreload" crossorigin href="/assets/project-router-BbCzrHKs.js">
|