limixbot 0.3.48 → 0.3.50
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-XlvWcNh9.js → ActivityPanel-BwDOVD9j.js} +1 -1
- package/dist/assets/{App-ChCSOxIp.js → App-CGZnP4z7.js} +111 -111
- package/dist/assets/{AppEventEditor-BVUu_Lcx.js → AppEventEditor-zUBmRtgm.js} +1 -1
- package/dist/assets/BotSettingsDialog-DTFwZfbQ.js +16 -0
- package/dist/assets/{BrowserPanel-BCIfyKnn.js → BrowserPanel-B5vUqP5d.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-DbgSvM0f.js → BrowserProfilesManager-DF3iHV1l.js} +1 -1
- package/dist/assets/{CloudAddDialog-Dl9Oshym.js → CloudAddDialog-Bi9x2OVN.js} +1 -1
- package/dist/assets/{ComputerFilesPane-Cgj-gSm4.js → ComputerFilesPane-DXb-rVT_.js} +1 -1
- package/dist/assets/{ComputerPanel-CWt6-5YN.js → ComputerPanel-o_9TTtVS.js} +2 -2
- package/dist/assets/{DataPanel-S3D8uZov.js → DataPanel-D6Yq58K8.js} +1 -1
- package/dist/assets/{DesktopViewer-D1ZJW3yu.js → DesktopViewer-DFhYwHIq.js} +1 -1
- package/dist/assets/{FilesView-DUUdJ-mW.js → FilesView-DIY7IawO.js} +1 -1
- package/dist/assets/{GrokMoveDialog-DgUr2ErY.js → GrokMoveDialog-yVqkaGh0.js} +1 -1
- package/dist/assets/{InspectorPanel-D0oeNabp.js → InspectorPanel-DZmieMQG.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-DDjFDnGN.js → KeyboardShortcutsModal-S5e-EG9u.js} +1 -1
- package/dist/assets/LimixChannelReview-CrGNdtS-.js +1 -0
- package/dist/assets/{LiveDesktop-CqifRkl1.js → LiveDesktop-H2irpbo4.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-BQbtgJKn.js → LocalVmWorkspace-5beJanrU.js} +1 -1
- package/dist/assets/{MacLocalControl-CfV-X14C.js → MacLocalControl-D5PKKnuP.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-X0MehVrM.js → MarkdownFilePreview-CKcwA3Cw.js} +1 -1
- package/dist/assets/{MenuMotion-BNVn5GSt.js → MenuMotion-CtV49YrJ.js} +1 -1
- package/dist/assets/{NewBotDialog-_J5mh-JV.js → NewBotDialog-Cna8-DSW.js} +1 -1
- package/dist/assets/{PhoneAppDialog-C5EDNXE1.js → PhoneAppDialog-Dtkpl1Hc.js} +1 -1
- package/dist/assets/{PlacesRail-CIHIyPoQ.js → PlacesRail-COZEZH0n.js} +1 -1
- package/dist/assets/{PluginsPanel-Uf4xxYLo.js → PluginsPanel-LvPKdxpW.js} +1 -1
- package/dist/assets/{ProIntroduction-C1ZjYkae.js → ProIntroduction-Cjw1BiAB.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-C2ii1ptH.js → RemoteAgentSettingsPanel-BIqx787N.js} +1 -1
- package/dist/assets/{RoomPanel-rpY6VUWk.js → RoomPanel-CJTHUkDN.js} +1 -1
- package/dist/assets/{RoutinesPage-D3s9tF-X.js → RoutinesPage-C8QjVdJH.js} +1 -1
- package/dist/assets/SettingsModal-D3I1whQj.js +19 -0
- package/dist/assets/{ShareTeamDialog-BcXftoRN.js → ShareTeamDialog-DLKGTkzv.js} +1 -1
- package/dist/assets/{SignedInSites-BGTefeLy.js → SignedInSites-Ccr7Us46.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-BGrOgQek.js → TeamLibraryPanel-DWkmvSW0.js} +1 -1
- package/dist/assets/{TeamMapPage-C6S7_ma-.js → TeamMapPage-BjPonu5A.js} +1 -1
- package/dist/assets/{TriggersPage-CtgQCp6P.js → TriggersPage-BE8reM-u.js} +1 -1
- package/dist/assets/VisibilitySection-diCNRN7h.js +22 -0
- package/dist/assets/{WebhookTrigger-DwY5yBvw.js → WebhookTrigger-BOsrYQH6.js} +1 -1
- package/dist/assets/{WorksOnGrid-BQiI1n3L.js → WorksOnGrid-D204I3p5.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-E5u2FY-u.js → abnfDiagram-YUKMZFIV-DmWI1Mtg.js} +1 -1
- package/dist/assets/{activity-CBC39k-I.js → activity-WfPBvs3Z.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-HbRi9-3s.js → architectureDiagram-47P4ROYG-rzc3-Q0w.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-BvbJQxRJ.js → blockDiagram-E7TT5TSB-VPDyKlQ7.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-6XQ7PCr5.js → c4Diagram-CRA5TL53-C9OGckku.js} +1 -1
- package/dist/assets/{calendar-days-uVdUhtRr.js → calendar-days-W4JHp6-m.js} +1 -1
- package/dist/assets/channel-DAFePtOr.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-KKy_GF1y.js → chunk-2Q5K7J3B-EpYkwMC8.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CAqDmDHS.js → chunk-5VM5RSS4-DyJEI8X6.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-Y_lWu8VB.js → chunk-7TKQ45FW-CJvVxQ2I.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-BO3PAeWa.js → chunk-AW2ZBBNX-s78zNrhy.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-BEy6ZFro.js → chunk-FVRAUYC3-CUPjaz9e.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-ge9hH-_c.js → chunk-HTAEGDNF-BhuM2dxl.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-D_lI4aTU.js → chunk-JWPE2WC7-DAj1UgJ8.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-DPMJ2vJV.js → chunk-KQW6MTUR-BgfdtkJI.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-C4mYjNRr.js → chunk-XXDRQBXY-Vak43p0S.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-DlGliqAX.js → classDiagram-v2-K4WV4PDN-Cjvbs86l.js} +1 -1
- package/dist/assets/{core-BIk0hYPX.js → core-D5ZIkAZ3.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-DVNjr33T.js → cose-bilkent-JH36ORCC-BEekB3gO.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-B6NBBGhM.js → cynefin-EF2NZ3EQ-D3g3_jPk.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-xdyPjX9I.js → cynefinDiagram-3GCD6N5R-13xmjXZj.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-Cj9fToJq.js → dagre-W4DXFKR2-CHAV8s2t.js} +1 -1
- package/dist/assets/de-CJcRve_J.js +8 -0
- package/dist/assets/{diagram-2UJZ2QOL-FQ9YmfPr.js → diagram-2UJZ2QOL-DgwdzZN7.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-DjjDmsSv.js → diagram-OVF4WLC6-DobmWwa_.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-DMa8rvdp.js → diagram-PFPMY2P6-CWjTVc0N.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-BzFwDQTx.js → diagram-UMYRVEAY-CAruZkhk.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-D2oM-7uQ.js → diagram-YEKJPTXX-Bcs89mQN.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-BDIMPZpL.js → diagram-ZIFT7M5P-Dz-O18tl.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-5YsbZGCa.js → ebnfDiagram-VR2GEFS7-CJX4rMIs.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-DSZEAjKl.js → elk-IJKZMXRS-Byop6FtW.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-BeXzxJfj.js → erDiagram-O2IAPWRE-ChpLnNCF.js} +1 -1
- package/dist/assets/es-DL-LT7LK.js +6 -0
- package/dist/assets/{file-up-pts79DW9.js → file-up-G3qWGpEB.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-D05KXhfA.js → flowDiagram-OXPTDLAJ-CWWhkNOE.js} +1 -1
- package/dist/assets/fr-Cqgsh6FT.js +8 -0
- package/dist/assets/{ganttDiagram-R7TSEDQI-9IKnYcFv.js → ganttDiagram-R7TSEDQI-DMXicWgq.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-De1Fj8FH.js → gitGraphDiagram-XJZIOB7I-CpiCnPUQ.js} +1 -1
- package/dist/assets/hi-DRlAa-mm.js +1 -0
- package/dist/assets/{import-name-BfYhMg1y.js → import-name-Cjp7lk7e.js} +1 -1
- package/dist/assets/{index-up1CA0zX.js → index-CSGTkyGn.js} +2 -2
- package/dist/assets/{index-PhXpx5mv.js → index-CZvRt7dv.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-BB9tseML.js → infoDiagram-5W2HQ5XZ-BU9zbv9f.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-zQATL5V8.js → ishikawaDiagram-K3B6WC7H-KEjUVvmG.js} +1 -1
- package/dist/assets/it-BapR4fyG.js +13 -0
- package/dist/assets/ja-rH-EVVS5.js +13 -0
- package/dist/assets/{journeyDiagram-COXZFDF6-DWl-s77q.js → journeyDiagram-COXZFDF6-DGU1V_40.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-0gNFYf4b.js → kanban-definition-P3RFRI5V-weJ2OFB2.js} +1 -1
- package/dist/assets/ko-DXzDBiEb.js +13 -0
- package/dist/assets/{mcp-servers-CkHO2yG6.js → mcp-servers-_vV_C1no.js} +1 -1
- package/dist/assets/{mermaid.core-aRNMQk5-.js → mermaid.core-DhSRukyE.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-Bof3P1eD.js → mindmap-definition-LZFPQGKD-DKKO0DWj.js} +1 -1
- package/dist/assets/{minimize-B2-pCESw.js → minimize-C16JX5N8.js} +1 -1
- package/dist/assets/{monitor-ET_fUXyt.js → monitor-Bben4nuu.js} +1 -1
- package/dist/assets/{new-bot-D-yMiT7M.js → new-bot-DwK47ypo.js} +1 -1
- package/dist/assets/{org-library-D_E7GVek.js → org-library-BXuxCBsG.js} +1 -1
- package/dist/assets/{package-format-B5SXvrHy.js → package-format-CmRh54Ve.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-DDlKwD4R.js → pegDiagram-BGZESJAR-CNNprTkt.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-DtwDw9NT.js → pieDiagram-CAPJLFHJ-pS8U8zdK.js} +1 -1
- package/dist/assets/pl-BV7GtmiM.js +13 -0
- package/dist/assets/pt-br-Dr9a700a.js +13 -0
- package/dist/assets/{quadrantDiagram-GDMTTRAM-CDeSRO7Z.js → quadrantDiagram-GDMTTRAM-CLk_fr2j.js} +1 -1
- package/dist/assets/{rail-DdyH9Fje.js → rail-CpM5o3ti.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-DJAwC8qS.js → railroadDiagram-SM67HX2B-DH8VPMJG.js} +1 -1
- package/dist/assets/{remote-desktop-panel-DN2__781.js → remote-desktop-panel-C_EqBmng.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-WsM1ryr2.js → requirementDiagram-X7JNWC4A-CoHRI7dx.js} +1 -1
- package/dist/assets/ru-DSSPfQyi.js +13 -0
- package/dist/assets/{sankeyDiagram-UM26HJRW-BaRMQhWI.js → sankeyDiagram-UM26HJRW-2zcVfvWw.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-BaxysqoC.js → sequenceDiagram-ZO4K6R2Y-B0d21eid.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BI5Y1n1O.js → sizeCapture-INFHLROL-CcYkvoh7.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-DqD0Wnx3.js → stateDiagram-v2-TBUQTH76-B5EilR72.js} +1 -1
- package/dist/assets/{styles-CxbuKpLq.js → styles-Cbtcp5Re.js} +2 -2
- package/dist/assets/styles-rYmbSF4Y.css +1 -0
- package/dist/assets/{swimlanes-N4OXWK64-pCvU3flP.js → swimlanes-N4OXWK64-xM7mNll9.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-CnVwW_RC.js +8 -0
- package/dist/assets/{team-share-C-EjLBgR.js → team-share-Bp69YR8I.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-BEpkjZWs.js → timeline-definition-YOQAKGHF-DM6SmhCQ.js} +1 -1
- package/dist/assets/tr-DJNxAMAd.js +6 -0
- package/dist/assets/uk-SbiO0vE9.js +1 -0
- package/dist/assets/{usecaseDiagram-VIAY4XPW-DUBT_yZ3.js → usecaseDiagram-VIAY4XPW-DiUdGN3G.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-CxArldGE.js → vennDiagram-BLWOH2XV-DrtmNBp4.js} +1 -1
- package/dist/assets/{vi-BYSU3aaD.js → vi-vTat5qyz.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-BQIk4Vh2.js → wardleyDiagram-YMQ3BMBF-D7jihWm5.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-BcBrHX_m.js → xychartDiagram-TAQBALBS-BCk-D9Uj.js} +1 -1
- package/dist/assets/zh-Ce8h_nYy.js +13 -0
- package/dist/assets/zh-tw-DXbqGzsI.js +13 -0
- package/dist/index.html +3 -3
- package/dist/rail.html +5 -5
- package/dist-server/container-mcp.js +3 -3
- package/dist-server/drivers/agents-proxy.js +384 -205
- package/dist-server/index.js +1651 -1604
- package/dist-server/openmausbot.js +598 -669
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +102 -99
- package/dist-server/server/activity.js +1 -0
- package/dist-server/server/bot-api-host.js +7 -4
- package/dist-server/server/bot-visibility.js +3 -1
- package/dist-server/server/chief-of-staff.js +3 -2
- package/dist-server/server/container-computer.js +31 -4
- package/dist-server/server/default-bot.js +2 -2
- package/dist-server/server/drivers/agents-call.js +3 -0
- package/dist-server/server/drivers/agents-catalog.js +16 -6
- package/dist-server/server/index.js +76 -15
- package/dist-server/server/limix-assistant-name.js +18 -0
- package/dist-server/server/limix-channel-identity.js +1 -0
- package/dist-server/server/limix-channel-media.js +12 -6
- package/dist-server/server/limix-desktop-resources.js +26 -0
- package/dist-server/server/limix-diagnose.js +41 -0
- package/dist-server/server/limix-gateway-sidecar.js +23 -0
- package/dist-server/server/limix-managed-grant.js +110 -0
- package/dist-server/server/limix-team-desktop.js +32 -0
- package/dist-server/server/routes/bot-messages.js +2 -2
- package/dist-server/server/routes/bot-patch.js +24 -0
- package/dist-server/server/routes/internal-chief-team.js +15 -5
- package/dist-server/server/team-setup-requests.js +60 -5
- package/dist-server/shared/default-bot.js +3 -1
- package/dist-server/shared/new-bot-defaults.js +1 -0
- package/dist-server/shared/ready-bots.js +331 -0
- package/dist-server/vps-container-mcp.js +20 -20
- package/dist-server/workspace-backup.worker.js +6 -6
- package/package.json +1 -1
- package/dist/assets/BotSettingsDialog-DITlFmzw.js +0 -16
- package/dist/assets/SettingsModal-BGxaTJg5.js +0 -19
- package/dist/assets/VisibilitySection-CLj2_C44.js +0 -22
- package/dist/assets/channel-CeBX8eSw.js +0 -1
- package/dist/assets/coins-C5bat6u2.js +0 -1
- package/dist/assets/de-BZ9nuzrz.js +0 -8
- package/dist/assets/es-BxLq0ePd.js +0 -6
- package/dist/assets/fr-BoXnQ5F8.js +0 -8
- package/dist/assets/hi-CcIxinfW.js +0 -1
- package/dist/assets/it-I6t2VEkh.js +0 -13
- package/dist/assets/ja-XTlk5V47.js +0 -13
- package/dist/assets/ko-BplWTKGd.js +0 -13
- package/dist/assets/pl-Bv2R8H4r.js +0 -13
- package/dist/assets/pt-br-CM02ONwa.js +0 -15
- package/dist/assets/ru-CJcyvxC6.js +0 -13
- package/dist/assets/styles-3v-vHlNV.css +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-Bt5R1mJd.js +0 -8
- package/dist/assets/tr-CTl25e95.js +0 -6
- package/dist/assets/uk-B_psMXqm.js +0 -1
- package/dist/assets/zh-BPHbGe7C.js +0 -13
- package/dist/assets/zh-tw-BMYbS8NC.js +0 -15
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Limix: a bot's own Private desktop size. Used when each bot has its own desktop; a field it leaves out follows the
|
|
2
|
+
// workspace setting. A running desktop takes a change when it is next created or started.
|
|
3
|
+
import { MAX_DESKTOP_CPUS, MAX_DESKTOP_MEMORY_GB, MIN_DESKTOP_CPUS, MIN_DESKTOP_MEMORY_GB } from "./container-limits.js";
|
|
4
|
+
/** null clears the bot's own limits. */
|
|
5
|
+
export function limixDesktopResources(raw) {
|
|
6
|
+
if (raw === null)
|
|
7
|
+
return { value: undefined };
|
|
8
|
+
if (typeof raw !== "object" || Array.isArray(raw))
|
|
9
|
+
return { error: "desktopResources must be an object or null" };
|
|
10
|
+
const out = {};
|
|
11
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
12
|
+
if (value === null || value === undefined)
|
|
13
|
+
continue;
|
|
14
|
+
const [min, max] = key === "memoryGb" ? [MIN_DESKTOP_MEMORY_GB, MAX_DESKTOP_MEMORY_GB] : key === "cpus" ? [MIN_DESKTOP_CPUS, MAX_DESKTOP_CPUS] : [NaN, NaN];
|
|
15
|
+
if (Number.isNaN(min))
|
|
16
|
+
return { error: `desktopResources takes memoryGb and cpus, not ${key}` };
|
|
17
|
+
if (!Number.isInteger(value) || value < min || value > max)
|
|
18
|
+
return { error: `desktopResources.${key} must be a whole number from ${min} to ${max}` };
|
|
19
|
+
out[key] = value;
|
|
20
|
+
}
|
|
21
|
+
return { value: Object.keys(out).length ? out : undefined };
|
|
22
|
+
}
|
|
23
|
+
/** The workspace size with this bot's own limits laid over it. */
|
|
24
|
+
export function withBotDesktopResources(workspace, bot) {
|
|
25
|
+
return { memoryGb: bot?.desktopResources?.memoryGb ?? workspace.memoryGb, cpus: bot?.desktopResources?.cpus ?? workspace.cpus };
|
|
26
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const CHANNEL_FIX = {
|
|
2
|
+
credential_invalid: "The token was refused. Make a fresh token in the platform's bot settings and paste it in the connection (the person does this; never ask them to send it in chat).",
|
|
3
|
+
conflict: "Another program is reading the same bot's messages. Stop that program or remove its webhook, then press Run again on the connection.",
|
|
4
|
+
degraded: "The connection is retrying after errors. If it persists, check the internet connection and the platform's status.",
|
|
5
|
+
error: "The connection stopped on an error. Press Run again; if it fails again, re-create the connection with a new token.",
|
|
6
|
+
stopped: "The connection is switched off. Press Run on it to start answering again.",
|
|
7
|
+
};
|
|
8
|
+
const CHANNEL_NAME = { telegram: "Telegram", zalo: "Zalo", discord: "Discord", facebook: "Facebook Page" };
|
|
9
|
+
export function diagnoseLimix(input) {
|
|
10
|
+
const findings = [];
|
|
11
|
+
const notes = [];
|
|
12
|
+
for (const channel of input.channels ?? []) {
|
|
13
|
+
const label = `${CHANNEL_NAME[channel.platform] ?? channel.platform}${channel.name ? ` · ${channel.name}` : ""}`;
|
|
14
|
+
if (channel.status === "running" && !channel.statusDetail)
|
|
15
|
+
continue;
|
|
16
|
+
if (channel.status === "running") {
|
|
17
|
+
findings.push({ area: "channel", subject: label, problem: `Connected, with a warning: ${channel.statusDetail}`, fix: "The channel works; the warning is about the AI it uses. Check that bot's engine sign-in." });
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (channel.status === "starting")
|
|
21
|
+
continue;
|
|
22
|
+
findings.push({ area: "channel", subject: label, problem: `Not answering (${channel.status})${channel.statusDetail ? `: ${channel.statusDetail}` : ""}`,
|
|
23
|
+
fix: CHANNEL_FIX[channel.status] ?? "Open the connection and press Run again." });
|
|
24
|
+
}
|
|
25
|
+
if (input.channels === null)
|
|
26
|
+
notes.push("Telegram and Zalo connections can't be read from here (they run in the desktop app or in another service). Ask the person to open Connections and say what status each one shows.");
|
|
27
|
+
else if (!input.channels.length)
|
|
28
|
+
notes.push("No Telegram, Zalo, Discord or Facebook connection is set up yet.");
|
|
29
|
+
for (const engine of input.engines) {
|
|
30
|
+
if (engine.state === "available")
|
|
31
|
+
continue;
|
|
32
|
+
findings.push({ area: "engine", subject: engine.displayName, problem: `The AI engine is ${engine.state}${engine.reason ? `: ${engine.reason}` : ""}`, fix: "Open Settings > AI, sign in again or install the engine; bots that use it can't answer until then." });
|
|
33
|
+
}
|
|
34
|
+
const visible = input.bots.filter((bot) => !bot.hidden);
|
|
35
|
+
if (!visible.length)
|
|
36
|
+
findings.push({ area: "setup", subject: "Bots", problem: "There is no active bot", fix: "Propose a bot or a ready-made team with propose_team_setup." });
|
|
37
|
+
return { ok: findings.length === 0, botCount: visible.length, findings, notes,
|
|
38
|
+
channels: (input.channels ?? []).map((c) => ({ platform: c.platform, name: c.name, status: c.status, running: c.running, enabled: c.enabled })),
|
|
39
|
+
engines: input.engines.map((e) => ({ name: e.displayName, state: e.state })),
|
|
40
|
+
summary: findings.length ? `${findings.length} problem${findings.length === 1 ? "" : "s"} found` : "Nothing wrong found in what this assistant can see" };
|
|
41
|
+
}
|
|
@@ -112,3 +112,26 @@ export function proxyLimixGateway(req, res, path) {
|
|
|
112
112
|
req.pipe(upstream);
|
|
113
113
|
return true;
|
|
114
114
|
}
|
|
115
|
+
/** The connections the connector reports (secrets are already masked there); null when this server has no connector or it doesn't answer. */
|
|
116
|
+
export function limixGatewayConnections() {
|
|
117
|
+
if (!limixGatewaySidecarOn() || !child)
|
|
118
|
+
return Promise.resolve(null);
|
|
119
|
+
return new Promise((resolve) => {
|
|
120
|
+
const upstream = httpRequest({ host: "127.0.0.1", port: GATEWAY_PORT, method: "GET", path: "/api/state", timeout: 5_000,
|
|
121
|
+
headers: { host: `127.0.0.1:${GATEWAY_PORT}`, "x-limix-admin": ADMIN } }, (response) => {
|
|
122
|
+
const chunks = [];
|
|
123
|
+
response.on("data", (chunk) => chunks.push(chunk));
|
|
124
|
+
response.on("end", () => {
|
|
125
|
+
try {
|
|
126
|
+
resolve(response.statusCode === 200 ? (JSON.parse(Buffer.concat(chunks).toString("utf8")).connections ?? null) : null);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
resolve(null);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
upstream.on("error", () => resolve(null));
|
|
134
|
+
upstream.on("timeout", () => { upstream.destroy(); resolve(null); });
|
|
135
|
+
upstream.end();
|
|
136
|
+
});
|
|
137
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// A Limix Cloud beta home (deploy/managed-beta): the desktop brings a grant the account Worker signed for this workspace
|
|
2
|
+
// and gets one pairing credential for it. Only the public key is here; a home cannot mint grants for itself or another.
|
|
3
|
+
// Security: signature, workspace, audience (this home's own https origin, as the request reached it), expiry and
|
|
4
|
+
// single use are all checked before a pairing opens; a bad signature counts toward the pairing lockout.
|
|
5
|
+
import { createPublicKey, verify } from "node:crypto";
|
|
6
|
+
import { readSignedBody } from "./cloud-home.js";
|
|
7
|
+
import { json } from "./harness/http.js";
|
|
8
|
+
import { requestOrigin, requestSource } from "./request-auth.js";
|
|
9
|
+
export const LIMIX_MANAGED_GRANT_PATH = "/api/limix/managed/grant";
|
|
10
|
+
const SIGNED_PREFIX = "limix-managed-grant.v1.";
|
|
11
|
+
const MAX_LIFETIME_S = 120;
|
|
12
|
+
const SKEW_S = 60;
|
|
13
|
+
const PAIRING_TTL_MS = 120_000;
|
|
14
|
+
const UUID = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/;
|
|
15
|
+
/** Null unless all three settings are present and valid; a half-configured home refuses to start. */
|
|
16
|
+
export function limixManagedGrantConfig(env = process.env) {
|
|
17
|
+
const workspaceId = env.LIMIX_MANAGED_WORKSPACE?.trim() ?? "", rawKey = env.LIMIX_MANAGED_GRANT_KEY?.trim() ?? "";
|
|
18
|
+
const rawOrigin = env.OMB_PUBLIC_URL?.trim().replace(/\/+$/, "") ?? "";
|
|
19
|
+
if (!workspaceId && !rawKey)
|
|
20
|
+
return null;
|
|
21
|
+
if (!UUID.test(workspaceId))
|
|
22
|
+
throw new Error("LIMIX_MANAGED_WORKSPACE must be the workspace UUID.");
|
|
23
|
+
if (!/^[A-Za-z0-9_-]{43}$/.test(rawKey))
|
|
24
|
+
throw new Error("LIMIX_MANAGED_GRANT_KEY must be an Ed25519 public key (base64url).");
|
|
25
|
+
let origin;
|
|
26
|
+
try {
|
|
27
|
+
origin = new URL(rawOrigin);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
throw new Error("OMB_PUBLIC_URL must be this home's https origin.");
|
|
31
|
+
}
|
|
32
|
+
if (origin.protocol !== "https:" || origin.origin !== rawOrigin)
|
|
33
|
+
throw new Error("OMB_PUBLIC_URL must be this home's https origin.");
|
|
34
|
+
return { workspaceId, origin: origin.origin, key: createPublicKey({ key: { kty: "OKP", crv: "Ed25519", x: rawKey }, format: "jwk" }) };
|
|
35
|
+
}
|
|
36
|
+
export function createLimixManagedGrant(config, sessions, now = Date.now) {
|
|
37
|
+
const used = new Map();
|
|
38
|
+
const redeem = (grant, origin, source) => {
|
|
39
|
+
const lock = sessions.attemptAllowed(source);
|
|
40
|
+
if (!lock.ok)
|
|
41
|
+
return { status: 429, body: { error: "rate_limited", retryAfterSeconds: Math.ceil(lock.retryAfterMs / 1000) } };
|
|
42
|
+
const [payload, signature, extra] = typeof grant === "string" && grant.length < 2048 ? grant.split(".") : [];
|
|
43
|
+
let signed = false;
|
|
44
|
+
try {
|
|
45
|
+
signed = Boolean(payload && signature && extra === undefined) && verify(null, Buffer.from(SIGNED_PREFIX + payload), config.key, Buffer.from(signature, "base64url"));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
signed = false;
|
|
49
|
+
}
|
|
50
|
+
if (!signed) {
|
|
51
|
+
sessions.noteFailure(source);
|
|
52
|
+
return { status: 401, body: { error: "invalid_grant" } };
|
|
53
|
+
}
|
|
54
|
+
sessions.clearFailures(source);
|
|
55
|
+
let claims;
|
|
56
|
+
try {
|
|
57
|
+
claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return { status: 400, body: { error: "invalid_grant" } };
|
|
61
|
+
}
|
|
62
|
+
const at = now() / 1000, iat = Number(claims.iat), exp = Number(claims.exp), nonce = claims.nonce;
|
|
63
|
+
if (claims.v !== 1 || claims.ws !== config.workspaceId)
|
|
64
|
+
return { status: 403, body: { error: "wrong_workspace" } };
|
|
65
|
+
// cloudflared keeps the public Host; the scheme it reports is not relied on, the name is.
|
|
66
|
+
if (claims.aud !== config.origin || origin?.replace(/^https?:/, "") !== config.origin.replace(/^https:/, ""))
|
|
67
|
+
return { status: 403, body: { error: "wrong_origin" } };
|
|
68
|
+
if (!Number.isFinite(iat) || !Number.isFinite(exp) || exp - iat > MAX_LIFETIME_S || iat > at + SKEW_S || exp < at) {
|
|
69
|
+
return { status: 401, body: { error: "expired_grant" } };
|
|
70
|
+
}
|
|
71
|
+
if (typeof nonce !== "string" || !/^[A-Za-z0-9_-]{16,64}$/.test(nonce))
|
|
72
|
+
return { status: 400, body: { error: "invalid_grant" } };
|
|
73
|
+
for (const [seen, until] of used)
|
|
74
|
+
if (until < at)
|
|
75
|
+
used.delete(seen);
|
|
76
|
+
if (used.has(nonce))
|
|
77
|
+
return { status: 401, body: { error: "grant_used" } };
|
|
78
|
+
used.set(nonce, exp + SKEW_S);
|
|
79
|
+
const label = typeof claims.sub === "string" ? `Limix Cloud · ${claims.sub.replace(/^limix:/, "")}`.slice(0, 80) : "Limix Cloud";
|
|
80
|
+
const opened = sessions.openPairing({ scopes: ["admin", "client"], label, ttlMs: PAIRING_TTL_MS });
|
|
81
|
+
return { status: 200, body: { credential: opened.credential, expiresAt: opened.expiresAt } };
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
redeem,
|
|
85
|
+
async handle(req, res, path, method) {
|
|
86
|
+
if (path !== LIMIX_MANAGED_GRANT_PATH)
|
|
87
|
+
return false;
|
|
88
|
+
res.setHeader("cache-control", "no-store");
|
|
89
|
+
if (method !== "POST") {
|
|
90
|
+
json(res, 405, { error: "method_not_allowed" });
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
if (!/^application\/json\b/i.test(String(req.headers["content-type"] ?? ""))) {
|
|
94
|
+
json(res, 415, { error: "json_required" });
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
let body;
|
|
98
|
+
try {
|
|
99
|
+
body = JSON.parse((await readSignedBody(req)).toString("utf8"));
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
json(res, 400, { error: "invalid_body" });
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
const result = redeem(body?.grant, requestOrigin(req), requestSource(req));
|
|
106
|
+
json(res, result.status, result.body);
|
|
107
|
+
return true;
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Limix: bots of one department can share one Private desktop (when each bot otherwise has its own). One screen, so
|
|
2
|
+
// they take turns on it. Its size grows with the number of bots unless someone set a size; it never asks for more than
|
|
3
|
+
// the machine can give a desktop.
|
|
4
|
+
import { MAX_DESKTOP_CPUS, MAX_DESKTOP_MEMORY_GB, MIN_DESKTOP_CPUS, MIN_DESKTOP_MEMORY_GB } from "./container-limits.js";
|
|
5
|
+
export const TEAM_DESKTOP_EXTRA_MEMORY_GB = 2;
|
|
6
|
+
export const TEAM_DESKTOP_EXTRA_CPUS = 1;
|
|
7
|
+
/** The department key ("" is General). */
|
|
8
|
+
export const teamDesktopKey = (bot) => (bot.section ?? "").trim().toLowerCase();
|
|
9
|
+
export function teamDesktopMembers(bots, team) {
|
|
10
|
+
return bots.filter((bot) => bot.desktopTeam && !bot.hidden && teamDesktopKey(bot) === team);
|
|
11
|
+
}
|
|
12
|
+
/** Suggested: the workspace size plus a share for each bot past the first. */
|
|
13
|
+
export function suggestedTeamDesktop(workspace, members) {
|
|
14
|
+
const extra = Math.max(0, members - 1);
|
|
15
|
+
return { memoryGb: workspace.memoryGb + extra * TEAM_DESKTOP_EXTRA_MEMORY_GB, cpus: workspace.cpus + extra * TEAM_DESKTOP_EXTRA_CPUS };
|
|
16
|
+
}
|
|
17
|
+
/** The size the shared desktop runs with: the largest size a member set, otherwise the suggestion, within the machine. */
|
|
18
|
+
export function teamDesktopResources(workspace, members, machine) {
|
|
19
|
+
const set = members.filter((bot) => bot.desktopResources?.memoryGb || bot.desktopResources?.cpus);
|
|
20
|
+
const suggested = suggestedTeamDesktop(workspace, members.length);
|
|
21
|
+
const want = set.length
|
|
22
|
+
? { memoryGb: Math.max(...set.map((bot) => bot.desktopResources?.memoryGb ?? workspace.memoryGb)), cpus: Math.max(...set.map((bot) => bot.desktopResources?.cpus ?? workspace.cpus)) }
|
|
23
|
+
: suggested;
|
|
24
|
+
const roomMemory = machine ? Math.floor(machine.memoryGb - machine.reservedMemoryGb) : MAX_DESKTOP_MEMORY_GB;
|
|
25
|
+
const roomCpus = machine ? Math.floor(machine.cpus - machine.reservedCpus) : MAX_DESKTOP_CPUS;
|
|
26
|
+
const clamp = (value, min, max, room) => Math.max(min, Math.min(value, max, Math.max(min, room)));
|
|
27
|
+
return {
|
|
28
|
+
memoryGb: clamp(want.memoryGb, MIN_DESKTOP_MEMORY_GB, MAX_DESKTOP_MEMORY_GB, roomMemory),
|
|
29
|
+
cpus: clamp(want.cpus, MIN_DESKTOP_CPUS, MAX_DESKTOP_CPUS, roomCpus),
|
|
30
|
+
chosen: set.length ? "set" : "suggested",
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -522,7 +522,7 @@ export function createBotMessageRoutes(deps) {
|
|
|
522
522
|
if (resolveAndSendTrust(res, bot.threadId, String(body.requestId), behavior))
|
|
523
523
|
return;
|
|
524
524
|
const answer = { botId: bot.id, threadId: bot.threadId, requestId: String(body.requestId), behavior };
|
|
525
|
-
if (await resolveAndSendTeamSetup(res, answer, ownerReview(auth, req)))
|
|
525
|
+
if (await resolveAndSendTeamSetup(res, { ...answer, ...(body.room === false ? { room: false } : {}) }, ownerReview(auth, req)))
|
|
526
526
|
return;
|
|
527
527
|
if (await resolveAndSendMcp(res, answer, ownerReview(auth, req)))
|
|
528
528
|
return;
|
|
@@ -645,7 +645,7 @@ export function createBotMessageRoutes(deps) {
|
|
|
645
645
|
const setupBotId = setupCard.from?.botId ?? store.botByThread(threadId)?.id;
|
|
646
646
|
if (!setupBotId)
|
|
647
647
|
return json(res, 400, { error: "This team setup has no valid owner" });
|
|
648
|
-
if (await resolveAndSendTeamSetup(res, { botId: setupBotId, threadId, requestId, behavior }, ownerReview(auth, req)))
|
|
648
|
+
if (await resolveAndSendTeamSetup(res, { botId: setupBotId, threadId, requestId, behavior, ...(body.room === false ? { room: false } : {}) }, ownerReview(auth, req)))
|
|
649
649
|
return;
|
|
650
650
|
}
|
|
651
651
|
const mcpCard = store.messagesFor(threadId).find((message) => message.card?.requestId === requestId && message.card.mcpRequest);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { limixDesktopResources } from "../limix-desktop-resources.js";
|
|
2
3
|
import { approvalModeFor, isApprovalMode } from "../../shared/approval-mode.js";
|
|
3
4
|
import { normalizeConnectorScopes } from "../../shared/connector-scopes.js";
|
|
4
5
|
import { normalizeOutboundPolicy } from "../../shared/outbound.js";
|
|
@@ -323,6 +324,29 @@ export function createBotPatchRoutes(deps) {
|
|
|
323
324
|
return json(res, 400, { error: "cacheKeepWarm must be true, false or null" });
|
|
324
325
|
patch.cacheKeepWarm = body.cacheKeepWarm ?? undefined;
|
|
325
326
|
}
|
|
327
|
+
if (body.desktopResources !== undefined) {
|
|
328
|
+
const parsed = limixDesktopResources(body.desktopResources);
|
|
329
|
+
if ("error" in parsed)
|
|
330
|
+
return json(res, 400, { error: parsed.error });
|
|
331
|
+
patch.desktopResources = parsed.value;
|
|
332
|
+
}
|
|
333
|
+
if (body.hideChannelGuests !== undefined) {
|
|
334
|
+
if (typeof body.hideChannelGuests !== "boolean")
|
|
335
|
+
return json(res, 400, { error: "hideChannelGuests must be true or false" });
|
|
336
|
+
patch.hideChannelGuests = body.hideChannelGuests || undefined;
|
|
337
|
+
}
|
|
338
|
+
if (body.desktopTeamFolder !== undefined) {
|
|
339
|
+
if (typeof body.desktopTeamFolder !== "boolean")
|
|
340
|
+
return json(res, 400, { error: "desktopTeamFolder must be true or false" });
|
|
341
|
+
patch.desktopTeamFolder = body.desktopTeamFolder || undefined;
|
|
342
|
+
}
|
|
343
|
+
if (body.desktopTeam !== undefined) {
|
|
344
|
+
if (typeof body.desktopTeam !== "boolean")
|
|
345
|
+
return json(res, 400, { error: "desktopTeam must be true or false" });
|
|
346
|
+
if (existingBot?.busy && body.desktopTeam !== Boolean(existingBot.desktopTeam))
|
|
347
|
+
return json(res, 409, { error: "Wait for this bot's work to finish before moving it to another desktop" });
|
|
348
|
+
patch.desktopTeam = body.desktopTeam || undefined;
|
|
349
|
+
}
|
|
326
350
|
if (body.helperModel !== undefined) {
|
|
327
351
|
if (typeof body.helperModel !== "boolean")
|
|
328
352
|
return json(res, 400, { error: "helperModel must be true or false" });
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { hasTeamAuthority, peerAllowed } from "../peer-roster.js";
|
|
2
2
|
import { chiefLevel } from "../chief-level.js";
|
|
3
3
|
import { libraryTeamRoles } from "../team-library.js";
|
|
4
|
+
import { diagnoseLimix } from "../limix-diagnose.js";
|
|
5
|
+
import { READY_BOTS } from "../../shared/ready-bots.js";
|
|
6
|
+
const BOT_TEMPLATES = READY_BOTS.map((bot) => ({ id: bot.id, name: bot.name, title: bot.title, description: bot.description, category: bot.category }));
|
|
4
7
|
import { PASS } from "./table.js";
|
|
5
8
|
const NOT_CHIEF = "Only an active Chief may plan team setup";
|
|
6
9
|
/** Only dispatch inside the internal capability gate. What a Chief of Staff reads before it changes its team. */
|
|
@@ -10,20 +13,27 @@ export function createInternalChiefTeamRoutes(deps) {
|
|
|
10
13
|
return chiefLevel(bot) && !bot.hidden ? bot : null;
|
|
11
14
|
};
|
|
12
15
|
return async ({ res, path, method, json }) => {
|
|
13
|
-
if (method !== "GET" || (path !== "/api/internal/team-setup-catalog" && path !== "/api/internal/team-library"))
|
|
16
|
+
if (method !== "GET" || (path !== "/api/internal/team-setup-catalog" && path !== "/api/internal/team-library" && path !== "/api/internal/limix-diagnosis"))
|
|
14
17
|
return PASS;
|
|
15
18
|
if (!chief())
|
|
16
19
|
return json(res, 403, { error: NOT_CHIEF });
|
|
20
|
+
if (path === "/api/internal/limix-diagnosis") {
|
|
21
|
+
const [instances, channels] = await Promise.all([deps.instances(), (deps.channels?.() ?? Promise.resolve(null)).catch(() => null)]);
|
|
22
|
+
deps.requireActive();
|
|
23
|
+
return chief() ? json(res, 200, diagnoseLimix({ engines: instances.map((item) => ({ instanceId: item.instanceId, displayName: item.displayName, state: item.snapshot.state, reason: item.snapshot.reason })),
|
|
24
|
+
channels, bots: deps.bots() })) : json(res, 403, { error: NOT_CHIEF });
|
|
25
|
+
}
|
|
17
26
|
if (path === "/api/internal/team-library") {
|
|
18
|
-
let teams;
|
|
27
|
+
let teams = [];
|
|
28
|
+
let note;
|
|
19
29
|
try {
|
|
20
30
|
teams = await (deps.library ?? libraryTeamRoles)();
|
|
21
31
|
}
|
|
22
32
|
catch {
|
|
23
|
-
|
|
33
|
+
note = "The ready-made team library can't be reached right now; use botTemplates or build the team from what the person asked.";
|
|
24
34
|
}
|
|
25
35
|
deps.requireActive();
|
|
26
|
-
return chief() ? json(res, 200, { teams }) : json(res, 403, { error: NOT_CHIEF });
|
|
36
|
+
return chief() ? json(res, 200, { teams, botTemplates: BOT_TEMPLATES, ...(note ? { note } : {}) }) : json(res, 403, { error: NOT_CHIEF });
|
|
27
37
|
}
|
|
28
38
|
const instances = await deps.instances();
|
|
29
39
|
deps.requireActive();
|
|
@@ -36,7 +46,7 @@ export function createInternalChiefTeamRoutes(deps) {
|
|
|
36
46
|
.map((bot) => ({ id: bot.id, name: bot.name, title: bot.title, section: bot.section ?? "", modelSelection: bot.modelSelection, chiefOfStaff: Boolean(bot.chiefOfStaff) })),
|
|
37
47
|
instances: instances.map((instance) => ({ instanceId: instance.instanceId, driverKind: instance.driverKind, displayName: instance.displayName,
|
|
38
48
|
state: instance.snapshot.state, models: instance.models, effortLevels: instance.capabilities?.effortLevels ?? [] })),
|
|
39
|
-
scope: "Bot model defaults apply to groups and new threads; existing threads retain their models. Requested team setup
|
|
49
|
+
scope: "Bot model defaults apply to groups and new threads; existing threads retain their models. Requested team setup waits for the person's decision on a card. Existing unauthorized teams remain outside this Chief's scope.",
|
|
40
50
|
});
|
|
41
51
|
};
|
|
42
52
|
}
|
|
@@ -12,6 +12,7 @@ import { harnessCapabilityLines } from "./harness-capabilities.js";
|
|
|
12
12
|
import { redactSecretsInText } from "./redact.js";
|
|
13
13
|
import { chiefLevel } from "./chief-level.js";
|
|
14
14
|
import { defaultBotRefusal } from "./default-bot.js";
|
|
15
|
+
import { READY_BOTS, readyBot } from "../shared/ready-bots.js";
|
|
15
16
|
const section = (value) => value?.trim() || "";
|
|
16
17
|
const teamName = z.string().trim().min(1).max(60).refine(fitsOnOneLine).refine((value) => redactSecretsInText(value) === value, "Team names cannot contain credentials");
|
|
17
18
|
const FIELD_LABELS = { name: "Name", title: "Title", description: "Description", section: "Department", cwd: "Working folder" };
|
|
@@ -27,9 +28,13 @@ const planSchema = z.object({
|
|
|
27
28
|
reason: z.string().trim().min(1).max(500),
|
|
28
29
|
newTeams: z.array(teamName).max(8).default([]),
|
|
29
30
|
operations: z.array(z.discriminatedUnion("action", [
|
|
30
|
-
z.object({ action: z.literal("create"), key: z.string().trim().min(1).max(80), fields: fieldsSchema }).strict(),
|
|
31
|
+
z.object({ action: z.literal("create"), key: z.string().trim().min(1).max(80), template: z.string().trim().min(1).max(80).optional(), fields: fieldsSchema.default({}) }).strict(),
|
|
31
32
|
z.object({ action: z.literal("update"), botId: z.string().min(1).max(128), fields: fieldsSchema }).strict(),
|
|
32
33
|
])).min(1).max(24),
|
|
34
|
+
room: z.object({
|
|
35
|
+
name: z.string().trim().min(1).max(100).refine(fitsOnOneLine).refine((value) => redactSecretsInText(value) === value, "Room names cannot contain credentials"),
|
|
36
|
+
members: z.array(z.string().trim().min(1).max(128)).max(24).optional(),
|
|
37
|
+
}).strict().optional(),
|
|
33
38
|
}).strict();
|
|
34
39
|
export class TeamSetupError extends Error {
|
|
35
40
|
status;
|
|
@@ -201,7 +206,17 @@ export class TeamSetupRequestService {
|
|
|
201
206
|
for (const operation of parsed.data.operations) {
|
|
202
207
|
const key = operation.action === "create" ? `create:${operation.key}` : `update:${operation.botId}`;
|
|
203
208
|
const previous = combined.get(key);
|
|
204
|
-
|
|
209
|
+
let fields = { ...previous?.fields, ...operation.fields };
|
|
210
|
+
if (operation.action === "create") {
|
|
211
|
+
if (operation.template) {
|
|
212
|
+
const template = readyBot(operation.template);
|
|
213
|
+
if (!template)
|
|
214
|
+
throw new TeamSetupError(`Unknown ready-made bot ${JSON.stringify(operation.template)}. Use an id from list_team_library botTemplates: ${READY_BOTS.map((bot) => bot.id).join(", ")}`);
|
|
215
|
+
fields = { name: template.name, title: template.title, description: template.description, soul: template.soul, ...fields };
|
|
216
|
+
}
|
|
217
|
+
fields.modelSelection ??= chief.modelSelection;
|
|
218
|
+
}
|
|
219
|
+
combined.set(key, { ...operation, fields });
|
|
205
220
|
}
|
|
206
221
|
if (combined.size > 8)
|
|
207
222
|
throw new TeamSetupError("Review at most eight bots in one setup");
|
|
@@ -218,12 +233,33 @@ export class TeamSetupRequestService {
|
|
|
218
233
|
for (const operation of operations)
|
|
219
234
|
if (operation.botId === chief.id)
|
|
220
235
|
Object.assign(requesterScope, operation.fields);
|
|
236
|
+
const room = parsed.data.room ? this.room(parsed.data.room, [...combined.values()], operations, chief) : undefined;
|
|
221
237
|
const request = { version: 1, requestId: newId(), botId: args.botId, threadId: args.threadId,
|
|
222
238
|
reason: redactSecretsInText(parsed.data.reason), createdAt: Date.now(), requesterRevision: teamSetupRevision(chief, requesterScope),
|
|
223
|
-
newTeams: [...new Set(parsed.data.newTeams)], operations };
|
|
239
|
+
newTeams: [...new Set(parsed.data.newTeams)], operations, ...(room ? { room } : {}) };
|
|
224
240
|
this.validate(request, false);
|
|
225
241
|
return request;
|
|
226
242
|
}
|
|
243
|
+
/** Members are the plan's create keys or existing bot ids; without any, every bot the plan creates. The Chief always joins. */
|
|
244
|
+
room(input, planned, operations, chief) {
|
|
245
|
+
if (!this.options.createRoom)
|
|
246
|
+
throw new TeamSetupError("Group chats can't be created with a setup here; propose the bots alone");
|
|
247
|
+
const keyed = new Map(planned.map((operation, index) => [operation.action === "create" ? operation.key : operation.botId, operations[index].botId]));
|
|
248
|
+
const requested = input.members?.length ? input.members : planned.filter((operation) => operation.action === "create").map((operation) => operation.key);
|
|
249
|
+
const botIds = [];
|
|
250
|
+
for (const member of requested) {
|
|
251
|
+
const id = keyed.get(member) ?? member;
|
|
252
|
+
const existing = this.options.store.bot(id);
|
|
253
|
+
if (!keyed.has(member) && (!existing || existing.hidden || !this.options.hasTeamAuthority(chief, existing.section))) {
|
|
254
|
+
throw new TeamSetupError(`Group chat member ${JSON.stringify(member)} is neither a bot in this plan nor a teammate from list_team_setup`);
|
|
255
|
+
}
|
|
256
|
+
if (id !== chief.id && !botIds.includes(id))
|
|
257
|
+
botIds.push(id);
|
|
258
|
+
}
|
|
259
|
+
if (!botIds.length)
|
|
260
|
+
throw new TeamSetupError("A group chat needs at least one bot besides you");
|
|
261
|
+
return { name: input.name, botIds };
|
|
262
|
+
}
|
|
227
263
|
prepareDeletion(args) {
|
|
228
264
|
const chief = this.chief(args.botId);
|
|
229
265
|
const target = this.options.store.bot(args.targetBotId);
|
|
@@ -296,6 +332,10 @@ export class TeamSetupRequestService {
|
|
|
296
332
|
lines.push(`New bots stay owner-owned after creation: the same connected apps as @${chief.name}, the workspace's default access level, a private workspace by default, avatar untouched.`);
|
|
297
333
|
}
|
|
298
334
|
lines.push("Existing execution permissions are unchanged.");
|
|
335
|
+
if (request.room) {
|
|
336
|
+
const names = request.room.botIds.map((id) => `@${this.options.store.bot(id)?.name ?? request.operations.find((operation) => operation.botId === id)?.fields.name ?? id}`);
|
|
337
|
+
lines.push(`\nGroup chat (the reviewer chooses): "${request.room.name}" with @${chief.name}, ${names.join(", ")}. @${chief.name} leads it.`);
|
|
338
|
+
}
|
|
299
339
|
}
|
|
300
340
|
if (!immediate)
|
|
301
341
|
lines.push("After this decision the Chief continues once with the result.");
|
|
@@ -354,7 +394,7 @@ export class TeamSetupRequestService {
|
|
|
354
394
|
async applyImmediately(request, from, canCommit) {
|
|
355
395
|
const card = this.cardData(request, true);
|
|
356
396
|
const before = request.deletion ? undefined : this.undoBefore(request);
|
|
357
|
-
let result = await this.apply(request, true, canCommit);
|
|
397
|
+
let result = this.withRoom(request, await this.apply(request, true, canCommit), true);
|
|
358
398
|
const undo = before && result.state === "applied" && !result.error ? this.undoRecord(result, before) : undefined;
|
|
359
399
|
const title = result.state === "applied" ? (request.deletion ? `Deleted @${request.deletion.name}` : "Team setup applied") : "Team setup not applied";
|
|
360
400
|
let messageId;
|
|
@@ -444,6 +484,21 @@ export class TeamSetupRequestService {
|
|
|
444
484
|
this.options.store.patchMessage(args.threadId, message.id, { card: { ...card, undone: true } });
|
|
445
485
|
return { claimed: true, state: "undone" };
|
|
446
486
|
}
|
|
487
|
+
/** Creates the chosen group chat once the setup applied; a failure here leaves the bots in place and says so. */
|
|
488
|
+
withRoom(request, result, wanted) {
|
|
489
|
+
if (!request.room || result.state !== "applied")
|
|
490
|
+
return result;
|
|
491
|
+
if (!wanted || !this.options.createRoom)
|
|
492
|
+
return { ...result, room: null };
|
|
493
|
+
const botIds = request.room.botIds.filter((id) => { const bot = this.options.store.bot(id); return bot && !bot.hidden; });
|
|
494
|
+
try {
|
|
495
|
+
return { ...result, room: this.options.createRoom(request, botIds) };
|
|
496
|
+
}
|
|
497
|
+
catch (error) {
|
|
498
|
+
const detail = redactSecretsInText(error instanceof Error ? error.message : String(error));
|
|
499
|
+
return { ...result, room: null, error: [result.error, `The bots were set up, but the group chat could not be created: ${detail}`].filter(Boolean).join(" ") };
|
|
500
|
+
}
|
|
501
|
+
}
|
|
447
502
|
async resolve(args) {
|
|
448
503
|
const message = this.options.store.messagesFor(args.threadId).find((item) => item.card?.requestId === args.requestId && item.card.teamSetupRequest);
|
|
449
504
|
const card = message?.card, request = card?.teamSetupRequest;
|
|
@@ -469,7 +524,7 @@ export class TeamSetupRequestService {
|
|
|
469
524
|
else if (args.behavior === "deny")
|
|
470
525
|
result = { state: "denied", bots: [], newTeams: [] };
|
|
471
526
|
else
|
|
472
|
-
result = await this.apply(request);
|
|
527
|
+
result = this.withRoom(request, await this.apply(request), args.room !== false);
|
|
473
528
|
const dead = result.state !== "applied" && result.state !== "denied";
|
|
474
529
|
this.options.store.patchMessage(args.threadId, message.id, { card: { ...card, ...(dead ? { expired: true, options: [] } : { answered: result.state === "applied" ? "allow" : "deny" }), held: result.error, teamSetupRequest: { ...request, result } } });
|
|
475
530
|
return { result, request: { ...request, result }, messageId: message.id, duplicate: false };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** MausBot: every person's built-in helper. A new install's first bot (its Chief of Staff too); an existing place or
|
|
2
2
|
* person without one is given one once. It can be renamed and recoloured, hidden from the sidebar, never deleted. */
|
|
3
|
-
export const DEFAULT_BOT_NAME = "Limix
|
|
3
|
+
export const DEFAULT_BOT_NAME = "Trợ Lý Limix";
|
|
4
|
+
/** Names the built-in helper had before; one still unchanged is renamed to DEFAULT_BOT_NAME. */
|
|
5
|
+
export const LEGACY_DEFAULT_BOT_NAMES = ["Limix Bot", "MausBot"];
|
|
4
6
|
export const DEFAULT_BOT_COLOR = "chrome";
|
|
5
7
|
export const defaultBotPerson = (bot) => bot.defaultBot?.person?.trim().toLowerCase() ?? "";
|
|
6
8
|
/** The MausBot a viewer sees as theirs: their own on a Team Cloud (by email), else the place's. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|