@volter-ai-dev/supercode-ui 0.1.53 → 0.1.55
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/activity.mjs +19 -1
- package/components.d.ts +1 -0
- package/components.mjs +272 -167
- package/composer.mjs +7 -0
- package/controller.d.ts +8 -0
- package/controller.mjs +48 -1
- package/conversation.mjs +8 -1
- package/core.mjs +28 -2
- package/embed.mjs +273 -169
- package/icon.mjs +6 -0
- package/index.d.ts +24 -3
- package/messenger.mjs +271 -167
- package/package.json +14 -2
- package/react/activity.mjs +19 -1
- package/react/components.mjs +272 -167
- package/react/composer.mjs +7 -0
- package/react/conversation.mjs +8 -1
- package/react/icon.mjs +6 -0
- package/react/index.d.ts +3 -2
- package/react/messenger.mjs +271 -167
- package/react/sessions.d.ts +1 -1
- package/react/sessions.mjs +41 -25
- package/react/settings.mjs +7 -0
- package/react/subagents.d.ts +2 -0
- package/react/subagents.mjs +1464 -0
- package/sessions.d.ts +1 -1
- package/sessions.mjs +41 -25
- package/settings.mjs +7 -0
- package/styles.css +6 -1
- package/subagents.d.ts +2 -0
- package/subagents.mjs +1464 -0
package/embed.mjs
CHANGED
|
@@ -68,6 +68,7 @@ var EMPTY_UI_STATE = Object.freeze({
|
|
|
68
68
|
savedDraft: "",
|
|
69
69
|
attention: Object.freeze([]),
|
|
70
70
|
sessions: Object.freeze([]),
|
|
71
|
+
subagentInspector: null,
|
|
71
72
|
attached: null,
|
|
72
73
|
owned: null,
|
|
73
74
|
attachError: null
|
|
@@ -574,10 +575,25 @@ function readSessions(value) {
|
|
|
574
575
|
active: row.active === true,
|
|
575
576
|
writable: row.writable === true,
|
|
576
577
|
live: row.live === true,
|
|
577
|
-
runtimeStatus: row.runtimeStatus === "running" || row.runtimeStatus === "busy" || row.runtimeStatus === "idle" ? row.runtimeStatus : null
|
|
578
|
+
runtimeStatus: row.runtimeStatus === "running" || row.runtimeStatus === "busy" || row.runtimeStatus === "idle" ? row.runtimeStatus : null,
|
|
579
|
+
...Number.isSafeInteger(row.subagentCount) && row.subagentCount > 0 ? { subagentCount: row.subagentCount } : {},
|
|
580
|
+
activity: ACTIVITY_PRIORITY[row.activity] !== void 0 ? row.activity : void 0
|
|
578
581
|
}];
|
|
579
582
|
});
|
|
580
583
|
}
|
|
584
|
+
function readSubagentInspector(value) {
|
|
585
|
+
const inspector = record(value);
|
|
586
|
+
if (!inspector || typeof inspector.parentKey !== "string" || !inspector.parentKey) return null;
|
|
587
|
+
return {
|
|
588
|
+
parentKey: inspector.parentKey,
|
|
589
|
+
parentTitle: boundedString(string(inspector.parentTitle), 500),
|
|
590
|
+
status: ["loading", "ready", "error"].includes(inspector.status) ? inspector.status : "loading",
|
|
591
|
+
items: readSessions(inspector.items).slice(0, 100),
|
|
592
|
+
selectedKey: typeof inspector.selectedKey === "string" && inspector.selectedKey ? inspector.selectedKey : null,
|
|
593
|
+
transcript: readTranscript(inspector.transcript).slice(-120),
|
|
594
|
+
error: typeof inspector.error === "string" ? boundedString(inspector.error) : null
|
|
595
|
+
};
|
|
596
|
+
}
|
|
581
597
|
function readAttached(value) {
|
|
582
598
|
const item = record(value);
|
|
583
599
|
if (!item || typeof item.harness !== "string") return null;
|
|
@@ -792,6 +808,7 @@ function normalizeUiState(value) {
|
|
|
792
808
|
return item && typeof item.key === "string" && ["unseen", "finished", "failed"].includes(item.kind) ? [{ key: item.key, kind: item.kind, ...typeof item.preview === "string" ? { preview: item.preview } : {}, ...Number.isSafeInteger(item.afterMessages) && item.afterMessages >= 0 ? { afterMessages: item.afterMessages } : {}, ...Number.isSafeInteger(item.unreadCount) && item.unreadCount > 0 ? { unreadCount: item.unreadCount } : {} }] : [];
|
|
793
809
|
}) : [],
|
|
794
810
|
sessions: readSessions(raw.sessions),
|
|
811
|
+
subagentInspector: readSubagentInspector(raw.subagentInspector),
|
|
795
812
|
attached: readAttached(raw.attached),
|
|
796
813
|
owned: readAttached(raw.owned),
|
|
797
814
|
attachError: attachError && typeof attachError.key === "string" && typeof attachError.message === "string" ? { key: attachError.key, message: attachError.message } : null
|
|
@@ -805,6 +822,7 @@ function sessionDisplayName(session) {
|
|
|
805
822
|
return title && title !== session.name ? title : session.name || "Untitled chat";
|
|
806
823
|
}
|
|
807
824
|
function sessionActivity(state, row) {
|
|
825
|
+
if (row.activity && ACTIVITY_PRIORITY[row.activity] !== void 0) return row.activity;
|
|
808
826
|
if (state.needsInput && row.active) return "needs-input";
|
|
809
827
|
if (state.busy && row.active) return "working";
|
|
810
828
|
if (row.runtimeStatus === "busy") return "working";
|
|
@@ -907,6 +925,12 @@ function boundedSet(map, key, value) {
|
|
|
907
925
|
// src/icon.jsx
|
|
908
926
|
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
909
927
|
var ICONS = {
|
|
928
|
+
agents: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
929
|
+
/* @__PURE__ */ jsx("circle", { cx: "6", cy: "6.5", r: "2" }),
|
|
930
|
+
/* @__PURE__ */ jsx("path", { d: "M2.75 13c.45-2 1.55-3 3.25-3s2.8 1 3.25 3" }),
|
|
931
|
+
/* @__PURE__ */ jsx("circle", { cx: "12.25", cy: "7", r: "1.5" }),
|
|
932
|
+
/* @__PURE__ */ jsx("path", { d: "M10.5 10.75c1.95-.65 3.45.1 4 2.25" })
|
|
933
|
+
] }),
|
|
910
934
|
attach: () => /* @__PURE__ */ jsx("path", { d: "M6.25 9.75 10.6 5.4a2.1 2.1 0 0 1 2.97 2.97l-5.4 5.4a3.3 3.3 0 0 1-4.67-4.66l5.52-5.52" }),
|
|
911
935
|
back: () => /* @__PURE__ */ jsx("path", { d: "m11.5 4.5-4.5 4.5 4.5 4.5" }),
|
|
912
936
|
check: () => /* @__PURE__ */ jsx("path", { d: "m4 9 3.25 3.25L14 5.5" }),
|
|
@@ -1954,13 +1978,13 @@ function ToolRow({ entry, workspace, open = false, adapter }) {
|
|
|
1954
1978
|
] });
|
|
1955
1979
|
}
|
|
1956
1980
|
function ActivityGroup({ entries, state, adapter }) {
|
|
1957
|
-
if (entries.length === 1) return /* @__PURE__ */ jsx5("section", { className: "scui-activity", "data-single": "true", children: /* @__PURE__ */ jsx5(ToolRow, { entry: entries[0], workspace: state.workspace, adapter }) });
|
|
1958
1981
|
const active = entries.some((entry) => entry.status === "pending");
|
|
1959
1982
|
const [open, setOpen] = useState3(active);
|
|
1960
1983
|
const id = useId();
|
|
1961
1984
|
useEffect4(() => {
|
|
1962
1985
|
if (active) setOpen(true);
|
|
1963
1986
|
}, [active]);
|
|
1987
|
+
if (entries.length === 1) return /* @__PURE__ */ jsx5("section", { className: "scui-activity", "data-single": "true", children: /* @__PURE__ */ jsx5(ToolRow, { entry: entries[0], workspace: state.workspace, adapter }) });
|
|
1964
1988
|
return /* @__PURE__ */ jsxs4("section", { className: "scui-activity", children: [
|
|
1965
1989
|
/* @__PURE__ */ jsxs4("button", { className: "scui-activity-head", type: "button", "aria-expanded": open, "aria-controls": id, onClick: () => setOpen((value) => !value), children: [
|
|
1966
1990
|
/* @__PURE__ */ jsx5("span", { className: "scui-fold", "data-open": open, children: /* @__PURE__ */ jsx5(UiIcon, { name: "chevron", size: 14 }) }),
|
|
@@ -2224,7 +2248,7 @@ function sessionPathParts(value) {
|
|
|
2224
2248
|
trailing: complete.slice(boundary + 1)
|
|
2225
2249
|
};
|
|
2226
2250
|
}
|
|
2227
|
-
function SessionRow({ row, state, onOpen, now = Date.now() }) {
|
|
2251
|
+
function SessionRow({ row, state, onOpen, onOpenSubagents, now = Date.now() }) {
|
|
2228
2252
|
const activity = sessionActivity(state, row);
|
|
2229
2253
|
const working = activity === "working";
|
|
2230
2254
|
const attention = state.attention.find((item) => item.key === row.key);
|
|
@@ -2234,32 +2258,40 @@ function SessionRow({ row, state, onOpen, now = Date.now() }) {
|
|
|
2234
2258
|
const unreadCount = attention?.unreadCount ?? 0;
|
|
2235
2259
|
const unreadLabel = unreadCount > 99 ? "99+" : String(unreadCount);
|
|
2236
2260
|
const age = relativeAge(row.previewUpdatedAt ?? row.updatedAt, now) || row.age;
|
|
2237
|
-
return /* @__PURE__ */ jsxs6("
|
|
2238
|
-
/* @__PURE__ */
|
|
2239
|
-
|
|
2240
|
-
/* @__PURE__ */ jsxs6("span", { className: "scui-session-
|
|
2241
|
-
/* @__PURE__ */
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
/* @__PURE__ */
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
working || preview || unreadCount ? /* @__PURE__ */ jsxs6("span", { className: "scui-session-preview", children: [
|
|
2250
|
-
working ? /* @__PURE__ */ jsxs6("span", { className: "scui-session-working", "aria-hidden": "true", children: [
|
|
2251
|
-
/* @__PURE__ */ jsx7("i", {}),
|
|
2252
|
-
/* @__PURE__ */ jsx7("i", {}),
|
|
2253
|
-
/* @__PURE__ */ jsx7("i", {})
|
|
2261
|
+
return /* @__PURE__ */ jsxs6("article", { className: "scui-session", "data-active": row.active, "data-activity": activity, "data-writable": row.writable, children: [
|
|
2262
|
+
/* @__PURE__ */ jsxs6("button", { className: "scui-session-main", "data-session-key": row.key, type: "button", "aria-label": `${title} \xB7 ${harnessDisplayName(row.harness)}${row.writable ? "" : " \xB7 Read-only"}${working ? " \xB7 Working" : ""}${path.complete ? ` \xB7 ${path.complete}` : ""}${preview ? ` \xB7 ${preview}` : ""}${unreadCount ? ` \xB7 ${unreadCount} unread` : ""}${age ? ` \xB7 ${age}` : ""}`, "aria-current": row.active ? "true" : void 0, onClick: () => onOpen(row), children: [
|
|
2263
|
+
/* @__PURE__ */ jsx7(HarnessLogo, { id: row.harness, activity, size: 34 }),
|
|
2264
|
+
/* @__PURE__ */ jsxs6("span", { className: "scui-session-copy", children: [
|
|
2265
|
+
/* @__PURE__ */ jsxs6("span", { className: "scui-session-title", children: [
|
|
2266
|
+
/* @__PURE__ */ jsx7("strong", { children: title }),
|
|
2267
|
+
/* @__PURE__ */ jsx7("span", { className: "scui-session-meta", children: age ? /* @__PURE__ */ jsx7("time", { children: age }) : null })
|
|
2268
|
+
] }),
|
|
2269
|
+
path.complete ? /* @__PURE__ */ jsxs6("small", { className: "scui-session-path", title: row.cwd, children: [
|
|
2270
|
+
/* @__PURE__ */ jsx7("span", { className: "scui-session-path-leading", children: path.leading }),
|
|
2271
|
+
path.separator ? /* @__PURE__ */ jsx7("span", { className: "scui-session-path-separator", children: path.separator }) : null,
|
|
2272
|
+
path.trailing ? /* @__PURE__ */ jsx7("span", { className: "scui-session-path-trailing", children: path.trailing }) : null
|
|
2254
2273
|
] }) : null,
|
|
2255
|
-
preview ||
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2274
|
+
working || preview || unreadCount ? /* @__PURE__ */ jsxs6("span", { className: "scui-session-preview", children: [
|
|
2275
|
+
working ? /* @__PURE__ */ jsxs6("span", { className: "scui-session-working", "aria-hidden": "true", children: [
|
|
2276
|
+
/* @__PURE__ */ jsx7("i", {}),
|
|
2277
|
+
/* @__PURE__ */ jsx7("i", {}),
|
|
2278
|
+
/* @__PURE__ */ jsx7("i", {})
|
|
2279
|
+
] }) : null,
|
|
2280
|
+
preview || working ? /* @__PURE__ */ jsx7("small", { children: preview || "Working\u2026" }) : null,
|
|
2281
|
+
unreadCount ? /* @__PURE__ */ jsx7("b", { "aria-label": `${unreadCount} unread messages`, children: unreadLabel }) : null
|
|
2282
|
+
] }) : null,
|
|
2283
|
+
state.attachError?.key === row.key ? /* @__PURE__ */ jsx7("em", { children: state.attachError.message }) : null
|
|
2284
|
+
] })
|
|
2285
|
+
] }),
|
|
2286
|
+
row.subagentCount ? /* @__PURE__ */ jsxs6("button", { className: "scui-session-agents", type: "button", "aria-label": `Inspect ${row.subagentCount} subagents in ${title}`, onClick: () => onOpenSubagents?.(row), children: [
|
|
2287
|
+
/* @__PURE__ */ jsx7(UiIcon, { name: "agents", size: 14 }),
|
|
2288
|
+
row.subagentCount,
|
|
2289
|
+
" ",
|
|
2290
|
+
row.subagentCount === 1 ? "agent" : "agents"
|
|
2291
|
+
] }) : null
|
|
2260
2292
|
] });
|
|
2261
2293
|
}
|
|
2262
|
-
function SessionList({ state, adapter, onOpen, onNew, onClose, components = {}, slots = {}, labels = DEFAULT_LABELS, focusKey = null, memoryKey = state.workspace || "@default", headerActions: HeaderActions }) {
|
|
2294
|
+
function SessionList({ state, adapter, onOpen, onOpenSubagents, onNew, onClose, components = {}, slots = {}, labels = DEFAULT_LABELS, focusKey = null, memoryKey = state.workspace || "@default", headerActions: HeaderActions }) {
|
|
2263
2295
|
const remembered = sessionListMemory.get(memoryKey) ?? { query: "", top: 0 };
|
|
2264
2296
|
const [query, setQuery] = useState4(remembered.query);
|
|
2265
2297
|
const [loadingMore, setLoadingMore] = useState4(false);
|
|
@@ -2325,26 +2357,86 @@ function SessionList({ state, adapter, onOpen, onNew, onClose, components = {},
|
|
|
2325
2357
|
/* @__PURE__ */ jsxs6("div", { className: "scui-session-rows", ref: rowScroller, onScroll: (event) => boundedSet(sessionListMemory, memoryKey, { query, top: event.currentTarget.scrollTop }), children: [
|
|
2326
2358
|
BeforeSessions ? /* @__PURE__ */ jsx7(BeforeSessions, { state, adapter, value: { query, rows } }) : null,
|
|
2327
2359
|
!rows.length && state.startup === "ready" ? /* @__PURE__ */ jsx7("div", { className: "scui-empty", children: query ? "No chats match your search." : state.error ?? "No coding chats found." }) : null,
|
|
2328
|
-
rows.map((row) => /* @__PURE__ */ jsx7(Row, { value: row, row, state, adapter, onOpen, now }, row.key)),
|
|
2360
|
+
rows.map((row) => /* @__PURE__ */ jsx7(Row, { value: row, row, state, adapter, onOpen, onOpenSubagents, now }, row.key)),
|
|
2329
2361
|
state.history.hasMoreSessions ? /* @__PURE__ */ jsx7("button", { className: "scui-load", type: "button", disabled: loadingMore, onClick: loadMore, children: loadingMore ? "Loading older chats\u2026" : "Load older chats" }) : null,
|
|
2330
2362
|
AfterSessions ? /* @__PURE__ */ jsx7(AfterSessions, { state, adapter, value: { query, rows } }) : null
|
|
2331
2363
|
] })
|
|
2332
2364
|
] });
|
|
2333
2365
|
}
|
|
2334
2366
|
|
|
2367
|
+
// src/subagents.jsx
|
|
2368
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "preact/jsx-runtime";
|
|
2369
|
+
function SubagentInspector({ state, adapter, onClose }) {
|
|
2370
|
+
const inspector = state.subagentInspector;
|
|
2371
|
+
if (!inspector) return null;
|
|
2372
|
+
const selected = inspector.items.find((row) => row.key === inspector.selectedKey) ?? null;
|
|
2373
|
+
const detailState = selected ? {
|
|
2374
|
+
...state,
|
|
2375
|
+
transcript: inspector.transcript,
|
|
2376
|
+
busy: selected.activity === "working",
|
|
2377
|
+
needsInput: selected.activity === "needs-input",
|
|
2378
|
+
harness: selected.harness,
|
|
2379
|
+
mode: "mirror",
|
|
2380
|
+
canSend: false,
|
|
2381
|
+
canSteer: false,
|
|
2382
|
+
canInterrupt: false,
|
|
2383
|
+
canRespond: false,
|
|
2384
|
+
taskPlan: { source: "none", items: [], residueCount: 0, observedAt: null },
|
|
2385
|
+
semantics: { fidelity: null, residue: [], residueCount: 0, parseErrors: 0, rawRecords: 0, subagents: [] },
|
|
2386
|
+
history: { ...state.history, hasEarlier: false }
|
|
2387
|
+
} : null;
|
|
2388
|
+
const leave = () => {
|
|
2389
|
+
adapter.onIntent({ action: "closeSubagents" });
|
|
2390
|
+
onClose();
|
|
2391
|
+
};
|
|
2392
|
+
const back = () => selected ? adapter.onIntent({ action: "openSubagents", key: inspector.parentKey }) : leave();
|
|
2393
|
+
return /* @__PURE__ */ jsxs7("section", { className: "scui-subagents", "aria-label": `Subagents for ${inspector.parentTitle}`, children: [
|
|
2394
|
+
/* @__PURE__ */ jsxs7("header", { className: "scui-head", children: [
|
|
2395
|
+
/* @__PURE__ */ jsx8("button", { type: "button", "aria-label": selected ? "Back to subagents" : "Back to chats", onClick: back, children: /* @__PURE__ */ jsx8(UiIcon, { name: "back", size: 17 }) }),
|
|
2396
|
+
/* @__PURE__ */ jsx8(UiIcon, { name: "agents", size: 20 }),
|
|
2397
|
+
/* @__PURE__ */ jsxs7("span", { className: "scui-head-copy", children: [
|
|
2398
|
+
/* @__PURE__ */ jsx8("strong", { children: selected ? sessionDisplayName(selected) : `${inspector.items.length || ""} ${inspector.items.length === 1 ? "agent" : "agents"}`.trim() }),
|
|
2399
|
+
/* @__PURE__ */ jsx8("small", { children: selected ? `${harnessDisplayName(selected.harness)} \xB7 Read-only` : inspector.parentTitle })
|
|
2400
|
+
] }),
|
|
2401
|
+
/* @__PURE__ */ jsx8("button", { type: "button", "aria-label": "Close subagent inspector", onClick: leave, children: /* @__PURE__ */ jsx8(UiIcon, { name: "close", size: 18 }) })
|
|
2402
|
+
] }),
|
|
2403
|
+
inspector.status === "loading" ? /* @__PURE__ */ jsxs7("div", { className: "scui-subagents-loading", role: "status", children: [
|
|
2404
|
+
/* @__PURE__ */ jsx8("i", {}),
|
|
2405
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
2406
|
+
/* @__PURE__ */ jsx8("strong", { children: selected ? "Loading subagent" : "Finding subagents" }),
|
|
2407
|
+
/* @__PURE__ */ jsx8("small", { children: selected ? "Reading a bounded recent transcript\u2026" : "Reading native session relationships\u2026" })
|
|
2408
|
+
] })
|
|
2409
|
+
] }) : null,
|
|
2410
|
+
inspector.error ? /* @__PURE__ */ jsx8("div", { className: "scui-error", role: "alert", children: inspector.error }) : null,
|
|
2411
|
+
!selected && inspector.status === "ready" ? /* @__PURE__ */ jsx8("div", { className: "scui-subagent-rows", children: inspector.items.map((row) => /* @__PURE__ */ jsxs7("button", { type: "button", "data-activity": row.activity ?? "idle", onClick: () => adapter.onIntent({ action: "openSubagent", parentKey: inspector.parentKey, key: row.key }), children: [
|
|
2412
|
+
/* @__PURE__ */ jsx8(HarnessLogo, { id: row.harness, activity: row.activity, size: 30 }),
|
|
2413
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
2414
|
+
/* @__PURE__ */ jsx8("strong", { children: sessionDisplayName(row) }),
|
|
2415
|
+
/* @__PURE__ */ jsx8("small", { children: row.preview || (row.activity === "working" ? "Working\u2026" : row.cwd) })
|
|
2416
|
+
] }),
|
|
2417
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
2418
|
+
/* @__PURE__ */ jsx8("small", { children: row.activity === "needs-input" ? "Needs input" : row.activity === "working" ? "Working" : row.age }),
|
|
2419
|
+
/* @__PURE__ */ jsx8(UiIcon, { name: "chevron", size: 14 })
|
|
2420
|
+
] })
|
|
2421
|
+
] }, row.key)) }) : null,
|
|
2422
|
+
!selected && inspector.status === "ready" && !inspector.items.length ? /* @__PURE__ */ jsx8("div", { className: "scui-empty", children: "No native child sessions were found." }) : null,
|
|
2423
|
+
selected && inspector.status === "ready" && detailState ? /* @__PURE__ */ jsx8(Conversation, { state: detailState, adapter, memoryKey: `subagent:${selected.key}` }) : null
|
|
2424
|
+
] });
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2335
2427
|
// src/settings.jsx
|
|
2336
2428
|
import { useEffect as useEffect7, useId as useId2, useMemo as useMemo2, useRef as useRef6, useState as useState5 } from "preact/hooks";
|
|
2337
|
-
import { jsx as
|
|
2429
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "preact/jsx-runtime";
|
|
2338
2430
|
function HarnessAdvisory({ state, onReview }) {
|
|
2339
2431
|
const advisory = state.interopSettings?.advisories[0];
|
|
2340
2432
|
if (!advisory && !state.interopSettingsError) return null;
|
|
2341
|
-
return /* @__PURE__ */
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
/* @__PURE__ */
|
|
2344
|
-
/* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2433
|
+
return /* @__PURE__ */ jsxs8("div", { className: "scui-advisory", "data-severity": advisory?.severity ?? "error", role: advisory?.severity === "error" || !advisory ? "alert" : "status", children: [
|
|
2434
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "!" }),
|
|
2435
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
2436
|
+
/* @__PURE__ */ jsx9("strong", { children: advisory?.title ?? "Could not inspect harness settings" }),
|
|
2437
|
+
/* @__PURE__ */ jsx9("small", { children: advisory?.message ?? state.interopSettingsError })
|
|
2346
2438
|
] }),
|
|
2347
|
-
advisory && state.canConfigureSettings ? /* @__PURE__ */
|
|
2439
|
+
advisory && state.canConfigureSettings ? /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => onReview(advisory.recommendation.change), children: "Review" }) : null
|
|
2348
2440
|
] });
|
|
2349
2441
|
}
|
|
2350
2442
|
function initialValues(report, recommendedChange) {
|
|
@@ -2372,11 +2464,11 @@ function HarnessSettingsPanel({ state, adapter, onClose, recommendedChange = nul
|
|
|
2372
2464
|
document.addEventListener("keydown", dismiss);
|
|
2373
2465
|
return () => document.removeEventListener("keydown", dismiss);
|
|
2374
2466
|
}, [onClose]);
|
|
2375
|
-
if (!report) return /* @__PURE__ */
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
2467
|
+
if (!report) return /* @__PURE__ */ jsx9("section", { ref: panel, className: "scui-settings", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: /* @__PURE__ */ jsxs8("header", { children: [
|
|
2468
|
+
/* @__PURE__ */ jsx9("button", { type: "button", "aria-label": "Close settings", onClick: onClose, children: /* @__PURE__ */ jsx9(UiIcon, { name: "close", size: 18 }) }),
|
|
2469
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
2470
|
+
/* @__PURE__ */ jsx9("strong", { id: titleId, children: "Harness settings" }),
|
|
2471
|
+
/* @__PURE__ */ jsx9("small", { children: state.interopSettingsError ?? "No interoperability controls are available." })
|
|
2380
2472
|
] })
|
|
2381
2473
|
] }) });
|
|
2382
2474
|
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 }] : []);
|
|
@@ -2385,45 +2477,45 @@ function HarnessSettingsPanel({ state, adapter, onClose, recommendedChange = nul
|
|
|
2385
2477
|
if (!changed.length || !state.canConfigureSettings) return;
|
|
2386
2478
|
adapter.onIntent({ action: "configureHarness", harness: report.harness, changes: changed, expectedRevision: report.revision });
|
|
2387
2479
|
};
|
|
2388
|
-
return /* @__PURE__ */
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2480
|
+
return /* @__PURE__ */ jsxs8("section", { ref: panel, className: "scui-settings", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: [
|
|
2481
|
+
/* @__PURE__ */ jsxs8("header", { children: [
|
|
2482
|
+
/* @__PURE__ */ jsx9("button", { type: "button", "aria-label": "Close settings", onClick: onClose, children: /* @__PURE__ */ jsx9(UiIcon, { name: "close", size: 18 }) }),
|
|
2483
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
2484
|
+
/* @__PURE__ */ jsxs8("strong", { id: titleId, children: [
|
|
2393
2485
|
harnessDisplayName(report.harness),
|
|
2394
2486
|
" interoperability"
|
|
2395
2487
|
] }),
|
|
2396
|
-
/* @__PURE__ */
|
|
2488
|
+
/* @__PURE__ */ jsx9("small", { children: "Native harness settings used by Supercode" })
|
|
2397
2489
|
] })
|
|
2398
2490
|
] }),
|
|
2399
|
-
/* @__PURE__ */
|
|
2491
|
+
/* @__PURE__ */ jsxs8("form", { onSubmit: submit, children: [
|
|
2400
2492
|
report.controls.map((control) => {
|
|
2401
2493
|
const choice = control.choices.find((item) => item.value === values[control.key]);
|
|
2402
2494
|
const recommendation = report.advisories.map((advisory) => advisory.recommendation).find((item) => item.change.key === control.key && item.change.value === values[control.key]);
|
|
2403
2495
|
const consequence = choice?.risk ?? recommendation?.consequence;
|
|
2404
|
-
return /* @__PURE__ */
|
|
2405
|
-
/* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2496
|
+
return /* @__PURE__ */ jsxs8("fieldset", { disabled: !control.writable || Boolean(state.operation), children: [
|
|
2497
|
+
/* @__PURE__ */ jsxs8("label", { htmlFor: `scui-setting-${control.key}`, children: [
|
|
2498
|
+
/* @__PURE__ */ jsx9("strong", { children: control.label }),
|
|
2499
|
+
/* @__PURE__ */ jsx9("small", { children: control.description })
|
|
2408
2500
|
] }),
|
|
2409
|
-
/* @__PURE__ */
|
|
2410
|
-
control.resettable ? /* @__PURE__ */
|
|
2411
|
-
control.choices.map((item) => /* @__PURE__ */
|
|
2501
|
+
/* @__PURE__ */ jsxs8("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: [
|
|
2502
|
+
control.resettable ? /* @__PURE__ */ jsx9("option", { value: "@default", children: "Use harness default" }) : null,
|
|
2503
|
+
control.choices.map((item) => /* @__PURE__ */ jsx9("option", { value: item.value, children: item.label }, item.value))
|
|
2412
2504
|
] }),
|
|
2413
|
-
choice ? /* @__PURE__ */
|
|
2414
|
-
consequence ? /* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2505
|
+
choice ? /* @__PURE__ */ jsx9("p", { children: choice.description }) : null,
|
|
2506
|
+
consequence ? /* @__PURE__ */ jsxs8("p", { className: "scui-setting-risk", children: [
|
|
2507
|
+
/* @__PURE__ */ jsx9("strong", { children: "Security consequence" }),
|
|
2416
2508
|
consequence
|
|
2417
2509
|
] }) : null,
|
|
2418
|
-
/* @__PURE__ */
|
|
2510
|
+
/* @__PURE__ */ jsxs8("small", { className: "scui-setting-source", children: [
|
|
2419
2511
|
control.effectiveNote,
|
|
2420
2512
|
control.sourcePath ? ` Source: ${control.sourcePath}` : ""
|
|
2421
2513
|
] })
|
|
2422
2514
|
] }, control.key);
|
|
2423
2515
|
}),
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
2516
|
+
/* @__PURE__ */ jsxs8("footer", { children: [
|
|
2517
|
+
/* @__PURE__ */ jsx9("button", { type: "button", onClick: onClose, children: "Cancel" }),
|
|
2518
|
+
/* @__PURE__ */ jsx9("button", { type: "submit", disabled: !changed.length || !state.canConfigureSettings || Boolean(state.operation), children: state.operation === "configureHarness" ? "Applying\u2026" : "Apply changes" })
|
|
2427
2519
|
] })
|
|
2428
2520
|
] })
|
|
2429
2521
|
] });
|
|
@@ -2431,20 +2523,20 @@ function HarnessSettingsPanel({ state, adapter, onClose, recommendedChange = nul
|
|
|
2431
2523
|
function HarnessReadiness({ harnesses, adapter }) {
|
|
2432
2524
|
const blocked = harnesses.filter((item) => !item.startable);
|
|
2433
2525
|
if (!blocked.length || harnesses.some((item) => item.startable)) return null;
|
|
2434
|
-
return /* @__PURE__ */
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
/* @__PURE__ */
|
|
2441
|
-
item.protocol ? /* @__PURE__ */
|
|
2526
|
+
return /* @__PURE__ */ jsxs8("details", { className: "scui-readiness", open: true, children: [
|
|
2527
|
+
/* @__PURE__ */ jsx9("summary", { children: "No coding harness is ready" }),
|
|
2528
|
+
/* @__PURE__ */ jsx9("div", { children: blocked.map((item) => /* @__PURE__ */ jsxs8("section", { children: [
|
|
2529
|
+
/* @__PURE__ */ jsx9(HarnessLogo, { id: item.id, size: 25 }),
|
|
2530
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
2531
|
+
/* @__PURE__ */ jsx9("strong", { children: item.label }),
|
|
2532
|
+
/* @__PURE__ */ jsx9("small", { children: item.reason || (item.auth === "required" ? "Authentication required" : "Unavailable") }),
|
|
2533
|
+
item.protocol ? /* @__PURE__ */ jsxs8("em", { children: [
|
|
2442
2534
|
item.protocol,
|
|
2443
2535
|
" \xB7 ",
|
|
2444
2536
|
item.runtime
|
|
2445
2537
|
] }) : null
|
|
2446
2538
|
] }),
|
|
2447
|
-
item.repair ? /* @__PURE__ */
|
|
2539
|
+
item.repair ? /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => adapter.copyText?.(item.repair), children: "Copy fix" }) : null
|
|
2448
2540
|
] }, item.id)) })
|
|
2449
2541
|
] });
|
|
2450
2542
|
}
|
|
@@ -2492,30 +2584,30 @@ function HarnessPicker({ harnesses, value, disabled = false, adapter, onChange,
|
|
|
2492
2584
|
onChange(id);
|
|
2493
2585
|
close();
|
|
2494
2586
|
};
|
|
2495
|
-
return /* @__PURE__ */
|
|
2587
|
+
return /* @__PURE__ */ jsxs8("div", { className: "scui-harness-menu", ref: root, onBlur: (event) => {
|
|
2496
2588
|
if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) setOpen(false);
|
|
2497
2589
|
}, children: [
|
|
2498
|
-
/* @__PURE__ */
|
|
2499
|
-
selected ? /* @__PURE__ */
|
|
2500
|
-
/* @__PURE__ */
|
|
2501
|
-
/* @__PURE__ */
|
|
2590
|
+
/* @__PURE__ */ jsxs8("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: [
|
|
2591
|
+
selected ? /* @__PURE__ */ jsx9(Logo, { id: selected.id, size: 20 }) : null,
|
|
2592
|
+
/* @__PURE__ */ jsx9("strong", { children: selected?.label ?? "No harness available" }),
|
|
2593
|
+
/* @__PURE__ */ jsx9(UiIcon, { name: "chevron", size: 13 })
|
|
2502
2594
|
] }),
|
|
2503
|
-
open ? /* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
/* @__PURE__ */
|
|
2506
|
-
/* @__PURE__ */
|
|
2507
|
-
/* @__PURE__ */
|
|
2508
|
-
/* @__PURE__ */
|
|
2595
|
+
open ? /* @__PURE__ */ jsxs8("div", { ref: panel, id: menuId, className: "scui-harness-popover", role: "dialog", "aria-label": "Choose coding harness", onKeyDown: navigate, children: [
|
|
2596
|
+
/* @__PURE__ */ jsx9("strong", { className: "scui-harness-popover-title", children: "Choose coding harness" }),
|
|
2597
|
+
/* @__PURE__ */ jsx9("div", { className: "scui-harness-options", role: "listbox", "aria-label": "Available coding harnesses", children: available.map((item) => /* @__PURE__ */ jsxs8("button", { type: "button", role: "option", "aria-selected": item.id === selected?.id, onClick: () => select(item.id), children: [
|
|
2598
|
+
/* @__PURE__ */ jsx9(Logo, { id: item.id, size: 24 }),
|
|
2599
|
+
/* @__PURE__ */ jsx9("strong", { children: item.label }),
|
|
2600
|
+
/* @__PURE__ */ jsx9("span", { children: item.id === selected?.id ? /* @__PURE__ */ jsx9(UiIcon, { name: "check", size: 15 }) : null })
|
|
2509
2601
|
] }, item.id)) }),
|
|
2510
|
-
unavailable.length ? /* @__PURE__ */
|
|
2511
|
-
/* @__PURE__ */
|
|
2512
|
-
/* @__PURE__ */
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
/* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
/* @__PURE__ */
|
|
2602
|
+
unavailable.length ? /* @__PURE__ */ jsxs8("details", { className: "scui-harness-manage", children: [
|
|
2603
|
+
/* @__PURE__ */ jsx9("summary", { children: "Manage additional harnesses" }),
|
|
2604
|
+
/* @__PURE__ */ jsx9("div", { children: unavailable.map((item) => /* @__PURE__ */ jsxs8("section", { children: [
|
|
2605
|
+
/* @__PURE__ */ jsx9(Logo, { id: item.id, size: 24 }),
|
|
2606
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
2607
|
+
/* @__PURE__ */ jsx9("strong", { children: item.label }),
|
|
2608
|
+
/* @__PURE__ */ jsx9("small", { children: item.reason || (item.auth === "required" ? "Authentication required" : "Unavailable") })
|
|
2517
2609
|
] }),
|
|
2518
|
-
item.repair ? /* @__PURE__ */
|
|
2610
|
+
item.repair ? /* @__PURE__ */ jsx9("button", { type: "button", onClick: () => adapter?.copyText?.(item.repair), children: "Copy fix" }) : null
|
|
2519
2611
|
] }, item.id)) })
|
|
2520
2612
|
] }) : null
|
|
2521
2613
|
] }) : null
|
|
@@ -2523,16 +2615,16 @@ function HarnessPicker({ harnesses, value, disabled = false, adapter, onChange,
|
|
|
2523
2615
|
}
|
|
2524
2616
|
|
|
2525
2617
|
// src/messenger.jsx
|
|
2526
|
-
import { jsx as
|
|
2618
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "preact/jsx-runtime";
|
|
2527
2619
|
var pendingMessageMemory = /* @__PURE__ */ new Map();
|
|
2528
2620
|
var messengerViewMemory = /* @__PURE__ */ new Map();
|
|
2529
2621
|
var newChatMemory = /* @__PURE__ */ new Map();
|
|
2530
2622
|
var TRACKED_ACTIONS = /* @__PURE__ */ new Set(["resume", "join", "detach", "branch", "reduce", "terminal", "export", "steer", "interrupt", "respond", "configureHarness", "refresh", "loadEarlier", "loadSessions"]);
|
|
2531
2623
|
function Receipt({ state, adapter }) {
|
|
2532
2624
|
const receipt = state.reductionReceipt;
|
|
2533
|
-
if (receipt) return /* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
/* @__PURE__ */
|
|
2625
|
+
if (receipt) return /* @__PURE__ */ jsx10("div", { className: "scui-receipt", children: /* @__PURE__ */ jsxs9("span", { children: [
|
|
2626
|
+
/* @__PURE__ */ jsx10("strong", { children: "Reduced and verified" }),
|
|
2627
|
+
/* @__PURE__ */ jsxs9("small", { children: [
|
|
2536
2628
|
receipt.sourceTokens.toLocaleString(),
|
|
2537
2629
|
" \u2192 ",
|
|
2538
2630
|
receipt.reducedTokens.toLocaleString(),
|
|
@@ -2541,27 +2633,27 @@ function Receipt({ state, adapter }) {
|
|
|
2541
2633
|
"\xD7 \xB7 reversible"
|
|
2542
2634
|
] })
|
|
2543
2635
|
] }) });
|
|
2544
|
-
if (state.exportReceipt) return /* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2636
|
+
if (state.exportReceipt) return /* @__PURE__ */ jsxs9("div", { className: "scui-receipt", children: [
|
|
2637
|
+
/* @__PURE__ */ jsxs9("span", { children: [
|
|
2638
|
+
/* @__PURE__ */ jsxs9("strong", { children: [
|
|
2547
2639
|
"Lossless export ready \xB7 ",
|
|
2548
2640
|
harnessDisplayName(state.exportReceipt.targetHarness)
|
|
2549
2641
|
] }),
|
|
2550
|
-
/* @__PURE__ */
|
|
2642
|
+
/* @__PURE__ */ jsxs9("small", { children: [
|
|
2551
2643
|
state.exportReceipt.path,
|
|
2552
2644
|
" \xB7 ",
|
|
2553
2645
|
state.exportReceipt.files,
|
|
2554
2646
|
" files"
|
|
2555
2647
|
] })
|
|
2556
2648
|
] }),
|
|
2557
|
-
/* @__PURE__ */
|
|
2649
|
+
/* @__PURE__ */ jsx10("button", { type: "button", onClick: () => adapter.copyText?.(state.exportReceipt.path), children: "Copy path" })
|
|
2558
2650
|
] });
|
|
2559
|
-
if (state.terminalHandoff) return /* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2561
|
-
/* @__PURE__ */
|
|
2562
|
-
/* @__PURE__ */
|
|
2651
|
+
if (state.terminalHandoff) return /* @__PURE__ */ jsxs9("div", { className: "scui-receipt", children: [
|
|
2652
|
+
/* @__PURE__ */ jsxs9("span", { children: [
|
|
2653
|
+
/* @__PURE__ */ jsx10("strong", { children: "Terminal handoff ready" }),
|
|
2654
|
+
/* @__PURE__ */ jsx10("small", { children: state.terminalHandoff.cwd })
|
|
2563
2655
|
] }),
|
|
2564
|
-
/* @__PURE__ */
|
|
2656
|
+
/* @__PURE__ */ jsx10("button", { type: "button", onClick: () => adapter.copyText?.(terminalCommand(state.terminalHandoff)), children: "Copy command" })
|
|
2565
2657
|
] });
|
|
2566
2658
|
return null;
|
|
2567
2659
|
}
|
|
@@ -2633,13 +2725,13 @@ function ConversationActions({ state, adapter, actionPending, onNew, onSettings
|
|
|
2633
2725
|
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;
|
|
2634
2726
|
items[index].focus({ preventScroll: true });
|
|
2635
2727
|
};
|
|
2636
|
-
return /* @__PURE__ */
|
|
2728
|
+
return /* @__PURE__ */ jsxs9("div", { className: "scui-menu", ref: root, onBlur: (event) => {
|
|
2637
2729
|
if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) setOpen(false);
|
|
2638
2730
|
}, children: [
|
|
2639
|
-
/* @__PURE__ */
|
|
2640
|
-
open ? /* @__PURE__ */
|
|
2641
|
-
/* @__PURE__ */
|
|
2642
|
-
group.items.map((item) => /* @__PURE__ */
|
|
2731
|
+
/* @__PURE__ */ jsx10("button", { ref: trigger, className: "scui-menu-trigger", type: "button", "aria-label": "Conversation actions", "aria-haspopup": "menu", "aria-expanded": open, "aria-controls": open ? menuId : void 0, onClick: () => setOpen((value) => !value), children: /* @__PURE__ */ jsx10(UiIcon, { name: "menu", size: 18 }) }),
|
|
2732
|
+
open ? /* @__PURE__ */ jsx10("div", { ref: panel, id: menuId, className: "scui-menu-panel", role: "menu", "aria-label": "Conversation actions", onKeyDown: navigate, children: groups.map((group) => /* @__PURE__ */ jsxs9("section", { role: "group", "aria-label": group.label, children: [
|
|
2733
|
+
/* @__PURE__ */ jsx10("strong", { children: group.label }),
|
|
2734
|
+
group.items.map((item) => /* @__PURE__ */ jsx10("button", { role: "menuitem", type: "button", disabled: actionPending, onClick: () => dispatch(item), children: item.label }, item.key))
|
|
2643
2735
|
] }, group.label)) }) : null
|
|
2644
2736
|
] });
|
|
2645
2737
|
}
|
|
@@ -2651,20 +2743,20 @@ function ChatHeader({ state, adapter, pendingStatus, actionPending, onBack, onNe
|
|
|
2651
2743
|
useEffect8(() => {
|
|
2652
2744
|
if (state.mode === "mirror" && !state.canSend) back.current?.focus({ preventScroll: true });
|
|
2653
2745
|
}, []);
|
|
2654
|
-
return /* @__PURE__ */
|
|
2655
|
-
/* @__PURE__ */
|
|
2656
|
-
/* @__PURE__ */
|
|
2657
|
-
/* @__PURE__ */
|
|
2658
|
-
/* @__PURE__ */
|
|
2659
|
-
/* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ jsxs9("header", { className: "scui-head scui-chat-head", children: [
|
|
2747
|
+
/* @__PURE__ */ jsx10("button", { ref: back, type: "button", "aria-label": "Back to chats", onClick: onBack, children: /* @__PURE__ */ jsx10(UiIcon, { name: "back", size: 17 }) }),
|
|
2748
|
+
/* @__PURE__ */ jsx10(HarnessLogo, { id: harness, size: 24 }),
|
|
2749
|
+
/* @__PURE__ */ jsxs9("span", { className: "scui-head-copy", children: [
|
|
2750
|
+
/* @__PURE__ */ jsx10("strong", { children: title }),
|
|
2751
|
+
/* @__PURE__ */ jsxs9("small", { children: [
|
|
2660
2752
|
harnessDisplayName(harness),
|
|
2661
2753
|
" \xB7 ",
|
|
2662
2754
|
status
|
|
2663
2755
|
] })
|
|
2664
2756
|
] }),
|
|
2665
|
-
HeaderActions ? /* @__PURE__ */
|
|
2666
|
-
/* @__PURE__ */
|
|
2667
|
-
onClose ? /* @__PURE__ */
|
|
2757
|
+
HeaderActions ? /* @__PURE__ */ jsx10(HeaderActions, { state, adapter, value: "chat" }) : null,
|
|
2758
|
+
/* @__PURE__ */ jsx10(ConversationActions, { state, adapter, actionPending, onNew, onSettings }),
|
|
2759
|
+
onClose ? /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx10(UiIcon, { name: "close", size: 18 }) }) : null
|
|
2668
2760
|
] });
|
|
2669
2761
|
}
|
|
2670
2762
|
function Chat({ state, adapter, onBack, onNew, onClose, components, slots, labels, contextCandidates, navigation, composerCommand }) {
|
|
@@ -2780,22 +2872,22 @@ function Chat({ state, adapter, onBack, onNew, onClose, components, slots, label
|
|
|
2780
2872
|
const unreadAfterMessages = state.attention.find((item) => item.key === state.attached?.key)?.afterMessages ?? null;
|
|
2781
2873
|
const Advisory = components.HarnessAdvisory ?? HarnessAdvisory;
|
|
2782
2874
|
const SettingsPanel = components.HarnessSettingsPanel ?? HarnessSettingsPanel;
|
|
2783
|
-
return /* @__PURE__ */
|
|
2784
|
-
Header ? /* @__PURE__ */
|
|
2785
|
-
actionLabel ? /* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
2875
|
+
return /* @__PURE__ */ jsxs9("section", { className: "scui-chat", children: [
|
|
2876
|
+
Header ? /* @__PURE__ */ jsx10(Header, { state: actionState, adapter: trackedAdapter, value: null }) : /* @__PURE__ */ jsx10(ChatHeader, { state: actionState, adapter: trackedAdapter, pendingStatus: pending?.status ?? null, actionPending: Boolean(action), onBack, onNew, onClose, onSettings: () => setSettings({ recommendedChange: null }), headerActions: HeaderActions }),
|
|
2877
|
+
actionLabel ? /* @__PURE__ */ jsxs9("div", { className: "scui-operation", role: "status", children: [
|
|
2878
|
+
/* @__PURE__ */ jsx10("i", {}),
|
|
2787
2879
|
actionLabel
|
|
2788
2880
|
] }) : null,
|
|
2789
|
-
state.error ? /* @__PURE__ */
|
|
2790
|
-
/* @__PURE__ */
|
|
2791
|
-
state.recoverable ? /* @__PURE__ */
|
|
2881
|
+
state.error ? /* @__PURE__ */ jsxs9("div", { className: "scui-error", role: "alert", children: [
|
|
2882
|
+
/* @__PURE__ */ jsx10("span", { children: state.error }),
|
|
2883
|
+
state.recoverable ? /* @__PURE__ */ jsx10("button", { type: "button", disabled: Boolean(action), onClick: () => trackedAdapter.onIntent({ action: "refresh" }), children: "Retry" }) : null
|
|
2792
2884
|
] }) : null,
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
/* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
2797
|
-
state.mode !== "mirror" || state.canSend ? /* @__PURE__ */
|
|
2798
|
-
settings ? /* @__PURE__ */
|
|
2885
|
+
/* @__PURE__ */ jsx10(Receipt, { state, adapter }),
|
|
2886
|
+
/* @__PURE__ */ jsx10(Conversation, { state: actionState, adapter: trackedAdapter, components, slots, memoryKey, pending: pendingMessage, unreadAfterMessages }, memoryKey),
|
|
2887
|
+
/* @__PURE__ */ jsx10(ContinuationBar, { state: actionState, adapter: trackedAdapter, labels }),
|
|
2888
|
+
/* @__PURE__ */ jsx10(Advisory, { state: actionState, adapter: trackedAdapter, value: state.interopSettings?.advisories[0] ?? null, onReview: (recommendedChange) => setSettings({ recommendedChange }) }),
|
|
2889
|
+
state.mode !== "mirror" || state.canSend ? /* @__PURE__ */ jsx10(Composer, { state: actionState, adapter: trackedAdapter, labels, memoryKey, pendingStatus: pending?.status ?? null, restoreDraft, command: composerCommand, contextCandidates, components, onDraftRestored: (id) => setRestoreDraft((value) => value?.id === id ? null : value), onPending: beginPending }, memoryKey) : null,
|
|
2890
|
+
settings ? /* @__PURE__ */ jsx10(SettingsPanel, { state: actionState, adapter: trackedAdapter, value: state.interopSettings, recommendedChange: settings.recommendedChange, onClose: () => setSettings(null) }) : null
|
|
2799
2891
|
] });
|
|
2800
2892
|
}
|
|
2801
2893
|
function NewChat({ state, adapter, onBack, onClose, onStarted, labels, memoryKey, headerActions: HeaderActions, contextCandidates, components, navigation, composerCommand }) {
|
|
@@ -2958,40 +3050,40 @@ function NewChat({ state, adapter, onBack, onClose, onStarted, labels, memoryKey
|
|
|
2958
3050
|
Promise.resolve(result).catch(() => setStarting((current) => current?.id === id ? null : current));
|
|
2959
3051
|
}
|
|
2960
3052
|
};
|
|
2961
|
-
return /* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
2963
|
-
/* @__PURE__ */
|
|
2964
|
-
/* @__PURE__ */
|
|
2965
|
-
/* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */
|
|
3053
|
+
return /* @__PURE__ */ jsxs9("section", { className: "scui-chat", children: [
|
|
3054
|
+
/* @__PURE__ */ jsxs9("header", { className: "scui-head", children: [
|
|
3055
|
+
/* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Back", onClick: onBack, children: /* @__PURE__ */ jsx10(UiIcon, { name: "back", size: 18 }) }),
|
|
3056
|
+
/* @__PURE__ */ jsxs9("span", { className: "scui-head-copy", children: [
|
|
3057
|
+
/* @__PURE__ */ jsx10("strong", { children: labels.newChat }),
|
|
3058
|
+
/* @__PURE__ */ jsx10("small", { children: "No session is created until you send" })
|
|
2967
3059
|
] }),
|
|
2968
|
-
HeaderActions ? /* @__PURE__ */
|
|
2969
|
-
onClose ? /* @__PURE__ */
|
|
3060
|
+
HeaderActions ? /* @__PURE__ */ jsx10(HeaderActions, { state, adapter, value: "new" }) : null,
|
|
3061
|
+
onClose ? /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx10(UiIcon, { name: "close", size: 18 }) }) : null
|
|
2970
3062
|
] }),
|
|
2971
|
-
starting ? /* @__PURE__ */
|
|
2972
|
-
/* @__PURE__ */
|
|
3063
|
+
starting ? /* @__PURE__ */ jsxs9("div", { className: "scui-operation", role: "status", children: [
|
|
3064
|
+
/* @__PURE__ */ jsx10("i", {}),
|
|
2973
3065
|
mode === "terminal" ? "Opening terminal\u2026" : operationLabel("start")
|
|
2974
3066
|
] }) : null,
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
3067
|
+
/* @__PURE__ */ jsxs9("div", { className: "scui-new", children: [
|
|
3068
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2726" }),
|
|
3069
|
+
/* @__PURE__ */ jsx10("strong", { children: "What should the agent build or fix?" }),
|
|
3070
|
+
/* @__PURE__ */ jsx10("small", { children: "Choose a coding harness and send the first message." })
|
|
2979
3071
|
] }),
|
|
2980
|
-
/* @__PURE__ */
|
|
2981
|
-
/* @__PURE__ */
|
|
2982
|
-
mode !== "terminal" ? /* @__PURE__ */
|
|
2983
|
-
/* @__PURE__ */
|
|
3072
|
+
/* @__PURE__ */ jsxs9("div", { className: "scui-compose", children: [
|
|
3073
|
+
/* @__PURE__ */ jsx10(Readiness, { harnesses: state.harnesses, state, adapter }),
|
|
3074
|
+
mode !== "terminal" ? /* @__PURE__ */ jsx10(ContextCandidates, { items: contextCandidates, context, images, state, adapter, onAttach: attachCandidate, component: components.ContextCandidate }) : null,
|
|
3075
|
+
/* @__PURE__ */ jsx10(ImageTray, { items: images, onRemove: (index) => setImages((items) => {
|
|
2984
3076
|
const next = items.filter((_, itemIndex) => itemIndex !== index);
|
|
2985
3077
|
remember({ images: next });
|
|
2986
3078
|
return next;
|
|
2987
3079
|
}) }),
|
|
2988
|
-
/* @__PURE__ */
|
|
3080
|
+
/* @__PURE__ */ jsx10(ContextTray, { items: context, onRemove: (index) => setContext((items) => {
|
|
2989
3081
|
const next = items.filter((_, itemIndex) => itemIndex !== index);
|
|
2990
3082
|
remember({ context: next });
|
|
2991
3083
|
return next;
|
|
2992
3084
|
}) }),
|
|
2993
|
-
terminalAttachments ? /* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
3085
|
+
terminalAttachments ? /* @__PURE__ */ jsx10("small", { className: "scui-context-error", role: "alert", children: "Terminal starts currently accept text only. Remove attachments or choose Headless." }) : pickerError ? /* @__PURE__ */ jsx10("small", { className: "scui-context-error", role: "alert", children: pickerError }) : null,
|
|
3086
|
+
/* @__PURE__ */ jsxs9("div", { className: `scui-envelope scui-new-envelope${dragging ? " scui-drop-target" : ""}`, onDragEnter: (event) => {
|
|
2995
3087
|
if (Array.from(event.dataTransfer?.types ?? []).includes("Files")) {
|
|
2996
3088
|
event.preventDefault();
|
|
2997
3089
|
setDragging(true);
|
|
@@ -3001,7 +3093,7 @@ function NewChat({ state, adapter, onBack, onClose, onStarted, labels, memoryKey
|
|
|
3001
3093
|
}, onDragLeave: (event) => {
|
|
3002
3094
|
if (!event.currentTarget.contains(event.relatedTarget)) setDragging(false);
|
|
3003
3095
|
}, onDrop: dropImages, children: [
|
|
3004
|
-
/* @__PURE__ */
|
|
3096
|
+
/* @__PURE__ */ jsx10("textarea", { ref: textarea, rows: 3, "aria-label": "Message coding agent", placeholder: startable.length ? "What should the agent do?" : "No coding harness is available", value: draft, disabled: !startable.length || Boolean(starting), onPaste: pasteImages, onInput: (event) => {
|
|
3005
3097
|
const value = event.currentTarget.value;
|
|
3006
3098
|
setDraft(value);
|
|
3007
3099
|
remember({ draft: value });
|
|
@@ -3011,19 +3103,19 @@ function NewChat({ state, adapter, onBack, onClose, onStarted, labels, memoryKey
|
|
|
3011
3103
|
send();
|
|
3012
3104
|
}
|
|
3013
3105
|
} }),
|
|
3014
|
-
/* @__PURE__ */
|
|
3015
|
-
adapter.pickContext ? /* @__PURE__ */
|
|
3016
|
-
/* @__PURE__ */
|
|
3106
|
+
/* @__PURE__ */ jsxs9("footer", { className: "scui-new-envelope-controls", children: [
|
|
3107
|
+
adapter.pickContext ? /* @__PURE__ */ jsx10("button", { className: "scui-attach", type: "button", "aria-label": labels.attachContext ?? DEFAULT_LABELS.attachContext, disabled: mode === "terminal" || picking || context.length >= MAX_CONTEXT_ITEMS && images.length >= MAX_IMAGE_ITEMS || Boolean(starting), onClick: pickContext, children: picking ? /* @__PURE__ */ jsx10("i", { className: "scui-control-spinner" }) : /* @__PURE__ */ jsx10(UiIcon, { name: "attach", size: 17 }) }) : null,
|
|
3108
|
+
/* @__PURE__ */ jsx10(Picker, { harnesses: state.harnesses, value: harness, disabled: Boolean(starting), adapter, logo: components.HarnessLogo, onChange: (value) => {
|
|
3017
3109
|
setHarness(value);
|
|
3018
3110
|
remember({ harness: value });
|
|
3019
3111
|
} }),
|
|
3020
|
-
/* @__PURE__ */
|
|
3112
|
+
/* @__PURE__ */ jsx10(ExecutionModeSelect, { modes: launchModes, value: mode, disabled: Boolean(starting) || mode !== requestedMode, onChange: (item) => {
|
|
3021
3113
|
const next = { ...modes, [harness]: item };
|
|
3022
3114
|
setModes(next);
|
|
3023
3115
|
setPickerError(null);
|
|
3024
3116
|
remember({ modes: next });
|
|
3025
3117
|
} }),
|
|
3026
|
-
/* @__PURE__ */
|
|
3118
|
+
/* @__PURE__ */ jsx10("span", { children: /* @__PURE__ */ jsx10("button", { type: "button", className: "scui-send", "aria-label": mode === "terminal" ? "Start terminal session" : "Start headless session", disabled: !draft.trim() && !images.length || !harness || Boolean(starting) || terminalAttachments || mode === "terminal" && !draft.trim(), onClick: send, children: starting ? /* @__PURE__ */ jsx10("i", { className: "scui-control-spinner" }) : /* @__PURE__ */ jsx10(UiIcon, { name: "send", size: 17 }) }) })
|
|
3027
3119
|
] })
|
|
3028
3120
|
] })
|
|
3029
3121
|
] })
|
|
@@ -3039,6 +3131,7 @@ function SupercodeMessenger({ state: stateInput, adapter, class: className = "",
|
|
|
3039
3131
|
const [newNavigation, setNewNavigation] = useState6(null);
|
|
3040
3132
|
const [chatNavigation, setChatNavigation] = useState6(null);
|
|
3041
3133
|
const [listFocus, setListFocus] = useState6(null);
|
|
3134
|
+
const [inspecting, setInspecting] = useState6(null);
|
|
3042
3135
|
const lastNavigation = useRef7(null);
|
|
3043
3136
|
const setView = (next) => {
|
|
3044
3137
|
boundedSet(messengerViewMemory, memoryKey, next);
|
|
@@ -3090,18 +3183,28 @@ function SupercodeMessenger({ state: stateInput, adapter, class: className = "",
|
|
|
3090
3183
|
setOpening(row);
|
|
3091
3184
|
adapter.onIntent({ action: "attach", key: row.key });
|
|
3092
3185
|
};
|
|
3186
|
+
const openSubagents = (row) => {
|
|
3187
|
+
setListFocus(row.key);
|
|
3188
|
+
setInspecting(row);
|
|
3189
|
+
adapter.onIntent({ action: "openSubagents", key: row.key });
|
|
3190
|
+
};
|
|
3093
3191
|
const close = () => adapter.onClose?.();
|
|
3094
3192
|
const Footer = slots.footer;
|
|
3095
3193
|
const HeaderActions = slots.headerActions;
|
|
3096
|
-
|
|
3097
|
-
|
|
3194
|
+
const inspectorParent = inspecting ?? (state.subagentInspector ? state.sessions.find((row) => row.key === state.subagentInspector.parentKey) ?? { key: state.subagentInspector.parentKey, title: state.subagentInspector.parentTitle } : null);
|
|
3195
|
+
const inspectorState = inspectorParent ? {
|
|
3196
|
+
...state,
|
|
3197
|
+
subagentInspector: state.subagentInspector?.parentKey === inspectorParent.key ? state.subagentInspector : { parentKey: inspectorParent.key, parentTitle: sessionDisplayName(inspectorParent), status: "loading", items: [], selectedKey: null, transcript: [], error: null }
|
|
3198
|
+
} : null;
|
|
3199
|
+
return /* @__PURE__ */ jsxs9("main", { className: `scui-root ${className}`, "data-view": view, "data-mode": state.mode, "aria-label": "Supercode messenger", children: [
|
|
3200
|
+
view === "list" ? /* @__PURE__ */ jsx10(SessionList, { state, adapter, focusKey: listFocus, onOpen: open, onOpenSubagents: openSubagents, onNew: () => {
|
|
3098
3201
|
setListFocus("@new");
|
|
3099
3202
|
setChatNavigation(null);
|
|
3100
3203
|
setNewNavigation(null);
|
|
3101
3204
|
setView("new");
|
|
3102
3205
|
}, onClose: adapter.onClose ? close : void 0, components, labels: copy, memoryKey, slots, headerActions: HeaderActions }) : null,
|
|
3103
|
-
view === "new" ? /* @__PURE__ */
|
|
3104
|
-
view === "chat" ? /* @__PURE__ */
|
|
3206
|
+
view === "new" ? /* @__PURE__ */ jsx10(NewChat, { state, adapter, onBack: () => setView("list"), onClose: adapter.onClose ? close : void 0, onStarted: (mode) => setView(mode === "terminal" ? "list" : "chat"), labels: copy, memoryKey, headerActions: HeaderActions, contextCandidates, components, navigation: newNavigation, composerCommand }) : null,
|
|
3207
|
+
view === "chat" ? /* @__PURE__ */ jsx10(Chat, { state, adapter, onBack: () => {
|
|
3105
3208
|
setListFocus(state.attached?.key ?? listFocus);
|
|
3106
3209
|
setView("list");
|
|
3107
3210
|
}, onNew: () => {
|
|
@@ -3110,27 +3213,28 @@ function SupercodeMessenger({ state: stateInput, adapter, class: className = "",
|
|
|
3110
3213
|
setNewNavigation(null);
|
|
3111
3214
|
setView("new");
|
|
3112
3215
|
}, onClose: adapter.onClose ? close : void 0, components, slots, labels: copy, contextCandidates, navigation: chatNavigation?.sessionKey === state.attached?.key ? chatNavigation : null, composerCommand }) : null,
|
|
3113
|
-
opening ? /* @__PURE__ */
|
|
3114
|
-
/* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3116
|
-
/* @__PURE__ */
|
|
3216
|
+
opening ? /* @__PURE__ */ jsxs9("div", { className: "scui-opening", role: "status", "aria-busy": "true", children: [
|
|
3217
|
+
/* @__PURE__ */ jsx10(HarnessLogo, { id: opening.harness, size: 34 }),
|
|
3218
|
+
/* @__PURE__ */ jsxs9("span", { children: [
|
|
3219
|
+
/* @__PURE__ */ jsxs9("strong", { children: [
|
|
3117
3220
|
"Opening ",
|
|
3118
3221
|
sessionDisplayName(opening)
|
|
3119
3222
|
] }),
|
|
3120
|
-
/* @__PURE__ */
|
|
3223
|
+
/* @__PURE__ */ jsx10("small", { children: "Loading the latest transcript window\u2026" })
|
|
3121
3224
|
] }),
|
|
3122
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsx10("i", {})
|
|
3123
3226
|
] }) : null,
|
|
3124
|
-
|
|
3227
|
+
inspectorState ? /* @__PURE__ */ jsx10(SubagentInspector, { state: inspectorState, adapter, onClose: () => setInspecting(null) }) : null,
|
|
3228
|
+
Footer ? /* @__PURE__ */ jsx10(Footer, { state, adapter, value: copy }) : null
|
|
3125
3229
|
] });
|
|
3126
3230
|
}
|
|
3127
3231
|
|
|
3128
3232
|
// src/embed.jsx
|
|
3129
|
-
import { jsx as
|
|
3233
|
+
import { jsx as jsx11 } from "preact/jsx-runtime";
|
|
3130
3234
|
function mountSupercodeMessenger(element, options) {
|
|
3131
3235
|
if (!(element instanceof Element)) throw new TypeError("mountSupercodeMessenger requires an Element");
|
|
3132
3236
|
let state = options.state;
|
|
3133
|
-
const draw = () => render(/* @__PURE__ */
|
|
3237
|
+
const draw = () => render(/* @__PURE__ */ jsx11(SupercodeMessenger, { ...options, state }), element);
|
|
3134
3238
|
options.adapter.onIntent({ action: "mounted" });
|
|
3135
3239
|
draw();
|
|
3136
3240
|
return {
|