@aoagents/ao-web 0.6.0 → 0.7.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 +200 -186
- package/.next/app-path-routes-manifest.json +16 -14
- package/.next/build-manifest.json +6 -6
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +19 -19
- package/.next/react-loadable-manifest.json +5 -3
- package/.next/required-server-files.json +4 -5
- 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 +8 -8
- 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 +5 -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/update/route.js +1 -0
- package/.next/server/app/api/update/route.js.nft.json +1 -0
- package/.next/server/app/api/update/route_client-reference-manifest.js +1 -0
- 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/version/route.js +1 -0
- package/.next/server/app/api/version/route.js.nft.json +1 -0
- package/.next/server/app/api/version/route_client-reference-manifest.js +1 -0
- 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.js.nft.json +1 -1
- package/.next/server/app/apple-icon/route_client-reference-manifest.js +1 -1
- package/.next/server/app/apple-icon.body +0 -0
- 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 +9 -9
- package/.next/server/app/icon/route.js +1 -1
- package/.next/server/app/icon/route.js.nft.json +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/icon.body +0 -0
- package/.next/server/app/manifest.webmanifest/route.js +1 -1
- 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/manifest.webmanifest.body +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 +9 -9
- package/.next/server/app-paths-manifest.json +16 -14
- package/.next/server/chunks/1271.js +1 -1
- package/.next/server/chunks/1876.js +2 -2
- package/.next/server/chunks/303.js +3 -0
- package/.next/server/chunks/3714.js +1 -1
- package/.next/server/chunks/4520.js +1 -1
- package/.next/server/chunks/6013.js +884 -0
- package/.next/server/chunks/6848.js +1 -0
- package/.next/server/chunks/7167.js +1 -1
- package/.next/server/chunks/7173.js +1 -1
- package/.next/server/chunks/7227.js +604 -0
- 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/9nr0fNWbZcuWTqhM2HhrH/_buildManifest.js +1 -0
- package/.next/static/chunks/1654.ac304fc9e36ec94a.js +1 -0
- package/.next/static/chunks/3764.cdef4e76dbc23af8.js +1 -0
- package/.next/static/chunks/3780-7bdc52d8370adf2f.js +1 -0
- package/.next/static/chunks/{5795-b96fd46c8c7344fc.js → 5795-a4dd81606df09bc4.js} +1 -1
- package/.next/static/chunks/6231-57dd9c1e306c7069.js +1 -0
- package/.next/static/chunks/app/_not-found/page-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/backlog/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/browse-directory/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/filesystem/browse/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/issues/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/observability/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/orchestrators/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/projects/reload/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/projects/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/prs/[id]/merge/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/runtime/terminal/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/kill/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/message/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/remap/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/restore/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/send/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/sessions/patches/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/setup-labels/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/spawn/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/update/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/verify/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/version/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/api/webhooks/[...slug]/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/apple-icon/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/dev/terminal-test/{page-59decd1aad4e02ad.js → page-9aa423dfd54c8325.js} +1 -1
- package/.next/static/chunks/app/{error-684a1c5596fa1e14.js → error-65c526052680c0dc.js} +1 -1
- package/.next/static/chunks/app/{global-error-1a79bacfbd9b1ba4.js → global-error-63dcb797b2c3ee60.js} +1 -1
- package/.next/static/chunks/app/icon/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/icon-192/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/icon-512/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/layout-36ab0168ddb22083.js +1 -0
- package/.next/static/chunks/app/loading-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/manifest.webmanifest/route-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/not-found-a693bed1f9e1893f.js +1 -0
- package/.next/static/chunks/app/orchestrators/{page-e3a2c53b57dd8391.js → page-376a92db51deb112.js} +1 -1
- package/.next/static/chunks/app/page-587d546e62c0796f.js +1 -0
- package/.next/static/chunks/app/projects/[projectId]/loading-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/projects/[projectId]/page-bd8fc2a1decb649d.js +1 -0
- package/.next/static/chunks/app/projects/[projectId]/sessions/[id]/page-bd33f6ffda513080.js +1 -0
- package/.next/static/chunks/app/projects/[projectId]/settings/page-11facc471a63de50.js +1 -0
- package/.next/static/chunks/app/prs/page-f34f66ad51106080.js +1 -0
- package/.next/static/chunks/app/sessions/[id]/{error-62e9972b39d9cd16.js → error-df65e7b626bbb713.js} +1 -1
- package/.next/static/chunks/app/sessions/[id]/loading-8b5044bdc951ae98.js +1 -0
- package/.next/static/chunks/app/sessions/[id]/not-found-a693bed1f9e1893f.js +1 -0
- package/.next/static/chunks/app/sessions/[id]/page-3ea4aa79275ea449.js +1 -0
- package/.next/static/chunks/app/test-direct/page-edfc701a9300105b.js +1 -0
- package/.next/static/chunks/main-app-decbc53736801215.js +1 -0
- package/.next/static/chunks/{webpack-83d2d8248a30259c.js → webpack-ecf0988dbb79e19b.js} +1 -1
- package/.next/static/css/b93232cd4a58743d.css +1 -0
- package/dist-server/direct-terminal-ws.js +12 -2
- package/dist-server/mux-websocket.js +270 -70
- package/dist-server/start-all.js +28 -6
- package/dist-server/tmux-utils.js +124 -2
- package/next.config.js +26 -0
- package/package.json +26 -12
- package/.next/server/chunks/1172.js +0 -1
- package/.next/server/chunks/6811.js +0 -3
- package/.next/server/chunks/801.js +0 -658
- package/.next/server/chunks/9223.js +0 -440
- package/.next/static/chunks/1383.8f5f7d4606d356cc.js +0 -1
- package/.next/static/chunks/3764.88619fb0d047cae8.js +0 -1
- package/.next/static/chunks/3780-52c4733ce6591b8d.js +0 -1
- package/.next/static/chunks/4465-17154f7a01abfe85.js +0 -1
- package/.next/static/chunks/app/_not-found/page-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/backlog/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/browse-directory/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/filesystem/browse/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/issues/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/observability/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/orchestrators/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/projects/reload/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/projects/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/prs/[id]/merge/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/runtime/terminal/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/kill/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/message/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/remap/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/restore/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/send/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/sessions/patches/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/setup-labels/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/spawn/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/verify/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/api/webhooks/[...slug]/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/apple-icon/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/icon/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/icon-192/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/icon-512/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/layout-0cda720d75f111b8.js +0 -1
- package/.next/static/chunks/app/loading-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/not-found-315f4e5c106b425d.js +0 -1
- package/.next/static/chunks/app/page-e2e589ea11a0780a.js +0 -1
- package/.next/static/chunks/app/projects/[projectId]/loading-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/projects/[projectId]/page-19a6d4cc9951a9e4.js +0 -1
- package/.next/static/chunks/app/projects/[projectId]/sessions/[id]/page-75c536c9755754f7.js +0 -1
- package/.next/static/chunks/app/projects/[projectId]/settings/page-f8c323b91978efff.js +0 -1
- package/.next/static/chunks/app/prs/page-08f17d7dc341b6f1.js +0 -1
- package/.next/static/chunks/app/sessions/[id]/loading-3b8a01e726e988c8.js +0 -1
- package/.next/static/chunks/app/sessions/[id]/not-found-315f4e5c106b425d.js +0 -1
- package/.next/static/chunks/app/sessions/[id]/page-d0b08722dec5a04a.js +0 -1
- package/.next/static/chunks/app/test-direct/page-ee0944bcd355194e.js +0 -1
- package/.next/static/chunks/main-app-b95f197c38e3b0a3.js +0 -1
- package/.next/static/css/cf9226160e230bf4.css +0 -1
- package/.next/static/h0RXs0prE87a8wlbEXQKM/_buildManifest.js +0 -1
- /package/.next/static/{h0RXs0prE87a8wlbEXQKM → 9nr0fNWbZcuWTqhM2HhrH}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.id=6848,exports.ids=[6848],exports.modules={4022:(a,b,c)=>{c.d(b,{Dashboard:()=>Q});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…"})}function D(){let[a,b]=(0,e.useState)(null),[c,f]=(0,e.useState)("idle"),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(null),k=(0,e.useCallback)(()=>{if(a?.latest){try{window.localStorage.setItem("ao.updateBanner.dismissedFor",a.latest)}catch{}j(a.latest),f("idle"),h(null)}},[a]),l=(0,e.useCallback)(async()=>{f("starting"),h(null);try{let a=await fetch("/api/update",{method:"POST"}),b=await a.json();if(a.ok)return void f("started");if(409===a.status){f("blocked"),h(b.message);return}f("error"),h(b.message??"Update failed")}catch(a){f("error"),h(a instanceof Error?a.message:String(a))}},[]);if(!a||!a.isOutdated||!a.latest||"manual"===a.channel||i===a.latest&&"idle"===c||"started"===c)return null;let m="nightly"===a.channel?" (nightly)":"";return(0,d.jsxs)("div",{role:"status","aria-live":"polite",className:"flex w-full items-center justify-between gap-3 border-b border-[var(--color-border-default)] bg-[var(--color-accent-amber-dim)] px-4 py-2 text-sm text-[var(--color-text-primary)]",children:[(0,d.jsxs)("div",{className:"flex flex-1 items-center gap-3",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"inline-block h-2 w-2 flex-shrink-0 rounded-full bg-[var(--color-accent-amber)]"}),(0,d.jsxs)("div",{className:"flex flex-col gap-0.5 sm:flex-row sm:items-baseline sm:gap-2",children:[(0,d.jsxs)("span",{className:"font-medium",children:["Update available",m,": ",a.current," → ",a.latest]}),"blocked"===c&&g||"error"===c&&g?(0,d.jsx)("span",{className:"text-xs text-[var(--color-status-error)]",children:g}):"starting"===c?(0,d.jsx)("span",{className:"text-xs text-[var(--color-text-secondary)]",children:"Starting…"}):(0,d.jsx)("span",{className:"text-xs text-[var(--color-text-secondary)]",children:"Click Update to install. The dashboard will restart."})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>void l(),disabled:"starting"===c,className:"rounded-sm border border-[var(--color-accent-amber-border)] bg-[var(--color-accent-amber)] px-3 py-1 text-xs font-medium text-[var(--color-text-inverse)] hover:bg-[color-mix(in_srgb,var(--color-accent-amber)_85%,black)] disabled:cursor-wait disabled:opacity-60",children:"starting"===c?"Updating…":"Update"}),(0,d.jsx)("button",{type:"button",onClick:k,"aria-label":"Dismiss",className:"rounded-sm px-2 py-1 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-bg-hover)]",children:"Dismiss"})]})]})}let E=[/\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 F({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 E.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 G=c(70162);function H(a){let b=Date.now(),c=Math.floor((b-new Date(a).getTime())/1e3);if(c<60)return`${c}s ago`;let d=Math.floor(c/60);if(d<60)return`${d}m ago`;let e=Math.floor(d/60);if(e<24)return`${e}h ago`;let f=Math.floor(e/24);return`${f}d ago`}function I(a){return a.replaceAll("_"," ")}function J(a){return null!==a}function K({session:a,mode:b,onCancel:c,onConfirm:f,onRequestKill:g,onMerge:h,isMergeReady:i=!1}){let k=(0,e.useRef)(null),m=(0,e.useRef)(null);(0,e.useRef)(null);let n=a?.pr?.number??null;if(!a)return null;let p=(0,l.Pn)(a),q=(0,j.ng)(a),r=a.summary&&!a.summaryIsFallback?a.summary:null,s="done"!==q&&"merge"!==q&&"terminated"!==a.status,t=a.pr,u=!!(t&&!(0,j.fZ)(t)&&!(0,j.sZ)(t)),v="done"===q||"terminated"===a.status||"exited"===a.activity,w=[{label:I(q),tone:"accent"},{label:I(a.status),tone:"neutral"},a.activity?{label:I(a.activity),tone:"neutral"}:null,a.branch?{label:a.branch,tone:"mono"}:null,a.pr?{label:`PR #${a.pr.number}`,tone:"neutral"}:null,a.issueLabel?{label:a.issueLabel,tone:"neutral"}:null].filter(J);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"bottom-sheet-backdrop",onClick:c,"aria-hidden":"true"}),(0,d.jsxs)("div",{ref:m,className:"bottom-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"bottom-sheet-title",onTouchStart:function(a){k.current=a.touches[0]?.clientY??null},onTouchEnd:function(a){if(null===k.current)return;let b=(a.changedTouches[0]?.clientY??0)-k.current;k.current=null,b>80&&c()},children:[(0,d.jsx)("div",{className:"bottom-sheet__handle","aria-hidden":"true"}),"confirm-kill"===b?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"bottom-sheet__header",children:[(0,d.jsx)("h2",{id:"bottom-sheet-title",className:"bottom-sheet__title",children:"Terminate session?"}),(0,d.jsx)("p",{className:"bottom-sheet__subtitle",children:"This action cannot be undone."})]}),(0,d.jsxs)("div",{className:"bottom-sheet__session-info",children:[(0,d.jsx)("div",{className:"bottom-sheet__session-name",children:p}),(0,d.jsx)("div",{className:"bottom-sheet__session-meta",children:w.map(a=>(0,d.jsx)("span",{className:`bottom-sheet__tag bottom-sheet__tag--${a.tone}`,children:a.label},`${a.tone}-${a.label}`))}),r?(0,d.jsx)("p",{className:"bottom-sheet__summary",children:r}):null]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"bottom-sheet__preview-card",children:[(0,d.jsx)("div",{className:"bottom-sheet__preview-strip","data-level":q}),(0,d.jsxs)("div",{className:"bottom-sheet__preview-content",children:[(0,d.jsxs)("div",{className:"bottom-sheet__preview-header",children:[(0,d.jsx)("span",{className:"bottom-sheet__preview-id",children:a.id}),(0,d.jsx)("span",{className:"bottom-sheet__preview-time",children:H(a.lastActivityAt)})]}),(0,d.jsx)("h2",{id:"bottom-sheet-title",className:"bottom-sheet__title",children:p}),(0,d.jsxs)("p",{className:"bottom-sheet__subtitle",children:[I(q)," \xb7 started ",H(a.createdAt)]}),(0,d.jsxs)("div",{className:"bottom-sheet__preview-meta",children:[a.branch?(0,d.jsx)("span",{className:"bottom-sheet__preview-branch",children:a.branch}):null,t?(0,d.jsxs)("span",{className:"bottom-sheet__preview-pr",children:["#",t.number]}):null,u&&t?(0,d.jsxs)("span",{className:"bottom-sheet__preview-diff",children:[(0,d.jsxs)("span",{className:"bottom-sheet__preview-diff-add",children:["+",t.additions]})," ",(0,d.jsxs)("span",{className:"bottom-sheet__preview-diff-del",children:["-",t.deletions]})]}):null]}),u&&t?(0,d.jsxs)("div",{className:"bottom-sheet__preview-pills",children:[(0,d.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--neutral",children:"passing"===t.ciStatus?"CI passing":"failing"===t.ciStatus?"CI failed":"CI pending"}),(0,d.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--accent",children:"approved"===t.reviewDecision?"approved":"changes_requested"===t.reviewDecision?"changes requested":"needs review"}),v?(0,d.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--accent",children:I(a.status)}):null,v&&a.activity?(0,d.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--neutral",children:I(a.activity)}):null]}):(0,d.jsxs)("div",{className:"bottom-sheet__preview-pills",children:[(0,d.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--accent",children:I(a.status)}),a.activity?(0,d.jsx)("span",{className:"bottom-sheet__tag bottom-sheet__tag--neutral",children:I(a.activity)}):null]})]})]}),r?(0,d.jsx)("p",{className:"bottom-sheet__summary",children:r}):null]}),(0,d.jsx)("div",{className:"bottom-sheet__actions",children:"confirm-kill"===b?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",className:"bottom-sheet__btn bottom-sheet__btn--cancel",onClick:c,children:"Cancel"}),(0,d.jsx)("button",{type:"button",className:"bottom-sheet__btn bottom-sheet__btn--danger",onClick:f,children:"Terminate"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("a",{href:(0,o.Nc)(a.projectId,a.id),className:"bottom-sheet__btn bottom-sheet__btn--primary",children:"Open session"}),i&&a.pr&&h?(0,d.jsx)("button",{type:"button",className:"bottom-sheet__btn bottom-sheet__btn--secondary",onClick:()=>{null!==n&&h(n)},children:"Merge"}):s&&g?(0,d.jsxs)("button",{type:"button",className:"bottom-sheet__btn bottom-sheet__btn--danger",onClick:g,children:[(0,d.jsxs)("svg",{className:"bottom-sheet__btn-icon",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",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"}),(0,d.jsx)("path",{d:"M10 11v6M14 11v6"})]}),"Terminate"]}):null]})})]})]})}let L=["working","pending","action","merge"],M=["working","pending","review","respond","merge"],N=[];function O({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&&!e?(0,d.jsx)("button",{type:"button",className:"done-card__restore",onClick:c=>{c.stopPropagation(),b(a.id)},children:"Restore"}):null]})]})}function P({initialSessions:a,projectId:b,projectName:c,projects:f=[],orchestrators:k,attentionZones:l="simple",dashboardLoadError:m}){let n=(0,x.eT)(),p="detailed"===l?M:L,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}),E=(0,e.useMemo)(()=>b?r.filter(a=>a.projectId===b):r,[r,b]),H=n?.status==="disconnected"?"disconnected":n?.status==="connected"?"connected":"reconnecting",I=z??(m&&u?void 0:m),J=(0,h.useSearchParams)(),P=(0,h.useRouter)(),Q=(0,e.useRef)(P);Q.current=P;let S=J.get("session")??void 0,[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(k??N),[X,Y]=(0,e.useState)([]),[Z,$]=(0,e.useState)({}),[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)(!1),ad=(0,i.U)(i.D),[ae,af]=(0,e.useState)(()=>new Set(["done","working"])),[ag,ah]=(0,e.useState)(null),[ai,aj]=(0,e.useState)("preview"),ak=J.get("debug"),al=!ad&&("1"===ak||"true"===ak),{showToast:am}=(0,B.d)(),[an,ao]=(0,e.useState)(!1),ap=(0,e.useRef)(r);ap.current=r;let aq=f.length>1&&void 0===b,ar=(0,e.useMemo)(()=>b?V.find(a=>a.projectId===b)??null:null,[V,b]),as=ar?(0,o.Nc)(ar.projectId,ar.id):null,at=!aq&&!!b&&f.some(a=>a.id===b&&!a.resolveError)&&!as,au=b?f.find(a=>a.id===b)??null:null,av=!!b&&X.includes(b),aw=b?Z[b]??null:null,ax=(0,e.useMemo)(()=>aq||!S?E:E.filter(a=>a.id===S),[E,aq,S]),ay=(0,e.useMemo)(()=>{let a={merge:[],action:[],respond:[],review:[],pending:[],working:[],done:[]};for(let b of ax)a[(0,j.ng)(b,l)].push(b);return a},[ax,l]),az=(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]),aA=(0,e.useMemo)(()=>aq?f.map(a=>{let b=az.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:V.find(b=>b.projectId===a.id)??null,sessionCount:b.length,openPRCount:b.filter(a=>a.pr?.state==="open").length,counts:c}}):[],[V,aq,l,f,az]),aB=(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),am(`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),am("Network error while sending message","error")),b}},[am]),aC=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a)}/kill`,{method:"POST"});if(b.ok)am("Session terminated","success");else{let c=await b.text();console.error(`Failed to kill ${a}:`,c),am(`Terminate failed: ${c}`,"error")}}catch(b){console.error(`Network error killing ${a}:`,b),am("Network error while terminating session","error")}},[am]),aD=(0,e.useCallback)(a=>{let b=ap.current.find(b=>b.id===a)??null;b&&aC(b.id)},[aC]),aE=(0,e.useCallback)(a=>{ah(a),aj("preview")},[]),aF=(0,e.useCallback)(()=>{aj("confirm-kill")},[]),aG=(0,e.useCallback)(()=>{ah(null),aj("preview")},[]),aH=(0,e.useCallback)(()=>{ag&&aC(ag.id),ah(null),aj("preview")},[ag,aC]),aI=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/prs/${a}/merge`,{method:"POST"});if(b.ok)am(`PR #${a} merged`,"success");else{let c=await b.text();console.error(`Failed to merge PR #${a}:`,c),am(`Merge failed: ${c}`,"error");return}}catch(b){console.error(`Network error merging PR #${a}:`,b),am("Network error while merging PR","error")}},[am]),aJ=(0,e.useCallback)(async a=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a)}/restore`,{method:"POST"});if(b.ok)am("Session restored","success"),Q.current.refresh();else{let c=await b.text();console.error(`Failed to restore ${a}:`,c),am(`Restore failed: ${c}`,"error")}}catch(b){console.error(`Network error restoring ${a}:`,b),am("Network error while restoring session","error")}},[am]),aK=async a=>{Y(b=>b.includes(a.id)?b:[...b,a.id]),$(({[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;W(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";$(c=>({...c,[a.id]:b})),console.error(`Failed to spawn orchestrator for ${a.id}:`,c)}finally{Y(b=>b.filter(b=>b!==a.id))}},aL=p.some(a=>ay[a].length>0),aM=!aq&&!aL&&!I,aN=I?(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:I}),(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,aO=(0,e.useMemo)(()=>r.some(a=>a.pr&&(0,j.fZ)(a.pr)),[r]),aP="agent orchestrator"===c?.trim().toLowerCase()?b??c??(aq?"All projects":"Dashboard"):c??(aq?"All projects":"Dashboard"),aQ=!aq&&aP.trim().length>0,aR=a=>{af(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},aS=()=>{aa(a=>!a)};return(0,d.jsx)(G.I.Provider,{value:{onToggleSidebar:aS,mobileSidebarOpen:ab},children:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(D,{}),(0,d.jsx)(C,{status:H}),(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:aS,"aria-label":"Toggle sidebar",children:ad?(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"})]}),aQ?(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:aP})]}):null,al?(0,d.jsx)(F,{projectId:b}):null,(0,d.jsx)("div",{className:"dashboard-app-header__spacer"}),(0,d.jsx)("div",{className:"dashboard-app-header__actions",children:!aq&&as?(0,d.jsxs)(g(),{href:as,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"]}):at&&au?(0,d.jsxs)("button",{type:"button",className:"dashboard-app-btn dashboard-app-btn--amber","aria-label":"Spawn Orchestrator",onClick:()=>void aK(au),disabled:av,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"})]}),av?"Spawning...":"Spawn Orchestrator"]}):null})]}),(0,d.jsxs)("div",{className:`dashboard-shell dashboard-shell--desktop${_?" dashboard-shell--sidebar-collapsed":""}`,children:[(0,d.jsx)("div",{className:`sidebar-wrapper${ab?" sidebar-wrapper--mobile-open":""}`,children:(0,d.jsx)(y.u,{projects:f,sessions:r,orchestrators:V,activeProjectId:b,activeSessionId:S,collapsed:_,onToggleCollapsed:()=>aa(a=>!a),onMobileClose:()=>ac(!1)})}),ab&&(0,d.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:()=>ac(!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:[aN,aO&&!T&&(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:()=>U(!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"})})})]}),aq&&(0,d.jsx)(R,{overviews:aA,onSpawnOrchestrator:aK,spawningProjectIds:X,spawnErrors:Z,attentionZones:l}),!aq&&aL&&(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:ay[a],onSend:aB,onKill:aD,onMerge:aI,onRestore:aJ,compactMobile:ad,collapsed:ad&&ae.has(a),onToggle:ad?aR:void 0,onPreview:ad?aE:void 0},a))})}),aM?(0,d.jsx)(A,{orchestratorHref:as,onSpawnOrchestrator:at&&au?()=>{aK(au)}:null,spawnLabel:av?"Spawning...":"Spawn Orchestrator",spawnDisabled:av}):null,!aq&&aw?(0,d.jsx)("p",{className:"mt-3 text-[11px] text-[var(--color-status-error)]",children:aw}):null,!aq&&ay.done.length>0&&(0,d.jsxs)("div",{className:"done-bar mt-6",children:[(0,d.jsxs)("button",{type:"button",className:"done-bar__toggle",onClick:()=>ao(a=>!a),"aria-expanded":an,children:[(0,d.jsx)("svg",{className:`done-bar__chevron${an?" 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:ay.done.length})]}),an&&(0,d.jsx)("div",{className:"done-bar__cards",children:ay.done.map(a=>(0,d.jsx)(O,{session:a,onRestore:aJ},a.id))})]})]})]})]})]}),(0,d.jsx)(K,{session:ag,mode:ai,onCancel:aG,onConfirm:aH,onRequestKill:aF,onMerge:aI,isMergeReady:!!ag&&"merge"===t[ag.id]})]})})}function Q(a){return(0,d.jsx)(B.t,{children:(0,d.jsx)(P,{...a})})}function R({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)(S,{label:"Merge",value:k.merge,tone:"ready"}),"detailed"===f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(S,{label:"Respond",value:k.respond,tone:"error"}),(0,d.jsx)(S,{label:"Review",value:k.review,tone:"orange"})]}):(0,d.jsx)(S,{label:"Action",value:k.action,tone:"orange"}),(0,d.jsx)(S,{label:"Pending",value:k.pending,tone:"attention"}),(0,d.jsx)(S,{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 S({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})]})}},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.")},"/tmp/ao-publish-stable/packages/web/src/components/Dashboard.tsx","Dashboard")},70162:(a,b,c)=>{c.d(b,{I:()=>d});let d=(0,c(81115).createContext)(null)}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=7167,exports.ids=[7167],exports.modules={5241:(a,b,c)=>{c.d(b,{CM:()=>f,N_:()=>h,Rt:()=>g,SB:()=>e,U1:()=>j,tT:()=>i,u3:()=>d});let d={ACTIVE:"active",READY:"ready",IDLE:"idle",WAITING_INPUT:"waiting_input",BLOCKED:"blocked",EXITED:"exited"},e={SPAWNING:"spawning",WORKING:"working",DETECTING:"detecting",PR_OPEN:"pr_open",CI_FAILED:"ci_failed",REVIEW_PENDING:"review_pending",CHANGES_REQUESTED:"changes_requested",APPROVED:"approved",MERGEABLE:"mergeable",MERGED:"merged",CLEANUP:"cleanup",NEEDS_INPUT:"needs_input",STUCK:"stuck",ERRORED:"errored",IDLE:"idle",KILLED:"killed",DONE:"done",TERMINATED:"terminated"},f=new Set(["killed","terminated","done","cleanup","errored","merged"]),g=new Set(["exited"]),h=new Set([]);function i(a,b,c){if(a.metadata?.role==="orchestrator")return!0;if(!b)return!1;let d=b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(a.id===`${b}-orchestrator`)return!0;if(!RegExp(`^${d}-orchestrator-\\d+$`).test(a.id))return!1;if(c){for(let d of c)if(d!==b&&RegExp(`^${d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}-\\d+$`).test(a.id))return!1}return!0}let j={PENDING:"pending",PASSING:"passing",FAILING:"failing",NONE:"none"}},20902:(a,b,c)=>{async function d(a){try{let b=await a.json(),c=b?.error??b?.message;if("string"==typeof c&&c.trim().length>0)return c.trim()}catch{}let b="string"==typeof a.statusText?a.statusText.trim():"";return b.length>0?`${a.status} ${b}`:`HTTP ${a.status}`}async function e(a,b={}){let{timeoutMs:c=8e3,timeoutMessage:f,signal:g,...h}=b,i=new AbortController,j=null,k=!1;try{let b=function(a){let b=a.filter(a=>!!a);if(0===b.length)return;if(1===b.length)return b[0];let c=new AbortController,d=()=>c.abort();for(let a of b){if(a.aborted){c.abort();break}a.addEventListener("abort",d,{once:!0})}return c.signal}([g,i.signal]),e={...h};b&&(e.signal=b);let l=new Promise((a,b)=>{j=setTimeout(()=>{k=!0,i.abort(),b(Error(f??`Request timed out after ${c}ms`))},c)}),m=await Promise.race([fetch(a,e).catch(a=>{if(k)throw Error(f??`Request timed out after ${c}ms`,{cause:a});throw a}),l]);if(!m.ok)throw Error(await d(m));return await m.json()}finally{j&&clearTimeout(j)}}c.d(b,{u:()=>e})},31849:(a,b,c)=>{c.d(b,{u:()=>C});var d=c(33666),e=c(47489),f=c.n(e),g=c(81115),h=c(50436),i=c(85489),j=c(37155),k=c(5241),l=c(61875),m=c(88950),n=c(74566);function o(a,b){return"~"===a?`~/${b}`:`${a.replace(/\/+$/,"")}/${b}`}function p({children:a,className:b,viewBox:c="0 0 16 16"}){return(0,d.jsx)("svg",{"aria-hidden":"true",viewBox:c,className:b,children:a})}let q={fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"square"},r={fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"miter"};function s(){return(0,d.jsx)(p,{className:"add-project-modal__toolicon",children:(0,d.jsx)("path",{d:"M10 3.5 6 8l4 4.5",...q})})}function t(){return(0,d.jsx)(p,{className:"add-project-modal__toolicon",children:(0,d.jsx)("path",{d:"m6 3.5 4 4.5L6 12.5",...q})})}function u(){return(0,d.jsx)(p,{className:"add-project-modal__toolicon",children:(0,d.jsx)("path",{d:"M8 12V4m0 0L5 7m3-3 3 3",...r})})}function v(){return(0,d.jsx)(p,{className:"add-project-modal__toolicon",children:(0,d.jsx)("path",{d:"M12 5V2.75H9.75M4.5 11A4.75 4.75 0 0 0 12 5M3.75 11v2.25H6m5.5-8.25A4.75 4.75 0 0 1 4 11",...r})})}function w({open:a,onClose:b}){let c=(0,h.useRouter)(),e=(0,g.useRef)(null),[f,i]=(0,g.useState)(!1),[j,k]=(0,g.useState)(null),[l,m]=(0,g.useState)(null),[n,p]=(0,g.useState)(null),[q,r]=(0,g.useState)("~"),[w,x]=(0,g.useState)("~"),[y,z]=(0,g.useState)(["~"]),[A,B]=(0,g.useState)(0),[C,D]=(0,g.useState)([]),[E,F]=(0,g.useState)(!1),[G,H]=(0,g.useState)(null),[I,J]=(0,g.useState)(""),[K,L]=(0,g.useState)(""),M=async(a,b)=>{F(!0),H(null);try{let c=await fetch(`/api/filesystem/browse?path=${encodeURIComponent(a)}`).catch(()=>null);if(!c){D([]),x(b?.selectedPath??a),H("Failed to browse directories.");return}if(!c.ok){let d=await c.json().catch(()=>null);D([]),x(b?.selectedPath??a),H(d?.error??"Failed to browse directories.");return}let d=await c.json().catch(()=>null),e=b?.mode??"push",f=b?.historyIndex??A;r(a),x(b?.selectedPath??a),D(d?.entries??[]),"push"===e?z(b=>{let c=b.slice(0,f+1);return c[c.length-1]!==a&&c.push(a),B(c.length-1),c}):z(b=>{let c=[...b];return c[f]=a,c})}catch{H("Failed to browse directories.")}finally{F(!1)}},N=(0,g.useMemo)(()=>C.filter(a=>a.isDirectory),[C]),O=(0,g.useMemo)(()=>N.find(a=>o(q,a.name)===w)??null,[q,N,w]),P=function(a){if("~"===a)return null;let b=a.split("/").filter(Boolean);return b.length<=1?"~":"~"===b[0]?`~/${b.slice(1,-1).join("/")}`:b.slice(0,-1).join("/")}(q),Q=A<y.length-1,R=I.trim()||(w.trim()&&"~"!==w?(w.split("/").filter(Boolean).pop()??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"project":""),S=K.trim()||(w.trim()&&"~"!==w?(w.split("/").filter(Boolean).pop()??"Project").replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase())||"Project":""),T=""!==w.trim()&&"~"!==w&&!G&&!!O?.isGitRepo&&R.length>0&&S.length>0;N.findIndex(a=>o(q,a.name)===w);let U=async(a=!1)=>{k(null),m(null),p(null),i(!0);let d=w.trim();try{let e=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:R,name:S,path:d,useDefaultProjectId:a})}),f=await e.json().catch(()=>null);if(409===e.status&&f?.existingProjectId&&f?.suggestedProjectId&&f?.suggestion){p({error:f.error??"A project with that ID already exists.",existingProjectId:f.existingProjectId,suggestedProjectId:f.suggestedProjectId,suggestion:f.suggestion}),J(f.suggestedProjectId);return}if(!e.ok){let a=f?.error??"Failed to add project.";e.status<500?k(a):m(a);return}let g=f?.projectId??R.trim();b(),c.push(`/projects/${encodeURIComponent(g)}`),c.refresh()}catch{m("Network error while adding project.")}finally{i(!1)}};if(!a)return null;let V=a=>{a<0||a>=y.length||(B(a),M(y[a]??"~",{mode:"replace",historyIndex:a}))},W=n?(0,d.jsxs)("div",{className:"add-project-modal__notice add-project-modal__notice--warning",children:[(0,d.jsx)("p",{className:"add-project-modal__notice-title",children:n.error}),(0,d.jsxs)("p",{className:"add-project-modal__notice-copy",children:["Existing project: ",(0,d.jsx)("code",{children:n.existingProjectId})]}),(0,d.jsxs)("p",{className:"add-project-modal__notice-copy",children:["Suggested project ID: ",(0,d.jsx)("code",{children:n.suggestedProjectId})]}),(0,d.jsxs)("div",{className:"add-project-modal__notice-actions",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{b(),c.push(`/projects/${encodeURIComponent(n.existingProjectId)}`)},className:"add-project-modal__ghostbtn",children:"Open existing"}),(0,d.jsx)("button",{type:"button",onClick:()=>void U(!0),className:"add-project-modal__ghostbtn",children:"Use suggested ID"}),(0,d.jsx)("span",{className:"add-project-modal__notice-hint",children:"Edit the Project ID field or accept the suggested suffix."})]})]}):j?(0,d.jsx)("div",{role:"alert",className:"add-project-modal__notice add-project-modal__notice--error",children:j}):O&&!O.isGitRepo?(0,d.jsx)("div",{role:"alert",className:"add-project-modal__notice add-project-modal__notice--error",children:"Selected folder is not a git repository."}):l?(0,d.jsx)("div",{className:"add-project-modal__notice add-project-modal__notice--error",children:l}):null;return(0,d.jsx)("div",{className:"add-project-modal-backdrop",children:(0,d.jsxs)("div",{ref:e,role:"dialog","aria-modal":"true","aria-label":"Add project",className:"add-project-modal",tabIndex:-1,children:[(0,d.jsxs)("div",{className:"add-project-modal__titlebar",children:[(0,d.jsx)("h2",{className:"add-project-modal__windowtitle",children:"add project"}),(0,d.jsx)("button",{type:"button","aria-label":"Close",onClick:b,className:"add-project-modal__iconbtn",children:"\xd7"})]}),(0,d.jsxs)("div",{className:"add-project-modal__toolbar",children:[(0,d.jsxs)("div",{className:"add-project-modal__toolbarcluster",children:[(0,d.jsx)("button",{type:"button",onClick:()=>V(A-1),disabled:!(A>0),className:"add-project-modal__toolbtn","aria-label":"Go back",children:(0,d.jsx)(s,{})}),(0,d.jsx)("button",{type:"button",onClick:()=>V(A+1),disabled:!Q,className:"add-project-modal__toolbtn","aria-label":"Go forward",children:(0,d.jsx)(t,{})}),(0,d.jsx)("button",{type:"button",onClick:()=>P&&void M(P),disabled:!P,className:"add-project-modal__toolbtn","aria-label":"Go up",children:(0,d.jsx)(u,{})}),(0,d.jsx)("button",{type:"button",onClick:()=>void M(q,{mode:"replace",selectedPath:w}),className:"add-project-modal__toolbtn","aria-label":"Refresh",children:(0,d.jsx)(v,{})})]}),(0,d.jsx)("div",{className:"add-project-modal__location",children:q})]}),(0,d.jsx)("div",{className:"add-project-modal__content",children:(0,d.jsxs)("div",{className:"add-project-browser",children:[(0,d.jsxs)("div",{className:"add-project-browser__current",children:[(0,d.jsx)("div",{className:"add-project-browser__current-label",children:"Current folder"}),(0,d.jsx)("div",{className:"add-project-browser__current-path",children:q})]}),G?(0,d.jsxs)("div",{className:"add-project-browser__state add-project-browser__state--error",children:[(0,d.jsx)("p",{className:"add-project-browser__state-title",children:"Directory browser unavailable"}),(0,d.jsx)("p",{className:"add-project-browser__state-copy",children:G})]}):E?(0,d.jsxs)("div",{className:"add-project-browser__state",children:[(0,d.jsx)("p",{className:"add-project-browser__state-title",children:"Loading folders"}),(0,d.jsx)("p",{className:"add-project-browser__state-copy",children:"Fetching directories for this location."})]}):0===N.length?(0,d.jsxs)("div",{className:"add-project-browser__state",children:[(0,d.jsx)("p",{className:"add-project-browser__state-title",children:"No visible folders here"}),(0,d.jsx)("p",{className:"add-project-browser__state-copy",children:"Try navigating up or picking a different location."})]}):(0,d.jsxs)("div",{className:"add-project-browser__rows",children:[P?(0,d.jsx)("button",{type:"button",onClick:()=>void M(P),className:"add-project-browser__row add-project-browser__row--parent",children:".."}):null,N.map(a=>{let b=o(q,a.name);return(0,d.jsx)("button",{type:"button",onClick:()=>x(b),onDoubleClick:()=>void M(b),className:`add-project-browser__row${w===b?" is-selected":""}`,children:a.name},b)})]})]})}),(0,d.jsxs)("div",{className:"add-project-modal__pathbar add-project-modal__pathbar--selection",children:[(0,d.jsx)("span",{className:"add-project-modal__selection-label",children:"Selected"}),(0,d.jsx)("span",{className:"add-project-modal__selection-path",children:w||"No directory selected"})]}),(0,d.jsxs)("div",{className:"add-project-modal__pathbar add-project-modal__pathbar--selection",children:[(0,d.jsx)("label",{className:"add-project-modal__selection-label",htmlFor:"project-id-input",children:"Project ID"}),(0,d.jsx)("input",{id:"project-id-input",value:I,onChange:a=>J(a.target.value),className:"add-project-modal__selection-path"})]}),(0,d.jsxs)("div",{className:"add-project-modal__pathbar add-project-modal__pathbar--selection",children:[(0,d.jsx)("label",{className:"add-project-modal__selection-label",htmlFor:"project-name-input",children:"Project name"}),(0,d.jsx)("input",{id:"project-name-input",value:K,onChange:a=>L(a.target.value),className:"add-project-modal__selection-path"})]}),W,(0,d.jsxs)("div",{className:"add-project-modal__footer",children:[(0,d.jsxs)("div",{className:"add-project-modal__foldercount",children:[N.length," folders"]}),(0,d.jsxs)("div",{className:"add-project-modal__actions",children:[(0,d.jsx)("button",{type:"button",onClick:b,className:"add-project-modal__ghostbtn",children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:()=>void U(),disabled:!T||f,className:"add-project-modal__primarybtn",children:f?"Adding…":"Add project"})]})]})]})})}var x=c(81407);function y({open:a,projectId:b,onClose:c}){let e=(0,g.useRef)(null),[f,h]=(0,g.useState)(!1),[i,j]=(0,g.useState)(null),[k,l]=(0,g.useState)(null),m=(0,g.useMemo)(()=>k&&b?{agent:k.agent??"",runtime:k.runtime??"",trackerPlugin:k.tracker?.plugin??"",scmPlugin:k.scm?.plugin??"",reactions:JSON.stringify(k.reactions??{},null,2),identity:{projectId:b,path:k.path,repo:k.repo??"",defaultBranch:k.defaultBranch??"main"}}:null,[k,b]);return a&&b?(0,d.jsx)("div",{className:"project-settings-modal-backdrop",onClick:c,children:(0,d.jsxs)("div",{ref:e,role:"dialog","aria-modal":"true","aria-label":"Project settings",className:"project-settings-modal",tabIndex:-1,onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"project-settings-modal__header",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"project-settings-modal__eyebrow",children:"Project settings"}),(0,d.jsx)("h2",{className:"project-settings-modal__title",children:k?.name??b})]}),(0,d.jsx)("button",{type:"button","aria-label":"Close",onClick:c,className:"project-settings-modal__close",children:"\xd7"})]}),(0,d.jsxs)("div",{className:"project-settings-modal__body",children:[f?(0,d.jsx)("div",{className:"project-settings-modal__state",children:"Loading project settings…"}):null,!f&&i?(0,d.jsx)("div",{role:"alert",className:"project-settings-modal__state project-settings-modal__state--error",children:i}):null,f||i||!m?null:(0,d.jsx)(x.ProjectSettingsForm,{projectId:b,initialValues:m})]})]})}):null}function z({level:a}){return(0,d.jsx)("div",{className:(0,i.cn)("sidebar-session-dot shrink-0 rounded-full","working"===a&&"sidebar-session-dot--glow"),"data-level":a})}function A(){return!1}let B={working:"working",pending:"pending",review:"review",respond:"respond",action:"action",merge:"merge",done:"done"};function C(a){return 0===a.projects.length?(0,d.jsx)(D,{collapsed:a.collapsed}):(0,d.jsx)(E,{...a})}function D({collapsed:a=!1}){let[b,c]=(0,g.useState)(!1);return a?(0,d.jsxs)("aside",{className:"project-sidebar project-sidebar--collapsed flex h-full flex-col items-center gap-1 py-2",children:[(0,d.jsx)("button",{type:"button",className:"project-sidebar__add-btn","aria-label":"New project",onClick:()=>c(!0),children:(0,d.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})})}),(0,d.jsx)(w,{open:b,onClose:()=>c(!1)})]}):(0,d.jsxs)("aside",{className:"project-sidebar flex h-full flex-col",children:[(0,d.jsxs)("div",{className:"project-sidebar__compact-hdr",children:[(0,d.jsx)("span",{className:"project-sidebar__sect-label",children:"Projects"}),(0,d.jsx)("button",{type:"button",className:"project-sidebar__add-btn","aria-label":"New project",onClick:()=>c(!0),children:(0,d.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})})})]}),(0,d.jsx)("div",{className:"project-sidebar__empty flex-1 text-[var(--color-text-tertiary)]",children:"No projects yet. Click + to add one."}),(0,d.jsx)("div",{className:"project-sidebar__footer",children:(0,d.jsx)("div",{className:"flex items-center justify-end gap-1 border-t border-[var(--color-border-subtle)] px-2 py-2",children:(0,d.jsx)(n.U,{className:"project-sidebar__theme-toggle"})})}),(0,d.jsx)(w,{open:b,onClose:()=>c(!1)})]})}function E({projects:a,sessions:b,orchestrators:c,activeProjectId:e,activeSessionId:o,loading:p=!1,error:q=!1,onRetry:r,collapsed:s=!1,onToggleCollapsed:t,onMobileClose:u}){let v=(0,h.useRouter)(),x=p||null===b,[C,D]=(0,g.useState)(()=>new Set(e&&"all"!==e?[e]:[])),[E,F]=(0,g.useState)(!1),[G,H]=(0,g.useState)(!1),[I,J]=(0,g.useState)(A),[K,L]=(0,g.useState)(!1),[M,N]=(0,g.useState)(null),[O,P]=(0,g.useState)(null),[Q,R]=(0,g.useState)(null),[S,T]=(0,g.useState)(new Set),[U,V]=(0,g.useState)(!1),W=(0,g.useRef)(null),X=(0,g.useRef)(null),Y=(0,g.useRef)(null),Z=(0,g.useRef)(null),$=(0,g.useMemo)(()=>a.filter(a=>!S.has(a.id)),[a,S]),_=(0,g.useMemo)(()=>new Map($.map(a=>[a.id,a.sessionPrefix??a.id])),[$]),aa=(0,g.useMemo)(()=>$.map(a=>a.sessionPrefix??a.id),[$]),ab=(0,g.useMemo)(()=>new Map((c??[]).map(a=>[a.projectId,a])),[c]),ac=(0,g.useMemo)(()=>{let a=new Map,c=new Set($.map(a=>a.id));for(let d of b??[]){if(!c.has(d.projectId)||(0,k.tT)(d,_.get(d.projectId),aa)||"done"===(0,j.ng)(d)&&("killed"===d.status?!E&&!G:!G))continue;let b=a.get(d.projectId)??[];b.push(d),a.set(d.projectId,b)}return a},[b,_,aa,$,E,G]),ad=(a,b)=>{if(b)try{sessionStorage.setItem(`ao-session-nav:${b.id}`,JSON.stringify(b))}catch{}v.push(a),u?.()},ae=async a=>{if(window.confirm(`Remove project ${a.name} from AO? This clears its AO sessions/history and removes it from the portfolio, but keeps the repository folder on disk.`)){R(a.id);try{let b=await fetch(`/api/projects/${encodeURIComponent(a.id)}`,{method:"DELETE"}),c=await b.json().catch(()=>null);if(!b.ok)throw Error((c&&"object"==typeof c&&"error"in c&&"string"==typeof c.error?c.error:null)??"Failed to remove project.");T(b=>new Set(b).add(a.id)),D(b=>{let c=new Set(b);return c.delete(a.id),c}),N(null),e===a.id?v.push("/"):"refresh"in v&&"function"==typeof v.refresh&&v.refresh(),u?.()}catch(a){window.alert(a instanceof Error?a.message:"Failed to remove project.")}finally{R(null)}}};return s?(0,d.jsx)("aside",{className:(0,i.cn)("project-sidebar project-sidebar--collapsed flex flex-col h-full items-center py-2 gap-1 overflow-y-auto"),children:$.map((a,b)=>{let c=ac.get(a.id)??[],f=a.name.slice(0,2).toUpperCase();return(0,d.jsxs)("div",{className:"flex flex-col items-center gap-0.5 w-full px-1",children:[b>0&&(0,d.jsx)("div",{className:"project-sidebar__collapsed-divider","aria-hidden":"true"}),(0,d.jsx)("a",{href:(0,m.bn)(a.id),className:(0,i.cn)("project-sidebar__collapsed-icon",e===a.id&&"project-sidebar__collapsed-icon--active"),title:a.name,"aria-label":a.name,children:(0,d.jsx)("span",{className:"project-sidebar__collapsed-abbr",children:f})}),c.slice(0,5).map(b=>{let c=(0,j.ng)(b),e=b.branch??(0,l.Pn)(b),f=(b.branch&&(0,l.mC)(b.branch)||e).replace(/\s+/g,"").slice(0,3).toUpperCase(),g=o===b.id,h=(0,m.Nc)(a.id,b.id);return(0,d.jsxs)("a",{href:h,onClick:a=>{a.metaKey||a.ctrlKey||a.shiftKey||1===a.button||(a.preventDefault(),ad(h,b))},className:(0,i.cn)("project-sidebar__collapsed-session-btn",g&&"project-sidebar__collapsed-session-btn--active"),"data-level":c,title:e,"aria-label":e,children:[(0,d.jsx)("span",{className:"project-sidebar__session-abbr-first",children:f[0]}),(0,d.jsx)("span",{className:"project-sidebar__session-abbr-rest",children:f.slice(1)})]},b.id)}),c.length>5&&(0,d.jsxs)("span",{className:"project-sidebar__collapsed-overflow",children:["+",c.length-5]})]},a.id)})}):(0,d.jsxs)("aside",{className:"project-sidebar flex h-full flex-col",children:[(0,d.jsxs)("div",{className:"project-sidebar__compact-hdr",children:[(0,d.jsx)("span",{className:"project-sidebar__sect-label",children:"Projects"}),(0,d.jsx)("button",{type:"button",className:"project-sidebar__add-btn","aria-label":"New project",onClick:()=>V(!0),children:(0,d.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})})})]}),q&&b&&b.length>0?(0,d.jsxs)("div",{role:"status",className:"mx-3 mb-2 flex items-center justify-between gap-2 rounded-md border border-[var(--color-border-strong)] bg-[var(--color-bg-primary)] px-2 py-1.5 text-[11px] text-[var(--color-text-tertiary)]",children:[(0,d.jsx)("span",{children:"Failed to refresh \xb7 showing cached sessions"}),r?(0,d.jsx)("button",{type:"button",onClick:r,className:"font-medium text-[var(--color-link)] hover:underline",children:"Retry"}):null]}):null,(0,d.jsx)("div",{className:"project-sidebar__tree flex-1 overflow-y-auto overflow-x-hidden",children:$.map(a=>{let b=ac.get(a.id)??[],c=C.has(a.id),g=e===a.id,h=!!a.resolveError,k=(0,m.bn)(a.id),n=b.length>0,p=ab.get(a.id)??null;return(0,d.jsxs)("div",{className:"project-sidebar__project",children:[(0,d.jsxs)("div",{className:"project-sidebar__proj-row flex items-center",children:[h?(0,d.jsxs)("a",{href:k,onClick:a=>{a.metaKey||a.ctrlKey||a.shiftKey||1===a.button||(a.preventDefault(),ad(k))},className:(0,i.cn)("project-sidebar__proj-toggle project-sidebar__proj-toggle--link project-sidebar__proj-toggle--degraded",g&&"project-sidebar__proj-toggle--active"),"aria-current":g?"page":void 0,children:[(0,d.jsxs)("svg",{className:"project-sidebar__proj-chevron project-sidebar__proj-chevron--degraded",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M12 9v4"}),(0,d.jsx)("path",{d:"M12 17h.01"}),(0,d.jsx)("path",{d:"M10.3 3.86 1.82 18a2 2 0 0 0 1.72 3h16.92a2 2 0 0 0 1.72-3L13.7 3.86a2 2 0 0 0-3.4 0Z"})]}),(0,d.jsx)("span",{className:"project-sidebar__proj-name",children:a.name}),(0,d.jsx)("span",{className:"project-sidebar__proj-badge project-sidebar__proj-badge--degraded",children:"degraded"})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>{var b;return b=a.id,void D(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:(0,i.cn)("project-sidebar__proj-toggle",g&&"project-sidebar__proj-toggle--active"),"aria-expanded":c,"aria-current":g?"page":void 0,children:[(0,d.jsx)("svg",{className:(0,i.cn)("project-sidebar__proj-chevron",c&&"project-sidebar__proj-chevron--open"),width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"m9 18 6-6-6-6"})}),(0,d.jsx)("span",{className:"project-sidebar__proj-name",children:a.name}),(0,d.jsx)("span",{className:(0,i.cn)("project-sidebar__proj-badge",n&&"project-sidebar__proj-badge--active"),children:b.length})]}),h?null:(0,d.jsx)(f(),{href:k,onClick:a=>{a.stopPropagation(),u?.()},className:"project-sidebar__proj-action","aria-label":`Open ${a.name} dashboard`,title:"Dashboard",children:(0,d.jsx)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M3 13h8V3H3zm10 8h8V11h-8zM3 21h8v-6H3zm10-10h8V3h-8z"})})}),!h&&p&&(0,d.jsx)(f(),{href:(0,m.Nc)(a.id,p.id),onClick:a=>{a.stopPropagation(),u?.()},className:"project-sidebar__proj-action","aria-label":`Open ${a.name} orchestrator`,title:"Orchestrator",children:(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",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"})]})}),(0,d.jsxs)("div",{className:"project-sidebar__proj-menu",ref:M===a.id?Y:void 0,children:[(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),N(b=>b===a.id?null:a.id)},className:"project-sidebar__proj-action project-sidebar__proj-action--menu","aria-label":`Project actions for ${a.name}`,"aria-expanded":M===a.id,"aria-haspopup":"menu",title:"Project actions",children:(0,d.jsxs)("svg",{width:"12",height:"12",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"1.75"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"1.75"}),(0,d.jsx)("circle",{cx:"12",cy:"19",r:"1.75"})]})}),M===a.id?(0,d.jsxs)("div",{ref:Z,className:"project-sidebar__proj-menu-popover",role:"menu","aria-label":`${a.name} actions`,children:[p?(0,d.jsx)("button",{type:"button",className:"project-sidebar__proj-menu-item",role:"menuitem",onClick:()=>{N(null),ad((0,m.Nc)(a.id,p.id))},children:"Open orchestrator"}):null,(0,d.jsx)("button",{type:"button",className:"project-sidebar__proj-menu-item",role:"menuitem",onClick:()=>{N(null),P(a.id)},children:"Project settings"}),(0,d.jsx)("button",{type:"button",className:"project-sidebar__proj-menu-item project-sidebar__proj-menu-item--danger",role:"menuitem",onClick:()=>void ae(a),disabled:Q===a.id,children:Q===a.id?"Removing...":"Remove project"})]}):null]})]}),h?(0,d.jsx)("div",{className:"project-sidebar__degraded-note",children:"Config needs repair"}):null,!h&&c&&(0,d.jsx)("div",{className:"project-sidebar__sessions",children:x?(0,d.jsx)("div",{className:"space-y-2 px-3 py-2","aria-label":"Loading sessions",children:Array.from({length:3},(b,c)=>(0,d.jsxs)("div",{className:"flex items-center gap-3 border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)] px-2 py-2",children:[(0,d.jsx)("div",{className:"h-2 w-2 shrink-0 animate-pulse bg-[var(--color-border-strong)]"}),(0,d.jsx)("div",{className:"h-3 flex-1 animate-pulse bg-[var(--color-bg-primary)]"}),(0,d.jsx)("div",{className:"h-3 w-12 animate-pulse bg-[var(--color-bg-primary)]"})]},`${a.id}-loading-${c}`))}):b.length>0?b.map(b=>{let c=(0,j.ng)(b),e=o===b.id,f=b.branch??(0,l.Pn)(b),g=(0,m.Nc)(a.id,b.id);return(0,d.jsxs)("a",{href:g,onClick:a=>{a.metaKey||a.ctrlKey||a.shiftKey||1===a.button||(a.preventDefault(),ad(g,b))},className:(0,i.cn)("project-sidebar__sess-row",e&&"project-sidebar__sess-row--active"),"aria-current":e?"page":void 0,"aria-label":`Open ${f}`,children:[(0,d.jsx)(z,{level:c}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:(0,i.cn)("project-sidebar__sess-label",e&&"project-sidebar__sess-label--active"),children:f}),I?(0,d.jsxs)("div",{className:"project-sidebar__sess-meta",children:[(0,d.jsx)("span",{className:"project-sidebar__sess-id",children:b.id}),(0,d.jsx)("span",{className:"project-sidebar__sess-status",children:B[c]})]}):null]}),I?null:(0,d.jsx)("span",{className:"project-sidebar__sess-status project-sidebar__sess-status--inline",children:B[c]})]},b.id)}):q?(0,d.jsxs)("div",{className:"px-3 py-2",children:[(0,d.jsx)("div",{className:"project-sidebar__empty",children:"Failed to load sessions"}),(0,d.jsx)("button",{type:"button",className:"mt-2 text-xs font-medium text-[var(--color-link)] hover:underline",onClick:r,children:"Retry"})]}):(0,d.jsx)("div",{className:"project-sidebar__empty",children:"No sessions shown"})})]},a.id)})}),(0,d.jsx)("div",{className:"project-sidebar__footer",children:(0,d.jsxs)("div",{className:"flex items-center gap-1 border-t border-[var(--color-border-subtle)] px-2 py-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>F(!E),className:(0,i.cn)("project-sidebar__footer-btn",E&&"project-sidebar__footer-btn--active"),"aria-pressed":E,title:E?"Hide killed sessions":"Show killed sessions","aria-label":E?"Hide killed sessions":"Show killed sessions",children:(0,d.jsxs)("svg",{width:"13",height:"13",fill:"none",stroke:"currentColor",strokeWidth:"1.75",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M12 3C7.03 3 3 7.03 3 12c0 3.1 1.5 5.84 3.8 7.55V21h2.4v-1h1.6v1h2.4v-1h1.6v1H17v-1.45A9 9 0 0 0 21 12c0-4.97-4.03-9-9-9z"}),(0,d.jsx)("circle",{cx:"9",cy:"11",r:"1.5",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"15",cy:"11",r:"1.5",fill:"currentColor",stroke:"none"})]})}),(0,d.jsx)("button",{type:"button",onClick:()=>H(!G),className:(0,i.cn)("project-sidebar__footer-btn",G&&"project-sidebar__footer-btn--active"),"aria-pressed":G,title:G?"Hide completed sessions":"Show completed sessions","aria-label":G?"Hide completed sessions":"Show completed sessions",children:(0,d.jsx)("svg",{width:"13",height:"13",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)("div",{className:"flex-1"}),(0,d.jsxs)("div",{className:"project-sidebar__settings-wrap",ref:W,children:[(0,d.jsx)("button",{type:"button",onClick:()=>L(a=>!a),className:(0,i.cn)("project-sidebar__footer-btn",K&&"project-sidebar__footer-btn--active"),"aria-expanded":K,"aria-haspopup":"dialog",title:"Sidebar settings","aria-label":"Sidebar settings",children:(0,d.jsxs)("svg",{width:"13",height:"13",fill:"none",stroke:"currentColor",strokeWidth:"1.75",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,d.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),K?(0,d.jsx)("div",{ref:X,className:"project-sidebar__settings-popover",role:"dialog","aria-label":"Sidebar settings",children:(0,d.jsxs)("label",{className:"project-sidebar__settings-row",children:[(0,d.jsx)("input",{type:"checkbox",checked:I,onChange:a=>J(a.target.checked)}),(0,d.jsx)("span",{children:"Show session ID"})]})}):null]}),(0,d.jsx)(n.U,{className:"project-sidebar__theme-toggle"})]})}),(0,d.jsx)(w,{open:U,onClose:()=>V(!1)}),(0,d.jsx)(y,{open:null!==O,projectId:O,onClose:()=>P(null)})]})}},37155:(a,b,c)=>{c.d(b,{CM:()=>d.CM,Kw:()=>k,N_:()=>d.N_,Ou:()=>i,QN:()=>g,U1:()=>d.U1,dG:()=>l,fZ:()=>e,nH:()=>m,ng:()=>o,of:()=>j,sZ:()=>f,wy:()=>n});var d=c(5241);function e(a){return a.mergeability.blockers.includes("API rate limited or unavailable")}function f(a){return!1===a.enriched}function g(a){return"open"===a.state&&a.mergeability.mergeable&&a.mergeability.ciPassing&&a.mergeability.approved&&a.mergeability.noConflicts}function h(a){return a.replace(/_/g," ")}function i(a){return a.lifecycle?.session?.label??h(a.status)}function j(a){return a.lifecycle?.pr?.label?a.lifecycle.pr.label:a.pr?.state?h(a.pr.state):"not created"}function k(a){return a.lifecycle?.runtime?.label??"unknown"}function l(a){return a.lifecycle?"done"===a.lifecycle.sessionState||"terminated"===a.lifecycle.sessionState||"merged"===a.lifecycle.prState:"merged"===a.status||"killed"===a.status||"cleanup"===a.status||"done"===a.status||"terminated"===a.status||a.pr?.state==="merged"}function m(a){return a.lifecycle?l(a)||"missing"===a.lifecycle.runtimeState||"exited"===a.lifecycle.runtimeState:d.CM.has(a.status)||null!==a.activity&&d.Rt.has(a.activity)}function n(a){return a.lifecycle?("done"===a.lifecycle.sessionState||"terminated"===a.lifecycle.sessionState||"missing"===a.lifecycle.runtimeState||"exited"===a.lifecycle.runtimeState)&&"merged"!==a.lifecycle.prState&&"merged"!==a.status:!!m(a)&&a.pr?.state!=="merged"&&"merged"!==a.status}function o(a,b="detailed"){let c=function(a){if(l(a))return"done";if(a.lifecycle?.prReason==="merge_ready"||a.lifecycle?.prReason==="approved"||"mergeable"===a.status||"approved"===a.status||a.pr&&!f(a.pr)&&a.pr.mergeability.mergeable)return"merge";if(a.lifecycle?.sessionState==="detecting"||a.lifecycle?.sessionState==="needs_input"||a.lifecycle?.sessionState==="stuck"||a.status===d.SB.ERRORED||a.status===d.SB.NEEDS_INPUT||a.status===d.SB.STUCK||a.activity===d.u3.WAITING_INPUT||a.activity===d.u3.BLOCKED||a.activity===d.u3.EXITED)return"respond";if(a.lifecycle?.prReason==="ci_failing"||a.lifecycle?.prReason==="changes_requested"||"ci_failed"===a.status||"changes_requested"===a.status)return"review";if(a.pr&&!e(a.pr)&&!f(a.pr)){let b=a.pr;if(b.ciStatus===d.U1.FAILING||"changes_requested"===b.reviewDecision||!b.mergeability.noConflicts)return"review"}if(a.lifecycle?.prReason==="review_pending"||a.lifecycle?.prReason==="closed_unmerged"||"review_pending"===a.status)return"pending";if(a.pr&&!e(a.pr)&&!f(a.pr)){let b=a.pr;if(!b.isDraft&&b.unresolvedThreads>0||!b.isDraft&&("pending"===b.reviewDecision||"none"===b.reviewDecision))return"pending"}return"working"}(a);return"simple"===b&&("respond"===c||"review"===c)?"action":c}},52754:(a,b,c)=>{c.d(b,{D:()=>e,U:()=>f});var d=c(81115);let e=767;function f(a){let[b,c]=(0,d.useState)(!1);return b}},61875:(a,b,c)=>{function d(a,b){let c=a.replace(/^(?:feat|fix|chore|refactor|docs|test|ci|session|orchestrator|release|hotfix|feature|bugfix|build|wip|improvement)\//,"");return b&&c===b?"":c.replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase()).trim()}function e(a){if(a.pr?.title)return a.pr.title;if(a.issueTitle)return a.issueTitle;if(a.displayName)return a.displayName;if(a.userPrompt)return a.userPrompt;if(a.branch){let b=d(a.branch,a.id);if(b)return b}let b=a.metadata.pinnedSummary;return b||(a.summary&&!a.summaryIsFallback||a.summary?a.summary:a.status)}function f(a){let b=Date.now()-a;if(b<6e4)return"just now";let c=Math.floor(b/6e4);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);if(e<7)return`${e}d ago`;let f=Math.floor(e/7);return`${f}w ago`}c.d(b,{Pn:()=>e,fw:()=>f,mC:()=>d})},71276:(a,b,c)=>{c.d(b,{d:()=>j,t:()=>i});var d=c(33666),e=c(81115),f=c(85489);function g(a,b){return"SHOW"===b.type?{message:b.message,variant:b.variant,key:b.key}:null}let h=(0,e.createContext)(null);function i({children:a}){let[b,c]=(0,e.useReducer)(g,null),i=(0,e.useRef)(null),j=(0,e.useRef)(0),k=(0,e.useCallback)((a,b="info")=>{null!==i.current&&clearTimeout(i.current),j.current+=1,c({type:"SHOW",message:a,variant:b,key:j.current}),i.current=setTimeout(()=>{c({type:"HIDE"}),i.current=null},3e3)},[]);return(0,d.jsxs)(h.Provider,{value:{showToast:k},children:[a,(0,d.jsx)("div",{className:"toast-container",role:"status","aria-live":"polite","aria-atomic":"true",children:b&&(0,d.jsxs)("div",{className:(0,f.cn)("toast","success"===b.variant&&"toast--success","error"===b.variant&&"toast--error","info"===b.variant&&"toast--info"),children:[(0,d.jsx)("span",{className:"toast__icon","aria-hidden":"true"}),(0,d.jsx)("span",{className:"toast__message",children:b.message})]},b.key)})]})}function j(){let a=(0,e.useContext)(h);if(!a)throw Error("useToast must be used within a ToastProvider");return a}},74566:(a,b,c)=>{c.d(b,{U:()=>g});var d=c(33666),e=c(93463),f=c(81115);function g({className:a,label:b}){let{resolvedTheme:c,setTheme:g}=(0,e.D)(),[h,i]=(0,f.useState)(!1);if(!h)return(0,d.jsx)("div",{className:a??"h-9 w-9"});let j="dark"===c;return(0,d.jsxs)("button",{onClick:()=>g(j?"light":"dark"),className:a??"flex h-9 w-9 items-center justify-center border border-[var(--color-border-strong)] bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)] transition-colors hover:bg-[var(--color-bg-elevated-hover)]","aria-label":`Switch to ${j?"light":"dark"} mode`,title:`Switch to ${j?"light":"dark"} mode`,children:[j?(0,d.jsxs)("svg",{className:"h-[18px] w-[18px]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,d.jsx)("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]}):(0,d.jsx)("svg",{className:"h-[18px] w-[18px]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"})}),b?(0,d.jsx)("span",{children:b}):null]})}},81407:(a,b,c)=>{c.d(b,{ProjectSettingsForm:()=>l});var d=c(33666),e=c(81115),f=c(50436),g=c(71276);let h="These describe which repo this is. Change them via `ao project relink`.";function i({projectId:a,initialValues:b}){let c=(0,f.useRouter)(),{showToast:h}=(0,g.d)(),[i,l]=(0,e.useState)(b.agent),[m,n]=(0,e.useState)(b.runtime),[o,p]=(0,e.useState)(b.trackerPlugin),[q,r]=(0,e.useState)(b.scmPlugin),[s,t]=(0,e.useState)(b.reactions),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(null),A=(0,e.useMemo)(()=>({agent:i.trim()||null,runtime:m.trim()||null,tracker:o.trim()?{plugin:o.trim()}:null,scm:q.trim()?{plugin:q.trim()}:null,reactions:s}),[i,m,o,q,s]),B=async()=>{let b;x(null),z(null);try{let a=s.trim();b=a?JSON.parse(a):void 0}catch{x("Reactions must be valid JSON.");return}v(!0);try{let d=await fetch(`/api/projects/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:A.agent,runtime:A.runtime,tracker:A.tracker,scm:A.scm,reactions:b??null})}),e=await d.json().catch(()=>null);if(!d.ok){let a=e?.error??"Failed to save project settings.";400===d.status?x(a):z(a);return}h("Project settings updated.","success"),c.refresh()}catch{z("Network error while saving project settings.")}finally{v(!1)}};return(0,d.jsxs)("div",{className:"project-settings-form",children:[(0,d.jsxs)("section",{className:"project-settings-form__section",children:[(0,d.jsxs)("div",{className:"project-settings-form__section-header",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"project-settings-form__eyebrow",children:"Behavior"}),(0,d.jsx)("h2",{className:"project-settings-form__section-title",children:"Runtime configuration"}),(0,d.jsx)("p",{className:"project-settings-form__section-copy",children:"These values change how AO runs this project without changing which repository the project points at."})]}),(0,d.jsx)("button",{type:"button",onClick:()=>void B(),disabled:u,className:"project-settings-form__save",children:u?"Saving...":"Save changes"})]}),(0,d.jsxs)("div",{className:"project-settings-form__grid",children:[(0,d.jsx)(j,{id:"agent",label:"Agent",value:i,onChange:l,placeholder:"claude-code"}),(0,d.jsx)(j,{id:"runtime",label:"Runtime",value:m,onChange:n,placeholder:"tmux"}),(0,d.jsx)(j,{id:"tracker-plugin",label:"Tracker plugin",value:o,onChange:p,placeholder:"github"}),(0,d.jsx)(j,{id:"scm-plugin",label:"SCM plugin",value:q,onChange:r,placeholder:"github"})]}),(0,d.jsxs)("div",{className:"project-settings-form__reactions",children:[(0,d.jsx)("label",{htmlFor:"reactions",className:"project-settings-form__label",children:"Reactions"}),(0,d.jsx)("p",{className:"project-settings-form__hint",children:"JSON object keyed by reaction name. This PATCH only sends behavior fields."}),(0,d.jsx)("textarea",{id:"reactions",value:s,onChange:a=>t(a.target.value),spellCheck:!1,rows:12,className:"project-settings-form__textarea project-settings-form__textarea--mono"})]}),w?(0,d.jsx)("div",{role:"alert",className:"project-settings-form__alert project-settings-form__alert--error",children:w}):null,y?(0,d.jsxs)("div",{className:"project-settings-form__alert project-settings-form__alert--surface",children:[(0,d.jsx)("p",{className:"project-settings-form__alert-copy",children:y}),(0,d.jsx)("button",{type:"button",onClick:()=>void B(),className:"project-settings-form__retry",children:"Retry"})]}):null]}),(0,d.jsxs)("section",{className:"project-settings-form__section",children:[(0,d.jsx)("p",{className:"project-settings-form__eyebrow",children:"Identity"}),(0,d.jsx)("h2",{className:"project-settings-form__section-title",children:"Repository identity"}),(0,d.jsx)("p",{className:"project-settings-form__section-copy",children:"These fields are read-only because they define which repository AO considers this project to be."}),(0,d.jsxs)("div",{className:"project-settings-form__grid",children:[(0,d.jsx)(k,{id:"identity-project-id",label:"Project ID",value:b.identity.projectId}),(0,d.jsx)(k,{id:"identity-path",label:"Path",value:b.identity.path}),(0,d.jsx)(k,{id:"identity-repo",label:"Repo",value:b.identity.repo}),(0,d.jsx)(k,{id:"identity-default-branch",label:"Default branch",value:b.identity.defaultBranch})]})]})]})}function j({id:a,label:b,value:c,onChange:e,placeholder:f}){return(0,d.jsxs)("label",{htmlFor:a,className:"project-settings-form__field",children:[(0,d.jsx)("span",{className:"project-settings-form__label",children:b}),(0,d.jsx)("input",{id:a,value:c,onChange:a=>e(a.target.value),placeholder:f,className:"project-settings-form__input"})]})}function k({id:a,label:b,value:c}){return(0,d.jsxs)("label",{htmlFor:a,className:"project-settings-form__field",children:[(0,d.jsx)("span",{className:"project-settings-form__label",children:b}),(0,d.jsx)("input",{id:a,value:c,disabled:!0,readOnly:!0,title:h,"aria-describedby":`${a}-tooltip`,className:"project-settings-form__input project-settings-form__input--readonly"}),(0,d.jsx)("span",{id:`${a}-tooltip`,className:"project-settings-form__hint",children:h})]})}function l(a){return(0,d.jsx)(g.t,{children:(0,d.jsx)(i,{...a})})}},85489:(a,b,c)=>{c.d(b,{cn:()=>d});function d(...a){return a.filter(Boolean).join(" ")}},88950:(a,b,c)=>{function d(a){return`/projects/${encodeURIComponent(a)}`}function e(a,b){return`${d(a)}/sessions/${encodeURIComponent(b)}`}function f(a,b,c){return`${e(a,b)}${c}`}c.d(b,{$l:()=>f,Nc:()=>e,bn:()=>d})}};
|
|
1
|
+
"use strict";exports.id=7167,exports.ids=[7167],exports.modules={5241:(a,b,c)=>{c.d(b,{CM:()=>f,N_:()=>h,Rt:()=>g,SB:()=>e,U1:()=>j,tT:()=>i,u3:()=>d});let d={ACTIVE:"active",READY:"ready",IDLE:"idle",WAITING_INPUT:"waiting_input",BLOCKED:"blocked",EXITED:"exited"},e={SPAWNING:"spawning",WORKING:"working",DETECTING:"detecting",PR_OPEN:"pr_open",CI_FAILED:"ci_failed",REVIEW_PENDING:"review_pending",CHANGES_REQUESTED:"changes_requested",APPROVED:"approved",MERGEABLE:"mergeable",MERGED:"merged",CLEANUP:"cleanup",NEEDS_INPUT:"needs_input",STUCK:"stuck",ERRORED:"errored",IDLE:"idle",KILLED:"killed",DONE:"done",TERMINATED:"terminated"},f=new Set(["killed","terminated","done","cleanup","errored","merged"]),g=new Set(["exited"]),h=new Set([]);function i(a,b,c){if(a.metadata?.role==="orchestrator")return!0;if(!b)return!1;let d=b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(a.id===`${b}-orchestrator`)return!0;if(!RegExp(`^${d}-orchestrator-\\d+$`).test(a.id))return!1;if(c){for(let d of c)if(d!==b&&RegExp(`^${d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}-\\d+$`).test(a.id))return!1}return!0}let j={PENDING:"pending",PASSING:"passing",FAILING:"failing",NONE:"none"}},20902:(a,b,c)=>{async function d(a){try{let b=await a.json(),c=b?.error??b?.message;if("string"==typeof c&&c.trim().length>0)return c.trim()}catch{}let b="string"==typeof a.statusText?a.statusText.trim():"";return b.length>0?`${a.status} ${b}`:`HTTP ${a.status}`}async function e(a,b={}){let{timeoutMs:c=8e3,timeoutMessage:f,signal:g,...h}=b,i=new AbortController,j=null,k=!1;try{let b=function(a){let b=a.filter(a=>!!a);if(0===b.length)return;if(1===b.length)return b[0];let c=new AbortController,d=()=>c.abort();for(let a of b){if(a.aborted){c.abort();break}a.addEventListener("abort",d,{once:!0})}return c.signal}([g,i.signal]),e={...h};b&&(e.signal=b);let l=new Promise((a,b)=>{j=setTimeout(()=>{k=!0,i.abort(),b(Error(f??`Request timed out after ${c}ms`))},c)}),m=await Promise.race([fetch(a,e).catch(a=>{if(k)throw Error(f??`Request timed out after ${c}ms`,{cause:a});throw a}),l]);if(!m.ok)throw Error(await d(m));return await m.json()}finally{j&&clearTimeout(j)}}c.d(b,{u:()=>e})},31849:(a,b,c)=>{c.d(b,{u:()=>C});var d=c(33666),e=c(47489),f=c.n(e),g=c(81115),h=c(50436),i=c(85489),j=c(37155),k=c(5241),l=c(61875),m=c(88950),n=c(74566);function o(a,b){return"~"===a?`~/${b}`:`${a.replace(/\/+$/,"")}/${b}`}function p({children:a,className:b,viewBox:c="0 0 16 16"}){return(0,d.jsx)("svg",{"aria-hidden":"true",viewBox:c,className:b,children:a})}let q={fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"square"},r={fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"miter"};function s(){return(0,d.jsx)(p,{className:"add-project-modal__toolicon",children:(0,d.jsx)("path",{d:"M10 3.5 6 8l4 4.5",...q})})}function t(){return(0,d.jsx)(p,{className:"add-project-modal__toolicon",children:(0,d.jsx)("path",{d:"m6 3.5 4 4.5L6 12.5",...q})})}function u(){return(0,d.jsx)(p,{className:"add-project-modal__toolicon",children:(0,d.jsx)("path",{d:"M8 12V4m0 0L5 7m3-3 3 3",...r})})}function v(){return(0,d.jsx)(p,{className:"add-project-modal__toolicon",children:(0,d.jsx)("path",{d:"M12 5V2.75H9.75M4.5 11A4.75 4.75 0 0 0 12 5M3.75 11v2.25H6m5.5-8.25A4.75 4.75 0 0 1 4 11",...r})})}function w({open:a,onClose:b}){let c=(0,h.useRouter)(),e=(0,g.useRef)(null),[f,i]=(0,g.useState)(!1),[j,k]=(0,g.useState)(null),[l,m]=(0,g.useState)(null),[n,p]=(0,g.useState)(null),[q,r]=(0,g.useState)("~"),[w,x]=(0,g.useState)("~"),[y,z]=(0,g.useState)(["~"]),[A,B]=(0,g.useState)(0),[C,D]=(0,g.useState)([]),[E,F]=(0,g.useState)(!1),[G,H]=(0,g.useState)(null),[I,J]=(0,g.useState)(""),[K,L]=(0,g.useState)(""),M=async(a,b)=>{F(!0),H(null);try{let c=await fetch(`/api/filesystem/browse?path=${encodeURIComponent(a)}`).catch(()=>null);if(!c){D([]),x(b?.selectedPath??a),H("Failed to browse directories.");return}if(!c.ok){let d=await c.json().catch(()=>null);D([]),x(b?.selectedPath??a),H(d?.error??"Failed to browse directories.");return}let d=await c.json().catch(()=>null),e=b?.mode??"push",f=b?.historyIndex??A;r(a),x(b?.selectedPath??a),D(d?.entries??[]),"push"===e?z(b=>{let c=b.slice(0,f+1);return c[c.length-1]!==a&&c.push(a),B(c.length-1),c}):z(b=>{let c=[...b];return c[f]=a,c})}catch{H("Failed to browse directories.")}finally{F(!1)}},N=(0,g.useMemo)(()=>C.filter(a=>a.isDirectory),[C]),O=(0,g.useMemo)(()=>N.find(a=>o(q,a.name)===w)??null,[q,N,w]),P=function(a){if("~"===a)return null;let b=a.split("/").filter(Boolean);return b.length<=1?"~":"~"===b[0]?`~/${b.slice(1,-1).join("/")}`:b.slice(0,-1).join("/")}(q),Q=A<y.length-1,R=I.trim()||(w.trim()&&"~"!==w?(w.split("/").filter(Boolean).pop()??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"project":""),S=K.trim()||(w.trim()&&"~"!==w?(w.split("/").filter(Boolean).pop()??"Project").replace(/[-_]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase())||"Project":""),T=""!==w.trim()&&"~"!==w&&!G&&!!O?.isGitRepo&&R.length>0&&S.length>0;N.findIndex(a=>o(q,a.name)===w);let U=async(a=!1)=>{k(null),m(null),p(null),i(!0);let d=w.trim();try{let e=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:R,name:S,path:d,useDefaultProjectId:a})}),f=await e.json().catch(()=>null);if(409===e.status&&f?.existingProjectId&&f?.suggestedProjectId&&f?.suggestion){p({error:f.error??"A project with that ID already exists.",existingProjectId:f.existingProjectId,suggestedProjectId:f.suggestedProjectId,suggestion:f.suggestion}),J(f.suggestedProjectId);return}if(!e.ok){let a=f?.error??"Failed to add project.";e.status<500?k(a):m(a);return}let g=f?.projectId??R.trim();b(),c.push(`/projects/${encodeURIComponent(g)}`),c.refresh()}catch{m("Network error while adding project.")}finally{i(!1)}};if(!a)return null;let V=a=>{a<0||a>=y.length||(B(a),M(y[a]??"~",{mode:"replace",historyIndex:a}))},W=n?(0,d.jsxs)("div",{className:"add-project-modal__notice add-project-modal__notice--warning",children:[(0,d.jsx)("p",{className:"add-project-modal__notice-title",children:n.error}),(0,d.jsxs)("p",{className:"add-project-modal__notice-copy",children:["Existing project: ",(0,d.jsx)("code",{children:n.existingProjectId})]}),(0,d.jsxs)("p",{className:"add-project-modal__notice-copy",children:["Suggested project ID: ",(0,d.jsx)("code",{children:n.suggestedProjectId})]}),(0,d.jsxs)("div",{className:"add-project-modal__notice-actions",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{b(),c.push(`/projects/${encodeURIComponent(n.existingProjectId)}`)},className:"add-project-modal__ghostbtn",children:"Open existing"}),(0,d.jsx)("button",{type:"button",onClick:()=>void U(!0),className:"add-project-modal__ghostbtn",children:"Use suggested ID"}),(0,d.jsx)("span",{className:"add-project-modal__notice-hint",children:"Edit the Project ID field or accept the suggested suffix."})]})]}):j?(0,d.jsx)("div",{role:"alert",className:"add-project-modal__notice add-project-modal__notice--error",children:j}):O&&!O.isGitRepo?(0,d.jsx)("div",{role:"alert",className:"add-project-modal__notice add-project-modal__notice--error",children:"Selected folder is not a git repository."}):l?(0,d.jsx)("div",{className:"add-project-modal__notice add-project-modal__notice--error",children:l}):null;return(0,d.jsx)("div",{className:"add-project-modal-backdrop",children:(0,d.jsxs)("div",{ref:e,role:"dialog","aria-modal":"true","aria-label":"Add project",className:"add-project-modal",tabIndex:-1,children:[(0,d.jsxs)("div",{className:"add-project-modal__titlebar",children:[(0,d.jsx)("h2",{className:"add-project-modal__windowtitle",children:"add project"}),(0,d.jsx)("button",{type:"button","aria-label":"Close",onClick:b,className:"add-project-modal__iconbtn",children:"\xd7"})]}),(0,d.jsxs)("div",{className:"add-project-modal__toolbar",children:[(0,d.jsxs)("div",{className:"add-project-modal__toolbarcluster",children:[(0,d.jsx)("button",{type:"button",onClick:()=>V(A-1),disabled:!(A>0),className:"add-project-modal__toolbtn","aria-label":"Go back",children:(0,d.jsx)(s,{})}),(0,d.jsx)("button",{type:"button",onClick:()=>V(A+1),disabled:!Q,className:"add-project-modal__toolbtn","aria-label":"Go forward",children:(0,d.jsx)(t,{})}),(0,d.jsx)("button",{type:"button",onClick:()=>P&&void M(P),disabled:!P,className:"add-project-modal__toolbtn","aria-label":"Go up",children:(0,d.jsx)(u,{})}),(0,d.jsx)("button",{type:"button",onClick:()=>void M(q,{mode:"replace",selectedPath:w}),className:"add-project-modal__toolbtn","aria-label":"Refresh",children:(0,d.jsx)(v,{})})]}),(0,d.jsx)("div",{className:"add-project-modal__location",children:q})]}),(0,d.jsx)("div",{className:"add-project-modal__content",children:(0,d.jsxs)("div",{className:"add-project-browser",children:[(0,d.jsxs)("div",{className:"add-project-browser__current",children:[(0,d.jsx)("div",{className:"add-project-browser__current-label",children:"Current folder"}),(0,d.jsx)("div",{className:"add-project-browser__current-path",children:q})]}),G?(0,d.jsxs)("div",{className:"add-project-browser__state add-project-browser__state--error",children:[(0,d.jsx)("p",{className:"add-project-browser__state-title",children:"Directory browser unavailable"}),(0,d.jsx)("p",{className:"add-project-browser__state-copy",children:G})]}):E?(0,d.jsxs)("div",{className:"add-project-browser__state",children:[(0,d.jsx)("p",{className:"add-project-browser__state-title",children:"Loading folders"}),(0,d.jsx)("p",{className:"add-project-browser__state-copy",children:"Fetching directories for this location."})]}):0===N.length?(0,d.jsxs)("div",{className:"add-project-browser__state",children:[(0,d.jsx)("p",{className:"add-project-browser__state-title",children:"No visible folders here"}),(0,d.jsx)("p",{className:"add-project-browser__state-copy",children:"Try navigating up or picking a different location."})]}):(0,d.jsxs)("div",{className:"add-project-browser__rows",children:[P?(0,d.jsx)("button",{type:"button",onClick:()=>void M(P),className:"add-project-browser__row add-project-browser__row--parent",children:".."}):null,N.map(a=>{let b=o(q,a.name);return(0,d.jsx)("button",{type:"button",onClick:()=>x(b),onDoubleClick:()=>void M(b),className:`add-project-browser__row${w===b?" is-selected":""}`,children:a.name},b)})]})]})}),(0,d.jsxs)("div",{className:"add-project-modal__pathbar add-project-modal__pathbar--selection",children:[(0,d.jsx)("span",{className:"add-project-modal__selection-label",children:"Selected"}),(0,d.jsx)("span",{className:"add-project-modal__selection-path",children:w||"No directory selected"})]}),(0,d.jsxs)("div",{className:"add-project-modal__pathbar add-project-modal__pathbar--selection",children:[(0,d.jsx)("label",{className:"add-project-modal__selection-label",htmlFor:"project-id-input",children:"Project ID"}),(0,d.jsx)("input",{id:"project-id-input",value:I,onChange:a=>J(a.target.value),className:"add-project-modal__selection-path"})]}),(0,d.jsxs)("div",{className:"add-project-modal__pathbar add-project-modal__pathbar--selection",children:[(0,d.jsx)("label",{className:"add-project-modal__selection-label",htmlFor:"project-name-input",children:"Project name"}),(0,d.jsx)("input",{id:"project-name-input",value:K,onChange:a=>L(a.target.value),className:"add-project-modal__selection-path"})]}),W,(0,d.jsxs)("div",{className:"add-project-modal__footer",children:[(0,d.jsxs)("div",{className:"add-project-modal__foldercount",children:[N.length," folders"]}),(0,d.jsxs)("div",{className:"add-project-modal__actions",children:[(0,d.jsx)("button",{type:"button",onClick:b,className:"add-project-modal__ghostbtn",children:"Cancel"}),(0,d.jsx)("button",{type:"button",onClick:()=>void U(),disabled:!T||f,className:"add-project-modal__primarybtn",children:f?"Adding…":"Add project"})]})]})]})})}var x=c(81407);function y({open:a,projectId:b,onClose:c}){let e=(0,g.useRef)(null),[f,h]=(0,g.useState)(!1),[i,j]=(0,g.useState)(null),[k,l]=(0,g.useState)(null),m=(0,g.useMemo)(()=>k&&b?{agent:k.agent??"",runtime:k.runtime??"",trackerPlugin:k.tracker?.plugin??"",scmPlugin:k.scm?.plugin??"",reactions:JSON.stringify(k.reactions??{},null,2),identity:{projectId:b,path:k.path,repo:k.repo??"",defaultBranch:k.defaultBranch??"main"}}:null,[k,b]);return a&&b?(0,d.jsx)("div",{className:"project-settings-modal-backdrop",onClick:c,children:(0,d.jsxs)("div",{ref:e,role:"dialog","aria-modal":"true","aria-label":"Project settings",className:"project-settings-modal",tabIndex:-1,onClick:a=>a.stopPropagation(),children:[(0,d.jsxs)("div",{className:"project-settings-modal__header",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"project-settings-modal__eyebrow",children:"Project settings"}),(0,d.jsx)("h2",{className:"project-settings-modal__title",children:k?.name??b})]}),(0,d.jsx)("button",{type:"button","aria-label":"Close",onClick:c,className:"project-settings-modal__close",children:"\xd7"})]}),(0,d.jsxs)("div",{className:"project-settings-modal__body",children:[f?(0,d.jsx)("div",{className:"project-settings-modal__state",children:"Loading project settings…"}):null,!f&&i?(0,d.jsx)("div",{role:"alert",className:"project-settings-modal__state project-settings-modal__state--error",children:i}):null,f||i||!m?null:(0,d.jsx)(x.ProjectSettingsForm,{projectId:b,initialValues:m})]})]})}):null}function z({level:a}){return(0,d.jsx)("div",{className:(0,i.cn)("sidebar-session-dot shrink-0 rounded-full","working"===a&&"sidebar-session-dot--glow"),"data-level":a})}function A(){return!1}let B={working:"working",pending:"pending",review:"review",respond:"respond",action:"action",merge:"merge",done:"done"};function C(a){return 0===a.projects.length?(0,d.jsx)(D,{collapsed:a.collapsed}):(0,d.jsx)(E,{...a})}function D({collapsed:a=!1}){let[b,c]=(0,g.useState)(!1);return a?(0,d.jsxs)("aside",{className:"project-sidebar project-sidebar--collapsed flex h-full flex-col items-center gap-1 py-2",children:[(0,d.jsx)("button",{type:"button",className:"project-sidebar__add-btn","aria-label":"New project",onClick:()=>c(!0),children:(0,d.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})})}),(0,d.jsx)(w,{open:b,onClose:()=>c(!1)})]}):(0,d.jsxs)("aside",{className:"project-sidebar flex h-full flex-col",children:[(0,d.jsxs)("div",{className:"project-sidebar__compact-hdr",children:[(0,d.jsx)("span",{className:"project-sidebar__sect-label",children:"Projects"}),(0,d.jsx)("button",{type:"button",className:"project-sidebar__add-btn","aria-label":"New project",onClick:()=>c(!0),children:(0,d.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})})})]}),(0,d.jsx)("div",{className:"project-sidebar__empty flex-1 text-[var(--color-text-tertiary)]",children:"No projects yet. Click + to add one."}),(0,d.jsx)("div",{className:"project-sidebar__footer",children:(0,d.jsx)("div",{className:"flex items-center justify-end gap-1 border-t border-[var(--color-border-subtle)] px-2 py-2",children:(0,d.jsx)(n.U,{className:"project-sidebar__theme-toggle"})})}),(0,d.jsx)(w,{open:b,onClose:()=>c(!1)})]})}function E({projects:a,sessions:b,orchestrators:c,activeProjectId:e,activeSessionId:o,loading:p=!1,error:q=!1,onRetry:r,collapsed:s=!1,onToggleCollapsed:t,onMobileClose:u}){let v=(0,h.useRouter)(),x=p||null===b,[C,D]=(0,g.useState)(()=>new Set(e&&"all"!==e?[e]:[])),[E,F]=(0,g.useState)(!1),[G,H]=(0,g.useState)(!1),[I,J]=(0,g.useState)(A),[K,L]=(0,g.useState)(null),[M,N]=(0,g.useState)(""),[O,P]=(0,g.useState)(new Map),[Q,R]=(0,g.useState)(!1),[S,T]=(0,g.useState)(null),[U,V]=(0,g.useState)(null),[W,X]=(0,g.useState)(null),[Y,Z]=(0,g.useState)(new Set),[$,_]=(0,g.useState)(!1),aa=(0,g.useRef)(null),ab=(0,g.useRef)(null),ac=(0,g.useRef)(null),ad=(0,g.useRef)(null),ae=(0,g.useMemo)(()=>a.filter(a=>!Y.has(a.id)),[a,Y]),af=(0,g.useMemo)(()=>new Map(ae.map(a=>[a.id,a.sessionPrefix??a.id])),[ae]),ag=(0,g.useMemo)(()=>ae.map(a=>a.sessionPrefix??a.id),[ae]),ah=(0,g.useMemo)(()=>new Map((c??[]).map(a=>[a.projectId,a])),[c]),ai=(0,g.useMemo)(()=>{let a=new Map,c=new Set(ae.map(a=>a.id));for(let d of b??[]){if(!c.has(d.projectId)||(0,k.tT)(d,af.get(d.projectId),ag)||"done"===(0,j.ng)(d)&&("killed"===d.status?!E&&!G:!G))continue;let b=a.get(d.projectId)??[];b.push(d),a.set(d.projectId,b)}return a},[b,af,ag,ae,E,G]),aj=async a=>{if(K!==a)return;let b=M.trim();L(null),N(""),P(c=>{let d=new Map(c);return d.set(a,b),d});try{let c=await fetch(`/api/sessions/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:""===b?null:b})});if(!c.ok){let a=await c.json().catch(()=>null);throw Error(a?.error??"Failed to rename session")}}catch{P(b=>{let c=new Map(b);return c.delete(a),c})}},ak=(a,b)=>{if(b)try{sessionStorage.setItem(`ao-session-nav:${b.id}`,JSON.stringify(b))}catch{}v.push(a),u?.()},al=async a=>{if(window.confirm(`Remove project ${a.name} from AO? This clears its AO sessions/history and removes it from the portfolio, but keeps the repository folder on disk.`)){X(a.id);try{let b=await fetch(`/api/projects/${encodeURIComponent(a.id)}`,{method:"DELETE"}),c=await b.json().catch(()=>null);if(!b.ok)throw Error((c&&"object"==typeof c&&"error"in c&&"string"==typeof c.error?c.error:null)??"Failed to remove project.");Z(b=>new Set(b).add(a.id)),D(b=>{let c=new Set(b);return c.delete(a.id),c}),T(null),e===a.id?v.push("/"):"refresh"in v&&"function"==typeof v.refresh&&v.refresh(),u?.()}catch(a){window.alert(a instanceof Error?a.message:"Failed to remove project.")}finally{X(null)}}};return s?(0,d.jsx)("aside",{className:(0,i.cn)("project-sidebar project-sidebar--collapsed flex flex-col h-full items-center py-2 gap-1 overflow-y-auto"),children:ae.map((a,b)=>{let c=ai.get(a.id)??[],f=a.name.slice(0,2).toUpperCase();return(0,d.jsxs)("div",{className:"flex flex-col items-center gap-0.5 w-full px-1",children:[b>0&&(0,d.jsx)("div",{className:"project-sidebar__collapsed-divider","aria-hidden":"true"}),(0,d.jsx)("a",{href:(0,m.bn)(a.id),className:(0,i.cn)("project-sidebar__collapsed-icon",e===a.id&&"project-sidebar__collapsed-icon--active"),title:a.name,"aria-label":a.name,children:(0,d.jsx)("span",{className:"project-sidebar__collapsed-abbr",children:f})}),c.slice(0,5).map(b=>{let c=(0,j.ng)(b),e=b.branch??(0,l.Pn)(b),f=(b.branch&&(0,l.mC)(b.branch)||e).replace(/\s+/g,"").slice(0,3).toUpperCase(),g=o===b.id,h=(0,m.Nc)(a.id,b.id);return(0,d.jsxs)("a",{href:h,onClick:a=>{a.metaKey||a.ctrlKey||a.shiftKey||1===a.button||(a.preventDefault(),ak(h,b))},className:(0,i.cn)("project-sidebar__collapsed-session-btn",g&&"project-sidebar__collapsed-session-btn--active"),"data-level":c,title:e,"aria-label":e,children:[(0,d.jsx)("span",{className:"project-sidebar__session-abbr-first",children:f[0]}),(0,d.jsx)("span",{className:"project-sidebar__session-abbr-rest",children:f.slice(1)})]},b.id)}),c.length>5&&(0,d.jsxs)("span",{className:"project-sidebar__collapsed-overflow",children:["+",c.length-5]})]},a.id)})}):(0,d.jsxs)("aside",{className:"project-sidebar flex h-full flex-col",children:[(0,d.jsxs)("div",{className:"project-sidebar__compact-hdr",children:[(0,d.jsx)("span",{className:"project-sidebar__sect-label",children:"Projects"}),(0,d.jsx)("button",{type:"button",className:"project-sidebar__add-btn","aria-label":"New project",onClick:()=>_(!0),children:(0,d.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 5v14M5 12h14"})})})]}),q&&b&&b.length>0?(0,d.jsxs)("div",{role:"status",className:"mx-3 mb-2 flex items-center justify-between gap-2 rounded-md border border-[var(--color-border-strong)] bg-[var(--color-bg-primary)] px-2 py-1.5 text-[11px] text-[var(--color-text-tertiary)]",children:[(0,d.jsx)("span",{children:"Failed to refresh \xb7 showing cached sessions"}),r?(0,d.jsx)("button",{type:"button",onClick:r,className:"font-medium text-[var(--color-link)] hover:underline",children:"Retry"}):null]}):null,(0,d.jsx)("div",{className:"project-sidebar__tree flex-1 overflow-y-auto overflow-x-hidden",children:ae.map(a=>{let b=ai.get(a.id)??[],c=C.has(a.id),g=e===a.id,h=!!a.resolveError,k=(0,m.bn)(a.id),n=b.length>0,p=ah.get(a.id)??null;return(0,d.jsxs)("div",{className:"project-sidebar__project",children:[(0,d.jsxs)("div",{className:"project-sidebar__proj-row flex items-center",children:[h?(0,d.jsxs)("a",{href:k,onClick:a=>{a.metaKey||a.ctrlKey||a.shiftKey||1===a.button||(a.preventDefault(),ak(k))},className:(0,i.cn)("project-sidebar__proj-toggle project-sidebar__proj-toggle--link project-sidebar__proj-toggle--degraded",g&&"project-sidebar__proj-toggle--active"),"aria-current":g?"page":void 0,children:[(0,d.jsxs)("svg",{className:"project-sidebar__proj-chevron project-sidebar__proj-chevron--degraded",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M12 9v4"}),(0,d.jsx)("path",{d:"M12 17h.01"}),(0,d.jsx)("path",{d:"M10.3 3.86 1.82 18a2 2 0 0 0 1.72 3h16.92a2 2 0 0 0 1.72-3L13.7 3.86a2 2 0 0 0-3.4 0Z"})]}),(0,d.jsx)("span",{className:"project-sidebar__proj-name",children:a.name}),(0,d.jsx)("span",{className:"project-sidebar__proj-badge project-sidebar__proj-badge--degraded",children:"degraded"})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>{var b;return b=a.id,void D(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:(0,i.cn)("project-sidebar__proj-toggle",g&&"project-sidebar__proj-toggle--active"),"aria-expanded":c,"aria-current":g?"page":void 0,children:[(0,d.jsx)("svg",{className:(0,i.cn)("project-sidebar__proj-chevron",c&&"project-sidebar__proj-chevron--open"),width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"m9 18 6-6-6-6"})}),(0,d.jsx)("span",{className:"project-sidebar__proj-name",children:a.name}),(0,d.jsx)("span",{className:(0,i.cn)("project-sidebar__proj-badge",n&&"project-sidebar__proj-badge--active"),children:b.length})]}),h?null:(0,d.jsx)(f(),{href:k,onClick:a=>{a.stopPropagation(),u?.()},className:"project-sidebar__proj-action","aria-label":`Open ${a.name} dashboard`,title:"Dashboard",children:(0,d.jsx)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M3 13h8V3H3zm10 8h8V11h-8zM3 21h8v-6H3zm10-10h8V3h-8z"})})}),!h&&p&&(0,d.jsx)(f(),{href:(0,m.Nc)(a.id,p.id),onClick:a=>{a.stopPropagation(),u?.()},className:"project-sidebar__proj-action","aria-label":`Open ${a.name} orchestrator`,title:"Orchestrator",children:(0,d.jsxs)("svg",{width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",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"})]})}),(0,d.jsxs)("div",{className:"project-sidebar__proj-menu",ref:S===a.id?ac:void 0,children:[(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),T(b=>b===a.id?null:a.id)},className:"project-sidebar__proj-action project-sidebar__proj-action--menu","aria-label":`Project actions for ${a.name}`,"aria-expanded":S===a.id,"aria-haspopup":"menu",title:"Project actions",children:(0,d.jsxs)("svg",{width:"12",height:"12",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"5",r:"1.75"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"1.75"}),(0,d.jsx)("circle",{cx:"12",cy:"19",r:"1.75"})]})}),S===a.id?(0,d.jsxs)("div",{ref:ad,className:"project-sidebar__proj-menu-popover",role:"menu","aria-label":`${a.name} actions`,children:[p?(0,d.jsx)("button",{type:"button",className:"project-sidebar__proj-menu-item",role:"menuitem",onClick:()=>{T(null),ak((0,m.Nc)(a.id,p.id))},children:"Open orchestrator"}):null,(0,d.jsx)("button",{type:"button",className:"project-sidebar__proj-menu-item",role:"menuitem",onClick:()=>{T(null),V(a.id)},children:"Project settings"}),(0,d.jsx)("button",{type:"button",className:"project-sidebar__proj-menu-item project-sidebar__proj-menu-item--danger",role:"menuitem",onClick:()=>void al(a),disabled:W===a.id,children:W===a.id?"Removing...":"Remove project"})]}):null]})]}),h?(0,d.jsx)("div",{className:"project-sidebar__degraded-note",children:"Config needs repair"}):null,!h&&c&&(0,d.jsx)("div",{className:"project-sidebar__sessions",children:x?(0,d.jsx)("div",{className:"space-y-2 px-3 py-2","aria-label":"Loading sessions",children:Array.from({length:3},(b,c)=>(0,d.jsxs)("div",{className:"flex items-center gap-3 border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)] px-2 py-2",children:[(0,d.jsx)("div",{className:"h-2 w-2 shrink-0 animate-pulse bg-[var(--color-border-strong)]"}),(0,d.jsx)("div",{className:"h-3 flex-1 animate-pulse bg-[var(--color-bg-primary)]"}),(0,d.jsx)("div",{className:"h-3 w-12 animate-pulse bg-[var(--color-bg-primary)]"})]},`${a.id}-loading-${c}`))}):b.length>0?b.map(b=>{let c=(0,j.ng)(b),e=o===b.id,f=O.get(b.id),g=void 0!==f?f:b.displayNameUserSet?b.displayName??"":"",h=""!==g?g:b.branch??(0,l.Pn)(b),k=(0,m.Nc)(a.id,b.id);return K===b.id?(0,d.jsxs)("div",{className:(0,i.cn)("project-sidebar__sess-row",e&&"project-sidebar__sess-row--active"),"data-editing":"true",children:[(0,d.jsx)(z,{level:c}),(0,d.jsx)("input",{type:"text",autoFocus:!0,value:M,onChange:a=>N(a.target.value),onKeyDown:a=>{"Enter"===a.key?(a.preventDefault(),aj(b.id)):"Escape"===a.key&&(a.preventDefault(),L(null),N(""))},onFocus:a=>a.currentTarget.select(),onBlur:()=>void aj(b.id),maxLength:80,"aria-label":`Rename ${b.id}`,className:"project-sidebar__sess-rename-input"})]},b.id):(0,d.jsxs)("div",{className:(0,i.cn)("project-sidebar__sess-row group",e&&"project-sidebar__sess-row--active"),children:[(0,d.jsxs)("a",{href:k,onClick:a=>{a.metaKey||a.ctrlKey||a.shiftKey||1===a.button||(a.preventDefault(),ak(k,b))},className:"project-sidebar__sess-link flex flex-1 min-w-0 items-center gap-[7px]","aria-current":e?"page":void 0,"aria-label":`Open ${h}`,children:[(0,d.jsx)(z,{level:c}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("span",{className:(0,i.cn)("project-sidebar__sess-label",e&&"project-sidebar__sess-label--active"),children:h}),I?(0,d.jsxs)("div",{className:"project-sidebar__sess-meta",children:[(0,d.jsx)("span",{className:"project-sidebar__sess-id",children:b.id}),(0,d.jsx)("span",{className:"project-sidebar__sess-status",children:B[c]})]}):null]}),I?null:(0,d.jsx)("span",{className:"project-sidebar__sess-status project-sidebar__sess-status--inline",children:B[c]})]}),(0,d.jsx)("button",{type:"button",onClick:a=>{a.preventDefault(),a.stopPropagation();let c=O.get(b.id)??(b.displayNameUserSet?b.displayName??"":"");L(b.id),N(c||h)},className:"project-sidebar__sess-rename-btn opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100",title:"Rename session","aria-label":`Rename ${b.id}`,children:(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M12 20h9"}),(0,d.jsx)("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})})]},b.id)}):q?(0,d.jsxs)("div",{className:"px-3 py-2",children:[(0,d.jsx)("div",{className:"project-sidebar__empty",children:"Failed to load sessions"}),(0,d.jsx)("button",{type:"button",className:"mt-2 text-xs font-medium text-[var(--color-link)] hover:underline",onClick:r,children:"Retry"})]}):(0,d.jsx)("div",{className:"project-sidebar__empty",children:"No sessions shown"})})]},a.id)})}),(0,d.jsx)("div",{className:"project-sidebar__footer",children:(0,d.jsxs)("div",{className:"flex items-center gap-1 border-t border-[var(--color-border-subtle)] px-2 py-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>F(!E),className:(0,i.cn)("project-sidebar__footer-btn",E&&"project-sidebar__footer-btn--active"),"aria-pressed":E,title:E?"Hide killed sessions":"Show killed sessions","aria-label":E?"Hide killed sessions":"Show killed sessions",children:(0,d.jsxs)("svg",{width:"13",height:"13",fill:"none",stroke:"currentColor",strokeWidth:"1.75",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M12 3C7.03 3 3 7.03 3 12c0 3.1 1.5 5.84 3.8 7.55V21h2.4v-1h1.6v1h2.4v-1h1.6v1H17v-1.45A9 9 0 0 0 21 12c0-4.97-4.03-9-9-9z"}),(0,d.jsx)("circle",{cx:"9",cy:"11",r:"1.5",fill:"currentColor",stroke:"none"}),(0,d.jsx)("circle",{cx:"15",cy:"11",r:"1.5",fill:"currentColor",stroke:"none"})]})}),(0,d.jsx)("button",{type:"button",onClick:()=>H(!G),className:(0,i.cn)("project-sidebar__footer-btn",G&&"project-sidebar__footer-btn--active"),"aria-pressed":G,title:G?"Hide completed sessions":"Show completed sessions","aria-label":G?"Hide completed sessions":"Show completed sessions",children:(0,d.jsx)("svg",{width:"13",height:"13",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)("div",{className:"flex-1"}),(0,d.jsxs)("div",{className:"project-sidebar__settings-wrap",ref:aa,children:[(0,d.jsx)("button",{type:"button",onClick:()=>R(a=>!a),className:(0,i.cn)("project-sidebar__footer-btn",Q&&"project-sidebar__footer-btn--active"),"aria-expanded":Q,"aria-haspopup":"dialog",title:"Sidebar settings","aria-label":"Sidebar settings",children:(0,d.jsxs)("svg",{width:"13",height:"13",fill:"none",stroke:"currentColor",strokeWidth:"1.75",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,d.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}),Q?(0,d.jsx)("div",{ref:ab,className:"project-sidebar__settings-popover",role:"dialog","aria-label":"Sidebar settings",children:(0,d.jsxs)("label",{className:"project-sidebar__settings-row",children:[(0,d.jsx)("input",{type:"checkbox",checked:I,onChange:a=>J(a.target.checked)}),(0,d.jsx)("span",{children:"Show session ID"})]})}):null]}),(0,d.jsx)(n.U,{className:"project-sidebar__theme-toggle"})]})}),(0,d.jsx)(w,{open:$,onClose:()=>_(!1)}),(0,d.jsx)(y,{open:null!==U,projectId:U,onClose:()=>V(null)})]})}},37155:(a,b,c)=>{c.d(b,{CM:()=>d.CM,Kw:()=>k,N_:()=>d.N_,Ou:()=>i,QN:()=>g,U1:()=>d.U1,dG:()=>l,fZ:()=>e,nH:()=>m,ng:()=>o,of:()=>j,sZ:()=>f,wy:()=>n});var d=c(5241);function e(a){return a.mergeability.blockers.includes("API rate limited or unavailable")}function f(a){return!1===a.enriched}function g(a){return"open"===a.state&&a.mergeability.mergeable&&a.mergeability.ciPassing&&a.mergeability.approved&&a.mergeability.noConflicts}function h(a){return a.replace(/_/g," ")}function i(a){return a.lifecycle?.session?.label??h(a.status)}function j(a){return a.lifecycle?.pr?.label?a.lifecycle.pr.label:a.pr?.state?h(a.pr.state):"not created"}function k(a){return a.lifecycle?.runtime?.label??"unknown"}function l(a){return a.lifecycle?"done"===a.lifecycle.sessionState||"terminated"===a.lifecycle.sessionState||"merged"===a.lifecycle.prState:"merged"===a.status||"killed"===a.status||"cleanup"===a.status||"done"===a.status||"terminated"===a.status||a.pr?.state==="merged"}function m(a){return a.lifecycle?l(a)||"missing"===a.lifecycle.runtimeState||"exited"===a.lifecycle.runtimeState:d.CM.has(a.status)||null!==a.activity&&d.Rt.has(a.activity)}function n(a){return a.lifecycle?("done"===a.lifecycle.sessionState||"terminated"===a.lifecycle.sessionState||"missing"===a.lifecycle.runtimeState||"exited"===a.lifecycle.runtimeState)&&"merged"!==a.lifecycle.prState&&"merged"!==a.status:!!m(a)&&a.pr?.state!=="merged"&&"merged"!==a.status}function o(a,b="detailed"){let c=function(a){if(l(a))return"done";if(a.lifecycle?.prReason==="merge_ready"||a.lifecycle?.prReason==="approved"||"mergeable"===a.status||"approved"===a.status||a.pr&&!f(a.pr)&&a.pr.mergeability.mergeable)return"merge";if(a.lifecycle?.sessionState==="detecting"||a.lifecycle?.sessionState==="needs_input"||a.lifecycle?.sessionState==="stuck"||a.status===d.SB.ERRORED||a.status===d.SB.NEEDS_INPUT||a.status===d.SB.STUCK||a.activity===d.u3.WAITING_INPUT||a.activity===d.u3.BLOCKED||a.activity===d.u3.EXITED)return"respond";if(a.lifecycle?.prReason==="ci_failing"||a.lifecycle?.prReason==="changes_requested"||"ci_failed"===a.status||"changes_requested"===a.status)return"review";if(a.pr&&!e(a.pr)&&!f(a.pr)){let b=a.pr;if(b.ciStatus===d.U1.FAILING||"changes_requested"===b.reviewDecision||!b.mergeability.noConflicts)return"review"}if(a.lifecycle?.prReason==="review_pending"||a.lifecycle?.prReason==="closed_unmerged"||"review_pending"===a.status)return"pending";if(a.pr&&!e(a.pr)&&!f(a.pr)){let b=a.pr;if(!b.isDraft&&b.unresolvedThreads>0||!b.isDraft&&("pending"===b.reviewDecision||"none"===b.reviewDecision))return"pending"}return"working"}(a);return"simple"===b&&("respond"===c||"review"===c)?"action":c}},52754:(a,b,c)=>{c.d(b,{D:()=>e,U:()=>f});var d=c(81115);let e=767;function f(a){let[b,c]=(0,d.useState)(!1);return b}},61875:(a,b,c)=>{function d(a,b){let c=a.replace(/^(?:feat|fix|chore|refactor|docs|test|ci|session|orchestrator|release|hotfix|feature|bugfix|build|wip|improvement)\//,"");return b&&c===b?"":c.replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase()).trim()}function e(a){if(a.displayName&&a.displayNameUserSet)return a.displayName;if(a.pr?.title)return a.pr.title;if(a.issueTitle)return a.issueTitle;if(a.displayName)return a.displayName;if(a.userPrompt)return a.userPrompt;if(a.branch){let b=d(a.branch,a.id);if(b)return b}let b=a.metadata.pinnedSummary;return b||(a.summary&&!a.summaryIsFallback||a.summary?a.summary:a.status)}function f(a){let b=Date.now()-a;if(b<6e4)return"just now";let c=Math.floor(b/6e4);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);if(e<7)return`${e}d ago`;let f=Math.floor(e/7);return`${f}w ago`}c.d(b,{Pn:()=>e,fw:()=>f,mC:()=>d})},71276:(a,b,c)=>{c.d(b,{d:()=>j,t:()=>i});var d=c(33666),e=c(81115),f=c(85489);function g(a,b){return"SHOW"===b.type?{message:b.message,variant:b.variant,key:b.key}:null}let h=(0,e.createContext)(null);function i({children:a}){let[b,c]=(0,e.useReducer)(g,null),i=(0,e.useRef)(null),j=(0,e.useRef)(0),k=(0,e.useCallback)((a,b="info")=>{null!==i.current&&clearTimeout(i.current),j.current+=1,c({type:"SHOW",message:a,variant:b,key:j.current}),i.current=setTimeout(()=>{c({type:"HIDE"}),i.current=null},3e3)},[]);return(0,d.jsxs)(h.Provider,{value:{showToast:k},children:[a,(0,d.jsx)("div",{className:"toast-container",role:"status","aria-live":"polite","aria-atomic":"true",children:b&&(0,d.jsxs)("div",{className:(0,f.cn)("toast","success"===b.variant&&"toast--success","error"===b.variant&&"toast--error","info"===b.variant&&"toast--info"),children:[(0,d.jsx)("span",{className:"toast__icon","aria-hidden":"true"}),(0,d.jsx)("span",{className:"toast__message",children:b.message})]},b.key)})]})}function j(){let a=(0,e.useContext)(h);if(!a)throw Error("useToast must be used within a ToastProvider");return a}},74566:(a,b,c)=>{c.d(b,{U:()=>g});var d=c(33666),e=c(93463),f=c(81115);function g({className:a,label:b}){let{resolvedTheme:c,setTheme:g}=(0,e.D)(),[h,i]=(0,f.useState)(!1);if(!h)return(0,d.jsx)("div",{className:a??"h-9 w-9"});let j="dark"===c;return(0,d.jsxs)("button",{onClick:()=>g(j?"light":"dark"),className:a??"flex h-9 w-9 items-center justify-center border border-[var(--color-border-strong)] bg-[var(--color-bg-elevated)] text-[var(--color-text-primary)] transition-colors hover:bg-[var(--color-bg-elevated-hover)]","aria-label":`Switch to ${j?"light":"dark"} mode`,title:`Switch to ${j?"light":"dark"} mode`,children:[j?(0,d.jsxs)("svg",{className:"h-[18px] w-[18px]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"5"}),(0,d.jsx)("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]}):(0,d.jsx)("svg",{className:"h-[18px] w-[18px]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"})}),b?(0,d.jsx)("span",{children:b}):null]})}},81407:(a,b,c)=>{c.d(b,{ProjectSettingsForm:()=>l});var d=c(33666),e=c(81115),f=c(50436),g=c(71276);let h="These describe which repo this is. Change them via `ao project relink`.";function i({projectId:a,initialValues:b}){let c=(0,f.useRouter)(),{showToast:h}=(0,g.d)(),[i,l]=(0,e.useState)(b.agent),[m,n]=(0,e.useState)(b.runtime),[o,p]=(0,e.useState)(b.trackerPlugin),[q,r]=(0,e.useState)(b.scmPlugin),[s,t]=(0,e.useState)(b.reactions),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(null),A=(0,e.useMemo)(()=>({agent:i.trim()||null,runtime:m.trim()||null,tracker:o.trim()?{plugin:o.trim()}:null,scm:q.trim()?{plugin:q.trim()}:null,reactions:s}),[i,m,o,q,s]),B=async()=>{let b;x(null),z(null);try{let a=s.trim();b=a?JSON.parse(a):void 0}catch{x("Reactions must be valid JSON.");return}v(!0);try{let d=await fetch(`/api/projects/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:A.agent,runtime:A.runtime,tracker:A.tracker,scm:A.scm,reactions:b??null})}),e=await d.json().catch(()=>null);if(!d.ok){let a=e?.error??"Failed to save project settings.";400===d.status?x(a):z(a);return}h("Project settings updated.","success"),c.refresh()}catch{z("Network error while saving project settings.")}finally{v(!1)}};return(0,d.jsxs)("div",{className:"project-settings-form",children:[(0,d.jsxs)("section",{className:"project-settings-form__section",children:[(0,d.jsxs)("div",{className:"project-settings-form__section-header",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"project-settings-form__eyebrow",children:"Behavior"}),(0,d.jsx)("h2",{className:"project-settings-form__section-title",children:"Runtime configuration"}),(0,d.jsx)("p",{className:"project-settings-form__section-copy",children:"These values change how AO runs this project without changing which repository the project points at."})]}),(0,d.jsx)("button",{type:"button",onClick:()=>void B(),disabled:u,className:"project-settings-form__save",children:u?"Saving...":"Save changes"})]}),(0,d.jsxs)("div",{className:"project-settings-form__grid",children:[(0,d.jsx)(j,{id:"agent",label:"Agent",value:i,onChange:l,placeholder:"claude-code"}),(0,d.jsx)(j,{id:"runtime",label:"Runtime",value:m,onChange:n,placeholder:"tmux"}),(0,d.jsx)(j,{id:"tracker-plugin",label:"Tracker plugin",value:o,onChange:p,placeholder:"github"}),(0,d.jsx)(j,{id:"scm-plugin",label:"SCM plugin",value:q,onChange:r,placeholder:"github"})]}),(0,d.jsxs)("div",{className:"project-settings-form__reactions",children:[(0,d.jsx)("label",{htmlFor:"reactions",className:"project-settings-form__label",children:"Reactions"}),(0,d.jsx)("p",{className:"project-settings-form__hint",children:"JSON object keyed by reaction name. This PATCH only sends behavior fields."}),(0,d.jsx)("textarea",{id:"reactions",value:s,onChange:a=>t(a.target.value),spellCheck:!1,rows:12,className:"project-settings-form__textarea project-settings-form__textarea--mono"})]}),w?(0,d.jsx)("div",{role:"alert",className:"project-settings-form__alert project-settings-form__alert--error",children:w}):null,y?(0,d.jsxs)("div",{className:"project-settings-form__alert project-settings-form__alert--surface",children:[(0,d.jsx)("p",{className:"project-settings-form__alert-copy",children:y}),(0,d.jsx)("button",{type:"button",onClick:()=>void B(),className:"project-settings-form__retry",children:"Retry"})]}):null]}),(0,d.jsxs)("section",{className:"project-settings-form__section",children:[(0,d.jsx)("p",{className:"project-settings-form__eyebrow",children:"Identity"}),(0,d.jsx)("h2",{className:"project-settings-form__section-title",children:"Repository identity"}),(0,d.jsx)("p",{className:"project-settings-form__section-copy",children:"These fields are read-only because they define which repository AO considers this project to be."}),(0,d.jsxs)("div",{className:"project-settings-form__grid",children:[(0,d.jsx)(k,{id:"identity-project-id",label:"Project ID",value:b.identity.projectId}),(0,d.jsx)(k,{id:"identity-path",label:"Path",value:b.identity.path}),(0,d.jsx)(k,{id:"identity-repo",label:"Repo",value:b.identity.repo}),(0,d.jsx)(k,{id:"identity-default-branch",label:"Default branch",value:b.identity.defaultBranch})]})]})]})}function j({id:a,label:b,value:c,onChange:e,placeholder:f}){return(0,d.jsxs)("label",{htmlFor:a,className:"project-settings-form__field",children:[(0,d.jsx)("span",{className:"project-settings-form__label",children:b}),(0,d.jsx)("input",{id:a,value:c,onChange:a=>e(a.target.value),placeholder:f,className:"project-settings-form__input"})]})}function k({id:a,label:b,value:c}){return(0,d.jsxs)("label",{htmlFor:a,className:"project-settings-form__field",children:[(0,d.jsx)("span",{className:"project-settings-form__label",children:b}),(0,d.jsx)("input",{id:a,value:c,disabled:!0,readOnly:!0,title:h,"aria-describedby":`${a}-tooltip`,className:"project-settings-form__input project-settings-form__input--readonly"}),(0,d.jsx)("span",{id:`${a}-tooltip`,className:"project-settings-form__hint",children:h})]})}function l(a){return(0,d.jsx)(g.t,{children:(0,d.jsx)(i,{...a})})}},85489:(a,b,c)=>{c.d(b,{cn:()=>d});function d(...a){return a.filter(Boolean).join(" ")}},88950:(a,b,c)=>{function d(a){return`/projects/${encodeURIComponent(a)}`}function e(a,b){return`${d(a)}/sessions/${encodeURIComponent(b)}`}function f(a,b,c){return`${e(a,b)}${c}`}c.d(b,{$l:()=>f,Nc:()=>e,bn:()=>d})}};
|
|
@@ -6,4 +6,4 @@ Description: ${v(c,7500)}
|
|
|
6
6
|
|
|
7
7
|
Resolve the comment at ${a.url} after fixing it.`;return v(d,9500)}(b),e=await fetch(`/api/sessions/${encodeURIComponent(a)}/message`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:d})});if(!e.ok)throw Error(`HTTP ${e.status}`);c()}catch(a){console.error("Failed to send message to agent:",a),d()}}function x({zones:a}){let b=[{value:a.merge,label:"merge",toneClass:"topbar-zone-pill--merge"},{value:a.respond,label:"respond",toneClass:"topbar-zone-pill--respond"},{value:a.review,label:"review",toneClass:"topbar-zone-pill--review"},{value:a.working,label:"working",toneClass:"topbar-zone-pill--working"},{value:a.pending,label:"pending",toneClass:"topbar-zone-pill--pending"},{value:a.done,label:"done",toneClass:"topbar-zone-pill--done"}].filter(a=>a.value>0);return 0===b.length?null:(0,d.jsx)(d.Fragment,{children:b.map(a=>(0,d.jsxs)("span",{className:(0,p.cn)("topbar-zone-pill",a.toneClass),children:[(0,d.jsx)("span",{className:"topbar-zone-pill__value",children:a.value}),(0,d.jsx)("span",{className:"topbar-zone-pill__label",children:a.label})]},a.label))})}function y({session:a,isOrchestrator:b,isMobile:c,terminalEnded:f,isRestorable:h,activity:j,headline:k,projects:l,orchestratorHref:m,orchestratorZones:n,onToggleSidebar:o,onRestore:q,onKill:r}){let s=a.pr,t=!!s&&(0,i.QN)(s),[v,y]=(0,e.useState)(!1),z=(0,e.useRef)(null),A=l.find(b=>b.id===a.projectId)?.name??a.projectId,B="agent orchestrator"!==A.trim().toLowerCase();return(0,d.jsxs)("header",{className:"dashboard-app-header",children:[l.length>0?(0,d.jsx)("button",{type:"button",className:"dashboard-app-sidebar-toggle",onClick:o,"aria-label":"Toggle sidebar",children:c?(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"})]})}):null,(0,d.jsx)("div",{className:"dashboard-app-header__brand dashboard-app-header__brand--hide-mobile",children:(0,d.jsx)("span",{children:"Agent Orchestrator"})}),B&&(0,d.jsx)("span",{className:"dashboard-app-header__sep topbar-desktop-only","aria-hidden":"true"}),(0,d.jsxs)("div",{className:"topbar-project-pills-group",children:[(0,d.jsxs)("div",{className:"topbar-project-line",children:[B&&(0,d.jsx)("span",{className:"dashboard-app-header__project",children:A}),(0,d.jsx)("span",{className:"dashboard-app-header__session-id topbar-mobile-only",children:a.id}),b&&(0,d.jsx)("span",{className:"session-detail-mode-badge",children:"orchestrator"})]}),(0,d.jsxs)("div",{className:"topbar-session-pills",children:[(0,d.jsxs)("div",{className:(0,p.cn)("topbar-status-pill",`topbar-status-pill--${j.label.toLowerCase().replace(/\s+/g,"-")}`),children:[(0,d.jsx)("span",{className:"topbar-status-pill__dot",style:{background:j.color}}),(0,d.jsx)("span",{className:"topbar-status-pill__label",children:j.label})]}),a.branch?s?(0,d.jsx)("a",{href:function(a){let b="https://github.com";try{b=new URL(a.url).origin}catch{}return`${b}/${a.owner}/${a.repo}/tree/${a.branch}`}(s),target:"_blank",rel:"noopener noreferrer",className:"topbar-branch-pill topbar-branch-pill--link",children:a.branch}):(0,d.jsx)("span",{className:"topbar-branch-pill",children:a.branch}):null,b&&n?(0,d.jsx)(x,{zones:n}):null]})]}),(0,d.jsx)("span",{className:"dashboard-app-header__sep topbar-desktop-only","aria-hidden":"true"}),(0,d.jsx)("span",{className:"dashboard-app-header__session-title topbar-desktop-only",children:k}),(0,d.jsx)("span",{className:"dashboard-app-header__session-id topbar-desktop-only",children:a.id}),(0,d.jsx)("div",{className:"dashboard-app-header__spacer"}),(0,d.jsxs)("div",{className:"dashboard-app-header__actions",children:[s?(0,d.jsxs)("div",{className:"topbar-pr-btn-wrap",ref:z,children:[(0,d.jsxs)("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:(0,p.cn)("dashboard-app-btn topbar-pr-btn",v&&"topbar-pr-btn--open"),onClick:a=>{a.metaKey||a.ctrlKey||a.shiftKey||1===a.button||(a.preventDefault(),y(a=>!a))},"aria-expanded":v,"aria-label":`PR #${s.number}`,children:[(0,d.jsx)("span",{className:(0,p.cn)("topbar-pr-dot",t?"topbar-pr-dot--green":s.ciStatus===g.U1.FAILING||"changes_requested"===s.reviewDecision?"topbar-pr-dot--red":"topbar-pr-dot--amber")}),"PR #",s.number,(0,d.jsx)("svg",{width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"2.5",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:v?"M18 15l-6-6-6 6":"M6 9l6 6 6-6"})})]}),v&&(0,d.jsx)("div",{className:"topbar-pr-popover",children:(0,d.jsx)(u,{pr:s,metadata:a.metadata,lifecyclePrReason:a.lifecycle?.prReason??void 0,onAskAgentToFix:(b,c,d)=>w(a.id,b,c,d)})})]}):null,h?(0,d.jsxs)("button",{type:"button",className:"dashboard-app-btn dashboard-app-btn--restore",onClick:q,children:[(0,d.jsxs)("svg",{className:"topbar-action-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"})]}),(0,d.jsx)("span",{className:"topbar-btn-label",children:"Restore"})]}):b||f?null:(0,d.jsxs)("button",{type:"button",className:"dashboard-app-btn dashboard-app-btn--danger",onClick:r,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:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})}),(0,d.jsx)("span",{className:"topbar-btn-label",children:"Kill"})]}),m?(0,d.jsxs)("a",{href:m,className:"dashboard-app-btn dashboard-app-btn--amber topbar-desktop-only","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"})]}),(0,d.jsx)("span",{className:"topbar-btn-label",children:"Orchestrator"})]}):null]})]})}function z({session:a,headline:b,pr:c,dashboardHref:e}){let f=a.lifecycle?.runtime.reasonLabel?a.lifecycle.runtime.reasonLabel:"killed"===a.status?"Manually stopped":"terminated"===a.status?"Runtime unavailable":"done"===a.status||"merged"===a.status?"Work completed":"Terminal ended",g=function(a,b){let c=a.metadata.pinnedSummary;return c||(a.summary&&!a.summaryIsFallback?a.summary:a.lifecycle?.summary?a.lifecycle.summary:a.userPrompt?a.userPrompt:a.summary?a.summary:b)}(a,b),h=a.lifecycle?.session.terminatedAt??a.lifecycle?.session.completedAt??a.lifecycle?.session.lastTransitionAt??a.lastActivityAt,i=a.lifecycle?.runtime.label??"Unavailable",j=c?"merged"===c.state?"Merged":"closed"===c.state?"Closed":c.mergeability.mergeable?"Open, merge-ready":"Open":"No PR";return(0,d.jsx)("section",{className:"session-ended-summary","aria-label":"Session ended summary",children:(0,d.jsxs)("div",{className:"session-ended-summary__panel",children:[(0,d.jsx)("div",{className:"session-ended-summary__eyebrow",children:"Terminal ended"}),(0,d.jsxs)("div",{className:"session-ended-summary__header",children:[(0,d.jsx)("div",{className:"session-ended-summary__icon","aria-hidden":"true",children:(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"1.8",viewBox:"0 0 24 24",children:[(0,d.jsx)("rect",{x:"3",y:"5",width:"18",height:"14",rx:"3"}),(0,d.jsx)("path",{d:"M7 10l3 2-3 2"}),(0,d.jsx)("path",{d:"M13 15h4"})]})}),(0,d.jsxs)("div",{className:"session-ended-summary__title-group",children:[(0,d.jsx)("h2",{className:"session-ended-summary__title",children:b}),(0,d.jsxs)("p",{className:"session-ended-summary__subtitle",children:[f,". The live terminal is gone, but the session context is still available."]})]})]}),(0,d.jsxs)("div",{className:"session-ended-summary__body",children:[(0,d.jsxs)("div",{className:"session-ended-summary__section",children:[(0,d.jsx)("div",{className:"session-ended-summary__label",children:"What happened"}),(0,d.jsx)("p",{className:"session-ended-summary__copy",children:g})]}),(0,d.jsxs)("div",{className:"session-ended-summary__facts","aria-label":"Session facts",children:[(0,d.jsxs)("div",{className:"session-ended-summary__fact",children:[(0,d.jsx)("span",{children:"Session"}),(0,d.jsx)("strong",{children:a.id})]}),(0,d.jsxs)("div",{className:"session-ended-summary__fact",children:[(0,d.jsx)("span",{children:"Ended"}),(0,d.jsx)("strong",{children:function(a){if(!a)return"Unknown";let b=new Date(a).getTime();return Number.isFinite(b)?(0,k.fw)(b):"Unknown"}(h)})]}),(0,d.jsxs)("div",{className:"session-ended-summary__fact",children:[(0,d.jsx)("span",{children:"Runtime"}),(0,d.jsx)("strong",{children:i})]}),(0,d.jsxs)("div",{className:"session-ended-summary__fact",children:[(0,d.jsx)("span",{children:"PR"}),(0,d.jsx)("strong",{children:j})]})]}),(0,d.jsxs)("div",{className:"session-ended-summary__links",children:[c?(0,d.jsxs)("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"session-ended-summary__primary",children:["Open PR #",c.number]}):null,(0,d.jsx)("a",{href:e,className:"session-ended-summary__secondary",children:"Back to dashboard"})]}),a.lifecycle?.evidence?(0,d.jsxs)("div",{className:"session-ended-summary__evidence",children:[(0,d.jsx)("span",{children:"Evidence"}),(0,d.jsx)("code",{children:a.lifecycle.evidence})]}):null]})]})})}let A=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/SessionDetail.tsx -> ./DirectTerminal"]},ssr:!1,loading:()=>(0,d.jsx)("div",{className:"h-full w-full animate-pulse rounded bg-[var(--color-bg-primary)]"})});function B({session:a,isOrchestrator:b=!1,orchestratorZones:c,projectOrchestratorId:g=null,projects:j=[],sidebarSessions:p=[],sidebarOrchestrators:r,sidebarLoading:s=!1,sidebarError:t=!1,onRetrySidebar:u}){let v=(0,f.useRouter)(),w=(0,f.useSearchParams)(),x=(0,h.U)(h.D),B="true"===w.get("fullscreen"),[C,D]=(0,e.useState)(!1),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),I=a.pr,J=i.CM.has(a.status),K=J&&!i.N_.has(a.status),L=(a.activity&&q[a.activity])??{label:a.activity??"unknown",color:"var(--color-text-muted)"},M=(0,k.Pn)(a),N=b?"orchestrator":"agent",O="opencode"===a.metadata.agent,P="string"==typeof a.metadata.opencodeSessionId&&a.metadata.opencodeSessionId.length>0?a.metadata.opencodeSessionId:void 0,Q=P?`/exit
|
|
8
8
|
opencode --session ${P}
|
|
9
|
-
`:void 0,R=a.projectId?(0,m.bn)(a.projectId):"/",S=(0,e.useCallback)(async()=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a.id)}/kill`,{method:"POST"});if(!b.ok)throw Error(`HTTP ${b.status}`);if(g)return void v.push((0,m.Nc)(a.projectId,g));v.push(R)}catch(a){console.error("Failed to kill session:",a)}},[R,g,v,a.id,a.projectId]),T=(0,e.useCallback)(async()=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a.id)}/restore`,{method:"POST"});if(!b.ok){let a=await b.text().catch(()=>"");throw Error(a||`HTTP ${b.status}`)}window.location.reload()}catch(a){console.error("Failed to restore session:",a)}},[a.id]),U=(0,e.useMemo)(()=>b?(0,m.Nc)(a.projectId,a.id):g?(0,m.Nc)(a.projectId,g):null,[b,g,a.id,a.projectId]),V=(0,e.useCallback)(()=>{x?F(a=>!a):D(a=>!a)},[x]);return(0,d.jsx)(l.I.Provider,{value:{onToggleSidebar:V,mobileSidebarOpen:E},children:(0,d.jsxs)("div",{className:"dashboard-app-shell",children:[(0,d.jsx)(y,{session:a,isOrchestrator:b,isMobile:x,terminalEnded:J,isRestorable:K,activity:L,headline:M,projects:j,orchestratorHref:U,orchestratorZones:c,onToggleSidebar:V,onRestore:T,onKill:S}),(0,d.jsxs)("div",{className:`dashboard-shell dashboard-shell--desktop${C?" dashboard-shell--sidebar-collapsed":""}`,children:[j.length>0?(0,d.jsx)("div",{className:`sidebar-wrapper${E?" sidebar-wrapper--mobile-open":""}`,children:(0,d.jsx)(n.u,{projects:j,sessions:p,orchestrators:r,loading:s,error:t,onRetry:u,activeProjectId:a.projectId,activeSessionId:a.id,collapsed:C,onToggleCollapsed:()=>D(a=>!a),onMobileClose:()=>F(!1)})}):null,E&&(0,d.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:()=>F(!1)}),(0,d.jsx)("div",{className:"dashboard-main dashboard-main--desktop",children:(0,d.jsx)("main",{className:"session-detail-page flex-1 min-h-0 flex flex-col bg-[var(--color-bg-base)]",children:(0,d.jsx)("div",{className:"flex-1 min-h-0 flex flex-col",children:G?J?(0,d.jsx)(z,{session:a,headline:M,pr:I,dashboardHref:R}):(0,d.jsx)(A,{sessionId:a.id,projectId:a.projectId,tmuxName:a.metadata?.tmuxName,startFullscreen:B,variant:N,appearance:"dark",height:"100%",isOpenCodeSession:O,reloadCommand:O?Q:void 0,autoFocus:!0}):(0,d.jsx)("div",{className:"session-detail-terminal-placeholder h-full"})})})})]}),(0,d.jsx)(o.X,{ariaLabel:"Session navigation",activeTab:b?"orchestrator":void 0,dashboardHref:R,prsHref:a.projectId?`/?project=${encodeURIComponent(a.projectId)}&tab=prs`:"/",showOrchestrator:!!U,orchestratorHref:U})]})})}var C=c(23041),D=c(58976),E=c(20902);let F=null,G=null,H=new Set(Object.values(g.SB)),I=new Set(Object.values(g.u3)),J=new Set;function K(a){if(a instanceof DOMException)return"AbortError"===a.name;if(a instanceof Error){let b=a.message.toLowerCase();return b.includes("aborted")||b.includes("aborterror")}return!1}function L({message:a}){return(0,d.jsx)("div",{className:"project-sidebar h-full",children:(0,d.jsxs)("div",{className:"space-y-3 px-3 py-4",children:[(0,d.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-[var(--color-text-tertiary)]",children:"Projects"}),(0,d.jsx)("div",{className:"space-y-2",children:Array.from({length:3},(a,b)=>(0,d.jsx)("div",{className:"h-10 animate-pulse border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)]"},`sidebar-placeholder-${b}`))}),(0,d.jsx)("div",{className:"pt-2 text-[12px] text-[var(--color-text-tertiary)]",children:a})]})})}function M({projects:a,projectsLoading:b,sidebarSessions:c,sidebarOrchestrators:f,sidebarLoading:g,sidebarError:i,onRetrySidebar:j,activeProjectId:k,activeSessionId:l,children:m}){let o=(0,h.U)(h.D),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),t=(0,e.useCallback)(()=>{if(o)return void s(a=>!a);q(a=>!a)},[o]);return(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:t,"aria-label":"Toggle sidebar",children:o?(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.jsx)("div",{className:"dashboard-app-header__brand",children:(0,d.jsx)("span",{children:"Agent Orchestrator"})}),(0,d.jsx)("div",{className:"dashboard-app-header__spacer"})]}),(0,d.jsxs)("div",{className:`dashboard-shell dashboard-shell--desktop${p?" dashboard-shell--sidebar-collapsed":""}`,children:[(0,d.jsx)("div",{className:`sidebar-wrapper${r?" sidebar-wrapper--mobile-open":""}`,children:a.length>0?(0,d.jsx)(n.u,{projects:a,sessions:c,orchestrators:f,loading:g,error:i,onRetry:j,activeProjectId:k,activeSessionId:l,collapsed:p,onToggleCollapsed:()=>q(a=>!a),onMobileClose:()=>s(!1)}):(0,d.jsx)(L,{message:b?"Loading projects...":"Projects unavailable."})}),r&&(0,d.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:()=>s(!1)}),(0,d.jsx)("div",{className:"dashboard-main dashboard-main--desktop",children:(0,d.jsx)("main",{className:"session-detail-page flex-1 min-h-0 flex flex-col bg-[var(--color-bg-base)]",children:(0,d.jsx)("div",{className:"flex-1 min-h-0",children:m})})})]})]})}function N(){let a=(0,f.useParams)();(0,f.usePathname)(),(0,f.useRouter)();let b=a.id,c="string"==typeof a.projectId?a.projectId:Array.isArray(a.projectId)?a.projectId[0]:null;(0,D.eT)();let h=(()=>{if("undefined"==typeof sessionStorage)return null;try{let a=sessionStorage.getItem(`ao-session-nav:${b}`);if(a)return sessionStorage.removeItem(`ao-session-nav:${b}`),JSON.parse(a)}catch{}return null})(),[j,k]=(0,e.useState)(h),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(void 0),[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(null===F),[t,u]=(0,e.useState)(()=>G),[v,w]=(0,e.useState)(void 0),[x,y]=(0,e.useState)(null===h),[z,A]=(0,e.useState)(null),[L,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(new Map);j?.projectId;let S=[...Q.values()],T=!!j&&(0,g.tT)(j,Q.get(j.projectId),S),U=(0,e.useRef)(null),V=(0,e.useRef)(!1),W=(0,e.useRef)(null),X=(0,e.useRef)(new Map),Y=(0,e.useRef)(null!==h),Z=(0,e.useRef)(null),$=(0,e.useRef)(!1),_=(0,e.useRef)(!1),aa=(0,e.useRef)(!1),ab=(0,e.useRef)(null),ac=(0,e.useRef)(null),ad=(0,e.useRef)(null),ae=(0,e.useRef)(!1),af=(0,e.useCallback)(async()=>{F&&(q(F),R(new Map(F.map(a=>[a.id,a.sessionPrefix??a.id]))),s(!1));try{var a,b;let c=await (0,E.u)("/api/projects",{timeoutMs:5e3,timeoutMessage:"Projects request timed out after 5000ms"});if(!c?.projects)return;a=F,b=c.projects,a&&a.length===b.length&&a.every((a,c)=>{let d=b[c];return JSON.stringify(a)===JSON.stringify(d)})||(F=c.projects,q(c.projects),R(new Map(c.projects.map(a=>[a.id,a.sessionPrefix??a.id]))))}catch(a){console.error("Failed to fetch projects:",a)}finally{s(!1)}},[]);var ag=b;let ah=(0,D.eT)(),ai=ah?.sessions.find(a=>a.id===ag);(0,e.useMemo)(()=>ai?{activity:ai.activity??null}:null,[ai]);let aj=(0,e.useCallback)(async()=>{if($.current)return;$.current=!0;let a=new AbortController;ab.current=a;try{let c=await (0,E.u)(`/api/sessions/${encodeURIComponent(b)}`,{signal:a.signal,timeoutMs:8e3,timeoutMessage:"Session request timed out after 8000ms"});k(c),A(null),N(!1),Y.current=!0}catch(c){if(ae.current||a.signal.aborted||K(c))return;let b=(c instanceof Error?c.message:"Failed to load session").toLowerCase();if(b.includes("session not found")||b.includes("http 404")){Y.current||N(!0),y(!1);return}console.error("Failed to fetch session:",c),Y.current||A(c instanceof Error?c:Error("Failed to load session"))}finally{y(!1),$.current=!1,ab.current===a&&(ab.current=null)}},[b]);(0,e.useCallback)(async()=>{if(_.current)return;let a=U.current;if(!a)return;let b=V.current,c=`${a}:${b?"orchestrator":"worker"}`;if(!b&&W.current===c)return;_.current=!0;let d=new AbortController;ac.current=d;try{let e=b?`/api/sessions?project=${encodeURIComponent(a)}&fresh=true`:`/api/sessions?project=${encodeURIComponent(a)}&orchestratorOnly=true&fresh=true`,f=await (0,E.u)(e,{signal:d.signal,timeoutMs:5e3,timeoutMessage:"Project sessions request timed out after 5000ms"}),h=f.sessions??[],j=f.orchestratorId??f.orchestrators?.find(b=>b.projectId===a)?.id??null;if(o(a=>a===j?a:j),!b){W.current=c;return}let k={merge:0,respond:0,review:0,pending:0,working:0,done:0},l=[...X.current.values()];for(let a of h)if(!(0,g.tT)(a,X.current.get(a.projectId),l)){let b=(0,i.ng)(a);if("action"===b)continue;k[b]++}m(k)}catch(a){if(ae.current||d.signal.aborted||K(a))return;console.error("Failed to fetch project sessions:",a)}finally{_.current=!1,ac.current===d&&(ac.current=null)}},[]);let ak=(0,e.useCallback)(async()=>{if(aa.current)return;aa.current=!0;let a=new AbortController;ad.current=a;try{let b=await (0,E.u)("/api/sessions?fresh=true",{signal:a.signal,timeoutMs:5e3,timeoutMessage:"Sidebar sessions request timed out after 5000ms"}),c=b?.sessions??[],d=function(a,b){if(!a||0===b.length)return a;let c=new Map(b.map(a=>[a.id,a])),d=!1,e=a.map(a=>{var b,e;let f=c.get(a.id);if(!f)return a;if(b=f.status,!H.has(b)){let b=`status:${f.status}`;return J.has(b)||(J.add(b),console.warn("Ignoring mux session patch with unknown status",{sessionId:f.id,status:f.status})),a}if(null!==f.activity&&(e=f.activity,!I.has(e))){let b=`activity:${f.activity}`;return J.has(b)||(J.add(b),console.warn("Ignoring mux session patch with unknown activity",{sessionId:f.id,activity:f.activity})),a}return a.status===f.status&&a.activity===f.activity&&a.lastActivityAt===f.lastActivityAt?a:(d=!0,{...a,status:f.status,activity:f.activity,lastActivityAt:f.lastActivityAt})});return d?e:a}(c,Z.current??[])??c;G=d,w(b?.orchestrators),P(!1),u(a=>a&&a.length===d.length&&a.every((a,b)=>{let c=d[b];return JSON.stringify(a)===JSON.stringify(c)})?a:d)}catch(b){if(ae.current||a.signal.aborted||K(b))return;console.error("Failed to fetch sidebar sessions:",b),P(!0),u(a=>null===a?[]:a)}finally{aa.current=!1,ad.current===a&&(ad.current=null)}},[]);return x?(0,d.jsx)(M,{projects:p,projectsLoading:r,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak,activeProjectId:c??void 0,activeSessionId:b,children:(0,d.jsx)("div",{className:"flex h-full min-h-screen items-center justify-center bg-[var(--color-bg-base)]",children:(0,d.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,d.jsx)("svg",{className:"h-5 w-5 animate-spin text-[var(--color-text-tertiary)]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 3a9 9 0 1 0 9 9"})}),(0,d.jsx)("div",{className:"text-[13px] text-[var(--color-text-tertiary)]",children:"Loading session…"})]})})}):L?(0,d.jsx)(M,{projects:p,projectsLoading:r,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak,activeProjectId:c??void 0,activeSessionId:b,children:(0,d.jsx)(C.ErrorDisplay,{title:"Session not found",message:"This session is no longer available. It may have been removed, renamed, or already cleaned up.",tone:"not-found",primaryAction:{label:"Back to dashboard",href:c?`/projects/${c}`:"/"},secondaryAction:{label:"Retry",onClick:()=>void aj()},compact:!0,chrome:"card"})}):z?(0,d.jsx)(M,{projects:p,projectsLoading:r,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak,activeProjectId:j?.projectId??c??void 0,activeSessionId:b,children:(0,d.jsx)(C.ErrorDisplay,{title:"Failed to load session",message:function(a){let b=a.message.toLowerCase();return b.includes("timed out")?"The session request is taking too long, so the page stopped waiting instead of spinning forever. You can retry, or return to the project and reopen a different session.":b.includes("network")?"The session request failed before the dashboard got a response. Check the local server connection and try again.":b.includes("404")?"This session is no longer available. It may have been removed while the page was open.":b.includes("500")?"The server returned an internal error while loading this session. Try again to re-fetch the latest state.":"The dashboard could not load this session cleanly. Try again to re-fetch the latest state."}(z),tone:"error",primaryAction:{label:"Try again",onClick:()=>{A(null),N(!1),y(!0),Promise.all([af(),aj(),ak()])}},secondaryAction:{label:"Back to dashboard",href:j?.projectId?`/projects/${j.projectId}`:"/"},error:z,compact:!0,chrome:"card"})}):j?(0,d.jsx)(B,{session:j,isOrchestrator:T,orchestratorZones:l??void 0,projectOrchestratorId:n,projects:p,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak}):(0,d.jsx)(M,{projects:p,projectsLoading:r,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak,activeProjectId:c??void 0,activeSessionId:b,children:(0,d.jsx)(C.ErrorDisplay,{title:"Session unavailable",message:"The backend has not returned this session yet. This can happen right after spawning an orchestrator; retry once the terminal registers the session.",tone:"error",primaryAction:{label:"Retry",onClick:()=>void aj()},secondaryAction:{label:"Back to dashboard",href:c?`/projects/${c}`:"/"},compact:!0,chrome:"card"})})}},18287:(a,b,c)=>{c.d(b,{default:()=>e.a});var d=c(26050),e=c.n(d)},26050:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return e}});let d=c(32697)._(c(90994));function e(a,b){var c;let e={};"function"==typeof a&&(e.loader=a);let f={...e,...b};return(0,d.default)({...f,modules:null==(c=f.loadableGenerated)?void 0:c.modules})}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},26745:(a,b,c)=>{c.r(b),c.d(b,{default:()=>d});let d=(0,c(10864).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/equinox/.agent-orchestrator/projects/agent-orchestrator/worktrees/ao-179/packages/web/src/app/sessions/[id]/page.tsx\" from the server, but it's 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/app/sessions/[id]/page.tsx","default")},54170:(a,b)=>{function c(a){return a.split("/").map(a=>encodeURIComponent(a)).join("/")}Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"encodeURIPath",{enumerable:!0,get:function(){return c}})},70162:(a,b,c)=>{c.d(b,{I:()=>d});let d=(0,c(81115).createContext)(null)},70424:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"PreloadChunks",{enumerable:!0,get:function(){return h}});let d=c(33666),e=c(51538),f=c(29294),g=c(54170);function h(a){let{moduleIds:b}=a,c=f.workAsyncStorage.getStore();if(void 0===c)return null;let h=[];if(c.reactLoadableManifest&&b){let a=c.reactLoadableManifest;for(let c of b){if(!a[c])continue;let b=a[c].files;h.push(...b)}}return 0===h.length?null:(0,d.jsx)(d.Fragment,{children:h.map(a=>{let b=c.assetPrefix+"/_next/"+(0,g.encodeURIPath)(a);return a.endsWith(".css")?(0,d.jsx)("link",{precedence:"dynamic",href:b,rel:"stylesheet",as:"style"},a):((0,e.preload)(b,{as:"script",fetchPriority:"low"}),null)})})}},88087:(a,b,c)=>{c.d(b,{X:()=>g});var d=c(33666),e=c(47489),f=c.n(e);function g({ariaLabel:a,activeTab:b,dashboardHref:c,prsHref:e,showOrchestrator:g=!0,orchestratorHref:h=null}){return(0,d.jsxs)("nav",{className:"mobile-bottom-nav","aria-label":a,children:[(0,d.jsxs)(f(),{href:c,className:"mobile-bottom-nav__item","data-active":"dashboard"===b?"true":"false","aria-current":"dashboard"===b?"page":void 0,children:[(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M3 13h8V3H3zm10 8h8V11h-8zM3 21h8v-6H3zm10-10h8V3h-8z"})}),(0,d.jsx)("span",{children:"Dashboard"})]}),(0,d.jsxs)(f(),{href:e,className:"mobile-bottom-nav__item","data-active":"prs"===b?"true":"false","aria-current":"prs"===b?"page":void 0,children:[(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})}),(0,d.jsx)("span",{children:"PRs"})]}),g?h?(0,d.jsxs)(f(),{href:h,className:"mobile-bottom-nav__item","data-active":"orchestrator"===b?"true":"false","aria-current":"orchestrator"===b?"page":void 0,children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M9 3H5a2 2 0 0 0-2 2v4m16 0V5a2 2 0 0 0-2-2h-4m0 18h4a2 2 0 0 0 2-2v-4M3 15v4a2 2 0 0 0 2 2h4"}),(0,d.jsx)("path",{d:"M9 9h6v6H9z"})]}),(0,d.jsx)("span",{children:"Orchestrator"})]}):(0,d.jsxs)("button",{type:"button",className:"mobile-bottom-nav__item",disabled:!0,children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M9 3H5a2 2 0 0 0-2 2v4m16 0V5a2 2 0 0 0-2-2h-4m0 18h4a2 2 0 0 0 2-2v-4M3 15v4a2 2 0 0 0 2 2h4"}),(0,d.jsx)("path",{d:"M9 9h6v6H9z"})]}),(0,d.jsx)("span",{children:"Orchestrator"})]}):null]})}},90994:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return j}});let d=c(33666),e=c(81115),f=c(97053),g=c(70424);function h(a){return{default:a&&"default"in a?a.default:a}}let i={loader:()=>Promise.resolve(h(()=>null)),loading:null,ssr:!0},j=function(a){let b={...i,...a},c=(0,e.lazy)(()=>b.loader().then(h)),j=b.loading;function k(a){let h=j?(0,d.jsx)(j,{isLoading:!0,pastDelay:!0,error:null}):null,i=!b.ssr||!!b.loading,k=i?e.Suspense:e.Fragment,l=b.ssr?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.PreloadChunks,{moduleIds:b.modules}),(0,d.jsx)(c,{...a})]}):(0,d.jsx)(f.BailoutToCSR,{reason:"next/dynamic",children:(0,d.jsx)(c,{...a})});return(0,d.jsx)(k,{...i?{fallback:h}:{},children:l})}return k.displayName="LoadableComponent",k}},97053:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"BailoutToCSR",{enumerable:!0,get:function(){return e}});let d=c(35945);function e(a){let{reason:b,children:c}=a;throw Object.defineProperty(new d.BailoutToCSRError(b),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}}};
|
|
9
|
+
`:void 0,R=a.projectId?(0,m.bn)(a.projectId):"/",S=(0,e.useCallback)(async()=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a.id)}/kill`,{method:"POST"});if(!b.ok)throw Error(`HTTP ${b.status}`);if(g)return void v.push((0,m.Nc)(a.projectId,g));v.push(R)}catch(a){console.error("Failed to kill session:",a)}},[R,g,v,a.id,a.projectId]),T=(0,e.useCallback)(async()=>{try{let b=await fetch(`/api/sessions/${encodeURIComponent(a.id)}/restore`,{method:"POST"});if(!b.ok){let a=await b.text().catch(()=>"");throw Error(a||`HTTP ${b.status}`)}window.location.reload()}catch(a){console.error("Failed to restore session:",a)}},[a.id]),U=(0,e.useMemo)(()=>b?(0,m.Nc)(a.projectId,a.id):g?(0,m.Nc)(a.projectId,g):null,[b,g,a.id,a.projectId]),V=(0,e.useCallback)(()=>{x?F(a=>!a):D(a=>!a)},[x]);return(0,d.jsx)(l.I.Provider,{value:{onToggleSidebar:V,mobileSidebarOpen:E},children:(0,d.jsxs)("div",{className:"dashboard-app-shell",children:[(0,d.jsx)(y,{session:a,isOrchestrator:b,isMobile:x,terminalEnded:J,isRestorable:K,activity:L,headline:M,projects:j,orchestratorHref:U,orchestratorZones:c,onToggleSidebar:V,onRestore:T,onKill:S}),(0,d.jsxs)("div",{className:`dashboard-shell dashboard-shell--desktop${C?" dashboard-shell--sidebar-collapsed":""}`,children:[j.length>0?(0,d.jsx)("div",{className:`sidebar-wrapper${E?" sidebar-wrapper--mobile-open":""}`,children:(0,d.jsx)(n.u,{projects:j,sessions:p,orchestrators:r,loading:s,error:t,onRetry:u,activeProjectId:a.projectId,activeSessionId:a.id,collapsed:C,onToggleCollapsed:()=>D(a=>!a),onMobileClose:()=>F(!1)})}):null,E&&(0,d.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:()=>F(!1)}),(0,d.jsx)("div",{className:"dashboard-main dashboard-main--desktop",children:(0,d.jsx)("main",{className:"session-detail-page flex-1 min-h-0 flex flex-col bg-[var(--color-bg-base)]",children:(0,d.jsx)("div",{className:"flex-1 min-h-0 flex flex-col",children:G?J?(0,d.jsx)(z,{session:a,headline:M,pr:I,dashboardHref:R}):(0,d.jsx)(A,{sessionId:a.id,projectId:a.projectId,tmuxName:a.metadata?.tmuxName,startFullscreen:B,variant:N,appearance:"dark",height:"100%",isOpenCodeSession:O,reloadCommand:O?Q:void 0,autoFocus:!0}):(0,d.jsx)("div",{className:"session-detail-terminal-placeholder h-full"})})})})]}),(0,d.jsx)(o.X,{ariaLabel:"Session navigation",activeTab:b?"orchestrator":void 0,dashboardHref:R,prsHref:a.projectId?`/?project=${encodeURIComponent(a.projectId)}&tab=prs`:"/",showOrchestrator:!!U,orchestratorHref:U})]})})}var C=c(23041),D=c(58976),E=c(20902);let F=null,G=null,H=new Set(Object.values(g.SB)),I=new Set(Object.values(g.u3)),J=new Set;function K(a){if(a instanceof DOMException)return"AbortError"===a.name;if(a instanceof Error){let b=a.message.toLowerCase();return b.includes("aborted")||b.includes("aborterror")}return!1}function L({message:a}){return(0,d.jsx)("div",{className:"project-sidebar h-full",children:(0,d.jsxs)("div",{className:"space-y-3 px-3 py-4",children:[(0,d.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-[var(--color-text-tertiary)]",children:"Projects"}),(0,d.jsx)("div",{className:"space-y-2",children:Array.from({length:3},(a,b)=>(0,d.jsx)("div",{className:"h-10 animate-pulse border border-[var(--color-border-subtle)] bg-[var(--color-bg-surface)]"},`sidebar-placeholder-${b}`))}),(0,d.jsx)("div",{className:"pt-2 text-[12px] text-[var(--color-text-tertiary)]",children:a})]})})}function M({projects:a,projectsLoading:b,sidebarSessions:c,sidebarOrchestrators:f,sidebarLoading:g,sidebarError:i,onRetrySidebar:j,activeProjectId:k,activeSessionId:l,children:m}){let o=(0,h.U)(h.D),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),t=(0,e.useCallback)(()=>{if(o)return void s(a=>!a);q(a=>!a)},[o]);return(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:t,"aria-label":"Toggle sidebar",children:o?(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.jsx)("div",{className:"dashboard-app-header__brand",children:(0,d.jsx)("span",{children:"Agent Orchestrator"})}),(0,d.jsx)("div",{className:"dashboard-app-header__spacer"})]}),(0,d.jsxs)("div",{className:`dashboard-shell dashboard-shell--desktop${p?" dashboard-shell--sidebar-collapsed":""}`,children:[(0,d.jsx)("div",{className:`sidebar-wrapper${r?" sidebar-wrapper--mobile-open":""}`,children:a.length>0?(0,d.jsx)(n.u,{projects:a,sessions:c,orchestrators:f,loading:g,error:i,onRetry:j,activeProjectId:k,activeSessionId:l,collapsed:p,onToggleCollapsed:()=>q(a=>!a),onMobileClose:()=>s(!1)}):(0,d.jsx)(L,{message:b?"Loading projects...":"Projects unavailable."})}),r&&(0,d.jsx)("div",{className:"sidebar-mobile-backdrop",onClick:()=>s(!1)}),(0,d.jsx)("div",{className:"dashboard-main dashboard-main--desktop",children:(0,d.jsx)("main",{className:"session-detail-page flex-1 min-h-0 flex flex-col bg-[var(--color-bg-base)]",children:(0,d.jsx)("div",{className:"flex-1 min-h-0",children:m})})})]})]})}function N(){let a=(0,f.useParams)();(0,f.usePathname)(),(0,f.useRouter)();let b=a.id,c="string"==typeof a.projectId?a.projectId:Array.isArray(a.projectId)?a.projectId[0]:null;(0,D.eT)();let h=(()=>{if("undefined"==typeof sessionStorage)return null;try{let a=sessionStorage.getItem(`ao-session-nav:${b}`);if(a)return sessionStorage.removeItem(`ao-session-nav:${b}`),JSON.parse(a)}catch{}return null})(),[j,k]=(0,e.useState)(h),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(void 0),[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(null===F),[t,u]=(0,e.useState)(()=>G),[v,w]=(0,e.useState)(void 0),[x,y]=(0,e.useState)(null===h),[z,A]=(0,e.useState)(null),[L,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(new Map);j?.projectId;let S=[...Q.values()],T=!!j&&(0,g.tT)(j,Q.get(j.projectId),S),U=(0,e.useRef)(null),V=(0,e.useRef)(!1),W=(0,e.useRef)(null),X=(0,e.useRef)(new Map),Y=(0,e.useRef)(null!==h),Z=(0,e.useRef)(null),$=(0,e.useRef)(!1),_=(0,e.useRef)(!1),aa=(0,e.useRef)(!1),ab=(0,e.useRef)(null),ac=(0,e.useRef)(null),ad=(0,e.useRef)(null),ae=(0,e.useRef)(!1),af=(0,e.useCallback)(async()=>{F&&(q(F),R(new Map(F.map(a=>[a.id,a.sessionPrefix??a.id]))),s(!1));try{var a,b;let c=await (0,E.u)("/api/projects",{timeoutMs:5e3,timeoutMessage:"Projects request timed out after 5000ms"});if(!c?.projects)return;a=F,b=c.projects,a&&a.length===b.length&&a.every((a,c)=>{let d=b[c];return JSON.stringify(a)===JSON.stringify(d)})||(F=c.projects,q(c.projects),R(new Map(c.projects.map(a=>[a.id,a.sessionPrefix??a.id]))))}catch(a){console.error("Failed to fetch projects:",a)}finally{s(!1)}},[]);var ag=b;let ah=(0,D.eT)(),ai=ah?.sessions.find(a=>a.id===ag);(0,e.useMemo)(()=>ai?{activity:ai.activity??null}:null,[ai]);let aj=(0,e.useCallback)(async()=>{if($.current)return;$.current=!0;let a=new AbortController;ab.current=a;try{let c=await (0,E.u)(`/api/sessions/${encodeURIComponent(b)}`,{signal:a.signal,timeoutMs:8e3,timeoutMessage:"Session request timed out after 8000ms"});k(c),A(null),N(!1),Y.current=!0}catch(c){if(ae.current||a.signal.aborted||K(c))return;let b=(c instanceof Error?c.message:"Failed to load session").toLowerCase();if(b.includes("session not found")||b.includes("http 404")){Y.current||N(!0),y(!1);return}console.error("Failed to fetch session:",c),Y.current||A(c instanceof Error?c:Error("Failed to load session"))}finally{y(!1),$.current=!1,ab.current===a&&(ab.current=null)}},[b]);(0,e.useCallback)(async()=>{if(_.current)return;let a=U.current;if(!a)return;let b=V.current,c=`${a}:${b?"orchestrator":"worker"}`;if(!b&&W.current===c)return;_.current=!0;let d=new AbortController;ac.current=d;try{let e=b?`/api/sessions?project=${encodeURIComponent(a)}&fresh=true`:`/api/sessions?project=${encodeURIComponent(a)}&orchestratorOnly=true&fresh=true`,f=await (0,E.u)(e,{signal:d.signal,timeoutMs:5e3,timeoutMessage:"Project sessions request timed out after 5000ms"}),h=f.sessions??[],j=f.orchestratorId??f.orchestrators?.find(b=>b.projectId===a)?.id??null;if(o(a=>a===j?a:j),!b){W.current=c;return}let k={merge:0,respond:0,review:0,pending:0,working:0,done:0},l=[...X.current.values()];for(let a of h)if(!(0,g.tT)(a,X.current.get(a.projectId),l)){let b=(0,i.ng)(a);if("action"===b)continue;k[b]++}m(k)}catch(a){if(ae.current||d.signal.aborted||K(a))return;console.error("Failed to fetch project sessions:",a)}finally{_.current=!1,ac.current===d&&(ac.current=null)}},[]);let ak=(0,e.useCallback)(async()=>{if(aa.current)return;aa.current=!0;let a=new AbortController;ad.current=a;try{let b=await (0,E.u)("/api/sessions?fresh=true",{signal:a.signal,timeoutMs:5e3,timeoutMessage:"Sidebar sessions request timed out after 5000ms"}),c=b?.sessions??[],d=function(a,b){if(!a||0===b.length)return a;let c=new Map(b.map(a=>[a.id,a])),d=!1,e=a.map(a=>{var b,e;let f=c.get(a.id);if(!f)return a;if(b=f.status,!H.has(b)){let b=`status:${f.status}`;return J.has(b)||(J.add(b),console.warn("Ignoring mux session patch with unknown status",{sessionId:f.id,status:f.status})),a}if(null!==f.activity&&(e=f.activity,!I.has(e))){let b=`activity:${f.activity}`;return J.has(b)||(J.add(b),console.warn("Ignoring mux session patch with unknown activity",{sessionId:f.id,activity:f.activity})),a}return a.status===f.status&&a.activity===f.activity&&a.lastActivityAt===f.lastActivityAt?a:(d=!0,{...a,status:f.status,activity:f.activity,lastActivityAt:f.lastActivityAt})});return d?e:a}(c,Z.current??[])??c;G=d,w(b?.orchestrators),P(!1),u(a=>a&&a.length===d.length&&a.every((a,b)=>{let c=d[b];return JSON.stringify(a)===JSON.stringify(c)})?a:d)}catch(b){if(ae.current||a.signal.aborted||K(b))return;console.error("Failed to fetch sidebar sessions:",b),P(!0),u(a=>null===a?[]:a)}finally{aa.current=!1,ad.current===a&&(ad.current=null)}},[]);return x?(0,d.jsx)(M,{projects:p,projectsLoading:r,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak,activeProjectId:c??void 0,activeSessionId:b,children:(0,d.jsx)("div",{className:"flex h-full min-h-screen items-center justify-center bg-[var(--color-bg-base)]",children:(0,d.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,d.jsx)("svg",{className:"h-5 w-5 animate-spin text-[var(--color-text-tertiary)]",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 3a9 9 0 1 0 9 9"})}),(0,d.jsx)("div",{className:"text-[13px] text-[var(--color-text-tertiary)]",children:"Loading session…"})]})})}):L?(0,d.jsx)(M,{projects:p,projectsLoading:r,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak,activeProjectId:c??void 0,activeSessionId:b,children:(0,d.jsx)(C.ErrorDisplay,{title:"Session not found",message:"This session is no longer available. It may have been removed, renamed, or already cleaned up.",tone:"not-found",primaryAction:{label:"Back to dashboard",href:c?`/projects/${c}`:"/"},secondaryAction:{label:"Retry",onClick:()=>void aj()},compact:!0,chrome:"card"})}):z?(0,d.jsx)(M,{projects:p,projectsLoading:r,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak,activeProjectId:j?.projectId??c??void 0,activeSessionId:b,children:(0,d.jsx)(C.ErrorDisplay,{title:"Failed to load session",message:function(a){let b=a.message.toLowerCase();return b.includes("timed out")?"The session request is taking too long, so the page stopped waiting instead of spinning forever. You can retry, or return to the project and reopen a different session.":b.includes("network")?"The session request failed before the dashboard got a response. Check the local server connection and try again.":b.includes("404")?"This session is no longer available. It may have been removed while the page was open.":b.includes("500")?"The server returned an internal error while loading this session. Try again to re-fetch the latest state.":"The dashboard could not load this session cleanly. Try again to re-fetch the latest state."}(z),tone:"error",primaryAction:{label:"Try again",onClick:()=>{A(null),N(!1),y(!0),Promise.all([af(),aj(),ak()])}},secondaryAction:{label:"Back to dashboard",href:j?.projectId?`/projects/${j.projectId}`:"/"},error:z,compact:!0,chrome:"card"})}):j?(0,d.jsx)(B,{session:j,isOrchestrator:T,orchestratorZones:l??void 0,projectOrchestratorId:n,projects:p,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak}):(0,d.jsx)(M,{projects:p,projectsLoading:r,sidebarSessions:t,sidebarOrchestrators:v,sidebarLoading:null===t,sidebarError:O,onRetrySidebar:ak,activeProjectId:c??void 0,activeSessionId:b,children:(0,d.jsx)(C.ErrorDisplay,{title:"Session unavailable",message:"The backend has not returned this session yet. This can happen right after spawning an orchestrator; retry once the terminal registers the session.",tone:"error",primaryAction:{label:"Retry",onClick:()=>void aj()},secondaryAction:{label:"Back to dashboard",href:c?`/projects/${c}`:"/"},compact:!0,chrome:"card"})})}},18287:(a,b,c)=>{c.d(b,{default:()=>e.a});var d=c(26050),e=c.n(d)},26050:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return e}});let d=c(32697)._(c(90994));function e(a,b){var c;let e={};"function"==typeof a&&(e.loader=a);let f={...e,...b};return(0,d.default)({...f,modules:null==(c=f.loadableGenerated)?void 0:c.modules})}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},26745:(a,b,c)=>{c.r(b),c.d(b,{default:()=>d});let d=(0,c(10864).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/tmp/ao-publish-stable/packages/web/src/app/sessions/[id]/page.tsx\" from the server, but it's 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.")},"/tmp/ao-publish-stable/packages/web/src/app/sessions/[id]/page.tsx","default")},54170:(a,b)=>{function c(a){return a.split("/").map(a=>encodeURIComponent(a)).join("/")}Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"encodeURIPath",{enumerable:!0,get:function(){return c}})},70162:(a,b,c)=>{c.d(b,{I:()=>d});let d=(0,c(81115).createContext)(null)},70424:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"PreloadChunks",{enumerable:!0,get:function(){return h}});let d=c(33666),e=c(51538),f=c(29294),g=c(54170);function h(a){let{moduleIds:b}=a,c=f.workAsyncStorage.getStore();if(void 0===c)return null;let h=[];if(c.reactLoadableManifest&&b){let a=c.reactLoadableManifest;for(let c of b){if(!a[c])continue;let b=a[c].files;h.push(...b)}}return 0===h.length?null:(0,d.jsx)(d.Fragment,{children:h.map(a=>{let b=c.assetPrefix+"/_next/"+(0,g.encodeURIPath)(a);return a.endsWith(".css")?(0,d.jsx)("link",{precedence:"dynamic",href:b,rel:"stylesheet",as:"style"},a):((0,e.preload)(b,{as:"script",fetchPriority:"low"}),null)})})}},88087:(a,b,c)=>{c.d(b,{X:()=>g});var d=c(33666),e=c(47489),f=c.n(e);function g({ariaLabel:a,activeTab:b,dashboardHref:c,prsHref:e,showOrchestrator:g=!0,orchestratorHref:h=null}){return(0,d.jsxs)("nav",{className:"mobile-bottom-nav","aria-label":a,children:[(0,d.jsxs)(f(),{href:c,className:"mobile-bottom-nav__item","data-active":"dashboard"===b?"true":"false","aria-current":"dashboard"===b?"page":void 0,children:[(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M3 13h8V3H3zm10 8h8V11h-8zM3 21h8v-6H3zm10-10h8V3h-8z"})}),(0,d.jsx)("span",{children:"Dashboard"})]}),(0,d.jsxs)(f(),{href:e,className:"mobile-bottom-nav__item","data-active":"prs"===b?"true":"false","aria-current":"prs"===b?"page":void 0,children:[(0,d.jsx)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})}),(0,d.jsx)("span",{children:"PRs"})]}),g?h?(0,d.jsxs)(f(),{href:h,className:"mobile-bottom-nav__item","data-active":"orchestrator"===b?"true":"false","aria-current":"orchestrator"===b?"page":void 0,children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M9 3H5a2 2 0 0 0-2 2v4m16 0V5a2 2 0 0 0-2-2h-4m0 18h4a2 2 0 0 0 2-2v-4M3 15v4a2 2 0 0 0 2 2h4"}),(0,d.jsx)("path",{d:"M9 9h6v6H9z"})]}),(0,d.jsx)("span",{children:"Orchestrator"})]}):(0,d.jsxs)("button",{type:"button",className:"mobile-bottom-nav__item",disabled:!0,children:[(0,d.jsxs)("svg",{fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,d.jsx)("path",{d:"M9 3H5a2 2 0 0 0-2 2v4m16 0V5a2 2 0 0 0-2-2h-4m0 18h4a2 2 0 0 0 2-2v-4M3 15v4a2 2 0 0 0 2 2h4"}),(0,d.jsx)("path",{d:"M9 9h6v6H9z"})]}),(0,d.jsx)("span",{children:"Orchestrator"})]}):null]})}},90994:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return j}});let d=c(33666),e=c(81115),f=c(97053),g=c(70424);function h(a){return{default:a&&"default"in a?a.default:a}}let i={loader:()=>Promise.resolve(h(()=>null)),loading:null,ssr:!0},j=function(a){let b={...i,...a},c=(0,e.lazy)(()=>b.loader().then(h)),j=b.loading;function k(a){let h=j?(0,d.jsx)(j,{isLoading:!0,pastDelay:!0,error:null}):null,i=!b.ssr||!!b.loading,k=i?e.Suspense:e.Fragment,l=b.ssr?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.PreloadChunks,{moduleIds:b.modules}),(0,d.jsx)(c,{...a})]}):(0,d.jsx)(f.BailoutToCSR,{reason:"next/dynamic",children:(0,d.jsx)(c,{...a})});return(0,d.jsx)(k,{...i?{fallback:h}:{},children:l})}return k.displayName="LoadableComponent",k}},97053:(a,b,c)=>{Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"BailoutToCSR",{enumerable:!0,get:function(){return e}});let d=c(35945);function e(a){let{reason:b,children:c}=a;throw Object.defineProperty(new d.BailoutToCSRError(b),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}}};
|