@truefoundry/trueforge-ui 0.3.0-rc.1 → 0.3.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +22 -7
  3. package/dist/{AgentCodeSnippets-NZOFJE57.js → AgentCodeSnippets-N546FNNS.js} +38 -23
  4. package/dist/AgentCodeSnippets-N546FNNS.js.map +1 -0
  5. package/dist/AgentMetricChart-YWJYVYYA.js +15 -0
  6. package/dist/{AgentOverview-EEBHJC32.js → AgentOverview-VF74XC7I.js} +7 -7
  7. package/dist/{AgentSessionEventTimeline-26Z6IB3B.js → AgentSessionEventTimeline-RFR6LQMY.js} +19 -10
  8. package/dist/AgentSessionEventTimeline-RFR6LQMY.js.map +1 -0
  9. package/dist/{AgentSessionEventTimelineChart-CGCU7WBK.js → AgentSessionEventTimelineChart-27CQF6FX.js} +144 -57
  10. package/dist/AgentSessionEventTimelineChart-27CQF6FX.js.map +1 -0
  11. package/dist/{AgentSessions-3MPDZASK.js → AgentSessions-4IVX2SGD.js} +36 -12
  12. package/dist/AgentSessions-4IVX2SGD.js.map +1 -0
  13. package/dist/{ConnectorSettings-MXFRWWR6.js → ConnectorSettings-R5VEP7BO.js} +162 -126
  14. package/dist/ConnectorSettings-R5VEP7BO.js.map +1 -0
  15. package/dist/{DockLayout-LM4AFMFY.js → DockLayout-F44RWGEY.js} +10 -10
  16. package/dist/{DrawerLayout-JR3O6RRB.js → DrawerLayout-SQ323AVM.js} +14 -12
  17. package/dist/DrawerLayout-SQ323AVM.js.map +1 -0
  18. package/dist/{ModelSettings-G7IFNC2Y.js → ModelSettings-6QLS63HM.js} +22 -28
  19. package/dist/ModelSettings-6QLS63HM.js.map +1 -0
  20. package/dist/OpenUiFenceBlock-4ROX3G4X.js +9 -0
  21. package/dist/{SandboxSettings-NXAANMAX.js → SandboxSettings-OLKDXIQS.js} +17 -21
  22. package/dist/SandboxSettings-OLKDXIQS.js.map +1 -0
  23. package/dist/SchedulesPage-TMOTK6DR.js +15 -0
  24. package/dist/{SettingsBuilder-L34IQ56S.js → SettingsBuilder-GISAH2WU.js} +8 -8
  25. package/dist/{ShellRouteSync-CEBETGEJ.js → ShellRouteSync-EN33DUQ7.js} +171 -26
  26. package/dist/ShellRouteSync-EN33DUQ7.js.map +1 -0
  27. package/dist/{SidebarLayout-A2HJPPHS.js → SidebarLayout-35K4AKTC.js} +80 -58
  28. package/dist/SidebarLayout-35K4AKTC.js.map +1 -0
  29. package/dist/{SkillSettings-FGGMSUNO.js → SkillSettings-JSX2BTII.js} +24 -22
  30. package/dist/SkillSettings-JSX2BTII.js.map +1 -0
  31. package/dist/{TrueForgeUIWithRouter-MZVJWJMB.js → TrueForgeUIWithRouter-6VCR7ES3.js} +9 -9
  32. package/dist/{WidgetLayout-6QM45OQQ.js → WidgetLayout-RKBSN2FZ.js} +10 -10
  33. package/dist/{chunk-ZTMKFZQ3.js → chunk-2O5EJ6QS.js} +4440 -3042
  34. package/dist/chunk-2O5EJ6QS.js.map +1 -0
  35. package/dist/chunk-6WCIL3H2.js +517 -0
  36. package/dist/chunk-6WCIL3H2.js.map +1 -0
  37. package/dist/{chunk-WVE3F724.js → chunk-73FQVITT.js} +21 -4
  38. package/dist/chunk-73FQVITT.js.map +1 -0
  39. package/dist/{chunk-QC42MLAK.js → chunk-7AAO4UDQ.js} +4 -3
  40. package/dist/chunk-7AAO4UDQ.js.map +1 -0
  41. package/dist/{chunk-CYHJDKFB.js → chunk-F5QVQIBH.js} +172 -46
  42. package/dist/chunk-F5QVQIBH.js.map +1 -0
  43. package/dist/{chunk-FJW36PD7.js → chunk-GIPFF6FZ.js} +28 -24
  44. package/dist/chunk-GIPFF6FZ.js.map +1 -0
  45. package/dist/{chunk-6O6FWUDW.js → chunk-GSJAYYLR.js} +233 -195
  46. package/dist/chunk-GSJAYYLR.js.map +1 -0
  47. package/dist/{chunk-MPNSO7E6.js → chunk-J5BPHEDT.js} +2 -2
  48. package/dist/chunk-KR7WYHVF.js +195 -0
  49. package/dist/chunk-KR7WYHVF.js.map +1 -0
  50. package/dist/{chunk-DMMZSZTN.js → chunk-LUG7E6BL.js} +60 -16
  51. package/dist/chunk-LUG7E6BL.js.map +1 -0
  52. package/dist/chunk-LXJMINS6.js +587 -0
  53. package/dist/chunk-LXJMINS6.js.map +1 -0
  54. package/dist/{chunk-U7KURWW3.js → chunk-PT4EENB3.js} +244 -52
  55. package/dist/chunk-PT4EENB3.js.map +1 -0
  56. package/dist/{chunk-XAU7QFG3.js → chunk-Q6TCT7ZJ.js} +68 -256
  57. package/dist/chunk-Q6TCT7ZJ.js.map +1 -0
  58. package/dist/{chunk-ZKNUMH2M.js → chunk-XLFOXQKZ.js} +13 -11
  59. package/dist/chunk-XLFOXQKZ.js.map +1 -0
  60. package/dist/{chunk-M62XY4NC.js → chunk-XY6LZQES.js} +235 -108
  61. package/dist/chunk-XY6LZQES.js.map +1 -0
  62. package/dist/{createTrueFoundryServer-CmZnBh_l.d.ts → createTrueFoundryServer-B_FYhSdn.d.ts} +8 -5
  63. package/dist/index.d.ts +316 -94
  64. package/dist/index.js +65 -488
  65. package/dist/index.js.map +1 -1
  66. package/dist/plugins/trueforge-agent-server-adapter/index.d.ts +36 -13
  67. package/dist/plugins/trueforge-agent-server-adapter/index.js +69 -34
  68. package/dist/plugins/trueforge-agent-server-adapter/index.js.map +1 -1
  69. package/dist/styles.css +1 -1
  70. package/package.json +4 -4
  71. package/dist/AgentCodeSnippets-NZOFJE57.js.map +0 -1
  72. package/dist/AgentMetricChart-JPU3MFQ2.js +0 -15
  73. package/dist/AgentSessionEventTimeline-26Z6IB3B.js.map +0 -1
  74. package/dist/AgentSessionEventTimelineChart-CGCU7WBK.js.map +0 -1
  75. package/dist/AgentSessions-3MPDZASK.js.map +0 -1
  76. package/dist/ConnectorSettings-MXFRWWR6.js.map +0 -1
  77. package/dist/DrawerLayout-JR3O6RRB.js.map +0 -1
  78. package/dist/ModelSettings-G7IFNC2Y.js.map +0 -1
  79. package/dist/OpenUiFenceBlock-2TV5TQ6P.js +0 -9
  80. package/dist/SandboxSettings-NXAANMAX.js.map +0 -1
  81. package/dist/SchedulesPage-KKLUDO6B.js +0 -15
  82. package/dist/ShellRouteSync-CEBETGEJ.js.map +0 -1
  83. package/dist/SidebarLayout-A2HJPPHS.js.map +0 -1
  84. package/dist/SkillSettings-FGGMSUNO.js.map +0 -1
  85. package/dist/chunk-2XPPBEYF.js +0 -74
  86. package/dist/chunk-2XPPBEYF.js.map +0 -1
  87. package/dist/chunk-6O6FWUDW.js.map +0 -1
  88. package/dist/chunk-7Z2C2K7F.js +0 -578
  89. package/dist/chunk-7Z2C2K7F.js.map +0 -1
  90. package/dist/chunk-CYHJDKFB.js.map +0 -1
  91. package/dist/chunk-DMMZSZTN.js.map +0 -1
  92. package/dist/chunk-FJW36PD7.js.map +0 -1
  93. package/dist/chunk-M62XY4NC.js.map +0 -1
  94. package/dist/chunk-QC42MLAK.js.map +0 -1
  95. package/dist/chunk-SFZNIO6U.js +0 -18
  96. package/dist/chunk-SFZNIO6U.js.map +0 -1
  97. package/dist/chunk-U7KURWW3.js.map +0 -1
  98. package/dist/chunk-WVE3F724.js.map +0 -1
  99. package/dist/chunk-XAU7QFG3.js.map +0 -1
  100. package/dist/chunk-ZKNUMH2M.js.map +0 -1
  101. package/dist/chunk-ZTMKFZQ3.js.map +0 -1
  102. /package/dist/{AgentMetricChart-JPU3MFQ2.js.map → AgentMetricChart-YWJYVYYA.js.map} +0 -0
  103. /package/dist/{AgentOverview-EEBHJC32.js.map → AgentOverview-VF74XC7I.js.map} +0 -0
  104. /package/dist/{DockLayout-LM4AFMFY.js.map → DockLayout-F44RWGEY.js.map} +0 -0
  105. /package/dist/{OpenUiFenceBlock-2TV5TQ6P.js.map → OpenUiFenceBlock-4ROX3G4X.js.map} +0 -0
  106. /package/dist/{SchedulesPage-KKLUDO6B.js.map → SchedulesPage-TMOTK6DR.js.map} +0 -0
  107. /package/dist/{SettingsBuilder-L34IQ56S.js.map → SettingsBuilder-GISAH2WU.js.map} +0 -0
  108. /package/dist/{TrueForgeUIWithRouter-MZVJWJMB.js.map → TrueForgeUIWithRouter-6VCR7ES3.js.map} +0 -0
  109. /package/dist/{WidgetLayout-6QM45OQQ.js.map → WidgetLayout-RKBSN2FZ.js.map} +0 -0
  110. /package/dist/{chunk-MPNSO7E6.js.map → chunk-J5BPHEDT.js.map} +0 -0
