@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.
- package/README.md +61 -1
- package/activity.mjs +5 -1235
- package/chunks/chunk-2FG7VKIW.mjs +201 -0
- package/chunks/chunk-4XUMCWPC.mjs +29 -0
- package/chunks/chunk-E65I2I2L.mjs +120 -0
- package/chunks/chunk-IL5T2AST.mjs +842 -0
- package/chunks/chunk-LOP6XOON.mjs +671 -0
- package/chunks/chunk-LS6JBXNT.mjs +1237 -0
- package/chunks/chunk-SJ3YTA6Z.mjs +316 -0
- package/chunks/chunk-TKTOVDXB.mjs +139 -0
- package/chunks/chunk-V3UM7H7W.mjs +328 -0
- package/chunks/chunk-WRK5TBX3.mjs +224 -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 +22 -3
- package/react/activity.mjs +5 -1235
- package/react/chunks/chunk-7ES5FSLG.mjs +316 -0
- package/react/chunks/chunk-LS6JBXNT.mjs +1237 -0
- package/react/chunks/chunk-LYRIQE5M.mjs +29 -0
- package/react/chunks/chunk-NJC6S2AW.mjs +201 -0
- package/react/chunks/chunk-OINC7LV7.mjs +62 -0
- package/react/chunks/chunk-QL6QEYPK.mjs +842 -0
- package/react/chunks/chunk-UGL6AB2K.mjs +120 -0
- package/react/chunks/chunk-UKHDCPME.mjs +328 -0
- package/react/chunks/chunk-UKMTRNJN.mjs +671 -0
- package/react/chunks/chunk-VFOVJ4S3.mjs +139 -0
- package/react/chunks/chunk-YK7SJ6EH.mjs +224 -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/react/supervision-components.mjs +1354 -0
- package/react/supervision.d.ts +36 -0
- package/sessions.mjs +9 -519
- package/settings.mjs +9 -425
- package/source-inventory.d.ts +240 -0
- package/source-inventory.mjs +367 -0
- package/styles.css +104 -0
- package/subagents.mjs +8 -1546
- package/supervision-components.d.ts +36 -0
- package/supervision-components.mjs +1354 -0
- package/supervision.d.ts +242 -0
- package/supervision.mjs +349 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HarnessLogo
|
|
3
|
+
} from "./chunk-TKTOVDXB.mjs";
|
|
4
|
+
import {
|
|
5
|
+
LoadingStatus
|
|
6
|
+
} from "./chunk-LOP6XOON.mjs";
|
|
7
|
+
import {
|
|
8
|
+
boundedSet,
|
|
9
|
+
uiMemory
|
|
10
|
+
} from "./chunk-V3UM7H7W.mjs";
|
|
11
|
+
import {
|
|
12
|
+
DEFAULT_LABELS,
|
|
13
|
+
filterSessions,
|
|
14
|
+
harnessDisplayName,
|
|
15
|
+
relativeAge,
|
|
16
|
+
sessionActivity,
|
|
17
|
+
sessionDisplayName
|
|
18
|
+
} from "./chunk-LS6JBXNT.mjs";
|
|
19
|
+
import {
|
|
20
|
+
UiIcon
|
|
21
|
+
} from "./chunk-ZLYHUYE2.mjs";
|
|
22
|
+
|
|
23
|
+
// src/sessions.jsx
|
|
24
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";
|
|
25
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
26
|
+
var sessionListMemory = uiMemory();
|
|
27
|
+
function sessionPathParts(value) {
|
|
28
|
+
const complete = String(value ?? "").replaceAll("\\", "/");
|
|
29
|
+
const boundary = complete.lastIndexOf("/");
|
|
30
|
+
if (boundary < 0) return { complete, leading: complete, separator: "", trailing: "" };
|
|
31
|
+
return {
|
|
32
|
+
complete,
|
|
33
|
+
leading: complete.slice(0, boundary),
|
|
34
|
+
separator: "/",
|
|
35
|
+
trailing: complete.slice(boundary + 1)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function SessionRow({ row, state, onOpen, onOpenSubagents, now = Date.now() }) {
|
|
39
|
+
const activity = sessionActivity(state, row);
|
|
40
|
+
const working = activity === "working";
|
|
41
|
+
const attention = state.attention.find((item) => item.key === row.key);
|
|
42
|
+
const title = sessionDisplayName(row);
|
|
43
|
+
const path = sessionPathParts(row.cwd);
|
|
44
|
+
const preview = row.preview || attention?.preview || "";
|
|
45
|
+
const unreadCount = attention?.unreadCount ?? 0;
|
|
46
|
+
const unreadLabel = unreadCount > 99 ? "99+" : String(unreadCount);
|
|
47
|
+
const age = relativeAge(row.previewUpdatedAt ?? row.updatedAt, now) || row.age;
|
|
48
|
+
const nounBadges = [];
|
|
49
|
+
if (row.trigger && row.trigger.kind !== "manual" && row.trigger.kind !== "human") {
|
|
50
|
+
const runs = row.recurring?.runs;
|
|
51
|
+
const detail = row.trigger.label || row.trigger.surface || "";
|
|
52
|
+
nounBadges.push(
|
|
53
|
+
/* @__PURE__ */ jsxs("small", { className: "scui-session-noun", "data-noun": "trigger", "data-kind": row.trigger.kind, "data-surface": row.trigger.surface ?? void 0, "data-status": row.recurring?.lastStatus ?? void 0, children: [
|
|
54
|
+
row.trigger.kind,
|
|
55
|
+
detail ? ` \xB7 ${detail}` : "",
|
|
56
|
+
runs && runs > 1 ? ` \xB7 \xD7${runs}` : ""
|
|
57
|
+
] }, "trigger")
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
if (row.crossSurface) {
|
|
61
|
+
nounBadges.push(
|
|
62
|
+
/* @__PURE__ */ jsxs("small", { className: "scui-session-noun", "data-noun": "cross-surface", "data-state": row.crossSurface.state, title: row.crossSurface.error ?? void 0, children: [
|
|
63
|
+
"\u2192",
|
|
64
|
+
row.crossSurface.platform ?? "elsewhere",
|
|
65
|
+
" \xB7 ",
|
|
66
|
+
row.crossSurface.state
|
|
67
|
+
] }, "cross-surface")
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
if (row.participant && row.participant.kind !== "local-user") {
|
|
71
|
+
nounBadges.push(
|
|
72
|
+
/* @__PURE__ */ jsx("small", { className: "scui-session-noun", "data-noun": "participant", "data-kind": row.participant.kind, children: row.participant.kind === "foreign" ? `${row.participant.label ?? "someone else"}${row.participant.origin ? ` via ${row.participant.origin}` : ""}` : "unknown participant" }, "participant")
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (row.mirror) {
|
|
76
|
+
nounBadges.push(
|
|
77
|
+
/* @__PURE__ */ jsxs("small", { className: "scui-session-noun", "data-noun": "mirror", "data-truncated": row.mirror.truncated, children: [
|
|
78
|
+
"mirror of ",
|
|
79
|
+
harnessDisplayName(row.mirror.canonicalHarness)
|
|
80
|
+
] }, "mirror")
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
if (row.workspaceRef?.kind === "channel") {
|
|
84
|
+
nounBadges.push(
|
|
85
|
+
/* @__PURE__ */ jsxs("small", { className: "scui-session-noun", "data-noun": "workspace", "data-kind": "channel", children: [
|
|
86
|
+
"#",
|
|
87
|
+
row.workspaceRef.value ?? "channel"
|
|
88
|
+
] }, "workspace")
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return /* @__PURE__ */ jsxs("article", { className: "scui-session", "data-active": row.active, "data-activity": activity, "data-writable": row.writable, "data-workspace-kind": row.workspaceRef?.kind, children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("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: [
|
|
93
|
+
/* @__PURE__ */ jsx(HarnessLogo, { id: row.harness, activity, size: 34 }),
|
|
94
|
+
/* @__PURE__ */ jsxs("span", { className: "scui-session-copy", children: [
|
|
95
|
+
/* @__PURE__ */ jsx("span", { className: "scui-session-title", children: /* @__PURE__ */ jsx("strong", { children: title }) }),
|
|
96
|
+
nounBadges.length ? /* @__PURE__ */ jsx("span", { className: "scui-session-nouns", children: nounBadges }) : null,
|
|
97
|
+
path.complete ? /* @__PURE__ */ jsxs("small", { className: "scui-session-path", title: row.cwd, children: [
|
|
98
|
+
/* @__PURE__ */ jsx("span", { className: "scui-session-path-leading", children: path.leading }),
|
|
99
|
+
path.separator ? /* @__PURE__ */ jsx("span", { className: "scui-session-path-separator", children: path.separator }) : null,
|
|
100
|
+
path.trailing ? /* @__PURE__ */ jsx("span", { className: "scui-session-path-trailing", children: path.trailing }) : null
|
|
101
|
+
] }) : null,
|
|
102
|
+
working || preview ? /* @__PURE__ */ jsxs("span", { className: "scui-session-preview", children: [
|
|
103
|
+
working ? /* @__PURE__ */ jsxs("span", { className: "scui-session-working", "aria-hidden": "true", children: [
|
|
104
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
105
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
106
|
+
/* @__PURE__ */ jsx("i", {})
|
|
107
|
+
] }) : null,
|
|
108
|
+
preview || working ? /* @__PURE__ */ jsx("small", { children: preview || "Working\u2026" }) : null
|
|
109
|
+
] }) : null,
|
|
110
|
+
state.attachError?.key === row.key ? /* @__PURE__ */ jsx("em", { children: state.attachError.message }) : null
|
|
111
|
+
] })
|
|
112
|
+
] }),
|
|
113
|
+
row.subagentCount || age || unreadCount ? /* @__PURE__ */ jsxs("span", { className: "scui-session-rail", children: [
|
|
114
|
+
/* @__PURE__ */ jsxs("span", { className: "scui-session-rail-meta", children: [
|
|
115
|
+
row.subagentCount ? /* @__PURE__ */ jsxs("button", { className: "scui-session-agents", type: "button", title: `${row.subagentCount} agent sessions`, "aria-label": `Open ${row.subagentCount} agent sessions in ${title}`, onClick: () => onOpenSubagents?.(row), children: [
|
|
116
|
+
/* @__PURE__ */ jsx(UiIcon, { name: "agents", size: 14 }),
|
|
117
|
+
/* @__PURE__ */ jsx("span", { children: row.subagentCount })
|
|
118
|
+
] }) : null,
|
|
119
|
+
age ? /* @__PURE__ */ jsx("time", { children: age }) : null
|
|
120
|
+
] }),
|
|
121
|
+
unreadCount ? /* @__PURE__ */ jsx("b", { "aria-label": `${unreadCount} unread messages`, children: unreadLabel }) : null
|
|
122
|
+
] }) : null
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
function SessionList({ state, adapter, onOpen, onOpenSubagents, onNew, onClose, components = {}, slots = {}, labels = DEFAULT_LABELS, focusKey = null, memoryKey = state.workspace || "@default", headerActions: HeaderActions }) {
|
|
126
|
+
const remembered = sessionListMemory.get(memoryKey) ?? { query: "", top: 0 };
|
|
127
|
+
const [query, setQuery] = useState(remembered.query);
|
|
128
|
+
const [loadingMore, setLoadingMore] = useState(false);
|
|
129
|
+
const [now, setNow] = useState(() => Date.now());
|
|
130
|
+
const root = useRef(null);
|
|
131
|
+
const rowScroller = useRef(null);
|
|
132
|
+
const rows = filterSessions(state.sessions, query);
|
|
133
|
+
const Row = components.SessionRow ?? SessionRow;
|
|
134
|
+
const ListHeader = slots.listHeader;
|
|
135
|
+
const ListToolbarActions = slots.listToolbarActions;
|
|
136
|
+
const BeforeSessions = slots.beforeSessions;
|
|
137
|
+
const AfterSessions = slots.afterSessions;
|
|
138
|
+
useLayoutEffect(() => {
|
|
139
|
+
if (rowScroller.current) rowScroller.current.scrollTop = remembered.top;
|
|
140
|
+
}, [memoryKey]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (!focusKey || !root.current) return;
|
|
143
|
+
const target = focusKey === "@new" ? root.current.querySelector('[data-list-focus="new"]') : [...root.current.querySelectorAll("[data-session-key]")].find((element) => element.dataset.sessionKey === focusKey);
|
|
144
|
+
(target ?? root.current.querySelector("input,button"))?.focus({ preventScroll: true });
|
|
145
|
+
}, [focusKey, rows.length]);
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
if (loadingMore) setLoadingMore(false);
|
|
148
|
+
}, [state.error, state.history.hasMoreSessions, state.sessions.length]);
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
const timer = setInterval(() => setNow(Date.now()), 1e4);
|
|
151
|
+
return () => clearInterval(timer);
|
|
152
|
+
}, []);
|
|
153
|
+
const loadMore = () => {
|
|
154
|
+
if (loadingMore) return;
|
|
155
|
+
setLoadingMore(true);
|
|
156
|
+
const result = adapter.onIntent({ action: "loadSessions" });
|
|
157
|
+
if (result && typeof result.then === "function") {
|
|
158
|
+
Promise.resolve(result).then(() => setLoadingMore(false), () => setLoadingMore(false));
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
return /* @__PURE__ */ jsxs("section", { className: "scui-list", ref: root, children: [
|
|
162
|
+
ListHeader ? /* @__PURE__ */ jsx(ListHeader, { state, adapter, value: { query, rows, onNew } }) : /* @__PURE__ */ jsxs("header", { className: "scui-head", children: [
|
|
163
|
+
/* @__PURE__ */ jsxs("span", { className: "scui-head-copy", children: [
|
|
164
|
+
/* @__PURE__ */ jsx("strong", { children: labels.chats }),
|
|
165
|
+
/* @__PURE__ */ jsxs("small", { children: [
|
|
166
|
+
state.sessions.length,
|
|
167
|
+
" recent conversations"
|
|
168
|
+
] })
|
|
169
|
+
] }),
|
|
170
|
+
HeaderActions ? /* @__PURE__ */ jsx(HeaderActions, { state, adapter, value: "list" }) : null,
|
|
171
|
+
/* @__PURE__ */ jsx("button", { type: "button", "data-list-focus": "new", "aria-label": labels.newChat, disabled: !state.harnesses.some((item) => item.startable), onClick: onNew, children: /* @__PURE__ */ jsx(UiIcon, { name: "plus", size: 18 }) }),
|
|
172
|
+
onClose ? /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx(UiIcon, { name: "close", size: 18 }) }) : null
|
|
173
|
+
] }),
|
|
174
|
+
state.startup !== "ready" ? /* @__PURE__ */ jsx(LoadingStatus, { state, compact: rows.length > 0 }) : null,
|
|
175
|
+
state.sessions.length > 4 || ListToolbarActions ? /* @__PURE__ */ jsxs("div", { className: "scui-list-toolbar", children: [
|
|
176
|
+
state.sessions.length > 4 ? /* @__PURE__ */ jsxs("label", { className: "scui-search", children: [
|
|
177
|
+
/* @__PURE__ */ jsx(UiIcon, { name: "search", size: 15 }),
|
|
178
|
+
/* @__PURE__ */ jsx("input", { type: "search", "aria-label": labels.searchChats, placeholder: labels.searchChats, value: query, onInput: (event) => {
|
|
179
|
+
const value = event.currentTarget.value;
|
|
180
|
+
setQuery(value);
|
|
181
|
+
boundedSet(sessionListMemory, memoryKey, { query: value, top: 0 });
|
|
182
|
+
if (rowScroller.current) rowScroller.current.scrollTop = 0;
|
|
183
|
+
} }),
|
|
184
|
+
query ? /* @__PURE__ */ jsx("small", { children: rows.length }) : null
|
|
185
|
+
] }) : null,
|
|
186
|
+
ListToolbarActions ? /* @__PURE__ */ jsx(ListToolbarActions, { state, adapter, value: { query, rows, onNew, canStart: state.harnesses.some((item) => item.startable) } }) : null
|
|
187
|
+
] }) : null,
|
|
188
|
+
/* @__PURE__ */ jsxs("div", { className: "scui-session-rows", ref: rowScroller, onScroll: (event) => boundedSet(sessionListMemory, memoryKey, { query, top: event.currentTarget.scrollTop }), children: [
|
|
189
|
+
BeforeSessions ? /* @__PURE__ */ jsx(BeforeSessions, { state, adapter, value: { query, rows } }) : null,
|
|
190
|
+
!rows.length && state.startup === "ready" ? /* @__PURE__ */ jsx("div", { className: "scui-empty", children: query ? "No chats match your search." : state.error ?? "No coding chats found." }) : null,
|
|
191
|
+
rows.map((row) => /* @__PURE__ */ jsx(Row, { value: row, row, state, adapter, onOpen, onOpenSubagents, now }, row.key)),
|
|
192
|
+
state.history.hasMoreSessions ? /* @__PURE__ */ jsx("button", { className: "scui-load", type: "button", disabled: loadingMore, onClick: loadMore, children: loadingMore ? "Loading older chats\u2026" : "Load older chats" }) : null,
|
|
193
|
+
AfterSessions ? /* @__PURE__ */ jsx(AfterSessions, { state, adapter, value: { query, rows } }) : null
|
|
194
|
+
] })
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export {
|
|
199
|
+
SessionRow,
|
|
200
|
+
SessionList
|
|
201
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HarnessLogo
|
|
3
|
+
} from "./chunk-TKTOVDXB.mjs";
|
|
4
|
+
import {
|
|
5
|
+
projectAgentActivity
|
|
6
|
+
} from "./chunk-LS6JBXNT.mjs";
|
|
7
|
+
|
|
8
|
+
// src/activity.jsx
|
|
9
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
10
|
+
function AgentActivityLauncher({ state, onOpen, class: className = "", showSummary = false, components = {} }) {
|
|
11
|
+
const value = projectAgentActivity(state);
|
|
12
|
+
const Logo = components.HarnessLogo ?? HarnessLogo;
|
|
13
|
+
const badge = value.unreadCount > 99 ? "99+" : String(value.unreadCount);
|
|
14
|
+
const label = [value.title, value.detail, value.unreadCount ? `${value.unreadCount} unread` : ""].filter(Boolean).join(" \xB7 ");
|
|
15
|
+
return /* @__PURE__ */ jsxs("button", { className: `scui-launcher ${className}`, "data-activity": value.activity, "data-unread-tone": value.unreadTone, type: "button", "aria-label": `Open ${label}`, onClick: () => onOpen?.(value), children: [
|
|
16
|
+
/* @__PURE__ */ jsxs("span", { className: "scui-launcher-logo", children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Logo, { id: value.harness || "supercode", activity: value.activity, size: 36 }),
|
|
18
|
+
value.unreadCount ? /* @__PURE__ */ jsx("b", { "aria-hidden": "true", children: badge }) : null
|
|
19
|
+
] }),
|
|
20
|
+
showSummary ? /* @__PURE__ */ jsxs("span", { className: "scui-launcher-copy", children: [
|
|
21
|
+
/* @__PURE__ */ jsx("strong", { children: value.title }),
|
|
22
|
+
/* @__PURE__ */ jsx("small", { children: value.detail })
|
|
23
|
+
] }) : null
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
AgentActivityLauncher
|
|
29
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HarnessLogo
|
|
3
|
+
} from "./chunk-TKTOVDXB.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Conversation
|
|
6
|
+
} from "./chunk-LOP6XOON.mjs";
|
|
7
|
+
import {
|
|
8
|
+
harnessDisplayName,
|
|
9
|
+
sessionDisplayName
|
|
10
|
+
} from "./chunk-LS6JBXNT.mjs";
|
|
11
|
+
import {
|
|
12
|
+
UiIcon
|
|
13
|
+
} from "./chunk-ZLYHUYE2.mjs";
|
|
14
|
+
|
|
15
|
+
// src/subagents.jsx
|
|
16
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
17
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
18
|
+
var ACTIVE_ACTIVITY = /* @__PURE__ */ new Set(["working", "running", "recent"]);
|
|
19
|
+
function activityLabel(activity, age) {
|
|
20
|
+
if (activity === "needs-input") return "Needs input";
|
|
21
|
+
if (activity === "failed") return "Failed";
|
|
22
|
+
if (activity === "unseen") return "New update";
|
|
23
|
+
if (activity === "working") return "Working";
|
|
24
|
+
if (activity === "running") return "Running";
|
|
25
|
+
if (activity === "recent") return "Recent";
|
|
26
|
+
if (activity === "finished") return "Finished";
|
|
27
|
+
return age;
|
|
28
|
+
}
|
|
29
|
+
function SubagentRow({ row, inspector, adapter }) {
|
|
30
|
+
return /* @__PURE__ */ jsxs("button", { className: "scui-subagent-row", type: "button", "data-activity": row.activity ?? "idle", onClick: () => adapter.onIntent({ action: "openSubagent", parentKey: inspector.parentKey, key: row.key }), children: [
|
|
31
|
+
/* @__PURE__ */ jsx(HarnessLogo, { id: row.harness, activity: row.activity, size: 30 }),
|
|
32
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
33
|
+
/* @__PURE__ */ jsx("strong", { children: sessionDisplayName(row) }),
|
|
34
|
+
/* @__PURE__ */ jsx("small", { children: row.preview || (row.activity === "working" ? "Working\u2026" : row.cwd) })
|
|
35
|
+
] }),
|
|
36
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
37
|
+
/* @__PURE__ */ jsx("small", { children: activityLabel(row.activity, row.age) }),
|
|
38
|
+
/* @__PURE__ */ jsx(UiIcon, { name: "chevron", size: 14 })
|
|
39
|
+
] })
|
|
40
|
+
] });
|
|
41
|
+
}
|
|
42
|
+
function SubagentSection({ label, rows, inspector, adapter }) {
|
|
43
|
+
if (!rows.length) return null;
|
|
44
|
+
return /* @__PURE__ */ jsxs("section", { className: "scui-subagent-section", "aria-labelledby": `scui-subagents-${label.toLowerCase().replaceAll(" ", "-")}`, children: [
|
|
45
|
+
/* @__PURE__ */ jsx("h2", { id: `scui-subagents-${label.toLowerCase().replaceAll(" ", "-")}`, children: label }),
|
|
46
|
+
rows.map((row) => /* @__PURE__ */ jsx(SubagentRow, { row, inspector, adapter }, row.key))
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
function SubagentInspectorContent({ state, adapter, onClose, inspector }) {
|
|
50
|
+
const selected = inspector.items.find((row) => row.key === inspector.selectedKey) ?? null;
|
|
51
|
+
const active = inspector.items.filter((row) => ACTIVE_ACTIVITY.has(row.activity));
|
|
52
|
+
const history = inspector.items.filter((row) => !ACTIVE_ACTIVITY.has(row.activity));
|
|
53
|
+
const [historyOpen, setHistoryOpen] = useState(false);
|
|
54
|
+
const backButton = useRef(null);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (inspector.status === "ready" && !active.length) setHistoryOpen(true);
|
|
57
|
+
}, [inspector.parentKey, inspector.status]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
backButton.current?.focus({ preventScroll: true });
|
|
60
|
+
}, [selected?.key]);
|
|
61
|
+
const detailState = selected ? {
|
|
62
|
+
...state,
|
|
63
|
+
transcript: inspector.transcript,
|
|
64
|
+
busy: selected.activity === "working",
|
|
65
|
+
needsInput: selected.activity === "needs-input",
|
|
66
|
+
harness: selected.harness,
|
|
67
|
+
mode: "mirror",
|
|
68
|
+
canSend: false,
|
|
69
|
+
canSteer: false,
|
|
70
|
+
canInterrupt: false,
|
|
71
|
+
canRespond: false,
|
|
72
|
+
taskPlan: { source: "none", items: [], residueCount: 0, observedAt: null },
|
|
73
|
+
semantics: { fidelity: null, residue: [], residueCount: 0, parseErrors: 0, rawRecords: 0, subagents: [] },
|
|
74
|
+
history: { ...state.history, hasEarlier: false }
|
|
75
|
+
} : null;
|
|
76
|
+
const leave = () => {
|
|
77
|
+
adapter.onIntent({ action: "closeSubagents" });
|
|
78
|
+
onClose();
|
|
79
|
+
};
|
|
80
|
+
const back = () => selected ? adapter.onIntent({ action: "openSubagents", key: inspector.parentKey }) : leave();
|
|
81
|
+
return /* @__PURE__ */ jsxs("section", { className: "scui-subagents", "aria-label": `Agents for ${inspector.parentTitle}`, children: [
|
|
82
|
+
/* @__PURE__ */ jsxs("header", { className: "scui-head", children: [
|
|
83
|
+
/* @__PURE__ */ jsx("button", { ref: backButton, type: "button", "aria-label": selected ? "Back to agents" : "Back to chats", onClick: back, children: /* @__PURE__ */ jsx(UiIcon, { name: "back", size: 17 }) }),
|
|
84
|
+
selected ? /* @__PURE__ */ jsx(HarnessLogo, { id: selected.harness, activity: selected.activity, size: 24 }) : /* @__PURE__ */ jsx(UiIcon, { name: "agents", size: 20 }),
|
|
85
|
+
/* @__PURE__ */ jsxs("span", { className: "scui-head-copy", children: [
|
|
86
|
+
/* @__PURE__ */ jsx("strong", { children: selected ? sessionDisplayName(selected) : "Agents" }),
|
|
87
|
+
/* @__PURE__ */ jsx("small", { children: selected ? `${harnessDisplayName(selected.harness)} \xB7 Read-only` : `${inspector.items.length} ${inspector.items.length === 1 ? "session" : "sessions"} \xB7 ${inspector.parentTitle}` })
|
|
88
|
+
] })
|
|
89
|
+
] }),
|
|
90
|
+
inspector.status === "loading" ? /* @__PURE__ */ jsxs("div", { className: "scui-subagents-loading", role: "status", children: [
|
|
91
|
+
/* @__PURE__ */ jsx("i", {}),
|
|
92
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
93
|
+
/* @__PURE__ */ jsx("strong", { children: selected ? "Loading subagent" : "Finding subagents" }),
|
|
94
|
+
/* @__PURE__ */ jsx("small", { children: selected ? "Reading a bounded recent transcript\u2026" : "Reading native session relationships\u2026" })
|
|
95
|
+
] })
|
|
96
|
+
] }) : null,
|
|
97
|
+
inspector.error ? /* @__PURE__ */ jsx("div", { className: "scui-error", role: "alert", children: inspector.error }) : null,
|
|
98
|
+
!selected && inspector.status === "ready" && inspector.items.length ? /* @__PURE__ */ jsxs("div", { className: "scui-subagent-rows", children: [
|
|
99
|
+
/* @__PURE__ */ jsx(SubagentSection, { label: "Active", rows: active, inspector, adapter }),
|
|
100
|
+
history.length ? /* @__PURE__ */ jsxs("details", { className: "scui-subagent-history", open: historyOpen, onToggle: (event) => setHistoryOpen(event.currentTarget.open), children: [
|
|
101
|
+
/* @__PURE__ */ jsxs("summary", { children: [
|
|
102
|
+
/* @__PURE__ */ jsx("span", { children: "History" }),
|
|
103
|
+
/* @__PURE__ */ jsx("small", { children: history.length }),
|
|
104
|
+
/* @__PURE__ */ jsx(UiIcon, { name: "chevron", size: 14 })
|
|
105
|
+
] }),
|
|
106
|
+
/* @__PURE__ */ jsx("div", { children: history.map((row) => /* @__PURE__ */ jsx(SubagentRow, { row, inspector, adapter }, row.key)) })
|
|
107
|
+
] }) : null
|
|
108
|
+
] }) : null,
|
|
109
|
+
!selected && inspector.status === "ready" && !inspector.items.length ? /* @__PURE__ */ jsx("div", { className: "scui-empty", children: "No native child sessions were found." }) : null,
|
|
110
|
+
selected && inspector.status === "ready" && detailState ? /* @__PURE__ */ jsx(Conversation, { state: detailState, adapter, memoryKey: `subagent:${selected.key}` }) : null
|
|
111
|
+
] });
|
|
112
|
+
}
|
|
113
|
+
function SubagentInspector({ state, adapter, onClose }) {
|
|
114
|
+
if (!state.subagentInspector) return null;
|
|
115
|
+
return /* @__PURE__ */ jsx(SubagentInspectorContent, { state, adapter, onClose, inspector: state.subagentInspector });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
SubagentInspector
|
|
120
|
+
};
|