@mrpatronz/nexusflow 2.10.0 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/desktop/assets/icon.png +0 -0
- package/dist/agent/ClaudeCliAdapter.d.ts +2 -2
- package/dist/agent/ClaudeCliAdapter.d.ts.map +1 -1
- package/dist/agent/ClaudeCliAdapter.js +6 -4
- package/dist/agent/ClaudeCliAdapter.js.map +1 -1
- package/dist/agent/CliAdapterBase.d.ts.map +1 -1
- package/dist/agent/CliAdapterBase.js +8 -1
- package/dist/agent/CliAdapterBase.js.map +1 -1
- package/dist/agent/cliAvailability.d.ts +2 -5
- package/dist/agent/cliAvailability.d.ts.map +1 -1
- package/dist/agent/cliAvailability.js +6 -41
- package/dist/agent/cliAvailability.js.map +1 -1
- package/dist/agent/session.d.ts +5 -0
- package/dist/agent/session.d.ts.map +1 -1
- package/dist/agent/session.js +8 -0
- package/dist/agent/session.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +40 -0
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/desktop.d.ts +2 -0
- package/dist/commands/desktop.d.ts.map +1 -1
- package/dist/commands/desktop.js +102 -31
- package/dist/commands/desktop.js.map +1 -1
- package/dist/core/workspace.d.ts +10 -1
- package/dist/core/workspace.d.ts.map +1 -1
- package/dist/core/workspace.js +21 -4
- package/dist/core/workspace.js.map +1 -1
- package/dist/core/worktree.d.ts +10 -4
- package/dist/core/worktree.d.ts.map +1 -1
- package/dist/core/worktree.js +34 -47
- package/dist/core/worktree.js.map +1 -1
- package/dist/generators/base.d.ts.map +1 -1
- package/dist/generators/base.js +0 -1
- package/dist/generators/base.js.map +1 -1
- package/dist/gui/assets/AgentsPage-DbivhmK0.js +3 -0
- package/dist/gui/assets/DashboardPage-D50Qrm3e.js +1 -0
- package/dist/gui/assets/{GettingStartedPage-BKeuSHZQ.js → GettingStartedPage-1MOTng3B.js} +1 -1
- package/dist/gui/assets/{NullStore-DuSDhGOe.js → NullStore-tdPen1kp.js} +1 -1
- package/dist/gui/assets/ProjectsPage-srKgf7VN.js +1 -0
- package/dist/gui/assets/ScaffoldRepoInline-CP0yn5mw.js +1 -0
- package/dist/gui/assets/SettingsPage-DWmrLV8o.js +1 -0
- package/dist/gui/assets/SkillsPage-CKjTXdrd.js +6 -0
- package/dist/gui/assets/StartWorkPage-BCUnJ9k8.js +1 -0
- package/dist/gui/assets/{StrategiesPage-BRQMly_d.js → StrategiesPage-CdCbbIu-.js} +2 -2
- package/dist/gui/assets/WorkroomsPage-BcT-mGtT.js +4 -0
- package/dist/gui/assets/WorkspacesPage-CYFCm-7_.js +2 -0
- package/dist/gui/assets/{alert-dialog-BHEUQVyS.js → alert-dialog-u7qgb9Hq.js} +1 -1
- package/dist/gui/assets/badge-DwXvB44H.js +1 -0
- package/dist/gui/assets/chunk-BV7QT456-DfUBKG-z.js +3 -0
- package/dist/gui/assets/index-3tD_IeyQ.js +55 -0
- package/dist/gui/assets/index-CK5YRfPV.css +2 -0
- package/dist/gui/assets/tabs-BrHKp5bD.js +1 -0
- package/dist/gui/assets/{useAriaLabelledBy-BmJErI5a.js → useAriaLabelledBy-C4zV-1Ra.js} +1 -1
- package/dist/gui/assets/{vsc-eMRaEwN3.js → vsc-D80c4gBT.js} +1 -1
- package/dist/gui/index.html +5 -8
- package/dist/orchestration/runner.d.ts.map +1 -1
- package/dist/orchestration/runner.js +28 -10
- package/dist/orchestration/runner.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +116 -10
- package/dist/server.js.map +1 -1
- package/dist/utils/repo-freshness.d.ts +106 -0
- package/dist/utils/repo-freshness.d.ts.map +1 -0
- package/dist/utils/repo-freshness.js +405 -0
- package/dist/utils/repo-freshness.js.map +1 -0
- package/dist/utils/session-finder.d.ts.map +1 -1
- package/dist/utils/session-finder.js +23 -8
- package/dist/utils/session-finder.js.map +1 -1
- package/dist/utils/terminal-launch.d.ts +4 -2
- package/dist/utils/terminal-launch.d.ts.map +1 -1
- package/dist/utils/terminal-launch.js +26 -16
- package/dist/utils/terminal-launch.js.map +1 -1
- package/dist/utils/user-paths.d.ts +23 -0
- package/dist/utils/user-paths.d.ts.map +1 -0
- package/dist/utils/user-paths.js +126 -0
- package/dist/utils/user-paths.js.map +1 -0
- package/package.json +6 -2
- package/dist/gui/assets/AgentsPage-CnXzZFo1.js +0 -3
- package/dist/gui/assets/DashboardPage-rm3hKgsw.js +0 -1
- package/dist/gui/assets/ProjectsPage-CioaA4uf.js +0 -1
- package/dist/gui/assets/ScaffoldRepoInline-DKZ1rPmE.js +0 -1
- package/dist/gui/assets/Separator-BgWyHDtg.js +0 -1
- package/dist/gui/assets/SettingsPage-BevO8oge.js +0 -1
- package/dist/gui/assets/SkillsPage-D2stJRWy.js +0 -6
- package/dist/gui/assets/StartWorkPage-C8a6eN90.js +0 -1
- package/dist/gui/assets/WorkroomsPage-KqBkRD-x.js +0 -4
- package/dist/gui/assets/WorkspacesPage-DcA2i5HN.js +0 -2
- package/dist/gui/assets/badge-DTBzXOWn.js +0 -1
- package/dist/gui/assets/index-BB4BuHBQ.css +0 -2
- package/dist/gui/assets/index-BTe-_1Mu.js +0 -57
- package/dist/gui/assets/isElementDisabled-BrwmCB1d.js +0 -1
- package/dist/gui/assets/menu-d_G9km1-.js +0 -1
- package/dist/gui/assets/tabs-BHwTt4t1.js +0 -1
- package/dist/gui/assets/useValueChanged-WS99hTmm.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,t as r}from"./button-CREn1mup.js";import{n as i,t as a}from"./badge-DTBzXOWn.js";import{n as o,t as s}from"./ScaffoldRepoInline-DKZ1rPmE.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./alert-dialog-BHEUQVyS.js";import{t as g}from"./trash-2-CMdv3eD3.js";import{F as _,G as v,Gt as y,H as b,Kt as x,Nt as S,Q as ee,Xt as C,_ as w,a as T,at as E,f as D,g as O,h as k,i as A,j,m as M,n as N,o as P,p as F,r as I,v as L,y as te}from"./index-BTe-_1Mu.js";var R=t(e(),1),z=n(),B={editingId:null,name:``,description:``,repoPaths:[]};function V(){let e=S(),t=b(),n=v(),V=E(),H=j(),U=ee(),W=_(),[G,K]=(0,R.useState)(null),[q,J]=(0,R.useState)(null),[Y,X]=(0,R.useState)(null),Z=(0,R.useMemo)(()=>{let e={};for(let t of V.data??[])t.projectId&&(e[t.projectId]=(e[t.projectId]??0)+1);return e},[V.data]),Q=()=>{J(null),K(B)},ne=e=>{J(null),K({editingId:e.id,name:e.name,description:e.description??``,repoPaths:e.repos.map(e=>e.path)})},re=e=>{K(t=>t&&{...t,repoPaths:t.repoPaths.includes(e.path)?t.repoPaths.filter(t=>t!==e.path):[...t.repoPaths,e.path]})},ie=async()=>{if(G){J(null);try{G.editingId?await U.mutateAsync({id:G.editingId,name:G.name,description:G.description||null,repos:G.repoPaths}):await H.mutateAsync({name:G.name,description:G.description||void 0,repos:G.repoPaths}),K(null)}catch(e){J(e instanceof Error?e.message:String(e))}}},ae=async()=>{if(Y)try{await W.mutateAsync(Y.id)}finally{X(null)}},oe=!!(G&&G.name.trim()&&G.repoPaths.length>0),$=H.isPending||U.isPending;return(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,z.jsxs)(`header`,{className:`mb-6 flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-border/70 pb-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-bold tracking-tight text-foreground`,children:`Projects`}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Named groups of repositories you start work from. Registered once, reused for every feature workspace.`})]}),(0,z.jsxs)(r,{onClick:Q,className:`gap-1.5 shadow-sm`,children:[(0,z.jsx)(y,{size:15}),` New project`]})]}),t.isLoading?(0,z.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,z.jsx)(D,{className:`size-6`})}):(t.data??[]).length===0?(0,z.jsxs)(N,{className:`border border-border border-dashed`,children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(T,{variant:`icon`,children:(0,z.jsx)(C,{})}),(0,z.jsx)(P,{children:`No projects yet`}),(0,z.jsx)(I,{children:`Register your first project to start work without re-picking repositories every time.`})]}),(0,z.jsxs)(r,{onClick:Q,children:[(0,z.jsx)(y,{}),` New project`]})]}):(0,z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:(t.data??[]).map(t=>(0,z.jsx)(`li`,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-4 transition-all duration-200 hover:border-primary/40 hover:shadow-xs`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:t.name}),(Z[t.id]??0)>0&&(0,z.jsxs)(a,{variant:`secondary`,children:[Z[t.id],` workspace`,Z[t.id]===1?``:`s`]})]}),t.description&&(0,z.jsx)(`p`,{className:`mt-0.5 truncate text-sm text-muted-foreground`,children:t.description}),(0,z.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:t.repos.map(e=>(0,z.jsxs)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[e.path,(0,z.jsxs)(`span`,{className:`ml-2 text-muted-foreground/60`,children:[`[`,e.defaultBranch,`]`]})]},e.path))})]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,z.jsxs)(r,{size:`sm`,onClick:()=>e(`/new?project=${encodeURIComponent(t.id)}`),children:[(0,z.jsx)(x,{}),` Start work`]}),(0,z.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`Edit ${t.name}`,onClick:()=>ne(t),children:(0,z.jsx)(l,{})}),(0,z.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${t.name}`,onClick:()=>X(t),children:(0,z.jsx)(g,{})})]})]})},t.id))}),(0,z.jsx)(F,{open:G!==null,onOpenChange:e=>!e&&K(null),children:(0,z.jsxs)(L,{className:`max-w-lg`,children:[(0,z.jsxs)(O,{children:[(0,z.jsx)(te,{children:G?.editingId?`Edit project`:`New project`}),(0,z.jsx)(M,{children:`A project is a reusable group of source repositories. Removing one later never touches disk.`})]}),(0,z.jsxs)(w,{className:`space-y-4`,children:[(0,z.jsxs)(`label`,{className:`block`,children:[(0,z.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Name`}),(0,z.jsx)(i,{value:G?.name??``,onChange:e=>K(t=>t&&{...t,name:e.target.value}),placeholder:`e.g. Hogia Billing`,autoFocus:!0})]}),(0,z.jsxs)(`label`,{className:`block`,children:[(0,z.jsxs)(`span`,{className:`mb-1 block text-sm font-medium`,children:[`Description `,(0,z.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,z.jsx)(i,{value:G?.description??``,onChange:e=>K(t=>t&&{...t,description:e.target.value}),placeholder:`What this group of repos is for`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Repositories`}),(0,z.jsx)(o,{repos:n.data??[],selectedPaths:G?.repoPaths??[],onToggle:re,loading:n.isLoading,emptyHint:`No repositories found in your dev directory.`}),(0,z.jsx)(s,{onCreated:e=>K(t=>t&&{...t,repoPaths:[...t.repoPaths,e.path]})})]}),q&&(0,z.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:q})]}),(0,z.jsxs)(k,{children:[(0,z.jsx)(r,{variant:`outline`,onClick:()=>K(null),children:`Cancel`}),(0,z.jsxs)(r,{onClick:ie,disabled:!oe||$,children:[$?(0,z.jsx)(D,{}):null,G?.editingId?`Save changes`:`Create project`]})]})]})}),(0,z.jsx)(h,{open:Y!==null,onOpenChange:e=>!e&&X(null),children:(0,z.jsxs)(f,{children:[(0,z.jsxs)(c,{children:[(0,z.jsxs)(m,{children:[`Remove “`,Y?.name,`”?`]}),(0,z.jsx)(p,{children:`This only removes the project from the registry — repositories and workspaces on disk are not touched.`})]}),(0,z.jsxs)(u,{children:[(0,z.jsx)(d,{render:(0,z.jsx)(r,{variant:`outline`,children:`Cancel`})}),(0,z.jsxs)(r,{variant:`destructive`,onClick:ae,disabled:W.isPending,children:[W.isPending?(0,z.jsx)(D,{}):null,`Remove project`]})]})]})})]})}export{V as ProjectsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,o as ee,p as u,t as d}from"./button-CREn1mup.js";import{En as f,Jn as p,Kt as m,Ln as h,Wt as g,Xt as _,Yt as te,_n as ne,bt as re,c as ie,i as ae,l as oe,n as v,nn as se,o as ce,rn as le,s as ue,sn as y,xt as de}from"./badge-DTBzXOWn.js";import{t as fe}from"./useValueChanged-WS99hTmm.js";import{t as pe}from"./useAriaLabelledBy-BmJErI5a.js";import{M as b,Ut as x,f as S}from"./index-BTe-_1Mu.js";var me=o(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),C=t(e(),1),w=C.createContext({disabled:!1});function he(){return C.useContext(w)}function ge(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function _e(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...oe}}var T=C.createContext(void 0);function ve(){return C.useContext(T)}var ye=C.createContext(void 0);function E(){let e=C.useContext(ye);if(e===void 0)throw Error(u(14));return e}var D=a(),be=`data-parent`,O=C.forwardRef(function(e,t){let{checked:a,className:o,defaultChecked:l=!1,"aria-labelledby":u,disabled:d=!1,form:p,id:m,indeterminate:g=!1,inputRef:oe,name:v,onCheckedChange:b,parent:x=!1,readOnly:S=!1,render:me,required:w=!1,uncheckedValue:T,value:E,nativeButton:O=!1,style:xe,...k}=e,{clearErrors:A}=ue(),{disabled:j,name:Se,setDirty:Ce,setFilled:M,setFocused:N,setTouched:we,state:P,validationMode:Te,validityData:Ee,validation:De}=ie(),Oe=he(),{labelId:ke,controlId:Ae,registerControlId:F,getDescriptionProps:je}=ce(),I=ve(),L=I?.allValues===void 0?void 0:I.parent,R=L!==void 0,z=j||Oe.disabled||I?.disabled||d,B=Se??v,V=E??B,Me=_(),Ne=_(),H=m||Ae;R&&(x?H=Ne:V===void 0?H||=Ne:H=`${L.id}-${V}`);let U={};R&&(x?U=L.getParentProps():V!==void 0&&(U=L.getChildProps(V)));let{checked:Pe=a,indeterminate:Fe=g,onCheckedChange:Ie,...Le}=U,W=I?.value,G=C.useRef(null),K=i(()=>Symbol()),q=C.useRef(!1),{getButtonProps:Re,buttonRef:ze}=se({disabled:z,native:O}),J=I?.validation??De,[Y,Be]=f({controlled:V!==void 0&&W!==void 0&&!x?W.includes(V):Pe,default:l,name:`Checkbox`,state:`checked`}),X=R?!!Pe:Y,Z=R&&Fe||g;y(()=>{F!==c&&(q.current=!0,F(K.current,H))},[H,F,K]),C.useEffect(()=>{let e=K.current;return()=>{!q.current||F===c||(q.current=!1,F(e,void 0))}},[F,K]),ae(G,Me,Y,void 0,!I&&!z,v);let Q=C.useRef(null),Ve=J.registerInput,He=I?V:void 0,Ue=C.useCallback(e=>Ve(e,{controlRef:G,value:He}),[Ve,He]),We=r(oe,Q,x?void 0:Ue),Ge=pe(u,ke,Q,!O,H??void 0);y(()=>{Q.current&&(Q.current.indeterminate=Z,Y&&M(!0))},[Y,Z,M]),fe(Y,()=>{I||(A(B),M(Y),Ce(Y!==Ee.initialValue),J.change(Y))});let Ke=ee({checked:Y,disabled:z,form:p,name:x?void 0:B,id:O?void 0:H??void 0,required:w,ref:We,style:B?de:re,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(S){e.preventDefault();return}let t=e.currentTarget.checked,n=te(h,e.nativeEvent);if(b?.(t,n),!n.isCanceled&&(Ie?.(t,n),!n.isCanceled&&(Be(t),V!==void 0&&I!==void 0&&!x&&!R))){let e=t?[...I.value,V]:I.value.filter(e=>e!==V);I.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){G.current?.focus()}},E===void 0?n:{value:(I?Y&&E:E)||``},je,e=>J.getValidationProps(z,e));C.useEffect(()=>{if(!L||V===void 0)return;let e=L.disabledStatesRef.current;return e.set(V,z),()=>{e.delete(V)}},[L,z,V]);let $=C.useMemo(()=>({...P,checked:X,disabled:z,readOnly:S,required:w,indeterminate:Z}),[P,X,z,S,w,Z]),qe=_e($),Je=s(`span`,e,{state:$,ref:[ze,G,t],props:[{id:O?H??void 0:Me,role:`checkbox`,"aria-checked":Z?`mixed`:X,"aria-readonly":S||void 0,"aria-required":w||void 0,"aria-labelledby":Ge,[be]:x?``:void 0,onFocus(){z||N(!0)},onBlur(){let e=Q.current;e&&(we(!0),N(!1),Te===`onBlur`&&J.commit(I?W:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),ne(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||ge(t)?.click()})},onClick(e){if(S||z)return;e.preventDefault();let t=Q.current;t&&le(t,e)}},k,Le,Re,je,e=>J.getValidationProps(z,e)],stateAttributesMapping:qe});return(0,D.jsxs)(ye.Provider,{value:$,children:[Je,!Y&&!I&&B&&!x&&T!==void 0&&(0,D.jsx)(`input`,{type:`hidden`,form:p,name:B,value:T,disabled:z}),(0,D.jsx)(`input`,{...Ke,suppressHydrationWarning:!0})]})}),xe=C.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,c=E(),l=c.checked||c.indeterminate,{mounted:ee,transitionStatus:u,setMounted:d}=m(l),f=C.useRef(null),h={...c,transitionStatus:u};g({open:l,ref:f,onComplete(){l||d(!1)}});let _={..._e(c),...p},te=a||ee,ne=s(`span`,e,{ref:[t,f],state:h,stateAttributesMapping:_,props:o});return te?ne:null});function k({className:e,...t}){return(0,D.jsx)(O,{className:l(`relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none`,e),"data-slot":`checkbox`,...t,children:(0,D.jsx)(xe,{className:`-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground`,"data-slot":`checkbox-indicator`,render:(e,t)=>(0,D.jsx)(`span`,{...e,children:t.indeterminate?(0,D.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,D.jsx)(`path`,{d:`M5.252 12h13.496`})}):(0,D.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,D.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})})})})}function A({repos:e,selectedPaths:t,onToggle:n,loading:r,emptyHint:i,className:a}){let[o,s]=(0,C.useState)(``),c=(0,C.useMemo)(()=>{let t=o.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,o]);return(0,D.jsxs)(`div`,{className:l(`flex flex-col gap-2`,a),children:[(0,D.jsxs)(`div`,{className:`relative`,children:[(0,D.jsx)(x,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,D.jsx)(v,{value:o,onChange:e=>s(e.target.value),placeholder:`Filter repositories…`,className:`pl-8`,"aria-label":`Filter repositories`})]}),(0,D.jsx)(`div`,{className:`max-h-56 overflow-y-auto rounded-lg border border-border`,children:r?(0,D.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Scanning for repositories…`}):c.length===0?(0,D.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:i??`No repositories found.`}):(0,D.jsx)(`ul`,{className:`divide-y divide-border`,children:c.map(e=>{let r=t.includes(e.path);return(0,D.jsx)(`li`,{children:(0,D.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 px-3 py-2 hover:bg-accent`,children:[(0,D.jsx)(k,{checked:r,onCheckedChange:()=>n(e),"aria-label":e.name}),(0,D.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,D.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,D.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]})},e.path)})})})]})}function j({onCreated:e}){let[t,n]=(0,C.useState)(!1),[r,i]=(0,C.useState)(``),[a,o]=(0,C.useState)(null),s=b(),c=async()=>{o(null);try{let{repo:t}=await s.mutateAsync(r.trim());i(``),n(!1),e(t)}catch(e){o(e instanceof Error?e.message:String(e))}};return t?(0,D.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(v,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&r.trim()&&c(),placeholder:`new-repo-name`,className:`h-7 font-mono text-xs`,"aria-label":`New repository name`,autoFocus:!0}),(0,D.jsxs)(d,{size:`xs`,onClick:c,disabled:!r.trim()||s.isPending,children:[s.isPending?(0,D.jsx)(S,{}):null,`Create`]}),(0,D.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>{n(!1),o(null)},children:`Cancel`})]}),a&&(0,D.jsx)(`p`,{className:`text-xs text-destructive-foreground`,children:a})]}):(0,D.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`mt-1.5 inline-flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(me,{className:`size-3.5`}),` Scaffold a brand-new repository`]})}export{A as n,k as r,j as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,i as n}from"./button-CREn1mup.js";var r=t(e(),1).forwardRef(function(e,t){let{className:r,render:i,orientation:a=`horizontal`,style:o,...s}=e;return n(`div`,e,{state:{orientation:a},ref:t,props:[{role:`separator`,"aria-orientation":a},s]})});export{r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,c as n,d as r,g as i,i as a,m as o,p as s,t as c}from"./button-CREn1mup.js";import{En as l,Ln as u,Xt as d,Yt as f,a as p,bt as m,c as ee,i as te,l as h,n as g,nn as ne,o as re,rn as ie,s as ae,sn as _,t as v,xt as y}from"./badge-DTBzXOWn.js";import{t as oe}from"./useValueChanged-WS99hTmm.js";import{t as b}from"./Separator-BgWyHDtg.js";import{t as x}from"./useAriaLabelledBy-BmJErI5a.js";import{C as S,Rt as C,S as w,T,Wt as E,f as D,nn as O,w as k,x as A}from"./index-BTe-_1Mu.js";import{t as j}from"./card-yrg6ov8B.js";import{t as M}from"./label-DC730X8s.js";import{t as N}from"./alert-QnMXzwpU.js";var P=i();function F({className:e,orientation:t=`horizontal`,...n}){return(0,P.jsx)(b,{className:o(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch`,e),"data-slot":`separator`,orientation:t,...n})}var I=t(e(),1),L=I.createContext(void 0);function R(){let e=I.useContext(L);if(e===void 0)throw Error(s(63));return e}var z={...h,checked(e){return e?{"data-checked":``}:{"data-unchecked":``}}},B=I.forwardRef(function(e,t){let{checked:i,className:o,defaultChecked:s,"aria-labelledby":c,form:h,id:g,inputRef:v,name:b,nativeButton:S=!1,onCheckedChange:C,readOnly:w=!1,required:T=!1,disabled:E=!1,render:D,uncheckedValue:O,value:k,style:A,...j}=e,{clearErrors:M}=ae(),{state:N,setTouched:F,setDirty:R,validityData:B,setFilled:V,setFocused:H,validationMode:U,disabled:se,name:ce,validation:W}=ee(),{labelId:le}=re(),G=se||E,K=ce??b,q=I.useRef(null),ue=r(q,v,W.inputRef),J=I.useRef(null),Y=d(),X=p({id:g,implicit:!1,controlRef:J}),Z=S?void 0:X,[Q,de]=l({controlled:i,default:!!s,name:`Switch`,state:`checked`});te(J,Y,Q,void 0,!G,b),_(()=>{q.current&&V(q.current.checked)},[V]),oe(Q,()=>{M(K),R(Q!==B.initialValue),V(Q),W.change(Q)});let{getButtonProps:fe,buttonRef:pe}=ne({disabled:G,native:S}),me=x(c,le,q,!S,Z),he={id:S?X:Y,role:`switch`,"aria-checked":Q,"aria-readonly":w||void 0,"aria-required":T||void 0,"aria-labelledby":me,onFocus(){G||H(!0)},onBlur(){let e=q.current;!e||G||(F(!0),H(!1),U===`onBlur`&&W.commit(e.checked))},onClick(e){if(w||G)return;e.preventDefault();let t=q.current;t&&ie(t,e)}},ge={...W.getValidationProps(G),checked:Q,disabled:G,form:h,id:Z,name:K,required:T,style:K?y:m,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:ue,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(w){e.preventDefault();return}let t=e.currentTarget.checked,n=f(u,e.nativeEvent);C?.(t,n),!n.isCanceled&&de(t)},onClick(e){e.stopPropagation()},onFocus(){J.current?.focus()},...k===void 0?n:{value:k}},$=I.useMemo(()=>({...N,checked:Q,disabled:G,readOnly:w,required:T}),[N,Q,G,w,T]),_e=a(`span`,e,{state:$,ref:[t,J,pe],props:[he,j,fe,e=>W.getValidationProps(G,e)],stateAttributesMapping:z});return(0,P.jsxs)(L.Provider,{value:$,children:[_e,!Q&&K&&O!==void 0&&(0,P.jsx)(`input`,{type:`hidden`,form:h,name:K,value:O,disabled:G}),(0,P.jsx)(`input`,{...ge,suppressHydrationWarning:!0})]})}),V=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...o}=e,s=R();return a(`span`,e,{state:s,ref:t,stateAttributesMapping:z,props:o})});function H({className:e,...t}){return(0,P.jsx)(B,{className:o(`inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 cursor-pointer items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]`,e),"data-slot":`switch`,...t,children:(0,P.jsx)(V,{className:o(`pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]`),"data-slot":`switch-thumb`})})}function U({config:e,setConfig:t,saveStatus:n,editors:r,adapters:i,saveAppConfig:a,isSettingsFormValid:o,toolsStatus:s,toolsLoading:l,updatingToolId:u,fetchToolsStatus:d,handleUpdateTool:f}){if(!e)return null;let p=r.find(t=>t.command===e.defaultEditor),m=i.find(t=>t.name===(e.storageProvider||`local`));return(0,P.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,P.jsxs)(`header`,{className:`mb-6 border-b border-border/70 pb-4`,children:[(0,P.jsx)(`h1`,{className:`text-xl font-bold tracking-tight text-foreground`,children:`Global Settings`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Configure your local development directories, AI search parameters, storage adapters, and editor defaults.`})]}),n===`success`&&(0,P.jsxs)(N,{variant:`success`,className:`mb-6`,children:[(0,P.jsx)(O,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,P.jsxs)(N,{variant:`error`,className:`mb-6`,children:[(0,P.jsx)(C,{size:18}),` Error: Could not save configuration details to disk.`]}),(0,P.jsx)(j,{className:`mb-6 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-6 shadow-xs`,children:(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-devDir`,className:`text-sm`,children:`Development Directory`}),(0,P.jsx)(g,{type:`text`,id:`settings-devDir`,value:e.devDir,onChange:n=>t({...e,devDir:n.target.value})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where your git projects are scanned.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-workspacesDir`,className:`text-sm`,children:`Workspaces Directory`}),(0,P.jsx)(g,{type:`text`,id:`settings-workspacesDir`,value:e.workspacesDir,onChange:n=>t({...e,workspacesDir:n.target.value})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where unified worktree environments are spun up.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-scanDepth`,className:`text-sm`,children:`Repo Search Depth`}),(0,P.jsx)(g,{type:`number`,min:1,max:5,id:`settings-scanDepth`,value:e.scanDepth,onChange:n=>t({...e,scanDepth:parseInt(n.target.value,10)})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Max directory levels deep the system will traverse for git repos.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:`Default Assistant`}),(0,P.jsxs)(A,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,P.jsx)(k,{"aria-label":`Default Assistant`,children:(0,P.jsx)(T,{children:e.defaultAssistant===`claude`?`Claude Code`:e.defaultAssistant===`antigravity`?`Antigravity`:e.defaultAssistant===`codex`?`Codex`:e.defaultAssistant===`copilot`?`GitHub Copilot`:e.defaultAssistant===`cursor`?`Cursor`:`None (Prompt me)`})}),(0,P.jsxs)(S,{alignItemWithTrigger:!1,children:[(0,P.jsx)(w,{value:``,children:`None (Prompt me)`}),(0,P.jsx)(w,{value:`claude`,children:`Claude Code`}),(0,P.jsx)(w,{value:`antigravity`,children:`Antigravity`}),(0,P.jsx)(w,{value:`codex`,children:`Codex`}),(0,P.jsx)(w,{value:`copilot`,children:`GitHub Copilot`}),(0,P.jsx)(w,{value:`cursor`,children:`Cursor`})]})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your preferred workspace context manager.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:`Preferred Editor`}),(0,P.jsxs)(A,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,P.jsx)(k,{"aria-label":`Preferred Editor`,children:(0,P.jsx)(T,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`No preference`})}),(0,P.jsxs)(S,{alignItemWithTrigger:!1,children:[(0,P.jsx)(w,{value:``,children:`No preference`}),r.map(e=>(0,P.jsxs)(w,{value:e.command,children:[e.name,` `,e.detected?`(Detected)`:`(Not found)`]},e.command))]})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Shown first in the “Open with…” workspace chooser.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 md:col-span-2`,children:[(0,P.jsx)(F,{className:`mt-1`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Workspace Storage Settings`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose where maps, plans, and knowledge files are stored.`})]}),(0,P.jsxs)(`div`,{className:`flex max-w-md flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,P.jsxs)(A,{value:e.storageProvider||`local`,onValueChange:n=>{if(typeof n!=`string`)return;let r=n,a={...e,storageProvider:r},o=i.find(e=>e.name===r);o?.configFields?.length&&(a.adapterConfig||={},a.adapterConfig[r]||(a.adapterConfig[r]={}),o.configFields.forEach(e=>{a.adapterConfig[r][e.key]===void 0&&e.default!==void 0&&(a.adapterConfig[r][e.key]=e.default)})),t(a)},children:[(0,P.jsx)(k,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,P.jsx)(T,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,P.jsx)(S,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,P.jsx)(w,{value:e.name,children:e.displayName},e.name)):(0,P.jsx)(w,{value:`local`,children:`Local Workspace (Folders)`})})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m?.description||`Choose where to store maps, plans, and knowledge files. Centralized vault keeps repositories 100% clean and allows Obsidian integration.`})]}),(()=>{let n=e.storageProvider||`local`,r=i.find(e=>e.name===n);return r?.configFields?.length?(0,P.jsxs)(`div`,{className:`flex max-w-md flex-col gap-4 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,P.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[r.displayName,` Settings`]}),r.configFields.map(r=>{let i=e.adapterConfig?.[n]?.[r.key]??r.default??``,a=i=>{let a={...e.adapterConfig||{},[n]:{...e.adapterConfig?.[n]||{},[r.key]:i}};t({...e,adapterConfig:a})};return r.type===`boolean`?(0,P.jsxs)(M,{className:`flex cursor-pointer items-start gap-3 text-sm`,children:[(0,P.jsx)(H,{checked:!!i,onCheckedChange:e=>a(e)}),(0,P.jsxs)(`span`,{className:`flex flex-col`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r.label}),r.description&&(0,P.jsx)(`span`,{className:`mt-0.5 text-xs leading-normal text-muted-foreground`,children:r.description})]})]},r.key):(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:r.label}),(0,P.jsx)(g,{type:r.type===`number`?`number`:`text`,value:i,onChange:e=>{let t=r.type===`number`?Number(e.target.value):e.target.value;a(t)}}),r.description&&(0,P.jsx)(`span`,{className:`text-xs leading-normal text-muted-foreground`,children:r.description})]},r.key)})]}):null})()]})]})}),(0,P.jsxs)(j,{className:`mt-6 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-6 shadow-xs`,children:[(0,P.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`AI Toolchain Updates`}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Monitor and update the CLI packages and assistants in your workflow.`})]}),(0,P.jsxs)(c,{variant:`outline`,size:`sm`,onClick:()=>d(!0),disabled:l,children:[l?(0,P.jsx)(D,{className:`size-3`}):(0,P.jsx)(E,{size:13}),l?`Checking...`:`Check Now`]})]}),l&&s.length===0?(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,P.jsx)(D,{className:`size-6`}),(0,P.jsx)(`span`,{className:`text-xs`,children:`Fetching registry version details...`})]}):s.length===0?(0,P.jsx)(`p`,{className:`py-4 text-xs text-muted-foreground`,children:`No toolchain information available.`}):(0,P.jsx)(`div`,{className:`space-y-4`,children:s.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[e.name,(0,P.jsx)(v,{variant:e.installed?`success`:`secondary`,size:`sm`,children:e.installed?`Installed`:`Not Installed`})]}),(0,P.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,P.jsxs)(`span`,{children:[`Installed version: `,(0,P.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.currentVersion})]}),e.installed&&(0,P.jsxs)(`span`,{children:[`Latest: `,(0,P.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.latestVersion})]})]}),(0,P.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.updateCmd})]}),(0,P.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:e.updateAvailable?(0,P.jsx)(c,{size:`sm`,onClick:()=>f(e.id),disabled:u!==null,children:u===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsxs)(v,{variant:`success`,className:`gap-1.5`,children:[(0,P.jsx)(O,{size:12}),` Up to Date`]}),(0,P.jsx)(c,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:u!==null,children:u===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Reinstalling...`]}):`Reinstall`})]}):(0,P.jsx)(c,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:u!==null,children:u===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Installing...`]}):`Install CLI`})})]},e.id))})]}),(0,P.jsx)(`div`,{className:`mb-10 flex justify-end pt-4`,children:(0,P.jsxs)(c,{onClick:()=>a(e),disabled:!o,children:[(0,P.jsx)(O,{size:16}),` Save Configuration`]})})]})}export{U as SettingsPage};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-CREn1mup.js";import{n as o,t as s}from"./badge-DTBzXOWn.js";import{t as ee}from"./chevron-down-B_Mwbim8.js";import{n as c,r as te,t as l}from"./shield-check-Dd1Yv3l2.js";import{t as ne}from"./code-xml-DH-38Tt7.js";import{a as re,i as ie,n as u,r as d,t as ae}from"./square-check-big-BSIiYXPI.js";import{t as f}from"./layers-j_brOuoa.js";import{t as p}from"./trash-2-CMdv3eD3.js";import{$t as m,Bt as oe,Ft as h,Gt as se,I as ce,It as le,J as ue,L as de,Mt as fe,Ut as pe,Vt as me,X as he,Xt as ge,Z as _e,a as ve,at as ye,f as be,g,h as _,i as xe,k as Se,lt as Ce,m as v,n as y,nn as we,o as Te,p as b,q as Ee,r as De,rn as x,rt as Oe,s as ke,v as S,y as C,zt as w}from"./index-BTe-_1Mu.js";import{t as Ae}from"./card-yrg6ov8B.js";import{t as T}from"./label-DC730X8s.js";var je=r(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Me=r(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ne=r(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Pe=r(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Fe=r(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),E=t(e(),1),D=n(),O={"git-pull-request":d,"flask-conical":ie,package:u,database:re,"shield-check":l,terminal:w,zap:h,cpu:m,layers:f,boxes:x,code:ne},Ie=[{label:`Blue`,value:`#3b82f6`},{label:`Green`,value:`#10b981`},{label:`Purple`,value:`#8b5cf6`},{label:`Amber`,value:`#f59e0b`},{label:`Red`,value:`#ef4444`},{label:`Cyan`,value:`#06b6d4`},{label:`Pink`,value:`#ec4899`},{label:`Emerald`,value:`#059669`}];function k({showToast:e}){let[t,n]=(0,E.useState)(`global`),[r,l]=(0,E.useState)(``),[ne,re]=(0,E.useState)({}),[ie,u]=(0,E.useState)(!1),[d,f]=(0,E.useState)(null),[m,h]=(0,E.useState)(!1),[w,k]=(0,E.useState)(null),[Le,A]=(0,E.useState)(!1),[j,M]=(0,E.useState)(`edit`),[Re,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(null),[ze,I]=(0,E.useState)(!1),[L,R]=(0,E.useState)(null),[Be,Ve]=(0,E.useState)(null),[z,B]=(0,E.useState)(null),{data:V=[],isLoading:He}=he(),{data:H=[],isLoading:Ue}=_e(t===`global`?void 0:t),{data:We=[]}=ye(),{data:U,isLoading:Ge,isError:Ke}=Oe(t===`global`?``:t),[W,G]=(0,E.useState)(null),qe=ue(),Je=de(),K=Ee(),Ye=ce(),q=Se(),J=t!==`global`,Y=new Set(W??U?.enabledSkills??[]),X=!J||!Ge&&!Ke&&!!U;(0,E.useEffect)(()=>{if(!J){G(null);return}U&&G([...U.enabledSkills])},[J,t,U]);let Xe=e=>{re(t=>({...t,[e]:!t[e]}))},Z=H.filter(e=>{if(!r.trim())return!0;let t=r.toLowerCase();return e.title?.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))}),Ze=V.reduce((e,t)=>(e[t.id]=Z.filter(e=>e.category===t.id),e),{}),Q=Z.filter(e=>!e.category||!V.some(t=>t.id===e.category)),Qe=e=>{f(e||{name:``,description:``,icon:`boxes`,color:`#3b82f6`,custom:!0}),u(!0)},$e=async()=>{if(!(!d||!d.name?.trim()))try{await qe.mutateAsync({id:d.id,name:d.name.trim(),description:d.description,icon:d.icon,color:d.color}),e?.(`Category saved successfully`,`success`),u(!1),f(null)}catch(t){e?.(`Failed to save category`,`error`),console.error(t)}},et=(e,t)=>{t.stopPropagation(),R({type:`category`,id:e.id,title:e.name}),I(!0)},$=(e,t)=>{k(e||{name:``,title:``,category:t||(V[0]?.id??`pull-requests`),description:``,tags:[],allowedTools:[],content:`# Skill Title
|
|
2
|
-
|
|
3
|
-
Instructions and playbook for the AI assistant.
|
|
4
|
-
`,custom:!0}),A(!!e),M(`edit`),h(!0)},tt=e=>{if(!w)return;let t={...w,title:e};!Le&&!w.id&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),k(t)},nt=async()=>{if(!w||!w.name?.trim()||!w.description?.trim()||!w.content?.trim()){e?.(`Skill name, trigger description, and content are required`,`error`);return}try{await K.mutateAsync({id:w.id,name:w.name.trim(),title:w.title||w.name,category:w.category||`general`,description:w.description||``,tags:w.tags||[],allowedTools:w.allowedTools||[],content:w.content}),e?.(`Skill package saved successfully`,`success`),h(!1),k(null)}catch(t){e?.(`Failed to save skill`,`error`),console.error(t)}},rt=(e,t)=>{t.stopPropagation(),R({type:`skill`,id:e.id,title:e.title||e.name}),I(!0)},it=async()=>{if(L)try{L.type===`category`?(await Je.mutateAsync(L.id),e?.(`Category deleted`,`info`)):(await Ye.mutateAsync(L.id),e?.(`Skill package deleted`,`info`)),I(!1),R(null)}catch(t){e?.(`Failed to delete item`,`error`),console.error(t)}},at=e=>{if(!J||!X||W===null)return;let t=new Set(W);t.has(e)?t.delete(e):t.add(e),G(Array.from(t))},ot=()=>{if(!w||w.custom!==!1)return;let e=`${w.name}-copy`;k({...w,id:void 0,name:e,title:`${w.title||w.name} Copy`,allowedTools:[],custom:!0,sourcePath:void 0,references:void 0,scripts:void 0}),A(!0)},st=(e,t)=>{if(!J||!X||W===null)return;let n=Ze[e]||[],r=new Set(W);for(let e of n)t?r.add(e.id):r.delete(e.id);G(Array.from(r))},ct=async()=>{if(!(!U||W===null||!J))try{await q.mutateAsync({workspaceId:t,expectedRevision:U.revision??0,enabledSkills:W,enabledAgents:U.enabledAgents??[],enabledCategories:V.map(e=>e.id)}),e?.(`Skill selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save skill selection`,`error`)}},lt=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`,Ve(t)},ut=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,z!==t&&B(t)},dt=()=>{B(null)},ft=async(t,n)=>{t.preventDefault(),B(null);let r=t.dataTransfer.getData(`text/plain`)||Be;if(Ve(null),!r)return;let i=H.find(e=>e.id===r);!i||!i.custom||J||i.category===n||(await K.mutateAsync({id:i.id,name:i.name,title:i.title,description:i.description,tags:i.tags,allowedTools:i.allowedTools,content:i.content,category:n}),e?.(`Skill re-categorized`,`success`))},pt=(e,t)=>{t.stopPropagation(),F(e),N(!0)},mt=async t=>{if(!P||P.category===t){N(!1),F(null);return}await K.mutateAsync({id:P.id,name:P.name,title:P.title,description:P.description,tags:P.tags,allowedTools:P.allowedTools,content:P.content,category:t}),e?.(`Skill moved to category`,`success`),N(!1),F(null)};return(0,D.jsxs)(`div`,{className:`flex-1 flex flex-col h-full overflow-hidden bg-background text-foreground`,children:[(0,D.jsxs)(`div`,{className:`p-6 border-b border-border flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-card/40 backdrop-blur-sm`,children:[(0,D.jsx)(`div`,{children:(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,D.jsx)(x,{className:`h-6 w-6`})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Skill Library`}),(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create, organize, and assign reusable Agent Skill packages.`})]})]})}),(0,D.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,D.jsx)(a,{render:(0,D.jsx)(fe,{to:`/agents`}),variant:`outline`,size:`sm`,children:`Codex Agents`}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/50 rounded-lg px-3 py-1.5 border border-border`,children:[(0,D.jsx)(ge,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(T,{htmlFor:`skill-scope`,className:`text-xs font-medium text-muted-foreground`,children:`Scope:`}),(0,D.jsxs)(`select`,{id:`skill-scope`,value:t,onChange:e=>n(e.target.value),className:`bg-transparent text-xs font-semibold focus:outline-none cursor-pointer text-foreground`,children:[(0,D.jsx)(`option`,{value:`global`,className:`bg-popover text-popover-foreground`,children:`🌐 Global Skills Catalog`}),We.map(e=>(0,D.jsxs)(`option`,{value:e.id,className:`bg-popover text-popover-foreground`,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))]})]}),J&&(0,D.jsx)(a,{size:`sm`,onClick:ct,disabled:!X||q.isPending||W===null,children:q.isPending?`Saving…`:`Save selection`}),!J&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(a,{variant:`outline`,size:`sm`,onClick:()=>Qe(),className:`flex items-center gap-1.5`,children:[(0,D.jsx)(se,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`New Category`})]}),(0,D.jsxs)(a,{variant:`default`,size:`sm`,onClick:()=>$(),className:`flex items-center gap-1.5`,children:[(0,D.jsx)(me,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`New Skill`})]})]})]})]}),(0,D.jsxs)(`div`,{className:`px-6 py-3 border-b border-border/60 bg-muted/20 flex items-center justify-between gap-4`,children:[(0,D.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,D.jsx)(pe,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,D.jsx)(o,{value:r,onChange:e=>l(e.target.value),placeholder:`Search skills by keyword, tag, or tool...`,className:`pl-9 pr-8 h-9 text-xs`}),r&&(0,D.jsx)(`button`,{onClick:()=>l(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,D.jsx)(le,{className:`h-3.5 w-3.5`})})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,D.jsxs)(`span`,{children:[`Showing `,(0,D.jsx)(`strong`,{className:`text-foreground`,children:Z.length}),` of`,` `,(0,D.jsx)(`strong`,{className:`text-foreground`,children:H.length}),` skills`]}),J&&(0,D.jsxs)(s,{variant:`secondary`,className:`text-[10px] uppercase font-mono`,children:[`Workspace Mode (`,Y.size,` active)`]})]})]}),(0,D.jsx)(Ce,{className:`flex-1 p-6`,children:He||Ue||J&&Ge?(0,D.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,D.jsx)(be,{}),(0,D.jsx)(`span`,{className:`text-sm`,children:`Loading skills catalog...`})]}):J&&Ke?(0,D.jsx)(y,{className:`py-12 border border-dashed rounded-xl`,children:(0,D.jsxs)(xe,{children:[(0,D.jsx)(Te,{children:`Workspace resources could not be loaded`}),(0,D.jsx)(De,{children:`Assignment controls are disabled so an existing selection cannot be overwritten.`})]})}):Z.length===0&&r?(0,D.jsxs)(y,{className:`py-12 border border-dashed rounded-xl`,children:[(0,D.jsx)(ve,{children:(0,D.jsx)(pe,{className:`h-8 w-8 text-muted-foreground/60`})}),(0,D.jsxs)(xe,{children:[(0,D.jsx)(Te,{children:`No matching skills found`}),(0,D.jsxs)(De,{children:[`No skills matched your search query "`,r,`".`]})]}),(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>l(``),children:`Clear Search`})]}):(0,D.jsxs)(`div`,{className:`space-y-6 max-w-7xl mx-auto pb-12`,children:[V.map(e=>{let t=O[e.icon||`boxes`]||x,n=Ze[e.id]||[],r=!!ne[e.id],o=z===e.id,c=n.length>0&&n.every(e=>Y.has(e.id));return(0,D.jsxs)(`div`,{onDragOver:t=>ut(t,e.id),onDragLeave:dt,onDrop:t=>ft(t,e.id),className:i(`border rounded-xl transition-all duration-150 overflow-hidden bg-card/60`,o?`border-primary ring-2 ring-primary/20 bg-primary/5`:`border-border`),children:[(0,D.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>Xe(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Xe(e.id))},className:`p-4 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors border-b border-border/40 select-none`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`p-2 rounded-lg text-white shadow-sm flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,D.jsx)(t,{className:`h-4 w-4`})}),(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`h2`,{className:`font-semibold text-sm tracking-tight`,children:e.name}),(0,D.jsxs)(s,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[n.length,` `,n.length===1?`skill`:`skills`]}),e.isTemplate&&!e.custom&&(0,D.jsx)(s,{variant:`secondary`,className:`text-[9px] px-1 py-0 uppercase`,children:`Template`})]}),e.description&&(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description})]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[J&&n.length>0&&(0,D.jsxs)(a,{variant:`ghost`,size:`xs`,onClick:()=>st(e.id,!c),className:`h-7 text-xs mr-2 text-muted-foreground hover:text-foreground`,title:c?`Deselect all in category`:`Select all in category`,children:[c?(0,D.jsx)(ae,{className:`h-3.5 w-3.5 mr-1 text-primary`}):(0,D.jsx)(oe,{className:`h-3.5 w-3.5 mr-1`}),(0,D.jsx)(`span`,{children:c?`Deselect All`:`Select All`})]}),!J&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>$(void 0,e.id),title:`Add skill to this category`,children:(0,D.jsx)(se,{className:`h-3.5 w-3.5`})}),!J&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:()=>Qe(e),title:`Edit category`,children:(0,D.jsx)(Pe,{className:`h-3 w-3`})}),!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>et(e,t),title:`Delete category`,className:`text-destructive hover:text-destructive`,children:(0,D.jsx)(p,{className:`h-3 w-3`})}),(0,D.jsx)(`div`,{className:`p-1 text-muted-foreground`,children:r?(0,D.jsx)(te,{className:`h-4 w-4`}):(0,D.jsx)(ee,{className:`h-4 w-4`})})]})]}),!r&&(0,D.jsx)(`div`,{className:`p-4 bg-background/50`,children:n.length===0?(0,D.jsxs)(`div`,{className:`border border-dashed border-border/80 rounded-lg p-6 text-center text-xs text-muted-foreground`,children:[`No skills in this category.`,!J&&(0,D.jsxs)(D.Fragment,{children:[` `,`Drag a custom skill here, or click`,` `,(0,D.jsx)(`button`,{onClick:()=>$(void 0,e.id),className:`text-primary underline font-medium`,children:`+ Add Skill`})]})]}):(0,D.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:n.map(e=>{let t=Y.has(e.id);return(0,D.jsxs)(Ae,{draggable:!J&&!!e.custom,onDragStart:t=>{!J&&e.custom&<(t,e.id)},onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:i(`group relative cursor-pointer hover:border-primary/60 transition-all p-3.5 flex flex-col justify-between select-none shadow-sm`,J&&!t&&`opacity-60 bg-muted/20`,Be===e.id&&`opacity-40 border-dashed`),children:[(0,D.jsxs)(`div`,{children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground group-hover:text-foreground cursor-grab active:cursor-grabbing`,title:`Drag to reorder or re-categorize`,"aria-label":`Drag handle`,children:[(0,D.jsx)(Ne,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground`,children:e.title||e.name})]}),J?(0,D.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),at(e.id)},disabled:!X||q.isPending,className:i(`h-5 px-2 rounded-md flex items-center gap-1 text-[10px] font-semibold transition-colors`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-muted/80`),children:[(0,D.jsx)(we,{className:i(`h-3 w-3`,!t&&`opacity-0`)}),(0,D.jsx)(`span`,{children:t?`Enabled`:`Disabled`})]}):(0,D.jsx)(s,{variant:`outline`,className:`text-[10px] font-mono`,children:e.custom?`Custom`:`Template`})]}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-3 leading-relaxed`,children:e.description||`No description provided.`})]}),(0,D.jsxs)(`div`,{className:`pt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags?.slice(0,2).map(e=>(0,D.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)),e.allowedTools&&e.allowedTools.length>0&&(0,D.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,D.jsx)(Fe,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>pt(e,t),title:`Move to another category`,className:`h-6 w-6 text-muted-foreground hover:text-foreground`,children:(0,D.jsx)(je,{className:`h-3 w-3`})}),!J&&e.custom&&(0,D.jsx)(a,{variant:`ghost`,size:`icon-xs`,onClick:t=>rt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive`,children:(0,D.jsx)(p,{className:`h-3 w-3`})})]})]})]},e.id)})})})]},e.id)}),Q.length>0&&(0,D.jsxs)(`div`,{className:`border border-border/80 rounded-xl overflow-hidden bg-card/60`,children:[(0,D.jsx)(`div`,{className:`p-4 bg-muted/30 border-b border-border/40 flex items-center justify-between`,children:(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(x,{className:`h-4 w-4 text-muted-foreground`}),(0,D.jsx)(`h2`,{className:`font-semibold text-sm`,children:`Uncategorized Skills`}),(0,D.jsx)(s,{variant:`outline`,className:`text-[10px]`,children:Q.length})]})}),(0,D.jsx)(`div`,{className:`p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:Q.map(e=>(0,D.jsxs)(Ae,{onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:`p-3.5 cursor-pointer hover:border-primary/60`,children:[(0,D.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,D.jsx)(`div`,{className:`font-mono text-xs font-bold`,children:e.title||e.name}),J&&(0,D.jsx)(a,{size:`xs`,variant:Y.has(e.id)?`default`:`outline`,disabled:!X||q.isPending,onClick:t=>{t.stopPropagation(),at(e.id)},children:Y.has(e.id)?`Enabled`:`Disabled`})]}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]},e.id))})]})]})}),(0,D.jsx)(b,{open:ie,onOpenChange:u,children:(0,D.jsxs)(S,{className:`sm:max-w-lg`,children:[(0,D.jsxs)(g,{children:[(0,D.jsx)(C,{children:d?.id?`Edit Skill Category`:`Create Skill Category`}),(0,D.jsx)(v,{children:`Categories group related procedural skills and agent tools into clean visual boxes.`})]}),(0,D.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`cat-name`,className:`text-xs font-medium`,children:`Category Name`}),(0,D.jsx)(o,{id:`cat-name`,value:d?.name||``,onChange:e=>f(t=>t?{...t,name:e.target.value}:null),placeholder:`e.g. Pull Requests & Review`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`cat-desc`,className:`text-xs font-medium`,children:`Description`}),(0,D.jsx)(o,{id:`cat-desc`,value:d?.description||``,onChange:e=>f(t=>t?{...t,description:e.target.value}:null),placeholder:`Brief summary of what skills belong in this box...`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{className:`text-xs font-medium`,children:`Icon`}),(0,D.jsx)(`div`,{className:`grid grid-cols-6 gap-2 mt-1.5`,children:Object.keys(O).map(e=>{let t=O[e],n=(d?.icon||`boxes`)===e;return(0,D.jsx)(`button`,{type:`button`,onClick:()=>f(t=>t?{...t,icon:e}:null),className:i(`p-2.5 rounded-lg border flex items-center justify-center transition-colors`,n?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted text-muted-foreground`),children:(0,D.jsx)(t,{className:`h-4 w-4`})},e)})})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{className:`text-xs font-medium`,children:`Color Accent`}),(0,D.jsx)(`div`,{className:`flex items-center gap-2 mt-1.5 flex-wrap`,children:Ie.map(e=>{let t=d?.color===e.value;return(0,D.jsx)(`button`,{type:`button`,"aria-label":`Select color ${e.label}`,onClick:()=>f(t=>t?{...t,color:e.value}:null),className:i(`w-7 h-7 rounded-full transition-transform flex items-center justify-center shadow-sm`,t?`scale-110 ring-2 ring-primary ring-offset-2`:`hover:scale-105`),style:{backgroundColor:e.value},children:t&&(0,D.jsx)(we,{className:`h-3.5 w-3.5 text-white`})},e.value)})})]})]}),(0,D.jsxs)(_,{children:[(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>u(!1),children:`Cancel`}),(0,D.jsx)(a,{variant:`default`,size:`sm`,onClick:$e,disabled:!d?.name?.trim(),children:`Save Category`})]})]})}),(0,D.jsx)(b,{open:m,onOpenChange:h,children:(0,D.jsxs)(S,{className:`sm:max-w-3xl max-h-[90vh] flex flex-col`,children:[(0,D.jsx)(g,{children:(0,D.jsxs)(`div`,{className:`flex items-center justify-between pr-6`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(C,{children:w?.id?`Edit Skill Package`:`Create New Skill`}),(0,D.jsx)(v,{children:`Configure SKILL.md metadata triggers and markdown playbook instructions.`})]}),(0,D.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/60 p-1 rounded-lg border border-border text-xs`,children:[(0,D.jsxs)(`button`,{type:`button`,onClick:()=>M(`edit`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,j===`edit`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,D.jsx)(c,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`Edit`})]}),(0,D.jsxs)(`button`,{type:`button`,onClick:()=>M(`preview`),className:i(`px-2.5 py-1 rounded-md flex items-center gap-1 font-medium transition-colors`,j===`preview`?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[(0,D.jsx)(Me,{className:`h-3.5 w-3.5`}),(0,D.jsx)(`span`,{children:`Preview`})]})]})]})}),(0,D.jsx)(Ce,{className:`flex-1 pr-4 py-2`,children:j===`edit`?(0,D.jsxs)(`div`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,D.jsx)(o,{id:`skill-title`,value:w?.title||``,onChange:e=>tt(e.target.value),placeholder:`e.g. Pull Request Reviewer`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,D.jsx)(o,{id:`skill-name`,value:w?.name||``,disabled:!!w?.id,onChange:e=>{A(!0),k(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. pr-review-toolkit`,className:`mt-1 text-xs font-mono`})]})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-cat`,className:`text-xs font-medium`,children:`Category Box`}),(0,D.jsx)(`select`,{id:`skill-cat`,value:w?.category||``,onChange:e=>k(t=>t?{...t,category:e.target.value}:null),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-primary`,children:V.map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-tags`,className:`text-xs font-medium`,children:`Tags (comma separated)`}),(0,D.jsx)(o,{id:`skill-tags`,value:w?.tags?.join(`, `)||``,onChange:e=>k(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. git, pr, quality`,className:`mt-1 text-xs font-mono`})]})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (for AI Autonomous Discovery)`}),(0,D.jsx)(o,{id:`skill-desc`,value:w?.description||``,onChange:e=>k(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when reviewing PR diffs or when user asks for a PR audit...`,className:`mt-1 text-xs`})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(T,{htmlFor:`skill-content`,className:`text-xs font-medium`,children:`Playbook Instructions (Markdown)`}),(0,D.jsx)(ke,{id:`skill-content`,value:w?.content||``,onChange:e=>k(t=>t?{...t,content:e.target.value}:null),rows:12,placeholder:`# Playbook Title
|
|
5
|
-
|
|
6
|
-
Detailed instructions for the AI assistant...`,className:`mt-1 font-mono text-xs leading-relaxed`})]})]}):(0,D.jsxs)(`div`,{className:`p-4 border rounded-xl bg-card/40 prose prose-sm dark:prose-invert max-w-none`,children:[(0,D.jsxs)(`div`,{className:`mb-4 pb-3 border-b`,children:[(0,D.jsx)(`h2`,{className:`text-lg font-bold m-0`,children:w?.title||w?.name}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground m-0 mt-1`,children:w?.description})]}),(0,D.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap font-sans bg-transparent p-0 border-0`,children:w?.content||`*(No playbook markdown provided)*`})]})}),(0,D.jsxs)(_,{className:`mt-4 pt-3 border-t`,children:[(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>h(!1),children:`Cancel`}),(0,D.jsx)(a,{variant:`default`,size:`sm`,onClick:w?.custom===!1?ot:nt,disabled:!w?.name?.trim()||!w?.description?.trim()||!w?.content?.trim(),children:w?.custom===!1?`Create editable copy`:`Save Skill`})]})]})}),(0,D.jsx)(b,{open:Re,onOpenChange:N,children:(0,D.jsxs)(S,{className:`sm:max-w-md`,children:[(0,D.jsxs)(g,{children:[(0,D.jsx)(C,{children:`Move Skill to Category`}),(0,D.jsxs)(v,{children:[`Select the destination category box for "`,P?.title||P?.name,`".`]})]}),(0,D.jsx)(`div`,{className:`space-y-2 py-2`,children:V.map(e=>{let t=O[e.icon||`boxes`]||x,n=P?.category===e.id;return(0,D.jsxs)(`button`,{type:`button`,onClick:()=>mt(e.id),className:i(`w-full p-3 rounded-lg border text-left flex items-center justify-between transition-colors`,n?`border-primary bg-primary/10`:`border-border hover:bg-muted/50 text-foreground`),children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,D.jsx)(`div`,{className:`p-1.5 rounded text-white flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,D.jsx)(t,{className:`h-4 w-4`})}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`font-semibold text-xs`,children:e.name}),e.description&&(0,D.jsx)(`div`,{className:`text-[11px] text-muted-foreground line-clamp-1`,children:e.description})]})]}),n&&(0,D.jsx)(s,{variant:`secondary`,className:`text-[10px]`,children:`Current`})]},e.id)})}),(0,D.jsx)(_,{children:(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>N(!1),children:`Cancel`})})]})}),(0,D.jsx)(b,{open:ze,onOpenChange:I,children:(0,D.jsxs)(S,{className:`sm:max-w-md`,children:[(0,D.jsxs)(g,{children:[(0,D.jsxs)(C,{className:`text-destructive`,children:[`Delete `,L?.type===`category`?`Category`:`Skill`]}),(0,D.jsxs)(v,{children:[`Are you sure you want to delete "`,L?.title,`"? This action cannot be undone.`]})]}),(0,D.jsxs)(_,{className:`mt-4`,children:[(0,D.jsx)(a,{variant:`outline`,size:`sm`,onClick:()=>I(!1),children:`Cancel`}),(0,D.jsx)(a,{variant:`destructive`,size:`sm`,onClick:it,children:`Delete Permanently`})]})]})})]})}export{k as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-CREn1mup.js";import{n as o,t as s}from"./badge-DTBzXOWn.js";import{t as c}from"./chevron-down-B_Mwbim8.js";import{t as l}from"./code-xml-DH-38Tt7.js";import{n as u,r as d,t as f}from"./ScaffoldRepoInline-DKZ1rPmE.js";import{t as p}from"./git-branch-Ce0I2663.js";import{s as m}from"./brand-hHByyyzq.js";import{$ as h,A as g,At as _,C as v,D as y,Dt as b,Et as x,Ft as S,G as ee,H as te,Mt as ne,N as re,Nt as ie,O as ae,Ot as C,Pt as w,Qt as T,S as E,St as D,T as oe,Tt as se,Vt as ce,W as O,Wt as le,Xt as ue,Z as de,_ as k,a as fe,c as A,cn as pe,en as j,et as me,f as M,g as N,i as he,in as ge,kt as P,l as _e,m as ve,n as F,nn as I,o as L,p as R,r as z,rn as ye,s as be,st as xe,tn as Se,tt as Ce,v as we,w as Te,wt as Ee,x as De,xt as B,y as Oe,zt as V}from"./index-BTe-_1Mu.js";import{n as ke,t as Ae}from"./vsc-eMRaEwN3.js";var H=r(`app-window`,[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]),je=r(`orbit`,[[`path`,{d:`M20.341 6.484A10 10 0 0 1 10.266 21.85`,key:`1enhxb`}],[`path`,{d:`M3.659 17.516A10 10 0 0 1 13.74 2.152`,key:`1crzgf`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`circle`,{cx:`19`,cy:`5`,r:`2`,key:`mhkx31`}],[`circle`,{cx:`5`,cy:`19`,r:`2`,key:`v8kfzx`}]]),Me=r(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),U=t(e(),1),Ne={status:`idle`,steps:[]};function Pe(){let[e,t]=(0,U.useState)(Ne),n=(0,U.useRef)(null),r=(0,U.useRef)(null),i=pe(),a=(0,U.useCallback)(()=>{n.current?.close(),n.current=null,r.current=null},[]);return(0,U.useEffect)(()=>a,[a]),{progress:e,start:(0,U.useCallback)(e=>{if(n.current&&r.current===e)return;a(),r.current=e,t({status:`running`,steps:[]});let o=new EventSource(`/api/workspace/create-stream/${encodeURIComponent(e)}`);n.current=o;let s=0;o.addEventListener(`progress`,r=>{if(n.current===o){s=0;try{let n=JSON.parse(r.data);t({status:n.status===`completed`||n.status===`failed`?n.status:`running`,steps:n.steps??[],error:n.error,workspacePath:n.workspacePath,workspaceId:n.feature?.id??e}),(n.status===`completed`||n.status===`failed`)&&(a(),i.invalidateQueries({queryKey:[`workspaces`]}),i.invalidateQueries({queryKey:[`workspaces-status`]}))}catch{}}}),o.onerror=()=>{n.current===o&&(s+=1,!(o.readyState!==EventSource.CLOSED&&s<5)&&(t(e=>e.status===`running`?{...e,status:`unavailable`,error:e.error??`Unable to reconnect to the creation stream. The workspace may still have been created.`}:e),a(),i.invalidateQueries({queryKey:[`workspaces`]}),i.invalidateQueries({queryKey:[`workspaces-status`]})))}},[a,i]),reset:(0,U.useCallback)(()=>{a(),t(Ne)},[a])}}var W=n(),G=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,K={codex:_,claude:B,vscode:Ae,"vscode-insiders":ke,cursor:D,antigravity:je,powershell:V,cmd:V,terminal:V,intellij:Ee,webstorm:b,pycharm:se,sublime:x,zed:P,windsurf:C},q={codex:`bg-foreground text-background`,claude:`bg-[#D97757] text-white`,vscode:`bg-[#007ACC] text-white`,"vscode-insiders":`bg-[#24A148] text-white`,cursor:`bg-zinc-950 text-white dark:bg-white dark:text-zinc-950`,antigravity:`bg-violet-600 text-white`,powershell:`bg-sky-700 text-white`,cmd:`bg-zinc-800 text-amber-400`,terminal:`bg-zinc-800 text-emerald-400`,intellij:`bg-fuchsia-600 text-white`,webstorm:`bg-cyan-600 text-white`,pycharm:`bg-lime-600 text-zinc-950`,sublime:`bg-orange-500 text-white`,zed:`bg-red-600 text-white`,windsurf:`bg-teal-600 text-white`};function J({icon:e}){let t=K[e]??l;return(0,W.jsx)(`span`,{className:i(`grid size-10 shrink-0 place-items-center rounded-xl shadow-sm`,q[e]),"aria-hidden":`true`,children:(0,W.jsx)(t,{className:`size-5`})})}function Fe({target:e,busy:t,launching:n,preferred:r,onLaunch:a}){return(0,W.jsxs)(`button`,{type:`button`,disabled:!e.available||t,onClick:()=>a(e),"aria-label":`Open workspace in ${e.name}`,className:i(`flex min-h-20 w-full items-center gap-3 rounded-xl border p-3 text-left outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,`cursor-pointer border-border bg-card hover:border-primary/40 hover:bg-accent/60`),children:[(0,W.jsx)(J,{icon:e.icon}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name}),n?(0,W.jsx)(M,{className:`size-4`}):r?(0,W.jsx)(s,{size:`sm`,variant:`secondary`,children:`Preferred`}):null]}),(0,W.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})}function Ie({session:e,busy:t,launching:n,onResume:r}){let a=e.desktopHandoff.method===`direct`,o=a?`Codex Desktop`:`Claude Desktop`;return(0,W.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>r(e),"aria-label":a?`Resume ${e.title} in Codex Desktop`:`Move ${e.title} to Claude Desktop`,className:i(`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/25 bg-primary/5 p-3 text-left outline-none transition-colors`,`hover:border-primary/45 hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-65`),children:[(0,W.jsx)(J,{icon:a?`codex`:`claude`}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-foreground`,title:e.title,children:e.title}),n?(0,W.jsx)(M,{className:`size-4 shrink-0`}):a?(0,W.jsx)(T,{className:`size-4 shrink-0 text-muted-foreground`}):(0,W.jsx)(j,{className:`size-4 shrink-0 text-muted-foreground`})]}),(0,W.jsxs)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-muted-foreground`,children:[a?`Open this existing task in ${o}`:`Resume in Claude Code, then type /desktop`,` · `,new Date(e.updatedAt).toLocaleString()]})]})]})}function Le({workspaceId:e,workspacePath:t,isVsCode:n=!1,className:r}){let[i,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(null),p=(0,U.useRef)(!1),h=me(),_=Ce(e,i),v=g().data?.config,y=h.data?.filter(e=>e.available)??[],b=y.filter(e=>e.kind===`ai-app`),x=v?.defaultEditor?{code:`vscode`,"code-insiders":`vscode-insiders`,cursor:`cursor`,antigravity:`antigravity`,idea:`intellij`,webstorm:`webstorm`,charm:`pycharm`,subl:`sublime`,zed:`zed`,windsurf:`windsurf`}[v.defaultEditor]:void 0,S=y.filter(e=>e.kind===`editor`).toSorted((e,t)=>Number(t.id===x)-Number(e.id===x)),ee=new Set(y.map(e=>e.id)),te=(_.data??[]).filter(e=>e.desktopHandoff&&ee.has(e.desktopHandoff.targetId)),ne=n||y.length>0,re=async t=>{if(!p.current){p.current=!0,u(null),f(null),c(t.id);try{await xe(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await h.refetch()}finally{c(null),p.current=!1}}},ie=async t=>{if(!(p.current||!t.desktopHandoff||!G.test(t.id))){p.current=!0,u(null),f(null),c(`session:${t.id}`);try{if(t.desktopHandoff.method===`guided`){await A(`claude --resume ${t.id}`),f(`Claude resume command copied. With a Claude subscription login, run it in this workspace, then type /desktop in Claude to move the session into Claude Desktop.`);return}await xe(`/api/workspace/${encodeURIComponent(e)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.desktopHandoff.targetId,action:`resume`,sessionId:t.id})}),o(!1)}catch(e){u(e instanceof Error?e.message:String(e)),await Promise.all([h.refetch(),_.refetch()])}finally{c(null),p.current=!1}}},ae=()=>{window.parent.postMessage({type:`openWorkspaceFolder`,workspacePath:t},`*`),o(!1)},C=()=>Promise.all([h.refetch(),_.refetch()]),w=h.isFetching||_.isFetching;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(a,{variant:`outline`,className:r,onClick:()=>o(!0),children:[(0,W.jsx)(Me,{}),`Open with…`]}),(0,W.jsx)(R,{open:i,onOpenChange:e=>{o(e),e||(u(null),f(null))},children:(0,W.jsxs)(we,{className:`max-w-2xl`,"aria-busy":s!==null,children:[(0,W.jsxs)(N,{children:[(0,W.jsx)(Oe,{children:`Open workspace with…`}),(0,W.jsx)(ve,{children:`Continue recent AI work or start in an installed coding app or editor. AI apps may use their own online services.`})]}),(0,W.jsxs)(k,{className:`space-y-5`,children:[l&&(0,W.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive-foreground`,children:l}),d&&(0,W.jsx)(`div`,{role:`status`,className:`rounded-lg border border-primary/25 bg-primary/5 px-3 py-2 text-sm text-foreground`,children:d}),_.isLoading?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,W.jsx)(M,{className:`size-4`}),` Checking recent sessions…`]}):te.length>0?(0,W.jsxs)(`section`,{"aria-labelledby":`recent-sessions-heading`,children:[(0,W.jsx)(`h3`,{id:`recent-sessions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Continue recent work`}),(0,W.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:te.map(e=>(0,W.jsx)(Ie,{session:e,busy:s!==null,launching:s===`session:${e.id}`,onResume:ie},`${e.assistant}:${e.id}`))})]}):_.isError?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent sessions could not be checked. Starting new work is still available.`}):null,n&&(0,W.jsxs)(`section`,{"aria-labelledby":`current-editor-heading`,children:[(0,W.jsx)(`h3`,{id:`current-editor-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Current window`}),(0,W.jsxs)(`button`,{type:`button`,disabled:s!==null,onClick:ae,className:`flex min-h-20 w-full cursor-pointer items-center gap-3 rounded-xl border border-primary/30 bg-primary/5 p-3 text-left outline-none transition-colors hover:bg-primary/10 focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-65`,children:[(0,W.jsx)(J,{icon:`vscode`}),(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block font-medium`,children:`Current VS Code window`}),(0,W.jsxs)(`span`,{className:`mt-0.5 block text-xs text-muted-foreground`,children:[`Open through the installed `,m,` extension.`]})]})]})]}),h.isLoading?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 py-8 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,W.jsx)(M,{}),` Checking apps on this computer…`]}):h.isError?(0,W.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-destructive/30 bg-destructive/10 p-3 text-sm text-destructive-foreground`,children:h.error instanceof Error?h.error.message:`Could not check available apps.`}):(0,W.jsxs)(W.Fragment,{children:[b.length>0&&(0,W.jsxs)(`section`,{"aria-labelledby":`ai-apps-heading`,children:[(0,W.jsx)(`h3`,{id:`ai-apps-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`AI coding apps`}),(0,W.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:b.map(e=>(0,W.jsx)(Fe,{target:e,busy:s!==null,launching:s===e.id,onLaunch:re},e.id))})]}),S.length>0&&(0,W.jsxs)(`section`,{"aria-labelledby":`editors-heading`,children:[(0,W.jsx)(`h3`,{id:`editors-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Code editors`}),(0,W.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:S.map(e=>(0,W.jsx)(Fe,{target:e,busy:s!==null,launching:s===e.id,preferred:e.id===x,onLaunch:re},e.id))})]}),!ne&&(0,W.jsx)(F,{className:`rounded-xl border border-dashed py-8 md:p-8`,children:(0,W.jsxs)(he,{children:[(0,W.jsx)(fe,{variant:`icon`,children:(0,W.jsx)(H,{})}),(0,W.jsx)(L,{className:`text-base`,children:`No compatible apps detected`}),(0,W.jsx)(z,{children:`Install a supported coding app or add its command to PATH, then recheck.`})]})})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-t border-border pt-3`,children:[(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,"aria-live":`polite`,children:w?`Checking recent sessions and apps…`:`Can’t find your app or session? Recheck detection.`}),(0,W.jsxs)(a,{size:`sm`,variant:`ghost`,onClick:()=>void C(),disabled:w||s!==null,children:[(0,W.jsx)(le,{className:w?`animate-spin`:``}),`Recheck`]})]})]})]})})]})}var Re=`__ad-hoc__`,ze=new URLSearchParams(window.location.search).get(`env`)===`vscode`,Be=[{value:`in-place`,icon:S,title:`In-place`,body:`Work directly in the source repos. No branches or worktrees — fastest start.`},{value:`worktree`,icon:p,title:`Isolated worktrees`,body:`A feature branch and worktree per repo. Your source checkouts stay untouched.`}];function Ve({repo:e,value:t,onChange:n,enabled:r}){let i=O(e.path,r),a=(0,U.useMemo)(()=>[...new Set([...i.data?.local??[],...i.data?.remote??[]])],[i.data]),s=`branches-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}`;return(0,W.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`w-40 shrink-0 truncate text-xs`,children:e.name}),(0,W.jsx)(o,{list:s,value:t,onChange:e=>n(e.target.value),placeholder:`existing branch (must exist)`,className:`h-7 font-mono text-xs`}),(0,W.jsx)(`datalist`,{id:s,children:a.map(e=>(0,W.jsx)(`option`,{value:e},e))})]})}function He({step:e}){return(0,W.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,W.jsx)(`span`,{className:i(`grid size-5 shrink-0 place-items-center rounded-full border`,e.status===`completed`&&`border-success bg-success/15 text-success-foreground`,e.status===`running`&&`border-primary text-primary`,e.status===`failed`&&`border-destructive bg-destructive/15 text-destructive-foreground`,e.status===`pending`&&`border-border text-muted-foreground`),children:e.status===`completed`?(0,W.jsx)(I,{className:`size-3`}):e.status===`running`?(0,W.jsx)(M,{className:`size-3`}):e.status===`failed`?(0,W.jsx)(Se,{className:`size-3`}):null}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,W.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.message})]})]})}function Y(){let e=ie(),[t,n]=w(),r=te(),l=ee(),p=ae(),m=h(),g=de(),_=y(),b=re(),{progress:x,start:S,reset:C}=Pe(),T=t.get(`job`),[D,se]=(0,U.useState)(t.get(`project`)??Re),[O,le]=(0,U.useState)(`in-place`),[k,fe]=(0,U.useState)(``),[A,pe]=(0,U.useState)(``),[j,me]=(0,U.useState)(``),[N,he]=(0,U.useState)([]),[P,ve]=(0,U.useState)(!1),[F,I]=(0,U.useState)([]),[L,R]=(0,U.useState)([]),[z,Se]=(0,U.useState)([]),[Ce,we]=(0,U.useState)(``),[Ee,B]=(0,U.useState)(``),[Oe,V]=(0,U.useState)(!1),[ke,Ae]=(0,U.useState)(null),[H,je]=(0,U.useState)({}),[Me,Ne]=(0,U.useState)(!1),[G,K]=(0,U.useState)(null);(0,U.useEffect)(()=>{T?S(T):C()},[T,C,S]);let q=()=>{C(),n(e=>{let t=new URLSearchParams(e);return t.delete(`job`),t},{replace:!0})},J=()=>{let e=new URL(window.location.href);e.hash=`#/new`,window.location.replace(e.toString())},Fe=()=>{T&&S(T)},Ie=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!Ie.current&&p.data&&(Ie.current=!0,I(p.data.filter(e=>e.detected).map(e=>e.name)))},[p.data]);let Y=(0,U.useMemo)(()=>(r.data??[]).find(e=>e.id===D)??null,[r.data,D]),X=(0,U.useMemo)(()=>Y?Y.repos.map(e=>({name:_e(e.path),path:e.path,defaultBranch:e.defaultBranch})):(l.data??[]).filter(e=>N.includes(e.path)),[Y,l.data,N]),Z=O===`in-place`,Ue=(Z?A.trim().length>0:k.trim().length>0)&&X.length>0&&j.trim().length>0,We=e=>{we(e),Ae(null);let t=(m.data??[]).find(t=>t.id===e);B(t?.content??``)},Ge=async()=>{if(!j.trim()){K(`Describe what you are building first — the suggestion is based on it.`);return}K(null),V(!0);try{let e=await xe(`/api/workspace/suggest-workflow`,{method:`POST`,body:JSON.stringify({description:j,repos:X})});we(e.suggestedWorkflowId),B(e.customInstructions),Ae(e.difficulty)}catch(e){K(e instanceof Error?e.message:String(e))}finally{V(!1)}},Q=(0,U.useRef)(!1),Ke=async()=>{if(Q.current||b.isPending||!Ue)return;Q.current=!0,K(null);let e={mode:O,projectId:Y?.id,...Z?{name:A.trim()}:{branchName:k.trim()},description:j.trim(),repos:X.map(e=>({...e,existingBranch:!Z&&H[e.path]?.trim()?H[e.path].trim():void 0})),assistants:F,enabledSkills:L.length>0?L:void 0,enabledAgents:z.length>0?z:void 0,teamworkInstructions:Ee.trim()||void 0};try{let{jobId:t}=await b.mutateAsync(e);S(t),n(e=>{let n=new URLSearchParams(e);return n.set(`job`,t),n},{replace:!0})}catch(e){K(e instanceof Error?e.message:String(e))}finally{Q.current=!1}},$=x.status===`idle`&&T?{status:`running`,steps:[]}:x;if($.status!==`idle`){let t=$.steps.find(e=>e.status===`failed`);return(0,W.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,W.jsx)(`h1`,{className:`text-xl font-semibold`,children:$.status===`running`?`Setting up your workspace…`:$.status===`completed`?`Workspace ready`:$.status===`failed`?`Workspace creation failed`:`Unable to reconnect to workspace setup`}),(0,W.jsx)(`ul`,{"aria-live":`polite`,"aria-relevant":`additions text`,className:`mt-6 divide-y divide-border rounded-xl border border-border bg-card px-4`,children:$.steps.length>0?$.steps.map(e=>(0,W.jsx)(He,{step:e},e.id)):(0,W.jsxs)(`li`,{className:`flex items-center gap-3 py-3.5`,children:[(0,W.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,W.jsx)(M,{className:`size-3`})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium`,children:`Connecting to workspace setup…`}),(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Waiting for creation progress…`})]})]})}),($.status===`failed`||$.status===`unavailable`)&&(0,W.jsx)(`p`,{className:`mt-4 text-sm text-destructive-foreground`,children:t?.message??$.error??`Something went wrong.`}),$.status===`completed`&&$.workspacePath&&(0,W.jsx)(`p`,{className:`mt-4 truncate font-mono text-xs text-muted-foreground`,children:$.workspacePath}),G&&(0,W.jsx)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:G}),(0,W.jsxs)(`div`,{"data-testid":`workspace-ready-actions`,className:`mt-6 flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[$.status===`completed`&&$.workspaceId&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(a,{className:`w-full min-w-0 whitespace-normal sm:w-auto`,onClick:()=>e(`/workspaces/${encodeURIComponent($.workspaceId)}`),children:`Open workspace`}),$.workspacePath&&(0,W.jsx)(Le,{workspaceId:$.workspaceId,workspacePath:$.workspacePath,isVsCode:ze,className:`w-full min-w-0 whitespace-normal sm:w-auto`})]}),$.status===`failed`&&(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(a,{variant:`default`,onClick:q,children:`Back to form (edit & retry)`}),(0,W.jsx)(a,{variant:`outline`,onClick:J,children:`Start over (clear form)`})]}),$.status===`unavailable`&&(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(a,{variant:`default`,onClick:Fe,children:`Try reconnecting`}),(0,W.jsx)(a,{variant:`outline`,onClick:q,children:`Back to form`})]}),$.status===`running`&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This can take a moment for large repositories.`}),(0,W.jsx)(a,{variant:`outline`,size:`sm`,onClick:q,children:`Return to form`})]})]})]})}return(0,W.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,W.jsxs)(`header`,{className:`mb-6`,children:[(0,W.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Start work`}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Pick where the work happens and how isolated it should be.`})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`Project`}),(0,W.jsxs)(De,{value:D,onValueChange:e=>typeof e==`string`&&se(e),children:[(0,W.jsx)(Te,{className:`w-full`,"aria-label":`Project`,children:(0,W.jsx)(oe,{children:Y?Y.name:`Ad-hoc — pick repositories manually`})}),(0,W.jsxs)(v,{alignItemWithTrigger:!1,children:[(r.data??[]).map(e=>(0,W.jsx)(E,{value:e.id,children:e.name},e.id)),(0,W.jsx)(E,{value:Re,children:`Ad-hoc — pick repositories manually`})]})]}),Y?(0,W.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:Y.repos.map(e=>(0,W.jsx)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.path},e.path))}):(0,W.jsxs)(`div`,{className:`mt-2`,children:[(0,W.jsx)(u,{repos:l.data??[],selectedPaths:N,onToggle:e=>he(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),loading:l.isLoading}),(0,W.jsx)(f,{onCreated:e=>he(t=>[...t,e.path])})]}),(r.data??[]).length===0&&!r.isLoading&&(0,W.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Tip: `,(0,W.jsx)(ne,{to:`/projects`,className:`text-primary hover:underline`,children:`register a project`}),` to skip repo picking next time.`]})]}),(0,W.jsxs)(`section`,{children:[(0,W.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`How do you want to work?`}),(0,W.jsx)(`div`,{role:`radiogroup`,"aria-label":`Work mode`,className:`grid gap-3 sm:grid-cols-2`,onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(e.key)){e.preventDefault();let t=O===`in-place`?`worktree`:`in-place`;le(t),document.getElementById(`mode-${t}`)?.focus()}},children:Be.map(e=>(0,W.jsxs)(`button`,{id:`mode-${e.value}`,type:`button`,role:`radio`,"aria-checked":O===e.value,tabIndex:O===e.value?0:-1,onClick:()=>le(e.value),className:i(`cursor-pointer rounded-xl border p-4 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring`,O===e.value?`border-primary bg-primary/5 ring-1 ring-primary`:`border-border bg-card hover:border-foreground/20`),children:[(0,W.jsx)(e.icon,{className:i(`size-4`,O===e.value?`text-primary`:`text-muted-foreground`)}),(0,W.jsx)(`p`,{className:`mt-2 text-sm font-semibold`,children:e.title}),(0,W.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.body})]},e.value))})]}),(0,W.jsx)(`section`,{children:Z?(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Workspace name`}),(0,W.jsx)(o,{value:A,onChange:e=>pe(e.target.value),placeholder:`e.g. Fix invoice rounding`})]}):(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Feature branch`}),(0,W.jsx)(o,{value:k,onChange:e=>fe(e.target.value),placeholder:`e.g. feature/invoice-rounding`,className:`font-mono`})]}),X.length>0&&(0,W.jsxs)(`details`,{className:`rounded-lg border border-border px-3 py-2`,onToggle:e=>Ne(e.target.open),children:[(0,W.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Use an existing branch for specific repos (optional)`}),(0,W.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:X.map(e=>(0,W.jsx)(Ve,{repo:e,enabled:Me,value:H[e.path]??``,onChange:t=>je(n=>({...n,[e.path]:t}))},e.path))})]})]})}),(0,W.jsx)(`section`,{children:(0,W.jsxs)(`label`,{className:`block`,children:[(0,W.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`What are you building?`}),(0,W.jsx)(be,{value:j,onChange:e=>me(e.target.value),placeholder:`A short description — your AI assistant reads this to plan the work.`,rows:3})]})}),(0,W.jsxs)(`section`,{className:`rounded-xl border border-border`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>ve(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-sm font-medium hover:bg-accent`,"aria-expanded":P,children:[`Advanced`,(0,W.jsx)(c,{className:i(`size-4 text-muted-foreground transition-transform`,P&&`rotate-180`)})]}),P&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border p-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`AI assistants`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(p.data??[]).map(e=>(0,W.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,!e.detected&&`opacity-50`),children:[(0,W.jsx)(d,{checked:F.includes(e.name),onCheckedChange:()=>I(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])}),e.displayName]},e.name))})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Teamwork strategy`}),(0,W.jsxs)(a,{size:`xs`,variant:`outline`,onClick:Ge,disabled:Oe,children:[Oe?(0,W.jsx)(M,{}):(0,W.jsx)(ce,{}),`Suggest with AI`]})]}),(0,W.jsxs)(De,{value:Ce,onValueChange:e=>typeof e==`string`&&We(e),children:[(0,W.jsx)(Te,{className:`w-full`,"aria-label":`Teamwork strategy`,children:(0,W.jsx)(oe,{children:(m.data??[]).find(e=>e.id===Ce)?.name??`None`})}),(0,W.jsxs)(v,{alignItemWithTrigger:!1,children:[(0,W.jsx)(E,{value:``,children:`None`}),(m.data??[]).map(e=>(0,W.jsx)(E,{value:e.id,children:e.name},e.id))]})]}),ke&&(0,W.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[`AI classified this task as `,(0,W.jsx)(`span`,{className:`font-medium`,children:ke}),` difficulty.`]}),(0,W.jsx)(be,{value:Ee,onChange:e=>B(e.target.value),placeholder:`Cooperation instructions for the agent team (editable — prefilled by the strategy pick or AI suggestion).`,rows:4,className:`mt-2 font-mono text-xs`})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,W.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,W.jsx)(ye,{className:`size-4 text-primary`}),`Agent Skills (`,L.length,` selected)`]}),(g.data??[]).length>0&&(0,W.jsx)(a,{type:`button`,size:`xs`,variant:`ghost`,onClick:()=>{let e=(g.data??[]).map(e=>e.id);R(L.length===e.length?[]:e)},className:`text-xs text-muted-foreground hover:text-foreground h-6 px-2`,children:L.length===(g.data??[]).length&&(g.data??[]).length>0?`Deselect All`:`Select All`})]}),(0,W.jsx)(`div`,{className:`max-h-48 overflow-y-auto rounded-lg border border-border bg-card/50 p-2 space-y-1.5`,children:g.isLoading?(0,W.jsxs)(`div`,{className:`flex items-center justify-center p-4 gap-2 text-xs text-muted-foreground`,children:[(0,W.jsx)(M,{className:`size-3`}),`Loading skills...`]}):(g.data??[]).length===0?(0,W.jsx)(`p`,{className:`text-xs text-muted-foreground p-2 text-center`,children:`No skills available in catalog.`}):(g.data??[]).map(e=>{let t=L.includes(e.id);return(0,W.jsxs)(`label`,{className:i(`flex items-center justify-between gap-2 rounded-md p-2 text-xs cursor-pointer border transition-colors`,t?`border-primary/50 bg-primary/5 text-foreground`:`border-transparent hover:bg-muted/50 text-muted-foreground`),children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,W.jsx)(d,{checked:t,onCheckedChange:()=>R(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,W.jsx)(`span`,{className:`font-mono font-medium truncate`,children:e.title||e.name})]}),(0,W.jsx)(s,{variant:`outline`,className:`text-[9px] px-1 py-0 shrink-0`,children:e.category})]},e.id)})})]}),(_.data??[]).length>0&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:(0,W.jsxs)(`span`,{className:`text-sm font-medium flex items-center gap-1.5`,children:[(0,W.jsx)(ge,{className:`size-4 text-purple-400`}),`Codex Native Agents (`,z.length,` selected)`]})}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(_.data??[]).map(e=>{let t=z.includes(e.id);return(0,W.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-xs`,t?`border-purple-500/60 bg-purple-500/5 text-foreground`:`text-muted-foreground hover:bg-muted/50`),children:[(0,W.jsx)(d,{checked:t,onCheckedChange:()=>Se(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),(0,W.jsx)(`span`,{className:`font-mono`,children:e.name})]},e.id)})})]})]})]}),G&&(0,W.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:G}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,W.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,W.jsx)(ue,{className:`size-3.5`}),X.length,` repositor`,X.length===1?`y`:`ies`,` selected`]}),(0,W.jsxs)(a,{onClick:Ke,disabled:!Ue||b.isPending,children:[b.isPending?(0,W.jsx)(M,{}):null,Z?`Start working`:`Create workspace`]})]})]})]})}export{Y as StartWorkPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,t as i}from"./button-CREn1mup.js";import{n as a,t as o}from"./badge-DTBzXOWn.js";import{a as ee,f as te,i as s,n as c,p as ne,r as l,t as re}from"./menu-d_G9km1-.js";import{n as u,r as ie,t as ae}from"./shield-check-Dd1Yv3l2.js";import{t as d}from"./git-branch-Ce0I2663.js";import{i as f,n as p,o as oe,r as m,t as se}from"./tabs-BHwTt4t1.js";import{t as ce}from"./trash-2-CMdv3eD3.js";import{C as h,S as le,d as ue,i as g,t as _,x as v}from"./brand-hHByyyzq.js";import{Bt as de,C as y,Kt as fe,Lt as b,S as x,T as S,Wt as C,c as w,f as T,nn as pe,ot as me,s as E,sn as he,st as D,w as O,x as k}from"./index-BTe-_1Mu.js";import{a as A,i as j,n as M,r as N,t as P}from"./card-yrg6ov8B.js";import{t as F}from"./label-DC730X8s.js";import{n as ge,r as _e,t as ve}from"./alert-QnMXzwpU.js";var ye=r(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),I=r(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),be=r(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),xe=r(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),Se=r(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),Ce=r(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),we=r(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Te=r(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),Ee=r(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),De=r(`lock-keyhole`,[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]),Oe=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),ke=r(`package-check`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`m16 17 2 2 4-4`,key:`uh5qu3`}],[`path`,{d:`M21 11.127V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.32-.753`,key:`kpkbpo`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),Ae=r(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),je=r(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Me=r(`user-check`,[[`path`,{d:`m16 11 2 2 4-4`,key:`9rsbq5`}],[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Ne=r(`user-minus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),L=r(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),R=t(e(),1),z=n(),Pe=[{pattern:/plan|decision|context|document|handoff/i,label:`Shared context`,tool:`context`},{pattern:/resource|package|skill|agent/i,label:`Resource evidence`,tool:`resources`},{pattern:/workflow|step|completion|evidence/i,label:`Workflow evidence`,tool:`workflow`},{pattern:/member|join|participant|invite/i,label:`People`,tool:`members`},{pattern:/password|credential|security|certificate|tls/i,label:`Security record`,tool:`security`}],Fe=[{tool:`overview`,label:`Project & privacy`,icon:ae},{tool:`context`,label:`Shared context`,icon:u},{tool:`resources`,label:`Resources`,icon:ke},{tool:`workflow`,label:`Workflow`,icon:d},{tool:`members`,label:`People`,icon:b},{tool:`activity`,label:`Full activity log`,icon:ne},{tool:`security`,label:`Security & export`,icon:De}];function Ie(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t)}function Le(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function B(e){return e.role===`host`?`host`:e.role===`publisher`?`publisher`:`member`}function V(e){switch(e){case`in_progress`:return`In progress`;case`completion_proposed`:return`Review requested`;case`completed`:return`Complete`;case`skipped`:return`Skipped`;default:return`Pending`}}function Re({status:e}){return e===`completed`?(0,z.jsx)(pe,{"aria-hidden":`true`,className:`text-success`,size:14}):e===`in_progress`?(0,z.jsx)(I,{"aria-hidden":`true`,className:`text-primary`,size:14}):e===`completion_proposed`?(0,z.jsx)(Se,{"aria-hidden":`true`,className:`text-warning`,size:14}):(0,z.jsx)(be,{"aria-hidden":`true`,className:`text-muted-foreground`,size:14})}function H({participant:e,emphasized:t=!1}){return(0,z.jsx)(`span`,{"aria-hidden":`true`,"data-role":e?.role??`system`,className:`grid shrink-0 place-items-center rounded-full border ${t?`size-9 border-primary/60 bg-primary/15 text-primary`:`size-8 border-border bg-muted text-muted-foreground`}`,children:(0,z.jsx)(L,{"aria-hidden":`true`,size:t?17:15})})}function ze({snapshot:e,roomUrl:t,isHost:n,me:r,busy:a,message:f,hasUnsavedHandoffDraft:p,headingRef:oe,onCreateInvite:m,onRefresh:se,onStopOrLeave:ce,onOpenTool:h,onMessageChange:le,onPostUpdate:ue}){let g=(0,R.useMemo)(()=>e.participants.filter(e=>!e.revokedAt),[e.participants]),_=(0,R.useMemo)(()=>new Map(e.participants.map(e=>[e.id,e])),[e.participants]),v=e.workflowProgress,y=v?.steps.findIndex(e=>e.status===`completion_proposed`)??-1,fe=v?.steps.findIndex(e=>e.status===`in_progress`)??-1,b=y>=0?y:fe,x=v?.steps.findIndex(e=>e.status===`pending`)??-1,S=b>=0?v?.steps[b]:void 0,w=x>=0?v?.steps[x]:void 0,T=v?.package.steps.find(e=>e.id===S?.stepId),pe=v?.package.steps.find(e=>e.id===w?.stepId),me=b>=0?v?.steps.slice(b+1).find(e=>e.status===`pending`):void 0,D=v?.package.steps.find(e=>e.id===me?.stepId),O=S?_.get(S.updatedBy):void 0,k=!!(v?.steps.length&&v.steps.every(e=>e.status===`completed`||e.status===`skipped`)),A=e.activity.slice(-20);return(0,z.jsxs)(`section`,{"aria-labelledby":`handoff-stream-title`,className:`animate-fade-in`,"data-testid":`handoff-stream`,children:[(0,z.jsx)(`header`,{className:`border-b border-border pb-4`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 xl:flex-row xl:items-center xl:justify-between`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 xl:flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(ne,{"aria-hidden":`true`,className:`text-muted-foreground`,size:17}),(0,z.jsx)(`h1`,{ref:oe,id:`handoff-stream-title`,tabIndex:-1,className:`text-lg font-semibold tracking-tight outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:`Handoff Stream`}),(0,z.jsxs)(o,{variant:`success`,children:[(0,z.jsx)(`span`,{className:`mr-1 inline-block size-1.5 rounded-full bg-success`}),`Live`]})]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-sm text-muted-foreground`,children:e.bundle.feature.goal})]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 sm:gap-3`,children:[(0,z.jsxs)(`div`,{"aria-label":`${g.length} participants`,className:`flex items-center gap-1`,children:[g.slice(0,4).map(e=>(0,z.jsxs)(`span`,{className:`flex items-center gap-2 rounded-md px-1 py-0.5`,title:`${e.displayName} · ${B(e)}`,children:[(0,z.jsx)(H,{participant:e,emphasized:e.id===r?.id}),(0,z.jsxs)(`span`,{className:`hidden max-w-24 leading-tight 2xl:block`,children:[(0,z.jsx)(`span`,{className:`block truncate text-xs font-semibold`,children:e.displayName}),(0,z.jsx)(`span`,{className:`block text-[10px] text-muted-foreground`,children:B(e)})]})]},e.id)),g.length>4&&(0,z.jsxs)(`span`,{className:`grid size-8 place-items-center rounded-full border border-border bg-muted text-[10px] font-semibold text-muted-foreground`,children:[`+`,g.length-4]})]}),n&&(0,z.jsxs)(i,{variant:`outline`,onClick:m,disabled:a!==null,children:[(0,z.jsx)(Ee,{"aria-hidden":`true`}),` Invite`,e.pendingJoins.length>0&&(0,z.jsx)(`span`,{className:`ml-0.5 rounded bg-warning/15 px-1 text-[10px] text-warning-foreground`,children:e.pendingJoins.length})]}),(0,z.jsxs)(re,{children:[(0,z.jsx)(ee,{"aria-label":`Open room tools`,className:`grid size-8 cursor-pointer place-items-center rounded-md border border-border bg-card text-muted-foreground shadow-2xs transition-colors hover:bg-accent hover:text-foreground`,children:(0,z.jsx)(we,{"aria-hidden":`true`,size:16})}),(0,z.jsxs)(l,{align:`end`,className:`w-56`,children:[Fe.map(({tool:t,label:n,icon:r})=>(0,z.jsxs)(c,{onClick:()=>h(t),children:[(0,z.jsx)(r,{"aria-hidden":`true`}),` `,n,t===`members`&&e.pendingJoins.length>0&&(0,z.jsx)(`span`,{className:`ml-auto text-[10px] text-warning-foreground`,children:e.pendingJoins.length})]},t)),(0,z.jsx)(s,{}),(0,z.jsxs)(c,{onClick:se,children:[(0,z.jsx)(C,{"aria-hidden":`true`}),` Refresh room`]}),(0,z.jsxs)(c,{variant:`destructive`,disabled:a!==null,onClick:()=>{let e=n?`stop hosting this Workroom`:`leave this Workroom`;window.confirm(`Are you sure you want to ${e}?`)&&ce()},children:[(0,z.jsx)(de,{"aria-hidden":`true`}),` `,n?`Stop room`:`Leave room`]})]})]})]})]})}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-4 xl:grid-cols-[minmax(0,1fr)_17rem]`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-primary/35 bg-primary/10 px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,z.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-full border border-primary/50 bg-primary/12 text-primary`,children:(0,z.jsx)(d,{"aria-hidden":`true`,size:17})}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`text-sm font-semibold`,children:v?k?`Workflow complete`:S?.status===`completion_proposed`?`A review is ready`:S?`Work is moving`:`Workflow ready`:`No shared workflow yet`}),(0,z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:k?`Every shared step has been completed.`:v&&S?`${O?.displayName||`A participant`} updated ${T?.title||S.stepId} · step ${b+1} of ${v.steps.length}${D?` · next: ${D.title}`:``}`:v&&w?`Next: ${pe?.title||w.stepId} · step ${x+1} of ${v.steps.length}`:v?`The shared workflow is ready to start.`:n?`Choose a reviewed workflow to make the next handoff explicit.`:`The host has not selected a shared workflow yet.`})]})]}),(v||n)&&(0,z.jsxs)(i,{size:`sm`,onClick:()=>h(`workflow`),children:[S?.status===`completion_proposed`?`Review proposal`:v?`Open workflow`:`Set workflow`,(0,z.jsx)(ie,{"aria-hidden":`true`})]})]}),(0,z.jsxs)(`div`,{className:`rounded-lg border border-border bg-card`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Room activity`}),(0,z.jsx)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:`Decisions, evidence, and handoffs shared with this room.`})]}),(0,z.jsxs)(i,{variant:`ghost`,size:`xs`,onClick:()=>h(`activity`),children:[`View log `,(0,z.jsx)(he,{"aria-hidden":`true`})]})]}),A.length>0?(0,z.jsx)(`ol`,{"aria-label":`Workroom activity`,className:`relative divide-y divide-border/70 before:absolute before:bottom-8 before:left-[2.05rem] before:top-8 before:w-px before:bg-border`,children:A.map(e=>{let t=_.get(e.actorId),n=Pe.find(({pattern:t})=>t.test(e.type));return(0,z.jsxs)(`li`,{className:`relative flex gap-3 px-4 py-4 sm:gap-4`,children:[(0,z.jsx)(`span`,{className:`relative z-10 rounded-full bg-card p-0.5`,children:(0,z.jsx)(H,{participant:t,emphasized:t?.id===r?.id})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,z.jsx)(`span`,{className:`min-w-0 break-words text-xs font-semibold [overflow-wrap:anywhere]`,children:t?.displayName||`Historical participant`}),t&&(0,z.jsx)(o,{variant:t.role===`host`?`info`:`secondary`,children:B(t)}),(0,z.jsx)(`time`,{className:`text-[10px] text-muted-foreground`,dateTime:e.createdAt,children:Ie(e.createdAt)})]}),(0,z.jsx)(`p`,{className:`mt-1.5 break-words text-sm font-medium text-foreground [overflow-wrap:anywhere]`,children:e.summary}),(0,z.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[e.type,` · event #`,e.sequence]}),n&&(0,z.jsxs)(`button`,{type:`button`,className:`mt-2 inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border bg-muted/35 px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,onClick:()=>h(n.tool),children:[(0,z.jsx)(u,{"aria-hidden":`true`,size:12}),` `,n.label]})]})]},e.sequence)})}):(0,z.jsxs)(`div`,{className:`px-4 py-10 text-center`,children:[(0,z.jsx)(ne,{"aria-hidden":`true`,className:`mx-auto text-muted-foreground`,size:20}),(0,z.jsx)(`p`,{className:`mt-2 text-sm font-medium`,children:`No shared activity yet`}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Post an update below to begin the handoff stream.`})]}),(0,z.jsxs)(`form`,{className:`border-t border-border p-3`,onSubmit:async e=>{e.preventDefault();let t=f.trim();!t||a!==null||p||await ue(t)},children:[(0,z.jsx)(`label`,{className:`sr-only`,htmlFor:`handoff-stream-message`,children:`Share a handoff update`}),(0,z.jsx)(E,{id:`handoff-stream-message`,className:`min-h-20 resize-y border-0 bg-transparent px-1 py-1 shadow-none focus-visible:ring-0`,maxLength:4e3,placeholder:`Share a decision, result, blocker, or next step…`,value:f,onChange:e=>le(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&e.currentTarget.form?.requestSubmit()}}),(0,z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Only the text you enter is shared from this composer. No files, diffs, paths, credentials, or transcripts are collected automatically.`}),p&&(0,z.jsx)(`p`,{className:`text-[10px] text-warning-foreground`,children:`Resolve your unsaved Handoff draft in Shared context before posting another update.`})]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2`,children:[p&&(0,z.jsx)(i,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>h(`context`),children:`Review draft`}),(0,z.jsxs)(i,{type:`submit`,size:`sm`,disabled:!f.trim()||a!==null||p,children:[(0,z.jsx)(te,{"aria-hidden":`true`}),` `,a===`stream-post`?`Posting…`:`Post update`]})]})]})]})]})]}),(0,z.jsxs)(`aside`,{"aria-label":`Workroom details`,className:`h-fit divide-y divide-border rounded-lg border border-border bg-card xl:sticky xl:top-4`,children:[(0,z.jsxs)(`section`,{className:`p-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(`h2`,{className:`text-xs font-semibold`,children:[`Steps `,v?`(${v.steps.length})`:``]}),(v||n)&&(0,z.jsx)(`button`,{type:`button`,onClick:()=>h(`workflow`),className:`cursor-pointer text-muted-foreground hover:text-foreground`,"aria-label":`Open workflow tools`,children:(0,z.jsx)(Ae,{"aria-hidden":`true`,size:14})})]}),v?(0,z.jsx)(`ol`,{className:`mt-3 space-y-1`,children:v.steps.map((e,t)=>{let n=v.package.steps.find(t=>t.id===e.stepId),r=_.get(e.updatedBy),i=V(e.status);return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`button`,{type:`button`,onClick:()=>h(`workflow`),className:`group flex w-full cursor-pointer items-start gap-2 rounded-md px-1 py-2 text-left hover:bg-accent/60`,children:[(0,z.jsx)(`span`,{className:`mt-0.5 grid size-5 shrink-0 place-items-center rounded-full border border-border bg-background text-[10px]`,children:t+1}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-xs ${e.status===`in_progress`||e.status===`completion_proposed`?`font-semibold text-foreground`:`text-muted-foreground`}`,children:n?.title||e.stepId}),(0,z.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground`,children:e.status===`pending`||!r?i:`${i} · updated by ${r.displayName}`})]}),(0,z.jsx)(`span`,{className:`mt-1`,children:(0,z.jsx)(Re,{status:e.status})})]})},e.stepId)})}):n?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>h(`workflow`),className:`mt-3 w-full cursor-pointer rounded-md border border-dashed border-border px-3 py-4 text-left hover:bg-accent/50`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium`,children:`Make turns explicit`}),(0,z.jsx)(`span`,{className:`mt-1 block text-[10px] text-muted-foreground`,children:`Select a shared workflow and require evidence for completion.`})]}):(0,z.jsxs)(`div`,{className:`mt-3 rounded-md border border-dashed border-border px-3 py-4`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium`,children:`Waiting for a workflow`}),(0,z.jsx)(`span`,{className:`mt-1 block text-[10px] text-muted-foreground`,children:`The host can select a shared workflow for this room.`})]})]}),(0,z.jsxs)(`section`,{className:`p-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(`h2`,{className:`text-xs font-semibold`,children:[`Participants (`,g.length,`)`]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>h(`members`),className:`cursor-pointer text-[10px] text-muted-foreground hover:text-foreground`,children:`Manage`})]}),(0,z.jsx)(`ul`,{className:`mt-3 space-y-2.5`,children:g.slice(0,6).map(e=>(0,z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(H,{participant:e,emphasized:e.id===r?.id}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:e.displayName}),(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:B(e)})]},e.id))})]}),(0,z.jsxs)(`section`,{className:`space-y-2.5 p-4`,children:[(0,z.jsx)(`h2`,{className:`text-xs font-semibold`,children:`Room details`}),(0,z.jsxs)(`dl`,{className:`space-y-2 text-[11px]`,children:[(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created by`}),(0,z.jsx)(`dd`,{className:`truncate text-right`,children:e.participants.find(e=>e.role===`host`)?.displayName||`Host`})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Created`}),(0,z.jsx)(`dd`,{className:`text-right`,children:Le(e.createdAt)})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Workspace`}),(0,z.jsx)(`dd`,{className:`truncate text-right`,children:e.bundle.feature.id})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:`Status`}),(0,z.jsxs)(`dd`,{className:`inline-flex items-center gap-1.5`,children:[`Live `,(0,z.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`})]})]})]}),(0,z.jsx)(`p`,{className:`truncate border-t border-border pt-2 font-mono text-[9px] text-muted-foreground`,title:t,children:t})]}),(0,z.jsx)(`section`,{className:`p-3`,children:(0,z.jsxs)(i,{variant:`ghost`,className:`w-full justify-start`,onClick:()=>h(`security`),children:[(0,z.jsx)(ae,{"aria-hidden":`true`}),` Security & encrypted export`]})})]})]})]})}var U={plan:`Plan`,decisions:`Decisions & knowledge`,handoff:`Handoff`},Be={overview:`Project & privacy`,context:`Shared context`,resources:`Resources`,workflow:`Workflow`,members:`People`,activity:`Full activity log`,security:`Security & encrypted export`};function Ve(){let e=new Uint8Array(18);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,``).slice(0,24)}function He(e){return e instanceof Error?e.message:String(e)}function W(e){return e.mode===`host`||e.mode===`guest`?e.snapshot:void 0}function Ue(e,t){return e.mode===`host`||e.mode===`guest`?{...e,snapshot:t}:e}function We(e,t){let n=W(e),r=W(t);if(!n||!r||n.roomId!==r.roomId)return t;let i=r.revision>=n.revision?r:n,a={plan:r.documents.plan.revision>=n.documents.plan.revision?r.documents.plan:n.documents.plan,decisions:r.documents.decisions.revision>=n.documents.decisions.revision?r.documents.decisions:n.documents.decisions,handoff:r.documents.handoff.revision>=n.documents.handoff.revision?r.documents.handoff:n.documents.handoff};return Ue(t,{...i,documents:a})}function Ge(e,t,n){let r=W(e);return!r||r.roomId!==t||n.revision<r.documents.handoff.revision?e:Ue(e,{...r,documents:{...r.documents,handoff:n}})}async function Ke(e,t){let n=JSON.stringify({bundle:e,documents:{plan:t.plan,decisions:t.decisions,handoff:t.handoff}}),r=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(n));return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function qe({workspaces:e,showToast:t}){let[n,r]=(0,R.useState)({mode:`idle`}),[ee,te]=(0,R.useState)([]),[s,c]=(0,R.useState)(null),[l,re]=(0,R.useState)(``),[u,ie]=(0,R.useState)(null),[d,he]=(0,R.useState)({plan:``,decisions:``,handoff:``}),[I,be]=(0,R.useState)({plan:!1,decisions:!1,handoff:!1}),[Se,we]=(0,R.useState)(!1),[De,Ae]=(0,R.useState)(``),[L,Pe]=(0,R.useState)(``),[Fe,Ie]=(0,R.useState)(`4242`),[Le,B]=(0,R.useState)(``),[V,Re]=(0,R.useState)(()=>Ve()),[H,W]=(0,R.useState)(``),[Ue,qe]=(0,R.useState)(``),[Je,Ye]=(0,R.useState)(``),[Xe,Ze]=(0,R.useState)(``),[Qe,$e]=(0,R.useState)(``),[et,tt]=(0,R.useState)(``),[nt,rt]=(0,R.useState)({plan:``,decisions:``,handoff:``}),[G,it]=(0,R.useState)({plan:!1,decisions:!1,handoff:!1}),[K,at]=(0,R.useState)([]),[ot,st]=(0,R.useState)(``),[ct,lt]=(0,R.useState)(`0.1.0`),[ut,dt]=(0,R.useState)({}),[ft,pt]=(0,R.useState)(``),[mt,ht]=(0,R.useState)(`0.1.0`),[gt,_t]=(0,R.useState)(`Plan
|
|
2
|
-
Implement
|
|
3
|
-
Verify
|
|
4
|
-
Review`),[vt,yt]=(0,R.useState)({}),[bt,xt]=(0,R.useState)(()=>Ve()),[q,St]=(0,R.useState)(()=>Ve()),[Ct,wt]=(0,R.useState)(null),[Tt,J]=(0,R.useState)(`stream`),[Et,Dt]=(0,R.useState)(``),[Ot,kt]=(0,R.useState)([]),[At,jt]=(0,R.useState)([]),Mt=(0,R.useRef)(null),Nt=(0,R.useRef)(null),Pt=(0,R.useRef)(null),Ft=(0,R.useRef)(!1),Y=n.mode===`host`||n.mode===`guest`?n.snapshot:void 0,X=n.mode===`host`,It=n.mode===`guest`&&n.status===`pending`,Lt=n.mode===`host`?Y?.participants.find(e=>e.role===`host`):n.mode===`guest`?Y?.participants.find(e=>e.id===n.memberId):void 0,Rt=Lt?.role===`host`||Lt?.role===`publisher`,zt=!!Y,Z=(0,R.useCallback)(async(e=!1)=>{try{let e=await D(`/api/workrooms/status`);r(t=>We(t,e.status))}catch(n){if(n instanceof me&&n.status===401)try{let e=await D(`/api/workrooms/session`);r(e.active&&e.locked&&e.roomType?{mode:`locked`,roomType:e.roomType}:{mode:`idle`});return}catch(n){e&&t(He(n),`error`);return}e&&t(He(n),`error`)}},[t]),Bt=(0,R.useCallback)(async()=>{let[e,t]=await Promise.all([D(`/api/workrooms/paused`),D(`/api/workrooms/quarantined`)]);kt(e.rooms),jt(t.rooms)},[]);(0,R.useEffect)(()=>{Promise.all([Z(),D(`/api/workrooms/interfaces`).then(e=>{te(e.interfaces),Pe(t=>t||e.interfaces.find(e=>!e.internal&&e.family===`IPv4`)?.address||e.interfaces[0]?.address||``)}),Bt()]);let e=window.setInterval(()=>void Z(),3e3);return()=>window.clearInterval(e)},[Z,Bt]),(0,R.useEffect)(()=>{if(!l){ie(null);return}D(`/api/workrooms/preview/${encodeURIComponent(l)}`).then(({preview:e})=>{ie(e),he(e.documents),be({plan:!1,decisions:!1,handoff:!1}),we(!1),Ae(t=>t||`${e.bundle.feature.id} workroom`)}).catch(e=>t(He(e),`error`))},[l,t]),(0,R.useEffect)(()=>{Y&&rt(e=>({plan:G.plan?e.plan:Y.documents.plan.content,decisions:G.decisions?e.decisions:Y.documents.decisions.content,handoff:G.handoff?e.handoff:Y.documents.handoff.content}))},[Y,G]),(0,R.useEffect)(()=>{Y?.workflowProgress&&yt(e=>Object.fromEntries(Y.workflowProgress.steps.map(t=>[t.stepId,e[t.stepId]??t.evidence??``])))},[Y?.workflowProgress]),(0,R.useEffect)(()=>{zt&&D(`/api/workrooms/local-resources`).then(({resources:e})=>{at(e),st(t=>t||(e[0]?`${e[0].kind}:${e[0].id}`:``)),pt(t=>t||e.find(e=>e.kind===`workflow`)?.id||``)}).catch(()=>{})},[zt]),(0,R.useEffect)(()=>{n.mode===`idle`&&(Dt(``),J(`stream`))},[n.mode]),(0,R.useEffect)(()=>{if(!zt){Ft.current=!1;return}if(!Ft.current){Ft.current=!0;return}let e=window.requestAnimationFrame(()=>{Tt===`stream`?Nt.current?.focus():Pt.current?.focus()});return()=>window.cancelAnimationFrame(e)},[Tt,zt]);let Q=async(e,n,r)=>{if(Mt.current!==null)return!1;Mt.current=e,c(e);try{return await n(),await Z(),await Bt().catch(()=>{}),r&&t(r,`success`),!0}catch(e){return t(He(e),`error`,8e3),!1}finally{Mt.current=null,c(null)}},Vt=()=>Q(`start`,async()=>{if(!u)throw Error(`Select and preview a workspace first.`);let e={plan:I.plan?d.plan:``,decisions:I.decisions?d.decisions:``,handoff:I.handoff?d.handoff:``},t=await D(`/api/workrooms/start`,{method:`POST`,body:JSON.stringify({workspaceId:l,name:De,address:L,port:Number(Fe),password:V,hostDisplayName:Le,contextConfirmed:Se,contextDigest:await Ke(u.bundle,e),documents:e})});r(t.status)},`Workroom started.`),Ht=e=>Q(`resume-${e}`,async()=>{let t=await D(`/api/workrooms/${encodeURIComponent(e)}/resume`,{method:`POST`,body:JSON.stringify({password:V})});r(t.status)},`Workroom resumed with its existing identity and memberships.`),Ut=e=>{window.confirm(`Discard failed import ${e}? This removes only its quarantined local files so you can retry the original encrypted export.`)&&Q(`discard-${e}`,async()=>{await D(`/api/workrooms/quarantined/${encodeURIComponent(e)}/discard`,{method:`POST`,body:JSON.stringify({confirmRoomId:e})})},`Failed import discarded. You can retry the encrypted export.`)},Wt=()=>Q(`join`,async()=>{let e=await D(`/api/workrooms/join`,{method:`POST`,body:JSON.stringify({invite:Je,password:Xe,displayName:Qe,workspaceId:l||void 0})});r(e.status)},`Join request sent to the host.`),Gt=()=>Q(`poll`,async()=>{let e=await D(`/api/workrooms/join/poll`,{method:`POST`});r(e.status)}),Kt=()=>Q(`stop`,async()=>{await D(`/api/workrooms/stop`,{method:`POST`}),r({mode:`idle`}),J(`stream`),Dt(``),W(``)},X?`Workroom stopped.`:`Left the Workroom.`),qt=()=>Q(`invite`,async()=>{let e=await D(`/api/workrooms/invites`,{method:`POST`});W(e.invite),qe(e.expiresAt),await w(e.invite)},`One-use invitation copied. Share the password separately.`),Jt=e=>Q(`doc-${e}`,async()=>{if(Y)try{await D(`/api/workrooms/documents/${e}`,{method:`PUT`,body:JSON.stringify({content:nt[e],expectedRevision:Y.documents[e].revision})}),it(t=>({...t,[e]:!1}))}catch(e){throw e instanceof me&&e.status===409?(await Z(),Error(`Someone updated this document first. Your draft is preserved; compare it with the latest revision and save again.`,{cause:e})):e}},`${U[e]} shared.`),Yt=()=>Q(`publish-resource`,async()=>{let[e,t]=ot.split(`:`);await D(`/api/workrooms/resources/publish`,{method:`POST`,body:JSON.stringify({kind:e,id:t,version:ct})})},`Immutable resource version published.`),Xt=e=>Q(`download-${e}`,async()=>{let t=await D(`/api/workrooms/resources/${e}/download`,{method:`POST`});dt(n=>({...n,[e]:t.preview}))},`Resource downloaded to the local quarantine cache. Review it before applying.`),Zt=e=>Q(`apply-${e}`,async()=>{let t=ut[e];if(!t)throw Error(`Download and review this resource again before applying it.`);await D(`/api/workrooms/resources/${e}/apply`,{method:`POST`,body:JSON.stringify({approvedDigest:e,approvedLocalDigest:t.localDigest})})},`Resource applied to your local ${_} catalog.`),Qt=e=>Q(`quarantine-${e}`,async()=>{await D(`/api/workrooms/resources/${e}/quarantine`,{method:`POST`})},`Resource version quarantined and removed from future exports and downloads.`),$t=e=>{window.confirm(`Permanently purge quarantined resource ${e}? Its package bytes and catalog entry will be removed so the room quota can be reused.`)&&Q(`purge-${e}`,async()=>{await D(`/api/workrooms/resources/${e}/purge`,{method:`POST`,body:JSON.stringify({confirmDigest:e})})},`Quarantined resource permanently purged and its room quota released.`)},en=()=>Q(`select-workflow`,async()=>{let e=K.find(e=>e.kind===`workflow`&&e.id===ft);if(!e)throw Error(`Select a local workflow.`);let t=gt.split(/\r?\n/).map(e=>e.trim()).filter(Boolean).map((e,t)=>({id:`${t+1}-${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`step`}`,title:e,requiresEvidence:!0}));await D(`/api/workrooms/workflow/select`,{method:`POST`,body:JSON.stringify({workflowId:e.id,version:mt,steps:t,expectedRevision:Y?.workflowProgress?.revision??0})})},`Shared workflow selected.`),$=(e,t)=>Q(`step-${e.stepId}`,async()=>{let n=Y?.workflowProgress?.package.steps.find(t=>t.id===e.stepId),r=(vt[e.stepId]??e.evidence??``).trim();if(t===`completed`&&n?.requiresEvidence&&!r)throw Error(`Add evidence before completing this workflow step.`);await D(`/api/workrooms/workflow/steps/${encodeURIComponent(e.stepId)}/transition`,{method:`POST`,body:JSON.stringify({status:t,expectedRevision:e.revision,...t===`completed`&&r?{evidence:r}:{}})})}),tn=async e=>{let t=e.trim(),n=await Q(`stream-post`,async()=>{if(!Y)throw Error(`The Workroom snapshot is not available.`);if(G.handoff)throw Error(`Resolve the unsaved Handoff draft in Shared context before posting another update.`);let e=Y.documents.handoff.content.trimEnd(),n=e?`${e}\n\n${t}\n`:`${t}\n`;try{let e=await D(`/api/workrooms/documents/handoff`,{method:`PUT`,body:JSON.stringify({content:n,expectedRevision:Y.documents.handoff.revision})});r(t=>Ge(t,Y.roomId,e.document))}catch(e){throw e instanceof me&&e.status===409?(await Z(),Error(`Someone updated the handoff first. Your update is preserved; review the latest shared context and post again.`,{cause:e})):e}},`Handoff update shared.`);return n&&Dt(e=>e.trim()===t?``:e),n},nn=()=>Q(`export`,async()=>{let e=await D(`/api/workrooms/export`,{method:`POST`,body:JSON.stringify({passphrase:q})}),t=new Blob([JSON.stringify(e.export,null,2)],{type:`application/json`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`${Y?.roomId??`${g}-workroom`}${h}`,n.click(),URL.revokeObjectURL(n.href)},`Encrypted Workroom export created.`),rn=()=>Q(`import`,async()=>{if(!Ct)throw Error(`Choose a ${h} or ${le} export first.`);let e=await D(`/api/workrooms/import`,{method:`POST`,body:JSON.stringify({export:Ct,exportPassphrase:q,name:De||void 0,address:L,port:Number(Fe),password:V,hostDisplayName:Le})});r(e.status)},`Encrypted export imported as a new Workroom with new credentials.`);if(n.mode===`locked`)return(0,z.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,z.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-amber-500/10 text-amber-700`,children:(0,z.jsx)(Te,{})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Active Workroom is locked`}),(0,z.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`This browser lost its local human-session cookie. `,n.roomType===`host`?`Enter the room password to regain host dashboard controls.`:`For safety, leave this local guest connection and join again with the invitation and room password.`]})]}),n.roomType===`host`?(0,z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm flex-col gap-3`,children:[(0,z.jsx)(F,{htmlFor:`workroom-recovery-password`,children:`Room password`}),(0,z.jsx)(a,{id:`workroom-recovery-password`,type:`password`,value:et,onChange:e=>tt(e.target.value)}),(0,z.jsxs)(i,{onClick:()=>Q(`reclaim`,async()=>{await D(`/api/workrooms/session/reclaim`,{method:`POST`,body:JSON.stringify({password:et})}),tt(``)},`Local Workroom dashboard reconnected.`),disabled:s!==null||!et,children:[s===`reclaim`?(0,z.jsx)(T,{}):(0,z.jsx)(Te,{}),` Unlock host dashboard`]})]}):(0,z.jsx)(`div`,{children:(0,z.jsxs)(i,{variant:`destructive-outline`,onClick:()=>Q(`abandon-locked-guest`,async()=>{await D(`/api/workrooms/session/abandon`,{method:`POST`,body:JSON.stringify({confirm:!0})}),r({mode:`idle`})},`Locked guest connection left. Join the Workroom again.`),disabled:s!==null,children:[s===`abandon-locked-guest`?(0,z.jsx)(T,{}):(0,z.jsx)(Oe,{}),` Leave and rejoin`]})})]});if(n.mode===`idle`)return(0,z.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in space-y-6`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(b,{className:`text-primary`,size:20}),(0,z.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Workrooms`}),(0,z.jsx)(o,{variant:`info`,children:`Experimental`})]}),(0,z.jsxs)(`p`,{className:`mt-1 max-w-3xl text-sm text-muted-foreground`,children:[`Share only the project context and reusable agent resources you explicitly review over a private LAN or VPN. `,_,` never adds code, diffs, credentials, terminals, or AI sessions automatically.`]})]}),(0,z.jsxs)(ve,{variant:`info`,children:[(0,z.jsx)(ae,{}),(0,z.jsx)(_e,{children:`No listener runs by default`}),(0,z.jsxs)(ge,{children:[`A Workroom binds only to the network address you select and stops with `,_,`.`]})]}),Ot.length>0&&(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:`Paused Workrooms`}),(0,z.jsx)(M,{children:`Enter the room password in the host form below, then resume on the same saved address and port. The password unlocks human authority; agent credentials remain read-and-propose-only.`})]}),(0,z.jsx)(j,{className:`grid gap-2 sm:grid-cols-2`,children:Ot.map(e=>(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border p-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,z.jsxs)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:[e.address,`:`,e.port,` · `,e.workspaceId]})]}),(0,z.jsxs)(i,{size:`sm`,variant:`outline`,onClick:()=>Ht(e.roomId),disabled:s!==null||V.length<12,children:[s===`resume-${e.roomId}`?(0,z.jsx)(T,{}):(0,z.jsx)(fe,{}),` Resume`]})]},e.roomId))})]}),At.length>0&&(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:`Failed imports`}),(0,z.jsx)(M,{children:`These rooms never completed import and cannot be resumed. Inspect the identity below, discard its quarantined local files, then retry the original encrypted export.`})]}),(0,z.jsx)(j,{className:`grid gap-2 sm:grid-cols-2`,children:At.map(e=>(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-amber-500/40 p-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:e.name||e.roomId}),(0,z.jsxs)(`p`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:[e.status===`failed`?`Import failed`:`Import interrupted`,e.workspaceId?` · ${e.workspaceId}`:``]})]}),(0,z.jsxs)(i,{size:`sm`,variant:`destructive-outline`,onClick:()=>Ut(e.roomId),disabled:s!==null,children:[s===`discard-${e.roomId}`?(0,z.jsx)(T,{}):(0,z.jsx)(ce,{}),` Discard`]})]},e.roomId))})]}),(0,z.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsxs)(A,{className:`flex items-center gap-2`,children:[(0,z.jsx)(oe,{size:15}),` Start a Workroom`]}),(0,z.jsx)(M,{children:`Host collaboration from this computer. Your existing dashboard remains localhost-only.`})]}),(0,z.jsxs)(j,{className:`space-y-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Workspace`}),(0,z.jsxs)(k,{value:l,onValueChange:e=>typeof e==`string`&&re(e),children:[(0,z.jsx)(O,{children:(0,z.jsx)(S,{children:e.find(e=>e.branchName===l)?.branchName||`Select a workspace`})}),(0,z.jsx)(y,{children:e.map(e=>(0,z.jsx)(x,{value:e.branchName,children:e.branchName},e.id))})]})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Room name`}),(0,z.jsx)(a,{value:De,onChange:e=>Ae(e.target.value)})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Your display name`}),(0,z.jsx)(a,{value:Le,onChange:e=>B(e.target.value),placeholder:`Defaults to OS user`})]})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[1fr_100px]`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Network interface`}),(0,z.jsxs)(k,{value:L,onValueChange:e=>typeof e==`string`&&Pe(e),children:[(0,z.jsx)(O,{children:(0,z.jsx)(S,{children:L||`Select an address`})}),(0,z.jsx)(y,{children:ee.map(e=>(0,z.jsxs)(x,{value:e.address,children:[e.name,` · `,e.address,e.internal?` (local only)`:``]},`${e.name}-${e.address}`))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Port`}),(0,z.jsx)(a,{type:`number`,value:Fe,onChange:e=>Ie(e.target.value)})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(F,{children:`Room password`}),(0,z.jsx)(i,{size:`xs`,variant:`ghost`,onClick:()=>Re(Ve()),children:`Generate`})]}),(0,z.jsx)(a,{type:`password`,value:V,onChange:e=>Re(e.target.value)}),(0,z.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Share this separately from the invitation. Minimum 12 characters.`})]}),u&&(0,z.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-muted/30 p-3 text-xs`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`font-semibold text-foreground`,children:`Exact sharing review`}),(0,z.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:`Repository identities below are always included. Local context files are excluded until you explicitly include each one.`})]}),u.bundleWarnings.map(e=>(0,z.jsxs)(`p`,{className:`text-amber-700 dark:text-amber-300`,children:[`Bundle warning: `,e]},e)),(0,z.jsx)(`div`,{className:`space-y-1 font-mono text-[10px] text-muted-foreground`,children:u.bundle.repos.map(e=>(0,z.jsxs)(`div`,{className:`break-all`,children:[e.name,`: `,e.remoteUrl]},e.id))}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer font-semibold text-foreground`,children:`Complete shared feature metadata`}),(0,z.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 font-mono text-[10px]`,children:JSON.stringify(u.bundle,null,2)})]}),Object.keys(U).map(e=>(0,z.jsxs)(`div`,{className:`space-y-1.5 rounded border border-border bg-background p-2`,children:[(0,z.jsxs)(`label`,{className:`flex items-center gap-2 font-semibold text-foreground`,children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:I[e],onChange:t=>{be(n=>({...n,[e]:t.target.checked})),we(!1)}}),` Include `,U[e]]}),u.warnings[e].map(e=>(0,z.jsxs)(`p`,{className:`text-amber-700 dark:text-amber-300`,children:[`Warning: `,e]},e)),(0,z.jsx)(E,{"aria-label":`${U[e]} exact outbound content`,className:`min-h-28 font-mono text-[10px]`,value:d[e],onChange:t=>{he(n=>({...n,[e]:t.target.value})),we(!1)}}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:I[e]?`${d[e].length.toLocaleString()} characters will be shared.`:`Excluded from the Workroom.`})]},e)),(0,z.jsxs)(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background p-2 text-[11px]`,children:[(0,z.jsx)(`input`,{className:`mt-0.5`,type:`checkbox`,checked:Se,onChange:e=>we(e.target.checked)}),(0,z.jsx)(`span`,{children:`I reviewed the exact included text and repository identities, including any credential, path, diff, or transcript warnings.`})]})]}),(0,z.jsxs)(i,{className:`w-full`,onClick:Vt,disabled:!u||!Se||!L||V.length<12||s!==null,children:[s===`start`?(0,z.jsx)(T,{}):(0,z.jsx)(fe,{}),` Start private Workroom`]})]})]}),(0,z.jsxs)(`div`,{className:`space-y-6`,children:[(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsxs)(A,{className:`flex items-center gap-2`,children:[(0,z.jsx)(Ee,{size:15}),` Join a Workroom`]}),(0,z.jsx)(M,{children:`Paste the invitation and enter the separately shared password. The host must approve this device.`})]}),(0,z.jsxs)(j,{className:`space-y-4`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Invitation`}),(0,z.jsx)(E,{className:`min-h-24 font-mono text-xs`,value:Je,onChange:e=>Ye(e.target.value),placeholder:`${v}//workroom/join?...`})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Password`}),(0,z.jsx)(a,{type:`password`,value:Xe,onChange:e=>Ze(e.target.value)})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Your display name`}),(0,z.jsx)(a,{value:Qe,onChange:e=>$e(e.target.value)})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Local workspace mapping`}),(0,z.jsxs)(k,{value:l,onValueChange:e=>typeof e==`string`&&re(e),children:[(0,z.jsx)(O,{children:(0,z.jsx)(S,{children:e.find(e=>e.branchName===l)?.branchName||`Select your checkout (recommended)`})}),(0,z.jsx)(y,{children:e.map(e=>(0,z.jsx)(x,{value:e.branchName,children:e.branchName},e.id))})]}),(0,z.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Used for local agent proposals and handoff snapshots; code remains in this checkout.`})]}),(0,z.jsxs)(i,{className:`w-full`,onClick:Wt,disabled:!Je||!Xe||s!==null,children:[s===`join`?(0,z.jsx)(T,{}):(0,z.jsx)(Me,{}),` Request to join`]})]})]}),(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsxs)(A,{className:`flex items-center gap-2`,children:[(0,z.jsx)(je,{size:15}),` Import an encrypted room`]}),(0,z.jsx)(M,{children:`Creates a new room identity, certificate, password, and membership set.`})]}),(0,z.jsxs)(j,{className:`space-y-3`,children:[(0,z.jsx)(a,{type:`file`,accept:`.json,${h},${le}`,onChange:e=>{let n=e.target.files?.[0];if(n){if(n.size>157286400){t(`Workroom export files are limited to 150 MiB.`,`error`);return}n.text().then(e=>wt(JSON.parse(e))).catch(()=>t(`Invalid Workroom export file.`,`error`))}}}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Export passphrase`}),(0,z.jsx)(a,{type:`password`,value:q,onChange:e=>St(e.target.value)})]}),(0,z.jsxs)(i,{variant:`outline`,className:`w-full`,onClick:rn,disabled:!Ct||!L||V.length<12||s!==null,children:[s===`import`?(0,z.jsx)(T,{}):(0,z.jsx)(je,{}),` Import and host`]})]})]})]})]})]});if(It||n.mode===`guest`&&n.status===`rejected`)return(0,z.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,z.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-primary/10 text-primary`,children:It?(0,z.jsx)(C,{className:`animate-spin`}):(0,z.jsx)(Ne,{})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:It?`Waiting for host approval`:`Join request rejected`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:It?`Your device credential is ready, but no room context is available until the host accepts you.`:`Ask the host for a new one-use invitation if this was unexpected.`})]}),(0,z.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[It&&(0,z.jsxs)(i,{onClick:Gt,disabled:s!==null,children:[s===`poll`?(0,z.jsx)(T,{}):(0,z.jsx)(C,{}),` Check approval`]}),(0,z.jsx)(i,{variant:`outline`,onClick:Kt,children:`Cancel`})]})]});if(n.mode===`guest`&&n.status===`accepted`&&!Y){let e=n.connection===`revoked`;return(0,z.jsxs)(`div`,{className:`mx-auto flex max-w-xl flex-col gap-5 py-16 text-center`,children:[(0,z.jsx)(`div`,{className:`mx-auto grid size-14 place-items-center rounded-full bg-amber-500/10 text-amber-700`,children:e?(0,z.jsx)(Ne,{}):(0,z.jsx)(oe,{})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold`,children:e?`Workroom access was revoked`:`Workroom connection is unavailable`}),(0,z.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e?`Leave this local connection, then ask the host for a new one-use invitation if you should rejoin.`:`The host or VPN may be offline. You can retry without losing the local connection, or leave immediately.`})]}),(0,z.jsxs)(`div`,{className:`flex justify-center gap-2`,children:[!e&&(0,z.jsxs)(i,{onClick:()=>Z(!0),disabled:s!==null,children:[(0,z.jsx)(C,{}),` Retry connection`]}),(0,z.jsxs)(i,{variant:`outline`,onClick:Kt,disabled:s!==null,children:[s===`stop`?(0,z.jsx)(T,{}):(0,z.jsx)(de,{}),` Leave local connection`]})]})]})}return Y?(0,z.jsxs)(`div`,{className:`mx-auto max-w-[1500px] animate-fade-in space-y-4`,children:[Tt!==`stream`&&(0,z.jsxs)(`header`,{className:`flex flex-col gap-3 border-b border-border pb-4 sm:flex-row sm:items-center`,children:[(0,z.jsxs)(i,{ref:Pt,variant:`ghost`,onClick:()=>J(`stream`),children:[(0,z.jsx)(ye,{}),` Back to Handoff Stream`]}),(0,z.jsxs)(`div`,{className:`min-w-0 sm:border-l sm:border-border sm:pl-4`,children:[(0,z.jsx)(`p`,{className:`text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground`,children:Y.name}),(0,z.jsx)(`h1`,{className:`truncate text-lg font-semibold`,children:Be[Tt]})]})]}),H&&(0,z.jsxs)(ve,{variant:`success`,children:[(0,z.jsx)(Te,{}),(0,z.jsx)(_e,{children:`One-use invitation ready`}),(0,z.jsxs)(ge,{children:[(0,z.jsx)(`span`,{className:`break-all font-mono text-[10px]`,children:H}),(0,z.jsxs)(`span`,{children:[`Expires `,new Date(Ue).toLocaleString(),`. Share the password separately.`]})]}),(0,z.jsxs)(i,{size:`sm`,variant:`outline`,onClick:()=>void w(H),children:[(0,z.jsx)(xe,{}),` Copy`]})]}),(0,z.jsxs)(se,{value:Tt,onValueChange:e=>J(e),children:[(0,z.jsxs)(p,{className:`hidden`,children:[(0,z.jsx)(f,{value:`stream`,children:`Handoff Stream`}),Object.keys(Be).map(e=>(0,z.jsx)(f,{value:e,children:Be[e]},e))]}),(0,z.jsx)(m,{value:`stream`,className:`mt-0`,children:(0,z.jsx)(ze,{snapshot:Y,roomUrl:n.url,isHost:X,me:Lt,busy:s,message:Et,hasUnsavedHandoffDraft:G.handoff,headingRef:Nt,onCreateInvite:qt,onRefresh:()=>Z(!0),onStopOrLeave:Kt,onOpenTool:J,onMessageChange:Dt,onPostUpdate:tn})}),(0,z.jsxs)(m,{value:`overview`,className:`space-y-5`,children:[(0,z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-3`,children:[(0,z.jsx)(P,{children:(0,z.jsxs)(N,{children:[(0,z.jsx)(M,{children:`Members`}),(0,z.jsx)(A,{className:`text-2xl`,children:Y.participants.filter(e=>!e.revokedAt).length})]})}),(0,z.jsx)(P,{children:(0,z.jsxs)(N,{children:[(0,z.jsx)(M,{children:`Shared resources`}),(0,z.jsx)(A,{className:`text-2xl`,children:Y.resources.filter(e=>!e.quarantinedAt).length})]})}),(0,z.jsx)(P,{children:(0,z.jsxs)(N,{children:[(0,z.jsx)(M,{children:`Repository identities`}),(0,z.jsx)(A,{className:`text-2xl`,children:Y.bundle.repos.length})]})})]}),(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:Y.bundle.feature.goal}),(0,z.jsxs)(M,{children:[Y.bundle.project.name,` · portable feature `,Y.bundle.feature.id]})]}),(0,z.jsx)(j,{className:`space-y-2`,children:Y.bundle.repos.map(e=>(0,z.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,z.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-sm font-medium`,children:e.name}),(0,z.jsx)(o,{variant:`secondary`,children:e.defaultBranch})]}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-muted-foreground`,children:e.remoteUrl}),e.handoff&&(0,z.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.handoff.branch,` @ `,e.handoff.commit.slice(0,12),` · `,e.handoff.dirty?`dirty`:`clean`,` · ↑`,e.handoff.ahead,` ↓`,e.handoff.behind]})]},e.id))})]}),(0,z.jsxs)(ve,{variant:`info`,children:[(0,z.jsx)(ae,{}),(0,z.jsx)(_e,{children:`Never collected automatically`}),(0,z.jsxs)(ge,{children:[_,` does not add source archives, filenames, diffs, local paths, credentials, terminals, editor state, or AI transcripts. A developer can still include sensitive text in a reviewed shared document.`]})]})]}),(0,z.jsx)(m,{value:`context`,className:`space-y-4`,children:Object.keys(U).map(e=>(0,z.jsxs)(P,{children:[(0,z.jsx)(N,{children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(A,{children:U[e]}),(0,z.jsxs)(M,{children:[`Revision `,Y.documents[e].revision,` · updated `,new Date(Y.documents[e].updatedAt).toLocaleString()]})]}),G[e]&&(0,z.jsx)(o,{variant:`warning`,children:`Local draft`})]})}),(0,z.jsxs)(j,{className:`space-y-3`,children:[(0,z.jsx)(E,{className:`min-h-64 font-mono text-xs`,value:nt[e],disabled:s!==null,onChange:t=>{rt(n=>({...n,[e]:t.target.value})),it(t=>({...t,[e]:!0}))}}),(0,z.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[e===`handoff`&&(0,z.jsxs)(i,{variant:`outline`,onClick:()=>Q(`handoff`,()=>D(`/api/workrooms/handoff`,{method:`POST`,body:JSON.stringify({workspaceId:n.localWorkspaceId})}).then(()=>void 0),`Git metadata handoff published.`),disabled:!n.localWorkspaceId||s!==null,children:[(0,z.jsx)(C,{}),` Publish Git snapshot`]}),(0,z.jsxs)(i,{onClick:()=>Jt(e),disabled:!G[e]||s!==null,children:[s===`doc-${e}`?(0,z.jsx)(T,{}):(0,z.jsx)(je,{}),` Share revision`]})]})]})]},e))}),(0,z.jsxs)(m,{value:`resources`,className:`space-y-4`,children:[Rt&&(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:`Publish a local resource`}),(0,z.jsx)(M,{children:`Published versions are immutable. Connected developers are notified and choose whether to download and apply them.`})]}),(0,z.jsxs)(j,{className:`flex flex-col gap-3 sm:flex-row sm:items-end`,children:[(0,z.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,z.jsx)(F,{children:`Resource`}),(0,z.jsxs)(k,{value:ot,onValueChange:e=>typeof e==`string`&&st(e),children:[(0,z.jsx)(O,{children:(0,z.jsx)(S,{children:K.find(e=>`${e.kind}:${e.id}`===ot)?.name||`Select resource`})}),(0,z.jsx)(y,{children:K.map(e=>(0,z.jsxs)(x,{value:`${e.kind}:${e.id}`,children:[e.kind,` · `,e.name]},`${e.kind}:${e.id}`))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Version`}),(0,z.jsx)(a,{className:`w-32 font-mono`,value:ct,onChange:e=>lt(e.target.value)})]}),(0,z.jsxs)(i,{onClick:Yt,disabled:!ot||s!==null,children:[(0,z.jsx)(je,{}),` Publish`]})]})]}),(0,z.jsx)(`div`,{className:`grid gap-3`,children:Y.resources.length===0?(0,z.jsx)(P,{className:`p-8 text-center text-sm text-muted-foreground`,children:`No resources have been published.`}):Y.resources.map(e=>{let t=ut[e.digest],n=[e.compatibility?.platforms?.length?`platforms: ${e.compatibility.platforms.join(`, `)}`:void 0,e.compatibility?.contextspace?`${_} ${e.compatibility.contextspace}`:e.compatibility?.nexusflow?`${ue} ${e.compatibility.nexusflow}`:void 0].filter(Boolean).join(` · `);return(0,z.jsx)(P,{className:e.quarantinedAt?`opacity-60`:``,children:(0,z.jsxs)(j,{className:`space-y-3 p-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(o,{variant:`secondary`,children:e.kind}),(0,z.jsxs)(`span`,{className:`text-sm font-semibold`,children:[e.id,`@`,e.version]}),e.quarantinedAt&&(0,z.jsx)(o,{variant:`error`,children:`Quarantined`})]}),(0,z.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`SHA-256 `,e.digest]}),n&&(0,z.jsxs)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[`Compatibility · `,n]})]}),e.quarantinedAt?X&&(0,z.jsxs)(i,{variant:`destructive-outline`,onClick:()=>$t(e.digest),disabled:s!==null,children:[s===`purge-${e.digest}`?(0,z.jsx)(T,{}):(0,z.jsx)(ce,{}),` Purge permanently`]}):(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t?(0,z.jsxs)(i,{onClick:()=>Zt(e.digest),disabled:s!==null,children:[(0,z.jsx)(ke,{}),` Approve exact digest & apply`]}):(0,z.jsxs)(i,{variant:`outline`,onClick:()=>Xt(e.digest),disabled:s!==null,children:[(0,z.jsx)(Ce,{}),` Download for review`]}),X&&(0,z.jsx)(i,{variant:`ghost`,onClick:()=>Qt(e.digest),disabled:s!==null,children:`Quarantine`})]})]}),t&&(0,z.jsxs)(`div`,{className:`space-y-3 rounded border border-border bg-muted/30 p-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`p`,{className:`text-xs font-semibold`,children:[`Exact package review · `,t.action===`update`?`updates an existing local resource`:`creates a new local resource`]}),(0,z.jsxs)(`p`,{className:`text-[10px] text-muted-foreground`,children:[`Applying installs the incoming definition shown below and is bound to SHA-256 `,e.digest,`.`]})]}),t.existingDefinition&&(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-xs font-semibold`,children:`Current local definition`}),(0,z.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:t.existingDefinition})]}),(0,z.jsxs)(`details`,{open:!0,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-xs font-semibold`,children:`Incoming applied definition`}),(0,z.jsx)(`pre`,{className:`mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:t.incomingDefinition})]}),(0,z.jsx)(`div`,{className:`space-y-2`,children:t.files.map(e=>(0,z.jsxs)(`details`,{children:[(0,z.jsxs)(`summary`,{className:`cursor-pointer font-mono text-[10px]`,children:[e.path,` · `,e.bytes.toLocaleString(),` bytes · `,e.encoding,e.executable?` · executable`:``]}),(0,z.jsx)(`pre`,{className:`mt-1 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-2 text-[10px]`,children:e.content})]},e.path))})]})]})},e.digest)})})]}),(0,z.jsxs)(m,{value:`workflow`,className:`space-y-4`,children:[X&&!Y.workflowProgress&&(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:`Start shared workflow tracking`}),(0,z.jsx)(M,{children:`Convert a local strategy into explicit ordered steps. Agents may propose completion; a developer confirms it.`})]}),(0,z.jsxs)(j,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[1fr_130px]`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Workflow`}),(0,z.jsxs)(k,{value:ft,onValueChange:e=>typeof e==`string`&&pt(e),children:[(0,z.jsx)(O,{children:(0,z.jsx)(S,{children:K.find(e=>e.id===ft&&e.kind===`workflow`)?.name||`Select workflow`})}),(0,z.jsx)(y,{children:K.filter(e=>e.kind===`workflow`).map(e=>(0,z.jsx)(x,{value:e.id,children:e.name},e.id))})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Version`}),(0,z.jsx)(a,{value:mt,onChange:e=>ht(e.target.value)})]})]}),(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Ordered steps, one per line`}),(0,z.jsx)(E,{className:`min-h-32`,value:gt,onChange:e=>_t(e.target.value)})]}),(0,z.jsxs)(i,{onClick:en,disabled:!ft||s!==null,children:[(0,z.jsx)(fe,{}),` Start workflow`]})]})]}),!X&&!Y.workflowProgress&&(0,z.jsx)(P,{children:(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:`No shared workflow yet`}),(0,z.jsx)(M,{children:`The host can select a reviewed workflow for this room. You can continue sharing context and handoff updates while you wait.`})]})}),Y.workflowProgress&&(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsxs)(A,{children:[Y.workflowProgress.package.name,`@`,Y.workflowProgress.workflow.version]}),(0,z.jsxs)(M,{children:[`Exact strategy retained at digest `,Y.workflowProgress.workflow.digest.slice(0,12),`… · shared progress revision `,Y.workflowProgress.revision]})]}),(0,z.jsx)(j,{className:`space-y-3`,children:Y.workflowProgress.steps.map((e,t)=>{let n=Y.workflowProgress.package.steps.find(t=>t.id===e.stepId);return(0,z.jsx)(`div`,{className:`rounded-lg border border-border p-3`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`grid size-5 place-items-center rounded-full bg-muted text-[10px]`,children:t+1}),(0,z.jsx)(`span`,{className:`text-xs font-semibold`,children:n?.title||e.stepId}),(0,z.jsx)(o,{variant:e.status===`completed`?`success`:e.status===`completion_proposed`?`warning`:`secondary`,children:e.status.replace(`_`,` `)})]}),(0,z.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.stepId}),e.evidence&&(0,z.jsxs)(`p`,{className:`mt-2 whitespace-pre-wrap text-xs text-muted-foreground`,children:[`Evidence: `,e.evidence]}),n?.requiresEvidence&&(0,z.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,z.jsx)(F,{htmlFor:`workflow-evidence-${e.stepId}`,children:`Completion evidence`}),(0,z.jsx)(E,{id:`workflow-evidence-${e.stepId}`,className:`min-h-20 text-xs`,value:vt[e.stepId]??e.evidence??``,onChange:t=>yt(n=>({...n,[e.stepId]:t.target.value})),placeholder:`Tests, review result, or other verification`})]})]}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.status===`completion_proposed`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(i,{size:`sm`,onClick:()=>$(e,`completed`),children:[(0,z.jsx)(pe,{}),` Confirm`]}),(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>$(e,`in_progress`),children:`Reject`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>$(e,`in_progress`),children:`In progress`}),(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>$(e,`completed`),children:`Complete`}),(0,z.jsx)(i,{size:`sm`,variant:`ghost`,onClick:()=>$(e,`pending`),children:`Reopen`})]})})]})},e.stepId)})})]})]}),(0,z.jsxs)(m,{value:`members`,className:`space-y-4`,children:[X&&Y.pendingJoins.map(e=>(0,z.jsxs)(ve,{variant:`warning`,children:[(0,z.jsx)(Me,{}),(0,z.jsxs)(_e,{children:[e.displayName,` wants to join`]}),(0,z.jsxs)(ge,{children:[`Requested `,new Date(e.requestedAt).toLocaleString()]}),(0,z.jsxs)(`div`,{className:`flex gap-1`,children:[(0,z.jsx)(i,{size:`sm`,onClick:()=>Q(`accept-${e.id}`,()=>D(`/api/workrooms/members/${e.id}/decision`,{method:`POST`,body:JSON.stringify({accept:!0})}).then(()=>void 0)),children:`Accept`}),(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>Q(`reject-${e.id}`,()=>D(`/api/workrooms/members/${e.id}/decision`,{method:`POST`,body:JSON.stringify({accept:!1})}).then(()=>void 0)),children:`Reject`})]})]},e.id)),(0,z.jsx)(P,{children:(0,z.jsx)(j,{className:`divide-y divide-border p-0`,children:Y.participants.map(e=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`size-2 rounded-full ${e.revokedAt?`bg-muted-foreground`:`bg-emerald-500`}`}),(0,z.jsx)(`span`,{className:`text-sm font-semibold`,children:e.displayName}),(0,z.jsx)(o,{variant:e.role===`host`?`info`:`secondary`,children:e.role}),e.id===Lt?.id&&(0,z.jsx)(o,{variant:`success`,children:`You`})]}),(0,z.jsxs)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:[`Joined `,new Date(e.joinedAt).toLocaleString()]})]}),X&&e.role!==`host`&&!e.revokedAt&&(0,z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,z.jsx)(i,{size:`sm`,variant:`outline`,onClick:()=>Q(`role-${e.id}`,()=>D(`/api/workrooms/members/${e.id}/role`,{method:`PUT`,body:JSON.stringify({role:e.role===`publisher`?`member`:`publisher`})}).then(()=>void 0)),children:e.role===`publisher`?`Make member`:`Make publisher`}),(0,z.jsxs)(i,{size:`sm`,variant:`destructive-outline`,onClick:()=>Q(`revoke-${e.id}`,()=>D(`/api/workrooms/members/${e.id}`,{method:`DELETE`}).then(()=>void 0)),children:[(0,z.jsx)(Ne,{}),` Revoke`]})]})]},e.id))})})]}),(0,z.jsx)(m,{value:`activity`,children:(0,z.jsx)(P,{children:(0,z.jsx)(j,{className:`divide-y divide-border p-0`,children:[...Y.activity].reverse().map(e=>(0,z.jsxs)(`div`,{className:`flex gap-3 p-4`,children:[(0,z.jsx)(ne,{className:`mt-0.5 shrink-0 text-muted-foreground`,size:14}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-sm`,children:e.summary}),(0,z.jsxs)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:[`#`,e.sequence,` · `,e.type,` · `,new Date(e.createdAt).toLocaleString()]})]})]},e.sequence))})})}),(0,z.jsxs)(m,{value:`security`,className:`space-y-4`,children:[(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:`TLS identity`}),(0,z.jsx)(M,{children:`Guests pin this SHA-256 fingerprint from the invitation. Mismatches stop before any password or device credential is sent.`})]}),(0,z.jsx)(j,{children:(0,z.jsx)(`code`,{className:`break-all text-xs`,children:Y.certificateFingerprint})})]}),X&&(0,z.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:`Rotate room password`}),(0,z.jsx)(M,{children:`Outstanding invitations are revoked. Existing device credentials are revoked by default.`})]}),(0,z.jsxs)(j,{className:`space-y-3`,children:[(0,z.jsx)(a,{type:`password`,value:bt,onChange:e=>xt(e.target.value)}),(0,z.jsxs)(i,{variant:`destructive-outline`,onClick:()=>Q(`rotate`,()=>D(`/api/workrooms/password/rotate`,{method:`POST`,body:JSON.stringify({password:bt,revokeDevices:!0})}).then(()=>void 0),`Password rotated and guest devices revoked.`),children:[(0,z.jsx)(Te,{}),` Rotate and revoke`]})]})]}),(0,z.jsxs)(P,{children:[(0,z.jsxs)(N,{children:[(0,z.jsx)(A,{children:`Encrypted portable export`}),(0,z.jsx)(M,{children:`Excludes certificates, password hashes, invitations, and device credentials.`})]}),(0,z.jsxs)(j,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,z.jsx)(F,{children:`Export passphrase`}),(0,z.jsx)(a,{type:`password`,value:q,onChange:e=>St(e.target.value)})]}),(0,z.jsxs)(i,{variant:`outline`,onClick:nn,disabled:q.length<12||s!==null,children:[(0,z.jsx)(Ce,{}),` Export room`]})]})]})]})]})]})]}):(0,z.jsx)(`div`,{className:`flex justify-center py-24`,children:(0,z.jsx)(T,{className:`size-6`})})}export{qe as WorkroomsPage};
|