bazilion 0.26.1 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +405 -244
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +1572 -749
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/ConfigPage-_FY--9PB.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-BblXqMVb.js +1 -0
- package/dist/web/client/assets/ConnectionsView-BZHJysCa.js +1 -0
- package/dist/web/client/assets/FieldRow-k05wfDy9.js +1 -0
- package/dist/web/client/assets/SectionTabs-DlfXtepS.js +1 -0
- package/dist/web/client/assets/{SkillFindings-8LX6bYf_.js → SkillFindings-CHf5ZGY0.js} +1 -1
- package/dist/web/client/assets/SpawnDialog-C-Ujb4bC.js +1 -0
- package/dist/web/client/assets/TeamForm-D6EAAF7m.js +1 -0
- package/dist/web/client/assets/TeamThread-DpUOwMoi.js +1 -0
- package/dist/web/client/assets/UnsavedChangesGuard-DTUP7hwu.js +1 -0
- package/dist/web/client/assets/_id-C94dgBDe.js +1 -0
- package/dist/web/client/assets/_id-CxmEfoEp.js +1 -0
- package/dist/web/client/assets/agents-C-bJ5R_0.js +1 -0
- package/dist/web/client/assets/agents-odqBNx-A.js +1 -0
- package/dist/web/client/assets/api-CPzQ_z9m.js +1 -0
- package/dist/web/client/assets/arrow-right-Dyta3p06.js +1 -0
- package/dist/web/client/assets/attention-D0e7o7fh.js +1 -0
- package/dist/web/client/assets/chevron-right-B2YEg9rw.js +1 -0
- package/dist/web/client/assets/config-B7Y5MtpM.js +3 -0
- package/dist/web/client/assets/createLucideIcon-Cgab8gqu.js +1 -0
- package/dist/web/client/assets/index-CNVw44IE.js +54 -0
- package/dist/web/client/assets/link-ClwtaO_E.js +1 -0
- package/dist/web/client/assets/login-Br1F4rQx.js +1 -0
- package/dist/web/client/assets/mcp-B8bIAY6k.js +1 -0
- package/dist/web/client/assets/routes-BZdlkRdC.js +76 -0
- package/dist/web/client/assets/save-ZqeB_I-c.js +1 -0
- package/dist/web/client/assets/{services-B2f7e5jV.js → services-CPJxDrVG.js} +1 -1
- package/dist/web/client/assets/skills-DE_kQQGj.js +1 -0
- package/dist/web/client/assets/style-BWShXY3e.js +7 -0
- package/dist/web/client/assets/styles-Tney8jZq.css +2 -0
- package/dist/web/client/assets/teams-AcuSLc3I.js +1 -0
- package/dist/web/client/assets/teams-tRamPg7O.js +1 -0
- package/dist/web/client/assets/telegram-Ku69-GAv.js +1 -0
- package/dist/web/client/assets/tokens-DuLNZMgi.js +1 -0
- package/dist/web/client/assets/welcome-CrQk6n6I.js +1 -0
- package/dist/web/server/assets/{ConfigPage-CGld_wCK.js → ConfigPage-DSLM5CLw.js} +2 -2
- package/dist/web/server/assets/{ConfirmDialog-LdVlEanK.js → ConfirmDialog-CvLZgbfY.js} +1 -1
- package/dist/web/server/assets/ConnectionsView-DVLNH81Y.js +708 -0
- package/dist/web/server/assets/{FieldRow-Dah2KKqo.js → FieldRow-DQBzMtcR.js} +4 -4
- package/dist/web/server/assets/{Page-CMSYKXWJ.js → Page-KIL1CsME.js} +1 -1
- package/dist/web/server/assets/Rail-D8LhjS38.js +756 -0
- package/dist/web/server/assets/{SectionTabs-CqFg9Vwx.js → SectionTabs-CNcvxbR8.js} +1 -16
- package/dist/web/server/assets/{SkillFindings-Bd6e81Wu.js → SkillFindings-DX8lCMG7.js} +1 -1
- package/dist/web/server/assets/{SpawnDialog-BGNaMfFb.js → SpawnDialog-Brmkl_ll.js} +24 -6
- package/dist/web/server/assets/{TeamForm-C93tpn9r.js → TeamForm-CvQAs2FA.js} +1 -1
- package/dist/web/server/assets/TeamThread-BNJi6gPM.js +205 -0
- package/dist/web/server/assets/{UnsavedChangesGuard-Dm4a27_5.js → UnsavedChangesGuard-B3Lpl08z.js} +8 -4
- package/dist/web/server/assets/{TeamPolicyEditor-BHS3J0R9.js → _id-BH1631a8.js} +114 -263
- package/dist/web/server/assets/{_id-sW6zXrTP.js → _id-CA3QO7J5.js} +1 -1
- package/dist/web/server/assets/{_id-lOVnT5sS.js → _id-CO1PgvyG.js} +5 -5
- package/dist/web/server/assets/{_id-B0x1ffz3.js → _id-DIXUiIaB.js} +1 -1
- package/dist/web/server/assets/{_id-ByiXeIPS.js → _id-E2N4gZ4O.js} +2 -2
- package/dist/web/server/assets/{_id-Bdf_Rg62.js → _id-TVruGcOd.js} +1 -1
- package/dist/web/server/assets/_tanstack-start-manifest_v-BVfrV7LQ.js +191 -0
- package/dist/web/server/assets/{agents-BNPkidbH.js → agents-BnWgFo6o.js} +1 -1
- package/dist/web/server/assets/{agents-BK8OmB8g.js → agents-C63VycUw.js} +2 -2
- package/dist/web/server/assets/{agents-D4tqK1kH.js → agents-CalSKogx.js} +14 -15
- package/dist/web/server/assets/{agents-Cn9GkXFX.js → agents-CdZvooeQ.js} +1 -1
- package/dist/web/server/assets/{agents-lOqc6VGd.js → agents-DPZVni4Q.js} +1 -1
- package/dist/web/server/assets/{agents-DycxHDt8.js → agents-DrkEwIpR.js} +8 -8
- package/dist/web/server/assets/{attention-DULVjdmF.js → attention-BbE4yc-V.js} +1 -1
- package/dist/web/server/assets/{attention-YWnLKA2E.js → attention-Cr7puThv.js} +1 -1
- package/dist/web/server/assets/{attention-BIm455bC.js → attention-DIyX3VMB.js} +6 -6
- package/dist/web/server/assets/{auth-DiN92ydD.js → auth-dJnrFW6y.js} +1 -1
- package/dist/web/server/assets/{config-C1VB28se.js → config-3tPtOmPE.js} +1 -1
- package/dist/web/server/assets/{config-BNEgu7WG.js → config-DJGZiPBJ.js} +13 -13
- package/dist/web/server/assets/{config-TdVqnqNL.js → config-rUqhMjIs.js} +1 -1
- package/dist/web/server/assets/{daemon-client-DL2ik2Em.js → daemon-client-B_ZRIIrT.js} +2 -1
- package/dist/web/server/assets/{mcp-BwmpNQPN.js → mcp-C97uAZe1.js} +1 -1
- package/dist/web/server/assets/{mcp-B09_O05r.js → mcp-Cf7KzOJ9.js} +9 -9
- package/dist/web/server/assets/{mcp-CqdTfXcn.js → mcp-DE14q5c0.js} +1 -1
- package/dist/web/server/assets/{router-BI9gmY3S.js → router-w2yPgmC1.js} +412 -259
- package/dist/web/server/assets/routes-1FEodTRm.js +16 -0
- package/dist/web/server/assets/routes-B6AO0LjK.js +57 -0
- package/dist/web/server/assets/routes-D1NHwz6f.js +7644 -0
- package/dist/web/server/assets/{services-tCfB1B83.js → services-BjroGXgC.js} +4 -4
- package/dist/web/server/assets/{services-Q9HYQXXB.js → services-Cdk40QHq.js} +1 -1
- package/dist/web/server/assets/{services-BLvAvb8g.js → services-DsHRLL8q.js} +1 -1
- package/dist/web/server/assets/{skills-BZg_txbf.js → skills-CA17GjuZ.js} +1 -1
- package/dist/web/server/assets/{skills-C7fqRPna.js → skills-DC1OTc8n.js} +11 -11
- package/dist/web/server/assets/{skills-C_g8IKag.js → skills-h5aHa7Q8.js} +1 -1
- package/dist/web/server/assets/style-GYDODk2F.js +178 -0
- package/dist/web/server/assets/{teams-D4CaU76n.js → teams-Bm63mbTt.js} +1 -1
- package/dist/web/server/assets/{teams-DX2HmKqi.js → teams-BxnvFTyn.js} +1 -1
- package/dist/web/server/assets/{teams-BS-oweRl.js → teams-Cg-QQWpH.js} +23 -15
- package/dist/web/server/assets/{teams-BHkhnt6b.js → teams-D6Tx-Jyn.js} +1 -1
- package/dist/web/server/assets/{teams-BSflKBP8.js → teams-OzHTyVi9.js} +6 -6
- package/dist/web/server/assets/{teams-CNyB5nM9.js → teams-YrmyutM4.js} +1 -1
- package/dist/web/server/assets/{telegram-CrJiygCX.js → telegram-BJ4l_TA_.js} +6 -6
- package/dist/web/server/assets/{telegram-C4v1HhyJ.js → telegram-Gy7_9yih.js} +1 -1
- package/dist/web/server/assets/{telegram-BUdnc8oF.js → telegram-xU-vXgef.js} +1 -1
- package/dist/web/server/assets/{tokens-DqldzPUq.js → tokens-ByPTGFBQ.js} +1 -1
- package/dist/web/server/assets/{tokens-B1twAJdd.js → tokens-CEdl8puR.js} +1 -1
- package/dist/web/server/assets/{tokens-DdjEyALj.js → tokens-CsqoRt5T.js} +10 -10
- package/dist/web/server/assets/{welcome-D0d38Pzx.js → welcome-O6Rjd7yO.js} +1 -1
- package/dist/web/server/assets/workspace-DeEYMPDX.js +658 -0
- package/dist/web/server/server.js +20 -72
- package/dist/worker.js +51 -7
- package/dist/worker.js.map +1 -1
- package/package.json +1 -2
- package/dist/web/client/assets/AgentAvatar-DWx-bM6n.js +0 -1
- package/dist/web/client/assets/ChatPane-DOV_HJg-.js +0 -72
- package/dist/web/client/assets/ConfigPage-Dfu9DzFX.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-536ziJ5P.js +0 -1
- package/dist/web/client/assets/FieldRow-z1JqCdqn.js +0 -1
- package/dist/web/client/assets/ResultCard-X4nTbjYY.js +0 -1
- package/dist/web/client/assets/SectionTabs-DXHzXmmb.js +0 -1
- package/dist/web/client/assets/SpawnDialog-DoZl-yes.js +0 -1
- package/dist/web/client/assets/SpawnTeamModal-C638hEoN.js +0 -1
- package/dist/web/client/assets/TeamForm-C-WzvOl4.js +0 -1
- package/dist/web/client/assets/TeamPolicyEditor-CSKBx0oK.js +0 -7
- package/dist/web/client/assets/UnsavedChangesGuard-GC-vzw7h.js +0 -1
- package/dist/web/client/assets/_id-BKLynswT.js +0 -1
- package/dist/web/client/assets/_id-BYM_NORr.js +0 -1
- package/dist/web/client/assets/_id-Cxa98a9m.js +0 -1
- package/dist/web/client/assets/_id-D4hV1U1t.js +0 -1
- package/dist/web/client/assets/agent-actions-CXQCoxKO.js +0 -1
- package/dist/web/client/assets/agents-BxPS1_Bp.js +0 -1
- package/dist/web/client/assets/agents-GozAWW-l.js +0 -1
- package/dist/web/client/assets/attention-Cz9rZcrr.js +0 -1
- package/dist/web/client/assets/chevron-right-CPAb1zac.js +0 -1
- package/dist/web/client/assets/config-9vv9Lipb.js +0 -3
- package/dist/web/client/assets/inbox-DHLArXxl.js +0 -1
- package/dist/web/client/assets/index-1YXquAq8.js +0 -52
- package/dist/web/client/assets/learning-PvtXm8Ne.js +0 -1
- package/dist/web/client/assets/login-DIJpNQFo.js +0 -1
- package/dist/web/client/assets/mcp-pKBL0xIf.js +0 -1
- package/dist/web/client/assets/members-DHWsgsEs.js +0 -1
- package/dist/web/client/assets/memory-CEVppPyU.js +0 -1
- package/dist/web/client/assets/plus-BaIRdB10.js +0 -1
- package/dist/web/client/assets/policy-DEh4BLSw.js +0 -1
- package/dist/web/client/assets/preload-helper-eUUcpe2S.js +0 -1
- package/dist/web/client/assets/results-DgJPjEZF.js +0 -1
- package/dist/web/client/assets/review-BbshafTQ.js +0 -1
- package/dist/web/client/assets/route-Ccb8v41z.js +0 -1
- package/dist/web/client/assets/route-D1d6kCEV.js +0 -1
- package/dist/web/client/assets/routes-g7V4ru7T.js +0 -1
- package/dist/web/client/assets/settings-B6elpcYm.js +0 -1
- package/dist/web/client/assets/skills-CngE7TF8.js +0 -1
- package/dist/web/client/assets/styles-xUnZ-ep_.css +0 -2
- package/dist/web/client/assets/teams-BdJZXOan.js +0 -1
- package/dist/web/client/assets/teams-c496ISsT.js +0 -1
- package/dist/web/client/assets/telegram-B_-hK6EC.js +0 -1
- package/dist/web/client/assets/tokens-CKz8gx4-.js +0 -1
- package/dist/web/client/assets/triggers-DCEPciGW.js +0 -1
- package/dist/web/client/assets/welcome-D-zVOLGA.js +0 -1
- package/dist/web/server/assets/AgentAvatar-8gTAy_tP.js +0 -37
- package/dist/web/server/assets/ChatPane-De_FPEoD.js +0 -1887
- package/dist/web/server/assets/ResultCard-CZn1w4KA.js +0 -97
- package/dist/web/server/assets/Sidebar-puq47KyR.js +0 -430
- package/dist/web/server/assets/SpawnTeamModal-C6GbfScI.js +0 -97
- package/dist/web/server/assets/_id-BR6tnR6I.js +0 -23
- package/dist/web/server/assets/_id-Bm611NQz.js +0 -13
- package/dist/web/server/assets/_id-D5UCoyES.js +0 -359
- package/dist/web/server/assets/_id-DHx5UmmL.js +0 -12
- package/dist/web/server/assets/_id-DLpGmOVm.js +0 -19
- package/dist/web/server/assets/_id-Y5ctILG2.js +0 -13
- package/dist/web/server/assets/_id-dDA0pdVo.js +0 -54
- package/dist/web/server/assets/_tanstack-start-manifest_v-B8u80HjK.js +0 -292
- package/dist/web/server/assets/agent-actions-BBdFVdoa.js +0 -20
- package/dist/web/server/assets/api-WWxPqx67.js +0 -85
- package/dist/web/server/assets/inbox-4Vj5jTT8.js +0 -245
- package/dist/web/server/assets/inbox-D4IqUv3l.js +0 -38
- package/dist/web/server/assets/inbox-Dle24AfV.js +0 -23
- package/dist/web/server/assets/learning-BScq7VbO.js +0 -12
- package/dist/web/server/assets/learning-CBWFEnhg.js +0 -263
- package/dist/web/server/assets/learning-DWAKevhF.js +0 -25
- package/dist/web/server/assets/members-B8QBF6TF.js +0 -12
- package/dist/web/server/assets/members-DsF02Wp7.js +0 -12
- package/dist/web/server/assets/members-tWZA9b15.js +0 -36
- package/dist/web/server/assets/memory-BNN0b-0x.js +0 -12
- package/dist/web/server/assets/memory-CTl1E1Rm.js +0 -267
- package/dist/web/server/assets/memory-CV5uCBb2.js +0 -12
- package/dist/web/server/assets/policy-C9M6zV6w.js +0 -79
- package/dist/web/server/assets/policy-h-6NpU3m.js +0 -19
- package/dist/web/server/assets/policy-xEw9X0DK.js +0 -12
- package/dist/web/server/assets/results-D3A3UA4d.js +0 -182
- package/dist/web/server/assets/results-D6Ui5S8D.js +0 -12
- package/dist/web/server/assets/results-DWmxvfyn.js +0 -15
- package/dist/web/server/assets/review-CyQky-WQ.js +0 -40
- package/dist/web/server/assets/review-Sq0GGcPV.js +0 -322
- package/dist/web/server/assets/review-XWbSF8cF.js +0 -12
- package/dist/web/server/assets/route-BErtkz6t.js +0 -19
- package/dist/web/server/assets/route-CLoV-An_.js +0 -48
- package/dist/web/server/assets/route-WQ19JkBa.js +0 -19
- package/dist/web/server/assets/route-dEK_2GLj.js +0 -203
- package/dist/web/server/assets/route-iHTkhO81.js +0 -16
- package/dist/web/server/assets/route-zs8uUQtB.js +0 -16
- package/dist/web/server/assets/routes-081s4n24.js +0 -45
- package/dist/web/server/assets/routes-CWo5WPsr.js +0 -15
- package/dist/web/server/assets/routes-Cqp1ufHm.js +0 -56
- package/dist/web/server/assets/settings-CVaGv-xF.js +0 -12
- package/dist/web/server/assets/settings-D9viV-86.js +0 -561
- package/dist/web/server/assets/settings-DaZNZ_CC.js +0 -27
- package/dist/web/server/assets/triggers-B7LW784F.js +0 -214
- package/dist/web/server/assets/triggers-C5sMCZXv2.js +0 -12
- package/dist/web/server/assets/triggers-DMfVdImD.js +0 -12
- package/dist/web/client/assets/{TeamPolicyEditor-DLioOiRN.css → style-DLioOiRN.css} +0 -0
- package/dist/web/server/assets/{start-DTX6aKCi.js → start-DhW7sy23.js} +1 -1
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
import { E as errorMessage, _ as useActivity, d as Button, f as AgentAvatar, g as teamSummary, h as shortTime, w as api } from "./workspace-DeEYMPDX.js";
|
|
2
|
+
import { n as DEFAULT_TEAM_ID, t as DEFAULT_PROFILE_ID } from "./entities-Dn2xzKIw.js";
|
|
3
|
+
import { n as Dialog$1, r as DialogActions, t as ConfirmDialog } from "./ConfirmDialog-CvLZgbfY.js";
|
|
4
|
+
import { i as renameAgent, n as archiveAgent, t as SpawnDialog } from "./SpawnDialog-Brmkl_ll.js";
|
|
5
|
+
import { t as TeamForm } from "./TeamForm-CvQAs2FA.js";
|
|
6
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { Link, useRouter } from "@tanstack/react-router";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Archive, Bot, ChevronDown, ChevronRight, Ellipsis, PanelLeft, PanelRight, Pencil, Plus, Send, Settings2, UsersRound } from "lucide-react";
|
|
10
|
+
import { DropdownMenu } from "radix-ui";
|
|
11
|
+
//#region src/lib/use-resource.ts
|
|
12
|
+
/**
|
|
13
|
+
* Load something from the daemon when a panel opens, and again whenever a dependency changes.
|
|
14
|
+
* `load` gets a signal that aborts when the dependencies change or the component goes away.
|
|
15
|
+
*/
|
|
16
|
+
function useResource(load, deps) {
|
|
17
|
+
const [data, setData] = useState(void 0);
|
|
18
|
+
const [error, setError] = useState(null);
|
|
19
|
+
const [loading, setLoading] = useState(true);
|
|
20
|
+
const loadRef = useRef(load);
|
|
21
|
+
loadRef.current = load;
|
|
22
|
+
const controllerRef = useRef(null);
|
|
23
|
+
const run = useCallback(async (reset) => {
|
|
24
|
+
controllerRef.current?.abort();
|
|
25
|
+
const controller = new AbortController();
|
|
26
|
+
controllerRef.current = controller;
|
|
27
|
+
if (reset) setData(void 0);
|
|
28
|
+
setLoading(true);
|
|
29
|
+
try {
|
|
30
|
+
const next = await loadRef.current(controller.signal);
|
|
31
|
+
if (controller.signal.aborted) return;
|
|
32
|
+
setData(next);
|
|
33
|
+
setError(null);
|
|
34
|
+
} catch (cause) {
|
|
35
|
+
if (controller.signal.aborted) return;
|
|
36
|
+
setError(errorMessage(cause));
|
|
37
|
+
} finally {
|
|
38
|
+
if (!controller.signal.aborted) setLoading(false);
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
run(true);
|
|
43
|
+
return () => controllerRef.current?.abort();
|
|
44
|
+
}, deps);
|
|
45
|
+
return {
|
|
46
|
+
data,
|
|
47
|
+
error,
|
|
48
|
+
loading,
|
|
49
|
+
reload: useCallback(() => run(false), [run])
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** False on the server and during hydration, true afterwards: for what only the browser knows. */
|
|
53
|
+
function useHydrated() {
|
|
54
|
+
const [hydrated, setHydrated] = useState(false);
|
|
55
|
+
useEffect(() => setHydrated(true), []);
|
|
56
|
+
return hydrated;
|
|
57
|
+
}
|
|
58
|
+
/** Whether a media query matches; `initial` until the browser says. */
|
|
59
|
+
function useMediaQuery(query, initial = true) {
|
|
60
|
+
const [matches, setMatches] = useState(initial);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const list = window.matchMedia(query);
|
|
63
|
+
const update = () => setMatches(list.matches);
|
|
64
|
+
update();
|
|
65
|
+
list.addEventListener("change", update);
|
|
66
|
+
return () => list.removeEventListener("change", update);
|
|
67
|
+
}, [query]);
|
|
68
|
+
return matches;
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/components/workspace/context.tsx
|
|
72
|
+
var WorkspaceContext = createContext(null);
|
|
73
|
+
function WorkspaceProvider({ value, children }) {
|
|
74
|
+
const full = useMemo(() => {
|
|
75
|
+
const byId = new Map(value.agents.map((agent) => [agent.id, agent]));
|
|
76
|
+
return {
|
|
77
|
+
...value,
|
|
78
|
+
agentById: (id) => byId.get(id),
|
|
79
|
+
to: (patch) => ({
|
|
80
|
+
...value.search,
|
|
81
|
+
...patch
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
}, [value]);
|
|
85
|
+
return /* @__PURE__ */ jsx(WorkspaceContext.Provider, {
|
|
86
|
+
value: full,
|
|
87
|
+
children
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function useWorkspace() {
|
|
91
|
+
const value = useContext(WorkspaceContext);
|
|
92
|
+
if (!value) throw new Error("useWorkspace needs a WorkspaceProvider");
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
/** The workspace when there is one: a conversation can also render on its own. */
|
|
96
|
+
function useWorkspaceOptional() {
|
|
97
|
+
return useContext(WorkspaceContext);
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/components/SpawnTeamModal.tsx
|
|
101
|
+
/** Spawn a Team template's Agents and allow edges into a new or existing Team. */
|
|
102
|
+
function SpawnTeamModal({ template, teams, initialTeamId = "", onClose, onSpawned }) {
|
|
103
|
+
const [teamId, setTeamId] = useState(initialTeamId);
|
|
104
|
+
const [userMd, setUserMd] = useState("");
|
|
105
|
+
const [error, setError] = useState(null);
|
|
106
|
+
const [busy, setBusy] = useState(false);
|
|
107
|
+
const target = teamId.trim();
|
|
108
|
+
const existing = teams.some((team) => team.id === target);
|
|
109
|
+
async function spawn(event) {
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
setBusy(true);
|
|
112
|
+
setError(null);
|
|
113
|
+
try {
|
|
114
|
+
await api(`/api/team-templates/${encodeURIComponent(template.id)}/spawn`, { body: {
|
|
115
|
+
teamId: target,
|
|
116
|
+
...userMd && !existing ? { userMd } : {}
|
|
117
|
+
} });
|
|
118
|
+
onSpawned(target);
|
|
119
|
+
} catch (cause) {
|
|
120
|
+
setError(errorMessage(cause));
|
|
121
|
+
} finally {
|
|
122
|
+
setBusy(false);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return /* @__PURE__ */ jsx(Dialog$1, {
|
|
126
|
+
title: `Spawn team: ${template.name}`,
|
|
127
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
128
|
+
"Creates ",
|
|
129
|
+
template.slots.length,
|
|
130
|
+
" Agent",
|
|
131
|
+
template.slots.length === 1 ? "" : "s",
|
|
132
|
+
" and",
|
|
133
|
+
" ",
|
|
134
|
+
template.edges.length,
|
|
135
|
+
" allow edge",
|
|
136
|
+
template.edges.length === 1 ? "" : "s",
|
|
137
|
+
". An unknown slug creates a new ",
|
|
138
|
+
template.policyMode,
|
|
139
|
+
" Team; an existing Team keeps its mode."
|
|
140
|
+
] }),
|
|
141
|
+
busy,
|
|
142
|
+
onClose,
|
|
143
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
144
|
+
onSubmit: (event) => void spawn(event),
|
|
145
|
+
children: [
|
|
146
|
+
/* @__PURE__ */ jsxs("label", { children: [
|
|
147
|
+
"Target Team slug",
|
|
148
|
+
/* @__PURE__ */ jsx("input", {
|
|
149
|
+
value: teamId,
|
|
150
|
+
onChange: (event) => setTeamId(event.target.value),
|
|
151
|
+
list: "spawn-team-targets",
|
|
152
|
+
required: true
|
|
153
|
+
}),
|
|
154
|
+
/* @__PURE__ */ jsx("datalist", {
|
|
155
|
+
id: "spawn-team-targets",
|
|
156
|
+
children: teams.map((team) => /* @__PURE__ */ jsx("option", {
|
|
157
|
+
value: team.id,
|
|
158
|
+
children: team.name
|
|
159
|
+
}, team.id))
|
|
160
|
+
})
|
|
161
|
+
] }),
|
|
162
|
+
!existing && /* @__PURE__ */ jsxs("label", { children: ["Starter USER.md (new Team only; defaults to the template's)", /* @__PURE__ */ jsx("textarea", {
|
|
163
|
+
rows: 3,
|
|
164
|
+
value: userMd,
|
|
165
|
+
onChange: (event) => setUserMd(event.target.value),
|
|
166
|
+
className: "font-mono text-[0.88em] leading-[1.55]"
|
|
167
|
+
})] }),
|
|
168
|
+
error && /* @__PURE__ */ jsx("p", {
|
|
169
|
+
role: "alert",
|
|
170
|
+
className: "err mt-2",
|
|
171
|
+
children: error
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ jsx("div", {
|
|
174
|
+
className: "mt-4",
|
|
175
|
+
children: /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
|
|
176
|
+
variant: "ghost",
|
|
177
|
+
disabled: busy,
|
|
178
|
+
onClick: onClose,
|
|
179
|
+
children: "Cancel"
|
|
180
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
181
|
+
variant: "primary",
|
|
182
|
+
type: "submit",
|
|
183
|
+
disabled: busy || !target || template.slots.length === 0,
|
|
184
|
+
children: busy ? "Spawning…" : "Spawn team"
|
|
185
|
+
})] })
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/components/workspace/Rail.tsx
|
|
193
|
+
var SIDEBAR_OPEN_GROUPS_COOKIE = "bz_sidebar_open_groups";
|
|
194
|
+
function writeOpenGroupsCookie(map) {
|
|
195
|
+
document.cookie = `${SIDEBAR_OPEN_GROUPS_COOKIE}=${encodeURIComponent(JSON.stringify(map))}; Path=/; Max-Age=31536000; SameSite=Lax`;
|
|
196
|
+
}
|
|
197
|
+
var MENU_ITEM = "flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm text-foreground outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50";
|
|
198
|
+
var MENU_LABEL = "flex items-center gap-1.5 px-2.5 pb-1 pt-1 text-xs font-semibold uppercase tracking-[0.08em] text-muted-foreground";
|
|
199
|
+
var STATE_TEXT = {
|
|
200
|
+
needs: "text-warning",
|
|
201
|
+
working: "text-success",
|
|
202
|
+
paused: "text-warning",
|
|
203
|
+
fresh: "text-accent-foreground",
|
|
204
|
+
idle: "text-muted-foreground"
|
|
205
|
+
};
|
|
206
|
+
var STATE_DOT = {
|
|
207
|
+
needs: "bg-warning",
|
|
208
|
+
working: "bg-success animate-pulse",
|
|
209
|
+
paused: "bg-fawn",
|
|
210
|
+
fresh: "bg-primary",
|
|
211
|
+
idle: "bg-fawn"
|
|
212
|
+
};
|
|
213
|
+
/** The Default Team first, then the rest as the daemon lists them. */
|
|
214
|
+
function sortTeams(teams) {
|
|
215
|
+
return [...teams].sort((a, b) => Number(b.id === DEFAULT_TEAM_ID) - Number(a.id === DEFAULT_TEAM_ID));
|
|
216
|
+
}
|
|
217
|
+
function Rail({ initialOpenGroups }) {
|
|
218
|
+
const { agents, teams, profiles, teamTemplates, agent: open, team: inView, search } = useWorkspace();
|
|
219
|
+
const activity = useActivity();
|
|
220
|
+
const router = useRouter();
|
|
221
|
+
const [spawnProfile, setSpawnProfile] = useState(null);
|
|
222
|
+
const [spawnTeam, setSpawnTeam] = useState(void 0);
|
|
223
|
+
const [spawnTemplate, setSpawnTemplate] = useState(null);
|
|
224
|
+
const [createTeamOpen, setCreateTeamOpen] = useState(false);
|
|
225
|
+
const [createTeamBusy, setCreateTeamBusy] = useState(false);
|
|
226
|
+
const [renameTarget, setRenameTarget] = useState(null);
|
|
227
|
+
const [archiveTarget, setArchiveTarget] = useState(null);
|
|
228
|
+
const [openGroups, setOpenGroups] = useState(initialOpenGroups);
|
|
229
|
+
const newButton = useRef(null);
|
|
230
|
+
const refocusNewButton = () => window.requestAnimationFrame(() => newButton.current?.focus());
|
|
231
|
+
const sortedProfiles = [...profiles].sort((a, b) => Number(b.id === DEFAULT_PROFILE_ID) - Number(a.id === DEFAULT_PROFILE_ID));
|
|
232
|
+
const sortedTeams = sortTeams(teams);
|
|
233
|
+
const template = teamTemplates.find((entry) => entry.id === spawnTemplate);
|
|
234
|
+
const selectedId = open?.agent.id ?? null;
|
|
235
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
236
|
+
className: "flex h-full flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-baziu-sm",
|
|
237
|
+
children: [
|
|
238
|
+
/* @__PURE__ */ jsxs("header", {
|
|
239
|
+
className: "flex items-center justify-between gap-3 border-b border-border bg-muted/60 px-3 py-2.5",
|
|
240
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
241
|
+
className: "flex min-w-0 items-center gap-2",
|
|
242
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
243
|
+
className: "flex size-7 shrink-0 items-center justify-center rounded-[10px] bg-accent text-accent-foreground",
|
|
244
|
+
children: /* @__PURE__ */ jsx(UsersRound, {
|
|
245
|
+
className: "size-4",
|
|
246
|
+
"aria-hidden": "true"
|
|
247
|
+
})
|
|
248
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
249
|
+
className: "min-w-0",
|
|
250
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
251
|
+
className: "text-sm font-semibold leading-tight text-foreground",
|
|
252
|
+
children: "Teams"
|
|
253
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
254
|
+
className: "m-0 truncate text-xs leading-snug text-muted-foreground",
|
|
255
|
+
children: [
|
|
256
|
+
agents.length,
|
|
257
|
+
" agent",
|
|
258
|
+
agents.length === 1 ? "" : "s",
|
|
259
|
+
" in ",
|
|
260
|
+
teams.length,
|
|
261
|
+
" team",
|
|
262
|
+
teams.length === 1 ? "" : "s"
|
|
263
|
+
]
|
|
264
|
+
})]
|
|
265
|
+
})]
|
|
266
|
+
}), /* @__PURE__ */ jsxs(DropdownMenu.Root, {
|
|
267
|
+
modal: false,
|
|
268
|
+
children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
|
|
269
|
+
asChild: true,
|
|
270
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
271
|
+
ref: newButton,
|
|
272
|
+
type: "button",
|
|
273
|
+
"aria-label": "Create a new Agent or Team",
|
|
274
|
+
className: "unstyled group inline-flex h-8 items-center gap-1 rounded-lg border border-border bg-card px-2.5 text-xs font-semibold text-foreground shadow-baziu-sm transition-colors hover:border-primary/30 hover:bg-accent hover:text-accent-foreground",
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ jsx(Plus, {
|
|
277
|
+
className: "size-3.5",
|
|
278
|
+
"aria-hidden": "true"
|
|
279
|
+
}),
|
|
280
|
+
"New",
|
|
281
|
+
/* @__PURE__ */ jsx(ChevronDown, {
|
|
282
|
+
className: "size-3.5 text-muted-foreground transition-transform group-data-[state=open]:rotate-180",
|
|
283
|
+
"aria-hidden": "true"
|
|
284
|
+
})
|
|
285
|
+
]
|
|
286
|
+
})
|
|
287
|
+
}), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
|
|
288
|
+
align: "end",
|
|
289
|
+
sideOffset: 6,
|
|
290
|
+
className: "z-50 w-60 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none",
|
|
291
|
+
children: [
|
|
292
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Label, {
|
|
293
|
+
className: MENU_LABEL,
|
|
294
|
+
children: [/* @__PURE__ */ jsx(Bot, {
|
|
295
|
+
className: "size-3",
|
|
296
|
+
"aria-hidden": "true"
|
|
297
|
+
}), "Agent templates"]
|
|
298
|
+
}),
|
|
299
|
+
sortedProfiles.length === 0 ? /* @__PURE__ */ jsx(DropdownMenu.Item, {
|
|
300
|
+
asChild: true,
|
|
301
|
+
className: MENU_ITEM,
|
|
302
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
303
|
+
href: "/templates/agents",
|
|
304
|
+
children: "Create an Agent template"
|
|
305
|
+
})
|
|
306
|
+
}) : sortedProfiles.map((profile) => /* @__PURE__ */ jsxs(DropdownMenu.Item, {
|
|
307
|
+
className: MENU_ITEM,
|
|
308
|
+
onSelect: () => {
|
|
309
|
+
setSpawnTeam(inView?.id);
|
|
310
|
+
setSpawnProfile(profile.id);
|
|
311
|
+
},
|
|
312
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
313
|
+
className: "min-w-0 flex-1 truncate",
|
|
314
|
+
children: profile.name || profile.id
|
|
315
|
+
}), profile.id === "default" && /* @__PURE__ */ jsx("span", {
|
|
316
|
+
className: "rounded-full border border-border bg-muted px-1.5 py-0.5 text-xs font-semibold text-muted-foreground",
|
|
317
|
+
children: "Default"
|
|
318
|
+
})]
|
|
319
|
+
}, profile.id)),
|
|
320
|
+
/* @__PURE__ */ jsx(DropdownMenu.Separator, { className: "my-1.5 h-px bg-border" }),
|
|
321
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Label, {
|
|
322
|
+
className: MENU_LABEL,
|
|
323
|
+
children: [/* @__PURE__ */ jsx(UsersRound, {
|
|
324
|
+
className: "size-3",
|
|
325
|
+
"aria-hidden": "true"
|
|
326
|
+
}), "Team templates"]
|
|
327
|
+
}),
|
|
328
|
+
teamTemplates.length === 0 ? /* @__PURE__ */ jsx(DropdownMenu.Item, {
|
|
329
|
+
asChild: true,
|
|
330
|
+
className: MENU_ITEM,
|
|
331
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
332
|
+
href: "/templates/teams",
|
|
333
|
+
children: "Create a Team template"
|
|
334
|
+
})
|
|
335
|
+
}) : teamTemplates.map((entry) => /* @__PURE__ */ jsxs(DropdownMenu.Item, {
|
|
336
|
+
className: MENU_ITEM,
|
|
337
|
+
disabled: entry.slots.length === 0,
|
|
338
|
+
title: entry.slots.length === 0 ? "Add at least one member before spawning" : void 0,
|
|
339
|
+
onSelect: () => setSpawnTemplate(entry.id),
|
|
340
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
341
|
+
className: "min-w-0 flex-1 truncate",
|
|
342
|
+
children: entry.name || entry.id
|
|
343
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
344
|
+
className: "inline-flex min-w-6 items-center justify-center rounded-full bg-muted px-1.5 font-mono text-xs text-muted-foreground",
|
|
345
|
+
children: entry.slots.length
|
|
346
|
+
})]
|
|
347
|
+
}, entry.id)),
|
|
348
|
+
/* @__PURE__ */ jsx(DropdownMenu.Separator, { className: "my-1.5 h-px bg-border" }),
|
|
349
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Item, {
|
|
350
|
+
className: MENU_ITEM,
|
|
351
|
+
onSelect: () => setCreateTeamOpen(true),
|
|
352
|
+
children: [/* @__PURE__ */ jsx(Plus, {
|
|
353
|
+
className: "size-3.5",
|
|
354
|
+
"aria-hidden": "true"
|
|
355
|
+
}), "Create a team"]
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
}) })]
|
|
359
|
+
})]
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ jsxs("nav", {
|
|
362
|
+
className: "flex-1 overflow-y-auto p-1.5",
|
|
363
|
+
"aria-label": "Teams and agents",
|
|
364
|
+
children: [agents.length === 0 && /* @__PURE__ */ jsxs("div", {
|
|
365
|
+
className: "m-1 mb-2 flex flex-col items-center rounded-xl border border-dashed border-border bg-muted/30 px-4 py-6 text-center",
|
|
366
|
+
children: [
|
|
367
|
+
/* @__PURE__ */ jsx("p", {
|
|
368
|
+
className: "m-0 text-sm font-semibold text-foreground",
|
|
369
|
+
children: "No agents yet"
|
|
370
|
+
}),
|
|
371
|
+
/* @__PURE__ */ jsx("p", {
|
|
372
|
+
className: "mt-1 text-xs leading-5 text-muted-foreground",
|
|
373
|
+
children: "Your default Team is ready. Spawn the first agent to start a conversation."
|
|
374
|
+
}),
|
|
375
|
+
sortedProfiles[0] ? /* @__PURE__ */ jsx(Button, {
|
|
376
|
+
variant: "primary",
|
|
377
|
+
className: "mt-3",
|
|
378
|
+
onClick: () => setSpawnProfile(sortedProfiles[0]?.id ?? "default"),
|
|
379
|
+
children: "Spawn first agent"
|
|
380
|
+
}) : /* @__PURE__ */ jsx("a", {
|
|
381
|
+
href: "/templates/agents",
|
|
382
|
+
className: "mt-3 text-xs font-semibold",
|
|
383
|
+
children: "Create an Agent template"
|
|
384
|
+
})
|
|
385
|
+
]
|
|
386
|
+
}), sortedTeams.map((team) => {
|
|
387
|
+
const members = agents.filter((agent) => agent.teamId === team.id);
|
|
388
|
+
const current = inView?.id === team.id;
|
|
389
|
+
const isOpen = openGroups[team.id] ?? (current || team.id === "default");
|
|
390
|
+
const summary = teamSummary(members.map((agent) => activity.stateOf(agent.id)));
|
|
391
|
+
return /* @__PURE__ */ jsxs("details", {
|
|
392
|
+
open: isOpen,
|
|
393
|
+
onToggle: (event) => {
|
|
394
|
+
const next = event.currentTarget.open;
|
|
395
|
+
if (next === isOpen) return;
|
|
396
|
+
const merged = {
|
|
397
|
+
...openGroups,
|
|
398
|
+
[team.id]: next
|
|
399
|
+
};
|
|
400
|
+
writeOpenGroupsCookie(merged);
|
|
401
|
+
setOpenGroups(merged);
|
|
402
|
+
},
|
|
403
|
+
className: "group/details mb-1 last:mb-0",
|
|
404
|
+
children: [/* @__PURE__ */ jsxs("summary", {
|
|
405
|
+
className: `flex min-h-9 cursor-pointer list-none items-center gap-1.5 rounded-lg py-1 pl-2 pr-1 text-sm transition-colors hover:bg-accent/60 [&::-webkit-details-marker]:hidden ${current ? "bg-muted text-foreground" : "text-mocha"}`,
|
|
406
|
+
children: [
|
|
407
|
+
/* @__PURE__ */ jsx(ChevronRight, {
|
|
408
|
+
className: "size-3.5 shrink-0 text-muted-foreground transition-transform group-open/details:rotate-90",
|
|
409
|
+
"aria-hidden": "true"
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ jsx("span", {
|
|
412
|
+
className: "min-w-0 flex-1 truncate font-semibold",
|
|
413
|
+
children: team.name
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ jsx("span", {
|
|
416
|
+
className: "shrink-0 text-xs text-muted-foreground",
|
|
417
|
+
children: summary || members.length
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ jsx(Link, {
|
|
420
|
+
to: "/",
|
|
421
|
+
search: {
|
|
422
|
+
...open?.team.id === team.id ? { agent: open.agent.id } : {},
|
|
423
|
+
team: team.id,
|
|
424
|
+
panel: "team"
|
|
425
|
+
},
|
|
426
|
+
"aria-label": `Open ${team.name}: members, USER.md, memory`,
|
|
427
|
+
title: "Open the Team",
|
|
428
|
+
className: "flex size-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-card hover:text-primary",
|
|
429
|
+
children: /* @__PURE__ */ jsx(PanelRight, {
|
|
430
|
+
className: "size-3.5",
|
|
431
|
+
"aria-hidden": "true"
|
|
432
|
+
})
|
|
433
|
+
})
|
|
434
|
+
]
|
|
435
|
+
}), members.length === 0 ? /* @__PURE__ */ jsx("div", {
|
|
436
|
+
className: "py-2 pl-7 pr-2 text-xs text-muted-foreground",
|
|
437
|
+
children: "No agents in this team"
|
|
438
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
439
|
+
className: "space-y-0.5 py-1 pl-1.5",
|
|
440
|
+
children: members.map((agent) => /* @__PURE__ */ jsx(AgentRow, {
|
|
441
|
+
agent,
|
|
442
|
+
selected: agent.id === selectedId,
|
|
443
|
+
state: activity.stateOf(agent.id),
|
|
444
|
+
lastActivityAt: activity.byAgent.get(agent.id)?.lastActivityAt ?? null,
|
|
445
|
+
panel: search.panel,
|
|
446
|
+
onRename: () => setRenameTarget(agent),
|
|
447
|
+
onArchive: () => setArchiveTarget(agent)
|
|
448
|
+
}, agent.id))
|
|
449
|
+
})]
|
|
450
|
+
}, team.id);
|
|
451
|
+
})]
|
|
452
|
+
}),
|
|
453
|
+
spawnProfile && /* @__PURE__ */ jsx(SpawnDialog, {
|
|
454
|
+
profiles: sortedProfiles,
|
|
455
|
+
teams: sortedTeams,
|
|
456
|
+
profileId: spawnProfile,
|
|
457
|
+
teamId: spawnTeam,
|
|
458
|
+
onClose: () => {
|
|
459
|
+
setSpawnProfile(null);
|
|
460
|
+
refocusNewButton();
|
|
461
|
+
}
|
|
462
|
+
}),
|
|
463
|
+
template && /* @__PURE__ */ jsx(SpawnTeamModal, {
|
|
464
|
+
template,
|
|
465
|
+
teams: sortedTeams,
|
|
466
|
+
onClose: () => {
|
|
467
|
+
setSpawnTemplate(null);
|
|
468
|
+
refocusNewButton();
|
|
469
|
+
},
|
|
470
|
+
onSpawned: (slug) => {
|
|
471
|
+
setSpawnTemplate(null);
|
|
472
|
+
router.navigate({
|
|
473
|
+
to: "/",
|
|
474
|
+
search: {
|
|
475
|
+
team: slug,
|
|
476
|
+
panel: "team"
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}),
|
|
481
|
+
createTeamOpen && /* @__PURE__ */ jsx(Dialog$1, {
|
|
482
|
+
title: "Create a team",
|
|
483
|
+
description: "A Team is one workspace with its own USER.md, members and shared memory.",
|
|
484
|
+
busy: createTeamBusy,
|
|
485
|
+
onClose: () => {
|
|
486
|
+
setCreateTeamOpen(false);
|
|
487
|
+
refocusNewButton();
|
|
488
|
+
},
|
|
489
|
+
children: /* @__PURE__ */ jsx(TeamForm, {
|
|
490
|
+
onBusyChange: setCreateTeamBusy,
|
|
491
|
+
onCreated: async (team) => {
|
|
492
|
+
setCreateTeamOpen(false);
|
|
493
|
+
await router.navigate({
|
|
494
|
+
to: "/",
|
|
495
|
+
search: {
|
|
496
|
+
team: team.id,
|
|
497
|
+
panel: "team"
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
},
|
|
501
|
+
extraActions: (busy) => /* @__PURE__ */ jsx(Button, {
|
|
502
|
+
variant: "ghost",
|
|
503
|
+
disabled: busy,
|
|
504
|
+
onClick: () => setCreateTeamOpen(false),
|
|
505
|
+
children: "Cancel"
|
|
506
|
+
})
|
|
507
|
+
})
|
|
508
|
+
}),
|
|
509
|
+
renameTarget && /* @__PURE__ */ jsx(RenameAgentDialog, {
|
|
510
|
+
agent: renameTarget,
|
|
511
|
+
onClose: () => setRenameTarget(null),
|
|
512
|
+
onRenamed: () => router.invalidate()
|
|
513
|
+
}),
|
|
514
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
515
|
+
open: archiveTarget !== null,
|
|
516
|
+
onOpenChange: (next) => {
|
|
517
|
+
if (!next) setArchiveTarget(null);
|
|
518
|
+
},
|
|
519
|
+
title: `Archive ${archiveTarget?.name ?? "agent"}?`,
|
|
520
|
+
description: /* @__PURE__ */ jsx("p", { children: "The Agent leaves this list and receives no work. Restore it later under Manage, Agents, with “Show archived”." }),
|
|
521
|
+
confirmLabel: "Archive agent",
|
|
522
|
+
confirmVariant: "primary",
|
|
523
|
+
onConfirm: async () => {
|
|
524
|
+
if (!archiveTarget) return;
|
|
525
|
+
await archiveAgent(archiveTarget.id);
|
|
526
|
+
if (archiveTarget.id === selectedId) await router.navigate({
|
|
527
|
+
to: "/",
|
|
528
|
+
search: {}
|
|
529
|
+
});
|
|
530
|
+
else await router.invalidate();
|
|
531
|
+
}
|
|
532
|
+
})
|
|
533
|
+
]
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
function AgentRow({ agent, selected, state, lastActivityAt, panel, onRename, onArchive }) {
|
|
537
|
+
const hydrated = useHydrated();
|
|
538
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
539
|
+
className: "group/row relative rounded-2xl",
|
|
540
|
+
children: [/* @__PURE__ */ jsxs(Link, {
|
|
541
|
+
to: "/",
|
|
542
|
+
search: {
|
|
543
|
+
agent: agent.id,
|
|
544
|
+
...panel ? { panel } : {}
|
|
545
|
+
},
|
|
546
|
+
"aria-current": selected ? "page" : void 0,
|
|
547
|
+
className: `flex min-h-[3.1rem] items-center gap-2.5 rounded-2xl border py-1.5 pl-2 pr-9 transition-colors hover:bg-accent/60 ${selected ? "border-primary/20 bg-accent shadow-baziu-sm" : "border-transparent"}`,
|
|
548
|
+
children: [/* @__PURE__ */ jsx(AgentAvatar, {
|
|
549
|
+
identity: agent.identity,
|
|
550
|
+
size: 30
|
|
551
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
552
|
+
className: "block min-w-0 flex-1",
|
|
553
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
554
|
+
className: "flex items-center gap-1.5",
|
|
555
|
+
children: [
|
|
556
|
+
/* @__PURE__ */ jsx("span", {
|
|
557
|
+
className: `min-w-0 truncate text-sm font-semibold leading-tight ${selected ? "text-accent-foreground" : "text-foreground"}`,
|
|
558
|
+
children: agent.name
|
|
559
|
+
}),
|
|
560
|
+
agent.telegramTopicId !== null && /* @__PURE__ */ jsx("span", {
|
|
561
|
+
className: "shrink-0 text-primary",
|
|
562
|
+
title: `Telegram topic #${agent.telegramTopicId}`,
|
|
563
|
+
role: "img",
|
|
564
|
+
"aria-label": `Bound to Telegram topic ${agent.telegramTopicId}`,
|
|
565
|
+
children: /* @__PURE__ */ jsx(Send, {
|
|
566
|
+
className: "size-3",
|
|
567
|
+
"aria-hidden": "true"
|
|
568
|
+
})
|
|
569
|
+
}),
|
|
570
|
+
hydrated && lastActivityAt !== null && /* @__PURE__ */ jsx("time", {
|
|
571
|
+
dateTime: new Date(lastActivityAt).toISOString(),
|
|
572
|
+
className: "ml-auto shrink-0 text-[0.7rem] font-normal text-muted-foreground",
|
|
573
|
+
children: shortTime(lastActivityAt)
|
|
574
|
+
})
|
|
575
|
+
]
|
|
576
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
577
|
+
className: `mt-0.5 flex items-center gap-1.5 text-xs leading-snug ${STATE_TEXT[state.kind]}`,
|
|
578
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
579
|
+
className: `size-[7px] shrink-0 rounded-full ${STATE_DOT[state.kind]}`,
|
|
580
|
+
"aria-hidden": "true"
|
|
581
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
582
|
+
className: "min-w-0 truncate",
|
|
583
|
+
children: state.text
|
|
584
|
+
})]
|
|
585
|
+
})]
|
|
586
|
+
})]
|
|
587
|
+
}), /* @__PURE__ */ jsxs(DropdownMenu.Root, {
|
|
588
|
+
modal: false,
|
|
589
|
+
children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
|
|
590
|
+
asChild: true,
|
|
591
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
592
|
+
type: "button",
|
|
593
|
+
"aria-label": `More for ${agent.name}`,
|
|
594
|
+
className: "unstyled absolute right-1 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-lg text-muted-foreground opacity-0 transition-opacity hover:bg-card hover:text-primary focus-visible:opacity-100 group-hover/row:opacity-100 data-[state=open]:opacity-100 [@media(hover:none)]:opacity-100",
|
|
595
|
+
children: /* @__PURE__ */ jsx(Ellipsis, {
|
|
596
|
+
className: "size-4",
|
|
597
|
+
"aria-hidden": "true"
|
|
598
|
+
})
|
|
599
|
+
})
|
|
600
|
+
}), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
|
|
601
|
+
align: "start",
|
|
602
|
+
sideOffset: 4,
|
|
603
|
+
className: "z-50 w-48 rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-baziu-lg outline-none",
|
|
604
|
+
children: [
|
|
605
|
+
/* @__PURE__ */ jsx(DropdownMenu.Item, {
|
|
606
|
+
asChild: true,
|
|
607
|
+
className: MENU_ITEM,
|
|
608
|
+
children: /* @__PURE__ */ jsxs(Link, {
|
|
609
|
+
to: "/",
|
|
610
|
+
search: {
|
|
611
|
+
agent: agent.id,
|
|
612
|
+
panel: "agent"
|
|
613
|
+
},
|
|
614
|
+
children: [/* @__PURE__ */ jsx(Settings2, {
|
|
615
|
+
className: "size-3.5",
|
|
616
|
+
"aria-hidden": "true"
|
|
617
|
+
}), "Agent settings"]
|
|
618
|
+
})
|
|
619
|
+
}),
|
|
620
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Item, {
|
|
621
|
+
className: MENU_ITEM,
|
|
622
|
+
onSelect: onRename,
|
|
623
|
+
children: [/* @__PURE__ */ jsx(Pencil, {
|
|
624
|
+
className: "size-3.5",
|
|
625
|
+
"aria-hidden": "true"
|
|
626
|
+
}), "Rename"]
|
|
627
|
+
}),
|
|
628
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Item, {
|
|
629
|
+
className: MENU_ITEM,
|
|
630
|
+
onSelect: onArchive,
|
|
631
|
+
children: [/* @__PURE__ */ jsx(Archive, {
|
|
632
|
+
className: "size-3.5",
|
|
633
|
+
"aria-hidden": "true"
|
|
634
|
+
}), "Archive"]
|
|
635
|
+
})
|
|
636
|
+
]
|
|
637
|
+
}) })]
|
|
638
|
+
})]
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
/** The rail folded to avatars, beside a full-width view. */
|
|
642
|
+
function SlimRail() {
|
|
643
|
+
const { agents, teams, agent: open, team: inView, search } = useWorkspace();
|
|
644
|
+
const activity = useActivity();
|
|
645
|
+
const sortedTeams = sortTeams(teams).filter((team) => agents.some((agent) => agent.teamId === team.id));
|
|
646
|
+
sortedTeams.sort((a, b) => Number(b.id === inView?.id) - Number(a.id === inView?.id));
|
|
647
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
648
|
+
"aria-label": "Agents",
|
|
649
|
+
className: "flex h-full w-16 flex-col items-center gap-2 overflow-y-auto rounded-xl border border-border bg-card py-2.5 shadow-baziu-sm",
|
|
650
|
+
children: [/* @__PURE__ */ jsx(Link, {
|
|
651
|
+
to: "/",
|
|
652
|
+
search: {
|
|
653
|
+
...search,
|
|
654
|
+
view: void 0,
|
|
655
|
+
file: void 0,
|
|
656
|
+
result: void 0
|
|
657
|
+
},
|
|
658
|
+
"aria-label": "Back to the conversation and the full list",
|
|
659
|
+
title: "Back to the conversation",
|
|
660
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-xl text-mocha hover:bg-accent hover:text-accent-foreground",
|
|
661
|
+
children: /* @__PURE__ */ jsx(PanelLeft, {
|
|
662
|
+
className: "size-[18px]",
|
|
663
|
+
"aria-hidden": "true"
|
|
664
|
+
})
|
|
665
|
+
}), sortedTeams.map((team) => /* @__PURE__ */ jsxs("div", {
|
|
666
|
+
className: "flex w-full flex-col items-center gap-2",
|
|
667
|
+
children: [
|
|
668
|
+
/* @__PURE__ */ jsx("div", { className: "h-px w-8 bg-border" }),
|
|
669
|
+
/* @__PURE__ */ jsx("span", {
|
|
670
|
+
className: `max-w-14 truncate text-[0.65rem] font-bold uppercase tracking-[0.06em] ${team.id === inView?.id ? "text-accent-foreground" : "text-muted-foreground"}`,
|
|
671
|
+
title: team.name,
|
|
672
|
+
children: team.name
|
|
673
|
+
}),
|
|
674
|
+
agents.filter((agent) => agent.teamId === team.id).map((agent) => {
|
|
675
|
+
const state = activity.stateOf(agent.id);
|
|
676
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
677
|
+
to: "/",
|
|
678
|
+
search: {
|
|
679
|
+
agent: agent.id,
|
|
680
|
+
...search.panel ? { panel: search.panel } : {}
|
|
681
|
+
},
|
|
682
|
+
"aria-label": `${agent.name}: ${state.text}`,
|
|
683
|
+
title: `${agent.name}: ${state.text}`,
|
|
684
|
+
className: `relative flex size-10 shrink-0 items-center justify-center rounded-full ${agent.id === open?.agent.id ? "ring-2 ring-primary ring-offset-2 ring-offset-card" : ""}`,
|
|
685
|
+
children: [/* @__PURE__ */ jsx(AgentAvatar, {
|
|
686
|
+
identity: agent.identity,
|
|
687
|
+
size: 40
|
|
688
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
689
|
+
className: `absolute -bottom-px -right-px size-3 rounded-full border-2 border-card ${STATE_DOT[state.kind]}`,
|
|
690
|
+
"aria-hidden": "true"
|
|
691
|
+
})]
|
|
692
|
+
}, agent.id);
|
|
693
|
+
})
|
|
694
|
+
]
|
|
695
|
+
}, team.id))]
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
function RenameAgentDialog({ agent, onClose, onRenamed }) {
|
|
699
|
+
const [name, setName] = useState(agent.name);
|
|
700
|
+
const [busy, setBusy] = useState(false);
|
|
701
|
+
const [error, setError] = useState(null);
|
|
702
|
+
const unchanged = !name.trim() || name.trim() === agent.name;
|
|
703
|
+
async function submit(event) {
|
|
704
|
+
event.preventDefault();
|
|
705
|
+
if (unchanged) return;
|
|
706
|
+
setBusy(true);
|
|
707
|
+
setError(null);
|
|
708
|
+
try {
|
|
709
|
+
await renameAgent(agent.id, name.trim());
|
|
710
|
+
await onRenamed();
|
|
711
|
+
onClose();
|
|
712
|
+
} catch (cause) {
|
|
713
|
+
setError(errorMessage(cause));
|
|
714
|
+
setBusy(false);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return /* @__PURE__ */ jsx(Dialog$1, {
|
|
718
|
+
title: `Rename ${agent.name}`,
|
|
719
|
+
description: "This changes the display name only; the Agent ID and history stay the same.",
|
|
720
|
+
busy,
|
|
721
|
+
onClose,
|
|
722
|
+
className: "max-w-md",
|
|
723
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
724
|
+
onSubmit: (event) => void submit(event),
|
|
725
|
+
children: [
|
|
726
|
+
/* @__PURE__ */ jsxs("label", { children: ["Agent name", /* @__PURE__ */ jsx("input", {
|
|
727
|
+
autoFocus: true,
|
|
728
|
+
value: name,
|
|
729
|
+
onChange: (event) => setName(event.target.value),
|
|
730
|
+
maxLength: 120
|
|
731
|
+
})] }),
|
|
732
|
+
error && /* @__PURE__ */ jsx("p", {
|
|
733
|
+
role: "alert",
|
|
734
|
+
className: "mt-3 text-sm text-danger",
|
|
735
|
+
children: error
|
|
736
|
+
}),
|
|
737
|
+
/* @__PURE__ */ jsx("div", {
|
|
738
|
+
className: "mt-4",
|
|
739
|
+
children: /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
|
|
740
|
+
variant: "ghost",
|
|
741
|
+
disabled: busy,
|
|
742
|
+
onClick: onClose,
|
|
743
|
+
children: "Cancel"
|
|
744
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
745
|
+
variant: "primary",
|
|
746
|
+
type: "submit",
|
|
747
|
+
disabled: busy || unchanged,
|
|
748
|
+
children: busy ? "Renaming…" : "Rename agent"
|
|
749
|
+
})] })
|
|
750
|
+
})
|
|
751
|
+
]
|
|
752
|
+
})
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
//#endregion
|
|
756
|
+
export { SlimRail as a, useWorkspace as c, useMediaQuery as d, useResource as f, STATE_DOT as i, useWorkspaceOptional as l, RenameAgentDialog as n, SpawnTeamModal as o, SIDEBAR_OPEN_GROUPS_COOKIE as r, WorkspaceProvider as s, Rail as t, useHydrated as u };
|