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