@streamoid/agent 0.6.54 → 0.6.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -2
- package/dist/pane.js +255 -251
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -138042,6 +138042,16 @@ function deriveSurfaceState(e, t, n) {
|
|
|
138042
138042
|
function surfaceFingerprint(e) {
|
|
138043
138043
|
return `${e.mode}:${e.panelCount}:${e.activePanel?.id ?? ""}`;
|
|
138044
138044
|
}
|
|
138045
|
+
let storesWorkspaceId = null;
|
|
138046
|
+
function syncStoresToWorkspace(e) {
|
|
138047
|
+
if (e) {
|
|
138048
|
+
if (storesWorkspaceId !== null && storesWorkspaceId !== e) {
|
|
138049
|
+
const t = useChatStore.getState();
|
|
138050
|
+
t.reset(), t.setConversationsLoading(!0), useSupportStore.getState().leave();
|
|
138051
|
+
}
|
|
138052
|
+
storesWorkspaceId = e;
|
|
138053
|
+
}
|
|
138054
|
+
}
|
|
138045
138055
|
function getCentralUrl() {
|
|
138046
138056
|
return useAuthStore.getState().centralDashboardUrl;
|
|
138047
138057
|
}
|
|
@@ -138279,7 +138289,7 @@ function AgentChatShell({ adapters: e }) {
|
|
|
138279
138289
|
getWorkspaceId: () => t.current.workspace.current.id,
|
|
138280
138290
|
onSessionExpired: () => t.current.auth.onSessionExpired?.(),
|
|
138281
138291
|
onBackendRecovered: () => t.current.onBackendRecovered?.()
|
|
138282
|
-
});
|
|
138292
|
+
}), syncStoresToWorkspace(s.current.id);
|
|
138283
138293
|
const Ke = useAuthStore.getState();
|
|
138284
138294
|
return Ke.setMode("iframe"), Ke.setAuth({
|
|
138285
138295
|
workspaceId: s.current.id,
|
|
@@ -138300,7 +138310,7 @@ function AgentChatShell({ adapters: e }) {
|
|
|
138300
138310
|
workspaceName: s.current.name ?? null
|
|
138301
138311
|
}), useThemeStore.getState().setTheme(o.mode), !0;
|
|
138302
138312
|
}), useEffect(() => {
|
|
138303
|
-
useAuthStore.getState().switchWorkspace(s.current.id);
|
|
138313
|
+
syncStoresToWorkspace(s.current.id), useAuthStore.getState().switchWorkspace(s.current.id);
|
|
138304
138314
|
}, [s.current.id]), useEffect(() => {
|
|
138305
138315
|
useThemeStore.getState().setTheme(o.mode);
|
|
138306
138316
|
}, [o.mode]), useEffect(() => {
|
package/dist/pane.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useStreamoidSearchShortcut as
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import { d as
|
|
5
|
-
function
|
|
1
|
+
import { useState as _, useEffect as O, useCallback as p, useMemo as Q, Component as pe, useRef as G, useLayoutEffect as he, Suspense as me, lazy as ge } from "react";
|
|
2
|
+
import { useStreamoidSearchShortcut as Se, useStreamoidPanelWidth as ye, SC_ASSISTANT_PANEL_BOUNDS as Ee, SC_ASSISTANT_PANEL_WIDTH as we, ScPanelResizeHandle as Ie } from "@streamoid/ui";
|
|
3
|
+
import { jsxs as oe, jsx as g, Fragment as ve } from "react/jsx-runtime";
|
|
4
|
+
import { d as be } from "./agentScope-BlOT7qMu.js";
|
|
5
|
+
function j() {
|
|
6
6
|
return import("./index.js");
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function te() {
|
|
9
|
+
j().catch(() => {
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
function
|
|
12
|
+
const Ae = "streamoid.askPane.session", D = { open: !1, chatId: null };
|
|
13
|
+
function ae(e, t) {
|
|
14
14
|
return `${e}:${t}`;
|
|
15
15
|
}
|
|
16
16
|
function ie() {
|
|
@@ -20,40 +20,40 @@ function ie() {
|
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
if (!t) return
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
23
|
+
function Ce(e, t) {
|
|
24
|
+
if (!t) return D;
|
|
25
|
+
const a = ie();
|
|
26
|
+
if (!a) return D;
|
|
27
27
|
try {
|
|
28
|
-
const n =
|
|
29
|
-
if (!n) return
|
|
28
|
+
const n = a.getItem(ae(e, t));
|
|
29
|
+
if (!n) return D;
|
|
30
30
|
const o = JSON.parse(n);
|
|
31
|
-
if (!o || typeof o != "object") return
|
|
32
|
-
const { surface:
|
|
33
|
-
return
|
|
31
|
+
if (!o || typeof o != "object") return D;
|
|
32
|
+
const { surface: c, chatId: l } = o;
|
|
33
|
+
return c !== "pane" && c !== "rail" ? D : { open: !0, chatId: typeof l == "string" && l ? l : null };
|
|
34
34
|
} catch {
|
|
35
|
-
return
|
|
35
|
+
return D;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Pe(e, t, a) {
|
|
39
39
|
if (!t) return;
|
|
40
40
|
const n = ie();
|
|
41
41
|
if (!n) return;
|
|
42
|
-
const o =
|
|
42
|
+
const o = ae(e, t);
|
|
43
43
|
try {
|
|
44
|
-
if (
|
|
44
|
+
if (a.surface === "closed") {
|
|
45
45
|
n.removeItem(o);
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
n.setItem(o, JSON.stringify({ surface: "
|
|
48
|
+
n.setItem(o, JSON.stringify({ surface: "rail", chatId: a.chatId }));
|
|
49
49
|
} catch {
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
function
|
|
54
|
-
return e.surface === "closed" ? t.mode === "inline" && e.declinedPanelId !== null ?
|
|
52
|
+
const ce = { surface: "closed", declinedPanelId: null }, Z = { surface: "pane", declinedPanelId: null };
|
|
53
|
+
function se(e, t) {
|
|
54
|
+
return e.surface === "closed" ? t.mode === "inline" && e.declinedPanelId !== null ? ce : e : t.mode === "inline" ? e.surface === "pane" && e.declinedPanelId === null ? e : Z : t.activePanel && t.activePanel.id === e.declinedPanelId || e.surface === "fullscreen" ? e : { surface: "fullscreen", declinedPanelId: e.declinedPanelId };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function xe(e, t) {
|
|
57
57
|
return e.surface === "closed" ? e : {
|
|
58
58
|
surface: "pane",
|
|
59
59
|
declinedPanelId: t?.activePanel?.id ?? null
|
|
@@ -61,193 +61,195 @@ function Ce(e, t) {
|
|
|
61
61
|
}
|
|
62
62
|
function le(e, t = null) {
|
|
63
63
|
if (e.surface !== "closed") return e;
|
|
64
|
-
const
|
|
65
|
-
return t ?
|
|
64
|
+
const a = { surface: "pane", declinedPanelId: e.declinedPanelId };
|
|
65
|
+
return t ? se(a, t) : a;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function ue(e) {
|
|
68
68
|
return e.surface === "closed" ? e : { surface: "closed", declinedPanelId: e.declinedPanelId };
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
return e.surface === "closed" ? le(e, t) :
|
|
70
|
+
function ke(e, t = null) {
|
|
71
|
+
return e.surface === "closed" ? le(e, t) : ue(e);
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
function
|
|
73
|
+
const Y = "streamoid.askPane.width";
|
|
74
|
+
function Re(e, t = De()) {
|
|
75
75
|
if (!t || !e) return !1;
|
|
76
|
-
const
|
|
76
|
+
const a = typeof e == "string" ? [e] : e;
|
|
77
77
|
try {
|
|
78
|
-
if (t.getItem(
|
|
79
|
-
for (const n of
|
|
80
|
-
if (!n || n ===
|
|
78
|
+
if (t.getItem(Y) !== null) return !1;
|
|
79
|
+
for (const n of a) {
|
|
80
|
+
if (!n || n === Y) continue;
|
|
81
81
|
const o = t.getItem(n);
|
|
82
82
|
if (o === null) continue;
|
|
83
|
-
const
|
|
84
|
-
if (Number.isFinite(
|
|
85
|
-
return t.setItem(
|
|
83
|
+
const c = Number.parseInt(o, 10);
|
|
84
|
+
if (Number.isFinite(c))
|
|
85
|
+
return t.setItem(Y, String(c)), !0;
|
|
86
86
|
}
|
|
87
87
|
} catch {
|
|
88
88
|
}
|
|
89
89
|
return !1;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function De() {
|
|
92
92
|
try {
|
|
93
93
|
return typeof window > "u" ? null : window.localStorage;
|
|
94
94
|
} catch {
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
const n =
|
|
98
|
+
function J(e, t, a = 0) {
|
|
99
|
+
const n = Ce(e, t);
|
|
100
100
|
return {
|
|
101
101
|
workspaceId: t,
|
|
102
|
-
memory: n.open ?
|
|
102
|
+
memory: n.open ? Z : ce,
|
|
103
103
|
chatId: n.chatId,
|
|
104
104
|
selectionSnapshot: null,
|
|
105
|
-
epoch:
|
|
105
|
+
epoch: a,
|
|
106
106
|
lastReport: null
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function $e({
|
|
110
110
|
workspaceId: e,
|
|
111
|
-
persistKey: t =
|
|
112
|
-
legacyWidthKey:
|
|
111
|
+
persistKey: t = Ae,
|
|
112
|
+
legacyWidthKey: a,
|
|
113
113
|
bindShortcut: n = !0
|
|
114
114
|
}) {
|
|
115
|
-
const o = e ?? "", [
|
|
116
|
-
let d =
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
const r =
|
|
120
|
-
d =
|
|
115
|
+
const o = e ?? "", [c, l] = _(() => J(t, o));
|
|
116
|
+
let d = c;
|
|
117
|
+
if (c.workspaceId !== o) {
|
|
118
|
+
if (c.workspaceId === "") {
|
|
119
|
+
const r = J(t, o, c.epoch);
|
|
120
|
+
d = c.memory.surface !== "closed" ? { ...c, workspaceId: o, chatId: c.chatId ?? r.chatId } : { ...r, selectionSnapshot: c.selectionSnapshot };
|
|
121
121
|
} else
|
|
122
|
-
d =
|
|
123
|
-
|
|
122
|
+
d = J(t, o, c.epoch + 1);
|
|
123
|
+
l(d);
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
O(() => {
|
|
126
|
+
Pe(t, d.workspaceId, {
|
|
127
127
|
surface: d.memory.surface,
|
|
128
128
|
chatId: d.chatId
|
|
129
129
|
});
|
|
130
130
|
}, [t, d.workspaceId, d.memory.surface, d.chatId]);
|
|
131
|
-
const
|
|
132
|
-
(r) =>
|
|
133
|
-
const
|
|
134
|
-
return
|
|
131
|
+
const h = p(
|
|
132
|
+
(r) => l((i) => {
|
|
133
|
+
const f = r(i.memory);
|
|
134
|
+
return f === i.memory ? i : { ...i, memory: f };
|
|
135
135
|
}),
|
|
136
136
|
[]
|
|
137
|
-
), A =
|
|
138
|
-
(r) =>
|
|
137
|
+
), A = p(
|
|
138
|
+
(r) => l((i) => i.chatId === r ? i : { ...i, chatId: r }),
|
|
139
139
|
[]
|
|
140
|
-
),
|
|
141
|
-
(r) =>
|
|
142
|
-
const
|
|
143
|
-
return
|
|
140
|
+
), S = p(
|
|
141
|
+
(r) => l((i) => {
|
|
142
|
+
const f = r(i);
|
|
143
|
+
return f === i.memory ? i : { ...i, memory: f };
|
|
144
144
|
}),
|
|
145
145
|
[]
|
|
146
|
-
), C =
|
|
147
|
-
() =>
|
|
148
|
-
[
|
|
149
|
-
), P =
|
|
150
|
-
() =>
|
|
151
|
-
[
|
|
152
|
-
), x =
|
|
153
|
-
() =>
|
|
146
|
+
), C = p(
|
|
147
|
+
() => S((r) => le(r.memory, r.lastReport)),
|
|
148
|
+
[S]
|
|
149
|
+
), P = p(() => h(ue), [h]), L = p(
|
|
150
|
+
() => S((r) => ke(r.memory, r.lastReport)),
|
|
151
|
+
[S]
|
|
152
|
+
), x = p(
|
|
153
|
+
() => l((r) => ({
|
|
154
154
|
...r,
|
|
155
155
|
chatId: null,
|
|
156
156
|
lastReport: null,
|
|
157
|
-
memory: r.memory.surface === "closed" ?
|
|
157
|
+
memory: r.memory.surface === "closed" ? Z : r.memory
|
|
158
158
|
})),
|
|
159
159
|
[]
|
|
160
|
-
), T =
|
|
161
|
-
(r) =>
|
|
162
|
-
const
|
|
163
|
-
return { ...
|
|
160
|
+
), T = p(
|
|
161
|
+
(r) => l((i) => {
|
|
162
|
+
const f = se(i.memory, r);
|
|
163
|
+
return { ...i, lastReport: r, memory: f };
|
|
164
164
|
}),
|
|
165
165
|
[]
|
|
166
|
-
),
|
|
167
|
-
() =>
|
|
168
|
-
[
|
|
169
|
-
), b =
|
|
170
|
-
C(),
|
|
166
|
+
), m = p(
|
|
167
|
+
() => S((r) => xe(r.memory, r.lastReport)),
|
|
168
|
+
[S]
|
|
169
|
+
), b = p(() => {
|
|
170
|
+
C(), j().then((r) => r.focusAgentComposer()).catch(() => {
|
|
171
171
|
});
|
|
172
|
-
}, [C]),
|
|
172
|
+
}, [C]), y = p(
|
|
173
173
|
(r) => {
|
|
174
|
-
const
|
|
175
|
-
return
|
|
174
|
+
const i = typeof r == "string" ? r.trim() : "";
|
|
175
|
+
return i ? (x(), j().then((f) => {
|
|
176
|
+
f.focusAgentComposer(), f.enqueueChatPrompt({ prompt: i, forceNewConversation: !0 });
|
|
177
|
+
}).catch(() => {
|
|
176
178
|
}), !0) : !1;
|
|
177
179
|
},
|
|
178
180
|
[x]
|
|
179
|
-
), N =
|
|
181
|
+
), N = p(
|
|
180
182
|
(r) => {
|
|
181
|
-
x(),
|
|
182
|
-
|
|
183
|
+
x(), j().then((i) => {
|
|
184
|
+
i.showAgentSupport(r ?? null);
|
|
183
185
|
}).catch(() => {
|
|
184
186
|
});
|
|
185
187
|
},
|
|
186
188
|
[x]
|
|
187
189
|
);
|
|
188
|
-
|
|
190
|
+
Se({
|
|
189
191
|
onTrigger: () => {
|
|
190
|
-
|
|
192
|
+
te(), b();
|
|
191
193
|
},
|
|
192
194
|
enabled: n
|
|
193
|
-
}),
|
|
194
|
-
const k =
|
|
195
|
-
storageKey:
|
|
196
|
-
defaultWidth:
|
|
195
|
+
}), _(() => Re(a));
|
|
196
|
+
const k = Ee, { width: z, setWidth: W, commitWidth: q } = ye({
|
|
197
|
+
storageKey: Y,
|
|
198
|
+
defaultWidth: we,
|
|
197
199
|
min: k.min,
|
|
198
200
|
max: k.max
|
|
199
|
-
}),
|
|
200
|
-
(r) =>
|
|
201
|
-
(
|
|
201
|
+
}), U = p(
|
|
202
|
+
(r) => l(
|
|
203
|
+
(i) => i.selectionSnapshot === (r ?? null) ? i : { ...i, selectionSnapshot: r ?? null }
|
|
202
204
|
),
|
|
203
205
|
[]
|
|
204
|
-
),
|
|
205
|
-
return
|
|
206
|
+
), X = d.selectionSnapshot, E = d.epoch, H = d.memory.surface;
|
|
207
|
+
return Q(
|
|
206
208
|
() => ({
|
|
207
|
-
open:
|
|
208
|
-
surface:
|
|
209
|
+
open: H !== "closed",
|
|
210
|
+
surface: H,
|
|
209
211
|
chatId: d.chatId,
|
|
210
212
|
reveal: C,
|
|
211
213
|
close: P,
|
|
212
214
|
toggle: L,
|
|
213
215
|
askCxo: b,
|
|
214
|
-
askAbout:
|
|
216
|
+
askAbout: y,
|
|
215
217
|
requestSupport: N,
|
|
216
|
-
prefetch:
|
|
217
|
-
width:
|
|
218
|
-
setWidth:
|
|
218
|
+
prefetch: te,
|
|
219
|
+
width: z,
|
|
220
|
+
setWidth: W,
|
|
219
221
|
commitWidth: q,
|
|
220
222
|
bounds: k,
|
|
221
|
-
selectionSnapshot:
|
|
222
|
-
workspaceEpoch:
|
|
223
|
+
selectionSnapshot: X,
|
|
224
|
+
workspaceEpoch: E,
|
|
223
225
|
setChatId: A,
|
|
224
226
|
reportSurface: T,
|
|
225
|
-
collapse:
|
|
226
|
-
reportSelectionSnapshot:
|
|
227
|
+
collapse: m,
|
|
228
|
+
reportSelectionSnapshot: U
|
|
227
229
|
}),
|
|
228
230
|
[
|
|
229
|
-
|
|
231
|
+
H,
|
|
230
232
|
d.chatId,
|
|
231
233
|
C,
|
|
232
234
|
P,
|
|
233
235
|
L,
|
|
234
236
|
b,
|
|
235
|
-
|
|
237
|
+
y,
|
|
236
238
|
N,
|
|
237
|
-
j,
|
|
238
239
|
z,
|
|
240
|
+
W,
|
|
239
241
|
q,
|
|
240
242
|
k,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
+
X,
|
|
244
|
+
E,
|
|
243
245
|
A,
|
|
244
246
|
T,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
m,
|
|
248
|
+
U
|
|
247
249
|
]
|
|
248
250
|
);
|
|
249
251
|
}
|
|
250
|
-
class
|
|
252
|
+
class Oe extends pe {
|
|
251
253
|
state = { error: null };
|
|
252
254
|
static getDerivedStateFromError(t) {
|
|
253
255
|
return { error: t ?? new Error("Ask CXO failed to load") };
|
|
@@ -259,7 +261,7 @@ class Re extends de {
|
|
|
259
261
|
this.setState({ error: null }), this.props.onRetry();
|
|
260
262
|
};
|
|
261
263
|
render() {
|
|
262
|
-
return this.state.error === null ? this.props.children : /* @__PURE__ */
|
|
264
|
+
return this.state.error === null ? this.props.children : /* @__PURE__ */ oe(
|
|
263
265
|
"div",
|
|
264
266
|
{
|
|
265
267
|
role: "alert",
|
|
@@ -277,8 +279,8 @@ class Re extends de {
|
|
|
277
279
|
color: "var(--alias-text---icons-secondary, currentColor)"
|
|
278
280
|
},
|
|
279
281
|
children: [
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ g("span", { children: "Ask CXO couldn’t load." }),
|
|
283
|
+
/* @__PURE__ */ g(
|
|
282
284
|
"button",
|
|
283
285
|
{
|
|
284
286
|
type: "button",
|
|
@@ -301,8 +303,8 @@ class Re extends de {
|
|
|
301
303
|
);
|
|
302
304
|
}
|
|
303
305
|
}
|
|
304
|
-
function
|
|
305
|
-
return /* @__PURE__ */
|
|
306
|
+
function _e() {
|
|
307
|
+
return /* @__PURE__ */ g(
|
|
306
308
|
"div",
|
|
307
309
|
{
|
|
308
310
|
role: "status",
|
|
@@ -321,193 +323,195 @@ function De() {
|
|
|
321
323
|
}
|
|
322
324
|
);
|
|
323
325
|
}
|
|
324
|
-
const
|
|
325
|
-
function
|
|
326
|
-
const n = (
|
|
326
|
+
const Le = '[role="dialog"], [role="alertdialog"], [aria-modal="true"], dialog[open]';
|
|
327
|
+
function B(e, t) {
|
|
328
|
+
const n = (V(e) ? e : null)?.closest(Le) ?? null;
|
|
327
329
|
return n !== null && n !== t;
|
|
328
330
|
}
|
|
329
|
-
function
|
|
330
|
-
const
|
|
331
|
-
for (const n of Array.from(
|
|
332
|
-
if (!(n === t ||
|
|
331
|
+
function Te(e, t) {
|
|
332
|
+
const a = e.querySelectorAll('[aria-modal="true"], dialog[open]');
|
|
333
|
+
for (const n of Array.from(a))
|
|
334
|
+
if (!(n === t || Ne(n, e)))
|
|
333
335
|
return !0;
|
|
334
336
|
return !1;
|
|
335
337
|
}
|
|
336
|
-
function
|
|
338
|
+
function Ne(e, t) {
|
|
337
339
|
if (e.closest("[hidden]")) return !0;
|
|
338
|
-
const
|
|
339
|
-
return !!
|
|
340
|
+
const a = t.defaultView?.getComputedStyle?.(e);
|
|
341
|
+
return !!a && (a.display === "none" || a.visibility === "hidden");
|
|
340
342
|
}
|
|
341
|
-
function
|
|
343
|
+
function We({
|
|
342
344
|
event: e,
|
|
343
345
|
pane: t,
|
|
344
|
-
active:
|
|
346
|
+
active: a,
|
|
345
347
|
doc: n,
|
|
346
348
|
surface: o,
|
|
347
|
-
isSheet:
|
|
349
|
+
isSheet: c
|
|
348
350
|
}) {
|
|
349
|
-
return e.key !== "Escape" || e.defaultPrevented || !t || o === "closed" ||
|
|
351
|
+
return e.key !== "Escape" || e.defaultPrevented || !t || o === "closed" || B(e.target, t) || B(a, t) || Te(n, t) || !c && !(V(a) && t.contains(a) || V(e.target) && t.contains(e.target)) ? null : o === "fullscreen" ? "collapse" : "close";
|
|
350
352
|
}
|
|
351
|
-
function
|
|
353
|
+
function V(e) {
|
|
352
354
|
return typeof e == "object" && e !== null && e.nodeType === 1 && typeof e.closest == "function";
|
|
353
355
|
}
|
|
354
|
-
const
|
|
355
|
-
let
|
|
356
|
-
function
|
|
356
|
+
const de = "__streamoidAskPane";
|
|
357
|
+
let He = 0;
|
|
358
|
+
function ne(e) {
|
|
357
359
|
if (!e || typeof e != "object") return null;
|
|
358
|
-
const t = e[
|
|
360
|
+
const t = e[de];
|
|
359
361
|
return typeof t == "string" ? t : null;
|
|
360
362
|
}
|
|
361
|
-
function
|
|
363
|
+
function Me(e, t = (n) => setTimeout(n, 0), a = (n) => clearTimeout(n)) {
|
|
362
364
|
let n = null, o = null;
|
|
363
|
-
const
|
|
365
|
+
const c = () => n !== null && ne(e.state) === n;
|
|
364
366
|
return {
|
|
365
367
|
enter() {
|
|
366
|
-
if (o !== null && (
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
369
|
-
n =
|
|
368
|
+
if (o !== null && (a(o), o = null), c()) return;
|
|
369
|
+
const l = ne(e.state);
|
|
370
|
+
if (l) {
|
|
371
|
+
n = l;
|
|
370
372
|
return;
|
|
371
373
|
}
|
|
372
|
-
n = `pane-${Date.now().toString(36)}-${
|
|
374
|
+
n = `pane-${Date.now().toString(36)}-${He += 1}`;
|
|
373
375
|
const d = e.state && typeof e.state == "object" ? e.state : {};
|
|
374
|
-
e.pushState({ ...d, [
|
|
376
|
+
e.pushState({ ...d, [de]: n }, "");
|
|
375
377
|
},
|
|
376
378
|
leave() {
|
|
377
379
|
n === null || o !== null || (o = t(() => {
|
|
378
380
|
o = null;
|
|
379
|
-
const
|
|
380
|
-
n = null,
|
|
381
|
+
const l = c();
|
|
382
|
+
n = null, l && e.back();
|
|
381
383
|
}));
|
|
382
384
|
},
|
|
383
385
|
handlePop() {
|
|
384
|
-
return n === null ||
|
|
386
|
+
return n === null || c() ? !1 : (n = null, o !== null && (a(o), o = null), !0);
|
|
385
387
|
},
|
|
386
|
-
isCurrent:
|
|
388
|
+
isCurrent: c
|
|
387
389
|
};
|
|
388
390
|
}
|
|
389
|
-
const
|
|
390
|
-
function
|
|
391
|
-
const e = () => typeof window < "u" && typeof window.matchMedia == "function" && !window.matchMedia(
|
|
392
|
-
return
|
|
391
|
+
const re = "(min-width: 768px)", Fe = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
392
|
+
function je() {
|
|
393
|
+
const e = () => typeof window < "u" && typeof window.matchMedia == "function" && !window.matchMedia(re).matches, [t, a] = _(e);
|
|
394
|
+
return O(() => {
|
|
393
395
|
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
394
|
-
const n = window.matchMedia(
|
|
396
|
+
const n = window.matchMedia(re), o = () => a(!n.matches);
|
|
395
397
|
return o(), n.addEventListener?.("change", o), () => n.removeEventListener?.("change", o);
|
|
396
398
|
}, []), t;
|
|
397
399
|
}
|
|
398
|
-
function
|
|
399
|
-
return
|
|
400
|
+
function K() {
|
|
401
|
+
return ge(() => j().then((e) => ({ default: e.AgentPanel })));
|
|
400
402
|
}
|
|
401
|
-
function
|
|
403
|
+
function Ye({
|
|
402
404
|
controller: e,
|
|
403
405
|
adapters: t,
|
|
404
|
-
hostContext:
|
|
406
|
+
hostContext: a,
|
|
405
407
|
scope: n,
|
|
406
408
|
support: o,
|
|
407
|
-
canvas:
|
|
408
|
-
className:
|
|
409
|
+
canvas: c,
|
|
410
|
+
className: l,
|
|
409
411
|
ariaLabel: d = "Ask CXO assistant"
|
|
410
412
|
}) {
|
|
411
|
-
const { open:
|
|
412
|
-
|
|
413
|
-
const [
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
const { open: h, surface: A, chatId: S, setChatId: C, close: P, collapse: L, reportSurface: x, reportSelectionSnapshot: T } = e, m = je(), b = G(null), y = h && m, [N, k] = _(h);
|
|
414
|
+
h && !N && k(!0);
|
|
415
|
+
const [z, W] = _(K), q = p(() => W(() => K()), []), [U, X] = _(e.workspaceEpoch);
|
|
416
|
+
U !== e.workspaceEpoch && (X(e.workspaceEpoch), W(() => K()));
|
|
417
|
+
const E = G({ surface: A, close: P, collapse: L, isSheet: m });
|
|
418
|
+
he(() => {
|
|
419
|
+
E.current = { surface: A, close: P, collapse: L, isSheet: m };
|
|
416
420
|
});
|
|
417
|
-
const
|
|
421
|
+
const H = Q(
|
|
418
422
|
() => ({
|
|
419
423
|
...t,
|
|
420
|
-
navigation: { chatId:
|
|
424
|
+
navigation: { chatId: S, onChatIdChange: C },
|
|
421
425
|
onClose: P,
|
|
422
426
|
onSurfaceChange: x,
|
|
423
427
|
onSelectionSnapshot: T,
|
|
424
|
-
hostContext:
|
|
428
|
+
hostContext: a ?? null,
|
|
425
429
|
scope: n ?? null,
|
|
426
430
|
support: o ?? null,
|
|
427
|
-
...
|
|
431
|
+
...c ? { canvas: c } : {}
|
|
428
432
|
}),
|
|
429
433
|
[
|
|
430
434
|
t,
|
|
431
|
-
|
|
435
|
+
S,
|
|
432
436
|
C,
|
|
433
437
|
P,
|
|
434
438
|
x,
|
|
435
439
|
T,
|
|
436
|
-
|
|
440
|
+
a,
|
|
437
441
|
n,
|
|
438
442
|
o,
|
|
439
|
-
|
|
443
|
+
c
|
|
440
444
|
]
|
|
441
445
|
);
|
|
442
|
-
|
|
443
|
-
if (!
|
|
444
|
-
const
|
|
445
|
-
const
|
|
446
|
+
O(() => {
|
|
447
|
+
if (!h) return;
|
|
448
|
+
const u = (w) => {
|
|
449
|
+
const I = We({
|
|
446
450
|
event: w,
|
|
447
451
|
pane: b.current,
|
|
448
452
|
active: document.activeElement,
|
|
449
453
|
doc: document,
|
|
450
|
-
surface:
|
|
451
|
-
isSheet:
|
|
454
|
+
surface: E.current.surface,
|
|
455
|
+
isSheet: E.current.isSheet
|
|
452
456
|
});
|
|
453
|
-
|
|
457
|
+
I && (w.preventDefault(), I === "collapse" ? E.current.collapse() : E.current.close());
|
|
454
458
|
};
|
|
455
|
-
return document.addEventListener("keydown",
|
|
456
|
-
}, [
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
const
|
|
460
|
-
if (
|
|
461
|
-
const
|
|
462
|
-
|
|
459
|
+
return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
|
|
460
|
+
}, [h]);
|
|
461
|
+
const r = G(null);
|
|
462
|
+
O(() => {
|
|
463
|
+
const u = b.current;
|
|
464
|
+
if (h) {
|
|
465
|
+
const R = document.activeElement;
|
|
466
|
+
R && R !== document.body && !u?.contains(R) && (r.current = R);
|
|
463
467
|
return;
|
|
464
468
|
}
|
|
465
|
-
const w =
|
|
466
|
-
|
|
467
|
-
const
|
|
468
|
-
w &&
|
|
469
|
-
}, [
|
|
470
|
-
if (!
|
|
471
|
-
const
|
|
472
|
-
if (!
|
|
469
|
+
const w = r.current;
|
|
470
|
+
r.current = null;
|
|
471
|
+
const I = document.activeElement, M = !I || I === document.body || (u?.contains(I) ?? !1);
|
|
472
|
+
w && M && w.isConnected && w.focus?.();
|
|
473
|
+
}, [h]), O(() => {
|
|
474
|
+
if (!y) return;
|
|
475
|
+
const u = b.current;
|
|
476
|
+
if (!u) return;
|
|
473
477
|
const w = () => {
|
|
474
|
-
const s = Array.from(
|
|
478
|
+
const s = Array.from(u.querySelectorAll(Fe)), v = s.filter((F) => F.getClientRects().length > 0);
|
|
475
479
|
return v.length > 0 ? v : s;
|
|
476
480
|
};
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
if (s.key !== "Tab" ||
|
|
481
|
+
u.contains(document.activeElement) || (w()[0] ?? u).focus?.();
|
|
482
|
+
const I = (s) => {
|
|
483
|
+
if (s.key !== "Tab" || B(s.target, u) || B(document.activeElement, u)) return;
|
|
480
484
|
const v = w();
|
|
481
485
|
if (v.length === 0) {
|
|
482
|
-
s.preventDefault(),
|
|
486
|
+
s.preventDefault(), u.focus?.();
|
|
483
487
|
return;
|
|
484
488
|
}
|
|
485
|
-
const
|
|
486
|
-
!s.shiftKey &&
|
|
487
|
-
},
|
|
488
|
-
(s) => s !==
|
|
489
|
-
),
|
|
490
|
-
return
|
|
491
|
-
document.removeEventListener("keydown",
|
|
492
|
-
|
|
489
|
+
const F = v[0], ee = v[v.length - 1], $ = document.activeElement;
|
|
490
|
+
!s.shiftKey && $ === ee ? (s.preventDefault(), F.focus()) : s.shiftKey && $ === F ? (s.preventDefault(), ee.focus()) : $ && !u.contains($) && (s.preventDefault(), F.focus());
|
|
491
|
+
}, M = Array.from(u.parentElement?.children ?? []).filter(
|
|
492
|
+
(s) => s !== u && s instanceof HTMLElement
|
|
493
|
+
), R = M.map((s) => s.hasAttribute("inert"));
|
|
494
|
+
return M.forEach((s) => s.setAttribute("inert", "")), document.addEventListener("keydown", I), () => {
|
|
495
|
+
document.removeEventListener("keydown", I), M.forEach((s, v) => {
|
|
496
|
+
R[v] || s.removeAttribute("inert");
|
|
493
497
|
});
|
|
494
498
|
};
|
|
495
|
-
}, [
|
|
496
|
-
const
|
|
497
|
-
() => typeof window > "u" ? null :
|
|
499
|
+
}, [y]);
|
|
500
|
+
const i = Q(
|
|
501
|
+
() => typeof window > "u" ? null : Me(window.history),
|
|
498
502
|
[]
|
|
499
503
|
);
|
|
500
|
-
|
|
501
|
-
if (!
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
|
|
504
|
+
O(() => {
|
|
505
|
+
if (!y || !i) return;
|
|
506
|
+
i.enter();
|
|
507
|
+
const u = () => {
|
|
508
|
+
i.handlePop() && E.current.close();
|
|
505
509
|
};
|
|
506
|
-
return window.addEventListener("popstate",
|
|
507
|
-
window.removeEventListener("popstate",
|
|
510
|
+
return window.addEventListener("popstate", u), () => {
|
|
511
|
+
window.removeEventListener("popstate", u), i.leave();
|
|
508
512
|
};
|
|
509
|
-
}, [
|
|
510
|
-
const
|
|
513
|
+
}, [y, i]);
|
|
514
|
+
const f = A === "fullscreen", fe = h ? m ? { display: "flex", position: "fixed", inset: 0, zIndex: 50, width: "100%", height: "100%" } : f ? { display: "flex", position: "relative", flex: "1 1 0%", minWidth: 0, height: "100%", minHeight: 0 } : {
|
|
511
515
|
display: "flex",
|
|
512
516
|
position: "relative",
|
|
513
517
|
flex: "0 0 auto",
|
|
@@ -515,28 +519,28 @@ function Xe({
|
|
|
515
519
|
height: "100%",
|
|
516
520
|
minHeight: 0
|
|
517
521
|
} : { display: "none" };
|
|
518
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ g(
|
|
519
523
|
"aside",
|
|
520
524
|
{
|
|
521
525
|
ref: b,
|
|
522
526
|
"aria-label": d,
|
|
523
|
-
"aria-hidden": !
|
|
524
|
-
...
|
|
525
|
-
tabIndex:
|
|
527
|
+
"aria-hidden": !h,
|
|
528
|
+
...y ? { role: "dialog", "aria-modal": !0 } : {},
|
|
529
|
+
tabIndex: y ? -1 : void 0,
|
|
526
530
|
"data-streamoid-agent": "pane",
|
|
527
531
|
"data-surface": A,
|
|
528
|
-
"data-layout":
|
|
532
|
+
"data-layout": m ? "sheet" : "docked",
|
|
529
533
|
"data-testid": "agent-side-pane",
|
|
530
|
-
className:
|
|
534
|
+
className: l,
|
|
531
535
|
style: {
|
|
532
536
|
flexDirection: "column",
|
|
533
537
|
boxSizing: "border-box",
|
|
534
538
|
background: "var(--alias-surface-base)",
|
|
535
|
-
borderRight:
|
|
536
|
-
...
|
|
539
|
+
borderRight: m || f ? void 0 : "1px solid var(--alias-border-subtle)",
|
|
540
|
+
...fe
|
|
537
541
|
},
|
|
538
|
-
children: N ? /* @__PURE__ */
|
|
539
|
-
!
|
|
542
|
+
children: N ? /* @__PURE__ */ oe(ve, { children: [
|
|
543
|
+
!m && !f ? /* @__PURE__ */ g(
|
|
540
544
|
Ie,
|
|
541
545
|
{
|
|
542
546
|
width: e.width,
|
|
@@ -548,7 +552,7 @@ function Xe({
|
|
|
548
552
|
ariaLabel: "Resize Ask CXO"
|
|
549
553
|
}
|
|
550
554
|
) : null,
|
|
551
|
-
/* @__PURE__ */
|
|
555
|
+
/* @__PURE__ */ g(
|
|
552
556
|
"div",
|
|
553
557
|
{
|
|
554
558
|
style: {
|
|
@@ -559,23 +563,23 @@ function Xe({
|
|
|
559
563
|
minWidth: 0,
|
|
560
564
|
overflow: "hidden"
|
|
561
565
|
},
|
|
562
|
-
children: /* @__PURE__ */
|
|
566
|
+
children: /* @__PURE__ */ g(Oe, { onRetry: q, children: /* @__PURE__ */ g(me, { fallback: /* @__PURE__ */ g(_e, {}), children: /* @__PURE__ */ g(z, { adapters: H }, e.workspaceEpoch) }) }, e.workspaceEpoch)
|
|
563
567
|
}
|
|
564
568
|
)
|
|
565
569
|
] }) : null
|
|
566
570
|
}
|
|
567
571
|
);
|
|
568
572
|
}
|
|
569
|
-
function
|
|
570
|
-
return
|
|
573
|
+
function Be(e, t) {
|
|
574
|
+
return be(e, t).length;
|
|
571
575
|
}
|
|
572
576
|
export {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
577
|
+
re as AGENT_PANE_DOCKED_MEDIA_QUERY,
|
|
578
|
+
Y as AGENT_PANE_WIDTH_KEY,
|
|
579
|
+
Ye as AgentSidePane,
|
|
580
|
+
Ae as DEFAULT_PANE_PERSIST_KEY,
|
|
581
|
+
be as deriveScopeSuggestions,
|
|
582
|
+
Be as paneSuggestionCount,
|
|
583
|
+
te as prefetchAgent,
|
|
584
|
+
$e as useAgentPaneController
|
|
581
585
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamoid/agent",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.55",
|
|
4
4
|
"description": "Native (no-iframe) embeddable Streamoid agent chat panel. Host renders <AgentPanel adapters={\u2026}/>. Prebuilt bundle \u2014 source + build live in the stream-agent repo.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|