@truefoundry/trueforge-ui 0.3.0-rc.2 → 0.3.0-rc.4
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/CHANGELOG.md +63 -0
- package/README.md +18 -10
- package/dist/{AgentCodeSnippets-637HQUXD.js → AgentCodeSnippets-U6KQWVBJ.js} +38 -23
- package/dist/AgentCodeSnippets-U6KQWVBJ.js.map +1 -0
- package/dist/AgentMetricChart-3D6FUFO6.js +15 -0
- package/dist/{AgentOverview-3FJ5EE6N.js → AgentOverview-RLJ6HZCN.js} +7 -7
- package/dist/{AgentSessionEventTimeline-VELWUYPR.js → AgentSessionEventTimeline-CDXRRUZQ.js} +8 -8
- package/dist/{AgentSessionEventTimeline-VELWUYPR.js.map → AgentSessionEventTimeline-CDXRRUZQ.js.map} +1 -1
- package/dist/{AgentSessionEventTimelineChart-CUKETHWM.js → AgentSessionEventTimelineChart-S2WX6ZEA.js} +12 -12
- package/dist/AgentSessionEventTimelineChart-S2WX6ZEA.js.map +1 -0
- package/dist/{AgentSessions-T7MOGOTZ.js → AgentSessions-UI3L7XY2.js} +72 -24
- package/dist/AgentSessions-UI3L7XY2.js.map +1 -0
- package/dist/{ConnectorSettings-ESZ2RSRG.js → ConnectorSettings-OIGAC2HU.js} +156 -116
- package/dist/ConnectorSettings-OIGAC2HU.js.map +1 -0
- package/dist/{DockLayout-NLFNU6F2.js → DockLayout-J5BRKMJZ.js} +10 -10
- package/dist/{DrawerLayout-PR3SMKA6.js → DrawerLayout-65YHGHIF.js} +13 -11
- package/dist/DrawerLayout-65YHGHIF.js.map +1 -0
- package/dist/{ModelSettings-LYW64IRR.js → ModelSettings-VP6WCMGT.js} +10 -10
- package/dist/{ModelSettings-LYW64IRR.js.map → ModelSettings-VP6WCMGT.js.map} +1 -1
- package/dist/OpenUiFenceBlock-UTDCTNTM.js +9 -0
- package/dist/{SandboxSettings-DF64LHYI.js → SandboxSettings-GTZT7LD6.js} +9 -9
- package/dist/SchedulesPage-ARWU7BZF.js +15 -0
- package/dist/{SettingsBuilder-LSXK2VN4.js → SettingsBuilder-A4BPYIFZ.js} +8 -8
- package/dist/{ShellRouteSync-B22IAV2W.js → ShellRouteSync-SSLGM35F.js} +157 -22
- package/dist/ShellRouteSync-SSLGM35F.js.map +1 -0
- package/dist/{SidebarLayout-XW6LXB7R.js → SidebarLayout-MFDOGAVJ.js} +74 -53
- package/dist/SidebarLayout-MFDOGAVJ.js.map +1 -0
- package/dist/{SkillSettings-64VXUO6J.js → SkillSettings-WQPUQ5TE.js} +18 -13
- package/dist/SkillSettings-WQPUQ5TE.js.map +1 -0
- package/dist/{TrueForgeUIWithRouter-3TSLV22Q.js → TrueForgeUIWithRouter-5CDICMCE.js} +9 -9
- package/dist/{WidgetLayout-Q5P7PYSJ.js → WidgetLayout-HE7E4UL5.js} +10 -10
- package/dist/{chunk-SQGT43Z3.js → chunk-2BDTG544.js} +21 -4
- package/dist/chunk-2BDTG544.js.map +1 -0
- package/dist/{chunk-YQO2NMJ3.js → chunk-2OKGEU6X.js} +4425 -2982
- package/dist/chunk-2OKGEU6X.js.map +1 -0
- package/dist/{chunk-FQK2XVVE.js → chunk-6CFZHEYH.js} +225 -72
- package/dist/chunk-6CFZHEYH.js.map +1 -0
- package/dist/{chunk-QC42MLAK.js → chunk-7AAO4UDQ.js} +4 -3
- package/dist/chunk-7AAO4UDQ.js.map +1 -0
- package/dist/chunk-E4GVP6PM.js +195 -0
- package/dist/chunk-E4GVP6PM.js.map +1 -0
- package/dist/{chunk-LGRHHFHN.js → chunk-F7ZAQIRE.js} +166 -45
- package/dist/chunk-F7ZAQIRE.js.map +1 -0
- package/dist/{chunk-VJ7BZGAF.js → chunk-GTTMLDCI.js} +2 -2
- package/dist/{chunk-5I2COQNL.js → chunk-IOPHQEUY.js} +13 -11
- package/dist/chunk-IOPHQEUY.js.map +1 -0
- package/dist/{chunk-G2TUAD65.js → chunk-KCYBMKQL.js} +235 -108
- package/dist/chunk-KCYBMKQL.js.map +1 -0
- package/dist/{chunk-H6WTY5PM.js → chunk-MAA7U4RF.js} +17 -227
- package/dist/chunk-MAA7U4RF.js.map +1 -0
- package/dist/{chunk-GXYAOAK5.js → chunk-MJULWIPI.js} +224 -162
- package/dist/chunk-MJULWIPI.js.map +1 -0
- package/dist/chunk-P7J2ABEP.js +587 -0
- package/dist/chunk-P7J2ABEP.js.map +1 -0
- package/dist/{chunk-VUMGMGKZ.js → chunk-TGKQRK3S.js} +52 -8
- package/dist/chunk-TGKQRK3S.js.map +1 -0
- package/dist/{chunk-I3AL54MA.js → chunk-VXKNS7FH.js} +28 -24
- package/dist/chunk-VXKNS7FH.js.map +1 -0
- package/dist/chunk-XO3FYN2W.js +517 -0
- package/dist/chunk-XO3FYN2W.js.map +1 -0
- package/dist/{createTrueFoundryServer-CmZnBh_l.d.ts → createTrueFoundryServer-B_FYhSdn.d.ts} +8 -5
- package/dist/index.d.ts +300 -89
- package/dist/index.js +65 -488
- package/dist/index.js.map +1 -1
- package/dist/plugins/trueforge-agent-server-adapter/index.d.ts +44 -13
- package/dist/plugins/trueforge-agent-server-adapter/index.js +73 -37
- package/dist/plugins/trueforge-agent-server-adapter/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/AgentCodeSnippets-637HQUXD.js.map +0 -1
- package/dist/AgentMetricChart-4FYECRIN.js +0 -15
- package/dist/AgentSessionEventTimelineChart-CUKETHWM.js.map +0 -1
- package/dist/AgentSessions-T7MOGOTZ.js.map +0 -1
- package/dist/ConnectorSettings-ESZ2RSRG.js.map +0 -1
- package/dist/DrawerLayout-PR3SMKA6.js.map +0 -1
- package/dist/OpenUiFenceBlock-JEPNPJ7U.js +0 -9
- package/dist/SchedulesPage-WQU4H25F.js +0 -15
- package/dist/ShellRouteSync-B22IAV2W.js.map +0 -1
- package/dist/SidebarLayout-XW6LXB7R.js.map +0 -1
- package/dist/SkillSettings-64VXUO6J.js.map +0 -1
- package/dist/chunk-5I2COQNL.js.map +0 -1
- package/dist/chunk-BWHOZFIV.js +0 -587
- package/dist/chunk-BWHOZFIV.js.map +0 -1
- package/dist/chunk-FQK2XVVE.js.map +0 -1
- package/dist/chunk-G2TUAD65.js.map +0 -1
- package/dist/chunk-GXYAOAK5.js.map +0 -1
- package/dist/chunk-H6WTY5PM.js.map +0 -1
- package/dist/chunk-I3AL54MA.js.map +0 -1
- package/dist/chunk-LGRHHFHN.js.map +0 -1
- package/dist/chunk-NHHSZB5N.js +0 -74
- package/dist/chunk-NHHSZB5N.js.map +0 -1
- package/dist/chunk-QC42MLAK.js.map +0 -1
- package/dist/chunk-SFZNIO6U.js +0 -18
- package/dist/chunk-SFZNIO6U.js.map +0 -1
- package/dist/chunk-SQGT43Z3.js.map +0 -1
- package/dist/chunk-VUMGMGKZ.js.map +0 -1
- package/dist/chunk-YQO2NMJ3.js.map +0 -1
- /package/dist/{AgentMetricChart-4FYECRIN.js.map → AgentMetricChart-3D6FUFO6.js.map} +0 -0
- /package/dist/{AgentOverview-3FJ5EE6N.js.map → AgentOverview-RLJ6HZCN.js.map} +0 -0
- /package/dist/{DockLayout-NLFNU6F2.js.map → DockLayout-J5BRKMJZ.js.map} +0 -0
- /package/dist/{OpenUiFenceBlock-JEPNPJ7U.js.map → OpenUiFenceBlock-UTDCTNTM.js.map} +0 -0
- /package/dist/{SandboxSettings-DF64LHYI.js.map → SandboxSettings-GTZT7LD6.js.map} +0 -0
- /package/dist/{SchedulesPage-WQU4H25F.js.map → SchedulesPage-ARWU7BZF.js.map} +0 -0
- /package/dist/{SettingsBuilder-LSXK2VN4.js.map → SettingsBuilder-A4BPYIFZ.js.map} +0 -0
- /package/dist/{TrueForgeUIWithRouter-3TSLV22Q.js.map → TrueForgeUIWithRouter-5CDICMCE.js.map} +0 -0
- /package/dist/{WidgetLayout-Q5P7PYSJ.js.map → WidgetLayout-HE7E4UL5.js.map} +0 -0
- /package/dist/{chunk-VJ7BZGAF.js.map → chunk-GTTMLDCI.js.map} +0 -0
|
@@ -4,30 +4,63 @@ import {
|
|
|
4
4
|
matchLocation,
|
|
5
5
|
placesEqual,
|
|
6
6
|
sanitizeSearchForPlace
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2BDTG544.js";
|
|
8
8
|
import {
|
|
9
9
|
sessionIsCreateAgent
|
|
10
10
|
} from "./chunk-RDXBMTP5.js";
|
|
11
|
-
import "./chunk-NHHSZB5N.js";
|
|
12
11
|
import {
|
|
12
|
+
findAgentByName
|
|
13
|
+
} from "./chunk-E4GVP6PM.js";
|
|
14
|
+
import {
|
|
15
|
+
libraryAgentId,
|
|
13
16
|
toEffectiveRoutes,
|
|
14
17
|
useOptionalAgentSessionsServer,
|
|
15
18
|
useOptionalCatalogServer,
|
|
16
19
|
useOptionalScheduleServer,
|
|
17
20
|
useOptionalServer,
|
|
18
21
|
useServerCapabilities,
|
|
22
|
+
useServerCapabilitiesSettled,
|
|
19
23
|
useShellMode
|
|
20
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-6CFZHEYH.js";
|
|
21
25
|
|
|
22
26
|
// src/routing/ShellRouteSync.tsx
|
|
23
27
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
24
28
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
25
29
|
|
|
30
|
+
// src/utils/historyAgentSearch.ts
|
|
31
|
+
var TRY_AGENT_NAME_QUERY = "try_agent_name";
|
|
32
|
+
var HISTORY_AGENT_NAME_QUERY = "history_agent_name";
|
|
33
|
+
function nonEmpty(value) {
|
|
34
|
+
return value != null && value.length > 0 ? value : null;
|
|
35
|
+
}
|
|
36
|
+
function readHistoryAgentSearch(search) {
|
|
37
|
+
const params = new URLSearchParams(search.startsWith("?") ? search.slice(1) : search);
|
|
38
|
+
const tryAgentName = nonEmpty(params.get(TRY_AGENT_NAME_QUERY));
|
|
39
|
+
if (tryAgentName != null) return { intent: "try-agent", agentName: tryAgentName };
|
|
40
|
+
const historyAgentName = nonEmpty(params.get(HISTORY_AGENT_NAME_QUERY));
|
|
41
|
+
return historyAgentName == null ? null : { intent: "history", agentName: historyAgentName };
|
|
42
|
+
}
|
|
43
|
+
function writeHistoryAgentSearch(params, next) {
|
|
44
|
+
params.delete(TRY_AGENT_NAME_QUERY);
|
|
45
|
+
params.delete(HISTORY_AGENT_NAME_QUERY);
|
|
46
|
+
if (next == null) return;
|
|
47
|
+
params.set(next.intent === "try-agent" ? TRY_AGENT_NAME_QUERY : HISTORY_AGENT_NAME_QUERY, next.agentName);
|
|
48
|
+
}
|
|
49
|
+
function updateHistoryAgentSearch(search, next) {
|
|
50
|
+
const params = new URLSearchParams(search.startsWith("?") ? search.slice(1) : search);
|
|
51
|
+
writeHistoryAgentSearch(params, next);
|
|
52
|
+
const updated = params.toString();
|
|
53
|
+
return updated.length > 0 ? `?${updated}` : "";
|
|
54
|
+
}
|
|
55
|
+
|
|
26
56
|
// src/routing/derivePlace.ts
|
|
27
57
|
function deriveChatPlace(snapshot) {
|
|
28
58
|
const sessionId = snapshot.activeRemoteId ?? snapshot.pendingSessionId;
|
|
29
59
|
if (sessionId != null) return { type: "session", sessionId };
|
|
30
60
|
const { mode, agentConfigMode } = snapshot;
|
|
61
|
+
if (mode.status === "active" && mode.isMutable && mode.isCreateAgent) {
|
|
62
|
+
return { type: "buildAgent" };
|
|
63
|
+
}
|
|
31
64
|
if (mode.status === "active" && !mode.isMutable && agentConfigMode !== "SingleAgent") {
|
|
32
65
|
const agentName = mode.agentName ?? mode.agentId;
|
|
33
66
|
if (agentName != null) return { type: "agent", agentName };
|
|
@@ -46,6 +79,9 @@ function derivePlace(snapshot) {
|
|
|
46
79
|
}
|
|
47
80
|
|
|
48
81
|
// src/routing/ShellRouteSync.tsx
|
|
82
|
+
function placeOwnsHistoryAgentSearch(place) {
|
|
83
|
+
return place.type === "root" || place.type === "agent" || place.type === "session";
|
|
84
|
+
}
|
|
49
85
|
function ShellRouteSync({
|
|
50
86
|
routes,
|
|
51
87
|
activeRemoteId,
|
|
@@ -57,6 +93,7 @@ function ShellRouteSync({
|
|
|
57
93
|
const sessions = useOptionalAgentSessionsServer();
|
|
58
94
|
const schedules = useOptionalScheduleServer();
|
|
59
95
|
const capabilities = useServerCapabilities();
|
|
96
|
+
const capabilitiesSettled = useServerCapabilitiesSettled();
|
|
60
97
|
const navigate = useNavigate();
|
|
61
98
|
const location = useLocation();
|
|
62
99
|
const effectiveRoutes = useMemo(
|
|
@@ -85,8 +122,12 @@ function ShellRouteSync({
|
|
|
85
122
|
const placeKey = JSON.stringify(place);
|
|
86
123
|
const selfNavPathRef = useRef(null);
|
|
87
124
|
const prevPlaceRef = useRef(null);
|
|
125
|
+
const appliedUrlPlaceRef = useRef(null);
|
|
88
126
|
const bootedRef = useRef(false);
|
|
127
|
+
const bootPlaceRef = useRef(null);
|
|
128
|
+
const bootHistoryAgentRef = useRef(null);
|
|
89
129
|
const requestedSessionRef = useRef(null);
|
|
130
|
+
const requestedHistoryAgentRef = useRef(null);
|
|
90
131
|
const shellSyncStartedRef = useRef(false);
|
|
91
132
|
const urlSyncStartedRef = useRef(false);
|
|
92
133
|
const openSession = useCallback(
|
|
@@ -111,6 +152,53 @@ function ShellRouteSync({
|
|
|
111
152
|
},
|
|
112
153
|
[server, shell]
|
|
113
154
|
);
|
|
155
|
+
const applyHistoryAgentSearch = useCallback(
|
|
156
|
+
(next) => {
|
|
157
|
+
if (next == null) {
|
|
158
|
+
requestedHistoryAgentRef.current = null;
|
|
159
|
+
bootHistoryAgentRef.current = null;
|
|
160
|
+
shell.setHistoryAgentFilter(null);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const requestKey = `${next.intent}\0${next.agentName}`;
|
|
164
|
+
const current = shell.historyAgentFilter;
|
|
165
|
+
if (current?.intent === next.intent && current.agentName === next.agentName && current.agentId != null) {
|
|
166
|
+
requestedHistoryAgentRef.current = null;
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
requestedHistoryAgentRef.current = requestKey;
|
|
170
|
+
shell.setHistoryAgentFilter(next);
|
|
171
|
+
if (server == null) return;
|
|
172
|
+
void findAgentByName({ server, agentName: next.agentName }).then((agent) => {
|
|
173
|
+
if (requestedHistoryAgentRef.current !== requestKey) return;
|
|
174
|
+
if (agent == null) {
|
|
175
|
+
requestedHistoryAgentRef.current = null;
|
|
176
|
+
bootHistoryAgentRef.current = null;
|
|
177
|
+
shell.setHistoryAgentFilter(null);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
requestedHistoryAgentRef.current = null;
|
|
181
|
+
shell.setHistoryAgentFilter({
|
|
182
|
+
agentId: libraryAgentId(agent),
|
|
183
|
+
agentName: agent.name,
|
|
184
|
+
intent: next.intent
|
|
185
|
+
});
|
|
186
|
+
}).catch(() => {
|
|
187
|
+
if (requestedHistoryAgentRef.current !== requestKey) return;
|
|
188
|
+
requestedHistoryAgentRef.current = null;
|
|
189
|
+
bootHistoryAgentRef.current = null;
|
|
190
|
+
shell.setHistoryAgentFilter(null);
|
|
191
|
+
});
|
|
192
|
+
},
|
|
193
|
+
[server, shell]
|
|
194
|
+
);
|
|
195
|
+
const openAgent = useCallback(
|
|
196
|
+
(agentName) => {
|
|
197
|
+
shell.selectLibraryAgent({ isMutable: false, agentName });
|
|
198
|
+
applyHistoryAgentSearch({ intent: "try-agent", agentName });
|
|
199
|
+
},
|
|
200
|
+
[applyHistoryAgentSearch, shell]
|
|
201
|
+
);
|
|
114
202
|
const applyPlace = useCallback(
|
|
115
203
|
(target) => {
|
|
116
204
|
switch (target.type) {
|
|
@@ -129,6 +217,9 @@ function ShellRouteSync({
|
|
|
129
217
|
case "schedules":
|
|
130
218
|
shell.setSchedulesOpen(true);
|
|
131
219
|
return;
|
|
220
|
+
case "buildAgent":
|
|
221
|
+
shell.openAgentBuilder();
|
|
222
|
+
return;
|
|
132
223
|
case "session":
|
|
133
224
|
shell.setLibraryOpen(false);
|
|
134
225
|
if (shell.pendingSessionId === target.sessionId || activeRemoteId === target.sessionId) return;
|
|
@@ -136,7 +227,7 @@ function ShellRouteSync({
|
|
|
136
227
|
return;
|
|
137
228
|
case "agent":
|
|
138
229
|
shell.setLibraryOpen(false);
|
|
139
|
-
|
|
230
|
+
openAgent(target.agentName);
|
|
140
231
|
return;
|
|
141
232
|
case "root":
|
|
142
233
|
shell.setSettingsOpen(false);
|
|
@@ -156,16 +247,25 @@ function ShellRouteSync({
|
|
|
156
247
|
}
|
|
157
248
|
}
|
|
158
249
|
},
|
|
159
|
-
[shell, activeRemoteId, openSession]
|
|
250
|
+
[shell, activeRemoteId, openAgent, openSession]
|
|
160
251
|
);
|
|
161
252
|
useEffect(() => {
|
|
162
253
|
if (bootedRef.current) return;
|
|
254
|
+
const configuredUrlPlace = matchLocation({
|
|
255
|
+
pathname: location.pathname,
|
|
256
|
+
search: location.search,
|
|
257
|
+
routes
|
|
258
|
+
});
|
|
259
|
+
if (!capabilitiesSettled && configuredUrlPlace?.type === "settings") return;
|
|
163
260
|
bootedRef.current = true;
|
|
164
261
|
const urlPlace = matchLocation({
|
|
165
262
|
pathname: location.pathname,
|
|
166
263
|
search: location.search,
|
|
167
264
|
routes: effectiveRoutes
|
|
168
265
|
}) ?? { type: "root" };
|
|
266
|
+
const historyAgentSearch = urlPlace.type === "agent" ? { intent: "try-agent", agentName: urlPlace.agentName } : placeOwnsHistoryAgentSearch(urlPlace) ? readHistoryAgentSearch(location.search) : null;
|
|
267
|
+
bootHistoryAgentRef.current = historyAgentSearch;
|
|
268
|
+
appliedUrlPlaceRef.current = urlPlace;
|
|
169
269
|
const settingsOnBoot = settingsChromeEnabled && (initialSettingsOpen || urlPlace.type === "settings");
|
|
170
270
|
if (urlPlace.type === "settings") {
|
|
171
271
|
if (settingsChromeEnabled) shell.setSettingsOpen(true);
|
|
@@ -182,34 +282,58 @@ function ShellRouteSync({
|
|
|
182
282
|
if (!placesEqual(chatPlace, urlPlace)) applyPlace(urlPlace);
|
|
183
283
|
if (settingsOnBoot) shell.setSettingsOpen(true);
|
|
184
284
|
}
|
|
285
|
+
if (urlPlace.type !== "agent" && historyAgentSearch != null) {
|
|
286
|
+
applyHistoryAgentSearch(historyAgentSearch);
|
|
287
|
+
} else if (!placeOwnsHistoryAgentSearch(urlPlace)) {
|
|
288
|
+
applyHistoryAgentSearch(null);
|
|
289
|
+
}
|
|
185
290
|
const desiredPlace = settingsOnBoot ? { type: "settings" } : urlPlace;
|
|
291
|
+
bootPlaceRef.current = placesEqual(place, desiredPlace) ? null : desiredPlace;
|
|
186
292
|
const desiredPath = buildPath(desiredPlace, effectiveRoutes);
|
|
187
|
-
const desiredSearch =
|
|
293
|
+
const desiredSearch = updateHistoryAgentSearch(
|
|
294
|
+
sanitizeSearchForPlace(desiredPlace, location.search),
|
|
295
|
+
historyAgentSearch
|
|
296
|
+
);
|
|
188
297
|
prevPlaceRef.current = desiredPlace;
|
|
189
298
|
if (desiredPath != null && (desiredPath !== location.pathname || desiredSearch !== location.search)) {
|
|
190
299
|
selfNavPathRef.current = desiredPath !== location.pathname ? desiredPath : null;
|
|
191
300
|
navigate({ pathname: desiredPath, search: desiredSearch, hash: location.hash }, { replace: true });
|
|
192
301
|
}
|
|
193
|
-
}, []);
|
|
302
|
+
}, [capabilitiesSettled]);
|
|
194
303
|
useEffect(() => {
|
|
195
304
|
if (!bootedRef.current) return;
|
|
196
305
|
if (!shellSyncStartedRef.current) {
|
|
197
306
|
shellSyncStartedRef.current = true;
|
|
198
307
|
return;
|
|
199
308
|
}
|
|
309
|
+
const bootPlace = bootPlaceRef.current;
|
|
310
|
+
if (bootPlace != null) {
|
|
311
|
+
if (!placesEqual(place, bootPlace)) return;
|
|
312
|
+
bootPlaceRef.current = null;
|
|
313
|
+
}
|
|
200
314
|
const target = buildPath(place, effectiveRoutes);
|
|
201
315
|
if (target == null) return;
|
|
202
316
|
const basename = effectiveRoutes.basename.endsWith("/") ? effectiveRoutes.basename.slice(0, -1) : effectiveRoutes.basename;
|
|
203
317
|
const browserPathname = `${basename}${location.pathname}` || "/";
|
|
204
318
|
const latestSearch = window.location.pathname === browserPathname ? window.location.search : location.search;
|
|
205
|
-
const
|
|
319
|
+
const ownsHistoryAgentSearch = placeOwnsHistoryAgentSearch(place);
|
|
320
|
+
const historyAgentSearch = ownsHistoryAgentSearch ? shell.historyAgentFilter == null ? bootHistoryAgentRef.current : {
|
|
321
|
+
intent: shell.historyAgentFilter.intent,
|
|
322
|
+
agentName: shell.historyAgentFilter.agentName
|
|
323
|
+
} : null;
|
|
324
|
+
if (!ownsHistoryAgentSearch && shell.historyAgentFilter != null) {
|
|
325
|
+
requestedHistoryAgentRef.current = null;
|
|
326
|
+
shell.setHistoryAgentFilter(null);
|
|
327
|
+
}
|
|
328
|
+
if (shell.historyAgentFilter != null) bootHistoryAgentRef.current = null;
|
|
329
|
+
const targetSearch = updateHistoryAgentSearch(sanitizeSearchForPlace(place, latestSearch), historyAgentSearch);
|
|
206
330
|
const prev = prevPlaceRef.current;
|
|
207
331
|
prevPlaceRef.current = place;
|
|
208
332
|
if (target === location.pathname && targetSearch === location.search) return;
|
|
209
333
|
const replace = place.type === "session" && shell.pendingSessionId == null && prev != null && prev.type !== "session";
|
|
210
334
|
selfNavPathRef.current = target !== location.pathname ? target : null;
|
|
211
335
|
navigate({ pathname: target, search: targetSearch, hash: location.hash }, { replace });
|
|
212
|
-
}, [placeKey, routeGatesKey]);
|
|
336
|
+
}, [placeKey, routeGatesKey, shell.historyAgentFilter?.agentName, shell.historyAgentFilter?.intent]);
|
|
213
337
|
useEffect(() => {
|
|
214
338
|
if (!bootedRef.current) return;
|
|
215
339
|
if (!urlSyncStartedRef.current) {
|
|
@@ -218,6 +342,7 @@ function ShellRouteSync({
|
|
|
218
342
|
}
|
|
219
343
|
if (selfNavPathRef.current === location.pathname) {
|
|
220
344
|
selfNavPathRef.current = null;
|
|
345
|
+
appliedUrlPlaceRef.current = place;
|
|
221
346
|
return;
|
|
222
347
|
}
|
|
223
348
|
const urlPlace = matchLocation({
|
|
@@ -231,25 +356,35 @@ function ShellRouteSync({
|
|
|
231
356
|
selfNavPathRef.current = rootPath;
|
|
232
357
|
navigate({ pathname: rootPath, search: rootSearch, hash: location.hash }, { replace: true });
|
|
233
358
|
applyPlace({ type: "root" });
|
|
359
|
+
applyHistoryAgentSearch(readHistoryAgentSearch(rootSearch));
|
|
234
360
|
return;
|
|
235
361
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
362
|
+
const previousUrlPlace = appliedUrlPlaceRef.current;
|
|
363
|
+
appliedUrlPlaceRef.current = urlPlace;
|
|
364
|
+
if (previousUrlPlace == null || !placesEqual(previousUrlPlace, urlPlace)) {
|
|
365
|
+
if (urlPlace.type !== "settings" && shell.settingsOpen) {
|
|
366
|
+
shell.setSettingsOpen(false);
|
|
367
|
+
}
|
|
368
|
+
if (urlPlace.type !== "library" && urlPlace.type !== "libraryAgent" && shell.libraryOpen) {
|
|
369
|
+
shell.setLibraryOpen(false);
|
|
370
|
+
}
|
|
371
|
+
if (urlPlace.type !== "sessionsBrowser" && shell.sessionsOpen) {
|
|
372
|
+
shell.setSessionsOpen(false);
|
|
373
|
+
}
|
|
374
|
+
if (urlPlace.type !== "schedules" && shell.schedulesOpen) {
|
|
375
|
+
shell.setSchedulesOpen(false);
|
|
376
|
+
}
|
|
377
|
+
applyPlace(urlPlace);
|
|
244
378
|
}
|
|
245
|
-
if (urlPlace.type !== "
|
|
246
|
-
|
|
379
|
+
if (urlPlace.type !== "agent" && placeOwnsHistoryAgentSearch(urlPlace)) {
|
|
380
|
+
applyHistoryAgentSearch(readHistoryAgentSearch(location.search));
|
|
381
|
+
} else if (!placeOwnsHistoryAgentSearch(urlPlace)) {
|
|
382
|
+
applyHistoryAgentSearch(null);
|
|
247
383
|
}
|
|
248
|
-
|
|
249
|
-
}, [location.pathname]);
|
|
384
|
+
}, [location.pathname, location.search]);
|
|
250
385
|
return null;
|
|
251
386
|
}
|
|
252
387
|
export {
|
|
253
388
|
ShellRouteSync
|
|
254
389
|
};
|
|
255
|
-
//# sourceMappingURL=ShellRouteSync-
|
|
390
|
+
//# sourceMappingURL=ShellRouteSync-SSLGM35F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/routing/ShellRouteSync.tsx","../src/utils/historyAgentSearch.ts","../src/routing/derivePlace.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nimport { sessionIsCreateAgent } from '../atoms/lib/sessionCreateAgent.js';\nimport { findAgentByName } from '../atoms/lib/useSearchAgentsList.js';\nimport {\n useOptionalAgentSessionsServer,\n useOptionalCatalogServer,\n useOptionalScheduleServer,\n useOptionalServer,\n useServerCapabilities,\n useServerCapabilitiesSettled,\n} from '../server/ServerContext.js';\nimport { libraryAgentId, useShellMode } from '../server/ShellModeContext.js';\nimport { toEffectiveRoutes } from '../server/serverChrome.js';\nimport {\n readHistoryAgentSearch,\n updateHistoryAgentSearch,\n type HistoryAgentSearch,\n} from '../utils/historyAgentSearch.js';\nimport { deriveChatPlace, derivePlace } from './derivePlace.js';\nimport { buildPath, matchLocation, placesEqual, sanitizeSearchForPlace } from './paths.js';\nimport type { ResolvedRoutes, RoutePlace, ShellSnapshot } from './types.js';\n\n// Filter intent follows chat history across chat/session URLs, but must not leak into unrelated surfaces.\nfunction placeOwnsHistoryAgentSearch(place: RoutePlace): boolean {\n return place.type === 'root' || place.type === 'agent' || place.type === 'session';\n}\n\n/**\n * Single bidirectional bridge between shell state and the URL. Mounted under\n * `ShellModeProvider` but outside the keyed chat runtime so boot applies once.\n */\nexport function ShellRouteSync({\n routes,\n activeRemoteId,\n initialSettingsOpen,\n}: {\n routes: ResolvedRoutes;\n activeRemoteId: string | undefined;\n initialSettingsOpen: boolean;\n}) {\n const shell = useShellMode();\n const server = useOptionalServer();\n const catalog = useOptionalCatalogServer();\n const sessions = useOptionalAgentSessionsServer();\n const schedules = useOptionalScheduleServer();\n const capabilities = useServerCapabilities();\n const capabilitiesSettled = useServerCapabilitiesSettled();\n const navigate = useNavigate();\n const location = useLocation();\n // Same gates as sidebar chrome: missing optional ports unregister their paths.\n const effectiveRoutes = useMemo(\n () => toEffectiveRoutes({ routes, catalog, capabilities, sessions, schedules }),\n [routes, catalog, capabilities, sessions, schedules],\n );\n const settingsChromeEnabled = effectiveRoutes.settings != null;\n // Gate identity only — avoid re-syncing when capabilities object identity churns\n // without changing which paths are registered (would clobber window share query).\n const routeGatesKey = [\n effectiveRoutes.settings,\n effectiveRoutes.sessionsBrowser,\n effectiveRoutes.libraryAgent,\n effectiveRoutes.schedules,\n ].join('\\0');\n\n const snapshot: ShellSnapshot = {\n settingsOpen: shell.settingsOpen,\n libraryOpen: shell.libraryOpen,\n sessionsOpen: shell.sessionsOpen,\n libraryAgentId: shell.libraryAgentId,\n schedulesOpen: shell.schedulesOpen,\n pendingSessionId: shell.pendingSessionId,\n activeRemoteId,\n mode: shell.mode,\n agentConfigMode: shell.agentConfigMode,\n };\n\n const place = derivePlace(snapshot);\n const placeKey = JSON.stringify(place);\n\n // Guards. `selfNavPathRef` marks a path we navigated to ourselves so the\n // URL->shell effect does not re-apply it. `prevPlaceRef` powers push/replace.\n const selfNavPathRef = useRef<string | null>(null);\n const prevPlaceRef = useRef<RoutePlace | null>(null);\n const appliedUrlPlaceRef = useRef<RoutePlace | null>(null);\n const bootedRef = useRef(false);\n const bootPlaceRef = useRef<RoutePlace | null>(null);\n const bootHistoryAgentRef = useRef<HistoryAgentSearch | null>(null);\n // Latest session id the URL asked for, so slower lookups cannot bind over it.\n const requestedSessionRef = useRef<string | null>(null);\n const requestedHistoryAgentRef = useRef<string | null>(null);\n // Boot owns the first URL; the ongoing effects skip their initial commit so\n // they do not fight boot with the stale first-render place.\n const shellSyncStartedRef = useRef(false);\n const urlSyncStartedRef = useRef(false);\n\n /**\n * A URL carries only the id, so ask the server whether it names a mutable\n * draft or an agent chat; guessing \"mutable\" opens an agent session as a\n * blank draft. `requestedSessionRef` drops replies a later place superseded.\n */\n const openSession = useCallback(\n (sessionId: string) => {\n requestedSessionRef.current = sessionId;\n if (server == null) {\n shell.openHistorySession({ sessionId });\n return;\n }\n void server\n .getSession({ sessionId })\n .then(session => {\n if (requestedSessionRef.current !== sessionId) return;\n shell.openHistorySession({\n sessionId,\n isMutable: session.isMutable,\n isCreateAgent: sessionIsCreateAgent(session),\n ...(session.agentName != null ? { agentName: session.agentName } : {}),\n });\n })\n .catch(() => {\n if (requestedSessionRef.current !== sessionId) return;\n // Unreachable session: bind by id alone rather than stranding the shell.\n shell.openHistorySession({ sessionId });\n });\n },\n [server, shell],\n );\n\n const applyHistoryAgentSearch = useCallback(\n (next: HistoryAgentSearch | null) => {\n if (next == null) {\n requestedHistoryAgentRef.current = null;\n bootHistoryAgentRef.current = null;\n shell.setHistoryAgentFilter(null);\n return;\n }\n\n const requestKey = `${next.intent}\\0${next.agentName}`;\n const current = shell.historyAgentFilter;\n if (current?.intent === next.intent && current.agentName === next.agentName && current.agentId != null) {\n requestedHistoryAgentRef.current = null;\n return;\n }\n\n requestedHistoryAgentRef.current = requestKey;\n shell.setHistoryAgentFilter(next);\n if (server == null) return;\n\n void findAgentByName({ server, agentName: next.agentName })\n .then(agent => {\n if (requestedHistoryAgentRef.current !== requestKey) return;\n if (agent == null) {\n requestedHistoryAgentRef.current = null;\n bootHistoryAgentRef.current = null;\n shell.setHistoryAgentFilter(null);\n return;\n }\n requestedHistoryAgentRef.current = null;\n shell.setHistoryAgentFilter({\n agentId: libraryAgentId(agent),\n agentName: agent.name,\n intent: next.intent,\n });\n })\n .catch(() => {\n if (requestedHistoryAgentRef.current !== requestKey) return;\n requestedHistoryAgentRef.current = null;\n bootHistoryAgentRef.current = null;\n shell.setHistoryAgentFilter(null);\n });\n },\n [server, shell],\n );\n\n const openAgent = useCallback(\n (agentName: string) => {\n shell.selectLibraryAgent({ isMutable: false, agentName });\n applyHistoryAgentSearch({ intent: 'try-agent', agentName });\n },\n [applyHistoryAgentSearch, shell],\n );\n\n const applyPlace = useCallback(\n (target: RoutePlace) => {\n switch (target.type) {\n case 'settings':\n shell.setSettingsOpen(true);\n return;\n case 'library':\n shell.setLibraryOpen(true);\n return;\n case 'sessionsBrowser':\n shell.setSessionsOpen(true);\n return;\n case 'libraryAgent':\n shell.openLibraryAgent(target.agentId);\n return;\n case 'schedules':\n shell.setSchedulesOpen(true);\n return;\n case 'buildAgent':\n shell.openAgentBuilder();\n return;\n case 'session':\n shell.setLibraryOpen(false);\n if (shell.pendingSessionId === target.sessionId || activeRemoteId === target.sessionId) return;\n openSession(target.sessionId);\n return;\n case 'agent':\n shell.setLibraryOpen(false);\n openAgent(target.agentName);\n return;\n case 'root':\n shell.setSettingsOpen(false);\n shell.setLibraryOpen(false);\n shell.setSchedulesOpen(false);\n switch (shell.agentConfigMode) {\n case 'AgentLibrary':\n shell.openLibraryHome();\n return;\n case 'AgentComposer':\n case 'AgentLibraryWithComposer':\n shell.openDraft();\n return;\n case 'SingleAgent':\n shell.clearChat();\n return;\n }\n }\n },\n [shell, activeRemoteId, openAgent, openSession],\n );\n\n // Boot: URL wins, except an explicit `initialSettingsOpen` overlay. Boot is the\n // sole authority for the first commit and sets the final URL + `prevPlaceRef`.\n useEffect(() => {\n if (bootedRef.current) return;\n const configuredUrlPlace = matchLocation({\n pathname: location.pathname,\n search: location.search,\n routes,\n });\n if (!capabilitiesSettled && configuredUrlPlace?.type === 'settings') return;\n bootedRef.current = true;\n\n const urlPlace = matchLocation({\n pathname: location.pathname,\n search: location.search,\n routes: effectiveRoutes,\n }) ?? { type: 'root' };\n const historyAgentSearch: HistoryAgentSearch | null =\n urlPlace.type === 'agent'\n ? { intent: 'try-agent', agentName: urlPlace.agentName }\n : placeOwnsHistoryAgentSearch(urlPlace)\n ? readHistoryAgentSearch(location.search)\n : null;\n bootHistoryAgentRef.current = historyAgentSearch;\n appliedUrlPlaceRef.current = urlPlace;\n const settingsOnBoot = settingsChromeEnabled && (initialSettingsOpen || urlPlace.type === 'settings');\n\n if (urlPlace.type === 'settings') {\n if (settingsChromeEnabled) shell.setSettingsOpen(true);\n } else if (urlPlace.type === 'library') {\n shell.setLibraryOpen(true);\n } else if (urlPlace.type === 'sessionsBrowser') {\n shell.setSessionsOpen(true);\n } else if (urlPlace.type === 'libraryAgent') {\n shell.openLibraryAgent(urlPlace.agentId);\n } else if (urlPlace.type === 'schedules') {\n shell.setSchedulesOpen(true);\n } else {\n const chatPlace = deriveChatPlace(snapshot);\n if (!placesEqual(chatPlace, urlPlace)) applyPlace(urlPlace);\n if (settingsOnBoot) shell.setSettingsOpen(true);\n }\n if (urlPlace.type !== 'agent' && historyAgentSearch != null) {\n applyHistoryAgentSearch(historyAgentSearch);\n } else if (!placeOwnsHistoryAgentSearch(urlPlace)) {\n applyHistoryAgentSearch(null);\n }\n\n const desiredPlace: RoutePlace = settingsOnBoot ? { type: 'settings' } : urlPlace;\n bootPlaceRef.current = placesEqual(place, desiredPlace) ? null : desiredPlace;\n const desiredPath = buildPath(desiredPlace, effectiveRoutes);\n const desiredSearch = updateHistoryAgentSearch(\n sanitizeSearchForPlace(desiredPlace, location.search),\n historyAgentSearch,\n );\n prevPlaceRef.current = desiredPlace;\n if (desiredPath != null && (desiredPath !== location.pathname || desiredSearch !== location.search)) {\n selfNavPathRef.current = desiredPath !== location.pathname ? desiredPath : null;\n navigate({ pathname: desiredPath, search: desiredSearch, hash: location.hash }, { replace: true });\n }\n // Boot runs once after any capability-dependent Settings destination resolves.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [capabilitiesSettled]);\n\n // Shell -> URL: mirror the derived place. Skip the first commit (boot owns it).\n useEffect(() => {\n if (!bootedRef.current) return;\n if (!shellSyncStartedRef.current) {\n shellSyncStartedRef.current = true;\n return;\n }\n const bootPlace = bootPlaceRef.current;\n if (bootPlace != null) {\n if (!placesEqual(place, bootPlace)) return;\n bootPlaceRef.current = null;\n }\n const target = buildPath(place, effectiveRoutes);\n if (target == null) return; // place has no configured URL (e.g. settings disabled)\n const basename = effectiveRoutes.basename.endsWith('/')\n ? effectiveRoutes.basename.slice(0, -1)\n : effectiveRoutes.basename;\n const browserPathname = `${basename}${location.pathname}` || '/';\n const latestSearch = window.location.pathname === browserPathname ? window.location.search : location.search;\n const ownsHistoryAgentSearch = placeOwnsHistoryAgentSearch(place);\n const historyAgentSearch = ownsHistoryAgentSearch\n ? shell.historyAgentFilter == null\n ? bootHistoryAgentRef.current\n : {\n intent: shell.historyAgentFilter.intent,\n agentName: shell.historyAgentFilter.agentName,\n }\n : null;\n if (!ownsHistoryAgentSearch && shell.historyAgentFilter != null) {\n requestedHistoryAgentRef.current = null;\n shell.setHistoryAgentFilter(null);\n }\n if (shell.historyAgentFilter != null) bootHistoryAgentRef.current = null;\n const targetSearch = updateHistoryAgentSearch(sanitizeSearchForPlace(place, latestSearch), historyAgentSearch);\n\n const prev = prevPlaceRef.current;\n prevPlaceRef.current = place;\n\n if (target === location.pathname && targetSearch === location.search) return;\n\n // Replace when a fresh chat just acquired its session id (same place, new id).\n const replace =\n place.type === 'session' && shell.pendingSessionId == null && prev != null && prev.type !== 'session';\n\n selfNavPathRef.current = target !== location.pathname ? target : null;\n // Query keys owned by other shell places are removed; host keys and hash survive.\n navigate({ pathname: target, search: targetSearch, hash: location.hash }, { replace });\n // location.pathname intentionally excluded: only react to shell-derived place changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [placeKey, routeGatesKey, shell.historyAgentFilter?.agentName, shell.historyAgentFilter?.intent]);\n\n // URL -> shell: apply on genuine location changes (Back/Forward, manual edits).\n useEffect(() => {\n if (!bootedRef.current) return;\n if (!urlSyncStartedRef.current) {\n urlSyncStartedRef.current = true;\n return;\n }\n if (selfNavPathRef.current === location.pathname) {\n selfNavPathRef.current = null;\n appliedUrlPlaceRef.current = place;\n return;\n }\n const urlPlace = matchLocation({\n pathname: location.pathname,\n search: location.search,\n routes: effectiveRoutes,\n });\n if (urlPlace == null) {\n // Unknown path: normalize to root.\n const rootPath = effectiveRoutes.root;\n const rootSearch = sanitizeSearchForPlace({ type: 'root' }, location.search);\n selfNavPathRef.current = rootPath;\n navigate({ pathname: rootPath, search: rootSearch, hash: location.hash }, { replace: true });\n applyPlace({ type: 'root' });\n applyHistoryAgentSearch(readHistoryAgentSearch(rootSearch));\n return;\n }\n const previousUrlPlace = appliedUrlPlaceRef.current;\n appliedUrlPlaceRef.current = urlPlace;\n if (previousUrlPlace == null || !placesEqual(previousUrlPlace, urlPlace)) {\n if (urlPlace.type !== 'settings' && shell.settingsOpen) {\n // Leaving settings via Back to a chat place.\n shell.setSettingsOpen(false);\n }\n if (urlPlace.type !== 'library' && urlPlace.type !== 'libraryAgent' && shell.libraryOpen) {\n shell.setLibraryOpen(false);\n }\n if (urlPlace.type !== 'sessionsBrowser' && shell.sessionsOpen) {\n shell.setSessionsOpen(false);\n }\n if (urlPlace.type !== 'schedules' && shell.schedulesOpen) {\n // Leaving schedules via Back to a chat place.\n shell.setSchedulesOpen(false);\n }\n applyPlace(urlPlace);\n }\n if (urlPlace.type !== 'agent' && placeOwnsHistoryAgentSearch(urlPlace)) {\n applyHistoryAgentSearch(readHistoryAgentSearch(location.search));\n } else if (!placeOwnsHistoryAgentSearch(urlPlace)) {\n applyHistoryAgentSearch(null);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [location.pathname, location.search]);\n\n return null;\n}\n","export const TRY_AGENT_NAME_QUERY = 'try_agent_name';\nexport const HISTORY_AGENT_NAME_QUERY = 'history_agent_name';\n\nexport type HistoryAgentIntent = 'try-agent' | 'history';\n\nexport type HistoryAgentSearch = {\n intent: HistoryAgentIntent;\n agentName: string;\n};\n\nfunction nonEmpty(value: string | null): string | null {\n return value != null && value.length > 0 ? value : null;\n}\n\nexport function readHistoryAgentSearch(search: string): HistoryAgentSearch | null {\n const params = new URLSearchParams(search.startsWith('?') ? search.slice(1) : search);\n const tryAgentName = nonEmpty(params.get(TRY_AGENT_NAME_QUERY));\n if (tryAgentName != null) return { intent: 'try-agent', agentName: tryAgentName };\n const historyAgentName = nonEmpty(params.get(HISTORY_AGENT_NAME_QUERY));\n return historyAgentName == null ? null : { intent: 'history', agentName: historyAgentName };\n}\n\nexport function writeHistoryAgentSearch(params: URLSearchParams, next: HistoryAgentSearch | null): void {\n params.delete(TRY_AGENT_NAME_QUERY);\n params.delete(HISTORY_AGENT_NAME_QUERY);\n if (next == null) return;\n params.set(next.intent === 'try-agent' ? TRY_AGENT_NAME_QUERY : HISTORY_AGENT_NAME_QUERY, next.agentName);\n}\n\nexport function updateHistoryAgentSearch(search: string, next: HistoryAgentSearch | null): string {\n const params = new URLSearchParams(search.startsWith('?') ? search.slice(1) : search);\n writeHistoryAgentSearch(params, next);\n const updated = params.toString();\n return updated.length > 0 ? `?${updated}` : '';\n}\n","import type { RoutePlace, ShellSnapshot } from './types.js';\n\n/**\n * The chat place implied by shell state, ignoring settings, schedules,\n * sessions-browser, and library overlays.\n * SingleAgent canonicalizes to `root` so `/` and `/agents/{name}` alias.\n */\nexport function deriveChatPlace(snapshot: ShellSnapshot): RoutePlace {\n // The live thread wins: reusing a mutable shell switches thread without a\n // remount, leaving `pendingSessionId` on the session the shell last opened.\n // It only leads while a requested session has not reported its thread yet.\n const sessionId = snapshot.activeRemoteId ?? snapshot.pendingSessionId;\n if (sessionId != null) return { type: 'session', sessionId };\n\n const { mode, agentConfigMode } = snapshot;\n if (mode.status === 'active' && mode.isMutable && mode.isCreateAgent) {\n return { type: 'buildAgent' };\n }\n\n if (mode.status === 'active' && !mode.isMutable && agentConfigMode !== 'SingleAgent') {\n const agentName = mode.agentName ?? mode.agentId;\n if (agentName != null) return { type: 'agent', agentName };\n }\n return { type: 'root' };\n}\n\n/** Full place with overlay priority: settings, schedules, sessions, library, chat. */\nexport function derivePlace(snapshot: ShellSnapshot): RoutePlace {\n if (snapshot.settingsOpen) return { type: 'settings' };\n if (snapshot.schedulesOpen) return { type: 'schedules' };\n if (snapshot.sessionsOpen) return { type: 'sessionsBrowser' };\n if (snapshot.libraryOpen && snapshot.libraryAgentId != null) {\n return { type: 'libraryAgent', agentId: snapshot.libraryAgentId };\n }\n if (snapshot.libraryOpen) return { type: 'library' };\n return deriveChatPlace(snapshot);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,aAAa,WAAW,SAAS,cAAc;AACxD,SAAS,aAAa,mBAAmB;;;ACHlC,IAAM,uBAAuB;AAC7B,IAAM,2BAA2B;AASxC,SAAS,SAAS,OAAqC;AACrD,SAAO,SAAS,QAAQ,MAAM,SAAS,IAAI,QAAQ;AACrD;AAEO,SAAS,uBAAuB,QAA2C;AAChF,QAAM,SAAS,IAAI,gBAAgB,OAAO,WAAW,GAAG,IAAI,OAAO,MAAM,CAAC,IAAI,MAAM;AACpF,QAAM,eAAe,SAAS,OAAO,IAAI,oBAAoB,CAAC;AAC9D,MAAI,gBAAgB,KAAM,QAAO,EAAE,QAAQ,aAAa,WAAW,aAAa;AAChF,QAAM,mBAAmB,SAAS,OAAO,IAAI,wBAAwB,CAAC;AACtE,SAAO,oBAAoB,OAAO,OAAO,EAAE,QAAQ,WAAW,WAAW,iBAAiB;AAC5F;AAEO,SAAS,wBAAwB,QAAyB,MAAuC;AACtG,SAAO,OAAO,oBAAoB;AAClC,SAAO,OAAO,wBAAwB;AACtC,MAAI,QAAQ,KAAM;AAClB,SAAO,IAAI,KAAK,WAAW,cAAc,uBAAuB,0BAA0B,KAAK,SAAS;AAC1G;AAEO,SAAS,yBAAyB,QAAgB,MAAyC;AAChG,QAAM,SAAS,IAAI,gBAAgB,OAAO,WAAW,GAAG,IAAI,OAAO,MAAM,CAAC,IAAI,MAAM;AACpF,0BAAwB,QAAQ,IAAI;AACpC,QAAM,UAAU,OAAO,SAAS;AAChC,SAAO,QAAQ,SAAS,IAAI,IAAI,OAAO,KAAK;AAC9C;;;AC3BO,SAAS,gBAAgB,UAAqC;AAInE,QAAM,Y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QAAQ,GAAG;AACxE,UAAI,SAAS,SAAS,cAAc,MAAM,cAAc;AAEtD,cAAM,gBAAgB,KAAK;AAAA,MAC7B;AACA,UAAI,SAAS,SAAS,aAAa,SAAS,SAAS,kBAAkB,MAAM,aAAa;AACxF,cAAM,eAAe,KAAK;AAAA,MAC5B;AACA,UAAI,SAAS,SAAS,qBAAqB,MAAM,cAAc;AAC7D,cAAM,gBAAgB,KAAK;AAAA,MAC7B;AACA,UAAI,SAAS,SAAS,eAAe,MAAM,eAAe;AAExD,cAAM,iBAAiB,KAAK;AAAA,MAC9B;AACA,iBAAW,QAAQ;AAAA,IACrB;AACA,QAAI,SAAS,SAAS,WAAW,4BAA4B,QAAQ,GAAG;AACtE,8BAAwB,uBAAuB,SAAS,MAAM,CAAC;AAAA,IACjE,WAAW,CAAC,4BAA4B,QAAQ,GAAG;AACjD,8BAAwB,IAAI;AAAA,IAC9B;AAAA,EAEF,GAAG,CAAC,SAAS,UAAU,SAAS,MAAM,CAAC;AAEvC,SAAO;AACT;","names":[]}
|
|
@@ -3,37 +3,40 @@ import {
|
|
|
3
3
|
AgentConfigDrawerContainer,
|
|
4
4
|
NamedAgentHeaderLabel,
|
|
5
5
|
ShellActions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TGKQRK3S.js";
|
|
7
|
+
import {
|
|
8
|
+
ThreadListContainer
|
|
9
|
+
} from "./chunk-XO3FYN2W.js";
|
|
7
10
|
import {
|
|
8
11
|
Thread
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KCYBMKQL.js";
|
|
10
13
|
import "./chunk-BSIPI3KV.js";
|
|
11
14
|
import {
|
|
12
15
|
resolveBrandChrome,
|
|
13
16
|
useChatHeaderContentVisible,
|
|
14
17
|
useIsMobile,
|
|
15
18
|
useSlot
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-2OKGEU6X.js";
|
|
20
|
+
import "./chunk-E4GVP6PM.js";
|
|
18
21
|
import {
|
|
19
22
|
Icon,
|
|
20
23
|
PageHeader,
|
|
21
24
|
Spinner,
|
|
22
25
|
auiButtonClass,
|
|
23
26
|
sidebarRailButtonClassName
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-MAA7U4RF.js";
|
|
25
28
|
import {
|
|
26
29
|
shellIsCreateAgent,
|
|
27
30
|
useOptionalShellMode
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-6CFZHEYH.js";
|
|
29
32
|
import {
|
|
30
33
|
useAui
|
|
31
34
|
} from "./chunk-M6MHLVSO.js";
|
|
32
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-GTTMLDCI.js";
|
|
33
36
|
import {
|
|
34
37
|
cn,
|
|
35
38
|
useBrand
|
|
36
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-P7J2ABEP.js";
|
|
37
40
|
|
|
38
41
|
// src/layouts/SidebarLayout.tsx
|
|
39
42
|
import {
|
|
@@ -44,14 +47,17 @@ import {
|
|
|
44
47
|
useState
|
|
45
48
|
} from "react";
|
|
46
49
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
47
|
-
var TruefoundrySettingsBuilder = lazy(() => import("./SettingsBuilder-
|
|
50
|
+
var TruefoundrySettingsBuilder = lazy(() => import("./SettingsBuilder-A4BPYIFZ.js"));
|
|
48
51
|
var SchedulesPage = lazy(
|
|
49
|
-
() => import("./SchedulesPage-
|
|
52
|
+
() => import("./SchedulesPage-ARWU7BZF.js").then((m) => ({ default: m.SchedulesPage }))
|
|
50
53
|
);
|
|
51
54
|
var brandLogoClassName = "h-5 w-5 max-w-40 shrink-0 object-contain";
|
|
52
|
-
var railWidthClassName = "w-
|
|
55
|
+
var railWidthClassName = "w-20";
|
|
53
56
|
var railActionButtonClassName = cn(sidebarRailButtonClassName, "text-sidebar-text");
|
|
54
57
|
var railSelectedClassName = "bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";
|
|
58
|
+
function isRecentHistoryVisible({ overlayOpen, mode }) {
|
|
59
|
+
return !overlayOpen && mode?.status === "active" && !mode.isCreateAgent;
|
|
60
|
+
}
|
|
55
61
|
function SidebarNav() {
|
|
56
62
|
const aui = useAui();
|
|
57
63
|
const shell = useOptionalShellMode();
|
|
@@ -61,7 +67,7 @@ function SidebarNav() {
|
|
|
61
67
|
const showNewActions = shell?.isNewChatEnabled !== false;
|
|
62
68
|
const overlayOpen = shell?.settingsOpen === true || shell?.libraryOpen === true || shell?.sessionsOpen === true || shell?.schedulesOpen === true;
|
|
63
69
|
const mode = shell?.mode;
|
|
64
|
-
const newChatSelected = !overlayOpen && mode?.status === "active" && mode.
|
|
70
|
+
const newChatSelected = !overlayOpen && mode?.status === "active" && !mode.isCreateAgent && shell?.historyAgentFilter?.intent !== "try-agent";
|
|
65
71
|
const newAgentSelected = !overlayOpen && mode != null && shellIsCreateAgent(mode);
|
|
66
72
|
const handleNewChat = () => {
|
|
67
73
|
shell?.setLibraryOpen(false);
|
|
@@ -114,7 +120,7 @@ function SidebarNav() {
|
|
|
114
120
|
onClick: handleNewAgent,
|
|
115
121
|
children: [
|
|
116
122
|
/* @__PURE__ */ jsx(Icon, { name: "agent-2", size: 14 }),
|
|
117
|
-
/* @__PURE__ */ jsx("span", { className: "text-center", children: "
|
|
123
|
+
/* @__PURE__ */ jsx("span", { className: "text-center whitespace-nowrap", children: "Build Agent" })
|
|
118
124
|
]
|
|
119
125
|
}
|
|
120
126
|
) : null,
|
|
@@ -132,6 +138,7 @@ function SidebarRail({
|
|
|
132
138
|
const brand = useBrand();
|
|
133
139
|
const chrome = resolveBrandChrome(brand);
|
|
134
140
|
const BrandLogo = useSlot("BrandLogo");
|
|
141
|
+
const UserAvatar = useSlot("UserAvatar");
|
|
135
142
|
return /* @__PURE__ */ jsxs(
|
|
136
143
|
"aside",
|
|
137
144
|
{
|
|
@@ -151,7 +158,10 @@ function SidebarRail({
|
|
|
151
158
|
children: [
|
|
152
159
|
/* @__PURE__ */ jsx("div", { className: "flex h-14 w-full shrink-0 items-center justify-center text-text-primary", children: /* @__PURE__ */ jsx(BrandLogo, { variant: chrome.collapsedVariant, className: brandLogoClassName }) }),
|
|
153
160
|
/* @__PURE__ */ jsx(SidebarNav, {}),
|
|
154
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ jsxs("footer", { className: "flex shrink-0 flex-col items-center border-border p-2", children: [
|
|
162
|
+
/* @__PURE__ */ jsx(ShellActions, { labeled: true, className: "flex-col" }),
|
|
163
|
+
/* @__PURE__ */ jsx(UserAvatar, { labeled: true, className: "mt-1" })
|
|
164
|
+
] })
|
|
155
165
|
]
|
|
156
166
|
}
|
|
157
167
|
);
|
|
@@ -177,6 +187,7 @@ function SidebarLayout({ className }) {
|
|
|
177
187
|
const schedulesOpen = shell?.schedulesOpen === true;
|
|
178
188
|
const overlayOpen = settingsOpen || libraryOpen || sessionsOpen || schedulesOpen;
|
|
179
189
|
const showAgentConfig = shell != null && shellIsCreateAgent(shell.mode) && !overlayOpen && (!isMobile || shell.agentConfigOpen);
|
|
190
|
+
const showRecentHistory = isRecentHistoryVisible({ overlayOpen, mode: shell?.mode });
|
|
180
191
|
const hasChatHeaderContent = useChatHeaderContentVisible();
|
|
181
192
|
useEffect(() => {
|
|
182
193
|
if (!mobileNavOpen) return;
|
|
@@ -207,7 +218,7 @@ function SidebarLayout({ className }) {
|
|
|
207
218
|
{
|
|
208
219
|
role: "dialog",
|
|
209
220
|
"aria-label": "Agent Config",
|
|
210
|
-
className: "absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:
|
|
221
|
+
className: "absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:max-w-140 md:flex-1 md:shadow-none 2xl:max-w-150",
|
|
211
222
|
children: /* @__PURE__ */ jsx(AgentConfigDrawerContainer, { showClose: isMobile })
|
|
212
223
|
}
|
|
213
224
|
) : null,
|
|
@@ -241,43 +252,53 @@ function SidebarLayout({ className }) {
|
|
|
241
252
|
] }) : null
|
|
242
253
|
}
|
|
243
254
|
),
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
"
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
255
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 min-w-0 flex-1", children: [
|
|
256
|
+
showRecentHistory ? /* @__PURE__ */ jsx(
|
|
257
|
+
"aside",
|
|
258
|
+
{
|
|
259
|
+
"aria-label": "Recent chats",
|
|
260
|
+
className: "hidden min-h-0 w-64 shrink-0 border-r border-border bg-sidebar-bg md:flex",
|
|
261
|
+
children: /* @__PURE__ */ jsx(ThreadListContainer, { variant: "recent-history" })
|
|
262
|
+
}
|
|
263
|
+
) : null,
|
|
264
|
+
/* @__PURE__ */ jsx("div", { ref: mainRef, className: "min-h-0 min-w-0 flex-1", children: settingsOpen ? /* @__PURE__ */ jsx(
|
|
265
|
+
Suspense,
|
|
266
|
+
{
|
|
267
|
+
fallback: /* @__PURE__ */ jsxs(
|
|
268
|
+
"div",
|
|
269
|
+
{
|
|
270
|
+
className: "flex h-full items-center justify-center",
|
|
271
|
+
role: "status",
|
|
272
|
+
"aria-live": "polite",
|
|
273
|
+
"aria-busy": "true",
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ jsx(Spinner, { size: 28, className: "text-text-primary" }),
|
|
276
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
children: /* @__PURE__ */ jsx(TruefoundrySettingsBuilder, {})
|
|
281
|
+
}
|
|
282
|
+
) : sessionsOpen ? /* @__PURE__ */ jsx(SessionsPage, {}) : libraryOpen && shell?.libraryAgentId != null ? /* @__PURE__ */ jsx(AgentDetailsPage, { agentId: shell.libraryAgentId }, shell.libraryAgentId) : libraryOpen ? /* @__PURE__ */ jsx(AgentsLibrary, { onSelectAgent: () => setMobileNavOpen(false) }) : schedulesOpen ? /* @__PURE__ */ jsx(
|
|
283
|
+
Suspense,
|
|
284
|
+
{
|
|
285
|
+
fallback: /* @__PURE__ */ jsxs(
|
|
286
|
+
"div",
|
|
287
|
+
{
|
|
288
|
+
className: "flex h-full items-center justify-center",
|
|
289
|
+
role: "status",
|
|
290
|
+
"aria-live": "polite",
|
|
291
|
+
"aria-busy": "true",
|
|
292
|
+
children: [
|
|
293
|
+
/* @__PURE__ */ jsx(Spinner, { size: 28, className: "text-text-primary" }),
|
|
294
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
children: /* @__PURE__ */ jsx(SchedulesPage, {})
|
|
299
|
+
}
|
|
300
|
+
) : isIdle ? /* @__PURE__ */ jsx(SelectAgentEmptyState, {}) : /* @__PURE__ */ jsx(Thread, {}) })
|
|
301
|
+
] })
|
|
281
302
|
] }),
|
|
282
303
|
mobileNavOpen ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
283
304
|
/* @__PURE__ */ jsx(
|
|
@@ -306,4 +327,4 @@ function SidebarLayout({ className }) {
|
|
|
306
327
|
export {
|
|
307
328
|
SidebarLayout
|
|
308
329
|
};
|
|
309
|
-
//# sourceMappingURL=SidebarLayout-
|
|
330
|
+
//# sourceMappingURL=SidebarLayout-MFDOGAVJ.js.map
|