local-operator-ui 0.31.13 → 0.31.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/out/main/index.js +53 -9
  2. package/out/renderer/assets/{_basePickBy-DjjQEvSb.js → _basePickBy-ByW4PGoZ.js} +1 -1
  3. package/out/renderer/assets/{_baseUniq-BqECYZsi.js → _baseUniq-BNZdLtEU.js} +1 -1
  4. package/out/renderer/assets/{agent-details-page-DWSkiNxw.js → agent-details-page-DAKGVTok.js} +1 -1
  5. package/out/renderer/assets/{agent-hub-page-D_c8J10-.js → agent-hub-page-DCQCLvuE.js} +1 -1
  6. package/out/renderer/assets/{agents-page-GjfdafAi.js → agents-page-P80PpPfF.js} +2 -2
  7. package/out/renderer/assets/{arc-DLAhhRoh.js → arc-BM_dGTT0.js} +1 -1
  8. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-Dz9DJe6U.js → architectureDiagram-IEHRJDOE-CEVl1UVo.js} +1 -1
  9. package/out/renderer/assets/{blockDiagram-JOT3LUYC-B1abEmJ8.js → blockDiagram-JOT3LUYC-Dd4ZtDNT.js} +1 -1
  10. package/out/renderer/assets/{book-open-4wp9tz_T.js → book-open-DORvUlzH.js} +1 -1
  11. package/out/renderer/assets/browser-page-D8jzpIB2.js +1 -0
  12. package/out/renderer/assets/{browser-webauthn-prompt-DIxt4Z0f.js → browser-webauthn-prompt-Bq-HOJkh.js} +1 -1
  13. package/out/renderer/assets/{c4Diagram-VJAJSXHY-DFUTE5Ky.js → c4Diagram-VJAJSXHY-DJyy7n2t.js} +1 -1
  14. package/out/renderer/assets/channel-Dd9P9cjr.js +1 -0
  15. package/out/renderer/assets/{chunk-4BMEZGHF-BwRplWr0.js → chunk-4BMEZGHF-p9QlgFQx.js} +1 -1
  16. package/out/renderer/assets/{chunk-A2AXSNBT-CojVy5BF.js → chunk-A2AXSNBT-jc38hxTP.js} +1 -1
  17. package/out/renderer/assets/{chunk-AEK57VVT-BbTJ2nr6.js → chunk-AEK57VVT-C-Lkcz0b.js} +1 -1
  18. package/out/renderer/assets/{chunk-D6G4REZN-Rb5cgSb4.js → chunk-D6G4REZN-BTNuVsq7.js} +1 -1
  19. package/out/renderer/assets/{chunk-RZ5BOZE2-B04F7M_0.js → chunk-RZ5BOZE2-BeXwBs0F.js} +1 -1
  20. package/out/renderer/assets/{chunk-XZIHB7SX-tjI4W2Za.js → chunk-XZIHB7SX-BFoUrE4z.js} +1 -1
  21. package/out/renderer/assets/classDiagram-GIVACNV2-CfiTqRrL.js +1 -0
  22. package/out/renderer/assets/classDiagram-v2-COTLJTTW-CfiTqRrL.js +1 -0
  23. package/out/renderer/assets/clone-DjeICEmq.js +1 -0
  24. package/out/renderer/assets/{console-mirror-Cp8JlE_x.js → console-mirror-gvEt6nID.js} +14 -14
  25. package/out/renderer/assets/{consoleCapture-BuuG2eYo.js → consoleCapture-BPecswCL.js} +1 -1
  26. package/out/renderer/assets/{dagre-OKDRZEBW-Yr1p9tqE.js → dagre-OKDRZEBW-DId-VIUD.js} +1 -1
  27. package/out/renderer/assets/{diagram-SSKATNLV-CUK31Gls.js → diagram-SSKATNLV-B91xcqFD.js} +1 -1
  28. package/out/renderer/assets/{diagram-VNBRO52H-DIjVl2yr.js → diagram-VNBRO52H-2FONSfG-.js} +1 -1
  29. package/out/renderer/assets/{erDiagram-Q7BY3M3F-DfFyzWJt.js → erDiagram-Q7BY3M3F-DC6yLQdn.js} +1 -1
  30. package/out/renderer/assets/{error-boundary-BxKgKUoO.js → error-boundary-bl9plxwd.js} +2 -2
  31. package/out/renderer/assets/{flowDiagram-4HSFHLVR-DcwqvGRJ.js → flowDiagram-4HSFHLVR-BQkDbqUO.js} +1 -1
  32. package/out/renderer/assets/{ganttDiagram-APWFNJXF-CYwBjlHW.js → ganttDiagram-APWFNJXF-DuMe7srU.js} +1 -1
  33. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-Do6CcWt4.js → gitGraphDiagram-7IBYFJ6S-IweLEul4.js} +1 -1
  34. package/out/renderer/assets/{graph-CQQogzkE.js → graph-dWQI_6He.js} +1 -1
  35. package/out/renderer/assets/{index-BwDDMKpx.js → index-BCLoCIgZ.js} +1 -1
  36. package/out/renderer/assets/{index-BGpQvlC-.js → index-BYm582eS.js} +397 -391
  37. package/out/renderer/assets/index-D7kPcQIL.css +1 -0
  38. package/out/renderer/assets/{index-Go5S7QEQ.js → index-DThKaYgW.js} +1 -1
  39. package/out/renderer/assets/{infoDiagram-PH2N3AL5-DO8p7Ibe.js → infoDiagram-PH2N3AL5-DJ28BiA9.js} +1 -1
  40. package/out/renderer/assets/{installer-iwJK_r4X.js → installer-B5olEpOL.js} +1 -1
  41. package/out/renderer/assets/{journeyDiagram-U35MCT3I-BzyoDXz6.js → journeyDiagram-U35MCT3I-Chhmcl-w.js} +1 -1
  42. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-C5KJJD3f.js → kanban-definition-NDS4AKOZ-BppAzkjD.js} +1 -1
  43. package/out/renderer/assets/{layout-DBWsZr1z.js → layout-DASlxn3X.js} +1 -1
  44. package/out/renderer/assets/legacy-agents-page-DWRDsjtU.js +33 -0
  45. package/out/renderer/assets/{mermaid.core-DjEcfQ2P.js → mermaid.core-BimBLnQI.js} +5 -5
  46. package/out/renderer/assets/{mesh-page-sfL6urAN.js → mesh-page-DJ2Xu7WX.js} +1 -1
  47. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DbBMNkp2.js → mindmap-definition-ALO5MXBD-CL0_Dklo.js} +1 -1
  48. package/out/renderer/assets/{org-surface-gate-BDsBqFdT.js → org-surface-gate-DBSpQaKQ.js} +1 -1
  49. package/out/renderer/assets/{page-header-7eTvlPad.js → page-header-CSth8igb.js} +1 -1
  50. package/out/renderer/assets/{pieDiagram-IB7DONF6-BOUMap4K.js → pieDiagram-IB7DONF6-D7sMeZBn.js} +1 -1
  51. package/out/renderer/assets/projects-page-BXnZiqzW.js +22 -0
  52. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-KVdqTwJk.js → quadrantDiagram-7GDLP6J5-CYm8uvms.js} +1 -1
  53. package/out/renderer/assets/{radar-MK3ICKWK-CTQEOe3H.js → radar-MK3ICKWK-kR5WGC6e.js} +1 -1
  54. package/out/renderer/assets/{radient-auth-buttons-BazI7e18.js → radient-auth-buttons-D2Mlpaea.js} +1 -1
  55. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-CpsfwkBd.js → requirementDiagram-KVF5MWMF-D9KpdhqG.js} +1 -1
  56. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-2Z-78WfE.js → sankeyDiagram-QLVOVGJD-CDDiu1t7.js} +1 -1
  57. package/out/renderer/assets/{schedules-page-Ban3orsO.js → schedules-page-sReBxwJU.js} +1 -1
  58. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-C2dIRuZz.js → sequenceDiagram-X6HHIX6F-CysJg9MU.js} +1 -1
  59. package/out/renderer/assets/{settings-page-DhuCeNKV.js → settings-page-BmCMRg0Q.js} +7 -7
  60. package/out/renderer/assets/{settings-section-JVdUSFVI.js → settings-section-BrZkwHPu.js} +1 -1
  61. package/out/renderer/assets/{stateDiagram-DGXRK772-soqNXJ79.js → stateDiagram-DGXRK772-DZNHqXFO.js} +1 -1
  62. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BR9bXWLS.js +1 -0
  63. package/out/renderer/assets/{timeline-definition-BDJGKUSR-DFPF4fnf.js → timeline-definition-BDJGKUSR-Cq5I65iA.js} +1 -1
  64. package/out/renderer/assets/{use-download-agent-mutation-BJVETEyg.js → use-download-agent-mutation-BiwTStj8.js} +2 -2
  65. package/out/renderer/assets/{use-memberships-query-CIdgBOGr.js → use-memberships-query-DBa-IUeT.js} +1 -1
  66. package/out/renderer/assets/{xychartDiagram-VJFVF3MP---VkBu3L.js → xychartDiagram-VJFVF3MP-BMgv0pD_.js} +1 -1
  67. package/out/renderer/console-capture.html +4 -4
  68. package/out/renderer/index.html +5 -5
  69. package/out/renderer/installer.html +4 -4
  70. package/package.json +2 -2
  71. package/out/renderer/assets/browser-page-O2yUi_D9.js +0 -1
  72. package/out/renderer/assets/channel-DwtjXPiQ.js +0 -1
  73. package/out/renderer/assets/classDiagram-GIVACNV2-I8f9T0d1.js +0 -1
  74. package/out/renderer/assets/classDiagram-v2-COTLJTTW-I8f9T0d1.js +0 -1
  75. package/out/renderer/assets/clone-WON5xoYU.js +0 -1
  76. package/out/renderer/assets/index-C9VwzLl-.css +0 -1
  77. package/out/renderer/assets/legacy-agents-page-BDjH2h53.js +0 -38
  78. package/out/renderer/assets/projects-page-CjiztSuz.js +0 -11
  79. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Bn8yI4B0.js +0 -1
  80. /package/out/renderer/assets/{index-Biw7WGBF.js → index-BkWL0Tso.js} +0 -0
