@chrysb/alphaclaw 0.8.2 → 0.8.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,7 @@ import { AppSidebar } from "./components/sidebar.js";
16
16
  import {
17
17
  AgentsRoute,
18
18
  BrowseRoute,
19
+ ChatRoute,
19
20
  CronRoute,
20
21
  DoctorRoute,
21
22
  EnvarsRoute,
@@ -32,6 +33,7 @@ import { useAgents } from "./components/agents-tab/use-agents.js";
32
33
  import { useAppShellController } from "./hooks/use-app-shell-controller.js";
33
34
  import { useAppShellUi } from "./hooks/use-app-shell-ui.js";
34
35
  import { useBrowseNavigation } from "./hooks/use-browse-navigation.js";
36
+ import { useAgentSessions } from "./hooks/useAgentSessions.js";
35
37
  import {
36
38
  getHashRouterPath,
37
39
  useHashLocation,
@@ -77,6 +79,7 @@ const App = () => {
77
79
  } = useAgents();
78
80
 
79
81
  const isAgentsRoute = location.startsWith("/agents");
82
+ const isChatRoute = location.startsWith("/chat");
80
83
  const isCronRoute = location.startsWith("/cron");
81
84
  const isEnvarsRoute = location.startsWith("/envars");
82
85
  const isModelsRoute = location.startsWith("/models");
@@ -94,6 +97,13 @@ const App = () => {
94
97
  const match = location.match(/^\/cron\/([^/]+)/);
95
98
  return match ? decodeURIComponent(match[1]) : "";
96
99
  })();
100
+ const {
101
+ sessions: chatSessions,
102
+ selectedSessionKey: selectedChatSessionKey,
103
+ setSelectedSessionKey: setSelectedChatSessionKey,
104
+ } = useAgentSessions({
105
+ enabled: controllerState.onboarded === true,
106
+ });
97
107
 
98
108
  useEffect(() => {
99
109
  if (!isAgentsRoute) return;
@@ -201,6 +211,19 @@ const App = () => {
201
211
  window[kPendingCreateAgentWindowFlag] = true;
202
212
  setLocation("/agents");
203
213
  }}
214
+ chatSessions=${chatSessions}
215
+ selectedChatSessionKey=${selectedChatSessionKey}
216
+ onSelectChatSession=${(sessionKey) => {
217
+ setSelectedChatSessionKey(sessionKey);
218
+ if (!isChatRoute) setLocation("/chat");
219
+ }}
220
+ onStartChat=${() => {
221
+ if (!isChatRoute) {
222
+ setLocation("/chat");
223
+ return;
224
+ }
225
+ window.dispatchEvent(new Event("alphaclaw:chat-new"));
226
+ }}
204
227
  />
205
228
  <div
206
229
  class=${`sidebar-resizer ${shellState.isResizingSidebar ? "is-resizing" : ""}`}
@@ -289,6 +312,16 @@ const App = () => {
289
312
  </div>
290
313
  `
291
314
  : null}
315
+ ${isChatRoute
316
+ ? html`
317
+ <div class="app-content-pane chat-pane">
318
+ <${ChatRoute}
319
+ sessions=${chatSessions}
320
+ selectedSessionKey=${selectedChatSessionKey}
321
+ />
322
+ </div>
323
+ `
324
+ : null}
292
325
  ${isCronRoute
293
326
  ? html`
294
327
  <div class="app-content-pane cron-pane">
@@ -328,6 +361,7 @@ const App = () => {
328
361
  : null}
329
362
  ${browseState.isBrowseRoute ||
330
363
  isAgentsRoute ||
364
+ isChatRoute ||
331
365
  isCronRoute ||
332
366
  isEnvarsRoute ||
333
367
  isModelsRoute ||
@@ -314,20 +314,6 @@ export const ConnectedNodesCard = ({
314
314
  />
315
315
  `
316
316
  : null}
317
- ${canCheckBrowser &&
318
- browserAttachEnabled &&
319
- !checkingBrowser
320
- ? html`
321
- <button
322
- type="button"
323
- onclick=${() =>
324
- handleDetachNodeBrowser(nodeId)}
325
- class="shrink-0 text-[11px] text-fg-muted hover:text-body"
326
- >
327
- Detach
328
- </button>
329
- `
330
- : null}
331
317
  </div>
332
318
  </div>
333
319
  ${browserStatus
@@ -363,6 +349,22 @@ export const ConnectedNodesCard = ({
363
349
  ${browserError}
364
350
  </div>`
365
351
  : null}
352
+ ${canCheckBrowser &&
353
+ browserAttachEnabled &&
354
+ !checkingBrowser
355
+ ? html`
356
+ <div class="flex justify-end pt-1">
357
+ <button
358
+ type="button"
359
+ onclick=${() =>
360
+ handleDetachNodeBrowser(nodeId)}
361
+ class="shrink-0 text-[11px] text-fg-muted hover:text-body"
362
+ >
363
+ Detach
364
+ </button>
365
+ </div>
366
+ `
367
+ : null}
366
368
  </div>
367
369
  </div>
368
370
  `