@volter-ai-dev/supercode-ui 0.1.70 → 0.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -1
- package/activity.mjs +5 -1235
- package/chunks/chunk-ATCOWFRV.mjs +105 -0
- package/chunks/chunk-LOP6XOON.mjs +671 -0
- package/chunks/chunk-LQMYNJPU.mjs +120 -0
- package/chunks/chunk-LS6JBXNT.mjs +1237 -0
- package/chunks/chunk-O7Q2PELK.mjs +201 -0
- package/chunks/chunk-OW42DS6P.mjs +842 -0
- package/chunks/chunk-SJ3YTA6Z.mjs +316 -0
- package/chunks/chunk-SSYNT434.mjs +224 -0
- package/chunks/chunk-V3UM7H7W.mjs +328 -0
- package/chunks/chunk-XD2WJYSL.mjs +29 -0
- package/chunks/chunk-ZLYHUYE2.mjs +62 -0
- package/components.d.ts +3 -0
- package/components.mjs +59 -3766
- package/composer.mjs +8 -580
- package/conversation.mjs +16 -1373
- package/embed.mjs +15 -3681
- package/icon.mjs +3 -58
- package/index.d.ts +25 -0
- package/logo.mjs +5 -87
- package/messenger.d.ts +3 -0
- package/messenger.mjs +21 -3677
- package/package.json +3 -2
- package/react/activity.mjs +5 -1235
- package/react/chunks/chunk-2RIHDJT6.mjs +842 -0
- package/react/chunks/chunk-7ES5FSLG.mjs +316 -0
- package/react/chunks/chunk-GV5KV5UY.mjs +105 -0
- package/react/chunks/chunk-GYQOTTZ5.mjs +224 -0
- package/react/chunks/chunk-LS6JBXNT.mjs +1237 -0
- package/react/chunks/chunk-OINC7LV7.mjs +62 -0
- package/react/chunks/chunk-TQHX2DQG.mjs +120 -0
- package/react/chunks/chunk-UKHDCPME.mjs +328 -0
- package/react/chunks/chunk-UKMTRNJN.mjs +671 -0
- package/react/chunks/chunk-ZM5X5LOF.mjs +29 -0
- package/react/chunks/chunk-ZXD7NZXI.mjs +201 -0
- package/react/components.mjs +59 -3766
- package/react/composer.mjs +8 -580
- package/react/conversation.mjs +16 -1373
- package/react/icon.mjs +3 -58
- package/react/index.d.ts +25 -0
- package/react/logo.mjs +5 -87
- package/react/messenger.d.ts +3 -0
- package/react/messenger.mjs +21 -3677
- package/react/sessions.mjs +9 -519
- package/react/settings.mjs +9 -425
- package/react/subagents.mjs +8 -1546
- package/sessions.mjs +9 -519
- package/settings.mjs +9 -425
- package/styles.css +12 -0
- package/subagents.mjs +8 -1546
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HarnessLogo
|
|
3
|
+
} from "./chunk-GV5KV5UY.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
|
+
};
|