@aoagents/ao-web 0.5.0 → 0.6.0
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/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +137 -137
- package/.next/app-path-routes-manifest.json +8 -8
- package/.next/build-manifest.json +6 -6
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +31 -31
- package/.next/react-loadable-manifest.json +3 -3
- package/.next/required-server-files.json +3 -3
- package/.next/server/app/_not-found/page.js +2 -2
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +7 -7
- package/.next/server/app/api/backlog/route.js +1 -1
- package/.next/server/app/api/backlog/route.js.nft.json +1 -1
- package/.next/server/app/api/backlog/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/browse-directory/route.js +1 -1
- package/.next/server/app/api/browse-directory/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/filesystem/browse/route.js +1 -1
- package/.next/server/app/api/filesystem/browse/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/issues/route.js +1 -1
- package/.next/server/app/api/issues/route.js.nft.json +1 -1
- package/.next/server/app/api/issues/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/observability/route.js +1 -1
- package/.next/server/app/api/observability/route.js.nft.json +1 -1
- package/.next/server/app/api/observability/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/orchestrators/route.js +1 -1
- package/.next/server/app/api/orchestrators/route.js.nft.json +1 -1
- package/.next/server/app/api/orchestrators/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/route.js +1 -1
- package/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/reload/route.js +1 -1
- package/.next/server/app/api/projects/reload/route.js.nft.json +1 -1
- package/.next/server/app/api/projects/reload/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/route.js +1 -1
- package/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/prs/[id]/merge/route.js +1 -1
- package/.next/server/app/api/prs/[id]/merge/route.js.nft.json +1 -1
- package/.next/server/app/api/prs/[id]/merge/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/runtime/terminal/route.js +1 -1
- package/.next/server/app/api/runtime/terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/[id]/kill/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/kill/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/kill/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/[id]/message/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/message/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/message/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/[id]/remap/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/remap/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/remap/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/[id]/restore/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/restore/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/restore/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/[id]/send/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/send/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/send/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/patches/route.js +1 -1
- package/.next/server/app/api/sessions/patches/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/patches/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/setup-labels/route.js +1 -1
- package/.next/server/app/api/setup-labels/route.js.nft.json +1 -1
- package/.next/server/app/api/setup-labels/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/spawn/route.js +1 -1
- package/.next/server/app/api/spawn/route.js.nft.json +1 -1
- package/.next/server/app/api/spawn/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/verify/route.js +1 -1
- package/.next/server/app/api/verify/route.js.nft.json +1 -1
- package/.next/server/app/api/verify/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/webhooks/[...slug]/route.js +1 -1
- package/.next/server/app/api/webhooks/[...slug]/route.js.nft.json +1 -1
- package/.next/server/app/api/webhooks/[...slug]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/apple-icon/route.js +1 -1
- package/.next/server/app/apple-icon/route_client-reference-manifest.js +1 -1
- package/.next/server/app/dev/terminal-test/page.js +3 -3
- package/.next/server/app/dev/terminal-test/page.js.nft.json +1 -1
- package/.next/server/app/dev/terminal-test/page_client-reference-manifest.js +1 -1
- package/.next/server/app/dev/terminal-test.html +1 -1
- package/.next/server/app/dev/terminal-test.rsc +8 -8
- package/.next/server/app/icon/route.js +1 -1
- package/.next/server/app/icon/route_client-reference-manifest.js +1 -1
- package/.next/server/app/icon-192/route.js +1 -1
- package/.next/server/app/icon-192/route.js.nft.json +1 -1
- package/.next/server/app/icon-192/route_client-reference-manifest.js +1 -1
- package/.next/server/app/icon-512/route.js +1 -1
- package/.next/server/app/icon-512/route.js.nft.json +1 -1
- package/.next/server/app/icon-512/route_client-reference-manifest.js +1 -1
- package/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
- package/.next/server/app/orchestrators/page.js +2 -2
- package/.next/server/app/orchestrators/page.js.nft.json +1 -1
- package/.next/server/app/orchestrators/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/projects/[projectId]/page.js +2 -2
- package/.next/server/app/projects/[projectId]/page.js.nft.json +1 -1
- package/.next/server/app/projects/[projectId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/projects/[projectId]/sessions/[id]/page.js +2 -2
- package/.next/server/app/projects/[projectId]/sessions/[id]/page.js.nft.json +1 -1
- package/.next/server/app/projects/[projectId]/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/projects/[projectId]/settings/page.js +2 -2
- package/.next/server/app/projects/[projectId]/settings/page.js.nft.json +1 -1
- package/.next/server/app/projects/[projectId]/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/prs/page.js +2 -2
- package/.next/server/app/prs/page.js.nft.json +1 -1
- package/.next/server/app/prs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/sessions/[id]/page.js +2 -2
- package/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
- package/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/test-direct/page.js +2 -2
- package/.next/server/app/test-direct/page.js.nft.json +1 -1
- package/.next/server/app/test-direct/page_client-reference-manifest.js +1 -1
- package/.next/server/app/test-direct.html +1 -1
- package/.next/server/app/test-direct.rsc +8 -8
- package/.next/server/app-paths-manifest.json +8 -8
- package/.next/server/chunks/1172.js +1 -1
- package/.next/server/chunks/1876.js +2 -2
- package/.next/server/chunks/4520.js +1 -1
- package/.next/server/chunks/6811.js +3 -0
- package/.next/server/chunks/7173.js +1 -1
- package/.next/server/chunks/801.js +5 -5
- package/.next/server/chunks/9223.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{1383.c891a8ba72ee600c.js → 1383.8f5f7d4606d356cc.js} +1 -1
- package/.next/static/chunks/3764.88619fb0d047cae8.js +1 -0
- package/.next/static/chunks/app/dev/terminal-test/page-59decd1aad4e02ad.js +1 -0
- package/.next/static/chunks/app/{error-da1d10c96ff5dd29.js → error-684a1c5596fa1e14.js} +1 -1
- package/.next/static/chunks/app/{global-error-ca06d2b1be2d4ae0.js → global-error-1a79bacfbd9b1ba4.js} +1 -1
- package/.next/static/chunks/app/layout-0cda720d75f111b8.js +1 -0
- package/.next/static/chunks/app/not-found-315f4e5c106b425d.js +1 -0
- package/.next/static/chunks/app/orchestrators/{page-f07983413ed1a44b.js → page-e3a2c53b57dd8391.js} +1 -1
- package/.next/static/chunks/app/page-e2e589ea11a0780a.js +1 -0
- package/.next/static/chunks/app/projects/[projectId]/{page-49eb5b990c74ca8f.js → page-19a6d4cc9951a9e4.js} +1 -1
- package/.next/static/chunks/app/projects/[projectId]/sessions/[id]/page-75c536c9755754f7.js +1 -0
- package/.next/static/chunks/app/projects/[projectId]/settings/{page-d1da671e72a7bd5e.js → page-f8c323b91978efff.js} +1 -1
- package/.next/static/chunks/app/prs/page-08f17d7dc341b6f1.js +1 -0
- package/.next/static/chunks/app/sessions/[id]/{error-8de5b24e86eeae7b.js → error-62e9972b39d9cd16.js} +1 -1
- package/.next/static/chunks/app/sessions/[id]/not-found-315f4e5c106b425d.js +1 -0
- package/.next/static/chunks/app/sessions/[id]/page-d0b08722dec5a04a.js +1 -0
- package/.next/static/chunks/app/test-direct/{page-eb366dde03fab6a7.js → page-ee0944bcd355194e.js} +1 -1
- package/.next/static/chunks/main-app-b95f197c38e3b0a3.js +1 -0
- package/.next/static/chunks/{webpack-d2dfbd3e9262b74e.js → webpack-83d2d8248a30259c.js} +1 -1
- package/.next/static/css/cf9226160e230bf4.css +1 -0
- package/dist-server/mux-websocket.js +49 -6
- package/package.json +12 -12
- package/.next/server/chunks/3131.js +0 -3
- package/.next/static/chunks/3764.89a5955e46eb74b4.js +0 -1
- package/.next/static/chunks/app/dev/terminal-test/page-5819e40b3d4754ef.js +0 -1
- package/.next/static/chunks/app/layout-bb6db479523cb3d6.js +0 -1
- package/.next/static/chunks/app/not-found-824d5d3c6e296eeb.js +0 -1
- package/.next/static/chunks/app/page-6aa506a579ac9949.js +0 -1
- package/.next/static/chunks/app/projects/[projectId]/sessions/[id]/page-2450704c6b66a4b4.js +0 -1
- package/.next/static/chunks/app/prs/page-2332a7180a47f28c.js +0 -1
- package/.next/static/chunks/app/sessions/[id]/not-found-824d5d3c6e296eeb.js +0 -1
- package/.next/static/chunks/app/sessions/[id]/page-b60b49ccbafe51c9.js +0 -1
- package/.next/static/chunks/main-app-690acf9d5d2050c9.js +0 -1
- package/.next/static/css/fcafd381715071b8.css +0 -1
- /package/.next/static/{YR6Xi4DC5A7S7E2PoZuif → h0RXs0prE87a8wlbEXQKM}/_buildManifest.js +0 -0
- /package/.next/static/{YR6Xi4DC5A7S7E2PoZuif → h0RXs0prE87a8wlbEXQKM}/_ssgManifest.js +0 -0
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
"/api/sessions/[id]/remap/route": "app/api/sessions/[id]/remap/route.js",
|
|
8
8
|
"/api/sessions/[id]/restore/route": "app/api/sessions/[id]/restore/route.js",
|
|
9
9
|
"/api/sessions/[id]/route": "app/api/sessions/[id]/route.js",
|
|
10
|
-
"/api/spawn/route": "app/api/spawn/route.js",
|
|
11
10
|
"/api/sessions/route": "app/api/sessions/route.js",
|
|
12
|
-
"/
|
|
11
|
+
"/api/spawn/route": "app/api/spawn/route.js",
|
|
13
12
|
"/icon-512/route": "app/icon-512/route.js",
|
|
13
|
+
"/icon-192/route": "app/icon-192/route.js",
|
|
14
14
|
"/manifest.webmanifest/route": "app/manifest.webmanifest/route.js",
|
|
15
15
|
"/api/backlog/route": "app/api/backlog/route.js",
|
|
16
16
|
"/api/browse-directory/route": "app/api/browse-directory/route.js",
|
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
"/api/filesystem/browse/route": "app/api/filesystem/browse/route.js",
|
|
19
19
|
"/api/issues/route": "app/api/issues/route.js",
|
|
20
20
|
"/api/runtime/terminal/route": "app/api/runtime/terminal/route.js",
|
|
21
|
-
"/api/
|
|
21
|
+
"/api/sessions/patches/route": "app/api/sessions/patches/route.js",
|
|
22
|
+
"/api/sessions/[id]/send/route": "app/api/sessions/[id]/send/route.js",
|
|
22
23
|
"/api/setup-labels/route": "app/api/setup-labels/route.js",
|
|
24
|
+
"/api/projects/route": "app/api/projects/route.js",
|
|
23
25
|
"/api/sessions/[id]/message/route": "app/api/sessions/[id]/message/route.js",
|
|
24
|
-
"/api/
|
|
25
|
-
"/api/sessions/patches/route": "app/api/sessions/patches/route.js",
|
|
26
|
+
"/api/verify/route": "app/api/verify/route.js",
|
|
26
27
|
"/api/webhooks/[...slug]/route": "app/api/webhooks/[...slug]/route.js",
|
|
27
28
|
"/api/projects/[id]/route": "app/api/projects/[id]/route.js",
|
|
28
|
-
"/api/verify/route": "app/api/verify/route.js",
|
|
29
|
-
"/icon/route": "app/icon/route.js",
|
|
30
29
|
"/apple-icon/route": "app/apple-icon/route.js",
|
|
30
|
+
"/icon/route": "app/icon/route.js",
|
|
31
31
|
"/projects/[projectId]/sessions/[id]/page": "app/projects/[projectId]/sessions/[id]/page.js",
|
|
32
32
|
"/sessions/[id]/page": "app/sessions/[id]/page.js",
|
|
33
33
|
"/page": "app/page.js",
|
|
34
|
+
"/orchestrators/page": "app/orchestrators/page.js",
|
|
34
35
|
"/projects/[projectId]/page": "app/projects/[projectId]/page.js",
|
|
35
36
|
"/prs/page": "app/prs/page.js",
|
|
36
37
|
"/projects/[projectId]/settings/page": "app/projects/[projectId]/settings/page.js",
|
|
37
38
|
"/test-direct/page": "app/test-direct/page.js",
|
|
38
|
-
"/orchestrators/page": "app/orchestrators/page.js",
|
|
39
39
|
"/dev/terminal-test/page": "app/dev/terminal-test/page.js"
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=1172,exports.ids=[1172],exports.modules={13219:(a,b,c)=>{c.d(b,{Dashboard:()=>d});let d=(0,c(10864).registerClientReference)(function(){throw Error("Attempted to call Dashboard() from the server but Dashboard is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/equinox/agent-orchestrator/packages/web/src/components/Dashboard.tsx","Dashboard")},16602:(a,b,c)=>{c.d(b,{Dashboard:()=>L});var d=c(33666),e=c(81115),f=c(47489),g=c.n(f),h=c(50436),i=c(52754),j=c(37155),k=c(85489),l=c(61875),m=c(82732),n=c(37501),o=c(88950);let p=new Set,q=(0,e.memo)(function({session:a,onSend:b,onKill:c,onMerge:f,onRestore:g}){var h,i;let[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(""),E=(0,e.useRef)(null),F=(0,e.useRef)(null),[G]=(0,e.useState)(()=>p.has(a.id)),H=(0,j.ng)(a),I=a.pr,J=async c=>{let d=c.trim();if(!d||null!==w)return!1;x(d),z(null);try{return await Promise.resolve(b?.(a.id,d)),z(d),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>z(null),2e3),!0}catch{return!1}finally{x(null)}},K=async a=>{"Enter"===a.key&&!a.shiftKey&&(a.preventDefault(),await J(C)&&D(""))},L=async(c,d)=>{if(null===s){t(c),v(null);try{await Promise.resolve(b?.(a.id,d)),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>t(null),2e3)}catch{t(null),v(c),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>v(null),2e3)}}},M=!!I&&(0,j.fZ)(I),N=!!I&&(0,j.sZ)(I),O=function(a){let b=a.pr;if(!b||"open"!==b.state||(0,j.fZ)(b)||(0,j.sZ)(b))return[];let c=a.metadata,e=[],f=a.lifecycle?.prReason??null,g=c.status,h=b.ciStatus===j.U1.FAILING||"ci_failing"===f||"ci_failed"===g,i="changes_requested"===b.reviewDecision||"changes_requested"===f||"changes_requested"===g,k=!b.mergeability.noConflicts;if(h){let a=b.ciChecks.find(a=>"failed"===a.status),d=b.ciChecks.filter(a=>"failed"===a.status).length;0===d&&b.ciStatus!==j.U1.FAILING?e.push({key:"ci-fail",type:"ci",icon:"✗",label:"CI failing",url:b.url+"/checks",notified:!!c.lastCIFailureDispatchHash,actionLabel:"Ask to fix",actionMessage:`Please fix the failing CI checks on ${b.url}`}):0===d?e.push({key:"ci-unknown",type:"ci",icon:"?",label:"CI unknown",url:b.url+"/checks"}):e.push({key:"ci-fail",type:"ci",icon:"✗",count:d,label:`check${d>1?"s":""} failing`,url:a?.url??b.url+"/checks",notified:!!c.lastCIFailureDispatchHash,actionLabel:"Ask to fix",actionMessage:`Please fix the failing CI checks on ${b.url}`})}if(i?e.push({key:"changes",type:"changes",icon:"↻",label:"changes requested",url:b.url,notified:!!c.lastPendingReviewDispatchHash,actionLabel:"Ask to address",actionMessage:`Please address the requested changes on ${b.url}`}):b.isDraft||"pending"!==b.reviewDecision&&"none"!==b.reviewDecision||e.push({key:"review",type:"review",icon:(0,d.jsxs)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,d.jsx)("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"})]}),label:"needs review",url:b.url,actionLabel:"Ask to post",actionMessage:`Post ${b.url} on slack asking for a review.`}),k&&e.push({key:"conflict",type:"conflict",icon:"⚠",label:"merge conflict",url:b.url,notified:"true"===c.lastMergeConflictDispatched,actionLabel:"Ask to fix",actionMessage:`Please resolve the merge conflicts on ${b.url} by rebasing on the base branch`}),b.unresolvedThreads>0){let a=b.unresolvedComments[0]?.url??b.url+"/files";e.push({key:"comments",type:"comment",icon:"\uD83D\uDCAC",label:"unresolved comments",count:b.unresolvedThreads,url:a,actionLabel:"Ask to resolve",actionMessage:`Please address all unresolved review comments on ${b.url}`})}return e}(a),P=!M&&I?.mergeability.mergeable&&"open"===I.state,Q=(0,j.nH)(a),R=(0,j.wy)(a),S=(0,l.Pn)(a),T=(h=a,i=H,P||"merge"===i?"mergeable":h.lifecycle?.sessionState==="detecting"?"detecting":"respond"===i?(0,j.Ou)(h):h.lifecycle?.prReason==="ci_failing"||"ci_failed"===h.status?"ci failing":"review"===i?(0,j.of)(h):(0,j.Ou)(h)),U=M||!I||N?[]:I.ciChecks.filter(a=>"passed"===a.status).slice(0,3),V=(0,j.dG)(a)||"done"===H,W=a.lifecycle?`Session ${(0,j.Ou)(a)} \xb7 PR ${(0,j.of)(a)} \xb7 Runtime ${(0,j.Kw)(a)}`:null,X=a.issueLabel?`${a.issueLabel}${a.issueTitle?` \xb7 ${a.issueTitle}`:""}`:a.issueTitle??(a.summary&&a.summary!==S?a.summary:null),Y=P?"session-card--merge-frame":O.length>0?"session-card--alert-frame":"session-card--fixed",Z=P?"session-card--accent-merge":"working"===H?"session-card--accent-working":"respond"===H?"session-card--accent-respond":"review"===H||"pending"===H?"session-card--accent-attention":"session-card--accent-default";if(V){let b=function(a){let b=a.activity,c=a.status,e=a.lifecycle?.prState??a.pr?.state;return"merged"===e||"merged"===c?{label:"merged",pillClass:"done-status-pill--merged",icon:(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",className:"h-3 w-3",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})})}:"closed"===e?{label:"closed",pillClass:"done-status-pill--exited",icon:(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M9 12h6"})]})}:a.lifecycle?.sessionState==="terminated"||"killed"===c||"terminated"===c?{label:(0,j.Ou)(a),pillClass:"done-status-pill--killed",icon:(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",className:"h-3 w-3",children:(0,d.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})}:{label:"exited"===b?"exited":(0,j.Ou)(a),pillClass:"done-status-pill--exited",icon:(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M9 12h6"})]})}}(a);return(0,d.jsxs)("div",{className:(0,k.cn)("session-card-done",q&&"done-expanded"),onClick:a=>{a.target.closest("a, button, textarea")||r(!q)},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-3 pb-1.5",children:[(0,d.jsxs)("span",{className:(0,k.cn)("done-status-pill",b.pillClass),children:[b.icon,b.label]}),(0,d.jsx)("span",{className:"font-[var(--font-mono)] text-[10px] tracking-wide text-[var(--color-text-muted)]",children:a.id}),(0,d.jsx)("div",{className:"flex-1"}),R&&(0,d.jsxs)("button",{onClick:b=>{b.stopPropagation(),g?.(a.id)},className:"done-restore-btn",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,d.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,d.jsx)("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),"restore"]})]}),(0,d.jsx)("div",{className:"px-3.5 pb-2",children:(0,d.jsx)("p",{className:"session-card-done__title text-[13px] font-semibold leading-snug [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden",children:S})}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 px-3.5 pb-3",children:[a.branch&&(0,d.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-2.5 w-2.5 opacity-50",children:[(0,d.jsx)("path",{d:"M6 3v12M18 9a3 3 0 0 1-3 3H9a3 3 0 0 0-3 3"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"3"})]}),a.branch]}),I&&(0,d.jsxs)("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"done-meta-chip font-[var(--font-mono)] font-bold text-[var(--color-text-primary)] no-underline underline-offset-2 hover:underline",children:["#",I.number]}),I&&!M&&(N?(0,d.jsx)("span",{className:"inline-block h-[14px] w-16 animate-pulse rounded-full bg-[var(--color-bg-subtle)]"}):(0,d.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,d.jsxs)("span",{className:"text-[var(--color-status-ready)]",children:["+",I.additions]})," ",(0,d.jsxs)("span",{className:"text-[var(--color-status-error)]",children:["-",I.deletions]})," ",(0,n.i_)(I.additions,I.deletions),(0,d.jsx)("span",{className:"sr-only",children:`+${I.additions} -${I.deletions} ${(0,n.i_)(I.additions,I.deletions)}`})]})),(0,d.jsx)("a",{href:(0,o.Nc)(a.projectId,a.id),onClick:a=>a.stopPropagation(),className:"done-meta-chip font-[var(--font-mono)] font-semibold text-[var(--color-accent)] no-underline hover:underline",children:"View current context"})]}),q&&(0,d.jsxs)("div",{className:"done-expand-section px-3.5 py-3",children:[a.summary&&I?.title&&a.summary!==I.title&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("div",{className:"done-detail-heading",children:[(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M4 6h16M4 12h16M4 18h10"})}),"Summary"]}),(0,d.jsx)("p",{className:"text-[12px] leading-relaxed text-[var(--color-text-secondary)]",children:a.summary})]}),a.issueUrl&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("div",{className:"done-detail-heading",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),"Issue"]}),(0,d.jsxs)("a",{href:a.issueUrl,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"text-[12px] text-[var(--color-accent)] hover:underline",children:[a.issueLabel||a.issueUrl,a.issueTitle&&`: ${a.issueTitle}`]})]}),I&&I.ciChecks.length>0&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("div",{className:"done-detail-heading",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{d:"M9 12l2 2 4-4"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"})]}),"CI Checks"]}),(0,d.jsx)(m.zm,{checks:I.ciChecks})]}),I&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("div",{className:"done-detail-heading",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65S8.93 17.38 9 18v4"}),(0,d.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]}),"PR"]}),(0,d.jsxs)("p",{className:"text-[12px] text-[var(--color-text-secondary)]",children:[(0,d.jsx)("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"hover:underline",children:I.title}),N?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("br",{}),(0,d.jsxs)("span",{className:"mt-1 inline-flex items-center gap-2 text-[10px] text-[var(--color-text-muted)]",children:[(0,d.jsx)("span",{className:"inline-block h-3 w-12 animate-pulse rounded bg-[var(--color-bg-subtle)]"}),(0,d.jsx)("span",{children:"PR details loading..."})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("br",{}),(0,d.jsxs)("span",{className:"mt-1 inline-flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,d.jsxs)("span",{className:"text-[var(--color-status-ready)]",children:["+",I.additions]})," ",(0,d.jsxs)("span",{className:"text-[var(--color-status-error)]",children:["-",I.deletions]})]}),(0,d.jsx)("span",{className:"text-[var(--color-text-muted)]",children:"\xb7"}),(0,d.jsxs)("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:["mergeable: ",I.mergeability.mergeable?"yes":"no"]}),(0,d.jsx)("span",{className:"text-[var(--color-text-muted)]",children:"\xb7"}),(0,d.jsxs)("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:["review: ",I.reviewDecision]})]})]})]})]}),!I&&(0,d.jsx)("p",{className:"text-[12px] text-[var(--color-text-tertiary)]",children:"No PR associated with this session."})]})]})}let $=Q?"exited":P||"merge"===H||"review"===H?"ready":"respond"===H?"waiting":"pending"===H?"idle":"working"===H?"working":"idle";return(0,d.jsxs)("div",{className:(0,k.cn)("session-card border",!G&&"kanban-card-enter",Y,Z,P&&"card-merge-ready"),children:[(0,d.jsxs)("div",{className:"session-card__header",children:[(0,d.jsx)("span",{className:(0,k.cn)("card__adot","working"===$&&"card__adot--working","ready"===$&&"card__adot--ready","idle"===$&&"card__adot--idle","waiting"===$&&"card__adot--waiting","exited"===$&&"card__adot--exited")}),(0,d.jsx)("span",{className:"card__id",children:a.id}),(0,d.jsx)("div",{className:"flex-1"}),R&&(0,d.jsxs)("button",{onClick:b=>{b.stopPropagation(),g?.(a.id)},className:"session-card__control session-card__restore-control",children:[(0,d.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{d:"M20 11a8 8 0 0 0-14.9-3.98"}),(0,d.jsx)("path",{d:"M4 5v4h4"}),(0,d.jsx)("path",{d:"M4 13a8 8 0 0 0 14.9 3.98"}),(0,d.jsx)("path",{d:"M20 19v-4h-4"})]}),"restore"]}),!Q&&(0,d.jsxs)("a",{href:(0,o.$l)(a.projectId,a.id,"#session-terminal-section"),onClick:a=>a.stopPropagation(),className:"session-card__control session-card__terminal-link",children:[(0,d.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),(0,d.jsx)("path",{d:"M6 10l4 2-4 2"}),(0,d.jsx)("path",{d:"M14 14h4"})]}),"terminal"]})]}),(0,d.jsxs)("div",{className:"session-card__body flex min-h-0 flex-1 flex-col",children:[(0,d.jsx)("div",{className:"card__title-wrap",children:(0,d.jsx)("p",{className:"card__title",children:S})}),(0,d.jsxs)("div",{className:"card__meta",children:[a.branch&&(0,d.jsx)("span",{className:"card__branch",children:a.branch}),a.branch&&I?(0,d.jsx)("span",{className:"card__meta-sep","aria-hidden":"true",children:"\xb7"}):null,I&&(0,d.jsxs)("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"card__pr",children:["#",I.number]}),I&&!M&&(N?(0,d.jsx)("span",{className:"inline-block h-[14px] w-16 animate-pulse rounded-full bg-[var(--color-bg-subtle)]"}):(0,d.jsxs)("span",{className:"card__diff inline-flex items-center",children:[(0,d.jsxs)("span",{className:"card__diff-add",children:["+",I.additions]})," ",(0,d.jsxs)("span",{className:"card__diff-del",children:["-",I.deletions]})," ",(0,d.jsx)("span",{className:"card__diff-size",children:(0,n.i_)(I.additions,I.deletions)}),(0,d.jsx)("span",{className:"sr-only",children:`+${I.additions} -${I.deletions} ${(0,n.i_)(I.additions,I.deletions)}`})]}))]}),X&&(0,d.jsx)("div",{className:"px-[10px] pb-[5px]",children:"merge"===H||P?(0,d.jsxs)("p",{className:"session-card__secondary session-card__secondary--merge",children:[(0,d.jsx)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})}),(0,d.jsx)("span",{children:X})]}):(0,d.jsx)("p",{className:"session-card__secondary",children:X})}),W&&(0,d.jsx)("div",{className:"px-[10px] pb-[5px]",children:(0,d.jsx)("p",{className:"text-[10px] leading-relaxed text-[var(--color-text-tertiary)]",children:W})}),M&&I?.state==="open"&&(0,d.jsx)("div",{className:"px-[10px] pb-[5px]",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] text-[var(--color-text-muted)]",children:[(0,d.jsxs)("svg",{className:"h-3 w-3 text-[var(--color-text-tertiary)]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),"PR data rate limited"]})}),U.length>0&&(0,d.jsx)("div",{className:"card__ci",children:U.map(a=>{let b=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("svg",{width:"8",height:"8",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})}),a.name]});return a.url?(0,d.jsx)("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"ci-chip ci-chip--pass",onClick:a=>a.stopPropagation(),children:b},a.name):(0,d.jsx)("span",{className:"ci-chip ci-chip--pass",children:b},a.name)})}),!M&&O.length>0&&(0,d.jsx)("div",{className:"card__alerts flex flex-col",children:O.slice(0,3).map(a=>(0,d.jsxs)("div",{className:(0,k.cn)("alert-row",`alert-row--${a.type}`),children:[(0,d.jsx)("span",{className:"alert-row__icon",children:a.icon}),(0,d.jsxs)("span",{className:"alert-row__text",children:[(0,d.jsxs)("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),children:[void 0!==a.count&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"font-bold",children:a.count})," "]}),a.label]}),a.notified&&(0,d.jsxs)("span",{className:"alert-row__notified",title:"Agent has been notified",children:[" ","\xb7 notified"]})]}),a.actionLabel&&(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),L(a.key,a.actionMessage??"")},disabled:s===a.key,className:"alert-row__action",children:s===a.key?"sent!":u===a.key?"failed":a.actionLabel})]},a.key))}),"respond"===H&&(0,d.jsxs)("div",{className:"quick-reply",onClick:a=>a.stopPropagation(),children:[a.summary&&!a.summaryIsFallback&&(0,d.jsxs)("div",{className:"card__agent-msg",children:[(0,d.jsx)("svg",{className:"card__agent-msg-icon",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),(0,d.jsx)("span",{children:a.summary})]}),(0,d.jsx)("a",{href:(0,o.Nc)(a.projectId,a.id),onClick:a=>a.stopPropagation(),className:"card__view-context",children:"View current context →"}),!Q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"card__presets",children:[(0,d.jsx)("button",{className:"card__preset",onClick:()=>void J("continue"),disabled:null!==w,children:"continue"===w?"Sending...":"continue"===y?"Sent":"Continue"}),(0,d.jsx)("button",{className:"card__preset",onClick:()=>void J("abort"),disabled:null!==w,children:"abort"===w?"Sending...":"abort"===y?"Sent":"Abort"}),(0,d.jsx)("button",{className:"card__preset",onClick:()=>void J("skip"),disabled:null!==w,children:"skip"===w?"Sending...":"skip"===y?"Sent":"Skip"})]}),(0,d.jsx)("div",{className:"card__reply-wrap",children:(0,d.jsx)("textarea",{className:"card__reply",placeholder:null!==w?"Sending...":"Type a reply... (Enter to send)","aria-label":"Type a reply to the agent",value:C,onChange:a=>D(a.target.value),onKeyDown:a=>{K(a)},rows:1,disabled:null!==w})})]})]}),(0,d.jsxs)("div",{className:"session-card__footer",children:[(0,d.jsx)("span",{className:"card__status min-w-0 truncate",title:a.userPrompt??void 0,children:!a.issueUrl&&a.userPrompt?a.userPrompt.length>60?a.userPrompt.slice(0,60)+"…":a.userPrompt:T}),P&&I?(0,d.jsxs)("button",{onClick:a=>{a.stopPropagation(),f?.(I.number)},className:"session-card__control session-card__merge-control",children:[(0,d.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"6",cy:"6",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"18",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"2"}),(0,d.jsx)("path",{d:"M8 6h5a3 3 0 0 1 3 3v7"})]}),"Merge PR #",I.number]}):!Q&&(0,d.jsx)("button",{onClick:b=>{if(b.stopPropagation(),!A)return void B(!0);B(!1),c?.(a.id)},onMouseLeave:()=>B(!1),onBlur:()=>B(!1),"aria-label":A?"Confirm terminate session":"Terminate session",className:(0,k.cn)("session-card__control session-card__terminate btn--danger",A&&"is-confirming"),children:A?(0,d.jsx)("span",{className:"font-mono text-[10px] font-semibold tracking-[0.04em]",children:"kill?"}):(0,d.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{d:"M3 6h18"}),(0,d.jsx)("path",{d:"M8 6V4h8v2"}),(0,d.jsx)("path",{d:"M19 6l-1 14H6L5 6"})]})})]})]})]})},function(a,b){return a.session===b.session&&a.onSend===b.onSend&&a.onKill===b.onKill&&a.onMerge===b.onMerge&&a.onRestore===b.onRestore}),r={merge:{label:"Ready",emptyMessage:"Nothing cleared to land yet."},action:{label:"Action",emptyMessage:"No agents need your input."},respond:{label:"Respond",emptyMessage:"No agents need your input."},review:{label:"Review",emptyMessage:"No code waiting for review."},pending:{label:"Pending",emptyMessage:"Nothing blocked."},working:{label:"Working",emptyMessage:"No agents running."},done:{label:"Done",emptyMessage:"No completed sessions."}},s=(0,e.memo)(function({level:a,sessions:b,onSend:c,onKill:f,onMerge:g,onRestore:h,collapsed:i,onToggle:j,compactMobile:k,onPreview:l,resetKey:m}){let n=r[a],o=void 0!==j,[p,s]=(0,e.useState)(!1),u=o&&k&&!p?b.slice(0,5):b,v=b.length-u.length;return o?(0,d.jsxs)("div",{className:`accordion-section${i?" accordion-section--collapsed":" accordion-section--expanded"}`,"data-level":a,children:[(0,d.jsxs)("button",{type:"button",className:"accordion-header",onClick:()=>j(a),"aria-expanded":!i,"aria-controls":`accordion-body-${a}`,children:[(0,d.jsx)("span",{className:"accordion-header__dot","data-level":a}),(0,d.jsx)("span",{className:"accordion-header__label",children:n.label}),(0,d.jsx)("span",{className:"accordion-header__count",children:b.length}),(0,d.jsx)("span",{className:"accordion-header__chevron","aria-hidden":"true",children:"▶"})]}),(0,d.jsx)("div",{id:`accordion-body-${a}`,className:"accordion-body",children:b.length>0?(0,d.jsxs)("div",{className:k?"mobile-session-list":"flex flex-col gap-2 p-3",children:[u.map(b=>k?(0,d.jsx)(t,{session:b,level:a,onPreview:l},b.id):(0,d.jsx)(q,{session:b,onSend:c,onKill:f,onMerge:g,onRestore:h},b.id)),k&&v>0?(0,d.jsxs)("button",{type:"button",className:"mobile-session-list__view-all",onClick:()=>s(!0),children:["View all ",b.length]}):null]}):k?(0,d.jsx)("div",{className:"mobile-session-list",children:(0,d.jsx)("div",{className:"mobile-session-list__empty",children:n.emptyMessage})}):null})]}):(0,d.jsxs)("div",{className:"kanban-column","data-level":a,children:[(0,d.jsx)("div",{className:"kanban-column__header",children:(0,d.jsxs)("div",{className:"kanban-column__title-row",children:[(0,d.jsx)("div",{className:"kanban-column__dot","data-level":a}),(0,d.jsx)("span",{className:"kanban-column__title",children:n.label}),(0,d.jsx)("span",{className:"kanban-column__count",children:b.length})]})}),(0,d.jsx)("div",{className:"kanban-column-body",children:b.length>0?(0,d.jsx)("div",{className:"kanban-column__stack",children:b.map(a=>(0,d.jsx)(q,{session:a,onSend:c,onKill:f,onMerge:g,onRestore:h},a.id))}):null})]})},function(a,b){return a.level===b.level&&a.collapsed===b.collapsed&&a.onToggle===b.onToggle&&a.onSend===b.onSend&&a.onKill===b.onKill&&a.onMerge===b.onMerge&&a.onRestore===b.onRestore&&a.compactMobile===b.compactMobile&&a.onPreview===b.onPreview&&a.resetKey===b.resetKey&&a.sessions.length===b.sessions.length&&a.sessions.every((a,c)=>a===b.sessions[c])});function t({session:a,level:b,onPreview:c}){let e=[a.branch,a.pr?`PR #${a.pr.number}`:null,a.issueLabel].filter(Boolean);return(0,d.jsxs)("div",{className:"mobile-session-row",children:[(0,d.jsxs)("button",{type:"button",className:"mobile-session-row__preview",onClick:()=>c?.(a),"aria-label":`Open ${(0,l.Pn)(a)}`,children:[(0,d.jsxs)("div",{className:"mobile-session-row__line",children:[(0,d.jsx)("span",{className:"mobile-session-row__dot","data-level":b,"aria-hidden":"true"}),(0,d.jsx)("span",{className:"mobile-session-row__title",children:(0,l.Pn)(a)})]}),(0,d.jsx)("div",{className:"mobile-session-row__meta",children:e.length>0?e.join(" \xb7 "):"No branch or PR metadata"})]}),(0,d.jsxs)("div",{className:"mobile-session-row__side",children:[(0,d.jsx)(u,{session:a,level:b}),(0,d.jsx)("a",{href:(0,o.Nc)(a.projectId,a.id),className:"mobile-session-row__open","aria-label":`Go to ${(0,l.Pn)(a)}`,children:(0,d.jsxs)("svg",{className:"mobile-session-row__open-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M4 17V7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z"}),(0,d.jsx)("path",{d:"m8 10 2 2-2 2M12 14h4"})]})})]})]})}function u({session:a,level:b}){let c=r[b].label.toLowerCase();if("merge"===b&&a.pr&&(0,j.QN)(a.pr))c="ready";else if("action"===b)c="needs_input"===a.status?"needs input":"stuck"===a.status?"stuck":"errored"===a.status?"errored":"waiting_input"===a.activity?"waiting":"exited"===a.activity?"crashed":"blocked"===a.activity?"blocked":"ci_failed"===a.status?"ci failed":"changes_requested"===a.status?"changes":a.pr?.ciStatus==="failing"?"ci failed":a.pr?.reviewDecision==="changes_requested"?"changes":a.pr&&!a.pr.mergeability.noConflicts?"conflicts":"action";else"respond"===b?c="waiting_input"===a.activity?"waiting":"needs input":"review"===b?c=a.pr?.reviewDecision==="changes_requested"?"changes":"review":"pending"===b?c=a.pr?.unresolvedThreads?"threads":"pending":"working"===b&&(c="idle"===a.activity?"idle":"active");return(0,d.jsx)("span",{className:"mobile-session-row__chip",children:c})}var v=c(18768),w=c(20057),x=c(58976),y=c(31849);let z=["Working","Pending","Review","Respond","Merge"];function A({message:a,orchestratorHref:b,onSpawnOrchestrator:c=null,spawnLabel:e="Spawn Orchestrator",spawnDisabled:f=!1}){return(0,d.jsxs)("div",{className:"board-wrapper",children:[(0,d.jsx)("div",{className:"kanban-ghost","aria-hidden":"true",children:z.map(a=>(0,d.jsx)("div",{className:"kanban-ghost__col",children:(0,d.jsx)("div",{className:"kanban-ghost__head",children:a})},a))}),(0,d.jsx)("div",{className:"board-center",children:(0,d.jsxs)("div",{className:"empty-state",role:"status",children:[(0,d.jsx)("div",{className:"empty-state__icon",children:(0,d.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5.5",r:"2.5",fill:"rgba(249,115,22,0.18)",stroke:"#f97316",strokeWidth:"1.5"}),(0,d.jsx)("circle",{cx:"5.5",cy:"17",r:"2.5",fill:"var(--color-bg-subtle)",stroke:"var(--color-border-strong)",strokeWidth:"1.5"}),(0,d.jsx)("circle",{cx:"18.5",cy:"17",r:"2.5",fill:"var(--color-bg-subtle)",stroke:"var(--color-border-strong)",strokeWidth:"1.5"}),(0,d.jsx)("line",{x1:"12",y1:"8",x2:"6.7",y2:"14.8",stroke:"rgba(249,115,22,0.22)",strokeWidth:"1",strokeDasharray:"2.5 2"}),(0,d.jsx)("line",{x1:"12",y1:"8",x2:"17.3",y2:"14.8",stroke:"rgba(249,115,22,0.22)",strokeWidth:"1",strokeDasharray:"2.5 2"}),(0,d.jsx)("line",{x1:"7.8",y1:"17",x2:"16.2",y2:"17",stroke:"var(--color-border-subtle)",strokeWidth:"1",strokeDasharray:"2.5 2"})]})}),a?(0,d.jsx)("p",{className:"empty-state__text",children:a}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"empty-state__headline",children:"Ready to orchestrate"}),(0,d.jsx)("p",{className:"empty-state__hint",children:"Open the main orchestrator to start a session and fan out parallel agents across your codebase."}),b?(0,d.jsxs)("a",{href:b,className:"empty-state__cta",children:[(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,d.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),"Open Orchestrator"]}):c?(0,d.jsxs)("button",{type:"button",className:"empty-state__cta",onClick:c,disabled:f,children:[(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,d.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),e]}):null]})]})})]})}var B=c(71276);function C({status:a}){return"connected"===a?null:"disconnected"===a?(0,d.jsx)("button",{type:"button",className:"connection-bar connection-bar--disconnected","aria-live":"assertive","aria-atomic":"true",onClick:()=>window.location.reload(),children:"Offline \xb7 tap to retry"}):(0,d.jsx)("div",{className:"connection-bar connection-bar--reconnecting",role:"status","aria-live":"polite","aria-atomic":"true",children:"Reconnecting…"})}let D=[/\bBearer\s+[A-Za-z0-9._\-+/=]+\b/gi,/\bsk-[A-Za-z0-9]{10,}\b/g,/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g];function E({projectId:a}){let{showToast:b}=(0,B.d)(),[c,f]=(0,e.useState)(!1),g=(0,e.useCallback)(async()=>{if(!c){f(!0);try{let c,d=await fetch("/api/observability",{credentials:"same-origin"});if(!d.ok)return void b("Could not fetch observability snapshot","error");let e=d.headers.get("x-correlation-id");try{c=await d.json()}catch{b("Could not parse observability snapshot","error");return}let f=function a(b,c=new WeakSet){if("string"==typeof b)return D.reduce((a,b)=>a.replace(b,"[REDACTED]"),b);if(Array.isArray(b))return b.map(b=>a(b,c));if(b&&"object"==typeof b){if(c.has(b))return"[Circular]";c.add(b);let d={};for(let[e,f]of Object.entries(b))d[e]=a(f,c);return d}return b}(function(a,b){if(!b||!a||"object"!=typeof a)return a;let c={...a},d=c.projects;if(d&&"object"==typeof d&&!Array.isArray(d)){let a=d[b];c.projects=void 0===a?{}:{[b]:a}}return c}(c,a)),g={copiedAt:new Date().toISOString(),pageHref:`${window.location.origin}${window.location.pathname}`,projectId:a??null,correlationId:e,userAgent:navigator.userAgent,observability:f};await navigator.clipboard.writeText(JSON.stringify(g,null,2)),b("Debug bundle copied to clipboard","success")}catch{b("Could not copy debug bundle","error")}finally{f(!1)}}},[c,a,b]);return(0,d.jsxs)("button",{type:"button",className:"orchestrator-btn flex min-h-[44px] min-w-[44px] items-center gap-2 px-4 py-2 text-[12px] font-semibold text-[var(--color-text-secondary)] transition-colors hover:bg-[var(--color-bg-hover)] disabled:opacity-50",onClick:()=>void g(),disabled:c,"aria-label":"Copy debug bundle for issue reports",children:[(0,d.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy debug info"]})}var F=c(70162);let G=["working","pending","action","merge"],H=["working","pending","review","respond","merge"],I=[];function J({session:a,onRestore:b}){let c=!a.summaryIsFallback&&a.summary||a.issueTitle||a.summary||a.id,e=a.pr?.state==="merged"||"merged"===a.status,f="killed"===a.status||"terminated"===a.status,g=!j.N_.has(a.status),h=`done-card__badge ${f?"done-card__badge--terminated":"done-card__badge--merged"}`;return(0,d.jsxs)("div",{className:"done-card",children:[(0,d.jsx)("p",{className:"done-card__title",children:c}),(0,d.jsxs)("div",{className:"done-card__meta",children:[(0,d.jsx)("span",{className:h,children:e?"merged":f?"terminated":"done"}),a.pr?(0,d.jsxs)("a",{href:a.pr.url,target:"_blank",rel:"noopener noreferrer",className:"done-card__pr",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"1.8",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"18",cy:"18",r:"3"}),(0,d.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,d.jsx)("path",{d:"M6 9v3a6 6 0 0 0 6 6h3"})]}),"#",a.pr.number]}):null,(0,d.jsx)("span",{className:"done-card__age",children:function(a){if(!a)return"just now";let b=new Date(a).getTime();if(!Number.isFinite(b))return"just now";let c=Date.now()-b;if(c<=0)return"just now";let d=Math.floor(c/1e3),e=Math.floor(d/60),f=Math.floor(e/60),g=Math.floor(f/24);return d<60?`${d}s ago`:e<60?`${e}m ago`:f<24?`${f}h ago`:`${g}d ago`}(a.lastActivityAt)}),g?(0,d.jsx)("button",{type:"button",className:"done-card__restore",onClick:c=>{c.stopPropagation(),b(a.id)},children:"Restore"}):null]})]})}function K({initialSessions:a,projectId:b,projectName:c,projects:f=[],orchestrators:k,attentionZones:l="simple",dashboardLoadError:m}){let n=(0,x.eT)(),p="detailed"===l?H:G,q=(0,e.useMemo)(()=>{let b={};for(let c of a)b[c.id]=(0,j.ng)(c,l);return b},[a,l]),{sessions:r,attentionLevels:t,liveSessionsResolved:u,loadError:z}=(0,w.D)({initialSessions:a,muxSessions:n?.status==="connected"?n.sessions:void 0,muxLastError:n?.lastError,initialAttentionLevels:q,attentionZones:l}),D=(0,e.useMemo)(()=>b?r.filter(a=>a.projectId===b):r,[r,b]),K=n?.status==="disconnected"?"disconnected":n?.status==="connected"?"connected":"reconnecting",L=z??(m&&u?void 0:m),N=(0,h.useSearchParams)(),O=(0,h.useRouter)(),P=(0,e.useRef)(O);P.current=O;let Q=N.get("session")??void 0,[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(k??I),[V,W]=(0,e.useState)([]),[X,Y]=(0,e.useState)({}),[Z,$]=(0,e.useState)(!1),[_,aa]=(0,e.useState)(!1),ab=(0,i.U)(i.D),ac=N.get("debug"),{showToast:ad}=(0,B.d)(),[ae,af]=(0,e.useState)(!1),ag=(0,e.useRef)(r);ag.current=r;let ah=f.length>1&&void 0===b,ai=(0,e.useMemo)(()=>b?T.find(a=>a.projectId===b)??null:null,[T,b]),aj=ai?(0,o.Nc)(ai.projectId,ai.id):null,ak=!ah&&!!b&&f.some(a=>a.id===b&&!a.resolveError)&&!aj,al=b?f.find(a=>a.id===b)??null:null,am=!!b&&V.includes(b),an=b?X[b]??null:null,ao=(0,e.useMemo)(()=>ah||!Q?D:D.filter(a=>a.id===Q),[D,ah,Q]),ap=(0,e.useMemo)(()=>{let a={merge:[],action:[],respond:[],review:[],pending:[],working:[],done:[]};for(let b of ao)a[(0,j.ng)(b,l)].push(b);return a},[ao,l]),aq=(0,e.useMemo)(()=>{let a=new Map;for(let b of r){let c=a.get(b.projectId);if(c){c.push(b);continue}a.set(b.projectId,[b])}return a},[r]),ar=(0,e.useMemo)(()=>ah?f.map(a=>{let b=aq.get(a.id)??[],c={merge:0,action:0,respond:0,review:0,pending:0,working:0,done:0};for(let a of b)c[(0,j.ng)(a,l)]++;return{project:a,orchestrator:T.find(b=>b.projectId===a.id)??null,sessionCount:b.length,openPRCount:b.filter(a=>a.pr?.state==="open").length,counts:c}}):[],[T,ah,l,f,aq]),as=(0,e.useCallback)(async(a,b)=>{try{let c=await fetch(`/api/sessions/${encodeURIComponent(a)}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:b})});if(!c.ok){let b=await c.text()||"Unknown error";console.error(`Failed to send message to ${a}:`,b),ad(`Send failed: ${b}`,"error");let d=Error(b);throw d.toastShown=!0,d}}catch(b){throw b instanceof Error&&"toastShown"in b&&b.toastShown||(console.error(`Network error sending message to ${a}:`,b),ad("Network error while sending message","error")),b}},[ad]),at=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a)}/kill`,{method:"POST"});if(b.ok)ad("Session terminated","success");else{let c=await b.text();console.error(`Failed to kill ${a}:`,c),ad(`Terminate failed: ${c}`,"error")}}catch(b){console.error(`Network error killing ${a}:`,b),ad("Network error while terminating session","error")}},[ad]),au=(0,e.useCallback)(a=>{let b=ag.current.find(b=>b.id===a)??null;b&&at(b.id)},[at]),av=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/prs/${a}/merge`,{method:"POST"});if(b.ok)ad(`PR #${a} merged`,"success");else{let c=await b.text();console.error(`Failed to merge PR #${a}:`,c),ad(`Merge failed: ${c}`,"error");return}}catch(b){console.error(`Network error merging PR #${a}:`,b),ad("Network error while merging PR","error")}},[ad]),aw=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a)}/restore`,{method:"POST"});if(b.ok)ad("Session restored","success"),P.current.refresh();else{let c=await b.text();console.error(`Failed to restore ${a}:`,c),ad(`Restore failed: ${c}`,"error")}}catch(b){console.error(`Network error restoring ${a}:`,b),ad("Network error while restoring session","error")}},[ad]),ax=async a=>{W(b=>b.includes(a.id)?b:[...b,a.id]),Y(({[a.id]:b,...c})=>c);try{let b=await fetch("/api/orchestrators",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:a.id})}),c=await b.json().catch(()=>null);if(!b.ok||!c?.orchestrator)throw Error(c?.error??`Failed to spawn orchestrator for ${a.name}`);let d=c.orchestrator;U(b=>{let c=b.filter(b=>b.projectId!==a.id);return c.push(d),c})}catch(c){let b=c instanceof Error?c.message:"Failed to spawn orchestrator";Y(c=>({...c,[a.id]:b})),console.error(`Failed to spawn orchestrator for ${a.id}:`,c)}finally{W(b=>b.filter(b=>b!==a.id))}},ay=p.some(a=>ap[a].length>0),az=!ah&&!ay&&!L,aA=L?(0,d.jsxs)("div",{className:"dashboard-alert mb-6 flex flex-col gap-1.5 border border-[color-mix(in_srgb,var(--color-status-error)_28%,transparent)] bg-[color-mix(in_srgb,var(--color-status-error)_10%,transparent)] px-3.5 py-2.5 text-[11px] md:mb-4",role:"alert","aria-live":"assertive",children:[(0,d.jsx)("span",{className:"font-semibold text-[var(--color-status-error)]",children:"Orchestrator failed to load"}),(0,d.jsx)("span",{className:"break-words text-[var(--color-text-secondary)]",children:L}),(0,d.jsxs)("span",{className:"text-[var(--color-text-secondary)]",children:["Confirm ",(0,d.jsx)("span",{className:"font-mono text-[10px]",children:"agent-orchestrator.yaml"})," exists and is valid, then run ",(0,d.jsx)("span",{className:"font-mono text-[10px]",children:"ao doctor"})," for diagnostics."]})]}):null,aB=(0,e.useMemo)(()=>r.some(a=>a.pr&&(0,j.fZ)(a.pr)),[r]),aC="agent orchestrator"===c?.trim().toLowerCase()?b??c??(ah?"All projects":"Dashboard"):c??(ah?"All projects":"Dashboard"),aD=!ah&&aC.trim().length>0,aE=()=>{$(a=>!a)};return(0,d.jsx)(F.I.Provider,{value:{onToggleSidebar:aE,mobileSidebarOpen:_},children:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(C,{status:K}),(0,d.jsxs)("div",{className:"dashboard-app-shell",children:[(0,d.jsxs)("header",{className:"dashboard-app-header",children:[(0,d.jsx)("button",{type:"button",className:"dashboard-app-sidebar-toggle",onClick:aE,"aria-label":"Toggle sidebar",children:ab?(0,d.jsx)("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"})}):(0,d.jsxs)("svg",{width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,d.jsx)("path",{d:"M9 3v18"})]})}),(0,d.jsxs)("div",{className:"dashboard-app-header__brand",children:[(0,d.jsx)("span",{className:"dashboard-app-header__brand-dot","aria-hidden":"true"}),(0,d.jsx)("span",{children:"Agent Orchestrator"})]}),aD?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"dashboard-app-header__sep","aria-hidden":"true"}),(0,d.jsx)("span",{className:"dashboard-app-header__project",children:aC})]}):null,ab||"1"!==ac&&"true"!==ac?null:(0,d.jsx)(E,{projectId:b}),(0,d.jsx)("div",{className:"dashboard-app-header__spacer"}),(0,d.jsx)("div",{className:"dashboard-app-header__actions",children:!ah&&aj?(0,d.jsxs)(g(),{href:aj,className:"dashboard-app-btn dashboard-app-btn--amber","aria-label":"Orchestrator",children:[(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,d.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),"Orchestrator"]}):ak&&al?(0,d.jsxs)("button",{type:"button",className:"dashboard-app-btn dashboard-app-btn--amber","aria-label":"Spawn Orchestrator",onClick:()=>void ax(al),disabled:am,children:[(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,d.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),am?"Spawning...":"Spawn Orchestrator"]}):null})]}),(0,d.jsxs)("div",{className:`dashboard-shell dashboard-shell--desktop${Z?" dashboard-shell--sidebar-collapsed":""}`,children:[(0,d.jsx)("div",{className:`sidebar-wrapper${_?" sidebar-wrapper--mobile-open":""}`,children:(0,d.jsx)(y.u,{projects:f,sessions:r,orchestrators:T,activeProjectId:b,activeSessionId:Q,collapsed:Z,onToggleCollapsed:()=>$(a=>!a),onMobileClose:()=>aa(!1)})}),_&&(0,d.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:()=>aa(!1)}),(0,d.jsxs)("main",{className:"dashboard-main dashboard-main--desktop",children:[(0,d.jsx)(v.u,{attentionLevels:t,projectName:c}),(0,d.jsxs)("div",{className:"dashboard-main__subhead",children:[(0,d.jsx)("h1",{className:"dashboard-main__title",children:"Dashboard"}),(0,d.jsx)("p",{className:"dashboard-main__subtitle",children:"Live agent sessions, pull requests, and merge status."})]}),(0,d.jsxs)("div",{className:"dashboard-main__body",children:[aA,aB&&!R&&(0,d.jsxs)("div",{className:"dashboard-alert mb-4 flex items-center gap-2.5 border border-[color-mix(in_srgb,var(--color-status-attention)_25%,transparent)] bg-[var(--color-tint-yellow)] px-3.5 py-2.5 text-[11px] text-[var(--color-status-attention)]",children:[(0,d.jsxs)("svg",{className:"h-3.5 w-3.5 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),(0,d.jsx)("span",{className:"flex-1",children:"GitHub API rate limited — PR data (CI status, review state, sizes) may be stale. Will retry automatically on next refresh."}),(0,d.jsx)("button",{onClick:()=>S(!0),className:"ml-1 shrink-0 opacity-60 hover:opacity-100","aria-label":"Dismiss",children:(0,d.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),ah&&(0,d.jsx)(M,{overviews:ar,onSpawnOrchestrator:ax,spawningProjectIds:V,spawnErrors:X,attentionZones:l}),!ah&&ay&&(0,d.jsx)("div",{className:"kanban-board-wrap",children:(0,d.jsx)("div",{className:"kanban-board","data-columns":p.length,style:{"--kanban-column-count":p.length},children:p.map(a=>(0,d.jsx)(s,{level:a,sessions:ap[a],onSend:as,onKill:au,onMerge:av,onRestore:aw},a))})}),az?(0,d.jsx)(A,{orchestratorHref:aj,onSpawnOrchestrator:ak&&al?()=>{ax(al)}:null,spawnLabel:am?"Spawning...":"Spawn Orchestrator",spawnDisabled:am}):null,!ah&&an?(0,d.jsx)("p",{className:"mt-3 text-[11px] text-[var(--color-status-error)]",children:an}):null,!ah&&ap.done.length>0&&(0,d.jsxs)("div",{className:"done-bar mt-6",children:[(0,d.jsxs)("button",{type:"button",className:"done-bar__toggle",onClick:()=>af(a=>!a),"aria-expanded":ae,children:[(0,d.jsx)("svg",{className:`done-bar__chevron${ae?" done-bar__chevron--open":""}`,fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"m9 18 6-6-6-6"})}),(0,d.jsx)("span",{className:"done-bar__label",children:"Done / Terminated"}),(0,d.jsx)("span",{className:"done-bar__count",children:ap.done.length})]}),ae&&(0,d.jsx)("div",{className:"done-bar__cards",children:ap.done.map(a=>(0,d.jsx)(J,{session:a,onRestore:aw},a.id))})]})]})]})]})]})]})})}function L(a){return(0,d.jsx)(B.t,{children:(0,d.jsx)(K,{...a})})}function M({overviews:a,onSpawnOrchestrator:b,spawningProjectIds:c,spawnErrors:e,attentionZones:f}){return(0,d.jsx)("div",{className:"mb-8 grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:a.map(({project:a,orchestrator:h,sessionCount:i,openPRCount:j,counts:k})=>(()=>{let l=!!a.resolveError,m=(0,o.bn)(a.id);return(0,d.jsxs)("section",{className:"border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] p-4",children:[(0,d.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-[14px] font-semibold text-[var(--color-text-primary)]",children:a.name}),(0,d.jsx)("div",{className:"mt-1 text-[11px] text-[var(--color-text-muted)]",children:l?"Config needs repair":(0,d.jsxs)(d.Fragment,{children:[i," active session",1!==i?"s":"",j>0?` \xb7 ${j} open PR${1!==j?"s":""}`:""]})})]}),(0,d.jsx)(g(),{href:m,className:"border border-[var(--color-border-default)] px-3 py-1.5 text-[11px] font-medium text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] hover:no-underline",children:"Open project"})]}),(0,d.jsxs)("div",{className:"mb-4 flex flex-wrap gap-2",children:[(0,d.jsx)(N,{label:"Merge",value:k.merge,tone:"ready"}),"detailed"===f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(N,{label:"Respond",value:k.respond,tone:"error"}),(0,d.jsx)(N,{label:"Review",value:k.review,tone:"orange"})]}):(0,d.jsx)(N,{label:"Action",value:k.action,tone:"orange"}),(0,d.jsx)(N,{label:"Pending",value:k.pending,tone:"attention"}),(0,d.jsx)(N,{label:"Working",value:k.working,tone:"working"})]}),(0,d.jsxs)("div",{className:"border-t border-[var(--color-border-subtle)] pt-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{className:"text-[11px] text-[var(--color-text-muted)]",children:l?"Project config could not be resolved":h?"Per-project orchestrator available":"No running orchestrator"}),l?(0,d.jsx)(g(),{href:m,className:"border border-[var(--color-border-default)] px-3 py-1.5 text-[11px] font-semibold text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] hover:no-underline",children:"Repair project"}):h?(0,d.jsxs)(g(),{href:(0,o.Nc)(h.projectId,h.id),className:"orchestrator-btn flex items-center gap-2 px-3 py-1.5 text-[11px] font-semibold hover:no-underline",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--color-accent)] opacity-80"}),"orchestrator"]}):(0,d.jsx)("button",{type:"button",onClick:()=>void b(a),disabled:c.includes(a.id),className:"orchestrator-btn px-3 py-1.5 text-[11px] font-semibold disabled:cursor-wait disabled:opacity-70",children:c.includes(a.id)?"Spawning...":"Spawn Orchestrator"})]}),e[a.id]?(0,d.jsx)("p",{className:"mt-2 text-[11px] text-[var(--color-status-error)]",children:e[a.id]}):null]})]},a.id)})())})}function N({label:a,value:b,tone:c}){return(0,d.jsxs)("div",{className:"min-w-[78px] border border-[var(--color-border-subtle)] px-2.5 py-2",children:[(0,d.jsx)("div",{className:"text-[10px] uppercase tracking-[0.08em] text-[var(--color-text-tertiary)]",children:a}),(0,d.jsx)("div",{className:"project-metric__value mt-1 text-[18px] font-semibold tabular-nums","data-tone":c,children:b})]})}},70162:(a,b,c)=>{c.d(b,{I:()=>d});let d=(0,c(81115).createContext)(null)}};
|
|
1
|
+
"use strict";exports.id=1172,exports.ids=[1172],exports.modules={13219:(a,b,c)=>{c.d(b,{Dashboard:()=>d});let d=(0,c(10864).registerClientReference)(function(){throw Error("Attempted to call Dashboard() from the server but Dashboard is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/equinox/.agent-orchestrator/projects/agent-orchestrator/worktrees/ao-179/packages/web/src/components/Dashboard.tsx","Dashboard")},16602:(a,b,c)=>{c.d(b,{Dashboard:()=>L});var d=c(33666),e=c(81115),f=c(47489),g=c.n(f),h=c(50436),i=c(52754),j=c(37155),k=c(85489),l=c(61875),m=c(82732),n=c(37501),o=c(88950);let p=new Set,q=(0,e.memo)(function({session:a,onSend:b,onKill:c,onMerge:f,onRestore:g}){var h,i;let[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(""),E=(0,e.useRef)(null),F=(0,e.useRef)(null),[G]=(0,e.useState)(()=>p.has(a.id)),H=(0,j.ng)(a),I=a.pr,J=async c=>{let d=c.trim();if(!d||null!==w)return!1;x(d),z(null);try{return await Promise.resolve(b?.(a.id,d)),z(d),F.current&&clearTimeout(F.current),F.current=setTimeout(()=>z(null),2e3),!0}catch{return!1}finally{x(null)}},K=async a=>{"Enter"===a.key&&!a.shiftKey&&(a.preventDefault(),await J(C)&&D(""))},L=async(c,d)=>{if(null===s){t(c),v(null);try{await Promise.resolve(b?.(a.id,d)),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>t(null),2e3)}catch{t(null),v(c),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>v(null),2e3)}}},M=!!I&&(0,j.fZ)(I),N=!!I&&(0,j.sZ)(I),O=function(a){let b=a.pr;if(!b||"open"!==b.state||(0,j.fZ)(b)||(0,j.sZ)(b))return[];let c=a.metadata,e=[],f=a.lifecycle?.prReason??null,g=c.status,h=b.ciStatus===j.U1.FAILING||"ci_failing"===f||"ci_failed"===g,i="changes_requested"===b.reviewDecision||"changes_requested"===f||"changes_requested"===g,k=!b.mergeability.noConflicts;if(h){let a=b.ciChecks.find(a=>"failed"===a.status),d=b.ciChecks.filter(a=>"failed"===a.status).length;0===d&&b.ciStatus!==j.U1.FAILING?e.push({key:"ci-fail",type:"ci",icon:"✗",label:"CI failing",url:b.url+"/checks",notified:!!c.lastCIFailureDispatchHash,actionLabel:"Ask to fix",actionMessage:`Please fix the failing CI checks on ${b.url}`}):0===d?e.push({key:"ci-unknown",type:"ci",icon:"?",label:"CI unknown",url:b.url+"/checks"}):e.push({key:"ci-fail",type:"ci",icon:"✗",count:d,label:`check${d>1?"s":""} failing`,url:a?.url??b.url+"/checks",notified:!!c.lastCIFailureDispatchHash,actionLabel:"Ask to fix",actionMessage:`Please fix the failing CI checks on ${b.url}`})}if(i?e.push({key:"changes",type:"changes",icon:"↻",label:"changes requested",url:b.url,notified:!!c.lastPendingReviewDispatchHash,actionLabel:"Ask to address",actionMessage:`Please address the requested changes on ${b.url}`}):b.isDraft||"pending"!==b.reviewDecision&&"none"!==b.reviewDecision||e.push({key:"review",type:"review",icon:(0,d.jsxs)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,d.jsx)("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75"})]}),label:"needs review",url:b.url,actionLabel:"Ask to post",actionMessage:`Post ${b.url} on slack asking for a review.`}),k&&e.push({key:"conflict",type:"conflict",icon:"⚠",label:"merge conflict",url:b.url,notified:"true"===c.lastMergeConflictDispatched,actionLabel:"Ask to fix",actionMessage:`Please resolve the merge conflicts on ${b.url} by rebasing on the base branch`}),b.unresolvedThreads>0){let a=b.unresolvedComments[0]?.url??b.url+"/files";e.push({key:"comments",type:"comment",icon:"\uD83D\uDCAC",label:"unresolved comments",count:b.unresolvedThreads,url:a,actionLabel:"Ask to resolve",actionMessage:`Please address all unresolved review comments on ${b.url}`})}return e}(a),P=!M&&I?.mergeability.mergeable&&"open"===I.state,Q=(0,j.nH)(a),R=(0,j.wy)(a),S=(0,l.Pn)(a),T=(h=a,i=H,P||"merge"===i?"mergeable":h.lifecycle?.sessionState==="detecting"?"detecting":"respond"===i?(0,j.Ou)(h):h.lifecycle?.prReason==="ci_failing"||"ci_failed"===h.status?"ci failing":"review"===i?(0,j.of)(h):(0,j.Ou)(h)),U=M||!I||N?[]:I.ciChecks.filter(a=>"passed"===a.status).slice(0,3),V=(0,j.dG)(a)||"done"===H,W=a.lifecycle?`Session ${(0,j.Ou)(a)} \xb7 PR ${(0,j.of)(a)} \xb7 Runtime ${(0,j.Kw)(a)}`:null,X=a.issueLabel?`${a.issueLabel}${a.issueTitle?` \xb7 ${a.issueTitle}`:""}`:a.issueTitle??(a.summary&&a.summary!==S?a.summary:null),Y=P?"session-card--merge-frame":O.length>0?"session-card--alert-frame":"session-card--fixed",Z=P?"session-card--accent-merge":"working"===H?"session-card--accent-working":"respond"===H?"session-card--accent-respond":"review"===H||"pending"===H?"session-card--accent-attention":"session-card--accent-default";if(V){let b=function(a){let b=a.activity,c=a.status,e=a.lifecycle?.prState??a.pr?.state;return"merged"===e||"merged"===c?{label:"merged",pillClass:"done-status-pill--merged",icon:(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",className:"h-3 w-3",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})})}:"closed"===e?{label:"closed",pillClass:"done-status-pill--exited",icon:(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M9 12h6"})]})}:a.lifecycle?.sessionState==="terminated"||"killed"===c||"terminated"===c?{label:(0,j.Ou)(a),pillClass:"done-status-pill--killed",icon:(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",className:"h-3 w-3",children:(0,d.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})}:{label:"exited"===b?"exited":(0,j.Ou)(a),pillClass:"done-status-pill--exited",icon:(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,d.jsx)("path",{d:"M9 12h6"})]})}}(a);return(0,d.jsxs)("div",{className:(0,k.cn)("session-card-done",q&&"done-expanded"),onClick:a=>{a.target.closest("a, button, textarea")||r(!q)},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-3 pb-1.5",children:[(0,d.jsxs)("span",{className:(0,k.cn)("done-status-pill",b.pillClass),children:[b.icon,b.label]}),(0,d.jsx)("span",{className:"font-[var(--font-mono)] text-[10px] tracking-wide text-[var(--color-text-muted)]",children:a.id}),(0,d.jsx)("div",{className:"flex-1"}),R&&(0,d.jsxs)("button",{onClick:b=>{b.stopPropagation(),g?.(a.id)},className:"done-restore-btn",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-3 w-3",children:[(0,d.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,d.jsx)("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),"restore"]})]}),(0,d.jsx)("div",{className:"px-3.5 pb-2",children:(0,d.jsx)("p",{className:"session-card-done__title text-[13px] font-semibold leading-snug [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden",children:S})}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 px-3.5 pb-3",children:[a.branch&&(0,d.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",className:"h-2.5 w-2.5 opacity-50",children:[(0,d.jsx)("path",{d:"M6 3v12M18 9a3 3 0 0 1-3 3H9a3 3 0 0 0-3 3"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"3"})]}),a.branch]}),I&&(0,d.jsxs)("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"done-meta-chip font-[var(--font-mono)] font-bold text-[var(--color-text-primary)] no-underline underline-offset-2 hover:underline",children:["#",I.number]}),I&&!M&&(N?(0,d.jsx)("span",{className:"inline-block h-[14px] w-16 animate-pulse rounded-full bg-[var(--color-bg-subtle)]"}):(0,d.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,d.jsxs)("span",{className:"text-[var(--color-status-ready)]",children:["+",I.additions]})," ",(0,d.jsxs)("span",{className:"text-[var(--color-status-error)]",children:["-",I.deletions]})," ",(0,n.i_)(I.additions,I.deletions),(0,d.jsx)("span",{className:"sr-only",children:`+${I.additions} -${I.deletions} ${(0,n.i_)(I.additions,I.deletions)}`})]})),(0,d.jsx)("a",{href:(0,o.Nc)(a.projectId,a.id),onClick:a=>a.stopPropagation(),className:"done-meta-chip font-[var(--font-mono)] font-semibold text-[var(--color-accent)] no-underline hover:underline",children:"View current context"})]}),q&&(0,d.jsxs)("div",{className:"done-expand-section px-3.5 py-3",children:[a.summary&&I?.title&&a.summary!==I.title&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("div",{className:"done-detail-heading",children:[(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M4 6h16M4 12h16M4 18h10"})}),"Summary"]}),(0,d.jsx)("p",{className:"text-[12px] leading-relaxed text-[var(--color-text-secondary)]",children:a.summary})]}),a.issueUrl&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("div",{className:"done-detail-heading",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),"Issue"]}),(0,d.jsxs)("a",{href:a.issueUrl,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"text-[12px] text-[var(--color-accent)] hover:underline",children:[a.issueLabel||a.issueUrl,a.issueTitle&&`: ${a.issueTitle}`]})]}),I&&I.ciChecks.length>0&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("div",{className:"done-detail-heading",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{d:"M9 12l2 2 4-4"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"})]}),"CI Checks"]}),(0,d.jsx)(m.zm,{checks:I.ciChecks})]}),I&&(0,d.jsxs)("div",{className:"mb-3",children:[(0,d.jsxs)("div",{className:"done-detail-heading",children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65S8.93 17.38 9 18v4"}),(0,d.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]}),"PR"]}),(0,d.jsxs)("p",{className:"text-[12px] text-[var(--color-text-secondary)]",children:[(0,d.jsx)("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"hover:underline",children:I.title}),N?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("br",{}),(0,d.jsxs)("span",{className:"mt-1 inline-flex items-center gap-2 text-[10px] text-[var(--color-text-muted)]",children:[(0,d.jsx)("span",{className:"inline-block h-3 w-12 animate-pulse rounded bg-[var(--color-bg-subtle)]"}),(0,d.jsx)("span",{children:"PR details loading..."})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("br",{}),(0,d.jsxs)("span",{className:"mt-1 inline-flex items-center gap-2",children:[(0,d.jsxs)("span",{className:"done-meta-chip font-[var(--font-mono)]",children:[(0,d.jsxs)("span",{className:"text-[var(--color-status-ready)]",children:["+",I.additions]})," ",(0,d.jsxs)("span",{className:"text-[var(--color-status-error)]",children:["-",I.deletions]})]}),(0,d.jsx)("span",{className:"text-[var(--color-text-muted)]",children:"\xb7"}),(0,d.jsxs)("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:["mergeable: ",I.mergeability.mergeable?"yes":"no"]}),(0,d.jsx)("span",{className:"text-[var(--color-text-muted)]",children:"\xb7"}),(0,d.jsxs)("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:["review: ",I.reviewDecision]})]})]})]})]}),!I&&(0,d.jsx)("p",{className:"text-[12px] text-[var(--color-text-tertiary)]",children:"No PR associated with this session."})]})]})}let $=Q?"exited":P||"merge"===H||"review"===H?"ready":"respond"===H?"waiting":"pending"===H?"idle":"working"===H?"working":"idle";return(0,d.jsxs)("div",{className:(0,k.cn)("session-card border",!G&&"kanban-card-enter",Y,Z,P&&"card-merge-ready"),children:[(0,d.jsxs)("div",{className:"session-card__header",children:[(0,d.jsx)("span",{className:(0,k.cn)("card__adot","working"===$&&"card__adot--working","ready"===$&&"card__adot--ready","idle"===$&&"card__adot--idle","waiting"===$&&"card__adot--waiting","exited"===$&&"card__adot--exited")}),(0,d.jsx)("span",{className:"card__id",children:a.id}),(0,d.jsx)("div",{className:"flex-1"}),R&&(0,d.jsxs)("button",{onClick:b=>{b.stopPropagation(),g?.(a.id)},className:"session-card__control session-card__restore-control",children:[(0,d.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{d:"M20 11a8 8 0 0 0-14.9-3.98"}),(0,d.jsx)("path",{d:"M4 5v4h4"}),(0,d.jsx)("path",{d:"M4 13a8 8 0 0 0 14.9 3.98"}),(0,d.jsx)("path",{d:"M20 19v-4h-4"})]}),"restore"]}),!Q&&(0,d.jsxs)("a",{href:(0,o.$l)(a.projectId,a.id,"#session-terminal-section"),onClick:a=>a.stopPropagation(),className:"session-card__control session-card__terminal-link",children:[(0,d.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),(0,d.jsx)("path",{d:"M6 10l4 2-4 2"}),(0,d.jsx)("path",{d:"M14 14h4"})]}),"terminal"]})]}),(0,d.jsxs)("div",{className:"session-card__body flex min-h-0 flex-1 flex-col",children:[(0,d.jsx)("div",{className:"card__title-wrap",children:(0,d.jsx)("p",{className:"card__title",children:S})}),(0,d.jsxs)("div",{className:"card__meta",children:[a.branch&&(0,d.jsx)("span",{className:"card__branch",children:a.branch}),a.branch&&I?(0,d.jsx)("span",{className:"card__meta-sep","aria-hidden":"true",children:"\xb7"}):null,I&&(0,d.jsxs)("a",{href:I.url,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),className:"card__pr",children:["#",I.number]}),I&&!M&&(N?(0,d.jsx)("span",{className:"inline-block h-[14px] w-16 animate-pulse rounded-full bg-[var(--color-bg-subtle)]"}):(0,d.jsxs)("span",{className:"card__diff inline-flex items-center",children:[(0,d.jsxs)("span",{className:"card__diff-add",children:["+",I.additions]})," ",(0,d.jsxs)("span",{className:"card__diff-del",children:["-",I.deletions]})," ",(0,d.jsx)("span",{className:"card__diff-size",children:(0,n.i_)(I.additions,I.deletions)}),(0,d.jsx)("span",{className:"sr-only",children:`+${I.additions} -${I.deletions} ${(0,n.i_)(I.additions,I.deletions)}`})]}))]}),X&&(0,d.jsx)("div",{className:"px-[10px] pb-[5px]",children:"merge"===H||P?(0,d.jsxs)("p",{className:"session-card__secondary session-card__secondary--merge",children:[(0,d.jsx)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})}),(0,d.jsx)("span",{children:X})]}):(0,d.jsx)("p",{className:"session-card__secondary",children:X})}),W&&(0,d.jsx)("div",{className:"px-[10px] pb-[5px]",children:(0,d.jsx)("p",{className:"text-[10px] leading-relaxed text-[var(--color-text-tertiary)]",children:W})}),M&&I?.state==="open"&&(0,d.jsx)("div",{className:"px-[10px] pb-[5px]",children:(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10px] text-[var(--color-text-muted)]",children:[(0,d.jsxs)("svg",{className:"h-3 w-3 text-[var(--color-text-tertiary)]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),"PR data rate limited"]})}),U.length>0&&(0,d.jsx)("div",{className:"card__ci",children:U.map(a=>{let b=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("svg",{width:"8",height:"8",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M20 6 9 17l-5-5"})}),a.name]});return a.url?(0,d.jsx)("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"ci-chip ci-chip--pass",onClick:a=>a.stopPropagation(),children:b},a.name):(0,d.jsx)("span",{className:"ci-chip ci-chip--pass",children:b},a.name)})}),!M&&O.length>0&&(0,d.jsx)("div",{className:"card__alerts flex flex-col",children:O.slice(0,3).map(a=>(0,d.jsxs)("div",{className:(0,k.cn)("alert-row",`alert-row--${a.type}`),children:[(0,d.jsx)("span",{className:"alert-row__icon",children:a.icon}),(0,d.jsxs)("span",{className:"alert-row__text",children:[(0,d.jsxs)("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",onClick:a=>a.stopPropagation(),children:[void 0!==a.count&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"font-bold",children:a.count})," "]}),a.label]}),a.notified&&(0,d.jsxs)("span",{className:"alert-row__notified",title:"Agent has been notified",children:[" ","\xb7 notified"]})]}),a.actionLabel&&(0,d.jsx)("button",{onClick:b=>{b.stopPropagation(),L(a.key,a.actionMessage??"")},disabled:s===a.key,className:"alert-row__action",children:s===a.key?"sent!":u===a.key?"failed":a.actionLabel})]},a.key))}),"respond"===H&&(0,d.jsxs)("div",{className:"quick-reply",onClick:a=>a.stopPropagation(),children:[a.summary&&!a.summaryIsFallback&&(0,d.jsxs)("div",{className:"card__agent-msg",children:[(0,d.jsx)("svg",{className:"card__agent-msg-icon",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),(0,d.jsx)("span",{children:a.summary})]}),(0,d.jsx)("a",{href:(0,o.Nc)(a.projectId,a.id),onClick:a=>a.stopPropagation(),className:"card__view-context",children:"View current context →"}),!Q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"card__presets",children:[(0,d.jsx)("button",{className:"card__preset",onClick:()=>void J("continue"),disabled:null!==w,children:"continue"===w?"Sending...":"continue"===y?"Sent":"Continue"}),(0,d.jsx)("button",{className:"card__preset",onClick:()=>void J("abort"),disabled:null!==w,children:"abort"===w?"Sending...":"abort"===y?"Sent":"Abort"}),(0,d.jsx)("button",{className:"card__preset",onClick:()=>void J("skip"),disabled:null!==w,children:"skip"===w?"Sending...":"skip"===y?"Sent":"Skip"})]}),(0,d.jsx)("div",{className:"card__reply-wrap",children:(0,d.jsx)("textarea",{className:"card__reply",placeholder:null!==w?"Sending...":"Type a reply... (Enter to send)","aria-label":"Type a reply to the agent",value:C,onChange:a=>D(a.target.value),onKeyDown:a=>{K(a)},rows:1,disabled:null!==w})})]})]}),(0,d.jsxs)("div",{className:"session-card__footer",children:[(0,d.jsx)("span",{className:"card__status min-w-0 truncate",title:a.userPrompt??void 0,children:!a.issueUrl&&a.userPrompt?a.userPrompt.length>60?a.userPrompt.slice(0,60)+"…":a.userPrompt:T}),P&&I?(0,d.jsxs)("button",{onClick:a=>{a.stopPropagation(),f?.(I.number)},className:"session-card__control session-card__merge-control",children:[(0,d.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"6",cy:"6",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"18",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"2"}),(0,d.jsx)("path",{d:"M8 6h5a3 3 0 0 1 3 3v7"})]}),"Merge PR #",I.number]}):!Q&&(0,d.jsx)("button",{onClick:b=>{if(b.stopPropagation(),!A)return void B(!0);B(!1),c?.(a.id)},onMouseLeave:()=>B(!1),onBlur:()=>B(!1),"aria-label":A?"Confirm terminate session":"Terminate session",className:(0,k.cn)("session-card__control session-card__terminate btn--danger",A&&"is-confirming"),children:A?(0,d.jsx)("span",{className:"font-mono text-[10px] font-semibold tracking-[0.04em]",children:"kill?"}):(0,d.jsxs)("svg",{className:"session-card__control-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("path",{d:"M3 6h18"}),(0,d.jsx)("path",{d:"M8 6V4h8v2"}),(0,d.jsx)("path",{d:"M19 6l-1 14H6L5 6"})]})})]})]})]})},function(a,b){return a.session===b.session&&a.onSend===b.onSend&&a.onKill===b.onKill&&a.onMerge===b.onMerge&&a.onRestore===b.onRestore}),r={merge:{label:"Ready",emptyMessage:"Nothing cleared to land yet."},action:{label:"Action",emptyMessage:"No agents need your input."},respond:{label:"Respond",emptyMessage:"No agents need your input."},review:{label:"Review",emptyMessage:"No code waiting for review."},pending:{label:"Pending",emptyMessage:"Nothing blocked."},working:{label:"Working",emptyMessage:"No agents running."},done:{label:"Done",emptyMessage:"No completed sessions."}},s=(0,e.memo)(function({level:a,sessions:b,onSend:c,onKill:f,onMerge:g,onRestore:h,collapsed:i,onToggle:j,compactMobile:k,onPreview:l,resetKey:m}){let n=r[a],o=void 0!==j,[p,s]=(0,e.useState)(!1),u=o&&k&&!p?b.slice(0,5):b,v=b.length-u.length;return o?(0,d.jsxs)("div",{className:`accordion-section${i?" accordion-section--collapsed":" accordion-section--expanded"}`,"data-level":a,children:[(0,d.jsxs)("button",{type:"button",className:"accordion-header",onClick:()=>j(a),"aria-expanded":!i,"aria-controls":`accordion-body-${a}`,children:[(0,d.jsx)("span",{className:"accordion-header__dot","data-level":a}),(0,d.jsx)("span",{className:"accordion-header__label",children:n.label}),(0,d.jsx)("span",{className:"accordion-header__count",children:b.length}),(0,d.jsx)("span",{className:"accordion-header__chevron","aria-hidden":"true",children:"▶"})]}),(0,d.jsx)("div",{id:`accordion-body-${a}`,className:"accordion-body",children:b.length>0?(0,d.jsxs)("div",{className:k?"mobile-session-list":"flex flex-col gap-2 p-3",children:[u.map(b=>k?(0,d.jsx)(t,{session:b,level:a,onPreview:l},b.id):(0,d.jsx)(q,{session:b,onSend:c,onKill:f,onMerge:g,onRestore:h},b.id)),k&&v>0?(0,d.jsxs)("button",{type:"button",className:"mobile-session-list__view-all",onClick:()=>s(!0),children:["View all ",b.length]}):null]}):k?(0,d.jsx)("div",{className:"mobile-session-list",children:(0,d.jsx)("div",{className:"mobile-session-list__empty",children:n.emptyMessage})}):null})]}):(0,d.jsxs)("div",{className:"kanban-column","data-level":a,children:[(0,d.jsx)("div",{className:"kanban-column__header",children:(0,d.jsxs)("div",{className:"kanban-column__title-row",children:[(0,d.jsx)("div",{className:"kanban-column__dot","data-level":a}),(0,d.jsx)("span",{className:"kanban-column__title",children:n.label}),(0,d.jsx)("span",{className:"kanban-column__count",children:b.length})]})}),(0,d.jsx)("div",{className:"kanban-column-body",children:b.length>0?(0,d.jsx)("div",{className:"kanban-column__stack",children:b.map(a=>(0,d.jsx)(q,{session:a,onSend:c,onKill:f,onMerge:g,onRestore:h},a.id))}):null})]})},function(a,b){return a.level===b.level&&a.collapsed===b.collapsed&&a.onToggle===b.onToggle&&a.onSend===b.onSend&&a.onKill===b.onKill&&a.onMerge===b.onMerge&&a.onRestore===b.onRestore&&a.compactMobile===b.compactMobile&&a.onPreview===b.onPreview&&a.resetKey===b.resetKey&&a.sessions.length===b.sessions.length&&a.sessions.every((a,c)=>a===b.sessions[c])});function t({session:a,level:b,onPreview:c}){let e=[a.branch,a.pr?`PR #${a.pr.number}`:null,a.issueLabel].filter(Boolean);return(0,d.jsxs)("div",{className:"mobile-session-row",children:[(0,d.jsxs)("button",{type:"button",className:"mobile-session-row__preview",onClick:()=>c?.(a),"aria-label":`Open ${(0,l.Pn)(a)}`,children:[(0,d.jsxs)("div",{className:"mobile-session-row__line",children:[(0,d.jsx)("span",{className:"mobile-session-row__dot","data-level":b,"aria-hidden":"true"}),(0,d.jsx)("span",{className:"mobile-session-row__title",children:(0,l.Pn)(a)})]}),(0,d.jsx)("div",{className:"mobile-session-row__meta",children:e.length>0?e.join(" \xb7 "):"No branch or PR metadata"})]}),(0,d.jsxs)("div",{className:"mobile-session-row__side",children:[(0,d.jsx)(u,{session:a,level:b}),(0,d.jsx)("a",{href:(0,o.Nc)(a.projectId,a.id),className:"mobile-session-row__open","aria-label":`Go to ${(0,l.Pn)(a)}`,children:(0,d.jsxs)("svg",{className:"mobile-session-row__open-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M4 17V7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2Z"}),(0,d.jsx)("path",{d:"m8 10 2 2-2 2M12 14h4"})]})})]})]})}function u({session:a,level:b}){let c=r[b].label.toLowerCase();if("merge"===b&&a.pr&&(0,j.QN)(a.pr))c="ready";else if("action"===b)c="needs_input"===a.status?"needs input":"stuck"===a.status?"stuck":"errored"===a.status?"errored":"waiting_input"===a.activity?"waiting":"exited"===a.activity?"crashed":"blocked"===a.activity?"blocked":"ci_failed"===a.status?"ci failed":"changes_requested"===a.status?"changes":a.pr?.ciStatus==="failing"?"ci failed":a.pr?.reviewDecision==="changes_requested"?"changes":a.pr&&!a.pr.mergeability.noConflicts?"conflicts":"action";else"respond"===b?c="waiting_input"===a.activity?"waiting":"needs input":"review"===b?c=a.pr?.reviewDecision==="changes_requested"?"changes":"review":"pending"===b?c=a.pr?.unresolvedThreads?"threads":"pending":"working"===b&&(c="idle"===a.activity?"idle":"active");return(0,d.jsx)("span",{className:"mobile-session-row__chip",children:c})}var v=c(18768),w=c(20057),x=c(58976),y=c(31849);let z=["Working","Pending","Review","Respond","Merge"];function A({message:a,orchestratorHref:b,onSpawnOrchestrator:c=null,spawnLabel:e="Spawn Orchestrator",spawnDisabled:f=!1}){return(0,d.jsxs)("div",{className:"board-wrapper",children:[(0,d.jsx)("div",{className:"kanban-ghost","aria-hidden":"true",children:z.map(a=>(0,d.jsx)("div",{className:"kanban-ghost__col",children:(0,d.jsx)("div",{className:"kanban-ghost__head",children:a})},a))}),(0,d.jsx)("div",{className:"board-center",children:(0,d.jsxs)("div",{className:"empty-state",role:"status",children:[(0,d.jsx)("div",{className:"empty-state__icon",children:(0,d.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5.5",r:"2.5",fill:"rgba(249,115,22,0.18)",stroke:"#f97316",strokeWidth:"1.5"}),(0,d.jsx)("circle",{cx:"5.5",cy:"17",r:"2.5",fill:"var(--color-bg-subtle)",stroke:"var(--color-border-strong)",strokeWidth:"1.5"}),(0,d.jsx)("circle",{cx:"18.5",cy:"17",r:"2.5",fill:"var(--color-bg-subtle)",stroke:"var(--color-border-strong)",strokeWidth:"1.5"}),(0,d.jsx)("line",{x1:"12",y1:"8",x2:"6.7",y2:"14.8",stroke:"rgba(249,115,22,0.22)",strokeWidth:"1",strokeDasharray:"2.5 2"}),(0,d.jsx)("line",{x1:"12",y1:"8",x2:"17.3",y2:"14.8",stroke:"rgba(249,115,22,0.22)",strokeWidth:"1",strokeDasharray:"2.5 2"}),(0,d.jsx)("line",{x1:"7.8",y1:"17",x2:"16.2",y2:"17",stroke:"var(--color-border-subtle)",strokeWidth:"1",strokeDasharray:"2.5 2"})]})}),a?(0,d.jsx)("p",{className:"empty-state__text",children:a}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"empty-state__headline",children:"Ready to orchestrate"}),(0,d.jsx)("p",{className:"empty-state__hint",children:"Open the main orchestrator to start a session and fan out parallel agents across your codebase."}),b?(0,d.jsxs)("a",{href:b,className:"empty-state__cta",children:[(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,d.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),"Open Orchestrator"]}):c?(0,d.jsxs)("button",{type:"button",className:"empty-state__cta",onClick:c,disabled:f,children:[(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,d.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),e]}):null]})]})})]})}var B=c(71276);function C({status:a}){return"connected"===a?null:"disconnected"===a?(0,d.jsx)("button",{type:"button",className:"connection-bar connection-bar--disconnected","aria-live":"assertive","aria-atomic":"true",onClick:()=>window.location.reload(),children:"Offline \xb7 tap to retry"}):(0,d.jsx)("div",{className:"connection-bar connection-bar--reconnecting",role:"status","aria-live":"polite","aria-atomic":"true",children:"Reconnecting…"})}let D=[/\bBearer\s+[A-Za-z0-9._\-+/=]+\b/gi,/\bsk-[A-Za-z0-9]{10,}\b/g,/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g];function E({projectId:a}){let{showToast:b}=(0,B.d)(),[c,f]=(0,e.useState)(!1),g=(0,e.useCallback)(async()=>{if(!c){f(!0);try{let c,d=await fetch("/api/observability",{credentials:"same-origin"});if(!d.ok)return void b("Could not fetch observability snapshot","error");let e=d.headers.get("x-correlation-id");try{c=await d.json()}catch{b("Could not parse observability snapshot","error");return}let f=function a(b,c=new WeakSet){if("string"==typeof b)return D.reduce((a,b)=>a.replace(b,"[REDACTED]"),b);if(Array.isArray(b))return b.map(b=>a(b,c));if(b&&"object"==typeof b){if(c.has(b))return"[Circular]";c.add(b);let d={};for(let[e,f]of Object.entries(b))d[e]=a(f,c);return d}return b}(function(a,b){if(!b||!a||"object"!=typeof a)return a;let c={...a},d=c.projects;if(d&&"object"==typeof d&&!Array.isArray(d)){let a=d[b];c.projects=void 0===a?{}:{[b]:a}}return c}(c,a)),g={copiedAt:new Date().toISOString(),pageHref:`${window.location.origin}${window.location.pathname}`,projectId:a??null,correlationId:e,userAgent:navigator.userAgent,observability:f};await navigator.clipboard.writeText(JSON.stringify(g,null,2)),b("Debug bundle copied to clipboard","success")}catch{b("Could not copy debug bundle","error")}finally{f(!1)}}},[c,a,b]);return(0,d.jsxs)("button",{type:"button",className:"orchestrator-btn flex min-h-[44px] min-w-[44px] items-center gap-2 px-4 py-2 text-[12px] font-semibold text-[var(--color-text-secondary)] transition-colors hover:bg-[var(--color-bg-hover)] disabled:opacity-50",onClick:()=>void g(),disabled:c,"aria-label":"Copy debug bundle for issue reports",children:[(0,d.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy debug info"]})}var F=c(70162);let G=["working","pending","action","merge"],H=["working","pending","review","respond","merge"],I=[];function J({session:a,onRestore:b}){let c=!a.summaryIsFallback&&a.summary||a.issueTitle||a.summary||a.id,e=a.pr?.state==="merged"||"merged"===a.status,f="killed"===a.status||"terminated"===a.status,g=!j.N_.has(a.status),h=`done-card__badge ${f?"done-card__badge--terminated":"done-card__badge--merged"}`;return(0,d.jsxs)("div",{className:"done-card",children:[(0,d.jsx)("p",{className:"done-card__title",children:c}),(0,d.jsxs)("div",{className:"done-card__meta",children:[(0,d.jsx)("span",{className:h,children:e?"merged":f?"terminated":"done"}),a.pr?(0,d.jsxs)("a",{href:a.pr.url,target:"_blank",rel:"noopener noreferrer",className:"done-card__pr",onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("svg",{width:"9",height:"9",fill:"none",stroke:"currentColor",strokeWidth:"1.8",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"18",cy:"18",r:"3"}),(0,d.jsx)("circle",{cx:"6",cy:"6",r:"3"}),(0,d.jsx)("path",{d:"M6 9v3a6 6 0 0 0 6 6h3"})]}),"#",a.pr.number]}):null,(0,d.jsx)("span",{className:"done-card__age",children:function(a){if(!a)return"just now";let b=new Date(a).getTime();if(!Number.isFinite(b))return"just now";let c=Date.now()-b;if(c<=0)return"just now";let d=Math.floor(c/1e3),e=Math.floor(d/60),f=Math.floor(e/60),g=Math.floor(f/24);return d<60?`${d}s ago`:e<60?`${e}m ago`:f<24?`${f}h ago`:`${g}d ago`}(a.lastActivityAt)}),g?(0,d.jsx)("button",{type:"button",className:"done-card__restore",onClick:c=>{c.stopPropagation(),b(a.id)},children:"Restore"}):null]})]})}function K({initialSessions:a,projectId:b,projectName:c,projects:f=[],orchestrators:k,attentionZones:l="simple",dashboardLoadError:m}){let n=(0,x.eT)(),p="detailed"===l?H:G,q=(0,e.useMemo)(()=>{let b={};for(let c of a)b[c.id]=(0,j.ng)(c,l);return b},[a,l]),{sessions:r,attentionLevels:t,liveSessionsResolved:u,loadError:z}=(0,w.D)({initialSessions:a,muxSessions:n?.status==="connected"?n.sessions:void 0,muxLastError:n?.lastError,initialAttentionLevels:q,attentionZones:l}),D=(0,e.useMemo)(()=>b?r.filter(a=>a.projectId===b):r,[r,b]),K=n?.status==="disconnected"?"disconnected":n?.status==="connected"?"connected":"reconnecting",L=z??(m&&u?void 0:m),N=(0,h.useSearchParams)(),O=(0,h.useRouter)(),P=(0,e.useRef)(O);P.current=O;let Q=N.get("session")??void 0,[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(k??I),[V,W]=(0,e.useState)([]),[X,Y]=(0,e.useState)({}),[Z,$]=(0,e.useState)(!1),[_,aa]=(0,e.useState)(!1),ab=(0,i.U)(i.D),ac=N.get("debug"),{showToast:ad}=(0,B.d)(),[ae,af]=(0,e.useState)(!1),ag=(0,e.useRef)(r);ag.current=r;let ah=f.length>1&&void 0===b,ai=(0,e.useMemo)(()=>b?T.find(a=>a.projectId===b)??null:null,[T,b]),aj=ai?(0,o.Nc)(ai.projectId,ai.id):null,ak=!ah&&!!b&&f.some(a=>a.id===b&&!a.resolveError)&&!aj,al=b?f.find(a=>a.id===b)??null:null,am=!!b&&V.includes(b),an=b?X[b]??null:null,ao=(0,e.useMemo)(()=>ah||!Q?D:D.filter(a=>a.id===Q),[D,ah,Q]),ap=(0,e.useMemo)(()=>{let a={merge:[],action:[],respond:[],review:[],pending:[],working:[],done:[]};for(let b of ao)a[(0,j.ng)(b,l)].push(b);return a},[ao,l]),aq=(0,e.useMemo)(()=>{let a=new Map;for(let b of r){let c=a.get(b.projectId);if(c){c.push(b);continue}a.set(b.projectId,[b])}return a},[r]),ar=(0,e.useMemo)(()=>ah?f.map(a=>{let b=aq.get(a.id)??[],c={merge:0,action:0,respond:0,review:0,pending:0,working:0,done:0};for(let a of b)c[(0,j.ng)(a,l)]++;return{project:a,orchestrator:T.find(b=>b.projectId===a.id)??null,sessionCount:b.length,openPRCount:b.filter(a=>a.pr?.state==="open").length,counts:c}}):[],[T,ah,l,f,aq]),as=(0,e.useCallback)(async(a,b)=>{try{let c=await fetch(`/api/sessions/${encodeURIComponent(a)}/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:b})});if(!c.ok){let b=await c.text()||"Unknown error";console.error(`Failed to send message to ${a}:`,b),ad(`Send failed: ${b}`,"error");let d=Error(b);throw d.toastShown=!0,d}}catch(b){throw b instanceof Error&&"toastShown"in b&&b.toastShown||(console.error(`Network error sending message to ${a}:`,b),ad("Network error while sending message","error")),b}},[ad]),at=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a)}/kill`,{method:"POST"});if(b.ok)ad("Session terminated","success");else{let c=await b.text();console.error(`Failed to kill ${a}:`,c),ad(`Terminate failed: ${c}`,"error")}}catch(b){console.error(`Network error killing ${a}:`,b),ad("Network error while terminating session","error")}},[ad]),au=(0,e.useCallback)(a=>{let b=ag.current.find(b=>b.id===a)??null;b&&at(b.id)},[at]),av=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/prs/${a}/merge`,{method:"POST"});if(b.ok)ad(`PR #${a} merged`,"success");else{let c=await b.text();console.error(`Failed to merge PR #${a}:`,c),ad(`Merge failed: ${c}`,"error");return}}catch(b){console.error(`Network error merging PR #${a}:`,b),ad("Network error while merging PR","error")}},[ad]),aw=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a)}/restore`,{method:"POST"});if(b.ok)ad("Session restored","success"),P.current.refresh();else{let c=await b.text();console.error(`Failed to restore ${a}:`,c),ad(`Restore failed: ${c}`,"error")}}catch(b){console.error(`Network error restoring ${a}:`,b),ad("Network error while restoring session","error")}},[ad]),ax=async a=>{W(b=>b.includes(a.id)?b:[...b,a.id]),Y(({[a.id]:b,...c})=>c);try{let b=await fetch("/api/orchestrators",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:a.id})}),c=await b.json().catch(()=>null);if(!b.ok||!c?.orchestrator)throw Error(c?.error??`Failed to spawn orchestrator for ${a.name}`);let d=c.orchestrator;U(b=>{let c=b.filter(b=>b.projectId!==a.id);return c.push(d),c})}catch(c){let b=c instanceof Error?c.message:"Failed to spawn orchestrator";Y(c=>({...c,[a.id]:b})),console.error(`Failed to spawn orchestrator for ${a.id}:`,c)}finally{W(b=>b.filter(b=>b!==a.id))}},ay=p.some(a=>ap[a].length>0),az=!ah&&!ay&&!L,aA=L?(0,d.jsxs)("div",{className:"dashboard-alert mb-6 flex flex-col gap-1.5 border border-[color-mix(in_srgb,var(--color-status-error)_28%,transparent)] bg-[color-mix(in_srgb,var(--color-status-error)_10%,transparent)] px-3.5 py-2.5 text-[11px] md:mb-4",role:"alert","aria-live":"assertive",children:[(0,d.jsx)("span",{className:"font-semibold text-[var(--color-status-error)]",children:"Orchestrator failed to load"}),(0,d.jsx)("span",{className:"break-words text-[var(--color-text-secondary)]",children:L}),(0,d.jsxs)("span",{className:"text-[var(--color-text-secondary)]",children:["Confirm ",(0,d.jsx)("span",{className:"font-mono text-[10px]",children:"agent-orchestrator.yaml"})," exists and is valid, then run ",(0,d.jsx)("span",{className:"font-mono text-[10px]",children:"ao doctor"})," for diagnostics."]})]}):null,aB=(0,e.useMemo)(()=>r.some(a=>a.pr&&(0,j.fZ)(a.pr)),[r]),aC="agent orchestrator"===c?.trim().toLowerCase()?b??c??(ah?"All projects":"Dashboard"):c??(ah?"All projects":"Dashboard"),aD=!ah&&aC.trim().length>0,aE=()=>{$(a=>!a)};return(0,d.jsx)(F.I.Provider,{value:{onToggleSidebar:aE,mobileSidebarOpen:_},children:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(C,{status:K}),(0,d.jsxs)("div",{className:"dashboard-app-shell",children:[(0,d.jsxs)("header",{className:"dashboard-app-header",children:[(0,d.jsx)("button",{type:"button",className:"dashboard-app-sidebar-toggle",onClick:aE,"aria-label":"Toggle sidebar",children:ab?(0,d.jsx)("svg",{width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"})}):(0,d.jsxs)("svg",{width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,d.jsx)("path",{d:"M9 3v18"})]})}),(0,d.jsxs)("div",{className:"dashboard-app-header__brand",children:[(0,d.jsx)("span",{className:"dashboard-app-header__brand-dot","aria-hidden":"true"}),(0,d.jsx)("span",{children:"Agent Orchestrator"})]}),aD?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"dashboard-app-header__sep","aria-hidden":"true"}),(0,d.jsx)("span",{className:"dashboard-app-header__project",children:aC})]}):null,ab||"1"!==ac&&"true"!==ac?null:(0,d.jsx)(E,{projectId:b}),(0,d.jsx)("div",{className:"dashboard-app-header__spacer"}),(0,d.jsx)("div",{className:"dashboard-app-header__actions",children:!ah&&aj?(0,d.jsxs)(g(),{href:aj,className:"dashboard-app-btn dashboard-app-btn--amber","aria-label":"Orchestrator",children:[(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,d.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),"Orchestrator"]}):ak&&al?(0,d.jsxs)("button",{type:"button",className:"dashboard-app-btn dashboard-app-btn--amber","aria-label":"Spawn Orchestrator",onClick:()=>void ax(al),disabled:am,children:[(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.6",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"2",fill:"currentColor",stroke:"none"}),(0,d.jsx)("path",{d:"M12 7v4M12 11H6M12 11h6M6 11v3M12 11v3M18 11v3"}),(0,d.jsx)("circle",{cx:"6",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"12",cy:"17",r:"2"}),(0,d.jsx)("circle",{cx:"18",cy:"17",r:"2"})]}),am?"Spawning...":"Spawn Orchestrator"]}):null})]}),(0,d.jsxs)("div",{className:`dashboard-shell dashboard-shell--desktop${Z?" dashboard-shell--sidebar-collapsed":""}`,children:[(0,d.jsx)("div",{className:`sidebar-wrapper${_?" sidebar-wrapper--mobile-open":""}`,children:(0,d.jsx)(y.u,{projects:f,sessions:r,orchestrators:T,activeProjectId:b,activeSessionId:Q,collapsed:Z,onToggleCollapsed:()=>$(a=>!a),onMobileClose:()=>aa(!1)})}),_&&(0,d.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:()=>aa(!1)}),(0,d.jsxs)("main",{className:"dashboard-main dashboard-main--desktop",children:[(0,d.jsx)(v.u,{attentionLevels:t,projectName:c}),(0,d.jsxs)("div",{className:"dashboard-main__subhead",children:[(0,d.jsx)("h1",{className:"dashboard-main__title",children:"Dashboard"}),(0,d.jsx)("p",{className:"dashboard-main__subtitle",children:"Live agent sessions, pull requests, and merge status."})]}),(0,d.jsxs)("div",{className:"dashboard-main__body",children:[aA,aB&&!R&&(0,d.jsxs)("div",{className:"dashboard-alert mb-4 flex items-center gap-2.5 border border-[color-mix(in_srgb,var(--color-status-attention)_25%,transparent)] bg-[var(--color-tint-yellow)] px-3.5 py-2.5 text-[11px] text-[var(--color-status-attention)]",children:[(0,d.jsxs)("svg",{className:"h-3.5 w-3.5 shrink-0",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("path",{d:"M12 8v4M12 16h.01"})]}),(0,d.jsx)("span",{className:"flex-1",children:"GitHub API rate limited — PR data (CI status, review state, sizes) may be stale. Will retry automatically on next refresh."}),(0,d.jsx)("button",{onClick:()=>S(!0),className:"ml-1 shrink-0 opacity-60 hover:opacity-100","aria-label":"Dismiss",children:(0,d.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),ah&&(0,d.jsx)(M,{overviews:ar,onSpawnOrchestrator:ax,spawningProjectIds:V,spawnErrors:X,attentionZones:l}),!ah&&ay&&(0,d.jsx)("div",{className:"kanban-board-wrap",children:(0,d.jsx)("div",{className:"kanban-board","data-columns":p.length,style:{"--kanban-column-count":p.length},children:p.map(a=>(0,d.jsx)(s,{level:a,sessions:ap[a],onSend:as,onKill:au,onMerge:av,onRestore:aw},a))})}),az?(0,d.jsx)(A,{orchestratorHref:aj,onSpawnOrchestrator:ak&&al?()=>{ax(al)}:null,spawnLabel:am?"Spawning...":"Spawn Orchestrator",spawnDisabled:am}):null,!ah&&an?(0,d.jsx)("p",{className:"mt-3 text-[11px] text-[var(--color-status-error)]",children:an}):null,!ah&&ap.done.length>0&&(0,d.jsxs)("div",{className:"done-bar mt-6",children:[(0,d.jsxs)("button",{type:"button",className:"done-bar__toggle",onClick:()=>af(a=>!a),"aria-expanded":ae,children:[(0,d.jsx)("svg",{className:`done-bar__chevron${ae?" done-bar__chevron--open":""}`,fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"m9 18 6-6-6-6"})}),(0,d.jsx)("span",{className:"done-bar__label",children:"Done / Terminated"}),(0,d.jsx)("span",{className:"done-bar__count",children:ap.done.length})]}),ae&&(0,d.jsx)("div",{className:"done-bar__cards",children:ap.done.map(a=>(0,d.jsx)(J,{session:a,onRestore:aw},a.id))})]})]})]})]})]})]})})}function L(a){return(0,d.jsx)(B.t,{children:(0,d.jsx)(K,{...a})})}function M({overviews:a,onSpawnOrchestrator:b,spawningProjectIds:c,spawnErrors:e,attentionZones:f}){return(0,d.jsx)("div",{className:"mb-8 grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:a.map(({project:a,orchestrator:h,sessionCount:i,openPRCount:j,counts:k})=>(()=>{let l=!!a.resolveError,m=(0,o.bn)(a.id);return(0,d.jsxs)("section",{className:"border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] p-4",children:[(0,d.jsxs)("div",{className:"mb-4 flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h2",{className:"text-[14px] font-semibold text-[var(--color-text-primary)]",children:a.name}),(0,d.jsx)("div",{className:"mt-1 text-[11px] text-[var(--color-text-muted)]",children:l?"Config needs repair":(0,d.jsxs)(d.Fragment,{children:[i," active session",1!==i?"s":"",j>0?` \xb7 ${j} open PR${1!==j?"s":""}`:""]})})]}),(0,d.jsx)(g(),{href:m,className:"border border-[var(--color-border-default)] px-3 py-1.5 text-[11px] font-medium text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] hover:no-underline",children:"Open project"})]}),(0,d.jsxs)("div",{className:"mb-4 flex flex-wrap gap-2",children:[(0,d.jsx)(N,{label:"Merge",value:k.merge,tone:"ready"}),"detailed"===f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(N,{label:"Respond",value:k.respond,tone:"error"}),(0,d.jsx)(N,{label:"Review",value:k.review,tone:"orange"})]}):(0,d.jsx)(N,{label:"Action",value:k.action,tone:"orange"}),(0,d.jsx)(N,{label:"Pending",value:k.pending,tone:"attention"}),(0,d.jsx)(N,{label:"Working",value:k.working,tone:"working"})]}),(0,d.jsxs)("div",{className:"border-t border-[var(--color-border-subtle)] pt-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{className:"text-[11px] text-[var(--color-text-muted)]",children:l?"Project config could not be resolved":h?"Per-project orchestrator available":"No running orchestrator"}),l?(0,d.jsx)(g(),{href:m,className:"border border-[var(--color-border-default)] px-3 py-1.5 text-[11px] font-semibold text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)] hover:no-underline",children:"Repair project"}):h?(0,d.jsxs)(g(),{href:(0,o.Nc)(h.projectId,h.id),className:"orchestrator-btn flex items-center gap-2 px-3 py-1.5 text-[11px] font-semibold hover:no-underline",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-[var(--color-accent)] opacity-80"}),"orchestrator"]}):(0,d.jsx)("button",{type:"button",onClick:()=>void b(a),disabled:c.includes(a.id),className:"orchestrator-btn px-3 py-1.5 text-[11px] font-semibold disabled:cursor-wait disabled:opacity-70",children:c.includes(a.id)?"Spawning...":"Spawn Orchestrator"})]}),e[a.id]?(0,d.jsx)("p",{className:"mt-2 text-[11px] text-[var(--color-status-error)]",children:e[a.id]}):null]})]},a.id)})())})}function N({label:a,value:b,tone:c}){return(0,d.jsxs)("div",{className:"min-w-[78px] border border-[var(--color-border-subtle)] px-2.5 py-2",children:[(0,d.jsx)("div",{className:"text-[10px] uppercase tracking-[0.08em] text-[var(--color-text-tertiary)]",children:a}),(0,d.jsx)("div",{className:"project-metric__value mt-1 text-[18px] font-semibold tabular-nums","data-tone":c,children:b})]})}},70162:(a,b,c)=>{c.d(b,{I:()=>d});let d=(0,c(81115).createContext)(null)}};
|