limixbot 0.3.23 → 0.3.24
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/assets/{ActivityPanel-BkpnvFMV.js → ActivityPanel-BjjmX49M.js} +1 -1
- package/dist/assets/{App-5fWd2qWI.js → App-BWtQhGWp.js} +90 -90
- package/dist/assets/{AppEventEditor-4U6g9rYH.js → AppEventEditor-Bq1-MGxi.js} +1 -1
- package/dist/assets/{BotSettingsDialog-DBAjMChc.js → BotSettingsDialog-CVlvG4Rb.js} +4 -4
- package/dist/assets/{BrowserPanel-DKxFFmVF.js → BrowserPanel-CPLcno_m.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-DbsOGGoV.js → BrowserProfilesManager-D9JsCp1k.js} +1 -1
- package/dist/assets/{CloudAddDialog-I2EDWXA8.js → CloudAddDialog-DcmN7A5a.js} +1 -1
- package/dist/assets/{ComputerFilesPane-DA4Txmh9.js → ComputerFilesPane-Bjx6TGmM.js} +1 -1
- package/dist/assets/{ComputerPanel-B3EgKF7M.js → ComputerPanel-C9Xx4Ifs.js} +2 -2
- package/dist/assets/{DataPanel-DALLlVzz.js → DataPanel-IfpQCi3b.js} +1 -1
- package/dist/assets/{DesktopViewer-BTFnhvej.js → DesktopViewer-RjjUUlrQ.js} +1 -1
- package/dist/assets/{FilesView-DfvDhNdO.js → FilesView-D_0GwHAN.js} +1 -1
- package/dist/assets/{GrokMoveDialog-CVgxiDZG.js → GrokMoveDialog-CUie-0en.js} +1 -1
- package/dist/assets/{InspectorPanel-B8d5f_Z7.js → InspectorPanel-BuFL6wWf.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-C4Sy1Y5Q.js → KeyboardShortcutsModal-uOhXagTA.js} +1 -1
- package/dist/assets/{LiveDesktop-BdLw7_qb.js → LiveDesktop-BwpZa-Ri.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-Dd8v6HSb.js → LocalVmWorkspace-CousHKOb.js} +1 -1
- package/dist/assets/{MacLocalControl-DBItoJQX.js → MacLocalControl-BKDzplO2.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-tXLtgk1m.js → MarkdownFilePreview-CCwc1Tek.js} +1 -1
- package/dist/assets/{MenuMotion-DnbwlBMa.js → MenuMotion-CSgaJLc2.js} +1 -1
- package/dist/assets/NewBotDialog-BtvoCpqN.js +1 -0
- package/dist/assets/{PhoneAppDialog-D4klvpz5.js → PhoneAppDialog-C1hIwyT8.js} +1 -1
- package/dist/assets/{PlacesRail-BYBRFGDz.js → PlacesRail-PP97GpM6.js} +1 -1
- package/dist/assets/{PluginsPanel-DUOw0nhP.js → PluginsPanel-DpUEC1zc.js} +1 -1
- package/dist/assets/{ProIntroduction-B1eqbu20.js → ProIntroduction-C-7uexIW.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-B46lWStL.js → RemoteAgentSettingsPanel-DtofJtgF.js} +1 -1
- package/dist/assets/{RoomPanel-DBKyhryu.js → RoomPanel-CHbgQ0xd.js} +1 -1
- package/dist/assets/{RoutinesPage-CCSHgNRs.js → RoutinesPage-ZdFTYQc-.js} +2 -2
- package/dist/assets/{SettingsModal-CwXiblca.js → SettingsModal-Cdz3bEYZ.js} +1 -1
- package/dist/assets/{ShareTeamDialog-DuSs1saG.js → ShareTeamDialog-CNu6Kwet.js} +1 -1
- package/dist/assets/{SignedInSites-BdxFX6Wt.js → SignedInSites-CyWcDbLW.js} +1 -1
- package/dist/assets/TeamLibraryPanel-DMhdlaSH.js +1 -0
- package/dist/assets/{TeamMapPage-PW3Ots-y.js → TeamMapPage-C2PnNdil.js} +1 -1
- package/dist/assets/{TriggersPage-D5jH7bR3.js → TriggersPage-B_br6xBZ.js} +1 -1
- package/dist/assets/{VisibilitySection-yE3ZIXKk.js → VisibilitySection-DH0WrBCn.js} +1 -1
- package/dist/assets/{WebhookTrigger-doGyrUZA.js → WebhookTrigger-BASBoMb_.js} +1 -1
- package/dist/assets/{WorksOnGrid-DWvjM4aV.js → WorksOnGrid-CboITAAs.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-Bs9i-eLj.js → abnfDiagram-YUKMZFIV-CJ69o_vp.js} +1 -1
- package/dist/assets/{activity-DIhOTAmd.js → activity-BdRjGS2C.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-CR-7WHVu.js → architectureDiagram-47P4ROYG-BH57AmKC.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-Cx9qUsrY.js → blockDiagram-E7TT5TSB-D3ebMs_o.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-CtuUaTlE.js → c4Diagram-CRA5TL53-6TrdcGZR.js} +1 -1
- package/dist/assets/{calendar-days-DyyECwZf.js → calendar-days-DiMBTH2e.js} +1 -1
- package/dist/assets/channel-k2J2GMwv.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DIvFRpG0.js → chunk-2Q5K7J3B-BemwHdji.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-Cxp3RKyR.js → chunk-5VM5RSS4-CQZbLBld.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-DSOW_9p2.js → chunk-7TKQ45FW-Dy6EXFTX.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-zV216OhN.js → chunk-AW2ZBBNX-BbKGGyK8.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-BOtXkSrZ.js → chunk-FVRAUYC3-DHqUalc2.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-DiV1eG2w.js → chunk-HTAEGDNF-B66Vjlwq.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BZJyqcw-.js → chunk-JWPE2WC7-DrtdT6L3.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-DabkPo_d.js → chunk-KQW6MTUR-t7RW8fFT.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CcZGTVYy.js → chunk-XXDRQBXY-CntyS42N.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-DfOdVcjL.js → classDiagram-v2-K4WV4PDN-KlNCgeTt.js} +1 -1
- package/dist/assets/{coins-s4HyWHyQ.js → coins-BHKpT34i.js} +1 -1
- package/dist/assets/{core-D7M03RiE.js → core-DEy6KDLR.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-CqrD5E-Q.js → cose-bilkent-JH36ORCC-C_cXoOGT.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-fcIOWtrM.js → cynefin-EF2NZ3EQ-DGuwW5zt.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-Cx2XYJ57.js → cynefinDiagram-3GCD6N5R-qMzxXkVk.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-D6f_32GP.js → dagre-W4DXFKR2-Q-osY3Yi.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-IxXxA3zr.js → diagram-2UJZ2QOL-DyVJSBOF.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-DzRS9og-.js → diagram-OVF4WLC6-C5qBFdpm.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-CA4cF9TP.js → diagram-PFPMY2P6-C1PW3U2P.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-B5YdB3mN.js → diagram-UMYRVEAY-D2pa0Mzi.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-D8jMUZQ7.js → diagram-YEKJPTXX-BIzOA1li.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-D9FKtuee.js → diagram-ZIFT7M5P-B1UL3O8m.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-BipEfLA3.js → ebnfDiagram-VR2GEFS7-Cxu-kU8s.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-ByA43ZYx.js → elk-IJKZMXRS-DJS39Bm9.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-hlDRgJN-.js → erDiagram-O2IAPWRE-Cb31BS5L.js} +1 -1
- package/dist/assets/{file-up-DXcOpz8w.js → file-up-DWGlVRGP.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-BuCuOW1m.js → flowDiagram-OXPTDLAJ-BaPTzS6m.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-Bk16Ilgi.js → ganttDiagram-R7TSEDQI-B_Lr-26i.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-CN3BXWBF.js → gitGraphDiagram-XJZIOB7I-UHyDFX6a.js} +1 -1
- package/dist/assets/{import-name-wz0BNJ-d.js → import-name-Cxwtm5XO.js} +1 -1
- package/dist/assets/{index-BR_1_bou.js → index-BME9PdWM.js} +1 -1
- package/dist/assets/{index-BJo4IICg.js → index-BSrb6nsc.js} +2 -2
- package/dist/assets/{infoDiagram-5W2HQ5XZ-DSUAydoj.js → infoDiagram-5W2HQ5XZ-B7ovBJYA.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-C1_ZiQE2.js → ishikawaDiagram-K3B6WC7H-BYS-TlrF.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-CAGOqBTO.js → journeyDiagram-COXZFDF6-jJxKYEtT.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-Dj3_9GgV.js → kanban-definition-P3RFRI5V-DyiFYaIK.js} +1 -1
- package/dist/assets/{mcp-servers-qzidl6IU.js → mcp-servers-DXFuhTlS.js} +1 -1
- package/dist/assets/{mermaid.core-CcbkAG9m.js → mermaid.core-D3YJgsiB.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-C_gFeuC9.js → mindmap-definition-LZFPQGKD-DnbWodUY.js} +1 -1
- package/dist/assets/{minimize-DixQTKye.js → minimize-Af1aU3Tz.js} +1 -1
- package/dist/assets/{monitor-IwDx0ohO.js → monitor-DuYHWIyw.js} +1 -1
- package/dist/assets/{new-bot-COptZjiW.js → new-bot-TwOnvVO1.js} +1 -1
- package/dist/assets/{org-library-97Cfj4XD.js → org-library-BLD6YHcM.js} +1 -1
- package/dist/assets/{package-format-MbGfBQ0g.js → package-format-72bbOy2w.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-CYa91QJf.js → pegDiagram-BGZESJAR-CcOuP6zx.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-H4g7rmhD.js → pieDiagram-CAPJLFHJ-DhCU7Sfy.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-CkHV6SSw.js → quadrantDiagram-GDMTTRAM-7OziX26h.js} +1 -1
- package/dist/assets/{rail-SzaGJCSZ.js → rail-DI2iZJYt.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-Kx3ccbrH.js → railroadDiagram-SM67HX2B-rg44R4U2.js} +1 -1
- package/dist/assets/{remote-desktop-panel-CVuN83Ny.js → remote-desktop-panel-BPKKvcHT.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-BcNRqLgf.js → requirementDiagram-X7JNWC4A-DFNvg72O.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-CQP982o-.js → sankeyDiagram-UM26HJRW-CUOrQF2i.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-BXkOAwlC.js → sequenceDiagram-ZO4K6R2Y-4HKsH1wt.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BtuN-EAh.js → sizeCapture-INFHLROL-BEXQDTx-.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-CmlsJGhT.js → stateDiagram-v2-TBUQTH76-BYBLUqiy.js} +1 -1
- package/dist/assets/{styles-ElM5u1od.js → styles-C2_XZv1s.js} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-GH4PBeGD.js → swimlanes-N4OXWK64-D-bp8wWN.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-DTQBdgKt.js +8 -0
- package/dist/assets/{team-share-B2cRBtNk.js → team-share-Dpu1nJNz.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-j8Q7uetA.js → timeline-definition-YOQAKGHF-CtLFkcud.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-Cz4ej3SQ.js → usecaseDiagram-VIAY4XPW-AWOhUKvG.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-BZ3IAGpt.js → vennDiagram-BLWOH2XV-C_OYDBvp.js} +1 -1
- package/dist/assets/{vi-CVDyZGky.js → vi-P4zxF4j0.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-Bc32JfGA.js → wardleyDiagram-YMQ3BMBF-CdxMh8tE.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-s5XbB-l2.js → xychartDiagram-TAQBALBS-BL2spC5z.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/index.js +1580 -1567
- package/dist-server/package.json +1 -1
- package/dist-server/server/index.js +1 -1
- package/dist-server/server/initial-greeting.js +4 -0
- package/dist-server/server/limix-bot-library.js +178 -0
- package/dist-server/server/routes/bot-skills.js +6 -0
- package/dist-server/server/routes/teams.js +1 -1
- package/package.json +1 -1
- package/dist/assets/NewBotDialog-sfd-FzAz.js +0 -1
- package/dist/assets/TeamLibraryPanel-Djaf5q_z.js +0 -1
- package/dist/assets/channel-DXuqtdcQ.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-VqQY3wNh.js +0 -8
package/dist-server/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"0.3.
|
|
1
|
+
{"type":"module","version":"0.3.24"}
|
|
@@ -661,7 +661,7 @@ const CLOUD_ENV = { ...process.env, ...CLOUD_SECRETS };
|
|
|
661
661
|
const CLOUD_HOME = cloudHomeConfiguration(CLOUD_ENV);
|
|
662
662
|
const CLOUD_TEAM = CLOUD_HOME?.team ?? null, CLOUD_PERSONAL = CLOUD_HOME !== null && CLOUD_TEAM === null, TEAM_LABEL = CLOUD_TEAM ? { label: CLOUD_TEAM.name } : {};
|
|
663
663
|
/** The language set on this server, else (on a Team Cloud) the team's default from the Admin. threadLanguage: the one a line in a conversation is written in, its one person's, else the place's (server/server-lines.ts). */
|
|
664
|
-
const appLanguage = () => cfg.language ?? CLOUD_TEAM?.language;
|
|
664
|
+
const appLanguage = () => cfg.language ?? CLOUD_TEAM?.language ?? (process.env.OMB_UI_LANGUAGE?.trim() || undefined);
|
|
665
665
|
const personLanguages = createPersonLanguages({ dataDir: DATA_DIR, configured: appLanguage, privateTo: (threadId) => teamHost.privateTo(threadId) });
|
|
666
666
|
const threadLanguage = personLanguages.forThread;
|
|
667
667
|
setConversationLanguage(threadLanguage);
|
|
@@ -6,6 +6,7 @@ const GREETINGS = {
|
|
|
6
6
|
es: (name, person) => `Hola${person ? ` ${person}` : ""}, soy ${name}. ¿Qué te gustaría que hiciera?`,
|
|
7
7
|
"pt-br": (name, person) => `Oi${person ? ` ${person}` : ""}, eu sou ${name}. O que você gostaria que eu fizesse?`,
|
|
8
8
|
ko: (name, person) => `안녕하세요${person ? `, ${person}님` : ""}. 저는 ${name}입니다. 무엇을 도와드릴까요?`,
|
|
9
|
+
vi: (name, person) => `Xin chào${person ? ` ${person}` : ""}, mình là ${name}. Bạn muốn mình giúp việc gì?`,
|
|
9
10
|
"zh-tw": (name, person) => `嗨${person ? ` ${person}` : ""},我是 ${name}。你想要我幫你做什麼?`,
|
|
10
11
|
};
|
|
11
12
|
/** What the bot says the moment Set me up is pressed: no model is asked, so it is written here. */
|
|
@@ -14,6 +15,7 @@ const SETUP_REQUEST_LINES = {
|
|
|
14
15
|
es: "Genial. Cuéntame con tus propias palabras en qué te gustaría que te ayude y me prepararé para ello. Por ejemplo: \"ordena mi bandeja de entrada cada mañana\" o \"investiga a nuestros competidores cada semana\".",
|
|
15
16
|
"pt-br": "Ótimo. Me conte com suas palavras em que você gostaria de ajuda e eu me preparo para isso. Por exemplo: \"organize minha caixa de entrada toda manhã\" ou \"pesquise nossos concorrentes toda semana\".",
|
|
16
17
|
ko: "좋아요. 도움이 필요한 일을 편하게 말씀해 주시면 거기에 맞게 제가 설정할게요. 예: \"매일 아침 받은편지함 정리해 줘\", \"매주 경쟁사 조사해 줘\".",
|
|
18
|
+
vi: "Tuyệt. Bạn cứ kể bằng lời của mình về việc cần giúp, mình sẽ tự thiết lập để làm việc đó. Ví dụ: \"sắp xếp hộp thư của tôi mỗi sáng\" hoặc \"tìm hiểu đối thủ của chúng tôi mỗi tuần\".",
|
|
17
19
|
"zh-tw": "好的。用你自己的話告訴我想要幫忙的事,我會照著設定好自己。例如:「每天早上整理我的收件匣」或「每週研究我們的競爭對手」。",
|
|
18
20
|
};
|
|
19
21
|
/** The answers a blank bot's greeting offers on its setup card. Picking one sets the bot up for its words, as
|
|
@@ -27,6 +29,8 @@ const SETUP_CHOICES = {
|
|
|
27
29
|
"Reservas, compras e tarefas", "Dados, planilhas e relatórios"],
|
|
28
30
|
ko: ["리서치와 주제 깊이 파고들기", "이것저것 지켜보기", "이메일, 캘린더, 메시지",
|
|
29
31
|
"예약, 쇼핑, 심부름", "데이터, 스프레드시트, 보고서"],
|
|
32
|
+
vi: ["Nghiên cứu và tìm hiểu sâu một chủ đề", "Theo dõi mọi việc giúp tôi", "Email, lịch và tin nhắn",
|
|
33
|
+
"Đặt chỗ, mua sắm và việc vặt", "Dữ liệu, bảng tính và báo cáo"],
|
|
30
34
|
"zh-tw": ["研究與深入探討主題", "幫我留意各種事情", "電子郵件、行事曆和訊息",
|
|
31
35
|
"預約、購物和跑腿", "資料、試算表和報告"],
|
|
32
36
|
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// Limix bot templates: the "Bot dựng sẵn" list in Templates comes from github.com/leomieo/limix-bot-teams.
|
|
2
|
+
// GET /api/limix/bots reads only the light list in catalog.json (cached ten minutes); GET /api/limix/bots/<id> fetches
|
|
3
|
+
// that one bot's file when the person presses "Dùng mẫu". Everything is checked here before it reaches the page, and a
|
|
4
|
+
// template only describes who the bot is: its routines always arrive paused and nothing is connected for the person.
|
|
5
|
+
import { MASCOT_BODY_IDS } from "../shared/mascot-bodies.js";
|
|
6
|
+
import { MAUS_COLOR_NAMES } from "../shared/wire.js";
|
|
7
|
+
const TEAM_LIBRARY_RAW_ROOT = "https://raw.githubusercontent.com/leomieo/limix-bot-teams/main";
|
|
8
|
+
const LIST_TTL_MS = 10 * 60 * 1000;
|
|
9
|
+
const MAX_CATALOG_BYTES = 256_000;
|
|
10
|
+
const MAX_BOT_BYTES = 64_000;
|
|
11
|
+
const CATEGORIES = ["everyday", "work", "writing", "design", "sales", "personal"];
|
|
12
|
+
const ID = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
13
|
+
const NOTE_PATH = /^(?:MEMORY\.md|memory\/[a-z0-9][a-z0-9-]{0,63}\.md)$/;
|
|
14
|
+
const TIME = /^(?:[01]\d|2[0-3]):[0-5]\d$/;
|
|
15
|
+
const isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
16
|
+
function text(value, field, max, allowEmpty = false) {
|
|
17
|
+
if (typeof value !== "string" || (!allowEmpty && !value.trim()))
|
|
18
|
+
throw new Error(`${field} is required`);
|
|
19
|
+
const trimmed = value.trim();
|
|
20
|
+
if (trimmed.length > max)
|
|
21
|
+
throw new Error(`${field} is too long`);
|
|
22
|
+
return trimmed;
|
|
23
|
+
}
|
|
24
|
+
function look(value, field) {
|
|
25
|
+
if (!isRecord(value))
|
|
26
|
+
throw new Error(`${field} is invalid`);
|
|
27
|
+
const color = text(value.color, `${field}.color`, 20);
|
|
28
|
+
const mascotBody = text(value.mascotBody, `${field}.mascotBody`, 20);
|
|
29
|
+
if (!MAUS_COLOR_NAMES.includes(color))
|
|
30
|
+
throw new Error(`${field}.color is not a known colour`);
|
|
31
|
+
if (!MASCOT_BODY_IDS.includes(mascotBody))
|
|
32
|
+
throw new Error(`${field}.mascotBody is not a known shape`);
|
|
33
|
+
return { color, mascotBody };
|
|
34
|
+
}
|
|
35
|
+
function category(value, field) {
|
|
36
|
+
const found = CATEGORIES.find((entry) => entry === value);
|
|
37
|
+
if (!found)
|
|
38
|
+
throw new Error(`${field} is not a known category`);
|
|
39
|
+
return found;
|
|
40
|
+
}
|
|
41
|
+
function apps(value, field) {
|
|
42
|
+
if (value === undefined)
|
|
43
|
+
return [];
|
|
44
|
+
if (!Array.isArray(value) || value.length > 10)
|
|
45
|
+
throw new Error(`${field} is invalid`);
|
|
46
|
+
return value.map((app, index) => {
|
|
47
|
+
const slug = text(app, `${field}[${index}]`, 40);
|
|
48
|
+
if (!/^[a-z0-9][a-z0-9_-]*$/.test(slug))
|
|
49
|
+
throw new Error(`${field}[${index}] is invalid`);
|
|
50
|
+
return slug;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function parseBotListing(value) {
|
|
54
|
+
if (!isRecord(value) || value.format !== "openmaus.catalog" || value.version !== 1)
|
|
55
|
+
throw new Error("Danh sách mẫu không đúng định dạng");
|
|
56
|
+
if (value.bots === undefined)
|
|
57
|
+
return [];
|
|
58
|
+
if (!Array.isArray(value.bots) || value.bots.length > 200)
|
|
59
|
+
throw new Error("Danh sách bot mẫu không hợp lệ");
|
|
60
|
+
const seen = new Set();
|
|
61
|
+
const out = [];
|
|
62
|
+
value.bots.forEach((raw, index) => {
|
|
63
|
+
const field = `bots[${index}]`;
|
|
64
|
+
try {
|
|
65
|
+
if (!isRecord(raw))
|
|
66
|
+
throw new Error(`${field} is invalid`);
|
|
67
|
+
const id = text(raw.id, `${field}.id`, 64);
|
|
68
|
+
if (!ID.test(id) || seen.has(id))
|
|
69
|
+
throw new Error(`${field}.id is invalid`);
|
|
70
|
+
const routines = typeof raw.routines === "number" && Number.isSafeInteger(raw.routines) && raw.routines >= 0 && raw.routines <= 10 ? raw.routines : 0;
|
|
71
|
+
out.push({
|
|
72
|
+
id, name: text(raw.name, `${field}.name`, 40), title: text(raw.title, `${field}.title`, 80),
|
|
73
|
+
category: category(raw.category, `${field}.category`), description: text(raw.description, `${field}.description`, 300),
|
|
74
|
+
try: text(raw.try, `${field}.try`, 200), look: look(raw.look, `${field}.look`), apps: apps(raw.apps, `${field}.apps`), routines,
|
|
75
|
+
});
|
|
76
|
+
seen.add(id);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// One broken entry hides that entry only; the rest of the list still shows.
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
export function parseLibraryBot(value, expectedId) {
|
|
85
|
+
if (!isRecord(value) || value.format !== "limix.bot" || value.version !== 1)
|
|
86
|
+
throw new Error("Tệp bot mẫu không đúng định dạng");
|
|
87
|
+
const id = text(value.id, "id", 64);
|
|
88
|
+
if (id !== expectedId)
|
|
89
|
+
throw new Error("Tệp bot mẫu không khớp với danh sách");
|
|
90
|
+
if (!Array.isArray(value.tryAsking) || value.tryAsking.length === 0 || value.tryAsking.length > 6)
|
|
91
|
+
throw new Error("tryAsking is invalid");
|
|
92
|
+
const bot = {
|
|
93
|
+
id, category: category(value.category, "category"), name: text(value.name, "name", 40), title: text(value.title, "title", 80),
|
|
94
|
+
description: text(value.description, "description", 300), soul: text(value.soul, "soul", 8_000), look: look(value.look, "look"),
|
|
95
|
+
tryAsking: value.tryAsking.map((line, index) => text(line, `tryAsking[${index}]`, 200)), apps: apps(value.apps, "apps"),
|
|
96
|
+
};
|
|
97
|
+
if (value.notes !== undefined) {
|
|
98
|
+
if (!isRecord(value.notes) || Object.keys(value.notes).length > 6)
|
|
99
|
+
throw new Error("notes is invalid");
|
|
100
|
+
bot.notes = {};
|
|
101
|
+
for (const [path, note] of Object.entries(value.notes)) {
|
|
102
|
+
if (!NOTE_PATH.test(path))
|
|
103
|
+
throw new Error(`notes path ${path} is not allowed`);
|
|
104
|
+
bot.notes[path] = text(note, `notes.${path}`, 8_000) + "\n";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (value.routines !== undefined) {
|
|
108
|
+
if (!Array.isArray(value.routines) || value.routines.length > 5)
|
|
109
|
+
throw new Error("routines is invalid");
|
|
110
|
+
bot.routines = value.routines.map((raw, index) => {
|
|
111
|
+
const field = `routines[${index}]`;
|
|
112
|
+
if (!isRecord(raw) || !isRecord(raw.schedule) || raw.schedule.type !== "daily")
|
|
113
|
+
throw new Error(`${field} is invalid`);
|
|
114
|
+
const time = text(raw.schedule.time, `${field}.schedule.time`, 5);
|
|
115
|
+
if (!TIME.test(time))
|
|
116
|
+
throw new Error(`${field}.schedule.time is invalid`);
|
|
117
|
+
const weekdays = raw.schedule.weekdays;
|
|
118
|
+
if (!Array.isArray(weekdays) || weekdays.length === 0 || weekdays.length > 7 || weekdays.some((day) => !Number.isInteger(day) || day < 0 || day > 6)) {
|
|
119
|
+
throw new Error(`${field}.schedule.weekdays is invalid`);
|
|
120
|
+
}
|
|
121
|
+
// Paused, always: the person turns a routine on after reading it.
|
|
122
|
+
return { name: text(raw.name, `${field}.name`, 80), prompt: text(raw.prompt, `${field}.prompt`, 2_000),
|
|
123
|
+
schedule: { type: "daily", time, weekdays: [...new Set(weekdays)].sort() }, enabled: false, overlap: "skip" };
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return bot;
|
|
127
|
+
}
|
|
128
|
+
async function fetchJson(url, maxBytes) {
|
|
129
|
+
const response = await fetch(url, { headers: { accept: "application/json, text/plain;q=0.9" }, redirect: "error", signal: AbortSignal.timeout(10_000) });
|
|
130
|
+
if (!response.ok)
|
|
131
|
+
throw new Error(`GitHub trả lỗi HTTP ${response.status}`);
|
|
132
|
+
const raw = await response.text();
|
|
133
|
+
if (Buffer.byteLength(raw) > maxBytes)
|
|
134
|
+
throw new Error("Tệp mẫu quá lớn");
|
|
135
|
+
try {
|
|
136
|
+
return JSON.parse(raw);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
throw new Error("GitHub không trả về JSON hợp lệ");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
let cached = null;
|
|
143
|
+
/** `fresh`: the "Cập nhật" button. Skips this cache and GitHub's (raw files are cached there for about five minutes). */
|
|
144
|
+
async function listing(fresh = false) {
|
|
145
|
+
if (!fresh && cached && Date.now() - cached.at < LIST_TTL_MS)
|
|
146
|
+
return cached.bots;
|
|
147
|
+
try {
|
|
148
|
+
const bots = parseBotListing(await fetchJson(`${TEAM_LIBRARY_RAW_ROOT}/catalog.json${fresh ? `?t=${Date.now()}` : ""}`, MAX_CATALOG_BYTES));
|
|
149
|
+
cached = { at: Date.now(), bots };
|
|
150
|
+
return bots;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
if (cached)
|
|
154
|
+
return cached.bots; // an older list beats none while GitHub is unreachable
|
|
155
|
+
throw error;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** GET /api/limix/bots, POST /api/limix/bots/refresh and GET /api/limix/bots/<id>. Null for any other path. */
|
|
159
|
+
export async function handleLimixBotLibrary(method, path) {
|
|
160
|
+
try {
|
|
161
|
+
if (method === "POST" && path === "/api/limix/bots/refresh")
|
|
162
|
+
return { status: 200, body: { bots: await listing(true) } };
|
|
163
|
+
if (method !== "GET")
|
|
164
|
+
return null;
|
|
165
|
+
if (path === "/api/limix/bots")
|
|
166
|
+
return { status: 200, body: { bots: await listing() } };
|
|
167
|
+
const match = path.match(/^\/api\/limix\/bots\/([a-z0-9][a-z0-9-]{0,63})$/);
|
|
168
|
+
if (!match)
|
|
169
|
+
return null;
|
|
170
|
+
const id = match[1];
|
|
171
|
+
if (!(await listing()).some((bot) => bot.id === id))
|
|
172
|
+
return { status: 404, body: { error: "Không có bot mẫu này" } };
|
|
173
|
+
return { status: 200, body: { bot: parseLibraryBot(await fetchJson(`${TEAM_LIBRARY_RAW_ROOT}/bots/${id}.json?t=${Date.now()}`, MAX_BOT_BYTES), id) } };
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
return { status: 502, body: { error: error instanceof Error ? error.message : String(error) } };
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { handleLimixBotLibrary } from "../limix-bot-library.js";
|
|
2
3
|
import { setImportedSkillEnabled } from "../imported-skills.js";
|
|
3
4
|
import { setNativeSkillEnabled } from "../native-skill-choices.js";
|
|
4
5
|
import { botSkillTemplateSchema } from "../new-bot-defaults.js";
|
|
@@ -14,6 +15,11 @@ export function createBotSkillsRoutes(deps) {
|
|
|
14
15
|
const { store, cfg, listBotSkills, readBotSkillFile, stagedSkillListing } = deps;
|
|
15
16
|
return async ({ req, res, url, path, method, json, readBody }) => {
|
|
16
17
|
let m = null;
|
|
18
|
+
if (path.startsWith("/api/limix/bots")) {
|
|
19
|
+
const library = await handleLimixBotLibrary(method, path);
|
|
20
|
+
if (library)
|
|
21
|
+
return json(res, library.status, library.body);
|
|
22
|
+
}
|
|
17
23
|
if (path.startsWith("/api/limix/hub")) {
|
|
18
24
|
const hub = await handleLimixHub(method, path, method === "POST" ? await readBody(req) : undefined);
|
|
19
25
|
if (hub)
|
|
@@ -159,7 +159,7 @@ export function createTeamRoutes(deps) {
|
|
|
159
159
|
}
|
|
160
160
|
if (method === "GET" && path === "/api/team-library/catalog") {
|
|
161
161
|
try {
|
|
162
|
-
return json(res, 200, await fetchTeamCatalog());
|
|
162
|
+
return json(res, 200, await fetchTeamCatalog(url.searchParams.get("fresh") ? ((input, init) => fetch(`${String(input)}?t=${Date.now()}`, init)) : fetch));
|
|
163
163
|
}
|
|
164
164
|
catch (error) {
|
|
165
165
|
return json(res, 502, { error: error instanceof Error ? error.message : "The team library is unavailable" });
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as s,r as o,d as Ae,j as e,X as ve,f as Te,a as Q,ac as ye,ad as Le,h as De,k as Oe,ae as Me,af as Ue,ag as Fe,b as ze,ah as Ie,ai as Ke,aj as _e,ak as $e,p as le,z as He}from"./styles-ElM5u1od.js";import{n as C,K as Ve,u as k,bL as ee,bM as qe,bN as y,S as R,bO as Je,bP as we,bQ as te,bR as We,bS as Ye,bT as Xe,bU as Ze,bV as oe,bW as ce,bX as Ge,bY as Qe,bZ as et,b_ as je,D as M,b$ as tt,c0 as st,e as ke,c1 as nt,c2 as de,c3 as at,c4 as it,c5 as rt,c6 as lt,c7 as ot,c8 as ct,c9 as dt,ca as ut,cb as pt,cc as xt,cd as mt,ce as gt,cf as ue,cg as ht,ch as ft,ci as bt,cj as vt,ck as Se,cl as Ne,cm as yt,cn as wt,co as jt,cp as kt,cq as St,cr as pe,T as Ce,cs as Nt}from"./App-5fWd2qWI.js";import{B as xe,E as Ct,s as Et,r as me,p as Bt,c as Rt,a as Pt}from"./new-bot-COptZjiW.js";import{o as At}from"./index-BJo4IICg.js";import{I as Tt,S as Lt,a as Dt,A as Ot,M as Mt,P as Ut,V as Ft,v as zt,i as ge}from"./VisibilitySection-yE3ZIXKk.js";import{R as It}from"./RoutinesPage-CCSHgNRs.js";import{r as Kt,L as X,R as _t,U as $t,V as Ht,P as Vt}from"./PlacesRail-BYBRFGDz.js";import{p as qt,d as Jt,e as Wt,f as Yt}from"./team-share-B2cRBtNk.js";import{B as Xt}from"./BrowserProfilesManager-DbsOGGoV.js";function Zt(t){const n=[];for(const a of t){const i=a.source==="org"?s("newBot.presetsFromOrganization",{name:a.publisherName??a.packageName}):s("newBot.presetsImported"),r=n.find(l=>l.label===i);r?r.presets.push(a):n.push({label:i,presets:[a]})}return n}function Gt(t){const n={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},a=t.bot.appearance;return a&&(n.color=a.color,n.mascotExpression=a.mascotExpression??null,a.mascotBody&&(n.mascotBody=a.mascotBody)),n}function Qt(t){const n=t.bot.appearance?.avatar;if(!n)return null;let a;try{a=atob(n.data)}catch{return null}const i=new Uint8Array(a.length);for(let r=0;r<a.length;r+=1)i[r]=a.charCodeAt(r);return new File([i],`preset.${n.mime.slice(6)}`,{type:n.mime})}function es(t){const n=[t.source==="org"&&t.publisherName?s("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):s("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&n.push(t.description);const a=t.skills.map(i=>i.name).join(", ");return a&&n.push(s(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:a})),t.notes.length&&n.push(s("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&n.push(s("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),n.push(s("newBot.presetKeeps")),n}function ts(t){return{id:t.id,skills:t.skills.map(n=>n.name),notes:[...t.notes]}}function he(t){const n=a=>a?.trim()?a.trim():void 0;return{format:"package",version:2,kind:"library",name:n(t.name),presetName:n(t.name),presetDescription:n(t.description),release:n(t.release),notes:n(t.notes),includeMemory:t.includeNotes,...t.picture?{presetAvatar:t.picture}:{},...t.dryRun?{dryRun:!0}:{}}}function fe({preview:t,localSkips:n}){const a=t.document.package.presets?.[0],i=Object.keys(a?.seed?.memory??{}).length,r=[[s("teamShare.part.skills"),a?.skills?.length?`${a.skills.length} · ${a.skills.join(", ")}`:"0"],[s("teamShare.part.notes"),i?String(i):s("teamShare.none")],[s("teamShare.part.pictures"),a?.bot.appearance?.avatar?s("teamShare.yes"):s("teamShare.none")]],l=[...n,...t.skipped.map(d=>Jt(d,t.document))];return e.jsxs("div",{children:[e.jsx("div",{className:"text-[12px] font-medium text-ink-secondary",children:s("teamShare.included")}),e.jsx("dl",{className:"mt-2 grid grid-cols-[minmax(0,1fr)_auto] gap-x-4 gap-y-1.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px]",children:r.map(([d,c])=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-ink-secondary",children:d}),e.jsx("dd",{className:"max-w-[300px] truncate text-right text-ink",title:c,children:c})]},d))}),e.jsxs("p",{className:"mt-3 flex items-start gap-2 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(Ve,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("span",{children:s("presetShare.never")})]}),t.redacted.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.redacted")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:t.redacted.map(d=>e.jsx("li",{children:Wt(d,t.document)},d))})]}),l.length>0&&e.jsxs("div",{className:"mt-3 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamShare.skipped")}),e.jsx("ul",{className:"mt-1 list-disc pl-5",children:l.map((d,c)=>e.jsx("li",{children:d},`${d}-${c}`))})]})]})}function ss({onClose:t}){const n=o.useRef(null),[a,i]=o.useState(""),[r,l]=o.useState(""),[d,c]=o.useState(""),[p,m]=o.useState(""),[w,P]=o.useState(!0),[A,g]=o.useState(!0),[h,v]=o.useState(null),[b,T]=o.useState(null),[f,L]=o.useState(!1),[I,$]=o.useState(null),[U,K]=o.useState(""),_=o.useRef(0);o.useEffect(()=>{let u=!1;return C("/api/bot-defaults").then(async({defaults:E})=>{!u&&E.profile.name?.trim()&&i(D=>D||E.profile.name.trim());const S=await qt([{id:"defaults",avatarUrl:E.profile.avatarUrl,avatarCrop:E.profile.avatarCrop}]);u||v({dataUrl:S.avatars.defaults,skipped:S.skipped.map(D=>`${s("teamShare.field.picture")} — ${Ae(`teamShare.skip.${D.reason}`,D.reason)}`)})}).catch(()=>{u||v({skipped:[]})}),()=>{u=!0}},[]);const q=u=>({name:a,description:r,release:d,notes:p,includeNotes:w,dryRun:u,...A&&h?.dataUrl?{picture:h.dataUrl}:{}});o.useEffect(()=>{if(!h)return;const u=++_.current,E=window.setTimeout(()=>{C("/api/teams/export",{method:"POST",body:JSON.stringify(he({...q(!0),release:void 0}))}).then(S=>{u===_.current&&(T(S),K(""),c(D=>D||S.document.package.release))}).catch(S=>{u===_.current&&(T(null),K(S instanceof Error?S.message:String(S)))})},250);return()=>window.clearTimeout(E)},[h,w,A]);const F=async()=>{if(!f){L(!0),K("");try{const u=await C("/api/teams/export",{method:"POST",body:JSON.stringify(he(q(!1)))});Yt(u.filename,u.document),$(u)}catch(u){K(u instanceof Error?u.message:String(u))}finally{L(!1)}}};o.useEffect(()=>{const u=document.activeElement instanceof HTMLElement?document.activeElement:null;return n.current?.focus(),()=>{u?.isConnected&&u.focus()}},[]);const H=A?h?.skipped??[]:[],z="mt-1 w-full rounded-lg border border-hairline/50 bg-inset px-3 py-2 text-[14px] text-ink disabled:opacity-60";return Kt.createPortal(e.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onMouseDown:u=>{u.target===u.currentTarget&&!f&&t()},children:e.jsxs("div",{ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"share-preset-title",tabIndex:-1,className:"flex max-h-[90vh] w-full max-w-[560px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel text-ink shadow-2xl outline-none",onKeyDown:u=>{if(u.key==="Escape"&&!f&&(u.stopPropagation(),t()),u.key==="Tab"){const E=n.current?.querySelectorAll("input:enabled, textarea:enabled, button:enabled");if(!E?.length)return;const S=E[0],D=E[E.length-1];u.shiftKey&&document.activeElement===S?(u.preventDefault(),D.focus()):!u.shiftKey&&document.activeElement===D&&(u.preventDefault(),S.focus())}},children:[e.jsxs("header",{className:"flex items-start justify-between gap-3 px-6 pb-2 pt-5",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"share-preset-title",className:"text-[17px] font-semibold",children:s("presetShare.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.intro")})]}),e.jsx("button",{"aria-label":s("presetShare.close"),disabled:f,onClick:t,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised",children:e.jsx(ve,{size:18})})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-4 pt-2",children:I?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"flex items-center gap-2 text-[14px] font-medium text-ink",children:[e.jsx(Te,{size:16,className:"text-success"}),s("teamShare.saved",{filename:I.filename})]}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("presetShare.savedHint")}),e.jsx("div",{className:"mt-4",children:e.jsx(fe,{preview:I,localSkips:H})})]}):e.jsxs(e.Fragment,{children:[b?e.jsx(fe,{preview:b,localSkips:H}):!U&&e.jsxs("div",{className:"flex items-center gap-2 py-6 text-[13px] text-ink-secondary",children:[e.jsx(X,{size:15,className:"animate-spin"}),s("presetShare.preparing")]}),e.jsxs("fieldset",{className:"mt-4 space-y-2 text-[13px]",disabled:f,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:A,onChange:u=>g(u.target.checked)}),s("presetShare.includePicture")]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-4 accent-accent",checked:w,onChange:u=>P(u.target.checked)}),s("presetShare.includeNotes")]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("presetShare.name"),e.jsx("input",{value:a,maxLength:100,disabled:f,onChange:u=>i(u.target.value),className:z})]}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("teamShare.release"),e.jsx("input",{value:d,maxLength:20,disabled:f,placeholder:"1.0.0",onChange:u=>c(u.target.value),className:z})]})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("presetShare.description"),e.jsx("input",{value:r,maxLength:300,disabled:f,onChange:u=>l(u.target.value),className:z})]}),e.jsxs("label",{className:"mt-3 block text-[13px] text-ink-secondary",children:[s("teamShare.notes"),e.jsx("textarea",{value:p,maxLength:4e3,rows:2,disabled:f,onChange:u=>m(u.target.value),className:z})]})]})}),U&&e.jsx("p",{role:"alert",className:"mx-6 mb-2 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:U}),e.jsx("footer",{className:"flex justify-end gap-2 border-t border-hairline/35 px-6 py-3",children:I?e.jsx("button",{onClick:t,className:"rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white",children:s("teamShare.done")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:f,onClick:t,className:"rounded-lg px-3 py-2 text-[13px] text-ink-secondary hover:bg-raised",children:s("common.cancel")}),e.jsxs("button",{disabled:f||!b,onClick:()=>{F()},className:"flex items-center gap-2 rounded-lg bg-accent px-4 py-2 text-[13px] font-medium text-white disabled:opacity-40",children:[f&&e.jsx(X,{size:14,className:"animate-spin"}),f?s("teamShare.saving"):s("teamShare.save")]})]})})]})}),document.body)}function se(){const{dispatch:t}=k(),[n,a]=o.useState(!1),[i,r]=o.useState("");return{saving:n,error:i,save:async d=>{if(!n){a(!0),r("");try{const c=await C("/api/config",{method:"PATCH",body:JSON.stringify(d)});t({type:"configStatus",config:c})}catch(c){r(c instanceof Error?c.message:s("settings.experimental.error"))}finally{a(!1)}}}}}function Bs(){const{state:t}=k(),n=ee(t.config),a=qe(t.config),i=t.config?.browserEngine?.installable===!0,r=window.ogb?.platform==="win32"&&!a&&!i,{saving:l,error:d,save:c}=se();return e.jsx(y,{title:s("settings.experimental.browserAria"),subtitle:a?n?s("settings.experimental.browserOn"):s("settings.experimental.browserOff"):r?s("settings.experimental.browserWindows"):Je(t.config),message:d?e.jsx("p",{role:"alert",className:"text-danger",children:d}):null,children:e.jsx(R,{checked:n,"aria-label":s("settings.experimental.browserAria"),disabled:l||!n&&!a&&!i,onClick:()=>{c({features:{browser:!n}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function Rs(){const{state:t}=k(),n=we(),a=t.config?.browserEngine?.serverSites,{saving:i,error:r,save:l}=se();return a===void 0||n!==!0||!ee(t.config)?null:e.jsx(y,{title:s("settings.browser.serverSites"),subtitle:s("settings.browser.serverSitesDetail"),message:r?e.jsx("p",{role:"alert",className:"text-danger",children:r}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.browser.serverSites"),disabled:i,onClick:()=>{l({browserEngine:{egress:{localNetwork:!a}}})},className:"disabled:cursor-wait disabled:opacity-50"})})}function ns(){const{state:t}=k(),n=t.config?.browserEngine?.engine==="chrome",{saving:a,error:i,save:r}=se();return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"new-browser-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.newBrowser")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.newBrowserDetail")})]}),e.jsx(R,{checked:n,"aria-label":s("settings.experimental.newBrowserAria"),disabled:a,onClick:()=>{r({browserEngine:{engine:n?"agent-browser":"chrome"}})},className:"disabled:cursor-wait disabled:opacity-50"})]}),i?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:i}):null]})}function as(){const{state:t,dispatch:n}=k(),a=te(t.config),i=We(t.config),r=Ye(t.config),l=Xe(t.config),d=Ze(t.bots,t.instances),[c,p]=o.useState(String(l)),[m,w]=o.useState(!1),[P,A]=o.useState(!1),[g,h]=o.useState(""),v=o.useRef(!1);o.useEffect(()=>{m||p(String(l))},[l,m]);const b=async f=>{if(v.current)return!1;v.current=!0,A(!0),h("");try{const L=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:f})});return n({type:"configStatus",config:L}),!0}catch(L){return h(L instanceof Error?L.message:s("settings.experimental.error")),!1}finally{v.current=!1,A(!1)}},T=async()=>{if(!m)return;const f=Ge(c);if(f===null){h(s("settings.experimental.skillReviewStepsRange",{min:ce,max:oe}));return}await b({skillReviewSteps:f})&&w(!1)};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"skill-review-settings",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillReview")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(a?"settings.experimental.skillReviewDetail":"settings.experimental.skillReviewNeedsAuthoring")})]}),e.jsx(R,{checked:i,"aria-label":s("settings.experimental.skillReviewAria"),disabled:P||!a,onClick:()=>{b({skillReview:!i})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}),e.jsx(is,{engines:d}),i?e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-ink",children:s("settings.experimental.skillAutoApply")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAutoApplyDetail")})]}),e.jsx(R,{checked:r,"aria-label":s("settings.experimental.skillAutoApplyAria"),disabled:P,onClick:()=>{b({skillAutoApply:!r})},className:"disabled:cursor-not-allowed disabled:opacity-50"})]}):null,i?e.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[e.jsx("label",{htmlFor:"skill-review-steps",className:"text-[13px] text-ink",children:s("settings.experimental.skillReviewSteps")}),e.jsx("div",{className:`flex w-[96px] items-center rounded-lg border bg-inset ${g?"border-danger/60":"border-hairline/40 focus-within:border-focus"}`,children:e.jsx("input",{id:"skill-review-steps",type:"number",min:ce,max:oe,step:1,inputMode:"numeric",value:c,disabled:P,"aria-invalid":!!g,onChange:f=>{p(f.target.value),w(!0),h("")},onBlur:()=>{T()},onKeyDown:f=>{f.key==="Enter"&&f.currentTarget.blur()},className:"min-w-0 flex-1 bg-transparent px-3 py-1.5 text-[14px] tabular-nums text-ink focus:outline-none"})})]}):null,g?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:g}):null]})}function is({engines:t}){return t.length?e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary","data-testid":"skill-review-engine-note",children:s("settings.experimental.skillReviewNoEngine",{engines:t.join(", ")})}):null}const rs=[{value:"off",label:"settings.experimental.shareSkillsOff"},{value:"ask",label:"settings.experimental.shareSkillsAsk"},{value:"auto",label:"settings.experimental.shareSkillsAuto"}];function ls(){const{state:t,dispatch:n}=k(),[a,i]=o.useState(!1),[r,l]=o.useState("");if(!Qe(t.config))return null;const d=te(t.config),c=et(t.config),p=async m=>{if(!(a||m===c)){i(!0),l("");try{const w=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{shareLearnedSkills:m}})});n({type:"configStatus",config:w})}catch(w){l(w instanceof Error?w.message:s("settings.experimental.error"))}finally{i(!1)}}};return e.jsxs("div",{className:"mt-4 border-t border-hairline/30 pt-4","data-testid":"share-learned-skills-settings",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.shareSkills")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s(d?"settings.experimental.shareSkillsDetail":"settings.experimental.shareSkillsNeedsAuthoring")})]}),e.jsx("div",{className:"inline-flex shrink-0 rounded-xl bg-inset p-1",role:"radiogroup","aria-label":s("settings.experimental.shareSkillsAria"),children:rs.map(m=>e.jsx("button",{type:"button",role:"radio","aria-checked":c===m.value,disabled:a||!d,onClick:()=>{p(m.value)},className:Q("rounded-lg px-3 py-1.5 text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-50",c===m.value?"bg-raised text-ink shadow":"text-ink-secondary hover:text-ink"),children:s(m.label)},m.value))})]}),r?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:r}):null]})}function os(){return e.jsxs(e.Fragment,{children:[e.jsx(as,{}),e.jsx(ls,{})]})}function Ps({title:t=s("settings.updates.title")}){const n=gt(),a=window.ogb?.updater;if(!n||!a)return null;const i=n.status==="checking"?s("settings.updates.checking"):n.status==="downloading"?n.percent==null?s("settings.updates.startingDownload"):s("settings.updates.downloading",{percent:Math.round(n.percent)}):n.status==="preparing"?s("settings.updates.preparing"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.readyInstall",{app:le(),version:n.version??""}):s("settings.updates.ready",{app:le(),version:n.version??""}):n.status==="installing"?ue(n)||(n.installMode==="handoff"?s("settings.updates.openingTerminal"):s("settings.updates.restarting")):n.status==="handed-off"?s("settings.updates.handedOff"):n.status==="error"?s("settings.updates.failed",{message:ue(n)??s("settings.updates.unknownError")}):s("settings.updates.latest");return e.jsx(y,{title:t,subtitle:i,children:e.jsx("button",{onClick:()=>{if(n.status==="downloaded")return void a.install();a.check()},disabled:n.status==="checking"||n.status==="downloading"||n.status==="preparing"||n.status==="installing"||n.retryable===!1,className:"ui-button",children:n.retryable===!1?s("settings.updates.quitReopen"):n.status==="downloaded"?n.installMode==="handoff"?s("settings.updates.install"):s("settings.updates.restart"):n.status==="preparing"?s("settings.updates.preparingShort"):n.status==="installing"?n.installMode==="handoff"?s("settings.updates.opening"):s("settings.updates.restartingShort"):s("settings.updates.check")})})}function Ee(){const{state:t,dispatch:n}=k(),a=t.config?.newBots?.effort??"",[i,r]=o.useState(!1),[l,d]=o.useState("");return{current:a,saving:i,error:l,save:async p=>{if(!i){r(!0),d("");try{const m=await C("/api/config",{method:"PATCH",body:JSON.stringify({newBots:{effort:vt(p)?p:null}})});n({type:"configStatus",config:m})}catch(m){d(m instanceof Error?m.message:s("settings.newBotEffort.error"))}finally{r(!1)}}}}}function Be({effort:t,className:n}){return e.jsxs(M,{size:"sm",className:n,value:t.current,disabled:t.saving,"aria-label":s("settings.newBotEffort.aria"),onChange:a=>{t.save(a.target.value)},children:[e.jsx("option",{value:"",children:s("settings.newBotEffort.default")}),ht.map(a=>e.jsx("option",{value:a,children:ft(a)},a))]})}function As(){const t=Ee();return e.jsx(y,{title:s("settings.newBotEffort.title"),subtitle:s("settings.newBotEffort.subtitle"),message:t.error?e.jsx("p",{role:"alert",className:"text-danger",children:t.error}):null,children:e.jsx(Be,{effort:t,className:"w-full max-w-[240px]"})})}function cs({onEdit:t,onShare:n}){const a=Ee();return e.jsx(y,{title:s("newBot.defaults"),subtitle:s("settings.newBotEffort.title"),message:a.error?e.jsx("p",{role:"alert",className:"text-danger",children:a.error}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Be,{effort:a,className:"w-auto"}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-share":!0,onClick:n,children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",className:"ui-button","data-new-bot-defaults":!0,onClick:t,children:s("newBot.edit")})]})})}function ds(){const{state:t,dispatch:n}=k(),[a,i]=o.useState(!1),[r,l]=o.useState(!1);return e.jsxs("div",{children:[e.jsx("button",{disabled:a,onClick:()=>{i(!0),l(!1),C("/api/config",{method:"PUT",body:JSON.stringify({onboarding:{...t.config?.onboarding?.completedAt?{}:_t().onboarding,hintsSeen:bt(t.config?.onboarding)}}),signal:AbortSignal.timeout(1e4)}).then(d=>{n({type:"configStatus",config:d}),n({type:"toggleTour",open:!0})}).catch(()=>l(!0)).finally(()=>i(!1))},className:"ui-button",children:s("settings.welcome.appTour")}),r&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:s("onboarding.tour.error")})]})}function Ts(){const{dispatch:t}=k();return e.jsx(y,{title:s("settings.welcome.title"),subtitle:s("settings.welcome.subtitleShort"),children:e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(ds,{}),e.jsx("button",{onClick:()=>t({type:"toggleWelcome",open:!0}),className:"ui-button",children:s("settings.welcome.replay")})]})})}function Ls({simple:t=!1}){const{state:n}=k(),a=De(Oe(),n.config?.language);return e.jsx(y,{title:s("settings.language.title"),subtitle:Fe()?s("settings.language.subtitleComplete"):t?ze()==="en"?void 0:s("settings.simple.language.partial"):s("settings.language.subtitle"),children:e.jsxs(M,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:a,"aria-label":s("settings.language.aria"),onChange:i=>Ue(i.target.value),children:[e.jsx("option",{value:"",children:s(t?"settings.simple.language.system":"settings.language.system")}),Me.map(({code:i,label:r})=>e.jsx("option",{value:i,children:r},i))]})})}function Ds({simple:t=!1}){const n=ke();return e.jsx(y,{title:s("settings.sendKey.title"),subtitle:s(t?"settings.simple.sendKey":"settings.sendKey.subtitle",{key:de("mod-enter")}),children:e.jsx(M,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.sendKey.title"),onChange:a=>at(it(a.target.value)),children:nt.map(a=>e.jsx("option",{value:a,children:de(a)},a))})})}function Os({simple:t=!1}){const n=rt(),a=lt(ke());return e.jsx(y,{title:s("settings.followUp.title"),subtitle:s(t?"settings.simple.followUp":"settings.followUp.subtitle",{key:a}),children:e.jsxs(M,{size:"sm",variant:t?"ghost":"field",className:t?void 0:"w-full max-w-[240px]",value:n,"aria-label":s("settings.followUp.title"),onChange:i=>ot(ct(i.target.value)),children:[e.jsx("option",{value:"steer",children:s("settings.followUp.steer")}),e.jsx("option",{value:"queue",children:s("settings.followUp.queue")})]})})}function Ms({simple:t=!1}){const n=tt();return e.jsx(y,{title:s(t?"settings.userBubbles.simpleTitle":"settings.userBubbles.title"),subtitle:t?void 0:s("settings.userBubbles.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.userBubbles.aria"),onClick:()=>st(!n)})})}function Us({simple:t=!1}){const n=ye();return e.jsx(y,{className:t?void 0:"rounded-2xl border border-accent-border/40 bg-raised-hover/40 py-4",title:s("settings.advancedMode.title"),subtitle:s(t?"settings.simple.advancedMode":"settings.advancedMode.subtitle"),children:e.jsx(R,{checked:n,"aria-label":s("settings.advancedMode.title"),onClick:()=>Le(!n)})})}function Fs(){const t=Ie();return e.jsx(y,{title:s("settings.threadDisplay.title"),subtitle:s("settings.threadDisplay.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.threadDisplay.show"),onClick:()=>Ke(!t)})})}function zs(){const t=dt();return e.jsx(y,{title:s("settings.pinnedCircles.title"),subtitle:s("settings.pinnedCircles.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.pinnedCircles.title"),onClick:()=>ut(!t)})})}function Is(){const t=_e();return e.jsx(y,{title:s("settings.runCard.title"),subtitle:s("settings.runCard.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.runCard.show"),onClick:()=>$e(!t)})})}function Ks(){const t=pt();return e.jsx(y,{title:s("settings.universalPins.title"),subtitle:s("settings.universalPins.subtitle"),children:e.jsx(R,{checked:t,"aria-label":s("settings.universalPins.title"),onClick:()=>xt(!t)})})}function _s(){const{state:t,dispatch:n}=k(),a=mt(t.config),[i,r]=o.useState(!1),[l,d]=o.useState(""),c=async()=>{if(!i){r(!0),d("");try{const p=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{showToolCalls:!a}})});n({type:"configStatus",config:p})}catch(p){d(p instanceof Error?p.message:s("settings.toolCalls.error"))}finally{r(!1)}}};return e.jsx(y,{title:s("settings.toolCalls.title"),subtitle:e.jsxs(e.Fragment,{children:[s("settings.toolCalls.subtitle")," ",s("settings.toolCalls.detail")]}),message:l?e.jsx("p",{role:"alert",className:"text-danger",children:l}):null,children:e.jsx(R,{checked:a,"aria-label":s("settings.toolCalls.aria"),disabled:i,onClick:()=>{c()},className:"disabled:cursor-wait disabled:opacity-50"})})}function $s(){const{state:t,dispatch:n}=k(),a=te(t.config),[i,r]=o.useState(!1),[l,d]=o.useState(""),c=async p=>{if(!i){r(!0),d("");try{const m=await C("/api/config",{method:"PATCH",body:JSON.stringify({features:{skillAuthoring:p}})});n({type:"configStatus",config:m})}catch(m){d(m instanceof Error?m.message:s("settings.experimental.error"))}finally{r(!1)}}};return e.jsxs(je,{title:s("settings.experimental.title"),subtitle:s("settings.experimental.subtitle"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("settings.experimental.skillAuthoring")}),e.jsx("div",{className:"mt-0.5 text-[12px] leading-relaxed text-ink-secondary",children:s("settings.experimental.skillAuthoringDetail")})]}),e.jsx(R,{checked:a,"aria-label":s("settings.experimental.skillAuthoringAria"),disabled:i,onClick:()=>{c(!a)},className:"disabled:cursor-wait disabled:opacity-50"})]}),l?e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:l}):null,e.jsx(os,{}),e.jsx(ns,{})]})}function Hs(){const{state:t}=k(),n=t.config?.browserProfiles??[];return!ee(t.config)&&n.length===0?null:e.jsx(je,{title:s("settings.profiles.title"),subtitle:s("settings.profiles.sharedSubtitle"),children:e.jsx(Xt,{})})}const be=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],us={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function Re(t){return e.jsx($t,{modal:!0,children:e.jsx(ps,{...t})})}function ps({defaultsMode:t=!1,onClose:n,onCreated:a,readyBotId:i}){const r=Ht(),l=k(),[,d]=o.useState(0),[c,p]=o.useState(()=>new xe(Ct,()=>d(x=>x+1))),[m,w]=o.useState("Identity"),[P,A]=o.useState(!1),[g,h]=o.useState(!1),v=g||l.state.botCreationPending,b=o.useRef(!1),T=o.useRef(!0),[f,L]=o.useState(""),[I,$]=o.useState(null),[U,K]=o.useState("everyone"),[_,q]=o.useState(""),F=Se(),H=l.state.config?.team?.name,[z,u]=o.useState(null),E=we(),S=He(),D=ye()?be:be.filter(x=>x!=="Model"),ne=!t&&typeof window<"u"&&!window.ogb&&E===!0,J=o.useRef(null),V=o.useRef(n);V.current=n,o.useEffect(()=>{let x=!1;return C("/api/bot-defaults").then(B=>{if(x)return;const j=Et(B,!t),N=t||!i?void 0:Ne(i),O=new xe(N?yt(j,N):j,()=>d(Y=>Y+1));N&&(O.role=N.id),p(O),A(!0)}).catch(B=>{x||L(String(B))}),()=>{x=!0}},[t,i]),o.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]),o.useEffect(()=>()=>c.dispose(),[c]),o.useEffect(()=>{v&&J.current?.focus()},[v]),o.useEffect(()=>{const x=document.activeElement instanceof HTMLElement?document.activeElement:null;J.current?.focus();const B=j=>{if(!r())return;const N=J.current;if(!N||j.target instanceof Node&&!N.contains(j.target))return;const O=N.querySelector('[role="dialog"], [role="alertdialog"]');if(O&&O.getClientRects().length||(j.key==="Escape"&&(j.preventDefault(),V.current()),j.key!=="Tab"))return;const Y=[...N.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(re=>re.getClientRects().length&&!re.closest("[hidden],fieldset:disabled")),Z=Y[0],G=Y.at(-1);if(!Z||!G){j.preventDefault(),N.focus();return}j.shiftKey&&(document.activeElement===Z||document.activeElement===N)?(j.preventDefault(),G.focus()):!j.shiftKey&&(document.activeElement===G||document.activeElement===N)&&(j.preventDefault(),Z.focus())};return window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B),x?.isConnected&&x.focus()}},[r]);const ae=async()=>{if(!P||b.current||l.state.botCreationPending)return;if(!t&&c.bot.approvalMode==="auto"&&c.bot.computer==="local"&&!c.consent.acknowledgeLocalAuto){$("local");return}const x=ne?zt(U,_):null;if(x&&!x.ok){L(s("botSettings.visibility.needPeople"));return}b.current=!0,h(!0),L(""),l.dispatch({type:"botCreationPending",on:!0});try{if(t)await C("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await Bt(c)})});else{const{bot:B,warnings:j,paused:N}=await Rt(c,void 0,void 0,void 0,x?.ok?x.visibility:void 0,F?me(z,c.bot.section,l.state.bots,F)??void 0:void 0);Pt(l.dispatch,B,j,{showThreads:S,source:c.preset?"preset":c.role?"template":"blank",role:c.role,paused:N});try{await a?.(B)}catch(O){l.dispatch({type:"error",message:O instanceof Error?O.message:String(O)})}}b.current=!1,T.current&&V.current()}catch(B){T.current&&L(B instanceof Error?B.message:String(B))}finally{b.current=!1,l.dispatch({type:"botCreationPending",on:!1}),T.current&&h(!1)}},W=c.bot,Pe={...l,state:{...l.state,bots:[W,...l.state.bots],routines:c.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>W,dispatch:x=>{x.type==="updateBot"&&x.botId===c.id?c.patch(x.patch):x.type==="setModel"&&x.botId===c.id?(c.setModel(x.selection),x.resetApprovalToAsk&&c.patch({approvalMode:"ask"})):x.type==="routinePatched"||x.type==="toggleSettings"||l.dispatch(x)}},ie=t?s("newBot.defaults"):s("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&l.state.appSettingsOpen,children:e.jsxs("div",{ref:J,role:"dialog","aria-modal":"true","aria-label":ie,"aria-busy":v,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:ie}),e.jsx("button",{type:"button",onClick:()=>V.current(),"aria-label":s("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(ve,{size:18,className:"pointer-events-none"})})]}),F&&!t&&H&&e.jsx(xs,{team:H}),ne&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[s("botSettings.visibility.title"),e.jsxs(M,{size:"sm",value:U,disabled:v,onChange:x=>K(x.target.value),children:[e.jsx("option",{value:"everyone",children:s("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:s("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:s("botSettings.visibility.people")})]})]}),U==="people"&&e.jsx("input",{value:_,disabled:v,onChange:x=>q(x.target.value),placeholder:s("botSettings.visibility.peoplePlaceholder"),"aria-label":s("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":s("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:D.map(x=>e.jsx("button",{type:"button",onClick:()=>w(x),"aria-current":m===x?"page":void 0,className:Q("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",m===x?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:s(us[x])},x))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!P&&!f&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(X,{size:16,className:"animate-spin"}),s("newBot.loading")]}),P&&e.jsx("fieldset",{disabled:v,className:"min-w-0",children:e.jsx(wt,{value:Pe,children:e.jsx(jt.Provider,{value:{request:c.request,draft:!0,uploadAvatar:c.uploadAvatar},children:e.jsx(ms,{active:m,draft:c,defaultsMode:t,owner:F&&!t?{value:me(z,W.section,l.state.bots,F),choose:u}:void 0})})})})]})]}),f&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:f}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>V.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:s("common.cancel")}),e.jsxs("button",{type:"button",disabled:!P||v||!t&&!W.name.trim(),onClick:()=>{ae()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[v&&e.jsx(X,{size:15,className:"animate-spin"}),s(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(kt,{open:I==="local",onCancel:()=>$(null),onConfirm:()=>{c.consent.acknowledgeLocalAuto=!0,$(null),ae()}})]})})}function xs({team:t}){const n=typeof window>"u"?void 0:window.ogb?.workspaces;return e.jsxs("div",{"data-new-bot-shared":!0,className:"flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[e.jsx("span",{children:s("newBot.sharedWith",{team:t})}),n?e.jsx("button",{type:"button",onClick:()=>{At(n).catch(()=>{})},className:"font-medium text-accent hover:underline",children:s("newBot.justForYou")}):e.jsx("span",{children:s("newBot.justForYou").replace(/\s*→$/,"")})]})}function ms({active:t,draft:n,defaultsMode:a,owner:i}){const r=n.bot,{state:l}=k(),d=Se(),c=St(r);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(gs,{draft:n,defaultsMode:a}),e.jsx(Tt,{bot:r,patch:c.patch,activeState:c.activeState,mascotMotion:null,namePlaceholder:a?s("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.team"),e.jsxs(M,{size:"lg",className:"mt-1.5 w-full",value:r.section??"",onChange:p=>n.patch({section:p.target.value}),children:[e.jsx("option",{value:"",children:s("teamSettings.general")}),[...new Set([...l.sections??[],...l.bots.map(p=>p.section??"")])].filter(Boolean).map(p=>e.jsx("option",{children:p},p))]})]}),i&&d&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[s("lookedAfter.newBot"),e.jsx(M,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:p=>i.choose(p.target.value),children:d.people.map(p=>e.jsx("option",{value:p.email,children:p.you?s("owner.you",{name:p.name}):p.name},p.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:s("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Lt,{bot:r,patch:c.patch}):t==="Skills"?e.jsx(Dt,{bot:r}):t==="Memory"?e.jsx(hs,{draft:n}):t==="Routines"?e.jsx(fs,{draft:n}):t==="Access"?e.jsx(Ot,{bot:r,derived:c}):t==="Model"?e.jsx(Mt,{bot:r}):t==="Permissions"?e.jsx(Ut,{bot:r,derived:c}):e.jsx(Ft,{bot:r,derived:c})}function gs({draft:t,defaultsMode:n}){const[a,i]=o.useState([]),[r,l]=o.useState(0),[d,c]=o.useState(""),p=o.useRef(!1);o.useEffect(()=>{if(n)return;let g=!1;return C("/api/bot-presets").then(h=>{g||i(h.presets)}).catch(()=>{g||i([])}),()=>{g=!0}},[n,r]);const m=t.preset?a.find(g=>g.id===t.preset.id):void 0,w=async g=>{c("");const h=g.startsWith("preset:")?a.find(b=>b.id===g.slice(7)):void 0;if(!h){t.choosePreset(void 0);const b=pe.find(f=>f.id===g);t.chooseRole(b?.id);const T=b&&Ne(b.id)?.look;b&&t.patch({...Nt(b),...T});return}t.patch(Gt(h)),t.choosePreset(ts(h));const v=Qt(h);try{v?(t.patch({avatarUrl:await t.uploadAvatar(v),avatarCrop:h.bot.appearance.avatar.crop}),p.current=!0):p.current&&(t.patch({avatarUrl:""}),p.current=!1)}catch(b){c(b instanceof Error?b.message:String(b))}},P=async g=>{c("");try{await C(`/api/bot-presets/${encodeURIComponent(g.id)}`,{method:"DELETE"}),t.preset?.id===g.id&&t.choosePreset(void 0),l(h=>h+1)}catch(h){c(h instanceof Error?h.message:String(h))}},A=pe.map(g=>e.jsx("option",{value:g.id,children:g.title},g.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[s("newBot.startingRole"),e.jsxs(M,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:g=>{w(g.target.value)},children:[e.jsx("option",{value:"",children:s("newBot.customSettings")}),Zt(a).map(g=>e.jsx("optgroup",{label:g.label,children:g.presets.map(h=>e.jsx("option",{value:`preset:${h.id}`,children:h.name},h.id))},g.label)),a.length?e.jsx("optgroup",{label:s("newBot.builtInRoles"),children:A}):A]})]}),m&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[es(m).map((g,h)=>e.jsx("p",{className:"break-words",children:g},h)),m.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{P(m)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.presetRemove")})]}),d&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:d})]})}function hs({draft:t}){const[n,a]=o.useState("MEMORY.md"),[i,r]=o.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(M,{size:"lg",className:"w-full","aria-label":s("memory.fileLabel",{path:n}),value:n,onChange:l=>a(l.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(l=>e.jsx("option",{children:l},l))}),e.jsx("textarea",{className:Q(ge,"min-h-72 font-mono"),"aria-label":s("memory.contents"),value:t.template.memory[n]??"",onChange:l=>t.setMemory(n,l.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:ge,"aria-label":s("memory.newTopicLabel"),placeholder:s("memory.newTopicLabel"),value:i,onChange:l=>r(l.target.value)}),e.jsx("button",{type:"button","aria-label":s("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const l=`memory/${i}.md`;l in t.template.memory||t.setMemory(l,""),a(l),r("")},children:e.jsx(Vt,{size:16})}),n!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":s("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(n,null),a("MEMORY.md")},children:e.jsx(Ce,{size:16})})]})]})}function fs({draft:t}){const[n,a]=o.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>a("new"),children:s("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>a(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:r=>t.setRoutineEnabled(i.id,r.target.checked)}),s("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":s("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(Ce,{size:15})})]},i.id)),n&&e.jsx(It,{routine:n==="new"?void 0:n,bots:[t.bot],lockedBotId:t.id,onClose:()=>a(null)})]})}function bs({simple:t=!1}){const[n,a]=o.useState(!1),[i,r]=o.useState(!1),l=e.jsxs(e.Fragment,{children:[n&&e.jsx(Re,{defaultsMode:!0,onClose:()=>a(!1)}),i&&e.jsx(ss,{onClose:()=>r(!1)})]});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(cs,{onEdit:()=>a(!0),onShare:()=>r(!0)}),l]});const d=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex shrink-0 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>r(!0),className:"cursor-pointer rounded-lg px-3 py-1.5 text-[13px] text-ink-secondary hover:bg-control hover:text-ink",children:s("newBot.sharePreset")}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:s("newBot.edit")})]}),l]});return e.jsx(y,{title:s("newBot.defaults"),children:d})}const Vs=Object.freeze(Object.defineProperty({__proto__:null,DefaultBotSettings:bs,NewBotDialog:Re},Symbol.toStringTag,{value:"Module"}));export{Us as A,Bs as B,Ms as C,bs as D,$s as E,Os as F,Ls as L,As as N,zs as P,Ts as R,Rs as S,_s as T,Ps as U,Hs as a,Ds as b,Fs as c,Ks as d,Is as e,Vs as f};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as s,j as e,a as y,f as re,r as n,X as lt,S as ot}from"./styles-ElM5u1od.js";import{N as ct,P as dt,r as Fe,O as mt,L as C,z as Te,Q as xt,y as J}from"./PlacesRail-BYBRFGDz.js";import{o as Ge,a as pt,b as ut,c as gt,d as ht,t as ae,e as bt,M as ft}from"./org-library-97Cfj4XD.js";import{t as yt,a as jt}from"./import-name-wz0BNJ-d.js";import{bw as kt,bx as Nt,by as vt,w as wt,bz as Ie,bA as St,aQ as Me,u as _e,bB as Ct,bC as Lt,bD as Bt,bE as zt,bF as Et,bG as Tt,n as S,bH as It,bI as Oe,bJ as Ot,F as At,bK as Dt}from"./App-5fWd2qWI.js";import{ShareTeamDialog as Pt}from"./ShareTeamDialog-DuSs1saG.js";import"./monitor-IwDx0ohO.js";import"./package-format-MbGfBQ0g.js";import"./index-BJo4IICg.js";import"./MenuMotion-DnbwlBMa.js";import"./team-share-B2cRBtNk.js";const Rt={"seo growth team":"seoGrowth","engineering team":"engineering","100x marketing team":"marketing100x","reddit lead miner":"redditLeadMiner","competitor watch":"competitorWatch","inbox follow-up":"inboxFollowup"};function Ue(a){const m=Rt[a.name.trim().toLowerCase()];return m?{...a,name:s(`templates.catalog.${m}.name`),summary:s(`templates.catalog.${m}.summary`),outcome:a.outcome?s(`templates.catalog.${m}.outcome`):void 0}:a}function $t(a,m){const x=Ue(a);return`${x.name} ${x.summary} ${a.name} ${a.summary} ${a.category} ${a.skills.join(" ")} ${a.requires.apps.join(" ")}`.toLowerCase().includes(m)}const I=["bg-purple-500/15 text-purple-300","bg-cyan-500/15 text-cyan-300","bg-orange-500/15 text-orange-300","bg-emerald-500/15 text-emerald-300"];function Ft({pending:a,importedNames:m,org:x=!1}){return e.jsxs(e.Fragment,{children:[a.description&&e.jsx("p",{className:"max-w-2xl text-[14px] leading-relaxed text-ink-secondary",children:a.description}),a.brief&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamImport.brief")}),e.jsx("p",{className:"mt-1 line-clamp-4 whitespace-pre-wrap break-words",children:a.brief})]}),!!a.warnings?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"mb-2 font-medium text-ink",children:s("templates.backupNotes")}),a.warnings?.map((d,o)=>e.jsx("p",{children:d},o))]}),(a.kind==="package"||a.kind==="backup")&&e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2 text-[12px] text-ink-secondary",children:[a.chiefOfStaff&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(kt,{size:13}),s("templates.leads",{name:a.chiefOfStaff})]}),!a.library&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Nt,{size:13}),s("templates.groupChats",{count:a.rooms})]}),!(a.library&&!a.playbooks)&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(vt,{size:13}),s("templates.playbooks",{count:a.playbooks})]}),!a.library&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(wt,{size:13}),a.version===2?s("teamImport.routinesPaused",{count:a.routines}):s("templates.pausedRoutines",{count:a.routines})]}),a.kind==="package"&&a.version!==2&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Ie,{size:13}),s("templates.connections",{count:a.apps.length})]}),!!a.connections?.length&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Ie,{size:13}),s("teamImport.connections",{count:a.connections?.length??0})]}),!!a.notes&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(St,{size:13}),s("teamImport.notes",{count:a.notes??0})]}),!!a.presets?.length&&e.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-raised px-3 py-1.5",children:[e.jsx(Me,{size:13}),s("teamImport.presets",{count:a.presets?.length??0})]})]}),!!a.skills?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:x?s("orgLibrary.skillsOn"):a.version===2?s("teamImport.skillsOff"):s("templates.skillsDisabled")}),e.jsx("p",{className:"mt-1 break-words",children:a.skills?.join(", ")}),!x&&e.jsx("p",{className:"mt-1",children:a.version===2?s("teamImport.skillsReview"):s("templates.skillsReview")})]}),a.library&&!!a.presets?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamImport.presetList")}),e.jsx("p",{className:"mt-1 break-words",children:a.presets?.join(", ")})]}),!!a.offeredSkills?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamImport.offeredSkills")}),e.jsx("p",{className:"mt-1 break-words",children:a.offeredSkills?.join(", ")})]}),!!a.connections?.length&&e.jsxs("div",{className:"mt-4 rounded-xl border border-hairline px-4 py-3 text-[13px] text-ink-secondary",children:[e.jsx("div",{className:"font-medium text-ink",children:s("teamImport.connections",{count:a.connections?.length??0})}),e.jsx("ul",{className:"mt-1",children:a.connections?.map((d,o)=>e.jsxs("li",{className:"truncate",children:[d.label," · ",d.url]},`${d.label}-${o}`))})]}),a.members.length>0&&e.jsx("div",{className:"mt-6 text-[12px] font-medium text-ink-secondary",children:s("templates.teamMembers")}),e.jsx("div",{className:"mt-2 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:a.members.map((d,o)=>e.jsxs("div",{className:"flex min-h-[72px] items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[a.pictures?.[o]?e.jsx("img",{src:a.pictures[o],alt:"",className:"size-9 shrink-0 rounded-lg object-cover"}):e.jsx("div",{className:y("flex size-9 shrink-0 items-center justify-center rounded-lg text-[13px] font-semibold",I[o%I.length]),children:d.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[14px] font-medium text-ink",children:m[o]}),m[o]!==d.name&&e.jsx("div",{className:"text-[12px] text-ink-secondary",children:s("templates.newCopyOf",{name:d.name})}),e.jsx("div",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:d.title||s("templates.generalAssistant")})]})]},`${d.name}-${o}`))}),e.jsxs("div",{className:"mt-6 flex items-start gap-2.5 rounded-xl bg-raised/45 px-4 py-3 text-[13px] leading-relaxed text-ink-secondary",children:[e.jsx(re,{size:15,className:"mt-0.5 shrink-0 text-success"}),e.jsx("p",{children:a.kind==="backup"?s("templates.backupSafety",{archived:a.archivedBots?s("templates.archivedBots",{count:a.archivedBots}):""}):x?a.members.length?s("orgLibrary.teamSafety"):s("orgLibrary.librarySafety"):a.library?s("teamImport.librarySafety"):a.version===2?s("teamImport.sharedTeamSafety"):a.kind==="package"?s("templates.packageSafety"):s("templates.legacySafety")})]})]})}const Gt={gmail:"Gmail",github:"GitHub",discord:"Discord",slack:"Slack",googlecalendar:"Google Calendar",notion:"Notion",linear:"Linear",figma:"Figma",gong:"Gong",hubspot:"HubSpot",postiz:"Postiz"},Ae={everyday:"readyBots.category.everyday",work:"readyBots.category.work",writing:"readyBots.category.writing",design:"readyBots.category.design",sales:"readyBots.category.sales",personal:"readyBots.category.personal"};function Mt({search:a,onDialog:m,onAdded:x}){const[d,o]=n.useState(null),{state:h,dispatch:j}=_e(),[v,p]=n.useState(null),b=l=>{if(!(l!==null&&Tt(h))){if(l!==null&&window.ogb?.remoteClient?.active){j({type:"newBot",onCreated:x});return}p(l),m(l!==null)}},L=Ct.filter(l=>(!d||l.category===d)&&Lt(l,a));return a.trim()&&L.length===0?null:e.jsxs("section",{className:"mb-8","aria-labelledby":"ready-bots-title",children:[e.jsxs("div",{className:"mb-1 flex flex-wrap items-baseline justify-between gap-2",children:[e.jsx("h3",{id:"ready-bots-title",className:"text-[12px] font-medium text-ink-secondary",children:s("readyBots.title")}),e.jsx("p",{className:"text-[12px] text-ink-tertiary",children:s("readyBots.subtitle")})]}),e.jsx("div",{className:"mb-3 mt-2 flex flex-wrap gap-1.5",role:"group","aria-label":s("readyBots.categories"),children:[null,...Bt].map(l=>e.jsx("button",{type:"button","aria-pressed":d===l,onClick:()=>o(l),className:y("rounded-full px-3 py-1 text-[13px] transition-colors",d===l?"bg-ink text-panel":"bg-raised/70 text-ink-secondary hover:text-ink"),children:l?s(Ae[l]):s("readyBots.all")},l??"all"))}),e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:L.map(l=>{const w=zt(l);return e.jsxs("article",{"data-ready-bot":l.id,className:"flex flex-col rounded-2xl border border-hairline/40 bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ct,{color:l.look.color,bodyId:l.look.mascotBody,size:40,animated:!1,label:l.name}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"truncate text-[14px] font-medium text-ink",children:l.name}),e.jsxs("p",{className:"truncate text-[12px] text-ink-secondary",children:[w.title," · ",s(Ae[l.category])]})]}),e.jsxs("button",{type:"button",onClick:()=>b(l.id),"aria-label":s("readyBots.addAria",{name:l.name,title:w.title}),className:"flex h-8 shrink-0 items-center gap-1 rounded-full bg-raised px-3 text-[13px] font-medium text-ink hover:bg-raised-hover focus-visible:outline-2 focus-visible:outline-accent",children:[e.jsx(dt,{size:14,"aria-hidden":"true"}),s("readyBots.add")]})]}),e.jsx("p",{className:"mt-3 text-[13px] leading-[1.45] text-ink-secondary",children:w.description}),e.jsx("p",{className:"mt-2 text-[12px] italic text-ink-tertiary",children:s("readyBots.try",{prompt:w.tryAsking})}),(l.apps.length>0||l.routines?.length)&&e.jsx("p",{className:"mt-auto pt-2 text-[12px] text-ink-tertiary",children:[l.apps.length>0&&s("readyBots.worksWith",{apps:l.apps.map(O=>Gt[O]??O).join(", ")}),l.routines?.length&&s("readyBots.pausedRoutine")].filter(Boolean).join(" · ")})]},l.id)})}),v&&Fe.createPortal(e.jsx(Et,{readyBotId:v,onClose:()=>b(null),onCreated:l=>{m(!1),x(l)}}),document.body)]})}const De=["bg-cyan-500/15 text-cyan-300","bg-purple-500/15 text-purple-300","bg-emerald-500/15 text-emerald-300","bg-orange-500/15 text-orange-300"];function _t({listing:a,busy:m,notice:x,error:d,onAdd:o,onDetails:h}){const j=a.organization.name;return e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("orgLibrary.intro",{name:j})}),a.packages.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:s("orgLibrary.empty",{name:j})}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:a.packages.map((v,p)=>e.jsx(Ut,{entry:v,index:p,busy:m,onAdd:o,onDetails:h},v.packageId))}),x&&e.jsx("div",{role:"status",className:"mt-4 rounded-lg bg-raised/60 px-3 py-2 text-[13px] text-ink-secondary",children:x}),d&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:d})]})}function Ut({entry:a,index:m,busy:x,onAdd:d,onDetails:o}){const h=Ge(a),j=pt(a),v=ut(a),p=x===a.packageId;return e.jsxs("article",{className:"flex min-h-[104px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx("div",{className:y("flex size-11 shrink-0 items-center justify-center rounded-xl",De[m%De.length]),children:e.jsx(mt,{size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:a.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:a.tagline}),e.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px] text-ink-tertiary",children:[e.jsx("span",{children:gt(a)}),j&&e.jsx("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-accent-text",children:j}),a.release&&e.jsx("span",{children:a.release.version})]}),e.jsx("p",{className:"mt-0.5 truncate text-[12px] text-ink-tertiary",children:ht(a.contents)}),v.map(b=>e.jsx("p",{className:"mt-0.5 text-[12px] text-warning",children:b},b))]}),e.jsxs("div",{className:"flex shrink-0 flex-col items-end gap-1.5",children:[h==="add"&&e.jsxs("button",{onClick:()=>d(a),disabled:x!==null,"aria-label":s("orgLibrary.addAria",{name:a.name}),className:"flex min-w-[72px] items-center justify-center gap-1.5 rounded-full bg-accent px-3.5 py-2 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[p&&e.jsx(C,{size:13,className:"animate-spin"}),p?s("orgLibrary.adding"):s("orgLibrary.add")]}),h==="added"&&e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-raised px-3 py-1.5 text-[12px] text-ink-secondary",children:[e.jsx(re,{size:13,className:"text-success"}),s("orgLibrary.added")]}),h==="updateApp"&&e.jsx("span",{className:"max-w-[140px] text-right text-[12px] text-ink-secondary",children:s("orgLibrary.updateApp")}),h==="notReady"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("orgLibrary.notReady")}),h==="noRelease"&&e.jsx("span",{className:"text-[12px] text-ink-secondary",children:s("orgLibrary.noRelease")}),a.blob==="ready"&&e.jsx("button",{onClick:()=>o(a),disabled:x!==null,"aria-label":s("orgLibrary.detailsAria",{name:a.name}),className:"rounded-full px-2.5 py-1 text-[12px] text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-40",children:s("orgLibrary.details")})]})]})}const Yt="https://github.com/leomieo/limix-bot-teams",Pe=["cyan","red","purple","green","orange"];async function Re(a){if(window.ogb?.openExternal){await window.ogb.openExternal(a);return}const m=window.open(a,"_blank","noopener,noreferrer");m&&(m.opener=null)}function Ht(a,m){const x=new Map;for(const o of m){if(o.hidden)continue;const h=o.section?.trim()??"";x.set(h,(x.get(h)??0)+1)}return[...[...new Set([...a.map(o=>o.trim()).filter(Boolean),...x.keys()])].filter(o=>o!==""),""].flatMap(o=>x.get(o)?[{name:o,bots:x.get(o)}]:[])}function $e({index:a}){return e.jsx("div",{className:y("flex size-11 shrink-0 items-center justify-center rounded-xl",I[a%I.length]),children:e.jsx(Me,{size:20})})}function as({onClose:a,onImported:m,returnFocusRef:x,initialUrl:d}){const{state:o,dispatch:h}=_e(),j=n.useRef(null),v=n.useRef(null),[p,b]=n.useState("explore"),[L,l]=n.useState(null),[w,O]=n.useState(!0),[ne,ie]=n.useState(""),[W,le]=n.useState(null),[c,A]=n.useState(null),[Ye,He]=n.useState("file"),[Q,oe]=n.useState(""),[ce,de]=n.useState(!1),[k,P]=n.useState(!1),[Ke,X]=n.useState(!1),[R,qe]=n.useState(""),[z,g]=n.useState(""),[me,xe]=n.useState(""),[$,pe]=n.useState(!1),[f,ue]=n.useState(null),[Je,We]=n.useState(""),[F,V]=n.useState(null),[ge,he]=n.useState(new Set),[be,fe]=n.useState(""),[G,ye]=n.useState(!1),[M,je]=n.useState(null),[ke,Qe]=n.useState(!1),[_,Ne]=n.useState(null),[Xe,U]=n.useState(null),[Ve,ve]=n.useState(""),[Ze,Y]=n.useState(""),[E,H]=n.useState(null),B=n.useRef(!1),T=n.useRef(0),Z=o.bots.filter(t=>!t.hidden).length,we=Ht(o.sections??[],o.bots),et=new Set(o.bots.map(t=>t.name.trim().toLowerCase())),tt=c?.members.map(t=>yt(t.name,et))??[],ee=n.useCallback(async()=>{O(!0),ie("");try{l(await S("/api/team-library/catalog"))}catch(t){ie(t instanceof Error?t.message:String(t))}finally{O(!1)}},[]);n.useEffect(()=>{ee()},[ee]);const K=n.useCallback(async()=>{try{const t=await S("/api/org-library");Ne(t),t.organization&&!B.current&&b("org")}catch{Ne({organization:null,packages:[]})}},[]);n.useEffect(()=>{K()},[K]),n.useEffect(()=>(j.current?.focus(),()=>x.current?.focus()),[x]),n.useEffect(()=>{const t=r=>{if(M!==null||ke)return;if(r.key==="Escape"&&!k){r.preventDefault(),r.stopPropagation(),c?(A(null),H(null)):a();return}if(r.key!=="Tab")return;const i=j.current,u=Array.from(i?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])')??[]);if(!i||u.length===0)return;const N=u[0],q=u.at(-1);r.shiftKey&&(document.activeElement===N||!i.contains(document.activeElement))?(r.preventDefault(),q.focus()):!r.shiftKey&&document.activeElement===q&&(r.preventDefault(),N.focus())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[k,a,c,M,ke]);const te=(t,r)=>{A(t),He(r),g("")},Se=async t=>{if(t.size>ft)throw new Error(s("templates.fileTooLarge"));const r=await t.text();let i=r;if(!t.name.toLowerCase().endsWith(".md"))try{i=JSON.parse(r)}catch(u){throw u instanceof SyntaxError?new Error(s("teamLibrary.invalidJson")):u}te(ae(i),"file")},st=async t=>{le(t.slug),g("");try{te(ae(await S(`/api/team-library/teams/${t.slug}`)),"library")}catch(r){g(r instanceof Error?r.message:String(r))}finally{le(null)}},Ce=async()=>{await Le(Q)},Le=async t=>{if(t.trim()){de(!0),g("");try{const r=await S("/api/team-library/github",{method:"POST",body:JSON.stringify({url:t.trim()})});te(ae(r),"github")}catch(r){g(r instanceof Error?r.message:String(r))}finally{de(!1)}}};n.useEffect(()=>{d&&(B.current=!0,b("import"),oe(d),Le(d))},[d]);const at=async()=>{if(c){P(!0),g("");try{const t=await jt(c.manifest,h);J("team_imported",{members:t.bots.length,source:Ye,mode:"add",format:c.kind}),m({name:c.name,members:t.bots.length,...t.connections?.length?{connections:t.connections.length}:{},...t.presets?.length?{presets:t.presets.length}:{}})}catch(t){g(t instanceof Error?t.message:String(t))}finally{P(!1)}}},rt=async t=>{U(t.packageId),Y("");try{const r=await S(`/api/org-library/packages/${t.packageId}`);A(bt(r.document)),H(t),g("")}catch(r){Y(r instanceof Error?r.message:String(r))}finally{U(null)}},Be=async t=>{U(t.packageId),P(!0),Y(""),ve(""),g("");try{const r=await S("/api/org-library/add",{method:"POST",body:JSON.stringify({packageId:t.packageId})});for(const u of r.bots??[])h({type:"botAdded",bot:u});for(const u of r.groups??[])h({type:"groupPatched",group:u});for(const u of r.routines??[])h({type:"routinePatched",routine:u});const i=r.bots?.find(u=>!u.hidden);if(J("team_imported",{members:r.bots?.length??0,source:"organization",mode:"add",format:"package"}),i){h({type:"select",id:i.id}),m({name:t.name,members:r.bots.length,...r.connections?.length?{connections:r.connections.length}:{}});return}A(null),H(null),r.alreadyAdded||ve(s("orgLibrary.addedSkills",{name:t.name})),await K()}catch(r){const i=r instanceof Error?r.message:String(r);E?g(i):Y(i),await K()}finally{U(null),P(!1)}},D=me.trim(),se=async t=>{const r=++T.current;pe(!0),g(""),ue(null),V(null),he(new Set);try{const i=await S(`/api/teams/scout?cwd=${encodeURIComponent(t)}`);if(r!==T.current)return;ue(i),We(t),fe(i.suggestion.roomName),J("team_scouted",{signals:i.suggestion.manifest.team.members.length-1}),S(`/api/teams/scout/directory?cwd=${encodeURIComponent(t)}`).then(u=>{r===T.current&&V(u.directory)}).catch(()=>{r===T.current&&V([])})}catch(i){if(r!==T.current)return;g(i instanceof Error?i.message:String(i))}finally{r===T.current&&pe(!1)}},nt=async()=>{const t=await window.ogb?.pickFolder?.(D||void 0);t&&(xe(t),await se(t))},it=async()=>{if(!(!f||G)){ye(!0),g("");try{const t=(F??[]).filter(N=>ge.has(N.slug)).map((N,q)=>({key:`dir-${N.slug}`,name:N.name,title:N.category||s("templates.communityBot"),description:N.prompt,appearance:{color:Pe[q%Pe.length]}})),r={...f.suggestion.manifest,team:{...f.suggestion.manifest.team,members:[...f.suggestion.manifest.team.members,...t]}},i=be.trim()||f.suggestion.roomName,u=await S(`/api/teams/import?mode=project&cwd=${encodeURIComponent(Je)}&room=${encodeURIComponent(i)}`,{method:"POST",body:JSON.stringify(r)});for(const N of u.bots)h({type:"botAdded",bot:N});u.group&&(h({type:"groupPatched",group:{...u.group,messages:[]}}),h({type:"select",id:u.group.id})),J("team_imported",{members:u.bots.length,source:"scout",mode:"project"}),m({name:i,members:u.bots.length})}catch(t){g(t instanceof Error?t.message:String(t))}finally{ye(!1)}}},ze=R.trim().toLowerCase(),Ee=(L?.teams??[]).filter(t=>!ze||$t(t,ze));return Fe.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4 sm:p-6",onMouseDown:t=>t.target===t.currentTarget&&!k&&a(),children:[e.jsxs("div",{ref:j,role:"dialog","aria-modal":"true","aria-labelledby":"team-library-title",tabIndex:-1,className:"animate-pop-in flex h-[min(780px,calc(100dvh-2rem))] w-full max-w-[1040px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl shadow-black/50 outline-none",children:[e.jsxs("header",{className:"flex items-start justify-between gap-4 px-6 pb-3 pt-6 sm:px-8 sm:pt-7",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c&&e.jsx("button",{onClick:()=>{A(null),H(null),g("")},disabled:k,className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":s("templates.back"),children:e.jsx(It,{size:18})}),e.jsx("h2",{id:"team-library-title",className:"truncate text-[22px] font-semibold tracking-[-0.01em] text-ink",children:c?c.name:s("templates.title")})]}),e.jsx("p",{className:y("mt-1 text-[13px] text-ink-secondary",c&&"ml-9"),children:c?c.kind==="backup"?s("templates.backupSummary",{bots:c.members.length,conversations:c.conversations??0}):c.kind==="package"?c.library?s("teamImport.library"):c.version===2?s("teamImport.sharedTeam",{count:c.members.length}):s("templates.playbookSummary",{count:c.members.length}):s("templates.readyBots",{count:c.members.length}):s("templates.subtitle")})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!c&&e.jsxs("button",{onClick:()=>{Re(L?.repositoryUrl??Yt)},className:"flex items-center gap-1.5 rounded-lg px-2.5 py-2 text-[13px] text-ink-secondary hover:bg-raised hover:text-ink",title:s("templates.openRepository"),children:[e.jsx(Oe,{size:16}),e.jsx("span",{className:"max-sm:hidden",children:s("templates.communityRepo")}),e.jsx(Te,{size:12})]}),e.jsx("button",{onClick:a,disabled:k,className:"rounded-lg p-2 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":s("templates.close"),children:e.jsx(lt,{size:21})})]})]}),c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-6 pt-6 sm:px-8",children:[e.jsx(Ft,{pending:c,importedNames:tt,org:E!==null}),z&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:z})]}),e.jsxs("footer",{className:"flex flex-col gap-3 border-t border-hairline/35 px-6 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-8",children:[e.jsxs("div",{className:"text-[13px] text-ink-secondary",children:[s(Z===0?"templates.existingNone":Z===1?"templates.existingOne":"templates.existingMany",{count:Z})," ",c.kind==="backup"?s("teamImport.backupCopies"):c.library?s("teamImport.libraryAdds"):c.members.length===0?"":s("teamImport.newSection",{name:c.teamName??c.name})]}),E?Ge(E)==="add"?e.jsxs("button",{onClick:()=>{Be(E)},disabled:k,"aria-label":s("orgLibrary.addAria",{name:E.name}),className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[k&&e.jsx(C,{size:15,className:"animate-spin"}),k?s("orgLibrary.adding"):s("orgLibrary.add")]}):e.jsxs("span",{className:"flex shrink-0 items-center gap-1 rounded-full bg-raised px-4 py-2 text-[13px] text-ink-secondary",children:[e.jsx(re,{size:14,className:"text-success"}),s("orgLibrary.added")]}):e.jsxs("button",{onClick:()=>{at()},disabled:k,className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[k&&e.jsx(C,{size:15,className:"animate-spin"}),k?s("templates.importing"):c.kind==="backup"?s("templates.importBackup"):c.library?s("teamImport.addPresets"):s("templates.addTeam")]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-3 px-6 pb-4 pt-5 sm:flex-row sm:items-center sm:justify-between sm:px-8",children:[e.jsxs("div",{className:"flex w-fit rounded-xl bg-raised/70 p-1",role:"tablist","aria-label":s("templates.source"),children:[_?.organization&&e.jsx("button",{role:"tab","aria-selected":p==="org",onClick:()=>{B.current=!0,b("org"),g("")},className:y("max-w-[220px] truncate rounded-lg px-4 py-2 text-[14px] transition-colors",p==="org"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("orgLibrary.tab",{name:_.organization.name})}),e.jsx("button",{role:"tab","aria-selected":p==="explore",onClick:()=>{B.current=!0,b("explore"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="explore"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.explore")}),e.jsx("button",{role:"tab","aria-selected":p==="import",onClick:()=>{B.current=!0,b("import"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="import"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.import")}),e.jsx("button",{role:"tab","aria-selected":p==="scout",onClick:()=>{B.current=!0,b("scout"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="scout"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("templates.fromFolder")}),e.jsx("button",{role:"tab","aria-selected":p==="share",onClick:()=>{B.current=!0,b("share"),g("")},className:y("rounded-lg px-4 py-2 text-[14px] transition-colors",p==="share"?"bg-card text-ink shadow-sm":"text-ink-secondary hover:text-ink"),children:s("teamLibrary.shareTab")})]}),p==="explore"&&e.jsxs("label",{className:"flex h-11 w-full items-center gap-2.5 rounded-xl bg-raised/70 px-3.5 sm:w-[320px]",children:[e.jsx(ot,{size:17,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{value:R,onChange:t=>qe(t.target.value),placeholder:s("templates.search"),"aria-label":s("templates.search"),className:"min-w-0 flex-1 bg-transparent text-[14px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pb-7 pt-5 sm:px-8",children:[p==="org"&&_?.organization&&e.jsx(_t,{listing:_,busy:Xe,notice:Ve,error:Ze,onAdd:t=>{Be(t)},onDetails:t=>{rt(t)}}),p==="explore"&&e.jsxs("div",{children:[e.jsx(Mt,{search:R,onDialog:Qe,onAdded:a}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:R?s("templates.searchResults"):s("templates.communityTemplates")}),w&&e.jsxs("div",{className:"flex items-center justify-center gap-2 py-24 text-[13px] text-ink-secondary",children:[e.jsx(C,{size:16,className:"animate-spin"})," ",s("templates.loading")]}),!w&&ne&&e.jsxs("div",{className:"rounded-xl bg-danger/10 p-4 text-[13px] text-danger",children:[e.jsx("p",{children:ne}),e.jsx("button",{onClick:()=>{ee()},className:"mt-3 rounded-full bg-raised px-3.5 py-2 text-ink hover:bg-raised-hover",children:s("common.tryAgain")})]}),!w&&L&&e.jsx("div",{className:"grid grid-cols-1 gap-x-10 md:grid-cols-2",children:Ee.map((t,r)=>{const i=Ue(t);return e.jsxs("article",{className:"flex min-h-[104px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx($e,{index:r}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:i.name}),e.jsx("p",{className:"mt-0.5 truncate text-[13px] text-ink-secondary",children:i.outcome??i.summary}),e.jsxs("p",{className:"mt-1 truncate text-[12px] text-ink-tertiary",children:[s("templates.botCount",{count:t.members})," · ",s("templates.playbookCount",{count:t.skills.length}),t.requires.apps.length>0&&` · ${t.requires.apps.join(", ")}`,t.setupMinutes&&` · ${s("templates.minutes",{count:t.setupMinutes})}`]})]}),e.jsxs("button",{onClick:()=>{st(t)},disabled:W!==null,className:"flex min-w-[72px] items-center justify-center gap-1.5 rounded-full bg-raised px-3.5 py-2 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40",children:[W===t.slug&&e.jsx(C,{size:13,className:"animate-spin"}),W===t.slug?s("templates.loadingShort"):s("templates.load")]})]},t.slug)})}),!w&&L&&Ee.length===0&&e.jsxs("div",{className:"flex min-h-56 flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:s("templates.noneFound")}),e.jsx("div",{className:"mt-1 text-[13px] text-ink-secondary",children:s("templates.tryDifferentSearch")})]})]}),p==="import"&&e.jsxs("div",{children:[e.jsx("input",{ref:v,type:"file",accept:".md,.json,.mausbackup.json,.mausteam.json,text/markdown,application/json",className:"hidden",onChange:t=>{const r=t.currentTarget.files?.[0];t.currentTarget.value="",r&&Se(r).catch(i=>g(i instanceof Error?i.message:String(i)))}}),e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:s("templates.bringYourOwn")}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("button",{onClick:()=>v.current?.click(),onDragEnter:t=>{t.preventDefault(),X(!0)},onDragOver:t=>t.preventDefault(),onDragLeave:()=>X(!1),onDrop:t=>{t.preventDefault(),X(!1);const r=t.dataTransfer.files[0];r&&Se(r).catch(i=>g(i instanceof Error?i.message:String(i)))},className:y("flex min-h-56 flex-col items-center justify-center rounded-2xl border border-dashed px-6 text-center transition-colors",Ke?"border-accent bg-accent/5":"border-hairline/60 bg-raised/20 hover:bg-raised/35"),children:[e.jsx(xt,{size:27,className:"text-accent"}),e.jsx("span",{className:"mt-3 text-[14px] font-medium text-ink",children:s("templates.chooseFile")}),e.jsx("span",{className:"mt-1 text-[13px] text-ink-secondary",children:s("templates.dropFile")})]}),e.jsxs("div",{className:"flex min-h-56 flex-col justify-center rounded-2xl bg-raised/25 px-6",children:[e.jsx(Oe,{size:25,className:"text-ink-secondary"}),e.jsx("h3",{className:"mt-3 text-[14px] font-medium text-ink",children:s("templates.loadGithub")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:s("templates.githubHint")}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("input",{value:Q,onChange:t=>oe(t.target.value),onKeyDown:t=>t.key==="Enter"&&void Ce(),placeholder:s("templates.githubPlaceholder"),"aria-label":s("templates.githubUrl"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),e.jsxs("button",{onClick:()=>{Ce()},disabled:!Q.trim()||ce,className:"flex items-center gap-1.5 rounded-full bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[ce&&e.jsx(C,{size:13,className:"animate-spin"}),s("templates.load")]})]})]})]}),z&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:z})]}),p==="share"&&e.jsxs("div",{children:[e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("teamLibrary.shareIntro")}),we.length===0?e.jsx("p",{className:"mt-6 text-[13px] text-ink-secondary",children:s("teamLibrary.shareEmpty")}):e.jsx("div",{className:"mt-4 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:we.map((t,r)=>e.jsxs("article",{className:"flex min-h-[84px] items-center gap-3 border-b border-hairline/35 px-1 py-4",children:[e.jsx($e,{index:r}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"truncate text-[14px] font-medium text-ink",children:t.name||s("teamLibrary.general")}),e.jsx("p",{className:"mt-0.5 text-[13px] text-ink-secondary",children:s("teamLibrary.shareBots",{count:t.bots})})]}),e.jsxs("button",{onClick:()=>je(t.name),"aria-label":s("teamLibrary.shareTeamAria",{name:t.name||s("teamLibrary.general")}),className:"flex items-center gap-1.5 rounded-full bg-raised px-3.5 py-2 text-[13px] text-ink hover:bg-raised-hover",children:[e.jsx(Ot,{size:13}),s("teamLibrary.shareTeam")]})]},t.name||"general"))})]}),p==="scout"&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-3 text-[12px] font-medium text-ink-secondary",children:s("templates.startFolder")}),e.jsx("p",{className:"max-w-2xl text-[13px] leading-relaxed text-ink-secondary",children:s("templates.scoutHint")}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{value:me,onChange:t=>xe(t.target.value),onKeyDown:t=>t.key==="Enter"&&D&&void se(D),placeholder:"/path/to/your/project","aria-label":s("templates.projectFolder"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),!!window.ogb?.pickFolder&&e.jsxs("button",{onClick:()=>{nt()},disabled:$,className:"flex items-center justify-center gap-1.5 rounded-full bg-raised px-4 py-2.5 text-[13px] text-ink hover:bg-raised-hover disabled:opacity-40",children:[e.jsx(At,{size:14}),s("templates.browse")]}),e.jsxs("button",{onClick:()=>{se(D)},disabled:!D||$,className:"flex items-center justify-center gap-1.5 rounded-full bg-accent px-4 py-2.5 text-[13px] font-medium text-white hover:bg-accent/90 disabled:opacity-40",children:[$?e.jsx(C,{size:14,className:"animate-spin"}):e.jsx(Dt,{size:14}),$?s("templates.scouting"):s("templates.scout")]})]}),f&&e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"rounded-2xl bg-raised/25 px-5 py-4",children:[e.jsx("div",{className:"text-[15px] font-semibold text-ink",children:f.profile.name}),f.profile.summary&&e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:f.profile.summary}),f.profile.stacks.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:f.profile.stacks.map(t=>e.jsx("span",{className:"rounded-full bg-raised px-2.5 py-1 text-[12px] text-ink-secondary",children:t},t))})]}),e.jsx("div",{className:"mt-5 text-[12px] font-medium text-ink-secondary",children:s("templates.suggestedTeam")}),e.jsx("div",{className:"mt-1 grid grid-cols-1 gap-x-10 md:grid-cols-2",children:f.suggestion.manifest.team.members.map((t,r)=>e.jsxs("div",{className:"flex min-h-[64px] items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[e.jsx("div",{className:y("flex size-9 shrink-0 items-center justify-center rounded-lg text-[13px] font-semibold",I[r%I.length]),children:t.name.slice(0,1).toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-[14px] font-medium text-ink",children:[t.name," ",e.jsxs("span",{className:"font-normal text-ink-secondary",children:["· ",t.title]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[12px] text-ink-secondary",children:f.suggestion.reasons[t.key]??""})]})]},t.key))}),F&&F.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-5 text-[12px] font-medium text-ink-secondary",children:s("templates.communityDirectory")}),e.jsx("div",{className:"mt-1 flex flex-col",children:F.map(t=>e.jsxs("div",{className:"flex items-center gap-3 border-b border-hairline/35 px-1 py-3",children:[e.jsxs("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:ge.has(t.slug),onChange:()=>he(r=>{const i=new Set(r);return i.has(t.slug)?i.delete(t.slug):i.add(t.slug),i}),className:"size-4 accent-accent"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"truncate text-[14px] font-medium text-ink",children:[t.name,t.category&&e.jsxs("span",{className:"font-normal text-ink-secondary",children:[" · ",t.category]})]}),e.jsx("div",{className:"mt-0.5 truncate text-[12px] text-ink-secondary",children:s("templates.matches",{values:t.matched.join(", ")})})]})]}),e.jsx("button",{onClick:()=>{Re(t.detailUrl)},"aria-label":s("templates.openDirectory",{name:t.name}),title:s("templates.readBeforeAdding"),className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(Te,{size:14})})]},t.slug))})]}),e.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("input",{value:be,onChange:t=>fe(t.target.value),"aria-label":s("templates.groupChatName"),className:"min-w-0 flex-1 rounded-xl bg-raised/80 px-3 py-2.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"}),e.jsxs("button",{onClick:()=>{it()},disabled:G,className:"flex shrink-0 items-center justify-center gap-2 rounded-full bg-accent px-5 py-2.5 text-[14px] font-medium text-white hover:bg-accent/90 disabled:opacity-60",children:[G&&e.jsx(C,{size:15,className:"animate-spin"}),G?s("templates.creating"):s("templates.createGroupChat")]})]}),e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:s("templates.createGroupHint")})]}),z&&e.jsx("div",{role:"alert",className:"mt-4 rounded-lg bg-danger/10 px-3 py-2 text-[13px] text-danger",children:z})]})]})]})]}),M!==null&&e.jsx(Pt,{team:M,onClose:()=>je(null)})]}),document.body)}export{Ft as TeamImportDetails,as as TeamLibraryPanel,Ht as shareableTeamList};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-CcbkAG9m.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-OXPTDLAJ-BuCuOW1m.js";import{_ as o}from"./mermaid.core-CcbkAG9m.js";import"./chunk-5VM5RSS4-Cxp3RKyR.js";import"./chunk-XXDRQBXY-CcZGTVYy.js";import"./chunk-KQW6MTUR-DabkPo_d.js";import"./chunk-7TKQ45FW-DSOW_9p2.js";import"./channel-DXuqtdcQ.js";import"./styles-ElM5u1od.js";import"./step-CkmJJ7wq.js";var a=o(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),m=a,y=r({styles:m});export{y as diagram};
|