@markmo/europacore-session-ui 0.2.0 → 0.4.0
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 +1 -1
- package/dist/ArtifactsPage-BxaqShTv.js +1178 -0
- package/dist/{BoardPage-BAQrGP7G.js → BoardPage-DH7p5o99.js} +274 -265
- package/dist/{CardDetail-CCgP8R61.js → CardDetail-LfDCJQhS.js} +42 -33
- package/dist/{ComparePage-FcLLhKzC.js → ComparePage-CrbCyu4u.js} +33 -33
- package/dist/MemoriesPage-BRA53Hlb.js +679 -0
- package/dist/{OverviewPage-CbfbyGNT.js → OverviewPage-BSBqY83_.js} +50 -49
- package/dist/{RegisterPage-3-hJNQEV.js → RegisterPage-64yGl9E-.js} +76 -76
- package/dist/SessionPage-C4hSlxWQ.js +906 -0
- package/dist/api/agentClient.d.ts +66 -1
- package/dist/api/wire.d.ts +540 -4
- package/dist/features/artifacts/ArtifactDetail.d.ts +15 -0
- package/dist/features/artifacts/ArtifactDialogs.d.ts +29 -0
- package/dist/features/artifacts/ArtifactLedger.d.ts +11 -0
- package/dist/features/artifacts/ArtifactStats.d.ts +9 -0
- package/dist/features/artifacts/ArtifactsPage.d.ts +1 -0
- package/dist/features/artifacts/artifactsCommands.d.ts +3 -0
- package/dist/features/artifacts/artifactsStore.d.ts +27 -0
- package/dist/features/artifacts/artifactsUi.d.ts +33 -0
- package/dist/features/bootstrap.d.ts +1 -0
- package/dist/features/chat/model/artifactAccess.d.ts +50 -0
- package/dist/features/chat/model/artifactCsv.d.ts +11 -0
- package/dist/features/chat/model/artifactExport.d.ts +45 -0
- package/dist/features/chat/model/artifactStats.d.ts +79 -0
- package/dist/features/chat/model/artifacts.d.ts +151 -0
- package/dist/features/chat/model/claims.d.ts +102 -0
- package/dist/features/chat/model/contextSources.d.ts +41 -0
- package/dist/features/chat/model/entries.d.ts +37 -2
- package/dist/features/chat/model/fleet.d.ts +11 -0
- package/dist/features/chat/model/format.d.ts +6 -0
- package/dist/features/chat/model/inspect.d.ts +11 -0
- package/dist/features/chat/model/memory.d.ts +3 -3
- package/dist/features/chat/model/memoryRecords.d.ts +79 -0
- package/dist/features/chat/model/monitors.d.ts +11 -0
- package/dist/features/chat/model/progress.d.ts +73 -0
- package/dist/features/chat/model/routing.d.ts +20 -0
- package/dist/features/chat/model/store.d.ts +5 -0
- package/dist/features/chat/model/tasks.d.ts +1 -1
- package/dist/features/chat/panels/ProgressPanel.d.ts +8 -0
- package/dist/features/chat/session/ComposerHistory.d.ts +1 -1
- package/dist/features/chat/session/SessionController.d.ts +3 -2
- package/dist/features/chat/session/useFileMentions.d.ts +18 -5
- package/dist/features/chat/transcript/ArtifactCard.d.ts +8 -0
- package/dist/features/chat/transcript/Rows.d.ts +12 -1
- package/dist/features/commands/InspectDialog.d.ts +3 -0
- package/dist/features/commands/dialogs.d.ts +1 -1
- package/dist/features/commands/registry.d.ts +1 -1
- package/dist/features/memories/MemoriesPage.d.ts +1 -0
- package/dist/features/memories/memoriesCommands.d.ts +3 -0
- package/dist/features/memories/memoriesController.d.ts +81 -0
- package/dist/features/memory/MemoryDialog.d.ts +1 -1
- package/dist/features/memory/memoryService.d.ts +10 -10
- package/dist/features/workspace/claimsCommands.d.ts +26 -0
- package/dist/features/workspace/collisionsWatcher.d.ts +7 -0
- package/dist/features/workspace/useSessionPageHooks.d.ts +1 -1
- package/dist/{index-NjGO7Jg1.js → index-CMPf-3JZ.js} +4821 -3447
- package/dist/index.d.ts +2 -0
- package/dist/index.js +86 -82
- package/dist/lib/paths.d.ts +12 -0
- package/dist/lib/zip.d.ts +14 -0
- package/dist/{promptHistory-DjSCHmEk.js → promptHistory-BR0NpLCI.js} +14 -14
- package/package.json +1 -1
- package/dist/SessionPage-CA9hAakW.js +0 -865
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
import { jsxs as g, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as H, useEffect as C, useRef as z, useState as S, useCallback as U, useLayoutEffect as te, memo as Ve, useId as Ie, useSyncExternalStore as Ae } from "react";
|
|
3
|
+
import { useParams as We, useSearchParams as qe, useNavigate as ae } from "react-router";
|
|
4
|
+
import { Sparkles as Ge, ArrowDown as Je, CircleSlash as Qe, X as Me, ImagePlus as Ye, ListPlus as Xe, Square as Ze, ArrowUp as et, RefreshCw as tt, Loader2 as nt, Pause as st, MessageSquareDashed as he, PanelRightClose as at, PanelRight as rt } from "lucide-react";
|
|
5
|
+
import { c as G, s as Te, i as ge, u as B, C as D, a as P, L as R, t as it, U as ot, D as ct, b as lt, A as ut, W as dt, T as ft, R as mt, d as pt, S as ht, P as gt, M as xt, N as wt, e as bt, f as yt, B as kt, r as vt, g as Nt, h as St, j as Dt, l as Et, k as Ct, m as It, o as At, n as $e, p as Mt, q as Tt, v as $t, w as Rt, x as Pt, I as ne, y as zt, z as xe, E as Ft, F as we, G as Re, H as X, J as Lt, K as M, O as J, Q as _t, V as be, X as Pe, Y as Kt, Z as Bt, _ as Ot, $ as Ut, a0 as Ht, a1 as jt, a2 as Vt, a3 as Wt, a4 as ye, a5 as qt, a6 as ke, a7 as Gt } from "./index-CMPf-3JZ.js";
|
|
6
|
+
import { p as re, w as Jt, P as Qt } from "./promptHistory-BR0NpLCI.js";
|
|
7
|
+
function Yt({ onPick: e }) {
|
|
8
|
+
const n = (Te().userName() || "").split(" ")[0];
|
|
9
|
+
return /* @__PURE__ */ g("div", { className: "mx-auto flex w-full max-w-3xl flex-1 flex-col justify-center px-4 py-10 sm:px-6", children: [
|
|
10
|
+
/* @__PURE__ */ g("div", { className: "mb-7 flex flex-col items-start gap-3", children: [
|
|
11
|
+
/* @__PURE__ */ t("span", { className: "flex h-10 w-10 items-center justify-center rounded-xl bg-accent text-on-accent", children: /* @__PURE__ */ t(Ge, { size: 19 }) }),
|
|
12
|
+
/* @__PURE__ */ t("h1", { className: "text-[26px] leading-tight font-semibold text-ink", children: n ? `How can I help, ${n}?` : "How can I help?" }),
|
|
13
|
+
/* @__PURE__ */ t("p", { className: "text-[13.5px] text-muted", children: "Ask anything. The assistant can use tools, and it will ask before doing anything with side effects." })
|
|
14
|
+
] }),
|
|
15
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: G.suggestions.map((i) => /* @__PURE__ */ g(
|
|
16
|
+
"button",
|
|
17
|
+
{
|
|
18
|
+
type: "button",
|
|
19
|
+
onClick: () => e(i.prompt),
|
|
20
|
+
className: "rounded-xl border border-line bg-surface px-3.5 py-3 text-left transition-colors hover:border-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ t("div", { className: "text-[13.5px] font-semibold text-ink", children: i.title }),
|
|
23
|
+
i.description && /* @__PURE__ */ t("div", { className: "mt-0.5 text-[12.5px] text-muted", children: i.description })
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
i.title
|
|
27
|
+
)) })
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
function ze(e) {
|
|
31
|
+
const n = H(() => [...new Set(ge().flatMap((i) => i.keys ?? []))], []);
|
|
32
|
+
return B(e, D.session, D.reset, D.workspace, D.fleet, ...n), ge().filter((i) => i.available(e));
|
|
33
|
+
}
|
|
34
|
+
function ve({
|
|
35
|
+
controller: e,
|
|
36
|
+
tab: n,
|
|
37
|
+
onTab: i,
|
|
38
|
+
className: o
|
|
39
|
+
}) {
|
|
40
|
+
const d = ze(e), c = d.find((l) => l.id === n) ?? d[0];
|
|
41
|
+
if (C(() => {
|
|
42
|
+
c && c.id !== n && i(c.id);
|
|
43
|
+
}, [c, n, i]), !c) return null;
|
|
44
|
+
const a = c.Component;
|
|
45
|
+
return /* @__PURE__ */ g("div", { className: P("flex min-h-0 flex-col", o), children: [
|
|
46
|
+
/* @__PURE__ */ t("div", { role: "tablist", "aria-label": "Session panels", className: "flex shrink-0 gap-0.5 overflow-x-auto border-b border-line px-2 pt-1.5", children: d.map((l) => {
|
|
47
|
+
const f = l.icon, r = l.badge?.(e) ?? null, m = l.id === c.id;
|
|
48
|
+
return /* @__PURE__ */ g(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
type: "button",
|
|
52
|
+
role: "tab",
|
|
53
|
+
"aria-selected": m,
|
|
54
|
+
onClick: () => i(l.id),
|
|
55
|
+
className: P(
|
|
56
|
+
"-mb-px inline-flex h-9 shrink-0 items-center gap-1.5 border-b-2 px-2.5 text-[12.5px] font-semibold transition-colors",
|
|
57
|
+
m ? "border-accent text-ink" : "border-transparent text-muted hover:text-ink"
|
|
58
|
+
),
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ t(f, { size: 14 }),
|
|
61
|
+
l.label,
|
|
62
|
+
r !== null && /* @__PURE__ */ t("span", { className: "rounded-full bg-accent-soft px-1.5 text-[10.5px] text-accent tabular-nums", children: r })
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
l.id
|
|
66
|
+
);
|
|
67
|
+
}) }),
|
|
68
|
+
/* @__PURE__ */ t("div", { role: "tabpanel", className: "min-h-0 flex-1 overflow-y-auto p-3", children: /* @__PURE__ */ t(a, { controller: e }) })
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
const Xt = 80, Zt = Ve(function({
|
|
72
|
+
controller: n,
|
|
73
|
+
block: i,
|
|
74
|
+
live: o
|
|
75
|
+
}) {
|
|
76
|
+
const d = lt(i.items), c = i.items.find((f) => f.kind === "entry" && f.entry.kind === "run-end"), a = c?.kind === "entry" && c.entry.kind === "run-end" && c.entry.outcome === "cancelled", l = d ? n.store.get(d) : void 0;
|
|
77
|
+
return /* @__PURE__ */ t("div", { className: "group", children: /* @__PURE__ */ g(
|
|
78
|
+
ut,
|
|
79
|
+
{
|
|
80
|
+
header: a ? /* @__PURE__ */ g(kt, { children: [
|
|
81
|
+
/* @__PURE__ */ t(Qe, { size: 11 }),
|
|
82
|
+
" Stopped"
|
|
83
|
+
] }) : void 0,
|
|
84
|
+
children: [
|
|
85
|
+
i.wake && /* @__PURE__ */ t(dt, { entry: i.wake }),
|
|
86
|
+
i.items.map((f) => {
|
|
87
|
+
if (f.kind === "tools") return /* @__PURE__ */ t(ft, { controller: n, entries: f.entries }, f.key);
|
|
88
|
+
const r = f.entry;
|
|
89
|
+
switch (r.kind) {
|
|
90
|
+
case "assistant":
|
|
91
|
+
return /* @__PURE__ */ t(bt, { controller: n, entry: r, answer: r.key === d }, r.key);
|
|
92
|
+
case "notice":
|
|
93
|
+
return /* @__PURE__ */ t(wt, { entry: r }, r.key);
|
|
94
|
+
case "monitor":
|
|
95
|
+
return /* @__PURE__ */ t(xt, { entry: r }, r.key);
|
|
96
|
+
case "peer":
|
|
97
|
+
return /* @__PURE__ */ t(gt, { entry: r }, r.key);
|
|
98
|
+
case "steer":
|
|
99
|
+
return /* @__PURE__ */ t(ht, { controller: n, entry: r }, r.key);
|
|
100
|
+
case "decision":
|
|
101
|
+
return /* @__PURE__ */ t(pt, { controller: n, entry: r }, r.key);
|
|
102
|
+
case "run-end":
|
|
103
|
+
return /* @__PURE__ */ t(mt, { entry: r }, r.key);
|
|
104
|
+
default:
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
!o && l?.kind === "assistant" && l.text && /* @__PURE__ */ t("div", { className: "-mt-1 -ml-1.5 flex items-center gap-0.5 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 max-sm:opacity-100", children: /* @__PURE__ */ t(yt, { text: l.text, label: "Copy answer" }) })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
) });
|
|
112
|
+
});
|
|
113
|
+
function en({
|
|
114
|
+
controller: e,
|
|
115
|
+
onEdit: n,
|
|
116
|
+
footer: i,
|
|
117
|
+
renderDiff: o
|
|
118
|
+
}) {
|
|
119
|
+
const d = B(e, R.list, D.run), c = e.store.state.entries, a = H(() => it(c), [d, c]), l = e.running(), f = e.store.state.run?.id ?? null, r = z(null), m = z(null), p = z(!0), k = z(0), [h, b] = S(!1), y = U((w = "auto") => {
|
|
120
|
+
const x = r.current;
|
|
121
|
+
x && x.scrollTo({ top: x.scrollHeight, behavior: w });
|
|
122
|
+
}, []), E = () => {
|
|
123
|
+
const w = r.current;
|
|
124
|
+
if (!w) return;
|
|
125
|
+
const x = w.scrollHeight - w.scrollTop - w.clientHeight < Xt, T = w.scrollTop < k.current - 2;
|
|
126
|
+
k.current = w.scrollTop, x ? p.current = !0 : T && (p.current = !1), b(!p.current);
|
|
127
|
+
};
|
|
128
|
+
C(() => {
|
|
129
|
+
const w = m.current;
|
|
130
|
+
if (!w || typeof ResizeObserver > "u") return;
|
|
131
|
+
const x = new ResizeObserver(() => {
|
|
132
|
+
p.current && y();
|
|
133
|
+
});
|
|
134
|
+
return x.observe(w), () => x.disconnect();
|
|
135
|
+
}, [y]);
|
|
136
|
+
const F = a[a.length - 1];
|
|
137
|
+
return te(() => {
|
|
138
|
+
F?.kind === "user" && (p.current = !0, b(!1)), p.current && y();
|
|
139
|
+
}, [F?.key, F?.kind, y]), te(() => {
|
|
140
|
+
p.current = !0, b(!1), y();
|
|
141
|
+
}, [e, y]), /* @__PURE__ */ g("div", { className: "relative min-h-0 flex-1", children: [
|
|
142
|
+
/* @__PURE__ */ t("div", { ref: r, onScroll: E, className: "h-full overflow-y-auto overscroll-contain", children: /* @__PURE__ */ g(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
ref: m,
|
|
146
|
+
role: "log",
|
|
147
|
+
"aria-live": "polite",
|
|
148
|
+
"aria-relevant": "additions",
|
|
149
|
+
"aria-label": "Conversation",
|
|
150
|
+
className: "mx-auto flex w-full max-w-3xl flex-col gap-5 px-4 pt-6 pb-8 sm:px-6",
|
|
151
|
+
children: [
|
|
152
|
+
a.map((w) => w.kind === "user" ? /* @__PURE__ */ t(ot, { controller: e, entry: w.entry, onEdit: l ? void 0 : n }, w.key) : w.kind === "diff" ? /* @__PURE__ */ t(ct, { entry: w.entry, renderDiff: o }, w.key) : /* @__PURE__ */ t(Zt, { controller: e, block: w, live: l && w.runId === f }, w.key)),
|
|
153
|
+
i
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
) }),
|
|
157
|
+
h && /* @__PURE__ */ g(
|
|
158
|
+
"button",
|
|
159
|
+
{
|
|
160
|
+
type: "button",
|
|
161
|
+
onClick: () => {
|
|
162
|
+
p.current = !0, b(!1), y("smooth");
|
|
163
|
+
},
|
|
164
|
+
className: "absolute bottom-3 left-1/2 inline-flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-line bg-surface px-3 py-1.5 text-[12px] font-semibold text-ink shadow-pop hover:bg-surface-hover",
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ t(Je, { size: 13 }),
|
|
167
|
+
" Jump to latest"
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
] });
|
|
172
|
+
}
|
|
173
|
+
const tn = 1536, nn = /^image\/(png|jpe?g|gif|webp)$/;
|
|
174
|
+
function Ne(e) {
|
|
175
|
+
return nn.test(e.type);
|
|
176
|
+
}
|
|
177
|
+
async function sn(e, n = tn) {
|
|
178
|
+
const i = await new Promise((l, f) => {
|
|
179
|
+
const r = new FileReader();
|
|
180
|
+
r.onload = () => l(String(r.result)), r.onerror = () => f(r.error), r.readAsDataURL(e);
|
|
181
|
+
});
|
|
182
|
+
if (e.type === "image/gif") return { kind: "image", name: e.name, url: i };
|
|
183
|
+
const o = await new Promise((l, f) => {
|
|
184
|
+
const r = new Image();
|
|
185
|
+
r.onload = () => l(r), r.onerror = f, r.src = i;
|
|
186
|
+
}), d = Math.min(1, n / Math.max(o.width, o.height));
|
|
187
|
+
if (d === 1 && e.size < 15e5) return { kind: "image", name: e.name, url: i };
|
|
188
|
+
const c = document.createElement("canvas");
|
|
189
|
+
c.width = Math.round(o.width * d), c.height = Math.round(o.height * d), c.getContext("2d").drawImage(o, 0, 0, c.width, c.height);
|
|
190
|
+
const a = e.type === "image/png" ? "image/png" : "image/jpeg";
|
|
191
|
+
return { kind: "image", name: e.name, url: c.toDataURL(a, 0.88) };
|
|
192
|
+
}
|
|
193
|
+
function Se(e, n, i) {
|
|
194
|
+
return i === 0 ? 0 : (e + n + i) % i;
|
|
195
|
+
}
|
|
196
|
+
const an = 200;
|
|
197
|
+
function rn(e, n, i) {
|
|
198
|
+
const o = z(null);
|
|
199
|
+
C(() => {
|
|
200
|
+
const a = o.current;
|
|
201
|
+
a && a.list[a.index] !== e && (o.current = null);
|
|
202
|
+
}, [e]);
|
|
203
|
+
const d = (a, l) => {
|
|
204
|
+
n(a), requestAnimationFrame(() => {
|
|
205
|
+
const f = i.current;
|
|
206
|
+
if (!f) return;
|
|
207
|
+
const r = l ? 0 : a.length;
|
|
208
|
+
f.setSelectionRange(r, r);
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
return { onKeyDown: (a) => {
|
|
212
|
+
if (a.altKey || a.ctrlKey || a.metaKey || a.shiftKey || a.key !== "ArrowUp" && a.key !== "ArrowDown") return !1;
|
|
213
|
+
const l = a.currentTarget;
|
|
214
|
+
if (l.selectionStart !== l.selectionEnd) return !1;
|
|
215
|
+
const f = l.value.slice(0, l.selectionStart), r = l.value.slice(l.selectionEnd);
|
|
216
|
+
if (a.key === "ArrowUp") {
|
|
217
|
+
if (f.includes(`
|
|
218
|
+
`)) return !1;
|
|
219
|
+
const p = o.current ?? { list: re.recent(), index: -1, draft: e }, k = p.index === -1 ? p.list.length - 1 : p.index - 1;
|
|
220
|
+
return k < 0 ? !1 : (o.current = { ...p, index: k }, a.preventDefault(), d(p.list[k], !0), !0);
|
|
221
|
+
}
|
|
222
|
+
const m = o.current;
|
|
223
|
+
return !m || r.includes(`
|
|
224
|
+
`) ? !1 : (a.preventDefault(), m.index + 1 >= m.list.length ? (o.current = null, d(m.draft, !1)) : (o.current = { ...m, index: m.index + 1 }, d(m.list[m.index + 1], !1)), !0);
|
|
225
|
+
}, reset: () => {
|
|
226
|
+
o.current = null;
|
|
227
|
+
} };
|
|
228
|
+
}
|
|
229
|
+
function on({ workspace: e, onPick: n, onClose: i }) {
|
|
230
|
+
const [o, d] = S(""), [c, a] = S(0), l = H(() => re.search("", e).slice(0, an), [e]), f = o.toLowerCase().split(/\s+/).filter(Boolean), r = l.filter((h) => f.every((b) => h.text.toLowerCase().includes(b))), m = Math.min(c, Math.max(0, r.length - 1)), p = (h) => {
|
|
231
|
+
const b = r[h];
|
|
232
|
+
b && n(b.text);
|
|
233
|
+
}, k = Ie();
|
|
234
|
+
return /* @__PURE__ */ g("div", { className: "absolute bottom-full left-0 z-20 mb-2 w-full rounded-xl border border-line bg-surface p-1.5 shadow-pop", children: [
|
|
235
|
+
/* @__PURE__ */ t(
|
|
236
|
+
"input",
|
|
237
|
+
{
|
|
238
|
+
autoFocus: !0,
|
|
239
|
+
value: o,
|
|
240
|
+
onChange: (h) => {
|
|
241
|
+
d(h.target.value), a(0);
|
|
242
|
+
},
|
|
243
|
+
onKeyDown: (h) => {
|
|
244
|
+
h.key === "ArrowDown" || h.key === "r" && h.ctrlKey ? (h.preventDefault(), a(Math.min(r.length - 1, m + 1))) : h.key === "ArrowUp" ? (h.preventDefault(), a(Math.max(0, m - 1))) : h.key === "Enter" ? (h.preventDefault(), p(m)) : h.key === "Escape" && (h.preventDefault(), i());
|
|
245
|
+
},
|
|
246
|
+
onBlur: i,
|
|
247
|
+
placeholder: "Search the prompts you have sent",
|
|
248
|
+
"aria-label": "Search prompt history",
|
|
249
|
+
"aria-controls": r.length ? k : void 0,
|
|
250
|
+
"aria-activedescendant": r.length ? `${k}-${m}` : void 0,
|
|
251
|
+
"aria-autocomplete": "list",
|
|
252
|
+
className: "mb-1 h-8 w-full rounded-md border border-line bg-surface px-2 text-[13px] text-ink placeholder:text-faint focus:border-accent focus:outline-none"
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
r.length === 0 ? /* @__PURE__ */ t("p", { className: "px-2.5 py-2 text-[12.5px] text-muted", children: l.length ? "No prompt has those words." : "No prompts sent yet." }) : /* @__PURE__ */ t("div", { id: k, role: "listbox", "aria-label": "Prompt history", className: "max-h-64 overflow-y-auto", children: r.map((h, b) => (
|
|
256
|
+
// biome-ignore lint/a11y/useFocusableInteractive: a combobox option; focus stays in the search box (aria-activedescendant)
|
|
257
|
+
/* @__PURE__ */ g(
|
|
258
|
+
"div",
|
|
259
|
+
{
|
|
260
|
+
id: `${k}-${b}`,
|
|
261
|
+
role: "option",
|
|
262
|
+
"aria-selected": b === m,
|
|
263
|
+
onMouseDown: (y) => {
|
|
264
|
+
y.preventDefault(), p(b);
|
|
265
|
+
},
|
|
266
|
+
onMouseEnter: () => a(b),
|
|
267
|
+
className: P("flex cursor-pointer items-baseline gap-2 rounded-md px-2.5 py-1.5 text-[13px]", b === m && "bg-accent-soft"),
|
|
268
|
+
children: [
|
|
269
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-ink", children: h.text.replace(/\s+/g, " ") }),
|
|
270
|
+
/* @__PURE__ */ g("span", { className: "shrink-0 text-[11px] text-faint", children: [
|
|
271
|
+
vt(new Date(h.at).toISOString()),
|
|
272
|
+
h.workspace && h.workspace !== e ? ` · ${h.workspace.split("/").pop()}` : ""
|
|
273
|
+
] })
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
`${h.at}-${b}`
|
|
277
|
+
)
|
|
278
|
+
)) })
|
|
279
|
+
] });
|
|
280
|
+
}
|
|
281
|
+
const se = "artifact:", cn = 5;
|
|
282
|
+
function ln(e) {
|
|
283
|
+
const n = /(?:^|\s)@([^\s@]*)$/.exec(e);
|
|
284
|
+
return n ? n[1] : null;
|
|
285
|
+
}
|
|
286
|
+
function un(e, n) {
|
|
287
|
+
return e.replace(/@([^\s@]*)$/, `@${n} `);
|
|
288
|
+
}
|
|
289
|
+
function De(e, n, i) {
|
|
290
|
+
const o = n.toLowerCase().split(/\s+/).filter(Boolean);
|
|
291
|
+
return e.filter((d) => {
|
|
292
|
+
const c = Ct(d, null).toLowerCase();
|
|
293
|
+
return o.every((a) => c.includes(a));
|
|
294
|
+
}).slice(0, i).map((d) => ({ value: `${se}${d.id}`, label: `${It(d.format)} ${At(d.title)}`, detail: d.id, kind: "artifact" }));
|
|
295
|
+
}
|
|
296
|
+
function dn(e, n) {
|
|
297
|
+
const [i, o] = S([]), d = Te().workspaces, c = n?.startsWith(se) ?? !1, a = n !== null && !c && e.hasWorkspace() && d !== null, l = n !== null && Nt().info?.capabilities.artifacts === !0, f = Ae(St, Dt);
|
|
298
|
+
if (C(() => {
|
|
299
|
+
l && !f.loaded && !f.loading && Et(e.id, !0);
|
|
300
|
+
}, [l, f.loaded, f.loading, e]), C(() => {
|
|
301
|
+
if (!a) {
|
|
302
|
+
o([]);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
let p = !1;
|
|
306
|
+
const k = setTimeout(() => {
|
|
307
|
+
d.files(e.id, n ?? "").then((h) => !p && o(h.slice(0, 30))).catch(() => !p && o([]));
|
|
308
|
+
}, 120);
|
|
309
|
+
return () => {
|
|
310
|
+
p = !0, clearTimeout(k);
|
|
311
|
+
};
|
|
312
|
+
}, [e, a, n, d]), n === null) return [];
|
|
313
|
+
const r = a ? i.map((p) => ({ value: p, label: p, kind: "file" })) : [];
|
|
314
|
+
if (!l) return r;
|
|
315
|
+
const m = [...f.list, ...f.shared];
|
|
316
|
+
return c ? De(m, n.slice(se.length), 20) : n ? [...r, ...De(m, n, cn)] : r;
|
|
317
|
+
}
|
|
318
|
+
function fn(e) {
|
|
319
|
+
const n = /^\/([\w.:-]*)$/.exec(e);
|
|
320
|
+
return n ? n[1].toLowerCase() : null;
|
|
321
|
+
}
|
|
322
|
+
function mn({ controller: e, commandContext: n, disabled: i, autoFocus: o, registerHandle: d }) {
|
|
323
|
+
const { toast: c } = $e(), a = B(e, R.commands);
|
|
324
|
+
B(e, D.run, D.pause, R.images, R.draft, R.followUps), Ae(Mt, Tt);
|
|
325
|
+
const l = e.running(), f = e.agent?.accepts_images ?? !0, r = f ? Math.min(e.agent?.image_limits?.max_count ?? G.maxImages, G.maxImages) : 0, m = e.images, [p, k] = S(e.draft), [h, b] = S(!1), [y, E] = S(0), [F, w] = S(!1), [x, T] = S(!1), v = z(null), V = z(null), L = Ie(), I = U(
|
|
326
|
+
(s) => {
|
|
327
|
+
k(s), e.setDraft(s);
|
|
328
|
+
},
|
|
329
|
+
[e]
|
|
330
|
+
), Fe = e.version(R.draft);
|
|
331
|
+
C(() => {
|
|
332
|
+
k(e.draft);
|
|
333
|
+
}, [e, Fe]), te(() => {
|
|
334
|
+
const s = v.current;
|
|
335
|
+
s && (s.style.height = "auto", s.style.height = `${Math.min(s.scrollHeight, 240)}px`);
|
|
336
|
+
}, [p]);
|
|
337
|
+
const _ = H(
|
|
338
|
+
() => ({
|
|
339
|
+
...n,
|
|
340
|
+
controller: e,
|
|
341
|
+
setComposer: (s) => {
|
|
342
|
+
I(s), requestAnimationFrame(() => {
|
|
343
|
+
const u = v.current;
|
|
344
|
+
u && (u.focus(), u.setSelectionRange(u.value.length, u.value.length));
|
|
345
|
+
});
|
|
346
|
+
},
|
|
347
|
+
pickImages: () => V.current?.click()
|
|
348
|
+
}),
|
|
349
|
+
[n, e, I]
|
|
350
|
+
);
|
|
351
|
+
C(() => (d?.({ setText: _.setComposer, pickImages: _.pickImages, focus: () => v.current?.focus() }), () => d?.(null)), [_, d]);
|
|
352
|
+
const ie = rn(p, I, v), oe = e.session?.workspace ?? e.newSession.workspace?.path ?? null, Q = F ? null : fn(p), $ = H(
|
|
353
|
+
() => Q === null ? [] : $t([...Rt(_), ...Pt(e)], Q).slice(0, 40),
|
|
354
|
+
[Q, _, e, a]
|
|
355
|
+
), O = $.length > 0, Le = O || F ? null : ln(p), K = dn(e, Le), W = !O && K.length > 0, ce = (s) => {
|
|
356
|
+
const u = K[Math.min(s, K.length - 1)];
|
|
357
|
+
u && (I(un(p, u.value)), E(0), requestAnimationFrame(() => v.current?.focus()));
|
|
358
|
+
}, Y = U(
|
|
359
|
+
async (s) => {
|
|
360
|
+
const u = s.filter(Ne);
|
|
361
|
+
if (s.length && !u.length) {
|
|
362
|
+
c("Only PNG, JPEG, GIF and WebP images can be attached.", "danger");
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (!f) {
|
|
366
|
+
c(`${e.agent?.name ?? "This agent"} doesn't take images.`, "danger");
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const N = r - e.images.length;
|
|
370
|
+
u.length > N && c(`Up to ${r} images per message.`, "danger");
|
|
371
|
+
const He = (await Promise.all(u.slice(0, Math.max(0, N)).map((j) => sn(j)))).map((j, je) => {
|
|
372
|
+
const pe = /^data:([^;,]+);base64,(.*)$/s.exec(j.url);
|
|
373
|
+
return { name: j.name ?? `image ${je + 1}`, url: j.url, image: { media_type: pe?.[1] ?? "image/png", data: pe?.[2] ?? "" } };
|
|
374
|
+
});
|
|
375
|
+
e.setImages([...e.images, ...He].slice(0, r));
|
|
376
|
+
},
|
|
377
|
+
[f, e, r, c]
|
|
378
|
+
), A = p.trim(), le = !i && !!(A || m.length && !l), q = async (s = !1) => {
|
|
379
|
+
if (!le) return;
|
|
380
|
+
ie.reset(), A && re.record(A, oe);
|
|
381
|
+
const u = zt(A);
|
|
382
|
+
if (u && e.serverCommand(u.raw) && !xe(u.name)) {
|
|
383
|
+
I(""), await e.runServerCommand(A);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (u && xe(u.name)) {
|
|
387
|
+
I("");
|
|
388
|
+
try {
|
|
389
|
+
await Ft(_, A);
|
|
390
|
+
} catch (N) {
|
|
391
|
+
c(N instanceof Error ? N.message : String(N), "danger");
|
|
392
|
+
}
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (I(""), s && l) {
|
|
396
|
+
e.queueFollowUp(A);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
await e.submit(A);
|
|
400
|
+
}, ue = (s) => {
|
|
401
|
+
const u = $[Math.min(s, $.length - 1)];
|
|
402
|
+
if (u) {
|
|
403
|
+
if (E(0), u.needsArgs) {
|
|
404
|
+
I(`/${u.name} `), requestAnimationFrame(() => v.current?.focus());
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
I(""), Promise.resolve(u.run(_, "")).catch((N) => c(N instanceof Error ? N.message : String(N), "danger"));
|
|
408
|
+
}
|
|
409
|
+
}, _e = (s) => {
|
|
410
|
+
if (!s.nativeEvent.isComposing) {
|
|
411
|
+
if (W) {
|
|
412
|
+
if (s.key === "ArrowDown" || s.key === "ArrowUp") {
|
|
413
|
+
s.preventDefault(), E((u) => Se(u, s.key === "ArrowDown" ? 1 : -1, K.length));
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (s.key === "Tab" || s.key === "Enter" && !s.shiftKey) {
|
|
417
|
+
s.preventDefault(), ce(y);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
if (s.key === "Escape") {
|
|
421
|
+
s.preventDefault(), w(!0);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (O) {
|
|
426
|
+
if (s.key === "ArrowDown" || s.key === "ArrowUp") {
|
|
427
|
+
s.preventDefault(), E((u) => Se(u, s.key === "ArrowDown" ? 1 : -1, $.length));
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (s.key === "Tab") {
|
|
431
|
+
s.preventDefault();
|
|
432
|
+
const u = $[Math.min(y, $.length - 1)];
|
|
433
|
+
u && I(`/${u.name} `);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (s.key === "Enter" && !s.shiftKey) {
|
|
437
|
+
s.preventDefault(), ue(y);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
if (s.key === "Escape") {
|
|
441
|
+
s.preventDefault(), w(!0);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (s.key === "r" && s.ctrlKey && !s.altKey && !s.metaKey) {
|
|
446
|
+
s.preventDefault(), T(!0);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (!ie.onKeyDown(s)) {
|
|
450
|
+
if (s.key === "Escape" && l && !A) {
|
|
451
|
+
s.preventDefault(), e.cancelRun();
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (s.key === "Enter" && s.altKey) {
|
|
455
|
+
s.preventDefault(), q(!0);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
s.key === "Enter" && !s.shiftKey && (s.preventDefault(), q());
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}, Ke = (s) => {
|
|
462
|
+
const u = Array.from(s.clipboardData.files);
|
|
463
|
+
u.some(Ne) && (s.preventDefault(), Y(u));
|
|
464
|
+
}, Be = (s) => {
|
|
465
|
+
s.preventDefault(), b(!1), Y(Array.from(s.dataTransfer.files));
|
|
466
|
+
}, de = e.store.state.pause, fe = G.ComposerFooter, Oe = e.isWorker(), Ue = l ? "Steer the turn in progress… (Alt+Enter queues it for after)" : de?.kind === "question" ? "Answer in your own words…" : de?.kind === "flow_input" ? "Reply to the flow…" : Oe ? "Steer this task through its fleet…" : `Message ${e.agent?.name ?? "the agent"}… (/ for commands)`;
|
|
467
|
+
return /* @__PURE__ */ g("div", { className: "relative", children: [
|
|
468
|
+
x && /* @__PURE__ */ t(
|
|
469
|
+
on,
|
|
470
|
+
{
|
|
471
|
+
workspace: oe,
|
|
472
|
+
onPick: (s) => {
|
|
473
|
+
T(!1), _.setComposer(s);
|
|
474
|
+
},
|
|
475
|
+
onClose: () => {
|
|
476
|
+
T(!1), requestAnimationFrame(() => v.current?.focus());
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
),
|
|
480
|
+
O && !x && /* @__PURE__ */ t(
|
|
481
|
+
"div",
|
|
482
|
+
{
|
|
483
|
+
id: L,
|
|
484
|
+
role: "listbox",
|
|
485
|
+
"aria-label": "Commands",
|
|
486
|
+
className: "absolute bottom-full left-0 z-20 mb-2 max-h-72 w-full overflow-y-auto rounded-xl border border-line bg-surface p-1.5 shadow-pop",
|
|
487
|
+
children: $.map((s, u) => (
|
|
488
|
+
// biome-ignore lint/a11y/useFocusableInteractive: a combobox option; focus stays in the textarea (aria-activedescendant)
|
|
489
|
+
/* @__PURE__ */ g(
|
|
490
|
+
"div",
|
|
491
|
+
{
|
|
492
|
+
id: `${L}-${u}`,
|
|
493
|
+
role: "option",
|
|
494
|
+
"aria-selected": u === Math.min(y, $.length - 1),
|
|
495
|
+
onMouseDown: (N) => {
|
|
496
|
+
N.preventDefault(), ue(u);
|
|
497
|
+
},
|
|
498
|
+
onMouseEnter: () => E(u),
|
|
499
|
+
className: P(
|
|
500
|
+
"flex cursor-pointer items-baseline gap-2 rounded-md px-2.5 py-1.5 text-[13px]",
|
|
501
|
+
u === Math.min(y, $.length - 1) ? "bg-accent-soft" : ""
|
|
502
|
+
),
|
|
503
|
+
children: [
|
|
504
|
+
/* @__PURE__ */ g("span", { className: P("shrink-0 font-mono font-semibold", u === y ? "text-accent" : "text-ink"), children: [
|
|
505
|
+
"/",
|
|
506
|
+
s.name
|
|
507
|
+
] }),
|
|
508
|
+
s.args && /* @__PURE__ */ t("span", { className: "shrink-0 font-mono text-[11.5px] text-faint", children: s.args }),
|
|
509
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 truncate text-muted", children: s.description })
|
|
510
|
+
]
|
|
511
|
+
},
|
|
512
|
+
s.name
|
|
513
|
+
)
|
|
514
|
+
))
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
W && /* @__PURE__ */ t(
|
|
518
|
+
"div",
|
|
519
|
+
{
|
|
520
|
+
id: `${L}-files`,
|
|
521
|
+
role: "listbox",
|
|
522
|
+
"aria-label": "Files and artifacts",
|
|
523
|
+
className: "absolute bottom-full left-0 z-20 mb-2 max-h-72 w-full overflow-y-auto rounded-xl border border-line bg-surface p-1.5 shadow-pop",
|
|
524
|
+
children: K.map((s, u) => (
|
|
525
|
+
// biome-ignore lint/a11y/useFocusableInteractive: a combobox option; focus stays in the textarea (aria-activedescendant)
|
|
526
|
+
/* @__PURE__ */ g(
|
|
527
|
+
"div",
|
|
528
|
+
{
|
|
529
|
+
id: `${L}-files-${u}`,
|
|
530
|
+
role: "option",
|
|
531
|
+
"aria-selected": u === Math.min(y, K.length - 1),
|
|
532
|
+
onMouseDown: (N) => {
|
|
533
|
+
N.preventDefault(), ce(u);
|
|
534
|
+
},
|
|
535
|
+
onMouseEnter: () => E(u),
|
|
536
|
+
className: P(
|
|
537
|
+
"flex cursor-pointer items-baseline gap-2 truncate rounded-md px-2.5 py-1.5 text-[12.5px] text-ink",
|
|
538
|
+
s.kind === "file" && "font-mono",
|
|
539
|
+
u === Math.min(y, K.length - 1) && "bg-accent-soft text-accent"
|
|
540
|
+
),
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 truncate", children: s.label }),
|
|
543
|
+
s.detail && /* @__PURE__ */ g("span", { className: "shrink-0 font-mono text-[11px] text-faint", children: [
|
|
544
|
+
"@artifact:",
|
|
545
|
+
s.detail
|
|
546
|
+
] })
|
|
547
|
+
]
|
|
548
|
+
},
|
|
549
|
+
s.value
|
|
550
|
+
)
|
|
551
|
+
))
|
|
552
|
+
}
|
|
553
|
+
),
|
|
554
|
+
/* @__PURE__ */ g(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
onDragOver: (s) => {
|
|
558
|
+
s.dataTransfer.types.includes("Files") && (s.preventDefault(), b(!0));
|
|
559
|
+
},
|
|
560
|
+
onDragLeave: () => b(!1),
|
|
561
|
+
onDrop: Be,
|
|
562
|
+
className: P(
|
|
563
|
+
"rounded-2xl border bg-surface p-1.5 shadow-sm transition-colors",
|
|
564
|
+
"focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/20",
|
|
565
|
+
h ? "border-accent bg-accent-soft" : "border-line",
|
|
566
|
+
i && "opacity-60"
|
|
567
|
+
),
|
|
568
|
+
children: [
|
|
569
|
+
m.length > 0 && /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2 px-1.5 pt-1 pb-2", children: m.map((s, u) => (
|
|
570
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: stateless thumbnails, removed by position
|
|
571
|
+
/* @__PURE__ */ g("div", { className: "relative", children: [
|
|
572
|
+
/* @__PURE__ */ t("img", { src: s.url, alt: s.name, className: "h-16 w-16 rounded-lg border border-line-soft object-cover" }),
|
|
573
|
+
/* @__PURE__ */ t(
|
|
574
|
+
"button",
|
|
575
|
+
{
|
|
576
|
+
type: "button",
|
|
577
|
+
"aria-label": `Remove ${s.name}`,
|
|
578
|
+
onClick: () => e.setImages(m.filter((N, me) => me !== u)),
|
|
579
|
+
className: "absolute -top-1.5 -right-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-ink text-surface shadow",
|
|
580
|
+
children: /* @__PURE__ */ t(Me, { size: 11 })
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
] }, u)
|
|
584
|
+
)) }),
|
|
585
|
+
/* @__PURE__ */ g("div", { className: "flex items-end gap-1", children: [
|
|
586
|
+
/* @__PURE__ */ t(
|
|
587
|
+
ne,
|
|
588
|
+
{
|
|
589
|
+
label: "Attach images",
|
|
590
|
+
disabled: i || !f || m.length >= r,
|
|
591
|
+
onClick: () => V.current?.click(),
|
|
592
|
+
className: "mb-0.5 h-9 w-9 rounded-full",
|
|
593
|
+
children: /* @__PURE__ */ t(Ye, { size: 17 })
|
|
594
|
+
}
|
|
595
|
+
),
|
|
596
|
+
/* @__PURE__ */ t(
|
|
597
|
+
"input",
|
|
598
|
+
{
|
|
599
|
+
ref: V,
|
|
600
|
+
type: "file",
|
|
601
|
+
accept: "image/png,image/jpeg,image/gif,image/webp",
|
|
602
|
+
multiple: !0,
|
|
603
|
+
hidden: !0,
|
|
604
|
+
onChange: (s) => {
|
|
605
|
+
Y(Array.from(s.target.files ?? [])), s.target.value = "";
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
/* @__PURE__ */ t(
|
|
610
|
+
"textarea",
|
|
611
|
+
{
|
|
612
|
+
ref: v,
|
|
613
|
+
value: p,
|
|
614
|
+
onChange: (s) => {
|
|
615
|
+
I(s.target.value), w(!1), E(0);
|
|
616
|
+
},
|
|
617
|
+
onKeyDown: _e,
|
|
618
|
+
onPaste: Ke,
|
|
619
|
+
rows: 1,
|
|
620
|
+
autoFocus: o,
|
|
621
|
+
disabled: i,
|
|
622
|
+
placeholder: Ue,
|
|
623
|
+
"aria-label": "Message",
|
|
624
|
+
"aria-controls": O ? L : W ? `${L}-files` : void 0,
|
|
625
|
+
"aria-activedescendant": O ? `${L}-${Math.min(y, $.length - 1)}` : W ? `${L}-files-${Math.min(y, K.length - 1)}` : void 0,
|
|
626
|
+
"aria-autocomplete": "list",
|
|
627
|
+
enterKeyHint: "send",
|
|
628
|
+
className: "max-h-[240px] min-h-10 flex-1 resize-none bg-transparent px-1.5 py-2.5 text-[16px] leading-snug text-ink outline-none placeholder:truncate placeholder:text-faint disabled:cursor-not-allowed sm:text-[14.5px]"
|
|
629
|
+
}
|
|
630
|
+
),
|
|
631
|
+
l && A && /* @__PURE__ */ t(ne, { label: "Queue for after this turn (Alt+Enter)", className: "mb-0.5 h-9 w-9 rounded-full", onClick: () => {
|
|
632
|
+
q(!0);
|
|
633
|
+
}, children: /* @__PURE__ */ t(Xe, { size: 17 }) }),
|
|
634
|
+
l && !A ? /* @__PURE__ */ t(
|
|
635
|
+
"button",
|
|
636
|
+
{
|
|
637
|
+
type: "button",
|
|
638
|
+
onClick: () => {
|
|
639
|
+
e.cancelRun();
|
|
640
|
+
},
|
|
641
|
+
"aria-label": "Stop the turn (Esc)",
|
|
642
|
+
title: "Stop the turn (Esc)",
|
|
643
|
+
className: "mb-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-ink text-surface transition-opacity hover:opacity-85",
|
|
644
|
+
children: /* @__PURE__ */ t(Ze, { size: 13, fill: "currentColor" })
|
|
645
|
+
}
|
|
646
|
+
) : /* @__PURE__ */ t(
|
|
647
|
+
"button",
|
|
648
|
+
{
|
|
649
|
+
type: "button",
|
|
650
|
+
onClick: () => {
|
|
651
|
+
q();
|
|
652
|
+
},
|
|
653
|
+
disabled: !le,
|
|
654
|
+
"aria-label": l ? "Steer the turn in progress" : "Send",
|
|
655
|
+
title: l ? "Steer the turn in progress (Enter)" : "Send (Enter)",
|
|
656
|
+
className: "mb-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-accent text-on-accent transition-opacity hover:bg-accent-hover disabled:opacity-35",
|
|
657
|
+
children: /* @__PURE__ */ t(et, { size: 18 })
|
|
658
|
+
}
|
|
659
|
+
)
|
|
660
|
+
] }),
|
|
661
|
+
fe && /* @__PURE__ */ t("div", { className: "px-1.5 pt-1", children: /* @__PURE__ */ t(fe, { conversationId: e.id }) })
|
|
662
|
+
]
|
|
663
|
+
}
|
|
664
|
+
)
|
|
665
|
+
] });
|
|
666
|
+
}
|
|
667
|
+
const pn = 1e4, hn = 6e4, gn = {
|
|
668
|
+
queued: "queued",
|
|
669
|
+
thinking: "thinking",
|
|
670
|
+
writing: "writing",
|
|
671
|
+
tool: "running",
|
|
672
|
+
compacting: "compacting context",
|
|
673
|
+
retrying: "retrying"
|
|
674
|
+
};
|
|
675
|
+
function xn({ controller: e }) {
|
|
676
|
+
B(e, D.run, D.pause, D.connection, R.followUps);
|
|
677
|
+
const n = e.store.state, [, i] = S(0), o = n.connection === "reconnecting";
|
|
678
|
+
if (C(() => {
|
|
679
|
+
if (!n.run && !o) return;
|
|
680
|
+
const c = setInterval(() => i((a) => a + 1), 1e3);
|
|
681
|
+
return () => clearInterval(c);
|
|
682
|
+
}, [n.run, o]), o) {
|
|
683
|
+
const c = n.reconnectingSince ? Date.now() - n.reconnectingSince : 0, a = c >= pn ? ` for ${we(c)}` : "";
|
|
684
|
+
return /* @__PURE__ */ g("output", { className: P("flex items-center gap-1.5 text-[12px]", c >= hn ? "text-danger" : "text-warn"), children: [
|
|
685
|
+
/* @__PURE__ */ t(tt, { size: 12, className: "animate-spin" }),
|
|
686
|
+
" Reconnecting",
|
|
687
|
+
a,
|
|
688
|
+
n.connectionDetail ? ` (${n.connectionDetail})` : "…"
|
|
689
|
+
] });
|
|
690
|
+
}
|
|
691
|
+
if (n.run) {
|
|
692
|
+
const a = [n.run.activity === "tool" && n.run.toolName ? `running ${n.run.toolName}` : gn[n.run.activity]];
|
|
693
|
+
return n.run.step !== null && a.push(`step ${n.run.step + 1}`), a.push(we(Date.now() - n.run.startedAt) ?? "0s"), e.followUps.length && a.push(`${e.followUps.length} queued`), /* @__PURE__ */ g("output", { className: "flex items-center gap-1.5 text-[12px] text-accent", children: [
|
|
694
|
+
/* @__PURE__ */ t(nt, { size: 12, className: "animate-spin" }),
|
|
695
|
+
" ",
|
|
696
|
+
a.join(" · ")
|
|
697
|
+
] });
|
|
698
|
+
}
|
|
699
|
+
if (n.pause && n.pause.kind !== "fork_seed" && e.deferredPauseId === n.pause.pending_tool_call_id) return null;
|
|
700
|
+
if (n.pause && n.pause.kind !== "fork_seed") {
|
|
701
|
+
const c = n.pause.task_id ? `${n.pause.task_id}: ` : "";
|
|
702
|
+
return /* @__PURE__ */ g("output", { className: "flex items-center gap-1.5 text-[12px] text-warn", children: [
|
|
703
|
+
/* @__PURE__ */ t(st, { size: 12 }),
|
|
704
|
+
" ",
|
|
705
|
+
c,
|
|
706
|
+
Jt(n.pause)
|
|
707
|
+
] });
|
|
708
|
+
}
|
|
709
|
+
const d = e.fleetParent();
|
|
710
|
+
return d ? /* @__PURE__ */ g("div", { className: "text-[12px] text-faint", children: [
|
|
711
|
+
"Fleet worker · read-only · typing steers ",
|
|
712
|
+
d.taskId,
|
|
713
|
+
" through its fleet"
|
|
714
|
+
] }) : null;
|
|
715
|
+
}
|
|
716
|
+
const Z = "ecui.session.inspector", Ee = "ecui.session.tab";
|
|
717
|
+
function Ce(e, n) {
|
|
718
|
+
try {
|
|
719
|
+
return localStorage.getItem(e) ?? n;
|
|
720
|
+
} catch {
|
|
721
|
+
return n;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function ee(e, n) {
|
|
725
|
+
try {
|
|
726
|
+
localStorage.setItem(e, n);
|
|
727
|
+
} catch {
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
function wn({ activeId: e }) {
|
|
731
|
+
Re();
|
|
732
|
+
const n = ae(), i = M.attached().filter((o) => o.started || o.id === e);
|
|
733
|
+
return i.length < 2 ? null : /* @__PURE__ */ t("nav", { className: "flex h-9 shrink-0 items-end gap-0.5 overflow-x-auto border-b border-line bg-surface-alt px-2", "aria-label": "Open sessions", children: i.map((o) => {
|
|
734
|
+
const d = Ot(o.store.state, { key: o.id, agent: o.agent?.name ?? null, attention: null, draft: "", createdAt: o.createdAt }), c = o.id === e;
|
|
735
|
+
return /* @__PURE__ */ g(
|
|
736
|
+
"div",
|
|
737
|
+
{
|
|
738
|
+
className: P(
|
|
739
|
+
"group flex h-8 max-w-[14rem] shrink-0 items-center gap-1.5 rounded-t-md border border-b-0 pr-1 pl-2.5 text-[12.5px]",
|
|
740
|
+
c ? "border-line bg-bg font-semibold text-ink" : "border-transparent text-muted hover:bg-surface-hover hover:text-ink"
|
|
741
|
+
),
|
|
742
|
+
children: [
|
|
743
|
+
/* @__PURE__ */ g("button", { type: "button", className: "flex min-w-0 items-center gap-1.5", "aria-current": c ? "page" : void 0, onClick: () => n(J(o.id)), children: [
|
|
744
|
+
/* @__PURE__ */ t(Ut, { row: d }),
|
|
745
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: o.title() })
|
|
746
|
+
] }),
|
|
747
|
+
/* @__PURE__ */ t(
|
|
748
|
+
"button",
|
|
749
|
+
{
|
|
750
|
+
type: "button",
|
|
751
|
+
"aria-label": `Stop following ${o.title()}`,
|
|
752
|
+
onClick: () => {
|
|
753
|
+
if (M.detach(o.id), c) {
|
|
754
|
+
const a = M.attached().find((l) => l.started);
|
|
755
|
+
n(a ? J(a.id) : Ht());
|
|
756
|
+
}
|
|
757
|
+
},
|
|
758
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded text-faint opacity-0 group-hover:opacity-100 hover:bg-surface-hover hover:text-ink focus:opacity-100 max-md:opacity-100",
|
|
759
|
+
children: /* @__PURE__ */ t(Me, { size: 12 })
|
|
760
|
+
}
|
|
761
|
+
)
|
|
762
|
+
]
|
|
763
|
+
},
|
|
764
|
+
o.id
|
|
765
|
+
);
|
|
766
|
+
}) });
|
|
767
|
+
}
|
|
768
|
+
function bn({ controller: e }) {
|
|
769
|
+
B(e, D.session, R.list);
|
|
770
|
+
const [n, i] = S(!1), [o, d] = S(""), c = z(null), a = e.title();
|
|
771
|
+
return n ? /* @__PURE__ */ t(
|
|
772
|
+
"input",
|
|
773
|
+
{
|
|
774
|
+
ref: c,
|
|
775
|
+
autoFocus: !0,
|
|
776
|
+
value: o,
|
|
777
|
+
onChange: (l) => d(l.target.value),
|
|
778
|
+
onBlur: () => {
|
|
779
|
+
i(!1), o.trim() && o.trim() !== a && e.setTitle(o.trim());
|
|
780
|
+
},
|
|
781
|
+
onKeyDown: (l) => {
|
|
782
|
+
l.key === "Enter" && l.target.blur(), l.key === "Escape" && i(!1);
|
|
783
|
+
},
|
|
784
|
+
"aria-label": "Session title",
|
|
785
|
+
className: "h-7 min-w-0 flex-1 rounded-md border border-accent bg-surface px-2 text-[13.5px] font-semibold text-ink outline-none"
|
|
786
|
+
}
|
|
787
|
+
) : /* @__PURE__ */ t("h1", { className: "min-w-[6rem] flex-1 truncate text-[13.5px] font-semibold text-ink", children: /* @__PURE__ */ t(
|
|
788
|
+
"button",
|
|
789
|
+
{
|
|
790
|
+
type: "button",
|
|
791
|
+
disabled: !e.started,
|
|
792
|
+
onClick: () => {
|
|
793
|
+
d(a), i(!0);
|
|
794
|
+
},
|
|
795
|
+
className: "max-w-full truncate rounded px-1 text-left hover:bg-surface-hover disabled:hover:bg-transparent",
|
|
796
|
+
title: e.started ? "Rename" : void 0,
|
|
797
|
+
children: a
|
|
798
|
+
}
|
|
799
|
+
) });
|
|
800
|
+
}
|
|
801
|
+
function yn({ controller: e }) {
|
|
802
|
+
B(e, D.reset, D.session, R.list, R.draft);
|
|
803
|
+
const n = ae(), { toast: i } = $e(), [o, d] = S(() => Ce(Z, "1") === "1"), [c, a] = S(!1), [l, f] = S(() => Ce(Ee, "brief")), r = ze(e), m = U((x) => {
|
|
804
|
+
f(x), ee(Ee, x);
|
|
805
|
+
}, []), p = z(null), k = U((x) => {
|
|
806
|
+
p.current = x;
|
|
807
|
+
}, []), h = H(
|
|
808
|
+
() => ({ navigate: (x) => n(x), toast: i, openDialog: jt }),
|
|
809
|
+
[n, i]
|
|
810
|
+
), b = U(
|
|
811
|
+
async (x) => {
|
|
812
|
+
const T = x.key.slice(2);
|
|
813
|
+
try {
|
|
814
|
+
const v = await Vt.forkSession(e.id, { before_message: T, title: e.session?.title ?? null });
|
|
815
|
+
M.attach(v.id).seedDraft(x.text), i("Editing in a copy of the session from before that message. The original is kept.", "info"), n(J(v.id));
|
|
816
|
+
} catch (v) {
|
|
817
|
+
i(`Couldn't edit: ${Wt(v)}`, "danger");
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
[e, n, i]
|
|
821
|
+
);
|
|
822
|
+
C(() => {
|
|
823
|
+
const x = (v) => {
|
|
824
|
+
m(String(v.detail)), window.matchMedia("(min-width: 1280px)").matches ? (d(!0), ee(Z, "1")) : a(!0);
|
|
825
|
+
}, T = () => y();
|
|
826
|
+
return window.addEventListener("ecui:inspector", x), window.addEventListener("ecui:toggle-inspector", T), () => {
|
|
827
|
+
window.removeEventListener("ecui:inspector", x), window.removeEventListener("ecui:toggle-inspector", T);
|
|
828
|
+
};
|
|
829
|
+
});
|
|
830
|
+
const y = () => {
|
|
831
|
+
window.matchMedia("(min-width: 1280px)").matches ? d((x) => (ee(Z, x ? "0" : "1"), !x)) : a(!0);
|
|
832
|
+
}, E = e.store.state.entries, F = !e.loading && E.length === 0 && !e.running(), w = r.length > 0;
|
|
833
|
+
return /* @__PURE__ */ g("div", { className: "flex min-h-0 flex-1", children: [
|
|
834
|
+
/* @__PURE__ */ g("section", { className: "flex min-w-0 flex-1 flex-col bg-bg", children: [
|
|
835
|
+
/* @__PURE__ */ g("div", { className: "flex h-11 shrink-0 items-center gap-1.5 border-b border-line bg-surface px-2 sm:px-3", children: [
|
|
836
|
+
/* @__PURE__ */ t(bn, { controller: e }),
|
|
837
|
+
/* @__PURE__ */ t("div", { className: "hidden min-w-0 md:block", children: /* @__PURE__ */ t(ye, { controller: e }) }),
|
|
838
|
+
/* @__PURE__ */ t(qt, { controller: e }),
|
|
839
|
+
w && /* @__PURE__ */ g(ne, { label: o ? "Hide panels" : "Show panels", onClick: y, children: [
|
|
840
|
+
o ? /* @__PURE__ */ t(at, { size: 17, className: "max-xl:hidden" }) : null,
|
|
841
|
+
/* @__PURE__ */ t(rt, { size: 17, className: P(o && "xl:hidden") })
|
|
842
|
+
] })
|
|
843
|
+
] }),
|
|
844
|
+
/* @__PURE__ */ t("div", { className: "flex shrink-0 items-center border-b border-line bg-surface px-2 py-1 md:hidden", children: /* @__PURE__ */ t(ye, { controller: e }) }),
|
|
845
|
+
e.loading && !E.length ? /* @__PURE__ */ t(Pe, {}) : F ? /* @__PURE__ */ t(Yt, { onPick: (x) => {
|
|
846
|
+
e.submit(x);
|
|
847
|
+
} }) : /* @__PURE__ */ t(en, { controller: e, onEdit: e.isWorker() ? void 0 : (x) => {
|
|
848
|
+
b(x);
|
|
849
|
+
}, renderDiff: ke.renderDiff }),
|
|
850
|
+
/* @__PURE__ */ t("div", { className: "shrink-0 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-6 sm:pb-4", children: /* @__PURE__ */ g("div", { className: "mx-auto flex w-full max-w-3xl flex-col gap-2", children: [
|
|
851
|
+
/* @__PURE__ */ t(Qt, { controller: e, collisions: ke.collisions }),
|
|
852
|
+
/* @__PURE__ */ t(xn, { controller: e }),
|
|
853
|
+
/* @__PURE__ */ t(mn, { controller: e, commandContext: h, autoFocus: !0, registerHandle: k })
|
|
854
|
+
] }) })
|
|
855
|
+
] }),
|
|
856
|
+
w && o && /* @__PURE__ */ t("aside", { className: "hidden w-[22rem] shrink-0 border-l border-line bg-surface xl:flex", "aria-label": "Session panels", children: /* @__PURE__ */ t(ve, { controller: e, tab: l, onTab: m, className: "w-full" }) }),
|
|
857
|
+
/* @__PURE__ */ t(Gt, { open: c, onClose: () => a(!1), title: "Session", side: "right", widthClass: "w-[min(24rem,100vw)]", children: /* @__PURE__ */ t(ve, { controller: e, tab: l, onTab: m, className: "h-full" }) })
|
|
858
|
+
] });
|
|
859
|
+
}
|
|
860
|
+
function Cn() {
|
|
861
|
+
const { sessionId: e } = We(), [n] = qe(), i = ae();
|
|
862
|
+
Re();
|
|
863
|
+
const o = X((m) => m.agents), d = X((m) => m.features), c = X((m) => m.status === "ready" || m.status === "error"), a = Lt(o, d), l = e === "new" && c && a.length === 0;
|
|
864
|
+
C(() => {
|
|
865
|
+
if (e !== "new" || !c || a.length === 0) return;
|
|
866
|
+
const m = n.get("agent"), p = a.find((b) => b.name === m) ?? a.find((b) => b.name === "chat") ?? a[0] ?? null, k = n.get("workspace"), h = M.create({
|
|
867
|
+
agent: p,
|
|
868
|
+
model: n.get("model"),
|
|
869
|
+
permissionMode: n.get("mode"),
|
|
870
|
+
workspace: k ? { path: k, worktree: n.get("worktree") !== "0" } : null
|
|
871
|
+
});
|
|
872
|
+
i(J(h.id), { replace: !0 });
|
|
873
|
+
}, [e, c]);
|
|
874
|
+
const f = _t(e && e !== "new" ? e : null), r = !!f?.started;
|
|
875
|
+
return C(() => {
|
|
876
|
+
r && f?.loadExtras();
|
|
877
|
+
}, [f, r]), C(() => {
|
|
878
|
+
if (!(!e || e === "new"))
|
|
879
|
+
return M.get(e) || M.attach(e), M.show(e), () => {
|
|
880
|
+
M.activeId === e && M.show(null);
|
|
881
|
+
};
|
|
882
|
+
}, [e]), l ? /* @__PURE__ */ t(be, { icon: /* @__PURE__ */ t(he, { size: 20 }), title: "No agent to start a session with here", children: "Sessions here start from elsewhere in the app." }) : !f || e === "new" ? /* @__PURE__ */ t(Pe, {}) : f.missing ? /* @__PURE__ */ t(
|
|
883
|
+
be,
|
|
884
|
+
{
|
|
885
|
+
icon: /* @__PURE__ */ t(he, { size: 20 }),
|
|
886
|
+
title: "Session not found",
|
|
887
|
+
action: a.length > 0 ? /* @__PURE__ */ t(
|
|
888
|
+
Kt,
|
|
889
|
+
{
|
|
890
|
+
variant: "primary",
|
|
891
|
+
onClick: () => {
|
|
892
|
+
M.detach(f.id), i(Bt());
|
|
893
|
+
},
|
|
894
|
+
children: "Start a new session"
|
|
895
|
+
}
|
|
896
|
+
) : void 0,
|
|
897
|
+
children: "It may have been deleted, or it belongs to another account."
|
|
898
|
+
}
|
|
899
|
+
) : /* @__PURE__ */ g("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
900
|
+
/* @__PURE__ */ t(wn, { activeId: f.id }),
|
|
901
|
+
/* @__PURE__ */ t(yn, { controller: f }, f.id)
|
|
902
|
+
] });
|
|
903
|
+
}
|
|
904
|
+
export {
|
|
905
|
+
Cn as default
|
|
906
|
+
};
|