@@ -1,11 +0,0 @@
1
- import{r as g,j as e,c as D}from"./index-Biw7WGBF.js";import{bF as We,bG as ne,bH as He,bI as Oe,g as $e,bJ as Je,bK as Ge,bL as Xe,bM as Ze,bN as et,bO as tt,bP as fe,bQ as ge,bR as st,bS as at,h as Re,as as Y,k as P,am as le,aY as nt,i as Z,bT as rt,ac as ce,aB as de,bU as it,bV as te,aC as ot,bW as lt,bX as ct,j as je,P as G,ax as be,bY as dt,aw as ut,ad as Q,at as B,a as mt,c as ht,b1 as xt,bZ as ve,b_ as pt}from"./index-BGpQvlC-.js";import{P as ye}from"./page-header-7eTvlPad.js";import{c as Le,v as ft,w as gt,x as jt,F as se,G as bt,H as vt,J as yt,K as kt,M as Nt,z as wt,N as A,P as St,O as Ct,Q as Dt,B as T,I as R,S as K,L as E,T as Tt,p as ke,q as Ne,r as we,s as Se,t as ae,R as _t,U as Mt,X as Et,A as re,V as Pt,W as Ot,Y as $t,Z as Rt}from"./error-boundary-BxKgKUoO.js";import"./console-mirror-Cp8JlE_x.js";function Ce(t,s){return t.filter(a=>!s.includes(a))}function Lt(t,s,a){const n=t.slice(0);return n[s]=a,n}var At=class extends We{#a;#e;#n;#r;#t;#s;#i;#o;#l=[];constructor(t,s,a){super(),this.#a=t,this.#r=a,this.#n=[],this.#t=[],this.#e=[],this.setQueries(s)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(t=>{t.subscribe(s=>{this.#m(t,s)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(t=>{t.destroy()})}setQueries(t,s){this.#n=t,this.#r=s,ne.batch(()=>{const a=this.#t,n=this.#u(this.#n);this.#l=n,n.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const r=n.map(o=>o.observer),i=r.map(o=>o.getCurrentResult()),c=r.some((o,p)=>o!==a[p]);a.length===r.length&&!c||(this.#t=r,this.#e=i,this.hasListeners()&&(Ce(a,r).forEach(o=>{o.destroy()}),Ce(r,a).forEach(o=>{o.subscribe(p=>{this.#m(o,p)})}),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(t=>t.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(t,s){const a=this.#u(t),n=a.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions));return[n,r=>this.#d(r??n,s),()=>this.#c(n,a)]}#c(t,s){return s.map((a,n)=>{const r=t[n];return a.defaultedQueryOptions.notifyOnChangeProps?r:a.observer.trackResult(r,i=>{s.forEach(c=>{c.observer.trackProp(i)})})})}#d(t,s){return s?((!this.#s||this.#e!==this.#o||s!==this.#i)&&(this.#i=s,this.#o=this.#e,this.#s=He(this.#s,s(t))),this.#s):t}#u(t){const s=new Map(this.#t.map(n=>[n.options.queryHash,n])),a=[];return t.forEach(n=>{const r=this.#a.defaultQueryOptions(n),i=s.get(r.queryHash);i?a.push({defaultedQueryOptions:r,observer:i}):a.push({defaultedQueryOptions:r,observer:new Oe(this.#a,r)})}),a}#m(t,s){const a=this.#t.indexOf(t);a!==-1&&(this.#e=Lt(this.#e,a,s),this.#h())}#h(){if(this.hasListeners()){const t=this.#s,s=this.#c(this.#e,this.#l),a=this.#d(s,this.#r?.combine);t!==a&&ne.batch(()=>{this.listeners.forEach(n=>{n(this.#e)})})}}};function Ut({queries:t,...s},a){const n=$e(),r=Je(),i=Ge(),c=g.useMemo(()=>t.map(m=>{const N=n.defaultQueryOptions(m);return N._optimisticResults=r?"isRestoring":"optimistic",N}),[t,n,r]);c.forEach(m=>{Xe(m),Ze(m,i)}),et(i);const[o]=g.useState(()=>new At(n,c,s)),[p,f,l]=o.getOptimisticResult(c,s.combine),u=!r&&s.subscribed!==!1;g.useSyncExternalStore(g.useCallback(m=>u?o.subscribe(ne.batchCalls(m)):tt,[o,u]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),g.useEffect(()=>{o.setQueries(c,s)},[c,s,o]);const x=p.some((m,N)=>fe(c[N],m))?p.flatMap((m,N)=>{const w=c[N];if(w){const h=new Oe(n,w);if(fe(w,m))return ge(w,h,i);st(m,r)&&ge(w,h,i)}return[]}):[];if(x.length>0)throw Promise.all(x);const j=p.find((m,N)=>{const w=c[N];return w&&at({result:m,errorResetBoundary:i,throwOnError:w.throwOnError,query:n.getQueryCache().get(w.queryHash),suspense:w.suspense})});if(j?.error)throw j.error;return f(l())}/**
2
- * @license lucide-react v0.507.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Ft=[["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"}]],It=Le("link-2",Ft);/**
7
- * @license lucide-react v0.507.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Yt=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],qt=Le("unlink",Yt),ee={list:["desktop","projects"],detail:t=>["desktop","projects",t]};function Bt(t){return Re({queryKey:ee.list,enabled:t,queryFn:()=>P({op:"projects.list"}).then(s=>s.projects),retry:le,staleTime:1e4})}function Qt(t,s){return Ut({queries:t.map(a=>({queryKey:ee.detail(a),enabled:s&&!!a,queryFn:()=>P({op:"projects.get",key:a}),retry:le,staleTime:1e4}))})}function Ae(t,s){return Re({queryKey:ee.detail(t??""),enabled:s&&!!t,queryFn:()=>P({op:"projects.get",key:t??""}),retry:le,staleTime:1e4})}function q(){const t=$e();return()=>{t.invalidateQueries({queryKey:ee.list})}}function zt(){const t=q();return Y({mutationFn:s=>P({op:"projects.create",name:s.name,...s.description!==void 0?{description:s.description}:{},...s.status!==void 0?{status:s.status}:{},...s.tags!==void 0?{tags:s.tags}:{}}),onSuccess:()=>t()})}function Ue(){const t=q();return Y({mutationFn:s=>P({op:"projects.update",key:s.key,fields:s.fields}),onSuccess:()=>t()})}function Fe(){const t=q();return Y({mutationFn:s=>P({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>t()})}function Kt(){const t=q();return Y({mutationFn:s=>P({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>t()})}function Vt(){const t=q();return Y({mutationFn:s=>P({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>t()})}function Wt(){const t=q();return Y({mutationFn:s=>P({op:"projects.milestone",key:s.key,name:s.name,...s.targetDate!==void 0?{targetDate:s.targetDate}:{},...s.completed!==void 0?{completed:s.completed}:{}}),onSuccess:()=>t()})}function Ht(){const t=q();return Y({mutationFn:s=>P({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>t()})}const Jt={active:{label:"Active",variant:"accent"},paused:{label:"Paused",variant:"neutral"},done:{label:"Done",variant:"success"},archived:{label:"Archived",variant:"outline"}};function V(t){return Jt[t]??{label:t||"Unknown",variant:"neutral"}}const Gt={completed:{label:"Completed",variant:"success"},overdue:{label:"Overdue",variant:"warning"},upcoming:{label:"Upcoming",variant:"neutral"}};function Xt(t){return Gt[t]??{label:String(t),variant:"neutral"}}const X="Stale",Zt=/^(\d{4})-(\d{2})-(\d{2})$/;function U(t,s,a=new Date){if(!t)return"";const n=Zt.exec(t);if(!n)return t;const r=new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));if(Number.isNaN(r.getTime()))return t;const i=r.toLocaleDateString(s,{month:"short",day:"numeric"});return r.getFullYear()===a.getFullYear()?i:`${i}, ${r.getFullYear()}`}function ue(t,s){if(t==null)return"";const a=Math.max(0,Math.floor(s/1e3-t));return a<60?"just now":a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:`${Math.floor(a/86400)}d`}function me(t){return t==="just now"?"just now":`${t} ago`}function es(t){return t?`reported ${me(t)}`:"no progress"}const Ie=/^$|^\d{4}-\d{2}-\d{2}$/;function ts(t){return t?t==="operator"?"the operator":`session ${t}`:""}function ss(t,s){if(!t.progress)return"not reported yet";const a=ue(t.progress_updated_at,s),n=ts(t.progress_reported_by),r=[a?`reported ${me(a)}`:"reported"];return n&&r.push(`by ${n}`),r.join(" ")}function Ye(t,s){if(t==null)return"";const a=String(t);return s==="points"?`${a} pt`:s==="days"?`${a}d`:a}function qe(t,s){return s<=0?"":`${t}/${s}`}function he(t){return t<=0?"":`${t} live`}function as(t){return t<=0?"":t===1?"1 session":`${t} sessions`}function ns(t){const s=as(t.sessions);if(!s)return"";const a=he(t.live_sessions);return a?`${s} · ${a}`:s}function rs(t){if(!t.exists)return{label:"Missing",variant:"outline"};if(t.archived)return{label:"Archived",variant:"neutral"};switch(t.runtime?.state){case"live":return{label:"Live",variant:"success"};case"wedged":return{label:"Wedged",variant:"warning"};case"stale":return{label:"Stale",variant:"warning"};case"stopped":return{label:"Stopped",variant:"neutral"};default:return{label:String(t.runtime?.state??"Unknown"),variant:"neutral"}}}function is(t){return t?t.running>0?t.running===1?"1 subagent running":`${t.running} subagents running`:t.settled===1?"1 subagent":`${t.settled} subagents`:""}function os(t){return t?t.total===1?"1 todo":`${t.total} todos`:""}function Be(t,s){const a=[],n=U(t.completed_at??t.target_date,s);n&&a.push({key:t.completed_at?"completed":"target",text:t.completed_at?`completed ${n}`:`due ${n}`});const r=Ye(t.estimate,t.estimate_unit);r&&a.push({key:"estimate",text:r});const i=qe(t.milestones_completed,t.milestones_total);i&&a.push({key:"milestones",text:`milestones ${i}`});const c=he(t.live_sessions);return c&&a.push({key:"live",text:c}),a}const z=864e5,ls=/^(\d{4})-(\d{2})-(\d{2})$/;function I(t){if(!t)return null;const s=ls.exec(t);if(!s)return null;const a=Number(s[1]),n=Number(s[2]),r=Number(s[3]),i=Date.UTC(a,n-1,r),c=new Date(i);return c.getUTCFullYear()!==a||c.getUTCMonth()!==n-1||c.getUTCDate()!==r?null:i}const ie=["active","paused","done"],J="archived";function cs(t){const s=new Map;for(const r of t){const i=s.get(r.status)??[];i.push(r),s.set(r.status,i)}const a=ie.map(r=>({status:r,projects:s.get(r)??[]})),n=s.get(J)??[];n.length>0&&a.push({status:J,projects:n});for(const[r,i]of s)r!==J&&!ie.includes(r)&&a.push({status:r,projects:i});return a}function ds(t,s){if(t.status==="done"||t.status==="archived"||t.completed_at)return!1;const a=I(t.target_date);return a===null?!1:a<s}const L=["day","week","month","quarter"],xe={day:24,week:9,month:3,quarter:1};function Qe(t){const s=new Date(t);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function F(t,s){return Math.round((s-t)/z)}function De(t,s){return F(t,s)+1}function us(t,s){for(const a of L)if(t*xe[a]<=s)return a;return L[L.length-1]}function ms(t){const{project:s}=t;return s.start_date||s.target_date||s.completed_at?!0:t.milestones.some(a=>!!a.target_date)}function hs(t,s){const a=[s];for(const n of t){for(const r of[n.project.start_date,n.project.target_date,n.project.completed_at]){const i=I(r);i!==null&&a.push(i)}for(const r of n.milestones){const i=I(r.target_date);i!==null&&a.push(i)}}return a.length===1?null:{startMs:Math.min(...a),endMs:Math.max(...a)}}function xs(t){const s=[],a=[];for(const n of t)(ms(n)?s:a).push(n);return{dated:s,undated:a}}function ps(t){const{project:s}=t,a=I(s.start_date),n=I(s.target_date),r=I(s.completed_at),i=s.status==="done"&&r!==null?r:n,c=a??i,o=i??a;return c===null||o===null?null:{fromMs:Math.min(c,o),toMs:Math.max(c,o)}}function fs(t){const s=[];for(const a of t.milestones){const n=I(a.target_date);n!==null&&s.push({name:a.name,dayMs:n,status:a.status})}return s}const H=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(t){const s=new Date(t);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function gs(t){const{year:s,month:a}=M(t);return Date.UTC(s,a-1,1)}function js(t){const{year:s,month:a}=M(t);return a===12?Date.UTC(s+1,0,1):Date.UTC(s,a,1)}function bs(t){const{year:s,month:a}=M(t);return Date.UTC(s,Math.floor((a-1)/3)*3,1)}function vs(t){const{year:s,month:a}=M(t),n=Math.floor((a-1)/3);return n===3?Date.UTC(s+1,0,1):Date.UTC(s,n*3+3,1)}function ys(t){const{weekday:s}=M(t);return t-(s+6)%7*z}const ks=26;function Ns(t,s,a){const n=[],r=(l,u,d)=>{l<t||l>s||n.push({dayMs:l,label:u,major:d})};if(a==="day"){let l=!1;for(let u=t;u<=s;u+=z){const{day:d,month:x}=M(u);d===1?(r(u,H[x-1],!0),l=!0):l?(r(u,"",!1),l=!1):r(u,String(d),!1)}return n}if(a==="week"){for(let l=ys(t);l<=s;l+=7*z){if(l<t)continue;const{day:u,month:d}=M(l);M(l-7*z).month!==d?r(l,`${H[d-1]} ${u}`,!0):r(l,String(u),!1)}return n}const i=a==="month"?gs:bs,c=a==="month"?js:vs,o=l=>{const{year:u,month:d}=M(l);if(a==="month")return d===1&&u!==M(t).year?`${H[0]} '${String(u%100).padStart(2,"0")}`:H[d-1];const x=Math.floor((d-1)/3)+1;return x===1&&u!==M(t).year?`Q1 '${String(u%100).padStart(2,"0")}`:`Q${x}`};r(t,o(i(t)),!0);const p=Math.ceil(ks/xe[a]);let f=t;for(let l=c(i(t));l<=s;l=c(l))F(f,l)<p||(r(l,o(l),!0),f=l);return n}const Te={active:"In flight",paused:"On hold",done:"Finished"};function ws(){const[t,s]=g.useState(null);return g.useEffect(()=>{if(!t)return;const a=document.querySelector(`[data-project-menu="${t}"]`);a&&(a.focus(),s(null))}),g.useCallback(a=>s(a),[])}const Ss=({projects:t,nowMs:s,onOpen:a,onEdit:n,onDelete:r,onMove:i,movingKeys:c=[]})=>{const o=cs(t),p=new Set(c);return e.jsx("div",{className:"@container flex min-h-0 flex-1 flex-col overflow-hidden rounded-md bg-surface","data-testid":"project-board",children:e.jsx("div",{className:"flex min-h-0 flex-1 items-stretch gap-3 overflow-x-auto p-3",children:o.map(f=>{const l=V(f.status);return e.jsxs("section",{"data-board-column":f.status,className:"flex w-64 shrink-0 flex-col overflow-hidden rounded-md bg-sunken",children:[e.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-2 border-b border-hairline px-3 py-2",children:[e.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"truncate text-body-sm font-medium text-ink",children:l.label}),Te[f.status]&&e.jsx("span",{className:"truncate text-meta text-ink-muted",children:Te[f.status]})]}),e.jsx("span",{className:"text-meta text-ink-muted",children:f.projects.length})]}),f.projects.length===0?e.jsx("p",{className:"px-3 py-4 text-meta text-ink-muted",children:"No projects here."}):e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-2",children:f.projects.map(u=>e.jsx("li",{children:e.jsx(Cs,{project:u,nowMs:s,busy:p.has(u.id),onOpen:()=>a(u),onEdit:()=>n(u),onDelete:()=>r(u),onMove:d=>i(u,d)})},u.id))})]},f.status)})})})},Cs=({project:t,nowMs:s,busy:a,onOpen:n,onEdit:r,onDelete:i,onMove:c})=>{const o=Be(t,typeof navigator>"u"?void 0:navigator.language),p=ds(t,Qe(s)),f=ue(t.progress_updated_at,s);return e.jsxs("div",{"data-project-name":t.name,className:D("group/card flex flex-col gap-2 rounded-sm bg-surface p-3",p&&"border border-warning-border"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("button",{type:"button",onClick:n,className:"-mx-1 min-w-0 flex-1 rounded-sm px-1 text-left hover:bg-elevated",children:[e.jsx("span",{className:"block truncate text-body-sm font-medium text-ink",children:t.name}),t.description&&e.jsx("span",{className:"mt-0.5 block truncate text-meta text-ink-muted",children:t.description})]}),e.jsxs(ft,{children:[e.jsx(gt,{"data-project-menu":t.id,"aria-label":`Actions for ${t.name}`,disabled:a,className:D("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-elevated hover:text-ink"),children:e.jsx(nt,{className:"size-4"})}),e.jsxs(jt,{align:"end",children:[e.jsx(se,{onSelect:n,children:"Open"}),e.jsxs(bt,{children:[e.jsx(vt,{children:"Set status"}),e.jsx(yt,{children:e.jsx(kt,{value:t.status,onValueChange:c,children:[...ie,J].map(l=>e.jsx(Nt,{value:l,children:V(l).label},l))})})]}),e.jsx(wt,{}),e.jsx(se,{onSelect:r,children:"Edit"}),e.jsx(se,{onSelect:i,children:"Delete"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[o.filter(l=>l.key!=="live").map(l=>e.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:l.text},l.key)),p&&e.jsx(A,{variant:"warning",children:"Overdue"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-meta text-ink-muted",children:es(f)}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(t.progress_stale||!f)&&e.jsx("span",{"aria-label":X,title:X,className:"size-1.5 rounded-full bg-warning"}),t.sessions>0&&e.jsx(Ds,{project:t})]})]})]})},Ds=({project:t})=>{const[s,a]=g.useState(!1),n=Z(),r=Ae(t.id,s),i=r.data?.links??[],c=ns(t);return e.jsxs(St,{open:s,onOpenChange:a,children:[e.jsx(Ct,{"data-project-sessions":t.id,"aria-label":`Sessions linked to ${t.name}`,className:D("rounded-sm px-1 text-meta whitespace-nowrap",t.live_sessions>0?"text-success hover:bg-elevated":"text-ink-muted hover:bg-elevated"),children:c}),e.jsx(Dt,{align:"end",className:"w-64 p-2 outline-none",children:r.isLoading?e.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:"Loading linked sessions…"}):r.isError?e.jsxs("div",{className:"flex flex-col items-start gap-1.5 px-1 py-2",children:[e.jsx("p",{className:"text-meta text-ink-muted",children:r.error instanceof Error&&r.error.message?r.error.message:"The linked sessions could not be read."}),e.jsx(T,{variant:"secondary",size:"sm",onClick:()=>void r.refetch(),children:"Try again"})]}):i.length===0?e.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:"No sessions linked yet."}):e.jsx("ul",{className:"flex flex-col",children:i.map(o=>e.jsx("li",{children:e.jsx("button",{type:"button",disabled:!o.exists,onClick:()=>{o.exists&&(a(!1),rt(n,o.session_id))},className:D("flex w-full items-center gap-2 rounded-sm px-1 py-1.5 text-left text-meta",o.exists?"text-ink hover:bg-elevated":"text-ink-disabled"),children:e.jsx("span",{className:"truncate",children:o.title||o.session_id})})},o.session_id))})})]})},ze=({open:t,projectName:s,onClose:a,onConfirm:n})=>{const[r,i]=g.useState(""),[c,o]=g.useState(null),[p,f]=g.useState(!1),l=g.useId();g.useEffect(()=>{t&&(i(""),o(null),f(!1))},[t]);const u=r.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,d=async()=>{f(!0),o(null);try{await n(r.trim()),a()}catch(x){o(x instanceof Error&&x.message?x.message:"The project was not deleted.")}finally{f(!1)}};return e.jsx(ce,{open:t,onClose:a,title:"Delete this project?",dataTourTag:"project-delete-dialog",actions:e.jsxs(e.Fragment,{children:[e.jsx(de,{onClick:a,disabled:p,children:"Cancel"}),e.jsxs(it,{onClick:()=>void d(),disabled:!u||p,children:[p&&e.jsx(K,{size:"xs"}),"Delete project"]})]}),children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("p",{className:"text-body-sm text-ink",children:"This deletes the project and its milestones. The sessions linked to it are not touched."}),e.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Type"," ",e.jsx("span",{className:"font-mono text-mono-sm text-ink",children:s})," ","to confirm."]}),e.jsx(R,{id:`${l}-confirm`,value:r,onChange:x=>i(x.target.value),placeholder:s,"aria-label":"Type the project name to confirm","aria-invalid":r.length>0&&!u,autoFocus:!0}),c&&e.jsx("p",{className:"text-body-sm text-danger",children:c})]})})},Ts=[{value:"active",label:"Active"},{value:"paused",label:"Paused"},{value:"done",label:"Done"},{value:"archived",label:"Archived"}],Ke={name:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},_e=Ie;function Me(t){return t.split(",").map(s=>s.trim()).filter(s=>s.length>0)}function _s(t){return t?{name:t.name,description:t.description,status:t.status,tags:t.tags.join(", "),startDate:t.start_date??"",targetDate:t.target_date??"",estimate:t.estimate===null||t.estimate===void 0?"":String(t.estimate),estimateUnit:t.estimate_unit||"points"}:Ke}const oe=({open:t,mode:s,initial:a,onClose:n,onSubmit:r})=>{const[i,c]=g.useState(Ke),[o,p]=g.useState({}),[f,l]=g.useState(null),[u,d]=g.useState(!1),x=g.useId();g.useEffect(()=>{t&&(c(_s(a)),p({}),l(null),d(!1))},[t]);const j=(h,y)=>{c(v=>({...v,[h]:y}))},m=h=>{const y={},v=lt(h.name.trim());v&&(y.name=v),h.description.length>te&&(y.description=`Keep the description within ${te} characters.`);const _=Me(h.tags);if(_.length>8)y.tags="At most 8 tags.";else for(const C of _){const k=ct(C);if(k){y.tags=k;break}}if(s==="edit"&&(_e.test(h.startDate)||(y.startDate="Dates are YYYY-MM-DD, or empty."),_e.test(h.targetDate)||(y.targetDate="Dates are YYYY-MM-DD, or empty."),!y.startDate&&!y.targetDate&&h.startDate&&h.targetDate&&h.targetDate<h.startDate&&(y.targetDate="The target date is before the start date."),h.estimate)){const C=Number(h.estimate);(!Number.isFinite(C)||!(C>0)||C>1e3)&&(y.estimate="Estimates are greater than 0 and at most 1000.")}return y},N=async()=>{const h=m(i);if(p(h),Object.keys(h).length>0)return;d(!0),l(null);const y=Me(i.tags);try{s==="create"?await r({mode:"create",fields:{name:i.name.trim(),...i.description.trim()?{description:i.description.trim()}:{},status:i.status,...y.length>0?{tags:y}:{}}}):await r({mode:"edit",key:a?.key??"",fields:{name:i.name.trim(),description:i.description.trim(),status:i.status,tags:y,start_date:i.startDate,target_date:i.targetDate,...i.estimate?{estimate:Number(i.estimate)}:{},estimate_unit:i.estimateUnit}}),n()}catch(v){l(v instanceof Error&&v.message?v.message:"The project was not saved.")}finally{d(!1)}},w=s==="create"?"New project":"Edit project";return e.jsx(ce,{open:t,onClose:n,title:w,maxWidth:"sm",dataTourTag:s==="create"?"project-create-dialog":"project-edit-dialog",actions:e.jsxs(e.Fragment,{children:[e.jsx(de,{onClick:n,disabled:u,children:"Cancel"}),e.jsxs(ot,{onClick:()=>void N(),disabled:u,children:[u&&e.jsx(K,{size:"xs"}),s==="create"?"Create project":"Save changes"]})]}),children:e.jsxs("form",{className:"flex flex-col gap-4 px-1 py-1",onSubmit:h=>{h.preventDefault(),N()},children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(E,{htmlFor:`${x}-name`,children:"Name"}),e.jsx(R,{id:`${x}-name`,value:i.name,onChange:h=>j("name",h.target.value),placeholder:"payments-migration",autoFocus:!0,"aria-invalid":!!o.name}),o.name?e.jsx("p",{className:"text-meta text-danger",children:o.name}):e.jsx("p",{className:"text-meta text-ink-muted",children:"Letters, digits, dot, underscore or dash; no spaces."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(E,{htmlFor:`${x}-description`,children:"Description"}),e.jsx(Tt,{id:`${x}-description`,value:i.description,onChange:h=>j("description",h.target.value),rows:2,"aria-invalid":!!o.description}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.description?e.jsx("p",{className:"text-meta text-danger",children:o.description}):e.jsx("span",{}),e.jsxs("p",{className:"text-meta text-ink-muted tabular-nums",children:[i.description.length,"/",te]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(E,{children:"Status"}),e.jsxs(ke,{value:i.status,onValueChange:h=>j("status",h),children:[e.jsx(Ne,{"aria-label":"Status",children:e.jsx(we,{})}),e.jsx(Se,{children:Ts.map(h=>e.jsx(ae,{value:h.value,children:h.label},h.value))})]}),i.status==="done"&&e.jsx("p",{className:"text-meta text-ink-muted",children:"Moving a project to Done stamps today as its completion date."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(E,{htmlFor:`${x}-tags`,children:"Tags"}),e.jsx(R,{id:`${x}-tags`,value:i.tags,onChange:h=>j("tags",h.target.value),placeholder:"q4, payments","aria-invalid":!!o.tags}),o.tags?e.jsx("p",{className:"text-meta text-danger",children:o.tags}):e.jsx("p",{className:"text-meta text-ink-muted",children:"Comma-separated, up to 8. Lowercase letters, digits, underscore or dash."})]}),s==="edit"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(E,{htmlFor:`${x}-start`,children:"Start date"}),e.jsx(R,{id:`${x}-start`,value:i.startDate,onChange:h=>j("startDate",h.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!o.startDate}),o.startDate&&e.jsx("p",{className:"text-meta text-danger",children:o.startDate})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(E,{htmlFor:`${x}-target`,children:"Target date"}),e.jsx(R,{id:`${x}-target`,value:i.targetDate,onChange:h=>j("targetDate",h.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!o.targetDate}),o.targetDate&&e.jsx("p",{className:"text-meta text-danger",children:o.targetDate})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(E,{htmlFor:`${x}-estimate`,children:"Estimate"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(R,{id:`${x}-estimate`,value:i.estimate,onChange:h=>j("estimate",h.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!o.estimate,className:"max-w-28"}),e.jsxs(ke,{value:i.estimateUnit,onValueChange:h=>j("estimateUnit",h),children:[e.jsx(Ne,{"aria-label":"Estimate unit",className:"max-w-32",children:e.jsx(we,{})}),e.jsxs(Se,{children:[e.jsx(ae,{value:"points",children:"Points"}),e.jsx(ae,{value:"days",children:"Days"})]})]})]}),o.estimate&&e.jsx("p",{className:"text-meta text-danger",children:o.estimate}),s==="edit"&&i.estimate.trim()===""&&a?.estimate!==null&&a?.estimate!==void 0&&e.jsx("p",{className:"text-meta text-ink-muted",children:"Clearing an estimate is not supported yet — saving keeps its current value."})]})]}),f&&e.jsx("p",{className:"text-body-sm text-danger",children:f})]})})},Ms=({links:t,busy:s,onUnlink:a,onLink:n})=>{const r=Z(),i=je(l=>l.sessions),[c,o]=g.useState(!1),p=g.useMemo(()=>{const l=new Set(t.map(u=>u.session_id));return i.filter(u=>!l.has(u.session_id)).map(u=>({id:u.session_id,name:u.title||u.session_id,description:u.cwd??void 0}))},[i,t]),f=l=>{je.getState().openSession(l).then(u=>{u&&r(`/chat/${l}`)})};return e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h2",{className:"text-title text-ink",children:"Linked sessions"}),e.jsxs(T,{variant:"secondary",size:"sm",disabled:s,onClick:()=>o(!0),"data-tour-tag":"project-link-session",children:[e.jsx(It,{}),"Link session"]})]}),t.length===0?e.jsx("p",{className:"text-body-sm text-ink-muted",children:"No sessions linked yet. Link the conversations that are working on this project so its progress stays with them."}):e.jsx("ul",{className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:t.map(l=>{const u=rs(l),d=is(l.subagents),x=os(l.todos),j=l.title||l.session_id,m=l.exists;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2",children:[e.jsx("button",{type:"button",disabled:!m,onClick:()=>{m&&f(l.session_id)},className:D("flex min-w-0 flex-1 items-center gap-2 text-left",m?"cursor-pointer":"cursor-default opacity-100"),children:e.jsx("span",{className:D("min-w-0 truncate text-body-sm",l.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:j})}),l.runtime?.busy===!0&&e.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:"busy"}),d&&e.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:d}),x&&e.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:x}),e.jsx(A,{variant:u.variant,children:u.label}),e.jsx(T,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Unlink ${j}`,onClick:()=>a(l.session_id),children:e.jsx(qt,{})})]},l.session_id)})}),e.jsx(ce,{open:c,onClose:()=>o(!1),title:"Link a session",maxWidth:"sm",dataTourTag:"project-link-dialog",actions:e.jsx(de,{onClick:()=>o(!1),children:"Close"}),children:e.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[e.jsx(E,{children:"Session"}),e.jsx(_t,{showLabel:!1,ariaLabel:"Search sessions",busyLabel:"Loading sessions",placeholder:"Search conversations",options:p,selected:null,onSelect:l=>{o(!1),n(l.id)}}),e.jsx("p",{className:"text-meta text-ink-muted",children:"Conversations already linked to this project are not listed."})]})})]})},Es=({milestones:t,busy:s,onToggle:a,onRemove:n,onAdd:r})=>{const[i,c]=g.useState(""),[o,p]=g.useState(""),f=!Ie.test(o.trim()),l=i.trim().length>0&&!f&&!s,u=()=>{l&&(r(i.trim(),o.trim()),c(""),p(""))};return e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx("h2",{className:"text-title text-ink",children:"Milestones"}),t.length===0?e.jsx("p",{className:"text-body-sm text-ink-muted",children:"No milestones yet. Add one below to mark the dates this project is planned around."}):e.jsx("ul",{className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:t.map(d=>{const x=Xt(d.status),j=d.completed_at!==null;return e.jsxs("li",{className:"flex items-center gap-3 px-3 py-2",children:[e.jsx(Mt,{checked:j,disabled:s,onCheckedChange:m=>a(d.name,m===!0),"aria-label":j?`Mark ${d.name} not complete`:`Mark ${d.name} complete`}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:d.name}),d.target_date&&e.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:U(d.target_date,typeof navigator>"u"?void 0:navigator.language)}),e.jsx(A,{variant:x.variant,children:x.label}),e.jsx(T,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":`Remove ${d.name}`,onClick:()=>n(d.name),children:e.jsx(Et,{})})]},d.name)})}),e.jsxs("div",{className:"flex items-end gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[e.jsx(E,{htmlFor:"project-milestone-name",children:"New milestone"}),e.jsx(R,{id:"project-milestone-name",value:i,onChange:d=>c(d.target.value),placeholder:"beta cut",onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),u())}})]}),e.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[e.jsx(E,{htmlFor:"project-milestone-date",children:"Target date"}),e.jsx(R,{id:"project-milestone-date",value:o,onChange:d=>p(d.target.value),placeholder:"YYYY-MM-DD","aria-invalid":f}),f&&e.jsx("p",{className:"text-meta text-danger",children:"Dates are YYYY-MM-DD, or empty."})]}),e.jsxs(T,{variant:"secondary",disabled:!l,onClick:u,"data-tour-tag":"project-milestone-add",children:[e.jsx(G,{}),"Add"]})]})]})},Ps=({projectKey:t,nowMs:s})=>{const a=Z(),n=Ae(t,!0),r=Ue(),i=Fe(),c=Wt(),o=Ht(),p=Kt(),f=Vt(),[l,u]=g.useState(!1),[d,x]=g.useState(!1),j=r.isPending||i.isPending||c.isPending||o.isPending||p.isPending||f.isPending;if(n.isLoading)return e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(K,{label:"Loading project"})});if(n.isError||!n.data)return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(re,{variant:"danger",children:n.error instanceof Error&&n.error.message?n.error.message:"The project could not be read."}),e.jsxs(T,{variant:"secondary",onClick:()=>void a("/projects"),children:[e.jsx(be,{}),"All projects"]})]});const{project:m,links:N}=n.data,w=V(m.status),h=Ye(m.estimate,m.estimate_unit),y=[],v=U(m.start_date,typeof navigator>"u"?void 0:navigator.language),_=U(m.target_date,typeof navigator>"u"?void 0:navigator.language),C=U(m.completed_at,typeof navigator>"u"?void 0:navigator.language);return v&&y.push({label:"Start",value:v}),_&&y.push({label:"Target",value:_}),C&&y.push({label:"Completed",value:C}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("button",{type:"button",onClick:()=>void a("/projects"),className:"flex w-fit items-center gap-1.5 text-body-sm text-ink-muted hover:text-ink",children:[e.jsx(be,{className:"size-4"}),"All projects"]}),e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h1",{className:"min-w-0 truncate text-display text-ink",children:m.name}),e.jsx(A,{variant:w.variant,children:w.label}),m.progress_stale&&e.jsx(A,{variant:"warning",children:X})]}),m.description&&e.jsx("p",{className:"max-w-200 text-body text-ink-muted",children:m.description}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-body-sm text-ink-muted",children:[y.map(k=>e.jsxs("span",{children:[k.label," ",k.value]},k.label)),h&&e.jsx("span",{children:h}),m.tags.length>0&&e.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:m.tags.map(k=>e.jsx(A,{variant:"outline",children:k},k))})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(T,{variant:"secondary",onClick:()=>u(!0),"data-tour-tag":"project-edit",children:[e.jsx(dt,{}),"Edit"]}),e.jsxs(T,{variant:"secondary",onClick:()=>x(!0),"data-tour-tag":"project-delete",children:[e.jsx(ut,{}),"Delete"]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx("h2",{className:"text-title text-ink",children:"Progress"}),e.jsx("p",{className:"max-w-200 whitespace-pre-wrap text-body-sm text-ink",children:m.progress||"No progress has been reported yet."}),e.jsx("p",{className:"text-meta text-ink-muted",children:ss(m,s)})]}),e.jsx(Es,{milestones:m.milestones,busy:j,onToggle:(k,S)=>{c.mutateAsync({key:m.id,name:k,completed:S}).catch(O=>{Q(O instanceof Error&&O.message?O.message:"The milestone was not updated.")})},onRemove:k=>{o.mutateAsync({key:m.id,name:k}).catch(S=>{Q(S instanceof Error&&S.message?S.message:"The milestone was not removed.")})},onAdd:(k,S)=>{c.mutateAsync({key:m.id,name:k,targetDate:S}).catch(O=>{Q(O instanceof Error&&O.message?O.message:"The milestone was not added.")})}}),e.jsx(Ms,{projectKey:m.id,links:N,busy:j,onLink:k=>{p.mutateAsync({key:m.id,sessionId:k}).catch(S=>{Q(S instanceof Error&&S.message?S.message:"The session was not linked.")})},onUnlink:k=>{f.mutateAsync({key:m.id,sessionId:k}).catch(S=>{Q(S instanceof Error&&S.message?S.message:"The session was not unlinked.")})}}),e.jsx(oe,{open:l,mode:"edit",initial:{key:m.id,name:m.name,description:m.description,status:m.status,tags:m.tags,start_date:m.start_date,target_date:m.target_date,estimate:m.estimate,estimate_unit:m.estimate_unit},onClose:()=>u(!1),onSubmit:async k=>{k.mode==="edit"&&(await r.mutateAsync({key:k.key,fields:k.fields}),B("Project saved"))}}),e.jsx(ze,{open:d,projectName:m.name,onClose:()=>x(!1),onConfirm:async k=>{await i.mutateAsync({key:m.id,confirmedName:k}),B("Project deleted"),a("/projects")}})]})},$=[{key:"name",label:"Project",className:"min-w-0 flex-1"},{key:"status",label:"Status",className:"w-20 shrink-0"},{key:"target",label:"Target",className:"hidden w-32 shrink-0 @[40rem]:block"},{key:"estimate",label:"Estimate",className:"hidden w-16 shrink-0 @[40rem]:block"},{key:"milestones",label:"Milestones",className:"hidden w-20 shrink-0 @[34rem]:block"},{key:"live",label:"Live",className:"hidden w-14 shrink-0 @[34rem]:block"},{key:"progress",label:"Progress",className:"w-40 shrink-0"}];function Os(t,s){const a=ue(t.progress_updated_at,s);return a?me(a):"not reported"}const $s=({projects:t,nowMs:s,onOpen:a})=>e.jsxs("div",{className:"@container flex min-h-0 flex-1 flex-col overflow-hidden rounded-md bg-surface","data-testid":"project-list",children:[e.jsx("div",{className:"flex shrink-0 items-center gap-3 border-b border-hairline px-3 py-2 text-meta text-ink-muted","aria-hidden":"true",children:$.map(n=>e.jsx("span",{className:n.className,children:n.label},n.key))}),e.jsx("ul",{className:"min-h-0 flex-1 divide-y divide-hairline overflow-y-auto",children:t.map(n=>{const r=V(n.status),i=new Map(Be(n,typeof navigator>"u"?void 0:navigator.language).map(p=>[p.key,p.text])),c=qe(n.milestones_completed,n.milestones_total),o=he(n.live_sessions);return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>a(n),"data-project-name":n.name,className:D("flex w-full items-center gap-3 px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","hover:bg-elevated"),children:[e.jsx("span",{className:D($[0].className,"truncate text-body-sm text-ink"),children:n.name}),e.jsx("span",{className:$[1].className,children:e.jsx(A,{variant:r.variant,children:r.label})}),e.jsx("span",{className:D($[2].className,"truncate text-meta text-ink-muted"),children:i.get("target")??i.get("completed")??""}),e.jsx("span",{className:D($[3].className,"truncate text-meta text-ink-muted"),children:i.get("estimate")??""}),e.jsx("span",{className:D($[4].className,"truncate text-meta text-ink-muted"),children:c}),e.jsx("span",{className:D($[5].className,"truncate text-meta text-ink-muted"),children:o}),e.jsxs("span",{className:D($[6].className,"flex items-center gap-2"),children:[e.jsx("span",{className:"truncate text-meta text-ink-muted",children:Os(n,s)}),n.progress_stale&&e.jsx(A,{variant:"warning",children:X})]})]})},n.id)})})]}),pe=224,Ee=36,Rs={day:"Days",week:"Weeks",month:"Months",quarter:"Quarters"},Ls=({items:t,nowMs:s,onOpen:a,pendingDetails:n,failedDetails:r,onRetryDetails:i})=>{const[c,o]=g.useState(null),[p,f]=g.useState(0),l=g.useRef(null),u=Qe(s),d=g.useMemo(()=>hs(t,u),[t,u]),x=g.useMemo(()=>xs(t),[t]);g.useLayoutEffect(()=>{const v=l.current;if(!v)return;const _=()=>f(v.clientWidth);if(_(),typeof ResizeObserver>"u")return;const C=new ResizeObserver(_);return C.observe(v),()=>C.disconnect()},[]);const j=Math.max(p-pe-24,160),m=d?us(De(d.startMs,d.endMs),j):"month",N=c??m,w=v=>{const _=L.indexOf(N),C=L[_-v];C&&o(C)},h=xe[N],y=d?De(d.startMs,d.endMs)*h:0;return e.jsxs("div",{ref:l,className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-md bg-surface","data-testid":"project-timeline",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-hairline px-3 py-2",children:[e.jsx("span",{className:"truncate text-meta text-ink-muted","data-timeline-note":!0,children:r>0?`Milestones could not be read for ${r} project${r===1?"":"s"}.`:n>0?`Loading milestones for ${n} project${n===1?"":"s"}…`:`${x.dated.length} dated · ${x.undated.length} without dates`}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[r>0&&e.jsx(T,{variant:"secondary",size:"sm",onClick:i,children:"Try again"}),e.jsx(T,{variant:"secondary",size:"icon","aria-label":"Zoom in",title:"Zoom in (finer)",disabled:!d||N===L[0],onClick:()=>w(1),children:e.jsx(G,{})}),e.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:Rs[N]}),e.jsx(T,{variant:"secondary",size:"icon","aria-label":"Zoom out",title:"Zoom out (coarser)",disabled:!d||N===L[L.length-1],onClick:()=>w(-1),children:e.jsx(Pt,{})})]})]}),d&&x.dated.length>0?e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:e.jsxs("div",{className:"min-w-max",children:[e.jsx(As,{startMs:d.startMs,endMs:d.endMs,tier:N,pxPerDay:h,trackPx:y}),x.dated.map(v=>e.jsx(Us,{item:v,spanStart:d.startMs,pxPerDay:h,trackPx:y,today:u,onOpen:()=>a(v)},v.project.id))]})}):e.jsx("p",{className:"px-3 py-6 text-body-sm text-ink-muted",children:"No dates on any project yet. Set a start date, a target date or a milestone date and it will appear on the timeline."}),x.undated.length>0&&e.jsxs("div",{className:"shrink-0 border-t border-hairline px-3 py-2 text-meta text-ink-muted",children:["No dates (",x.undated.length,"):"," ",x.undated.map((v,_)=>e.jsxs("span",{children:[_>0&&", ",e.jsx("button",{type:"button",className:"text-ink hover:underline",onClick:()=>a(v),children:v.project.name})]},v.project.id))]})]})},As=({startMs:t,endMs:s,tier:a,pxPerDay:n,trackPx:r})=>{const i=Ns(t,s,a);return e.jsxs("div",{className:"flex items-stretch border-b border-hairline",children:[e.jsx("span",{className:"sticky left-0 z-10 shrink-0 bg-surface",style:{width:pe}}),e.jsx("span",{className:"relative block h-6",style:{width:r},children:i.map(c=>e.jsxs("span",{className:"absolute top-0 h-full",style:{left:F(t,c.dayMs)*n},children:[e.jsx("span",{className:D("absolute top-0 h-full w-px",c.major?"bg-hairline":"bg-hairline/60"),"aria-hidden":"true"}),e.jsx("span",{className:"absolute top-1/2 left-1 -translate-y-1/2 whitespace-nowrap text-meta text-ink-muted",children:c.label})]},c.dayMs))})]})},Us=({item:t,spanStart:s,pxPerDay:a,trackPx:n,today:r,onOpen:i})=>{const{project:c}=t,o=ps(t),p=fs(t),f=l=>new Date(l).toISOString().slice(0,10);return e.jsxs("button",{type:"button",onClick:i,"data-project-name":c.name,className:"flex w-full items-stretch text-left transition-colors duration-fast ease-out-quart hover:bg-elevated",children:[e.jsx("span",{className:"sticky left-0 z-10 flex shrink-0 items-center gap-2 border-r border-hairline bg-surface px-3",style:{width:pe,height:Ee},children:e.jsx("span",{className:"truncate text-body-sm text-ink",children:c.name})}),e.jsxs("span",{className:"relative block",style:{width:n,height:Ee},children:[o&&e.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:F(s,o.fromMs)*a,width:(F(o.fromMs,o.toMs)+1)*a},title:`${U(f(o.fromMs))} → ${U(f(o.toMs))}`}),p.map(l=>e.jsx("span",{"data-milestone":l.status,className:D("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",l.status==="completed"&&"bg-success",l.status==="overdue"&&"bg-warning",l.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:F(s,l.dayMs)*a},title:`${l.name} · ${l.status} · ${U(f(l.dayMs))}`},`${l.name}-${l.dayMs}`)),e.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:F(s,r)*a},"aria-hidden":"true"})]})]})},Ve="projects-view",Fs=[{value:"list",label:"List"},{value:"board",label:"Board"},{value:"timeline",label:"Timeline"}];function Is(){try{const t=localStorage.getItem(Ve);if(t==="board"||t==="timeline"||t==="list")return t}catch{}return"list"}function Ys(t){try{localStorage.setItem(Ve,t)}catch{}}const qs=({value:t,onChange:s})=>e.jsx(Ot,{value:t,onValueChange:a=>s(a),children:e.jsx($t,{"aria-label":"Project view","data-tour-tag":"projects-view-switcher",children:Fs.map(a=>e.jsx(Rt,{value:a.value,children:a.label},a.value))})}),Pe={unpaired:"This app is not paired with the Local Operator server, so Projects are unavailable.","below-version":"The Local Operator server is older than this app expects, so Projects are unavailable. Update the server and try again.",unknown:"The server's capabilities could not be read, so Projects are unavailable."},Ws=({nowMs:t=Date.now()})=>{const{projectId:s}=mt(),a=Z(),n=ht(),r=xt(n.data,"projects",1),i=r==="enabled",c=Bt(i),o=zt(),p=Ue(),f=Fe(),[l,u]=g.useState(!1),[d,x]=g.useState(()=>Is()),[j,m]=g.useState(null),[N,w]=g.useState(null),h=ws(),y=c.data??[],v=Qt(d==="timeline"?y.map(b=>b.id):[],i),_=y.map((b,W)=>({project:b,milestones:v[W]?.data?.project.milestones??[]})),C=d==="timeline"?v.filter(b=>b.isLoading).length:0,k=d==="timeline"?v.filter(b=>b.isError).length:0,S=()=>{for(const b of v)b.isError&&b.refetch()},O=(b,W)=>{p.mutate({key:b.id,fields:{status:W}},{onSuccess:()=>{B(`Moved to ${V(W).label}`),c.refetch().then(()=>h(b.id))}})};return i?s?e.jsx("div",{className:"flex h-full min-h-0 flex-col gap-8 p-6",children:e.jsx(Ps,{projectKey:s,nowMs:t})}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-8 p-6",children:[e.jsx(ye,{title:"Projects",icon:ve,subtitle:"Workstreams you and your agents track across sessions.",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{variant:"secondary",size:"icon","aria-label":"Refresh projects",title:"Refresh projects",disabled:c.isFetching,onClick:()=>void c.refetch(),"data-tour-tag":"refresh-projects-button",children:e.jsx(pt,{})}),e.jsxs(T,{variant:"secondary",onClick:()=>u(!0),"data-tour-tag":"create-project-button",children:[e.jsx(G,{}),"New project"]})]})}),e.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3",children:e.jsx(qs,{value:d,onChange:b=>{x(b),Ys(b)}})}),c.isLoading&&e.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-md bg-surface",children:e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(K,{label:"Loading projects"})})}),c.isError&&e.jsxs("div",{className:"flex flex-col items-start gap-2",children:[e.jsx(re,{variant:"danger",children:c.error instanceof Error&&c.error.message?c.error.message:"The projects could not be read."}),e.jsx(T,{variant:"secondary",size:"sm",onClick:()=>void c.refetch(),children:"Try again"})]}),c.isSuccess&&c.data.length===0&&e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-4 overflow-hidden rounded-md bg-surface",children:[e.jsx("p",{className:"text-heading text-ink",children:"No projects yet."}),e.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:"Create one here, or ask an agent to create one and link this session."}),e.jsxs(T,{variant:"primary",onClick:()=>u(!0),"data-tour-tag":"create-project-empty-button",children:[e.jsx(G,{}),"New project"]})]}),c.isSuccess&&c.data.length>0&&d==="list"&&e.jsx($s,{projects:c.data,nowMs:t,onOpen:b=>void a(`/projects/${b.id}`)}),c.isSuccess&&c.data.length>0&&d==="board"&&e.jsx(Ss,{projects:y,nowMs:t,onOpen:b=>void a(`/projects/${b.id}`),onEdit:m,onDelete:w,onMove:O,movingKeys:p.isPending&&p.variables?[p.variables.key]:[]}),c.isSuccess&&c.data.length>0&&d==="timeline"&&e.jsx(Ls,{items:_,nowMs:t,onOpen:b=>void a(`/projects/${b.project.id}`),pendingDetails:C,failedDetails:k,onRetryDetails:S}),e.jsx(oe,{open:j!==null,mode:"edit",initial:j?{key:j.id,name:j.name,description:j.description,status:j.status,tags:j.tags,start_date:j.start_date,target_date:j.target_date,estimate:j.estimate,estimate_unit:j.estimate_unit}:null,onClose:()=>m(null),onSubmit:async b=>{b.mode==="edit"&&(await p.mutateAsync({key:b.key,fields:b.fields}),B("Project saved"),m(null))}}),e.jsx(ze,{open:N!==null,projectName:N?.name??"",onClose:()=>w(null),onConfirm:async b=>{N&&(await f.mutateAsync({key:N.id,confirmedName:b}),B("Project deleted"),w(null))}}),e.jsx(oe,{open:l,mode:"create",onClose:()=>u(!1),onSubmit:async b=>{b.mode==="create"&&(await o.mutateAsync(b.fields),B(`Project ${b.fields.name} created`))}})]}):e.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[e.jsx(ye,{title:"Projects",icon:ve}),n.isLoading?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(K,{label:"Checking the server's Projects support"})}):e.jsx(re,{variant:"warning",children:Pe[r]??Pe.unknown})]})};export{Ws as ProjectsPage};
@@ -1 +0,0 @@
1
- import{s as r,b as e,a,S as s}from"./chunk-AEK57VVT-BbTJ2nr6.js";import{_ as i}from"./mermaid.core-DjEcfQ2P.js";import"./chunk-RZ5BOZE2-B04F7M_0.js";import"./index-BGpQvlC-.js";import"./index-Biw7WGBF.js";import"./console-mirror-Cp8JlE_x.js";import"./error-boundary-BxKgKUoO.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram};