@volter-ai-dev/supercode-ui 0.1.70 → 0.1.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +61 -1
  2. package/activity.mjs +5 -1235
  3. package/chunks/chunk-2FG7VKIW.mjs +201 -0
  4. package/chunks/chunk-4XUMCWPC.mjs +29 -0
  5. package/chunks/chunk-E65I2I2L.mjs +120 -0
  6. package/chunks/chunk-IL5T2AST.mjs +842 -0
  7. package/chunks/chunk-LOP6XOON.mjs +671 -0
  8. package/chunks/chunk-LS6JBXNT.mjs +1237 -0
  9. package/chunks/chunk-SJ3YTA6Z.mjs +316 -0
  10. package/chunks/chunk-TKTOVDXB.mjs +139 -0
  11. package/chunks/chunk-V3UM7H7W.mjs +328 -0
  12. package/chunks/chunk-WRK5TBX3.mjs +224 -0
  13. package/chunks/chunk-ZLYHUYE2.mjs +62 -0
  14. package/components.d.ts +3 -0
  15. package/components.mjs +59 -3766
  16. package/composer.mjs +8 -580
  17. package/conversation.mjs +16 -1373
  18. package/embed.mjs +15 -3681
  19. package/icon.mjs +3 -58
  20. package/index.d.ts +25 -0
  21. package/logo.mjs +5 -87
  22. package/messenger.d.ts +3 -0
  23. package/messenger.mjs +21 -3677
  24. package/package.json +22 -3
  25. package/react/activity.mjs +5 -1235
  26. package/react/chunks/chunk-7ES5FSLG.mjs +316 -0
  27. package/react/chunks/chunk-LS6JBXNT.mjs +1237 -0
  28. package/react/chunks/chunk-LYRIQE5M.mjs +29 -0
  29. package/react/chunks/chunk-NJC6S2AW.mjs +201 -0
  30. package/react/chunks/chunk-OINC7LV7.mjs +62 -0
  31. package/react/chunks/chunk-QL6QEYPK.mjs +842 -0
  32. package/react/chunks/chunk-UGL6AB2K.mjs +120 -0
  33. package/react/chunks/chunk-UKHDCPME.mjs +328 -0
  34. package/react/chunks/chunk-UKMTRNJN.mjs +671 -0
  35. package/react/chunks/chunk-VFOVJ4S3.mjs +139 -0
  36. package/react/chunks/chunk-YK7SJ6EH.mjs +224 -0
  37. package/react/components.mjs +59 -3766
  38. package/react/composer.mjs +8 -580
  39. package/react/conversation.mjs +16 -1373
  40. package/react/icon.mjs +3 -58
  41. package/react/index.d.ts +25 -0
  42. package/react/logo.mjs +5 -87
  43. package/react/messenger.d.ts +3 -0
  44. package/react/messenger.mjs +21 -3677
  45. package/react/sessions.mjs +9 -519
  46. package/react/settings.mjs +9 -425
  47. package/react/subagents.mjs +8 -1546
  48. package/react/supervision-components.mjs +1354 -0
  49. package/react/supervision.d.ts +36 -0
  50. package/sessions.mjs +9 -519
  51. package/settings.mjs +9 -425
  52. package/source-inventory.d.ts +240 -0
  53. package/source-inventory.mjs +367 -0
  54. package/styles.css +104 -0
  55. package/subagents.mjs +8 -1546
  56. package/supervision-components.d.ts +36 -0
  57. package/supervision-components.mjs +1354 -0
  58. package/supervision.d.ts +242 -0
  59. package/supervision.mjs +349 -0
