@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.
Files changed (51) hide show
  1. package/README.md +37 -1
  2. package/activity.mjs +5 -1235
  3. package/chunks/chunk-ATCOWFRV.mjs +105 -0
  4. package/chunks/chunk-LOP6XOON.mjs +671 -0
  5. package/chunks/chunk-LQMYNJPU.mjs +120 -0
  6. package/chunks/chunk-LS6JBXNT.mjs +1237 -0
  7. package/chunks/chunk-O7Q2PELK.mjs +201 -0
  8. package/chunks/chunk-OW42DS6P.mjs +842 -0
  9. package/chunks/chunk-SJ3YTA6Z.mjs +316 -0
  10. package/chunks/chunk-SSYNT434.mjs +224 -0
  11. package/chunks/chunk-V3UM7H7W.mjs +328 -0
  12. package/chunks/chunk-XD2WJYSL.mjs +29 -0
  13. package/chunks/chunk-ZLYHUYE2.mjs +62 -0
  14. package/components.d.ts +3 -0
  15. package/components.mjs +59 -3766
  16. package/composer.mjs +8 -580
  17. package/conversation.mjs +16 -1373
  18. package/embed.mjs +15 -3681
  19. package/icon.mjs +3 -58
  20. package/index.d.ts +25 -0
  21. package/logo.mjs +5 -87
  22. package/messenger.d.ts +3 -0
  23. package/messenger.mjs +21 -3677
  24. package/package.json +3 -2
  25. package/react/activity.mjs +5 -1235
  26. package/react/chunks/chunk-2RIHDJT6.mjs +842 -0
  27. package/react/chunks/chunk-7ES5FSLG.mjs +316 -0
  28. package/react/chunks/chunk-GV5KV5UY.mjs +105 -0
  29. package/react/chunks/chunk-GYQOTTZ5.mjs +224 -0
  30. package/react/chunks/chunk-LS6JBXNT.mjs +1237 -0
  31. package/react/chunks/chunk-OINC7LV7.mjs +62 -0
  32. package/react/chunks/chunk-TQHX2DQG.mjs +120 -0
  33. package/react/chunks/chunk-UKHDCPME.mjs +328 -0
  34. package/react/chunks/chunk-UKMTRNJN.mjs +671 -0
  35. package/react/chunks/chunk-ZM5X5LOF.mjs +29 -0
  36. package/react/chunks/chunk-ZXD7NZXI.mjs +201 -0
  37. package/react/components.mjs +59 -3766
  38. package/react/composer.mjs +8 -580
  39. package/react/conversation.mjs +16 -1373
  40. package/react/icon.mjs +3 -58
  41. package/react/index.d.ts +25 -0
  42. package/react/logo.mjs +5 -87
  43. package/react/messenger.d.ts +3 -0
  44. package/react/messenger.mjs +21 -3677
  45. package/react/sessions.mjs +9 -519
  46. package/react/settings.mjs +9 -425
  47. package/react/subagents.mjs +8 -1546
  48. package/sessions.mjs +9 -519
  49. package/settings.mjs +9 -425
  50. package/styles.css +12 -0
  51. package/subagents.mjs +8 -1546
@@ -0,0 +1,29 @@
1
+ import {
2
+ HarnessLogo
3
+ } from "./chunk-GV5KV5UY.mjs";
4
+ import {
5
+ projectAgentActivity
6
+ } from "./chunk-LS6JBXNT.mjs";
7
+
8
+ // src/activity.jsx
9
+ import { jsx, jsxs } from "react/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,201 @@
1
+ import {
2
+ HarnessLogo
3
+ } from "./chunk-GV5KV5UY.mjs";
4
+ import {
5
+ LoadingStatus
6
+ } from "./chunk-UKMTRNJN.mjs";
7
+ import {
8
+ boundedSet,
9
+ uiMemory
10
+ } from "./chunk-UKHDCPME.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-OINC7LV7.mjs";
22
+
23
+ // src/sessions.jsx
24
+ import { useEffect, useLayoutEffect, useRef, useState } from "react";
25
+ import { jsx, jsxs } from "react/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
+ };