@@ -4,28 +4,63 @@ import {
4
4
  matchLocation,
5
5
  placesEqual,
6
6
  sanitizeSearchForPlace
7
- } from "./chunk-WVE3F724.js";
7
+ } from "./chunk-73FQVITT.js";
8
8
  import {
9
9
  sessionIsCreateAgent
10
10
  } from "./chunk-RDXBMTP5.js";
11
- import "./chunk-2XPPBEYF.js";
12
11
  import {
13
- isSettingsChromeEnabled,
12
+ findAgentByName
13
+ } from "./chunk-KR7WYHVF.js";
14
+ import {
15
+ libraryAgentId,
16
+ toEffectiveRoutes,
17
+ useOptionalAgentSessionsServer,
14
18
  useOptionalCatalogServer,
19
+ useOptionalScheduleServer,
15
20
  useOptionalServer,
16
21
  useServerCapabilities,
22
+ useServerCapabilitiesSettled,
17
23
  useShellMode
18
- } from "./chunk-U7KURWW3.js";
24
+ } from "./chunk-PT4EENB3.js";
19
25
 
20
26
  // src/routing/ShellRouteSync.tsx
21
27
  import { useCallback, useEffect, useMemo, useRef } from "react";
22
28
  import { useLocation, useNavigate } from "react-router-dom";
