@open-mercato/cezar 0.16.2 → 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-origin.d.ts +6 -0
- package/dist/api-origin.js +32 -0
- package/dist/api-origin.js.map +1 -0
- package/dist/automations/schedule-runner.d.ts +1 -0
- package/dist/automations/schedule-runner.js +2 -2
- package/dist/automations/schedule-runner.js.map +1 -1
- package/dist/core/agent-errors.d.ts +5 -0
- package/dist/core/agent-errors.js +49 -0
- package/dist/core/agent-errors.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +3 -0
- package/dist/core/claude-cli-runner.js +20 -4
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-ui-mapper.js +4 -1
- package/dist/core/codex-ui-mapper.js.map +1 -1
- package/dist/core/copilot-acp-runner.d.ts +1 -1
- package/dist/core/copilot-acp-runner.js +26 -5
- package/dist/core/copilot-acp-runner.js.map +1 -1
- package/dist/core/model-presets.d.ts +11 -0
- package/dist/core/model-presets.js +35 -1
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-model-catalog.js +3 -0
- package/dist/core/opencode-model-catalog.js.map +1 -1
- package/dist/core/opencode-server-runner.d.ts +7 -0
- package/dist/core/opencode-server-runner.js +36 -1
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.js +2 -0
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/provider-auth.d.ts +6 -0
- package/dist/core/provider-auth.js +59 -13
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/usage-limit.js +8 -2
- package/dist/core/usage-limit.js.map +1 -1
- package/dist/index.js +3 -19
- package/dist/index.js.map +1 -1
- package/dist/release/bump.d.ts +1 -1
- package/dist/release/bump.js +1 -1
- package/dist/release/stable.d.ts +21 -4
- package/dist/release/stable.js +48 -15
- package/dist/release/stable.js.map +1 -1
- package/dist/runs/agent-error-telemetry.js +4 -2
- package/dist/runs/agent-error-telemetry.js.map +1 -1
- package/dist/runs/store.d.ts +1 -1
- package/dist/runs/store.js +31 -4
- package/dist/runs/store.js.map +1 -1
- package/dist/server/git-changes.d.ts +22 -0
- package/dist/server/git-changes.js +19 -1
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/open-in-app.js +14 -3
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/preview/location-reporter.d.ts +12 -0
- package/dist/server/preview/location-reporter.js +45 -0
- package/dist/server/preview/location-reporter.js.map +1 -0
- package/dist/server/preview/picker-script.d.ts +0 -22
- package/dist/server/preview/picker-script.js +3 -1
- package/dist/server/preview/picker-script.js.map +1 -1
- package/dist/server/provider-telemetry.d.ts +3 -1
- package/dist/server/provider-telemetry.js +4 -2
- package/dist/server/provider-telemetry.js.map +1 -1
- package/dist/server/repo-sync.js +5 -10
- package/dist/server/repo-sync.js.map +1 -1
- package/dist/server/server.d.ts +1854 -1854
- package/dist/server/server.js +7 -2
- package/dist/server/server.js.map +1 -1
- package/dist/server/worktree-lifecycle.d.ts +8 -8
- package/dist/telemetry.js +3 -1
- package/dist/telemetry.js.map +1 -1
- package/dist/workflows/continuation-context.d.ts +3 -1
- package/dist/workflows/continuation-context.js +22 -3
- package/dist/workflows/continuation-context.js.map +1 -1
- package/dist/workflows/run.d.ts +20 -9
- package/dist/workflows/run.js +49 -11
- package/dist/workflows/run.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-copilot-acp.mjs +4 -0
- package/web/dist/assets/{agent-task-pickers-DEW3Vgdv.js → agent-task-pickers-CNuwgeJL.js} +1 -1
- package/web/dist/assets/{automations-route-Cx7mzYhD.js → automations-route-Cs1tsu1W.js} +1 -1
- package/web/dist/assets/{commit-list-xMdmPYbz.js → commit-list-Ti2arrt8.js} +1 -1
- package/web/dist/assets/{compare-variants-B6ja1M4D.js → compare-variants-CdchlJMs.js} +1 -1
- package/web/dist/assets/{dashboard-ClEGBFFq.js → dashboard-wi0EQack.js} +2 -2
- package/web/dist/assets/{file-preview-iucr8WDo.js → file-preview-pS9i9ZDR.js} +1 -1
- package/web/dist/assets/git-tab-loading-BC6WP7W4.js +1 -0
- package/web/dist/assets/{git-toolbar-DU5Ca6RI.js → git-toolbar-Dra1QlHb.js} +1 -1
- package/web/dist/assets/github-DZcdhMzw.js +1 -0
- package/web/dist/assets/{host-usage-DjDYDU0A.js → host-usage-DnkXF0CT.js} +1 -1
- package/web/dist/assets/index-qeFtKZ4e.js +22 -0
- package/web/dist/assets/{layout-cards-Sur4EWtx.js → layout-cards-CXMlrDUf.js} +1 -1
- package/web/dist/assets/{project-router-DZsR9P9C.js → project-router-CZzr7lzN.js} +2 -2
- package/web/dist/assets/queries-Bn7zl9OU.js +1 -0
- package/web/dist/assets/{reference-chip-DnemrSPW.js → reference-chip-CScP5y_O.js} +1 -1
- package/web/dist/assets/repo-git-CV-yXaSx.js +1 -0
- package/web/dist/assets/{run-diff-BPZ85gAE.js → run-diff-GHEaeAio.js} +2 -2
- package/web/dist/assets/{skills-BgCN1gTp.js → skills-DuSNv5op.js} +1 -1
- package/web/dist/assets/{task-commits-W1ZZiEt4.js → task-commits-D_gLpFQo.js} +1 -1
- package/web/dist/assets/{task-graph-DI2fn5M8.js → task-graph-BgHk8Y3v.js} +1 -1
- package/web/dist/assets/{task-notes-lmvd1UM7.js → task-notes-BBp0rdzM.js} +1 -1
- package/web/dist/assets/task-workspace-Cr9AjTxP.js +27 -0
- package/web/dist/assets/{terminal-drawer-DAkquqSe.js → terminal-drawer-CcPOjWwP.js} +2 -2
- package/web/dist/assets/{tracker-Cqdpt9RN.js → tracker-BHwMGsDY.js} +2 -2
- package/web/dist/assets/use-automations-Dh3Wj-79.js +5 -0
- package/web/dist/assets/{use-now-pBdvhv13.js → use-now-BB7W0F--.js} +1 -1
- package/web/dist/assets/{workflow-graph-l7O50dsV.js → workflow-graph-CcOTCItr.js} +3 -3
- package/web/dist/assets/worktree-lifecycle-operation-vTgExKUM.js +18 -0
- package/web/dist/index.html +10 -10
- package/web/dist/assets/git-tab-loading-BfC2ir8N.js +0 -1
- package/web/dist/assets/github-CELdSmld.js +0 -1
- package/web/dist/assets/index-BBND6Sg3.js +0 -22
- package/web/dist/assets/queries-CI0EmEcH.js +0 -1
- package/web/dist/assets/repo-git-Bj0PBOjX.js +0 -1
- package/web/dist/assets/task-workspace-B8Fpho3e.js +0 -27
- package/web/dist/assets/use-automations-v77gHYDG.js +0 -5
- package/web/dist/assets/worktree-lifecycle-operation-DOTiqQFx.js +0 -18
|
@@ -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{Fr as r,Hn as i,Ir as a,Sa as o,Vn as s,X as c,Xn as l,_a as u,ba as d,ei as f,ti as p,va as m,ya as h}from"./queries-CI0EmEcH.js";import{A as g,B as _,C as v,D as y,E as b,F as x,N as S,S as C,T as w,_ as ee,a as te,c as ne,d as re,g as ie,h as ae,i as T,l as oe,m as se,o as E,r as D,s as ce,t as le,u as ue,v as de,x as fe,y as pe}from"./button-Clwd6u4_.js";import{a as O,c as me,l as k,o as he,s as ge}from"./tooltip-B628Gs7C.js";import{t as A}from"./circle-check-DnEaQ9Rj.js";import{n as _e,r as ve,t as ye}from"./triangle-alert-BqI_9MkV.js";import{t as be}from"./git-pull-request-draft-Cn24ayXz.js";import{t as xe}from"./x-DMIsmLBt.js";import{i as Se}from"./token-metrics-Dk2ZNHb_.js";var j={all:(e=_())=>[`worktree-lifecycle`,e],list:(e=_())=>[...j.all(e),`list`],detail:(e,t=_())=>[...j.all(t),`worktree`,e],operation:(e,t=_())=>[...j.all(t),`operation`,e],output:(e,t=_())=>[...j.all(t),`output`,e]};function Ce(){return u(),d({queryKey:j.list(),queryFn:async({signal:e})=>{let t=await f({limit:100},{signal:e}),n=new Map(t.worktrees.map(e=>[e.worktreeId,e])),r=new Set,i=t.nextCursor;for(;i&&!r.has(i);){r.add(i);let t=await f({limit:100,cursor:i},{signal:e});for(let e of t.worktrees)n.set(e.worktreeId,e);i=t.nextCursor}return{worktrees:[...n.values()]}}})}function we(e,t=!0){return u(),d({queryKey:j.detail(e),enabled:t,queryFn:({signal:t})=>p(e,{signal:t})})}function Te(e){return u(),d({queryKey:j.operation(e),queryFn:({signal:t})=>r(e,{signal:t})})}function Ee(e,t){return u(),m({queryKey:j.output(e),enabled:t,initialPageParam:0,queryFn:({signal:t,pageParam:n})=>a(e,n,{signal:t}),getNextPageParam:e=>e.items.length>=100?e.nextSeq:void 0,maxPages:5})}function De(e){let t=o();u();let n=_();return h({mutationFn:t=>l(e,t),onSuccess:r=>{t.setQueryData(j.operation(e,n),r),t.invalidateQueries({queryKey:j.all(n)}),t.invalidateQueries({queryKey:[`runs`,n]}),t.invalidateQueries({queryKey:[`worktrees`,n]})},onError:()=>{t.invalidateQueries({queryKey:j.operation(e,n)})}})}var M=x(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),N=x(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),P=x(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),F=x(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Oe=x(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),ke=x(`message-square-warning`,[[`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:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),Ae=x(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),I=e(t(),1),L=n(),R=`Popover`,[z,je]=b(R,[k]),B=k(),[Me,V]=z(R),H=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=B(t),c=I.useRef(null),[l,u]=I.useState(!1),[d,f]=v({prop:r,defaultProp:i??!1,onChange:a,caller:R});return(0,L.jsx)(me,{...s,children:(0,L.jsx)(Me,{scope:t,contentId:fe(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:I.useCallback(()=>u(!0),[]),onCustomAnchorRemove:I.useCallback(()=>u(!1),[]),modal:o,children:n})})};H.displayName=R;var U=`PopoverAnchor`,W=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(U,n),a=B(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return I.useEffect(()=>(o(),()=>s()),[o,s]),(0,L.jsx)(O,{...a,...r,ref:t})});W.displayName=U;var G=`PopoverTrigger`,K=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(G,n),a=B(n),o=S(t,i.triggerRef),s=(0,L.jsx)(y.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Ue(i.open),...r,ref:o,onClick:w(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,L.jsx)(O,{asChild:!0,...a,children:s})});K.displayName=G;var q=`PopoverPortal`,[Ne,Pe]=z(q,{forceMount:void 0}),J=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=V(q,t);return(0,L.jsx)(Ne,{scope:t,forceMount:n,children:(0,L.jsx)(C,{present:n||a.open,children:(0,L.jsx)(ee,{asChild:!0,container:i,children:r})})})};J.displayName=q;var Y=`PopoverContent`,X=I.forwardRef((e,t)=>{let n=Pe(Y,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=V(Y,e.__scopePopover);return(0,L.jsx)(C,{present:r||a.open,children:a.modal?(0,L.jsx)(Ie,{...i,ref:t}):(0,L.jsx)(Le,{...i,ref:t})})});X.displayName=Y;var Fe=g(`PopoverContent.RemoveScroll`),Ie=I.forwardRef((e,t)=>{let n=V(Y,e.__scopePopover),r=I.useRef(null),i=S(t,r),a=I.useRef(!1);return I.useEffect(()=>{let e=r.current;if(e)return se(e)},[]),(0,L.jsx)(ae,{as:Fe,allowPinchZoom:!0,children:(0,L.jsx)(Re,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:w(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Le=I.forwardRef((e,t)=>{let n=V(Y,e.__scopePopover),r=I.useRef(!1),i=I.useRef(!1);return(0,L.jsx)(Re,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Re=I.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=V(Y,n),p=B(n);return ie(),(0,L.jsx)(de,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(pe,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,L.jsx)(ge,{"data-state":Ue(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ze=`PopoverClose`,Be=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(ze,n);return(0,L.jsx)(y.button,{type:`button`,...r,ref:t,onClick:w(e.onClick,()=>i.onOpenChange(!1))})});Be.displayName=ze;var Ve=`PopoverArrow`,He=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=B(n);return(0,L.jsx)(he,{...i,...r,ref:t})});He.displayName=Ve;function Ue(e){return e?`open`:`closed`}var We=H,Ge=W,Ke=K,qe=J,Je=X;function Ye({...e}){return(0,L.jsx)(te,{"data-slot":`dialog`,...e})}function Xe({...e}){return(0,L.jsx)(ue,{"data-slot":`dialog-portal`,...e})}function Ze({className:e,...t}){return(0,L.jsx)(oe,{"data-slot":`dialog-overlay`,className:D(`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 Qe({className:e,children:t,showCloseButton:n=!0,...r}){return(0,L.jsxs)(Xe,{"data-slot":`dialog-portal`,children:[(0,L.jsx)(Ze,{}),(0,L.jsxs)(ce,{"data-slot":`dialog-content`,className:D(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,L.jsxs)(E,{"data-slot":`dialog-close`,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-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,L.jsx)(xe,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function $e({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`dialog-header`,className:D(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function et({className:e,showCloseButton:t=!1,children:n,...r}){return(0,L.jsxs)(`div`,{"data-slot":`dialog-footer`,className:D(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,L.jsx)(E,{asChild:!0,children:(0,L.jsx)(le,{variant:`outline`,children:`Close`})})]})}function tt({className:e,...t}){return(0,L.jsx)(re,{"data-slot":`dialog-title`,className:D(`text-lg leading-none font-semibold`,e),...t})}function nt({className:e,...t}){return(0,L.jsx)(ne,{"data-slot":`dialog-description`,className:D(`text-sm text-muted-foreground`,e),...t})}var rt=(0,I.createContext)(null);function it({children:e}){let[t,n]=(0,I.useState)(()=>new Map),r=(0,I.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,I.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=c((0,I.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,I.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,L.jsx)(rt.Provider,{value:o,children:e})}var Z=(0,I.createContext)(null);function at({projectId:e,requests:t,children:n}){let r=(0,I.useContext)(rt),i=(0,I.useId)(),a=t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`),o=r?.publish,s=r?.retract;(0,I.useEffect)(()=>{if(!(!o||!s))return o(i,t),()=>s(i)},[o,s,i,a]);let l=c(r?ot:t),u=r?.lookup??l,d=(0,I.useMemo)(()=>({lookup:u,projectId:e}),[u,e]);return(0,L.jsx)(Z.Provider,{value:d,children:n})}var ot=[];function st(e,t,n){let r=(0,I.useContext)(Z),i=n??r?.projectId;return!r||!i||t===void 0?lt:r.lookup({projectId:i,kind:e,number:t})}function ct(){let e=(0,I.useContext)(Z);return{lookup:e?.lookup??(()=>lt),projectId:e?.projectId}}var lt=Object.freeze({state:`idle`});function Q(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function ut(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=Q(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(Q(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function dt(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:Q(e)}:{top:0,bottom:0}}function ft(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function pt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(dt(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function mt(){let[e,t]=(0,I.useState)({top:0,bottom:0});return(0,I.useEffect)(()=>pt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function ht(e){let t=(0,I.useRef)(e);t.current=e,(0,I.useEffect)(()=>{let e=document.documentElement;return ut(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}function gt({...e}){return(0,L.jsx)(We,{"data-slot":`popover`,...e})}function _t({...e}){return(0,L.jsx)(Ke,{"data-slot":`popover-trigger`,...e})}function vt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,...i}){let a=mt();return(0,L.jsx)(qe,{children:(0,L.jsx)(Je,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:ft(a,r),className:D(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...i})})}function yt({...e}){return(0,L.jsx)(Ge,{"data-slot":`popover-anchor`,...e})}var bt={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,violet:`border-violet/35 text-violet`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},xt={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,violet:`hover:bg-violet/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},St={draft:be,"review-required":_e,"changes-requested":ke,"checks-pending":null,"checks-failing":F,ready:A,merged:ve,closed:Oe,open:N,completed:A,"not-planned":P};function Ct({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:a,projectId:o,className:c,compact:l=!1}){let{kind:u,number:d,url:f}=e,p=st(u,d,o),m=n??p.status,h=i(m),g=u===`PR`&&(r??p.conflicting)===!0,_=g?s:h,v=D(`inline-flex h-[22px] items-center gap-1 rounded-full border px-2 font-mono text-[11px] font-semibold`,bt[_?.tone??`violet`],c),y=Ot(p,_,g?h:void 0),b=d?`${!l&&u===`Issue`?`Issue `:``}#${d}`:u,x=u===`PR`?`pull request`:`issue`,S=`Open the ${x} for ${t}${_?` — ${_.label}`:``}`,C=(0,L.jsxs)(L.Fragment,{children:[g?(0,L.jsx)(ye,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,L.jsx)(At,{status:_?m:void 0}),b]}),w=!f||!T(f)?(0,L.jsx)(`span`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,...g?{"data-conflicting":`true`}:{},"aria-label":_?`${x} ${b} — ${_.label}`:void 0,className:v,children:C}):(0,L.jsxs)(`a`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,...g?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:y?void 0:f,"aria-label":S,className:D(v,xt[_?.tone??`violet`]),children:[C,(0,L.jsx)(M,{className:`size-2.5`,"aria-hidden":`true`})]});if(!y)return w;let ee=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`block font-medium`,children:[u===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,y.headline]}),(0,L.jsx)(`span`,{className:`block`,children:y.detail}),y.also?(0,L.jsx)(`span`,{className:`block opacity-70`,children:y.also}):null,f&&T(f)?(0,L.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,L.jsx)(Dt,{chip:w,action:g?a:void 0,state:p.state,children:ee})}var wt=(0,I.createContext)(()=>{});function Tt(){return(0,I.useContext)(wt)}var Et=150,$=120;function Dt({chip:e,action:t,state:n,children:r}){let[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(null),s=(0,I.useRef)(null),c=(0,I.useRef)(void 0),l=(0,I.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,I.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,I.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,L.jsxs)(gt,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,L.jsx)(yt,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Et)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,$)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,L.jsxs)(vt,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,$)},children:[(0,L.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,L.jsx)(wt.Provider,{value:u,children:t}):null]})]})}function Ot(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${kt(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function kt(e){return e.charAt(0).toLowerCase()+e.slice(1)}function At({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,L.jsx)(Se,{tone:`pending`,pulse:!0,className:`size-[6px]`,"aria-hidden":`true`});let t=St[e];return t?(0,L.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}export{j as C,we as D,Ee as E,Ce as O,M as S,Te as T,tt as _,vt as a,P as b,at as c,ct as d,Ye as f,$e as g,et as h,yt as i,it as l,nt as m,Tt as n,_t as o,Qe as p,gt as r,ht as s,Ct as t,st as u,Ae as v,De as w,N as x,F as y};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Fr as r,Hn as i,Ir as a,Vn as o,X as s,Xn as c,_a as l,ei as u,ga as d,ti as f,va as p,xa as m,ya as h}from"./queries-Bn7zl9OU.js";import{A as g,B as _,C as v,D as y,E as b,F as x,N as S,S as C,T as w,_ as ee,a as te,c as ne,d as re,g as ie,h as ae,i as T,l as oe,m as se,o as E,r as D,s as ce,t as le,u as ue,v as de,x as fe,y as pe}from"./button-Clwd6u4_.js";import{a as O,c as me,l as k,o as he,s as ge}from"./tooltip-B628Gs7C.js";import{t as A}from"./circle-check-DnEaQ9Rj.js";import{n as _e,r as ve,t as ye}from"./triangle-alert-BqI_9MkV.js";import{t as be}from"./git-pull-request-draft-Cn24ayXz.js";import{t as xe}from"./x-DMIsmLBt.js";import{i as Se}from"./token-metrics-Dk2ZNHb_.js";var j={all:(e=_())=>[`worktree-lifecycle`,e],list:(e=_())=>[...j.all(e),`list`],detail:(e,t=_())=>[...j.all(t),`worktree`,e],operation:(e,t=_())=>[...j.all(t),`operation`,e],output:(e,t=_())=>[...j.all(t),`output`,e]};function Ce(){return d(),h({queryKey:j.list(),queryFn:async({signal:e})=>{let t=await u({limit:100},{signal:e}),n=new Map(t.worktrees.map(e=>[e.worktreeId,e])),r=new Set,i=t.nextCursor;for(;i&&!r.has(i);){r.add(i);let t=await u({limit:100,cursor:i},{signal:e});for(let e of t.worktrees)n.set(e.worktreeId,e);i=t.nextCursor}return{worktrees:[...n.values()]}}})}function we(e,t=!0){return d(),h({queryKey:j.detail(e),enabled:t,queryFn:({signal:t})=>f(e,{signal:t})})}function Te(e){return d(),h({queryKey:j.operation(e),queryFn:({signal:t})=>r(e,{signal:t})})}function Ee(e,t){return d(),l({queryKey:j.output(e),enabled:t,initialPageParam:0,queryFn:({signal:t,pageParam:n})=>a(e,n,{signal:t}),getNextPageParam:e=>e.items.length>=100?e.nextSeq:void 0,maxPages:5})}function De(e){let t=m();d();let n=_();return p({mutationFn:t=>c(e,t),onSuccess:r=>{t.setQueryData(j.operation(e,n),r),t.invalidateQueries({queryKey:j.all(n)}),t.invalidateQueries({queryKey:[`runs`,n]}),t.invalidateQueries({queryKey:[`worktrees`,n]})},onError:()=>{t.invalidateQueries({queryKey:j.operation(e,n)})}})}var M=x(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),N=x(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),P=x(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),F=x(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Oe=x(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),ke=x(`message-square-warning`,[[`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:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]),Ae=x(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),I=e(t(),1),L=n(),R=`Popover`,[z,je]=b(R,[k]),B=k(),[Me,V]=z(R),H=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=B(t),c=I.useRef(null),[l,u]=I.useState(!1),[d,f]=v({prop:r,defaultProp:i??!1,onChange:a,caller:R});return(0,L.jsx)(me,{...s,children:(0,L.jsx)(Me,{scope:t,contentId:fe(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:I.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:I.useCallback(()=>u(!0),[]),onCustomAnchorRemove:I.useCallback(()=>u(!1),[]),modal:o,children:n})})};H.displayName=R;var U=`PopoverAnchor`,W=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(U,n),a=B(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return I.useEffect(()=>(o(),()=>s()),[o,s]),(0,L.jsx)(O,{...a,...r,ref:t})});W.displayName=U;var G=`PopoverTrigger`,K=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(G,n),a=B(n),o=S(t,i.triggerRef),s=(0,L.jsx)(y.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Ue(i.open),...r,ref:o,onClick:w(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,L.jsx)(O,{asChild:!0,...a,children:s})});K.displayName=G;var q=`PopoverPortal`,[Ne,Pe]=z(q,{forceMount:void 0}),J=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=V(q,t);return(0,L.jsx)(Ne,{scope:t,forceMount:n,children:(0,L.jsx)(C,{present:n||a.open,children:(0,L.jsx)(ee,{asChild:!0,container:i,children:r})})})};J.displayName=q;var Y=`PopoverContent`,X=I.forwardRef((e,t)=>{let n=Pe(Y,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=V(Y,e.__scopePopover);return(0,L.jsx)(C,{present:r||a.open,children:a.modal?(0,L.jsx)(Ie,{...i,ref:t}):(0,L.jsx)(Le,{...i,ref:t})})});X.displayName=Y;var Fe=g(`PopoverContent.RemoveScroll`),Ie=I.forwardRef((e,t)=>{let n=V(Y,e.__scopePopover),r=I.useRef(null),i=S(t,r),a=I.useRef(!1);return I.useEffect(()=>{let e=r.current;if(e)return se(e)},[]),(0,L.jsx)(ae,{as:Fe,allowPinchZoom:!0,children:(0,L.jsx)(Re,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:w(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),Le=I.forwardRef((e,t)=>{let n=V(Y,e.__scopePopover),r=I.useRef(!1),i=I.useRef(!1);return(0,L.jsx)(Re,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),Re=I.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=V(Y,n),p=B(n);return ie(),(0,L.jsx)(de,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(pe,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,L.jsx)(ge,{"data-state":Ue(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ze=`PopoverClose`,Be=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=V(ze,n);return(0,L.jsx)(y.button,{type:`button`,...r,ref:t,onClick:w(e.onClick,()=>i.onOpenChange(!1))})});Be.displayName=ze;var Ve=`PopoverArrow`,He=I.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=B(n);return(0,L.jsx)(he,{...i,...r,ref:t})});He.displayName=Ve;function Ue(e){return e?`open`:`closed`}var We=H,Ge=W,Ke=K,qe=J,Je=X;function Ye({...e}){return(0,L.jsx)(te,{"data-slot":`dialog`,...e})}function Xe({...e}){return(0,L.jsx)(ue,{"data-slot":`dialog-portal`,...e})}function Ze({className:e,...t}){return(0,L.jsx)(oe,{"data-slot":`dialog-overlay`,className:D(`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 Qe({className:e,children:t,showCloseButton:n=!0,...r}){return(0,L.jsxs)(Xe,{"data-slot":`dialog-portal`,children:[(0,L.jsx)(Ze,{}),(0,L.jsxs)(ce,{"data-slot":`dialog-content`,className:D(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,L.jsxs)(E,{"data-slot":`dialog-close`,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-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,L.jsx)(xe,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function $e({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`dialog-header`,className:D(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function et({className:e,showCloseButton:t=!1,children:n,...r}){return(0,L.jsxs)(`div`,{"data-slot":`dialog-footer`,className:D(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,L.jsx)(E,{asChild:!0,children:(0,L.jsx)(le,{variant:`outline`,children:`Close`})})]})}function tt({className:e,...t}){return(0,L.jsx)(re,{"data-slot":`dialog-title`,className:D(`text-lg leading-none font-semibold`,e),...t})}function nt({className:e,...t}){return(0,L.jsx)(ne,{"data-slot":`dialog-description`,className:D(`text-sm text-muted-foreground`,e),...t})}var rt=(0,I.createContext)(null);function it({children:e}){let[t,n]=(0,I.useState)(()=>new Map),r=(0,I.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,I.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=s((0,I.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,I.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,L.jsx)(rt.Provider,{value:o,children:e})}var Z=(0,I.createContext)(null);function at({projectId:e,requests:t,children:n}){let r=(0,I.useContext)(rt),i=(0,I.useId)(),a=t.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`),o=r?.publish,c=r?.retract;(0,I.useEffect)(()=>{if(!(!o||!c))return o(i,t),()=>c(i)},[o,c,i,a]);let l=s(r?ot:t),u=r?.lookup??l,d=(0,I.useMemo)(()=>({lookup:u,projectId:e}),[u,e]);return(0,L.jsx)(Z.Provider,{value:d,children:n})}var ot=[];function st(e,t,n){let r=(0,I.useContext)(Z),i=n??r?.projectId;return!r||!i||t===void 0?lt:r.lookup({projectId:i,kind:e,number:t})}function ct(){let e=(0,I.useContext)(Z);return{lookup:e?.lookup??(()=>lt),projectId:e?.projectId}}var lt=Object.freeze({state:`idle`});function Q(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function ut(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=Q(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(Q(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function dt(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:Q(e)}:{top:0,bottom:0}}function ft(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function pt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(dt(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function mt(){let[e,t]=(0,I.useState)({top:0,bottom:0});return(0,I.useEffect)(()=>pt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function ht(e){let t=(0,I.useRef)(e);t.current=e,(0,I.useEffect)(()=>{let e=document.documentElement;return ut(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}function gt({...e}){return(0,L.jsx)(We,{"data-slot":`popover`,...e})}function _t({...e}){return(0,L.jsx)(Ke,{"data-slot":`popover-trigger`,...e})}function vt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,...i}){let a=mt();return(0,L.jsx)(qe,{children:(0,L.jsx)(Je,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:ft(a,r),className:D(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...i})})}function yt({...e}){return(0,L.jsx)(Ge,{"data-slot":`popover-anchor`,...e})}var bt={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,violet:`border-violet/35 text-violet`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},xt={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,violet:`hover:bg-violet/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},St={draft:be,"review-required":_e,"changes-requested":ke,"checks-pending":null,"checks-failing":F,ready:A,merged:ve,closed:Oe,open:N,completed:A,"not-planned":P};function Ct({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:a,projectId:s,className:c,compact:l=!1}){let{kind:u,number:d,url:f}=e,p=st(u,d,s),m=n??p.status,h=i(m),g=u===`PR`&&(r??p.conflicting)===!0,_=g?o:h,v=D(`inline-flex h-[22px] items-center gap-1 rounded-full border px-2 font-mono text-[11px] font-semibold`,bt[_?.tone??`violet`],c),y=Ot(p,_,g?h:void 0),b=d?`${!l&&u===`Issue`?`Issue `:``}#${d}`:u,x=u===`PR`?`pull request`:`issue`,S=`Open the ${x} for ${t}${_?` — ${_.label}`:``}`,C=(0,L.jsxs)(L.Fragment,{children:[g?(0,L.jsx)(ye,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,L.jsx)(At,{status:_?m:void 0}),b]}),w=!f||!T(f)?(0,L.jsx)(`span`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,...g?{"data-conflicting":`true`}:{},"aria-label":_?`${x} ${b} — ${_.label}`:void 0,className:v,children:C}):(0,L.jsxs)(`a`,{"data-slot":u===`PR`?`pr-chip`:`issue-chip`,"data-status":m,...g?{"data-conflicting":`true`}:{},href:f,target:`_blank`,rel:`noopener noreferrer`,title:y?void 0:f,"aria-label":S,className:D(v,xt[_?.tone??`violet`]),children:[C,(0,L.jsx)(M,{className:`size-2.5`,"aria-hidden":`true`})]});if(!y)return w;let ee=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:`block font-medium`,children:[u===`PR`?`Pull request`:`Issue`,d?` #${d}`:``,` · `,y.headline]}),(0,L.jsx)(`span`,{className:`block`,children:y.detail}),y.also?(0,L.jsx)(`span`,{className:`block opacity-70`,children:y.also}):null,f&&T(f)?(0,L.jsx)(`span`,{className:`block opacity-70`,children:f.replace(/^https?:\/\//,``)}):null]});return(0,L.jsx)(Dt,{chip:w,action:g?a:void 0,state:p.state,children:ee})}var wt=(0,I.createContext)(()=>{});function Tt(){return(0,I.useContext)(wt)}var Et=150,$=120;function Dt({chip:e,action:t,state:n,children:r}){let[i,a]=(0,I.useState)(!1),o=(0,I.useRef)(null),s=(0,I.useRef)(null),c=(0,I.useRef)(void 0),l=(0,I.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,I.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,I.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,L.jsxs)(gt,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,L.jsx)(yt,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Et)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,$)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,L.jsxs)(vt,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,$)},children:[(0,L.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,L.jsx)(wt.Provider,{value:u,children:t}):null]})]})}function Ot(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${kt(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function kt(e){return e.charAt(0).toLowerCase()+e.slice(1)}function At({status:e}){if(!e)return null;if(e===`checks-pending`)return(0,L.jsx)(Se,{tone:`pending`,pulse:!0,className:`size-[6px]`,"aria-hidden":`true`});let t=St[e];return t?(0,L.jsx)(t,{className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null}export{j as C,we as D,Ee as E,Ce as O,M as S,Te as T,tt as _,vt as a,P as b,at as c,ct as d,Ye as f,$e as g,et as h,yt as i,it as l,nt as m,Tt as n,_t as o,Qe as p,gt as r,ht as s,Ct as t,st as u,Ae as v,De as w,N as x,F as y};
|
|
@@ -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{C as r,Yn as i,_i as a,at as o,ct as s,fr as c,it as l,j as u,lt as d,ot as f,r as p,ut as m,va as h,xa as g}from"./queries-Bn7zl9OU.js";import{F as _,i as v,r as y,t as b}from"./button-Clwd6u4_.js";import{c as x,f as S,t as C,w}from"./project-router-CZzr7lzN.js";import{t as T}from"./use-desktop-BNN3U2y9.js";import{a as ee,c as te,i as ne,l as E,o as re,r as ie,t as ae,u as oe}from"./file-preview-pS9i9ZDR.js";import{t as D}from"./arrow-left-BELOeFyX.js";import{n as O,t as k}from"./file-1a6_DhLG.js";import{t as se}from"./check-Dt8U0Zvm.js";import{t as ce}from"./chevron-right-VbYrJ_st.js";import{c as A,d as j,f as le,o as ue,p as M,s as N,t as de,u as P}from"./git-toolbar-Dra1QlHb.js";import{n as F}from"./upload-J0hBTVF7.js";import{n as fe,t as I}from"./triangle-alert-BqI_9MkV.js";import{t as pe}from"./plus-CBVm02wz.js";import{t as L}from"./search-x-CuinYQnl.js";import{t as R}from"./input-DIWTlsx6.js";import{t as z}from"./diff-stat-CiWUpWY0.js";import{t as B}from"./centered-state-nM7v9xtl.js";import{a as me}from"./index-qeFtKZ4e.js";import{t as he}from"./markdown-BzqT8I8y.js";import{t as V}from"./diff-CJKocK17.js";import{t as H}from"./commit-list-Ti2arrt8.js";var ge=_(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),U=e(t(),1),W=n();function _e(){let e=s(),t=d();if(!e.data)return null;let n=e.data,r=e=>t.mutate(e,{onSuccess:e=>S(e.message),onError:e=>S(e.message,{tone:`danger`,expected:e instanceof i&&e.status===409})}),a=t.isPending,o=t.variables;return(0,W.jsxs)(`div`,{"data-slot":`repo-sync`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px]`,children:[n.upstream?(0,W.jsxs)(`span`,{"data-slot":`repo-upstream`,className:`truncate font-mono text-soft-foreground`,title:`Upstream`,children:[`→ `,n.upstream]}):n.branch?(0,W.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`not published`}):(0,W.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`detached HEAD`}),n.upstream?(0,W.jsx)(K,{ahead:n.ahead,behind:n.behind}):n.outgoing.length>0?(0,W.jsx)(K,{ahead:n.outgoing.length,behind:null}):null,(0,W.jsx)(`span`,{"data-slot":`repo-fetched`,className:`hidden text-soft-foreground sm:inline`,children:n.lastFetchedAt?`fetched ${ye(n.lastFetchedAt)}`:`never fetched`}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,W.jsx)(G,{which:`fetch`,label:`Fetch`,busy:a,pending:o,onClick:r,disabled:!n.pushRemote,children:(0,W.jsx)(P,{"aria-hidden":`true`,className:y(a&&o===`fetch`&&`animate-spin`)})}),n.upstream?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(G,{which:`pull`,label:`Pull`,busy:a,pending:o,onClick:r,disabled:!n.behind,children:(0,W.jsx)(oe,{"aria-hidden":`true`})}),(0,W.jsx)(G,{which:`push`,label:`Push`,busy:a,pending:o,onClick:r,disabled:!n.ahead,children:(0,W.jsx)(O,{"aria-hidden":`true`})}),(0,W.jsx)(G,{which:`sync`,label:`Sync`,busy:a,pending:o,onClick:r,disabled:!n.ahead&&!n.behind,variant:`outline`,children:(0,W.jsx)(P,{"aria-hidden":`true`,className:y(a&&o===`sync`&&`animate-spin`)})})]}):n.branch&&n.pushRemote?(0,W.jsx)(G,{which:`push`,label:`Publish branch`,busy:a,pending:o,onClick:r,variant:`outline`,children:(0,W.jsx)(ge,{"aria-hidden":`true`})}):null]})]})}function G({which:e,label:t,busy:n,pending:r,onClick:i,disabled:a,variant:o=`ghost`,children:s}){return(0,W.jsxs)(b,{variant:o,size:`sm`,"data-action":`repo-${e}`,"aria-busy":n&&r===e,disabled:n||a,onClick:()=>i(e),children:[s,t]})}function K({ahead:e,behind:t}){return e===null&&t===null?null:!e&&!t?(0,W.jsx)(`span`,{"data-slot":`sync-counts`,className:`text-soft-foreground`,children:`in sync`}):(0,W.jsxs)(`span`,{"data-slot":`sync-counts`,className:`flex items-center gap-1 font-mono`,children:[e?(0,W.jsxs)(`span`,{"data-sync":`ahead`,title:`${e} to push`,className:`text-primary`,children:[`↑`,e]}):null,t?(0,W.jsxs)(`span`,{"data-sync":`behind`,title:`${t} to pull`,className:`text-warning`,children:[`↓`,t]}):null]})}function ve({name:e,sync:t}){if(!t)return null;let n=t.branches.find(t=>t.name===e),r=n?n.gone?`upstream gone`:n.upstream?null:`local only`:`remote only`;return(0,W.jsx)(`span`,{"data-slot":`branch-tracking`,className:`flex shrink-0 items-center gap-1 text-[11px]`,children:r?(0,W.jsx)(`span`,{className:`text-soft-foreground`,children:r}):(0,W.jsx)(K,{ahead:n.ahead,behind:n.behind})})}function ye(e){let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/1e3));if(t<60)return`just now`;let n=Math.round(t/60);if(n<60)return`${n} min ago`;let r=Math.round(n/60);return r<24?`${r} h ago`:`${Math.round(r/24)} d ago`}function be({repo:e,info:t}){let n=u(),r=s(),i=g(),o=e=>S(e.message,{tone:`danger`}),l=h({mutationFn:e=>c({name:e}),onSuccess:async e=>{S(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([i.invalidateQueries({queryKey:p.repo}),i.invalidateQueries({queryKey:p.health})]),i.setQueryData(p.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),i.setQueryData(p.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:o}),d=h({mutationFn:e=>a({baseBranch:e}),onSuccess:e=>{S(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),i.invalidateQueries({queryKey:p.repo})},onError:o}),[f,m]=(0,U.useState)(``),[_,v]=(0,U.useState)(``),x=_.trim().toLowerCase(),C=x?e.branches.filter(e=>e.toLowerCase().includes(x)):e.branches;return(0,W.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Branches`}),(0,W.jsx)(R,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:_,onChange:e=>v(e.target.value),className:`mt-2 max-w-xl`}),(0,W.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[C.map(n=>{let i=n===t.branch,a=e.checkedOutElsewhere?.[n];return(0,W.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":n,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,W.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-xs`,i&&`font-semibold`),children:n}),(0,W.jsx)(ve,{name:n,sync:r.data}),i?(0,W.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,W.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`current`]}):a?(0,W.jsx)(`span`,{"data-slot":`branch-elsewhere`,title:`Checked out in ${a}`,className:`ml-auto shrink-0 text-[11px] text-soft-foreground`,children:`in another worktree`}):(0,W.jsx)(b,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:l.isPending,onClick:()=>l.mutate(n),children:`Switch`})]},n)}),C.length===0?(0,W.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,_.trim(),`”.`]}):null]}),(0,W.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=f.trim();t&&l.mutate(t,{onSuccess:()=>m(``)})},children:[(0,W.jsx)(R,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:f,onChange:e=>m(e.target.value)}),(0,W.jsxs)(b,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!f.trim()||l.isPending,children:[(0,W.jsx)(pe,{"aria-hidden":`true`}),`Create`]})]})]}),(0,W.jsxs)(`div`,{className:`max-w-md`,children:[(0,W.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Agents’ base branch`}),(0,W.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:d.isPending,onChange:e=>d.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,W.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]}),(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n.data?.forge?.available?(0,W.jsx)(xe,{}):null]})}function xe(){let e=r({limit:20});return(0,W.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,W.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,W.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,W.jsx)(Se,{pr:e},e.number))}):(0,W.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 Se({pr:e}){let t=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,W.jsx)(Ce,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,W.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:v(e.url)?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:y(n,`hover:bg-muted`),children:t}):(0,W.jsx)(`span`,{className:n,children:t})})}function Ce({checks:e}){return(0,W.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:y(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function we(){let e=o(),t=T(),[n,r]=(0,U.useState)(`unified`),[a,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(null),f=(0,U.useRef)(null),p=e.isError&&e.error instanceof i&&e.error.status===409,m=e.data?.files??[],h=(0,U.useMemo)(()=>ne(m),[m]),g=(0,U.useMemo)(()=>m.some(he),[m]),_=t?n:`unified`,v=!t||a;return(0,W.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.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,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,W.jsx)(de,{stat:e.data.stat}):null,(0,W.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,W.jsx)(N,{mode:n,wrap:a,preview:c,onModeChange:r,onWrapChange:s,onPreviewChange:g?l:void 0})})]}),e.isPending?(0,W.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,W.jsx)(B,{icon:p?(0,W.jsx)(M,{}):(0,W.jsx)(I,{}),tone:p?`neutral`:`danger`,heading:`h2`,title:p?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):m.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(M,{}),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,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 px-4 py-4 max-md:[--diff-sticky-top:7rem] md:px-6 md:py-0`,children:[(0,W.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`hidden w-60 shrink-0 overflow-y-auto overscroll-contain py-4 md:block lg:w-72`,children:(0,W.jsx)(re,{root:h,selected:u,onSelect:e=>{d(e),f.current?.scrollToPath(e)}})}),(0,W.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":t?``:void 0,className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,W.jsx)(V,{files:m,viewRef:f,mode:_,wrap:v,preview:t&&g&&c,className:`min-w-0 md:py-4`})})]})]})}function Te({log:e}){let{sha:t}=w(),n=s().data;if(t)return(0,W.jsx)(Ee,{sha:t});let r=new Set(n?.outgoing??[]),i=n?.incoming??[],a=(e,t)=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`,...t?{sync:t}:{}}),o=i.length>0?(0,W.jsxs)(`section`,{"data-slot":`repo-incoming`,className:`border-b border-border`,children:[(0,W.jsxs)(`h2`,{className:`px-4 pt-3 text-[11px] font-medium text-muted-foreground md:px-6`,children:[`Incoming from `,n?.upstream,` · `,i.length]}),(0,W.jsx)(H,{slot:`repo-incoming-commits`,commits:i.map(e=>a(e,`incoming`))})]}):null;return e.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,W.jsxs)(W.Fragment,{children:[o,(0,W.jsx)(H,{slot:`repo-commits`,commits:e.map(e=>a(e,r.has(e.hash)?`outgoing`:void 0))})]})}function Ee({sha:e}){let t=f(e),n=T(),[r,a]=(0,U.useState)(`unified`),[o,s]=(0,U.useState)(!1),c=t.isError&&t.error instanceof i&&t.error.status===409,l=n?r:`unified`,u=!n||o;return(0,W.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.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,W.jsx)(b,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,W.jsxs)(C,{to:`/git/commits`,children:[(0,W.jsx)(D,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,W.jsx)(z,{stat:t.data.stat}):null,(0,W.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,W.jsx)(N,{mode:r,wrap:o,onModeChange:a,onWrapChange:s})})]}),t.isPending?(0,W.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,W.jsx)(B,{icon:c?(0,W.jsx)(L,{}):(0,W.jsx)(I,{}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,W.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,W.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,W.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,W.jsx)(V,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function q(e,t){let n=0;for(let r of t){if(n=e.indexOf(r,n),n===-1)return!1;n+=r.length}return!0}function De(e,t,n){let r=t.trim().toLowerCase();if(r===``)return{results:[...e],total:e.length};let i=[];for(let t of e){let e=t.toLowerCase();if(!q(e,r))continue;let n=e.slice(e.lastIndexOf(`/`)+1);i.push({path:t,basenameMatch:q(n,r)})}return i.sort((e,t)=>e.basenameMatch===t.basenameMatch?e.path.length===t.path.length?e.path.localeCompare(t.path):e.path.length-t.path.length:e.basenameMatch?-1:1),{results:i.slice(0,n).map(e=>e.path),total:i.length}}var Oe=200;function ke({selected:e,onSelect:t}){let n=m(),r=n.isError&&n.error instanceof i&&n.error.status===409,a=n.data?.paths??[];return n.isPending?(0,W.jsx)(J,{children:(0,W.jsx)(`p`,{"data-slot":`repo-files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`})}):n.isError?(0,W.jsx)(J,{children:(0,W.jsx)(B,{icon:r?(0,W.jsx)(E,{}):(0,W.jsx)(I,{}),tone:r?`neutral`:`danger`,heading:`h2`,title:r?`No files to browse`:`Could not load the files`,subtitle:n.error.message})}):a.length===0?(0,W.jsx)(J,{children:(0,W.jsx)(B,{icon:(0,W.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`No files yet`,subtitle:`Nothing is tracked in this repository. Files show up here once git knows about them.`})}):(0,W.jsxs)(J,{children:[n.data.truncated?(0,W.jsxs)(`p`,{"data-slot":`repo-files-truncated`,role:`status`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground md:px-6`,children:[`Showing the first `,a.length.toLocaleString(),` files; this repository has more. The tree and the filter cover only what is loaded.`]}):null,(0,W.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,W.jsx)(`aside`,{"data-slot":`repo-files-tree-pane`,className:y(`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:block md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,e!==null&&`hidden`),children:(0,W.jsx)(Z,{paths:a,selected:e,onSelect:t})}),(0,W.jsxs)(`div`,{className:y(`min-w-0 flex-1`,e===null&&`hidden md:block`),children:[e===null?null:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`repo-files-back`,onClick:()=>t(null),className:`mb-2 flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground md:hidden`,children:[(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the file tree`]}),(0,W.jsx)(ae,{source:{kind:`repo`},path:e})]})]})]})}function J({children:e}){return(0,W.jsx)(`section`,{"data-slot":`repo-files`,className:`flex min-h-0 flex-1 flex-col`,children:e})}function Y(e){if(e===null)return[];let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function X(e,t,n){let r=[];for(let i of e.dirs){let e=t.has(i.path);r.push({kind:`dir`,path:i.path,name:i.name,level:n,open:e}),e&&r.push(...X(i,t,n+1))}for(let t of e.files)r.push({kind:`file`,path:t.path,name:t.name,level:n,label:t.name});return r}function Z({paths:e,selected:t,onSelect:n}){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(()=>new Set(Y(t))),[s,c]=(0,U.useState)(t),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=Y(t);e.length!==0&&o(t=>{if(e.every(e=>t.has(e)))return t;let n=new Set(t);for(let t of e)n.add(t);return n})},[t]);let u=r.trim()!==``,d=(0,U.useMemo)(()=>De(e,r,Oe),[e,r]),f=(0,U.useMemo)(()=>ee(e,(e,t)=>({kind:`file`,name:t,path:e})),[e]),p=(0,U.useMemo)(()=>u?d.results.map(e=>({kind:`file`,path:e,name:e.slice(e.lastIndexOf(`/`)+1),level:0,label:e})):X(f,a,0),[u,d.results,f,a]),m=p.find(e=>e.path===s)??p[0],h=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,W.jsxs)(`div`,{"data-slot":`repo-files-browser`,className:`flex min-w-0 flex-col gap-2`,onKeyDown:e=>{e.key!==`/`||e.target===l.current||(e.preventDefault(),l.current?.focus())},children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`label`,{htmlFor:`repo-files-filter`,className:`sr-only`,children:`Filter repository files`}),(0,W.jsx)(`input`,{id:`repo-files-filter`,ref:l,"data-slot":`repo-files-filter`,type:`search`,value:r,placeholder:`Filter files… (/)`,"aria-controls":`repo-files-tree`,autoComplete:`off`,spellCheck:!1,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(``))},className:`w-full rounded-sm border border-border bg-background px-2 py-1 text-xs placeholder:text-soft-foreground focus:border-foreground focus:outline-none`}),(0,W.jsx)(`p`,{"data-slot":`repo-files-count`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:u?`${d.total} files match ${r.trim()}`:`${e.length} files`})]}),u&&d.total===0?(0,W.jsxs)(`p`,{"data-slot":`repo-files-no-match`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[`No file matches `,(0,W.jsx)(`span`,{className:`font-mono`,children:r.trim()}),`.`]}):(0,W.jsx)(`div`,{id:`repo-files-tree`,"data-slot":`repo-files-tree`,"data-filtering":u?`true`:void 0,role:`tree`,"aria-label":`Repository files`,"aria-activedescendant":m?Q(m.path):void 0,onKeyDown:e=>{let t=p.findIndex(e=>e.path===m?.path),r=e=>{let t=p[Math.max(0,Math.min(p.length-1,e))];t&&c(t.path)},i=p[t];if(e.key===`ArrowDown`)e.preventDefault(),r(t+1);else if(e.key===`ArrowUp`)e.preventDefault(),r(t-1);else if(e.key===`ArrowRight`&&i?.kind===`dir`)e.preventDefault(),i.open?r(t+1):h(i.path);else if(e.key===`ArrowLeft`&&i!==void 0)if(e.preventDefault(),i.kind===`dir`&&i.open)h(i.path);else for(let e=t-1;e>=0;--e){let t=p[e];if(t.level<i.level){c(t.path);break}}else(e.key===`Enter`||e.key===` `)&&i!==void 0&&(e.preventDefault(),i.kind===`file`?n(i.path):h(i.path))},className:`min-w-0 text-[13px]`,children:p.map(e=>e.kind===`dir`?(0,W.jsx)(Ae,{row:e,focused:e.path===m?.path,onToggle:()=>{c(e.path),h(e.path)}},e.path):(0,W.jsx)(je,{row:e,active:e.path===t,focused:e.path===m?.path,onSelect:()=>{c(e.path),n(e.path)}},e.path))}),u&&d.total>d.results.length?(0,W.jsxs)(`p`,{"data-slot":`repo-files-more`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[(d.total-d.results.length).toLocaleString(),` more — refine the filter.`]}):null]})}var Q=e=>`repo-file-row-${e}`,$=(e,t)=>({paddingLeft:`${t+e*14}px`});function Ae({row:e,focused:t,onToggle:n}){return(0,W.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-expanded":e.open,"aria-level":e.level+1,"data-slot":`repo-files-dir`,"data-path":e.path,"data-state":e.open?`open`:`closed`,tabIndex:t?0:-1,onClick:n,className:`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground focus:bg-muted focus:outline-none`,style:$(e.level,6),children:[(0,W.jsx)(ce,{"aria-hidden":`true`,className:y(`size-3.5 shrink-0 transition-transform`,e.open&&`rotate-90`)}),(0,W.jsx)(le,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})}function je({row:e,active:t,focused:n,onSelect:r}){let i=ie(e.path)?te:k;return(0,W.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-level":e.level+1,"aria-selected":t,"aria-current":t?`true`:void 0,"data-slot":`repo-files-file`,"data-path":e.path,tabIndex:n?0:-1,onClick:r,className:y(`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted focus:outline-none`,t?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:$(e.level,24),children:[(0,W.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,title:e.label,children:e.label})]})}function Me({tab:e}){let t=l();if(t.isPending)return(0,W.jsx)(me,{});if(t.isError)return(0,W.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(B,{icon:(0,W.jsx)(I,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,W.jsx)(Ne,{repo:t.data,info:n,tab:e}):(0,W.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(B,{icon:(0,W.jsx)(j,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`The cockpit is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Ne({repo:e,info:t,tab:n}){return(0,W.jsxs)(`div`,{"data-route":`repo-git`,className:y(`flex min-h-full flex-col`,n===`changes`&&`md:h-full`),children:[(0,W.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,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,W.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,W.jsx)(ue,{branch:t.branch}),t.remote?(0,W.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-[11px] text-soft-foreground md:inline`,children:t.remote}):null]}),(0,W.jsx)(`div`,{className:`mt-1.5`,children:(0,W.jsx)(_e,{})}),(0,W.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,W.jsx)(A,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,W.jsx)(A,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,W.jsx)(A,{to:`/git/branches`,active:n===`branches`,children:`Branches`}),(0,W.jsx)(A,{to:`/git/files`,active:n===`files`,children:`Files`})]})]}),n===`changes`?(0,W.jsx)(we,{}):n===`commits`?(0,W.jsx)(Te,{log:e.log}):n===`files`?(0,W.jsx)(Pe,{}):(0,W.jsx)(be,{repo:e,info:t})]})}function Pe(){let e=w(),t=x();return(0,W.jsx)(ke,{selected:e[`*`]!==void 0&&e[`*`]!==``?e[`*`]:null,onSelect:e=>t(e===null?`/git/files`:`/git/files/${Fe(e)}`,{replace:!0})})}function Fe(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}export{Me as RepoGitRoute};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{
|
|
2
|
-
`)){if(h.test(i)){n={path:g(i),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]},t.push(n),r=!1;continue}if(n){if(!r){if(i.startsWith(`@@`))r=!0,n.lines.push(i);else if(i.startsWith(`rename from `))n.status=`renamed`,n.oldPath=_(i.slice(12));else if(i.startsWith(`rename to `))n.status=`renamed`,n.path=_(i.slice(10));else if(i.startsWith(`new file mode`))n.status=`added`;else if(i.startsWith(`deleted file mode`))n.status=`deleted`;else if(i.startsWith(`Binary files `)||i===`GIT binary patch`)n.binary=!0;else if(i.startsWith(`+++ `)){let e=v(i);e!==void 0&&(n.path=e)}else if(i.startsWith(`--- `)){let e=v(i);e!==void 0&&n.status===`deleted`&&(n.path=e)}continue}n.lines.push(i),i.startsWith(`+`)?n.additions+=1:i.startsWith(`-`)&&(n.deletions+=1)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function b(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var x=n(),S=20,C=300;function w({runId:e}){let t=
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{gt as r,r as i,xa as a}from"./queries-Bn7zl9OU.js";import{r as o,t as s}from"./button-Clwd6u4_.js";import{t as c}from"./chevron-right-VbYrJ_st.js";import{n as l,r as u,t as d}from"./collapsible-Bdyuw-he.js";import{a as f,i as p}from"./markdown-Rbaca31B.js";var m=e(t(),1),h=/^diff --git /;function g(e){let t=e.replace(h,``),n=t.lastIndexOf(` b/`);return _(n>=0?t.slice(n+3):t)}function _(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function v(e){let t=_(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function y(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
2
|
+
`)){if(h.test(i)){n={path:g(i),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]},t.push(n),r=!1;continue}if(n){if(!r){if(i.startsWith(`@@`))r=!0,n.lines.push(i);else if(i.startsWith(`rename from `))n.status=`renamed`,n.oldPath=_(i.slice(12));else if(i.startsWith(`rename to `))n.status=`renamed`,n.path=_(i.slice(10));else if(i.startsWith(`new file mode`))n.status=`added`;else if(i.startsWith(`deleted file mode`))n.status=`deleted`;else if(i.startsWith(`Binary files `)||i===`GIT binary patch`)n.binary=!0;else if(i.startsWith(`+++ `)){let e=v(i);e!==void 0&&(n.path=e)}else if(i.startsWith(`--- `)){let e=v(i);e!==void 0&&n.status===`deleted`&&(n.path=e)}continue}n.lines.push(i),i.startsWith(`+`)?n.additions+=1:i.startsWith(`-`)&&(n.deletions+=1)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function b(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var x=n(),S=20,C=300;function w({runId:e}){let t=a(),n=r(e);(0,m.useEffect)(()=>{t.invalidateQueries({queryKey:i.runs.diff(e)})},[t,e]);let o=(0,m.useMemo)(()=>y(n.data??``),[n.data]),[c,l]=(0,m.useState)(!1);if(n.isPending)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(n.isError)return(0,x.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:n.error.message});if(o.length===0)return(0,x.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:n.data.trim()||`(no changes)`});let u=b(o),d=c?o:o.slice(0,S);return(0,x.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,x.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,x.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,x.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,u.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.deletions]})]})]}),d.map(e=>(0,x.jsx)(E,{file:e},`${e.oldPath??``}→${e.path}`)),o.length>d.length?(0,x.jsxs)(s,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>l(!0),children:[`Show `,o.length-d.length,` more files`]}):null]})}var T={added:`added`,deleted:`deleted`,renamed:`renamed`};function E({file:e}){let[t,n]=(0,m.useState)(!0),r=T[e.status];return(0,x.jsxs)(d,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-border bg-card`,children:[(0,x.jsxs)(u,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,x.jsx)(c,{className:o(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,x.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,x.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`binary`}):null,(0,x.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] font-semibold tabular-nums`,children:[(0,x.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,x.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})]}),(0,x.jsx)(l,{children:(0,x.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,x.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,x.jsx)(D,{lines:e.lines})})})]})}function D({lines:e}){let[t,n]=(0,m.useState)(!1),r=t?e:e.slice(0,C),i=r.join(`
|
|
3
3
|
`),[a,s]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=!1;return p(i,`diff`).then(t=>{e||s({text:i,tokens:t.tokens})}),()=>{e=!0}},[i]);let c=a?.text===i?a.tokens:f(i,`diff`)?.tokens??null;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,x.jsxs)(`span`,{className:o(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,x.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>C?(0,x.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(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:t?`Show less`:`Show all ${e.length} lines`}):null]})}export{w as t};
|
|
@@ -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{Di as r,N as i,Nt as a,Pt as o,Qn as s,Qt as c,Sa as l,Ut as u,Yn as d,or as f,pr as p,qr as m,qt as h,r as g,xi as _,ya as v}from"./queries-CI0EmEcH.js";import{r as y,t as b}from"./button-Clwd6u4_.js";import{T as x,c as S,f as C,s as w,t as T}from"./project-router-DZsR9P9C.js";import{_ as E,f as D,g as O,h as k,m as A,p as j}from"./reference-chip-DnemrSPW.js";import{N as M,bn as N,fn as P,gn as F}from"./git-tab-loading-BfC2ir8N.js";import{t as I}from"./arrow-left-BELOeFyX.js";import{F as L,H as R,M as z,N as B}from"./worktree-lifecycle-operation-DOTiqQFx.js";import{t as V}from"./circle-check-DnEaQ9Rj.js";import{u as H}from"./git-toolbar-DU5Ca6RI.js";import{t as ee}from"./triangle-alert-BqI_9MkV.js";import{t as te}from"./input-DIWTlsx6.js";import{t as U}from"./centered-state-nM7v9xtl.js";import{D as W,l as G,s as ne}from"./index-BBND6Sg3.js";var K=e(t(),1),q=n(),J=[`.ai/cezar/skills/`,`.ai/skills/`,`.agents/skills/`];function Y({children:e}){return(0,q.jsx)(`span`,{className:`font-mono`,children:e})}function X(){return(0,q.jsx)(q.Fragment,{children:J.map((e,t)=>(0,q.jsxs)(`span`,{children:[t>0?t===J.length-1?`, or `:`, `:``,(0,q.jsx)(Y,{children:e})]},e))})}function re(){return(0,q.jsxs)(q.Fragment,{children:[`No skills yet. Drop Markdown files into `,(0,q.jsx)(X,{}),` (agent mirrors like`,` `,(0,q.jsx)(Y,{children:`.claude/skills/`}),` work too) — optional frontmatter: `,(0,q.jsx)(Y,{children:`name`}),`,`,` `,(0,q.jsx)(Y,{children:`description`}),`. Global (`,(0,q.jsx)(Y,{children:`~/.agents/skills`}),`) and team-repo skills appear here too — try Refresh.`]})}var ie=2e3,ae=5*6e4;async function oe(e,t,n={}){let{apply:r=s,read:i=m,wait:a=e=>new Promise(t=>setTimeout(t,e)),now:o=Date.now,onDropped:c=F}=n;try{return await r(e)}catch(n){if(!(n instanceof d)||n.status!==0&&n.status!==409)throw n;let r=e=>{n.status===0&&c(e)},s=o()+ae;for(;;){let c;try{c=await i(e)}catch{throw r(`unreachable`),n}if(c.status!==`updating`){if(c.updatedAt&&c.updatedAt!==t)return r(`recovered`),c;throw r(`not_applied`),n}if(o()>=s)throw r(`timed_out`),n;await a(ie)}}}function Z(e){return e===`project`?`Project installation`:`Global installation`}function se({projectId:e,state:t,loadError:n}){let r=l(),i=S(),a=(0,K.useRef)(0),[o,s]=(0,K.useState)(!1),u=v({mutationFn:()=>p({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=>{P(`skills_import`),s(!1),i(M(e))},onError:e=>C(e.message,{tone:`danger`})}),d=(t,n)=>{n.seq===a.current&&(r.setQueryData(c.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:g.skills}),C(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),s(!0)))},m=(e,t)=>{t.seq===a.current&&C(e.message,{tone:`danger`})},h=v({mutationFn:t=>f(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>m(e,t)}),_=v({mutationFn:t=>oe(e,t.previousUpdatedAt).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>m(e,t)}),x=e=>{let n=++a.current;e===`apply`?_.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):h.mutate({action:e,seq:n})},w=t?.scopes??[],T=w.filter(e=>e.skills.length>0),N=T.length>0,F=t?.status===`error`,I=N&&(t?.available||F),L=_.isPending||t?.status===`updating`,R=w.filter(e=>e.status===`error`||e.status===`unavailable`),z=w.filter(e=>e.updatedAt&&!R.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`&&!N?B=t.needsUpgradeNotes?`Skill files were updated.`:`No installed Open Mercato skills are tracked for updates.`: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,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`rounded-lg border border-border bg-muted/30 p-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,T.length>0?(0,q.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:T.map(e=>(0,q.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,R.length>0?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,R.map(e=>Z(e.scope)).join(`, `),z.length?`; updated: `+z.map(e=>Z(e.scope)).join(`, `):``,`.`]}):null]}),I?(0,q.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:L,onClick:()=>x(`apply`),children:[(0,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3.5`,L&&`motion-safe:animate-spin`)}),L?`Updating…`:F?`Retry`:`Update now`]}):t?.status===`current`?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:h.isPending,onClick:()=>x(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:h.isPending,onClick:()=>x(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,q.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,q.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,q.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,q.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,q.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,q.jsx)(D,{open:o,onOpenChange:e=>u.isPending?void 0:s(e),children:(0,q.jsxs)(j,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,q.jsxs)(O,{children:[(0,q.jsx)(E,{children:`Apply the upgrade notes now?`}),(0,q.jsxs)(A,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,q.jsxs)(k,{children:[(0,q.jsx)(b,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>s(!1),children:`No`}),(0,q.jsx)(b,{type:`button`,disabled:u.isPending,onClick:()=>u.mutate(),children:u.isPending?`Starting…`:`Yes, start session`})]})]})})]})}function Q(e,t){let n=e?.importedSkills;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&!!e):[...t]}function $(e,t,n,r,i=!1){let a=e.source===`ai`||e.source===`cezar`||e.source===`agents`||e.source===`global`,o=e.source===`team`&&(t.has(e.name)||i);if(!(!a&&!o))return{ariaLabel:a?`${e.name} is always enabled`:`${e.enabled?`Disable`:`Enable`} ${e.name}`,checked:a||e.enabled,disabled:a||n||i,onCheckedChange:()=>r(e.name)}}function ce(){return(0,q.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,q.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,q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,q.jsx)(le,{})]})}function le(){let e=w()??``,t=o(e,!!e),n=a(),s=h(),c=i(),[d]=x(),[f,p]=(0,K.useState)(``),m=l(),S=u(),E=c.data??[],D=(0,K.useMemo)(()=>E.map(e=>e.name),[E]),O=(0,K.useMemo)(()=>new Set(D),[D]),k=(0,K.useMemo)(()=>new Set(Q(S.data,D)),[S.data,D]),A=(0,K.useRef)(Promise.resolve()),j=(0,K.useRef)(0),M=(0,K.useCallback)(t=>{let n=g.uiState,r=g.skills,i=m.getQueryData(n),a=Q(i,D),o=a.includes(t)?a.filter(e=>e!==t):[...a,t];m.setQueryData(n,{...i,importedSkills:o});let s=++j.current;A.current=A.current.then(async()=>{try{let t=await _({importedSkills:o},e);if(s!==j.current)return;m.setQueryData(n,t),m.invalidateQueries({queryKey:r})}catch(e){if(s!==j.current)return;C(e instanceof Error?e.message:String(e),{tone:`danger`}),m.invalidateQueries({queryKey:n})}})},[D,e,m]),P=v({mutationFn:()=>r(),onSuccess:e=>{m.setQueryData(g.skills,e),C(`Team skills refreshed.`)},onError:e=>C(e.message,{tone:`danger`})});if(n.isError)return(0,q.jsx)(U,{icon:(0,q.jsx)(ee,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:n.error.message});let F=L(n.data??[]),B=new Set(F.map(e=>e.name)),V=L([...F.map(e=>({...e,enabled:e.source===`team`&&O.has(e.name)?k.has(e.name):!0})),...E.filter(e=>!B.has(e.name)).map(e=>({...e,enabled:k.has(e.name)}))].sort((e,t)=>e.name.localeCompare(t.name))),W=d.get(`skill`),G=V.find(e=>e.name===W)??(W===null?V.find(e=>e.enabled):null)??null,J=G?.name??null,Y=G?$(G,O,S.isPending,M,c.isError):void 0,X=z(V,f);return(0,q.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,q.jsxs)(`section`,{"data-slot":`skills-list`,className:y(`w-full flex-col border-border md:flex md:w-96 md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,W===null||!G?`flex`:`hidden md:flex`),children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,q.jsx)(te,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:f,onChange:e=>p(e.target.value),className:`h-8 text-[13px]`}),(0,q.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:P.isPending,onClick:()=>P.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,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3`,P.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),e?(0,q.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,q.jsx)(se,{projectId:e,state:t.data,loadError:t.error})}):null,c.isError?(0,q.jsxs)(`div`,{"data-slot":`skills-importable-error`,role:`alert`,className:`mx-3 mb-2 flex shrink-0 items-center justify-between gap-3 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[(0,q.jsxs)(`p`,{className:`min-w-0`,children:[`Could not load the Open Mercato skills catalog. Team skills may be missing until it loads.`,` `,c.error.message]}),(0,q.jsx)(b,{type:`button`,"data-action":`skills-importable-retry`,variant:`ghost`,size:`sm`,disabled:c.isFetching,onClick:()=>void c.refetch(),children:`Retry`})]}):null,(0,q.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 pb-2`,children:n.isPending?(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):X.length>0?X.map(e=>(0,q.jsx)(ue,{skill:e,active:J===e.name,activation:$(e,O,S.isPending,M,c.isError)},e.name)):(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:V.length>0?`(no skills match)`:(0,q.jsx)(re,{})})})]}),(0,q.jsx)(`section`,{"data-slot":`skills-detail`,className:y(`min-w-0 flex-1 flex-col`,W===null||!G?`hidden md:flex`:`flex`),children:(0,q.jsx)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:G?(0,q.jsxs)(q.Fragment,{children:[W===null?null:(0,q.jsxs)(T,{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,q.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),(0,q.jsx)(ne,{skill:G,enabled:G.enabled,activation:Y,usedBy:R(s.data?.workflows??[],G.name)})]}):n.isPending?null:(0,q.jsx)(U,{icon:(0,q.jsx)(N,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})})})]})}function ue({skill:e,active:t,activation:n}){let r=B(e),i=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-[13px]`,e.enabled?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,q.jsx)(G,{source:e.source,teamRepo:e.team?.repo,className:`ml-auto`})]}),e.description?(0,q.jsx)(`span`,{className:`line-clamp-2 text-xs text-soft-foreground`,children:e.description}):null]});return(0,q.jsxs)(`li`,{className:y(`flex min-w-0 items-start gap-0 rounded-md transition-colors hover:bg-muted`,t&&`bg-muted`),children:[n?(0,q.jsx)(W,{"data-slot":`skill-activation`,"aria-label":n.ariaLabel,checked:n.checked,disabled:n.disabled,onCheckedChange:n.onCheckedChange,size:`sm`,className:`mt-2.5 ml-2 shrink-0`}):null,(0,q.jsx)(T,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":r?`true`:void 0,"data-enabled":e.enabled?`true`:`false`,"aria-current":t?`page`:void 0,className:`flex min-w-0 flex-1 flex-col gap-0.5 px-2.5 py-2`,children:i})]})}export{ce 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{Di as r,N as i,Nt as a,Pt as o,Qn as s,Qt as c,Ut as l,Yn as u,or as d,pr as f,qr as p,qt as m,r as h,va as g,xa as _,xi as v}from"./queries-Bn7zl9OU.js";import{r as y,t as b}from"./button-Clwd6u4_.js";import{T as x,c as S,f as C,s as w,t as T}from"./project-router-CZzr7lzN.js";import{_ as E,f as D,g as O,h as k,m as A,p as j}from"./reference-chip-CScP5y_O.js";import{N as M,bn as N,fn as P,gn as F}from"./git-tab-loading-BC6WP7W4.js";import{t as I}from"./arrow-left-BELOeFyX.js";import{F as L,H as R,M as z,N as B}from"./worktree-lifecycle-operation-vTgExKUM.js";import{t as V}from"./circle-check-DnEaQ9Rj.js";import{u as H}from"./git-toolbar-Dra1QlHb.js";import{t as ee}from"./triangle-alert-BqI_9MkV.js";import{t as te}from"./input-DIWTlsx6.js";import{t as U}from"./centered-state-nM7v9xtl.js";import{D as W,l as G,s as ne}from"./index-qeFtKZ4e.js";var K=e(t(),1),q=n(),J=[`.ai/cezar/skills/`,`.ai/skills/`,`.agents/skills/`];function Y({children:e}){return(0,q.jsx)(`span`,{className:`font-mono`,children:e})}function X(){return(0,q.jsx)(q.Fragment,{children:J.map((e,t)=>(0,q.jsxs)(`span`,{children:[t>0?t===J.length-1?`, or `:`, `:``,(0,q.jsx)(Y,{children:e})]},e))})}function re(){return(0,q.jsxs)(q.Fragment,{children:[`No skills yet. Drop Markdown files into `,(0,q.jsx)(X,{}),` (agent mirrors like`,` `,(0,q.jsx)(Y,{children:`.claude/skills/`}),` work too) — optional frontmatter: `,(0,q.jsx)(Y,{children:`name`}),`,`,` `,(0,q.jsx)(Y,{children:`description`}),`. Global (`,(0,q.jsx)(Y,{children:`~/.agents/skills`}),`) and team-repo skills appear here too — try Refresh.`]})}var ie=2e3,ae=5*6e4;async function oe(e,t,n={}){let{apply:r=s,read:i=p,wait:a=e=>new Promise(t=>setTimeout(t,e)),now:o=Date.now,onDropped:c=F}=n;try{return await r(e)}catch(n){if(!(n instanceof u)||n.status!==0&&n.status!==409)throw n;let r=e=>{n.status===0&&c(e)},s=o()+ae;for(;;){let c;try{c=await i(e)}catch{throw r(`unreachable`),n}if(c.status!==`updating`){if(c.updatedAt&&c.updatedAt!==t)return r(`recovered`),c;throw r(`not_applied`),n}if(o()>=s)throw r(`timed_out`),n;await a(ie)}}}function Z(e){return e===`project`?`Project installation`:`Global installation`}function se({projectId:e,state:t,loadError:n}){let r=_(),i=S(),a=(0,K.useRef)(0),[o,s]=(0,K.useState)(!1),l=g({mutationFn:()=>f({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=>{P(`skills_import`),s(!1),i(M(e))},onError:e=>C(e.message,{tone:`danger`})}),u=(t,n)=>{n.seq===a.current&&(r.setQueryData(c.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:h.skills}),C(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),s(!0)))},p=(e,t)=>{t.seq===a.current&&C(e.message,{tone:`danger`})},m=g({mutationFn:t=>d(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>u(e,t),onError:(e,t)=>p(e,t)}),v=g({mutationFn:t=>oe(e,t.previousUpdatedAt).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>u(e,t),onError:(e,t)=>p(e,t)}),x=e=>{let n=++a.current;e===`apply`?v.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):m.mutate({action:e,seq:n})},w=t?.scopes??[],T=w.filter(e=>e.skills.length>0),N=T.length>0,F=t?.status===`error`,I=N&&(t?.available||F),L=v.isPending||t?.status===`updating`,R=w.filter(e=>e.status===`error`||e.status===`unavailable`),z=w.filter(e=>e.updatedAt&&!R.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`&&!N?B=t.needsUpgradeNotes?`Skill files were updated.`:`No installed Open Mercato skills are tracked for updates.`: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,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`rounded-lg border border-border bg-muted/30 p-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,T.length>0?(0,q.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:T.map(e=>(0,q.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,R.length>0?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,R.map(e=>Z(e.scope)).join(`, `),z.length?`; updated: `+z.map(e=>Z(e.scope)).join(`, `):``,`.`]}):null]}),I?(0,q.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:L,onClick:()=>x(`apply`),children:[(0,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3.5`,L&&`motion-safe:animate-spin`)}),L?`Updating…`:F?`Retry`:`Update now`]}):t?.status===`current`?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>x(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:m.isPending,onClick:()=>x(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,q.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,q.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,q.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,q.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,q.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,q.jsx)(D,{open:o,onOpenChange:e=>l.isPending?void 0:s(e),children:(0,q.jsxs)(j,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,q.jsxs)(O,{children:[(0,q.jsx)(E,{children:`Apply the upgrade notes now?`}),(0,q.jsxs)(A,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,q.jsxs)(k,{children:[(0,q.jsx)(b,{type:`button`,variant:`outline`,disabled:l.isPending,onClick:()=>s(!1),children:`No`}),(0,q.jsx)(b,{type:`button`,disabled:l.isPending,onClick:()=>l.mutate(),children:l.isPending?`Starting…`:`Yes, start session`})]})]})})]})}function Q(e,t){let n=e?.importedSkills;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&!!e):[...t]}function $(e,t,n,r,i=!1){let a=e.source===`ai`||e.source===`cezar`||e.source===`agents`||e.source===`global`,o=e.source===`team`&&(t.has(e.name)||i);if(!(!a&&!o))return{ariaLabel:a?`${e.name} is always enabled`:`${e.enabled?`Disable`:`Enable`} ${e.name}`,checked:a||e.enabled,disabled:a||n||i,onCheckedChange:()=>r(e.name)}}function ce(){return(0,q.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,q.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,q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,q.jsx)(le,{})]})}function le(){let e=w()??``,t=o(e,!!e),n=a(),s=m(),c=i(),[u]=x(),[d,f]=(0,K.useState)(``),p=_(),S=l(),E=c.data??[],D=(0,K.useMemo)(()=>E.map(e=>e.name),[E]),O=(0,K.useMemo)(()=>new Set(D),[D]),k=(0,K.useMemo)(()=>new Set(Q(S.data,D)),[S.data,D]),A=(0,K.useRef)(Promise.resolve()),j=(0,K.useRef)(0),M=(0,K.useCallback)(t=>{let n=h.uiState,r=h.skills,i=p.getQueryData(n),a=Q(i,D),o=a.includes(t)?a.filter(e=>e!==t):[...a,t];p.setQueryData(n,{...i,importedSkills:o});let s=++j.current;A.current=A.current.then(async()=>{try{let t=await v({importedSkills:o},e);if(s!==j.current)return;p.setQueryData(n,t),p.invalidateQueries({queryKey:r})}catch(e){if(s!==j.current)return;C(e instanceof Error?e.message:String(e),{tone:`danger`}),p.invalidateQueries({queryKey:n})}})},[D,e,p]),P=g({mutationFn:()=>r(),onSuccess:e=>{p.setQueryData(h.skills,e),C(`Team skills refreshed.`)},onError:e=>C(e.message,{tone:`danger`})});if(n.isError)return(0,q.jsx)(U,{icon:(0,q.jsx)(ee,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:n.error.message});let F=L(n.data??[]),B=new Set(F.map(e=>e.name)),V=L([...F.map(e=>({...e,enabled:e.source===`team`&&O.has(e.name)?k.has(e.name):!0})),...E.filter(e=>!B.has(e.name)).map(e=>({...e,enabled:k.has(e.name)}))].sort((e,t)=>e.name.localeCompare(t.name))),W=u.get(`skill`),G=V.find(e=>e.name===W)??(W===null?V.find(e=>e.enabled):null)??null,J=G?.name??null,Y=G?$(G,O,S.isPending,M,c.isError):void 0,X=z(V,d);return(0,q.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,q.jsxs)(`section`,{"data-slot":`skills-list`,className:y(`w-full flex-col border-border md:flex md:w-96 md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,W===null||!G?`flex`:`hidden md:flex`),children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,q.jsx)(te,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:d,onChange:e=>f(e.target.value),className:`h-8 text-[13px]`}),(0,q.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:P.isPending,onClick:()=>P.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,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3`,P.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),e?(0,q.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,q.jsx)(se,{projectId:e,state:t.data,loadError:t.error})}):null,c.isError?(0,q.jsxs)(`div`,{"data-slot":`skills-importable-error`,role:`alert`,className:`mx-3 mb-2 flex shrink-0 items-center justify-between gap-3 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[(0,q.jsxs)(`p`,{className:`min-w-0`,children:[`Could not load the Open Mercato skills catalog. Team skills may be missing until it loads.`,` `,c.error.message]}),(0,q.jsx)(b,{type:`button`,"data-action":`skills-importable-retry`,variant:`ghost`,size:`sm`,disabled:c.isFetching,onClick:()=>void c.refetch(),children:`Retry`})]}):null,(0,q.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 pb-2`,children:n.isPending?(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):X.length>0?X.map(e=>(0,q.jsx)(ue,{skill:e,active:J===e.name,activation:$(e,O,S.isPending,M,c.isError)},e.name)):(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:V.length>0?`(no skills match)`:(0,q.jsx)(re,{})})})]}),(0,q.jsx)(`section`,{"data-slot":`skills-detail`,className:y(`min-w-0 flex-1 flex-col`,W===null||!G?`hidden md:flex`:`flex`),children:(0,q.jsx)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:G?(0,q.jsxs)(q.Fragment,{children:[W===null?null:(0,q.jsxs)(T,{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,q.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),(0,q.jsx)(ne,{skill:G,enabled:G.enabled,activation:Y,usedBy:R(s.data?.workflows??[],G.name)})]}):n.isPending?null:(0,q.jsx)(U,{icon:(0,q.jsx)(N,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})})})]})}function ue({skill:e,active:t,activation:n}){let r=B(e),i=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-[13px]`,e.enabled?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,q.jsx)(G,{source:e.source,teamRepo:e.team?.repo,className:`ml-auto`})]}),e.description?(0,q.jsx)(`span`,{className:`line-clamp-2 text-xs text-soft-foreground`,children:e.description}):null]});return(0,q.jsxs)(`li`,{className:y(`flex min-w-0 items-start gap-0 rounded-md transition-colors hover:bg-muted`,t&&`bg-muted`),children:[n?(0,q.jsx)(W,{"data-slot":`skill-activation`,"aria-label":n.ariaLabel,checked:n.checked,disabled:n.disabled,onCheckedChange:n.onCheckedChange,size:`sm`,className:`mt-2.5 ml-2 shrink-0`}):null,(0,q.jsx)(T,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":r?`true`:void 0,"data-enabled":e.enabled?`true`:`false`,"aria-current":t?`page`:void 0,className:`flex min-w-0 flex-1 flex-col gap-0.5 px-2.5 py-2`,children:i})]})}export{ce as SkillsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Yn as i,ft as a,ht as o,mt as s}from"./queries-
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Yn as i,ft as a,ht as o,mt as s}from"./queries-Bn7zl9OU.js";import{r as c,t as l}from"./button-Clwd6u4_.js";import{t as u,w as d}from"./project-router-CZzr7lzN.js";import{t as f}from"./use-desktop-BNN3U2y9.js";import{Jt as p,n as m,r as h,t as g}from"./git-tab-loading-BC6WP7W4.js";import{t as _}from"./arrow-left-BELOeFyX.js";import{s as v}from"./git-toolbar-Dra1QlHb.js";import{n as y}from"./upload-J0hBTVF7.js";import{t as b}from"./triangle-alert-BqI_9MkV.js";import{t as x}from"./search-x-CuinYQnl.js";import{t as S}from"./diff-stat-CiWUpWY0.js";import{t as C}from"./centered-state-nM7v9xtl.js";import{t as w}from"./diff-CJKocK17.js";import{t as T}from"./commit-list-Ti2arrt8.js";var E=t(n(),1),D=new Map,O=new Map;function k(e,t){D.set(e,t);for(let n of O.get(e)??[])n(t)}function A(e,t){let n=()=>e!==void 0&&D.has(e)?D.get(e):t,[r,i]=(0,E.useState)(n),a=(0,E.useRef)(e);return a.current!==e&&(a.current=e,i(n())),(0,E.useEffect)(()=>{if(e===void 0)return;let t=e=>i(e),n=O.get(e)??new Set;return n.add(t),O.set(e,n),()=>{n.delete(t),n.size===0&&O.delete(e)}},[e]),[r,(0,E.useCallback)(t=>{e!==void 0&&D.set(e,t),i(t)},[e])]}var j=e({CommitsView:()=>P,TaskCommitsRoute:()=>N}),M=r();function N(){let{id:e}=d(),t=a(e);return t.isPending?(0,M.jsx)(m,{tab:`changes`}):t.isError?(0,M.jsx)(g,{tab:`changes`,error:t.error}):(0,M.jsx)(P,{run:t.data})}function P({run:e,embedded:t=!1,stateKey:n}){let{sha:r}=d(),[a,s]=A(n,null),u=t?a??void 0:r,f=o(e.id,p(e.status));return(0,M.jsxs)(`div`,{"data-route":`task-commits`,className:c(`flex min-h-full flex-col`,u&&`md:h-full`),children:[t?null:(0,M.jsx)(h,{run:e,tab:`commits`}),u?(0,M.jsxs)(M.Fragment,{children:[t?(0,M.jsx)(`div`,{className:`shrink-0 border-b border-border px-4 py-1.5 md:px-6`,children:(0,M.jsxs)(l,{variant:`ghost`,size:`xs`,"data-action":`all-commits`,onClick:()=>s(null),children:[(0,M.jsx)(_,{"aria-hidden":`true`}),`All commits`]})}):null,(0,M.jsx)(F,{runId:e.id,sha:u},u)]}):f.isPending?(0,M.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):f.isError?(0,M.jsx)(C,{icon:(0,M.jsx)(y,{}),tone:f.error instanceof i&&f.error.status===409?`neutral`:`danger`,heading:`h2`,title:f.error instanceof i&&f.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:f.error.message}):f.data.commits.length===0?(0,M.jsx)(C,{icon:(0,M.jsx)(y,{}),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,M.jsx)(T,{slot:`task-commits`,className:`mx-auto w-full max-w-[var(--measure)]`,commits:f.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`})),onSelect:t?s:void 0})]})}function F({runId:e,sha:t}){let n=s(e,t),r=f(),[a,o]=(0,E.useState)(`unified`),[c,d]=(0,E.useState)(!1),p=n.isError&&n.error instanceof i&&n.error.status===409,m=r?a:`unified`,h=!r||c;return(0,M.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,M.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,M.jsx)(l,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,M.jsxs)(u,{to:`/tasks/${e}/commits`,children:[(0,M.jsx)(_,{"aria-hidden":`true`}),`All commits`]})}),n.data?(0,M.jsx)(S,{stat:n.data.stat}):null,(0,M.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,M.jsx)(v,{mode:a,wrap:c,onModeChange:o,onWrapChange:d})})]}),n.isPending?(0,M.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,M.jsx)(C,{icon:p?(0,M.jsx)(x,{}):(0,M.jsx)(b,{}),tone:p?`neutral`:`danger`,heading:`h2`,title:p?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,M.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,M.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,M.jsx)(C,{icon:(0,M.jsx)(y,{}),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,M.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":r?``:void 0,className:`px-4 md:min-h-0 md:flex-1 md:overflow-y-auto md:overscroll-contain md:px-6`,children:(0,M.jsx)(w,{files:n.data.files,mode:m,wrap:h,className:`min-w-0 py-4`})})]})]})}export{A as i,j as n,k as r,P as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{ft as r}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{ft as r}from"./queries-Bn7zl9OU.js";import{t as i}from"./project-router-CZzr7lzN.js";import{r as a}from"./git-tab-loading-BC6WP7W4.js";import{n as o}from"./textarea-ewNKsXDa.js";import{n as s}from"./terminal-F3ZJ5fI8.js";import{t as c}from"./centered-state-nM7v9xtl.js";import{FloatingPanel as l,a as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w}from"./workflow-graph-CcOTCItr.js";var T=e(t(),1),E=n();function D({data:e}){let{node:t,state:n,childRunId:r}=e;return r?(0,E.jsx)(O,{node:t,state:n,childRunId:r}):(0,E.jsx)(C,{node:t,connectable:!1,status:n.status,loopCount:n.loopCount,iterations:n.iterations,costUsd:n.costUsd})}function O({node:e,state:t,childRunId:n}){let i=r(n).data,a=i&&i.steps.length>1?i.steps.map(e=>({id:e.id,name:e.name??e.id,status:e.status})):void 0;return(0,E.jsx)(C,{node:e,connectable:!1,status:t.status,costUsd:i?.costUsd??t.costUsd,inner:a,subtaskTo:`/tasks/${n}/graph`})}var k={live:D};function A({run:e,embedded:t=!1}){let n=e.workflowDef,r=(0,T.useMemo)(()=>n?u(n):null,[n]),i=(0,T.useMemo)(()=>r?g(r,e):null,[r,e]),[s,C]=(0,T.useState)(null),D=r?.nodes.find(e=>e.id===s),O=(0,T.useMemo)(()=>r&&i?r.nodes.map(t=>({id:t.id,type:`live`,position:r.layout?.[t.id]??{x:0,y:0},draggable:!1,connectable:!1,data:{node:t,state:i.nodes.get(t.id)??{status:`pending`},...j(e,t.id)}})):[],[r,i]),A=(0,T.useMemo)(()=>r?y(r):new Set,[r]),N=(0,T.useMemo)(()=>r?v(r,A):new Map,[r,A]),P=(0,T.useMemo)(()=>!r||!i?[]:r.nodes.flatMap(e=>d(e).flatMap(t=>{let n=w(r,e.id,t);if(!n)return[];let a=`${e.id}.${t}->${n}`,o=i.edges.get(a)??0,s=A.has(`${e.id}.${t}->${n}`),c=(r.layout?.[n]?.x??0)<=(r.layout?.[e.id]?.x??0),l=x({tone:S(e,t),back:s,emphasis:o?`taken`:`dim`});return[{id:a,source:e.id,sourceHandle:t,target:n,type:s||c||N.has(a)?`lane`:`default`,...N.has(a)?{data:{lane:N.get(a)}}:{},label:o>1?`×${o}`:void 0,style:l,markerEnd:{type:m.ArrowClosed,color:l.stroke,width:14,height:14},labelStyle:{fill:`var(--muted-foreground)`,fontSize:10,fontWeight:600},labelBgStyle:{fill:`var(--background)`}}]})),[r,i,A,N]);return(0,E.jsxs)(`div`,{"data-route":`task-graph`,className:`flex h-full min-h-0 flex-col`,children:[t?null:(0,E.jsx)(a,{run:e,tab:`graph`}),r?(0,E.jsxs)(`div`,{className:`relative min-h-[420px] flex-1`,children:[(0,E.jsxs)(_,{nodes:O,edges:P,nodeTypes:k,edgeTypes:h,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,onNodeClick:(e,t)=>C(t.id),onPaneClick:()=>C(null),fitView:!0,fitViewOptions:{padding:.2,maxZoom:1.2},minZoom:.2,colorMode:`system`,proOptions:{hideAttribution:!0},children:[(0,E.jsx)(f,{variant:p.Dots,gap:18,size:1}),(0,E.jsx)(b,{showInteractive:!1})]}),D&&i?(0,E.jsx)(l,{side:`right`,label:`Node details`,title:D.name??D.id,onClose:()=>C(null),children:(0,E.jsx)(M,{state:i.nodes.get(D.id)??{status:`pending`},outputs:e.graphState?.outputs?.[D.id],childRunId:j(e,D.id).childRunId,loopMax:D.type===`loop`?D.max:void 0})}):null]}):(0,E.jsx)(c,{icon:(0,E.jsx)(o,{}),tone:`neutral`,title:`No workflow graph`,subtitle:`This task has no stored workflow definition to draw.`})]})}function j(e,t){let n=e.graphState?.outputs?.[t]?.runId;return typeof n==`string`&&n?{childRunId:n}:{}}function M({state:e,outputs:t,loopMax:n,childRunId:r}){let a=[[`status`,e.status===`reached`?`passed through`:e.status]];e.iterations&&a.push([`runs`,String(e.iterations)]),e.costUsd&&a.push([`cost`,`$${e.costUsd.toFixed(2)}`]),e.loopCount!==void 0&&a.push([`iterations`,`${e.loopCount}${n?` / ${n}`:``}`]);let o=Object.entries(t??{}).filter(([,e])=>e!==``);return(0,E.jsxs)(`div`,{className:`space-y-4 p-4 text-[12px]`,children:[(0,E.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:a.map(([e,t])=>(0,E.jsxs)(`div`,{className:`contents`,children:[(0,E.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,E.jsx)(`dd`,{children:t})]},e))}),r?(0,E.jsxs)(i,{to:`/tasks/${r}`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[`Open the subtask `,(0,E.jsx)(s,{className:`size-3`})]}):null,(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`mb-1 text-[11px] text-muted-foreground uppercase`,children:`Outputs`}),o.length===0?(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Nothing yet — outputs appear once the node has run.`}):o.map(([e,t])=>(0,E.jsxs)(`div`,{className:`mb-2`,children:[(0,E.jsx)(`code`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,E.jsx)(`pre`,{className:`mt-0.5 max-h-48 overflow-auto rounded-md bg-muted/40 p-2 text-[11px] whitespace-pre-wrap`,children:String(t)})]},e))]})]})}export{A as TaskGraphView};
|
|
@@ -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{bt as r,ft as i,j as a}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{bt as r,ft as i,j as a}from"./queries-Bn7zl9OU.js";import{c as o,w as s}from"./project-router-CZzr7lzN.js";import{G as c,K as l,Q as u,U as d,n as f,r as p,t as m}from"./git-tab-loading-BC6WP7W4.js";import{t as h}from"./markdown-Rbaca31B.js";import{t as g}from"./layout-cards-CXMlrDUf.js";var _=e(t(),1),v=n();function y(){let{id:e}=s(),t=i(e);return t.isPending?(0,v.jsx)(f,{tab:`notes`}):t.isError?(0,v.jsx)(m,{tab:`notes`,error:t.error}):(0,v.jsxs)(`div`,{"data-route":`task-notes`,className:`flex min-h-full flex-col`,children:[(0,v.jsx)(b,{run:t.data}),(0,v.jsx)(`div`,{className:`mx-auto w-full max-w-[var(--measure)] px-3 py-3 md:px-6 md:py-5`,children:(0,v.jsx)(S,{runId:t.data.id})})]})}function b({run:e}){let t=o(),n=a().data?.capabilities?.terminal===!0,r=(0,_.useMemo)(()=>l.filter(t=>(t!==`graph`||!!e.workflowDef)&&(t!==`terminal`||n)),[e.workflowDef,n]),{hints:i,show:s}=c((0,_.useMemo)(()=>d(r),[r]));return(0,v.jsx)(p,{run:e,tab:`notes`,tabs:(0,_.useMemo)(()=>(0,v.jsx)(g,{keyHints:i,showKeyHints:s,layouts:[],active:``,fixedViews:r,onSelectFixed:n=>t(`/tasks/${e.id}/${u[n]}`),onSelect:x,onClose:x,notesHref:`/tasks/${e.id}/notes`,notesActive:!0,showLayouts:!1}),[r,t,e.id,i,s]),wide:!0})}var x=()=>{};function S({runId:e}){let t=r(e);return(0,v.jsx)(`div`,{"data-slot":`notes-panel`,children:t.isPending?(0,v.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):t.isError?(0,v.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}):t.data.trim().length>0?(0,v.jsx)(h,{children:t.data}):(0,v.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})})}export{y as TaskNotesRoute};
|