Skip to content

HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.

feat(console): the v2 console, ported from the hosted product

richard-epsillac8a55ed35d48
diff --git a/ui/package-lock.json b/ui/package-lock.json
index ed419c5f..1fd7421f 100644
--- a/ui/package-lock.json
+++ b/ui/package-lock.json
@@ -50,7 +50,7 @@
"react-markdown": "^9.1.0",
"react-syntax-highlighter": "^16.1.1",
"rehype-sanitize": "^6.0.0",
- "reifyui": "git+https://github.com/epsilla-enterprise/ReifyUI.git#412db80fe217c3ba4a74b5f1255048830f203813",
+ "reifyui": "git+https://github.com/epsilla-enterprise/ReifyUI.git#766ca0f546667179a76155d0708f33f38ce5a2db",
"remark-gfm": "^4.0.1",
"tailwind-merge": "^3.3.1",
"tailwindcss": "^3.4.1",
@@ -12669,9 +12669,9 @@
}
},
"node_modules/reifyui": {
- "version": "0.4.0",
- "resolved": "git+ssh://[email protected]/epsilla-enterprise/ReifyUI.git#412db80fe217c3ba4a74b5f1255048830f203813",
- "integrity": "sha512-NRsW0AAQw2kZ4yStwE0r1LjuzmUKal4BfoKY5z9jftlMZ2ZYyl+e/Rk4zeJvNm2JG72R6G3hHxHrwfwmSZPl3A==",
+ "version": "0.12.0",
+ "resolved": "git+ssh://[email protected]/epsilla-enterprise/ReifyUI.git#766ca0f546667179a76155d0708f33f38ce5a2db",
+ "integrity": "sha512-9+NufXUHhP6JRuaLFMPze74aOcUnA6MqQcUvanoeW0pc9jBb1TuWzDvnpFaCctA+NncSIfS2hD9m2BeEh5AzeQ==",
"license": "MIT",
"engines": {
"node": ">=18"
@@ -12681,7 +12681,8 @@
"highlight.js": "^11",
"mermaid": "^10 || ^11",
"react": ">=18",
- "react-dom": ">=18"
+ "react-dom": ">=18",
+ "react-file-icon": "^1"
},
"peerDependenciesMeta": {
"echarts": {
@@ -12692,6 +12693,9 @@
},
"mermaid": {
"optional": true
+ },
+ "react-file-icon": {
+ "optional": true
}
}
},
diff --git a/ui/package.json b/ui/package.json
index 0e97a4e6..707674ca 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -59,7 +59,7 @@
"react-markdown": "^9.1.0",
"react-syntax-highlighter": "^16.1.1",
"rehype-sanitize": "^6.0.0",
- "reifyui": "git+https://github.com/epsilla-enterprise/ReifyUI.git#412db80fe217c3ba4a74b5f1255048830f203813",
+ "reifyui": "git+https://github.com/epsilla-enterprise/ReifyUI.git#766ca0f546667179a76155d0708f33f38ce5a2db",
"remark-gfm": "^4.0.1",
"tailwind-merge": "^3.3.1",
"tailwindcss": "^3.4.1",
diff --git a/ui/public/harnessrouter-logo-gray.svg b/ui/public/harnessrouter-logo-gray.svg
new file mode 100644
index 00000000..8880fa8c
--- /dev/null
+++ b/ui/public/harnessrouter-logo-gray.svg
@@ -0,0 +1,8 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" role="img" aria-labelledby="title description">
+ <title id="title">HarnessRouter logo</title>
+ <desc id="description">The HarnessRouter mark in greyscale, for the navigation.</desc>
+ <path d="M14 10V46" fill="none" stroke="#111111" stroke-width="6" stroke-linecap="round"/>
+ <path d="M14 30Q14 20 24 20Q34 20 34 30V46" fill="none" stroke="#111111" stroke-width="6" stroke-linecap="round"/>
+ <path d="M34 36Q34 28 42 28H46" fill="none" stroke="#494949" stroke-width="6" stroke-linecap="round"/>
+ <path d="M45 20.5L56 28L45 35.5Z" fill="#494949"/>
+</svg>
diff --git a/ui/public/logos/cursor.svg b/ui/public/logos/cursor.svg
new file mode 100644
index 00000000..7a208ccb
--- /dev/null
+++ b/ui/public/logos/cursor.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" fill="none"><mask id="a" width="832" height="832" x="96" y="96" maskUnits="userSpaceOnUse" style="mask-type:luminance"><path fill="#fff" fillRule="evenodd" d="M808.825 109.876C767.549 96 740.643 96 644.764 96H379.231c-95.878 0-122.78 0-164.056 13.876-48.802 17.837-87.462 56.497-105.299 105.294C96 256.451 96 283.353 96 379.231v265.533c0 95.879 0 122.785 13.876 164.061 17.837 48.797 56.497 87.462 105.299 105.294C256.451 928 283.353 928 379.231 928h265.533c95.879 0 122.785 0 164.061-13.881 48.797-17.832 87.462-56.497 105.294-105.294C928 767.549 928 740.643 928 644.764V379.231c0-95.878 0-122.78-13.881-164.061-17.832-48.797-56.497-87.457-105.294-105.294" clipRule="evenodd" style="fill:#fff;fill-opacity:1"/></mask><g mask="url(#a)"><path fill="#23222F" d="M96 96h832v832H96z" style="fill:#23222f;fill:color(display-p3 .1357 .134 .186);fill-opacity:1"/><rect width="768" height="768" x="128" y="128" fill="url(#b)" rx="160" style="mix-blend-mode:luminosity"/><g filter="url(#c)" opacity=".7"><ellipse cx="512" cy="900.615" fill="#4FAAFF" rx="400" ry="384.615" style="fill:#4faaff;fill:color(display-p3 .3098 .6667 1);fill-opacity:1"/></g><g filter="url(#d)" opacity=".7" style="mix-blend-mode:overlay"><ellipse cx="476" cy="882" fill="#fff" rx="183" ry="72" style="fill:#fff;fill-opacity:1"/></g><g filter="url(#e)" opacity=".6" style="mix-blend-mode:luminosity"><ellipse cx="512" cy="96" fill="#B3B3B3" fill-opacity=".5" rx="284" ry="129" style="fill:#b3b3b3;fill:color(display-p3 .7 .7 .7);fill-opacity:.5"/></g><g filter="url(#f)" opacity=".2" style="mix-blend-mode:luminosity"><ellipse cx="512" cy="96" fill="#B3B3B3" fill-opacity=".5" rx="542" ry="246" style="fill:#b3b3b3;fill:color(display-p3 .7 .7 .7);fill-opacity:.5"/></g><g style="mix-blend-mode:color-burn"><rect width="768" height="768" x="128" y="128" fill="#4FAAFF" opacity=".2" rx="160" style="fill:#4faaff;fill:color(display-p3 .3098 .6667 1);fill-opacity:1"/></g><g filter="url(#g)" opacity=".8"><path fill="#000" fillRule="evenodd" d="M725.606 331.636c5.112-3.377 11.887.525 11.531 6.642l-31.313 538.204c-.401 6.892-9.157 9.571-13.346 4.083L537.777 677.88a7.45 7.45 0 0 0-4.931-2.861L280.45 641.283c-6.82-.911-8.857-9.795-3.116-13.587z" clipRule="evenodd" style="fill:#000;fill-opacity:1"/></g><g filter="url(#h)" opacity=".3"><path fill="#000" fillRule="evenodd" d="M632.268 407.006c5.113-3.382 11.892.52 11.536 6.639l-25.833 444.694c-.401 6.896-9.163 9.573-13.35 4.079l-126.959-166.59a7.44 7.44 0 0 0-4.932-2.865l-207.193-27.736c-6.816-.912-8.854-9.79-3.118-13.584z" clipRule="evenodd" style="fill:#000;fill-opacity:1"/></g><g filter="url(#i)"><path fill="#4FAAFF" fillRule="evenodd" d="M680.944 244.828c5.112-3.381 11.892-.41 11.536 5.709l-14.605 264.65-14.969 263.809c-.656 29.379-25.476 48.962-46.315 21.639-44.91-58.881-111-159-145-180.5s-150.246-31.958-224-38.5c-20-1.774-27-33-7.753-45.474z" clipRule="evenodd" style="fill:#4faaff;fill:color(display-p3 .3098 .6667 1);fill-opacity:1"/></g><path stroke="#130D20" stroke-opacity=".6" stroke-width="1.5" d="M681.358 245.454c2.341-1.549 5.036-1.627 7.083-.656 2.03.961 3.45 2.958 3.291 5.695v.002l-14.606 264.65v.001l-14.969 263.808v.012l-.001.013c-.324 14.519-6.618 26.469-15.215 31.451-4.28 2.48-9.145 3.248-14.203 1.763-5.072-1.49-10.407-5.269-15.551-12.013-11.221-14.711-23.766-32.001-36.81-50.005l-1.418-1.957c-12.603-17.397-25.64-35.391-38.36-52.302-13.197-17.544-26.062-33.931-37.76-47.282-11.683-13.335-22.249-23.695-30.848-29.133-8.609-5.444-22.351-10.151-39.195-14.26-16.864-4.115-36.914-7.646-58.191-10.708-42.554-6.123-90.074-10.374-126.948-13.645-9.57-.849-16.123-8.754-17.924-18.119-1.798-9.348 1.193-19.939 10.512-25.978l.006-.004z" style="stroke:#130d20;stroke:color(display-p3 .0761 .0503 .1247);stroke-opacity:.6;mix-blend-mode:soft-light"/><path fill="url(#j)" fill-opacity=".75" fillRule="evenodd" d="M680.944 244.828c5.112-3.381 11.892-.41 11.536 5.709l-14.605 264.65-14.969 263.809c-.656 29.379-25.476 48.962-46.315 21.639-44.91-58.881-111-159-145-180.5s-150.246-31.958-224-38.5c-20-1.774-27-33-7.753-45.474z" clipRule="evenodd" style="mix-blend-mode:multiply"/><mask id="k" width="465" height="571" x="228" y="243" maskUnits="userSpaceOnUse" style="mask-type:luminance"><path fill="#fff" fillRule="evenodd" d="M680.944 244.828c5.112-3.381 11.892-.41 11.536 5.709l-14.605 264.65-14.969 263.809c-.656 29.379-25.476 48.962-46.315 21.639-44.91-58.881-111-159-145-180.5s-150.246-31.958-224-38.5c-20-1.774-27-33-7.753-45.474z" clipRule="evenodd" style="fill:#fff;fill-opacity:1"/></mask><g mask="url(#k)"><g style="mix-blend-mode:overlay"><path fill="#000" fillRule="evenodd" d="M681.054 246.201c5.112-3.382 11.892.52 11.536 6.639l-30.783 529.892c-.832 14.332-19.599 19.462-27.639 7.568-40.254-59.551-117.96-170.955-148.401-190.037-30.407-19.06-165.524-30.387-237.415-35.17-14.357-.955-19.409-19.842-7.409-27.78z" clipRule="evenodd" opacity=".3" style="fill:#000;fill-opacity:1"/></g><g filter="url(#l)" style="mix-blend-mode:overlay"><circle cx="682.5" cy="833.5" r="45.5" fill="#fff" style="fill:#fff;fill-opacity:1"/></g><g filter="url(#m)" opacity=".9" style="mix-blend-mode:soft-light"><ellipse cx="558.861" cy="683.774" fill="#fff" rx="8" ry="88.852" style="fill:#fff;fill-opacity:1" transform="rotate(-37 558.861 683.774)"/></g><g filter="url(#n)" opacity=".5" style="mix-blend-mode:overlay"><ellipse cx="10.385" cy="104.25" fill="#fff" rx="10.385" ry="104.25" style="fill:#fff;fill-opacity:1" transform="scale(-1 1)rotate(82.5 -442.793 125.358)"/></g></g><mask id="o" width="459" height="553" x="235" y="242" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#D8D8D8" fillRule="evenodd" d="M682.055 244.201c5.112-3.382 11.891.52 11.536 6.639l-30.783 529.892c-.833 14.332-19.6 19.462-27.639 7.568-40.255-59.551-117.96-170.956-148.402-190.037-30.407-19.06-165.524-30.387-237.415-35.17-14.356-.955-19.409-19.842-7.408-27.78z" clipRule="evenodd" style="fill:#d8d8d8;fill:color(display-p3 .847 .847 .847);fill-opacity:1"/></mask><g mask="url(#o)"><path fill="url(#p)" fillRule="evenodd" d="m694.453 236-34.265 589.819-173.421-227.556z" clipRule="evenodd"/><path fill="url(#q)" fillRule="evenodd" d="M694.453 236 486.767 598.263 204 560.411z" clipRule="evenodd"/><g filter="url(#r)" opacity=".7"><path fill="url(#s)" fillRule="evenodd" d="M613.558 375.123 550.73 674.92l-57.648-76.987-104.66-34.887z" clipRule="evenodd"/></g><g filter="url(#t)"><path fill="#fff" fill-opacity=".2" fillRule="evenodd" d="M682.054 244.201c5.112-3.382 11.892.52 11.536 6.639l-30.783 529.892c-.832 14.332-19.599 19.462-27.639 7.568-40.254-59.551-117.96-170.955-148.401-190.037-30.407-19.06-165.524-30.387-237.415-35.17-14.357-.955-19.409-19.842-7.409-27.78z" clipRule="evenodd" style="fill:#fff;fill-opacity:.2;mix-blend-mode:soft-light"/></g><path stroke="url(#u)" stroke-width="1.5" d="M682.468 244.826c4.597-3.04 10.693.468 10.374 5.97l-30.783 529.893c-.791 13.612-18.63 18.493-26.27 7.191-20.129-29.779-49.627-72.53-77.902-110.225-14.136-18.846-27.973-36.437-40.184-50.514-12.192-14.054-22.821-24.676-30.538-29.513-7.728-4.844-21.997-9.147-40.058-12.962-18.095-3.823-40.106-7.179-63.398-10.086-46.588-5.815-98.357-9.843-134.307-12.235-13.647-.908-18.442-18.868-7.045-26.406z"/><path fill="url(#v)" d="m310.521 501.14 366.543-245.603-74.425 100.009c-27.774 37.935-77.172 60.604-128.848 74.89-54.777 15.143-132.873 80.038-163.27 70.704"/></g><g fill="#fff" opacity=".6" style="mix-blend-mode:overlay"><mask id="w"><path fillRule="evenodd" d="M808.825 109.876C767.549 96 740.643 96 644.764 96H379.231c-95.878 0-122.78 0-164.056 13.876-48.802 17.837-87.462 56.497-105.299 105.294C96 256.451 96 283.353 96 379.231v265.533c0 95.879 0 122.785 13.876 164.061 17.837 48.797 56.497 87.462 105.299 105.294C256.451 928 283.353 928 379.231 928h265.533c95.879 0 122.785 0 164.061-13.881 48.797-17.832 87.462-56.497 105.294-105.294C928 767.549 928 740.643 928 644.764V379.231c0-95.878 0-122.78-13.881-164.061-17.832-48.797-56.497-87.457-105.294-105.294" clipRule="evenodd"/></mask><path d="m215.175 109.876-10.197-30.332-.396.133-.393.144zM109.876 215.17l-30.055-10.986-.144.393-.133.397zm0 593.655-30.332 10.197.133.397.144.393zm105.299 105.294-10.983 30.057.39.142.393.132zm593.65 0 10.2 30.331.394-.132.39-.143zm105.294-105.294 30.056 10.984.143-.39.132-.394zm0-593.655 30.332-10.199-.133-.394-.143-.391zM819.022 79.544C771.797 63.668 739.18 64 644.764 64v64c97.342 0 118.537.332 153.865 12.208zM644.764 64H379.231v64h265.533zm-265.533 0c-94.416 0-127.028-.332-174.253 15.544l20.393 60.664C260.7 128.332 281.89 128 379.231 128zM204.189 79.82c-57.656 21.074-103.294 66.712-124.368 124.364l60.11 21.972c14.6-39.941 46.283-71.624 86.229-86.225zM79.544 204.975C63.669 252.203 64 284.815 64 379.231h64c0-97.341.332-118.532 12.208-153.865zM64 379.231v265.533h64V379.231zm0 265.533c0 94.416-.332 127.033 15.544 174.258l60.664-20.393C128.332 763.301 128 742.106 128 644.764zm15.82 175.048c21.074 57.65 66.711 103.294 124.372 124.364l21.966-60.113c-39.943-14.595-71.626-46.281-86.227-86.224zM204.976 944.45c47.225 15.882 79.84 15.55 174.255 15.55v-64c-97.342 0-118.53-.332-153.856-12.211zM379.231 960h265.533v-64H379.231zm265.533 0c94.415 0 127.034.332 174.261-15.55l-20.4-60.661C763.299 895.668 742.106 896 644.764 896zm175.045-15.825c57.654-21.069 103.297-66.712 124.366-124.366l-60.111-21.968c-14.596 39.94-46.283 71.627-86.223 86.223zm124.641-125.15C960.332 771.798 960 739.179 960 644.764h-64c0 97.342-.332 118.535-12.211 153.861zM960 644.764V379.231h-64v265.533zm0-265.533c0-94.416.332-127.029-15.549-174.26l-60.663 20.398C895.668 260.701 896 281.89 896 379.231zm-15.825-175.045c-21.07-57.655-66.713-103.292-124.363-124.365l-21.973 60.11c39.944 14.601 71.629 46.285 86.225 86.223z" mask="url(#w)" style="fill:#fff;fill-opacity:1"/></g></g><defs><filter id="c" width="1408.99" height="1378.22" x="-192.493" y="211.507" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="152.247"/></filter><filter id="d" width="686" height="464" x="133" y="650" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="80"/></filter><filter id="e" width="888" height="578" x="68" y="-193" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="80"/></filter><filter id="f" width="1444" height="852" x="-210" y="-330" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="90"/></filter><filter id="g" width="693.882" height="783.832" x="158.628" y="215.029" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="57.679"/></filter><filter id="h" width="496.38" height="571.243" x="203.257" y="349.937" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="27.909"/></filter><filter id="i" width="464.007" height="570.287" x="228.487" y="243.411" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset/><feGaussianBlur stdDeviation="6"/><feComposite in2="hardAlpha" k2="-1" k3="1" operator="arithmetic"/><feColorMatrix values="0 0 0 0 0.309804 0 0 0 0 0.666667 0 0 0 0 1 0 0 0 1 0"/><feBlend in2="shape" mode="soft-light" result="effect1_innerShadow_28_9"/></filter><filter id="l" width="115" height="115" x="625" y="776" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="6"/></filter><filter id="m" width="131.716" height="166.252" x="493.003" y="600.648" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="6"/></filter><filter id="n" width="230.735" height="58.13" x="247.346" y="542.839" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="6"/></filter><filter id="r" width="344.216" height="418.877" x="328.882" y="315.583" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_28_9" stdDeviation="29.77"/></filter><filter id="t" width="458.38" height="551.963" x="235.223" y="242.951" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset/><feGaussianBlur stdDeviation="32"/><feComposite in2="hardAlpha" k2="-1" k3="1" operator="arithmetic"/><feColorMatrix values="0 0 0 0 0.233594 0 0 0 0 0.253455 0 0 0 0 0.308073 0 0 0 0.25 0"/><feBlend in2="shape" mode="soft-light" result="effect1_innerShadow_28_9"/></filter><linearGradient id="j" x1="237.5" x2="666" y1="537" y2="780.5" gradientUnits="userSpaceOnUse"><stop stop-color="#1A1A1A" style="stop-color:#1a1a1a;stop-color:color(display-p3 .1 .1 .1);stop-opacity:1"/><stop offset=".034" stop-color="#BFBFBF" style="stop-color:#bfbfbf;stop-color:color(display-p3 .75 .75 .75);stop-opacity:1"/><stop offset=".079" stop-color="gray" style="stop-color:gray;stop-color:color(display-p3 .5 .5 .5);stop-opacity:1"/><stop offset=".498" stop-color="#4D4D4D" style="stop-color:#4d4d4d;stop-color:color(display-p3 .3 .3 .3);stop-opacity:1"/><stop offset=".504" stop-color="#999" style="stop-color:#999;stop-color:color(display-p3 .6 .6 .6);stop-opacity:1"/><stop offset=".955" stop-color="#E6E6E6" style="stop-color:#e6e6e6;stop-color:color(display-p3 .9 .9 .9);stop-opacity:1"/><stop offset="1" stop-color="#333" style="stop-color:#333;stop-color:color(display-p3 .2 .2 .2);stop-opacity:1"/></linearGradient><linearGradient id="p" x1="694.275" x2="564.032" y1="236" y2="696.505" gradientUnits="userSpaceOnUse"><stop stop-color="#A7AEB6" style="stop-color:#a7aeb6;stop-color:color(display-p3 .653 .6833 .7137);stop-opacity:1"/><stop offset="1" stop-color="#A4B1BF" style="stop-color:#a4b1bf;stop-color:color(display-p3 .6426 .6958 .7491);stop-opacity:1"/></linearGradient><linearGradient id="q" x1="694.276" x2="342.617" y1="236" y2="577.426" gradientUnits="userSpaceOnUse"><stop stop-color="#F7FAFB" style="stop-color:#f7fafb;stop-color:color(display-p3 .9672 .9814 .9828);stop-opacity:1"/><stop offset=".542" stop-color="#ECEEED" style="stop-color:#eceeed;stop-color:color(display-p3 .9252 .9345 .9289);stop-opacity:1"/><stop offset="1" stop-color="#DEDFE2" style="stop-color:#dedfe2;stop-color:color(display-p3 .8706 .8738 .8877);stop-opacity:1"/></linearGradient><linearGradient id="s" x1="409.595" x2="610.132" y1="506.325" y2="595.788" gradientUnits="userSpaceOnUse"><stop stop-color="#BAB8C2" style="stop-color:#bab8c2;stop-color:color(display-p3 .7294 .7216 .7608);stop-opacity:1"/><stop offset="1" stop-color="#E5E5E7" style="stop-color:#e5e5e7;stop-color:color(display-p3 .898 .898 .9059);stop-opacity:1"/></linearGradient><linearGradient id="u" x1="682" x2="441" y1="252" y2="681" gradientUnits="userSpaceOnUse"><stop stop-color="#13111D" style="stop-color:#13111d;stop-color:color(display-p3 .0753 .0684 .115);stop-opacity:1"/><stop offset="1" stop-color="#575562" stop-opacity=".21" style="stop-color:#575562;stop-color:color(display-p3 .3405 .333 .3837);stop-opacity:.21"/></linearGradient><linearGradient id="v" x1="687.763" x2="367.735" y1="236.465" y2="506.256" gradientUnits="userSpaceOnUse"><stop stop-color="#fff" style="stop-color:white;stop-opacity:1"/><stop offset=".954" stop-color="#fff" stop-opacity="0" style="stop-color:none;stop-opacity:0"/></linearGradient><radialGradient id="b" cx="0" cy="0" r="1" gradientTransform="rotate(180 256 256)scale(423)" gradientUnits="userSpaceOnUse"><stop style="stop-color:black;stop-opacity:1"/><stop offset="1" stop-opacity="0" style="stop-color:none;stop-opacity:0"/></radialGradient></defs></svg>
\ No newline at end of file
diff --git a/ui/src/app/(app)/harnesses/[id]/page.tsx b/ui/src/app/(app)/harnesses/[id]/page.tsx
index 80a9cbab..9e8662ce 100644
--- a/ui/src/app/(app)/harnesses/[id]/page.tsx
+++ b/ui/src/app/(app)/harnesses/[id]/page.tsx
@@ -1,438 +1,7 @@
-'use client';
-// Harness Settings, the ONE place persistent harness configuration is edited (per the 2026-07-17
-// IA review): General → Default model → Agent instructions → Tools → Skills → Runtime limits →
-// Request headers, one Save. Built-in harnesses render read-only with a Clone action.
-// Reuses the battle-tested SkillEditor + McpModal from the workbench.
-import { useEffect, useMemo, useState } from 'react';
-import { SkelPage } from '@/components/Skel';
-import { useParams, useRouter } from 'next/navigation';
-import {
- OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, useBases, getCustom, saveCustom, deleteCustom, createCustom, getSkillFiles, storeMcpSecret,
- modelAvailable,
- type CustomHarness, type McpServer, type OobHarness } from '@/lib/harness';
-import { HarnessLogo } from '@/components/HarnessLogo';
-import { CopyId } from '@/components/CopyId';
-import { SkillEditor, McpModal, McpRow } from '@/components/HarnessEditors';
-import { fetchTraceWindow, statsFor, p95Of, avgCreditsOf, type TraceCard } from '@/lib/revamp-data';
-import { SELF_HOSTED } from '@/lib/edition';
-import { CloudUploadDialog } from '@/components/CloudUploadDialog';
-import { statusOne, type CloudStatus } from '@/lib/cloud-upload';
-import { timeAgo } from '@/lib/revamp-data';
+// Harness settings live inside the Agent harnesses page now (v2). Old links land there.
+import { redirect } from 'next/navigation';
-type Skill = CustomHarness['skills'][number];
-const isOwnSkill = (s: Skill) => Boolean((s.files && s.files.length) || (s as { content?: string }).content || s.blob);
-
-export default function HarnessSettingsPage() {
- const params = useParams<{ id: string }>();
- const router = useRouter();
- const id = decodeURIComponent(params.id || '');
- const oob = oobById(id);
- const [saved, setSaved] = useState<CustomHarness | null>(null);
- const [draft, setDraft] = useState<CustomHarness | null>(null);
- const [loaded, setLoaded] = useState(false);
- const [busy, setBusy] = useState(false);
- const [err, setErr] = useState<string | null>(null);
- const [editSkillIdx, setEditSkillIdx] = useState<number | null>(null);
- const [mcpModal, setMcpModal] = useState<{ idx: number | null } | null>(null);
- const [confirmDelete, setConfirmDelete] = useState(false);
- const [uploading, setUploading] = useState(false);
- const [cloud, setCloud] = useState<CloudStatus | null>(null);
- // The chip: absent until the first upload, then "Uploaded …" or "Changed since upload".
- // Declared with the other hooks, above every early return, so the hook order never changes.
- useEffect(() => {
- if (!SELF_HOSTED || !id || oobById(id)) return;
- statusOne(id).then(setCloud).catch(() => setCloud(null));
- }, [id, saved]); // re-read after every save: the fingerprint may have moved
- // Draft of a NEW skill being created in the SkillEditor popup (name edited in the same popup).
- const [newSkill, setNewSkill] = useState<{ name: string } | null>(null);
- const [cards, setCards] = useState<TraceCard[]>([]);
-
- useEffect(() => {
- let alive = true;
- fetchTraceWindow(id).then((cs) => { if (alive) setCards(cs); }).catch(() => { /* metrics show dashes */ });
- return () => { alive = false; };
- }, [id]);
-
- useEffect(() => {
- if (oob) { setLoaded(true); return; }
- let alive = true;
- getCustom(id).then((c) => { if (alive) { setSaved(c); setDraft(c); setLoaded(true); } });
- return () => { alive = false; };
- }, [id, oob]);
-
- const dirty = useMemo(() => JSON.stringify(draft) !== JSON.stringify(saved), [draft, saved]);
- useModelCatalog(); // model list comes from the gateway, not a local copy
- const base = oob || oobById(draft?.base || '') || null;
- // Capabilities come from the server, never from the static table: it once advertised four
- // built-in skills that existed nowhere, with controls beside them that acted on nothing.
- const bases = useBases();
- const srvBase = bases?.[base?.id || draft?.base || ''] || null;
- const baseTools = srvBase?.tools || [];
- const models = oobModels(base);
- const upd = (p: Partial<CustomHarness>) => setDraft((d) => (d ? { ...d, ...p } : d));
-
- async function save() {
- if (!draft || busy) return;
- setBusy(true); setErr(null);
- try {
- const s = await saveCustom(draft);
- setSaved(s); setDraft(s);
- // After a successful save, jump to Tasks with THIS harness selected so the user can
- // immediately run a task on the config they just changed.
- router.push(`/tasks?h=${encodeURIComponent(s.id || id)}`);
- }
- catch (e) { setErr(e instanceof Error ? e.message : String(e)); }
- finally { setBusy(false); }
- }
-
- async function openSkillEditor(idx: number) {
- if (!draft) return;
- const s = draft.skills[idx];
- if (!(s.files && s.files.length) && s.blob) {
- try {
- const files = await getSkillFiles(draft.id, s.id || s.name);
- upd({ skills: draft.skills.map((x, k) => (k === idx ? { ...x, files } : x)) });
- } catch { setErr('Could not load the skill folder, try again.'); return; }
- }
- setEditSkillIdx(idx);
- }
-
- if (!loaded) return <section className="view is-active" id="view-harness"><SkelPage /></section>;
- if (!oob && !draft) return <section className="view is-active"><div className="page"><div className="session-empty">Harness not found.</div></div></section>;
-
- const name = oob ? oob.name : draft!.name;
- const readOnly = Boolean(oob);
- const skills = draft?.skills || [];
- const ownSkills = skills.map((s, idx) => ({ s, idx })).filter(({ s }) => isOwnSkill(s));
- // Built-ins the harness has not replaced with one of its own. A built-in is implicit: the
- // harness stores an entry only when its answer differs from the image's default.
- const baseSkills = (srvBase?.builtinSkills || []).filter((b) => !ownSkills.some(({ s }) => s.name === b.name));
- const disabledTools = new Set(draft?.disabledTools || []);
-
- const stats = statsFor(cards);
- const degraded = stats.success != null && stats.success < 0.9 && stats.tasks7d >= 3;
- const p95 = p95Of(cards);
- const creditsPerTask = avgCreditsOf(cards);
-
- return (
- <section className="view is-active" id="view-harness">
- <div className="page">
- <div className="page-header detail-context">
- <div>
- <button className="back-link" type="button" onClick={() => router.push('/harnesses')}><iconify-icon icon="tabler:arrow-left"></iconify-icon><span>Harnesses</span></button>
- <div className="detail-header">
- <span className="detail-icon"><HarnessLogo id={(base?.id || draft?.base || '')} size={26} /></span>
- <div className="detail-title"><h1>{name}</h1>
- <p><span className={'status ' + (degraded ? 'warning' : 'healthy')}>{degraded ? 'Needs review' : 'Connected and healthy'}</span> · Base Harness: {base?.name || draft?.baseLabel}{readOnly ? ' · built-in' : ''}</p></div>
- </div>
- </div>
- </div>
-
- <div className="detail-metrics" aria-label="Selected Harness metrics">
- <div className="detail-metric"><span>Success rate</span><strong>{stats.success != null ? `${(stats.success * 100).toFixed(1)}%` : '—'}</strong><small>Last 7 days</small></div>
- <button className="detail-metric" type="button" onClick={() => router.push(`/tasks?h=${encodeURIComponent(id)}`)}>
- <span>Tasks</span><strong>{stats.tasks7d.toLocaleString()}</strong><small>Last 7 days</small></button>
- <div className="detail-metric"><span>p95 duration</span><strong>{p95 ?? '—'}</strong><small>Recent tasks</small></div>
- {SELF_HOSTED ? null : (
- <div className="detail-metric"><span>Credits / Task</span><strong>{creditsPerTask ?? '—'}</strong><small>Avg over priced runs</small></div>
- )}
- </div>
-
- <form className="settings-form" onSubmit={(e) => { e.preventDefault(); void save(); }}>
- <div className="settings-form-head">
- <div><h2>Harness Settings</h2><p>Configure the instructions, capabilities, and execution limits inherited by every Task on this Harness.</p></div>
- <div className="header-actions">
- <span className="save-state">{readOnly ? 'Built-in · read-only' : dirty ? 'Unsaved changes' : 'No unsaved changes'}</span>
- {SELF_HOSTED && !readOnly && cloud?.uploaded && (
- <span className={'cloud-chip' + (cloud.changed ? ' changed' : '')} title={cloud.target || ''}>
- <iconify-icon icon={cloud.changed ? 'tabler:cloud-up' : 'tabler:cloud-check'}></iconify-icon>
- <span>{cloud.changed ? 'Changed since upload' : `Uploaded ${timeAgo(cloud.uploaded_at ?? null)}`}</span>
- </span>
- )}
- </div>
- </div>
-
- <section className="form-section">
- <div><h3>General</h3><p>Name this reusable agent configuration and review its runtime foundation.</p></div>
- <div className="field-stack">
- <div className="field"><label htmlFor="hsName">Name</label>
- <input id="hsName" value={name} disabled={readOnly} onChange={(e) => upd({ name: e.target.value })} /></div>
- <div className="field"><label>Base Harness</label>
- <div className="inline-value"><span>{base?.name || draft?.baseLabel || '—'}</span><span className="status healthy">Connected</span></div>
- <span className="field-help">The Base Harness defines compatible capabilities and cannot be changed after creation.</span></div>
- <div className="field"><label>Harness ID</label>
- <CopyId value={id} />
- <span className="field-help">Address this Harness from the API with this ID.</span></div>
- </div>
- </section>
-
- <section className="form-section">
- <div><h3>Default model</h3><p>The model used when a Task does not choose an override.</p></div>
- <div className="field-stack">
- <div className="field"><label htmlFor="hsModel">Model</label>
- <select id="hsModel" disabled={readOnly} value={oob ? oobDefaultModel(oob) : (draft?.defaultModel || oobDefaultModel(oobById(draft?.base || '')) || '')}
- onChange={(e) => upd({ defaultModel: e.target.value })}>
-{models.map((m) => (
- <option key={m} value={m} disabled={!modelAvailable((oob?.backend || oobById(draft?.base || '')?.backend) || '', m)}>
- {m}{modelAvailable((oob?.backend || oobById(draft?.base || '')?.backend) || '', m) ? '' : ' — no provider'}
- </option>
- ))}
- </select>
- <span className="field-help">Tasks may choose another compatible model at runtime.</span></div>
- </div>
- </section>
-
- <section className="form-section">
- <div><h3>Agent instructions</h3><p>Persistent role, conventions, constraints, and output contract loaded on every Task.</p></div>
- <div className="field-stack">
- <div className="field"><label htmlFor="hsInstructions">{['codex', 'hermes', 'pi', 'dsh', 'opencode'].includes(base?.id || draft?.base || '') ? 'AGENTS.md' : 'CLAUDE.md'}</label>
- <textarea id="hsInstructions" rows={7} disabled={readOnly}
- value={oob ? oob.systemPrompt : (draft?.systemPrompt || '')}
- onChange={(e) => upd({ systemPrompt: e.target.value })} />
- <span className="field-help">These Harness-specific instructions are loaded every turn; the Base Harness system prompt remains unchanged.</span></div>
- </div>
- </section>
-
- <section className="form-section">
- <div><h3>Tools</h3><p>Control inherited tools and add MCP servers for external capabilities.</p></div>
- <div className="field-stack">
- <div className="section-actions"><strong>{baseTools.length + (draft?.mcpServers?.length || 0)} configured tools</strong>
- {!readOnly && <button className="button small" type="button" onClick={() => setMcpModal({ idx: null })}><iconify-icon icon="tabler:plus"></iconify-icon>Add tool</button>}</div>
- <div className="capability-list">
- {baseTools.map((t) => (
- <div key={t.name} className="capability-row">
- <span className="capability-icon"><iconify-icon icon="tabler:plug"></iconify-icon></span>
- <div className="capability-copy"><strong>{t.label}</strong>
- <span>Built into {base?.name}
- {t.enforcement === 'instruction' && ' · disabling asks the agent not to use it'}</span></div>
- <div className="capability-actions">
- <button className="toggle-button" type="button" disabled={readOnly} aria-pressed={!disabledTools.has(t.name)}
- onClick={() => upd({ disabledTools: disabledTools.has(t.name) ? (draft?.disabledTools || []).filter((x) => x !== t.name) : [...(draft?.disabledTools || []), t.name] })}>
- {disabledTools.has(t.name) ? 'Disabled' : 'Enabled'}</button>
- </div>
- </div>
- ))}
- {/* Every MCP server this Harness has, one row each and no exceptions — a database
- a kit connected is one of them. It has to appear here: a capability nobody can
- see on the page that lists capabilities is a capability nobody can audit, and
- reviewing an agent has to reveal that it can read a production database. */}
- {(draft?.mcpServers || []).map((m, idx) => (
- <McpRow key={m.id || idx} server={m} busy={busy}
- onEdit={() => setMcpModal({ idx })}
- onDelete={() => upd({ mcpServers: (draft?.mcpServers || []).filter((_, k) => k !== idx) })}
- onToggle={() => upd({ mcpServers: (draft?.mcpServers || []).map((x, k) => (k === idx ? { ...x, enabled: !(x.enabled !== false) } : x)) })} />
- ))}
- </div>
- </div>
- </section>
-
- <section className="form-section">
- <div><h3>Skills</h3><p>Add Harness-specific workflows, replace inherited Skills, or disable capabilities this agent should not use.</p></div>
- <div className="field-stack">
- <div className="section-actions"><strong>{ownSkills.length + baseSkills.length} configured Skills</strong>
- {!readOnly && <button className="button small" type="button" onClick={() => setNewSkill({ name: '' })}>
- <iconify-icon icon="tabler:plus"></iconify-icon>Add Skill</button>}</div>
- <div className="capability-list">
- {ownSkills.map(({ s, idx }) => (
- <div key={s.id || idx} className="capability-row">
- <span className="capability-icon"><iconify-icon icon="tabler:sparkles"></iconify-icon></span>
- <div className="capability-copy"><strong>{s.name}</strong><span>Custom Skill</span></div>
- <div className="capability-actions">
- <button className="button quiet small" type="button" onClick={() => void openSkillEditor(idx)}>Edit</button>
- <button className="button quiet small" type="button" onClick={() => upd({ skills: skills.filter((_, k) => k !== idx) })}>Delete</button>
- <button className="toggle-button" type="button" aria-pressed={s.enabled !== false}
- onClick={() => upd({ skills: skills.map((x, k) => (k === idx ? { ...x, enabled: !(x.enabled !== false) } : x)) })}>
- {s.enabled !== false ? 'Enabled' : 'Disabled'}</button>
- </div>
- </div>
- ))}
- {baseSkills.map((b) => {
- const n = b.name;
- const stored = skills.find((s) => s.name === n && !isOwnSkill(s));
- // No stored entry means the image's default applies.
- const off = stored ? stored.enabled === false : !b.defaultEnabled;
- return (
- <div key={'inh-' + n} className="capability-row">
- <span className="capability-icon"><iconify-icon icon="tabler:bulb"></iconify-icon></span>
- <div className="capability-copy"><strong>{b.title || n}</strong>
- <span>{b.description || 'Built in'}</span></div>
- <div className="capability-actions">
- {!readOnly && <button className="button quiet small" type="button" onClick={() => {
- if (!draft) return;
- const rest = skills.filter((s) => s.name !== n);
- const sid = 'skl_' + crypto.randomUUID().replace(/-/g, '');
- const files = [{ path: 'SKILL.md', content: `---\nname: ${n}\ndescription: \n---\n\n# ${n}\n\nReplaces the built-in ${n} skill.\n` }];
- upd({ skills: [...rest, { id: sid, name: n, enabled: true, files }] });
- setEditSkillIdx(rest.length);
- }}>Replace</button>}
- <button className="toggle-button" type="button" disabled={readOnly} aria-pressed={!off}
- onClick={() => {
- const rest = skills.filter((s) => !(s.name === n && !isOwnSkill(s)));
- // Store an entry only when the harness disagrees with the image's
- // default; agreeing with it stores nothing, so the harness keeps
- // following the image as the bundled set changes.
- const want = off; // clicking flips it to this
- upd({ skills: want === b.defaultEnabled ? rest
- : [...rest, { id: 'skl_' + crypto.randomUUID().replace(/-/g, ''), name: n, enabled: want }] });
- }}>
- {off ? 'Disabled' : 'Enabled'}</button>
- </div>
- </div>
- );
- })}
- {ownSkills.length === 0 && baseSkills.length === 0 && (
- <div className="capability-row">
- <span className="capability-icon"><iconify-icon icon="tabler:bulb"></iconify-icon></span>
- <div className="capability-copy"><strong>No Skills added yet</strong>
- <span>{srvBase && !srvBase.builtinSkillsEnumerable
- ? `${base?.name} brings its own Skills and discovers them when it runs, so they can't be listed here. Add a Skill to give this Harness something of your own.`
- : 'Add a Skill to give this Harness a workflow of your own.'}</span></div>
- </div>
- )}
- </div>
- </div>
- </section>
-
- <section className="form-section">
- <div><h3>Runtime limits</h3><p>Stop Tasks that run longer or take more agent steps than expected.</p></div>
- <div className="field-stack">
- <div className="two-column-fields">
- <div className="field"><label htmlFor="hsSteps">Max steps</label>
- <input id="hsSteps" type="number" min={1} placeholder="400" disabled={readOnly}
- value={draft?.maxStep ?? ''} onChange={(e) => upd({ maxStep: e.target.value ? Math.max(1, Number(e.target.value)) : null })} />
- <span className="field-help">Maximum agent steps before the Task stops.</span></div>
- <div className="field"><label htmlFor="hsTimeout">Timeout (minutes)</label>
- <input id="hsTimeout" type="number" min={1} placeholder="120" disabled={readOnly}
- value={draft?.timeoutSeconds ? Math.round(draft.timeoutSeconds / 60) : ''}
- onChange={(e) => upd({ timeoutSeconds: e.target.value ? Math.max(1, Number(e.target.value)) * 60 : null })} />
- <span className="field-help">Maximum wall-clock execution time.</span></div>
- </div>
- </div>
- </section>
-
- <section className="form-section">
- <div><h3>Request headers</h3><p>Forward approved Task request context to MCP servers used by this Harness.</p></div>
- <div className="field-stack">
- <div className="section-actions"><strong>Dynamic header mappings</strong>
- {!readOnly && <button className="button small" type="button" onClick={() => upd({ additionalHeaders: [...(draft?.additionalHeaders || []), ''] })}><iconify-icon icon="tabler:plus"></iconify-icon>Add header</button>}</div>
- <div>
- {(draft?.additionalHeaders || []).map((h, idx) => (
- <div key={idx} className="header-row">
- <div className="field"><label>Header name</label>
- <input value={h} placeholder="X-App-JWT" onChange={(e) => upd({ additionalHeaders: (draft?.additionalHeaders || []).map((x, k) => (k === idx ? e.target.value : x)) })} /></div>
- <div className="field"><label>Value reference</label>
- <input value={h ? `$headers.${h}` : ''} readOnly /></div>
- <button className="icon-button" type="button" aria-label="Remove header"
- onClick={() => upd({ additionalHeaders: (draft?.additionalHeaders || []).filter((_, k) => k !== idx) })}><iconify-icon icon="tabler:trash"></iconify-icon></button>
- </div>
- ))}
- {!(draft?.additionalHeaders || []).length && <span className="field-help">No headers declared.</span>}
- </div>
- <span className="field-help">Values are resolved from the incoming Task request when the Harness calls an MCP server. Store credentials in a trusted secret manager; never enter literal secrets here.</span>
- </div>
- </section>
-
- {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Save failed</strong>{err}</div></div>}
- {!readOnly && (
- <div className="settings-form-footer settings-footer-sticky">
- <button className="button danger" type="button" onClick={() => setConfirmDelete(true)}>Delete Harness</button>
- <span className="settings-footer-spacer" />
- {dirty && (
- <button className="button" type="button" disabled={busy} onClick={() => setDraft(saved)}>Discard Changes</button>
- )}
- {dirty ? (
- <button className="button primary" type="submit" disabled={busy}>{busy ? 'Saving…' : 'Save Changes'}</button>
- ) : (<>
- {SELF_HOSTED && (
- <button className="button" type="button" onClick={() => setUploading(true)}>
- <iconify-icon icon="tabler:cloud-upload"></iconify-icon>Upload to Cloud</button>
- )}
- <button className="button primary" type="button"
- onClick={() => router.push(`/tasks?h=${encodeURIComponent(id)}`)}>
- <iconify-icon icon="tabler:list-details"></iconify-icon>Run Task</button>
- </>)}
- </div>
- )}
- {/* Built-ins have nothing to save, but they still need somewhere to act — same bar,
- same corner, so the action never moves depending on which harness you opened. */}
- {readOnly && (
- <div className="settings-form-footer settings-footer-sticky">
- <span className="settings-footer-spacer" />
- <button className="button" type="button" disabled={busy} onClick={async () => {
- setBusy(true);
- try {
- const c = await createCustom({ name: `${oob!.name} (custom)`, base: oob!.id, defaultModel: oobDefaultModel(oob), systemPrompt: oob!.systemPrompt });
- router.push(`/harnesses/${encodeURIComponent(c.id)}`);
- } finally { setBusy(false); }
- }}><iconify-icon icon="tabler:git-fork"></iconify-icon>Fork and Customize</button>
- <button className="button primary" type="button"
- onClick={() => router.push(`/tasks?h=${encodeURIComponent(id)}`)}>
- <iconify-icon icon="tabler:list-details"></iconify-icon>Run Task</button>
- </div>
- )}
- </form>
- </div>
-
- {editSkillIdx !== null && draft?.skills?.[editSkillIdx] && (
- <SkillEditor skill={draft.skills[editSkillIdx]}
- onClose={() => setEditSkillIdx(null)}
- onSave={(files) => {
- upd({ skills: skills.map((x, k) => (k === editSkillIdx ? { ...x, files, blob: undefined } : x)) });
- setEditSkillIdx(null);
- }} />
- )}
- {newSkill && draft && (
- <SkillEditor skill={{ name: newSkill.name, files: [{ path: 'SKILL.md',
- content: `---\nname: \ndescription: \n---\n` }] }}
- nameEditable onName={(n) => setNewSkill({ name: n })}
- onClose={() => setNewSkill(null)}
- onSave={(files) => {
- const nm = newSkill.name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
- if (!nm) { setErr('Give the skill a name (kebab-case) at the top of the editor.'); return; }
- const sid = 'skl_' + crypto.randomUUID().replace(/-/g, '');
- upd({ skills: [...skills, { id: sid, name: nm, enabled: true, files }] });
- setNewSkill(null);
- }} />
- )}
- {mcpModal && draft && (
- <McpModal server={mcpModal.idx != null ? (draft.mcpServers[mcpModal.idx] as McpServer) : null}
- declaredHeaders={(draft.additionalHeaders || []).filter(Boolean)}
- onClose={() => setMcpModal(null)}
- onSave={async (srv) => {
- let auth = srv.auth;
- if (auth && !auth.startsWith('vault:') && !auth.startsWith('$headers.')) {
- try { auth = await storeMcpSecret(srv.name, auth); } catch { /* keep literal; gateway re-vaults */ }
- }
- const entry = { ...srv, auth };
- upd({ mcpServers: mcpModal.idx != null ? draft.mcpServers.map((x, k) => (k === mcpModal.idx ? entry : x)) : [...draft.mcpServers, entry] });
- setMcpModal(null);
- }} />
- )}
- {uploading && draft && (
- <CloudUploadDialog
- items={[{ id: draft.id, name: draft.name, uploaded: !!cloud?.uploaded,
- includes: ['instructions', draft.defaultModel, (draft.skills || []).length ? `${draft.skills.length} skill${draft.skills.length === 1 ? '' : 's'}` : '',
- (draft.mcpServers || []).length ? `${draft.mcpServers.length} MCP server${draft.mcpServers.length === 1 ? '' : 's'}` : ''].filter(Boolean).join(' · ') }]}
- onClose={() => setUploading(false)}
- onDone={() => { statusOne(draft.id).then(setCloud).catch(() => null); }} />
- )}
- {confirmDelete && draft && (
- <div className="modal-backdrop">
- <section className="modal" role="dialog" aria-modal="true" onClick={(e) => e.stopPropagation()}>
- <div className="modal-header"><div>
- <h2>Delete {draft.name}?</h2>
- <p>Removes this Harness configuration. Existing task history stays readable.</p>
- </div></div>
- <div className="modal-body">
- <div className="modal-actions">
- <button className="button" type="button" onClick={() => setConfirmDelete(false)}>Cancel</button>
- <button className="button primary" type="button" disabled={busy} style={{ background: 'var(--red)', borderColor: 'var(--red)' }}
- onClick={async () => { await deleteCustom(draft.id); router.push('/harnesses'); }}>Delete</button>
- </div>
- </div>
- </section>
- </div>
- )}
- </section>
- );
+export default async function HarnessSettingsRedirect({ params }: { params: Promise<{ id: string }> }) {
+ const { id } = await params;
+ redirect(`/harnesses?h=${encodeURIComponent(decodeURIComponent(id))}&view=settings`);
}
diff --git a/ui/src/app/(app)/harnesses/page.tsx b/ui/src/app/(app)/harnesses/page.tsx
index 8d282399..72fb5244 100644
--- a/ui/src/app/(app)/harnesses/page.tsx
+++ b/ui/src/app/(app)/harnesses/page.tsx
@@ -1,239 +1,439 @@
'use client';
-// Harnesses, per-harness operations + the only entry to configuration. Scannable table
-// (purpose, health, runtime, tasks, success, last activity); row click opens the single
-// Settings form at /harnesses/[id]. Instructions file names intentionally stay OFF the list.
-import { useEffect, useState } from 'react';
-import { SkelRows } from '@/components/Skel';
-import { useRouter } from 'next/navigation';
-import { OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, createCustom } from '@/lib/harness';
+// Agent harnesses: the one page for the product's core object (the v2 design, 终版).
+//
+// Three panes. The nav. A harness panel: search across harnesses and tasks, a Dashboard row
+// (the index of every harness), and each harness with its own task list, a New task and a
+// settings control. A main area that is one of: a task (its conversation and trace), the
+// harness index, or a harness's settings. Tasks are not a separate page any more: a task
+// belongs to its harness, and it opens where the harness is.
+//
+// The URL is the state: ?h= names the harness, ?sid= the task, ?view=index|settings the view.
+// Old /tasks and /harnesses/[id] links redirect here with the same names.
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import { useRouter, useSearchParams } from 'next/navigation';
+import { SkelListItems } from '@/components/Skel';
import { HarnessLogo } from '@/components/HarnessLogo';
import { CopyId } from '@/components/CopyId';
-import { fetchHarnessRows, groupByHarness, timeAgo, p95Of, avgCreditsOf, type HarnessRow, type TraceCard } from '@/lib/revamp-data';
-import { SELF_HOSTED } from '@/lib/edition';
-import { CloudUploadDialog } from '@/components/CloudUploadDialog';
-import { statusAll, type CloudStatus } from '@/lib/cloud-upload';
+import { ConfigChat, ShareModal, type ConvTotals } from '@/components/TaskChat';
+import { HarnessSettings } from '@/components/HarnessSettings';
+import { OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, createCustom, listCustom,
+ type CustomHarness } from '@/lib/harness';
+import { fetchHarnessRows, groupByHarness, timeAgo, p95Of, avgCreditsOf, RUNNING, TERMINAL_OK, TERMINAL_BAD,
+ type HarnessRow, type TraceCard, fetchHarnessTasks, sortByActivity } from '@/lib/revamp-data';
+import { track } from '@/lib/analytics';
+import { getCurrentWorkspaceRef } from '@/lib/workspace';
+import { useEscape } from '@/lib/useEscape';
+import { getConvState, type UserMsg } from '@/lib/conversation';
+
+type View = 'index' | 'chat' | 'settings';
+type TaskState = 'done' | 'running' | 'failed' | 'cancelled' | 'incomplete';
+
+function taskState(status?: string): TaskState {
+ const s = status || '';
+ if (TERMINAL_OK.has(s)) return 'done';
+ if (RUNNING.has(s)) return 'running';
+ if (TERMINAL_BAD.has(s)) return 'failed';
+ if (s === 'cancelled') return 'cancelled';
+ return 'incomplete';
+}
+
+/** A harness's loaded tasks: the pages read so far, the cursor for the next, and whether one is in flight. */
+interface TaskSlice { list: TraceCard[]; cursor: string; pages: number; loading: boolean }
+
+/** "4.2s" under a minute, "1m 12s" past it. */
+function fmtLatency(s: number): string {
+ if (s < 60) return `${s < 10 ? s.toFixed(1) : Math.round(s)}s`;
+ const m = Math.floor(s / 60);
+ return `${m}m ${Math.round(s - m * 60)}s`;
+}
+
+/** "Codex · gpt-5.4" for a row, from the same fields the old list read. */
+function runtimeOf(r: HarnessRow): { baseId: string; name: string; model: string } {
+ if (r.kind === 'builtin') {
+ const o = oobById(r.id);
+ return { baseId: r.id, name: o?.name || r.name, model: oobDefaultModel(o) || '' };
+ }
+ const [rawBase, rawModel] = r.runtime.split(' · ');
+ const o = OOB.find((x) => x.id === rawBase || x.name === rawBase || x.id === rawBase?.toLowerCase().replace(/\s+/g, '-'));
+ return { baseId: o?.id || '', name: o?.name || rawBase || '—', model: rawModel === 'backend default' ? '' : (rawModel || '') };
+}
export default function HarnessesPage() {
- useModelCatalog(); // model list comes from the gateway, not a local copy
const router = useRouter();
+ const params = useSearchParams();
+ useModelCatalog();
+ const h = params.get('h') || '';
+ const sid = params.get('sid') || '';
+ const view: View = params.get('view') === 'settings' && h ? 'settings' : (h && params.get('view') !== 'index') ? 'chat' : 'index';
+
+ const [custom, setCustom] = useState<CustomHarness[]>([]);
const [rows, setRows] = useState<HarnessRow[] | null>(null);
- const [byHarness, setByHarness] = useState<Map<string, TraceCard[]>>(new Map());
+ const [cards, setCards] = useState<TraceCard[]>([]);
const [q, setQ] = useState('');
- const [baseFlt, setBaseFlt] = useState('all');
- const [healthFlt, setHealthFlt] = useState('all');
+ // One harness is expanded at a time (an accordion), so the task refresh has one folder to keep
+ // current and the panel never becomes a wall of every harness's tasks.
+ const [open, setOpen] = useState<string | null>(h || null);
+ // Each expanded harness lists ITS OWN tasks, paged 50 at a time from that harness's index with
+ // "Load more" at the foot of the folder. The org-wide window (`cards`) is the newest 200
+ // sessions across the workspace; in a busy org that is a few days, and every harness whose
+ // last task is older would read "No tasks yet".
+ const [perHarness, setPerHarness] = useState<Record<string, TaskSlice>>({});
+ const [tick, setTick] = useState(0);
+ const loadTasks = useCallback(async (id: string, cursor = '') => {
+ setPerHarness((p) => ({ ...p, [id]: { list: p[id]?.list ?? [], cursor: p[id]?.cursor ?? '', pages: p[id]?.pages ?? 0, loading: true } }));
+ const { sessions, cursor: next } = await fetchHarnessTasks(id, cursor);
+ setPerHarness((p) => {
+ const prev = p[id] ?? { list: [], cursor: '', pages: 0, loading: false };
+ const seen = new Set(sessions.map((c) => c.session_id));
+ // A refresh re-reads the first page and keeps the deeper pages already loaded; a
+ // "Load more" appends. Either way one entry per session, most recent activity first.
+ const list = sortByActivity(cursor ? [...prev.list, ...sessions.filter((c) => !prev.list.some((x) => x.session_id === c.session_id))]
+ : [...sessions, ...prev.list.filter((c) => !seen.has(c.session_id))]);
+ return { ...p, [id]: { list, cursor: cursor || prev.pages <= 1 ? next : prev.cursor, pages: cursor ? prev.pages + 1 : Math.max(prev.pages, 1), loading: false } };
+ });
+ }, []);
const [adding, setAdding] = useState(false);
- // No selection mode: the checkboxes are simply there. Ticking any row summons the bar;
- // clearing the last tick dismisses it. A row click still opens the harness.
- const [picked, setPicked] = useState<Set<string>>(new Set());
- const [uploading, setUploading] = useState(false);
- const [cloud, setCloud] = useState<Record<string, CloudStatus>>({});
- useEffect(() => { if (SELF_HOSTED) statusAll().then((r) => setCloud(r.harnesses || {})).catch(() => null); }, [uploading]);
- const [name, setName] = useState('');
- const [base, setBase] = useState('codex');
- const [model, setModel] = useState('');
- const [busy, setBusy] = useState(false);
- const [err, setErr] = useState<string | null>(null);
+ const [sharing, setSharing] = useState(false);
+ const [totals, setTotals] = useState<ConvTotals | null>(null);
+ useEffect(() => { setTotals(null); }, [sid]);
+ // Narrow screens (CSS <=820px) alternate between the panel and the main area, as Tasks did.
+ const [mobileDetail, setMobileDetail] = useState(false);
+ useEffect(() => { if (h || view === 'index') setMobileDetail(!!h || params.get('view') === 'index'); }, [h, view]); // eslint-disable-line react-hooks/exhaustive-deps
- useEffect(() => {
- let alive = true;
- fetchHarnessRows().then(({ rows, all }) => {
- if (alive) { setRows(rows); setByHarness(groupByHarness(all)); }
- }).catch(() => setRows([]));
- return () => { alive = false; };
+ const reloadCustom = useCallback(() => { void listCustom().then(setCustom).catch(() => setCustom([])); }, []);
+ const refresh = useCallback(() => {
+ void fetchHarnessRows().then(({ rows: r, all }) => { setRows(r); setCards(all); }).catch(() => setRows((prev) => prev || []));
+ setTick((t) => t + 1);
}, []);
+ useEffect(() => { if (open) void loadTasks(open); }, [open, tick, loadTasks]);
+ useEffect(() => { reloadCustom(); refresh(); }, [reloadCustom, refresh]);
+ // A running task keeps the panel fresh; an idle page does not poll.
+ const anyRunning = cards.some((c) => RUNNING.has(c.status || ''));
+ useEffect(() => {
+ if (!anyRunning) return;
+ const iv = setInterval(refresh, 15000);
+ return () => clearInterval(iv);
+ }, [anyRunning, refresh]);
+ // The selected harness's own tasks stay open in the panel.
+ useEffect(() => { if (h) setOpen(h); }, [h]);
- const baseOf = (r: HarnessRow) => (r.kind === 'builtin' ? r.id : (r.runtime.split(' · ')[0] || ''));
- // Display names: old records store base ids (claude-code) in the runtime label, resolve to the
- // OOB display name; model subtitle keeps the stored value, prettified when it's the default marker.
- const baseDisplay = (r: HarnessRow): { id: string; name: string; model: string } => {
- const [rawBase, rawModel] = r.runtime.split(' · ');
- const o = OOB.find((x) => x.id === rawBase || x.name === rawBase || x.id === rawBase?.toLowerCase().replace(/\s+/g, '-'));
- return { id: o?.id || '', name: o?.name || rawBase || '—',
- model: rawModel === 'backend default' ? 'Backend default' : (rawModel || '') };
- };
- const isDegraded = (r: HarnessRow) => r.stats.success != null && r.stats.success < 0.9 && r.stats.tasks7d >= 3;
- const filtered = (rows || [])
- .filter((r) => !q.trim() || r.name.toLowerCase().includes(q.toLowerCase()) || r.purpose.toLowerCase().includes(q.toLowerCase()))
- .filter((r) => {
- if (baseFlt === 'all') return true;
- const b = baseOf(r).toLowerCase();
- // Stored records carry either the base id or its display name in `runtime`, so the two
- // whose id and name differ need their own line. Everything else matches on its id, which
- // is what keeps this working when a base is added.
- if (baseFlt === 'claude-code') return b.includes('claude');
- if (baseFlt === 'dsh') return b === 'dsh' || b.includes('deepseek');
- // 'pi' must be an exact-ish match: substring would also catch every base that merely
- // contains the letters (nothing today, but 'claude' teaches the lesson cheaply).
- if (baseFlt === 'pi') return b === 'pi' || b.startsWith('pi ');
- // NOT a `return b.includes('claude')` default. That made every unrecognised filter value
- // silently mean Claude Code, so a base added to the dropdown without a matching branch here
- // would quietly list the wrong rows instead of listing none.
- return b.includes(baseFlt);
- })
- .filter((r) => healthFlt === 'all' || (healthFlt === 'review') === isDegraded(r));
-
- async function submitAdd() {
- if (!name.trim() || busy) return;
- setBusy(true); setErr(null);
- try {
- const base0 = OOB.find((o) => o.id === base);
- const c = await createCustom({ name: name.trim(), base, defaultModel: model || oobDefaultModel(base0) });
- router.push(`/harnesses/${encodeURIComponent(c.id)}`);
- } catch (e) {
- setErr(e instanceof Error ? e.message : String(e));
- setBusy(false);
- }
- }
+ const byHarness = useMemo(() => groupByHarness(cards), [cards]);
+ const tasksOf = useCallback((id: string) => perHarness[id]?.list ?? byHarness.get(id) ?? [], [perHarness, byHarness]);
+ const oob = oobById(h);
+ const ch = oob ? null : (custom.find((c) => c.id === h) || null);
+ const harnessName = oob?.name || ch?.name || '';
+ const row = (rows || []).find((r) => r.id === h) || null;
+ const card = sid ? cards.find((c) => c.session_id === sid) || Object.values(perHarness).flatMap((s) => s.list).find((c) => c.session_id === sid) || null : null;
+ // A session that was born in this tab has a conversation before it has an index record: its
+ // first message is the title until the record lands.
+ const liveFirst = sid && !card
+ ? ((getConvState(sid)?.msgs || []).find((m) => m.role === 'user') as UserMsg | undefined)?.text?.split('\n')[0].slice(0, 120) || ''
+ : '';
+
+ const go = useCallback((next: { h?: string; sid?: string; view?: 'index' | 'settings' }, replace = false) => {
+ const p = new URLSearchParams();
+ if (next.h) p.set('h', next.h);
+ if (next.sid) p.set('sid', next.sid);
+ if (next.view) p.set('view', next.view);
+ const url = `/harnesses${p.toString() ? `?${p.toString()}` : ''}`;
+ if (replace) router.replace(url); else router.push(url);
+ }, [router]);
+
+ // ── the panel: harnesses with their tasks, filtered by one search ──
+ const needle = q.trim().toLowerCase();
+ const panel = useMemo(() => (rows || []).map((r) => {
+ const tasks = tasksOf(r.id);
+ const shownTasks = needle ? tasks.filter((c) => (c.title || '').toLowerCase().includes(needle)) : tasks;
+ const nameHit = !needle || r.name.toLowerCase().includes(needle);
+ const slice = perHarness[r.id];
+ return { r, tasks: shownTasks, loaded: (slice?.pages ?? 0) > 0, more: !needle && !!slice?.cursor, loading: !!slice?.loading, visible: nameHit || shownTasks.length > 0 };
+ }).filter((x) => x.visible), [rows, tasksOf, perHarness, needle]);
+
+ // ── the header ──
+ const rt = row ? runtimeOf(row) : null;
+ const crumb = view === 'index' ? ['Agent harnesses', 'reusable agents']
+ : [harnessName || '…', rt ? [rt.name, rt.model].filter(Boolean).join(' · ') : ''];
+ const title = view === 'index' ? 'Agent harnesses' : view === 'settings' ? harnessName : (card?.title || liveFirst || (sid ? 'Task' : 'New task'));
+ const pill = view === 'index' ? 'workspace' : view === 'settings' ? 'harness settings' : (sid ? taskState(card?.status) : 'draft');
+
+ const openIndex = () => { setMobileDetail(true); go({ view: 'index' }); };
+ const openTask = (hid: string, s: string) => { setMobileDetail(true); go({ h: hid, sid: s }); };
+ const openNew = (hid: string) => { setMobileDetail(true); go({ h: hid }); };
+ const openSettings = (hid: string) => { setMobileDetail(true); go({ h: hid, view: 'settings' }); };
+ const toggle = (hid: string) => setOpen((s) => (s === hid ? null : hid));
return (
- <section className="view is-active collection-view" id="view-harnesses">
- <div className="page">
- <div className="page-header">
- <div><h1>Harnesses</h1><p>Create, monitor, and configure the reusable agents in this Workspace.</p></div>
- <button className="button primary" type="button" onClick={() => { setName(''); setAdding(true); }}><iconify-icon icon="tabler:plus"></iconify-icon>Add Harness</button>
+ <section className={'hx-root' + (mobileDetail ? ' m-detail' : '')} id="view-harnesses">
+ <aside className="hx-side" aria-label="Harnesses and their tasks">
+ <div className="hx-side-head">
+ <span className="hx-side-title">Agent harnesses</span>
+ <label className="hx-search">
+ <iconify-icon icon="tabler:search"></iconify-icon>
+ <input type="search" placeholder="Search harnesses and tasks" aria-label="Search harnesses and tasks"
+ value={q} onChange={(e) => setQ(e.target.value)} autoComplete="off" />
+ </label>
</div>
- <div className="toolbar">
- <div className="collection-tools">
- <input className="search-input" type="search" placeholder="Search Harnesses" aria-label="Search Harnesses"
- value={q} onChange={(e) => setQ(e.target.value)} />
- <select className="select" aria-label="Filter by Base Harness" value={baseFlt} onChange={(e) => setBaseFlt(e.target.value)}>
- <option value="all">All Base Harnesses</option>
- {/* Derived from OOB so a new base cannot be missing here: the hardcoded list had
- already drifted once, offering five options for six bases. */}
- {OOB.filter((o) => o.status === 'ready').map((o) => (
- <option key={o.id} value={o.id}>{o.name}</option>
- ))}
- </select>
- <select className="select" aria-label="Filter Harnesses by health" value={healthFlt} onChange={(e) => setHealthFlt(e.target.value)}>
- <option value="all">All health</option>
- <option value="healthy">Healthy</option>
- <option value="review">Needs review</option>
- </select>
- </div>
- <span className="object-count">{rows ? `${filtered.length} Harness${filtered.length === 1 ? '' : 'es'}` : ''}</span>
+ {/* The Dashboard row stays put; only the harness list scrolls. */}
+ <div className="hx-side-fixed">
+ <button type="button" className={'hx-index' + (view === 'index' ? ' is-on' : '')} aria-current={view === 'index' ? 'page' : undefined} onClick={openIndex}>
+ <iconify-icon icon="tabler:layout-grid"></iconify-icon>
+ <span>Dashboard</span>
+ {rows && <b>{rows.length}</b>}
+ </button>
+ <div className="hx-div" />
</div>
- <div className="table-wrap">
- <table className="harness-inventory-table">
- <thead><tr>{SELF_HOSTED && (
- <th className="select-col"><input type="checkbox" aria-label="Select all"
- disabled={!filtered.some((r) => r.kind !== 'builtin')}
- checked={filtered.some((r) => r.kind !== 'builtin') && filtered.every((r) => r.kind === 'builtin' || picked.has(r.id))}
- onChange={(e) => setPicked(e.target.checked ? new Set(filtered.filter((r) => r.kind !== 'builtin').map((r) => r.id)) : new Set())} /></th>
- )}<th>Harness</th><th className="harness-desktop-col">Harness ID</th><th>Health</th><th className="harness-desktop-col">Base Harness</th><th className="harness-desktop-col">Tasks (7d)</th><th className="harness-desktop-col">Success</th><th className="harness-desktop-col">p95</th>{SELF_HOSTED ? null : <th className="harness-desktop-col">Credits / Task</th>}<th className="harness-desktop-col">Last activity</th><th aria-label="Open"></th></tr></thead>
- <tbody>
- {filtered.map((r) => {
- const bad = isDegraded(r);
- const { id: baseId, name: baseName, model: modelName } = baseDisplay(r);
- return (
- <tr key={r.id} className="object-row" style={{ cursor: 'pointer' }}
- onClick={() => router.push(`/harnesses/${encodeURIComponent(r.id)}`)}>
- {SELF_HOSTED && (
- <td className="select-col" onClick={(e) => e.stopPropagation()}>
- {r.kind === 'builtin' ? null : (
- <input type="checkbox" aria-label={`Select ${r.name}`} checked={picked.has(r.id)}
- onChange={(e) => setPicked((p) => { const n = new Set(p); if (e.target.checked) n.add(r.id); else n.delete(r.id); return n; })} />
- )}
- </td>
+ <div className="hx-side-scroll">
+ {!rows ? <SkelListItems rows={4} /> : panel.length === 0 ? (
+ <div className="hx-empty">{needle ? 'Nothing matches that.' : 'No harnesses yet.'}</div>
+ ) : panel.map(({ r, tasks, loaded, more, loading }) => {
+ const isOpen = open === r.id || !!needle;
+ const running = tasks.filter((c) => RUNNING.has(c.status || '')).length;
+ return (
+ <div key={r.id} className={'hx-proj' + (r.id === h ? ' is-current' : '')}>
+ <div className="hx-proj-row">
+ <button type="button" className="hx-proj-btn" aria-expanded={isOpen} onClick={() => toggle(r.id)}>
+ <iconify-icon icon={isOpen ? 'tabler:chevron-down' : 'tabler:chevron-right'} className="hx-caret"></iconify-icon>
+ <HarnessLogo id={r.kind === 'builtin' ? r.id : runtimeOf(r).baseId} size={14} />
+ <span className="hx-proj-name">{r.name}</span>
+ {running > 0 && <span className="hx-proj-badge" title={`${running} running`}>{running}</span>}
+ </button>
+ <button type="button" className="hx-ic" title="New task" aria-label={`New task in ${r.name}`} onClick={() => openNew(r.id)}>
+ <iconify-icon icon="tabler:plus"></iconify-icon>
+ </button>
+ <button type="button" className="hx-ic" title="Harness settings" aria-label={`Settings for ${r.name}`} onClick={() => openSettings(r.id)}>
+ <iconify-icon icon="tabler:settings"></iconify-icon>
+ </button>
+ </div>
+ {isOpen && (
+ <div className="hx-tasks">
+ {tasks.length === 0 ? (loaded ? <div className="hx-tasks-empty">No tasks yet</div> : null) : tasks.map((c) => {
+ const on = c.session_id === sid;
+ return (
+ <button key={c.session_id} type="button" className={'hx-task' + (on ? ' is-on' : '')}
+ aria-current={on ? 'true' : undefined} onClick={() => openTask(r.id, c.session_id)}>
+ <i className={'hx-dot is-' + taskState(c.status)} aria-hidden="true" />
+ <span>{c.title || 'Task'}</span>
+ </button>
+ );
+ })}
+ {more && (
+ <button type="button" className="hx-more" disabled={loading} onClick={() => void loadTasks(r.id, perHarness[r.id]?.cursor)}>
+ {loading ? 'Loading' : 'Load more'}
+ </button>
)}
- <td className="object-cell"><div className="object-title">
- <span className="object-icon"><iconify-icon icon={r.kind === 'builtin' ? 'tabler:box' : 'tabler:terminal-2'}></iconify-icon></span>
- <div className="object-copy"><strong>{r.name}</strong><span>{r.kind === 'builtin' ? `Built-in · ${r.purpose}` : r.purpose}</span>{cloud[r.id]?.uploaded ? (
- <span className={'cloud-chip' + (cloud[r.id].changed ? ' changed' : '')} title={cloud[r.id].target || ''}><iconify-icon icon={cloud[r.id].changed ? 'tabler:cloud-up' : 'tabler:cloud-check'}></iconify-icon><span>{cloud[r.id].changed ? 'Changed since upload' : 'Uploaded'}</span></span>
- ) : null}</div>
- </div></td>
- <td className="harness-desktop-col" onClick={(e) => e.stopPropagation()}><CopyId value={r.id} /></td>
- <td><span className={'status ' + (bad ? 'warning' : 'healthy')}>{bad ? 'Needs review' : 'Healthy'}</span></td>
- <td className="harness-desktop-col"><div className="harness-runtime harness-runtime-logo"><HarnessLogo id={r.kind === 'builtin' ? r.id : baseId} size={22} /><div><strong>{baseName}</strong><span>{modelName || ''}</span></div></div></td>
- <td className="number harness-desktop-col">{r.stats.tasks7d}</td>
- <td className="number harness-desktop-col">{r.stats.success != null ? (r.stats.success * 100).toFixed(1) + '%' : '—'}</td>
- <td className="number harness-desktop-col">{p95Of(byHarness.get(r.id)) ?? '—'}</td>
- {SELF_HOSTED ? null : <td className="number harness-desktop-col">{avgCreditsOf(byHarness.get(r.id)) ?? '—'}</td>}
- <td className="harness-desktop-col">{timeAgo(r.stats.lastActivity)}</td>
- <td><button className="row-action" type="button" aria-label={`Open ${r.name}`}><iconify-icon icon="tabler:chevron-right"></iconify-icon></button></td>
- </tr>
- );
- })}
- {rows && !filtered.length && <tr><td colSpan={SELF_HOSTED ? 11 : 10} className="session-empty">No harnesses match.</td></tr>}
- {!rows && <SkelRows rows={4} cols={10} first={200} />}
- </tbody>
- </table>
+ </div>
+ )}
+ </div>
+ );
+ })}
</div>
- {rows && !filtered.some((r) => r.kind !== 'builtin') && SELF_HOSTED && (
- <p className="field-help cloud-select-hint">Built-ins already exist in the cloud. Add or fork a harness to upload.</p>
- )}
- {picked.size > 0 && (
- <div className="select-bar">
- <strong>{picked.size} selected</strong>
- <span className="settings-footer-spacer" />
- <button className="button" type="button" onClick={() => setPicked(new Set())}>Clear</button>
- <button className="button primary" type="button" onClick={() => setUploading(true)}>
- <iconify-icon icon="tabler:cloud-upload"></iconify-icon>Upload {picked.size} to Cloud
- </button>
+ </aside>
+
+ <div className="hx-main">
+ <header className={'hx-head' + (view === 'chat' ? ' has-tabs' : '')}>
+ <div className="hx-head-row">
+ <div className="hx-head-lead">
+ <button className="hx-back" type="button" onClick={() => setMobileDetail(false)}>
+ <iconify-icon icon="tabler:chevron-left"></iconify-icon>Harnesses
+ </button>
+ <div className="hx-crumb"><span>{crumb[0]}</span>{crumb[1] ? <><span className="hx-crumb-sep">/</span><span className="hx-crumb-cfg">{crumb[1]}</span></> : null}</div>
+ <div className="hx-title-row">
+ <h1 className="hx-title" title={title}>{title}</h1>
+ <span className={'hx-pill is-' + (view === 'chat' ? pill : 'neutral')}>{pill}</span>
+ {/* What this task has taken and cost. Credits come from the task record (the whole
+ session, priced at every settle); latency from the turns that carry it, "≥" when
+ older turns do not. Nothing is shown before either is known. */}
+ {view === 'chat' && sid && (() => {
+ const credits = card?.credits != null && card.credits > 0 ? card.credits
+ : totals && totals.costed > 0 ? totals.credits : null;
+ const creditsPartial = !(card?.credits != null && card.credits > 0) && !!totals && totals.costed < totals.finished;
+ const latency = totals && totals.timed > 0 ? totals.elapsed : null;
+ const latencyPartial = !!totals && totals.timed < totals.finished;
+ if (credits == null && latency == null) return null;
+ return (
+ <span className="hx-badges" aria-label="Task totals">
+ {latency != null && (
+ <span className="hx-badge" title={`Total latency${latencyPartial ? `, from ${totals!.timed} of ${totals!.finished} turns` : ''}`}>
+ <iconify-icon icon="tabler:clock"></iconify-icon>{latencyPartial ? '≥ ' : ''}{fmtLatency(latency)}
+ </span>
+ )}
+ {credits != null && (
+ <span className="hx-badge" title="Credits this task has used">
+ <iconify-icon icon="tabler:coins"></iconify-icon>{creditsPartial ? '≥ ' : ''}{credits < 1 ? credits.toFixed(3) : credits.toLocaleString(undefined, { maximumFractionDigits: 2 })} credits
+ </span>
+ )}
+ </span>
+ );
+ })()}
+ </div>
+ </div>
+ <div className="hx-head-actions">
+ {view === 'chat' && sid && (
+ <button className="hx-icbtn" type="button" title="Share this task" aria-label="Share this task" onClick={() => setSharing(true)}>
+ <iconify-icon icon="tabler:share-2"></iconify-icon>
+ </button>
+ )}
+ {view === 'chat' && h && <button className="hx-secondary" type="button" onClick={() => openNew(h)}>New task</button>}
+ {view === 'settings' && h && <button className="hx-secondary" type="button" onClick={() => go({ h })}>Back to tasks</button>}
+ {view === 'index' && <button className="hx-primary" type="button" onClick={() => setAdding(true)}>New harness</button>}
+ </div>
</div>
- )}
+ </header>
+
+ <div className={'hx-body' + (view === 'chat' ? ' is-chat' : '')}>
+ {view === 'index' && (
+ <IndexTable rows={rows} byHarness={byHarness} onOpen={(r) => {
+ // Open the harness's newest task, from its own index, else a fresh draft.
+ const pick = (list: TraceCard[]) => { const newest = list[0]; if (newest) openTask(r.id, newest.session_id); else openNew(r.id); };
+ if (perHarness[r.id]?.pages) pick(perHarness[r.id].list); else void fetchHarnessTasks(r.id).then(({ sessions }) => pick(sortByActivity(sessions)));
+ }} />
+ )}
+ {view === 'settings' && h && (
+ <HarnessSettings key={h} id={h} embedded
+ onNavigate={(to) => { if (to === 'tasks') go({ h }); else go({ view: 'index' }); reloadCustom(); refresh(); }} />
+ )}
+ {/* Keyed by harness only: the task to show travels through deepSid, so a draft that
+ just became a session keeps streaming instead of being remounted. */}
+ {view === 'chat' && h && (oob || ch) && (
+ <ConfigChat key={h}
+ oob={oob} ch={ch} harnessId={h} harnessName={harnessName} deepSid={sid || undefined}
+ onActiveSid={(s) => {
+ if (!s || s === sid) return;
+ go({ h, sid: s }, true);
+ // The index lists the new session a moment after it is accepted; read it again then.
+ refresh(); setTimeout(refresh, 2500); setTimeout(refresh, 8000);
+ }}
+ onHarness={(id) => { if (id !== h) go({ h: id, sid }, true); }}
+ onActivity={() => { refresh(); setTimeout(refresh, 2500); setTimeout(refresh, 8000); }}
+ onTotals={setTotals}
+ onSaved={reloadCustom} />
+ )}
+ {view === 'chat' && h && !oob && !ch && custom.length > 0 && (
+ <div className="hx-empty-main">This harness is not in this workspace. Pick one from the list.</div>
+ )}
+ </div>
</div>
- {uploading && (
- <CloudUploadDialog
- items={(rows || []).filter((r) => picked.has(r.id)).map((r) => ({ id: r.id, name: r.name, builtin: r.kind === 'builtin', uploaded: !!cloud[r.id]?.uploaded }))}
- onClose={() => { setUploading(false); }}
- onDone={() => { setPicked(new Set()); }} />
+ {sharing && sid && <ShareModal sid={sid} onClose={() => setSharing(false)} />}
+ {adding && (
+ <AddHarness onClose={() => setAdding(false)} existing={(rows || []).filter((r) => r.kind !== 'builtin').length}
+ onCreated={(id) => { setAdding(false); reloadCustom(); refresh(); openSettings(id); }} />
)}
+ </section>
+ );
+}
- {adding && (
- <div className="modal-backdrop">
- <section className="modal" role="dialog" aria-modal="true" aria-labelledby="addHarnessTitle" onClick={(e) => e.stopPropagation()}>
- <div className="modal-header">
- <div><h2 id="addHarnessTitle">Add Harness</h2><p>Choose the Base Harness first. You can configure instructions, Tools, Skills, and limits after creation.</p></div>
- <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={() => setAdding(false)}><iconify-icon icon="tabler:x"></iconify-icon></button>
- </div>
- <div className="modal-body">
- <div className="field-stack">
- <div className="field"><label htmlFor="newHarnessName">Name</label>
- <input id="newHarnessName" value={name} placeholder="Customer Support Agent" autoFocus
- onChange={(e) => setName(e.target.value)} onKeyDown={(e) => { if (e.key === 'Enter') void submitAdd(); }} />
- <span className="field-help">Name the reusable agent configuration, not an individual Task.</span></div>
- <fieldset className="field" style={{ margin: 0, padding: 0, border: 0 }}>
- <legend style={{ marginBottom: 6, color: '#55555f', fontSize: 12, fontWeight: 650 }}>Base Harness</legend>
- <div className="base-choice-list">
- {OOB.filter((o) => o.status === 'ready').map((o) => (
- <label key={o.id} className="base-choice">
- <input type="radio" name="baseHarness" value={o.id} checked={base === o.id}
- onChange={() => { setBase(o.id); setModel(''); }} />
- <span className="base-choice-icon"><HarnessLogo id={o.id} size={24} /></span>
- <span className="base-choice-copy"><strong>{o.name}</strong>
- <span>{o.id === 'codex'
- ? 'Best for repository work, code changes, shell commands, and generated files.'
- : o.id === 'hermes'
- ? 'Self-improving agent that builds memory and skills across Tasks, best for evolving, long-running work.'
- : o.id === 'pi'
- ? 'Minimal, steerable harness with four core tools, best when you want a lean agent you can shape.'
- : o.id === 'dsh'
- ? 'DeepSeek\u2019s own agent runtime, best for deep-reasoning work on the DeepSeek model family.'
- : o.id === 'opencode'
- ? 'Open source terminal agent, best when you want a widely used harness that runs any model you have configured.'
- : 'Best for long-context analysis, document workflows, and structured review.'}</span></span>
- <span className="base-choice-models">{oobDefaultModel(o)} default</span>
- </label>
- ))}
- </div>
- <span className="field-help">The Base Harness determines compatible models and inherited capabilities. It cannot be changed after creation.</span>
- </fieldset>
- <div className="field"><label htmlFor="newHarnessModel">Default model</label>
- <select id="newHarnessModel" value={model || oobDefaultModel(oobById(base))} onChange={(e) => setModel(e.target.value)}>
- {oobModels(oobById(base)).map((m) => <option key={m} value={m}>{m}</option>)}
- </select></div>
- {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Could not create</strong>{err}</div></div>}
- </div>
- <div className="creation-next"><iconify-icon icon="tabler:arrow-right"></iconify-icon><span>Next, you&rsquo;ll land in Harness Settings to review inherited Tools and Skills, add instructions, set runtime limits, and save the configuration.</span></div>
- <div className="modal-actions">
- <button className="button" type="button" onClick={() => setAdding(false)} disabled={busy}>Cancel</button>
- <button className="button primary" type="button" onClick={() => void submitAdd()} disabled={busy || !name.trim()}>{busy ? 'Creating…' : 'Create and configure'}</button>
- </div>
+// ── the index: every harness, its health and its numbers over the last 7 days ─────────────
+function IndexTable({ rows, byHarness, onOpen }: {
+ rows: HarnessRow[] | null; byHarness: Map<string, TraceCard[]>; onOpen: (r: HarnessRow) => void;
+}) {
+ return (
+ <div className="hx-index-wrap">
+ <div className="hx-index-note">{rows ? `${rows.length} ${rows.length === 1 ? 'harness' : 'harnesses'} · last 7 days` : ''}</div>
+ <div className="hx-card">
+ <div className="hx-thead" aria-hidden="true">
+ <span>Harness</span><span className="hx-th-id">Harness ID</span><span>Health</span><span className="hx-th-rt">Runtime</span>
+ <span className="hx-th-n">Tasks</span><span className="hx-th-n hx-th-success">Success</span><span className="hx-th-n hx-th-p95">P95</span><span className="hx-th-n hx-th-cpt">Cr / task</span>
+ <span className="hx-th-last">Last activity</span><span />
+ </div>
+ {!rows ? <SkelListItems rows={4} /> : rows.length === 0 ? (
+ <div className="hx-empty-main">No harnesses yet. Create one to give an agent a name, instructions and tools.</div>
+ ) : rows.map((r) => {
+ const rt = runtimeOf(r);
+ const s = r.stats;
+ const idle = s.tasks7d === 0;
+ const bad = s.success != null && s.success < 0.9 && s.tasks7d >= 3;
+ const health = idle ? 'idle' : bad ? 'degraded' : 'healthy';
+ return (
+ <button key={r.id} type="button" className="hx-row" onClick={() => onOpen(r)}>
+ <span className="hx-row-name">
+ <b>{r.name}</b>
+ <small>{r.kind === 'builtin' ? `Built-in · ${r.purpose}` : r.purpose}</small>
+ </span>
+ <span className="hx-row-id hx-th-id" onClick={(e) => e.stopPropagation()}><CopyId value={r.id} /></span>
+ <span className={'hx-health is-' + health}><i aria-hidden="true" />{health}</span>
+ <span className="hx-row-rt hx-th-rt">
+ <HarnessLogo id={rt.baseId} size={16} />
+ <span><b>{rt.name}</b>{rt.model ? <small>{rt.model}</small> : null}</span>
+ </span>
+ <span className="hx-num hx-th-n">{s.tasks7d}</span>
+ <span className={'hx-num hx-th-n hx-th-success' + (bad ? ' is-bad' : '')}>{s.success != null ? `${Math.round(s.success * 100)}%` : '—'}</span>
+ <span className="hx-num hx-th-n hx-th-p95">{p95Of(byHarness.get(r.id)) ?? '—'}</span>
+ <span className="hx-num hx-th-n hx-th-cpt">{avgCreditsOf(byHarness.get(r.id)) ?? '—'}</span>
+ <span className="hx-num hx-th-last">{s.lastActivity ? timeAgo(s.lastActivity) : '—'}</span>
+ <span className="hx-row-chev" aria-hidden="true">›</span>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ );
+}
+
+// ── add a harness: name, base, default model; lands in its settings ───────────────────────
+function AddHarness({ onClose, onCreated, existing }: { onClose: () => void; onCreated: (id: string) => void; existing: number }) {
+ const ready = OOB.filter((o) => o.status === 'ready');
+ const [name, setName] = useState('');
+ const [base, setBase] = useState(ready[0]?.id || 'codex');
+ const [model, setModel] = useState('');
+ const [busy, setBusy] = useState(false);
+ const [err, setErr] = useState('');
+ useEscape(true, () => { if (!busy) onClose(); });
+ const baseObj = oobById(base);
+ async function submit() {
+ if (!name.trim() || busy) return;
+ setBusy(true); setErr('');
+ try {
+ const chosen = model || oobDefaultModel(baseObj);
+ const c = await createCustom({ name: name.trim(), base, defaultModel: chosen });
+ track('harness_created', { base, model: chosen || null, harness_count_before: existing,
+ workspace_id: getCurrentWorkspaceRef()?.id || null });
+ onCreated(c.id);
+ } catch (e) { setErr(e instanceof Error ? e.message : String(e)); setBusy(false); }
+ }
+ const blurb = (id: string) => id === 'codex' ? 'Repository work, code changes, shell commands, generated files.'
+ : id === 'hermes' ? 'Self-improving agent that builds memory and skills across tasks.'
+ : 'Long-context analysis, document workflows, structured review.';
+ return (
+ <div className="ak-scrim" onMouseDown={() => { if (!busy) onClose(); }}>
+ <section className="ak-modal hx-add" role="dialog" aria-modal="true" aria-labelledby="hxAddTitle" onMouseDown={(e) => e.stopPropagation()}>
+ <div className="ak-modal-body">
+ <h2 id="hxAddTitle">Add harness</h2>
+ <p className="ak-modal-sub">Choose the base harness first. Instructions, tools, skills and limits are configured after creation.</p>
+ <div className="ak-field">
+ <div className="ak-field-k">Name</div>
+ <input value={name} placeholder="Customer Support Agent" autoFocus aria-label="Harness name"
+ onChange={(e) => setName(e.target.value)} onKeyDown={(e) => { if (e.key === 'Enter') void submit(); }} />
+ <div className="hx-add-help">Name the reusable agent configuration, not an individual task.</div>
+ </div>
+ <div className="ak-field">
+ <div className="ak-field-k">Base harness</div>
+ <div className="hx-bases" role="radiogroup" aria-label="Base harness">
+ {ready.map((o) => (
+ <button key={o.id} type="button" role="radio" aria-checked={base === o.id} className={'hx-base' + (base === o.id ? ' is-on' : '')}
+ onClick={() => { setBase(o.id); setModel(''); }}>
+ <HarnessLogo id={o.id} size={18} />
+ <span className="hx-base-copy"><b>{o.name}</b><small>{blurb(o.id)}</small></span>
+ <span className="hx-base-def">{oobDefaultModel(o)}</span>
+ </button>
+ ))}
</div>
- </section>
+ <div className="hx-add-help">The base harness determines compatible models and inherited capabilities. It cannot be changed after creation.</div>
+ </div>
+ <div className="ak-field">
+ <div className="ak-field-k">Default model</div>
+ <select className="hx-add-select" aria-label="Default model" value={model || oobDefaultModel(baseObj)} onChange={(e) => setModel(e.target.value)}>
+ {oobModels(baseObj).map((m) => <option key={m} value={m}>{m}</option>)}
+ </select>
+ </div>
+ {err && <div className="ak-err" style={{ marginTop: 14 }} role="alert">Could not create the harness. {err}</div>}
</div>
- )}
- </section>
+ <div className="ak-modal-foot">
+ <span className="hx-add-next">Next you land in harness settings to review inherited tools and skills.</span>
+ <button className="ak-secondary" type="button" onClick={onClose} disabled={busy}>Cancel</button>
+ <button className="ak-primary" type="button" onClick={() => void submit()} disabled={busy || !name.trim()}>{busy ? 'Creating…' : 'Create and configure'}</button>
+ </div>
+ </section>
+ </div>
);
}
diff --git a/ui/src/app/(app)/keys/page.tsx b/ui/src/app/(app)/keys/page.tsx
index 72c122b4..5f4d7355 100644
--- a/ui/src/app/(app)/keys/page.tsx
+++ b/ui/src/app/(app)/keys/page.tsx
@@ -1,34 +1,53 @@
'use client';
-// API Keys, per the finalized 2026-07-19 design revision (prototype view-api-keys):
-// page header + Create button, search toolbar with the shown-once security note, table
-// (Name / Key / Last used / Created) with a per-row dots menu for Revoke, and the
-// create modal with one-time reveal. Keys are workspace-scoped (CT-249). "Last used"
-// is not tracked by the gateway yet, it renders "—" rather than a guess.
+// API keys, per the v2 design: header with the one primary action, a search box, the shown-once
+// reminder; then one card of keys (name, masked key, last used, created) with a row menu for
+// rename, rotate and revoke, and the create sheet whose second stage reveals the secret once.
+//
+// Keys are workspace-scoped. "Last used" is what the gateway stamps when a key authenticates a
+// call; a key with no stamp reads "never", never a guess.
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { harnessFetch } from '@/lib/hfetch';
-import { useCallback, useEffect, useRef, useState } from 'react';
-import { SkelRows } from '@/components/Skel';
import { getSession } from '@/lib/auth';
import { useWorkspace } from '@/lib/workspace';
+import { useEscape } from '@/lib/useEscape';
+import { track } from '@/lib/analytics';
+import { timeAgo } from '@/lib/revamp-data';
+import { Popover } from 'reifyui';
-interface Key { id: string; name?: string; created_at?: string; revoked?: boolean; member?: string; workspace?: string; last_used?: string }
+interface Key {
+ id: string; name?: string; created_at?: string; revoked?: boolean; member?: string; tail?: string;
+ workspace?: string; last_used?: string; last_harness?: string;
+}
+
+// The gateway began stamping key use on this date. A key made before it that carries no stamp
+// may well have been used earlier, so "never" on it gets a tooltip saying so.
+const USE_TRACKED_SINCE = Date.UTC(2026, 6, 23);
-function fmtDate(s?: string): string {
- const n = Number(s); if (!n) return '—';
- try { return new Date(n * (n < 1e12 ? 1000 : 1)).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' }); } catch { return '—'; }
+const toMs = (s?: string): number => { const n = Number(s); return n ? n * (n < 1e12 ? 1000 : 1) : 0; };
+function createdLabel(ms: number): string {
+ if (!ms) return '—';
+ const d = new Date(ms);
+ const sameYear = d.getFullYear() === new Date().getFullYear();
+ return d.toLocaleDateString('en-US', sameYear ? { month: 'short', day: 'numeric' } : { month: 'short', day: 'numeric', year: 'numeric' });
}
+type Sheet =
+ | { kind: 'create' }
+ | { kind: 'reveal'; name: string; secret: string; rotated: boolean }
+ | { kind: 'rename'; key: Key }
+ | { kind: 'revoke'; key: Key }
+ | null;
+
export default function KeysPage() {
const [keys, setKeys] = useState<Key[] | null>(null);
const [err, setErr] = useState('');
const [search, setSearch] = useState('');
+ const [sheet, setSheet] = useState<Sheet>(null);
const [name, setName] = useState('');
- const [creating, setCreating] = useState(false);
const [busy, setBusy] = useState(false);
- const [minted, setMinted] = useState<string | null>(null);
const [copied, setCopied] = useState(false);
const [menuFor, setMenuFor] = useState<string | null>(null);
- const [revoking, setRevoking] = useState<Key | null>(null);
- const menuRef = useRef<HTMLDivElement>(null);
+ const menuAnchor = useRef<HTMLElement | null>(null);
const org = getSession()?.orgId || '';
const member = getSession()?.member?.email || getSession()?.member?.id || '';
@@ -47,144 +66,210 @@ export default function KeysPage() {
}, [base, org, current.id, isDefaultWs]);
useEffect(reload, [reload]);
- useEffect(() => {
- const close = (e: MouseEvent) => {
- if (menuRef.current && !menuRef.current.contains(e.target as Node)) setMenuFor(null);
- };
- document.addEventListener('mousedown', close);
- return () => document.removeEventListener('mousedown', close);
- }, []);
+ useEscape(!!sheet, () => { if (!busy) setSheet(null); });
- async function mint() {
- if (busy) return; // name is OPTIONAL, never gate the action on it
+ const rows = useMemo(() => (keys || [])
+ .map((k) => {
+ const created = toMs(k.created_at);
+ const lastUsed = toMs(k.last_used);
+ return { k, created, lastUsed, tracked: created >= USE_TRACKED_SINCE };
+ })
+ .sort((a, b) => b.created - a.created), [keys]); // newest first: the key you just made is the first row
+ const shown = rows.filter(({ k }) => {
+ const q = search.trim().toLowerCase();
+ return !q || (k.name || '').toLowerCase().includes(q) || (k.id || '').slice(-4).toLowerCase().includes(q);
+ });
+
+ async function mint(keyName: string, rotateFrom?: Key) {
+ if (busy) return;
setBusy(true); setErr('');
try {
- const finalName = name.trim() || 'Untitled key';
const r = await harnessFetch(base, { method: 'POST', headers: { 'content-type': 'application/json' },
- body: JSON.stringify({ name: finalName, member_id: member,
- workspace: current.id || '', workspace_default: isDefaultWs }) });
+ body: JSON.stringify({ name: keyName, member_id: member, workspace: current.id || '',
+ workspace_name: current.name || '', workspace_default: isDefaultWs }) });
const d = await r.json();
if (!r.ok) throw new Error(d.detail || JSON.stringify(d));
- setMinted(d.key); setCopied(false); setName(''); reload();
+ if (rotateFrom) {
+ // Rotation: the old secret is dead the moment the new one exists. Revoking first would
+ // leave a window with no working key at all.
+ await harnessFetch(`${base}/${encodeURIComponent(rotateFrom.id)}`, { method: 'DELETE' });
+ } else {
+ track('api_key_created', { surface: 'keys', is_first_key: (keys || []).length === 0,
+ workspace_is_default: isDefaultWs, workspace_id: current.id || null });
+ }
+ setCopied(false);
+ setSheet({ kind: 'reveal', name: keyName, secret: d.key, rotated: !!rotateFrom });
+ reload();
} catch (e) { setErr(e instanceof Error ? e.message : String(e)); }
finally { setBusy(false); }
}
- async function revoke(id: string) {
- await harnessFetch(`${base}/${encodeURIComponent(id)}`, { method: 'DELETE' });
- setRevoking(null); setMenuFor(null); reload();
+ async function rename(key: Key, next: string) {
+ const clean = next.trim();
+ if (!clean || busy) return;
+ setBusy(true); setErr('');
+ try {
+ const r = await harnessFetch(`${base}/${encodeURIComponent(key.id)}`, { method: 'PATCH',
+ headers: { 'content-type': 'application/json' }, body: JSON.stringify({ name: clean }) });
+ if (!r.ok) throw new Error((await r.json().catch(() => ({})))?.detail || `${r.status}`);
+ setSheet(null); reload();
+ } catch (e) { setErr(e instanceof Error ? e.message : String(e)); }
+ finally { setBusy(false); }
}
- const shown = (keys || []).filter((k) =>
- !search.trim() || (k.name || '').toLowerCase().includes(search.trim().toLowerCase()));
+ async function revoke(key: Key) {
+ setBusy(true);
+ try { await harnessFetch(`${base}/${encodeURIComponent(key.id)}`, { method: 'DELETE' }); }
+ finally { setBusy(false); setSheet(null); reload(); }
+ }
+
+ const openMenu = (el: HTMLElement, id: string) => {
+ if (menuFor === id) { setMenuFor(null); return; }
+ menuAnchor.current = el; setMenuFor(id);
+ };
+ const menuKey = rows.find((r) => r.k.id === menuFor)?.k || null;
+
+ const openCreate = () => { setName(''); setErr(''); setCopied(false); setSheet({ kind: 'create' }); };
return (
- <section className="view is-active" id="view-api-keys">
- <div className="page">
- <div className="page-header">
- <div><h1>API Keys</h1><p>Create and revoke credentials scoped to <span className="workspace-name">{current.name}</span>.</p></div>
- <button className="button primary" type="button" disabled={!org}
- onClick={() => { setName(''); setErr(''); setMinted(null); setCreating(true); }}>
- <iconify-icon icon="tabler:plus"></iconify-icon>Create API Key
- </button>
- </div>
- <div className="api-key-toolbar">
- <label className="api-key-search">
- <span className="sr-only">Search API keys</span>
- <iconify-icon icon="tabler:search"></iconify-icon>
- <input className="search-input" type="search" placeholder="Search keys" autoComplete="off"
- value={search} onChange={(e) => setSearch(e.target.value)} />
- </label>
- <div className="api-key-toolbar-meta">
- <span className="api-key-security"><iconify-icon icon="tabler:shield-lock"></iconify-icon>New secrets are shown once</span>
+ <section className="ak-root" id="view-api-keys">
+ <header className="ak-head">
+ <div className="ak-head-row">
+ <div>
+ <h1>API keys</h1>
+ <p className="ak-sub">Create and revoke credentials scoped to {current.name}.</p>
</div>
+ <button className="ak-primary" type="button" disabled={!org} onClick={openCreate}>Create API key</button>
</div>
- {err && !creating && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Could not load keys</strong>{err}</div></div>}
- <div className="table-wrap">
- <table><thead><tr><th>Name</th><th>Key</th><th>Last used</th><th>Created</th><th aria-label="Actions"></th></tr></thead><tbody>
- {shown.map((k) => (
- <tr key={k.id}>
- <td><strong>{k.name || 'Untitled key'}</strong></td>
- <td><code>sk-hr-••••{(k.id || '').slice(-4)}</code></td>
- <td>{fmtDate(k.last_used)}</td>
- <td>{fmtDate(k.created_at)}</td>
- <td>
- <div className="api-key-menu-wrap" ref={menuFor === k.id ? menuRef : undefined}>
- <button className="row-action" type="button" aria-label={`Manage ${k.name || 'key'}`}
- aria-expanded={menuFor === k.id}
- onClick={() => setMenuFor(menuFor === k.id ? null : k.id)}>
- <iconify-icon icon="tabler:dots"></iconify-icon>
- </button>
- {menuFor === k.id && (
- <div className="api-key-menu">
- <button className="danger" type="button" onClick={() => { setMenuFor(null); setRevoking(k); }}>Revoke key</button>
- </div>
- )}
- </div>
- </td>
- </tr>
- ))}
- </tbody></table>
- {keys === null && <table><tbody><SkelRows rows={3} cols={5} first={140} /></tbody></table>}
- {keys != null && keys.length === 0 && (
- <div className="api-key-empty">No API keys yet. Use <b>Create API Key</b> to make one and call the API.</div>
- )}
- {keys != null && keys.length > 0 && shown.length === 0 && (
- <div className="api-key-empty">No keys match this search.</div>
- )}
+ <div className="ak-tools">
+ <input className="ak-search" type="search" placeholder="Search keys" aria-label="Search keys"
+ autoComplete="off" value={search} onChange={(e) => setSearch(e.target.value)} />
+ <span className="ak-once"><iconify-icon icon="tabler:shield-lock"></iconify-icon>New secrets are shown once</span>
</div>
- </div>
+ </header>
- {creating && (
- <div className="modal-backdrop">
- <section className="modal" role="dialog" aria-modal="true" aria-labelledby="newKeyTitle" onClick={(e) => e.stopPropagation()}>
- <div className="modal-header">
- <div><h2 id="newKeyTitle">Create API Key</h2><p>A secret key for the public API, scoped to <span className="workspace-name">{current.name}</span>. The secret is shown once, right after creation.</p></div>
- <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={() => setCreating(false)}><iconify-icon icon="tabler:x"></iconify-icon></button>
+ <div className="ak-body">
+ {err && !sheet && <div className="ak-err" role="alert">Could not load keys. {err}</div>}
+ <div className="ak-card">
+ <div className="ak-thead" aria-hidden="true">
+ <span>Name</span><span>Key</span>
+ <span className="ak-th-last">Last used</span><span className="ak-th-created">Created</span><span />
+ </div>
+ {keys === null ? (
+ <><div className="ak-skel" /><div className="ak-skel" style={{ width: '70%' }} /><div className="ak-skel" style={{ width: '85%' }} /></>
+ ) : shown.length === 0 ? (
+ <div className="ak-empty">
+ {rows.length === 0 ? <>No API keys yet. Create one to call the API from your own code.</> : <>No keys match that search.</>}
</div>
- {!minted ? (
- <div className="modal-body">
- <div className="field-stack">
- <div className="field"><label htmlFor="newKeyName">Key name <span className="optional-label">Optional</span></label>
- <input id="newKeyName" value={name} placeholder="e.g. production" autoFocus
+ ) : shown.map(({ k, created, lastUsed, tracked }) => (
+ <div key={k.id} className="ak-row">
+ <div className="ak-name">
+ <b>{k.name || 'Untitled key'}</b>
+ </div>
+ {/* The key's own last four, kept at creation. A key from before that is shown masked only. */}
+ <span className="ak-key">sk-hr-••••{k.tail || ''}</span>
+ <span className={'ak-last' + (lastUsed ? '' : ' none')}
+ title={lastUsed ? new Date(lastUsed).toLocaleString() : tracked ? undefined : 'Use has been recorded since Jul 23, 2026'}>
+ {lastUsed ? timeAgo(lastUsed) : 'never'}
+ </span>
+ <span className="ak-created" title={created ? new Date(created).toLocaleDateString() : undefined}>{createdLabel(created)}</span>
+ <button className="ak-dots" type="button" aria-label={`Actions for ${k.name || 'key'}`}
+ aria-haspopup="menu" aria-expanded={menuFor === k.id}
+ onClick={(e) => openMenu(e.currentTarget, k.id)}>
+ <iconify-icon icon="tabler:dots"></iconify-icon>
+ </button>
+ </div>
+ ))}
+ </div>
+ </div>
+
+ <Popover open={!!menuKey} anchorRef={menuAnchor} onClose={() => setMenuFor(null)} width={180} minHeight={120}
+ className="ak-menu" label={menuKey ? `Actions for ${menuKey.name || 'key'}` : 'Actions'}>
+ {menuKey && (
+ <div className="uic-pop-list" role="menu">
+ <button type="button" role="menuitem" className="uic-pop-item"
+ onClick={() => { setMenuFor(null); setName(menuKey.name || ''); setErr(''); setSheet({ kind: 'rename', key: menuKey }); }}>Rename</button>
+ <button type="button" role="menuitem" className="uic-pop-item"
+ onClick={() => { setMenuFor(null); void mint(menuKey.name || 'Untitled key', menuKey); }}>Rotate secret</button>
+ <button type="button" role="menuitem" className="uic-pop-item danger"
+ onClick={() => { setMenuFor(null); setSheet({ kind: 'revoke', key: menuKey }); }}>Revoke</button>
+ </div>
+ )}
+ </Popover>
+
+ {sheet && (
+ <div className="ak-scrim" onMouseDown={() => { if (!busy && sheet.kind !== 'reveal') setSheet(null); }}>
+ <section className="ak-modal" role="dialog" aria-modal="true" aria-labelledby="akTitle" onMouseDown={(e) => e.stopPropagation()}>
+ {sheet.kind === 'create' && (
+ <>
+ <div className="ak-modal-body">
+ <h2 id="akTitle">Create API key</h2>
+ <p className="ak-modal-sub">Scoped to {current.name}. Name it after where it will live, so an unused key is easy to trace later.</p>
+ <div className="ak-field">
+ <div className="ak-field-k">Name</div>
+ <input value={name} placeholder="e.g. video-service · staging" autoFocus aria-label="Key name"
onChange={(e) => setName(e.target.value)}
- onKeyDown={(e) => { if (e.key === 'Enter') void mint(); }} /></div>
- {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Could not create</strong>{err}</div></div>}
+ onKeyDown={(e) => { if (e.key === 'Enter') void mint(name.trim() || 'Untitled key'); }} />
+ </div>
+ <div className="ak-warn"><i>!</i><span>The secret is shown once, on the next screen. Paste it into your server environment or the secure modal your coding agent opens, never into chat, source files, or logs.</span></div>
+ {err && <div className="ak-err" style={{ marginTop: 14 }} role="alert">Could not create the key. {err}</div>}
</div>
- <div className="modal-actions">
- <button className="button" type="button" onClick={() => setCreating(false)} disabled={busy}>Cancel</button>
- <button className="button primary" type="button" onClick={() => void mint()} disabled={busy}>{busy ? 'Creating…' : 'Create API Key'}</button>
+ <div className="ak-modal-foot">
+ <button className="ak-secondary" type="button" onClick={() => setSheet(null)} disabled={busy}>Cancel</button>
+ <button className="ak-primary" type="button" onClick={() => void mint(name.trim() || 'Untitled key')} disabled={busy}>{busy ? 'Creating…' : 'Create key'}</button>
</div>
- </div>
- ) : (
- <div className="modal-body">
- <div className="key-reveal"><code>{minted}</code><span>This key is shown once. Copy it now, for security it is never shown again.</span></div>
- <div className="security-note"><iconify-icon icon="tabler:shield-lock"></iconify-icon><span>Never paste this key into normal chat, source files, browser code, logs, or screenshots.</span></div>
- <div className="modal-actions">
- <span className="copy-state" role="status" aria-live="polite">{copied ? 'Copied' : ''}</span>
- <button className="button" type="button" onClick={async () => { try { await navigator.clipboard.writeText(minted); setCopied(true); } catch { /* blocked */ } }}>
- <iconify-icon icon={copied ? 'tabler:check' : 'tabler:copy'}></iconify-icon>{copied ? 'Copied' : 'Copy API Key'}</button>
- <button className="button primary" type="button" onClick={() => { setCreating(false); setMinted(null); }}>Done</button>
+ </>
+ )}
+ {sheet.kind === 'reveal' && (
+ <>
+ <div className="ak-modal-body">
+ <h2 id="akTitle">{sheet.rotated ? `“${sheet.name}” has a new secret` : `“${sheet.name}” is ready`}</h2>
+ <p className="ak-modal-sub">Copy it now. This is the only time it will be shown.</p>
+ {/* ph-no-capture: the plaintext secret stays out of session replay. */}
+ <div className="ak-secret ph-no-capture">
+ <code>{sheet.secret}</code>
+ <button className={'ak-copy' + (copied ? ' is-copied' : '')} type="button"
+ onClick={async () => { try { await navigator.clipboard.writeText(sheet.secret); setCopied(true); } catch { /* blocked */ } }}>
+ {copied ? 'Copied' : 'Copy'}
+ </button>
+ </div>
+ <p className="ak-modal-note">Store it as HR_API_KEY on your server. Rotate it from this page if it ever leaks.</p>
</div>
- </div>
+ <div className="ak-modal-foot">
+ <button className="ak-primary" type="button" onClick={() => setSheet(null)}>{copied ? 'Done' : 'I have copied it'}</button>
+ </div>
+ </>
+ )}
+ {sheet.kind === 'rename' && (
+ <>
+ <div className="ak-modal-body">
+ <h2 id="akTitle">Rename key</h2>
+ <p className="ak-modal-sub">Only the name changes. The secret and its scope stay as they are.</p>
+ <div className="ak-field">
+ <div className="ak-field-k">Name</div>
+ <input value={name} autoFocus aria-label="Key name" onChange={(e) => setName(e.target.value)}
+ onKeyDown={(e) => { if (e.key === 'Enter') void rename(sheet.key, name); }} />
+ </div>
+ {err && <div className="ak-err" style={{ marginTop: 14 }} role="alert">Could not rename the key. {err}</div>}
+ </div>
+ <div className="ak-modal-foot">
+ <button className="ak-secondary" type="button" onClick={() => setSheet(null)} disabled={busy}>Cancel</button>
+ <button className="ak-primary" type="button" onClick={() => void rename(sheet.key, name)} disabled={busy || !name.trim()}>Save name</button>
+ </div>
+ </>
+ )}
+ {sheet.kind === 'revoke' && (
+ <>
+ <div className="ak-modal-body">
+ <h2 id="akTitle">Revoke “{sheet.key.name || 'Untitled key'}”?</h2>
+ <p className="ak-modal-sub">Anything using this key stops working right away. This cannot be undone.</p>
+ </div>
+ <div className="ak-modal-foot">
+ <button className="ak-secondary" type="button" onClick={() => setSheet(null)} disabled={busy}>Cancel</button>
+ <button className="ak-danger" type="button" onClick={() => void revoke(sheet.key)} disabled={busy}>Revoke key</button>
+ </div>
+ </>
)}
- </section>
- </div>
- )}
-
- {revoking && (
- <div className="modal-backdrop">
- <section className="modal" role="dialog" aria-modal="true" aria-labelledby="revokeTitle" onClick={(e) => e.stopPropagation()}>
- <div className="modal-header">
- <div><h2 id="revokeTitle">Revoke &ldquo;{revoking.name || 'Untitled key'}&rdquo;?</h2><p>Any integration using this key will immediately stop working. This cannot be undone.</p></div>
- <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={() => setRevoking(null)}><iconify-icon icon="tabler:x"></iconify-icon></button>
- </div>
- <div className="modal-body">
- <div className="modal-actions">
- <button className="button" type="button" onClick={() => setRevoking(null)}>Cancel</button>
- <button className="button danger" type="button" onClick={() => void revoke(revoking.id)}>Revoke key</button>
- </div>
- </div>
</section>
</div>
)}
diff --git a/ui/src/app/(app)/quickstart/page.tsx b/ui/src/app/(app)/quickstart/page.tsx
index ab3c231c..f6f98855 100644
--- a/ui/src/app/(app)/quickstart/page.tsx
+++ b/ui/src/app/(app)/quickstart/page.tsx
@@ -1,30 +1,47 @@
'use client';
-// Quickstart, "Connect a Coding Agent" in three steps. The AGENTS.md content is the primary
-// copyable asset; the API key is created in a light modal HERE (name + one-time reveal), never a
-// jump to the management page. The full doc stays at /agents as the single source of truth.
-import { harnessFetch } from '@/lib/hfetch';
+// Quickstart, "Connect a coding agent", per the v2 design: four steps on a rail. Copy AGENTS.md
+// and paste it into your coding agent, ask it to build, hand it a workspace API key through its
+// secure modal, then manage what it built under Agent harnesses. Progress is kept per browser.
+// The API key is created HERE, shown once, and never stored beyond its last four characters.
+import Link from 'next/link';
import { useMemo, useState } from 'react';
+import { harnessFetch } from '@/lib/hfetch';
import { getSession } from '@/lib/auth';
import { agentMd } from '@/lib/agentmd';
import { useWorkspace } from '@/lib/workspace';
+import { track } from '@/lib/analytics';
+import { useQuickstart, quickstartDone } from '@/lib/quickstart';
+
+/** The coding agents people paste the guide into, with their own marks. */
+const AGENTS = [
+ { id: 'codex', name: 'Codex', logo: '/logos/codex.png' },
+ { id: 'claude-code', name: 'Claude Code', logo: '/logos/claude.png' },
+ { id: 'cursor', name: 'Cursor', logo: '/logos/cursor.svg' },
+];
+const NEXT = [
+ { title: 'Create a harness', body: 'Prompt + runtime + model, reusable', href: '/harnesses' },
+ { title: 'Run your first task', body: 'Send a message, watch the trace', href: '/harnesses?h=codex' },
+ { title: 'Field an arena run', body: 'Compare configurations on one task', href: '/arena' },
+];
+const fmtKb = (bytes: number) => `${(bytes / 1024).toFixed(1)} kB`;
export default function QuickstartPage() {
const { current, defaultId } = useWorkspace();
+ const [qs, update] = useQuickstart();
const md = useMemo(() => agentMd(), []);
+ const size = useMemo(() => fmtKb(new TextEncoder().encode(md).length), [md]);
const preview = useMemo(() => md.split('\n').slice(0, 8).join('\n') + '\n\nRead the complete guide before implementing the integration…', [md]);
- const [copied, setCopied] = useState(false);
- const [modal, setModal] = useState(false);
- const [keyName, setKeyName] = useState('Quickstart integration');
- const [minted, setMinted] = useState<string | null>(null);
+ const agent = AGENTS.find((a) => a.id === qs.agent) || AGENTS[0];
+
+ const [minted, setMinted] = useState<string | null>(null); // the one-time reveal, this visit only
const [busy, setBusy] = useState(false);
const [err, setErr] = useState('');
const [keyCopied, setKeyCopied] = useState(false);
const copyMd = async () => {
- try { await navigator.clipboard.writeText(md); setCopied(true); setTimeout(() => setCopied(false), 1600); } catch { /* blocked */ }
+ try { await navigator.clipboard.writeText(md); track('agents_guide_copied'); update({ copied: true }); } catch { /* blocked */ }
};
-
- async function mint() {
+ async function createKey() {
if (busy) return;
setBusy(true); setErr('');
try {
@@ -33,92 +50,153 @@ export default function QuickstartPage() {
const member = s?.member?.email || s?.member?.id || '';
const r = await harnessFetch(`/api/harness/v1/orgs/${encodeURIComponent(org)}/keys`, {
method: 'POST', headers: { 'content-type': 'application/json' },
- body: JSON.stringify({ name: keyName.trim() || 'Quickstart integration', member_id: member,
- workspace: current.id || '', workspace_default: !current.id || current.id === defaultId }),
+ body: JSON.stringify({ name: 'Quickstart integration', member_id: member, workspace: current.id || '', workspace_name: current.name || '',
+ workspace_default: !current.id || current.id === defaultId }),
});
const d = await r.json();
if (!r.ok) throw new Error(d.detail || 'Could not create the key');
- setMinted(d.key);
+ track('api_key_created', { surface: 'quickstart', is_first_key: null, workspace_is_default: !current.id || current.id === defaultId, workspace_id: current.id || null });
+ setMinted(d.key); setKeyCopied(false);
+ const k = String(d.key || '');
+ update({ keyCreated: true, keyHint: `${k.slice(0, k.indexOf('-', 3) + 1 || 3)}••••${k.slice(-4)}` });
} catch (e) { setErr(e instanceof Error ? e.message : String(e)); }
finally { setBusy(false); }
}
+ const done = quickstartDone(qs);
+ const allDone = done === 4;
+ const oneState = qs.pasted ? 'done' : 'active';
+ const twoState = qs.asked ? 'done' : 'active';
+ const threeState = qs.keyCreated ? 'done' : 'active';
+ const fourState = allDone ? 'done' : 'active';
+
return (
- <section className="view is-active" id="view-quickstart">
- <div className="page">
- <div className="page-header">
- <div><h1>Connect a Coding Agent</h1><p>Paste the guide, describe what you want, then provide one Workspace API key through a secure modal.</p></div>
+ <section className="qs" id="view-quickstart">
+ <header className="qs-head">
+ <h1>Connect a coding agent</h1>
+ <p>Copy the guide, paste it into your coding agent, then type the product you want to build. Your agent writes the product; HarnessRouter runs the agents behind it.</p>
+ <div className="qs-progress">
+ <span className="qs-progress-label">{allDone ? 'All steps done' : `${done} of 4 steps done`}</span>
+ <span className="qs-bar"><span className={'qs-bar-fill' + (allDone ? ' is-done' : '')} style={{ width: `${Math.round((done / 4) * 100)}%` }} /></span>
+ {allDone && <button type="button" className="qs-reset" onClick={() => { setMinted(null); update({ copied: false, pasted: false, asked: false, keyCreated: false, keyHint: '' }); }}>START OVER</button>}
</div>
- <div className="quickstart">
- <div className="quickstart-steps">
- <section className="quickstart-step">
- <span className="step-number">1</span>
- <h2>Paste into your coding agent</h2>
- <div className="quickstart-copy">
- <p>Copy the official instructions and paste them into Codex, Claude Code, or another coding agent.</p>
- <pre className="agent-preview" aria-label="AGENTS.md preview">{preview}</pre>
- <div className="quickstart-actions">
- <button className="button primary" type="button" onClick={() => void copyMd()}><iconify-icon icon="tabler:copy"></iconify-icon>Copy full AGENTS.md</button>
- <a className="button" href="/agents" target="_blank" rel="noreferrer">View official source</a>
- <span className="copy-state" role="status" aria-live="polite">{copied ? 'Copied' : ''}</span>
- </div>
- </div>
- </section>
- <section className="quickstart-step">
- <span className="step-number">2</span>
- <h2>Ask it to build</h2>
- <div className="quickstart-copy">
- <p>Describe the product or feature you want. The coding agent will build the host product and add the server-side HarnessRouter integration.</p>
- <pre className="agent-preview" aria-label="Example build request">Build a contract-review app that lets users upload an agreement, streams progress, renders the result, and supports follow-up revisions.</pre>
+ </header>
+
+ <div className="qs-body">
+ <div className="qs-grid">
+ {/* 01 */}
+ <div className="qs-railcell"><span className="qs-rail" /><span className={'qs-marker is-' + oneState}>{qs.pasted ? '✓' : '01'}</span></div>
+ <div className={'qs-card is-' + oneState}>
+ <div className="qs-card-head">
+ <div>
+ <div className="qs-title">Paste AGENTS.md into your coding agent</div>
+ <div className="qs-sub">Copy the official instructions and paste them into Codex, Claude Code, Cursor, or another coding agent.</div>
</div>
- </section>
- <section className="quickstart-step">
- <span className="step-number">3</span>
- <h2>Add your API key securely</h2>
- <div className="quickstart-copy">
- <p>When the coding agent opens a secure secret modal, create an API key for <span className="workspace-name">{current.name}</span> and paste it into that modal. The agent stores it as <code>HR_API_KEY</code> and continues the build.</p>
- <button className="button" type="button" onClick={() => { setMinted(null); setErr(''); setModal(true); }}><iconify-icon icon="tabler:key"></iconify-icon>Create API Key</button>
- <div className="security-note"><iconify-icon icon="tabler:shield-lock"></iconify-icon><span>Paste the key only into the secure modal opened by your coding agent. Never paste it into normal chat, source files, AGENTS.md, browser code, logs, or screenshots.</span></div>
+ <a className="qs-link" href="/agents" target="_blank" rel="noreferrer">View official source</a>
+ </div>
+ <div className="qs-doc">
+ <div className="qs-doc-head"><span className="qs-doc-name">AGENTS.MD</span><span className="qs-doc-meta">canonical · {size}</span></div>
+ <pre className="qs-doc-body" aria-label="AGENTS.md preview">{preview}</pre>
+ </div>
+ <div className="qs-actions">
+ <button type="button" className={'qs-copy' + (qs.copied ? ' is-done' : '')} onClick={() => void copyMd()}>{qs.copied ? 'Copied to clipboard' : 'Copy AGENTS.md'}</button>
+ <div className="qs-chips" role="radiogroup" aria-label="Your coding agent">
+ {AGENTS.map((a) => (
+ <button key={a.id} type="button" role="radio" aria-checked={a.id === agent.id} className={'qs-chip' + (a.id === agent.id ? ' is-on' : '')} onClick={() => update({ agent: a.id })}>
+ {/* eslint-disable-next-line @next/next/no-img-element -- the agent's own mark, a static asset */}
+ <img className="qs-chip-mark" src={a.logo} alt="" aria-hidden="true" /><span>{a.name}</span>
+ </button>
+ ))}
</div>
- </section>
+ <button type="button" className={'qs-confirm' + (qs.pasted ? ' is-done' : '')} disabled={!qs.copied} title={qs.copied ? undefined : 'Copy AGENTS.md first'}
+ onClick={() => { if (qs.copied) { track('quickstart_pasted'); update({ pasted: true }); } }}>{qs.pasted ? 'Pasted' : 'Done pasting'}</button>
+ </div>
</div>
- </div>
- </div>
- {modal && (
- <div className="modal-backdrop">
- <section className="modal" role="dialog" aria-modal="true" aria-labelledby="qkTitle" onClick={(e) => e.stopPropagation()}>
- <div className="modal-header">
- <div><h2 id="qkTitle">Create API Key</h2><p>Create a key for <span className="workspace-name">{current.name}</span> without leaving Quickstart.</p></div>
- <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={() => setModal(false)}><iconify-icon icon="tabler:x"></iconify-icon></button>
+ {/* 02 */}
+ <div className="qs-railcell"><span className="qs-rail" /><span className={'qs-marker is-' + twoState}>{qs.asked ? '✓' : '02'}</span></div>
+ <div className={'qs-card is-' + twoState}>
+ <div className="qs-card-head">
+ <div>
+ <div className="qs-title">Ask it to build</div>
+ <div className="qs-sub">Describe the product or feature you want. The coding agent builds the product interface and connects your backend to server-side agents through HarnessRouter.</div>
+ </div>
</div>
- {!minted ? (
- <div className="modal-body">
- <div className="field-stack">
- <div className="field"><label htmlFor="qkName">Key name</label>
- <input id="qkName" value={keyName} onChange={(e) => setKeyName(e.target.value)} autoFocus /></div>
- {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Could not create</strong>{err}</div></div>}
- </div>
- <div className="modal-actions">
- <button className="button" type="button" onClick={() => setModal(false)} disabled={busy}>Cancel</button>
- <button className="button primary" type="button" onClick={() => void mint()} disabled={busy}>{busy ? 'Creating…' : 'Create API Key'}</button>
- </div>
+ <div className="qs-kicker">In {agent.name}</div>
+ <div className="qs-mock" aria-label={`What you type into ${agent.name}`}>
+ <div className="qs-mock-file">
+ {/* eslint-disable-next-line @next/next/no-img-element -- the agent's own mark, a static asset */}
+ <span className="qs-mock-mark"><img src={agent.logo} alt="" aria-hidden="true" /></span>
+ <div><div className="qs-mock-file-name">HarnessRouter AGENTS.md</div><div className="qs-mock-file-meta">Pasted text · {size}</div></div>
+ <span className="qs-mock-x" aria-hidden="true">✕</span>
</div>
- ) : (
- <div className="modal-body">
- <div className="key-reveal"><code>{minted}</code><span>This key is shown once. Copy it now, then paste it into the secure modal opened by your coding agent.</span></div>
- <div className="security-note"><iconify-icon icon="tabler:shield-lock"></iconify-icon><span>Never paste this key into normal chat, source files, browser code, logs, or screenshots.</span></div>
- <div className="modal-actions">
- <span className="copy-state" role="status" aria-live="polite">{keyCopied ? 'Copied' : ''}</span>
- <button className="button" type="button" onClick={async () => { try { await navigator.clipboard.writeText(minted); setKeyCopied(true); } catch { /* blocked */ } }}>
- <iconify-icon icon={keyCopied ? 'tabler:check' : 'tabler:copy'}></iconify-icon>{keyCopied ? 'Copied' : 'Copy API Key'}</button>
- <button className="button primary" type="button" onClick={() => setModal(false)}>Done</button>
- </div>
+ <div className="qs-mock-prompt">Build a product-launch video agent.</div>
+ <div className="qs-mock-row">
+ <span className="qs-mock-plus" aria-hidden="true">+</span>
+ <span className="qs-mock-badge">{agent.name}</span>
+ <span className="qs-mock-send" aria-hidden="true">↑</span>
+ </div>
+ </div>
+ <div className="qs-actions">
+ <button type="button" className={'qs-confirm' + (qs.asked ? ' is-done' : '')} onClick={() => { track('quickstart_asked'); update({ asked: true }); }}>{qs.asked ? 'Sent to my agent' : 'I sent this to my agent'}</button>
+ </div>
+ </div>
+
+ {/* 03 */}
+ <div className="qs-railcell"><span className="qs-rail" /><span className={'qs-marker is-' + threeState}>{qs.keyCreated ? '✓' : '03'}</span></div>
+ <div className={'qs-card is-' + threeState}>
+ <div className="qs-card-head">
+ <div>
+ <div className="qs-title">Add your API key securely</div>
+ <div className="qs-sub">When the coding agent opens a secure secret modal, create a Workspace API key and paste it into that modal. The agent stores it as HR_API_KEY and continues the build.</div>
+ </div>
+ </div>
+ <div className="qs-keyrow">
+ <button type="button" className={'qs-keybtn' + (qs.keyCreated ? ' is-done' : '')} disabled={busy} onClick={() => void createKey()}>
+ {busy ? 'Creating' : qs.keyCreated ? `Key created · ${qs.keyHint}` : 'Create API key'}
+ </button>
+ <span className="qs-keynote">{qs.keyCreated ? 'Shown once. Paste it into the agent’s secure modal.' : `Scoped to ${current.name}`}</span>
+ </div>
+ {err && <p className="qs-err" role="alert">{err}</p>}
+ {minted && (
+ <div className="qs-reveal ph-no-capture">
+ <code>{minted}</code>
+ <button type="button" className="qs-confirm" onClick={async () => { try { await navigator.clipboard.writeText(minted); setKeyCopied(true); } catch { /* blocked */ } }}>{keyCopied ? 'Copied' : 'Copy key'}</button>
</div>
)}
- </section>
+ <div className="qs-warn"><span aria-hidden="true">!</span><span>Paste the key only into the secure modal opened by your coding agent. Never paste it into normal chat, source files, AGENTS.md, browser code, logs, or screenshots.</span></div>
+ </div>
+
+ {/* 04 */}
+ <div className="qs-railcell"><span className={'qs-marker is-' + fourState}>{allDone ? '✓' : '04'}</span></div>
+ <div className={'qs-card is-' + fourState}>
+ <div className="qs-title">Manage your harnesses</div>
+ <div className="qs-sub">Signing in to Cloud brings you here. Every harness your agent creates shows up under Agent harnesses, with its tasks, traces, and settings.</div>
+ <div className="qs-flow">
+ <div className="qs-flow-box">Your product</div>
+ <span className="qs-flow-arrow" aria-hidden="true">→</span>
+ <div className="qs-flow-box is-cloud">HarnessRouter Cloud</div>
+ </div>
+ <div className="qs-flow-note">Tasks in · progress, files, artifacts, and results out. Hosted tasks run the selected harness in an isolated sandbox.</div>
+ <div className="qs-actions qs-actions-last">
+ <Link className="qs-open" href="/harnesses">Open Agent harnesses →</Link>
+ <span className="qs-ce">Community Edition runs the same flow on your infrastructure.</span>
+ </div>
+ </div>
</div>
- )}
+
+ {allDone && (
+ <div className="qs-done">
+ <div className="qs-done-kicker">CONNECTED</div>
+ <div className="qs-done-title">Your product can now run agents through HarnessRouter.</div>
+ <div className="qs-next">
+ {NEXT.map((n) => (
+ <Link key={n.title} className="qs-next-card" href={n.href}><span className="qs-next-title">{n.title}</span><span className="qs-next-body">{n.body}</span></Link>
+ ))}
+ </div>
+ </div>
+ )}
+ </div>
</section>
);
}
diff --git a/ui/src/app/(app)/tasks/page.tsx b/ui/src/app/(app)/tasks/page.tsx
index 9395b5e8..7267e2cf 100644
--- a/ui/src/app/(app)/tasks/page.tsx
+++ b/ui/src/app/(app)/tasks/page.tsx
@@ -1,11 +1,14 @@
-'use client';
-// Tasks, the Workspace's execution/observation surface, rendered per the HIG prototype's
-// run-layout master-detail: page header (title + harness select + New Task), bordered
-// list/detail card, task rows with status chips + updated times, detail head with run-meta,
-// Conversation | Trace tabs. One unified list (no Live/Test split, product decision
-// 2026-07-18); end-user↔session permission modeling belongs to the host application.
-import Workbench from '../workbench/page';
+// Tasks are part of the Agent harnesses page now (v2): each harness lists its tasks, and a
+// task opens in place. Old links, with their harness and session, land there.
+import { redirect } from 'next/navigation';
-export default function TasksPage() {
- return <Workbench />;
+export default async function TasksRedirect({ searchParams }: { searchParams: Promise<Record<string, string | string[] | undefined>> }) {
+ const sp = await searchParams;
+ const q = new URLSearchParams();
+ const h = typeof sp.h === 'string' ? sp.h : '';
+ const sid = typeof sp.sid === 'string' ? sp.sid : '';
+ if (h) q.set('h', h);
+ if (sid) q.set('sid', sid);
+ const qs = q.toString();
+ redirect(qs ? `/harnesses?${qs}` : '/harnesses');
}
diff --git a/ui/src/app/(app)/workbench/page.tsx b/ui/src/app/(app)/workbench/page.tsx
deleted file mode 100644
index 54af33df..00000000
--- a/ui/src/app/(app)/workbench/page.tsx
+++ /dev/null
@@ -1,1426 +0,0 @@
-'use client';
-import { harnessFetch } from '@/lib/hfetch';
-import { Children, Suspense, useEffect, useId, useMemo, useRef, useState, isValidElement, type CSSProperties, type ReactElement, type ReactNode } from 'react';
-import { SkelListItems, SkelPage } from '@/components/Skel';
-import { useSearchParams } from 'next/navigation';
-import ReactMarkdown from 'react-markdown';
-import remarkGfm from 'remark-gfm';
-import { Mermaid } from '@/components/Mermaid';
-import { OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, saveCustom, listCustom, getSkillFiles, storeMcpSecret, testMcp, type CustomHarness, type OobHarness, modelAvailable } from '@/lib/harness';
-import { HarnessLogo } from '@/components/HarnessLogo';
-import { streamResponse, subscribeHarnessEvents, containerFileUrl, downloadFile, loadSessionTurns, cancelSession, authHeaders, type RespFile, type SessionTurn } from '@/lib/chat';
-import { getSession } from '@/lib/auth';
-import { appendWorkspaceQuery } from '@/lib/workspace';
-import { statusChip, timeAgo } from '@/lib/revamp-data';
-// Shared Conversational Agent surface (UI Core), extracted from this page; see
-// frontend-ui-core/README.md for the token/transport/slot contracts.
-import { Svg, Chevron, IcPlug, IcSkill } from 'reifyui';
-import { ChatMessages } from 'reifyui';
-import { CodeBlock } from 'reifyui';
-import { Composer } from 'reifyui';
-import { withText, withReasoning, withStep, withResult, asstText } from 'reifyui';
-import { createConversationStore } from 'reifyui';
-import { SELF_HOSTED } from '@/lib/edition';
-import TracesMain from '@/studio/traces/TracesMain.jsx';
-import { traceStore } from '@/studio/traces/store';
-import { FilePreview } from '@/components/FilePreview';
-import { FileTypeIcon } from '@/components/FileTypeIcon';
-
-type Tab = 'config' | 'traces';
-
-// react-markdown v9 override: a ```mermaid fence renders as a real diagram; every other fenced
-// block renders through the shared CodeBlock (language-aware syntax highlighting, lazy
-// highlight.js). We override `pre` (not `code`) because in v9 the language class lives on the
-// inner <code>, so replacing the block happens at the `pre` level.
-const MD_COMPONENTS = {
- pre({ children }: { children?: ReactNode }) {
- const el = Children.toArray(children).find(isValidElement) as
- ReactElement<{ className?: string; children?: React.ReactNode }> | undefined;
- const cls = el?.props?.className || '';
- const lang = /language-([\w#+-]+)/.exec(cls);
- const code = String(el?.props?.children ?? '').replace(/\n$/, '');
- if (lang && lang[1] === 'mermaid') {
- return <Mermaid code={code} />;
- }
- return <CodeBlock code={code} language={lang ? lang[1] : ''} />;
- },
-};
-const renderWbMarkdown = (t: string) => (
- <ReactMarkdown remarkPlugins={[remarkGfm]} components={MD_COMPONENTS}>{t}</ReactMarkdown>
-);
-
-// Agent replies reference workspace files as /workspace/... or sandbox: links, served nowhere as
-// written (they 404 on the app origin). This renderer rewrites those hrefs to the authenticated
-// by-path artifact route for the CURRENT session, so clicking opens the real file inline.
-const WS_LINK_RE = /^(?:sandbox:)?\/?(?:workspace\/)?(.+)$/;
-function isWorkspaceHref(href: string): boolean {
- if (!href || href.startsWith('#')) return false;
- if (/^[a-z][a-z0-9+.-]*:/i.test(href) && !href.startsWith('sandbox:')) return false; // http(s), mailto…
- return href.startsWith('sandbox:') || href.startsWith('/workspace/') || href.startsWith('workspace/')
- || (!href.startsWith('/') && /\.[A-Za-z0-9]{1,8}$/.test(href));
-}
-function makeWbMarkdown(getSid: () => string | null, getHarness?: () => string | null) {
- const components = {
- ...MD_COMPONENTS,
- a: ({ href, children }: { href?: string; children?: React.ReactNode }) => {
- const sid = getSid();
- if (href && sid && isWorkspaceHref(href)) {
- const m = decodeURIComponent(href).match(WS_LINK_RE);
- const path = m ? m[1].replace(/^\/+/, '') : '';
- if (path) {
- const enc = path.split('/').map(encodeURIComponent).join('/');
- const h = getHarness?.();
- // canonical address: /{harness}/{session}/workspace/{path}
- const url = h ? `/${encodeURIComponent(h)}/${encodeURIComponent(sid)}/workspace/${enc}`
- : `/api/harness/a/${encodeURIComponent(sid)}/${enc}`;
- return <a href={url} target="_blank" rel="noreferrer">{children}</a>;
- }
- }
- return <a href={href} target="_blank" rel="noreferrer">{children}</a>;
- },
- };
- return (t: string) => (
- <ReactMarkdown remarkPlugins={[remarkGfm]} components={components}>{t}</ReactMarkdown>
- );
-}
-
-const TERMINAL_TURN = new Set(['done', 'completed', 'failed', 'error', 'cancelled', 'incomplete', 'timeout', 'max_turns']);
-
-/** Server turns -> conversation messages (shared by hydration + busy reconciliation). */
-function msgsFromTurns(turns: SessionTurn[]): { msgs: Msg[]; running: boolean } {
- const m: Msg[] = [];
- let running = false;
- for (const t of turns) {
- if (t.user || (t.user_files || []).length) {
- m.push({ role: 'user', text: t.user,
- attachments: (t.user_files || []).map((f) => ({ name: f.name })) });
- }
- const steps = (t.tools || []).map((x) => ({ name: x.name, args: x.arguments, result: x.result }));
- const blocks: Block[] = [];
- if (steps.length) blocks.push({ kind: 'tools', reasoning: '', steps });
- if (t.assistant) blocks.push({ kind: 'text', text: t.assistant });
- const st: AsstMsg['status'] = t.status === 'failed' || t.status === 'error' ? 'failed'
- : t.status === 'cancelled' ? 'cancelled'
- : (t.status === 'incomplete' || t.status === 'max_turns' || t.status === 'timeout') ? 'incomplete'
- : (t.status === 'running' || t.status === 'starting' || t.status === 'in_progress') ? 'running' : 'done';
- if (st === 'running') running = true;
- m.push({ role: 'assistant', blocks, files: t.files || [], status: st,
- incompleteReason: (t as { incomplete_reason?: string }).incomplete_reason || undefined });
- }
- return { msgs: m, running };
-}
-
-// Each base harness gets a stable assigned accent so the badge reads at a glance.
-const BASE_TINT: Record<string, string> = {
- codex: '#0E8C6A', 'claude-code': '#C2613D', pi: '#6E55FF', hermes: '#2563EB',
-};
-function baseTint(id: string): string {
- if (BASE_TINT[id]) return BASE_TINT[id];
- let h = 0;
- for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) >>> 0;
- return `hsl(${h % 360} 52% 42%)`;
-}
-
-// Svg / Chevron / IcPlug / IcSkill come from UI Core; the icons below are workbench-specific.
-const IcCopy = () => <Svg><rect x="9" y="9" width="11" height="11" rx="2" /><path d="M5 15V5a2 2 0 0 1 2-2h10" /></Svg>;
-const IcRetry = () => <Svg><path d="M21 12a9 9 0 1 1-3-6.7" /><path d="M21 4v5h-5" /></Svg>;
-const IcPlus = () => <Svg s={18}><path d="M12 5v14M5 12h14" /></Svg>;
-const IcDl = () => <Svg s={16}><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><path d="M7 10l5 5 5-5" /><path d="M12 15V3" /></Svg>;
-const IcTrash = () => <Svg s={15}><path d="M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6" /></Svg>;
-const FileGlyph = ({ small }: { small?: boolean }) =>
- <Svg s={small ? 13 : 18}><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><path d="M14 2v6h6" /></Svg>;
-// Side-panel toggle (collapse/expand the task-history rail), split-rectangle glyph.
-const IcPanel = () => <Svg s={18}><rect x="3" y="4" width="18" height="16" rx="2" /><path d="M9 4v16" /></Svg>;
-const IcFolder = () => <Svg s={14}><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /></Svg>;
-const IcFilePlus = () => <Svg s={17}><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /><path d="M14 2v6h6" /><path d="M12 12v6M9 15h6" /></Svg>;
-const IcFolderPlus = () => <Svg s={17}><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /><path d="M12 11v5M9.5 13.5h5" /></Svg>;
-const IcUpload = () => <Svg s={17}><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><path d="M7 9l5-5 5 5" /><path d="M12 4v12" /></Svg>;
-const IcFolderUp = () => <Svg s={17}><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /><path d="M12 16v-5.5" /><path d="M9.5 13 12 10.5 14.5 13" /></Svg>;
-const IcPencil = () => <Svg s={14}><path d="M12 20h9" /><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z" /></Svg>;
-
-// Tool-step icons, toolMeta, summarizeSteps and the activity timeline (ToolGroup/ToolRow)
-// live in UI Core (frontend-ui-core/src/components/*), rendered via ChatMessages below.
-
-// Drag-to-resize a pane width. fromRight: handle is on the pane's left edge (dragging right shrinks).
-function useHResize(initial: number, min: number, max: number, fromRight = false) {
- const [w, setW] = useState(initial);
- const onDown = (e: React.MouseEvent) => {
- e.preventDefault();
- const sx = e.clientX, base = w, dir = fromRight ? -1 : 1;
- // While dragging, neutralize iframes/text-selection so the embedded PDF/preview can't swallow
- // mousemove/mouseup (which would strand the drag and make narrowing impossible).
- document.body.classList.add('hr-resizing');
- const move = (ev: MouseEvent) => setW(Math.min(max, Math.max(min, base + dir * (ev.clientX - sx))));
- const up = () => {
- window.removeEventListener('mousemove', move); window.removeEventListener('mouseup', up);
- document.body.style.cursor = ''; document.body.classList.remove('hr-resizing');
- };
- window.addEventListener('mousemove', move); window.addEventListener('mouseup', up); document.body.style.cursor = 'col-resize';
- };
- return [w, onDown] as const;
-}
-
-function Workbench() {
- const sp = useSearchParams();
- const [harnessId, setHarnessId] = useState(sp.get('h') || '');
- const [custom, setCustom] = useState<CustomHarness[]>([]);
- const [customLoaded, setCustomLoaded] = useState(false);
- useEffect(() => { listCustom().then((cs) => { setCustom(cs); setCustomLoaded(true); }).catch(() => setCustomLoaded(true)); }, []);
- // Default selection: the user's newest CUSTOM harness; built-in Codex only when none exist.
- // Gate on customLoaded, defaulting before the list arrives would lock onto the built-in.
- useEffect(() => { if (!harnessId && customLoaded) setHarnessId(custom[0]?.id || OOB[0].id); }, [harnessId, custom, customLoaded]);
- // Reflect the selected harness in the URL (?h=<id>) so a refresh restores the selection.
- useEffect(() => {
- if (!harnessId) return;
- const url = new URL(window.location.href);
- if (url.searchParams.get('h') !== harnessId) {
- url.searchParams.set('h', harnessId);
- window.history.replaceState(null, '', url.toString());
- }
- }, [harnessId]);
-
- const oob = oobById(harnessId);
- const ch = oob ? null : (custom.find((c) => c.id === harnessId) || null);
- const curName = oob?.name || ch?.name || '';
- // Deep link: /tasks?h=<harness>&sid=<session> opens that exact task. Bad ids surface a
- // visible error instead of silently landing on an empty New Task. Consumed ONCE, switching
- // harness clears it (and the URL param) so the new harness starts on a clean New Task.
- const [deepSid, setDeepSid] = useState(() => sp.get('sid') || '');
- const harnessMissing = customLoaded && !!sp.get('h') && !oob && !ch;
-
- // Harness selector lives in the task-list panel as a filter (finalized design, no title row).
- const harnessSelect = (
- <select className="select" aria-label="Select Harness" value={harnessId} onChange={(e) => {
- const url = new URL(window.location.href);
- if (url.searchParams.has('sid')) { url.searchParams.delete('sid'); window.history.replaceState(null, '', url.toString()); }
- setDeepSid('');
- setHarnessId(e.target.value);
- }}>
- <optgroup label="My Harnesses">
- {custom.map((c) => <option key={c.id} value={c.id}>{c.name}</option>)}
- </optgroup>
- <optgroup label="System">
- {OOB.map((o) => (
- <option key={o.id} value={o.id} disabled={o.status === 'soon'}>
- {o.name}{o.status === 'soon' ? ' (soon)' : ''}
- </option>
- ))}
- </optgroup>
- </select>
- );
-
- return (
- <section className="view is-active" id="view-tasks">
- <div className="page tasks-page">
- {harnessMissing && (
- <div className="notice" style={{ marginBottom: 12 }}>
- <iconify-icon icon="tabler:alert-triangle"></iconify-icon>
- <div><strong>Harness not found</strong>
- The linked Harness (<code>{sp.get('h')}</code>) doesn&rsquo;t exist in this Workspace, it may have been
- deleted or belong to another Workspace. Pick a Harness from the list to continue.</div>
- </div>
- )}
- <ConfigChat key={harnessId} oob={oob} ch={ch} harnessId={harnessId}
- harnessName={curName} harnessSelect={harnessSelect} deepSid={deepSid}
- onClearDeepSid={() => setDeepSid('')}
- onSaved={() => listCustom().then(setCustom)} />
- </div>
- </section>
- );
-}
-
-// ── Session sharing (session-level only; artifacts inherit the session's share state) ────────
-function ShareModal({ sid, onClose }: { sid: string; onClose: () => void }) {
- const [enabled, setEnabled] = useState<boolean | null>(null);
- const [token, setToken] = useState('');
- const [busy, setBusy] = useState(false);
- const [copied, setCopied] = useState(false);
- const [err, setErr] = useState('');
- useEffect(() => {
- let alive = true;
- harnessFetch(`/api/harness/v1/sessions/${encodeURIComponent(sid)}/share`, { headers: authHeaders() })
- .then((r) => (r.ok ? r.json() : Promise.reject(new Error(String(r.status)))))
- .then((d) => { if (alive) { setEnabled(Boolean(d.enabled)); setToken(d.token || ''); } })
- .catch(() => { if (alive) setErr('Could not load sharing state.'); });
- return () => { alive = false; };
- }, [sid]);
- const set = async (on: boolean) => {
- if (busy) return;
- setBusy(true); setErr('');
- try {
- const r = await harnessFetch(`/api/harness/v1/sessions/${encodeURIComponent(sid)}/share`, {
- method: 'POST', headers: authHeaders(), body: JSON.stringify({ enabled: on }),
- });
- const d = await r.json();
- if (!r.ok) throw new Error(d.detail || String(r.status));
- setEnabled(Boolean(d.enabled)); setToken(d.token || '');
- } catch (e) { setErr(e instanceof Error ? e.message : String(e)); }
- finally { setBusy(false); }
- };
- const link = token ? `${window.location.origin}/share/${token}` : '';
- return (
- <div className="modal-backdrop">
- <section className="modal" role="dialog" aria-modal="true" aria-labelledby="shareTitle" onClick={(e) => e.stopPropagation()}>
- <div className="modal-header">
- <div><h2 id="shareTitle">Share Task</h2><p>Anyone with the link sees a read-only view of this conversation and ALL of its artifacts. Turn sharing off at any time to revoke the link.</p></div>
- <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={onClose}><iconify-icon icon="tabler:x"></iconify-icon></button>
- </div>
- <div className="modal-body">
- <div className="share-choice-list">
- <button type="button" className={'share-choice' + (enabled === false ? ' on' : '')} disabled={busy} onClick={() => void set(false)}>
- <iconify-icon icon="tabler:lock"></iconify-icon>
- <span><strong>Keep private</strong><span>Only members of this Workspace&rsquo;s organization have access</span></span>
- {enabled === false && <iconify-icon icon="tabler:check"></iconify-icon>}
- </button>
- <button type="button" className={'share-choice' + (enabled === true ? ' on' : '')} disabled={busy} onClick={() => void set(true)}>
- <iconify-icon icon="tabler:world"></iconify-icon>
- <span><strong>Create public link</strong><span>Anyone with the link can view the conversation and artifacts</span></span>
- {enabled === true && <iconify-icon icon="tabler:check"></iconify-icon>}
- </button>
- </div>
- {enabled && link && (
- <div className="share-link-row">
- <input readOnly value={link} onClick={(e) => (e.target as HTMLInputElement).select()} />
- <button className="button" type="button" onClick={async () => { try { await navigator.clipboard.writeText(link); setCopied(true); setTimeout(() => setCopied(false), 1400); } catch { /* blocked */ } }}>
- <iconify-icon icon={copied ? 'tabler:check' : 'tabler:copy'}></iconify-icon>{copied ? 'Copied' : 'Copy'}
- </button>
- </div>
- )}
- {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Sharing error</strong>{err}</div></div>}
- <div className="modal-actions"><button className="button primary" type="button" onClick={onClose}>Done</button></div>
- </div>
- </section>
- </div>
- );
-}
-
-// ── Task list (left) | Task detail (right), the design's run-layout master-detail ────────────
-function ConfigChat({ oob, ch, harnessId, harnessName, harnessSelect, deepSid, onClearDeepSid, onSaved }: {
- oob: OobHarness | null; ch: CustomHarness | null; harnessId: string; harnessName: string;
- harnessSelect?: React.ReactNode; deepSid?: string; onClearDeepSid?: () => void; onSaved: () => void;
-}) {
- const [draft, setDraft] = useState<CustomHarness | null>(ch);
- useEffect(() => setDraft(ch), [ch?.id]); // eslint-disable-line react-hooks/exhaustive-deps
-
- useModelCatalog(); // server catalog is the source of truth for the picker
- const models = oobModels(oob).length ? oobModels(oob) : oobModels(oobById(draft?.base || ''));
- // The safe fallback is the BACKEND DEFAULT (gpt-5.4 / sonnet-4.6), never models[0], the lists
- // lead with the newest/priciest entries (gpt-5.6-*, fable-5) and those must never be picked
- // implicitly.
- const fallbackModel = oobDefaultModel(oob) || oobDefaultModel(oobById(draft?.base || '')) || '';
- // Resolve a stored model name against the current option list, tolerate legacy bare names
- // (sonnet-4.6) now that options carry the claude- prefix, so the saved default still applies.
- const normModel = (m: string | undefined): string => {
- if (!m) return fallbackModel || models[0] || '';
- if (models.includes(m)) return m;
- if (models.includes('claude-' + m)) return 'claude-' + m;
- const bare = m.replace(/^claude-/, '');
- if (models.includes(bare)) return bare;
- return fallbackModel || m;
- };
- const [model, setModel] = useState(oob ? (oobDefaultModel(oob) || '') : normModel(ch?.defaultModel));
- // Re-sync the active model to the harness's saved default whenever the config loads or its default
- // changes (ch arrives async after mount; without ch in deps the saved default was never applied).
- // Resolve against the BASE's model list directly so it doesn't depend on draft-render timing.
- // GUARD: skip when a session is open — an existing task's model is what IT ran with (set by the
- // taskModel effect below), and this effect fires LATE on reload (ch loads async) so without the
- // guard it clobbered the session's model back to the harness default (fable-5 → opus-4.8 on reload).
- useEffect(() => {
- if (deepSid) return; // reloading straight into a session → its own model wins, not the default
- if (oob) { setModel(oobDefaultModel(oob) || ''); return; }
- const base0 = oobById(ch?.base || '');
- const ms = oobModels(base0);
- const dm = ch?.defaultModel || '';
- const pick = ms.includes(dm) ? dm
- : ms.includes('claude-' + dm) ? 'claude-' + dm
- : ms.includes(dm.replace(/^claude-/, '')) ? dm.replace(/^claude-/, '')
- : (oobDefaultModel(base0) || dm);
- setModel(pick);
- }, [harnessId, ch?.defaultModel, ch?.base, deepSid]); // eslint-disable-line react-hooks/exhaustive-deps
-
- const [recentsOpen, setRecentsOpen] = useState(true);
- const [recentsKey, setRecentsKey] = useState(0);
- // Realtime broadcast: subscribe ONCE per harness. Every session's live events flow into the conv
- // store by session id, so any open conversation updates live (no per-tab stream, no hard refresh).
- // Turn start/finish also refreshes Recents so its status dots track in realtime.
- useHarnessBus(harnessId, () => setRecentsKey((k) => k + 1));
- const [selectedSid, setSelectedSid] = useState<string | null>(deepSid || null);
- // activeSid = the session the conversation pane is actually showing (drives the Recents highlight).
- // Kept SEPARATE from selectedSid so a new chat reporting its own session id highlights the row
- // WITHOUT remounting the live conversation (the Conversation is keyed by selectedSid).
- const [activeSid, setActiveSid] = useState<string | null>(deepSid || null);
- const [shareOpen, setShareOpen] = useState(false);
- // Deep-linked session validation: confirm the manifest exists; 404 -> visible error + New Task.
- // A 200 manifest also serves as the title/meta fallback when the session isn't in MY recents
- // (deep links can point at another member's task).
- const [deepErr, setDeepErr] = useState('');
- const [deepCard, setDeepCard] = useState<TraceCard | null>(null);
- useEffect(() => {
- if (!deepSid) return;
- let alive = true;
- harnessFetch(`/api/harness/v1/traces/${encodeURIComponent(deepSid)}`)
- .then(async (r) => {
- if (!alive) return;
- if (r.status === 404) {
- setDeepErr(`The linked Task (${deepSid.slice(0, 18)}…) doesn't exist, it may have been deleted.`);
- setSelectedSid(null); setActiveSid(null); onClearDeepSid?.();
- } else if (!r.ok) {
- setDeepErr(`Could not open the linked Task (HTTP ${r.status}). Try again or pick it from the list.`);
- } else {
- const m = await r.json().catch(() => null);
- if (alive && m?.session_id) {
- setDeepCard({ session_id: m.session_id, title: m.title, status: m.status,
- finished_at: m.finished_at, model: m.model, event_count: m.event_count, elapsed: m.elapsed, credits: m.credits });
- }
- }
- })
- .catch(() => { if (alive) setDeepErr('Could not reach the server to open the linked Task.'); });
- return () => { alive = false; };
- }, [deepSid]);
- // Keep ?sid= in the URL in sync with the shown task so every task view is shareable.
- useEffect(() => {
- const url = new URL(window.location.href);
- const cur = url.searchParams.get('sid');
- const want = activeSid ?? selectedSid;
- if (want && cur !== want) { url.searchParams.set('sid', want); window.history.replaceState(null, '', url.toString()); }
- else if (!want && cur) { url.searchParams.delete('sid'); window.history.replaceState(null, '', url.toString()); }
- }, [activeSid, selectedSid]);
- // Bumped on "New Task" so the conversation fully resets even when selectedSid is already null
- // (a fresh, never-saved task), keys the Conversation to remount it clean.
- const [newTaskNonce, setNewTaskNonce] = useState(0);
- // Trace is a diagnostics TAB of the selected Task (per the IA review), not a separate surface.
- const [detailTab, setDetailTab] = useState<'conversation' | 'trace'>('conversation');
- // Narrow screens alternate between the task list and the detail pane (CSS ≤820px); desktop
- // ignores this. Narrow DEFAULTS to the detail view (list collapsed), the title-row toggle
- // expands the list; picking a task collapses it again.
- const isNarrow = () => typeof window !== 'undefined' && window.matchMedia('(max-width: 820px)').matches;
- const [mobileDetail, setMobileDetail] = useState(() => isNarrow());
- const toggleList = () => { if (isNarrow()) setMobileDetail((v) => !v); else setRecentsOpen((v) => !v); };
- // The task cards (lifted from RecentsPanel) drive the detail header's title + meta row.
- const [cards, setCards] = useState<TraceCard[]>([]);
- const backend = oob?.backend ?? (oobById(draft?.base || '')?.backend ?? null);
-
- const startNew = () => {
- setSelectedSid(null); setActiveSid(null); setDetailTab('conversation');
- // A New Task must be a BRAND-NEW session: kill the deep-link sid + its error so nothing
- // can rebind the fresh conversation to an old session.
- setDeepErr(''); onClearDeepSid?.();
- setNewTaskNonce((n) => n + 1); setMobileDetail(true);
- };
-
- const shownSid = activeSid ?? selectedSid;
- const selCard = shownSid
- ? cards.find((c) => c.session_id === shownSid)
- || (deepCard && deepCard.session_id === shownSid ? deepCard : null)
- : null;
- const chip = selCard ? statusChip(selCard.status) : { cls: 'healthy', label: 'Ready' };
- // An existing task's selector shows the model IT actually ran with last turn (from the trace
- // card), not the harness default, resuming a conversation must not silently switch models.
- const taskModel = selCard?.model || '';
- useEffect(() => {
- if (!shownSid || !taskModel) return;
- setModel(normModel(taskModel));
- }, [shownSid, taskModel]); // eslint-disable-line react-hooks/exhaustive-deps
- const fmtDur = (s?: number) => {
- if (!s) return '';
- const m = Math.floor(s / 60), sec = Math.round(s % 60);
- return m ? `${m}m ${sec}s` : `${sec}s`;
- };
-
- return (
- <div className={'run-layout' + (mobileDetail ? ' m-detail' : '')}
- style={recentsOpen ? undefined : { gridTemplateColumns: 'minmax(0,1fr)' }}>
- {recentsOpen && (
- <RecentsPanel key={`r${harnessId}`} refreshNonce={recentsKey} harnessId={harnessId}
- harnessName={harnessName} selected={activeSid} onCards={setCards} harnessSelect={harnessSelect}
- onSelect={(sid) => { setSelectedSid(sid); setActiveSid(sid); setDetailTab('conversation'); setDeepErr(''); onClearDeepSid?.(); setMobileDetail(true); }}
- onNew={startNew} />
- )}
- <article className="run-detail">
- {deepErr && (
- <div className="notice" style={{ margin: '14px 18px 0' }}>
- <iconify-icon icon="tabler:alert-triangle"></iconify-icon>
- <div><strong>Task not found</strong>{deepErr}</div>
- </div>
- )}
- <div className="task-detail-shell">
- <div className="session-detail-head">
- <div className="session-detail-lead">
- <div className="session-title-row">
- <button className="wbx-panel-tgl" type="button"
- title="Show or hide the task list"
- aria-pressed={recentsOpen} onClick={toggleList}><IcPanel /></button>
- <h2 className="session-title-ellip" title={selCard?.title || undefined}>
- {selCard?.title || (shownSid ? 'Task' : 'New Task')}</h2>
- {shownSid && typeof selCard?.credits === 'number' && selCard.credits > 0 && (
- <span className="run-credits-chip" title="Credits this task has used">
- <iconify-icon icon="tabler:coins"></iconify-icon>
- {selCard.credits < 1 ? selCard.credits.toFixed(2) : selCard.credits.toLocaleString(undefined, { maximumFractionDigits: 1 })} cr
- </span>
- )}
- {shownSid && (
- <button className="wbx-panel-tgl session-share-btn" type="button" title="Share this Task"
- onClick={() => setShareOpen(true)}>
- <iconify-icon icon="tabler:share-2"></iconify-icon>
- </button>
- )}
- </div>
- </div>
- </div>
- {/* Trace is a diagnostics surface backed by the hosted tracing pipeline; a self-hosted
- box has no such pipeline, so a single tab with nothing behind it is worse than none. */}
- {SELF_HOSTED ? null : (
- <div className="tabs" role="tablist" aria-label="Task detail">
- <button className="tab" type="button" role="tab" aria-selected={detailTab === 'conversation'}
- onClick={() => setDetailTab('conversation')}>Conversation</button>
- <button className="tab" type="button" role="tab" aria-selected={detailTab === 'trace'}
- disabled={!shownSid} onClick={() => shownSid && setDetailTab('trace')}>Trace</button>
- </div>
- )}
- </div>
- {/* Conversation stays MOUNTED while the Trace tab shows, its store writes + bus rendering
- must not be interrupted by a diagnostics peek. */}
- <div className="run-detail-fill" style={{ display: detailTab === 'conversation' ? undefined : 'none' }}>
- <Conversation key={`conv-${harnessId}-${selectedSid ?? 'new'}-${newTaskNonce}`} harnessId={harnessId} sessionId={selectedSid}
- target={{ name: harnessName, backend, model, baseId: oob?.id ?? oobById(draft?.base || '')?.id }}
- additionalHeaders={(draft?.additionalHeaders || []).filter(Boolean)}
- models={models} onModel={(m) => setModel(m)}
- recentsOpen={recentsOpen} onToggleRecents={() => setRecentsOpen((v) => !v)} showToggle={false}
- onSession={(sid) => { setActiveSid(sid); setRecentsKey((k) => k + 1); }}
- onRan={() => setRecentsKey((k) => k + 1)} />
- </div>
- {!SELF_HOSTED && detailTab === 'trace' && <TraceView sid={shownSid} />}
- </article>
- {shareOpen && shownSid && <ShareModal sid={shownSid} onClose={() => setShareOpen(false)} />}
- </div>
- );
-}
-
-function AttachCard({ name, dataUri, onRemove }: { name: string; dataUri?: string; onRemove?: () => void }) {
- const ext = (name.split('.').pop() || '').toLowerCase();
- const isImg = /^(png|jpe?g|gif|webp|bmp|svg|avif)$/.test(ext) && !!dataUri && dataUri.startsWith('data:image');
- return (
- <div className={'wbx-attach' + (isImg ? ' img' : '')}>
- {onRemove && <button className="wbx-attach-x" title="Remove" onClick={onRemove}>×</button>}
- {isImg
- ? <img className="wbx-attach-thumb" src={dataUri} alt={name} />
- : <><span className="wbx-attach-ic"><FileTypeIcon name={name} size={26} /></span>
- <span className="wbx-attach-meta"><span className="wbx-attach-name">{name}</span>
- <span className="wbx-attach-ext">{ext.toUpperCase() || 'FILE'}</span></span></>}
- </div>
- );
-}
-
-function ModelSelect({ models, value, onChange, backend }: {
- models: string[]; value: string; onChange: (m: string) => void; backend?: string | null;
-}) {
- return (
- <div className="wbx-select-wrap block">
- <select className="wbx-select full" value={value} onChange={(e) => onChange(e.target.value)}>
- {models.map((m) => (
- <option key={m} value={m} disabled={!modelAvailable(backend, m)}>
- {m}{modelAvailable(backend, m) ? '' : ' — no provider'}
- </option>
- ))}
- </select>
- <span className="wbx-select-chev"><Chevron dir="down" size={15} /></span>
- </div>
- );
-}
-
-// ── Recents: this user's sessions for this harness (clickable → loads its chat history) ─────────
-interface TraceCard {
- session_id: string; title?: string; status?: string; finished_at?: number;
- model?: string; event_count?: number; elapsed?: number; credits?: number;
-}
-
-// Optimistic Recents entries: a just-sent NEW task shows in the list INSTANTLY. The durable card
-// only lands after session allocation + the first trace write (seconds on a cold start), so without
-// this the list lags every new send. An entry drops the moment the server list contains its session
-// (sid learned from response.created), or after a safety expiry if the send failed before a session
-// existed. Module-level (like _runningSids) so it survives panel re-renders.
-type PendingCard = { tempId: string; harness: string; title: string; at: number; sid?: string };
-let _pendingCards: PendingCard[] = [];
-function addPendingCard(harness: string, title: string): string {
- const tempId = 'pend_' + Math.random().toString(36).slice(2);
- _pendingCards.push({ tempId, harness, title, at: Date.now() });
- return tempId;
-}
-function setPendingSid(tempId: string, sid: string) {
- const p = _pendingCards.find((x) => x.tempId === tempId);
- if (p) p.sid = sid;
-}
-function dropPending(tempId: string) { _pendingCards = _pendingCards.filter((x) => x.tempId !== tempId); }
-/** Pending entries still worth showing for this harness, given the server list; prunes the store. */
-function livePending(harness: string, cards: TraceCard[] | null): PendingCard[] {
- const now = Date.now();
- _pendingCards = _pendingCards.filter((p) =>
- now - p.at < 180_000 && !(p.sid && (cards || []).some((c) => c.session_id === p.sid)));
- return _pendingCards.filter((p) => p.harness === harness);
-}
-function RecentsPanel({ harnessId, harnessName, selected, onSelect, onNew, onCards, harnessSelect, refreshNonce }: {
- harnessId: string; harnessName: string; selected: string | null;
- onSelect: (sid: string) => void; onNew: () => void;
- onCards?: (cards: TraceCard[]) => void; harnessSelect?: React.ReactNode; refreshNonce?: number;
-}) {
- const [cards, _setCards] = useState<TraceCard[] | null>(null);
- const setCards = (v: TraceCard[] | null | ((prev: TraceCard[] | null) => TraceCard[] | null)) => {
- _setCards((prev) => (typeof v === 'function' ? v(prev) : v));
- };
- // REAL pagination over the gateway's cursor-paged /v1/traces: `cards` is the polled first
- // page (stays fresh); `tail` accumulates older pages appended by scroll-load; `cursor`
- // points past the last loaded page ('' = exhausted or not yet known).
- const [tail, setTail] = useState<TraceCard[]>([]);
- const [cursor, setCursor] = useState('');
- const [loadingMore, setLoadingMore] = useState(false);
- const merged = useMemo(() => {
- const head = cards || [];
- const seen = new Set(head.map((c) => c.session_id));
- return [...head, ...tail.filter((t) => !seen.has(t.session_id))];
- }, [cards, tail]);
- // The detail header's title derives from the loaded cards (head + tail).
- useEffect(() => { onCards?.(merged); }, [merged]); // eslint-disable-line react-hooks/exhaustive-deps
-
- const listQuery = () => {
- const s = getSession(); const org = s?.orgId; const member = s?.member?.email || s?.member?.id || '';
- if (!org) return null;
- const q = new URLSearchParams({ org, member, harness: harnessId, limit: '40' });
- appendWorkspaceQuery(q);
- return q;
- };
- const loadMore = () => {
- if (!cursor || loadingMore) return;
- const q = listQuery(); if (!q) return;
- q.set('cursor', cursor);
- setLoadingMore(true);
- harnessFetch(`/api/harness/v1/traces?${q.toString()}`)
- .then((r) => (r.ok ? r.json() : Promise.reject(new Error(`traces ${r.status}`))))
- .then((d) => {
- if (Array.isArray(d?.sessions)) setTail((t) => [...t, ...d.sessions]);
- setCursor(d?.cursor || '');
- })
- .catch(() => { /* keep cursor; the next scroll retries */ })
- .finally(() => setLoadingMore(false));
- };
- const onListScroll = (e: React.UIEvent<HTMLDivElement>) => {
- const el = e.currentTarget;
- if (el.scrollTop + el.clientHeight > el.scrollHeight - 140) loadMore();
- };
- const [delTarget, setDelTarget] = useState<TraceCard | null>(null);
- const [flt, setFlt] = useState('');
- const [stFlt, setStFlt] = useState<'all' | 'working' | 'done' | 'failed'>('all');
- const [fltOpen, setFltOpen] = useState(false);
- const fltRef = useRef<HTMLDivElement>(null);
- useEffect(() => {
- const close = (e: MouseEvent) => {
- if (fltRef.current && !fltRef.current.contains(e.target as Node)) setFltOpen(false);
- };
- document.addEventListener('mousedown', close);
- return () => document.removeEventListener('mousedown', close);
- }, []);
- const [deleting, setDeleting] = useState(false);
- // Refresh the list in place (never null it out) so it doesn't flash. Used by the 6s poll AND by
- // refreshNonce bumps (after a turn runs / a session is picked), previously the parent remounted
- // this whole panel via `key`, which blanked the list and caused the visible flash.
- // While nothing is paginated yet, the head page's cursor seeds scroll-load.
- const tailLenRef = useRef(0);
- useEffect(() => { tailLenRef.current = tail.length; }, [tail]);
- const load = () => {
- const q = listQuery();
- if (!q) return Promise.resolve();
- return harnessFetch(`/api/harness/v1/traces?${q.toString()}`)
- .then((r) => (r.ok ? r.json() : Promise.reject(new Error(`traces ${r.status}`))))
- // Only overwrite with a genuine array. A transient error / cold-start / gateway rollover must
- // NEVER blank an already-loaded list, that reads to the user as "all my sessions are gone".
- .then((d) => {
- if (Array.isArray(d?.sessions)) setCards(d.sessions);
- if (tailLenRef.current === 0) setCursor(d?.cursor || '');
- })
- .catch(() => { /* keep prior list on error */ });
- };
- useEffect(() => {
- let alive = true;
- const tick = () => {
- const q = listQuery();
- if (!q) return;
- harnessFetch(`/api/harness/v1/traces?${q.toString()}`)
- .then((r) => (r.ok ? r.json() : Promise.reject(new Error(`traces ${r.status}`))))
- .then((d) => {
- if (!alive) return;
- if (Array.isArray(d?.sessions)) setCards(d.sessions);
- if (tailLenRef.current === 0) setCursor(d?.cursor || '');
- })
- .catch(() => { /* keep prior list */ });
- };
- tick(); const t = setInterval(tick, 6000); return () => { alive = false; clearInterval(t); };
- }, [harnessId]); // eslint-disable-line react-hooks/exhaustive-deps
- // Refresh-in-place when the parent signals a change (turn ran / session switched), no remount, no flash.
- const firstNonce = useRef(true);
- useEffect(() => {
- if (firstNonce.current) { firstNonce.current = false; return; }
- load();
- }, [refreshNonce]); // eslint-disable-line react-hooks/exhaustive-deps
-
- const confirmDelete = async () => {
- if (!delTarget) return;
- setDeleting(true);
- const sid = delTarget.session_id;
- try {
- await harnessFetch(`/api/harness/v1/traces/${encodeURIComponent(sid)}`, { method: 'DELETE' });
- } catch { /* surfaced via the list staying put */ }
- setCards((cs) => (cs || []).filter((c) => c.session_id !== sid));
- if (selected === sid) onNew(); // viewing the deleted one -> reset to a fresh task
- setDeleting(false); setDelTarget(null);
- load();
- };
-
- // Working = the bus says this session has a live turn (instant + accurate), OR its card status is
- // a running-ish state. The card's MANIFEST status is authoritative: once a session is terminal
- // (done/completed/failed/incomplete/…), it isn't "working" even if a stale _runningSids entry
- // lingers from a turn.started whose terminal bus event was missed.
- const _TERMINAL = new Set(['done', 'completed', 'failed', 'incomplete', 'max_turns', 'error', 'timeout', 'cancelled']);
- const isWorking = (sid: string, s?: string) =>
- !_TERMINAL.has((s || '').toLowerCase()) &&
- (_runningSids.has(sid) || s === 'running' || s === 'starting' || s === 'in_progress');
- // Design's .session-state chip: Working (green dot), Done (muted), Failed/Cancelled (amber).
- const stateChip = (sid: string, s?: string): { cls: string; label: string } => {
- if (isWorking(sid, s)) return { cls: '', label: 'Working' };
- const st = (s || '').toLowerCase();
- if (['failed', 'error', 'timeout'].includes(st)) return { cls: ' attention', label: 'Failed' };
- if (st === 'cancelled') return { cls: ' attention', label: 'Cancelled' };
- if (['incomplete', 'max_turns'].includes(st)) return { cls: ' attention', label: 'Incomplete' };
- return { cls: ' completed', label: 'Done' };
- };
- const updatedAt = (c: TraceCard) => (c.finished_at ? `Updated ${timeAgo(c.finished_at * 1000)}` : 'Updated just now');
- return (
- <div className="run-list">
- <div className="run-list-head">
- <span className="run-list-hint">Switch Harness</span>
- {harnessSelect}
- <button className="button primary run-list-new" type="button" onClick={onNew}>
- <iconify-icon icon="tabler:plus"></iconify-icon>New Task
- </button>
- <span className="list-scope">Tasks for <strong>{harnessName}</strong></span>
- <div className="run-filter-row" ref={fltRef}>
- <input className="search-input" type="search" placeholder="Filter tasks…" aria-label="Filter tasks"
- value={flt} onChange={(e) => setFlt(e.target.value)} />
- <button className={'run-flt-btn' + (stFlt !== 'all' ? ' active' : '')} type="button"
- title="Filter by status" aria-haspopup="menu" aria-expanded={fltOpen}
- onClick={() => setFltOpen((v) => !v)}>
- <iconify-icon icon="tabler:filter"></iconify-icon>
- </button>
- {fltOpen && (
- <div className="run-flt-menu" role="menu">
- {(['all', 'working', 'done', 'failed'] as const).map((k) => (
- <button key={k} role="menuitemradio" aria-checked={stFlt === k} type="button"
- className={'run-flt-item' + (stFlt === k ? ' on' : '')}
- onClick={() => { setStFlt(k); setFltOpen(false); }}>
- {k === 'all' ? 'All statuses' : k[0].toUpperCase() + k.slice(1)}
- {stFlt === k && <iconify-icon icon="tabler:check"></iconify-icon>}
- </button>
- ))}
- </div>
- )}
- </div>
- </div>
- <div className="run-list-scroll" onScroll={onListScroll}>
- {(() => { const pend = livePending(harnessId, merged); const shown = merged.filter((c) => !pend.some((p) => p.sid === c.session_id))
- .filter((c) => !flt.trim() || (c.title || c.session_id).toLowerCase().includes(flt.trim().toLowerCase()))
- .filter((c) => {
- if (stFlt === 'all') return true;
- const working = isWorking(c.session_id, c.status);
- if (stFlt === 'working') return working;
- const st = (c.status || '').toLowerCase();
- const failed = ['failed', 'error', 'timeout', 'cancelled'].includes(st);
- return stFlt === 'failed' ? failed : (!working && !failed);
- });
- return (<>
- {pend.map((p) => (
- <button key={p.tempId} className="run-item task-item" type="button" aria-pressed="false">
- <span className="run-item-top"><strong>{p.title}</strong><span className="session-state">Working</span></span>
- <span>Updated just now</span>
- </button>
- ))}
- {cards === null && pend.length === 0 && <SkelListItems rows={6} />}
- {cards && shown.length === 0 && pend.length === 0 && (
- <div className="session-empty">{merged.length === 0 ? 'No Tasks yet. Send a message to start.' : 'No Tasks match this filter.'}</div>
- )}
- {shown.map((c) => { const st = stateChip(c.session_id, c.status); return (
- <button key={c.session_id} type="button" aria-pressed={selected === c.session_id}
- className={'run-item task-item' + (selected === c.session_id ? ' active' : '')}
- onClick={() => onSelect(c.session_id)}>
- <span className="run-item-top">
- <strong>{c.title || c.session_id}</strong>
- <span className={'session-state' + st.cls}>{st.label}</span>
- <span className="run-item-del" role="button" tabIndex={0} title="Delete conversation"
- onClick={(e) => { e.stopPropagation(); setDelTarget(c); }}
- onKeyDown={(e) => { if (e.key === 'Enter') { e.stopPropagation(); setDelTarget(c); } }}><IcTrash /></span>
- </span>
- <span>{updatedAt(c)}</span>
- </button>
- ); })}
- {loadingMore && <SkelListItems rows={2} />}
- </>); })()}
- </div>
- {delTarget && (
- <div className="hr-modal-scrim" onClick={() => !deleting && setDelTarget(null)}>
- <div className="hr-auth-card" style={{ width: 380 }} onClick={(e) => e.stopPropagation()}>
- <h1 style={{ fontSize: 17 }}>Delete conversation</h1>
- <p className="sub">This permanently deletes <b>{delTarget.title || 'this conversation'}</b> and its workspace. This can&apos;t be undone.</p>
- <div className="hr-card-actions" style={{ marginTop: 18 }}>
- <button className="hr-btn" disabled={deleting} onClick={() => setDelTarget(null)}>Cancel</button>
- <button className="hr-btn danger" disabled={deleting} onClick={confirmDelete}>{deleting ? 'Deleting…' : 'Delete'}</button>
- </div>
- </div>
- </div>
- )}
- </div>
- );
-}
-
-interface ChatTarget { name: string; backend: string | null; model?: string; baseId?: string }
-interface UserMsg { role: 'user'; text: string; attachments?: { name: string; dataUri?: string }[] }
-interface ToolStep { name: string; args: string; result?: string; callId?: string }
-// An assistant turn is an ORDERED list of blocks appended as events arrive, so tool activity is
-// interleaved with prose in real time (not all tools hoisted to the top).
-type Block = { kind: 'text'; text: string } | { kind: 'tools'; reasoning: string; steps: ToolStep[] };
-interface AsstMsg { role: 'assistant'; blocks: Block[]; files: RespFile[]; status: 'running' | 'done' | 'failed' | 'cancelled' | 'incomplete';
- /** Why an incomplete turn is incomplete (max_steps | timeout | interrupted) — from the
- * gateway's incomplete_details. Absent on records from before the field existed. */
- incompleteReason?: string }
-// AGENTS.md / CLAUDE.md are harness-internal instruction files the runner seeds into the workspace
-// (they surface installed skills to the agent). They are never user-facing outputs, so they must
-// never render as output file cards, including on older sessions that captured them before the
-// gateway started excluding them.
-const _INTERNAL_OUT = new Set(['AGENTS.md', 'CLAUDE.md']);
-const isInternalOutput = (name?: string) =>
- !!name && (_INTERNAL_OUT.has(name) || name.startsWith('.harness/') || name.includes('/.harness/'));
-type Msg = UserMsg | AsstMsg;
-
-// The ordered-block state machine (withText/withReasoning/withStep/withResult/asstText) is
-// imported from UI Core, identical semantics to the original in-file implementation.
-
-// ── Per-conversation store (module-level, survives panel remount + tab switches) ────────────────
-// The Conversation component used to hold msgs/busy/stream in component-local state, so switching
-// conversations destroyed the optimistic user message AND the in-flight stream, that's why a
-// message "sent" to one conversation vanished when you came back, and why only the turn that had
-// already finished (reloadable from the server) ever showed. Hoisting this state here keeps every
-// conversation's messages + run status alive in the background; streams write to the store by key,
-// so switching is just a re-view and N concurrent turns all keep streaming.
-// The store mechanics live in UI Core (createConversationStore); these thin typed wrappers keep
-// every call site unchanged.
-type ConvState = { msgs: Msg[]; busy: boolean; prevId: string | null; firstTurn: boolean; loaded: boolean };
-const convStore = createConversationStore();
-function getConvState(key: string): ConvState { return convStore.get(key) as ConvState; }
-function setConvState(key: string, patch: Partial<ConvState> | ((s: ConvState) => Partial<ConvState>)): void {
- convStore.set(key, patch);
-}
-function useConvState(key: string): ConvState { return convStore.use(key) as ConvState; }
-
-// ── realtime broadcast bus → conv store ──────────────────────────────────────────────────────────
-// The gateway broadcasts every event of every session of a harness. We apply each event to the
-// conv store keyed by the REAL session id, so any conversation renders live regardless of which tab
-// (or none) started the turn, fixing "open a running session and see nothing until a hard refresh".
-/** Add a produced file to a turn, at most once.
- *
- * A turn is rendered by TWO paths — this tab's own POST stream and the broadcast bus that keeps
- * other tabs (and this one, after a transport drop) current. Suppression stops the bus while the
- * POST stream owns a session, but it is released when that stream ends, so a citation arriving in
- * the handover was applied by both and the file appeared twice until a reload.
- *
- * Rather than tighten the timing, applying a citation is idempotent: a file IS its
- * (container_id, file_id), so the same one landing twice is the same file, not a second one.
- * That holds however many renderers, replays or reconnects there are. */
-function withFile(files: RespFile[], f: RespFile): RespFile[] {
- const key = (x: RespFile) => `${x.container_id}:${x.file_id}` || x.filename;
- return files.some((x) => key(x) === key(f)) ? files : [...files, f];
-}
-
-// `_busSuppress` holds session ids whose turn THIS tab is already rendering via its own POST stream
-// (convKey === sid), so we don't double-apply deltas for those.
-const _busSuppress = new Set<string>();
-// Sessions with a turn currently in flight, maintained from the bus (authoritative, no trace-card
-// lag) so the Recents "working" dot is accurate the instant a turn starts/ends.
-const _runningSids = new Set<string>();
-const _busFn: Record<string, { name: string; callId: string }> = {};
-function busUpdateLast(sid: string, fn: (a: AsstMsg) => void) {
- setConvState(sid, (s) => {
- const out = s.msgs.slice();
- for (let i = out.length - 1; i >= 0; i--) {
- if (out[i].role === 'assistant') { const a = { ...(out[i] as AsstMsg) }; fn(a); out[i] = a; break; }
- }
- return { msgs: out };
- });
-}
-function applyBusEvent(sid: string, responseId: string, ev: Record<string, unknown>, replay = false) {
- if (!sid || _busSuppress.has(sid)) return; // initiating tab's POST stream owns this one
- // History catch-up frames are dropped: an in-flight turn's progress-so-far is loaded from the
- // authoritative durable trace via GET /v1/sessions/{sid}/turns (msgsFromTurns). Re-applying the
- // same events off the bus would double-render (append the same text/tools twice). The bus is the
- // live-FORWARD channel only; the trace snapshot + the reconcile poll own history + repair.
- if (replay) return;
- const t = ev.type as string;
- switch (t) {
- case 'harness.turn.started': {
- // Ignore a REPLAYED start of a turn we've already finished (its response_id is our last prevId):
- // a stale/duplicate start would otherwise append a phantom "Working…" turn that never completes.
- if (responseId && getConvState(sid).prevId === responseId) return;
- setConvState(sid, (s) => {
- const last = s.msgs[s.msgs.length - 1];
- if (last && last.role === 'assistant' && (last as AsstMsg).status === 'running') return {}; // already showing it
- const user = String((ev.user_text as string) || '');
- const add: Msg[] = [];
- if (user) add.push({ role: 'user', text: user });
- add.push({ role: 'assistant', blocks: [], files: [], status: 'running' });
- return { msgs: [...s.msgs, ...add], busy: true, loaded: true };
- });
- break;
- }
- case 'response.reasoning_summary_text.delta':
- busUpdateLast(sid, (a) => { a.blocks = withReasoning(a.blocks, ev.delta as string); }); break;
- case 'response.output_item.added': {
- const item = ev.item as Record<string, unknown>;
- if (item?.type === 'function_call') _busFn[`${sid}:${ev.output_index}`] = { name: item.name as string, callId: (item.call_id as string) || '' };
- else if (item?.type === 'function_call_output') busUpdateLast(sid, (a) => { a.blocks = withResult(a.blocks, (item.call_id as string) || '', String(item.output ?? '')); });
- break;
- }
- case 'response.function_call_arguments.done': {
- const fn = _busFn[`${sid}:${ev.output_index}`] || { name: 'tool', callId: '' };
- busUpdateLast(sid, (a) => { a.blocks = withStep(a.blocks, { name: fn.name, args: (ev.arguments as string) || '', callId: fn.callId }); }); break;
- }
- case 'response.output_text.delta':
- busUpdateLast(sid, (a) => { a.blocks = withText(a.blocks, ev.delta as string); }); break;
- case 'response.output_text.annotation.added': {
- const a = ev.annotation as Record<string, unknown>;
- if (a?.type === 'container_file_citation') busUpdateLast(sid, (m) => { m.files = withFile(m.files, { container_id: a.container_id as string, file_id: a.file_id as string, filename: a.filename as string }); });
- break;
- }
- case 'response.completed':
- busUpdateLast(sid, (a) => { a.status = 'done'; }); setConvState(sid, { busy: false, prevId: responseId, firstTurn: false }); break;
- case 'response.incomplete':
- busUpdateLast(sid, (a) => { a.status = 'incomplete'; }); setConvState(sid, { busy: false, prevId: responseId, firstTurn: false }); break;
- case 'response.failed': {
- // A user Stop arrives as response.failed with reason/status "cancelled", show it as
- // Cancelled, not Failed (the session card + turn record already say cancelled).
- const wasCancelled = ev.reason === 'cancelled'
- || (ev.response as Record<string, unknown> | undefined)?.status === 'cancelled';
- busUpdateLast(sid, (a) => { a.status = wasCancelled ? 'cancelled' : 'failed'; });
- setConvState(sid, { busy: false, prevId: responseId, firstTurn: false }); break;
- }
- case 'error':
- busUpdateLast(sid, (a) => { a.blocks = withText(a.blocks, '\n\nError: ' + ((ev.message as string) || 'stream error')); }); break;
- }
-}
-function useHarnessBus(harnessId: string, onActivity?: () => void) {
- useEffect(() => {
- if (!harnessId) return;
- const unsub = subscribeHarnessEvents(harnessId, (m) => {
- const t = (m.event as Record<string, unknown>)?.type as string;
- // track in-flight sessions (authoritative for the Recents dot) regardless of suppress/replay:
- // a replayed start still tells us the session is live (its terminal event clears it).
- if (t === 'harness.turn.started') _runningSids.add(m.session_id);
- else if (t === 'response.completed' || t === 'response.failed' || t === 'response.incomplete') _runningSids.delete(m.session_id);
- applyBusEvent(m.session_id, m.response_id, m.event || {}, Boolean(m.replay));
- if (t === 'harness.turn.started' || t === 'response.completed' || t === 'response.failed' || t === 'response.incomplete') onActivity?.();
- });
- return unsub;
- }, [harnessId]); // eslint-disable-line react-hooks/exhaustive-deps
-}
-
-function Conversation({ harnessId, sessionId, target, models, onModel, onRan, onSession, recentsOpen, onToggleRecents, showToggle = true, additionalHeaders }: {
- harnessId: string; sessionId: string | null; target: ChatTarget;
- models: string[]; onModel: (m: string) => void; onRan: () => void; onSession?: (sid: string) => void;
- recentsOpen: boolean; onToggleRecents: () => void; showToggle?: boolean; additionalHeaders?: string[];
-}) {
- // Additional Headers (app-level auth): per-harness VALUES for the declared header names, kept
- // client-side only (localStorage) and attached to every Playground call, the same pass-through
- // path an external caller uses, so the Playground exercises real app auth.
- const hdrKey = 'hr.hdrs.' + harnessId;
- const [hdrVals, setHdrVals] = useState<Record<string, string>>(() => {
- try { return JSON.parse(localStorage.getItem(hdrKey) || '{}'); } catch { return {}; }
- });
- const [hdrOpen, setHdrOpen] = useState(false);
- const declared = (additionalHeaders || []).filter(Boolean);
- const saveHdrVals = (vals: Record<string, string>) => {
- setHdrVals(vals);
- try { localStorage.setItem(hdrKey, JSON.stringify(vals)); } catch { /* private mode */ }
- };
- const extraHeaders = () => {
- const out: Record<string, string> = {};
- for (const n of declared) { const v = hdrVals[n]; if (v) out[n] = v; }
- return out;
- };
- // Conversation state lives in the module store (see ConvState) keyed by the session id, or a
- // stable per-mount id for a not-yet-saved new conversation, so it survives switching away/back.
- // Once the gateway allocates the real session id (onSession), a new conversation REBINDS to that
- // key: the local POST stream and the broadcast bus then write to the same entry, so prevId can't
- // split across keys (the split was one way a follow-up forked a brand-new session).
- const genId = useId();
- const [boundSid, setBoundSid] = useState<string | null>(null);
- const sidRef = useRef<string | null>(sessionId);
- // Workspace-file links inside agent replies resolve against the LIVE session id.
- const mdRenderer = useMemo(() => makeWbMarkdown(() => sessionId ?? sidRef.current, () => harnessId || null), [sessionId, harnessId]); // eslint-disable-line react-hooks/exhaustive-deps
- useEffect(() => { if (sessionId) sidRef.current = sessionId; }, [sessionId]);
- const convKey = sessionId ?? boundSid ?? `new-${genId}`;
- const convKeyRef = useRef(convKey);
- convKeyRef.current = convKey;
- const conv = useConvState(convKey);
- const msgs = conv.msgs;
- const setMsgs = (u: Msg[] | ((m: Msg[]) => Msg[])) =>
- setConvState(convKeyRef.current, (s) => ({ msgs: typeof u === 'function' ? (u as (m: Msg[]) => Msg[])(s.msgs) : u }));
- const [input, setInput] = useState('');
- const [copiedIdx, setCopiedIdx] = useState<number | null>(null);
- const taRef = useRef<HTMLTextAreaElement>(null); // shared Composer auto-grows it (15-row cap)
- const busy = conv.busy;
- const setBusy = (b: boolean) => setConvState(convKeyRef.current, { busy: b });
- const prevId = conv.prevId;
- const setPrevId = (id: string | null) => setConvState(convKeyRef.current, { prevId: id });
- const firstTurn = conv.firstTurn;
- const setFirstTurn = (b: boolean) => setConvState(convKeyRef.current, { firstTurn: b });
- const [loading, setLoading] = useState(false);
- const [files, setFiles] = useState<{ name: string; dataUri: string }[]>([]);
- const [preview, setPreview] = useState<{ url: string; name: string } | null>(null);
- // Stop is one-shot: disabled the moment it's clicked so a slow cancel can't be spammed.
- // Re-armed whenever the busy state settles (turn ended) or a new turn starts.
- const [stopping, setStopping] = useState(false);
- useEffect(() => { setStopping(false); }, [busy]);
- const [previewW, onPreviewResize] = useHResize(520, 340, 1100, true);
- const [atBottom, setAtBottom] = useState(true);
- const fileRef = useRef<HTMLInputElement>(null);
- const scrollRef = useRef<HTMLDivElement>(null);
- const jumpToBottom = () => requestAnimationFrame(() => requestAnimationFrame(() => {
- const el = scrollRef.current; if (el) el.scrollTop = el.scrollHeight;
- }));
- // Auto-stick to the newest message only when the user is already near the bottom.
- useEffect(() => { if (atBottom) jumpToBottom(); }, [msgs, atBottom]);
- const onScroll = () => {
- const el = scrollRef.current; if (!el) return;
- setAtBottom(el.scrollHeight - el.scrollTop - el.clientHeight < 60);
- };
- async function pickFiles(list: FileList | null) {
- if (!list) return;
- const out: { name: string; dataUri: string }[] = [];
- for (const f of Array.from(list)) {
- const b64: string = await new Promise((res) => {
- const r = new FileReader(); r.onload = () => res(String(r.result || '').split(',')[1] || ''); r.readAsDataURL(f);
- });
- out.push({ name: f.name, dataUri: `data:${f.type || 'application/octet-stream'};base64,${b64}` });
- }
- setFiles((p) => [...p, ...out]);
- }
- // Drag-and-drop attach: dropping files anywhere on the conversation adds them to the composer.
- // dragCount tracks nested enter/leave pairs (children fire their own events) so the highlight
- // doesn't flicker off while moving across the pane.
- const [dragOver, setDragOver] = useState(false);
- const dragCount = useRef(0);
- const canAttach = !!target.backend && !busy;
- const onDragEnter = (e: React.DragEvent) => {
- if (!canAttach || !Array.from(e.dataTransfer?.types || []).includes('Files')) return;
- e.preventDefault();
- dragCount.current += 1;
- setDragOver(true);
- };
- const onDragOver = (e: React.DragEvent) => {
- if (!canAttach || !Array.from(e.dataTransfer?.types || []).includes('Files')) return;
- e.preventDefault();
- e.dataTransfer.dropEffect = 'copy';
- };
- const onDragLeave = (e: React.DragEvent) => {
- if (!dragOver) return;
- e.preventDefault();
- dragCount.current = Math.max(0, dragCount.current - 1);
- if (dragCount.current === 0) setDragOver(false);
- };
- const onDrop = (e: React.DragEvent) => {
- if (!canAttach) return;
- e.preventDefault();
- dragCount.current = 0;
- setDragOver(false);
- if (e.dataTransfer?.files?.length) void pickFiles(e.dataTransfer.files);
- };
-
- // Load a session's chat history into the store, reconciling against the AUTHORITATIVE backend.
- // Opening a session always checks the real turn status: a session the backend reports terminal is
- // shown done with its content even if the store was left stuck at busy:true (e.g. a terminal bus
- // event was dropped on a full queue / reconnect race), which previously stranded it at "Working…"
- // until a hard refresh. A genuinely in-flight turn keeps its live placeholder for the bus to stream.
- useEffect(() => {
- const existing = getConvState(convKey);
- if (!sessionId) { if (!existing.loaded) setConvState(convKey, { loaded: true }); return; }
- // Already loaded, idle, and has content → trust it (no refetch on every open).
- if (existing.loaded && !existing.busy && existing.msgs.length) return;
- setLoading(true);
- loadSessionTurns(sessionId).then(({ turns, lastResponseId }) => {
- const { msgs: m, running } = msgsFromTurns(turns);
- const cur = getConvState(convKey);
- if (!running) {
- // Backend is terminal → authoritative. Show its content and clear any stale busy flag.
- setConvState(convKey, { msgs: m, prevId: lastResponseId, firstTurn: false, loaded: true, busy: false });
- } else if (!cur.msgs.length) {
- // In-flight with nothing local yet → load the turn's progress-so-far (the backend
- // reconstructs a running turn's partial output from its durable trace) and let the bus
- // stream new events on top. If the trace was still empty this is just the placeholder.
- setConvState(convKey, { msgs: m, prevId: lastResponseId, firstTurn: false, loaded: true, busy: true });
- } else {
- // In-flight and we already hold live msgs (switched away/back mid-turn) → keep them.
- setConvState(convKey, { loaded: true });
- }
- setLoading(false);
- }).catch(() => setLoading(false));
- }, [convKey, sessionId]);
-
- // RECONCILIATION: SSE (POST stream or bus) is best-effort delivery, a reconnect gap, a
- // replica switch, or a dropped terminal event must NEVER strand the conversation at
- // "Working…". While busy, poll the authoritative turn state; the moment the backend says
- // the turn is over, rebuild from /turns and settle. This is the load-bearing guarantee;
- // streaming is just the fast path on top of it.
- useEffect(() => {
- if (!busy) return;
- const sid = sessionId ?? sidRef.current;
- if (!sid) return;
- let stop = false;
- const iv = setInterval(async () => {
- if (stop) return;
- try {
- const { turns, lastResponseId } = await loadSessionTurns(sid);
- if (stop || !turns.length) return;
- const last = turns[turns.length - 1];
- if (!TERMINAL_TURN.has(String(last.status || ''))) return;
- const { msgs: m } = msgsFromTurns(turns);
- _busSuppress.delete(sid);
- setConvState(convKeyRef.current, { msgs: m, prevId: lastResponseId, firstTurn: false, loaded: true, busy: false });
- } catch { /* transient, next tick */ }
- }, 4000);
- return () => { stop = true; clearInterval(iv); };
- }, [busy, sessionId]); // eslint-disable-line react-hooks/exhaustive-deps
-
- const updateLast = (fn: (a: AsstMsg) => void) =>
- setMsgs((m) => { const out = m.slice(); for (let i = out.length - 1; i >= 0; i--) { if (out[i].role === 'assistant') { const a = { ...(out[i] as AsstMsg) }; fn(a); out[i] = a; break; } } return out; });
-
- async function send(textOverride?: string) {
- const text = (textOverride ?? input).trim();
- if ((!text && files.length === 0) || busy || !target.backend) return;
- const sent = files;
- // OpenAI Responses input: a string, or a user MESSAGE whose content is text + file parts.
- // (The gateway parses {role,content:[…]}, a bare content-part array reads as empty input.)
- const input_payload: string | unknown[] = sent.length
- ? [{ role: 'user', content: [
- ...(text ? [{ type: 'input_text', text }] : []),
- ...sent.map((f) => ({ type: 'input_file', filename: f.name, file_data: f.dataUri })),
- ] }]
- : text;
- setInput(''); setFiles([]); setBusy(true); setAtBottom(true);
- setMsgs((m) => [...m, { role: 'user', text, attachments: sent.map((f) => ({ name: f.name, dataUri: f.dataUri })) }, { role: 'assistant', blocks: [], files: [], status: 'running' }]);
- // NEW task (no session yet): surface it in Recents IMMEDIATELY via an optimistic entry, the
- // durable card takes seconds (session allocation + first trace write). onRan() re-renders the
- // panel now; the entry swaps for the real card as soon as the server list carries this session.
- const pendId = !sessionId ? addPendingCard(harnessId, (text || sent[0]?.name || 'New task').split('\n')[0].slice(0, 120)) : null;
- if (pendId) onRan();
- // This tab renders the turn via its own POST stream below; tell the broadcast bus to NOT also
- // apply deltas to this same session (convKey === sid) to avoid double-rendering. Other tabs /
- // other conversations still get it live from the bus.
- const knownSid = sessionId ?? sidRef.current;
- if (knownSid) _busSuppress.add(knownSid);
- try {
- const id = await streamResponse(
- // No `instructions`: the harness's configured Agent Instructions are written into the
- // workspace as AGENTS.md/CLAUDE.md (server-side, from the saved harness), so the model keeps
- // its default system prompt rather than having instructions prepended to the first message.
- // sessionHint: continuity fallback, the gateway continues this session even if prevId was
- // lost client-side (interrupted stream), instead of forking a new one.
- { input: input_payload, backend: target.backend, model: target.model || undefined, previousResponseId: prevId,
- sessionHint: knownSid, harnessId, harnessName: target.name, extraHeaders: extraHeaders() },
- { onCreated: (rid) => setPrevId(rid),
- onSession: (sid) => {
- if (pendId) setPendingSid(pendId, sid);
- // First turn of a new conversation: rebind the conv store to the real session id so all
- // future writes (this stream, the bus, follow-up turns) land on ONE key.
- if (!sessionId && !sidRef.current && sid) {
- convStore.seed(sid, { ...getConvState(convKeyRef.current) });
- _busSuppress.add(sid);
- sidRef.current = sid;
- setBoundSid(sid);
- }
- onSession?.(sid);
- },
- onReasoningDelta: (d) => updateLast((a) => { a.blocks = withReasoning(a.blocks, d); }),
- onToolCall: (name, args, callId) => updateLast((a) => { a.blocks = withStep(a.blocks, { name, args, callId }); }),
- onToolResult: (callId, output) => updateLast((a) => { a.blocks = withResult(a.blocks, callId, output); }),
- onTextDelta: (d) => updateLast((a) => { a.blocks = withText(a.blocks, d); }),
- onFile: (f) => updateLast((a) => { a.files = withFile(a.files, f); }),
- onError: (msg) => updateLast((a) => { a.blocks = withText(a.blocks, '\n\nError: ' + msg); }),
- onDone: (status) => updateLast((a) => {
- a.status = status === 'completed' ? 'done'
- : (['failed', 'cancelled', 'incomplete'].includes(status) ? status as AsstMsg['status'] : 'failed');
- }) },
- );
- if (id) setPrevId(id); setFirstTurn(false);
- } catch (e) {
- // A throw here is a TRANSPORT failure (the POST stream dropped), never an agent failure, which
- // arrives via onError + onDone('failed'). If the turn already reached a session it is STILL
- // running server-side (a gateway redeploy rolling the SSE, a network blip), so painting it
- // "failed" is a lie that strands the user. Leave it running and let the finally hand rendering
- // to the auto-reconnecting broadcast bus. Only a start failure (no session yet) is a real error.
- const sk = sessionId ?? sidRef.current;
- if (!sk) {
- if (pendId) dropPending(pendId);
- updateLast((a) => { a.blocks = withText(a.blocks, '\n\nError: ' + (e instanceof Error ? e.message : String(e))); a.status = 'failed'; });
- }
- } finally {
- const sk = sessionId ?? sidRef.current;
- // If the stream ended (returned or threw) but no terminal event set the assistant status, the
- // turn is still live server-side (transport drop OR a clean drain-close mid-turn). Hand it to the
- // broadcast bus, which auto-reconnects, by releasing suppression, and KEEP the working state so
- // the indicator stands until the bus (or the on-focus reconcile) lands the true terminal status.
- const ms = getConvState(convKeyRef.current).msgs;
- const lastA = ms[ms.length - 1];
- const stillRunning = !!lastA && lastA.role === 'assistant' && (lastA as AsstMsg).status === 'running';
- if (sk && stillRunning) {
- _busSuppress.delete(sk); // bus renders the remainder; keep busy=true (composer stays disabled)
- } else {
- if (sk) _busSuppress.delete(sk);
- setBusy(false);
- }
- onRan();
- }
- }
-
- return (
- <div className={'wbx-conv' + (preview ? ' split' : '')}
- onDragEnter={onDragEnter} onDragOver={onDragOver} onDragLeave={onDragLeave} onDrop={onDrop}>
- {dragOver && (
- <div className="wbx-droparea" aria-hidden="true">
- <div className="wbx-droparea-inner">
- <iconify-icon icon="tabler:file-upload"></iconify-icon>
- Drop files to attach
- </div>
- </div>
- )}
- <div className="wbx-conv-main">
- <div className="wbx-conv-bar">
- {showToggle && (
- <button className="wbx-panel-tgl" title={recentsOpen ? 'Hide task history' : 'Show task history'}
- aria-pressed={recentsOpen} onClick={onToggleRecents}><IcPanel /></button>
- )}
- <span className="wbx-conv-bar-title">{target.baseId ? <HarnessLogo id={target.baseId} size={18} /> : null}{target.name}</span>
- {declared.length > 0 && (
- <button className="wbx-hdr-gear" title="Header values for this preview"
- aria-haspopup="dialog" aria-expanded={hdrOpen}
- onClick={() => setHdrOpen(true)}>
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="3" /><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 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.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 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.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 1 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 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" /></svg>
- {declared.some((n) => !hdrVals[n]) && <span className="wbx-hdr-dot" title="Some header values are not set" />}
- </button>
- )}
- </div>
- {hdrOpen && (
- <div className="hr-modal-scrim" onClick={() => setHdrOpen(false)}>
- <div className="wbx-hdr-pop" role="dialog" aria-label="Preview header values" onClick={(e) => e.stopPropagation()}>
- <div className="wbx-hdr-pop-title">Preview header values</div>
- <div className="hr-meta" style={{ marginBottom: 10 }}>
- Sent with every call from this preview, like your product would. Stored only in this browser.
- </div>
- {declared.map((n) => (
- <label key={n} style={{ display: 'block', marginBottom: 8 }}>
- <div className="wb-label" style={{ marginBottom: 3 }}>{n}</div>
- <input className="wb-input" type="password" autoComplete="off" placeholder="value"
- value={hdrVals[n] || ''}
- onChange={(e) => setHdrVals({ ...hdrVals, [n]: e.target.value })} />
- </label>
- ))}
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8, marginTop: 12 }}>
- <button className="hr-btn" onClick={() => setHdrOpen(false)}>Cancel</button>
- <button className="hr-btn primary" onClick={() => { saveHdrVals(hdrVals); setHdrOpen(false); }}>Save</button>
- </div>
- </div>
- </div>
- )}
- <div className="wbx-conv-msgs" ref={scrollRef} onScroll={onScroll}>
- {loading && <div className="hr-empty" style={{ marginTop: 40 }}>Loading conversation…</div>}
- {!loading && msgs.length === 0 && <div className="hr-empty" style={{ marginTop: 60 }}>Send a message to run a turn on <b>{target.name}</b>.</div>}
- {/* Shared message list (UI Core): blocks render in stream order so tool activity
- interleaves with prose. HR-specific chrome rides the override slots. */}
- {!loading && (
- <ChatMessages
- messages={msgs}
- renderMarkdown={mdRenderer}
- // The default incomplete badge asserted "step or time limit" for EVERY incomplete —
- // including turns that hit neither (a deploy restart under a live turn settles as
- // incomplete). The badge now claims only what is true of all causes; the specific
- // cause, when the record carries one, renders per turn in the footer below.
- statusLabels={{
- failed: '✕ Failed — see the output above for the reason',
- cancelled: '◼ Stopped by you',
- incomplete: '◔ Stopped before finishing — Continue to resume',
- }}
- userExtras={(m: UserMsg) => (m.attachments && m.attachments.length > 0 ? (
- <div className="wbx-attach-row">
- {m.attachments.map((f, j) => <AttachCard key={j} name={f.name} dataUri={f.dataUri} />)}
- </div>
- ) : null)}
- assistantFooter={(m: AsstMsg, i: number) => (
- <>
- {m.status === 'incomplete' && m.incompleteReason && (
- <div className="wbx-incomplete-why">
- {m.incompleteReason === 'max_steps' ? 'It hit its step limit.'
- : m.incompleteReason === 'timeout' ? 'It hit its time limit.'
- : m.incompleteReason === 'interrupted'
- ? 'The turn was interrupted before it finished — for example by a server restart. No limit was hit.'
- : null}
- </div>
- )}
- {m.files.filter((f) => !isInternalOutput(f.filename)).length > 0 && (
- <div className="wbx-files">
- {m.files.filter((f) => !isInternalOutput(f.filename)).map((f, j) => (
- <div key={j} className="wbx-filecard" onClick={() => setPreview({ url: containerFileUrl(f), name: f.filename })}>
- <span className="wbx-filecard-ic"><FileTypeIcon name={f.filename} size={32} /></span>
- <span className="wbx-filecard-meta">
- <span className="wbx-filecard-name">{f.filename}</span>
- <span className="wbx-filecard-sub">{(f.filename.split('.').pop() || 'file').toUpperCase()} · output</span>
- </span>
- {/* Authed download (LIVE-B): a bare href carries no session and is rejected. */}
- <button className="wbx-filecard-dl" title="Download" type="button"
- onClick={(e) => { e.stopPropagation(); downloadFile(containerFileUrl(f), f.filename).catch(() => undefined); }}><IcDl /></button>
- <span className="wbx-filecard-open">Preview</span>
- </div>
- ))}
- {/* One-click zip of THIS turn's outputs (folder hierarchy preserved inside the
- archive). Only worth a row when there's more than one file. */}
- {(() => {
- const outs = m.files.filter((f) => !isInternalOutput(f.filename));
- if (outs.length < 2) return null;
- const zipUrl = `/api/harness/v1/sessions/${encodeURIComponent(outs[0].container_id)}` +
- `/files/archive?files=${encodeURIComponent(outs.map((f) => f.file_id).join(','))}`;
- return (
- <button className="wbx-zipall" type="button"
- onClick={(e) => { e.stopPropagation(); downloadFile(zipUrl, 'outputs.zip').catch(() => undefined); }}>
- <IcDl /> Download all ({outs.length}) as .zip
- </button>
- );
- })()}
- </div>
- )}
- {m.status !== 'running' && asstText(m) && (
- <div className="wbx-actrow">
- <button className="wbx-act-ic" title={copiedIdx === i ? 'Copied' : 'Copy'}
- onClick={async () => {
- try { await navigator.clipboard.writeText(asstText(m)); setCopiedIdx(i); setTimeout(() => setCopiedIdx((x) => (x === i ? null : x)), 1400); } catch { /* blocked */ }
- }}>{copiedIdx === i ? <iconify-icon icon="tabler:check"></iconify-icon> : <iconify-icon icon="tabler:copy"></iconify-icon>}</button>
- {i === msgs.length - 1 && !busy && (
- <>
- {/* Continue = one more turn on the SAME session (prevId threads automatically). */}
- <button className="wbx-act-ic" title="Continue"
- onClick={() => void send('Continue where you left off and finish the remaining work.')}><iconify-icon icon="tabler:arrow-forward"></iconify-icon></button>
- {/* Revise = put the prior prompt back in the composer for editing; sending it
- continues this session rather than forking a new one. */}
- <button className="wbx-act-ic" title="Revise"
- onClick={() => {
- const lu = [...msgs].reverse().find((x) => x.role === 'user');
- if (lu && 'text' in lu && lu.text) { setInput(lu.text); taRef.current?.focus(); }
- }}><iconify-icon icon="tabler:pencil"></iconify-icon></button>
- </>
- )}
- </div>
- )}
- </>
- )}
- />
- )}
- </div>
-
- {!atBottom && (
- <button className="wbx-jump" title="Jump to latest" onClick={() => { setAtBottom(true); jumpToBottom(); }}>
- <Chevron dir="down" size={18} />
- </button>
- )}
-
- {/* Shared composer (UI Core): Enter sends, auto-grows to 15 rows; HR chrome via slots. */}
- <Composer
- value={input}
- onChange={setInput}
- onSend={() => send()}
- disabled={!target.backend || busy}
- placeholder={target.backend ? 'Write a message…' : 'This harness is coming soon'}
- inputRef={taRef}
- attachments={files.length > 0 ? (
- <div className="wbx-attach-row in-composer">
- {files.map((f, j) => (
- <AttachCard key={j} name={f.name} dataUri={f.dataUri} onRemove={() => setFiles((p) => p.filter((_, k) => k !== j))} />
- ))}
- </div>
- ) : null}
- accessoriesLeft={(
- <>
- <input ref={fileRef} type="file" multiple hidden onChange={(e) => { pickFiles(e.target.files); e.target.value = ''; }} />
- <button className="wbx-comp-ic" title="Attach file" disabled={!target.backend || busy} onClick={() => fileRef.current?.click()}><IcPlus /></button>
- {models.length > 0 && (
- <div className="wbx-select-wrap mini">
- <select className="wbx-select mini" value={target.model || ''} onChange={(e) => onModel(e.target.value)}>
- {models.map((m) => (
- <option key={m} value={m} disabled={!modelAvailable(target.backend, m)}>
- {m}{modelAvailable(target.backend, m) ? '' : ' — no provider'}
- </option>
- ))}
- </select>
- <span className="wbx-select-chev"><Chevron dir="down" size={13} /></span>
- </div>
- )}
- </>
- )}
- renderSend={() => (busy && (sessionId ?? sidRef.current) ? (
- // A running turn can't Send anyway, the slot becomes Stop (square icon).
- <button className="hr-btn primary wbx-send wbx-send-stop" title="Stop this turn" disabled={stopping}
- onClick={() => {
- const sid = sessionId ?? sidRef.current;
- if (!sid || stopping) return;
- setStopping(true);
- // Settle from the server's verdict too, the bus event alone can be missed
- // (dropped SSE, reconnect race), which used to leave Stop looking like a no-op.
- void cancelSession(sid).then((r) => {
- const terminal = ['cancelled', 'failed', 'error', 'done', 'completed', 'incomplete', 'max_turns', 'timeout'];
- if (r.cancelled || terminal.includes(r.status)) {
- updateLast((a) => { a.status = 'cancelled'; });
- setBusy(false);
- } else {
- setStopping(false); // cancel didn't land, let the user retry
- }
- }).catch(() => setStopping(false));
- }}>
- <iconify-icon icon="tabler:player-stop-filled"></iconify-icon>
- {stopping ? 'Stopping…' : 'Stop'}
- </button>
- ) : (
- <button className="hr-btn primary wbx-send" onClick={() => send()} disabled={!target.backend || busy || (!input.trim() && files.length === 0)}>Send</button>
- ))}
- />
- </div>
- {preview && <>
- <div className="wbx-vresize" onMouseDown={onPreviewResize} title="Drag to resize" />
- <div className="wbx-preview-pane" style={{ width: previewW, flex: '0 0 auto' }}>
- <FilePreview file={preview} onClose={() => setPreview(null)} />
- </div>
- </>}
- </div>
- );
-}
-
-// ── Trace tab: the ORIGINAL Traces component (TracesMain) scoped to the selected Task, the
-// session list is unnecessary here because the task list on the left already selects the session.
-function TraceView({ sid }: { sid: string | null }) {
- useEffect(() => {
- traceStore.select(sid || null);
- return () => { traceStore.select(null); };
- }, [sid]);
- if (!sid) {
- return (
- <div className="run-trace-embed"><div className="session-empty">Run the task first, its trace appears here.</div></div>
- );
- }
- return (
- <div className="run-trace-embed">
- <TracesMain />
- </div>
- );
-}
-export default function WorkbenchPage() {
- return <Suspense fallback={<SkelPage />}><Workbench /></Suspense>;
-}
diff --git a/ui/src/app/error.tsx b/ui/src/app/error.tsx
new file mode 100644
index 00000000..612676c2
--- /dev/null
+++ b/ui/src/app/error.tsx
@@ -0,0 +1,33 @@
+'use client';
+// The route-level error boundary. Its one job beyond showing a plain message: a tab loaded
+// before a deploy asks for the previous build's chunks on its next navigation; when one is gone
+// the router throws a ChunkLoadError. That tab is not broken, it is stale, so reload it once
+// (guarded so a genuinely missing chunk cannot loop) instead of showing a dead page.
+import { useEffect } from 'react';
+
+const isStaleChunk = (e: Error) => /ChunkLoadError|Loading chunk|Failed to fetch dynamically imported module/i.test(`${e?.name} ${e?.message}`);
+
+export default function RouteError({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
+ useEffect(() => {
+ if (!isStaleChunk(error)) return;
+ try {
+ const key = 'hr:reloaded-for-chunk';
+ if (sessionStorage.getItem(key) !== '1') { sessionStorage.setItem(key, '1'); window.location.reload(); return; }
+ } catch { /* storage blocked: fall through to the button */ }
+ }, [error]);
+ return (
+ <div style={{ minHeight: '60vh', display: 'grid', placeItems: 'center', padding: 24, textAlign: 'center' }}>
+ <div style={{ maxWidth: 420 }}>
+ <div style={{ fontSize: 16, fontWeight: 600, marginBottom: 8 }}>{isStaleChunk(error) ? 'This page is out of date' : 'Something went wrong'}</div>
+ <div style={{ fontSize: 13.5, color: '#6b6560', lineHeight: 1.6, marginBottom: 16 }}>
+ {isStaleChunk(error) ? 'A newer version is available. Reload to pick it up.' : 'Reloading usually clears it. If it keeps happening, tell us what you were doing.'}
+ </div>
+ <button type="button" onClick={() => { try { sessionStorage.removeItem('hr:reloaded-for-chunk'); } catch { /* ignore */ } window.location.reload(); }}
+ style={{ font: 'inherit', fontSize: 13, fontWeight: 500, padding: '8px 14px', border: '1px solid #e0dcd9', borderRadius: 8, background: '#fff', color: '#57534e', cursor: 'pointer' }}>
+ Reload
+ </button>
+ {!isStaleChunk(error) && <button type="button" onClick={reset} style={{ marginLeft: 8, font: 'inherit', fontSize: 13, fontWeight: 500, padding: '8px 14px', border: 0, borderRadius: 8, background: '#1a5cf5', color: '#fff', cursor: 'pointer' }}>Try again</button>}
+ </div>
+ </div>
+ );
+}
diff --git a/ui/src/app/hr-billing.css b/ui/src/app/hr-billing.css
index aa655a70..7701ce1f 100644
--- a/ui/src/app/hr-billing.css
+++ b/ui/src/app/hr-billing.css
@@ -2,15 +2,14 @@
.hrb-content { display: flex; flex-direction: column; gap: 20px; max-width: 960px; margin: 0 auto; padding: 28px 24px 40px; }
.hrb-notice { padding: 10px 14px; border: 1px solid var(--brand-soft); background: var(--brand-50); color: var(--brand-ink); border-radius: 10px; font-size: 13px; }
-.hrb-label { font-size: 13px; color: var(--mute, #5B5D66); margin-bottom: 6px; }
.hrb-balance { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px; gap: 16px; }
.hrb-balance-value { font-size: 36px; font-weight: 680; color: var(--ink); line-height: 1.1; }
-.hrb-balance-low { border-color: #E3B341; background: #FFFBEB; }
+.hrb-balance-low { border-color: #E3B341; background: #fdf9f4; }
.hrb-balance-deficit { border-color: #DA1E28; background: #FFF1F2; }
.hrb-alert { margin-top: 10px; font-size: 13px; border-radius: 8px; padding: 8px 12px; }
-.hrb-alert-low { background: #FEF3C7; color: #92400E; }
-.hrb-alert-deficit { background: #FEE2E2; color: #991B1B; }
+.hrb-alert-low { background: #fdf9f4; color: #8a6a3c; }
+.hrb-alert-deficit { background: #fdf9f4; color: #8a3a10; }
/* ── Subscription plans: three vertical pricing cards ─────────────────────────── */
.hrb-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
@@ -33,8 +32,8 @@
.hrb-plan-sub-state { margin-top: auto; display: flex; align-items: center; gap: 6px;
padding: 8px 0 2px; font-size: 12.5px; font-weight: 600; color: #0E8C6A; }
.hrb-plan-sub-state iconify-icon { font-size: 15px; flex: 0 0 auto; }
-.hrb-plan-cancel { margin-top: 8px; color: #B91C1C; border-color: #FECACA; }
-.hrb-plan-cancel:hover { background: #FEF2F2; border-color: #FCA5A5; }
+.hrb-plan-cancel { margin-top: 8px; color: #b4460f; border-color: #f0e2d4; }
+.hrb-plan-cancel:hover { background: #fdf9f4; border-color: #FCA5A5; }
.hrb-plan.current .hrb-plan-cta.hrb-plan-cancel { margin-top: 8px; }
.hrb-plan.current .hrb-plan-feats + .hrb-plan-sub-state { margin-top: auto; }
.hrb-plan-name { font-size: 12px; font-weight: 700; text-transform: uppercase;
@@ -58,43 +57,25 @@
.hrb-table-card { padding: 8px 0 12px; }
.hrb-table-scroll { overflow-x: auto; }
.hrb-table { width: 100%; min-width: 700px; border-collapse: collapse; font-size: 13px; }
-.hrb-table th { text-align: left; padding: 10px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--mute, #5B5D66); font-weight: 600; }
+.hrb-table th { text-align: left; padding: 10px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--mute, #6b6560); font-weight: 600; }
.hrb-table td { padding: 10px 16px; color: var(--ink); }
.hrb-table tbody tr:hover { background: var(--brand-50); }
-.hrb-table-empty { text-align: center; color: var(--mute, #5B5D66); padding: 28px 0 !important; }
-.hrb-row-overdraft td { color: #991B1B; }
+.hrb-table-empty { text-align: center; color: var(--mute, #6b6560); padding: 28px 0 !important; }
+.hrb-row-overdraft td { color: #8a3a10; }
.hrb-link { color: var(--brand-ink); text-decoration: none; }
.hrb-link:hover { text-decoration: underline; }
.hrb-pager { display: flex; gap: 6px; padding: 12px 16px 4px; align-items: center; }
.hrb-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.hrb-pill-ok { background: #E7F6EC; color: #1F7A3D; }
-.hrb-pill-mute { background: #EDEEF2; color: #5B5D66; }
-.hrb-pill-warn { background: #FEF3C7; color: #92400E; }
-.hrb-pill-danger { background: #FEE2E2; color: #991B1B; }
+.hrb-pill-mute { background: #EDEEF2; color: #6b6560; }
+.hrb-pill-warn { background: #fdf9f4; color: #8a6a3c; }
+.hrb-pill-danger { background: #fdf9f4; color: #8a3a10; }
-.hrb-range { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
-.hrb-range-custom { display: inline-flex; align-items: center; gap: 6px; }
-.hrb-range-custom .hr-input { width: 150px; }
-.hrb-range-sep { color: var(--mute, #5B5D66); font-size: 12px; }
-.hrb-spent { max-width: 260px; padding: 16px 20px; }
-.hrb-spent-value { font-size: 28px; font-weight: 650; color: var(--ink); }
-.hrb-chart-card { padding: 16px 20px 12px; }
-.hrb-section-title { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 12px; }
-.hrb-chart { height: 280px; }
-.hrb-chart-empty { height: 120px; display: flex; align-items: center; justify-content: center; color: var(--mute, #5B5D66); font-size: 13px; }
-.hrb-pricing-card { padding: 16px 20px; }
-.hrb-pricing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
-.hrb-price { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
-.hrb-price-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
-.hrb-price-label { font-size: 13px; font-weight: 600; color: var(--ink); }
-.hrb-price-value { font-size: 12px; color: var(--mute, #5B5D66); margin-top: 2px; }
.hrb-skeleton { background: var(--brand-50); border-radius: 8px; animation: hrbPulse 1.4s ease-in-out infinite; }
.hrb-skeleton-balance { width: 140px; height: 36px; }
.hrb-skeleton-card { height: 130px; border: 1px solid var(--line); border-radius: 12px; }
-.hrb-skeleton-spent { width: 90px; height: 28px; }
-.hrb-skeleton-chart { height: 280px; }
@keyframes hrbPulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.hr-input { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-input, 8px); font-size: 13px; background: var(--surface); color: var(--ink); }
.hr-input:focus { outline: none; border-color: var(--brand); }
diff --git a/ui/src/app/hr.css b/ui/src/app/hr.css
index 0204d6ab..fa720a6b 100644
--- a/ui/src/app/hr.css
+++ b/ui/src/app/hr.css
@@ -1,4 +1,4 @@
-/* HarnessRouter app chrome — built on AgentStudio tokens (deep iris --brand #42309C). */
+/* HarnessRouter app chrome — built on AgentStudio tokens (deep iris --brand #1a5cf5). */
/* UI Core token mapping — the shared conversational surface (frontend-ui-core/styles/chat.css,
the wbx-* chat rules extracted from this file) reads --uic-*; map them onto HR's palette so
@@ -58,8 +58,8 @@ a { color: inherit; text-decoration: none; }
.hr-btn.primary { background: var(--brand); color: #fff; border-color: var(--brand);
box-shadow: 0 10px 22px -6px rgba(40,90,255,.40); }
.hr-btn.primary:hover:not(:disabled) { background: var(--brand-ink); box-shadow: 0 12px 26px -6px rgba(40,90,255,.48); }
-.hr-btn.danger { color: #B91C1C; border-color: #FECACA; }
-.hr-btn.danger:hover:not(:disabled) { background: #FEF2F2; color: #B91C1C; border-color: #FCA5A5; }
+.hr-btn.danger { color: #b4460f; border-color: #f0e2d4; }
+.hr-btn.danger:hover:not(:disabled) { background: #fdf9f4; color: #b4460f; border-color: #FCA5A5; }
.hr-btn.ghost { border-color: transparent; background: transparent; }
/* Disabled state: every .hr-btn (Send while generating, Save when not dirty, etc.) must LOOK
disabled, not just be inert. Dim + not-allowed cursor + no hover. */
@@ -111,7 +111,7 @@ a { color: inherit; text-decoration: none; }
.hr-field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.hr-field input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
.hr-field input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
-.hr-err { color: #B91C1C; font-size: 13px; margin: 8px 0; }
+.hr-err { color: #b4460f; font-size: 13px; margin: 8px 0; }
.hr-gwrap { display: flex; justify-content: center; margin: 4px 0 2px; min-height: 44px; }
.hr-gbtn { display: flex; justify-content: center; }
.hr-or { display: flex; align-items: center; gap: 12px; color: var(--mute); font-size: 12px; margin: 14px 0; }
@@ -220,7 +220,7 @@ a { color: inherit; text-decoration: none; }
border: none; background: transparent; color: var(--sidebar-mute); border-radius: 6px; cursor: pointer;
opacity: 0; transition: opacity .12s, background .12s, color .12s; }
.wbx-recent:hover .wbx-recent-del { opacity: 1; }
-.wbx-recent-del:hover { background: color-mix(in srgb, #DC2626 12%, transparent); color: #DC2626; }
+.wbx-recent-del:hover { background: color-mix(in srgb, #b4460f 12%, transparent); color: #b4460f; }
/* conversation */
.wbx-conv { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; min-height: 0; }
@@ -280,7 +280,7 @@ a { color: inherit; text-decoration: none; }
.wbx-iconbtn { font-size: 12px; color: var(--sidebar-mute); background: transparent; border: none; cursor: pointer;
display: inline-flex; align-items: center; gap: 5px; padding: 2px 4px; border-radius: 6px; }
.wbx-iconbtn:hover { color: var(--ink); background: var(--brand-50); }
-.wbx-act-fail { font-size: 12px; color: #dc2626; font-weight: 600; }
+.wbx-act-fail { font-size: 12px; color: #b4460f; font-weight: 600; }
/* "new harness" add card: a single large, vertically-centered + (no label) */
.hr-add { min-height: 168px; display: grid; place-items: center; }
@@ -314,8 +314,8 @@ a { color: inherit; text-decoration: none; }
.apidoc-ep { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 14px 0; background: var(--surface); }
.apidoc-ep-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.apidoc-m { font-size: 11px; font-weight: 800; letter-spacing: .04em; color: #fff; border-radius: 6px; padding: 3px 8px; }
-.apidoc-m-post { background: #16a34a; } .apidoc-m-get { background: #2563eb; }
-.apidoc-m-delete { background: #dc2626; } .apidoc-m-put { background: #d97706; }
+.apidoc-m-post { background: #15803d; } .apidoc-m-get { background: #1a5cf5; }
+.apidoc-m-delete { background: #b4460f; } .apidoc-m-put { background: #d97706; }
.apidoc-path { font-size: 13.5px; font-weight: 700; background: none; border: none; padding: 0; color: var(--ink); }
.apidoc-tbl { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 13px; }
.apidoc-tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
@@ -323,7 +323,7 @@ a { color: inherit; text-decoration: none; }
.apidoc-tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.apidoc-tbl tr:last-child td { border-bottom: none; }
.apidoc-ty { color: var(--sidebar-mute); font-family: ui-monospace, monospace; font-size: 12px; }
-.apidoc-req { font-size: 11px; font-weight: 700; color: #b91c1c; }
+.apidoc-req { font-size: 11px; font-weight: 700; color: #b4460f; }
.apidoc-opt { font-size: 11px; color: var(--sidebar-mute); }
/* ════════ Cowork-faithful chat polish ════════ */
@@ -358,7 +358,7 @@ a { color: inherit; text-decoration: none; }
.wbx-act-txt { height: 28px; padding: 0 10px; border-radius: 7px; font-size: 12px; font-weight: 600;
color: var(--sidebar-mute); background: transparent; border: none; cursor: pointer; font-family: inherit; }
.wbx-act-txt:hover { background: var(--brand-50); color: var(--ink); }
-.wbx-act-fail { font-size: 12px; color: #dc2626; font-weight: 600; margin-left: 8px; }
+.wbx-act-fail { font-size: 12px; color: #b4460f; font-weight: 600; margin-left: 8px; }
/* output file cards (under the answer) */
.wbx-files { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-width: 560px; }
@@ -515,13 +515,6 @@ a { color: inherit; text-decoration: none; }
padding: 8px; pointer-events: none;
background: linear-gradient(to bottom, var(--surface) 60%, color-mix(in srgb, var(--surface) 40%, transparent)); }
.wbx-conv-bar > * { pointer-events: auto; }
-.wbx-conv-bar-title { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 13.5px; font-weight: 600;
- display: inline-flex; align-items: center; gap: 7px;
- color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
-.wbx-panel-tgl { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
- border: none; background: transparent; color: var(--sidebar-mute); border-radius: 9px; cursor: pointer; transition: background .12s, color .12s; }
-.wbx-panel-tgl:hover { background: var(--brand-50); color: var(--brand); }
-.wbx-panel-tgl[aria-pressed="true"] { color: var(--brand); }
/* messages clear the floating bar */
.wbx-conv-msgs { padding-top: 50px; }
@@ -536,8 +529,8 @@ a { color: inherit; text-decoration: none; }
/* quiet status: a small colored dot + neutral ink text (not a wall of green) */
.mcp-test-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.mcp-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
-.mcp-test-status.ok .mcp-dot { background: #16a34a; }
-.mcp-test-status.err { color: #b91c1c; } .mcp-test-status.err .mcp-dot { background: #dc2626; }
+.mcp-test-status.ok .mcp-dot { background: #15803d; }
+.mcp-test-status.err { color: #b4460f; } .mcp-test-status.err .mcp-dot { background: #b4460f; }
/* tools as a scrollable list of cards */
.mcp-tools { margin-top: 10px; max-height: 240px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.mcp-tool-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
@@ -690,7 +683,7 @@ body.hr-resizing iframe { pointer-events: none; }
.mcp-authkind { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600;
padding: 2px 8px; border-radius: 999px; margin-left: 8px; white-space: nowrap;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
-.mcp-authkind.hdr { color: #1d4ed8; background: #eff6ff; border: 1px solid #bfdbfe; }
+.mcp-authkind.hdr { color: #1447c4; background: #eff6ff; border: 1px solid #bfdbfe; }
/* MCP modal: one-click insert chips for declared Additional Headers */
.mcp-hdr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
diff --git a/ui/src/app/layout.tsx b/ui/src/app/layout.tsx
index 0f2a6313..8d9063da 100644
--- a/ui/src/app/layout.tsx
+++ b/ui/src/app/layout.tsx
@@ -1,5 +1,5 @@
import type { Metadata } from 'next';
-import { IBM_Plex_Sans, IBM_Plex_Mono, Schibsted_Grotesk } from 'next/font/google';
+import { IBM_Plex_Sans, IBM_Plex_Mono, Schibsted_Grotesk, Inter, JetBrains_Mono } from 'next/font/google';
// Unified with the HarnessRouter marketing landing: paper theme + accent blue (#285AFF)
// and IBM Plex Sans/Mono with a Schibsted Grotesk display face for the wordmark.
@@ -11,10 +11,15 @@ import '@/studio/styles/traces.css';
import 'reifyui/styles/chat.css';
import './hr.css';
import './hr-billing.css';
+// v2 re-skin: MUST load last — its :root remaps every legacy token (fonts, inks, accent) so
+// un-migrated pages inherit the v2 look without edits. See harness_router_v2_design/CLAUDE.md.
+import './v2.css';
const sans = IBM_Plex_Sans({ variable: '--font-ibm-sans', subsets: ['latin'], weight: ['400', '500', '600', '700'] });
const mono = IBM_Plex_Mono({ variable: '--font-ibm-mono', subsets: ['latin'], weight: ['400', '500', '600'] });
const display = Schibsted_Grotesk({ variable: '--font-grotesk', subsets: ['latin'], weight: 'variable' });
+const inter = Inter({ variable: '--font-inter', subsets: ['latin'], weight: ['400', '500', '600', '700'] });
+const jbmono = JetBrains_Mono({ variable: '--font-jbmono', subsets: ['latin'], weight: ['400', '500', '600'] });
const SITE = 'https://app.harnessrouter.ai';
// Self-hosted bills nothing and indexes nothing — a private box must not describe itself in
@@ -42,7 +47,7 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
- <html lang="en" className={`${sans.variable} ${mono.variable} ${display.variable}`}>
+ <html lang="en" className={`${sans.variable} ${mono.variable} ${display.variable} ${inter.variable} ${jbmono.variable}`}>
<body>{children}</body>
</html>
);
diff --git a/ui/src/app/page.tsx b/ui/src/app/page.tsx
index 3d2fdccf..9da9a856 100644
--- a/ui/src/app/page.tsx
+++ b/ui/src/app/page.tsx
@@ -13,7 +13,7 @@ export default function Root() {
useEffect(() => {
// Self-hosted has no sign-in and no workbench surface — harnesses is the front door.
if (SELF_HOSTED) { router.replace('/harnesses'); return; }
- router.replace(isAuthed() ? '/workbench' : '/login');
+ router.replace(isAuthed() ? '/harnesses' : '/login');
}, [router]);
return null;
}
diff --git a/ui/src/app/reset/page.tsx b/ui/src/app/reset/page.tsx
index 90dd97f0..7c987b2f 100644
--- a/ui/src/app/reset/page.tsx
+++ b/ui/src/app/reset/page.tsx
@@ -17,7 +17,7 @@ function ResetInner() {
async function enter(orgId: string) {
await switchOrg(orgId);
- window.location.assign('/workbench');
+ window.location.assign('/harnesses');
}
async function afterAuth(s: Session) {
const orgs = hrSubscribed(s.orgs);
diff --git a/ui/src/app/revamp.css b/ui/src/app/revamp.css
index 99ead854..1e577aef 100644
--- a/ui/src/app/revamp.css
+++ b/ui/src/app/revamp.css
@@ -4,25 +4,28 @@
the marker at the end. */
:root {
- --bg: #fbfbfc;
+ --bg: #fafaf9; /* v2 stone (was cool #fbfbfc) */
--surface: #fff;
- --surface-subtle: #f7f7f9;
- --surface-active: #eef3ff;
- --ink: #17171a;
- --muted: #6f6f78;
- --faint: #9696a0;
- --line: #e7e7eb;
- --line-strong: #d8d8df;
- --accent: #285aff;
- --accent-hover: #1641d8;
- --accent-soft: #eef3ff;
+ --surface-subtle: #f5f5f4;
+ --surface-active: #f7f8fe;
+ --ink: #1c1917;
+ --muted: #6b6560;
+ /* #9696a0 measured about 2.9:1 on white, well under the 4.5:1 that small text needs, so
+ every label drawn in it failed contrast. Darkened to clear AA on white and on the grey
+ panels both. */
+ --faint: #6e6760; /* warm; kept darker than the design's #a8a29e caption so small text stays AA (see note above) */
+ --line: #e7e5e4;
+ --line-strong: #d6d3d1;
+ --accent: #1a5cf5;
+ --accent-hover: #1447c4;
+ --accent-soft: #f7f8fe;
--teal: #0f766e;
- --green: #16824b;
- --green-soft: #ebf8f0;
- --amber: #9a6500;
- --amber-soft: #fff7df;
- --red: #b4232d;
- --red-soft: #fff0f1;
+ --green: #15803d;
+ --green-soft: #eaf5ee;
+ --amber: #8a6a3c;
+ --amber-soft: #fdf9f4;
+ --red: #b4460f; /* the design's failure orange; status set is green/blue/orange */
+ --red-soft: #fdf9f4;
--header-h: 64px;
--sidebar-w: 224px;
--radius: 10px;
@@ -249,7 +252,7 @@
border: 0;
border-radius: 7px;
background: transparent;
- color: #55555f;
+ color: #57534e;
cursor: pointer;
font-size: 13.5px;
text-align: left;
@@ -304,7 +307,7 @@
gap: 9px;
padding: 0 9px;
border-radius: 7px;
- color: #55555f;
+ color: #57534e;
text-decoration: none;
font-size: 13px;
}
@@ -389,7 +392,7 @@
td { padding: 15px 14px; border-top: 1px solid var(--line); color: #4b4b54; vertical-align: middle; }
td strong { color: var(--ink); font-weight: 650; }
.object-row { cursor: pointer; }
- .object-row:hover { background: #f7f9ff; }
+ .object-row:hover { background: #f7f8fe; }
.object-row:focus-visible { position: relative; outline: 2px solid rgba(40,90,255,.35); outline-offset: -2px; }
.object-row .row-disclosure { width: 42px; color: var(--faint); text-align: right; }
.object-row:hover .row-disclosure { color: var(--accent); }
@@ -448,8 +451,8 @@
.kpi-card { position: relative; min-height: 112px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: inherit; font: inherit; text-align: left; }
.kpi-card.actionable { cursor: pointer; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.kpi-card.actionable:hover { border-color: #cbd8ff; box-shadow: 0 5px 16px rgba(40,90,255,.08); transform: translateY(-1px); }
- .kpi-card.primary-tint { background: #f7f9ff; }
- .kpi-card.green { background: #f7fcf9; }
+ .kpi-card.primary-tint { background: #f7f8fe; }
+ .kpi-card.green { background: #eaf5ee; }
.kpi-card.blue { background: #f8fbfd; }
.kpi-card span, .kpi-card small { display: block; color: var(--muted); font-size: 11.5px; }
.kpi-card strong { display: block; margin: 8px 0 6px; font-size: 24px; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
@@ -576,50 +579,34 @@
.mono-id:hover { background: var(--accent-soft); border-color: rgba(40,90,255,.28); color: var(--accent); }
.mono-id:focus-visible { outline: 2px solid rgba(40,90,255,.35); outline-offset: 1px; }
.mono-id.is-empty { color: var(--faint); background: none; border: none; padding: 0; cursor: default; }
- .mono-id-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+ .mono-id-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono-id-icon { flex: none; font-size: 13px; opacity: .7; }
.mono-id:hover .mono-id-icon { opacity: 1; }
/* In the inventory table the id cell is width-bounded so long chrn_ ids ellipsize, not wrap. */
#view-harnesses .mono-id { max-width: 190px; }
.run-layout { display: grid; grid-template-columns: 330px minmax(0,1fr); height: calc(100vh - 204px); min-height: 500px; max-height: 760px; border: 1px solid var(--line); border-radius: 9px; background: #fff; overflow: hidden; }
- .run-list { overflow-y: auto; }
- .run-list { border-right: 1px solid var(--line); }
- .run-list-head { padding: 14px; border-bottom: 1px solid var(--line); }
- .run-list-head .search-input { width: 100%; }
- .run-list-head .filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
- .run-list-head .select { width: 100%; min-width: 0; }
- .run-list-head > .select { margin-top: 8px; }
.list-scope { display: block; margin-top: 11px; color: var(--muted); font-size: 10.5px; }
.task-mode-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-subtle); }
.task-mode-button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font: 620 11.5px/1 var(--font); }
.task-mode-button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(28,28,35,.1); }
.task-mode-button[data-task-mode="test"][aria-selected="true"] { color: var(--accent); }
- .task-mode-context { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; gap: 10px; align-items: center; margin-bottom: 12px; padding: 11px 13px; border: 1px solid #dcefe4; border-radius: 8px; background: #f7fcf9; }
+ .task-mode-context { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; gap: 10px; align-items: center; margin-bottom: 12px; padding: 11px 13px; border: 1px solid #dcefe4; border-radius: 8px; background: #eaf5ee; }
.task-mode-context > iconify-icon { color: var(--green); font-size: 19px; }
.task-mode-context strong, .task-mode-context span { display: block; }
.task-mode-context strong { font-size: 11.5px; }
.task-mode-context span { margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.4; }
- .task-mode-context.test { border-color: #cbd8ff; background: #f7f9ff; }
+ .task-mode-context.test { border-color: #cbd8ff; background: #f7f8fe; }
.task-mode-context.test > iconify-icon { color: var(--accent); }
.mode-badge { justify-self: end; padding: 5px 8px; border-radius: 999px; background: #e7f5ec; color: #25633e !important; font-size: 10px !important; font-weight: 680; }
.task-mode-context.test .mode-badge { background: var(--accent-soft); color: var(--accent-hover) !important; }
- .run-item { width: 100%; display: block; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; }
- .run-item:hover, .run-item.active { background: #f7f9ff; }
- .run-item.active { box-shadow: inset 3px 0 var(--accent); }
- .run-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
- .run-item strong { display: block; font-size: 13px; }
- .run-item span { display: block; margin-top: 5px; color: var(--muted); font-size: 11.5px; }
- .run-item .session-state { display: inline-flex; flex: 0 0 auto; align-items: center; margin: 0; color: var(--muted); font-size: 10.5px; font-weight: 650; }
- .run-item .session-state::before { width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: currentColor; content: ""; }
- .run-item .session-state.completed { color: var(--green); }
- .run-item .session-state.working { color: var(--accent); }
- .run-item .session-state.attention { color: var(--red); }
+ /* The row's click target, stretched behind its content so the delete button stays on top. */
+ .run-item-hit { position: absolute; inset: 0; width: 100%; margin: 0; padding: 0; border: 0;
+ background: transparent; cursor: pointer; }
.session-empty { padding: 24px 16px; color: var(--muted); font-size: 12px; text-align: center; }
- .run-row.is-selected td { background: #f7f9ff; }
+ .run-row.is-selected td { background: #f7f8fe; }
.run-detail { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.run-detail h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.session-detail-head, .inspector-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
- .session-detail-head .button { flex: 0 0 auto; }
.run-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 9px; color: var(--muted); font-size: 11.5px; }
.run-meta .meta-label { color: var(--faint); }
.result-box { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
@@ -654,9 +641,9 @@
.activity-disclosure { width: 100%; display: flex; align-items: center; gap: 8px; margin: 12px 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #4b4b54; cursor: pointer; text-align: left; font-size: 11.5px; font-weight: 650; }
.activity-disclosure iconify-icon:last-child { margin-left: auto; transition: transform .16s ease; }
.activity-disclosure[aria-expanded="true"] iconify-icon:last-child { transform: rotate(180deg); }
- .activity-detail { display: grid; gap: 7px; margin: -4px 0 12px; padding: 11px 12px; border-left: 2px solid #bfd0ff; background: #f7f9ff; color: var(--muted); font-size: 11px; }
+ .activity-detail { display: grid; gap: 7px; margin: -4px 0 12px; padding: 11px 12px; border-left: 2px solid #bfd0ff; background: #f7f8fe; color: var(--muted); font-size: 11px; }
.activity-detail span { display: flex; align-items: center; gap: 8px; }
- .task-state { display: flex; align-items: center; gap: 7px; margin-top: 13px; padding: 9px 11px; border: 1px solid #dcefe4; border-radius: 8px; background: #f7fcf9; color: #276640; font-size: 11.5px; font-weight: 650; }
+ .task-state { display: flex; align-items: center; gap: 7px; margin-top: 13px; padding: 9px 11px; border: 1px solid #dcefe4; border-radius: 8px; background: #eaf5ee; color: #276640; font-size: 11.5px; font-weight: 650; }
.task-feedback { display: flex; gap: 4px; margin-left: 2px; }
.task-feedback .icon-button { width: 34px; height: 34px; }
.composer { margin-top: auto; padding: 12px 22px 20px; border-top: 0; background: #fff; }
@@ -723,7 +710,7 @@
.billing-plan-line strong, .billing-plan-line span { display: block; }
.billing-plan-line strong { font-size: 14px; }
.billing-plan-line span { margin-top: 4px; color: var(--muted); font-size: 12px; }
- .billing-balance-panel { display: grid; grid-template-columns: minmax(220px,1.35fr) repeat(2,minmax(150px,.72fr)) auto; align-items: center; gap: 28px; margin-bottom: 30px; padding: 22px 24px; border-radius: 12px; background: #f4f6fa; }
+ .billing-balance-panel { display: grid; grid-template-columns: minmax(220px,1.35fr) repeat(2,minmax(150px,.72fr)) auto; align-items: center; gap: 28px; margin-bottom: 30px; padding: 22px 24px; border-radius: 12px; background: #fafaf9; }
.billing-balance-primary span, .billing-balance-stat span { display: block; color: var(--muted); font-size: 11.5px; }
.billing-balance-primary strong { display: block; margin: 6px 0 4px; font-size: 25px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.billing-balance-primary small, .billing-balance-stat small { color: var(--muted); font-size: 11.5px; }
@@ -742,34 +729,21 @@
.form-section h3 { margin: 0; font-size: 14px; }
.form-section > div:first-child p { margin: 6px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.field-stack { display: grid; gap: 16px; }
- .field label { display: block; margin-bottom: 6px; color: #55555f; font-size: 12px; font-weight: 650; }
+ .field label { display: block; margin-bottom: 6px; color: #57534e; font-size: 12px; font-weight: 650; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.field input, .field select { min-height: 40px; padding: 0 11px; }
.field textarea { min-height: 112px; padding: 10px 11px; resize: vertical; line-height: 1.5; }
- .field input[readonly], .field textarea[readonly] { background: var(--surface-subtle); color: #55555f; }
+ .field input[readonly], .field textarea[readonly] { background: var(--surface-subtle); color: #57534e; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.inline-value { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle); font-size: 12.5px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-subtle); color: #4d4d57; font-size: 11.5px; }
.section-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-actions strong { font-size: 12px; }
- .capability-list { display: grid; gap: 8px; container-type: inline-size; }
+ .capability-list { display: grid; gap: 8px; }
.capability-row { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 10px; align-items: center; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
- /* The row sits in a column narrower than the viewport — at 768 the settings form still spends
- 210px on its label, leaving the row about 270px — so the viewport is the wrong thing to ask.
- Ask the row's own container, and put the actions under the copy before three buttons crush
- what a tool says about itself into one word per line. */
- @container (max-width: 420px) {
- .capability-row { grid-template-columns: 30px minmax(0,1fr); }
- .capability-actions { grid-column: 2; justify-content: flex-start; }
- }
.capability-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-subtle); color: var(--muted); }
.capability-copy strong, .capability-copy span { display: block; }
- /* A server's name and its endpoint are both single unbreakable tokens, and the second one is
- long. Without this they spill out of the row rather than wrapping inside it, which is what
- a narrow column does to any url. Break anywhere: a wrapped url is readable, a clipped one
- is not, and truncating would hide the very thing this line exists to show. */
- .capability-copy strong, .capability-copy span { overflow-wrap: anywhere; }
.capability-copy strong { font-size: 12.5px; }
.capability-copy span { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.capability-actions { display: flex; align-items: center; gap: 6px; }
@@ -781,14 +755,6 @@
.header-row .icon-button { margin-bottom: 1px; }
.settings-form-footer { position: sticky; bottom: 0; z-index: 2; display: flex; justify-content: flex-end; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); background: rgba(251,251,252,.94); backdrop-filter: blur(8px); }
.save-state { color: var(--muted); font-size: 11.5px; }
- .quickstart { max-width: 860px; }
- .quickstart-steps { margin-top: 10px; border-top: 1px solid var(--line); }
- .quickstart-step { display: grid; grid-template-columns: 32px 180px minmax(0,1fr); gap: 14px; padding: 22px 0; border-bottom: 1px solid var(--line); }
- .step-number { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
- .quickstart-step h2 { margin: 3px 0 0; font-size: 14px; }
- .quickstart-copy > p { max-width: 600px; margin: 1px 0 14px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
- .agent-preview { margin: 0 0 14px; padding: 14px 16px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle); color: #3d3d47; font: 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; }
- .quickstart-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.modal-backdrop {
position: fixed;
inset: 0;
@@ -814,9 +780,6 @@
.modal-close { flex: 0 0 auto; }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
- .key-reveal { padding: 13px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-subtle); }
- .key-reveal code { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: 14px; }
- .key-reveal span { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.copy-state { color: var(--green); font-size: 11.5px; }
.optional-label { color: var(--muted); font-weight: 500; }
.security-note { display: flex; align-items: flex-start; gap: 9px; max-width: 620px; margin: 14px 0 0; color: #6c4a0a; font-size: 11.5px; line-height: 1.5; }
@@ -866,53 +829,6 @@
#view-quickstart .quickstart-steps,
#view-settings .form-section,
#view-billing .settings-list { border-color: var(--line); }
- #view-api-keys .page { max-width: 1120px; }
- #view-api-keys .page-header { margin-bottom: 22px; }
- .api-key-toolbar {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 18px;
- margin-bottom: 12px;
- }
- .api-key-search { position: relative; width: min(320px, 100%); }
- .api-key-search iconify-icon {
- position: absolute;
- top: 50%;
- left: 12px;
- transform: translateY(-50%);
- color: var(--muted);
- font-size: 17px;
- pointer-events: none;
- }
- .api-key-search .search-input { width: 100%; padding-left: 37px; }
- .api-key-toolbar-meta { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 11.5px; }
- .api-key-security { display: inline-flex; align-items: center; gap: 7px; }
- .api-key-security iconify-icon { color: #696973; font-size: 16px; }
- #view-api-keys .table-wrap { overflow: visible; border: 0; }
- #view-api-keys thead { background: #f6f6f8; }
- #view-api-keys th { border: 0; color: #65656e; }
- #view-api-keys td { border-top: 0; border-bottom: 1px solid var(--line); }
- #view-api-keys tbody tr:last-child td { border-bottom: 0; }
- #view-api-keys tbody tr:hover { background: #fafbfe; }
- #view-api-keys code { color: #555560; font-size: 12px; }
- .api-key-empty { padding: 30px 14px; color: var(--muted); text-align: center; }
- .api-key-menu-wrap { position: relative; display: flex; justify-content: flex-end; }
- .api-key-menu {
- position: absolute;
- z-index: 8;
- top: 34px;
- right: 0;
- width: 142px;
- padding: 5px;
- border: 1px solid var(--line);
- border-radius: 8px;
- background: #fff;
- box-shadow: 0 10px 28px rgba(20,20,30,.12);
- }
- .api-key-menu button { width: 100%; padding: 8px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; font: inherit; font-size: 12px; }
- .api-key-menu button:hover { background: var(--surface-subtle); }
- .api-key-menu .danger { color: var(--red); }
#view-billing .settings-row { grid-template-columns: 32px minmax(0,1fr) auto; }
/* Intent-led component grammar. Keep boundaries only where they explain
@@ -937,7 +853,7 @@
#view-dashboard .table-wrap,
#view-harnesses .table-wrap { border: 0; }
#view-dashboard thead,
- #view-harnesses thead { background: #f6f6f8; }
+ #view-harnesses thead { background: #f5f5f4; }
#view-dashboard th,
#view-harnesses th { border: 0; color: #65656e; }
#view-dashboard td,
@@ -962,12 +878,11 @@
}
.filter-chip:hover { color: var(--ink); }
.filter-chip[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,20,30,.09); }
- .object-count { color: var(--muted); font-size: 11.5px; }
/* Cross-page grammar: collection views stay flat, supervision uses contained
metrics, and mutation is isolated in explicit configuration or test modes. */
.collection-view .table-wrap { overflow-x: auto; border: 0; }
- .collection-view thead { background: #f6f6f8; }
+ .collection-view thead { background: #f5f5f4; }
.collection-view th { border: 0; color: #65656e; }
.collection-view td { border-top: 0; border-bottom: 1px solid var(--line); }
.collection-view tbody tr:last-child td { border-bottom: 0; }
@@ -985,7 +900,7 @@
background: #e5e9f2;
content: "";
}
- #view-quickstart .agent-preview { border: 0; background: #f3f4f7; }
+ #view-quickstart .agent-preview { border: 0; background: #f5f5f4; }
#view-harness .capability-list {
gap: 0;
@@ -1004,68 +919,15 @@
}
#view-harness .capability-row:last-child { border-bottom: 0; }
#view-harness .capability-icon { background: rgba(255,255,255,.72); }
- #view-harness .inline-value { border: 0; background: #f3f4f7; }
-
- #view-tasks .task-mode-context { border: 0; }
- #view-tasks .page-header {
- display: grid;
- grid-template-columns: minmax(0,1fr) max-content;
- align-items: start;
- column-gap: 28px;
- }
- #view-tasks .page-header > div:first-child { min-width: 0; }
- #view-tasks .page-header .header-actions {
- display: grid;
- grid-template-columns: max-content 220px max-content;
- align-items: center;
- gap: 8px;
- }
- #view-tasks .task-mode-switch,
- #view-tasks .task-mode-button,
- #view-tasks #newTestTask { white-space: nowrap; }
- #view-tasks #taskHarness { width: 220px; min-width: 0; }
- #view-tasks .run-layout {
- border: 0;
- gap: 18px;
- border-radius: 0;
- background: transparent;
- box-shadow: none;
- overflow: visible;
- }
- #view-tasks .run-list {
- border-right: 0;
- border-radius: 12px;
- background: #f4f5f7;
- scrollbar-width: thin;
- }
- #view-tasks .run-list-head { padding: 14px 14px 10px; border-bottom: 0; background: transparent; }
- #view-tasks .run-item {
- width: calc(100% - 16px);
- margin: 4px 8px;
- padding: 13px 12px;
- border: 0;
- border-radius: 9px;
- background: transparent;
- }
- #view-tasks .run-item:hover { background: rgba(255,255,255,.68); }
- #view-tasks .run-item.active { background: #fff; box-shadow: 0 1px 4px rgba(20,20,30,.08); }
- #view-tasks .run-detail {
- border-radius: 12px;
- background: #fff;
- box-shadow: 0 1px 2px rgba(20,20,30,.04), 0 10px 30px rgba(20,20,30,.035);
- }
- #view-tasks .tabs { border-bottom-color: rgba(111,111,125,.12); }
- #view-tasks .activity-disclosure { border: 0; background: #f4f5f7; }
- #view-tasks .task-state { border: 0; }
- #view-tasks .file-row { padding: 12px; border: 0; border-radius: 9px; background: #f7f8fa; }
+ #view-harness .inline-value { border: 0; background: #f5f5f4; }
#view-analytics .dashboard-card .table-wrap { border: 0; }
- #view-analytics .dashboard-card thead { background: #f6f6f8; }
+ #view-analytics .dashboard-card thead { background: #f5f5f4; }
#view-analytics .dashboard-card th { border: 0; }
#view-analytics .dashboard-card td { border-top: 0; border-bottom: 1px solid var(--line); }
#view-analytics .dashboard-card tbody tr:last-child td { border-bottom: 0; }
#view-monetization .dashboard-card .table-wrap { border: 0; }
- #view-monetization .dashboard-card thead { background: #f6f6f8; }
+ #view-monetization .dashboard-card thead { background: #f5f5f4; }
#view-monetization .dashboard-card th { border: 0; }
#view-monetization .dashboard-card td { border-top: 0; border-bottom: 1px solid var(--line); }
#view-monetization .dashboard-card tbody tr:last-child td { border-bottom: 0; }
@@ -1100,7 +962,7 @@
margin: 4px 0 28px;
padding: 4px;
border-radius: 10px;
- background: #f4f6fa;
+ background: #fafaf9;
}
.connection-summary > div { min-height: 92px; padding: 16px; }
.connection-summary span,
@@ -1115,11 +977,11 @@
.monetization-activity { margin-top: 20px; }
.table-subcopy { color: var(--muted); font-size: 10.5px; }
.number.negative { color: var(--danger); }
- .payout-guidance { display: flex; align-items: flex-start; gap: 10px; max-width: 920px; margin: 2px 0 14px; padding: 12px 14px; border-radius: 9px; background: #f4f6fa; }
+ .payout-guidance { display: flex; align-items: flex-start; gap: 10px; max-width: 920px; margin: 2px 0 14px; padding: 12px 14px; border-radius: 9px; background: #fafaf9; }
.payout-guidance iconify-icon { flex: 0 0 auto; margin-top: 2px; color: var(--accent); font-size: 17px; }
.payout-guidance p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.payout-guidance strong { color: var(--text); }
- .product-modal-summary { margin: 2px 0 16px; padding: 12px 13px; border-radius: 8px; background: #f4f6fa; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
+ .product-modal-summary { margin: 2px 0 16px; padding: 12px 13px; border-radius: 8px; background: #fafaf9; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
#monetization-overview.is-active { display: grid; gap: 20px; }
#monetization-overview > .dashboard-card-head,
#monetization-overview > .dashboard-kpis,
@@ -1136,8 +998,6 @@
.pulse-list span iconify-icon { font-size: 18px; }
.pulse-list strong { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pulse-list strong small { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
-
- .harness-inventory-table { min-width: 980px; }
.harness-runtime { display: grid; gap: 3px; }
.harness-runtime span { color: var(--muted); font-size: 11.5px; }
.detail-metrics {
@@ -1148,7 +1008,7 @@
padding: 4px;
border: 0;
border-radius: 10px;
- background: #f4f6fa;
+ background: #fafaf9;
}
.detail-metric {
display: grid;
@@ -1215,41 +1075,7 @@
.harness-sheet .modal-body { padding: 14px 20px 16px; }
.harness-sheet .field-stack { gap: 13px; }
.harness-sheet .modal-actions { position: sticky; bottom: -16px; margin: 12px -2px 0; padding: 10px 2px 0; background: #fff; }
- .base-choice-list { display: grid; gap: 8px; margin-top: 8px; }
- .field .base-choice {
- position: relative;
- display: grid;
- grid-template-columns: 36px minmax(0,1fr) auto;
- gap: 12px;
- align-items: center;
- min-height: 60px;
- padding: 8px 12px;
- border: 1px solid var(--line);
- border-radius: 9px;
- cursor: pointer;
- }
- .field .base-choice:hover { background: var(--surface-subtle); }
- .field .base-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
- /* the checked card state (accent border + soft fill) IS the selection indicator */
- .base-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
- .base-choice-icon { width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); }
- .base-choice-copy strong, .base-choice-copy span { display: block; }
- .base-choice-copy strong { font-size: 13.5px; }
- .base-choice-copy span { margin-top: 4px; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
- .base-choice-models { color: var(--muted); font-size: 11px; white-space: nowrap; }
- .base-choice.disabled { cursor: default; opacity: .55; }
- .base-choice.disabled:hover { background: transparent; }
.soon-label { padding: 3px 6px; border-radius: 5px; background: var(--surface-subtle); font-size: 10px; font-weight: 650; }
- .creation-next { display: flex; gap: 9px; margin-top: 10px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
- .creation-next iconify-icon { flex: 0 0 auto; margin-top: 1px; color: var(--accent); }
- .harness-sheet .base-choice-list { gap: 0; padding: 4px; border-radius: 10px; background: #f3f4f7; }
- .harness-sheet .field .base-choice { border: 0; border-radius: 7px; }
- .harness-sheet .field .base-choice:has(input:checked) { border-color: transparent; background: #fff; box-shadow: 0 1px 4px rgba(20,20,30,.10); }
-
- @media (max-width: 1180px) {
- #view-tasks .page-header { grid-template-columns: 1fr; row-gap: 18px; }
- #view-tasks .page-header .header-actions { justify-content: start; }
- }
@media (max-width: 980px) {
:root { --sidebar-w: 204px; }
@@ -1261,8 +1087,6 @@
.run-layout { grid-template-columns: 280px minmax(0,1fr); }
.run-detail { min-width: 0; }
.task-actions { justify-content: flex-start; }
- .quickstart-step { grid-template-columns: 32px minmax(0,1fr); }
- .quickstart-copy { grid-column: 2; }
.summary-value { min-width: 0; text-align: left; }
.dashboard-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
.detail-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
@@ -1288,7 +1112,6 @@
main { margin-left: 0; }
.page { padding: 24px 16px 50px; }
.page-header { align-items: stretch; flex-direction: column; }
- #view-tasks .page-header .header-actions { width: 100%; }
.settings-form-head { align-items: stretch; flex-direction: column; }
.settings-form-head .header-actions { justify-content: space-between; }
.page-header .button.primary { align-self: flex-start; }
@@ -1298,14 +1121,10 @@
.pulse-list > div:last-child { border-bottom: 0; }
.toolbar-group { flex-wrap: wrap; }
.search-input { width: 100%; }
- .api-key-toolbar { align-items: stretch; flex-direction: column; }
- .api-key-search { width: 100%; }
- .api-key-toolbar-meta { justify-content: space-between; }
.run-layout { grid-template-columns: 1fr; }
.run-layout { height: auto; max-height: none; }
.task-mode-context { grid-template-columns: 24px minmax(0,1fr); }
.mode-badge { grid-column: 2; justify-self: start; }
- .run-list { border-right: 0; }
.run-detail { min-height: 420px; }
.run-summary-grid { grid-template-columns: repeat(2,1fr); }
.run-summary-stat:nth-child(2) { border-right: 0; }
@@ -1330,8 +1149,6 @@
.money-flow { grid-template-columns: 1fr; gap: 8px; }
.money-flow > iconify-icon { transform: rotate(90deg); }
.detail-metrics { grid-template-columns: 1fr; }
- .harness-inventory-table { min-width: 0; }
- .harness-inventory-table .harness-desktop-col { display: none; }
.readiness-strip { grid-template-columns: 1fr; }
.readiness-item + .readiness-item { border-top: 1px solid var(--line); border-left: 0; }
.collection-tools { width: 100%; align-items: stretch; flex-direction: column; }
@@ -1357,9 +1174,6 @@
#view-workspace .dashboard-lower-grid > section:nth-child(2) .dashboard-table :is(th,td):nth-child(3) { width: 92px; }
}
@media (max-width: 460px) {
- #view-tasks .page-header .header-actions { grid-template-columns: 1fr; }
- #view-tasks .task-mode-switch { width: max-content; }
- #view-tasks #taskHarness { width: 100%; }
.global-search input { padding-right: 12px; }
.search-key { display: none; }
.page-header h1, .detail-title h1 { font-size: 25px; }
@@ -1372,6 +1186,8 @@
.run-detail { padding: 0; }
.task-detail-shell, .conversation { padding-left: 16px; padding-right: 16px; }
.composer { padding-left: 16px; padding-right: 16px; }
+ .capability-row { grid-template-columns: 30px minmax(0,1fr); }
+ .capability-actions { grid-column: 2; justify-content: flex-start; }
.header-row { grid-template-columns: 1fr; }
.session-detail-head, .inspector-head { align-items: stretch; flex-direction: column; }
.run-inspector { padding: 18px 16px; }
@@ -1387,14 +1203,7 @@
.connection-summary { grid-template-columns: 1fr; }
.billing-page .section-header { align-items: flex-start; flex-direction: column; gap: 4px; }
.billing-page .button.small { min-height: 44px; }
- #view-api-keys th:nth-child(3), #view-api-keys td:nth-child(3),
- #view-api-keys th:nth-child(4), #view-api-keys td:nth-child(4) { display: none; }
- #view-api-keys th, #view-api-keys td { padding-left: 8px; padding-right: 8px; }
- #view-api-keys th:first-child, #view-api-keys td:first-child { width: 34%; }
- #view-api-keys code { font-size: 10px; white-space: nowrap; }
.chart-wrap { height: 220px; }
- .field .base-choice { grid-template-columns: 30px minmax(0,1fr); }
- .base-choice-models { grid-column: 3; white-space: normal; }
.readiness-item { grid-template-columns: 30px minmax(0,1fr); }
.readiness-item .button, .readiness-item .row-action { grid-column: 2; justify-self: start; }
}
@@ -1415,12 +1224,6 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
same arithmetic as the prototype. Bottom page padding lets short screens scroll to it whole. */
/* Tasks has NO title row (finalized design): full-width page, card fills the viewport. */
.tasks-page { max-width: none; padding: 20px 24px 24px; }
-.tasks-page .run-layout { height: calc(100vh - 108px); max-height: none; }
-.run-list-hint { display: block; margin-bottom: 5px; color: var(--faint); font-size: 10.5px;
- font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
-.run-list-new { width: 100%; justify-content: center; margin-top: 10px; }
-.run-list-head .select { width: 100%; min-width: 0; }
-.run-list-head .search-input { margin-top: 10px; }
/* Tightened title-to-content rhythm (user: prototype reads tighter than our render). */
.page { padding-top: 24px; }
.page-header { margin-bottom: 18px; }
@@ -1438,16 +1241,10 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.run-detail-fill { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.run-detail-fill > .wbx-conv, .run-detail-fill .wbx-conv { height: 100%; }
.run-trace-scroll { flex: 1; min-height: 0; overflow-y: auto; }
-/* Prototype CSS bug fix: `.run-item span` (display:block) outweighs `.run-item-top`
- (display:flex) by specificity, stacking the title and status chip. The design intent is
- one row with the chip right-aligned — enforce it with a stronger selector. */
-.run-item .run-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 0; }
/* Row delete affordance: hidden until the row is hovered, like the old recents list. */
-.run-item-del { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
- flex: 0 0 auto; border-radius: 6px; color: var(--faint); opacity: 0; cursor: pointer; }
-.run-item:hover .run-item-del, .run-item-del:focus { opacity: 1; }
-.run-item-del:hover { background: color-mix(in srgb, #DC2626 12%, transparent); color: #DC2626; }
-.run-item-top strong { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.run-item-del { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center;
+ width: 22px; height: 22px; flex: 0 0 auto; padding: 0; border: 0; background: transparent;
+ border-radius: 6px; color: var(--faint); opacity: 0; cursor: pointer; }
/* Narrow screens: list and detail alternate as full-width views (state class from the page). */
@media (max-width: 820px) {
.tasks-page .run-layout { grid-template-columns: 1fr; height: calc(100vh - 120px); min-height: 420px; }
@@ -1460,17 +1257,6 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.danger; give the standalone button an equivalent treatment. */
.button.danger { border-color: #f3c6c6; background: #fff5f5; color: #b4232d; }
.button.danger:hover { background: #fdeaea; }
-
-/* ── Tasks detail head: toggle beside the session title; one-line ellipsis title ── */
-.session-detail-lead { min-width: 0; flex: 1; }
-.session-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
-.session-title-row .wbx-panel-tgl { flex: 0 0 auto; }
-.run-credits-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
- padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line);
- background: var(--surface-subtle, #f7f9ff); color: var(--muted); font-size: 12px; font-weight: 600;
- white-space: nowrap; }
-.run-credits-chip iconify-icon { font-size: 13px; color: var(--accent, #285aff); }
-.session-title-ellip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Trace tab embeds the ORIGINAL Traces component (no session list — the task list selects). */
.run-trace-embed { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.run-trace-embed > * { flex: 1; min-width: 0; }
@@ -1482,11 +1268,6 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.skl-title-edit { display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.skl-name-input { min-width: 220px; border: 1px solid var(--line); border-radius: 7px;
padding: 5px 9px; font-size: 13px; font-weight: 600; font-family: inherit; }
-
-/* ── Task-list status filter: funnel icon beside the search bar with a dropdown menu ── */
-.run-list-head .list-scope { margin: 10px 0 0; }
-.run-filter-row { position: relative; display: flex; align-items: center; gap: 8px; margin-top: 8px; }
-.run-filter-row .search-input { flex: 1; min-width: 0; margin-top: 0; }
.run-flt-btn { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center;
border: 1px solid var(--line-strong, #d5d5dc); border-radius: 9px; background: #fff;
color: var(--muted); cursor: pointer; font-size: 17px; }
@@ -1500,16 +1281,6 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
color: var(--ink); cursor: pointer; font-size: 13px; text-align: left; }
.run-flt-item:hover { background: #f4f4f7; }
.run-flt-item.on { color: var(--accent); font-weight: 640; }
-
-/* ── Task-list head hierarchy: both hints share one label style; clearer rhythm ── */
-.run-list-head { padding: 16px 14px 14px; }
-.run-list-head .list-scope,
-.run-list-hint { display: block; margin: 0 0 6px; color: var(--faint); font-size: 10.5px;
- font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
-.run-list-head .list-scope { margin: 16px 0 6px; }
-.run-list-head .list-scope strong { color: var(--muted); font-weight: 740; }
-.run-list-new { margin-top: 10px; }
-.run-filter-row { margin-top: 0; }
/* Trace embed: the task name already sits in the detail head — hide the inner duplicate. */
.run-trace-embed .tr-mtitle { display: none; }
.run-trace-embed .tr-mhead { padding-top: 4px; }
@@ -1518,7 +1289,6 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
margin: 0; padding: 12px 32px; background: #fff; border-top: 1px solid var(--line); z-index: 20; }
#view-harness .settings-form { padding-bottom: 88px; }
@media (max-width: 760px) { #view-harness .settings-footer-sticky { left: 0; } }
-@media (max-width: 760px) { .select-bar { left: 0; } }
/* Composer + file cards must never overflow a narrow conversation pane (preview split, mobile). */
.wbx-conv, .wbx-conv-main, .wbx-composer, .wbx-composer-row { min-width: 0; }
.wbx-composer-row > * { min-width: 0; }
@@ -1554,19 +1324,11 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.sk-block.tall { height: 260px; }
.sk-kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.sk-kpi { display: block; height: 112px; border-radius: 10px; }
-
-/* ── Task list: pinned head + independently scrolling sessions (cursor-paged scroll-load) ── */
-.run-list { display: flex; flex-direction: column; overflow: hidden; }
-.run-list-head { flex: 0 0 auto; }
-.run-list-scroll { flex: 1; min-height: 0; overflow-y: auto; }
/* Composer textarea: no focus ring — the composer card is the affordance. */
.wbx-composer-input:focus, .wbx-composer-input:focus-visible { outline: none !important; box-shadow: none; }
/* Stop replaces Send while a turn runs. */
.wbx-send-stop { display: inline-flex; align-items: center; gap: 6px; }
.wbx-act-ic iconify-icon { font-size: 16px; }
-
-/* ── Session sharing: modal choices + public read-only share page ── */
-.session-share-btn { margin-left: 2px; }
.share-choice-list { display: grid; gap: 8px; }
.share-choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; }
@@ -1586,7 +1348,7 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.share-user-bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px 14px 4px 14px;
background: var(--accent-soft); color: var(--ink); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }
.share-asst { font-size: 13.5px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
-.share-asst pre { overflow-x: auto; padding: 12px; border-radius: 8px; background: #f6f6f8; font-size: 12px; }
+.share-asst pre { overflow-x: auto; padding: 12px; border-radius: 8px; background: #f5f5f4; font-size: 12px; }
.share-asst code { background: #f2f2f5; border-radius: 4px; padding: 1px 4px; font-size: 12px; }
.share-asst pre code { background: transparent; padding: 0; }
.share-page { padding-bottom: 80px; }
@@ -1594,7 +1356,7 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
/* Share page meta badges — same look as the trace pane's labels (.tr-tag) */
.share-meta { display: flex; align-items: center; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.share-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-2, #3f3f46);
- background: var(--surface-2, #f6f6f8); border: 1px solid var(--line, #e4e4e7); padding: 2.5px 9px;
+ background: var(--surface-2, #f5f5f4); border: 1px solid var(--line, #e4e4e7); padding: 2.5px 9px;
border-radius: 999px; white-space: nowrap; }
.share-tag iconify-icon { color: var(--muted); font-size: 13px; }
@@ -1614,15 +1376,6 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
background-size: 14px;
}
-/* Share button sits at the far right of the session title row */
-.session-share-btn { margin-left: auto; }
-
-/* SWITCH HARNESS label hugs its dropdown like the sidebar's WORKSPACE label does;
- the larger separation lives BELOW the picker group instead. */
-.run-list-head > .select { margin-top: 0; }
-.run-list-hint { margin-bottom: 6px; }
-.run-list-head .list-scope { margin-top: 14px; }
-
/* ── Welcome / activate-credits modal — premium first-impression surface ─────────── */
@keyframes welcomeIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes welcomeOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@@ -1695,6 +1448,61 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.welcome-cards { grid-template-columns: 1fr; }
.welcome-wide { padding: 30px 20px 24px; }
}
+
+/* ── Apply for welcome credits — the two-question form, in the same popup shell ───── */
+.welcome-wide.apply-wide { width: min(100%, 560px); }
+.apply-wide .welcome-wide-head { margin-bottom: 20px; }
+.apply-form { display: grid; gap: 16px; text-align: left; }
+.apply-field { display: grid; gap: 7px; }
+.apply-label { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.4; }
+.apply-form .input { width: 100%; }
+.apply-textarea { min-height: 96px; resize: vertical; line-height: 1.55; padding-top: 10px; padding-bottom: 10px; }
+.apply-error {
+ display: flex; align-items: center; gap: 7px; padding: 9px 12px; border-radius: 10px;
+ background: var(--red-soft, rgba(220,60,60,.08)); color: var(--red, #b4460f); font-size: 13px;
+}
+.apply-actions { display: grid; gap: 6px; margin-top: 2px; }
+.apply-hint { margin: 0; text-align: center; color: var(--faint); font-size: 12px; }
+.apply-done { text-align: center; padding: 12px 4px 4px; }
+.apply-done-badge {
+ width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center;
+ border-radius: 17px; color: #fff; font-size: 27px;
+ background: linear-gradient(140deg, #4c78ff 0%, #1a5cf5 55%, #1b3fd8 100%);
+ box-shadow: 0 10px 22px -8px rgba(40,90,255,.55), inset 0 1px 0 rgba(255,255,255,.35);
+}
+.apply-done-cta { max-width: 240px; margin: 22px auto 0; }
+
+/* ── Credit approvals (platform org) ─────────────────────────────────────────────── */
+.creq-table { width: 100%; }
+.creq-table td { vertical-align: top; }
+.creq-org { display: grid; gap: 3px; min-width: 0; }
+.creq-org strong { font-size: 13.5px; }
+.creq-org span { color: var(--muted); font-size: 12px; word-break: break-word; }
+.creq-use { color: var(--ink); font-size: 13px; line-height: 1.5; max-width: 460px; white-space: pre-wrap; }
+.creq-when { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
+.creq-actions { text-align: right; white-space: nowrap; }
+.creq-actions .button + .button { margin-left: 8px; }
+/* The decider is an email — one unbreakable token, so it must be allowed to wrap or it clips. */
+.creq-decided { color: var(--muted); font-size: 12.5px; text-align: right;
+ white-space: normal; word-break: break-word; }
+.creq-status {
+ display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
+ font-size: 11.5px; font-weight: 650; white-space: nowrap;
+}
+.creq-status.pending { background: rgba(40,90,255,.1); color: var(--accent); }
+.creq-status.approved { background: var(--green-soft); color: var(--green); }
+.creq-status.denied { background: var(--surface-subtle); color: var(--muted); }
+.creq-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
+@media (max-width: 760px) {
+ .creq-use { max-width: none; }
+ .creq-mobile-hide { display: none; }
+ /* Shed the decision DETAIL, never the decision itself — the status pill in the workspace cell
+ already says approved/denied, and the actions column has to survive for pending rows. */
+ .creq-decided { display: none; }
+ .creq-actions { white-space: normal; }
+ .creq-actions .button { display: block; width: 100%; }
+ .creq-actions .button + .button { margin-left: 0; margin-top: 6px; }
+}
.welcome-badge::after {
content: ""; position: absolute; top: -30%; left: 0; width: 40%; height: 160%;
background: linear-gradient(90deg, transparent, rgba(40,90,255,.1), transparent);
@@ -1722,7 +1530,7 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.welcome-cta {
width: 100%; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
border: 0; border-radius: 12px; cursor: pointer; font-size: 14.5px; font-weight: 650; color: #fff;
- background: linear-gradient(135deg, #3f6bff 0%, #285aff 60%, #1f4ae6 100%);
+ background: linear-gradient(135deg, #3f6bff 0%, #1a5cf5 60%, #1f4ae6 100%);
box-shadow: 0 8px 20px -6px rgba(40,90,255,.55), inset 0 1px 0 rgba(255,255,255,.28);
transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
@@ -1752,7 +1560,7 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
}
.welcome-banner-badge {
flex: 0 0 auto; width: 52px; height: 52px; display: grid; place-items: center; color: #fff;
- border-radius: 15px; background: linear-gradient(140deg, #4c78ff 0%, #285aff 55%, #1b3fd8 100%);
+ border-radius: 15px; background: linear-gradient(140deg, #4c78ff 0%, #1a5cf5 55%, #1b3fd8 100%);
box-shadow: 0 8px 18px -6px rgba(40,90,255,.55), inset 0 1px 0 rgba(255,255,255,.35);
}
.welcome-banner-badge iconify-icon { font-size: 25px; }
@@ -1775,7 +1583,7 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.welcome-banner-cta {
flex: 0 0 auto; min-height: 44px; padding: 0 20px; display: inline-flex; align-items: center; gap: 8px;
border: 0; border-radius: 12px; cursor: pointer; font-size: 14px; font-weight: 650; color: #fff; white-space: nowrap;
- background: linear-gradient(135deg, #3f6bff 0%, #285aff 60%, #1f4ae6 100%);
+ background: linear-gradient(135deg, #3f6bff 0%, #1a5cf5 60%, #1f4ae6 100%);
box-shadow: 0 8px 20px -6px rgba(40,90,255,.5), inset 0 1px 0 rgba(255,255,255,.28);
transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
@@ -1822,6 +1630,7 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
.pay-card-meta { flex: 1 1 240px; min-width: 220px; display: flex; align-items: flex-end; }
.pay-card-update:disabled { cursor: default; opacity: .6; }
+
.harness-runtime-logo { display: flex; align-items: center; gap: 9px; }
/* name on row 1, model on row 2 (the outer flex is logo | text-stack) */
.harness-runtime-logo > div { display: grid; gap: 3px; min-width: 0; }
@@ -1892,31 +1701,277 @@ main .hr-wrap { max-width: 1320px; margin: 0 auto; padding: 28px 32px 64px; }
border-radius: 9px; background: var(--surface-subtle); color: var(--ink); font-size: 12.5px; }
.invite-copy { flex: 0 0 auto; width: auto !important; padding: 0 16px; }
- /* ── cloud upload: one dialog, a chip, a select bar ───────────────────────── */
- .cloud-includes { margin-top: -2px; }
- .cloud-keyrow { display: flex; gap: 8px; }
- .cloud-keyrow input { flex: 1; min-width: 0; }
- .cloud-rows { max-height: 44vh; overflow-y: auto; }
- .cloud-rows td { padding: 10px 12px; }
- .modal .modal-actions { position: sticky; bottom: 0; background: #fff; padding-bottom: 2px; }
- .cloud-note { color: var(--muted); font-size: 12px; }
- .cloud-remove { text-align: right; }
- #cloudTo { width: 100%; }
- .cloud-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
- .cloud-chip iconify-icon { flex: 0 0 auto; font-size: 14px; }
- /* .object-copy makes every descendant span a block; the chip's label is not a line of its
- own, so undo that inside the chip. */
- .object-copy .cloud-chip { display: flex; align-items: center; margin-top: 3px; }
- .object-copy .cloud-chip span { display: inline; margin-top: 0; max-width: none; font-size: 12px; line-height: 1; }
- .cloud-chip.changed { color: var(--ink); }
- /* The selection bar is FIXED to the viewport bottom, same recipe as the harness settings
- action bar above: a short list must still put the action where the thumb expects it. */
- .select-bar { position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 20;
- display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 32px;
- background: #fff; border-top: 1px solid var(--line); }
- .select-bar strong { white-space: nowrap; }
- .select-bar .settings-footer-spacer { flex: 1; }
- .select-col { width: 36px; }
- .select-col input { cursor: pointer; }
- .cloud-select-hint { margin: 10px 2px 0; }
- .button { white-space: nowrap; }
+/* ── First-run onboarding wall ───────────────────────────────────────────────────── */
+/* No close affordance anywhere on purpose: the flow is walked, not dismissed. Every ASK
+ inside it is skippable, which is what keeps "cannot close" from meaning "must pay". */
+/* An OPAQUE takeover, not a scrim. The app behind is not dimmed, blurred or half-visible —
+ it is simply not there. A translucent mask says "a dialog is covering your page"; this step
+ is the page, and showing a ghost of the dashboard underneath only invites people to try to
+ click through to it. Solid background, no backdrop-filter, nothing to see past. */
+.ob-overlay {
+ position: fixed; inset: 0; z-index: 300; overflow-y: auto;
+ display: flex; align-items: center; justify-content: center; padding: 32px 24px;
+ background: var(--bg);
+ animation: welcomeOverlayIn .2s ease both;
+}
+/* The card holds the CONTENT; Back / skip / Next and the progress dots sit on the page beneath
+ it, so the panel stays a clean rectangle of substance instead of growing a chrome bar. */
+.ob-stage { width: min(100%, 720px); margin: auto; }
+.ob-card {
+ display: flex; flex-direction: column; padding: 34px;
+ border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
+ box-shadow: 0 1px 2px rgba(20,20,30,.04);
+ animation: welcomeIn .34s cubic-bezier(.2,.8,.2,1) both;
+}
+.ob-title { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -.03em; font-weight: 700; color: var(--ink); }
+.ob-title-ok { display: flex; align-items: center; gap: 10px; }
+.ob-title-ok iconify-icon { color: var(--green); font-size: 26px; flex: 0 0 auto; }
+.ob-sub { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 560px; }
+
+.ob-values { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-top: 26px; }
+.ob-value { padding: 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-subtle); }
+.ob-value-ic {
+ width: 36px; height: 36px; margin-bottom: 12px; display: grid; place-items: center;
+ border-radius: 10px; background: rgba(40,90,255,.1); color: var(--accent); font-size: 19px;
+}
+.ob-value h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
+.ob-value p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
+
+.ob-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 22px 0 7px; }
+.ob-label em { font-style: normal; font-weight: 400; color: var(--faint); }
+.ob-key-row { display: flex; align-items: stretch; gap: 8px; }
+.ob-key {
+ flex: 1 1 auto; min-width: 0; padding: 12px 14px; border-radius: 10px;
+ border: 1px solid var(--line); background: var(--surface-subtle); color: var(--ink);
+ font-family: "SFMono-Regular", ui-monospace, Menlo, monospace; font-size: 13px;
+ overflow-x: auto; white-space: nowrap; display: flex; align-items: center;
+}
+.ob-key-wait { color: var(--muted); font-family: var(--font); }
+.ob-copy {
+ flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px;
+ border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
+ color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer;
+}
+.ob-copy:hover { background: var(--surface-subtle); }
+.ob-note { margin: 10px 0 0; font-size: 12.5px; color: var(--faint); line-height: 1.5; }
+.ob-error {
+ display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 10px 12px;
+ border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 13px;
+}
+.ob-retry { margin-left: auto; border: 0; background: transparent; color: var(--red);
+ font-weight: 650; font-size: 13px; cursor: pointer; text-decoration: underline; }
+
+.ob-form { display: grid; gap: 14px; margin-top: 20px; }
+.ob-field { display: grid; gap: 6px; }
+.ob-field .ob-label { margin: 0; }
+.ob-field .input, .ob-field .select { width: 100%; }
+.ob-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
+.ob-primary {
+ width: 100%; min-height: 46px; margin-top: 4px; display: inline-flex; align-items: center;
+ justify-content: center; gap: 8px; border: 0; border-radius: 12px; cursor: pointer;
+ font-size: 14.5px; font-weight: 650; color: #fff;
+ background: linear-gradient(135deg, #3f6bff 0%, #1a5cf5 60%, #1f4ae6 100%);
+ box-shadow: 0 8px 20px -6px rgba(40,90,255,.55);
+}
+.ob-primary:disabled { background: var(--surface-subtle); color: var(--faint); box-shadow: none; cursor: default; }
+
+.ob-sources { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 22px; }
+.ob-source {
+ display: flex; align-items: center; gap: 10px; padding: 11px 14px; text-align: left;
+ border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
+ color: var(--ink); font-size: 13.5px; font-weight: 500; cursor: pointer;
+ transition: border-color .12s, background .12s;
+}
+.ob-source:hover { background: var(--surface-subtle); }
+.ob-source.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
+.ob-radio {
+ flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
+ border: 1.5px solid var(--line-strong, #c9c9d2); background: var(--surface);
+}
+.ob-source.on .ob-radio { border-color: var(--accent); border-width: 5px; }
+
+.ob-foot {
+ display: flex; align-items: center; gap: 12px; padding: 18px 4px 0;
+}
+.ob-foot-left, .ob-foot-right { flex: 1 1 0; display: flex; align-items: center; gap: 16px; }
+.ob-foot-right { justify-content: flex-end; }
+.ob-dots { display: flex; gap: 6px; justify-content: center; padding-top: 22px; }
+.ob-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
+.ob-dot.done { background: rgba(40,90,255,.4); }
+.ob-dot.on { background: var(--accent); width: 20px; border-radius: 4px; }
+.ob-back, .ob-skip {
+ display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent;
+ color: var(--muted); font-size: 13.5px; font-weight: 500; cursor: pointer; padding: 8px 4px;
+ white-space: nowrap;
+}
+.ob-back:hover, .ob-skip:hover { color: var(--ink); }
+.ob-next {
+ min-height: 40px; padding: 0 22px; border: 0; border-radius: 10px; cursor: pointer;
+ font-size: 14px; font-weight: 650; color: #fff; background: var(--accent);
+}
+.ob-next:hover:not(:disabled) { background: var(--accent-hover); }
+.ob-next:disabled { opacity: .5; cursor: default; }
+
+@media (max-width: 720px) {
+ /* Edge to edge on a phone: a floating card inside an opaque page wastes the only screen
+ space there is, and the border adds nothing when nothing shows around it. */
+ .ob-overlay { padding: 0; align-items: stretch; }
+ .ob-stage { width: 100%; min-height: 100vh; display: flex; flex-direction: column; padding: 0 16px 20px; }
+ .ob-card { flex: 1 1 auto; border-radius: 0; border: 0; box-shadow: none;
+ padding: 26px 4px 20px; background: transparent; }
+ .ob-title { font-size: 22px; }
+ .ob-values { grid-template-columns: 1fr; gap: 10px; }
+ .ob-sources { grid-template-columns: 1fr; }
+ .ob-row2 { grid-template-columns: 1fr; }
+ .ob-foot { padding: 14px 16px; border-radius: 0; }
+ .ob-next { padding: 0 16px; }
+ .ob-key { font-size: 12px; }
+}
+
+/* Onboarding context on the approvals table (staff-only surface). */
+.creq-ctx { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
+.creq-chip {
+ display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
+ border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 11.5px;
+}
+.creq-chip iconify-icon { font-size: 12px; }
+.creq-addr { color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 6px; white-space: pre-line; }
+.creq-sources { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
+.creq-srcstat {
+ display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 10px;
+ border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--muted);
+}
+.creq-srcstat b { font-size: 14px; color: var(--ink); font-weight: 700; }
+
+/* Workspace + key, sharing the first screen with the pitch. */
+.ob-ready { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
+.ob-ready-title {
+ display: flex; align-items: center; gap: 9px; margin: 0; font-size: 18px;
+ font-weight: 700; letter-spacing: -.02em; color: var(--ink);
+}
+.ob-ready-title iconify-icon { color: var(--green); font-size: 20px; flex: 0 0 auto; }
+.ob-ready-sub { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
+.ob-note-mid { text-align: center; margin-top: 14px; }
+
+/* ── Out of credits ──────────────────────────────────────────────────────────────── */
+/* Dismissible, unlike the onboarding wall: someone whose run just stopped may well want to
+ re-read what their agent did before deciding to spend. */
+.oc-card {
+ position: relative; width: min(100%, 420px); padding: 30px 28px 22px; text-align: center;
+ border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
+ box-shadow: 0 24px 60px -20px rgba(30,40,90,.35);
+ animation: welcomeIn .3s cubic-bezier(.2,.8,.2,1) both;
+}
+.oc-badge {
+ width: 54px; height: 54px; margin: 0 auto 16px; display: grid; place-items: center;
+ border-radius: 16px; background: var(--amber-soft); color: var(--amber); font-size: 26px;
+}
+.oc-card .welcome-sub { max-width: none; }
+.oc-cta { margin-top: 20px; }
+
+/* ── Subscription | Top Up switcher (billing) ────────────────────────────────────── */
+/* The two ways to pay used to be stacked sections, so the second only existed if you scrolled
+ far enough to find it. Side by side, each carrying the one line that tells you which you want. */
+.pay-tabs {
+ display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 16px; max-width: 560px;
+}
+.pay-tab {
+ display: flex; flex-direction: column; gap: 3px; align-items: flex-start; text-align: left;
+ padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
+ color: var(--ink); font-size: 14.5px; font-weight: 650; cursor: pointer;
+ transition: border-color .12s, background .12s, box-shadow .12s;
+}
+.pay-tab span { font-size: 12px; font-weight: 400; color: var(--muted); }
+.pay-tab:hover { background: var(--surface-subtle); }
+.pay-tab.on {
+ border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
+ box-shadow: inset 0 0 0 1px var(--accent);
+}
+/* No opacity fade: at .8 over the tab's tint this sub-label dropped under the 4.5:1 that small
+ text needs. */
+.pay-tab.on span { color: var(--accent); }
+@media (max-width: 560px) { .pay-tabs { grid-template-columns: 1fr; max-width: none; } }
+
+/* Subtitle carrying the workspace-ready confirmation on the first onboarding screen. */
+.ob-sub-ready { display: flex; align-items: flex-start; gap: 9px; }
+.ob-sub-ready iconify-icon { color: var(--green); font-size: 19px; flex: 0 0 auto; margin-top: 1px; }
+.ob-sub-ready b { color: var(--ink); font-weight: 650; }
+
+/* The credit-application pill on the last step. A slow sheen sweep + a breathing glow —
+ attention-getting without literal blinking (and stilled entirely under reduced motion). */
+@keyframes ob-badge-sheen { to { background-position: -220% 0; } }
+@keyframes ob-badge-glow {
+ 0%, 100% { box-shadow: 0 4px 14px rgba(40, 90, 255, .28); }
+ 50% { box-shadow: 0 4px 24px rgba(40, 90, 255, .55); }
+}
+
+/* Embedded card form (provider iframe lives inside .ec-wrap). */
+.ec-wrap { display: grid; gap: 16px; }
+.ec-loading { padding: 28px 0; text-align: center; color: var(--muted); font-size: 13.5px; }
+.ob-linkish {
+ border: 0; background: transparent; color: var(--muted); font-size: 12.5px;
+ cursor: pointer; text-decoration: underline; padding: 2px;
+}
+.ob-linkish:hover { color: var(--ink); }
+
+/* Channel chips double as filters on the onboarding-forms page. */
+button.creq-srcstat { cursor: pointer; transition: border-color .12s, background .12s; }
+button.creq-srcstat:hover { background: var(--surface-subtle); }
+button.creq-srcstat.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
+button.creq-srcstat.on b { color: var(--accent); }
+
+/* The sidebar credits card is a BUTTON to Billing, and nothing about a coin and a number said
+ so. One small line names the destination. */
+.credits-card-hint { display: block; margin-top: 2px; font-size: 11px; color: var(--accent); font-weight: 550; }
+
+/* ── Arena columns ─────────────────────────────────────────────────────────────────────────
+ One comparison column. The page shell (history, hero, chat box, the row's sizing) is in
+ v2.css; this is only what a column looks like inside. */
+.arena-col { display: flex; flex-direction: column; min-width: 0;
+ border: 1px solid var(--line); border-radius: 11px; background: #fff; overflow: hidden; }
+.arena-col-head { flex: 0 0 auto; display: flex; flex-direction: column; align-items: stretch; gap: 6px;
+ padding: 10px 10px 8px; border-bottom: 1px solid var(--line); }
+.arena-col-head-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
+/* Second banner row: the conversation's totals as two quiet mono badges. */
+.arena-col-totals { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
+.arena-col-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
+ background: var(--v2-row, #f3f2f0); font-family: var(--v2-mono, ui-monospace, monospace); font-size: 11px; color: var(--v2-sec, #6b6560);
+ font-variant-numeric: tabular-nums; }
+.arena-col-badge iconify-icon { font-size: 12px; color: var(--v2-cap, #a8a29e); }
+.arena-col-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; font-size: 13px; }
+.arena-col-title b { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+/* The model, in the banner: mono and quiet. It reads; the chat box chip is where it changes. */
+.arena-col-modelname { flex: 0 1 auto; min-width: 0; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
+ font-family: var(--v2-mono, ui-monospace, monospace); font-size: 11.5px; color: var(--muted); }
+.arena-col-open { flex: 0 0 auto; display: inline-flex; color: var(--muted); font-size: 15px; }
+.arena-col-open:hover { color: var(--accent); }
+/* The winner pick: a quiet crown on every column; on the winner it becomes a right-aligned badge
+ with the word, so the verdict never rides on color alone. */
+.arena-col-crown { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; min-height: 24px;
+ padding: 2px 5px; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer;
+ font-family: inherit; font-size: 15px; line-height: 0; }
+.arena-col-crown:hover { color: var(--v2-orange, #b4460f); background: var(--v2-row, #f3f2f0); }
+.arena-col-crown.is-winner { padding: 3px 9px 3px 7px; background: #fdf1e3; color: #9a4b0a;
+ font-size: 12px; font-weight: 600; line-height: 1; }
+.arena-col-crown.is-winner iconify-icon { font-size: 15px; }
+.arena-col-crown.is-winner:hover { background: #f9e4cc; color: #7a3a06; }
+.arena-col-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 0 10px; }
+/* The chat turns are the shared ones; a narrow column just needs tighter gutters, and room
+ between one exchange and the next so the answers read as separate. */
+.arena-col-body .wbx-turn { padding: 0 12px; }
+.arena-col-body .wbx-turn + .wbx-turn { margin-top: 18px; }
+.arena-col-body .wbx-turn.asst + .wbx-turn.user { margin-top: 24px; }
+/* Under an answer: what it took and cost, in the place Tasks keeps its action row. */
+.arena-turn-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px;
+ font-family: var(--v2-mono, ui-monospace, monospace); font-size: 11px; color: var(--v2-cap, #a8a29e); }
+.arena-col-body .wbx-bubble-user { max-width: 92%; }
+.arena-col-empty { padding: 22px 14px; color: var(--muted); font-size: 12px; text-align: center; }
+.arena-col-gone { margin: 8px 12px; padding: 9px 11px; border-radius: 8px;
+ background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 11.5px; line-height: 1.5; }
+.arena-col-preview { min-height: 140px; border-top: 1px solid var(--line); display: flex; }
+.arena-col-preview .fp-panel { border-left: 0; }
+
+/* Why an incomplete turn is incomplete: one quiet line under the neutral badge, rendered only
+ when the record actually knows the cause. The badge above it deliberately no longer names a
+ cause, because it used to name the wrong one for interrupted turns. */
+.wbx-incomplete-why { font-size: 12.5px; color: var(--faint, #6e6760); margin: 4px 0 0 2px; }
diff --git a/ui/src/app/v2.css b/ui/src/app/v2.css
new file mode 100644
index 00000000..3f1eecda
--- /dev/null
+++ b/ui/src/app/v2.css
@@ -0,0 +1,912 @@
+/* ── v2 design system (harness_router_v2_design/CLAUDE.md is the source of truth) ──────────────
+ Loaded LAST from the root layout so its :root remaps win. Two jobs:
+ 1. Retheme the whole app by remapping the token variables every existing surface already
+ reads (fonts, inks, lines, accent) — un-migrated pages inherit the v2 look without edits.
+ 2. Style the v2 chrome (sidebar shell) and re-skin the shared primitives (menus, modals).
+ Palette discipline per the spec: four ink steps, three status colors, three radii. Never add
+ a fifth grey. */
+
+:root {
+ /* type — Inter for prose/UI, JetBrains Mono for machine values. The old IBM Plex/Grotesk
+ variables are REMAPPED (not removed) so every existing rule that reads them flips over. */
+ --v2-sans: var(--font-inter), 'Inter', system-ui, sans-serif;
+ --v2-mono: var(--font-jbmono), 'JetBrains Mono', ui-monospace, monospace;
+ --font-ibm-sans: var(--v2-sans);
+ --font-ibm-mono: var(--v2-mono);
+ --font-grotesk: var(--v2-sans);
+
+ /* ink, four steps only */
+ --v2-ink: #1c1917;
+ --v2-body: #57534e;
+ --v2-sec: #6b6560;
+ --v2-cap: #a8a29e;
+ --v2-dis: #c4beba;
+ /* lines */
+ --v2-line: #e7e5e4;
+ --v2-row: #f4f2f0;
+ --v2-div: #f0eeec;
+ /* surfaces */
+ --v2-desk: #eeecea;
+ --v2-bg: #fafaf9;
+ --v2-card: #ffffff;
+ /* accent + status */
+ --v2-accent: #1a5cf5;
+ --v2-accent-hover: #1447c4;
+ --v2-tint: #f7f8fe;
+ --v2-tint-border: #c9d5f7;
+ --v2-green: #15803d;
+ --v2-green-bg: #eaf5ee;
+ --v2-green-border: #cfe4d6;
+ --v2-orange: #b4460f;
+ --v2-warn-bg: #fdf9f4;
+ --v2-warn-border: #f0e2d4;
+ --v2-warn-ink: #8a6a3c;
+
+ /* remap the legacy token names the existing pages read (studio tokens + revamp) */
+ /* reifyui components read --uic-*; point them at the v2 palette so Chip/SearchField/
+ Composer render on-theme without forking the library. */
+ --uic-brand: var(--v2-accent);
+ --uic-brand-ink: var(--v2-accent-hover);
+ --uic-brand-faint: var(--v2-tint);
+ --uic-ink: var(--v2-ink);
+ --uic-ink-2: var(--v2-body);
+ --uic-mute: var(--v2-sec);
+ --uic-mute-2: var(--v2-cap);
+ --uic-line: var(--v2-line);
+ --uic-line-soft: var(--v2-row);
+ --uic-surface: var(--v2-card);
+ --brand: var(--v2-accent);
+ --brand-hover: var(--v2-accent-hover);
+ --accent: var(--v2-accent);
+ --ink: var(--v2-ink);
+ --muted: var(--v2-sec);
+ --faint: var(--v2-cap);
+ --line: var(--v2-line);
+ --paper: var(--v2-bg);
+ --card: var(--v2-card);
+}
+
+body {
+ background: var(--v2-bg);
+ color: var(--v2-ink);
+ font-family: var(--v2-sans);
+}
+
+/* ── v2 shell ─────────────────────────────────────────────────────────────────────────────── */
+.v2-side {
+ position: fixed; inset: 0 auto 0 0; width: var(--v2-navw, 268px);
+ background: #fff; border-right: 1px solid var(--v2-line);
+ display: flex; flex-direction: column; z-index: 60;
+ transition: width .12s ease;
+}
+.v2-side.is-dragging { transition: none; user-select: none; }
+/* drag handle: invisible 7px strip on the right edge */
+.v2-resize {
+ position: absolute; top: 0; right: -4px; width: 7px; height: 100%;
+ cursor: col-resize; z-index: 61;
+}
+.v2-resize:hover, .v2-side.is-dragging .v2-resize { background: var(--v2-tint-border); opacity: .5; }
+
+.v2-title {
+ display: flex; align-items: center; gap: 9px;
+ padding: 18px 16px 14px; flex: none; overflow: hidden;
+}
+/* The wordmark sits in a clipping box: when the nav is dragged narrower than the mark, the mark
+ is cropped on its right and the toggle keeps its place inside the nav. */
+.v2-title .v2-brand { flex: 1 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center; }
+.v2-title .v2-brand-full { height: 28px; width: auto; max-width: none; flex: none; }
+.v2-title .v2-brand-icon { width: 22px; height: 22px; display: none; }
+.v2-title .v2-searchbtn {
+ margin-left: auto; border: 0; background: none; color: var(--v2-cap); cursor: pointer;
+ display: inline-flex; padding: 4px; border-radius: 6px;
+}
+.v2-title .v2-searchbtn:hover { color: var(--v2-body); background: var(--v2-bg); }
+
+.v2-wscard {
+ margin: 0 14px 14px; padding: 9px 11px; text-align: left;
+ border: 1px solid #e0dcd9; border-radius: 8px; background: #fff; cursor: pointer;
+ display: flex; align-items: center; gap: 10px; width: calc(100% - 28px);
+}
+.v2-wscard .v2-wschev { margin-left: auto; flex: none; color: var(--v2-cap); font-size: 14px; }
+.v2-wscard:hover { border-color: var(--v2-tint-border); }
+.v2-wscard .v2-wsavatar {
+ width: 28px; height: 28px; border-radius: 8px; flex: none;
+ background: var(--v2-tint); color: var(--v2-accent);
+ display: grid; place-items: center; font-size: 11px; font-weight: 700;
+}
+.v2-wscard .v2-wsmeta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
+.v2-wscard .v2-wskicker {
+ font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em;
+ text-transform: uppercase; color: var(--v2-cap);
+}
+.v2-wscard .v2-wsname {
+ font-size: 13px; font-weight: 600; color: var(--v2-ink);
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
+}
+
+/* Groups are full-width bands separated by hairlines, and a row's highlight runs edge to edge
+ with the accent bar on the sidebar's own edge (the design), not an inset pill. */
+.v2-nav { flex: 1; overflow-y: auto; padding: 0 0 12px; }
+.v2-group { padding: 14px 0 10px; border-top: 1px solid var(--v2-div); }
+.v2-group:first-child { padding-top: 0; border-top: 0; }
+.v2-group-label {
+ font-size: 12px; color: var(--v2-cap); margin: 0 18px 7px; font-weight: 500;
+}
+.v2-item {
+ display: flex; align-items: center; gap: 11px; width: 100%;
+ padding: 8px 18px; border-radius: 0; border: 0; background: none; cursor: pointer;
+ font-size: 13.5px; color: var(--v2-body); text-decoration: none; position: relative;
+}
+.v2-item:hover { background: var(--v2-bg); color: var(--v2-ink); text-decoration: none; }
+.v2-item[aria-current='page'] { background: var(--v2-tint); color: var(--v2-ink); font-weight: 600; }
+.v2-item[aria-current='page']::before {
+ content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
+ width: 2.5px; border-radius: 0 2px 2px 0; background: var(--v2-accent);
+}
+.v2-item iconify-icon { font-size: 16px; color: inherit; flex: none; }
+.v2-item .v2-item-end {
+ margin-left: auto; font-family: var(--v2-mono); font-size: 11.5px; color: var(--v2-cap);
+}
+.v2-item.is-soon { color: var(--v2-dis); cursor: default; }
+.v2-item.is-soon:hover { background: none; color: var(--v2-dis); }
+.v2-soon-pill {
+ margin-left: auto; font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .12em;
+ color: var(--v2-cap); background: #f5f5f4; border-radius: 999px; padding: 2px 7px;
+}
+
+.v2-foot { flex: none; border-top: 1px solid var(--v2-div); padding: 10px 12px; position: relative; }
+.v2-account {
+ display: flex; align-items: center; gap: 10px; width: 100%;
+ padding: 6px 8px; border: 0; background: none; border-radius: 8px; cursor: pointer;
+}
+.v2-account:hover { background: var(--v2-bg); }
+.v2-account .v2-avatar {
+ width: 26px; height: 26px; border-radius: 999px; flex: none; overflow: hidden;
+ background: #f5f5f4; color: var(--v2-sec); display: grid; place-items: center;
+ font-size: 10.5px; font-weight: 700;
+}
+.v2-account .v2-avatar img { width: 100%; height: 100%; object-fit: cover; }
+.v2-account .v2-email {
+ font-size: 13px; color: var(--v2-body);
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
+}
+
+/* collapsed rail: icons only */
+.v2-side.is-rail .v2-title .v2-brand-full,
+.v2-side.is-rail .v2-wscard .v2-wsmeta, .v2-side.is-rail .v2-group-label,
+.v2-side.is-rail .v2-item span, .v2-side.is-rail .v2-item .v2-item-end,
+.v2-side.is-rail .v2-soon-pill, .v2-side.is-rail .v2-account .v2-email { display: none; }
+.v2-side.is-rail .v2-title .v2-brand-icon { display: inline-block; }
+.v2-side.is-rail .v2-title { justify-content: center; padding-left: 0; padding-right: 0; }
+.v2-side.is-rail .v2-title .v2-brand { flex: none; overflow: visible; }
+.v2-side.is-rail .v2-wscard { justify-content: center; padding: 5px; margin: 0 auto 14px; width: auto; border-color: transparent; }
+.v2-side.is-rail .v2-wscard .v2-wschev { display: none; }
+.v2-side.is-rail .v2-item { justify-content: center; padding: 8px 0; }
+.v2-side.is-rail .v2-group-label { display: none; }
+/* The workspace menu: a real width in both modes, and in the rail it flies out to the right
+ instead of squeezing into a 64px column where every name wraps. */
+.v2-side .workspace-menu { top: 46px; left: 14px; width: calc(100% - 28px); min-width: 236px; }
+.v2-side .workspace-menu-item > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.v2-side.is-rail .workspace-menu { left: calc(100% + 8px); top: 0; width: 236px; }
+.v2-side.is-rail .v2-account { justify-content: center; }
+
+/* main content sits right of the sidebar */
+.v2-main { margin-left: var(--v2-navw, 268px); min-height: 100vh; transition: margin-left .12s ease; }
+
+/* mobile top bar (≤768): the sidebar becomes an overlay drawer */
+.v2-mobilebar { display: none; }
+@media (max-width: 768px) {
+ .v2-mobilebar {
+ display: flex; align-items: center; gap: 10px;
+ position: sticky; top: 0; z-index: 55;
+ background: #fff; border-bottom: 1px solid var(--v2-line); padding: 10px 14px;
+ }
+ .v2-mobilebar img { width: 20px; height: 20px; }
+ .v2-mobilebar strong { font-size: 14px; }
+ .v2-mobilebar button {
+ margin-left: auto; border: 0; background: none; font-size: 20px;
+ color: var(--v2-body); cursor: pointer; display: inline-flex; padding: 4px;
+ }
+ .v2-side { transform: translateX(-100%); transition: transform .15s ease; width: 268px !important; }
+ .v2-side .v2-collapsebtn { display: none; }
+ .v2-side.is-open { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(28,25,23,.28); }
+ .v2-resize { display: none; }
+ .v2-main { margin-left: 0; }
+}
+/* tablet (769–1024): keep the sidebar but default narrower via JS-set width */
+
+/* ── re-skin shared primitives the old chrome classes still render ────────────────────────── */
+.account-menu, .workspace-menu, .connect-menu, .search-panel {
+ border: 1px solid var(--v2-line); border-radius: 10px; background: #fff;
+ box-shadow: 0 8px 28px rgba(28,25,23,.10);
+}
+.modal { border-radius: 12px; }
+.button.primary, .btn-primary { background: var(--v2-accent); border-radius: 8px; }
+.button.primary:hover, .btn-primary:hover { background: var(--v2-accent-hover); }
+
+/* v2 search overlay (⌘K) */
+.v2-search-overlay {
+ position: fixed; inset: 0; z-index: 90; background: rgba(28,25,23,.30);
+ display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh;
+}
+.v2-search-box {
+ width: min(640px, calc(100vw - 32px)); background: #fff; border-radius: 12px;
+ border: 1px solid var(--v2-line); box-shadow: 0 16px 48px rgba(28,25,23,.18); overflow: hidden;
+}
+.v2-search-box .global-search { position: relative; display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--v2-div); }
+.v2-search-box .global-search input { flex: 1; border: 0; outline: none; font-size: 14.5px; font-family: var(--v2-sans); background: none; }
+.v2-search-box .global-search iconify-icon { color: var(--v2-cap); font-size: 17px; }
+.v2-search-box .search-key { font-family: var(--v2-mono); font-size: 10.5px; color: var(--v2-cap); }
+.v2-search-box .search-panel { position: static; border: 0; box-shadow: none; border-radius: 0; max-height: 48vh; overflow-y: auto; }
+
+/* title-row actions: search + the collapse toggle (the design's panel icon). In the rail the
+ toggle stays visible, stacked under the logo, so expansion never requires finding the 7px
+ drag edge; search hides (Cmd+K still works). */
+.v2-title-actions { margin-left: auto; display: inline-flex; gap: 2px; }
+.v2-collapsebtn {
+ border: 0; background: none; color: var(--v2-cap); cursor: pointer;
+ display: inline-flex; padding: 4px; border-radius: 6px; font-size: 16px;
+}
+.v2-collapsebtn:hover { color: var(--v2-body); background: var(--v2-bg); }
+.v2-side.is-rail .v2-title { flex-direction: column; gap: 12px; padding-top: 16px; }
+.v2-side.is-rail .v2-title-actions { margin-left: 0; }
+.v2-side.is-rail .v2-collapsebtn { display: inline-flex; }
+
+/* ── Scrollbars: thin pill thumbs, no painted track, everywhere ─────────────────────────────
+ Chrome/Safari draw these through the -webkit pseudo-elements; Firefox through the standard
+ properties. The standard properties are scoped to engines WITHOUT the pseudo-elements on
+ purpose: Chrome ignores ::-webkit-scrollbar on any element that sets scrollbar-width, so a
+ bare `scrollbar-width: thin` anywhere would switch that element back to the stock bar. */
+@supports not selector(::-webkit-scrollbar) {
+ * { scrollbar-width: thin; scrollbar-color: rgba(28,25,23,.22) transparent; }
+}
+*::-webkit-scrollbar { width: 10px; height: 10px; }
+*::-webkit-scrollbar-track, *::-webkit-scrollbar-corner { background: transparent; }
+*::-webkit-scrollbar-thumb { background-color: rgba(28,25,23,.18); border-radius: 999px;
+ border: 3px solid transparent; background-clip: padding-box; }
+*::-webkit-scrollbar-thumb:hover { background-color: rgba(28,25,23,.34); }
+
+/* ── Usage: where the credits went, by day and by harness ─────────────────────────────────
+ Header block on white with the period control, four summary numbers, then a scroll body
+ with the chart card, the by-harness table and the price list (the v2 design's Usage page). */
+.us-root { display: flex; flex-direction: column; height: 100vh; min-width: 0; background: var(--v2-bg); }
+.us-head { flex: none; padding: 30px 36px 16px; background: #fff; border-bottom: 1px solid var(--v2-line); }
+.us-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
+.us-head h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
+.us-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
+.us-seg { display: flex; align-items: center; gap: 2px; padding: 3px; background: #f5f5f4; border-radius: 8px; flex: none; }
+.us-seg button { font: inherit; font-size: 12.5px; font-weight: 500; padding: 7px 13px; border: 0; border-radius: 6px;
+ background: transparent; color: var(--v2-sec); cursor: pointer; }
+.us-seg button[aria-pressed="true"] { background: #fff; color: var(--v2-accent); font-weight: 600; box-shadow: 0 1px 2px rgba(28,25,23,.1); }
+.us-custom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--v2-sec); }
+.us-custom input { font: inherit; font-size: 12.5px; padding: 7px 10px; border: 1px solid #e0dcd9; border-radius: 8px; background: #fff; color: var(--v2-ink); }
+.us-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px 28px; margin-top: 22px; }
+.us-stat-k { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); }
+.us-stat-v { display: flex; align-items: baseline; gap: 8px; margin-top: 5px; min-width: 0; }
+.us-stat-v b { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; color: var(--v2-ink); font-variant-numeric: tabular-nums; }
+.us-delta { font-family: var(--v2-mono); font-size: 11.5px; }
+.us-delta.up { color: var(--v2-orange); }
+.us-delta.down { color: var(--v2-green); }
+.us-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 36px 34px; display: flex; flex-direction: column; gap: 16px; }
+.us-card { border: 1px solid var(--v2-line); border-radius: 10px; background: #fff; }
+.us-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; padding: 18px 22px 14px; }
+.us-card-title { font-size: 15px; font-weight: 600; color: var(--v2-ink); display: inline-flex; align-items: center; gap: 12px; }
+/* In-card mode chips: mono 10/600 in a track, the design's in-row tab style, never page tabs. */
+.us-mode { display: inline-flex; gap: 2px; padding: 2px; background: #f5f5f4; border-radius: 6px; }
+.us-mode button { font-family: var(--v2-mono); font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
+ padding: 4px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--v2-sec); cursor: pointer; }
+.us-mode button[aria-pressed="true"] { background: #fff; color: var(--v2-ink); box-shadow: 0 1px 2px rgba(28,25,23,.1); }
+.us-legend { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
+.us-legend-i { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--v2-body); }
+.us-legend-i i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
+.us-legend-i b { font-family: var(--v2-mono); font-weight: 400; font-size: 11.5px; color: var(--v2-cap); }
+.us-chart { height: 232px; margin: 4px 22px 18px; }
+.us-empty { padding: 26px 22px; font-size: 13.5px; color: var(--v2-sec); line-height: 1.5; }
+.us-empty a { color: var(--v2-accent); }
+.us-skel { margin: 4px 22px 18px; height: 232px; border-radius: 8px; background: linear-gradient(90deg, #f5f5f4, #fafaf9, #f5f5f4); background-size: 200% 100%; animation: us-shimmer 1.2s linear infinite; }
+@keyframes us-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
+@media (prefers-reduced-motion: reduce) { .us-skel { animation: none; } }
+/* The by-harness table: a grid, so the header and the rows share one set of columns. */
+.us-thead, .us-row { display: grid; grid-template-columns: minmax(200px, 1fr) 208px 70px 82px 88px 168px; align-items: center; gap: 14px; padding: 13px 22px; }
+.us-thead { padding: 10px 22px; background: var(--v2-bg); border-top: 1px solid var(--v2-line); border-bottom: 1px solid var(--v2-line);
+ font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); }
+.us-row { border-bottom: 1px solid #f4f2f0; }
+.us-row:last-child { border-bottom: 0; }
+.us-row-name { min-width: 0; }
+.us-row-name b { display: block; font-size: 14px; font-weight: 600; color: var(--v2-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.us-cfg { font-family: var(--v2-mono); font-size: 11.5px; color: var(--v2-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
+.us-num { font-family: var(--v2-mono); font-size: 12.5px; color: var(--v2-body); font-variant-numeric: tabular-nums; }
+.us-num.ink { color: var(--v2-ink); }
+.us-share { display: flex; align-items: center; gap: 9px; min-width: 0; }
+.us-bar { flex: 1; height: 5px; border-radius: 3px; background: #f0eeec; overflow: hidden; }
+.us-bar i { display: block; height: 100%; background: var(--v2-accent); }
+.us-share span { font-family: var(--v2-mono); font-size: 11px; color: var(--v2-cap); width: 34px; text-align: right; flex: none; }
+/* Price list: a card that opens. */
+.us-prices-btn { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 16px 22px;
+ background: transparent; border: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; border-radius: 10px; }
+.us-prices-btn:hover { background: var(--v2-bg); }
+.us-prices-t { font-size: 14.5px; font-weight: 600; color: var(--v2-ink); }
+.us-prices-k { font-family: var(--v2-mono); font-size: 11px; color: var(--v2-cap); flex: none; }
+.us-prices { border-top: 1px solid #f0eeec; }
+.us-price-g { padding: 12px 22px 4px; font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); }
+.us-price { display: grid; grid-template-columns: 1fr 200px; align-items: center; gap: 16px; padding: 10px 22px; border-bottom: 1px solid #f7f5f4; }
+.us-price span:first-child { font-size: 13.5px; color: var(--v2-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.us-price span:last-child { font-family: var(--v2-mono); font-size: 12.5px; color: var(--v2-body); }
+@media (max-width: 1100px) {
+ .us-thead, .us-row { grid-template-columns: minmax(150px, 1fr) 150px 56px 72px 72px; }
+ .us-share, .us-thead .us-th-share { display: none; }
+}
+@media (max-width: 1024px) {
+ .us-stats { grid-template-columns: repeat(2, 1fr); }
+}
+@media (max-width: 768px) {
+ .us-root { height: calc(100vh - 53px); }
+ .us-head { padding: 20px 16px 14px; }
+ .us-body { padding: 16px 16px 24px; }
+ .us-stat-v b { font-size: 22px; }
+}
+@media (max-width: 600px) {
+ .us-thead, .us-row { grid-template-columns: minmax(120px, 1fr) 56px 72px; gap: 10px; padding-left: 16px; padding-right: 16px; }
+ .us-cfg, .us-thead .us-th-cfg, .us-cpt, .us-thead .us-th-cpt { display: none; }
+ .us-row-name b { white-space: normal; }
+ .us-card-head, .us-thead, .us-price, .us-prices-btn, .us-price-g { padding-left: 16px; padding-right: 16px; }
+ .us-chart { margin: 4px 12px 0; } .us-empty { margin-left: 16px; margin-right: 16px; }
+ .us-price { grid-template-columns: 1fr auto; }
+}
+
+/* ── API keys ───────────────────────────────────────────────────────────────────────────────
+ Header block (title, primary action, search, the stale note, the shown-once note), then one
+ card: a grid table whose header and rows share the same columns. A key that was never used
+ since it was made sits on a warm row with the reason spelled out. */
+.ak-root { display: flex; flex-direction: column; height: 100vh; min-width: 0; background: var(--v2-bg); }
+.ak-head { flex: none; padding: 30px 36px 18px; background: #fff; border-bottom: 1px solid var(--v2-line); }
+.ak-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
+.ak-head h1 { margin: 0 0 7px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
+.ak-sub { margin: 0; font-size: 14px; color: var(--v2-sec); }
+.ak-primary { flex: none; font: inherit; font-size: 13.5px; font-weight: 600; padding: 11px 18px; border: 0; border-radius: 8px;
+ background: var(--v2-accent); color: #fff; cursor: pointer; }
+.ak-primary:hover { background: var(--v2-accent-hover, #1447c4); }
+.ak-primary:disabled { opacity: .5; cursor: default; }
+.ak-secondary { font: inherit; font-size: 13px; font-weight: 500; padding: 10px 16px; background: transparent; border: 1px solid #e0dcd9; border-radius: 8px; cursor: pointer; color: var(--v2-body); }
+.ak-secondary:hover { border-color: var(--v2-cap); }
+.ak-danger { font: inherit; font-size: 13px; font-weight: 600; padding: 10px 18px; background: var(--v2-orange); border: 0; border-radius: 8px; cursor: pointer; color: #fff; }
+.ak-tools { display: flex; align-items: center; gap: 12px 16px; margin-top: 20px; flex-wrap: wrap; }
+.ak-search { width: 260px; max-width: 100%; font: inherit; font-size: 13.5px; padding: 9px 12px; background: #fff; border: 1px solid #e0dcd9; border-radius: 8px; color: var(--v2-ink); }
+.ak-search:focus { outline: none; border-color: var(--v2-accent); }
+.ak-once { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--v2-cap); }
+.ak-once iconify-icon { font-size: 15px; color: var(--v2-dis, #b8b2ad); }
+.ak-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 36px 34px; }
+.ak-err { margin-bottom: 14px; padding: 12px 14px; border: 1px solid #f0e2d4; border-radius: 8px; background: #fdf9f4; color: #8a6a3c; font-size: 13px; }
+.ak-card { border: 1px solid var(--v2-line); border-radius: 10px; background: #fff; overflow: hidden; }
+.ak-thead, .ak-row { display: grid; grid-template-columns: minmax(190px, 1fr) 152px 132px 92px 30px; align-items: center; gap: 14px; padding: 13px 20px; }
+.ak-thead { padding: 11px 20px; background: var(--v2-bg); border-bottom: 1px solid var(--v2-line);
+ font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); }
+.ak-row { border-bottom: 1px solid #f4f2f0; }
+.ak-row:last-child { border-bottom: 0; }
+.ak-name { min-width: 0; }
+.ak-name b { display: block; font-size: 14px; font-weight: 600; color: var(--v2-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.ak-key { font-family: var(--v2-mono); font-size: 12.5px; color: var(--v2-body); white-space: nowrap; }
+.ak-last.none { color: var(--v2-cap); }
+.ak-last { font-family: var(--v2-mono); font-size: 12px; color: var(--v2-body); white-space: nowrap; }
+.ak-created { font-family: var(--v2-mono); font-size: 12px; color: var(--v2-cap); white-space: nowrap; }
+.ak-dots { justify-self: end; background: transparent; border: 0; border-radius: 6px; padding: 4px 6px; cursor: pointer; color: var(--v2-cap); font-size: 16px; line-height: 0; }
+.ak-dots:hover, .ak-dots[aria-expanded="true"] { background: #f5f5f4; color: var(--v2-ink); }
+.ak-menu .uic-pop-item.danger { color: var(--v2-orange); }
+.ak-empty { padding: 34px 20px; text-align: center; font-size: 13.5px; color: var(--v2-sec); line-height: 1.6; }
+.ak-skel { height: 18px; margin: 15px 20px; border-radius: 6px; background: linear-gradient(90deg, #f5f5f4, #fafaf9, #f5f5f4); background-size: 200% 100%; animation: us-shimmer 1.2s linear infinite; }
+@media (prefers-reduced-motion: reduce) { .ak-skel { animation: none; } }
+/* Dialogs, the design's 520px sheet: title, body, a footer bar. */
+.ak-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(28,25,23,.34); display: flex; align-items: center; justify-content: center; padding: 16px; }
+.ak-modal { width: 520px; max-width: 100%; max-height: 100%; overflow: auto; background: #fff; border-radius: 12px; box-shadow: 0 30px 70px -30px rgba(28,25,23,.5); }
+.ak-modal-body { padding: 24px 26px 20px; }
+.ak-modal h2 { margin: 0; font-size: 18px; font-weight: 600; color: var(--v2-ink); }
+.ak-modal-sub { font-size: 13px; color: var(--v2-sec); margin-top: 6px; line-height: 1.5; }
+.ak-field { margin-top: 20px; }
+.ak-field-k { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); margin-bottom: 7px; }
+.ak-field input { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; padding: 11px 13px; background: #fff; border: 1px solid #e0dcd9; border-radius: 8px; color: var(--v2-ink); }
+.ak-field input:focus { outline: none; border-color: var(--v2-accent); }
+.ak-warn { display: flex; gap: 11px; margin-top: 18px; padding: 13px 15px; border: 1px solid #f0e2d4; border-radius: 8px; background: #fdf9f4; }
+.ak-warn i { font-style: normal; color: var(--v2-orange); font-size: 13px; line-height: 1.5; flex: none; font-weight: 700; }
+.ak-warn span { font-size: 12.5px; line-height: 1.6; color: #8a6a3c; }
+.ak-secret { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 14px 16px; border: 1px solid var(--v2-line); border-radius: 8px; background: var(--v2-bg); }
+.ak-secret code { flex: 1; min-width: 0; font-family: var(--v2-mono); font-size: 13px; color: var(--v2-ink); word-break: break-all; }
+.ak-copy { flex: none; font: inherit; font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 8px; cursor: pointer; border: 1px solid #e0dcd9; background: #fff; color: var(--v2-ink); }
+.ak-copy.is-copied { border-color: var(--v2-green-border); background: var(--v2-green-bg); color: var(--v2-green); }
+.ak-modal-note { font-size: 12.5px; color: var(--v2-cap); margin-top: 12px; }
+.ak-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 14px 26px; border-top: 1px solid #f0eeec; background: var(--v2-bg); }
+@media (max-width: 820px) {
+ .ak-thead, .ak-row { grid-template-columns: minmax(140px, 1fr) 130px 110px 30px; gap: 12px; }
+ .ak-created, .ak-th-created { display: none; }
+}
+@media (max-width: 768px) {
+ .ak-root { height: calc(100vh - 53px); }
+ .ak-head { padding: 20px 16px 14px; }
+ .ak-body { padding: 16px 16px 24px; }
+ .ak-search { width: 100%; }
+ .ak-once { margin-left: 0; }
+}
+@media (max-width: 480px) {
+ .ak-thead, .ak-row { grid-template-columns: minmax(100px, 1fr) 118px 30px; gap: 10px; padding-left: 14px; padding-right: 14px; }
+ .ak-last, .ak-th-last { display: none; }
+ .ak-name b { white-space: normal; }
+}
+
+/* ── Agent harnesses (终版): panel of harnesses with their tasks, plus one main area ────────
+ Full-bleed like Arena: the page owns everything right of the nav. The panel is 288px on
+ white; the main area is a white header block over a scrolling body. */
+.hx-root { display: flex; height: 100vh; min-width: 0; background: var(--v2-bg); }
+.hx-side { width: 288px; flex: none; background: #fff; border-right: 1px solid var(--v2-line); display: flex; flex-direction: column; min-height: 0; }
+.hx-side-head { flex: none; padding: 18px 14px 10px; display: flex; flex-direction: column; gap: 10px; }
+.hx-side-title { font-size: 14.5px; font-weight: 600; color: var(--v2-ink); padding: 0 4px; }
+.hx-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid #e0dcd9; border-radius: 8px; background: #fff; color: var(--v2-cap); }
+.hx-search:focus-within { border-color: var(--v2-accent); }
+.hx-search iconify-icon { font-size: 15px; flex: none; }
+.hx-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 13px; color: var(--v2-ink); }
+.hx-side-fixed { flex: none; padding-top: 4px; }
+.hx-side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 0 14px; }
+.hx-index { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 18px; border: 0; background: none; cursor: pointer;
+ font: inherit; font-size: 13.5px; font-weight: 500; color: var(--v2-body); text-align: left; }
+.hx-index iconify-icon { font-size: 16px; color: var(--v2-cap); }
+.hx-index b { margin-left: auto; font-family: var(--v2-mono); font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 999px; background: #f5f5f4; color: var(--v2-cap); }
+.hx-index.is-on { background: var(--v2-tint); color: var(--v2-ink); font-weight: 600; }
+.hx-index.is-on::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2.5px; border-radius: 0 2px 2px 0; background: var(--v2-accent); }
+.hx-div { height: 1px; margin: 8px 0 6px; background: var(--v2-div); }
+.hx-proj-row { display: flex; align-items: center; gap: 2px; padding: 2px 8px 2px 10px; }
+.hx-proj-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 6px 4px; border: 0; background: none; cursor: pointer;
+ font: inherit; text-align: left; color: var(--v2-ink); }
+.hx-caret { font-size: 14px; color: var(--v2-cap); flex: none; }
+.hx-proj-name { font-size: 13px; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-proj-badge { flex: none; font-family: var(--v2-mono); font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 999px; background: var(--v2-tint); color: var(--v2-accent); }
+.hx-ic { display: grid; place-items: center; width: 24px; height: 24px; flex: none; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--v2-cap); cursor: pointer; font-size: 14px; opacity: 0; }
+.hx-proj-row:hover .hx-ic, .hx-ic:focus-visible, .hx-proj.is-current .hx-ic { opacity: 1; }
+.hx-ic:hover { background: #f5f5f4; color: var(--v2-ink); }
+.hx-tasks { position: relative; padding: 0 0 4px; }
+/* The tree guide: a hairline under the caret, so the tasks read as the harness's children. */
+.hx-tasks::before { content: ''; position: absolute; left: 21px; top: 0; bottom: 6px; width: 1px; background: var(--v2-line); }
+.hx-tasks-empty { padding: 5px 14px 6px 34px; font-size: 12px; color: var(--v2-cap); }
+.hx-task { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 14px 6px 32px; border: 0; background: none; cursor: pointer;
+ font: inherit; text-align: left; }
+.hx-task span { font-size: 13px; color: var(--v2-body); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-task.is-on { background: var(--v2-tint); }
+.hx-task.is-on span { color: var(--v2-ink); font-weight: 600; }
+.hx-task.is-on::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2.5px; border-radius: 0 2px 2px 0; background: var(--v2-accent); }
+.hx-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; background: var(--v2-cap); }
+.hx-dot.is-done { background: var(--v2-green); } .hx-dot.is-running { background: var(--v2-accent); } .hx-dot.is-failed { background: var(--v2-orange); }
+.hx-empty { padding: 18px 16px; font-size: 13px; color: var(--v2-cap); }
+
+.hx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
+.hx-head { flex: none; padding: 16px 28px 0; background: #fff; border-bottom: 1px solid var(--v2-line); }
+/* With tabs, the header's bottom line is the tabs' baseline: the tabs row (rendered by the
+ conversation below) carries the one line, so the header itself draws none. */
+.hx-head.has-tabs { border-bottom: 0; }
+.hx-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 14px; }
+.hx-head.has-tabs .hx-head-row { padding-bottom: 0; }
+.hx-head-lead { min-width: 0; }
+.hx-back { display: none; }
+.hx-crumb { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--v2-cap); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-crumb-cfg { font-family: var(--v2-mono); font-size: 11px; }
+.hx-crumb-sep { color: #d6d3d1; }
+.hx-title-row { display: flex; align-items: center; gap: 10px; margin-top: 5px; min-width: 0; }
+.hx-title { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: var(--v2-ink); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-pill { flex: none; font-family: var(--v2-mono); font-size: 9.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: #f5f5f4; color: var(--v2-sec); }
+.hx-pill.is-done { background: rgba(21, 128, 61, .08); color: #15803d; }
+.hx-pill.is-running { background: rgba(26, 92, 245, .08); color: #1a5cf5; }
+.hx-pill.is-failed { background: rgba(180, 70, 15, .08); color: #b4460f; }
+.hx-more { display: block; margin: 2px 0 4px 26px; padding: 4px 8px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 12px; color: var(--v2-accent); cursor: pointer; }
+.hx-more:hover { background: var(--v2-row, #f3f2f0); }
+.hx-more:disabled { color: var(--v2-cap); cursor: default; }
+/* ── the conversation, per the design: captions above turns, a tinted user bubble, the agent's
+ reply as plain text (no card), file cards with an extension badge and a plain Preview link ── */
+.run-layout.is-embedded .wbx-conv-main { background: var(--v2-bg); }
+.run-layout.is-embedded .wbx-conv-msgs { --uic-cap: var(--v2-cap); --uic-mono: var(--v2-mono); --uic-bubble-max-w: 640px; gap: 20px; }
+.run-layout.is-embedded .wbx-turn.user .wbx-bubble-user { background: #f0f3fe; color: var(--v2-ink); border-radius: 12px; padding: 13px 17px; font-size: 15px; line-height: 1.65; text-wrap: pretty; }
+.run-layout.is-embedded .wbx-turn.asst > * { max-width: 640px; }
+.run-layout.is-embedded .wbx-turn.asst .wbx-md { font-size: 15px; line-height: 1.65; color: var(--v2-ink); text-wrap: pretty; }
+.run-layout.is-embedded .wbx-files { max-width: 640px; margin-top: 10px; gap: 10px; }
+.run-layout.is-embedded .wbx-filecard { gap: 12px; padding: 11px 13px; border: 1px solid var(--v2-line); border-radius: 10px; background: #fff; transition: border-color 110ms, background 110ms; }
+.run-layout.is-embedded .wbx-filecard:hover { border-color: #c9d5f7; background: var(--v2-tint); }
+.run-layout.is-embedded .wbx-filecard-ic { width: 30px; flex: none; }
+.run-layout.is-embedded .wbx-filecard-name { font-size: 13.5px; font-weight: 600; color: var(--v2-ink); }
+.run-layout.is-embedded .wbx-filecard-sub { font-family: var(--v2-mono); font-size: 11px; color: var(--v2-cap); margin-top: 2px; }
+.run-layout.is-embedded .wbx-filecard-dl { color: var(--v2-cap); }
+.run-layout.is-embedded .wbx-filecard-open { border: 0; padding: 0; font-size: 12.5px; font-weight: 500; color: var(--v2-accent); }
+/* the tabs, per the design, with the Trace count: the row sits in the white header band and its
+ one line is the header's bottom line */
+.run-layout.is-embedded .task-detail-shell { background: #fff; padding: 0 28px; border-bottom: 1px solid var(--v2-line); }
+.run-layout.is-embedded .tabs { display: flex; gap: 24px; margin: 14px 0 0; border-bottom: 0; }
+.run-layout.is-embedded .tabs .tab { display: flex; align-items: center; gap: 8px; min-height: 0; padding: 10px 2px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; color: #8a827c; }
+.run-layout.is-embedded .tabs .tab[aria-selected="true"] { color: var(--v2-ink); border-color: var(--v2-accent); }
+.hx-badges { display: inline-flex; align-items: center; gap: 6px; flex: none; }
+.hx-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: var(--v2-row, #f3f2f0);
+ font-family: var(--v2-mono); font-size: 11px; color: var(--v2-sec); font-variant-numeric: tabular-nums; white-space: nowrap; }
+.hx-badge iconify-icon { font-size: 12px; color: var(--v2-cap); }
+.hx-head-actions { flex: none; display: flex; gap: 8px; }
+.hx-primary { font: inherit; font-size: 13.5px; font-weight: 600; padding: 10px 16px; border: 0; border-radius: 8px; background: var(--v2-accent); color: #fff; cursor: pointer; }
+.hx-primary:hover { background: var(--v2-accent-hover, #1447c4); }
+.hx-head-actions .hx-secondary, .hx-secondary { font: inherit; font-size: 13px; font-weight: 500; line-height: normal; padding: 8px 14px; border: 1px solid #e0dcd9; border-radius: 8px; background: #fff; color: var(--v2-body); cursor: pointer; }
+.hx-secondary:hover { border-color: var(--v2-cap); }
+.hx-secondary { font: inherit; font-size: 13px; font-weight: 500; padding: 9px 14px; border: 1px solid #e0dcd9; border-radius: 8px; background: #fff; color: var(--v2-body); cursor: pointer; }
+.hx-secondary:hover { border-color: var(--v2-cap); }
+.hx-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 28px 30px; }
+.hx-body.is-chat { padding: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--v2-bg); }
+.hx-empty-main { padding: 34px 20px; text-align: center; font-size: 13.5px; color: var(--v2-sec); line-height: 1.6; }
+
+/* The embedded task conversation fills the body; the Tasks page card chrome is gone. */
+.hx-body.is-chat .run-layout.is-embedded { height: 100%; max-height: none; min-height: 0; border: 0; border-radius: 0; grid-template-columns: minmax(0, 1fr); }
+.hx-body.is-chat .run-layout.is-embedded .task-detail-shell { padding: 0 28px; }
+.hx-body.is-chat .run-layout.is-embedded .task-detail-shell .tabs { margin: 14px 0 0; }
+/* The embedded settings drop the page frame: no back link, no detail header, the host has both. */
+#view-harness.is-embedded .page { padding: 0; max-width: none; }
+
+/* The index table. */
+.hx-index-note { font-family: var(--v2-mono); font-size: 11px; color: var(--v2-cap); margin: 0 0 12px 2px; }
+.hx-card { border: 1px solid var(--v2-line); border-radius: 10px; background: #fff; overflow: hidden; }
+.hx-thead, .hx-row { display: grid; grid-template-columns: minmax(200px, 1.6fr) 118px 92px 150px 56px 68px 62px 70px 84px 14px; align-items: center; gap: 14px; padding: 12px 20px; }
+.hx-thead { padding: 11px 20px; background: var(--v2-bg); border-bottom: 1px solid var(--v2-line); font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); }
+.hx-row { width: 100%; border: 0; border-bottom: 1px solid #f4f2f0; background: #fff; cursor: pointer; font: inherit; text-align: left; color: inherit; }
+.hx-row:last-child { border-bottom: 0; }
+.hx-row:hover { background: var(--v2-bg); }
+.hx-row-name { min-width: 0; }
+.hx-row-name b { display: block; font-size: 13.5px; font-weight: 600; color: var(--v2-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-row-name small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--v2-cap); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-row-id { min-width: 0; display: flex; font-family: var(--v2-mono); font-size: 11.5px; color: var(--v2-sec); }
+.hx-row-id .mono-id { max-width: 100%; }
+.hx-health { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--v2-green); }
+.hx-health i { width: 6px; height: 6px; border-radius: 50%; background: var(--v2-green); flex: none; }
+.hx-health.is-idle { color: var(--v2-cap); } .hx-health.is-idle i { background: #c4beba; }
+.hx-health.is-degraded { color: var(--v2-orange); } .hx-health.is-degraded i { background: var(--v2-orange); }
+.hx-row-rt { display: flex; align-items: center; gap: 8px; min-width: 0; }
+.hx-row-rt > span { min-width: 0; display: flex; flex-direction: column; }
+.hx-row-rt b { font-size: 12.5px; font-weight: 600; color: var(--v2-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-row-rt small { font-family: var(--v2-mono); font-size: 10.5px; color: var(--v2-cap); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-num { font-family: var(--v2-mono); font-size: 12.5px; color: var(--v2-body); font-variant-numeric: tabular-nums; }
+.hx-num.is-bad { color: var(--v2-orange); }
+.hx-row-chev { color: var(--v2-cap); }
+
+/* Add harness sheet extras (on the keys page's sheet). */
+.hx-add { width: 560px; }
+.hx-add-help { font-size: 12px; color: var(--v2-cap); margin-top: 7px; line-height: 1.5; }
+.hx-bases { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
+.hx-base { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid #eceae9; border-radius: 8px; background: #fff;
+ cursor: pointer; font: inherit; text-align: left; color: var(--v2-ink); }
+.hx-base.is-on { background: var(--v2-tint); border-color: var(--v2-tint-border); }
+.hx-base-copy { min-width: 0; display: flex; flex-direction: column; }
+.hx-base-copy b { font-size: 13.5px; font-weight: 600; } .hx-base.is-on .hx-base-copy b { color: var(--v2-accent); }
+.hx-base-copy small { font-size: 11.5px; line-height: 1.45; color: var(--v2-cap); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
+.hx-base-def { font-family: var(--v2-mono); font-size: 11px; color: var(--v2-cap); flex: none; }
+.hx-add-select { width: 100%; font: inherit; font-size: 14px; padding: 10px 38px 10px 12px; border: 1px solid #e0dcd9; border-radius: 8px; color: var(--v2-ink); appearance: none; -webkit-appearance: none;
+ background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6560' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 12px center; }
+.hx-add-next { flex: 1; font-size: 12px; color: var(--v2-cap); }
+
+/* The nav's image icon sits like an iconify glyph. */
+.v2-item .v2-item-img { width: 16px; height: 16px; flex: none; object-fit: contain; opacity: .9; }
+.v2-item[aria-current='page'] .v2-item-img { opacity: 1; }
+
+/* The table sheds columns by the width it actually has (the main area, which depends on the nav
+ and the panel), never by the viewport: container queries on the index wrap. */
+.hx-index-wrap { container-type: inline-size; }
+@container (max-width: 1040px) {
+ .hx-thead, .hx-row { grid-template-columns: minmax(170px, 1.6fr) 92px 130px 56px 68px 62px 70px 78px 14px; gap: 12px; }
+ .hx-th-id { display: none; }
+}
+@container (max-width: 900px) {
+ .hx-thead, .hx-row { grid-template-columns: minmax(170px, 1.6fr) 92px 130px 56px 68px 62px 70px 14px; }
+ .hx-th-last { display: none; }
+}
+@container (max-width: 780px) {
+ .hx-thead, .hx-row { grid-template-columns: minmax(160px, 1.6fr) 92px 56px 68px 62px 70px 14px; }
+ .hx-th-rt { display: none; }
+}
+@container (max-width: 620px) {
+ .hx-thead, .hx-row { grid-template-columns: minmax(140px, 1.6fr) 92px 56px 68px 14px; gap: 10px; }
+ .hx-th-p95, .hx-th-cpt { display: none; }
+}
+@container (max-width: 440px) {
+ .hx-thead, .hx-row { grid-template-columns: minmax(120px, 1fr) 84px 44px 14px; padding-left: 14px; padding-right: 14px; }
+ .hx-th-success { display: none; }
+}
+.hx-icbtn { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #e0dcd9; border-radius: 8px; background: #fff; color: var(--v2-body); cursor: pointer; font-size: 15px; }
+.hx-icbtn:hover { border-color: var(--v2-cap); color: var(--v2-ink); }
+@media (max-width: 1024px) {
+ .hx-side { width: 250px; }
+}
+@media (max-width: 820px) {
+ .hx-root { height: calc(100vh - 53px); }
+ .hx-root:not(.m-detail) .hx-main { display: none; }
+ .hx-root.m-detail .hx-side { display: none; }
+ .hx-side { width: 100%; border-right: 0; }
+ .hx-back { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 8px -6px; border: 0; background: none; color: var(--v2-sec); font: inherit; font-size: 13px; cursor: pointer; }
+ .hx-head { padding: 14px 16px 0; }
+ .hx-body { padding: 14px 16px 24px; }
+ .hx-ic { opacity: 1; }
+ .hx-add { width: 100%; }
+}
+
+/* A fresh task draft: the harness, named under its base's mark, above a centered composer. */
+.wbx-conv-main.is-hero { display: flex; flex-direction: column; justify-content: center; }
+.wbx-conv-main.is-hero .wbx-conv-msgs { flex: 0 0 auto; padding: 0 0 6px; overflow: visible; align-items: center; }
+.wbx-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 24px; }
+.wbx-hero h1 { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--v2-ink); min-width: 0; }
+.wbx-hero h1 span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.wbx-conv-main.is-hero .wbx-composer { margin: 0 auto; }
+/* One measure for the whole conversation: the message rows and the composer share a 760px
+ column, centered, whether the thread is a fresh draft or long. The scroll container itself
+ stays full width so the scrollbar sits at the pane edge; each row centers inside it. Rows
+ inset their text 16px so it lines up with the text inside the composer's frame. */
+.wbx-conv-main .wbx-composer { width: min(780px, calc(100% - 56px)); margin: 10px auto 20px; }
+.wbx-conv-msgs { --uic-turn-pad-x: 0px; padding: 24px 0 12px; gap: 20px; }
+.wbx-conv-msgs > * { box-sizing: border-box; width: min(780px, calc(100% - 56px)); margin-left: auto; margin-right: auto; }
+@media (max-width: 768px) {
+ .wbx-hero h1 { font-size: 22px; }
+ .wbx-conv-main .wbx-composer, .wbx-conv-msgs > * { width: calc(100% - 24px); }
+}
+
+/* ── Arena v2: hero-to-run layout, full-bleed ─────────────────────────────────────────────────
+ First principles on sizing: the page owns the full space right of the nav (no .page gutters,
+ no max-height card) — .v2-main supplies the left margin that tracks the rail, and this root
+ fills the rest, so collapsing the sidebar simply gives the columns more room. */
+.ar2-root { display: flex; height: 100vh; min-width: 0; background: var(--v2-bg); }
+
+.ar2-side { width: 250px; flex: none; background: #fff; border-right: 1px solid var(--v2-line);
+ display: flex; flex-direction: column; min-height: 0; }
+.ar2-side-head { display: flex; gap: 8px; padding: 10px; border-bottom: 1px solid var(--v2-div); }
+/* SearchField (reifyui) sized to fill the header row */
+.ar2-search { flex: 1; min-width: 0; height: 32px; }
+.ar2-search input { width: 100%; font-size: 13px; }
+.ar2-new { flex: none; width: 32px; border: 1px solid #e0dcd9; border-radius: 8px; background: #fff;
+ color: var(--v2-body); cursor: pointer; display: grid; place-items: center; font-size: 15px; }
+.ar2-new:hover { border-color: var(--v2-tint-border); color: var(--v2-accent); }
+.ar2-side-scroll { flex: 1; overflow-y: auto; min-height: 0; }
+.ar2-foreign { margin: 10px 10px 4px; padding: 9px 11px; border: 1px solid #f0e2d4; border-radius: 8px; background: #fdf9f4;
+ color: #8a6a3c; font-size: 12px; line-height: 1.5; }
+.ar2-foreign b { font-weight: 600; }
+.ar2-foreign button { display: block; margin-top: 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 12px;
+ color: var(--v2-accent); cursor: pointer; }
+.ar2-foreign button:hover { text-decoration: underline; }
+/* Flat rows, no card margins: the list IS the panel. */
+.ar2-row { position: relative; display: flex; flex-direction: column; gap: 2px;
+ padding: 10px 12px; border-bottom: 1px solid var(--v2-row); }
+.ar2-row.active { background: var(--v2-tint); box-shadow: inset 2.5px 0 0 var(--v2-accent); }
+.ar2-row-hit { position: absolute; inset: 0; border: 0; background: none; cursor: pointer; }
+.ar2-row-name { font-size: 13.5px; font-weight: 600; color: var(--v2-ink);
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 22px; pointer-events: none; }
+.ar2-row-meta { font-family: var(--v2-mono); font-size: 11px; color: var(--v2-cap); pointer-events: none; }
+.ar2-row-del { position: absolute; right: 6px; top: 8px; display: none; border: 0; background: none;
+ color: var(--v2-cap); cursor: pointer; padding: 4px; border-radius: 6px; }
+.ar2-row:hover .ar2-row-del, .ar2-row-del:focus-visible { display: inline-flex; }
+.ar2-row-del:hover { color: var(--v2-orange); background: #fff; }
+
+.ar2-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; position: relative; }
+.ar2-back { display: none; }
+
+/* HERO: dead-center composer with the route list under it. */
+.ar2-hero { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column;
+ align-items: center; justify-content: center; padding: 32px 24px; }
+.ar2-hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 22px; text-align: center; }
+/* THE chat box — one card for both states (task on top, tray below, per the design). */
+/* One width in both states: a reading-width box, centered, so a long route list wraps inside it
+ instead of stretching the box across a wide screen. */
+.ar2-box { width: min(760px, 100%); margin: 0 auto; background: #fff; border: 1px solid var(--v2-line);
+ border-radius: 20px; box-shadow: 0 10px 34px rgba(28,25,23,.07); overflow: hidden; }
+/* One inset for everything in the box: the + button, the text, and the route chips under them
+ all start on the same left edge, 10px in. The tray gets its own breathing room above. */
+.ar2-box .wbx-composer, .ar2-box .uic-composer { border: 0; box-shadow: none; border-radius: 0; margin: 0; max-width: none;
+ padding: 8px 10px 10px; }
+.ar2-box .uic-composer-line { padding: 0; }
+.ar2-box .uic-composer-tray { margin-top: 8px; padding: 0; }
+
+/* A route chip: harness, then its model in mono, then a chevron that says "this opens". The whole
+ chip is the press target for the model menu; the ✕ stays its own control. */
+.ar2-route-model { font-family: var(--v2-mono); font-size: 11.5px; color: var(--v2-sec);
+ min-width: 0; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ar2-route-chev { font-size: 13px; color: var(--v2-cap); align-self: center; line-height: 0; }
+.ar2-chip.is-menu-open { border-color: var(--v2-accent); }
+.ar2-chip:disabled { opacity: .5; cursor: default; }
+.ar2-chip:disabled:hover { border-color: var(--v2-line); color: var(--v2-sec); }
+.ar2-chip .uic-chip-press:hover .ar2-route-model, .ar2-chip .uic-chip-press:hover .ar2-route-chev { color: inherit; }
+
+/* RUN: columns fill everything above the bottom composer.
+ Sizing is one rule, not a media matrix: every column is `flex: 1 1 0` with a minimum width.
+ While N × min + gaps fits the row, flex shares the width evenly (one column takes it all);
+ past that, min-width stops the shrink and the row scrolls sideways at exactly min each.
+ The gutters are margins on the first and last column rather than padding on the scroller,
+ because a scroller's end padding is not part of its scrollable overflow in every engine. */
+.ar2-cols { flex: 1; min-height: 0; display: flex; gap: 10px; padding: 12px 0 8px;
+ overflow-x: auto; overflow-y: hidden; }
+.ar2-cols[hidden] { display: none; }
+.ar2-cols .arena-col { flex: 1 1 0; min-width: 400px; height: 100%;
+ margin: 0; display: flex; flex-direction: column; min-height: 0; }
+.ar2-cols .arena-col:first-child { margin-left: 12px; }
+.ar2-cols .arena-col:last-child { margin-right: 12px; }
+
+.ar2-bottom { flex: none; padding: 6px 12px 12px; background: var(--v2-bg); }
+.ar2-bottom .ar2-box { box-shadow: 0 4px 18px rgba(28,25,23,.06); }
+
+/* Tablet: narrower history. */
+@media (max-width: 1024px) {
+ .ar2-side { width: 220px; }
+ .ar2-cols .arena-col { min-width: 340px; }
+}
+/* Phone: list and detail alternate, same as Tasks; the root sits under the mobile top bar. */
+@media (max-width: 768px) {
+ .ar2-root { height: calc(100vh - 53px); }
+ .ar2-root:not(.m-detail) .ar2-main { display: none; }
+ .ar2-root.m-detail .ar2-side { display: none; }
+ .ar2-side { width: 100%; border-right: 0; }
+ .ar2-back { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start;
+ margin: 8px 12px 0; border: 0; background: none; color: var(--v2-sec); font-size: 13px; cursor: pointer; }
+ .ar2-cols { padding: 8px 0 6px; gap: 8px; }
+ .ar2-cols .arena-col { min-width: 86vw; }
+ .ar2-cols .arena-col:first-child { margin-left: 8px; }
+ .ar2-cols .arena-col:last-child { margin-right: 8px; }
+ .ar2-bottom { padding: 6px 8px 10px; }
+ .ar2-hero h1 { font-size: 22px; }
+}
+
+/* ── the task composer: the Arena box and layout (attach square left, Send pill right, the route
+ chip in the tray) so the two chat surfaces are one thing ── */
+.run-layout.is-embedded .wbx-composer { padding: 14px 16px; background: #fff; border: 1px solid var(--v2-line); border-radius: 20px; box-shadow: 0 10px 34px rgba(28,25,23,.07); overflow: hidden; }
+.run-layout.is-embedded .uic-composer-line { padding: 0; }
+.run-layout.is-embedded .uic-composer-tray { margin-top: 8px; padding: 0; }
+.run-layout.is-embedded .wbx-attach-row.in-composer { margin: 0 0 10px; }
+.wbx-model-pop { background: #fff; border: 1px solid var(--v2-line); border-radius: 10px; padding: 6px; box-shadow: 0 -14px 36px -16px rgba(28, 25, 23, .3); }
+.wbx-model-head { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); padding: 6px 10px 5px; }
+.wbx-model-opt { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; padding: 8px 10px; background: transparent; border: 0; border-radius: 6px; cursor: pointer; text-align: left; font: inherit; font-size: 13.5px; color: var(--v2-ink); }
+.wbx-model-opt:hover { background: #f5f5f4; }
+.wbx-model-opt.is-on { color: var(--v2-accent); font-weight: 600; }
+.wbx-model-opt:disabled { color: var(--v2-cap); cursor: default; }
+.wbx-model-meta { font-family: var(--v2-mono); font-size: 10.5px; color: var(--v2-cap); }
+
+/* the community marks above the account row (expanded sidebar only) */
+.v2-socials { display: flex; align-items: center; gap: 2px; padding: 0 8px 4px; }
+.v2-social { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; color: var(--v2-cap); font-size: 16px; text-decoration: none; }
+.v2-social:hover { background: var(--v2-row); color: var(--v2-ink); }
+
+/* ── Quickstart, per the design: four steps on a rail ── */
+.qs { display: flex; flex-direction: column; min-height: 100%; }
+.qs-head { padding: 30px 36px 18px; background: #fff; border-bottom: 1px solid var(--v2-line); }
+.qs-head h1 { margin: 0 0 8px; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--v2-ink); }
+.qs-head p { margin: 0; font-size: 14px; color: var(--v2-sec); max-width: 640px; }
+.qs-progress { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
+.qs-progress-label { font-family: var(--v2-mono); font-size: 11.5px; color: var(--v2-sec); }
+.qs-bar { flex: 1; height: 4px; border-radius: 2px; background: #f0eeec; overflow: hidden; max-width: 260px; }
+.qs-bar-fill { display: block; height: 100%; background: var(--v2-accent); transition: width 160ms; }
+.qs-bar-fill.is-done { background: #15803d; }
+.qs-reset { background: transparent; border: 0; padding: 0; cursor: pointer; font-family: var(--v2-mono); font-size: 11px; color: var(--v2-cap); }
+.qs-reset:hover { color: var(--v2-ink); }
+.qs-body { flex: 1; min-height: 0; padding: 24px 36px 34px; }
+.qs-grid { display: grid; grid-template-columns: 44px 1fr; column-gap: 0; }
+.qs-railcell { position: relative; }
+.qs-rail { position: absolute; left: 12.5px; top: 22px; bottom: -14px; width: 1.5px; background: #f0eeec; }
+.qs-marker { position: absolute; left: 0; top: 22px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-family: var(--v2-mono); font-size: 11px; font-weight: 600; background: var(--v2-accent); color: #fff; }
+.qs-marker.is-done { background: #15803d; }
+.qs-card { padding: 22px 24px 24px; margin-bottom: 14px; border: 1px solid var(--v2-line); border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(28, 25, 23, .05); min-width: 0; }
+.qs-card.is-done { border-color: #dfe6dd; box-shadow: none; }
+.qs-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
+.qs-title { font-size: 16px; font-weight: 600; color: var(--v2-ink); }
+.qs-sub { font-size: 13.5px; color: var(--v2-sec); margin-top: 5px; max-width: 560px; }
+.qs-link { font-size: 12.5px; flex: none; color: var(--v2-accent); }
+.qs-doc { margin-top: 16px; border: 1px solid var(--v2-line); border-radius: 8px; background: var(--v2-bg); overflow: hidden; }
+.qs-doc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid #f0eeec; }
+.qs-doc-name { font-family: var(--v2-mono); font-size: 10.5px; letter-spacing: .1em; color: var(--v2-cap); }
+.qs-doc-meta { font-family: var(--v2-mono); font-size: 10.5px; color: #c4beba; }
+.qs-doc-body { margin: 0; padding: 14px 16px; font-family: var(--v2-mono); font-size: 12px; line-height: 1.7; color: var(--v2-body); white-space: pre-wrap; overflow-wrap: anywhere; }
+.qs-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
+.qs-copy { font: inherit; font-size: 13.5px; font-weight: 600; padding: 11px 18px; border: 0; border-radius: 8px; cursor: pointer; background: var(--v2-accent); color: #fff; }
+.qs-copy:hover { background: var(--v2-accent-hover, #1447c4); }
+.qs-copy.is-done { background: #eaf5ee; color: #15803d; }
+.qs-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
+.qs-chip { display: flex; align-items: center; gap: 7px; font: inherit; font-size: 12.5px; font-weight: 500; padding: 6px 12px 6px 7px; border-radius: 999px; cursor: pointer; border: 1px solid var(--v2-line); background: #fff; color: var(--v2-sec); }
+.qs-chip.is-on { font-weight: 600; border-color: #c9d5f7; background: var(--v2-tint); color: var(--v2-ink); }
+.qs-chip-mark { width: 17px; height: 17px; border-radius: 5px; flex: none; object-fit: contain; }
+.qs-confirm { margin-left: auto; font: inherit; font-size: 13px; font-weight: 500; padding: 10px 16px; border-radius: 8px; cursor: pointer; border: 1px solid #e0dcd9; background: transparent; color: var(--v2-body); }
+.qs-confirm:disabled { cursor: not-allowed; border-color: #f0eeec; color: var(--v2-cap); }
+.qs-confirm.is-done { border-color: #cfe4d6; background: #eaf5ee; color: #15803d; }
+.qs-kicker { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); margin: 16px 0 9px; }
+.qs-mock { border: 1px solid #e0dcd9; border-radius: 10px; background: #fff; padding: 14px; }
+.qs-mock-file { display: inline-flex; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid #f0eeec; border-radius: 8px; max-width: 100%; }
+.qs-mock-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; flex: none; background: var(--v2-tint); }
+.qs-mock-mark img { width: 18px; height: 18px; object-fit: contain; }
+.qs-mock-file-name { font-size: 13px; font-weight: 600; color: var(--v2-ink); }
+.qs-mock-file-meta { font-size: 11.5px; color: var(--v2-cap); margin-top: 2px; }
+.qs-mock-x { color: #c4beba; font-size: 13px; margin-left: 6px; }
+.qs-mock-prompt { font-size: 15px; line-height: 1.5; margin-top: 14px; color: var(--v2-ink); }
+.qs-mock-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
+.qs-mock-plus { color: #c4beba; font-size: 15px; }
+.qs-mock-badge { margin-left: auto; font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: #f5f5f4; color: var(--v2-sec); }
+.qs-mock-send { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--v2-ink); color: #fff; font-size: 14px; }
+.qs-keyrow { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
+.qs-keybtn { font: inherit; font-size: 13.5px; font-weight: 600; padding: 11px 18px; border-radius: 8px; cursor: pointer; border: 1px solid #e0dcd9; background: #fff; color: var(--v2-ink); }
+.qs-keybtn:hover { border-color: var(--v2-cap); }
+.qs-keybtn.is-done { border-color: #cfe4d6; background: #eaf5ee; color: #15803d; }
+.qs-keybtn:disabled { cursor: default; color: var(--v2-cap); }
+.qs-keynote { font-family: var(--v2-mono); font-size: 11.5px; color: var(--v2-cap); }
+.qs-err { margin: 10px 0 0; font-size: 12.5px; color: #b4460f; }
+.qs-reveal { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid #e0dcd9; border-radius: 8px; background: var(--v2-bg); }
+.qs-reveal code { flex: 1; min-width: 0; font-family: var(--v2-mono); font-size: 13px; color: var(--v2-ink); overflow-wrap: anywhere; }
+.qs-reveal .qs-confirm { margin-left: 0; flex: none; }
+.qs-warn { display: flex; gap: 11px; margin-top: 14px; padding: 13px 15px; border: 1px solid #f0e2d4; border-radius: 8px; background: #fdf9f4; }
+.qs-warn > span:first-child { color: #b4460f; font-size: 13px; line-height: 1.5; flex: none; }
+.qs-warn > span:last-child { font-size: 12.5px; line-height: 1.6; color: #8a6a3c; }
+.qs-flow { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 18px 20px; border: 1px solid #c9d5f7; border-radius: 10px; background: var(--v2-tint); }
+.qs-flow-box { flex: 1; min-width: 0; padding: 14px 16px; border: 1px solid var(--v2-line); border-radius: 8px; background: #fff; font-size: 13.5px; font-weight: 500; text-align: center; color: var(--v2-ink); }
+.qs-flow-box.is-cloud { border-color: #c9d5f7; font-weight: 600; color: var(--v2-accent); }
+.qs-flow-arrow { color: var(--v2-accent); font-size: 15px; flex: none; }
+.qs-flow-note { font-size: 12.5px; color: var(--v2-cap); margin-top: 9px; }
+.qs-actions-last { gap: 14px; margin-top: 18px; }
+.qs-open { font-size: 13.5px; font-weight: 600; padding: 12px 20px; border-radius: 8px; background: var(--v2-accent); color: #fff; text-decoration: none; }
+.qs-open:hover { background: var(--v2-accent-hover, #1447c4); }
+.qs-ce { font-size: 12.5px; color: var(--v2-cap); }
+.qs-done { margin-top: 26px; padding: 22px 24px; border: 1px solid #cfe4d6; border-radius: 10px; background: #fbfdfb; }
+.qs-done-kicker { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; color: var(--v2-cap); margin-bottom: 8px; }
+.qs-done-title { font-size: 17px; font-weight: 600; color: var(--v2-ink); }
+.qs-next { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
+.qs-next-card { display: flex; flex-direction: column; gap: 4px; min-width: 220px; padding: 14px 16px; text-align: left; background: #fff; border: 1px solid var(--v2-line); border-radius: 8px; text-decoration: none; color: inherit; }
+.qs-next-card:hover { border-color: var(--v2-accent); }
+.qs-next-title { font-size: 14px; font-weight: 600; color: var(--v2-ink); }
+.qs-next-body { font-size: 12.5px; color: var(--v2-sec); }
+.v2-item-badge { margin-left: auto; font-family: var(--v2-mono); font-size: 9.5px; font-weight: 600; min-width: 18px; text-align: center; padding: 2px 6px; border-radius: 999px; background: var(--v2-ink); color: #fff; }
+.v2-side.is-rail .v2-item-badge { display: none; }
+@media (max-width: 768px) {
+ .qs-head { padding: 20px 16px 14px; }
+ .qs-head h1 { font-size: 22px; }
+ .qs-body { padding: 16px 12px 24px; }
+ .qs-grid { grid-template-columns: 34px 1fr; }
+ .qs-marker { width: 22px; height: 22px; font-size: 10px; top: 20px; }
+ .qs-rail { left: 10.5px; }
+ .qs-card { padding: 16px 16px 18px; }
+ .qs-card-head { flex-direction: column; gap: 6px; }
+ .qs-confirm { margin-left: 0; width: 100%; }
+ .qs-flow { flex-direction: column; }
+ .qs-flow-box { width: 100%; box-sizing: border-box; }
+ .qs-flow-arrow { transform: rotate(90deg); }
+ .qs-next-card { min-width: 0; flex: 1 1 100%; }
+}
+
+/* ── active-work billing (v2) preview on Billing, staging only ── */
+.b2 { margin: 18px 0 22px; padding: 20px 22px 8px; border: 1px solid #c9d5f7; border-radius: 12px; background: #fff; }
+.b2-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
+.b2-kicker { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); }
+.b2-title { margin: 4px 0 0; font-size: 17px; font-weight: 600; color: var(--v2-ink); }
+.b2-pill { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; }
+.b2-pill.is-bad { background: rgba(180, 70, 15, .08); color: #b4460f; }
+.b2-wallets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
+.b2-wallet { padding: 14px 16px; border: 1px solid var(--v2-line); border-radius: 10px; background: var(--v2-bg); min-width: 0; }
+.b2-wallet-k { font-size: 12.5px; color: var(--v2-sec); }
+.b2-wallet-v { margin-top: 4px; font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--v2-ink); font-variant-numeric: tabular-nums; }
+.b2-wallet-s { margin-top: 3px; font-size: 12px; color: var(--v2-cap); }
+.b2-rate { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--v2-sec); }
+.b2-rate b { color: var(--v2-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
+.b2-rate span { font-family: var(--v2-mono); font-size: 10.5px; color: var(--v2-cap); }
+.b2-receipts { margin-top: 18px; overflow-x: auto; }
+.b2-th, .b2-tr { display: grid; grid-template-columns: minmax(180px, 1.6fr) repeat(5, minmax(88px, 1fr)); gap: 12px; align-items: center; padding: 9px 4px; min-width: 640px; }
+.b2-th { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); border-bottom: 1px solid var(--v2-line); }
+.b2-tr { border-bottom: 1px solid #f4f2f0; }
+.b2-tr:last-child { border-bottom: 0; }
+.b2-task b { display: block; font-family: var(--v2-mono); font-size: 12px; font-weight: 600; color: var(--v2-ink); }
+.b2-task small { display: block; font-size: 11.5px; color: var(--v2-cap); margin-top: 2px; }
+.b2-n { font-family: var(--v2-mono); font-size: 12px; color: var(--v2-body); font-variant-numeric: tabular-nums; }
+.b2-n small { display: block; font-size: 10.5px; color: var(--v2-cap); }
+.b2-n.is-total { font-weight: 600; color: var(--v2-ink); }
+.b2-empty { padding: 14px 4px; font-size: 13px; color: var(--v2-cap); }
+@media (max-width: 768px) { .b2-wallets { grid-template-columns: 1fr; } .b2 { padding: 16px 14px 6px; } }
+
+.b2-notice { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: #eaf5ee; color: #15803d; font-size: 13px; }
+.b2-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
+.b2-plans, .b2-prepaid, .b2-tracing { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
+.b2-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 9px 14px; border: 0; border-radius: 8px; background: var(--v2-accent); color: #fff; cursor: pointer; }
+.b2-btn:disabled { cursor: default; opacity: .55; }
+.b2-btn.is-current { background: #eaf5ee; color: #15803d; opacity: 1; }
+.b2-btn.is-secondary { background: #fff; color: var(--v2-body); border: 1px solid #e0dcd9; font-weight: 500; }
+.b2-btn.is-secondary:hover:not(:disabled) { border-color: var(--v2-cap); }
+.b2-link { font: inherit; font-size: 12.5px; background: none; border: 0; color: var(--v2-cap); cursor: pointer; text-decoration: underline; }
+.b2-amt { display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; border: 1px solid #e0dcd9; border-radius: 8px; background: #fff; font-size: 13px; color: var(--v2-cap); }
+.b2-amt input { width: 72px; border: 0; outline: 0; font: inherit; font-size: 13.5px; padding: 9px 0; color: var(--v2-ink); background: transparent; }
+.b2-fee { font-family: var(--v2-mono); font-size: 11px; color: var(--v2-cap); }
+.tc-gate { position: relative; min-height: 320px; overflow: hidden; }
+.tc-gate-blur { filter: blur(6px); pointer-events: none; user-select: none; opacity: .8; }
+.tc-gate-card { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); width: min(420px, calc(100% - 32px)); padding: 22px 24px; background: #fff; border: 1px solid var(--v2-line); border-radius: 12px; box-shadow: 0 10px 34px rgba(28, 25, 23, .1); text-align: center; }
+.tc-gate-kicker { font-family: var(--v2-mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--v2-cap); }
+.tc-gate-title { margin-top: 6px; font-size: 16px; font-weight: 600; color: var(--v2-ink); }
+.tc-gate-body { margin: 8px 0 14px; font-size: 13px; line-height: 1.55; color: var(--v2-sec); }
+.b2-notice.is-error { background: #fdf3ec; color: #b4460f; }
diff --git a/ui/src/components/ApiReference.tsx b/ui/src/components/ApiReference.tsx
index 4ba87959..7457ffba 100644
--- a/ui/src/components/ApiReference.tsx
+++ b/ui/src/components/ApiReference.tsx
@@ -76,7 +76,7 @@ export function ApiReference({ harnessId, additionalHeaders, model: modelIn }: {
</div>
<h3 className="apidoc-h3">Authentication</h3>
- <p className="hr-meta">Every request carries a per-org API key (mint one under API Keys) as a Bearer
+ <p className="hr-meta">Every request carries a per-org API key (mint one under API keys) as a Bearer
token. Keys are scoped to your organization; the harness is chosen by the path, the LLM by the
model field. Task runs use the per-agent form <code>/{'{harness_id}'}/v1/…</code>; management
routes (harness CRUD, secrets, sessions) are plain <code>/v1/…</code>. Wire all of this behind a
diff --git a/ui/src/components/ChatAttachments.tsx b/ui/src/components/ChatAttachments.tsx
new file mode 100644
index 00000000..89bd712f
--- /dev/null
+++ b/ui/src/components/ChatAttachments.tsx
@@ -0,0 +1,71 @@
+'use client';
+// The attachment and output-file cards a conversation renders.
+//
+// These live here because TWO surfaces show them — Tasks and Arena — and the second one grew its
+// own thinner versions instead of these: a text pill with an × where an image thumbnail belongs,
+// and a bare row where the output card belongs. One definition, so a column in an arena is the
+// same card as a task, because it is the same card.
+import React from 'react';
+import { FileTypeIcon } from '@/components/FileTypeIcon';
+import { containerFileUrl, downloadFile, type RespFile } from '@/lib/chat';
+
+const Svg = ({ s = 16, children }: { s?: number; children: React.ReactNode }) => (
+ <svg width={s} height={s} viewBox="0 0 24 24" fill="none" stroke="currentColor"
+ strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">{children}</svg>
+);
+export const IcDl = () => (
+ <Svg s={16}><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><path d="M7 10l5 5 5-5" /><path d="M12 15V3" /></Svg>
+);
+
+/** One attached input file: a thumbnail when it is an image, an icon card when it is not. */
+export function AttachCard({ name, dataUri, onRemove }: { name: string; dataUri?: string; onRemove?: () => void }) {
+ const ext = (name.split('.').pop() || '').toLowerCase();
+ const isImg = /^(png|jpe?g|gif|webp|bmp|svg|avif)$/.test(ext) && !!dataUri && dataUri.startsWith('data:image');
+ return (
+ <div className={'wbx-attach' + (isImg ? ' img' : '')}>
+ {onRemove && <button className="wbx-attach-x" title="Remove" onClick={onRemove}>×</button>}
+ {isImg
+ /* ph-no-capture: src is the uploaded file itself, inlined as a data URI. Attribute
+ masking already blanks it; blocking the element keeps the whole thing out. */
+ ? <img className="wbx-attach-thumb ph-no-capture" src={dataUri} alt={name} />
+ : <><span className="wbx-attach-ic"><FileTypeIcon name={name} size={26} /></span>
+ <span className="wbx-attach-meta"><span className="wbx-attach-name">{name}</span>
+ <span className="wbx-attach-ext">{ext.toUpperCase() || 'FILE'}</span></span></>}
+ </div>
+ );
+}
+
+/** The output files of one assistant turn, plus a zip-them-all row once there are several. */
+export function OutputFiles({ files, onPreview }: {
+ files: RespFile[]; onPreview: (p: { url: string; name: string }) => void;
+}) {
+ if (!files.length) return null;
+ const zipUrl = `/api/harness/v1/sessions/${encodeURIComponent(files[0].container_id)}`
+ + `/files/archive?files=${encodeURIComponent(files.map((f) => f.file_id).join(','))}`;
+ return (
+ <div className="wbx-files">
+ {files.map((f, j) => (
+ <div key={j} className="wbx-filecard"
+ onClick={() => onPreview({ url: containerFileUrl(f), name: f.filename })}>
+ <span className="wbx-filecard-ic"><FileTypeIcon name={f.filename} size={30} /></span>
+ <span className="wbx-filecard-meta">
+ <span className="wbx-filecard-name">{f.filename}</span>
+ <span className="wbx-filecard-sub">{(f.filename.split('.').pop() || 'file').toUpperCase()} · output</span>
+ </span>
+ {/* Authed download (LIVE-B): a bare href carries no session and is rejected. */}
+ <button className="wbx-filecard-dl" title="Download" type="button"
+ onClick={(e) => { e.stopPropagation(); downloadFile(containerFileUrl(f), f.filename).catch(() => undefined); }}><IcDl /></button>
+ <span className="wbx-filecard-open">Preview</span>
+ </div>
+ ))}
+ {/* One-click zip of THIS turn's outputs (folder hierarchy preserved inside the archive).
+ Only worth a row when there's more than one file. */}
+ {files.length > 1 && (
+ <button className="wbx-zipall" type="button"
+ onClick={(e) => { e.stopPropagation(); downloadFile(zipUrl, 'outputs.zip').catch(() => undefined); }}>
+ <IcDl /> Download all ({files.length}) as .zip
+ </button>
+ )}
+ </div>
+ );
+}
diff --git a/ui/src/components/HarnessEditors.tsx b/ui/src/components/HarnessEditors.tsx
index bc2a958e..a240a9a0 100644
--- a/ui/src/components/HarnessEditors.tsx
+++ b/ui/src/components/HarnessEditors.tsx
@@ -6,6 +6,8 @@
// Extracted from workbench/page.tsx (page files must not carry extra named exports).
import { useRef, useState } from 'react';
import { testMcp, storeMcpSecret, type McpServer } from '@/lib/harness';
+// Re-exported: pages ported from the hosted console import the type from here.
+export type { McpServer };
import { Svg, Chevron, IcSkill } from 'reifyui';
const IcTrash = () => <Svg s={15}><path d="M3 6h18M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6" /></Svg>;
@@ -389,7 +391,7 @@ export function McpModal({ server, declaredHeaders = [], onClose, onSave }: {
<h1>{server ? 'Edit MCP server' : 'Add MCP server'}</h1>
<p className="sub">Connect a remote MCP server (a set of tools) by endpoint and an optional bearer token. Tokens are encrypted at rest and never shown again.</p>
<div className="hr-field"><label>Name</label>
- <input value={name} autoFocus onChange={(e) => setName(e.target.value)} placeholder="stanford-sis" /></div>
+ <input value={name} autoFocus onChange={(e) => setName(e.target.value)} placeholder="docs-search" /></div>
<div className="hr-field"><label>Endpoint URL</label>
<input value={url} onChange={(e) => setUrl(e.target.value)} placeholder="https://…/mcp" /></div>
<div className="hr-field">
diff --git a/ui/src/components/HarnessSettings.tsx b/ui/src/components/HarnessSettings.tsx
new file mode 100644
index 00000000..fbf5c256
--- /dev/null
+++ b/ui/src/components/HarnessSettings.tsx
@@ -0,0 +1,412 @@
+'use client';
+// Harness Settings, the ONE place persistent harness configuration is edited (per the 2026-07-17
+// IA review): General → Default model → Agent instructions → Tools → Skills → Runtime limits →
+// Request headers, one Save. Built-in harnesses render read-only with a Clone action.
+// Reuses the battle-tested SkillEditor + McpModal from the workbench.
+import { useEffect, useMemo, useState } from 'react';
+import { SkelPage } from '@/components/Skel';
+import { useRouter } from 'next/navigation';
+import {
+ OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, modelAvailable, useBases, getCustom, saveCustom, deleteCustom, createCustom, getSkillFiles, storeMcpSecret,
+ type CustomHarness, type OobHarness,
+} from '@/lib/harness';
+import { HarnessLogo } from '@/components/HarnessLogo';
+import { CopyId } from '@/components/CopyId';
+import { SkillEditor, McpModal, type McpServer } from '@/components/HarnessEditors';
+import { fetchTraceWindow, statsFor, p95Of, avgCreditsOf, type TraceCard } from '@/lib/revamp-data';
+
+type Skill = CustomHarness['skills'][number];
+const isOwnSkill = (s: Skill) => Boolean((s.files && s.files.length) || (s as { content?: string }).content || s.blob);
+
+/** Harness settings. `embedded`: rendered inside the Agent harnesses page, which owns the title
+ * row and the way back; navigation asks the host instead of pushing routes. */
+export function HarnessSettings({ id, embedded = false, onNavigate }: {
+ id: string; embedded?: boolean; onNavigate?: (to: 'tasks' | 'list') => void;
+}) {
+ const router = useRouter();
+ const go = (to: 'tasks' | 'list') => {
+ if (onNavigate) onNavigate(to);
+ else router.push(to === 'tasks' ? `/harnesses?h=${encodeURIComponent(id)}` : '/harnesses');
+ };
+ const oob = oobById(id);
+ const [saved, setSaved] = useState<CustomHarness | null>(null);
+ const [draft, setDraft] = useState<CustomHarness | null>(null);
+ const [loaded, setLoaded] = useState(false);
+ const [busy, setBusy] = useState(false);
+ const [err, setErr] = useState<string | null>(null);
+ const [editSkillIdx, setEditSkillIdx] = useState<number | null>(null);
+ const [mcpModal, setMcpModal] = useState<{ idx: number | null } | null>(null);
+ const [confirmDelete, setConfirmDelete] = useState(false);
+ // Draft of a NEW skill being created in the SkillEditor popup (name edited in the same popup).
+ const [newSkill, setNewSkill] = useState<{ name: string } | null>(null);
+ const [cards, setCards] = useState<TraceCard[]>([]);
+
+ useEffect(() => {
+ let alive = true;
+ fetchTraceWindow(id).then((cs) => { if (alive) setCards(cs); }).catch(() => { /* metrics show dashes */ });
+ return () => { alive = false; };
+ }, [id]);
+
+ useEffect(() => {
+ if (oob) { setLoaded(true); return; }
+ let alive = true;
+ getCustom(id).then((c) => { if (alive) { setSaved(c); setDraft(c); setLoaded(true); } });
+ return () => { alive = false; };
+ }, [id, oob]);
+
+ const dirty = useMemo(() => JSON.stringify(draft) !== JSON.stringify(saved), [draft, saved]);
+ useModelCatalog(); // model list comes from the gateway, not a local copy
+ const base = oob || oobById(draft?.base || '') || null;
+ // Capabilities come from the server, never from the static table: it once advertised four
+ // built-in skills that existed nowhere, with controls beside them that acted on nothing.
+ const bases = useBases();
+ const srvBase = bases?.[base?.id || draft?.base || ''] || null;
+ const baseTools = srvBase?.tools || [];
+ const models = oobModels(base);
+ const upd = (p: Partial<CustomHarness>) => setDraft((d) => (d ? { ...d, ...p } : d));
+
+ async function save() {
+ if (!draft || busy) return;
+ setBusy(true); setErr(null);
+ try {
+ const s = await saveCustom(draft);
+ setSaved(s); setDraft(s);
+ // After a successful save, jump to Tasks with THIS harness selected so the user can
+ // immediately run a task on the config they just changed.
+ go('tasks');
+ }
+ catch (e) { setErr(e instanceof Error ? e.message : String(e)); }
+ finally { setBusy(false); }
+ }
+
+ async function openSkillEditor(idx: number) {
+ if (!draft) return;
+ const s = draft.skills[idx];
+ if (!(s.files && s.files.length) && s.blob) {
+ try {
+ const files = await getSkillFiles(draft.id, s.id || s.name);
+ upd({ skills: draft.skills.map((x, k) => (k === idx ? { ...x, files } : x)) });
+ } catch { setErr('Could not load the skill folder, try again.'); return; }
+ }
+ setEditSkillIdx(idx);
+ }
+
+ if (!loaded) return <section className="view is-active" id="view-harness"><SkelPage /></section>;
+ if (!oob && !draft) return <section className="view is-active"><div className="page"><div className="session-empty">Harness not found.</div></div></section>;
+
+ const name = oob ? oob.name : draft!.name;
+ const readOnly = Boolean(oob);
+ const skills = draft?.skills || [];
+ const ownSkills = skills.map((s, idx) => ({ s, idx })).filter(({ s }) => isOwnSkill(s));
+ // Built-ins the harness has not replaced with one of its own. A built-in is implicit: the
+ // harness stores an entry only when its answer differs from the image's default.
+ const baseSkills = (srvBase?.builtinSkills || []).filter((b) => !ownSkills.some(({ s }) => s.name === b.name));
+ const disabledTools = new Set(draft?.disabledTools || []);
+
+ const stats = statsFor(cards);
+ const degraded = stats.success != null && stats.success < 0.9 && stats.tasks7d >= 3;
+ const p95 = p95Of(cards);
+ const creditsPerTask = avgCreditsOf(cards);
+
+ return (
+ <section className={'view is-active' + (embedded ? ' is-embedded' : '')} id="view-harness">
+ <div className="page">
+ {!embedded && (
+ <div className="page-header detail-context">
+ <div>
+ <button className="back-link" type="button" onClick={() => go('list')}><iconify-icon icon="tabler:arrow-left"></iconify-icon><span>Harnesses</span></button>
+ <div className="detail-header">
+ <span className="detail-icon"><HarnessLogo id={(base?.id || draft?.base || '')} size={26} /></span>
+ <div className="detail-title"><h1>{name}</h1>
+ <p><span className={'status ' + (degraded ? 'warning' : 'healthy')}>{degraded ? 'Needs review' : 'Connected and healthy'}</span> · Base Harness: {base?.name || draft?.baseLabel}{readOnly ? ' · built-in' : ''}</p></div>
+ </div>
+ </div>
+ </div>
+ )}
+
+ <div className="detail-metrics" aria-label="Selected Harness metrics">
+ <div className="detail-metric"><span>Success rate</span><strong>{stats.success != null ? `${(stats.success * 100).toFixed(1)}%` : '—'}</strong><small>Last 7 days</small></div>
+ <button className="detail-metric" type="button" onClick={() => go('tasks')}>
+ <span>Tasks</span><strong>{stats.tasks7d.toLocaleString()}</strong><small>Last 7 days</small></button>
+ <div className="detail-metric"><span>p95 duration</span><strong>{p95 ?? '—'}</strong><small>Recent tasks</small></div>
+ <div className="detail-metric"><span>Credits / Task</span><strong>{creditsPerTask ?? '—'}</strong><small>Avg over priced runs</small></div>
+ </div>
+
+ <form className="settings-form" onSubmit={(e) => { e.preventDefault(); void save(); }}>
+ <div className="settings-form-head">
+ <div><h2>Harness Settings</h2><p>Configure the instructions, capabilities, and execution limits inherited by every Task on this Harness.</p></div>
+ <div className="header-actions"><span className="save-state">{readOnly ? 'Built-in · read-only' : dirty ? 'Unsaved changes' : 'No unsaved changes'}</span></div>
+ </div>
+
+ <section className="form-section">
+ <div><h3>General</h3><p>Name this reusable agent configuration and review its runtime foundation.</p></div>
+ <div className="field-stack">
+ <div className="field"><label htmlFor="hsName">Name</label>
+ <input id="hsName" value={name} disabled={readOnly} onChange={(e) => upd({ name: e.target.value })} /></div>
+ <div className="field"><label>Base Harness</label>
+ <div className="inline-value"><span>{base?.name || draft?.baseLabel || '—'}</span><span className="status healthy">Connected</span></div>
+ <span className="field-help">The Base Harness defines compatible capabilities and cannot be changed after creation.</span></div>
+ <div className="field"><label>Harness ID</label>
+ <CopyId value={id} />
+ <span className="field-help">Address this Harness from the API with this ID.</span></div>
+ </div>
+ </section>
+
+ <section className="form-section">
+ <div><h3>Default model</h3><p>The model used when a Task does not choose an override.</p></div>
+ <div className="field-stack">
+ <div className="field"><label htmlFor="hsModel">Model</label>
+ <select id="hsModel" disabled={readOnly} value={oob ? oobDefaultModel(oob) : (draft?.defaultModel || oobDefaultModel(oobById(draft?.base || '')) || '')}
+ onChange={(e) => upd({ defaultModel: e.target.value })}>
+ {models.map((m) => (
+ <option key={m} value={m} disabled={!modelAvailable((oob?.backend || oobById(draft?.base || '')?.backend) || '', m)}>
+ {m}{modelAvailable((oob?.backend || oobById(draft?.base || '')?.backend) || '', m) ? '' : ' (no provider)'}
+ </option>
+ ))}
+ </select>
+ <span className="field-help">Tasks may choose another compatible model at runtime.</span></div>
+ </div>
+ </section>
+
+ <section className="form-section">
+ <div><h3>Agent instructions</h3><p>Persistent role, conventions, constraints, and output contract loaded on every Task.</p></div>
+ <div className="field-stack">
+ <div className="field"><label htmlFor="hsInstructions">{['codex', 'hermes'].includes(base?.id || draft?.base || '') ? 'AGENTS.md' : 'CLAUDE.md'}</label>
+ <textarea id="hsInstructions" rows={7} disabled={readOnly}
+ value={oob ? oob.systemPrompt : (draft?.systemPrompt || '')}
+ onChange={(e) => upd({ systemPrompt: e.target.value })} />
+ <span className="field-help">These Harness-specific instructions are loaded every turn; the Base Harness system prompt remains unchanged.</span></div>
+ </div>
+ </section>
+
+ <section className="form-section">
+ <div><h3>Tools</h3><p>Control inherited tools and add MCP servers for external capabilities.</p></div>
+ <div className="field-stack">
+ <div className="section-actions"><strong>{baseTools.length + (draft?.mcpServers?.length || 0)} configured tools</strong>
+ {!readOnly && <button className="button small" type="button" onClick={() => setMcpModal({ idx: null })}><iconify-icon icon="tabler:plus"></iconify-icon>Add MCP</button>}</div>
+ <div className="capability-list">
+ {baseTools.map((t) => (
+ <div key={t.name} className="capability-row">
+ <span className="capability-icon"><iconify-icon icon="tabler:plug"></iconify-icon></span>
+ <div className="capability-copy"><strong>{t.label}</strong>
+ <span>Built into {base?.name}
+ {t.enforcement === 'instruction' && ' · disabling asks the agent not to use it'}</span></div>
+ <div className="capability-actions">
+ <button className="toggle-button" type="button" disabled={readOnly} aria-pressed={!disabledTools.has(t.name)}
+ onClick={() => upd({ disabledTools: disabledTools.has(t.name) ? (draft?.disabledTools || []).filter((x) => x !== t.name) : [...(draft?.disabledTools || []), t.name] })}>
+ {disabledTools.has(t.name) ? 'Disabled' : 'Enabled'}</button>
+ </div>
+ </div>
+ ))}
+ {(draft?.mcpServers || []).map((m, idx) => (
+ <div key={m.id || idx} className="capability-row">
+ <span className="capability-icon"><iconify-icon icon="tabler:world-www"></iconify-icon></span>
+ <div className="capability-copy"><strong>{m.name}</strong><span>Custom MCP · {m.url || 'endpoint'}</span></div>
+ <div className="capability-actions">
+ <button className="button quiet small" type="button" onClick={() => setMcpModal({ idx })}>Edit</button>
+ <button className="button quiet small" type="button" onClick={() => upd({ mcpServers: (draft?.mcpServers || []).filter((_, k) => k !== idx) })}>Delete</button>
+ <button className="toggle-button" type="button" aria-pressed={m.enabled !== false}
+ onClick={() => upd({ mcpServers: (draft?.mcpServers || []).map((x, k) => (k === idx ? { ...x, enabled: !(x.enabled !== false) } : x)) })}>
+ {m.enabled !== false ? 'Enabled' : 'Disabled'}</button>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ </section>
+
+ <section className="form-section">
+ <div><h3>Skills</h3><p>Add Harness-specific workflows, replace inherited Skills, or disable capabilities this agent should not use.</p></div>
+ <div className="field-stack">
+ <div className="section-actions"><strong>{ownSkills.length + baseSkills.length} configured Skills</strong>
+ {!readOnly && <button className="button small" type="button" onClick={() => setNewSkill({ name: '' })}>
+ <iconify-icon icon="tabler:plus"></iconify-icon>Add Skill</button>}</div>
+ <div className="capability-list">
+ {ownSkills.map(({ s, idx }) => (
+ <div key={s.id || idx} className="capability-row">
+ <span className="capability-icon"><iconify-icon icon="tabler:sparkles"></iconify-icon></span>
+ <div className="capability-copy"><strong>{s.name}</strong><span>Custom Skill</span></div>
+ <div className="capability-actions">
+ <button className="button quiet small" type="button" onClick={() => void openSkillEditor(idx)}>Edit</button>
+ <button className="button quiet small" type="button" onClick={() => upd({ skills: skills.filter((_, k) => k !== idx) })}>Delete</button>
+ <button className="toggle-button" type="button" aria-pressed={s.enabled !== false}
+ onClick={() => upd({ skills: skills.map((x, k) => (k === idx ? { ...x, enabled: !(x.enabled !== false) } : x)) })}>
+ {s.enabled !== false ? 'Enabled' : 'Disabled'}</button>
+ </div>
+ </div>
+ ))}
+ {baseSkills.map((b) => {
+ const n = b.name;
+ const stored = skills.find((s) => s.name === n && !isOwnSkill(s));
+ // No stored entry means the image's default applies.
+ const off = stored ? stored.enabled === false : !b.defaultEnabled;
+ return (
+ <div key={'inh-' + n} className="capability-row">
+ <span className="capability-icon"><iconify-icon icon="tabler:bulb"></iconify-icon></span>
+ <div className="capability-copy"><strong>{b.title || n}</strong>
+ <span>{b.description || 'Built in'}</span></div>
+ <div className="capability-actions">
+ {!readOnly && <button className="button quiet small" type="button" onClick={() => {
+ if (!draft) return;
+ const rest = skills.filter((s) => s.name !== n);
+ const sid = 'skl_' + crypto.randomUUID().replace(/-/g, '');
+ const files = [{ path: 'SKILL.md', content: `---\nname: ${n}\ndescription: \n---\n\n# ${n}\n\nReplaces the built-in ${n} skill.\n` }];
+ upd({ skills: [...rest, { id: sid, name: n, enabled: true, files }] });
+ setEditSkillIdx(rest.length);
+ }}>Replace</button>}
+ <button className="toggle-button" type="button" disabled={readOnly} aria-pressed={!off}
+ onClick={() => {
+ const rest = skills.filter((s) => !(s.name === n && !isOwnSkill(s)));
+ // Store an entry only when the harness disagrees with the image's
+ // default; agreeing with it stores nothing, so the harness keeps
+ // following the image as the bundled set changes.
+ const want = off; // clicking flips it to this
+ upd({ skills: want === b.defaultEnabled ? rest
+ : [...rest, { id: 'skl_' + crypto.randomUUID().replace(/-/g, ''), name: n, enabled: want }] });
+ }}>
+ {off ? 'Disabled' : 'Enabled'}</button>
+ </div>
+ </div>
+ );
+ })}
+ {ownSkills.length === 0 && baseSkills.length === 0 && (
+ <div className="capability-row">
+ <span className="capability-icon"><iconify-icon icon="tabler:bulb"></iconify-icon></span>
+ <div className="capability-copy"><strong>No Skills added yet</strong>
+ <span>{srvBase && !srvBase.builtinSkillsEnumerable
+ ? `${base?.name} brings its own Skills and discovers them when it runs, so they can't be listed here. Add a Skill to give this Harness something of your own.`
+ : 'Add a Skill to give this Harness a workflow of your own.'}</span></div>
+ </div>
+ )}
+ </div>
+ </div>
+ </section>
+
+ <section className="form-section">
+ <div><h3>Runtime limits</h3><p>Stop Tasks that run longer or take more agent steps than expected.</p></div>
+ <div className="field-stack">
+ <div className="two-column-fields">
+ <div className="field"><label htmlFor="hsSteps">Max steps</label>
+ <input id="hsSteps" type="number" min={1} placeholder="400" disabled={readOnly}
+ value={draft?.maxStep ?? ''} onChange={(e) => upd({ maxStep: e.target.value ? Math.max(1, Number(e.target.value)) : null })} />
+ <span className="field-help">Maximum agent steps before the Task stops.</span></div>
+ <div className="field"><label htmlFor="hsTimeout">Timeout (minutes)</label>
+ <input id="hsTimeout" type="number" min={1} placeholder="120" disabled={readOnly}
+ value={draft?.timeoutSeconds ? Math.round(draft.timeoutSeconds / 60) : ''}
+ onChange={(e) => upd({ timeoutSeconds: e.target.value ? Math.max(1, Number(e.target.value)) * 60 : null })} />
+ <span className="field-help">Maximum wall-clock execution time.</span></div>
+ </div>
+ </div>
+ </section>
+
+ <section className="form-section">
+ <div><h3>Request headers</h3><p>Forward approved Task request context to MCP servers used by this Harness.</p></div>
+ <div className="field-stack">
+ <div className="section-actions"><strong>Dynamic header mappings</strong>
+ {!readOnly && <button className="button small" type="button" onClick={() => upd({ additionalHeaders: [...(draft?.additionalHeaders || []), ''] })}><iconify-icon icon="tabler:plus"></iconify-icon>Add header</button>}</div>
+ <div>
+ {(draft?.additionalHeaders || []).map((h, idx) => (
+ <div key={idx} className="header-row">
+ <div className="field"><label>Header name</label>
+ <input value={h} placeholder="X-App-JWT" onChange={(e) => upd({ additionalHeaders: (draft?.additionalHeaders || []).map((x, k) => (k === idx ? e.target.value : x)) })} /></div>
+ <div className="field"><label>Value reference</label>
+ <input value={h ? `$headers.${h}` : ''} readOnly /></div>
+ <button className="icon-button" type="button" aria-label="Remove header"
+ onClick={() => upd({ additionalHeaders: (draft?.additionalHeaders || []).filter((_, k) => k !== idx) })}><iconify-icon icon="tabler:trash"></iconify-icon></button>
+ </div>
+ ))}
+ {!(draft?.additionalHeaders || []).length && <span className="field-help">No headers declared.</span>}
+ </div>
+ <span className="field-help">Values are resolved from the incoming Task request when the Harness calls an MCP server. Store credentials in a trusted secret manager; never enter literal secrets here.</span>
+ </div>
+ </section>
+
+ {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Save failed</strong>{err}</div></div>}
+ {!readOnly && (
+ <div className="settings-form-footer settings-footer-sticky">
+ <button className="button danger" type="button" onClick={() => setConfirmDelete(true)}>Delete Harness</button>
+ <span className="settings-footer-spacer" />
+ {dirty && (
+ <button className="button" type="button" disabled={busy} onClick={() => setDraft(saved)}>Discard Changes</button>
+ )}
+ {dirty ? (
+ <button className="button primary" type="submit" disabled={busy}>{busy ? 'Saving…' : 'Save Changes'}</button>
+ ) : (
+ <button className="button primary" type="button"
+ onClick={() => go('tasks')}>
+ <iconify-icon icon="tabler:list-details"></iconify-icon>Run Task</button>
+ )}
+ </div>
+ )}
+ {/* Built-ins have nothing to save, but they still need somewhere to act — same bar,
+ same corner, so the action never moves depending on which harness you opened. */}
+ {readOnly && (
+ <div className="settings-form-footer settings-footer-sticky">
+ <span className="settings-footer-spacer" />
+ <button className="button" type="button" disabled={busy} onClick={async () => {
+ setBusy(true);
+ try {
+ const c = await createCustom({ name: `${oob!.name} (custom)`, base: oob!.id, defaultModel: oobDefaultModel(oob), systemPrompt: oob!.systemPrompt });
+ router.push(`/harnesses/${encodeURIComponent(c.id)}`);
+ } finally { setBusy(false); }
+ }}><iconify-icon icon="tabler:git-fork"></iconify-icon>Fork and Customize</button>
+ <button className="button primary" type="button"
+ onClick={() => go('tasks')}>
+ <iconify-icon icon="tabler:list-details"></iconify-icon>Run Task</button>
+ </div>
+ )}
+ </form>
+ </div>
+
+ {editSkillIdx !== null && draft?.skills?.[editSkillIdx] && (
+ <SkillEditor skill={draft.skills[editSkillIdx]}
+ onClose={() => setEditSkillIdx(null)}
+ onSave={(files) => {
+ upd({ skills: skills.map((x, k) => (k === editSkillIdx ? { ...x, files, blob: undefined } : x)) });
+ setEditSkillIdx(null);
+ }} />
+ )}
+ {newSkill && draft && (
+ <SkillEditor skill={{ name: newSkill.name, files: [{ path: 'SKILL.md',
+ content: `---\nname: \ndescription: \n---\n` }] }}
+ nameEditable onName={(n) => setNewSkill({ name: n })}
+ onClose={() => setNewSkill(null)}
+ onSave={(files) => {
+ const nm = newSkill.name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
+ if (!nm) { setErr('Give the skill a name (kebab-case) at the top of the editor.'); return; }
+ const sid = 'skl_' + crypto.randomUUID().replace(/-/g, '');
+ upd({ skills: [...skills, { id: sid, name: nm, enabled: true, files }] });
+ setNewSkill(null);
+ }} />
+ )}
+ {mcpModal && draft && (
+ <McpModal server={mcpModal.idx != null ? (draft.mcpServers[mcpModal.idx] as McpServer) : null}
+ declaredHeaders={(draft.additionalHeaders || []).filter(Boolean)}
+ onClose={() => setMcpModal(null)}
+ onSave={async (srv) => {
+ let auth = srv.auth;
+ if (auth && !auth.startsWith('vault:') && !auth.startsWith('$headers.')) {
+ try { auth = await storeMcpSecret(srv.name, auth); } catch { /* keep literal; gateway re-vaults */ }
+ }
+ const entry = { ...srv, auth };
+ upd({ mcpServers: mcpModal.idx != null ? draft.mcpServers.map((x, k) => (k === mcpModal.idx ? entry : x)) : [...draft.mcpServers, entry] });
+ setMcpModal(null);
+ }} />
+ )}
+ {confirmDelete && draft && (
+ <div className="modal-backdrop">
+ <section className="modal" role="dialog" aria-modal="true" onClick={(e) => e.stopPropagation()}>
+ <div className="modal-header"><div><h2>Delete {draft.name}?</h2><p>Removes this Harness configuration. Existing task history stays readable.</p></div></div>
+ <div className="modal-body">
+ <div className="modal-actions">
+ <button className="button" type="button" onClick={() => setConfirmDelete(false)}>Cancel</button>
+ <button className="button primary" type="button" style={{ background: 'var(--red)', borderColor: 'var(--red)' }}
+ onClick={async () => { await deleteCustom(draft.id); go('list'); }}>Delete</button>
+ </div>
+ </div>
+ </section>
+ </div>
+ )}
+ </section>
+ );
+}
diff --git a/ui/src/components/InsufficientCreditsModal.tsx b/ui/src/components/InsufficientCreditsModal.tsx
new file mode 100644
index 00000000..8906c044
--- /dev/null
+++ b/ui/src/components/InsufficientCreditsModal.tsx
@@ -0,0 +1,43 @@
+'use client';
+// The credit wall, surfaced as a dialog instead of a line of red text in the transcript.
+//
+// WHY A DIALOG. A run that stops for money is not an error the user can debug — it is a decision
+// they have to make, and the only useful next move is a page they may not know exists. An inline
+// "Error: insufficient credits" leaves them re-reading a transcript looking for a fix that isn't
+// in it. This names the reason and hands them the door.
+//
+// It is DISMISSIBLE, unlike the onboarding wall: the user may well want to go back and read what
+// their agent did before deciding to spend. Blocking that would be punishing them for running out.
+import { useRouter } from 'next/navigation';
+import { track } from '@/lib/analytics';
+
+export function InsufficientCreditsModal({ balance, onClose }: {
+ /** Live balance, or null when we don't have it — never invent a number on a money screen. */
+ balance: number | null;
+ onClose: () => void;
+}) {
+ const router = useRouter();
+ return (
+ <div className="welcome-overlay" role="dialog" aria-modal="true" aria-labelledby="oc-title"
+ onClick={(e) => { if (e.target === e.currentTarget) onClose(); }}>
+ <div className="oc-card">
+ <button className="welcome-wide-close" type="button" aria-label="Close" onClick={onClose}>
+ <iconify-icon icon="tabler:x"></iconify-icon>
+ </button>
+ <div className="oc-badge"><iconify-icon icon="tabler:bolt-off"></iconify-icon></div>
+ <h2 className="welcome-title" id="oc-title">Insufficient credits</h2>
+ <p className="welcome-sub">
+ Your run stopped because this workspace is out of credits.
+ {balance != null ? <> Your balance is <b>{balance.toLocaleString()}</b>.</> : null}
+ {' '}Top up and start it again. Nothing you have already done is lost.
+ </p>
+ <button className="welcome-cta oc-cta" type="button"
+ onClick={() => { track('credits_checkout_started', { kind: 'out_of_credits_modal', package_id: '' });
+ router.push('/billing'); onClose(); }}>
+ <iconify-icon icon="tabler:credit-card"></iconify-icon>Add Credits
+ </button>
+ <button className="welcome-later" type="button" onClick={onClose}>Not now</button>
+ </div>
+ </div>
+ );
+}
diff --git a/ui/src/components/TaskChat.tsx b/ui/src/components/TaskChat.tsx
new file mode 100644
index 00000000..3c4d8d6e
--- /dev/null
+++ b/ui/src/components/TaskChat.tsx
@@ -0,0 +1,736 @@
+'use client';
+import { harnessFetch } from '@/lib/hfetch';
+import { useEscape } from '@/lib/useEscape';
+import { Children, Suspense, useEffect, useId, useMemo, useRef, useState, isValidElement, type CSSProperties, type ReactElement, type ReactNode } from 'react';
+import { SkelListItems, SkelPage } from '@/components/Skel';
+import ReactMarkdown from 'react-markdown';
+import remarkGfm from 'remark-gfm';
+import { Mermaid } from '@/components/Mermaid';
+import { OOB, oobById, oobDefaultModel, oobModels, useModelCatalog, modelAvailable, saveCustom, listCustom, getSkillFiles, storeMcpSecret, testMcp, type CustomHarness, type OobHarness } from '@/lib/harness';
+import { HarnessLogo } from '@/components/HarnessLogo';
+import { streamResponse, subscribeHarnessEvents, containerFileUrl, downloadFile, loadSessionTurns, cancelSession, authHeaders, type RespFile, type SessionTurn } from '@/lib/chat';
+import { appendWorkspaceQuery, getCurrentWorkspaceRef } from '@/lib/workspace';
+import { track } from '@/lib/analytics';
+import { InsufficientCreditsModal } from '@/components/InsufficientCreditsModal';
+import { billing } from '@/app/(app)/billing/lib';
+import { statusChip, timeAgo } from '@/lib/revamp-data';
+// Shared Conversational Agent surface (UI Core), extracted from this page; see
+// frontend-ui-core/README.md for the token/transport/slot contracts.
+import { Svg, Chevron, IcPlug, IcSkill } from 'reifyui';
+import { ChatMessages } from 'reifyui';
+import { Popover } from 'reifyui';
+import { SELF_HOSTED } from '@/lib/edition';
+import { Chip } from 'reifyui';
+import { CodeBlock } from 'reifyui';
+import { Composer } from 'reifyui';
+import { IcPaperclip } from 'reifyui';
+import { withText, withReasoning, withStep, withResult, asstText } from 'reifyui';
+import {
+ // The conversation controller and its module-level singletons now live in one place so Tasks and
+ // Arena share a single store, one realtime bus wiring and one turn lifecycle (see lib/conversation).
+ useConversationTurn, useHarnessBus, useConvState, getConvState, setConvState, convStore,
+ msgsFromTurns, turnIndexOf, trackTaskFinished, isInternalOutput,
+ addPendingCard, setPendingSid, dropPending, livePending,
+ _busSuppress, _runningSids,
+ type ChatTarget, type Msg, type UserMsg, type AsstMsg, type Block, type ToolStep, type TraceCard,
+} from '@/lib/conversation';
+import TracesMain from '@/studio/traces/TracesMain.jsx';
+import { traceStore } from '@/studio/traces/store';
+import { FilePreview } from '@/components/FilePreview';
+import { FileTypeIcon } from '@/components/FileTypeIcon';
+import { AttachCard, OutputFiles } from '@/components/ChatAttachments';
+
+type Tab = 'config' | 'traces';
+
+// react-markdown v9 override: a ```mermaid fence renders as a real diagram; every other fenced
+// block renders through the shared CodeBlock (language-aware syntax highlighting, lazy
+// highlight.js). We override `pre` (not `code`) because in v9 the language class lives on the
+// inner <code>, so replacing the block happens at the `pre` level.
+const MD_COMPONENTS = {
+ pre({ children }: { children?: ReactNode }) {
+ const el = Children.toArray(children).find(isValidElement) as
+ ReactElement<{ className?: string; children?: React.ReactNode }> | undefined;
+ const cls = el?.props?.className || '';
+ const lang = /language-([\w#+-]+)/.exec(cls);
+ const code = String(el?.props?.children ?? '').replace(/\n$/, '');
+ if (lang && lang[1] === 'mermaid') {
+ return <Mermaid code={code} />;
+ }
+ return <CodeBlock code={code} language={lang ? lang[1] : ''} />;
+ },
+};
+const renderWbMarkdown = (t: string) => (
+ <ReactMarkdown remarkPlugins={[remarkGfm]} components={MD_COMPONENTS}>{t}</ReactMarkdown>
+);
+
+// Agent replies reference workspace files as /workspace/... or sandbox: links, served nowhere as
+// written (they 404 on the app origin). This renderer rewrites those hrefs to the authenticated
+// by-path artifact route for the CURRENT session, so clicking opens the real file inline.
+const WS_LINK_RE = /^(?:sandbox:)?\/?(?:workspace\/)?(.+)$/;
+function isWorkspaceHref(href: string): boolean {
+ if (!href || href.startsWith('#')) return false;
+ if (/^[a-z][a-z0-9+.-]*:/i.test(href) && !href.startsWith('sandbox:')) return false; // http(s), mailto…
+ return href.startsWith('sandbox:') || href.startsWith('/workspace/') || href.startsWith('workspace/')
+ || (!href.startsWith('/') && /\.[A-Za-z0-9]{1,8}$/.test(href));
+}
+function makeWbMarkdown(getSid: () => string | null, getHarness?: () => string | null) {
+ const components = {
+ ...MD_COMPONENTS,
+ a: ({ href, children }: { href?: string; children?: React.ReactNode }) => {
+ const sid = getSid();
+ if (href && sid && isWorkspaceHref(href)) {
+ const m = decodeURIComponent(href).match(WS_LINK_RE);
+ const path = m ? m[1].replace(/^\/+/, '') : '';
+ if (path) {
+ const enc = path.split('/').map(encodeURIComponent).join('/');
+ const h = getHarness?.();
+ // canonical address: /{harness}/{session}/workspace/{path}
+ const url = h ? `/${encodeURIComponent(h)}/${encodeURIComponent(sid)}/workspace/${enc}`
+ : `/api/harness/a/${encodeURIComponent(sid)}/${enc}`;
+ return <a href={url} target="_blank" rel="noreferrer">{children}</a>;
+ }
+ }
+ return <a href={href} target="_blank" rel="noreferrer">{children}</a>;
+ },
+ };
+ return (t: string) => (
+ <ReactMarkdown remarkPlugins={[remarkGfm]} components={components}>{t}</ReactMarkdown>
+ );
+}
+
+
+/** Server turns -> conversation messages (shared by hydration + busy reconciliation). */
+
+// Each base harness gets a stable assigned accent so the badge reads at a glance.
+const BASE_TINT: Record<string, string> = {
+ codex: '#0E8C6A', 'claude-code': '#C2613D', pi: '#6E55FF', hermes: '#2563EB',
+};
+function baseTint(id: string): string {
+ if (BASE_TINT[id]) return BASE_TINT[id];
+ let h = 0;
+ for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) >>> 0;
+ return `hsl(${h % 360} 52% 42%)`;
+}
+
+// Svg / Chevron / IcPlug / IcSkill come from UI Core; the icons below are workbench-specific.
+const IcFolder = () => <Svg s={14}><path d="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /></Svg>;
+
+// Tool-step icons, toolMeta, summarizeSteps and the activity timeline (ToolGroup/ToolRow)
+// live in UI Core (frontend-ui-core/src/components/*), rendered via ChatMessages below.
+
+// Drag-to-resize a pane width. fromRight: handle is on the pane's left edge (dragging right shrinks).
+function useHResize(initial: number, min: number, max: number, fromRight = false) {
+ const [w, setW] = useState(initial);
+ const onDown = (e: React.MouseEvent) => {
+ e.preventDefault();
+ const sx = e.clientX, base = w, dir = fromRight ? -1 : 1;
+ // While dragging, neutralize iframes/text-selection so the embedded PDF/preview can't swallow
+ // mousemove/mouseup (which would strand the drag and make narrowing impossible).
+ document.body.classList.add('hr-resizing');
+ const move = (ev: MouseEvent) => setW(Math.min(max, Math.max(min, base + dir * (ev.clientX - sx))));
+ const up = () => {
+ window.removeEventListener('mousemove', move); window.removeEventListener('mouseup', up);
+ document.body.style.cursor = ''; document.body.classList.remove('hr-resizing');
+ };
+ window.addEventListener('mousemove', move); window.addEventListener('mouseup', up); document.body.style.cursor = 'col-resize';
+ };
+ return [w, onDown] as const;
+}
+
+export function ShareModal({ sid, onClose }: { sid: string; onClose: () => void }) {
+ const [enabled, setEnabled] = useState<boolean | null>(null);
+ const [token, setToken] = useState('');
+ const [busy, setBusy] = useState(false);
+ const [copied, setCopied] = useState(false);
+ const [err, setErr] = useState('');
+ useEffect(() => {
+ let alive = true;
+ harnessFetch(`/api/harness/v1/sessions/${encodeURIComponent(sid)}/share`, { headers: authHeaders() })
+ .then((r) => (r.ok ? r.json() : Promise.reject(new Error(String(r.status)))))
+ .then((d) => { if (alive) { setEnabled(Boolean(d.enabled)); setToken(d.token || ''); } })
+ .catch(() => { if (alive) setErr('Could not load sharing state.'); });
+ return () => { alive = false; };
+ }, [sid]);
+ const set = async (on: boolean) => {
+ if (busy) return;
+ setBusy(true); setErr('');
+ try {
+ const r = await harnessFetch(`/api/harness/v1/sessions/${encodeURIComponent(sid)}/share`, {
+ method: 'POST', headers: authHeaders(), body: JSON.stringify({ enabled: on }),
+ });
+ const d = await r.json();
+ if (!r.ok) throw new Error(d.detail || String(r.status));
+ setEnabled(Boolean(d.enabled)); setToken(d.token || '');
+ } catch (e) { setErr(e instanceof Error ? e.message : String(e)); }
+ finally { setBusy(false); }
+ };
+ const link = token ? `${window.location.origin}/share/${token}` : '';
+ return (
+ <div className="modal-backdrop">
+ <section className="modal" role="dialog" aria-modal="true" aria-labelledby="shareTitle" onClick={(e) => e.stopPropagation()}>
+ <div className="modal-header">
+ <div><h2 id="shareTitle">Share Task</h2><p>Anyone with the link sees a read-only view of this conversation and ALL of its artifacts. Turn sharing off at any time to revoke the link.</p></div>
+ <button className="icon-button modal-close" type="button" aria-label="Close dialog" onClick={onClose}><iconify-icon icon="tabler:x"></iconify-icon></button>
+ </div>
+ <div className="modal-body">
+ <div className="share-choice-list">
+ <button type="button" className={'share-choice' + (enabled === false ? ' on' : '')} disabled={busy} onClick={() => void set(false)}>
+ <iconify-icon icon="tabler:lock"></iconify-icon>
+ <span><strong>Keep private</strong><span>Only members of this Workspace&rsquo;s organization have access</span></span>
+ {enabled === false && <iconify-icon icon="tabler:check"></iconify-icon>}
+ </button>
+ <button type="button" className={'share-choice' + (enabled === true ? ' on' : '')} disabled={busy} onClick={() => void set(true)}>
+ <iconify-icon icon="tabler:world"></iconify-icon>
+ <span><strong>Create public link</strong><span>Anyone with the link can view the conversation and artifacts</span></span>
+ {enabled === true && <iconify-icon icon="tabler:check"></iconify-icon>}
+ </button>
+ </div>
+ {enabled && link && (
+ <div className="share-link-row">
+ <input readOnly value={link} onClick={(e) => (e.target as HTMLInputElement).select()} />
+ <button className="button" type="button" onClick={async () => { try { await navigator.clipboard.writeText(link); setCopied(true); setTimeout(() => setCopied(false), 1400); } catch { /* blocked */ } }}>
+ <iconify-icon icon={copied ? 'tabler:check' : 'tabler:copy'}></iconify-icon>{copied ? 'Copied' : 'Copy'}
+ </button>
+ </div>
+ )}
+ {err && <div className="notice"><iconify-icon icon="tabler:alert-triangle"></iconify-icon><div><strong>Sharing error</strong>{err}</div></div>}
+ <div className="modal-actions"><button className="button primary" type="button" onClick={onClose}>Done</button></div>
+ </div>
+ </section>
+ </div>
+ );
+}
+
+// ── Task list (left) | Task detail (right), the design's run-layout master-detail ────────────
+// The host page (Agent harnesses) owns the task list, the title row, sharing and the URL; this
+// renders the conversation, its tabs and the trace, and reports the live session id, activity,
+// and a deep-linked task that belongs to another harness.
+/** What a conversation has taken and cost, summed over the finished turns that carry figures;
+ * `timed`/`costed` against `finished` say whether the sum is the whole story. */
+export interface ConvTotals { elapsed: number; credits: number; timed: number; costed: number; finished: number }
+
+export function ConfigChat({ oob, ch, harnessId, harnessName, deepSid, onClearDeepSid,
+ onHarness, onSaved, onActiveSid, onActivity, onTotals }: {
+ oob: OobHarness | null; ch: CustomHarness | null; harnessId: string; harnessName: string;
+ deepSid?: string; onClearDeepSid?: () => void;
+ onHarness?: (id: string) => void; onSaved: () => void;
+ onActiveSid?: (sid: string | null) => void; onActivity?: () => void;
+ onTotals?: (t: ConvTotals) => void;
+}) {
+ const [draft, setDraft] = useState<CustomHarness | null>(ch);
+ useEffect(() => setDraft(ch), [ch?.id]); // eslint-disable-line react-hooks/exhaustive-deps
+
+ useModelCatalog(); // server catalog is the source of truth for the picker
+ const models = oobModels(oob).length ? oobModels(oob) : oobModels(oobById(draft?.base || ''));
+ // The safe fallback is the BACKEND DEFAULT (gpt-5.4 / sonnet-4.6), never models[0], the lists
+ // lead with the newest/priciest entries (gpt-5.6-*, fable-5) and those must never be picked
+ // implicitly.
+ const fallbackModel = oobDefaultModel(oob) || oobDefaultModel(oobById(draft?.base || '')) || '';
+ // Resolve a stored model name against the current option list, tolerate legacy bare names
+ // (sonnet-4.6) now that options carry the claude- prefix, so the saved default still applies.
+ const normModel = (m: string | undefined): string => {
+ if (!m) return fallbackModel || models[0] || '';
+ if (models.includes(m)) return m;
+ if (models.includes('claude-' + m)) return 'claude-' + m;
+ const bare = m.replace(/^claude-/, '');
+ if (models.includes(bare)) return bare;
+ return fallbackModel || m;
+ };
+ const [model, setModel] = useState(oob ? (oobDefaultModel(oob) || '') : normModel(ch?.defaultModel));
+ // Re-sync the active model to the harness's saved default whenever the config loads or its default
+ // changes (ch arrives async after mount; without ch in deps the saved default was never applied).
+ // Resolve against the BASE's model list directly so it doesn't depend on draft-render timing.
+ // GUARD: skip when a session is open — an existing task's model is what IT ran with (set by the
+ // taskModel effect below), and this effect fires LATE on reload (ch loads async) so without the
+ // guard it clobbered the session's model back to the harness default (fable-5 → opus-4.8 on reload).
+ useEffect(() => {
+ if (deepSid) return; // reloading straight into a session → its own model wins, not the default
+ if (oob) { setModel(oobDefaultModel(oob) || ''); return; }
+ const base0 = oobById(ch?.base || '');
+ const ms = oobModels(base0);
+ const dm = ch?.defaultModel || '';
+ const pick = ms.includes(dm) ? dm
+ : ms.includes('claude-' + dm) ? 'claude-' + dm
+ : ms.includes(dm.replace(/^claude-/, '')) ? dm.replace(/^claude-/, '')
+ : (oobDefaultModel(base0) || dm);
+ setModel(pick);
+ }, [harnessId, ch?.defaultModel, ch?.base, deepSid]); // eslint-disable-line react-hooks/exhaustive-deps
+
+ const [recentsKey, setRecentsKey] = useState(0);
+ // Realtime broadcast: subscribe ONCE per harness. Every session's live events flow into the conv
+ // store by session id, so any open conversation updates live (no per-tab stream, no hard refresh).
+ // Turn start/finish also refreshes Recents so its status dots track in realtime.
+ useHarnessBus(harnessId, () => setRecentsKey((k) => k + 1));
+ const [selectedSid, setSelectedSid] = useState<string | null>(deepSid || null);
+ // activeSid = the session the conversation pane is actually showing (drives the Recents highlight).
+ // Kept SEPARATE from selectedSid so a new chat reporting its own session id highlights the row
+ // WITHOUT remounting the live conversation (the Conversation is keyed by selectedSid).
+ const [activeSid, setActiveSid] = useState<string | null>(deepSid || null);
+ useEffect(() => { onActiveSid?.(activeSid); }, [activeSid]); // eslint-disable-line react-hooks/exhaustive-deps
+ // Deep-linked session validation: confirm the manifest exists; 404 -> visible error + New Task.
+ // A 200 manifest also serves as the title/meta fallback when the session isn't in MY recents
+ // (deep links can point at another member's task).
+ const [deepErr, setDeepErr] = useState('');
+ const [deepCard, setDeepCard] = useState<TraceCard | null>(null);
+ useEffect(() => {
+ // A session born in this tab needs no lookup: its conversation is already here, and the
+ // index may not list it for a moment, which would read as a task that does not exist.
+ if (!deepSid || deepSid === activeSid) return;
+ let alive = true;
+ harnessFetch(`/api/harness/v1/traces/${encodeURIComponent(deepSid)}`)
+ .then(async (r) => {
+ if (!alive) return;
+ if (r.status === 404) {
+ setDeepErr(`The linked Task (${deepSid.slice(0, 18)}…) doesn't exist, it may have been deleted.`);
+ setSelectedSid(null); setActiveSid(null); onClearDeepSid?.();
+ } else if (!r.ok) {
+ setDeepErr(`Could not open the linked Task (HTTP ${r.status}). Try again or pick it from the list.`);
+ } else {
+ const m = await r.json().catch(() => null);
+ if (alive && m?.session_id) {
+ setDeepCard({ session_id: m.session_id, title: m.title, status: m.status,
+ finished_at: m.finished_at, model: m.model, event_count: m.event_count, elapsed: m.elapsed, credits: m.credits });
+ // A session belongs to the harness that ran it, and the trace says which one. Trusting
+ // ?h= instead meant a link with a missing or stale harness rendered the transcript
+ // under whatever harness happened to be selected: another vendor's name and logo on
+ // top of this harness's answer, with that other harness's tasks listed beside it.
+ if (m.harness_id && m.harness_id !== harnessId) onHarness?.(m.harness_id);
+ }
+ }
+ })
+ .catch(() => { if (alive) setDeepErr('Could not reach the server to open the linked Task.'); });
+ return () => { alive = false; };
+ }, [deepSid]); // eslint-disable-line react-hooks/exhaustive-deps
+ // Bumped on "New Task" so the conversation fully resets even when selectedSid is already null
+ // (a fresh, never-saved task), keys the Conversation to remount it clean.
+ const [newTaskNonce, setNewTaskNonce] = useState(0);
+ // Trace is a diagnostics TAB of the selected Task (per the IA review), not a separate surface.
+ const [detailTab, setDetailTab] = useState<'conversation' | 'trace'>('conversation');
+ // Narrow screens alternate between the task list and the detail pane (CSS ≤820px); desktop
+ // ignores this. Narrow DEFAULTS to the detail view (list collapsed), the title-row toggle
+ // expands the list; picking a task collapses it again.
+ // The task cards (lifted from RecentsPanel) drive the detail header's title + meta row.
+ const [cards, setCards] = useState<TraceCard[]>([]);
+ const backend = oob?.backend ?? (oobById(draft?.base || '')?.backend ?? null);
+
+ const startNew = () => {
+ setSelectedSid(null); setActiveSid(null); setDetailTab('conversation');
+ // A New Task must be a BRAND-NEW session: kill the deep-link sid + its error so nothing
+ // can rebind the fresh conversation to an old session.
+ setDeepErr(''); onClearDeepSid?.();
+ setNewTaskNonce((n) => n + 1);
+ };
+ // The host owns the URL and tells this component which task to show through `deepSid`. Three
+ // cases: no task means a fresh draft; a task already live here (the session this draft just
+ // created, whose id the host wrote back) means nothing, so the streaming conversation is not
+ // torn down; any other task means switch to it.
+ useEffect(() => {
+ if (!deepSid) { if (activeSid || selectedSid) startNew(); return; }
+ if (deepSid === activeSid || deepSid === selectedSid) return;
+ setSelectedSid(deepSid); setActiveSid(deepSid); setDetailTab('conversation'); setDeepErr('');
+ }, [deepSid]); // eslint-disable-line react-hooks/exhaustive-deps
+
+ const shownSid = activeSid ?? selectedSid;
+ const selCard = shownSid
+ ? cards.find((c) => c.session_id === shownSid)
+ || (deepCard && deepCard.session_id === shownSid ? deepCard : null)
+ : null;
+ const chip = selCard ? statusChip(selCard.status) : { cls: 'healthy', label: 'Ready' };
+ // An existing task's selector shows the model IT actually ran with last turn (from the trace
+ // card), not the harness default, resuming a conversation must not silently switch models.
+ const taskModel = selCard?.model || '';
+ useEffect(() => {
+ if (!shownSid || !taskModel) return;
+ setModel(normModel(taskModel));
+ }, [shownSid, taskModel]); // eslint-disable-line react-hooks/exhaustive-deps
+ const fmtDur = (s?: number) => {
+ if (!s) return '';
+ const m = Math.floor(s / 60), sec = Math.round(s % 60);
+ return m ? `${m}m ${sec}s` : `${sec}s`;
+ };
+
+ return (
+ <div className="run-layout is-embedded">
+ <article className="run-detail">
+ {deepErr && (
+ <div className="notice" style={{ margin: '14px 18px 0' }}>
+ <iconify-icon icon="tabler:alert-triangle"></iconify-icon>
+ <div><strong>Task not found</strong>{deepErr}</div>
+ </div>
+ )}
+ <div className="task-detail-shell">
+ {/* Trace is a diagnostics surface backed by the hosted tracing pipeline; a self-hosted
+ box has no such pipeline, so a single tab with nothing behind it is worse than none. */}
+ {SELF_HOSTED ? null : (
+ <div className="tabs" role="tablist" aria-label="Task detail">
+ <button className="tab" type="button" role="tab" aria-selected={detailTab === 'conversation'}
+ onClick={() => setDetailTab('conversation')}>Conversation</button>
+ <button className="tab" type="button" role="tab" aria-selected={detailTab === 'trace'}
+ disabled={!shownSid} onClick={() => shownSid && setDetailTab('trace')}>Trace</button>
+ </div>
+ )}
+ </div>
+ {/* Conversation stays MOUNTED while the Trace tab shows, its store writes + bus rendering
+ must not be interrupted by a diagnostics peek. */}
+ <div className="run-detail-fill" style={{ display: detailTab === 'conversation' ? undefined : 'none' }}>
+ <Conversation key={`conv-${harnessId}-${selectedSid ?? 'new'}-${newTaskNonce}`} harnessId={harnessId} sessionId={selectedSid}
+ target={{ name: harnessName, backend, model, baseId: oob?.id ?? oobById(draft?.base || '')?.id,
+ runtime: (oob ?? oobById(draft?.base || ''))?.name, defaultModel: oob ? (oobDefaultModel(oob) || '') : normModel(ch?.defaultModel) }}
+ additionalHeaders={(draft?.additionalHeaders || []).filter(Boolean)}
+ models={models} onModel={(m) => setModel(m)}
+ onSession={(sid) => { setActiveSid(sid); setRecentsKey((k) => k + 1); }}
+ onTotals={onTotals}
+ onRan={() => { setRecentsKey((k) => k + 1); onActivity?.(); }} />
+ </div>
+ {!SELF_HOSTED && detailTab === 'trace' && <TraceView sid={shownSid} />}
+ </article>
+ </div>
+ );
+}
+
+function ModelSelect({ models, value, onChange, backend }: {
+ models: string[]; value: string; onChange: (m: string) => void; backend?: string | null;
+}) {
+ return (
+ <div className="wbx-select-wrap block">
+ <select className="wbx-select full" value={value} onChange={(e) => onChange(e.target.value)}>
+ {models.map((m) => (
+ <option key={m} value={m} disabled={!modelAvailable(backend, m)}>
+ {m}{modelAvailable(backend, m) ? '' : ' (no provider)'}
+ </option>
+ ))}
+ </select>
+ <span className="wbx-select-chev"><Chevron dir="down" size={15} /></span>
+ </div>
+ );
+}
+
+// ── Recents: this user's sessions for this harness (clickable → loads its chat history) ─────────
+
+function Conversation({ harnessId, sessionId, target, models, onModel, onRan, onSession, additionalHeaders, onTotals }: {
+ harnessId: string; sessionId: string | null; target: ChatTarget;
+ models: string[]; onModel: (m: string) => void; onRan: () => void; onSession?: (sid: string) => void;
+ additionalHeaders?: string[]; onTotals?: (t: ConvTotals) => void;
+}) {
+ // Additional Headers (app-level auth): per-harness VALUES for the declared header names, kept
+ // client-side only (localStorage) and attached to every Playground call, the same pass-through
+ // path an external caller uses, so the Playground exercises real app auth.
+ const hdrKey = 'hr.hdrs.' + harnessId;
+ const [hdrVals, setHdrVals] = useState<Record<string, string>>(() => {
+ try { return JSON.parse(localStorage.getItem(hdrKey) || '{}'); } catch { return {}; }
+ });
+ const [hdrOpen, setHdrOpen] = useState(false);
+ useEscape(hdrOpen, () => setHdrOpen(false));
+ const declared = (additionalHeaders || []).filter(Boolean);
+ const saveHdrVals = (vals: Record<string, string>) => {
+ setHdrVals(vals);
+ try { localStorage.setItem(hdrKey, JSON.stringify(vals)); } catch { /* private mode */ }
+ };
+ const extraHeaders = () => {
+ const out: Record<string, string> = {};
+ for (const n of declared) { const v = hdrVals[n]; if (v) out[n] = v; }
+ return out;
+ };
+ // The turn lifecycle (store binding, history load, send, reconcile, stop) lives in the shared
+ // controller so Tasks and Arena run the exact same machine; this component owns only the view
+ // and its own composer state.
+ const { msgs, busy, loading, stopping, outOfCredits, clearOutOfCredits,
+ liveSessionId, send, stop, setMsgs, updateLast } = useConversationTurn({
+ harnessId, sessionId, target, onRan, onSession, extraHeaders,
+ onSendStart: () => { setInput(''); setFiles([]); setAtBottom(true); },
+ });
+ useEffect(() => {
+ if (!onTotals) return;
+ const finished = msgs.filter((m): m is AsstMsg => m.role === 'assistant' && m.status !== 'running');
+ const timed = finished.filter((m) => m.elapsed != null), costed = finished.filter((m) => m.credits != null);
+ onTotals({ elapsed: timed.reduce((a, m) => a + (m.elapsed || 0), 0), credits: costed.reduce((a, m) => a + (m.credits || 0), 0),
+ timed: timed.length, costed: costed.length, finished: finished.length });
+ }, [msgs]); // eslint-disable-line react-hooks/exhaustive-deps
+ const sidRef = useRef<string | null>(sessionId);
+ useEffect(() => { if (sessionId) sidRef.current = sessionId; }, [sessionId]);
+ useEffect(() => { if (liveSessionId) sidRef.current = liveSessionId; }, [liveSessionId]);
+ // Workspace-file links inside agent replies resolve against the LIVE session id.
+ const mdRenderer = useMemo(() => makeWbMarkdown(() => sessionId ?? sidRef.current, () => harnessId || null), [sessionId, harnessId]); // eslint-disable-line react-hooks/exhaustive-deps
+ const [input, setInput] = useState('');
+ const [copiedIdx, setCopiedIdx] = useState<number | null>(null);
+ const taRef = useRef<HTMLTextAreaElement>(null); // shared Composer auto-grows it (15-row cap)
+ // A fresh draft is for typing: the caret is already in the box when the page settles on it.
+ const hero = !loading && msgs.length === 0 && !busy;
+ useEffect(() => { if (hero) taRef.current?.focus(); }, [hero]);
+ const [files, setFiles] = useState<{ name: string; dataUri: string }[]>([]);
+ const [preview, setPreview] = useState<{ url: string; name: string } | null>(null);
+ const [modelOpen, setModelOpen] = useState(false);
+ const modelBtnRef = useRef<HTMLElement>(null);
+ const [previewW, onPreviewResize] = useHResize(520, 340, 1100, true);
+ const [atBottom, setAtBottom] = useState(true);
+ const fileRef = useRef<HTMLInputElement>(null);
+ const scrollRef = useRef<HTMLDivElement>(null);
+ const jumpToBottom = () => requestAnimationFrame(() => requestAnimationFrame(() => {
+ const el = scrollRef.current; if (el) el.scrollTop = el.scrollHeight;
+ }));
+ // Auto-stick to the newest message only when the user is already near the bottom.
+ useEffect(() => { if (atBottom) jumpToBottom(); }, [msgs, atBottom]);
+ const onScroll = () => {
+ const el = scrollRef.current; if (!el) return;
+ setAtBottom(el.scrollHeight - el.scrollTop - el.clientHeight < 60);
+ };
+ async function pickFiles(list: FileList | null) {
+ if (!list) return;
+ const out: { name: string; dataUri: string }[] = [];
+ for (const f of Array.from(list)) {
+ const b64: string = await new Promise((res) => {
+ const r = new FileReader(); r.onload = () => res(String(r.result || '').split(',')[1] || ''); r.readAsDataURL(f);
+ });
+ out.push({ name: f.name, dataUri: `data:${f.type || 'application/octet-stream'};base64,${b64}` });
+ }
+ setFiles((p) => [...p, ...out]);
+ }
+ // Drag-and-drop attach: dropping files anywhere on the conversation adds them to the composer.
+ // dragCount tracks nested enter/leave pairs (children fire their own events) so the highlight
+ // doesn't flicker off while moving across the pane.
+ const [dragOver, setDragOver] = useState(false);
+ const dragCount = useRef(0);
+ const canAttach = !!target.backend && !busy;
+ const onDragEnter = (e: React.DragEvent) => {
+ if (!canAttach || !Array.from(e.dataTransfer?.types || []).includes('Files')) return;
+ e.preventDefault();
+ dragCount.current += 1;
+ setDragOver(true);
+ };
+ const onDragOver = (e: React.DragEvent) => {
+ if (!canAttach || !Array.from(e.dataTransfer?.types || []).includes('Files')) return;
+ e.preventDefault();
+ e.dataTransfer.dropEffect = 'copy';
+ };
+ const onDragLeave = (e: React.DragEvent) => {
+ if (!dragOver) return;
+ e.preventDefault();
+ dragCount.current = Math.max(0, dragCount.current - 1);
+ if (dragCount.current === 0) setDragOver(false);
+ };
+ const onDrop = (e: React.DragEvent) => {
+ if (!canAttach) return;
+ e.preventDefault();
+ dragCount.current = 0;
+ setDragOver(false);
+ if (e.dataTransfer?.files?.length) void pickFiles(e.dataTransfer.files);
+ };
+
+ return (
+ <div className={'wbx-conv' + (preview ? ' split' : '')}
+ onDragEnter={onDragEnter} onDragOver={onDragOver} onDragLeave={onDragLeave} onDrop={onDrop}>
+ {dragOver && (
+ <div className="wbx-droparea" aria-hidden="true">
+ <div className="wbx-droparea-inner">
+ <iconify-icon icon="tabler:file-upload"></iconify-icon>
+ Drop files to attach
+ </div>
+ </div>
+ )}
+ {/* A fresh draft centers on what it is for: the harness, named under its base's mark, with
+ the composer right under it. The first message turns it into the running thread. */}
+ <div className={'wbx-conv-main' + (!loading && msgs.length === 0 && !busy ? ' is-hero' : '')}>
+ {/* The bar exists for one thing: the header-values gear of a harness with declared headers.
+ The host page names the harness above; nothing else belongs here. */}
+ {declared.length > 0 && (
+ <div className="wbx-conv-bar">
+ {declared.length > 0 && (
+ <button className="wbx-hdr-gear" title="Header values for this preview"
+ aria-haspopup="dialog" aria-expanded={hdrOpen}
+ onClick={() => setHdrOpen(true)}>
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="3" /><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 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.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 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.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 1 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 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" /></svg>
+ {declared.some((n) => !hdrVals[n]) && <span className="wbx-hdr-dot" title="Some header values are not set" />}
+ </button>
+ )}
+ </div>
+ )}
+ {hdrOpen && (
+ <div className="hr-modal-scrim" onClick={() => setHdrOpen(false)}>
+ <div className="wbx-hdr-pop" role="dialog" aria-label="Preview header values" onClick={(e) => e.stopPropagation()}>
+ <div className="wbx-hdr-pop-title">Preview header values</div>
+ <div className="hr-meta" style={{ marginBottom: 10 }}>
+ Sent with every call from this preview, like your product would. Stored only in this browser.
+ </div>
+ {declared.map((n) => (
+ <label key={n} style={{ display: 'block', marginBottom: 8 }}>
+ <div className="wb-label" style={{ marginBottom: 3 }}>{n}</div>
+ <input className="wb-input" type="password" autoComplete="off" placeholder="value"
+ value={hdrVals[n] || ''}
+ onChange={(e) => setHdrVals({ ...hdrVals, [n]: e.target.value })} />
+ </label>
+ ))}
+ <div style={{ display: 'flex', justifyContent: 'flex-end', gap: 8, marginTop: 12 }}>
+ <button className="hr-btn" onClick={() => setHdrOpen(false)}>Cancel</button>
+ <button className="hr-btn primary" onClick={() => { saveHdrVals(hdrVals); setHdrOpen(false); }}>Save</button>
+ </div>
+ </div>
+ </div>
+ )}
+ <div className="wbx-conv-msgs" ref={scrollRef} onScroll={onScroll}>
+ {loading && <div className="hr-empty" style={{ marginTop: 40 }}>Loading conversation…</div>}
+ {!loading && msgs.length === 0 && (
+ <div className="wbx-hero">
+ <h1>{target.baseId ? <HarnessLogo id={target.baseId} size={30} /> : null}<span>{target.name}</span></h1>
+ </div>
+ )}
+ {/* Shared message list (UI Core): blocks render in stream order so tool activity
+ interleaves with prose. HR-specific chrome rides the override slots. */}
+ {!loading && (
+ <ChatMessages
+ messages={msgs}
+ roleLabel={(m: { role: string }) => (m.role === 'user' ? 'You' : target.name)}
+ renderMarkdown={mdRenderer}
+ // The default incomplete badge asserted "hit its step or time limit" for EVERY
+ // incomplete turn, including turns that hit neither — a deploy restart landing under
+ // a live turn settles as incomplete too. The badge now claims only what is true of
+ // every cause; the specific cause renders below, and only when the record knows it.
+ statusLabels={{
+ failed: '✕ Failed. See the output above for the reason',
+ cancelled: '◼ Stopped by you',
+ incomplete: '◔ Stopped before finishing. Continue to resume',
+ }}
+ userExtras={(m: UserMsg) => (m.attachments && m.attachments.length > 0 ? (
+ <div className="wbx-attach-row">
+ {m.attachments.map((f, j) => <AttachCard key={j} name={f.name} dataUri={f.dataUri} />)}
+ </div>
+ ) : null)}
+ assistantFooter={(m: AsstMsg, i: number) => (
+ <>
+ {m.status === 'incomplete' && m.incompleteReason && (
+ <div className="wbx-incomplete-why">
+ {m.incompleteReason === 'max_steps' ? 'It hit its step limit.'
+ : m.incompleteReason === 'timeout' ? 'It hit its time limit.'
+ : m.incompleteReason === 'interrupted'
+ ? 'The turn was interrupted before it finished, for example by a server restart. No limit was hit.'
+ : null}
+ </div>
+ )}
+ <OutputFiles files={m.files.filter((f) => !isInternalOutput(f.filename))}
+ onPreview={setPreview} />
+ {m.status !== 'running' && asstText(m) && (
+ <div className="wbx-actrow">
+ <button className="wbx-act-ic" title={copiedIdx === i ? 'Copied' : 'Copy'}
+ onClick={async () => {
+ try { await navigator.clipboard.writeText(asstText(m)); setCopiedIdx(i); setTimeout(() => setCopiedIdx((x) => (x === i ? null : x)), 1400); } catch { /* blocked */ }
+ }}>{copiedIdx === i ? <iconify-icon icon="tabler:check"></iconify-icon> : <iconify-icon icon="tabler:copy"></iconify-icon>}</button>
+ {i === msgs.length - 1 && !busy && (
+ <>
+ {/* Continue = one more turn on the SAME session (prevId threads automatically). */}
+ <button className="wbx-act-ic" title="Continue"
+ onClick={() => void send('Continue where you left off and finish the remaining work.')}><iconify-icon icon="tabler:arrow-forward"></iconify-icon></button>
+ {/* Revise = put the prior prompt back in the composer for editing; sending it
+ continues this session rather than forking a new one. */}
+ <button className="wbx-act-ic" title="Revise"
+ onClick={() => {
+ const lu = [...msgs].reverse().find((x) => x.role === 'user');
+ if (lu && 'text' in lu && lu.text) { setInput(lu.text); taRef.current?.focus(); }
+ }}><iconify-icon icon="tabler:pencil"></iconify-icon></button>
+ </>
+ )}
+ </div>
+ )}
+ </>
+ )}
+ />
+ )}
+ </div>
+
+ {!atBottom && (
+ <button className="wbx-jump" title="Jump to latest" onClick={() => { setAtBottom(true); jumpToBottom(); }}>
+ <Chevron dir="down" size={18} />
+ </button>
+ )}
+
+ {/* Shared composer (UI Core): Enter sends, auto-grows to 15 rows; HR chrome via slots. */}
+ <Composer
+ inline
+ value={input}
+ onChange={setInput}
+ onSend={() => send(input, files)}
+ disabled={!target.backend || busy}
+ placeholder={!target.backend ? 'This harness is coming soon' : (sessionId || msgs.length > 0) ? `Reply to ${target.name}…` : 'Describe a task…'}
+ inputRef={taRef}
+ attachments={files.length > 0 ? (
+ <div className="wbx-attach-row in-composer">
+ {files.map((f, j) => (
+ <AttachCard key={j} name={f.name} dataUri={f.dataUri} onRemove={() => setFiles((p) => p.filter((_, k) => k !== j))} />
+ ))}
+ </div>
+ ) : null}
+ accessoriesLeft={(
+ <>
+ <input ref={fileRef} type="file" multiple hidden onChange={(e) => { pickFiles(e.target.files); e.target.value = ''; }} />
+ <button className="wbx-comp-ic" type="button" title="Attach files" aria-label="Attach files" disabled={!target.backend || busy} onClick={() => fileRef.current?.click()}><IcPaperclip size={16} /></button>
+ </>
+ )}
+ renderSend={() => (busy && (sessionId ?? sidRef.current) ? (
+ // A running turn can't Send anyway, the slot becomes Stop.
+ <button className="hr-btn primary wbx-send wbx-send-stop" type="button" title="Stop this turn" disabled={stopping} onClick={stop}>
+ <iconify-icon icon="tabler:player-stop-filled"></iconify-icon>{stopping ? 'Stopping…' : 'Stop'}
+ </button>
+ ) : (
+ <button className="hr-btn primary wbx-send" type="button" onClick={() => send(input, files)} disabled={!target.backend || busy || (!input.trim() && files.length === 0)}>Send</button>
+ ))}
+ tray={models.length > 0 ? (
+ // The route chip, as in Arena: the runtime, the model for this task, a menu to change it.
+ <Chip ref={modelBtnRef} slot={false} className={'ar2-chip' + (modelOpen ? ' is-menu-open' : '')}
+ icon={target.baseId ? <HarnessLogo id={target.baseId} size={14} /> : undefined}
+ label={(
+ <>
+ <span className="uic-chip-t">{target.runtime || target.name}</span>
+ <span className="ar2-route-model">{target.model || 'default model'}</span>
+ <iconify-icon icon="tabler:chevron-down" className="ar2-route-chev"></iconify-icon>
+ </>
+ )}
+ onClick={() => setModelOpen((v) => !v)}
+ aria-haspopup="listbox" aria-expanded={modelOpen}
+ aria-label={`${target.runtime || target.name}, model ${target.model || 'default'}. Change model`} />
+ ) : null}
+ />
+ <Popover open={modelOpen} anchorRef={modelBtnRef} onClose={() => setModelOpen(false)} width={280} minHeight={120} placement="above" className="wbx-model-pop" label="Model for this task">
+ <div className="wbx-model-head">Model for this task</div>
+ <div role="listbox" aria-label="Model for this task">
+ {models.map((m) => {
+ const ok = modelAvailable(target.backend, m);
+ return (
+ <button key={m} type="button" role="option" aria-selected={m === target.model} className={'wbx-model-opt' + (m === target.model ? ' is-on' : '')} disabled={!ok}
+ onClick={() => { onModel(m); setModelOpen(false); }}>
+ <span>{m}</span>{!ok && <span className="wbx-model-meta">no provider</span>}
+ </button>
+ );
+ })}
+ </div>
+ </Popover>
+ </div>
+ {preview && <>
+ <div className="wbx-vresize" onMouseDown={onPreviewResize} title="Drag to resize" />
+ <div className="wbx-preview-pane" style={{ width: previewW, flex: '0 0 auto' }}>
+ <FilePreview file={preview} onClose={() => setPreview(null)} />
+ </div>
+ </>}
+ {outOfCredits && (
+ <InsufficientCreditsModal balance={outOfCredits.balance}
+ onClose={clearOutOfCredits} />
+ )}
+ </div>
+ );
+}
+
+// ── Trace tab: the ORIGINAL Traces component (TracesMain) scoped to the selected Task, the
+// session list is unnecessary here because the task list on the left already selects the session.
+function TraceView({ sid }: { sid: string | null }) {
+ useEffect(() => {
+ traceStore.select(sid || null);
+ return () => { traceStore.select(null); };
+ }, [sid]);
+ if (!sid) {
+ return (
+ <div className="run-trace-embed"><div className="session-empty">Run the task first, its trace appears here.</div></div>
+ );
+ }
+ return (
+ <div className="run-trace-embed">
+ <TracesMain />
+ </div>
+ );
+}
diff --git a/ui/src/components/revamp/Shell.tsx b/ui/src/components/revamp/Shell.tsx
index 00513c90..0b02bcda 100644
--- a/ui/src/components/revamp/Shell.tsx
+++ b/ui/src/components/revamp/Shell.tsx
@@ -6,13 +6,14 @@
// Tasks / Analytics / API Keys / Settings, with Support/Feedback footer.
import 'iconify-icon';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import { useQuickstart, quickstartDone } from '@/lib/quickstart';
import Link from 'next/link';
import { usePathname, useRouter } from 'next/navigation';
import { getSession, logout } from '@/lib/auth';
+import { PLATFORM_ADMIN_ORGS, SELF_HOSTED, SELF_HOSTED_NAV } from '@/lib/edition';
import { useWorkspace } from '@/lib/workspace';
import { listCustom, OOB } from '@/lib/harness';
import { fetchTraceWindow, type TraceCard } from '@/lib/revamp-data';
-import { PLATFORM_ADMIN_ORGS, SELF_HOSTED, SELF_HOSTED_NAV } from '@/lib/edition';
// Global search result, a workspace to switch to, a harness to open, or a task to jump into.
type SearchItem =
@@ -37,20 +38,42 @@ function highlight(text: string, q: string): React.ReactNode {
// Finalized IA (2026-07-19 prototype revision): Monetization joins the workspace nav;
// Workspace Settings moves INTO the workspace switcher menu (no standalone sidebar entry).
-const WORKSPACE_NAV = [
- { href: '/quickstart', icon: 'tabler:rocket', label: 'Quickstart' },
- { href: '/overview', icon: 'tabler:home', label: 'Overview' },
- // Above Harnesses on purpose: a kit IS a configured Harness plus its app, so it is the
- // shorter path to something working, and the thing to try before building one by hand.
- { href: '/kits', icon: 'tabler:sparkles', label: 'Starter Kits' },
- { href: '/harnesses', icon: 'tabler:assembly', label: 'Harnesses' },
- { href: '/tasks', icon: 'tabler:list-details', label: 'Tasks' },
- // Monetization (builder revenue / Stripe Connect) hidden until the backend ships, owner
- // decision 2026-07-21; the route stays for direct links, only the nav entry is removed.
- { href: '/keys', icon: 'tabler:key', label: 'API Keys' },
-].filter((n) => !SELF_HOSTED || SELF_HOSTED_NAV.includes(n.href));
+// v2 IA (harness_router_v2_design, 2026-08-31): grouped sidebar. Tasks stays in Build as a
+// TRANSITIONAL deviation from the design — the v2 model folds tasks into each harness, but per
+// the owner's direction the current chat workbench is embedded untouched until he guides that
+// migration, and it must stay reachable. Unbuilt pages (Benchmark) are not listed at all.
+type NavItem = { href?: string; icon?: string; img?: string; label: string; soon?: boolean };
+/** Where the community is. Shown as a row of marks in the expanded sidebar; as menu entries on the rail. */
+const SOCIALS = [
+ { label: 'Discord', href: 'https://discord.gg/nPcbwqVPb2', icon: 'tabler:brand-discord' },
+ { label: 'GitHub', href: 'https://github.com/HarnessRouter', icon: 'tabler:brand-github' },
+ { label: 'LinkedIn', href: 'https://linkedin.com/company/harnessrouter/', icon: 'tabler:brand-linkedin' },
+ { label: 'X', href: 'https://x.com/HARNESSROUTER', icon: 'tabler:brand-x' },
+];
+
+const NAV_GROUPS: { label: string | null; items: NavItem[] }[] = [
+ { label: null, items: [
+ { href: '/overview', icon: 'tabler:chart-histogram', label: 'Dashboard' },
+ { href: '/quickstart', icon: 'tabler:bolt', label: 'Quickstart' },
+ ] },
+ { label: 'Build', items: [
+ // Above the harnesses on purpose: a kit IS a configured Harness plus its app, so it is the
+ // shorter path to something working, and the thing to try before building one by hand.
+ { href: '/kits', icon: 'tabler:sparkles', label: 'Starter Kits' },
+ // The mark itself, in greyscale (public/harnessrouter-logo-gray.svg, generated by luminance
+ // from the colour mark), stands for the product's core object.
+ { href: '/harnesses', img: '/harnessrouter-logo-gray.svg', label: 'Agent harnesses' },
+ ] },
+ { label: 'Access', items: [
+ { href: '/keys', icon: 'tabler:key', label: 'API keys' },
+ ] },
+]
+ // Self-hosted keeps only the entries the box can actually serve (see lib/edition.ts), and a
+ // group with nothing left in it disappears rather than showing a bare heading.
+ .map((g) => ({ ...g, items: g.items.filter((n) => !SELF_HOSTED || (n.href && SELF_HOSTED_NAV.includes(n.href))) }))
+ .filter((g) => g.items.length > 0);
// Platform-org-only surfaces (the Integrations console configures GLOBAL model routing).
-// Customer BYOK later widens this to every org.
+// Self-hosted: your own keys, on your own box — bring-your-own-key IS the product there.
const PLATFORM_NAV = [
{ href: '/integrations', icon: 'tabler:plug-connected', label: 'Integrations', orgs: PLATFORM_ADMIN_ORGS },
];
@@ -76,6 +99,61 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit
.catch(() => { /* the menu just says "this instance" */ });
}, []);
const [mobileNav, setMobileNav] = useState(false);
+ // Quickstart progress rides on its sidebar entry until all four steps are done.
+ const [qs] = useQuickstart();
+ const qsDone = quickstartDone(qs);
+ // v2 resizable sidebar: drag 64-340, release under 150 snaps to the 64px icon rail,
+ // double-click toggles. Width persists per browser; expanded = navW >= 150 (the design's rule).
+ const [navW, setNavW] = useState(268);
+ const [dragging, setDragging] = useState(false);
+ const dragRef = useRef({ startX: 0, startW: 268 });
+ useEffect(() => {
+ try {
+ const saved = Number(localStorage.getItem('hr.v2.navW') || '');
+ if (saved >= 64 && saved <= 340) setNavW(saved < 150 ? 64 : saved);
+ // Tablet default: below 1025 the rail is the right starting point.
+ else if (window.innerWidth <= 1024) setNavW(64);
+ } catch { /* storage unavailable -> keep the default */ }
+ }, []);
+ const commitNavW = useCallback((w: number) => {
+ const snapped = w < 150 ? 64 : Math.min(340, Math.max(150, w));
+ setNavW(snapped);
+ try { localStorage.setItem('hr.v2.navW', String(snapped)); } catch { /* ignore */ }
+ }, []);
+ const onDragStart = useCallback((e: React.PointerEvent) => {
+ dragRef.current = { startX: e.clientX, startW: navW };
+ setDragging(true);
+ const move = (ev: PointerEvent) => {
+ const w = dragRef.current.startW + (ev.clientX - dragRef.current.startX);
+ setNavW(Math.min(340, Math.max(64, w)));
+ };
+ const up = (ev: PointerEvent) => {
+ window.removeEventListener('pointermove', move);
+ window.removeEventListener('pointerup', up);
+ setDragging(false);
+ commitNavW(dragRef.current.startW + (ev.clientX - dragRef.current.startX));
+ };
+ window.addEventListener('pointermove', move);
+ window.addEventListener('pointerup', up);
+ }, [navW, commitNavW]);
+ // The icon rail is a desktop preference. On a phone the sidebar is a drawer, and a drawer is
+ // always the full nav: labels, group headings, the workspace card. The stored width still
+ // applies the moment the viewport is wide again.
+ const [mobile, setMobile] = useState(false);
+ useEffect(() => {
+ const mq = window.matchMedia('(max-width: 768px)');
+ const sync = () => setMobile(mq.matches);
+ sync(); mq.addEventListener('change', sync);
+ return () => mq.removeEventListener('change', sync);
+ }, []);
+ const railed = navW < 150 && !mobile;
+ // The width variable must live on the ROOT, not on the aside: .v2-main is a sibling, and a
+ // custom property set inline on the aside never cascades to it — so the content margin stayed
+ // 268px with the rail collapsed, leaving exactly the dead gap the owner screenshotted.
+ useEffect(() => {
+ document.documentElement.style.setProperty('--v2-navw', `${navW}px`);
+ return () => { document.documentElement.style.removeProperty('--v2-navw'); };
+ }, [navW]);
const [connectOpen, setConnectOpen] = useState(false);
const wsRef = useRef<HTMLDivElement>(null);
const acctRef = useRef<HTMLDivElement>(null);
@@ -142,8 +220,9 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit
if (it.kind === 'workspace') {
if (it.current) return;
setCurrent(it.id);
- // Match the switcher: hard reload so every workspace-scoped surface re-queries.
- window.location.reload();
+ // Match the switcher: hard reload so every workspace-scoped surface re-queries, and
+ // without the query string, so a record from the old workspace does not stay open.
+ window.location.assign(window.location.pathname);
return;
}
if (it.kind === 'harness') { router.push(`/harnesses/${encodeURIComponent(it.id)}`); return; }
@@ -153,7 +232,7 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit
// Hard nav (not router.push): the workbench binds its deep-linked task on mount, so when the
// user is already on /tasks a client-side query swap changes the URL but doesn't reopen the
// task. A full load remounts the workbench and opens the exact task every time.
- window.location.assign(`/tasks?${p.toString()}`);
+ window.location.assign(`/harnesses?${p.toString()}`);
}, [router, setCurrent]);
const onSearchKey = (e: React.KeyboardEvent) => {
@@ -209,8 +288,11 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit
useEffect(() => { setMobileNav(false); setSearchOpen(false); }, [pathname]);
const s = getSession();
- const initials = (s?.member?.name || s?.member?.email || '?').slice(0, 2).toUpperCase();
- const avatarUrl = (s?.member?.avatar_url as string) || '';
+ const initials = SELF_HOSTED
+ ? (selfHostUser || '?').slice(0, 2).toUpperCase()
+ : (s?.member?.name || s?.member?.email || '?').slice(0, 2).toUpperCase();
+ const avatarUrl = SELF_HOSTED ? '' : ((s?.member?.avatar_url as string) || '');
+ const acctLabel = SELF_HOSTED ? (selfHostUser || 'This instance') : (s?.member?.email || 'Account');
const isActive = (href: string) => pathname === href || pathname.startsWith(href + '/');
const renderGroup = (title: string, icon: string, items: SearchItem[], offset: number) => {
@@ -246,101 +328,51 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit
return (
<>
- <header className="app-header">
- <Link className="brand" href="/dashboard" aria-label="Open Dashboard">
- {/* Full wordmark on roomy headers; the icon alone once space gets tight. */}
- {/* eslint-disable-next-line @next/next/no-img-element -- small static brand asset */}
- <img className="brand-full" src="/harnessrouter-wordmark.png" alt="HarnessRouter" />
- {/* eslint-disable-next-line @next/next/no-img-element -- small static brand asset */}
- <img className="brand-icon" src="/harnessrouter-logo.svg" alt="HarnessRouter" />
- </Link>
- <div className="global-search" ref={searchRef}>
- <iconify-icon icon="tabler:search" aria-hidden="true"></iconify-icon>
- <input type="search" placeholder="Search workspaces, harnesses, tasks"
- aria-label="Search workspaces, harnesses, and tasks" role="combobox"
- aria-expanded={searchOpen} aria-controls="global-search-panel" autoComplete="off"
- ref={searchInputRef} value={query}
- onFocus={() => { setSearchOpen(true); void ensureSearchData(); }}
- onChange={(e) => { setQuery(e.target.value); setSearchOpen(true); void ensureSearchData(); }}
- onKeyDown={onSearchKey} />
- <span className="search-key">⌘ K</span>
- {searchOpen && q ? (
- <div className="search-panel" id="global-search-panel" role="listbox" aria-label="Search results">
- {flat.length === 0 ? (
- <div className="search-empty">{searchLoading ? 'Searching…' : `No matches for “${query.trim()}”`}</div>
- ) : (
- <>
- {renderGroup('Workspaces', 'tabler:building', groups!.ws, 0)}
- {renderGroup('Harnesses', 'tabler:assembly', groups!.hs, groups!.ws.length)}
- {renderGroup('Tasks', 'tabler:list-details', groups!.ts, groups!.ws.length + groups!.hs.length)}
- </>
- )}
- </div>
- ) : null}
- </div>
- <div className="header-utils">
- <a className="utility-link" href="https://harnessrouter.ai/docs" target="_blank" rel="noreferrer"><iconify-icon icon="tabler:book-2"></iconify-icon>Docs</a>
- {SELF_HOSTED ? (
- <div className="account-wrap" ref={acctRef}>
- <button className="account-button" type="button" aria-expanded={acctMenu}
- aria-label="Account" onClick={() => setAcctMenu((v) => !v)}>
- <iconify-icon icon="tabler:user"></iconify-icon>
- </button>
- {acctMenu && (
- <div className="account-menu">
- <div className="account-meta">
- <strong>Signed in</strong>
- <span>{selfHostUser || 'this instance'}</span>
- </div>
- <button className="menu-item" type="button" onClick={() => {
- setAcctMenu(false);
- router.push('/profile');
- }}><iconify-icon icon="tabler:user-cog"></iconify-icon>Profile</button>
- <button className="menu-item" type="button" onClick={async () => {
- setAcctMenu(false);
- await fetch('/api/selfhost/logout', { method: 'POST' }).catch(() => undefined);
- // Full navigation: the middleware must re-evaluate without the cookie.
- window.location.assign('/login');
- }}><iconify-icon icon="tabler:logout"></iconify-icon>Sign out</button>
- </div>
- )}
- </div>
- ) : (
- <div className="account-wrap" ref={acctRef}>
- <button className="account-button" type="button" aria-expanded={acctMenu} onClick={() => setAcctMenu((v) => !v)}>
- {avatarUrl
- /* eslint-disable-next-line @next/next/no-img-element -- external OAuth photo, not a local asset */
- ? <img className="account-avatar" src={avatarUrl} alt="" referrerPolicy="no-referrer" />
- : initials}
+ {/* mobile top bar (<=768): brand + hamburger; the sidebar becomes an overlay drawer */}
+ <div className="v2-mobilebar">
+ {/* eslint-disable-next-line @next/next/no-img-element -- small static brand asset */}
+ <img src="/harnessrouter-logo.svg" alt="" />
+ <strong>HarnessRouter Console</strong>
+ <button type="button" aria-label="Open navigation" aria-expanded={mobileNav}
+ onClick={() => setMobileNav((v) => !v)}><iconify-icon icon="tabler:menu-2"></iconify-icon></button>
+ </div>
+
+ <aside className={'v2-side' + (railed ? ' is-rail' : '') + (dragging ? ' is-dragging' : '') + (mobileNav ? ' is-open' : '')}
+ style={{ ['--v2-navw' as string]: `${navW}px` }} aria-label="Product navigation">
+ <div className="v2-resize" role="separator" aria-orientation="vertical" aria-label="Resize navigation"
+ onPointerDown={onDragStart} onDoubleClick={() => commitNavW(railed ? 268 : 64)} />
+
+ <div className="v2-title">
+ {/* Expanded: the full wordmark, nothing else (no "Console" suffix). Rail: icon only.
+ eslint-disable-next-line @next/next/no-img-element -- small static brand asset */}
+ <span className="v2-brand">
+ {/* eslint-disable-next-line @next/next/no-img-element -- small static brand asset */}
+ <img className="v2-brand-full" src="/harnessrouter-wordmark.png" alt="HarnessRouter" />
+ {/* eslint-disable-next-line @next/next/no-img-element -- small static brand asset */}
+ <img className="v2-brand-icon" src="/harnessrouter-logo.svg" alt="HarnessRouter" />
+ </span>
+ <span className="v2-title-actions">
+ {/* The explicit collapse/expand toggle from the design's title row. Search moved out
+ of this row entirely (it crowded the brand) - Cmd+K still opens the palette. */}
+ <button className="v2-collapsebtn" type="button"
+ aria-label={railed ? 'Expand navigation' : 'Collapse navigation'}
+ title={railed ? 'Expand navigation' : 'Collapse navigation (or press Cmd+K to search)'}
+ onClick={() => commitNavW(railed ? 268 : 64)}>
+ <iconify-icon icon="tabler:layout-sidebar"></iconify-icon>
</button>
- {acctMenu && (
- <div className="account-menu">
- <div className="account-meta"><strong>{s?.member?.name || 'Account'}</strong><span>{s?.member?.email || ''}</span></div>
- <button className="menu-item" type="button" onClick={() => { setAcctMenu(false); router.push('/billing'); }}><iconify-icon icon="tabler:credit-card"></iconify-icon>Billing &amp; plan</button>
- <button className="menu-item" type="button" onClick={() => { setAcctMenu(false); router.push('/account'); }}><iconify-icon icon="tabler:settings"></iconify-icon>Account settings</button>
- <button className="menu-item" type="button" onClick={() => { logout(); router.replace('/login'); }}><iconify-icon icon="tabler:logout"></iconify-icon>Sign out</button>
- </div>
- )}
- </div>
- )}
- <button className="icon-button mobile-menu" type="button" aria-label="Open navigation" aria-expanded={mobileNav}
- onClick={() => setMobileNav((v) => !v)}><iconify-icon icon="tabler:menu-2"></iconify-icon></button>
+ </span>
</div>
- </header>
- <aside className={'sidebar' + (mobileNav ? ' is-open' : '')} aria-label="Product navigation">
{SELF_HOSTED ? null : (
- <div className="side-section global-nav">
- <Link className="side-nav" href="/dashboard" aria-current={isActive('/dashboard') ? 'page' : undefined}>
- <iconify-icon icon="tabler:layout-dashboard"></iconify-icon>Dashboard
- </Link>
- </div>
- )}
<div className="switcher-wrap" ref={wsRef}>
- <p className="side-label">Workspace</p>
- <button className="workspace-switcher" type="button" aria-expanded={wsMenu} onClick={() => setWsMenu((v) => !v)}>
- <span><iconify-icon icon="tabler:building"></iconify-icon><span className="switcher-label">{current.name}</span></span>
- <iconify-icon icon="tabler:chevron-down"></iconify-icon>
+ <button className="v2-wscard" type="button" aria-expanded={wsMenu} onClick={() => setWsMenu((v) => !v)}
+ title={railed ? current.name : undefined}>
+ <span className="v2-wsavatar">{(current.name || '?').slice(0, 2).toUpperCase()}</span>
+ <span className="v2-wsmeta">
+ <span className="v2-wskicker">Workspace</span>
+ <span className="v2-wsname">{current.name}</span>
+ </span>
+ <iconify-icon icon="tabler:selector" className="v2-wschev"></iconify-icon>
</button>
{wsMenu && (
<div className="workspace-menu">
@@ -352,8 +384,10 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit
if (w.id !== current.id) {
setCurrent(w.id);
// Every data surface scopes reads by the active workspace, hard refresh so
- // long-lived client caches (recents polls, dashboards) re-query cleanly.
- window.location.reload();
+ // long-lived client caches (recents polls, dashboards) re-query cleanly. The
+ // query string is dropped on purpose: an open arena or task belongs to the
+ // workspace it was made in, not to the one just chosen.
+ window.location.assign(window.location.pathname);
}
}}>
<span>{w.name}</span>
@@ -372,58 +406,147 @@ export function Shell({ children, credits }: { children: React.ReactNode; credit
</div>
)}
</div>
- <div className="side-section workspace-nav">
- {WORKSPACE_NAV.map((n) => (
- <Link key={n.href} className="side-nav" href={n.href} aria-current={isActive(n.href) ? 'page' : undefined}>
- <iconify-icon icon={n.icon}></iconify-icon>{n.label}
- </Link>
+ )}
+
+ <nav className="v2-nav">
+ {NAV_GROUPS.map((g, gi) => (
+ <div key={gi} className="v2-group">
+ {g.label ? <p className="v2-group-label">{g.label}</p> : null}
+ {g.items.map((n) => n.soon ? (
+ <span key={n.label} className="v2-item is-soon" title={railed ? `${n.label} (soon)` : undefined}>
+ <iconify-icon icon={n.icon || ''}></iconify-icon><span>{n.label}</span>
+ <span className="v2-soon-pill">soon</span>
+ </span>
+ ) : (
+ <Link key={n.href} className="v2-item" href={n.href!} title={railed ? n.label : undefined}
+ aria-current={isActive(n.href!) ? 'page' : undefined}>
+ {n.img
+ /* eslint-disable-next-line @next/next/no-img-element -- small static brand asset */
+ ? <img className="v2-item-img" src={n.img} alt="" aria-hidden="true" />
+ : <iconify-icon icon={n.icon || ''}></iconify-icon>}
+ <span>{n.label}</span>
+ {n.href === '/quickstart' && qsDone < 4 && <span className="v2-item-badge" aria-label={`${qsDone} of 4 steps done`}>{qsDone}/4</span>}
+ </Link>
+ ))}
+ </div>
))}
+ {SELF_HOSTED ? null : (
+ <div className="v2-group">
+ <p className="v2-group-label">Billing</p>
+ <Link className="v2-item" href="/billing" title={railed ? 'Credits' : undefined}
+ aria-current={isActive('/billing') ? 'page' : undefined}
+ aria-label={credits != null ? `Credits, balance ${credits}` : 'Credits'}>
+ {/* Coins, not a dollar sign: credits are not currency and must not look like it. */}
+ <iconify-icon icon="tabler:coins"></iconify-icon><span>Credits</span>
+ <span className="v2-item-end">{credits != null ? credits.toLocaleString() : '—'}</span>
+ </Link>
+ </div>
+ )}
{PLATFORM_NAV.filter((n) => (SELF_HOSTED
? SELF_HOSTED_NAV.includes(n.href) // your own keys, on your own box
- : n.orgs.includes(s?.orgId || ''))).map((n) => (
- <Link key={n.href} className="side-nav" href={n.href} aria-current={isActive(n.href) ? 'page' : undefined}>
- <iconify-icon icon={n.icon}></iconify-icon>{n.label}
- </Link>
- ))}
- </div>
- <div className="sidebar-foot" ref={connectRef}>
- {SELF_HOSTED ? null : (
- <button className="credits-card" type="button" onClick={() => router.push('/billing')}
- aria-label={credits != null ? `Credit balance, ${credits} credits — manage billing` : 'Billing'}>
- <span className="credits-card-coin" aria-hidden="true"><iconify-icon icon="tabler:currency-dollar"></iconify-icon></span>
- <span className="credits-card-body">
- <span className="credits-card-label">Credits</span>
- <span className="credits-card-value">{credits != null ? credits.toLocaleString() : '—'}</span>
- </span>
- <iconify-icon className="credits-card-go" icon="tabler:chevron-right" aria-hidden="true"></iconify-icon>
- </button>
+ : n.orgs.includes(s?.orgId || ''))).length > 0 && (
+ <div className="v2-group">
+ <p className="v2-group-label">Platform</p>
+ {PLATFORM_NAV.filter((n) => (SELF_HOSTED
+ ? SELF_HOSTED_NAV.includes(n.href)
+ : n.orgs.includes(s?.orgId || ''))).map((n) => (
+ <Link key={n.href} className="v2-item" href={n.href} title={railed ? n.label : undefined}
+ aria-current={isActive(n.href) ? 'page' : undefined}>
+ <iconify-icon icon={n.icon}></iconify-icon><span>{n.label}</span>
+ </Link>
+ ))}
+ </div>
+ )}
+ </nav>
+
+ <div className="v2-foot" ref={acctRef}>
+ {/* The four places we live, as a row of marks when the sidebar has the width for it; on
+ the icon rail the same four move into the account menu instead. */}
+ {!railed && (
+ <div className="v2-socials" aria-label="Community links">
+ {SOCIALS.map((x) => (
+ <a key={x.label} className="v2-social" href={x.href} target="_blank" rel="noreferrer" title={x.label} aria-label={x.label}>
+ <iconify-icon icon={x.icon}></iconify-icon>
+ </a>
+ ))}
+ </div>
)}
- <button className="side-nav connect-trigger" type="button" aria-expanded={connectOpen}
- onClick={() => setConnectOpen((v) => !v)}>
- <iconify-icon icon="tabler:world" aria-hidden="true"></iconify-icon>
- <span>Connect</span>
- <iconify-icon className="connect-chevron" icon="tabler:chevron-up" aria-hidden="true"></iconify-icon>
+ <button className="v2-account" type="button" aria-expanded={acctMenu}
+ onClick={() => setAcctMenu((v) => !v)} title={railed ? acctLabel : undefined}>
+ <span className="v2-avatar">
+ {avatarUrl
+ /* eslint-disable-next-line @next/next/no-img-element -- external OAuth photo, not a local asset */
+ ? <img className="ph-no-capture" src={avatarUrl} alt="" referrerPolicy="no-referrer" />
+ : initials}
+ </span>
+ {/* ph-no-capture: the email identifies the person. */}
+ <span className="v2-email ph-no-capture">{acctLabel}</span>
</button>
- {connectOpen && (
- <div className="connect-menu">
- <a className="connect-item" href="https://discord.gg/nPcbwqVPb2" target="_blank" rel="noopener noreferrer" aria-label="Open the public HarnessRouter Discord community in a new tab">
- <iconify-icon icon="tabler:brand-discord" aria-hidden="true"></iconify-icon><span>Discord</span><iconify-icon className="connect-external" icon="tabler:external-link" aria-hidden="true"></iconify-icon>
- </a>
- <a className="connect-item" href="https://github.com/HarnessRouter" target="_blank" rel="noopener noreferrer" aria-label="Open HarnessRouter on GitHub in a new tab">
- <iconify-icon icon="tabler:brand-github" aria-hidden="true"></iconify-icon><span>GitHub</span><iconify-icon className="connect-external" icon="tabler:external-link" aria-hidden="true"></iconify-icon>
- </a>
- <a className="connect-item" href="https://linkedin.com/company/harnessrouter/" target="_blank" rel="noopener noreferrer" aria-label="Open HarnessRouter on LinkedIn in a new tab">
- <iconify-icon icon="tabler:brand-linkedin" aria-hidden="true"></iconify-icon><span>LinkedIn</span><iconify-icon className="connect-external" icon="tabler:external-link" aria-hidden="true"></iconify-icon>
- </a>
- <a className="connect-item" href="https://x.com/HARNESSROUTER" target="_blank" rel="noopener noreferrer" aria-label="Open HarnessRouter on X in a new tab">
- <iconify-icon icon="tabler:brand-x" aria-hidden="true"></iconify-icon><span>X</span><iconify-icon className="connect-external" icon="tabler:external-link" aria-hidden="true"></iconify-icon>
- </a>
+ {acctMenu && (
+ <div className="account-menu" style={{ position: 'absolute', bottom: '100%', left: 12, right: 12, top: 'auto', marginBottom: 6 }}>
+ {SELF_HOSTED ? (
+ <div className="account-meta ph-no-capture"><strong>Signed in</strong><span>{selfHostUser || 'this instance'}</span></div>
+ ) : (
+ <div className="account-meta ph-no-capture"><strong>{s?.member?.name || 'Account'}</strong><span>{s?.member?.email || ''}</span></div>
+ )}
+ {SELF_HOSTED ? (
+ <button className="menu-item" type="button" onClick={() => { setAcctMenu(false); router.push('/profile'); }}><iconify-icon icon="tabler:user-cog"></iconify-icon>Profile</button>
+ ) : (<>
+ <button className="menu-item" type="button" onClick={() => { setAcctMenu(false); router.push('/billing'); }}><iconify-icon icon="tabler:credit-card"></iconify-icon>Billing &amp; plan</button>
+ <button className="menu-item" type="button" onClick={() => { setAcctMenu(false); router.push('/account'); }}><iconify-icon icon="tabler:settings"></iconify-icon>Account settings</button>
+ </>)}
+ <a className="menu-item" href="https://harnessrouter.ai/docs" target="_blank" rel="noreferrer"><iconify-icon icon="tabler:book-2"></iconify-icon>Docs</a>
+ {railed && SOCIALS.map((x) => (
+ <a key={x.label} className="menu-item" href={x.href} target="_blank" rel="noreferrer"><iconify-icon icon={x.icon}></iconify-icon>{x.label}</a>
+ ))}
+ {SELF_HOSTED ? (
+ <button className="menu-item" type="button" onClick={async () => {
+ setAcctMenu(false);
+ await fetch('/api/selfhost/logout', { method: 'POST' }).catch(() => undefined);
+ // Full navigation: the middleware must re-evaluate without the cookie.
+ window.location.assign('/login');
+ }}><iconify-icon icon="tabler:logout"></iconify-icon>Sign out</button>
+ ) : (
+ <button className="menu-item" type="button" onClick={() => { logout(); router.replace('/login'); }}><iconify-icon icon="tabler:logout"></iconify-icon>Sign out</button>
+ )}
</div>
)}
</div>
</aside>
- <main ref={mainRef}>{children}</main>
+ {/* Cmd+K search: the v2 chrome has no header, so search lives in a palette overlay. All
+ search state/logic is unchanged - only where the input renders moved. */}
+ {searchOpen && (
+ <div className="v2-search-overlay" onMouseDown={() => setSearchOpen(false)}>
+ <div className="v2-search-box" ref={searchRef} onMouseDown={(e) => e.stopPropagation()}>
+ <div className="global-search">
+ <iconify-icon icon="tabler:search" aria-hidden="true"></iconify-icon>
+ <input type="search" placeholder="Search workspaces, harnesses, tasks"
+ aria-label="Search workspaces, harnesses, and tasks" role="combobox"
+ aria-expanded={searchOpen} aria-controls="global-search-panel" autoComplete="off"
+ ref={searchInputRef} value={query} autoFocus
+ onChange={(e) => { setQuery(e.target.value); void ensureSearchData(); }}
+ onKeyDown={onSearchKey} />
+ <span className="search-key">esc</span>
+ </div>
+ {q ? (
+ <div className="search-panel" id="global-search-panel" role="listbox" aria-label="Search results">
+ {flat.length === 0 ? (
+ <div className="search-empty">{searchLoading ? 'Searching…' : `No matches for “${query.trim()}”`}</div>
+ ) : (
+ <>
+ {renderGroup('Workspaces', 'tabler:building', groups!.ws, 0)}
+ {renderGroup('Harnesses', 'tabler:assembly', groups!.hs, groups!.ws.length)}
+ {renderGroup('Tasks', 'tabler:list-details', groups!.ts, groups!.ws.length + groups!.hs.length)}
+ </>
+ )}
+ </div>
+ ) : null}
+ </div>
+ </div>
+ )}
+
+ <main className="v2-main" ref={mainRef}>{children}</main>
{wsCreate && (
<div className="modal-backdrop">
diff --git a/ui/src/lib/analytics.tsx b/ui/src/lib/analytics.tsx
new file mode 100644
index 00000000..ecb2e95e
--- /dev/null
+++ b/ui/src/lib/analytics.tsx
@@ -0,0 +1,11 @@
+'use client';
+// Product analytics, open-source build: there is no analytics pipeline in this distribution, so
+// `track` is a no-op with the hosted signature. Pages ported from the hosted console keep their
+// call sites unchanged (same file, same lines), which is what keeps the two trees one product
+// rather than a fork — the calls simply have nothing behind them here, like the other surfaces
+// gated in lib/edition.ts. Nothing is recorded and nothing leaves the browser.
+export const ANALYTICS_ENABLED = false;
+
+export function track(_event: string, _props?: Record<string, unknown>): void {
+ // Intentionally empty.
+}
diff --git a/ui/src/lib/chat.ts b/ui/src/lib/chat.ts
index 8d80bad1..82bc6985 100644
--- a/ui/src/lib/chat.ts
+++ b/ui/src/lib/chat.ts
@@ -89,6 +89,8 @@ export async function downloadFile(url: string, filename: string): Promise<void>
export interface SessionTurn {
id: string; status: string; user: string; assistant: string;
+ /** What this turn alone took and cost; absent on turns from before the gateway kept them. */
+ elapsed?: number | null; credits?: number | null;
user_files?: { name: string }[]; // caller-attached input files (names; bytes live in the workspace)
tools: { name: string; arguments: string; result?: string }[]; files: RespFile[];
}
diff --git a/ui/src/lib/conversation.ts b/ui/src/lib/conversation.ts
new file mode 100644
index 00000000..a84af075
--- /dev/null
+++ b/ui/src/lib/conversation.ts
@@ -0,0 +1,569 @@
+'use client';
+// The conversation controller: the state machine behind every agent chat surface in the console.
+//
+// It lives here, NOT in a page, because two surfaces now drive it: Tasks (one conversation at a
+// time) and Arena (N conversations side by side, one shared composer fanning a message out to all
+// of them). The pieces below are deliberately MODULE-LEVEL singletons: the conversation store, the
+// bus-suppression set, the pending-card list and the turn telemetry. A second copy of any of them
+// would give a second surface its own store, and the realtime bus would silently stop updating it.
+//
+// The split that makes sharing work: this module owns the turn lifecycle (send, stream, reconcile,
+// stop, settle) and owns NO composer state. `send(text, files)` takes what to send as arguments, so
+// one composer can drive one column or six.
+import { useEffect, useId, useRef, useState } from 'react';
+import { streamResponse, subscribeHarnessEvents, loadSessionTurns, cancelSession,
+ type RespFile, type SessionTurn } from '@/lib/chat';
+import { getCurrentWorkspaceRef } from '@/lib/workspace';
+import { track } from '@/lib/analytics';
+import { billing } from '@/app/(app)/billing/lib';
+import { oobById } from '@/lib/harness';
+import { withText, withReasoning, withStep, withResult } from 'reifyui';
+import { createConversationStore } from 'reifyui';
+
+/** Turn states the backend considers settled. One definition, used by every settle path. */
+export const TERMINAL_TURN = new Set(['done', 'completed', 'failed', 'error', 'cancelled', 'incomplete', 'timeout', 'max_turns']);
+
+/** A session card as the Recents/Arena lists see it (mirrors the gateway trace card). */
+export interface TraceCard {
+ session_id: string; title?: string; status?: string; finished_at?: number;
+ model?: string; event_count?: number; elapsed?: number; credits?: number;
+}
+
+export interface ChatTarget { name: string; backend: string | null; model?: string; baseId?: string;
+ /** The runtime this harness runs on and the model its settings default to (the footer names both). */
+ runtime?: string; defaultModel?: string }
+export interface UserMsg { role: 'user'; text: string; attachments?: { name: string; dataUri?: string }[] }
+export interface ToolStep { name: string; args: string; result?: string; callId?: string }
+// An assistant turn is an ORDERED list of blocks appended as events arrive, so tool activity is
+// interleaved with prose in real time (not all tools hoisted to the top).
+export type Block = { kind: 'text'; text: string } | { kind: 'tools'; reasoning: string; steps: ToolStep[] };
+export interface AsstMsg { role: 'assistant'; blocks: Block[]; files: RespFile[]; status: 'running' | 'done' | 'failed' | 'cancelled' | 'incomplete';
+ /** Why an incomplete turn is incomplete (max_steps | timeout | interrupted) — from the
+ * gateway's incomplete_details. Absent on records from before the field existed, which is
+ * why the badge itself must not assert a cause. */
+ incompleteReason?: string;
+ /** Seconds this turn took and the credits it cost, when the gateway kept them. */
+ elapsed?: number; credits?: number }
+// AGENTS.md / CLAUDE.md are harness-internal instruction files the runner seeds into the workspace
+// (they surface installed skills to the agent). They are never user-facing outputs, so they must
+// never render as output file cards, including on older sessions that captured them before the
+// gateway started excluding them.
+const _INTERNAL_OUT = new Set(['AGENTS.md', 'CLAUDE.md', 'QWEN.md']);
+export const isInternalOutput = (name?: string) =>
+ !!name && (_INTERNAL_OUT.has(name) || name.startsWith('.harness/') || name.includes('/.harness/'));
+export type Msg = UserMsg | AsstMsg;
+
+export function msgsFromTurns(turns: SessionTurn[]): { msgs: Msg[]; running: boolean } {
+ const m: Msg[] = [];
+ let running = false;
+ for (const t of turns) {
+ if (t.user || (t.user_files || []).length) {
+ m.push({ role: 'user', text: t.user,
+ attachments: (t.user_files || []).map((f) => ({ name: f.name })) });
+ }
+ const steps = (t.tools || []).map((x) => ({ name: x.name, args: x.arguments, result: x.result }));
+ const blocks: Block[] = [];
+ if (steps.length) blocks.push({ kind: 'tools', reasoning: '', steps });
+ if (t.assistant) blocks.push({ kind: 'text', text: t.assistant });
+ const st: AsstMsg['status'] = t.status === 'failed' || t.status === 'error' ? 'failed'
+ : t.status === 'cancelled' ? 'cancelled'
+ : (t.status === 'incomplete' || t.status === 'max_turns' || t.status === 'timeout') ? 'incomplete'
+ : (t.status === 'running' || t.status === 'starting' || t.status === 'in_progress') ? 'running' : 'done';
+ if (st === 'running') running = true;
+ m.push({ role: 'assistant', blocks, files: t.files || [], status: st,
+ incompleteReason: (t as { incomplete_reason?: string }).incomplete_reason || undefined,
+ elapsed: typeof t.elapsed === 'number' ? t.elapsed : undefined,
+ credits: typeof t.credits === 'number' ? t.credits : undefined });
+ }
+ return { msgs: m, running };
+}
+
+// Optimistic Recents entries: a just-sent NEW task shows in the list INSTANTLY. The durable card
+// only lands after session allocation + the first trace write (seconds on a cold start), so without
+// this the list lags every new send. An entry drops the moment the server list contains its session
+// (sid learned from response.created), or after a safety expiry if the send failed before a session
+// existed. Module-level (like _runningSids) so it survives panel re-renders.
+export type PendingCard = { tempId: string; harness: string; title: string; at: number; sid?: string };
+let _pendingCards: PendingCard[] = [];
+export function addPendingCard(harness: string, title: string): string {
+ const tempId = 'pend_' + Math.random().toString(36).slice(2);
+ _pendingCards.push({ tempId, harness, title, at: Date.now() });
+ return tempId;
+}
+export function setPendingSid(tempId: string, sid: string) {
+ const p = _pendingCards.find((x) => x.tempId === tempId);
+ if (p) p.sid = sid;
+}
+export function dropPending(tempId: string) { _pendingCards = _pendingCards.filter((x) => x.tempId !== tempId); }
+/** Pending entries still worth showing for this harness, given the server list; prunes the store. */
+export function livePending(harness: string, cards: TraceCard[] | null): PendingCard[] {
+ const now = Date.now();
+ _pendingCards = _pendingCards.filter((p) =>
+ now - p.at < 180_000 && !(p.sid && (cards || []).some((c) => c.session_id === p.sid)));
+ return _pendingCards.filter((p) => p.harness === harness);
+}
+
+// ── Per-conversation store (module-level, survives panel remount + tab switches) ────────────────
+// The Conversation component used to hold msgs/busy/stream in component-local state, so switching
+// conversations destroyed the optimistic user message AND the in-flight stream, that's why a
+// message "sent" to one conversation vanished when you came back, and why only the turn that had
+// already finished (reloadable from the server) ever showed. Hoisting this state here keeps every
+// conversation's messages + run status alive in the background; streams write to the store by key,
+// so switching is just a re-view and N concurrent turns all keep streaming.
+// The store mechanics live in UI Core (createConversationStore); these thin typed wrappers keep
+// every call site unchanged.
+export type ConvState = { msgs: Msg[]; busy: boolean; prevId: string | null; firstTurn: boolean; loaded: boolean };
+export const convStore = createConversationStore();
+export function getConvState(key: string): ConvState { return convStore.get(key) as ConvState; }
+export function setConvState(key: string, patch: Partial<ConvState> | ((s: ConvState) => Partial<ConvState>)): void {
+ convStore.set(key, patch);
+}
+export function useConvState(key: string): ConvState { return convStore.use(key) as ConvState; }
+
+// ── realtime broadcast bus → conv store ──────────────────────────────────────────────────────────
+// The gateway broadcasts every event of every session of a harness. We apply each event to the
+// conv store keyed by the REAL session id, so any conversation renders live regardless of which tab
+// (or none) started the turn, fixing "open a running session and see nothing until a hard refresh".
+// `_busSuppress` holds session ids whose turn THIS tab is already rendering via its own POST stream
+// (convKey === sid), so we don't double-apply deltas for those.
+export const _busSuppress = new Set<string>();
+// ── task_started / task_finished bookkeeping ────────────────────────────────────────────────
+// Both live at module scope for the same reason the conversation store does: a turn outlives
+// the component that started it (switch away, come back, reload).
+// Wall-clock turn start, keyed by conv key then re-keyed to the real session id once allocated.
+// Absent means "not observed by this browser" — duration is then omitted, never guessed.
+const _turnStart = new Map<string, number>();
+// A turn settles on whichever path wins: the SSE terminal event, or the 4s reconcile poll.
+// Reporting only the fast path would systematically under-count failures, because dropped
+// terminal events are exactly what the poll exists to repair.
+const _finished = new Set<string>();
+export function trackTaskFinished(sid: string, turnIndex: number, props: Record<string, string | number | boolean | null | undefined>): void {
+ const key = `${sid}#${turnIndex}`;
+ if (_finished.has(key)) return;
+ _finished.add(key);
+ const started = _turnStart.get(sid);
+ if (started) _turnStart.delete(sid);
+ track('task_finished', { ...props, turn_index: turnIndex,
+ duration_ms: started ? Math.round(performance.now() - started) : undefined });
+}
+/** Turn index = assistant messages so far - 1. One definition, used by both settle paths. */
+export function turnIndexOf(msgs: Msg[]): number {
+ return Math.max(0, msgs.filter((m) => m.role === 'assistant').length - 1);
+}
+
+// Sessions with a turn currently in flight, maintained from the bus (authoritative, no trace-card
+// lag) so the Recents "working" dot is accurate the instant a turn starts/ends.
+export const _runningSids = new Set<string>();
+const _busFn: Record<string, { name: string; callId: string }> = {};
+function busUpdateLast(sid: string, fn: (a: AsstMsg) => void) {
+ setConvState(sid, (s) => {
+ const out = s.msgs.slice();
+ for (let i = out.length - 1; i >= 0; i--) {
+ if (out[i].role === 'assistant') { const a = { ...(out[i] as AsstMsg) }; fn(a); out[i] = a; break; }
+ }
+ return { msgs: out };
+ });
+}
+function applyBusEvent(sid: string, responseId: string, ev: Record<string, unknown>, replay = false) {
+ if (!sid || _busSuppress.has(sid)) return; // initiating tab's POST stream owns this one
+ // History catch-up frames are dropped: an in-flight turn's progress-so-far is loaded from the
+ // authoritative durable trace via GET /v1/sessions/{sid}/turns (msgsFromTurns). Re-applying the
+ // same events off the bus would double-render (append the same text/tools twice). The bus is the
+ // live-FORWARD channel only; the trace snapshot + the reconcile poll own history + repair.
+ if (replay) return;
+ const t = ev.type as string;
+ switch (t) {
+ case 'harness.turn.started': {
+ // Ignore a REPLAYED start of a turn we've already finished (its response_id is our last prevId):
+ // a stale/duplicate start would otherwise append a phantom "Working…" turn that never completes.
+ if (responseId && getConvState(sid).prevId === responseId) return;
+ setConvState(sid, (s) => {
+ const last = s.msgs[s.msgs.length - 1];
+ if (last && last.role === 'assistant' && (last as AsstMsg).status === 'running') return {}; // already showing it
+ const user = String((ev.user_text as string) || '');
+ const add: Msg[] = [];
+ if (user) add.push({ role: 'user', text: user });
+ add.push({ role: 'assistant', blocks: [], files: [], status: 'running' });
+ return { msgs: [...s.msgs, ...add], busy: true, loaded: true };
+ });
+ break;
+ }
+ case 'response.reasoning_summary_text.delta':
+ busUpdateLast(sid, (a) => { a.blocks = withReasoning(a.blocks, ev.delta as string); }); break;
+ case 'response.output_item.added': {
+ const item = ev.item as Record<string, unknown>;
+ if (item?.type === 'function_call') _busFn[`${sid}:${ev.output_index}`] = { name: item.name as string, callId: (item.call_id as string) || '' };
+ else if (item?.type === 'function_call_output') busUpdateLast(sid, (a) => { a.blocks = withResult(a.blocks, (item.call_id as string) || '', String(item.output ?? '')); });
+ break;
+ }
+ case 'response.function_call_arguments.done': {
+ const fn = _busFn[`${sid}:${ev.output_index}`] || { name: 'tool', callId: '' };
+ busUpdateLast(sid, (a) => { a.blocks = withStep(a.blocks, { name: fn.name, args: (ev.arguments as string) || '', callId: fn.callId }); }); break;
+ }
+ case 'response.output_text.delta':
+ busUpdateLast(sid, (a) => { a.blocks = withText(a.blocks, ev.delta as string); }); break;
+ case 'response.output_text.annotation.added': {
+ const a = ev.annotation as Record<string, unknown>;
+ if (a?.type === 'container_file_citation') busUpdateLast(sid, (m) => { m.files = [...m.files, { container_id: a.container_id as string, file_id: a.file_id as string, filename: a.filename as string }]; });
+ break;
+ }
+ case 'response.completed':
+ busUpdateLast(sid, (a) => { a.status = 'done'; }); setConvState(sid, { busy: false, prevId: responseId, firstTurn: false }); break;
+ case 'response.incomplete':
+ busUpdateLast(sid, (a) => { a.status = 'incomplete'; }); setConvState(sid, { busy: false, prevId: responseId, firstTurn: false }); break;
+ case 'response.failed': {
+ // A user Stop arrives as response.failed with reason/status "cancelled", show it as
+ // Cancelled, not Failed (the session card + turn record already say cancelled).
+ const wasCancelled = ev.reason === 'cancelled'
+ || (ev.response as Record<string, unknown> | undefined)?.status === 'cancelled';
+ busUpdateLast(sid, (a) => { a.status = wasCancelled ? 'cancelled' : 'failed'; });
+ setConvState(sid, { busy: false, prevId: responseId, firstTurn: false }); break;
+ }
+ case 'error':
+ busUpdateLast(sid, (a) => { a.blocks = withText(a.blocks, '\n\nError: ' + ((ev.message as string) || 'stream error')); }); break;
+ }
+}
+export function useHarnessBus(harnessId: string, onActivity?: () => void) {
+ useEffect(() => {
+ if (!harnessId) return;
+ const unsub = subscribeHarnessEvents(harnessId, (m) => {
+ const t = (m.event as Record<string, unknown>)?.type as string;
+ // track in-flight sessions (authoritative for the Recents dot) regardless of suppress/replay:
+ // a replayed start still tells us the session is live (its terminal event clears it).
+ if (t === 'harness.turn.started') _runningSids.add(m.session_id);
+ else if (t === 'response.completed' || t === 'response.failed' || t === 'response.incomplete') _runningSids.delete(m.session_id);
+ applyBusEvent(m.session_id, m.response_id, m.event || {}, Boolean(m.replay));
+ if (t === 'harness.turn.started' || t === 'response.completed' || t === 'response.failed' || t === 'response.incomplete') onActivity?.();
+ });
+ return unsub;
+ }, [harnessId]); // eslint-disable-line react-hooks/exhaustive-deps
+}
+
+
+// ── the turn controller ────────────────────────────────────────────────────────────────────────
+/**
+ * One conversation's lifecycle: bind to the store, load history, run turns, settle them.
+ *
+ * Owns NO composer state on purpose. `send(text, files)` is given what to send, which is what lets
+ * Tasks drive one of these from its own composer and Arena drive six from one shared composer.
+ */
+export function useConversationTurn({ harnessId, sessionId, target, onRan, onSession, onSendStart, extraHeaders }: {
+ harnessId: string;
+ sessionId: string | null;
+ target: ChatTarget;
+ onRan: () => void;
+ onSession?: (sid: string) => void;
+ /** Fired the instant a send is accepted, so a view can clear its composer. */
+ onSendStart?: () => void;
+ /** App-auth pass-through header values for this harness. */
+ extraHeaders?: () => Record<string, string>;
+}) {
+ const genId = useId();
+ const [boundSid, setBoundSid] = useState<string | null>(null);
+ const sidRef = useRef<string | null>(sessionId);
+ // Synchronous send latch — see the comment in send(). React state cannot gate two calls that
+ // land in the same tick, because neither has re-rendered yet.
+ const sendingRef = useRef(false);
+ useEffect(() => { if (sessionId) sidRef.current = sessionId; }, [sessionId]);
+ const convKey = sessionId ?? boundSid ?? `new-${genId}`;
+ const convKeyRef = useRef(convKey);
+ convKeyRef.current = convKey;
+ const conv = useConvState(convKey);
+ const msgs = conv.msgs;
+ const busy = conv.busy;
+ const prevId = conv.prevId;
+ const firstTurn = conv.firstTurn;
+ const setMsgs = (u: Msg[] | ((m: Msg[]) => Msg[])) =>
+ setConvState(convKeyRef.current, (s) => ({ msgs: typeof u === 'function' ? (u as (m: Msg[]) => Msg[])(s.msgs) : u }));
+ const setBusy = (b: boolean) => setConvState(convKeyRef.current, { busy: b });
+ const setPrevId = (id: string | null) => setConvState(convKeyRef.current, { prevId: id });
+ const setFirstTurn = (b: boolean) => setConvState(convKeyRef.current, { firstTurn: b });
+ const [loading, setLoading] = useState(false);
+ const [outOfCredits, setOutOfCredits] = useState<{ balance: number | null } | null>(null);
+ // Stop is one-shot: disabled the moment it is clicked so a slow cancel cannot be spammed.
+ const [stopping, setStopping] = useState(false);
+ useEffect(() => { setStopping(false); }, [busy]);
+
+ // The shape of a task, never its content. No prompt, no file name, no title.
+ const taskFacts = () => ({
+ harness_kind: oobById(harnessId) ? 'builtin' : 'custom',
+ base: target.baseId || null,
+ model: target.model || null,
+ workspace_id: getCurrentWorkspaceRef()?.id || null,
+ });
+ const factsRef = useRef(taskFacts);
+ factsRef.current = taskFacts;
+
+ const updateLast = (fn: (a: AsstMsg) => void) =>
+ setMsgs((m) => { const out = m.slice(); for (let i = out.length - 1; i >= 0; i--) { if (out[i].role === 'assistant') { const a = { ...(out[i] as AsstMsg) }; fn(a); out[i] = a; break; } } return out; });
+
+
+ // Load a session's chat history into the store, reconciling against the AUTHORITATIVE backend.
+ // Opening a session always checks the real turn status: a session the backend reports terminal is
+ // shown done with its content even if the store was left stuck at busy:true (e.g. a terminal bus
+ // event was dropped on a full queue / reconnect race), which previously stranded it at "Working…"
+ // until a hard refresh. A genuinely in-flight turn keeps its live placeholder for the bus to stream.
+ useEffect(() => {
+ const existing = getConvState(convKey);
+ if (!sessionId) { if (!existing.loaded) setConvState(convKey, { loaded: true }); return; }
+ // Already loaded, idle, and has content → trust it (no refetch on every open).
+ if (existing.loaded && !existing.busy && existing.msgs.length) return;
+ setLoading(true);
+ loadSessionTurns(sessionId).then(({ turns, lastResponseId }) => {
+ const { msgs: m, running } = msgsFromTurns(turns);
+ const cur = getConvState(convKey);
+ if (!running) {
+ // Backend is terminal → authoritative. Show its content and clear any stale busy flag.
+ setConvState(convKey, { msgs: m, prevId: lastResponseId, firstTurn: false, loaded: true, busy: false });
+ } else if (!cur.msgs.length) {
+ // In-flight with nothing local yet → load the turn's progress-so-far (the backend
+ // reconstructs a running turn's partial output from its durable trace) and let the bus
+ // stream new events on top. If the trace was still empty this is just the placeholder.
+ setConvState(convKey, { msgs: m, prevId: lastResponseId, firstTurn: false, loaded: true, busy: true });
+ } else {
+ // In-flight and we already hold live msgs (switched away/back mid-turn) → keep them.
+ setConvState(convKey, { loaded: true });
+ }
+ setLoading(false);
+ }).catch(() => setLoading(false));
+ }, [convKey, sessionId]); // eslint-disable-line react-hooks/exhaustive-deps
+
+ // RECONCILIATION: SSE (POST stream or bus) is best-effort delivery, a reconnect gap, a
+ // replica switch, or a dropped terminal event must NEVER strand the conversation at
+ // "Working…". While busy, poll the authoritative turn state; the moment the backend says
+ // the turn is over, rebuild from /turns and settle. This is the load-bearing guarantee;
+ // streaming is just the fast path on top of it.
+ useEffect(() => {
+ if (!busy) return;
+ const sid = sessionId ?? sidRef.current;
+ if (!sid) return;
+ let stop = false;
+ const iv = setInterval(async () => {
+ if (stop) return;
+ try {
+ const { turns, lastResponseId } = await loadSessionTurns(sid);
+ if (stop || !turns.length) return;
+ const last = turns[turns.length - 1];
+ if (!TERMINAL_TURN.has(String(last.status || ''))) return;
+ const { msgs: m } = msgsFromTurns(turns);
+ // The OTHER settle path. SSE is best-effort (see the comment above); a dropped terminal
+ // event lands here instead, and instrumenting only the fast path would bias the success
+ // rate — the one metric this event exists to measure — upward.
+ const lastAsst = [...m].reverse().find((x) => x.role === 'assistant') as AsstMsg | undefined;
+ trackTaskFinished(sid, turnIndexOf(m), {
+ ...factsRef.current(),
+ status: lastAsst?.status === 'done' ? 'completed' : (lastAsst?.status || 'failed'),
+ produced_files: !!lastAsst?.files?.length,
+ file_count: lastAsst?.files?.length ?? 0,
+ });
+ _busSuppress.delete(sid);
+ setConvState(convKeyRef.current, { msgs: m, prevId: lastResponseId, firstTurn: false, loaded: true, busy: false });
+ } catch { /* transient, next tick */ }
+ }, 4000);
+ return () => { stop = true; clearInterval(iv); };
+ }, [busy, sessionId]); // eslint-disable-line react-hooks/exhaustive-deps
+
+ // The settled read. A turn that settled on the SSE path holds only what was streamed; what it
+ // took and cost is written by the gateway at settle, a moment after the terminal event. One
+ // read (and one retry, since the persist can trail the event by a couple of seconds) folds
+ // those figures into the last answer, so the per-turn line appears without a reload.
+ const settledRead = useRef<Set<string>>(new Set());
+ useEffect(() => {
+ if (busy) return;
+ const sid = sessionId ?? sidRef.current;
+ if (!sid) return;
+ const cur = getConvState(convKeyRef.current);
+ const idx = turnIndexOf(cur.msgs);
+ const last = [...cur.msgs].reverse().find((x) => x.role === 'assistant') as AsstMsg | undefined;
+ if (!last || last.status === 'running' || last.elapsed != null) return;
+ const key = `${sid}#${idx}`;
+ if (settledRead.current.has(key)) return;
+ settledRead.current.add(key);
+ let stop = false;
+ const attempt = async (left: number) => {
+ if (stop) return;
+ try {
+ const { turns } = await loadSessionTurns(sid);
+ const t = turns[turns.length - 1];
+ if (t && (typeof t.elapsed === 'number' || typeof t.credits === 'number')) {
+ setConvState(convKeyRef.current, (st) => {
+ const out = st.msgs.slice();
+ for (let i = out.length - 1; i >= 0; i--) {
+ if (out[i].role === 'assistant') {
+ out[i] = { ...(out[i] as AsstMsg),
+ elapsed: typeof t.elapsed === 'number' ? t.elapsed : undefined,
+ credits: typeof t.credits === 'number' ? t.credits : undefined };
+ break;
+ }
+ }
+ return { msgs: out };
+ });
+ return;
+ }
+ } catch { /* transient; the retry below */ }
+ if (left > 0) setTimeout(() => void attempt(left - 1), 4000);
+ };
+ // Up to four reads over ~15s: the persist can trail the terminal event by several seconds
+ // when the settle is collecting produced files.
+ const t0 = setTimeout(() => void attempt(3), 2500);
+ return () => { stop = true; clearTimeout(t0); };
+ }, [busy, sessionId]); // eslint-disable-line react-hooks/exhaustive-deps
+ async function send(rawText: string, attach: { name: string; dataUri: string }[] = []) {
+ const text = (rawText || '').trim();
+ // `busy` is React state, so three clicks landing in one tick all read it as false and all
+ // three stream into the same assistant message: the server runs the turn once, but the
+ // reader watches the answer arrive three times over. The latch is a ref because it has to
+ // flip now, not at the next render.
+ if ((!text && attach.length === 0) || busy || sendingRef.current || !target.backend) return;
+ sendingRef.current = true;
+ const sent = attach;
+ // OpenAI Responses input: a string, or a user MESSAGE whose content is text + file parts.
+ // (The gateway parses {role,content:[…]}, a bare content-part array reads as empty input.)
+ const input_payload: string | unknown[] = sent.length
+ ? [{ role: 'user', content: [
+ ...(text ? [{ type: 'input_text', text }] : []),
+ ...sent.map((f) => ({ type: 'input_file', filename: f.name, file_data: f.dataUri })),
+ ] }]
+ : text;
+ const wasFirstTurn = firstTurn;
+ const startedAt = performance.now();
+ let reported = false; // task_started fires on the FIRST session id only
+ setBusy(true);
+ onSendStart?.();
+ setMsgs((m) => [...m, { role: 'user', text, attachments: sent.map((f) => ({ name: f.name, dataUri: f.dataUri })) }, { role: 'assistant', blocks: [], files: [], status: 'running' }]);
+ // NEW task (no session yet): surface it in Recents IMMEDIATELY via an optimistic entry, the
+ // durable card takes seconds (session allocation + first trace write). onRan() re-renders the
+ // panel now; the entry swaps for the real card as soon as the server list carries this session.
+ const pendId = !sessionId ? addPendingCard(harnessId, (text || sent[0]?.name || 'New task').split('\n')[0].slice(0, 120)) : null;
+ // A follow-up has a card already; its record turns "running" as the turn starts, so the
+ // panel re-reads now too and the task rises to the top of its harness while it runs.
+ onRan();
+ // This tab renders the turn via its own POST stream below; tell the broadcast bus to NOT also
+ // apply deltas to this same session (convKey === sid) to avoid double-rendering. Other tabs /
+ // other conversations still get it live from the bus.
+ const knownSid = sessionId ?? sidRef.current;
+ if (knownSid) _busSuppress.add(knownSid);
+ try {
+ const id = await streamResponse(
+ // No `instructions`: the harness's configured Agent Instructions are written into the
+ // workspace as AGENTS.md/CLAUDE.md (server-side, from the saved harness), so the model keeps
+ // its default system prompt rather than having instructions prepended to the first message.
+ // sessionHint: continuity fallback, the gateway continues this session even if prevId was
+ // lost client-side (interrupted stream), instead of forking a new one.
+ { input: input_payload, backend: target.backend, model: target.model || undefined, previousResponseId: prevId,
+ sessionHint: knownSid, harnessId, harnessName: target.name, extraHeaders: extraHeaders?.() || {} },
+ { onCreated: (rid) => setPrevId(rid),
+ onSession: (sid) => {
+ if (!reported && sid) {
+ reported = true;
+ _turnStart.set(sid, startedAt);
+ // Fired on session allocation, not on POST dispatch: a request that dies before it
+ // gets a session never became a task.
+ track('task_started', { ...taskFacts(), is_first_turn: wasFirstTurn,
+ has_attachments: sent.length > 0, attachment_count: sent.length });
+ }
+ if (pendId) setPendingSid(pendId, sid);
+ // First turn of a new conversation: rebind the conv store to the real session id so all
+ // future writes (this stream, the bus, follow-up turns) land on ONE key.
+ if (!sessionId && !sidRef.current && sid) {
+ convStore.seed(sid, { ...getConvState(convKeyRef.current) });
+ _busSuppress.add(sid);
+ sidRef.current = sid;
+ setBoundSid(sid);
+ }
+ onSession?.(sid);
+ },
+ onReasoningDelta: (d) => updateLast((a) => { a.blocks = withReasoning(a.blocks, d); }),
+ onToolCall: (name, args, callId) => updateLast((a) => { a.blocks = withStep(a.blocks, { name, args, callId }); }),
+ onToolResult: (callId, output) => updateLast((a) => { a.blocks = withResult(a.blocks, callId, output); }),
+ onTextDelta: (d) => updateLast((a) => { a.blocks = withText(a.blocks, d); }),
+ onFile: (f) => updateLast((a) => { a.files = [...a.files, f]; }),
+ onError: (msg) => updateLast((a) => { a.blocks = withText(a.blocks, '\n\nError: ' + msg); }),
+ onDone: (status) => {
+ updateLast((a) => {
+ a.status = status === 'completed' ? 'done'
+ : (['failed', 'cancelled', 'incomplete'].includes(status) ? status as AsstMsg['status'] : 'failed');
+ });
+ const sk = sessionId ?? sidRef.current;
+ const ms = getConvState(convKeyRef.current).msgs;
+ const lastA = [...ms].reverse().find((x) => x.role === 'assistant') as AsstMsg | undefined;
+ if (sk) trackTaskFinished(sk, turnIndexOf(ms), {
+ ...taskFacts(),
+ status: ['completed', 'failed', 'cancelled', 'incomplete'].includes(status) ? status : 'failed',
+ produced_files: !!lastA?.files?.length,
+ file_count: lastA?.files?.length ?? 0,
+ });
+ } },
+ );
+ if (id) setPrevId(id); setFirstTurn(false);
+ } catch (e) {
+ // A throw here is a TRANSPORT failure (the POST stream dropped), never an agent failure, which
+ // arrives via onError + onDone('failed'). If the turn already reached a session it is STILL
+ // running server-side (a gateway redeploy rolling the SSE, a network blip), so painting it
+ // "failed" is a lie that strands the user. Leave it running and let the finally hand rendering
+ // to the auto-reconnecting broadcast bus. Only a start failure (no session yet) is a real error.
+ const sk = sessionId ?? sidRef.current;
+ if (!sk) {
+ // The loop broke before it started. Report the CLASS, never the message: the server's
+ // raw `detail` string is arbitrary text and must not leave the browser. The 402 credit
+ // wall and a gateway blip look identical to the user and completely different to the
+ // business, which is the whole point of the enum.
+ const st = (e as { status?: unknown })?.status;
+ track('task_blocked', {
+ reason: st === 402 ? 'out_of_credits' : st === 429 ? 'rate_limited'
+ : typeof st === 'number' ? 'other' : 'transport',
+ ...taskFacts(),
+ });
+ // Out of credits is a decision, not a defect: name it and hand over the door, instead of
+ // leaving a red line in the transcript the user cannot act on. The balance is fetched
+ // rather than assumed — a wrong number on a money dialog is worse than no number.
+ if (st === 402) {
+ setOutOfCredits({ balance: null });
+ billing.balance()
+ .then((b) => setOutOfCredits({ balance: Math.round(Number(b?.balance ?? 0)) }))
+ .catch(() => { /* keep the dialog, just without a figure */ });
+ }
+ if (pendId) dropPending(pendId);
+ updateLast((a) => { a.blocks = withText(a.blocks, '\n\nError: ' + (e instanceof Error ? e.message : String(e))); a.status = 'failed'; });
+ }
+ } finally {
+ sendingRef.current = false;
+ const sk = sessionId ?? sidRef.current;
+ // If the stream ended (returned or threw) but no terminal event set the assistant status, the
+ // turn is still live server-side (transport drop OR a clean drain-close mid-turn). Hand it to the
+ // broadcast bus, which auto-reconnects, by releasing suppression, and KEEP the working state so
+ // the indicator stands until the bus (or the on-focus reconcile) lands the true terminal status.
+ const ms = getConvState(convKeyRef.current).msgs;
+ const lastA = ms[ms.length - 1];
+ const stillRunning = !!lastA && lastA.role === 'assistant' && (lastA as AsstMsg).status === 'running';
+ if (sk && stillRunning) {
+ _busSuppress.delete(sk); // bus renders the remainder; keep busy=true (composer stays disabled)
+ } else {
+ if (sk) _busSuppress.delete(sk);
+ setBusy(false);
+ }
+ onRan();
+ }
+ }
+
+ /** Cancel the running turn, settling from the server verdict as well as the bus event. */
+ function stop() {
+ const sid = sessionId ?? sidRef.current;
+ if (!sid || stopping) return;
+ setStopping(true);
+ void cancelSession(sid).then((r) => {
+ const terminal = ['cancelled', 'failed', 'error', 'done', 'completed', 'incomplete', 'max_turns', 'timeout'];
+ if (r.cancelled || terminal.includes(r.status)) {
+ updateLast((a) => { a.status = 'cancelled'; });
+ setBusy(false);
+ } else {
+ setStopping(false); // cancel did not land, let the user retry
+ }
+ }).catch(() => setStopping(false));
+ }
+
+ return { msgs, busy, loading, stopping, prevId, firstTurn, outOfCredits,
+ clearOutOfCredits: () => setOutOfCredits(null),
+ liveSessionId: sessionId ?? sidRef.current, convKey,
+ send, stop, setMsgs, updateLast };
+}
diff --git a/ui/src/lib/quickstart.ts b/ui/src/lib/quickstart.ts
new file mode 100644
index 00000000..55511b81
--- /dev/null
+++ b/ui/src/lib/quickstart.ts
@@ -0,0 +1,45 @@
+// Quickstart progress: four steps, kept per browser so the page and the sidebar badge agree and a
+// reload does not start the person over. Nothing secret lives here: the API key's last four
+// characters only, never the key.
+import { useCallback, useEffect, useState } from 'react';
+
+export interface QuickstartState {
+ copied: boolean; // AGENTS.md went to the clipboard
+ pasted: boolean; // step 1: they confirmed the paste
+ asked: boolean; // step 2: they sent a build request to their agent
+ keyCreated: boolean; // step 3: a workspace key was created here
+ keyHint: string; // the created key's head and tail (sk-hr-••••1a2b), for the "Key created" label
+ agent: string; // which coding agent they chose (codex | claude-code | cursor)
+}
+export const QUICKSTART_EMPTY: QuickstartState = { copied: false, pasted: false, asked: false, keyCreated: false, keyHint: '', agent: 'codex' };
+const KEY = 'hr:quickstart:v1';
+const EVT = 'hr:quickstart';
+
+export function readQuickstart(): QuickstartState {
+ let s = QUICKSTART_EMPTY;
+ try { const raw = localStorage.getItem(KEY); s = raw ? { ...QUICKSTART_EMPTY, ...JSON.parse(raw) } : QUICKSTART_EMPTY; }
+ catch { return QUICKSTART_EMPTY; }
+ // A key is only created once the agent asked for it, which only happens after the guide was
+ // pasted and a build was requested. The two confirmations are easy to skip; the key is proof.
+ return s.keyCreated ? { ...s, copied: true, pasted: true, asked: true } : s;
+}
+function writeQuickstart(next: QuickstartState): void {
+ try { localStorage.setItem(KEY, JSON.stringify(next)); } catch { /* storage blocked: the page still works for this visit */ }
+ window.dispatchEvent(new Event(EVT));
+}
+/** Steps done out of four. The fourth (manage your harnesses) is the destination: it lights once the three setup steps are done. */
+export function quickstartDone(s: QuickstartState): number {
+ const three = [s.pasted, s.asked, s.keyCreated].filter(Boolean).length;
+ return three + (three === 3 ? 1 : 0);
+}
+export function useQuickstart(): [QuickstartState, (patch: Partial<QuickstartState>) => void] {
+ const [s, setS] = useState<QuickstartState>(QUICKSTART_EMPTY);
+ useEffect(() => {
+ const sync = () => setS(readQuickstart());
+ sync();
+ window.addEventListener(EVT, sync); window.addEventListener('storage', sync);
+ return () => { window.removeEventListener(EVT, sync); window.removeEventListener('storage', sync); };
+ }, []);
+ const update = useCallback((patch: Partial<QuickstartState>) => { const next = { ...readQuickstart(), ...patch }; writeQuickstart(next); setS(next); }, []);
+ return [s, update];
+}
diff --git a/ui/src/lib/revamp-data.ts b/ui/src/lib/revamp-data.ts
index d1f7d843..e46e197d 100644
--- a/ui/src/lib/revamp-data.ts
+++ b/ui/src/lib/revamp-data.ts
@@ -23,6 +23,7 @@ export interface TraceCard {
last_response_id?: string;
workspace?: string;
credits?: number;
+ created_at?: number;
}
const WINDOW = 200;
@@ -43,6 +44,21 @@ export async function fetchTraceWindow(harness?: string,
return Array.isArray(d?.sessions) ? d.sessions : [];
}
+/** One page of a harness's own tasks, newest first, from that harness's index. `cursor` continues
+ * the listing; an empty cursor back means the end. Scoped to the active workspace like the window. */
+export const TASK_PAGE = 50;
+export async function fetchHarnessTasks(harness: string, cursor = ''): Promise<{ sessions: TraceCard[]; cursor: string }> {
+ const org = getSession()?.orgId;
+ if (!org) return { sessions: [], cursor: '' };
+ const q = new URLSearchParams({ org, limit: String(TASK_PAGE), harness });
+ if (cursor) q.set('cursor', cursor);
+ appendWorkspaceQuery(q);
+ const r = await harnessFetch(`/api/harness/v1/traces?${q.toString()}`);
+ if (!r.ok) return { sessions: [], cursor: '' };
+ const d = await r.json().catch(() => null);
+ return { sessions: Array.isArray(d?.sessions) ? d.sessions : [], cursor: typeof d?.cursor === 'string' ? d.cursor : '' };
+}
+
export const TERMINAL_OK = new Set(['done', 'completed']);
export const TERMINAL_BAD = new Set(['failed', 'error']);
export const RUNNING = new Set(['running', 'starting', 'in_progress']);
@@ -88,6 +104,11 @@ export function avgCreditsOf(cards: TraceCard[] | undefined): string | null {
return avg >= 100 ? Math.round(avg).toLocaleString() : avg.toFixed(avg < 10 ? 2 : 1);
}
+/** When a task last did something: the settle of its latest turn, else its creation. */
+export function activityAt(c: TraceCard): number { return c.finished_at || c.created_at || 0; }
+
+/** Cards per harness, most recent activity first: a task that is running now leads, then the
+ * rest by their latest settle, so a follow-up on an old task brings it back to the top. */
export function groupByHarness(cards: TraceCard[]): Map<string, TraceCard[]> {
const m = new Map<string, TraceCard[]>();
for (const c of cards) {
@@ -95,9 +116,16 @@ export function groupByHarness(cards: TraceCard[]): Map<string, TraceCard[]> {
if (!m.has(k)) m.set(k, []);
m.get(k)!.push(c);
}
+ for (const [k, list] of m) m.set(k, sortByActivity(list));
return m;
}
+/** Most recent activity first: running tasks lead, then the rest by their latest settle. */
+export function sortByActivity(list: TraceCard[]): TraceCard[] {
+ const live = (c: TraceCard) => (RUNNING.has(c.status || '') ? 1 : 0);
+ return [...list].sort((a, b) => live(b) - live(a) || activityAt(b) - activityAt(a));
+}
+
/** Tasks-per-day buckets for the last `days`, oldest first. */
export function dailyBuckets(cards: TraceCard[], days = 7, now = Date.now()): { label: string; count: number; ok: number; bad: number }[] {
const out: { label: string; count: number; ok: number; bad: number }[] = [];
diff --git a/ui/src/lib/useEscape.ts b/ui/src/lib/useEscape.ts
new file mode 100644
index 00000000..e7a6e368
--- /dev/null
+++ b/ui/src/lib/useEscape.ts
@@ -0,0 +1,18 @@
+'use client';
+import { useEffect } from 'react';
+
+/**
+ * Close a dialog with Escape.
+ *
+ * Every modal here can be dismissed by clicking its backdrop, which leaves anyone working from
+ * the keyboard with no way out at all. `active` is the open flag, so the listener exists only
+ * while the dialog does and a stack of dialogs closes innermost first.
+ */
+export function useEscape(active: boolean, onClose: () => void): void {
+ useEffect(() => {
+ if (!active) return;
+ const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); };
+ window.addEventListener('keydown', onKey);
+ return () => window.removeEventListener('keydown', onKey);
+ }, [active]); // eslint-disable-line react-hooks/exhaustive-deps
+}
diff --git a/ui/src/studio/styles/ap-graph.css b/ui/src/studio/styles/ap-graph.css
index f184a093..29d9a65c 100644
--- a/ui/src/studio/styles/ap-graph.css
+++ b/ui/src/studio/styles/ap-graph.css
@@ -81,7 +81,7 @@
.dg-canvas {
flex: 1; min-width: 0; min-height: 0;
position: relative;
- background: #FAFBFD;
+ background: #fafaf9;
overflow: hidden;
}
@@ -424,7 +424,7 @@
cursor: pointer;
color: var(--mute);
}
-.dg-conn-x:hover { color: #B91C1C; border-color: #FECACA; background: #FEF2F2; }
+.dg-conn-x:hover { color: #b4460f; border-color: #f0e2d4; background: #fdf9f4; }
.dg-conn-x:disabled { opacity: .3; cursor: not-allowed; }
.prop-edge-row {
@@ -448,7 +448,7 @@
display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dg-label-eye:hover { color: var(--ink); border-color: var(--mute-2); }
-.dg-label-eye.on { color: #fff; background: var(--brand, #42309C); border-color: var(--brand, #42309C); }
+.dg-label-eye.on { color: #fff; background: var(--brand, #1a5cf5); border-color: var(--brand, #1a5cf5); }
/* Flat per-property list (one row per property) for the node/edge detail. */
.dg-prop-list { display: flex; flex-direction: column; }
@@ -548,7 +548,7 @@
.cy-ctx-menu {
min-width: 180px;
background: #fff;
- border: 1px solid var(--line, #E5E7EB);
+ border: 1px solid var(--line, #e7e5e4);
border-radius: 8px;
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
padding: 4px;
@@ -571,19 +571,19 @@
.cy-ctx-item:hover,
.cy-ctx-item.open { background: var(--bg-soft, #F3F4F6); }
.cy-ctx-has-sub { padding-right: 22px; }
-.cy-ctx-chev { color: var(--mute, #6B7280); font-size: 14px; line-height: 1; margin-left: 8px; }
+.cy-ctx-chev { color: var(--mute, #6b6560); font-size: 14px; line-height: 1; margin-left: 8px; }
.cy-ctx-sub {
position: absolute;
top: -4px; left: 100%;
margin-left: 2px;
min-width: 240px;
background: #fff;
- border: 1px solid var(--line, #E5E7EB);
+ border: 1px solid var(--line, #e7e5e4);
border-radius: 8px;
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
padding: 4px;
}
-.cy-ctx-empty { padding: 6px 10px; color: var(--mute, #6B7280); font-size: 12px; }
+.cy-ctx-empty { padding: 6px 10px; color: var(--mute, #6b6560); font-size: 12px; }
/* Edge → target leaf items in the 2nd-level submenu */
.cy-ctx-leaf {
@@ -616,7 +616,7 @@
min-width: 18px; height: 18px;
padding: 0 5px;
border-radius: 999px;
- background: var(--brand, #42309C);
+ background: var(--brand, #1a5cf5);
color: #fff;
font-size: 11px;
font-weight: 600;
diff --git a/ui/src/studio/styles/ap-runs.css b/ui/src/studio/styles/ap-runs.css
index 76113042..a68307d3 100644
--- a/ui/src/studio/styles/ap-runs.css
+++ b/ui/src/studio/styles/ap-runs.css
@@ -19,7 +19,7 @@
.runs-tbl-row:hover { background: var(--surface-2); }
.runs-tbl-row.row-warm { background: #FEF7EB; }
.runs-tbl-row.row-warm:hover { background: #FCEAC8; }
-.runs-tbl-row.row-hot { background: #FEF2F2; }
+.runs-tbl-row.row-hot { background: #fdf9f4; }
.runs-tbl-row.row-hot:hover { background: #FBE4E4; }
.runs-tbl-row.row-dim { opacity: 0.6; }
diff --git a/ui/src/studio/styles/ap-tokens.css b/ui/src/studio/styles/ap-tokens.css
index ce881afb..18a451cd 100644
--- a/ui/src/studio/styles/ap-tokens.css
+++ b/ui/src/studio/styles/ap-tokens.css
@@ -5,20 +5,20 @@
*/
:root {
- --state-queued: #94A3B8;
- --state-running: #42309C;
- --state-success: #10B981;
- --state-failed: #EF4444;
+ --state-queued: #a8a29e;
+ --state-running: #1a5cf5;
+ --state-success: #15803d;
+ --state-failed: #b4460f;
--state-skipped: #CBD0DA;
- --state-suspended: #F59E0B;
+ --state-suspended: #8a6a3c;
}
-.pill.state-queued { background: #EEF1F5; color: #475569; }
-.pill.state-running { background: #ECE9F7; color: #332578; }
-.pill.state-success { background: #DFF6EC; color: #047857; }
-.pill.state-failed { background: #FEE4E4; color: #B91C1C; }
-.pill.state-skipped { background: #EEF1F5; color: #6B7280; }
-.pill.state-suspended { background: #FEF1D6; color: #92400E; }
+.pill.state-queued { background: #f4f2f0; color: #57534e; }
+.pill.state-running { background: #f7f8fe; color: #1447c4; }
+.pill.state-success { background: #DFF6EC; color: #15803d; }
+.pill.state-failed { background: #FEE4E4; color: #b4460f; }
+.pill.state-skipped { background: #f4f2f0; color: #6b6560; }
+.pill.state-suspended { background: #FEF1D6; color: #8a6a3c; }
/* AdminPortal is English-first; bump density a hair from the Chinese console */
.ap-app, .ap-app body { font-size: 13px; }
diff --git a/ui/src/studio/styles/ap-workflow.css b/ui/src/studio/styles/ap-workflow.css
index 049828ed..34cfe415 100644
--- a/ui/src/studio/styles/ap-workflow.css
+++ b/ui/src/studio/styles/ap-workflow.css
@@ -64,7 +64,7 @@
.wf-canvas {
flex: 1; min-width: 0; min-height: 0;
position: relative;
- background: #FAFBFD;
+ background: #fafaf9;
}
/* Floating action bar on top of the canvas. No parent container —
@@ -105,14 +105,14 @@
padding: 2px 8px; border-radius: 999px;
text-transform: uppercase; letter-spacing: .04em;
}
-.wf-run-queued { background: #E2E8F0; color: #475569; }
-.wf-run-running { background: #DBEAFE; color: #1E40AF; }
-.wf-run-succeeded { background: #D1FAE5; color: #047857; }
-.wf-run-failed { background: #FEE2E2; color: #B91C1C; }
-.wf-run-suspended { background: #FEF3C7; color: #92400E; }
+.wf-run-queued { background: #e7e5e4; color: #57534e; }
+.wf-run-running { background: #f7f8fe; color: #1E40AF; }
+.wf-run-succeeded { background: #eaf5ee; color: #15803d; }
+.wf-run-failed { background: #fdf9f4; color: #b4460f; }
+.wf-run-suspended { background: #fdf9f4; color: #8a6a3c; }
.wf-run-err {
- font-size: 10px; font-weight: 600; color: #B91C1C;
- padding: 2px 6px; border-radius: 4px; background: #FEF2F2;
+ font-size: 10px; font-weight: 600; color: #b4460f;
+ padding: 2px 6px; border-radius: 4px; background: #fdf9f4;
}
/* Node status overlays — set by the SSE-driven run status effect. */
@@ -152,15 +152,15 @@
* blocked making the actual border-width any larger. */
}
@keyframes wf-rainbow-border {
- 0% { box-shadow: 0 0 0 4px #EF4444, 0 0 12px 2px rgba(239, 68, 68,.55); }
- 17% { box-shadow: 0 0 0 4px #F59E0B, 0 0 12px 2px rgba(245,158, 11,.55); }
+ 0% { box-shadow: 0 0 0 4px #b4460f, 0 0 12px 2px rgba(239, 68, 68,.55); }
+ 17% { box-shadow: 0 0 0 4px #8a6a3c, 0 0 12px 2px rgba(245,158, 11,.55); }
33% { box-shadow: 0 0 0 4px #EAB308, 0 0 12px 2px rgba(234,179, 8,.55); }
50% { box-shadow: 0 0 0 4px #22C55E, 0 0 12px 2px rgba( 34,197, 94,.55); }
67% { box-shadow: 0 0 0 4px #06B6D4, 0 0 12px 2px rgba( 6,182,212,.55); }
83% { box-shadow: 0 0 0 4px #6366F1, 0 0 12px 2px rgba( 99,102,241,.55); }
- 100% { box-shadow: 0 0 0 4px #EF4444, 0 0 12px 2px rgba(239, 68, 68,.55); }
+ 100% { box-shadow: 0 0 0 4px #b4460f, 0 0 12px 2px rgba(239, 68, 68,.55); }
}
-.wf-canvas .react-flow__renderer { background: #FAFBFD; }
+.wf-canvas .react-flow__renderer { background: #fafaf9; }
.wf-empty {
position: absolute; left: 50%; top: 40%;
transform: translate(-50%, -50%);
@@ -188,13 +188,13 @@
.wf-canvas .react-flow__controls-button:hover { background: var(--surface-2); }
.wf-canvas .react-flow__controls-button svg { fill: currentColor; }
.wf-canvas .react-flow__minimap { box-shadow: var(--shadow-1); }
-.wf-canvas .react-flow__edge-path { stroke: #94A3B8; }
+.wf-canvas .react-flow__edge-path { stroke: #a8a29e; }
.wf-canvas .react-flow__edge.selected .react-flow__edge-path,
.wf-canvas .react-flow__edge:focus .react-flow__edge-path {
- stroke: #42309C; stroke-width: 2;
+ stroke: #1a5cf5; stroke-width: 2;
}
-.wf-canvas .react-flow__arrowhead { fill: #94A3B8; }
-.wf-canvas .react-flow__edge.selected .react-flow__arrowhead { fill: #42309C; }
+.wf-canvas .react-flow__arrowhead { fill: #a8a29e; }
+.wf-canvas .react-flow__edge.selected .react-flow__arrowhead { fill: #1a5cf5; }
/* ── Sticky-note annotation ────────────────────────────────────────── */
.wf-note {
@@ -273,7 +273,7 @@
}
.wf-node-tool-dot {
width: 5px; height: 5px; border-radius: 50%;
- background: var(--brand, #42309C);
+ background: var(--brand, #1a5cf5);
flex-shrink: 0;
}
.wf-node-tool-name { color: var(--ink); font-weight: 600; }
@@ -358,7 +358,7 @@
background: transparent; color: var(--mute);
cursor: pointer; font-size: 14px; line-height: 1;
}
-.wf-kv-x:hover { color: #B91C1C; border-color: #FECACA; background: #FEF2F2; }
+.wf-kv-x:hover { color: #b4460f; border-color: #f0e2d4; background: #fdf9f4; }
.wf-kv-add { align-self: flex-start; margin-top: 2px; }
.wf-cond-row { display: flex; align-items: center; gap: 6px; }
@@ -400,14 +400,14 @@
font-size: 9px; font-weight: 600;
padding: 2px 7px; border-radius: 999px;
text-transform: uppercase; letter-spacing: .04em;
- background: #E2E8F0; color: #475569;
+ background: #e7e5e4; color: #57534e;
flex-shrink: 0;
}
-.wf-rail-badge.wf-run-queued { background: #E2E8F0; color: #475569; }
-.wf-rail-badge.wf-run-running { background: #DBEAFE; color: #1E40AF; animation: wf-running-pulse 1.2s ease-in-out infinite; }
-.wf-rail-badge.wf-run-succeeded { background: #D1FAE5; color: #047857; }
-.wf-rail-badge.wf-run-failed { background: #FEE2E2; color: #B91C1C; }
-.wf-rail-badge.wf-run-suspended { background: #FEF3C7; color: #92400E; }
+.wf-rail-badge.wf-run-queued { background: #e7e5e4; color: #57534e; }
+.wf-rail-badge.wf-run-running { background: #f7f8fe; color: #1E40AF; animation: wf-running-pulse 1.2s ease-in-out infinite; }
+.wf-rail-badge.wf-run-succeeded { background: #eaf5ee; color: #15803d; }
+.wf-rail-badge.wf-run-failed { background: #fdf9f4; color: #b4460f; }
+.wf-rail-badge.wf-run-suspended { background: #fdf9f4; color: #8a6a3c; }
.wf-rail-dur { font-size: 10px; }
/* Run-inputs modal — opened by the Run button when the workflow
diff --git a/ui/src/studio/styles/app.css b/ui/src/studio/styles/app.css
index 737b902d..5929d08d 100644
--- a/ui/src/studio/styles/app.css
+++ b/ui/src/studio/styles/app.css
@@ -52,14 +52,14 @@ body {
.wf-crumb-input {
font-size: 14px; font-weight: 600; letter-spacing: -.005em;
color: var(--ink); background: #fff;
- border: 1px solid var(--brand, #42309C); border-radius: 4px;
+ border: 1px solid var(--brand, #1a5cf5); border-radius: 4px;
padding: 2px 6px; outline: none;
min-width: 240px;
}
.wf-crumb-err {
display: inline-flex; align-items: center; justify-content: center;
width: 16px; height: 16px; border-radius: 50%;
- background: #FEE2E2; color: #B91C1C; font-weight: 700; font-size: 11px;
+ background: #fdf9f4; color: #b4460f; font-weight: 700; font-size: 11px;
}
/* ── Body / shell ─────────────────────────────────────────────────────── */
diff --git a/ui/src/studio/styles/calendar.css b/ui/src/studio/styles/calendar.css
index 5c308864..d0bb43d7 100644
--- a/ui/src/studio/styles/calendar.css
+++ b/ui/src/studio/styles/calendar.css
@@ -50,12 +50,12 @@
/* Drag-to-select range preview */
.cal-selbox { position: absolute; left: 2px; right: 2px; background: color-mix(in srgb, var(--brand) 18%, #fff); border: 1px solid var(--brand); border-radius: 5px; z-index: 6; pointer-events: none; }
.cal-selbox-t { position: absolute; top: 2px; left: 6px; font-size: 10px; font-weight: 600; color: var(--brand-ink); }
-.cal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #EF4444; z-index: 5; pointer-events: none; }
-.cal-now::before { content: ''; position: absolute; left: -4px; top: -4px; width: 7px; height: 7px; border-radius: 999px; background: #EF4444; }
+.cal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #b4460f; z-index: 5; pointer-events: none; }
+.cal-now::before { content: ''; position: absolute; left: -4px; top: -4px; width: 7px; height: 7px; border-radius: 999px; background: #b4460f; }
/* ── Event chip ──────────────────────────────────────────────────────────── */
.cal-evt { --evt: var(--brand); display: flex; align-items: center; gap: 5px; width: 100%; text-align: left; overflow: hidden; border: 0; cursor: pointer;
- background: color-mix(in srgb, var(--evt) 14%, #fff); color: color-mix(in srgb, var(--evt) 72%, #111); border-left: 3px solid var(--evt);
+ background: color-mix(in srgb, var(--evt) 14%, #fff); color: color-mix(in srgb, var(--evt) 72%, #1c1917); border-left: 3px solid var(--evt);
border-radius: 5px; padding: 2px 6px; font-size: 12px; line-height: 1.25; box-sizing: border-box; }
.cal-evt:hover { background: color-mix(in srgb, var(--evt) 22%, #fff); }
.cal-evt.is-compact { padding: 1px 6px; font-size: 11px; }
@@ -63,7 +63,7 @@
.cal-evt-time { font-size: 10px; opacity: .8; flex-shrink: 0; }
/* Workflow tasks: dashed border, tinted by their RUN STATUS color (--evt set per
event by the backend: green=succeeded, red=failed, amber=running, slate=scheduled). */
-.cal-evt.is-wf { background: color-mix(in srgb, var(--evt) 13%, #fff); color: color-mix(in srgb, var(--evt) 72%, #111); border-left-style: dashed; }
+.cal-evt.is-wf { background: color-mix(in srgb, var(--evt) 13%, #fff); color: color-mix(in srgb, var(--evt) 72%, #1c1917); border-left-style: dashed; }
.cal-evt-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--evt); flex-shrink: 0; }
/* Draggable timed events: grab to move, ns-resize on the bottom grip. */
.cal-body .cal-evt { cursor: grab; }
@@ -115,15 +115,15 @@
.cal-run-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.cal-run-row:last-child { border-bottom: 0; }
.cal-run-time { color: var(--ink-2); }
-.cal-run-st { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: color-mix(in srgb, var(--evt) 78%, #111); }
+.cal-run-st { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: color-mix(in srgb, var(--evt) 78%, #1c1917); }
.cal-run-st::before { content: ''; width: 6px; height: 6px; border-radius: 999px; background: var(--evt); }
.cal-run-view { font-size: 12px; font-weight: 600; color: var(--brand); text-decoration: none; padding: 2px 8px; border-radius: 6px; }
.cal-run-view:hover { background: var(--brand-50); }
.cal-run-view.is-dim { color: var(--mute-2); pointer-events: none; }
/* Run-count badge on a grouped workflow chip */
-.cal-evt-count { flex-shrink: 0; font-size: 10px; font-weight: 700; background: color-mix(in srgb, var(--evt) 26%, #fff); color: color-mix(in srgb, var(--evt) 80%, #111); border-radius: 999px; padding: 0 6px; min-width: 16px; text-align: center; }
+.cal-evt-count { flex-shrink: 0; font-size: 10px; font-weight: 700; background: color-mix(in srgb, var(--evt) 26%, #fff); color: color-mix(in srgb, var(--evt) 80%, #1c1917); border-radius: 999px; padding: 0 6px; min-width: 16px; text-align: center; }
.cal-st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; margin-top: 3px;
- color: color-mix(in srgb, var(--evt) 78%, #111); background: color-mix(in srgb, var(--evt) 15%, #fff); }
+ color: color-mix(in srgb, var(--evt) 78%, #1c1917); background: color-mix(in srgb, var(--evt) 15%, #fff); }
.cal-st::before { content: ''; width: 7px; height: 7px; border-radius: 999px; background: var(--evt); }
.cal-pop-ro-note { font-size: 12px; color: var(--mute); padding-left: 25px; }
.cal-pop-row { display: flex; align-items: flex-start; gap: 10px; color: var(--mute); }
@@ -149,8 +149,8 @@
.cal-swatch.on { box-shadow: 0 0 0 2px var(--brand); }
.cal-pop-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--line-soft); }
.cal-pop-foot-r { display: flex; gap: 8px; }
-.cal-del { color: #B91C1C; border-color: #FECACA; }
-.cal-del:hover { background: #FEF2F2; }
+.cal-del { color: #b4460f; border-color: #f0e2d4; }
+.cal-del:hover { background: #fdf9f4; }
/* ── Sidebar (dock app left rail) — sits on the DARK app sidebar (--sidebar-2),
so text/controls use light-on-dark colors, not the light-theme ink tokens. ── */
diff --git a/ui/src/studio/styles/chat.css b/ui/src/studio/styles/chat.css
index d4647e31..30bf69f7 100644
--- a/ui/src/studio/styles/chat.css
+++ b/ui/src/studio/styles/chat.css
@@ -11,7 +11,7 @@
.ch-new-wrap { position: relative; }
.ch-new {
width: 30px; height: 30px; border-radius: 7px; border: none; cursor: pointer;
- background: rgba(255,255,255,.08); color: #C7CCDA;
+ background: rgba(255,255,255,.08); color: #e7e5e4;
display: inline-flex; align-items: center; justify-content: center;
}
.ch-new:hover { background: rgba(255,255,255,.16); color: #fff; }
@@ -36,7 +36,7 @@
.ch-search:focus-within { border-color: rgba(183,172,255,.55); background: rgba(255,255,255,.09); }
.ch-search-input {
flex: 1; min-width: 0; border: 0; background: none; outline: none;
- color: #E5E7EB; font-size: 13px; font-family: inherit;
+ color: #e7e5e4; font-size: 13px; font-family: inherit;
}
.ch-search-input::placeholder { color: var(--sidebar-mute); }
.ch-search-clear { border: 0; background: none; color: var(--sidebar-mute); cursor: pointer; display: inline-flex; }
@@ -76,7 +76,7 @@
.ch-row {
display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
padding: 7px 8px; border: 0; background: none; border-radius: 8px; cursor: pointer;
- color: #C7CCDA; font-family: inherit;
+ color: #e7e5e4; font-family: inherit;
}
.ch-row:hover { background: rgba(255,255,255,.05); }
.ch-row.active { background: rgba(94,78,190,.22); }
@@ -84,7 +84,7 @@
.ch-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ch-row-top { display: flex; align-items: baseline; gap: 6px; }
.ch-row-title {
- flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: #E5E7EB;
+ flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: #e7e5e4;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
display: flex; align-items: center; gap: 4px;
}
@@ -94,10 +94,10 @@
.ch-row-prev { flex: 1; min-width: 0; font-size: 12px; color: var(--sidebar-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Unread: brighten the row + a count pill (Slack style). */
.ch-row.unread .ch-row-title { color: #fff; font-weight: 700; }
-.ch-row.unread .ch-row-prev { color: #C7CCDA; }
+.ch-row.unread .ch-row-prev { color: #e7e5e4; }
.ch-unread {
flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
- background: var(--brand, #42309C); color: #fff; font-size: 11px; font-weight: 700;
+ background: var(--brand, #1a5cf5); color: #fff; font-size: 11px; font-weight: 700;
line-height: 18px; text-align: center;
}
@@ -107,7 +107,7 @@
position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px;
box-sizing: border-box;
display: inline-flex; align-items: center; justify-content: center;
- border-radius: 9px; background: #EF4444; color: #fff; font-size: 10.5px; font-weight: 700;
+ border-radius: 9px; background: #b4460f; color: #fff; font-size: 10.5px; font-weight: 700;
line-height: 1; border: 2px solid var(--dock-bg, #1B1530);
box-shadow: 0 0 0 .5px rgba(0,0,0,.3);
}
@@ -118,10 +118,10 @@
.ch-av-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.ch-av {
border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
- background: #42309C; color: #fff;
+ background: #1a5cf5; color: #fff;
font-size: 12px; font-weight: 600;
}
-.ch-av.bot { background: #0E9488; }
+.ch-av.bot { background: #15803d; }
.ch-badge {
position: absolute; right: -3px; bottom: -3px; min-width: 15px; height: 15px; padding: 0 3px;
border-radius: 5px; color: #fff; font-size: 8px; font-weight: 700; line-height: 15px;
@@ -139,14 +139,14 @@
.ch-agent-chip {
display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px;
- background: var(--brand-soft, #ECE9F7); color: var(--brand-ink, #332578); font-size: 12px; font-weight: 600;
+ background: var(--brand-soft, #f7f8fe); color: var(--brand-ink, #1447c4); font-size: 12px; font-weight: 600;
}
/* the agent "AI Agent" pill is the shared .ai-tag; .ch-agent-chip .ai-tag in page.css
makes it solid so it reads on the soft chip. */
.ch-extbar {
display: flex; align-items: center; gap: 8px; flex-shrink: 0;
- padding: 8px 24px; background: #FFFBEB; color: #92400E; font-size: 12.5px;
+ padding: 8px 24px; background: #fdf9f4; color: #8a6a3c; font-size: 12.5px;
border-bottom: 1px solid #FDE68A;
}
.ch-extbar-badge {
@@ -167,7 +167,7 @@
display: flex; align-items: center; justify-content: center; margin: 14px 0 6px; position: relative;
font-size: 12px; font-weight: 700; color: var(--ink-2);
}
-.ch-day::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-soft, #EFF1F4); }
+.ch-day::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-soft, #f4f2f0); }
.ch-day span { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 13px; box-shadow: 0 1px 2px rgba(17,24,39,.04); }
.ch-new-divider {
display: flex; align-items: center; margin: 8px 0; padding: 0 20px;
@@ -179,7 +179,7 @@
/* System/event line (joined / left a channel): centered, muted, actor highlighted. */
.ch-event { display: flex; justify-content: center; padding: 9px 16px; }
.ch-event-line { font-size: 13px; color: var(--mute, #8b919b); text-align: center; line-height: 1.5; }
-.ch-event-actor { color: var(--brand, #42309C); font-weight: 600; }
+.ch-event-actor { color: var(--brand, #1a5cf5); font-weight: 600; }
/* ── Message row (Slack-style left-aligned) ──────────────────────────────── */
.ch-m {
@@ -193,9 +193,9 @@
.ch-m-av {
width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
display: inline-flex; align-items: center; justify-content: center;
- background: #42309C; color: #fff; font-size: 12px; font-weight: 600;
+ background: #1a5cf5; color: #fff; font-size: 12px; font-weight: 600;
}
-.ch-m-av.bot { background: #0E9488; }
+.ch-m-av.bot { background: #15803d; }
.ch-m-time-hover {
font-size: 10px; color: var(--mute-2); opacity: 0; line-height: 21px; user-select: none;
}
@@ -206,7 +206,7 @@
.ch-m-time { font-size: 11px; color: var(--mute-2); }
.ch-cust-tag {
font-size: 8.5px; font-weight: 700; letter-spacing: .03em; padding: 1px 5px; border-radius: 4px;
- background: #FEF3C7; color: #92400E;
+ background: #fdf9f4; color: #8a6a3c;
}
/* Body + "(edited)" share a baseline flow: short messages get the marker inline
to the right (Slack); long wrapped text degrades to the next line. */
@@ -223,7 +223,7 @@
.ch-rich p { margin: 0 0 4px; }
.ch-rich ul, .ch-rich ol { margin: 2px 0 4px; padding-left: 22px; }
.ch-rich li { margin: 1px 0; }
-.ch-rich a.ch-link { color: var(--brand, #42309C); text-decoration: none; }
+.ch-rich a.ch-link { color: var(--brand, #1a5cf5); text-decoration: none; }
.ch-rich a.ch-link:hover { text-decoration: underline; }
.ch-rich code {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
@@ -240,9 +240,9 @@
.ch-rich img { max-width: 100%; border-radius: 8px; }
.ch-rich hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.ch-mention {
- background: #E3DFF3; color: #332578; font-weight: 600; border-radius: 4px; padding: 0 3px; white-space: nowrap;
+ background: #E3DFF3; color: #1447c4; font-weight: 600; border-radius: 4px; padding: 0 3px; white-space: nowrap;
}
-.ch-mention.me { background: #FDECC8; color: #92400E; }
+.ch-mention.me { background: #FDECC8; color: #8a6a3c; }
/* ── Attachments ─────────────────────────────────────────────────────────── */
.ch-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
@@ -268,16 +268,16 @@
row of attachments reads at a glance instead of one wall of brand purple. */
.ch-file-ico {
width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; display: inline-flex;
- align-items: center; justify-content: center; background: #EEF1F5; color: #5A6472;
+ align-items: center; justify-content: center; background: #f4f2f0; color: #6b6560;
}
-.ch-file-ico.tone-red { background: #FDEBEC; color: #D8373F; }
+.ch-file-ico.tone-red { background: #fdf9f4; color: #D8373F; }
.ch-file-ico.tone-green { background: #E5F3EC; color: #1F845A; }
-.ch-file-ico.tone-amber { background: #FBF0D7; color: #A66B00; }
-.ch-file-ico.tone-violet { background: #F1ECFF; color: #5F4DC7; }
+.ch-file-ico.tone-amber { background: #fdf9f4; color: #A66B00; }
+.ch-file-ico.tone-violet { background: #f7f8fe; color: #5F4DC7; }
.ch-file-ico.tone-pink { background: #FBEAF3; color: #C4357F; }
-.ch-file-ico.tone-indigo { background: #E9EEFC; color: #3E63DD; }
+.ch-file-ico.tone-indigo { background: #f7f8fe; color: #3E63DD; }
.ch-file-ico.tone-blue { background: #E7F0FA; color: #2674BA; }
-.ch-file-ico.tone-slate { background: #EEF1F5; color: #5A6472; }
+.ch-file-ico.tone-slate { background: #f4f2f0; color: #6b6560; }
.ch-file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ch-file-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-file-sub { font-size: 11px; color: var(--mute); }
@@ -298,21 +298,21 @@
.ch-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.ch-react-pill {
display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; cursor: pointer;
- border: 1px solid transparent; border-radius: 11px; background: #F2F2F6; font-family: inherit;
+ border: 1px solid transparent; border-radius: 11px; background: #f5f5f4; font-family: inherit;
transition: background .1s ease, border-color .1s ease;
}
.ch-react-pill:hover { background: #fff; border-color: #C9C9D6; }
-.ch-react-pill.mine { background: var(--brand-soft, #ECE9F7); border-color: #B0A6DE; }
-.ch-react-pill.mine:hover { border-color: var(--brand, #42309C); }
+.ch-react-pill.mine { background: var(--brand-soft, #f7f8fe); border-color: #B0A6DE; }
+.ch-react-pill.mine:hover { border-color: var(--brand, #1a5cf5); }
.ch-react-emoji { font-size: 13px; line-height: 1; }
.ch-react-count { font-size: 11.5px; font-weight: 700; color: #55555E; }
-.ch-react-pill.mine .ch-react-count { color: var(--brand-ink, #332578); }
+.ch-react-pill.mine .ch-react-count { color: var(--brand-ink, #1447c4); }
/* The bare add-reaction button only shows while hovering the message — at rest
the row is just content (Slack). */
.ch-react-add-wrap { position: relative; }
.ch-react-add {
width: 26px; height: 22px; border: 1px solid transparent; border-radius: 11px; cursor: pointer;
- background: #F2F2F6; color: var(--mute); display: inline-flex; align-items: center; justify-content: center;
+ background: #f5f5f4; color: var(--mute); display: inline-flex; align-items: center; justify-content: center;
opacity: 0; transition: opacity .1s ease;
}
.ch-m:hover .ch-react-add { opacity: 1; }
@@ -329,7 +329,7 @@
width: 30px; height: 28px; border: 0; background: none; border-radius: 6px; cursor: pointer;
color: #5C5C66; display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
-.ch-tool-btn:hover { background: #F2F2F6; color: var(--ink); }
+.ch-tool-btn:hover { background: #f5f5f4; color: var(--ink); }
.ch-tool-emoji { font-size: 15px; }
.ch-tool-anchor { position: relative; display: inline-flex; }
.ch-tool-menu {
@@ -343,9 +343,9 @@
}
.ch-tool-menu button:hover { background: var(--line-soft); color: var(--ink); }
.ch-tool-menu button svg { color: var(--mute); }
-.ch-tool-menu button.danger { color: #DC2626; }
-.ch-tool-menu button.danger svg { color: #DC2626; }
-.ch-tool-menu button.danger:hover { background: #FEF2F2; }
+.ch-tool-menu button.danger { color: #b4460f; }
+.ch-tool-menu button.danger svg { color: #b4460f; }
+.ch-tool-menu button.danger:hover { background: #fdf9f4; }
/* ── Thread chip + read receipts ─────────────────────────────────────────── */
/* Slack's reply bar: brand count + gray time at rest; hovering reveals a card
@@ -354,7 +354,7 @@
display: inline-flex; align-items: center; gap: 7px; margin-top: 5px; padding: 4px 9px 4px 7px;
min-width: 240px; max-width: 480px;
border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; font-family: inherit;
- font-size: 12.5px; font-weight: 600; color: var(--brand, #42309C); text-align: left;
+ font-size: 12.5px; font-weight: 600; color: var(--brand, #1a5cf5); text-align: left;
}
.ch-thread-chip:hover { background: #fff; border-color: var(--line); box-shadow: 0 1px 3px rgba(17,24,39,.07); }
.ch-thread-chip-time { color: var(--mute); font-weight: 500; }
@@ -368,10 +368,10 @@
.ch-read-av {
width: 15px; height: 15px; border-radius: 4px; overflow: hidden; margin-left: -3px;
border: 1.5px solid #fff; display: inline-flex; align-items: center; justify-content: center;
- background: #42309C; color: #fff; font-size: 7px; font-weight: 700;
+ background: #1a5cf5; color: #fff; font-size: 7px; font-weight: 700;
}
.ch-read-av:first-child { margin-left: 0; }
-.ch-read-av.bot { background: #0E9488; }
+.ch-read-av.bot { background: #15803d; }
.ch-read-more { font-size: 10px; color: var(--mute); margin-left: 4px; }
/* ── Typing indicator ────────────────────────────────────────────────────── */
@@ -393,13 +393,13 @@
read as template, not product. */
.ch-composer-rich:focus-within { border-color: #A3A6B3; box-shadow: none; }
.ch-composer-rich.inline { border-radius: 10px; margin: 2px 0; }
-.ch-fmt-bar { display: flex; align-items: center; gap: 1px; padding: 4px 6px; border-bottom: 1px solid var(--line-soft, #EFF1F4); }
+.ch-fmt-bar { display: flex; align-items: center; gap: 1px; padding: 4px 6px; border-bottom: 1px solid var(--line-soft, #f4f2f0); }
.ch-fmt-btn {
width: 28px; height: 26px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: #71717C;
display: inline-flex; align-items: center; justify-content: center;
}
-.ch-fmt-btn:hover { background: #F2F2F6; color: var(--ink); }
-.ch-fmt-btn.active { background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C); }
+.ch-fmt-btn:hover { background: #f5f5f4; color: var(--ink); }
+.ch-fmt-btn.active { background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5); }
.ch-editor-wrap { max-height: 220px; overflow: auto; }
.ch-editor .ProseMirror {
padding: 10px 13px; min-height: 22px; outline: none; font-size: 14.5px; line-height: 1.46; color: var(--ink);
@@ -413,7 +413,7 @@
.ch-editor .ProseMirror pre { background: #1E1B2E; color: #E6E1FF; border-radius: 8px; padding: 9px 11px; }
.ch-editor .ProseMirror ul, .ch-editor .ProseMirror ol { padding-left: 20px; margin: 2px 0; }
.ch-editor .ProseMirror blockquote { border-left: 3px solid var(--line); padding-left: 10px; color: var(--ink-2); }
-.ch-editor .ProseMirror .ch-mention { background: #E3DFF3; color: #332578; font-weight: 600; border-radius: 4px; padding: 0 3px; }
+.ch-editor .ProseMirror .ch-mention { background: #E3DFF3; color: #1447c4; font-weight: 600; border-radius: 4px; padding: 0 3px; }
.ch-attach-tray { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 11px 7px; }
.ch-attach-chip {
@@ -423,7 +423,7 @@
.ch-attach-chip.up { opacity: .7; }
.ch-attach-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-attach-x { border: 0; background: none; cursor: pointer; color: var(--mute); display: inline-flex; padding: 0; }
-.ch-attach-x:hover { color: #DC2626; }
+.ch-attach-x:hover { color: #b4460f; }
.ch-attach-spin { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: ch-spin .7s linear infinite; }
@keyframes ch-spin { to { transform: rotate(360deg); } }
@@ -434,19 +434,19 @@
width: 30px; height: 28px; border: 0; background: none; border-radius: 7px; cursor: pointer; color: #71717C;
display: inline-flex; align-items: center; justify-content: center;
}
-.ch-ca-btn:hover { background: #F2F2F6; color: var(--ink); }
-.ch-ca-btn.on { background: var(--brand-soft, #ECE9F7); color: var(--brand); }
+.ch-ca-btn:hover { background: #f5f5f4; color: var(--ink); }
+.ch-ca-btn.on { background: var(--brand-soft, #f7f8fe); color: var(--brand); }
.ch-emoji-anchor { position: relative; display: inline-flex; }
.ch-btn-ghost { border: 0; background: none; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--mute); padding: 6px 10px; border-radius: 8px; }
-.ch-btn-ghost:hover { background: #F2F2F6; color: var(--ink); }
+.ch-btn-ghost:hover { background: #f5f5f4; color: var(--ink); }
/* Send: gray ghost while empty, brand fill once there is content (Slack). */
.ch-send {
height: 28px; min-width: 32px; padding: 0 8px; border-radius: 7px; border: 0; cursor: pointer; flex-shrink: 0;
- background: var(--brand, #42309C); color: #fff; display: inline-flex; align-items: center; justify-content: center;
+ background: var(--brand, #1a5cf5); color: #fff; display: inline-flex; align-items: center; justify-content: center;
transition: background .12s ease, color .12s ease;
}
.ch-send:disabled { background: transparent; color: #B6B6C0; cursor: default; }
-.ch-send:not(:disabled):hover { background: var(--brand-ink, #332578); }
+.ch-send:not(:disabled):hover { background: var(--brand-ink, #1447c4); }
/* ── Emoji popover + mention list ────────────────────────────────────────── */
.ch-emoji-pop { position: absolute; bottom: calc(100% + 8px); z-index: 80; }
@@ -464,12 +464,12 @@ em-emoji-picker { --rgb-background: 255,255,255; --border-radius: 12px; box-shad
display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 9px; border: 0; background: none;
border-radius: 7px; cursor: pointer; font-family: inherit; text-align: left;
}
-.ch-mention-item.active { background: #ECE9F7; }
+.ch-mention-item.active { background: #f7f8fe; }
.ch-mention-av {
width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; display: inline-flex; align-items: center;
- justify-content: center; background: #42309C; color: #fff; font-size: 9.5px; font-weight: 700;
+ justify-content: center; background: #1a5cf5; color: #fff; font-size: 9.5px; font-weight: 700;
}
-.ch-mention-av.bot { background: #0E9488; }
+.ch-mention-av.bot { background: #15803d; }
.ch-mention-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--ink); }
/* ── Thread side-pane ────────────────────────────────────────────────────── */
@@ -482,4 +482,4 @@ em-emoji-picker { --rgb-background: 255,255,255; --border-radius: 12px; box-shad
.ch-thread-count { font-size: 11.5px; font-weight: 600; color: var(--mute); padding: 8px 20px 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ch-thread-composer { flex-shrink: 0; padding: 8px 16px 12px; border-top: 1px solid var(--line); }
.ch-also-send { display: flex; align-items: center; gap: 7px; margin-top: 7px; font-size: 12px; color: var(--mute); cursor: pointer; }
-.ch-also-send input { accent-color: var(--brand, #42309C); }
+.ch-also-send input { accent-color: var(--brand, #1a5cf5); }
diff --git a/ui/src/studio/styles/chrome.css b/ui/src/studio/styles/chrome.css
index b8ad76be..c25d5cf7 100644
--- a/ui/src/studio/styles/chrome.css
+++ b/ui/src/studio/styles/chrome.css
@@ -26,7 +26,7 @@
/* Sidebar — independent vertical scroll within .side-nav, never on the shell */
.side {
background: var(--sidebar);
- color: #E5E7EB;
+ color: #e7e5e4;
display: flex; flex-direction: column;
min-height: 0;
overflow: hidden;
@@ -77,7 +77,7 @@
.side-link.locked .ic { opacity: .35; }
.side-link {
display: flex; align-items: center; gap: 10px;
- height: 32px; padding: 0 16px; font-size: 13px; color: #C7CCDA;
+ height: 32px; padding: 0 16px; font-size: 13px; color: #e7e5e4;
cursor: pointer; position: relative;
}
.side-link .ic { display:inline-flex; opacity: .75; }
diff --git a/ui/src/studio/styles/dashboard.css b/ui/src/studio/styles/dashboard.css
index 303acd56..b06c9aa7 100644
--- a/ui/src/studio/styles/dashboard.css
+++ b/ui/src/studio/styles/dashboard.css
@@ -1,4 +1,4 @@
-/* Generative-BI dashboard — flat, on-brand (bright iris #6E55FF), matches studio tokens.
+/* Generative-BI dashboard — flat, on-brand (bright iris #1a5cf5), matches studio tokens.
Buttons reuse the studio `.btn` / `.btn.sm` / `.btn.primary` primitives. */
.db-root { display: flex; flex-direction: column; height: 100%; min-height: 0; background: #FBFAFF; }
@@ -9,12 +9,12 @@
}
.db-toolbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.db-toolbar-right { display: flex; gap: 8px; }
-.db-stamp { font-size: 12px; color: #8A82A6; }
+.db-stamp { font-size: 12px; color: #a8a29e; }
.db-edit-badge {
- font-size: 11.5px; font-weight: 600; color: #6E55FF; background: #EEEBFF;
+ font-size: 11.5px; font-weight: 600; color: #1a5cf5; background: #f7f8fe;
padding: 3px 10px; border-radius: 999px; letter-spacing: .02em;
}
-.db-note { font-size: 12px; color: #5B47D6; background: #EEEBFF; padding: 3px 10px; border-radius: 999px; }
+.db-note { font-size: 12px; color: #5B47D6; background: #f7f8fe; padding: 3px 10px; border-radius: 999px; }
/* ── canvas + inspector row ── */
.db-main { flex: 1; min-height: 0; display: flex; }
@@ -31,14 +31,14 @@
}
.db-panel.is-edit { cursor: pointer; }
.db-panel.is-edit:hover { box-shadow: 0 4px 16px rgba(110,85,255,.10), 0 0 0 1px #D9D1FB; }
-.db-panel.is-sel { box-shadow: 0 6px 22px rgba(110,85,255,.16), 0 0 0 2px #6E55FF; }
+.db-panel.is-sel { box-shadow: 0 6px 22px rgba(110,85,255,.16), 0 0 0 2px #1a5cf5; }
.db-panel-head {
display: flex; align-items: center; justify-content: space-between;
padding: 12px 15px 5px; flex-shrink: 0; gap: 8px;
}
.db-panel.is-edit .db-panel-head { cursor: move; }
.db-panel-title {
- font-size: 12.5px; font-weight: 600; color: #2A2350; letter-spacing: .01em;
+ font-size: 12.5px; font-weight: 600; color: #1447c4; letter-spacing: .01em;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.db-panel-body { flex: 1; min-height: 0; padding: 4px 14px 14px; position: relative; }
@@ -50,25 +50,25 @@
width: 24px; height: 24px; border-radius: 7px; display: inline-flex;
align-items: center; justify-content: center;
}
-.db-panel-act:hover { background: #EEEBFF; color: #6E55FF; }
+.db-panel-act:hover { background: #f7f8fe; color: #1a5cf5; }
.db-panel-act-del:hover { background: #FCE9F1; color: #E0407A; }
/* ── tiles ── */
.db-stat { display: flex; flex-direction: column; justify-content: center; height: 100%; padding: 4px 4px 10px; }
.db-stat-value { font-size: 36px; font-weight: 700; line-height: 1.04; letter-spacing: -.015em; }
-.db-stat-sub { font-size: 12px; color: #8A82A6; margin-top: 5px; }
+.db-stat-sub { font-size: 12px; color: #a8a29e; margin-top: 5px; }
.db-table-wrap { height: 100%; overflow: auto; }
.db-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
-.db-table th { text-align: left; color: #8A82A6; font-weight: 600; padding: 6px 8px; position: sticky; top: 0; background: #fff; }
-.db-table td { padding: 6px 8px; color: #2A2350; border-top: 1px solid #F3F0FC; }
+.db-table th { text-align: left; color: #a8a29e; font-weight: 600; padding: 6px 8px; position: sticky; top: 0; background: #fff; }
+.db-table td { padding: 6px 8px; color: #1447c4; border-top: 1px solid #F3F0FC; }
-.db-loading, .db-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #8A82A6; gap: 6px; }
-.db-empty-title { font-size: 16px; font-weight: 600; color: #2A2350; }
+.db-loading, .db-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: #a8a29e; gap: 6px; }
+.db-empty-title { font-size: 16px; font-weight: 600; color: #1447c4; }
.db-empty-sub { font-size: 13px; }
/* react-grid-layout on-brand */
-.react-grid-item.react-grid-placeholder { background: #6E55FF !important; opacity: .14; border-radius: 16px; }
+.react-grid-item.react-grid-placeholder { background: #1a5cf5 !important; opacity: .14; border-radius: 16px; }
.react-grid-item > .react-resizable-handle::after { border-color: #C5BAF5; }
/* ── inline inspector (mirrors the workflow editor's right panel) ── */
@@ -78,15 +78,15 @@
}
.db-insp-h {
display: flex; align-items: center; gap: 9px; padding: 13px 16px;
- border-bottom: 1px solid #F1EEFA; flex-shrink: 0;
+ border-bottom: 1px solid #f7f8fe; flex-shrink: 0;
}
.db-insp-badge {
- width: 24px; height: 24px; border-radius: 7px; background: #EEEBFF; color: #6E55FF;
+ width: 24px; height: 24px; border-radius: 7px; background: #f7f8fe; color: #1a5cf5;
display: inline-flex; align-items: center; justify-content: center;
}
-.db-insp-title { font-size: 13px; font-weight: 600; color: #2A2350; flex: 1; }
+.db-insp-title { font-size: 13px; font-weight: 600; color: #1447c4; flex: 1; }
.db-insp-x { border: none; background: transparent; font-size: 20px; line-height: 1; color: #A79FC6; cursor: pointer; padding: 0 2px; }
-.db-insp-x:hover { color: #6E55FF; }
+.db-insp-x:hover { color: #1a5cf5; }
.db-insp-b { flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 13px; }
.db-insp-sec {
font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
@@ -97,18 +97,18 @@
.db-insp-hint { font-size: 10.5px; color: #B3ABCC; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.db-insp-f {
display: flex; align-items: center; gap: 8px; padding: 12px 16px;
- border-top: 1px solid #F1EEFA; flex-shrink: 0;
+ border-top: 1px solid #f7f8fe; flex-shrink: 0;
}
.db-insp-del { color: #E0407A; margin-right: auto; }
.db-insp-del:hover { background: #FCE9F1; border-color: #F6C9DC; }
/* inputs */
.db-in {
- width: 100%; font: inherit; font-size: 13px; color: #2A2350; background: #fff;
+ width: 100%; font: inherit; font-size: 13px; color: #1447c4; background: #fff;
border: 1px solid #E6E2F3; border-radius: 8px; padding: 7px 10px; outline: none;
transition: border-color .12s ease, box-shadow .12s ease;
}
-.db-in:focus { border-color: #6E55FF; box-shadow: 0 0 0 3px rgba(110,85,255,.12); }
+.db-in:focus { border-color: #1a5cf5; box-shadow: 0 0 0 3px rgba(110,85,255,.12); }
select.db-in { cursor: pointer; }
.db-ta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; resize: vertical; }
diff --git a/ui/src/studio/styles/dialog.css b/ui/src/studio/styles/dialog.css
index c81bacd9..bad14625 100644
--- a/ui/src/studio/styles/dialog.css
+++ b/ui/src/studio/styles/dialog.css
@@ -53,15 +53,15 @@
cursor: pointer;
transition: border-color .12s, background .12s, transform .04s;
}
-.dlg-type:hover { background: var(--surface-2, #F8FAFC); }
-.dlg-type.on { border-color: var(--brand, #42309C); box-shadow: 0 0 0 2px rgba(40,90,255,.16); }
+.dlg-type:hover { background: var(--surface-2, #fafaf9); }
+.dlg-type.on { border-color: var(--brand, #1a5cf5); box-shadow: 0 0 0 2px rgba(40,90,255,.16); }
.dlg-type:active { transform: translateY(1px); }
.dlg-type-ic {
width: 38px; height: 38px; border-radius: 10px;
display: inline-flex; align-items: center; justify-content: center;
}
.dlg-type-lbl {
- font-size: 12px; font-weight: 550; color: var(--ink, #0f172a);
+ font-size: 12px; font-weight: 550; color: var(--ink, #1c1917);
text-align: center; line-height: 1.25;
}
@@ -70,13 +70,13 @@
}
.dlg-title {
font-size: 15px; font-weight: 600;
- color: var(--ink, #0f172a);
+ color: var(--ink, #1c1917);
line-height: 1.4;
}
-.dlg-h-destructive .dlg-title { color: #B91C1C; }
-.dlg-h-error .dlg-title { color: #B91C1C; }
+.dlg-h-destructive .dlg-title { color: #b4460f; }
+.dlg-h-error .dlg-title { color: #b4460f; }
.dlg-h-warning .dlg-title { color: #B45309; }
-.dlg-h-success .dlg-title { color: #047857; }
+.dlg-h-success .dlg-title { color: #15803d; }
.dlg-b {
padding: 12px 20px 4px;
@@ -84,7 +84,7 @@
}
.dlg-msg {
font-size: 13px; line-height: 1.55;
- color: var(--mute, #475569);
+ color: var(--mute, #57534e);
margin-bottom: 8px;
white-space: pre-wrap;
word-break: break-word;
@@ -92,7 +92,7 @@
.dlg-label {
display: block;
font-size: 11px; font-weight: 600;
- color: var(--mute, #475569);
+ color: var(--mute, #57534e);
text-transform: uppercase;
letter-spacing: .04em;
margin: 10px 0 6px;
@@ -102,7 +102,7 @@
padding: 9px 11px;
font-size: 13px;
font-family: inherit;
- color: var(--ink, #0f172a);
+ color: var(--ink, #1c1917);
background: var(--surface, #fff);
border: 1px solid var(--line, rgba(15,23,42,.16));
border-radius: 8px;
@@ -110,22 +110,22 @@
transition: border-color .12s ease, box-shadow .12s ease;
}
.dlg-input:focus {
- border-color: var(--brand, #42309C);
+ border-color: var(--brand, #1a5cf5);
box-shadow: 0 0 0 3px rgba(40,90,255,.14);
}
.dlg-input-err {
- border-color: #DC2626;
+ border-color: #b4460f;
}
.dlg-input-err:focus {
box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}
textarea.dlg-input { resize: vertical; min-height: 80px; line-height: 1.5; }
.dlg-help {
- font-size: 11px; color: var(--mute, #475569);
+ font-size: 11px; color: var(--mute, #57534e);
margin-top: 6px; line-height: 1.5;
}
.dlg-err {
- font-size: 11px; color: #B91C1C;
+ font-size: 11px; color: #b4460f;
margin-top: 6px; line-height: 1.5;
}
@@ -144,22 +144,22 @@ textarea.dlg-input { resize: vertical; min-height: 80px; line-height: 1.5; }
border-radius: 8px;
border: 1px solid transparent;
background: transparent;
- color: var(--ink, #0f172a);
+ color: var(--ink, #1c1917);
transition: background .12s, border-color .12s, color .12s, transform .04s;
}
-.dlg-btn:focus-visible { outline: 2px solid var(--brand, #42309C); outline-offset: 2px; }
+.dlg-btn:focus-visible { outline: 2px solid var(--brand, #1a5cf5); outline-offset: 2px; }
.dlg-btn:active { transform: translateY(1px); }
.dlg-secondary {
border-color: var(--line, rgba(15,23,42,.18));
- color: var(--ink, #0f172a);
+ color: var(--ink, #1c1917);
background: var(--surface, #fff);
}
-.dlg-secondary:hover { background: var(--surface-2, #F8FAFC); }
+.dlg-secondary:hover { background: var(--surface-2, #fafaf9); }
.dlg-primary {
- background: var(--brand, #42309C);
- border-color: var(--brand, #42309C);
+ background: var(--brand, #1a5cf5);
+ border-color: var(--brand, #1a5cf5);
color: #fff;
}
.dlg-primary:hover {
@@ -168,10 +168,10 @@ textarea.dlg-input { resize: vertical; min-height: 80px; line-height: 1.5; }
}
.dlg-destructive {
- background: #DC2626;
- border-color: #DC2626;
+ background: #b4460f;
+ border-color: #b4460f;
}
.dlg-destructive:hover {
- background: #B91C1C;
- border-color: #B91C1C;
+ background: #b4460f;
+ border-color: #b4460f;
}
diff --git a/ui/src/studio/styles/org.css b/ui/src/studio/styles/org.css
index f05654d5..2f6fd0b1 100644
--- a/ui/src/studio/styles/org.css
+++ b/ui/src/studio/styles/org.css
@@ -6,7 +6,7 @@
.org-err {
max-width: 760px; margin: 0 auto 16px; padding: 10px 14px; border-radius: 10px;
- background: #fdecec; color: #b42318; font-size: 13px; border: 1px solid #f6c9c6;
+ background: #fdf9f4; color: #b42318; font-size: 13px; border: 1px solid #f6c9c6;
}
.org-card { max-width: 760px; margin: 0 auto 20px; padding: 20px 22px; }
@@ -14,8 +14,8 @@
.org-card-h h2 { font-size: 16px; font-weight: 600; margin: 0; color: var(--ink); }
.org-count {
display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px;
- padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--brand-soft, #ECE9F7);
- color: var(--brand, #42309C); font-size: 12px; font-weight: 600;
+ padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--brand-soft, #f7f8fe);
+ color: var(--brand, #1a5cf5); font-size: 12px; font-weight: 600;
}
.org-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
@@ -41,7 +41,7 @@
.org-av {
width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
- background: #42309C; color: #fff; font-size: 12px; font-weight: 600;
+ background: #1a5cf5; color: #fff; font-size: 12px; font-weight: 600;
}
.org-member-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.org-member-name { font-size: 14px; font-weight: 550; color: var(--ink); }
@@ -54,7 +54,7 @@
.org-chip {
display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
- background: var(--brand-soft, #ECE9F7); color: var(--brand-ink, #332578);
+ background: var(--brand-soft, #f7f8fe); color: var(--brand-ink, #1447c4);
border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.org-chip.member { background: var(--surface-2, #f4f5f8); color: var(--ink); border: 1px solid var(--line); }
@@ -71,7 +71,7 @@
.org-team-ic {
width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
- background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C);
+ background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5);
}
.org-team-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.org-team-count { margin-left: auto; font-size: 12px; color: var(--mute); }
@@ -92,7 +92,7 @@
.pf-av {
width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
- background: #42309C; color: #fff; font-size: 24px; font-weight: 600;
+ background: #1a5cf5; color: #fff; font-size: 24px; font-weight: 600;
}
.pf-id { min-width: 0; }
.pf-name { font-size: 18px; font-weight: 600; color: var(--ink); }
@@ -116,5 +116,5 @@
.pf-modal-h { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.pf-cropper { position: relative; width: 100%; height: 300px; background: #1a1830; border-radius: 12px; overflow: hidden; }
.pf-zoom { padding: 14px 2px 4px; }
-.pf-zoom input { width: 100%; accent-color: var(--brand, #42309C); }
+.pf-zoom input { width: 100%; accent-color: var(--brand, #1a5cf5); }
.pf-modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
diff --git a/ui/src/studio/styles/os.css b/ui/src/studio/styles/os.css
index 469b7701..bf898e7d 100644
--- a/ui/src/studio/styles/os.css
+++ b/ui/src/studio/styles/os.css
@@ -33,7 +33,7 @@
content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px;
background: transparent; transition: background .12s ease;
}
-.app-side-resize:hover::after { background: var(--brand, #42309C); }
+.app-side-resize:hover::after { background: var(--brand, #1a5cf5); }
/* ── Dock ─────────────────────────────────────────────────────────────── */
.os-dock {
@@ -104,7 +104,7 @@
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, .06);
- color: #C7CCDA;
+ color: #e7e5e4;
transition: background .14s ease, color .14s ease, border-radius .14s ease;
}
.os-app:hover .os-app-ic {
@@ -123,7 +123,7 @@
white-space: nowrap;
}
.os-app.active .os-app-ic {
- background: #42309C;
+ background: #1a5cf5;
color: #fff;
box-shadow: 0 4px 12px rgba(74, 55, 204, .4);
}
@@ -159,7 +159,7 @@
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, .06);
- color: #C7CCDA;
+ color: #e7e5e4;
}
.os-dock-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.os-dock-avatar {
@@ -171,7 +171,7 @@
display: flex;
align-items: center;
justify-content: center;
- background: #42309C;
+ background: #1a5cf5;
color: #fff;
font-size: 14px;
font-weight: 600;
@@ -218,7 +218,7 @@
.os-acct-av {
width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
- background: #42309C; color: #fff;
+ background: #1a5cf5; color: #fff;
font-size: 13px; font-weight: 600;
}
.os-acct-id { min-width: 0; }
@@ -243,8 +243,8 @@
.os-acct-item.os-acct-item-static { color: var(--mute-2); cursor: default; }
.os-acct-item.os-acct-item-static:hover { background: none; }
.os-acct-caret { color: var(--mute-2); flex: 0 0 auto !important; }
-.os-acct-danger { color: #DC2626; }
-.os-acct-danger:hover { background: var(--hot-soft); color: #B91C1C; }
+.os-acct-danger { color: #b4460f; }
+.os-acct-danger:hover { background: var(--hot-soft); color: #b4460f; }
.os-acct-orglist { padding: 2px 6px 4px; }
.os-acct-orgrow {
display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
@@ -272,8 +272,8 @@
display: flex;
align-items: center;
justify-content: center;
- background: var(--brand-soft, #ECE9F7);
- color: var(--brand, #42309C);
+ background: var(--brand-soft, #f7f8fe);
+ color: var(--brand, #1a5cf5);
}
/* ── Help → Chatra modal ──────────────────────────────────────────────────
diff --git a/ui/src/studio/styles/page.css b/ui/src/studio/styles/page.css
index e0333a39..ff34a1b4 100644
--- a/ui/src/studio/styles/page.css
+++ b/ui/src/studio/styles/page.css
@@ -110,7 +110,7 @@
.ai-tag {
font-size: 9px; font-weight: 700; letter-spacing: .05em; line-height: 1.6;
padding: 1.5px 5px; border-radius: 5px; white-space: nowrap; margin-left: 2px;
- background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C);
+ background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5);
}
.app-side .ai-tag { background: rgba(40,90,255, .3); color: #9FC0FF; }
-.ch-agent-chip .ai-tag { background: var(--brand, #42309C); color: #fff; }
+.ch-agent-chip .ai-tag { background: var(--brand, #1a5cf5); color: #fff; }
diff --git a/ui/src/studio/styles/spaces.css b/ui/src/studio/styles/spaces.css
index 16ec2cc1..f8704655 100644
--- a/ui/src/studio/styles/spaces.css
+++ b/ui/src/studio/styles/spaces.css
@@ -9,7 +9,7 @@
font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
color: var(--sidebar-mute); cursor: pointer; user-select: none;
}
-.sp-ws-head:hover { color: #C7CCDA; }
+.sp-ws-head:hover { color: #e7e5e4; }
.sp-ws-chev { display: inline-flex; opacity: .8; }
.sp-ws-chev svg { width: 13px; height: 13px; }
.sp-ws-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -56,7 +56,7 @@
.sp-empty-ic {
width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px;
display: flex; align-items: center; justify-content: center;
- background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C);
+ background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5);
}
.sp-empty-ic svg { width: 26px; height: 26px; }
@@ -192,7 +192,7 @@
.sp-row { padding-right: 6px; }
/* Row icons read at full strength, the same color as the label (no fade). */
.sp-row .ic { flex-shrink: 0; opacity: 1; color: inherit; }
-.sp-section .lbl { font-weight: 600; color: #C7CCDA; letter-spacing: .01em; }
+.sp-section .lbl { font-weight: 600; color: #e7e5e4; letter-spacing: .01em; }
.sp-section:hover .lbl { color: #fff; }
.sp-row-right {
margin-left: auto; display: inline-flex; align-items: center; gap: 1px;
@@ -242,8 +242,8 @@
.sp-rowmenu-item:hover { background: var(--line-soft); color: var(--ink); }
.sp-rowmenu-item svg { flex-shrink: 0; color: var(--mute); }
.sp-rowmenu-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
-.sp-rowmenu-item.danger, .sp-rowmenu-item.danger svg { color: #DC2626; }
-.sp-rowmenu-item.danger:hover { background: var(--hot-soft); color: #B91C1C; }
+.sp-rowmenu-item.danger, .sp-rowmenu-item.danger svg { color: #b4460f; }
+.sp-rowmenu-item.danger:hover { background: var(--hot-soft); color: #b4460f; }
.sp-rowmenu-empty { font-size: 12px; color: var(--mute-2); padding: 6px 9px; }
/* ── Resource breadcrumb (light topbar) ───────────────────────────────────── */
@@ -271,10 +271,10 @@
.share-av {
width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
display: inline-flex; align-items: center; justify-content: center;
- background: #42309C; color: #fff;
+ background: #1a5cf5; color: #fff;
font-size: 9.5px; font-weight: 600;
}
-.share-av.team { background: #10B981; }
+.share-av.team { background: #15803d; }
.share-av.lock { background: var(--line-soft); color: var(--mute); }
.share-av.inherit { background: var(--brand-soft); color: var(--brand-ink); }
@@ -292,7 +292,7 @@
color: var(--ink); background: var(--surface-2);
}
.share-input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(94,78,190,.12); }
-.share-msg { font-size: 12px; color: #B45309; background: #FEF3C7; border-radius: 7px; padding: 6px 9px; margin-bottom: 8px; }
+.share-msg { font-size: 12px; color: #B45309; background: #fdf9f4; border-radius: 7px; padding: 6px 9px; margin-bottom: 8px; }
.share-list { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; max-height: 240px; overflow: auto; }
.share-empty { font-size: 12.5px; color: var(--mute); padding: 8px 2px; }
@@ -315,7 +315,7 @@
width: 24px; height: 24px; border: 0; background: none; border-radius: 6px; cursor: pointer;
color: var(--mute-2); display: inline-flex; align-items: center; justify-content: center;
}
-.share-remove:hover { background: var(--hot-soft); color: #B91C1C; }
+.share-remove:hover { background: var(--hot-soft); color: #b4460f; }
.share-inherited { display: flex; align-items: center; gap: 8px; padding: 8px 4px; color: var(--mute); font-size: 12px; }
/* Read-only role for an inherited grant (managed at the ancestor it came from). */
.share-priv-ro { display: inline-flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; line-height: 1.25; }
@@ -363,7 +363,7 @@
.folder-head-ic {
width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
- background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C);
+ background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5);
}
.folder-title { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
@@ -392,19 +392,19 @@
transition: border-color .15s, background .15s, box-shadow .15s;
}
.folder-card:hover {
- border-color: var(--brand, #42309C);
- box-shadow: 0 1px 0 var(--brand-soft, #ECE9F7), 0 6px 18px -12px rgba(94,78,190, .5);
+ border-color: var(--brand, #1a5cf5);
+ box-shadow: 0 1px 0 var(--brand-soft, #f7f8fe), 0 6px 18px -12px rgba(94,78,190, .5);
}
.folder-card-ic {
width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
- background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C);
+ background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5);
}
.folder-card-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.folder-card-name { font-size: 14px; font-weight: 550; color: var(--ink); }
.folder-card-kind { font-size: 11.5px; color: var(--mute); }
.folder-card-go { color: var(--mute); display: flex; }
-.folder-card:hover .folder-card-go { color: var(--brand, #42309C); }
+.folder-card:hover .folder-card-go { color: var(--brand, #1a5cf5); }
/* ── Minimal markdown (README bodies) ────────────────────────────────────── */
.md { color: var(--ink); font-size: 14.5px; line-height: 1.7; }
@@ -419,17 +419,17 @@
.md-ul li, .md-ol li { margin: .25em 0; }
.md-code {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em;
- background: var(--brand-soft, #ECE9F7); color: var(--brand-ink, #332578);
+ background: var(--brand-soft, #f7f8fe); color: var(--brand-ink, #1447c4);
padding: 1px 5px; border-radius: 5px;
}
.md-pre {
- background: var(--code-bg, #0f1117); color: #e6e6e6; border-radius: 10px;
+ background: var(--code-bg, #1c1917); color: #e6e6e6; border-radius: 10px;
padding: 14px 16px; overflow-x: auto; margin: 0 0 1em; font-size: 13px; line-height: 1.55;
}
.md-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: none; color: inherit; padding: 0; }
.md-hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.md-quote { margin: 0 0 1em; padding: 4px 0 4px 14px; border-left: 3px solid var(--line); color: var(--mute); }
-.md a { color: var(--brand, #42309C); text-decoration: none; }
+.md a { color: var(--brand, #1a5cf5); text-decoration: none; }
.md a:hover { text-decoration: underline; }
/* ── Prev / next page links (GitBook-style), at the foot of a resource ─────── */
@@ -455,14 +455,14 @@
color: var(--ink);
transition: border-color .14s ease, box-shadow .14s ease;
}
-.sp-pn-card:hover { border-color: var(--brand, #42309C); box-shadow: 0 2px 12px -5px rgba(94,78,190, .35); }
+.sp-pn-card:hover { border-color: var(--brand, #1a5cf5); box-shadow: 0 2px 12px -5px rgba(94,78,190, .35); }
.sp-pn-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sp-pn-prev .sp-pn-body { align-items: flex-end; text-align: right; } /* Previous: text right-aligned */
.sp-pn-next .sp-pn-body { align-items: flex-start; text-align: left; } /* Next: text left-aligned */
.sp-pn-dir { font-size: 13px; color: var(--mute); }
.sp-pn-name { font-size: 15px; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.sp-pn-card svg { color: var(--mute-2); flex-shrink: 0; }
-.sp-pn-card:hover svg { color: var(--brand, #42309C); }
+.sp-pn-card:hover svg { color: var(--brand, #1a5cf5); }
/* ── Pinned app header + filter at the top of the Spaces sidebar ───────────── */
.app-side { display: flex; flex-direction: column; min-height: 0; }
@@ -493,10 +493,10 @@
padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
cursor: pointer; text-align: left; transition: border-color .14s ease, box-shadow .14s ease;
}
-.sp-es-card:hover { border-color: var(--brand, #42309C); box-shadow: 0 2px 12px -5px rgba(94,78,190, .35); }
+.sp-es-card:hover { border-color: var(--brand, #1a5cf5); box-shadow: 0 2px 12px -5px rgba(94,78,190, .35); }
.sp-es-ic {
width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
- background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C); margin-bottom: 6px;
+ background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5); margin-bottom: 6px;
}
.sp-es-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.sp-es-desc { font-size: 12.5px; color: var(--mute); }
@@ -513,54 +513,54 @@
border: 1px solid var(--line); border-radius: 8px; background: #fff; font-family: inherit;
font-size: 13px; font-weight: 600; color: var(--ink-2); transition: border-color .12s, background .12s;
}
-.dv-btn:hover { border-color: #C9C9D6; background: var(--line-soft, #F2F2F6); }
-.dv-btn.primary { background: var(--brand, #42309C); border-color: var(--brand, #42309C); color: #fff; }
-.dv-btn.primary:hover { background: var(--brand-ink, #332578); }
+.dv-btn:hover { border-color: #C9C9D6; background: var(--line-soft, #f5f5f4); }
+.dv-btn.primary { background: var(--brand, #1a5cf5); border-color: var(--brand, #1a5cf5); color: #fff; }
+.dv-btn.primary:hover { background: var(--brand-ink, #1447c4); }
.dv-btn:disabled { opacity: .6; cursor: default; }
-.dv-err { font-size: 12.5px; color: #C0392B; background: #FDECEC; border: 1px solid #F6C9C5; border-radius: 8px; padding: 7px 11px; margin-bottom: 12px; }
+.dv-err { font-size: 12.5px; color: #b4460f; background: #fdf9f4; border: 1px solid #F6C9C5; border-radius: 8px; padding: 7px 11px; margin-bottom: 12px; }
.dv-drop {
width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
- padding: 56px 20px; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--bg, #F7F8FB);
+ padding: 56px 20px; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--bg, #fafaf9);
color: var(--mute); cursor: pointer; font-family: inherit; transition: border-color .12s, background .12s;
}
-.dv-drop:hover:not(:disabled) { border-color: var(--brand, #42309C); background: var(--brand-50, #F5F4FA); color: var(--brand-ink, #332578); }
+.dv-drop:hover:not(:disabled) { border-color: var(--brand, #1a5cf5); background: var(--brand-50, #F5F4FA); color: var(--brand-ink, #1447c4); }
.dv-drop:disabled { cursor: default; }
.dv-drop svg { color: var(--mute-2); }
-.dv-drop:hover:not(:disabled) svg { color: var(--brand, #42309C); }
+.dv-drop:hover:not(:disabled) svg { color: var(--brand, #1a5cf5); }
.dv-drop-1 { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.dv-drop-2 { font-size: 12.5px; color: var(--mute); }
.dv-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dv-row {
- display: flex; align-items: center; gap: 0; background: #fff; border-bottom: 1px solid var(--line-soft, #EFF1F4);
+ display: flex; align-items: center; gap: 0; background: #fff; border-bottom: 1px solid var(--line-soft, #f4f2f0);
font-family: inherit; text-align: left;
}
.dv-row:last-child { border-bottom: 0; }
.dv-row:hover { background: #FAFAFC; }
-.dv-row.folder { border: 0; border-bottom: 1px solid var(--line-soft, #EFF1F4); cursor: pointer; padding: 0; width: 100%; }
+.dv-row.folder { border: 0; border-bottom: 1px solid var(--line-soft, #f4f2f0); cursor: pointer; padding: 0; width: 100%; }
.dv-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 11px 14px; text-decoration: none; color: inherit; }
.dv-row.folder { gap: 11px; padding: 11px 14px; }
.dv-ico {
width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; display: inline-flex; align-items: center;
- justify-content: center; background: #EEF1F5; color: #5A6472;
+ justify-content: center; background: #f4f2f0; color: #6b6560;
}
-.dv-ico.tone-folder { background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C); }
-.dv-ico.tone-red { background: #FDEBEC; color: #D8373F; }
+.dv-ico.tone-folder { background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5); }
+.dv-ico.tone-red { background: #fdf9f4; color: #D8373F; }
.dv-ico.tone-green { background: #E5F3EC; color: #1F845A; }
-.dv-ico.tone-amber { background: #FBF0D7; color: #A66B00; }
-.dv-ico.tone-violet { background: #F1ECFF; color: #7C5CFF; }
+.dv-ico.tone-amber { background: #fdf9f4; color: #A66B00; }
+.dv-ico.tone-violet { background: #f7f8fe; color: #7C5CFF; }
.dv-ico.tone-pink { background: #FBEAF3; color: #C4357F; }
-.dv-ico.tone-indigo { background: #E9EEFC; color: #3E63DD; }
-.dv-ico.tone-slate { background: #EEF1F5; color: #5A6472; }
+.dv-ico.tone-indigo { background: #f7f8fe; color: #3E63DD; }
+.dv-ico.tone-slate { background: #f4f2f0; color: #6b6560; }
.dv-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-sub { font-size: 12px; color: var(--mute); flex-shrink: 0; }
.dv-act { color: var(--mute-2); padding-right: 14px; }
.dv-rowacts { display: flex; align-items: center; gap: 2px; padding-right: 10px; opacity: 0; transition: opacity .1s; }
.dv-row:hover .dv-rowacts { opacity: 1; }
.dv-iconbtn { width: 30px; height: 30px; border: 0; background: none; border-radius: 7px; cursor: pointer; color: var(--mute); display: inline-flex; align-items: center; justify-content: center; }
-.dv-iconbtn:hover { background: var(--line-soft, #F2F2F6); color: var(--ink); }
-.dv-iconbtn.danger:hover { background: #FDECEC; color: #C0392B; }
+.dv-iconbtn:hover { background: var(--line-soft, #f5f5f4); color: var(--ink); }
+.dv-iconbtn.danger:hover { background: #fdf9f4; color: #b4460f; }
/* Drive folder file-count badge in the sidebar tree (a populated folder reads as
non-empty even though individual files aren't listed in the tree). */
@@ -572,11 +572,11 @@
/* "Load more" pager at the foot of a long file list. */
.dv-more {
display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%;
- padding: 12px; border: 0; border-top: 1px solid var(--line-soft, #EFF1F4); background: #fff;
+ padding: 12px; border: 0; border-top: 1px solid var(--line-soft, #f4f2f0); background: #fff;
cursor: pointer; font-family: inherit; transition: background .12s;
}
.dv-more:hover { background: var(--brand-50, #F5F4FA); }
-.dv-more-main { font-size: 13px; font-weight: 600; color: var(--brand, #42309C); }
+.dv-more-main { font-size: 13px; font-weight: 600; color: var(--brand, #1a5cf5); }
.dv-more-sub { font-size: 11.5px; color: var(--mute); }
/* ── Folder browser — unified card-grid view for any folder (scrollable) ────── */
@@ -591,30 +591,30 @@
.fb-sort-btn:hover { border-color: #C9C9D6; }
.fb-sort-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 20; min-width: 150px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 36px -12px rgba(17,24,39,.34); padding: 5px; }
.fb-sort-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--ink-2); }
-.fb-sort-item:hover { background: var(--line-soft, #F2F2F6); }
-.fb-sort-item.active { color: var(--brand, #42309C); font-weight: 600; }
+.fb-sort-item:hover { background: var(--line-soft, #f5f5f4); }
+.fb-sort-item.active { color: var(--brand, #1a5cf5); font-weight: 600; }
.fb-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.fb-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; cursor: pointer; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); }
-.fb-btn:hover { border-color: #C9C9D6; background: var(--line-soft, #F2F2F6); }
-.fb-btn.primary { background: var(--brand, #42309C); border-color: var(--brand, #42309C); color: #fff; }
-.fb-btn.primary:hover { background: var(--brand-ink, #332578); }
+.fb-btn:hover { border-color: #C9C9D6; background: var(--line-soft, #f5f5f4); }
+.fb-btn.primary { background: var(--brand, #1a5cf5); border-color: var(--brand, #1a5cf5); color: #fff; }
+.fb-btn.primary:hover { background: var(--brand-ink, #1447c4); }
.fb-btn:disabled { opacity: .6; cursor: default; }
.fb-meta { flex-shrink: 0; padding: 0 24px 8px; font-size: 12.5px; color: var(--mute); }
-.fb-err { flex-shrink: 0; margin: 0 24px 8px; font-size: 12.5px; color: #C0392B; background: #FDECEC; border: 1px solid #F6C9C5; border-radius: 8px; padding: 7px 11px; }
+.fb-err { flex-shrink: 0; margin: 0 24px 8px; font-size: 12.5px; color: #b4460f; background: #fdf9f4; border: 1px solid #F6C9C5; border-radius: 8px; padding: 7px 11px; }
.fb-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 24px 32px; }
.fb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.fb-card { position: relative; display: flex; align-items: center; gap: 11px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; transition: border-color .12s, box-shadow .12s; min-width: 0; }
.fb-card:hover { border-color: #D5D7DE; box-shadow: 0 2px 10px -3px rgba(17,24,39,.1); }
-.fb-ic { width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: #EEF1F5; color: #5A6472; }
-.fb-ic.tone-folder { background: var(--brand-soft, #ECE9F7); color: var(--brand, #42309C); }
+.fb-ic { width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: #f4f2f0; color: #6b6560; }
+.fb-ic.tone-folder { background: var(--brand-soft, #f7f8fe); color: var(--brand, #1a5cf5); }
.fb-ic.tone-blue { background: #E7F0FA; color: #2674BA; }
-.fb-ic.tone-violet { background: #F1ECFF; color: #7C5CFF; }
-.fb-ic.tone-amber { background: #FBF0D7; color: #A66B00; }
-.fb-ic.tone-red { background: #FDEBEC; color: #D8373F; }
+.fb-ic.tone-violet { background: #f7f8fe; color: #7C5CFF; }
+.fb-ic.tone-amber { background: #fdf9f4; color: #A66B00; }
+.fb-ic.tone-red { background: #fdf9f4; color: #D8373F; }
.fb-ic.tone-green { background: #E5F3EC; color: #1F845A; }
.fb-ic.tone-pink { background: #FBEAF3; color: #C4357F; }
-.fb-ic.tone-indigo { background: #E9EEFC; color: #3E63DD; }
-.fb-ic.tone-slate { background: #EEF1F5; color: #5A6472; }
+.fb-ic.tone-indigo { background: #f7f8fe; color: #3E63DD; }
+.fb-ic.tone-slate { background: #f4f2f0; color: #6b6560; }
.fb-card-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fb-card-name { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-card-sub { font-size: 11.5px; color: var(--mute); }
@@ -630,13 +630,13 @@
}
.fb-card:hover .fb-card-acts { opacity: 1; }
.fb-iconbtn { width: 28px; height: 28px; border: 0; background: none; border-radius: 7px; cursor: pointer; color: var(--mute); display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
-.fb-iconbtn:hover { background: var(--line-soft, #F2F2F6); color: var(--ink); }
-.fb-iconbtn.danger:hover { background: #FDECEC; color: #C0392B; }
-.fb-more { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--brand, #42309C); }
+.fb-iconbtn:hover { background: var(--line-soft, #f5f5f4); color: var(--ink); }
+.fb-iconbtn.danger:hover { background: #fdf9f4; color: #b4460f; }
+.fb-more { display: flex; flex-direction: column; align-items: center; gap: 1px; width: 100%; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--brand, #1a5cf5); }
.fb-more:hover { background: var(--brand-50, #F5F4FA); }
.fb-more-sub { font-size: 11.5px; font-weight: 500; color: var(--mute); }
-.fb-drop { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 56px 20px; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--bg, #F7F8FB); color: var(--mute); cursor: pointer; font-family: inherit; }
-.fb-drop:hover:not(:disabled) { border-color: var(--brand, #42309C); background: var(--brand-50, #F5F4FA); color: var(--brand-ink, #332578); }
+.fb-drop { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 56px 20px; border: 1.5px dashed var(--line); border-radius: 14px; background: var(--bg, #fafaf9); color: var(--mute); cursor: pointer; font-family: inherit; }
+.fb-drop:hover:not(:disabled) { border-color: var(--brand, #1a5cf5); background: var(--brand-50, #F5F4FA); color: var(--brand-ink, #1447c4); }
.fb-drop-1 { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.fb-drop-2 { font-size: 12.5px; color: var(--mute); }
.fb-empty { padding: 48px; text-align: center; color: var(--mute); font-size: 13px; }
@@ -648,12 +648,12 @@
.fp-name { font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-meta { font-size: 12px; color: var(--mute); }
.fp-dl { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 600; text-decoration: none; flex-shrink: 0; }
-.fp-dl:hover { border-color: #C9C9D6; background: var(--line-soft, #F2F2F6); }
+.fp-dl:hover { border-color: #C9C9D6; background: var(--line-soft, #f5f5f4); }
.fp-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.fp-status { display: flex; align-items: center; gap: 9px; padding: 24px; color: var(--mute); font-size: 13px; }
-.fp-status a { color: var(--brand, #42309C); font-weight: 600; }
-.fp-status.fp-err { color: #C0392B; }
-.fp-spin { width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--brand, #42309C); border-radius: 50%; animation: fp-spin .7s linear infinite; }
+.fp-status a { color: var(--brand, #1a5cf5); font-weight: 600; }
+.fp-status.fp-err { color: #b4460f; }
+.fp-spin { width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--brand, #1a5cf5); border-radius: 50%; animation: fp-spin .7s linear infinite; }
@keyframes fp-spin { to { transform: rotate(360deg); } }
.fp-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 0; }
.fp-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
@@ -664,11 +664,11 @@
.fp-archive { padding: 12px 24px 32px; }
.fp-archive-head { font-size: 12.5px; font-weight: 600; color: var(--mute); margin-bottom: 8px; }
.fp-entry { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; font-size: 13px; color: var(--ink-2); }
-.fp-entry:hover { background: var(--line-soft, #F2F2F6); }
+.fp-entry:hover { background: var(--line-soft, #f5f5f4); }
.fp-entry svg { color: var(--mute); flex-shrink: 0; }
.fp-entry-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-entry-size { font-size: 11.5px; color: var(--mute); flex-shrink: 0; }
/* "N more — open folder" row at the bottom of a capped file list in the tree. */
.sp-more-row .lbl { font-size: 12px; color: var(--sidebar-mute); font-weight: 500; font-style: italic; }
-.sp-more-row:hover .lbl { color: #C7CCDA; }
+.sp-more-row:hover .lbl { color: #e7e5e4; }
diff --git a/ui/src/studio/styles/tasks.css b/ui/src/studio/styles/tasks.css
index d9dd5f80..9a91543f 100644
--- a/ui/src/studio/styles/tasks.css
+++ b/ui/src/studio/styles/tasks.css
@@ -1,4 +1,4 @@
-/* Tasks app — Linear-grade. Flat iris (#42309C) on studio tokens. */
+/* Tasks app — Linear-grade. Flat iris (#1a5cf5) on studio tokens. */
.tk-root { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; background: var(--bg); }
.tk-embed { position: relative; height: 100%; min-height: 0; }
@@ -73,13 +73,13 @@
.tk-stage-note { font-size: 12px; color: var(--mute); line-height: 1.4; padding: 4px 2px 2px; }
/* Loading skeletons (shown while switching views, so no stale flash). */
-.tk-skel-line { display: inline-block; height: 10px; border-radius: 5px; background: var(--surface-2, #EEF0F4); animation: tk-pulse 1.3s infinite; }
-.tk-skel-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2, #EEF0F4); animation: tk-pulse 1.3s infinite; flex-shrink: 0; }
+.tk-skel-line { display: inline-block; height: 10px; border-radius: 5px; background: var(--surface-2, #f4f2f0); animation: tk-pulse 1.3s infinite; }
+.tk-skel-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2, #f4f2f0); animation: tk-pulse 1.3s infinite; flex-shrink: 0; }
.tk-skel-card { display: flex; flex-direction: column; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 13px 11px; }
.tk-skel-row { display: flex; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line-soft, #F0F1F4); }
.tk-skel .tk-col-head { gap: 8px; }
.tk-skel .tk-lgroup-head { gap: 8px; }
-.tk-title-skel { display: inline-block; width: 128px; height: 18px; border-radius: 6px; background: var(--surface-2, #EEF0F4); animation: tk-pulse 1.3s infinite; }
+.tk-title-skel { display: inline-block; width: 128px; height: 18px; border-radius: 6px; background: var(--surface-2, #f4f2f0); animation: tk-pulse 1.3s infinite; }
/* Label picker: shared registry options + create */
.tk-label-opts { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; max-height: 200px; overflow-y: auto; }
@@ -120,7 +120,7 @@
.tk-bb-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
color: var(--ink); border-radius: 999px; padding: 5px 11px 5px 7px; font-size: 12.5px; cursor: pointer; }
.tk-bb-chip:hover { background: var(--surface-2); }
-.tk-bb-chip.on { border-color: var(--brand); background: var(--brand-soft, #ECE9F7); color: var(--brand); font-weight: 550; }
+.tk-bb-chip.on { border-color: var(--brand); background: var(--brand-soft, #f7f8fe); color: var(--brand); font-weight: 550; }
.tk-bb-chip .tk-label-dot { width: 9px; height: 9px; border-radius: 50%; }
.tk-bb-empty { font-size: 12.5px; color: var(--mute); }
.tk-bb-dates { display: flex; gap: 16px; }
@@ -130,7 +130,7 @@
.tk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px 8px;
cursor: pointer; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-1); transition: border-color .12s, box-shadow .12s; }
-.tk-card:hover { border-color: #C9C2EE; box-shadow: var(--shadow-2); }
+.tk-card:hover { border-color: #c9d5f7; box-shadow: var(--shadow-2); }
.tk-card.is-dragging { opacity: .35; }
.tk-card-parent { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--mute);
font-family: var(--mono); letter-spacing: .02em; margin-bottom: -1px; }
diff --git a/ui/src/studio/styles/tokens.css b/ui/src/studio/styles/tokens.css
index 1fcf4839..fa53277f 100644
--- a/ui/src/studio/styles/tokens.css
+++ b/ui/src/studio/styles/tokens.css
@@ -1,18 +1,18 @@
-/* HarnessRouter app tokens — unified with the marketing landing (paper + accent blue #285AFF). */
+/* HarnessRouter app tokens — unified with the marketing landing (paper + accent blue #1a5cf5). */
:root {
- --brand: #285AFF;
- --brand-ink: #1641D8;
- --brand-soft: #E1E9FF;
- --brand-50: #EFF3FF;
+ --brand: #1a5cf5;
+ --brand-ink: #1447c4;
+ --brand-soft: #f7f8fe;
+ --brand-50: #f7f8fe;
--accent-bright: #58A9FF;
- --hot: #EF4444;
+ --hot: #b4460f;
--hot-soft: #FEE4E4;
- --warm: #F59E0B;
+ --warm: #8a6a3c;
--warm-soft: #FEF1D6;
- --cold: #94A3B8;
- --cold-soft: #EEF1F5;
- --ok: #10B981;
+ --cold: #a8a29e;
+ --cold-soft: #f4f2f0;
+ --ok: #15803d;
--ok-soft: #DFF6EC;
--info: #0EA5E9;
--info-soft: #DCF1FB;
@@ -22,14 +22,14 @@
--surface-2: #F5F7FB;
--sidebar: #1F2433;
--sidebar-2: #2A3145;
- --sidebar-mute: #5B5D66;
- --sidebar-active: #285AFF;
+ --sidebar-mute: #6b6560;
+ --sidebar-active: #1a5cf5;
- --ink: #111317;
- --ink-2: #3A3D45;
- --mute: #5B5D66;
+ --ink: #1c1917;
+ --ink-2: #57534e;
+ --mute: #6b6560;
--mute-2: #8A8D96;
- --line: #DDDFE6;
+ --line: #e7e5e4;
--line-soft: #E9EAEF;
--r-card: 12px;
@@ -60,10 +60,10 @@ body { font-family: var(--font); color: var(--ink); background: var(--bg); -webk
border: 1px solid transparent;
}
.pill .dot { width:6px; height:6px; border-radius: 999px; background: currentColor; }
-.pill.hot { background: var(--hot-soft); color: #B91C1C; }
-.pill.warm { background: var(--warm-soft); color: #92400E; }
-.pill.cold { background: var(--cold-soft); color: #475569; }
-.pill.ok { background: var(--ok-soft); color: #047857; }
+.pill.hot { background: var(--hot-soft); color: #b4460f; }
+.pill.warm { background: var(--warm-soft); color: #8a6a3c; }
+.pill.cold { background: var(--cold-soft); color: #57534e; }
+.pill.ok { background: var(--ok-soft); color: #15803d; }
.pill.info { background: var(--info-soft); color: #075985; }
.pill.brand { background: var(--brand-soft); color: var(--brand-ink); }
@@ -139,13 +139,13 @@ body { font-family: var(--font); color: var(--ink); background: var(--bg); -webk
}
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av.lg { width: 40px; height: 40px; font-size: 14px; }
-.av.client { background: #F59E0B; }
-.av.ai { background: #10B981; }
-.av.me { background: #3B82F6; }
+.av.client { background: #8a6a3c; }
+.av.ai { background: #15803d; }
+.av.me { background: #1a5cf5; }
/* Striped placeholder backdrop */
.placeholder-stripe {
- background-image: repeating-linear-gradient(135deg, #EEF1F5 0 8px, #F7F8FB 8px 16px);
+ background-image: repeating-linear-gradient(135deg, #f4f2f0 0 8px, #fafaf9 8px 16px);
border-radius: 8px;
}
diff --git a/ui/src/studio/styles/traces.css b/ui/src/studio/styles/traces.css
index 1cd018b9..b5286741 100644
--- a/ui/src/studio/styles/traces.css
+++ b/ui/src/studio/styles/traces.css
@@ -1,11 +1,11 @@
/* Traces app — agent run trace viewer. Left session-history rail + right timeline/steps/detail.
- Aligned to the studio deep-iris tokens (var(--brand) #42309C …); role colors re-skinned. */
+ Aligned to the studio deep-iris tokens (var(--brand) #1a5cf5 …); role colors re-skinned. */
/* ── per-role accent palette (dots / badges / timeline segments) ── */
.tr-side, .tr-main {
- --r-user: #285AFF; --r-agent: #2563EB; --r-tool: #64748B; --r-bash: #334155;
- --r-write: #B45309; --r-thinking: #7C6FB0; --r-result: #15803D; --r-toolresult: #64748B;
- --r-error: #DC2626; --r-system: #94A3B8;
+ --r-user: #1a5cf5; --r-agent: #1a5cf5; --r-tool: #6b6560; --r-bash: #334155;
+ --r-write: #B45309; --r-thinking: #7C6FB0; --r-result: #15803D; --r-toolresult: #6b6560;
+ --r-error: #b4460f; --r-system: #a8a29e;
}
/* ── LEFT RAIL ── */
@@ -18,7 +18,7 @@
border-radius: 9px; color: var(--sidebar-mute); flex-shrink: 0;
}
.tr-search:focus-within { border-color: rgba(183,172,255,.55); background: rgba(255,255,255,.09); }
-.tr-search input { border: 0; background: transparent; outline: none; width: 100%; font-size: 13px; color: #E5E7EB; font-family: inherit; }
+.tr-search input { border: 0; background: transparent; outline: none; width: 100%; font-size: 13px; color: #e7e5e4; font-family: inherit; }
.tr-search input::placeholder { color: var(--sidebar-mute); }
.tr-list { flex: 1; min-height: 0; overflow: auto; padding: 0 8px 8px; }
.tr-empty { padding: 18px 12px; color: var(--sidebar-mute); font-size: 13px; }
@@ -33,16 +33,16 @@
.tr-card:focus, .tr-card:focus-visible { outline: none; }
.tr-card.active { background: rgba(255,255,255,.09); }
/* row 1: the user question (2-line clamp); row 2: time (left) + harness + status badges (right) */
-.tr-card-q { font-size: 13px; font-weight: 600; color: #E5E7EB; line-height: 1.4;
+.tr-card-q { font-size: 13px; font-weight: 600; color: #e7e5e4; line-height: 1.4;
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.tr-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.tr-card-ago { font-size: 11px; color: var(--sidebar-mute); }
.tr-card-badges { display: flex; align-items: center; gap: 6px; }
-.tr-card-be { font-size: 10.5px; font-weight: 600; color: #C9C2EE; background: rgba(255,255,255,.08);
+.tr-card-be { font-size: 10.5px; font-weight: 600; color: #c9d5f7; background: rgba(255,255,255,.08);
padding: 1.5px 8px; border-radius: 999px; text-transform: capitalize; letter-spacing: .01em; }
.tr-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 12px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
-.tr-pg { font-size: 12px; color: #C9C2EE; background: transparent; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; padding: 4px 9px; cursor: pointer; }
+.tr-pg { font-size: 12px; color: #c9d5f7; background: transparent; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; padding: 4px 9px; cursor: pointer; }
.tr-pg:hover:not(:disabled) { background: rgba(255,255,255,.06); }
.tr-pg:disabled { color: var(--sidebar-mute); cursor: default; opacity: .45; }
.tr-pg-lbl { font-size: 11px; color: var(--sidebar-mute); }
@@ -51,11 +51,11 @@
/* base pill carries a neutral chip so ANY status (incl. ones we didn't special-case) reads as a
styled badge, never an unstyled bare word */
.tr-pill { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; text-transform: capitalize;
- color: #C9C2EE; background: rgba(255,255,255,.10); }
-.tr-done, .tr-completed { color: #15803D; background: #DCFCE7; }
-.tr-running, .tr-starting, .tr-in_progress { color: #1D4ED8; background: #DBEAFE; }
-.tr-failed, .tr-timeout, .tr-error { color: #B91C1C; background: #FEE2E2; }
-.tr-max_turns, .tr-incomplete { color: #B45309; background: #FEF3C7; }
+ color: #c9d5f7; background: rgba(255,255,255,.10); }
+.tr-done, .tr-completed { color: #15803D; background: #eaf5ee; }
+.tr-running, .tr-starting, .tr-in_progress { color: #1447c4; background: #f7f8fe; }
+.tr-failed, .tr-timeout, .tr-error { color: #b4460f; background: #fdf9f4; }
+.tr-max_turns, .tr-incomplete { color: #B45309; background: #fdf9f4; }
/* ── RIGHT PANE ── */
.tr-main { display: flex; min-height: 0; height: 100%; }
@@ -70,7 +70,7 @@
/* timeline — main lane + one stacked lane per subagent, segments coloured by kind */
.tr-strips { margin: 14px 22px 8px; display: flex; flex-direction: column; gap: 3px; }
-.tr-strip { position: relative; height: 18px; background: #EEF0F4; border-radius: 5px; overflow: hidden; }
+.tr-strip { position: relative; height: 18px; background: #f4f2f0; border-radius: 5px; overflow: hidden; }
.tr-strip.lane { height: 13px; }
.tr-seg { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; cursor: pointer; opacity: .85; min-width: 3px; }
.tr-seg:hover, .tr-seg.hot { opacity: 1; top: 1px; bottom: 1px; box-shadow: 0 0 0 1px #fff; }
@@ -92,7 +92,7 @@
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tr-rmsg { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--ink-2); }
.tr-errbadge { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600;
- color: #B91C1C; background: #FEE2E2; padding: 1px 7px; border-radius: 999px; }
+ color: #b4460f; background: #fdf9f4; padding: 1px 7px; border-radius: 999px; }
.tr-row-stats { flex: 0 0 auto; display: flex; align-items: center; gap: 16px; }
.tr-stat { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted);
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@@ -102,17 +102,17 @@
/* "Session idle" boundary between turns (hatched band, centered label) */
.tr-idle { display: flex; align-items: center; justify-content: center; height: 26px; margin: 8px 22px;
- background: repeating-linear-gradient(45deg, #F7F8FB 0 7px, #EEF0F4 7px 14px); border-radius: 7px; }
+ background: repeating-linear-gradient(45deg, #fafaf9 0 7px, #f4f2f0 7px 14px); border-radius: 7px; }
.tr-idle span { font-size: 11px; color: var(--muted); font-weight: 500; }
/* detail-pane content blocks (NOT shown inline in the list anymore) */
.tr-text { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; line-height: 1.55; word-break: break-word; }
.tr-text.italic { font-style: italic; color: var(--muted); }
-.tr-bash { background: #0F1A2B; color: #E2E8F0; padding: 9px 11px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
+.tr-bash { background: #0F1A2B; color: #e7e5e4; padding: 9px 11px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tr-code { background: var(--surface-2); border: 1px solid var(--line-soft); color: var(--ink-2); padding: 9px 11px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.55; }
-.tr-code.err { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
+.tr-code.err { background: #fdf9f4; border-color: #f0e2d4; color: #8a3a10; }
.tr-json { background: var(--surface-2); border: 1px solid var(--line-soft); padding: 10px 12px; border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.55; color: var(--ink-2); }
-.tr-json .j-key { color: #B45309; } .tr-json .j-str { color: #2563EB; } .tr-json .j-num { color: #15803D; } .tr-json .j-bool { color: #9333EA; }
+.tr-json .j-key { color: #B45309; } .tr-json .j-str { color: #1a5cf5; } .tr-json .j-num { color: #15803D; } .tr-json .j-bool { color: #9333EA; }
.tr-tooldetail + .tr-tooldetail { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.tr-tool-sep { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
@@ -122,15 +122,15 @@
/* role pills (badge bg+text) + timeline segments + detail header pill */
.tr-seg.tr-user { background: var(--r-user); } .tr-badge.tr-user { color: #6D28D9; background: #EDE9FE; }
-.tr-seg.tr-agent { background: var(--r-agent); } .tr-badge.tr-agent { color: #1D4ED8; background: #DBEAFE; }
-.tr-seg.tr-tool { background: var(--r-tool); } .tr-badge.tr-tool { color: #475569; background: #EEF2F6; }
-.tr-seg.tr-bash { background: var(--r-bash); } .tr-badge.tr-bash { color: #E2E8F0; background: #334155; }
-.tr-seg.tr-write { background: var(--r-write); } .tr-badge.tr-write { color: #B45309; background: #FEF3C7; }
-.tr-seg.tr-thinking { background: var(--r-thinking); } .tr-badge.tr-thinking { color: #6D5BA6; background: #F1EEFA; }
-.tr-seg.tr-result { background: var(--r-result); } .tr-badge.tr-result { color: #15803D; background: #DCFCE7; }
-.tr-seg.tr-toolresult { background: var(--r-toolresult); } .tr-badge.tr-toolresult { color: #475569; background: #EEF2F6; }
-.tr-seg.tr-error { background: var(--r-error); } .tr-badge.tr-error { color: #B91C1C; background: #FEE2E2; }
-.tr-seg.tr-system { background: var(--r-system); } .tr-badge.tr-system { color: #64748B; background: #F1F5F9; }
+.tr-seg.tr-agent { background: var(--r-agent); } .tr-badge.tr-agent { color: #1447c4; background: #f7f8fe; }
+.tr-seg.tr-tool { background: var(--r-tool); } .tr-badge.tr-tool { color: #57534e; background: #EEF2F6; }
+.tr-seg.tr-bash { background: var(--r-bash); } .tr-badge.tr-bash { color: #e7e5e4; background: #334155; }
+.tr-seg.tr-write { background: var(--r-write); } .tr-badge.tr-write { color: #B45309; background: #fdf9f4; }
+.tr-seg.tr-thinking { background: var(--r-thinking); } .tr-badge.tr-thinking { color: #6D5BA6; background: #f7f8fe; }
+.tr-seg.tr-result { background: var(--r-result); } .tr-badge.tr-result { color: #15803D; background: #eaf5ee; }
+.tr-seg.tr-toolresult { background: var(--r-toolresult); } .tr-badge.tr-toolresult { color: #57534e; background: #EEF2F6; }
+.tr-seg.tr-error { background: var(--r-error); } .tr-badge.tr-error { color: #b4460f; background: #fdf9f4; }
+.tr-seg.tr-system { background: var(--r-system); } .tr-badge.tr-system { color: #6b6560; background: #F1F5F9; }
/* detail panel (click a step / segment) */
.tr-detail { width: 440px; flex: 0 0 440px; border-left: 1px solid var(--line); overflow: auto; padding: 18px 20px 40px; background: #fff; }
@@ -157,9 +157,9 @@
.tr-md table { border-collapse: collapse; margin: 10px 0; font-size: 12.5px; display: block; overflow-x: auto; }
.tr-md th, .tr-md td { border: 1px solid var(--line-soft); padding: 5px 9px; text-align: left; }
.tr-md th { background: var(--surface-2); font-weight: 700; }
-.tr-md a { color: var(--brand, #42309C); text-decoration: underline; }
-.tr-md blockquote { margin: 8px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--line-soft); color: var(--ink-2, #475569); }
-.tr-md ul li::marker { color: var(--ink-2, #475569); }
+.tr-md a { color: var(--brand, #1a5cf5); text-decoration: underline; }
+.tr-md blockquote { margin: 8px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--line-soft); color: var(--ink-2, #57534e); }
+.tr-md ul li::marker { color: var(--ink-2, #57534e); }
.tr-md a { color: var(--brand); text-decoration: none; }
@media (max-width: 1200px) { .tr-detail { width: 340px; flex-basis: 340px; } }
@@ -169,7 +169,7 @@
/* loading skeleton for a session transcript */
@keyframes tr-shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
-.tr-skel { background: linear-gradient(90deg, #EEF0F4 25%, #F6F7FA 37%, #EEF0F4 63%); background-size: 800px 100%;
+.tr-skel { background: linear-gradient(90deg, #f4f2f0 25%, #F6F7FA 37%, #f4f2f0 63%); background-size: 800px 100%;
animation: tr-shimmer 1.3s ease-in-out infinite; border-radius: 6px; }
.tr-skel-title { height: 20px; width: 46%; margin: 18px 22px 0; }
.tr-skel-pill { height: 20px; width: 84px; border-radius: 999px; }