23
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
+
24
56
  // src/routing/derivePlace.ts
25
57
  function deriveChatPlace(snapshot) {
26
58
  const sessionId = snapshot.activeRemoteId ?? snapshot.pendingSessionId;
27
59
  if (sessionId != null) return { type: "session", sessionId };
28
60
  const { mode, agentConfigMode } = snapshot;
61
+ if (mode.status === "active" && mode.isMutable && mode.isCreateAgent) {
62
+ return { type: "buildAgent" };
63
+ }
29
64
  if (mode.status === "active" && !mode.isMutable && agentConfigMode !== "SingleAgent") {
30
65
  const agentName = mode.agentName ?? mode.agentId;
31
66
  if (agentName != null) return { type: "agent", agentName };
@@ -44,6 +79,9 @@ function derivePlace(snapshot) {
44
79
  }
45
80
 
46
81
  // src/routing/ShellRouteSync.tsx
82
+ function placeOwnsHistoryAgentSearch(place) {
83
+ return place.type === "root" || place.type === "agent" || place.type === "session";
84
+ }
47
85
  function ShellRouteSync({
48
86
  routes,
49
87
  activeRemoteId,
@@ -52,14 +90,23 @@ function ShellRouteSync({
52
90
  const shell = useShellMode();
53
91
  const server = useOptionalServer();
54
92
  const catalog = useOptionalCatalogServer();
93
+ const sessions = useOptionalAgentSessionsServer();
94
+ const schedules = useOptionalScheduleServer();
55
95
  const capabilities = useServerCapabilities();
96
+ const capabilitiesSettled = useServerCapabilitiesSettled();
56
97
  const navigate = useNavigate();
57
98
  const location = useLocation();
58
- const settingsChromeEnabled = isSettingsChromeEnabled({ catalog, capabilities });
59
99
  const effectiveRoutes = useMemo(
60
- () => settingsChromeEnabled ? routes : { ...routes, settings: null },
61
- [routes, settingsChromeEnabled]
100
+ () => toEffectiveRoutes({ routes, catalog, capabilities, sessions, schedules }),
101
+ [routes, catalog, capabilities, sessions, schedules]
62
102
  );
103
+ const settingsChromeEnabled = effectiveRoutes.settings != null;
104
+ const routeGatesKey = [
105
+ effectiveRoutes.settings,
106
+ effectiveRoutes.sessionsBrowser,
107
+ effectiveRoutes.libraryAgent,
108
+ effectiveRoutes.schedules
109
+ ].join("\0");
63
110
  const snapshot = {
64
111
  settingsOpen: shell.settingsOpen,
65
112
  libraryOpen: shell.libraryOpen,
@@ -75,8 +122,12 @@ function ShellRouteSync({
75
122
  const placeKey = JSON.stringify(place);
76
123
  const selfNavPathRef = useRef(null);
77
124
  const prevPlaceRef = useRef(null);
125
+ const appliedUrlPlaceRef = useRef(null);
78
126
  const bootedRef = useRef(false);
127
+ const bootPlaceRef = useRef(null);
128
+ const bootHistoryAgentRef = useRef(null);
79
129
  const requestedSessionRef = useRef(null);
130
+ const requestedHistoryAgentRef = useRef(null);
80
131
  const shellSyncStartedRef = useRef(false);
81
132
  const urlSyncStartedRef = useRef(false);
82
133
  const openSession = useCallback(
@@ -101,6 +152,53 @@ function ShellRouteSync({
101
152
  },
102
153
  [server, shell]
103
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
+ );
104
202
  const applyPlace = useCallback(
105
203
  (target) => {
106
204
  switch (target.type) {
@@ -119,6 +217,9 @@ function ShellRouteSync({
119
217
  case "schedules":
120
218
  shell.setSchedulesOpen(true);
121
219
  return;
220
+ case "buildAgent":
221
+ shell.openAgentBuilder();
222
+ return;
122
223
  case "session":
123
224
  shell.setLibraryOpen(false);
124
225
  if (shell.pendingSessionId === target.sessionId || activeRemoteId === target.sessionId) return;
@@ -126,7 +227,7 @@ function ShellRouteSync({
126
227
  return;
127
228
  case "agent":
128
229
  shell.setLibraryOpen(false);
129
- shell.selectLibraryAgent({ isMutable: false, agentName: target.agentName });
230
+ openAgent(target.agentName);
130
231
  return;
131
232
  case "root":
132
233
  shell.setSettingsOpen(false);
@@ -146,16 +247,25 @@ function ShellRouteSync({
146
247
  }
147
248
  }
148
249
  },
149
- [shell, activeRemoteId, openSession]
250
+ [shell, activeRemoteId, openAgent, openSession]
150
251
  );
151
252
  useEffect(() => {
152
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;
153
260
  bootedRef.current = true;
154
261
  const urlPlace = matchLocation({
155
262
  pathname: location.pathname,
156
263
  search: location.search,
157
264
  routes: effectiveRoutes
158
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;
159
269
  const settingsOnBoot = settingsChromeEnabled && (initialSettingsOpen || urlPlace.type === "settings");
160
270
  if (urlPlace.type === "settings") {
161
271
  if (settingsChromeEnabled) shell.setSettingsOpen(true);
@@ -172,34 +282,58 @@ function ShellRouteSync({
172
282
  if (!placesEqual(chatPlace, urlPlace)) applyPlace(urlPlace);
173
283
  if (settingsOnBoot) shell.setSettingsOpen(true);
174
284
  }
285
+ if (urlPlace.type !== "agent" && historyAgentSearch != null) {
286
+ applyHistoryAgentSearch(historyAgentSearch);
287
+ } else if (!placeOwnsHistoryAgentSearch(urlPlace)) {
288
+ applyHistoryAgentSearch(null);
289
+ }
175
290
  const desiredPlace = settingsOnBoot ? { type: "settings" } : urlPlace;
291
+ bootPlaceRef.current = placesEqual(place, desiredPlace) ? null : desiredPlace;
176
292
  const desiredPath = buildPath(desiredPlace, effectiveRoutes);
177
- const desiredSearch = sanitizeSearchForPlace(desiredPlace, location.search);
293
+ const desiredSearch = updateHistoryAgentSearch(
294
+ sanitizeSearchForPlace(desiredPlace, location.search),
295
+ historyAgentSearch
296
+ );
178
297
  prevPlaceRef.current = desiredPlace;
179
298
  if (desiredPath != null && (desiredPath !== location.pathname || desiredSearch !== location.search)) {
180
299
  selfNavPathRef.current = desiredPath !== location.pathname ? desiredPath : null;
181
300
  navigate({ pathname: desiredPath, search: desiredSearch, hash: location.hash }, { replace: true });
182
301
  }
183
- }, []);
302
+ }, [capabilitiesSettled]);
184
303
  useEffect(() => {
185
304
  if (!bootedRef.current) return;
186
305
  if (!shellSyncStartedRef.current) {
187
306
  shellSyncStartedRef.current = true;
188
307
  return;
189
308
  }
309
+ const bootPlace = bootPlaceRef.current;
310
+ if (bootPlace != null) {
311
+ if (!placesEqual(place, bootPlace)) return;
312
+ bootPlaceRef.current = null;
313
+ }
190
314
  const target = buildPath(place, effectiveRoutes);
191
315
  if (target == null) return;
192
316
  const basename = effectiveRoutes.basename.endsWith("/") ? effectiveRoutes.basename.slice(0, -1) : effectiveRoutes.basename;
193
317
  const browserPathname = `${basename}${location.pathname}` || "/";
194
318
  const latestSearch = window.location.pathname === browserPathname ? window.location.search : location.search;
195
- const targetSearch = sanitizeSearchForPlace(place, latestSearch);
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);
196
330
  const prev = prevPlaceRef.current;
197
331
  prevPlaceRef.current = place;
198
332
  if (target === location.pathname && targetSearch === location.search) return;
199
333
  const replace = place.type === "session" && shell.pendingSessionId == null && prev != null && prev.type !== "session";
200
334
  selfNavPathRef.current = target !== location.pathname ? target : null;
201
335
  navigate({ pathname: target, search: targetSearch, hash: location.hash }, { replace });
202
- }, [placeKey, settingsChromeEnabled]);
336
+ }, [placeKey, routeGatesKey, shell.historyAgentFilter?.agentName, shell.historyAgentFilter?.intent]);
203
337
  useEffect(() => {
204
338
  if (!bootedRef.current) return;
205
339
  if (!urlSyncStartedRef.current) {
@@ -208,6 +342,7 @@ function ShellRouteSync({
208
342
  }
209
343
  if (selfNavPathRef.current === location.pathname) {
210
344
  selfNavPathRef.current = null;
345
+ appliedUrlPlaceRef.current = place;
211
346
  return;
212
347
  }
213
348
  const urlPlace = matchLocation({
@@ -221,25 +356,35 @@ function ShellRouteSync({
221
356
  selfNavPathRef.current = rootPath;
222
357
  navigate({ pathname: rootPath, search: rootSearch, hash: location.hash }, { replace: true });
223
358
  applyPlace({ type: "root" });
359
+ applyHistoryAgentSearch(readHistoryAgentSearch(rootSearch));
224
360
  return;
225
361
  }
226
- if (urlPlace.type !== "settings" && shell.settingsOpen) {
227
- shell.setSettingsOpen(false);
228
- }
229
- if (urlPlace.type !== "library" && urlPlace.type !== "libraryAgent" && shell.libraryOpen) {
230
- shell.setLibraryOpen(false);
231
- }
232
- if (urlPlace.type !== "sessionsBrowser" && shell.sessionsOpen) {
233
- shell.setSessionsOpen(false);
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);
234
378
  }
235
- if (urlPlace.type !== "schedules" && shell.schedulesOpen) {
236
- shell.setSchedulesOpen(false);
379
+ if (urlPlace.type !== "agent" && placeOwnsHistoryAgentSearch(urlPlace)) {
380
+ applyHistoryAgentSearch(readHistoryAgentSearch(location.search));
381
+ } else if (!placeOwnsHistoryAgentSearch(urlPlace)) {
382
+ applyHistoryAgentSearch(null);
237
383
  }
238
- applyPlace(urlPlace);
239
- }, [location.pathname]);
384
+ }, [location.pathname, location.search]);
240
385
  return null;
241
386
  }
242
387
  export {
243
388
  ShellRouteSync
244
389
  };
245
- //# sourceMappingURL=ShellRouteSync-CEBETGEJ.js.map
390
+ //# sourceMappingURL=ShellRouteSync-EN33DUQ7.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,Q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AAM,SAAS,KAAK,GAAG,EAAE,SAAS,KAAK,CAAC;AAC3F,iBAAW,EAAE,MAAM,OAAO,CAAC;AAC3B,8BAAwB,uBAAuB,UAAU,CAAC;AAC1D;AAAA,IACF;AACA,UAAM,mBAAmB,mBAAmB;AAC5C,uBAAmB,UAAU;AAC7B,QAAI,oBAAoB,QAAQ,CAAC,YAAY,kBAAkB,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,36 +3,40 @@ import {
3
3
  AgentConfigDrawerContainer,
4
4
  NamedAgentHeaderLabel,
5
5
  ShellActions
6
- } from "./chunk-DMMZSZTN.js";
6
+ } from "./chunk-LUG7E6BL.js";
7
+ import {
8
+ ThreadListContainer
9
+ } from "./chunk-6WCIL3H2.js";
7
10
  import {
8
11
  Thread
9
- } from "./chunk-M62XY4NC.js";
12
+ } from "./chunk-XY6LZQES.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-ZTMKFZQ3.js";
17
- import "./chunk-2XPPBEYF.js";
19
+ } from "./chunk-2O5EJ6QS.js";
20
+ import "./chunk-KR7WYHVF.js";
18
21
  import {
19
22
  Icon,
20
23
  PageHeader,
21
24
  Spinner,
22
- auiButtonClass
23
- } from "./chunk-XAU7QFG3.js";
25
+ auiButtonClass,
26
+ sidebarRailButtonClassName
27
+ } from "./chunk-Q6TCT7ZJ.js";
24
28
  import {
25
29
  shellIsCreateAgent,
26
30
  useOptionalShellMode
27
- } from "./chunk-U7KURWW3.js";
31
+ } from "./chunk-PT4EENB3.js";
28
32
  import {
29
33
  useAui
30
34
  } from "./chunk-M6MHLVSO.js";
31
- import "./chunk-MPNSO7E6.js";
35
+ import "./chunk-J5BPHEDT.js";
32
36
  import {
33
37
  cn,
34
38
  useBrand
35
- } from "./chunk-7Z2C2K7F.js";
39
+ } from "./chunk-LXJMINS6.js";
36
40
 
37
41
  // src/layouts/SidebarLayout.tsx
38
42
  import {
@@ -43,14 +47,17 @@ import {
43
47
  useState
44
48
  } from "react";
45
49
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
46
- var TruefoundrySettingsBuilder = lazy(() => import("./SettingsBuilder-L34IQ56S.js"));
50
+ var TruefoundrySettingsBuilder = lazy(() => import("./SettingsBuilder-GISAH2WU.js"));
47
51
  var SchedulesPage = lazy(
48
- () => import("./SchedulesPage-KKLUDO6B.js").then((m) => ({ default: m.SchedulesPage }))
52
+ () => import("./SchedulesPage-TMOTK6DR.js").then((m) => ({ default: m.SchedulesPage }))
49
53
  );
50
54
  var brandLogoClassName = "h-5 w-5 max-w-40 shrink-0 object-contain";
51
- var railWidthClassName = "w-18";
52
- var railActionButtonClassName = "h-auto w-full flex-col gap-1.5 whitespace-normal px-1 py-3 text-[0.625rem] leading-tight !justify-center text-text-primary shadow-none hover:bg-secondary-button-hover hover:text-ghost-button-text";
53
- var railSelectedClassName = "bg-primary-button-bg text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";
55
+ var railWidthClassName = "w-20";
56
+ var railActionButtonClassName = cn(sidebarRailButtonClassName, "text-sidebar-text");
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
+ }
54
61
  function SidebarNav() {
55
62
  const aui = useAui();
56
63
  const shell = useOptionalShellMode();
@@ -60,7 +67,7 @@ function SidebarNav() {
60
67
  const showNewActions = shell?.isNewChatEnabled !== false;
61
68
  const overlayOpen = shell?.settingsOpen === true || shell?.libraryOpen === true || shell?.sessionsOpen === true || shell?.schedulesOpen === true;
62
69
  const mode = shell?.mode;
63
- const newChatSelected = !overlayOpen && mode?.status === "active" && mode.isMutable && !mode.isCreateAgent;
70
+ const newChatSelected = !overlayOpen && mode?.status === "active" && !mode.isCreateAgent;
64
71
  const newAgentSelected = !overlayOpen && mode != null && shellIsCreateAgent(mode);
65
72
  const handleNewChat = () => {
66
73
  shell?.setLibraryOpen(false);
@@ -94,7 +101,7 @@ function SidebarNav() {
94
101
  }),
95
102
  onClick: handleNewChat,
96
103
  children: [
97
- /* @__PURE__ */ jsx(Icon, { name: "square-pen", size: 16 }),
104
+ /* @__PURE__ */ jsx(Icon, { name: "square-pen", size: 14 }),
98
105
  /* @__PURE__ */ jsx("span", { className: "text-center", children: "New Chat" })
99
106
  ]
100
107
  }
@@ -112,8 +119,8 @@ function SidebarNav() {
112
119
  }),
113
120
  onClick: handleNewAgent,
114
121
  children: [
115
- /* @__PURE__ */ jsx(Icon, { name: "agent-2", size: 16 }),
116
- /* @__PURE__ */ jsx("span", { className: "text-center", children: "New Agent" })
122
+ /* @__PURE__ */ jsx(Icon, { name: "agent-2", size: 14 }),
123
+ /* @__PURE__ */ jsx("span", { className: "text-center whitespace-nowrap", children: "Build Agent" })
117
124
  ]
118
125
  }
119
126
  ) : null,
@@ -131,6 +138,7 @@ function SidebarRail({
131
138
  const brand = useBrand();
132
139
  const chrome = resolveBrandChrome(brand);
133
140
  const BrandLogo = useSlot("BrandLogo");
141
+ const UserAvatar = useSlot("UserAvatar");
134
142
  return /* @__PURE__ */ jsxs(
135
143
  "aside",
136
144
  {
@@ -150,7 +158,10 @@ function SidebarRail({
150
158
  children: [
151
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 }) }),
152
160
  /* @__PURE__ */ jsx(SidebarNav, {}),
153
- /* @__PURE__ */ jsx("footer", { className: "flex shrink-0 flex-col items-center border-border p-2", children: /* @__PURE__ */ jsx(ShellActions, { labeled: true, className: "flex-col" }) })
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
+ ] })
154
165
  ]
155
166
  }
156
167
  );
@@ -176,6 +187,7 @@ function SidebarLayout({ className }) {
176
187
  const schedulesOpen = shell?.schedulesOpen === true;
177
188
  const overlayOpen = settingsOpen || libraryOpen || sessionsOpen || schedulesOpen;
178
189
  const showAgentConfig = shell != null && shellIsCreateAgent(shell.mode) && !overlayOpen && (!isMobile || shell.agentConfigOpen);
190
+ const showRecentHistory = isRecentHistoryVisible({ overlayOpen, mode: shell?.mode });
179
191
  const hasChatHeaderContent = useChatHeaderContentVisible();
180
192
  useEffect(() => {
181
193
  if (!mobileNavOpen) return;
@@ -206,7 +218,7 @@ function SidebarLayout({ className }) {
206
218
  {
207
219
  role: "dialog",
208
220
  "aria-label": "Agent Config",
209
- 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:w-88 md:max-w-none md:shrink-0 md:shadow-none",
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",
210
222
  children: /* @__PURE__ */ jsx(AgentConfigDrawerContainer, { showClose: isMobile })
211
223
  }
212
224
  ) : null,
@@ -240,43 +252,53 @@ function SidebarLayout({ className }) {
240
252
  ] }) : null
241
253
  }
242
254
  ),
243
- /* @__PURE__ */ jsx("div", { ref: mainRef, className: "min-h-0 min-w-0 flex-1", children: settingsOpen ? /* @__PURE__ */ jsx(
244
- Suspense,
245
- {
246
- fallback: /* @__PURE__ */ jsxs(
247
- "div",
248
- {
249
- className: "flex h-full items-center justify-center",
250
- role: "status",
251
- "aria-live": "polite",
252
- "aria-busy": "true",
253
- children: [
254
- /* @__PURE__ */ jsx(Spinner, { size: 28, className: "text-text-primary" }),
255
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
256
- ]
257
- }
258
- ),
259
- children: /* @__PURE__ */ jsx(TruefoundrySettingsBuilder, {})
260
- }
261
- ) : 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(
262
- Suspense,
263
- {
264
- fallback: /* @__PURE__ */ jsxs(
265
- "div",
266
- {
267
- className: "flex h-full items-center justify-center",
268
- role: "status",
269
- "aria-live": "polite",
270
- "aria-busy": "true",
271
- children: [
272
- /* @__PURE__ */ jsx(Spinner, { size: 28, className: "text-text-primary" }),
273
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
274
- ]
275
- }
276
- ),
277
- children: /* @__PURE__ */ jsx(SchedulesPage, {})
278
- }
279
- ) : isIdle ? /* @__PURE__ */ jsx(SelectAgentEmptyState, {}) : /* @__PURE__ */ jsx(Thread, {}) })
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
+ ] })
280
302
  ] }),
281
303
  mobileNavOpen ? /* @__PURE__ */ jsxs(Fragment, { children: [
282
304
  /* @__PURE__ */ jsx(
@@ -305,4 +327,4 @@ function SidebarLayout({ className }) {
305
327
  export {
306
328
  SidebarLayout
307
329
  };
308
- //# sourceMappingURL=SidebarLayout-A2HJPPHS.js.map
330
+ //# sourceMappingURL=SidebarLayout-35K4AKTC.js.map