@@ -0,0 +1,139 @@
1
+ // src/logo.jsx
2
+ import { useEffect } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var LOGOS = {
5
+ "claude-code": {
6
+ viewBox: "-1 3.5 26 18",
7
+ paths: [
8
+ ["path", { fillRule: "evenodd", clipRule: "evenodd", d: "M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z" }]
9
+ ]
10
+ },
11
+ codex: {
12
+ viewBox: "-1 -1 26 26",
13
+ paths: [
14
+ ["path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z" }]
15
+ ]
16
+ },
17
+ gemini: {
18
+ viewBox: "0 0 24 24",
19
+ paths: [["path", { d: "M12 24C12 17.373 6.627 12 0 12 6.627 12 12 6.627 12 0c0 6.627 5.373 12 12 12-6.627 0-12 5.373-12 12z" }]]
20
+ },
21
+ grok: {
22
+ viewBox: "-1 -1 26 26",
23
+ paths: [["path", { d: "M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815" }]]
24
+ },
25
+ // Canonical mark from block/goose's documentation/static/img/goose.svg.
26
+ goose: {
27
+ viewBox: "0 0 45 45",
28
+ paths: [["path", { d: "M43.2098 39.2492L39.8118 36.4522C37.9646 34.9318 36.3923 33.1051 35.1631 31.0529C33.4647 28.2172 31.1178 25.8243 28.3164 24.071L26.9482 23.2744C26.4794 22.9485 26.1525 22.4405 26.106 21.8675C26.0762 21.4981 26.1647 21.1678 26.3712 20.8771C27.0837 19.873 30.9617 15.6995 31.6365 15.1411C32.5056 14.4228 33.4739 13.8253 34.3724 13.1412C34.5001 13.0438 34.6283 12.9469 34.7545 12.8481C35.0574 12.6088 35.3295 12.3671 35.5458 12.0803C36.5993 10.8604 36.5783 9.82938 36.5783 9.82938C36.4677 9.5534 36.0645 8.69902 35.2449 8.29825C35.9696 8.28406 36.7872 8.55564 37.1582 8.91873C37.6039 8.21947 37.8922 7.76585 38.3404 7.00347C38.4471 6.82241 38.5038 6.48771 38.2998 6.30029C38.1114 6.11287 37.6416 6.01697 37.4606 6.12364C36.4692 6.70693 35.5047 7.33475 34.6351 7.88525C34.6351 7.88525 33.6046 7.86372 32.3842 8.91775C32.097 9.13452 31.8552 9.4066 31.6282 9.69433C31.5171 9.83476 31.4202 9.96297 31.3233 10.0912C30.6387 10.9901 30.0417 11.958 29.3234 12.8271C28.7656 13.5023 24.5915 17.3798 23.5874 18.0923C23.2967 18.2988 22.9669 18.3879 22.597 18.3575C22.0245 18.3115 21.5161 17.9842 21.1902 17.5154L20.3935 16.1472C18.6402 13.3448 16.2474 10.9989 13.4117 9.30041C11.3594 8.0712 9.5332 6.49847 8.01234 4.65172L5.2153 1.25377C5.0773 1.08642 4.81306 1.11382 4.71422 1.30662C4.39615 1.92612 3.78888 3.23411 3.32353 4.99327C3.92786 5.81095 5.26717 7.35089 6.8624 8.65351C6.97348 8.74403 6.88246 8.92313 6.74447 8.88496C5.36846 8.51013 4.03062 7.90825 3.02944 7.39542C2.94772 7.35383 2.84887 7.4057 2.83713 7.49672C2.68152 8.74354 2.64139 10.1127 2.80581 11.5562C4.02572 12.1596 5.85143 12.8804 7.76816 13.3389C7.90713 13.3722 7.90273 13.5723 7.76229 13.5992C6.26982 13.8801 4.70688 13.9427 3.43656 13.9261C3.3475 13.9251 3.28193 14.0093 3.30591 14.0949C3.56085 14.9958 3.90632 15.9118 4.3619 16.8342C4.55029 17.2487 4.75532 17.6553 4.97504 18.0532C6.21207 18.107 7.47946 17.9964 8.75369 17.7713C8.97095 17.7331 9.08741 18.0189 8.90391 18.1417C8.03877 18.7201 7.11588 19.2183 6.25758 19.6283C6.14259 19.6836 6.1054 19.8304 6.18125 19.9327C6.69114 20.6236 7.25191 21.2774 7.86114 21.8866C7.86114 21.8866 10.8608 24.9763 10.9425 25.2185C12.6928 23.4261 15.5701 21.4394 18.7474 19.7047C14.4921 23.1672 12.1198 25.7235 10.9258 27.1758L10.0935 28.3439C9.66091 28.9507 9.2856 29.5951 8.97193 30.2709C7.92231 32.5292 6.19201 37.0966 6.19201 37.0966C6.0594 37.4543 6.16755 37.8072 6.39753 38.0371C6.66031 38.2999 7.01263 38.4076 7.37033 38.275C7.37033 38.275 11.9368 36.5447 14.1961 35.495C14.8719 35.1814 15.5168 34.8056 16.1231 34.3735L17.4095 33.457C18.0907 32.9715 19.0234 33.0489 19.615 33.6405L22.5804 36.6058C23.1896 37.2151 23.8433 37.7758 24.5343 38.2857C24.637 38.3611 24.7833 38.3244 24.8386 38.2094C25.2492 37.3516 25.7473 36.4277 26.3252 35.5631C26.4481 35.3796 26.7343 35.4965 26.6957 35.7133C26.4701 36.988 26.3605 38.2554 26.3086 39.3035C27.2178 39.9172 28.5551 40.5606 30.3721 41.1611C30.4577 41.185 30.5419 41.1195 30.5409 41.0304C30.5237 39.7596 30.5864 38.1967 30.8677 36.7047C30.8942 36.5638 31.0943 36.5593 31.1281 36.6988C31.5861 38.616 32.3069 40.4417 32.8041 41.5829C34.3543 41.8256 35.7234 41.7855 36.9703 41.6298C37.0618 41.6186 37.1136 41.5197 37.0715 41.4375C36.5587 40.4364 35.9568 39.0975 35.582 37.7225C35.5443 37.584 35.7229 37.4935 35.8135 37.6046C37.1161 39.1998 38.656 40.5391 39.3548 41.1175C41.2333 40.6786 42.5413 40.0713 43.1604 39.7528C43.3532 39.6539 43.3806 39.3897 43.2132 39.2517Z" }]]
29
+ },
30
+ opencode: { viewBox: "2.5 0 19 24", paths: [["path", { d: "M16 6H8v12h8V6zm4 16H4V2h16v20z" }]] },
31
+ // Hermes brands itself with the staff of Hermes (U+2695 ⚕) — it heads every
32
+ // box the CLI draws — on Nous Research's gold. A glyph, not an invented mark.
33
+ hermes: {
34
+ viewBox: "0 0 24 24",
35
+ paths: [["text", { x: "12", y: "21", textAnchor: "middle", fontSize: "26", fontWeight: "700", fontFamily: "ui-sans-serif, system-ui, sans-serif", children: "\u2695" }]]
36
+ },
37
+ pi: {
38
+ viewBox: "0 0 24 24",
39
+ paths: [
40
+ ["path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1 1h16.5v11H12v5.5H6.5V23H1V1zm5.5 5.5V12H12V6.5H6.5z" }],
41
+ ["path", { d: "M17.5 12H23v11h-5.5V12z" }]
42
+ ]
43
+ },
44
+ // Product mark shared with the first-party browser frontend favicon.
45
+ // OpenClaw's own mark: docs/assets/pixel-lobster.svg from openclaw/openclaw,
46
+ // transcribed rect-for-rect as one path per fill (pixel art needs
47
+ // crisp edges, so the rects stay axis-aligned unit squares).
48
+ openclaw: {
49
+ viewBox: "0 0 16 16",
50
+ paths: [
51
+ ["path", { fill: "#3a0a0d", d: "M1 5h1v3h-1zM2 4h1v1h-1zM2 8h1v1h-1zM3 3h1v1h-1zM3 9h1v1h-1zM4 2h1v1h-1zM4 10h1v1h-1zM5 2h6v1h-6zM11 2h1v1h-1zM12 3h1v1h-1zM12 9h1v1h-1zM13 4h1v1h-1zM13 8h1v1h-1zM14 5h1v3h-1zM5 11h6v1h-6zM4 12h1v1h-1zM11 12h1v1h-1zM3 13h1v1h-1zM12 13h1v1h-1zM5 14h6v1h-6z" }],
52
+ ["path", { fill: "#ff4f40", d: "M5 3h6v1h-6zM4 4h8v1h-8zM3 5h10v1h-10zM3 6h10v1h-10zM3 7h10v1h-10zM4 8h8v1h-8zM5 9h6v1h-6zM5 12h6v1h-6zM6 13h4v1h-4z" }],
53
+ ["path", { fill: "#ff775f", d: "M1 6h2v1h-2zM2 5h1v1h-1zM2 7h1v1h-1zM13 6h2v1h-2zM13 5h1v1h-1zM13 7h1v1h-1z" }],
54
+ ["path", { fill: "#081016", d: "M6 5h1v1h-1zM9 5h1v1h-1z" }],
55
+ ["path", { fill: "#f5fbff", d: "M6 4h1v1h-1zM9 4h1v1h-1z" }]
56
+ ]
57
+ },
58
+ // The orchestrator is supercode's own harness id (ORC-7): the same cowl,
59
+ // slate on the dark tile with the session-green eyes — the one that conducts.
60
+ orchestrator: {
61
+ viewBox: "0 0 64 64",
62
+ paths: [
63
+ ["rect", { width: "64", height: "64", rx: "14", fill: "#111923" }],
64
+ ["path", { fill: "#4a5568", "shape-rendering": "crispEdges", d: "M6 2h4v4h-4zM54 2h4v4h-4zM6 6h8v4h-8zM50 6h8v4h-8zM6 10h12v4h-12zM22 10h20v4h-20zM46 10h12v4h-12zM6 14h52v4h-52zM6 18h52v4h-52zM6 22h52v4h-52zM6 26h52v4h-52zM2 30h60v4h-60zM2 34h60v4h-60zM2 38h60v4h-60zM2 42h12v4h-12zM22 42h20v4h-20zM50 42h12v4h-12zM6 46h12v4h-12zM26 46h12v4h-12zM46 46h12v4h-12zM6 50h52v4h-52zM10 54h4v4h-4zM50 54h4v4h-4zM14 58h8v4h-8zM42 58h8v4h-8z" }],
65
+ ["path", { fill: "#8ce0aa", "shape-rendering": "crispEdges", d: "M14 42h8v4h-8zM42 42h8v4h-8zM18 46h8v4h-8zM38 46h8v4h-8z" }],
66
+ ["path", { fill: "#e8b89a", "shape-rendering": "crispEdges", d: "M14 54h36v4h-36zM22 58h20v4h-20z" }]
67
+ ]
68
+ },
69
+ // supercode's mark: the pixel cowl. A 15×15 sprite drawn the way pixel
70
+ // artists draw the character — the ear's outer edge continues the head's
71
+ // side and only its inner edge slants; a one-cell notch parts each ear from
72
+ // the crown; the head widens by one cell at the eye band; the eyes are
73
+ // two-cell slits whose lower row steps inward. One path per fill, cells on
74
+ // a 4-unit grid inside the 64 tile, so the edges stay crisp at every size.
75
+ supercode: {
76
+ viewBox: "0 0 64 64",
77
+ paths: [
78
+ ["rect", { width: "64", height: "64", rx: "14", fill: "#f7f7f5" }],
79
+ ["path", { fill: "#0a0a0a", "shape-rendering": "crispEdges", d: "M6 2h4v4h-4zM54 2h4v4h-4zM6 6h8v4h-8zM50 6h8v4h-8zM6 10h12v4h-12zM22 10h20v4h-20zM46 10h12v4h-12zM6 14h52v4h-52zM6 18h52v4h-52zM6 22h52v4h-52zM6 26h52v4h-52zM2 30h60v4h-60zM2 34h60v4h-60zM2 38h60v4h-60zM2 42h12v4h-12zM22 42h20v4h-20zM50 42h12v4h-12zM6 46h12v4h-12zM26 46h12v4h-12zM46 46h12v4h-12zM6 50h52v4h-52zM10 54h4v4h-4zM50 54h4v4h-4zM14 58h8v4h-8zM42 58h8v4h-8z" }],
80
+ ["path", { fill: "#f7f7f5", "shape-rendering": "crispEdges", d: "M14 42h8v4h-8zM42 42h8v4h-8zM18 46h8v4h-8zM38 46h8v4h-8z" }],
81
+ ["path", { fill: "#e8b89a", "shape-rendering": "crispEdges", d: "M14 54h36v4h-36zM22 58h20v4h-20z" }]
82
+ ]
83
+ }
84
+ };
85
+ function hasHarnessLogo(id) {
86
+ return Object.hasOwn(LOGOS, id);
87
+ }
88
+ var LOGO_CHROME = {
89
+ codex: { background: "#f7f7f5", color: "#111" },
90
+ gemini: { background: "#f7f7f5", color: "#6e79dc" },
91
+ goose: { background: "#f7f7f5", color: "#101010" },
92
+ pi: { background: "#efefeb", color: "#111" },
93
+ supercode: { background: "#f7f7f5", color: "#0a0a0a" },
94
+ hermes: { background: "#111", color: "#ffd700" },
95
+ openclaw: { background: "#f7f7f5", color: "#ff4f40" },
96
+ orchestrator: { background: "#111923", color: "#8ce0aa" }
97
+ };
98
+ function escapeSvgAttribute(value) {
99
+ return String(value).replaceAll("&", "&amp;").replaceAll('"', "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
100
+ }
101
+ var SVG_ATTRIBUTE_NAMES = Object.freeze({
102
+ clipRule: "clip-rule",
103
+ fillRule: "fill-rule",
104
+ strokeWidth: "stroke-width",
105
+ textAnchor: "text-anchor",
106
+ fontSize: "font-size",
107
+ fontFamily: "font-family",
108
+ fontWeight: "font-weight",
109
+ strokeLinecap: "stroke-linecap"
110
+ });
111
+ function harnessLogoDataUrl(id) {
112
+ const logo = LOGOS[id];
113
+ if (!logo) return null;
114
+ const chrome = LOGO_CHROME[id] ?? { background: "#111", color: id === "claude-code" ? "#d97757" : "#f7f7f5" };
115
+ const glyph = logo.paths.map(([tag, attributes]) => {
116
+ const { children, ...rest } = attributes;
117
+ const serialized = Object.entries(rest).map(([name, value]) => `${SVG_ATTRIBUTE_NAMES[name] ?? name}="${escapeSvgAttribute(value)}"`).join(" ");
118
+ return children === void 0 ? `<${tag} ${serialized}/>` : `<${tag} ${serialized}>${escapeSvgAttribute(children)}</${tag}>`;
119
+ }).join("");
120
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><circle cx="20" cy="20" r="19" fill="${chrome.background}" stroke="#383a42"/><svg x="7" y="7" width="26" height="26" viewBox="${logo.viewBox}" color="${chrome.color}" fill="currentColor" preserveAspectRatio="xMidYMid meet">${glyph}</svg></svg>`;
121
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
122
+ }
123
+ function HarnessLogo({ id, activity, size = 28, onMissingLogo }) {
124
+ const logo = LOGOS[id];
125
+ useEffect(() => {
126
+ if (!logo) onMissingLogo?.(id);
127
+ }, [id, logo, onMissingLogo]);
128
+ if (!logo) return null;
129
+ return /* @__PURE__ */ jsxs("span", { className: "scui-logo", "data-harness": id, "data-activity": activity, style: { "--scui-logo-size": `${size}px` }, "aria-hidden": "true", children: [
130
+ /* @__PURE__ */ jsx("svg", { viewBox: logo.viewBox, preserveAspectRatio: "xMidYMid meet", focusable: "false", children: logo.paths.map(([Tag, props], index) => /* @__PURE__ */ jsx(Tag, { ...props }, index)) }),
131
+ activity && activity !== "idle" ? /* @__PURE__ */ jsx("i", {}) : null
132
+ ] });
133
+ }
134
+
135
+ export {
136
+ hasHarnessLogo,
137
+ harnessLogoDataUrl,
138
+ HarnessLogo
139
+ };
@@ -0,0 +1,224 @@
1
+ import {
2
+ HarnessLogo
3
+ } from "./chunk-VFOVJ4S3.mjs";
4
+ import {
5
+ harnessDisplayName
6
+ } from "./chunk-LS6JBXNT.mjs";
7
+ import {
8
+ UiIcon
9
+ } from "./chunk-OINC7LV7.mjs";
10
+
11
+ // src/settings.jsx
12
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ function HarnessAdvisory({ state, onReview }) {
15
+ const advisory = state.interopSettings?.advisories[0];
16
+ if (!advisory && !state.interopSettingsError) return null;
17
+ return /* @__PURE__ */ jsxs("div", { className: "scui-advisory", "data-severity": advisory?.severity ?? "error", role: advisory?.severity === "error" || !advisory ? "alert" : "status", children: [
18
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "!" }),
19
+ /* @__PURE__ */ jsxs("span", { children: [
20
+ /* @__PURE__ */ jsx("strong", { children: advisory?.title ?? "Could not inspect harness settings" }),
21
+ /* @__PURE__ */ jsx("small", { children: advisory?.message ?? state.interopSettingsError })
22
+ ] }),
23
+ advisory && state.canConfigureSettings ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onReview(advisory.recommendation.change), children: "Review" }) : null
24
+ ] });
25
+ }
26
+ function initialValues(report, recommendedChange) {
27
+ return Object.fromEntries(report.controls.map((control) => [
28
+ control.key,
29
+ recommendedChange?.key === control.key ? recommendedChange.value : control.configuredValue ?? control.effectiveValue ?? control.choices[0]?.value ?? null
30
+ ]));
31
+ }
32
+ function HarnessSettingsPanel({ state, adapter, onClose, recommendedChange = null }) {
33
+ const report = state.interopSettings;
34
+ const titleId = useId();
35
+ const panel = useRef(null);
36
+ const valuesKey = `${report?.revision ?? ""}:${recommendedChange?.key ?? ""}:${recommendedChange?.value ?? ""}`;
37
+ const defaults = useMemo(() => report ? initialValues(report, recommendedChange) : {}, [valuesKey]);
38
+ const [values, setValues] = useState(defaults);
39
+ useEffect(() => setValues(defaults), [defaults]);
40
+ useEffect(() => {
41
+ panel.current?.querySelector("select, button")?.focus({ preventScroll: true });
42
+ const dismiss = (event) => {
43
+ if (event.key === "Escape") {
44
+ event.preventDefault();
45
+ onClose();
46
+ }
47
+ };
48
+ document.addEventListener("keydown", dismiss);
49
+ return () => document.removeEventListener("keydown", dismiss);
50
+ }, [onClose]);
51
+ if (!report) return /* @__PURE__ */ jsx("section", { ref: panel, className: "scui-settings", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: /* @__PURE__ */ jsxs("header", { children: [
52
+ /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close settings", onClick: onClose, children: /* @__PURE__ */ jsx(UiIcon, { name: "close", size: 18 }) }),
53
+ /* @__PURE__ */ jsxs("span", { children: [
54
+ /* @__PURE__ */ jsx("strong", { id: titleId, children: "Harness settings" }),
55
+ /* @__PURE__ */ jsx("small", { children: state.interopSettingsError ?? "No interoperability controls are available." })
56
+ ] })
57
+ ] }) });
58
+ const changed = report.controls.flatMap((control) => values[control.key] !== (control.configuredValue ?? control.effectiveValue ?? control.choices[0]?.value ?? null) ? [{ key: control.key, value: values[control.key] ?? null }] : []);
59
+ const submit = (event) => {
60
+ event.preventDefault();
61
+ if (!changed.length || !state.canConfigureSettings) return;
62
+ adapter.onIntent({ action: "configureHarness", harness: report.harness, changes: changed, expectedRevision: report.revision });
63
+ };
64
+ return /* @__PURE__ */ jsxs("section", { ref: panel, className: "scui-settings", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: [
65
+ /* @__PURE__ */ jsxs("header", { children: [
66
+ /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close settings", onClick: onClose, children: /* @__PURE__ */ jsx(UiIcon, { name: "close", size: 18 }) }),
67
+ /* @__PURE__ */ jsxs("span", { children: [
68
+ /* @__PURE__ */ jsxs("strong", { id: titleId, children: [
69
+ harnessDisplayName(report.harness),
70
+ " interoperability"
71
+ ] }),
72
+ /* @__PURE__ */ jsx("small", { children: "Native harness settings used by Supercode" })
73
+ ] })
74
+ ] }),
75
+ /* @__PURE__ */ jsxs("form", { onSubmit: submit, children: [
76
+ report.controls.map((control) => {
77
+ const choice = control.choices.find((item) => item.value === values[control.key]);
78
+ const recommendation = report.advisories.map((advisory) => advisory.recommendation).find((item) => item.change.key === control.key && item.change.value === values[control.key]);
79
+ const consequence = choice?.risk ?? recommendation?.consequence;
80
+ return /* @__PURE__ */ jsxs("fieldset", { disabled: !control.writable || Boolean(state.operation), children: [
81
+ /* @__PURE__ */ jsxs("label", { htmlFor: `scui-setting-${control.key}`, children: [
82
+ /* @__PURE__ */ jsx("strong", { children: control.label }),
83
+ /* @__PURE__ */ jsx("small", { children: control.description })
84
+ ] }),
85
+ /* @__PURE__ */ jsxs("select", { id: `scui-setting-${control.key}`, value: values[control.key] ?? "@default", onChange: (event) => setValues((current) => ({ ...current, [control.key]: event.currentTarget.value === "@default" ? null : event.currentTarget.value })), children: [
86
+ control.resettable ? /* @__PURE__ */ jsx("option", { value: "@default", children: "Use harness default" }) : null,
87
+ control.choices.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, children: item.label }, item.value))
88
+ ] }),
89
+ choice ? /* @__PURE__ */ jsx("p", { children: choice.description }) : null,
90
+ consequence ? /* @__PURE__ */ jsxs("p", { className: "scui-setting-risk", children: [
91
+ /* @__PURE__ */ jsx("strong", { children: "Security consequence" }),
92
+ consequence
93
+ ] }) : null,
94
+ /* @__PURE__ */ jsxs("small", { className: "scui-setting-source", children: [
95
+ control.effectiveNote,
96
+ control.sourcePath ? ` Source: ${control.sourcePath}` : ""
97
+ ] })
98
+ ] }, control.key);
99
+ }),
100
+ /* @__PURE__ */ jsxs("footer", { children: [
101
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: onClose, children: "Cancel" }),
102
+ /* @__PURE__ */ jsx("button", { type: "submit", disabled: !changed.length || !state.canConfigureSettings || Boolean(state.operation), children: state.operation === "configureHarness" ? "Applying\u2026" : "Apply changes" })
103
+ ] })
104
+ ] })
105
+ ] });
106
+ }
107
+ var ACTIVE_AUTHENTICATION_PHASES = /* @__PURE__ */ new Set(["checking", "launching", "awaiting_user", "verifying"]);
108
+ function HarnessAuthenticationButton({ item, state, adapter }) {
109
+ if (!item.installed || !["claude-code", "codex"].includes(item.id) || ["ready", "configured"].includes(item.auth)) return null;
110
+ const flow = state?.harnessAuthentication?.harness === item.id ? state.harnessAuthentication : null;
111
+ const busy = flow && ACTIVE_AUTHENTICATION_PHASES.has(flow.phase);
112
+ const completed = flow?.phase === "authenticated";
113
+ const label = flow?.phase === "checking" ? "Checking\u2026" : flow?.phase === "launching" ? "Opening\u2026" : flow?.phase === "awaiting_user" ? "Finish sign-in" : flow?.phase === "verifying" ? "Verifying\u2026" : flow?.phase === "authenticated" ? "Signed in" : flow?.phase === "failed" ? "Try again" : "Sign in";
114
+ return /* @__PURE__ */ jsx("button", { type: "button", disabled: Boolean(busy || completed), "aria-busy": Boolean(busy), onClick: () => adapter?.onIntent({ action: "authenticateHarness", harness: item.id }), children: label });
115
+ }
116
+ function canAuthenticateHarness(item) {
117
+ return item.installed && ["claude-code", "codex"].includes(item.id) && !["ready", "configured"].includes(item.auth);
118
+ }
119
+ function harnessAuthenticationReason(item, state) {
120
+ const flow = state?.harnessAuthentication?.harness === item.id ? state.harnessAuthentication : null;
121
+ return flow?.error?.message || flow?.plan?.instructions || item.reason || (item.auth === "required" ? "Authentication required" : "Unavailable");
122
+ }
123
+ function HarnessReadiness({ harnesses, state, adapter }) {
124
+ const blocked = harnesses.filter((item) => !item.startable);
125
+ if (!blocked.length || harnesses.some((item) => item.startable)) return null;
126
+ return /* @__PURE__ */ jsxs("details", { className: "scui-readiness", open: true, children: [
127
+ /* @__PURE__ */ jsx("summary", { children: "No coding harness is ready" }),
128
+ /* @__PURE__ */ jsx("div", { children: blocked.map((item) => /* @__PURE__ */ jsxs("section", { children: [
129
+ /* @__PURE__ */ jsx(HarnessLogo, { id: item.id, size: 25 }),
130
+ /* @__PURE__ */ jsxs("span", { children: [
131
+ /* @__PURE__ */ jsx("strong", { children: item.label }),
132
+ /* @__PURE__ */ jsx("small", { children: harnessAuthenticationReason(item, state) }),
133
+ item.protocol ? /* @__PURE__ */ jsxs("em", { children: [
134
+ item.protocol,
135
+ " \xB7 ",
136
+ item.runtime
137
+ ] }) : null
138
+ ] }),
139
+ /* @__PURE__ */ jsx(HarnessAuthenticationButton, { item, state, adapter }),
140
+ !canAuthenticateHarness(item) && item.repair ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => adapter.copyText?.(item.repair), children: "Copy fix" }) : null
141
+ ] }, item.id)) })
142
+ ] });
143
+ }
144
+ function HarnessPicker({ harnesses, state, value, disabled = false, adapter, onChange, logo: Logo = HarnessLogo }) {
145
+ const [open, setOpen] = useState(false);
146
+ const menuId = useId();
147
+ const root = useRef(null);
148
+ const trigger = useRef(null);
149
+ const panel = useRef(null);
150
+ const available = harnesses.filter((item) => item.startable);
151
+ const unavailable = harnesses.filter((item) => !item.startable);
152
+ const selected = available.find((item) => item.id === value) ?? available[0] ?? null;
153
+ const close = () => {
154
+ setOpen(false);
155
+ trigger.current?.focus({ preventScroll: true });
156
+ };
157
+ useEffect(() => {
158
+ if (!open) return;
159
+ panel.current?.querySelector('[aria-selected="true"], [role="option"]')?.focus({ preventScroll: true });
160
+ const dismiss = (event) => {
161
+ if (event.type === "keydown" && event.key === "Escape") {
162
+ event.preventDefault();
163
+ close();
164
+ } else if (event.type === "pointerdown" && !root.current?.contains(event.target)) {
165
+ setOpen(false);
166
+ }
167
+ };
168
+ document.addEventListener("keydown", dismiss);
169
+ document.addEventListener("pointerdown", dismiss, true);
170
+ return () => {
171
+ document.removeEventListener("keydown", dismiss);
172
+ document.removeEventListener("pointerdown", dismiss, true);
173
+ };
174
+ }, [open]);
175
+ const navigate = (event) => {
176
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) return;
177
+ const items = [...panel.current.querySelectorAll('[role="option"]')];
178
+ if (!items.length) return;
179
+ event.preventDefault();
180
+ const current = items.indexOf(document.activeElement);
181
+ const index = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : event.key === "ArrowDown" ? (current + 1) % items.length : (current <= 0 ? items.length : current) - 1;
182
+ items[index].focus({ preventScroll: true });
183
+ };
184
+ const select = (id) => {
185
+ onChange(id);
186
+ close();
187
+ };
188
+ return /* @__PURE__ */ jsxs("div", { className: "scui-harness-menu", ref: root, onBlur: (event) => {
189
+ if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) setOpen(false);
190
+ }, children: [
191
+ /* @__PURE__ */ jsxs("button", { ref: trigger, className: "scui-harness-trigger", type: "button", disabled: disabled || !selected, "aria-label": selected ? `Coding harness: ${selected.label}` : "No coding harness available", "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? menuId : void 0, onClick: () => setOpen((current) => !current), children: [
192
+ selected ? /* @__PURE__ */ jsx(Logo, { id: selected.id, size: 20 }) : null,
193
+ /* @__PURE__ */ jsx("strong", { children: selected?.label ?? "No harness available" }),
194
+ /* @__PURE__ */ jsx(UiIcon, { name: "chevron", size: 13 })
195
+ ] }),
196
+ open ? /* @__PURE__ */ jsxs("div", { ref: panel, id: menuId, className: "scui-harness-popover", role: "dialog", "aria-label": "Choose coding harness", onKeyDown: navigate, children: [
197
+ /* @__PURE__ */ jsx("strong", { className: "scui-harness-popover-title", children: "Choose coding harness" }),
198
+ /* @__PURE__ */ jsx("div", { className: "scui-harness-options", role: "listbox", "aria-label": "Available coding harnesses", children: available.map((item) => /* @__PURE__ */ jsxs("button", { type: "button", role: "option", "aria-selected": item.id === selected?.id, onClick: () => select(item.id), children: [
199
+ /* @__PURE__ */ jsx(Logo, { id: item.id, size: 24 }),
200
+ /* @__PURE__ */ jsx("strong", { children: item.label }),
201
+ /* @__PURE__ */ jsx("span", { children: item.id === selected?.id ? /* @__PURE__ */ jsx(UiIcon, { name: "check", size: 15 }) : null })
202
+ ] }, item.id)) }),
203
+ unavailable.length ? /* @__PURE__ */ jsxs("details", { className: "scui-harness-manage", children: [
204
+ /* @__PURE__ */ jsx("summary", { children: "Manage additional harnesses" }),
205
+ /* @__PURE__ */ jsx("div", { children: unavailable.map((item) => /* @__PURE__ */ jsxs("section", { children: [
206
+ /* @__PURE__ */ jsx(Logo, { id: item.id, size: 24 }),
207
+ /* @__PURE__ */ jsxs("span", { children: [
208
+ /* @__PURE__ */ jsx("strong", { children: item.label }),
209
+ /* @__PURE__ */ jsx("small", { children: harnessAuthenticationReason(item, state) })
210
+ ] }),
211
+ /* @__PURE__ */ jsx(HarnessAuthenticationButton, { item, state, adapter }),
212
+ !canAuthenticateHarness(item) && item.repair ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => adapter?.copyText?.(item.repair), children: "Copy fix" }) : null
213
+ ] }, item.id)) })
214
+ ] }) : null
215
+ ] }) : null
216
+ ] });
217
+ }
218
+
219
+ export {
220
+ HarnessAdvisory,
221
+ HarnessSettingsPanel,
222
+ HarnessReadiness,
223
+ HarnessPicker
224
+ };