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
|
@@ -83,6 +83,7 @@ const TEAM_ACTION_KEYS = {
|
|
|
83
83
|
list_room_targets: "activity.tool.team.listRoomTargets",
|
|
84
84
|
list_rooms: "activity.tool.team.listRooms",
|
|
85
85
|
list_shared_computers: "activity.tool.team.listSharedComputers",
|
|
86
|
+
diagnose_limix: "activity.tool.team.diagnoseLimix",
|
|
86
87
|
list_team_library: "activity.tool.team.listTeamLibrary",
|
|
87
88
|
list_models: "activity.tool.team.listModels",
|
|
88
89
|
list_team_setup: "activity.tool.team.listTeamSetup",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { channelConversationSchema, parseChannelHeader } from "./limix-channel-identity.js";
|
|
2
|
-
import { channelAttachmentSchema, channelReplyAttachments, saveChannelAttachments } from "./limix-channel-media.js";
|
|
2
|
+
import { CHANNEL_MEDIA_MAX_BYTES, channelAttachmentSchema, channelReplyAttachments, saveChannelAttachments } from "./limix-channel-media.js";
|
|
3
3
|
import { deleteAttachment } from "./attachments.js";
|
|
4
4
|
// The Bot API's two sides. Outside: `POST /hooks/api/bots/<id>/messages` on the webhook receiver, a bearer key, a
|
|
5
5
|
// message in, the bot's reply out; the turn it starts is outside work (the "api" trigger), so it never acts for the
|
|
@@ -23,7 +23,7 @@ const PUBLIC_PATH = /^\/hooks\/api\/bots\/([\w-]{1,128})\/messages$/;
|
|
|
23
23
|
const APP_PATH = /^\/api\/bots\/([\w-]{1,128})\/bot-api(?:\/(new-key))?$/;
|
|
24
24
|
const callSchema = z.object({
|
|
25
25
|
message: z.string().min(1).max(BOT_API_MAX_MESSAGE_CHARS),
|
|
26
|
-
attachments: z.array(channelAttachmentSchema).max(
|
|
26
|
+
attachments: z.array(channelAttachmentSchema).max(1000).optional(),
|
|
27
27
|
thread: z.string().regex(/^[\w-]{1,128}$/).optional(),
|
|
28
28
|
conversation: channelConversationSchema.optional(),
|
|
29
29
|
channel: z.enum(["telegram", "zalo", "discord", "facebook"]).optional(),
|
|
@@ -233,7 +233,8 @@ export function createBotApiHost(deps) {
|
|
|
233
233
|
}
|
|
234
234
|
let call;
|
|
235
235
|
try {
|
|
236
|
-
|
|
236
|
+
// Room for CHANNEL_MEDIA_MAX_BYTES of files as base64, plus the message.
|
|
237
|
+
const raw = await readRawBody(req, Math.ceil(CHANNEL_MEDIA_MAX_BYTES / 3) * 4 + 1024 * 1024);
|
|
237
238
|
const contentType = header(req, "content-type")?.toLowerCase() ?? "";
|
|
238
239
|
if (!contentType.includes("json"))
|
|
239
240
|
fail(415, "Send JSON: Content-Type: application/json");
|
|
@@ -266,7 +267,9 @@ export function createBotApiHost(deps) {
|
|
|
266
267
|
catch (error) {
|
|
267
268
|
manager.record(botId, { outcome: "rejected", statusCode: statusOf(error), reason: detailOf(error), preview: call.message });
|
|
268
269
|
const busy = retryableBusySchema.safeParse(error);
|
|
269
|
-
|
|
270
|
+
// Limix: the bot's own owner (linked in a private chat) is told why a turn could not run; other callers are not.
|
|
271
|
+
const ownerDetail = limixOwner && statusOf(error) === 502 ? detailOf(error).slice(0, 300) : "";
|
|
272
|
+
json(res, statusOf(error), { error: callerWords(error), ...(busy.success ? { code: busy.data.code, retryable: true } : {}), ...(ownerDetail ? { detail: ownerDetail } : {}) });
|
|
270
273
|
}
|
|
271
274
|
return true;
|
|
272
275
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// admin still sees only their own private chats, never another person's: audience.ts). A member sees a room
|
|
4
4
|
// only when they can see every bot in it, and bots reach each other only with the same audience (sameAudience): a room
|
|
5
5
|
// transcript or a delegation would otherwise carry a restricted bot's words to people who cannot see it.
|
|
6
|
+
import { isLimixOwnerThread } from "./limix-owner-lane.js";
|
|
6
7
|
import { z } from "zod";
|
|
7
8
|
import { accessFromVisibility, entryMatches, higherLevel, sharedLevel } from "../shared/bot-access.js";
|
|
8
9
|
import { botOwner } from "../shared/bot-owner.js";
|
|
@@ -236,7 +237,8 @@ export class VisibleSet {
|
|
|
236
237
|
audienceShows(threadId) {
|
|
237
238
|
const holder = this.ownerOf(threadId);
|
|
238
239
|
const task = holder?.bot ? this.bots.get(holder.bot)?.tasks?.find(task => task.threadId === threadId) : undefined;
|
|
239
|
-
|
|
240
|
+
// Limix: the bot owner's own Telegram / Zalo chat stays listed; other people's wait for the password unlock.
|
|
241
|
+
if (task?.botApi && !isLimixOwnerThread(threadId) && (this.viewer.channelReviewUntil ?? 0) <= Date.now())
|
|
240
242
|
return false;
|
|
241
243
|
const audience = this.audiences?.of(threadId);
|
|
242
244
|
return audience === undefined || audienceIncludes(audience, { admin: this.viewer.kind === "all", person: this.audiences.person, seesRoom: (groupId) => this.group(groupId) });
|
|
@@ -8,7 +8,8 @@ export function chiefTidies(from, task, opener, owner) {
|
|
|
8
8
|
}
|
|
9
9
|
const ROSTER_MAX_BOTS = 40;
|
|
10
10
|
const OTHERS_MIN_BOTS = 8;
|
|
11
|
-
const SPECIALISTS = "When a job needs a specialist you do not have (an ongoing area of work, a different skill set, or work to run in parallel),
|
|
11
|
+
const SPECIALISTS = "When the person asks for a bot or a team, or a job clearly needs a specialist you do not have (an ongoing area of work, a different skill set, or work to run in parallel), propose it; never create bots on your own. First call list_team_library: botTemplates are ready-made single bots (create one with its template id), teams are ready-made groups of roles. Prefer a ready-made bot or team when it fits the request; otherwise design custom bots. Then call propose_team_setup once, in this conversation, with every bot. When it adds two or more bots that will work together, include room so the person can choose to also create a group chat that you lead. Before the card, tell the person in one or two lines what you propose and why, and whether it is ready-made or custom. Never add a bot just to look busy, or one that duplicates a teammate."
|
|
12
|
+
+ " When the person says a bot or a Telegram / Zalo connection is not working, call diagnose_limix first (read-only, it never shows secrets), explain in plain words what is wrong and the fix, and use propose_team_setup for any bot change; never ask them to send you a token or password.";
|
|
12
13
|
const sectionKey = (section) => section?.trim() || "";
|
|
13
14
|
/** Names the team every turn; who is busy changes turn to turn, so it rides the volatile half instead. */
|
|
14
15
|
/** The Team map sends an @everyone line to the Chief alone (src/lib/map-composer.ts): every bot taking a turn of its own cost
|
|
@@ -60,7 +61,7 @@ export function chiefOfStaffSystemPrompt(chiefId, bots, canDelegate, also) {
|
|
|
60
61
|
: "",
|
|
61
62
|
delegation,
|
|
62
63
|
canDelegate ? "Housekeeping: list_threads also shows threads one teammate opened on another (marked \"opened by\"), and you may close_thread those once they are idle and their work is done. Threads the person started are theirs: never close them." : "",
|
|
63
|
-
canDelegate ? "When the user asks you to assemble or configure a team, use list_team_setup for the exact authorized teams, bot IDs and model catalog, then propose_team_setup once with all named specialists and their profile/model changes. Include new teams explicitly; the plan covers their creation and your access. Existing thread models and other bots' execution permissions stay unchanged.
|
|
64
|
+
canDelegate ? "When the user asks you to assemble or configure a team, use list_team_setup for the exact authorized teams, bot IDs and model catalog, then propose_team_setup once with all named specialists and their profile/model changes. Include new teams explicitly; the plan covers their creation and your access. Existing thread models and other bots' execution permissions stay unchanged. Every plan waits for the person's decision on a card: end your turn after proposing; the decision automatically resumes you once with a structured result, including the group chat if they chose one. Report failed or cancelled results honestly. Do not ask for another yes, poll, or repeat the proposal. After successful setup, use the available coordination tools for already requested work. For explicitly requested bot deletion, use propose_bot_deletion separately and follow its applied or pending result too." : "",
|
|
64
65
|
person ? `Bots that report to ${person} (your team):` : chief?.managedSections?.length ? "Your team, in the departments you are responsible for:" : `Current ${sectionName} department (your team):`,
|
|
65
66
|
roster,
|
|
66
67
|
othersRoster && (person ? "Other bots you can reach (they report to someone else):" : "Other bots you can reach, in other departments:"),
|
|
@@ -4,7 +4,7 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
4
4
|
import { lstatSync } from "node:fs";
|
|
5
5
|
import { chmod, mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
|
-
import { join, resolve } from "node:path";
|
|
7
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
8
8
|
import { promisify } from "node:util";
|
|
9
9
|
import { augmentedPath, resolveCliSpawn } from "./env-path.js";
|
|
10
10
|
import { workspacePreparationDockerfile } from "./container-workspace.js";
|
|
@@ -41,6 +41,13 @@ export const CUA_EXECUTABLE = "/usr/local/libexec/limixbot/cua-driver";
|
|
|
41
41
|
const RUNTIMES = ["docker", "podman", "container"];
|
|
42
42
|
const INTERNAL_VIEWER_PORT = 6901;
|
|
43
43
|
const HOST_VIEWER_PORT = 6080;
|
|
44
|
+
/** Limix: where a shared department folder appears inside a bot's own desktop. */
|
|
45
|
+
export const TEAM_FOLDER_GUEST = "/home/cua/team";
|
|
46
|
+
/** Limix: every shared department folder lives here on the host; nothing else may be the second mount. */
|
|
47
|
+
export const TEAM_FOLDERS_DIR = join(DATA_DIR, "vm-teams");
|
|
48
|
+
export function teamFolderDir(team) {
|
|
49
|
+
return join(TEAM_FOLDERS_DIR, createHash("sha256").update(`limix-team-folder:${team}`).digest("hex").slice(0, 16));
|
|
50
|
+
}
|
|
44
51
|
export const SHARED_LOCAL_VM_TARGET = {
|
|
45
52
|
key: "shared",
|
|
46
53
|
containerName: CONTAINER,
|
|
@@ -60,6 +67,18 @@ export function perBotLocalVmTarget(botId) {
|
|
|
60
67
|
label: digest,
|
|
61
68
|
};
|
|
62
69
|
}
|
|
70
|
+
/** Limix: one desktop a department's bots share when each opted in. Its own digest space, apart from bots and seats. */
|
|
71
|
+
export function teamLocalVmTarget(team) {
|
|
72
|
+
const digest = createHash("sha256").update(`limix-team-desktop:${team}`).digest("hex");
|
|
73
|
+
const short = digest.slice(0, 16);
|
|
74
|
+
return {
|
|
75
|
+
key: `team:${digest}`,
|
|
76
|
+
containerName: `${CONTAINER}-t${short}`,
|
|
77
|
+
workspaceDir: join(DATA_DIR, "vm-homes", `team-${short}`),
|
|
78
|
+
viewerPort: null,
|
|
79
|
+
label: `team-${short}`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
63
82
|
/** Seat identities stay disjoint from the shared singleton and per-bot digests, so the three modes never meet. */
|
|
64
83
|
export function poolLocalVmTarget(seat) {
|
|
65
84
|
return {
|
|
@@ -565,7 +584,10 @@ function dockerWorkspaceMountIsSafe(mounts, platform, expectedWorkspace, runtime
|
|
|
565
584
|
(runtime === "podman" &&
|
|
566
585
|
platform === "win32" &&
|
|
567
586
|
samePodmanWindowsWorkspaceSource(mounts?.[0]?.Source, expectedWorkspace));
|
|
568
|
-
|
|
587
|
+
const team = mounts?.[1];
|
|
588
|
+
const teamOk = !team || (team.Type === "bind" && team.Destination === TEAM_FOLDER_GUEST && team.RW !== false &&
|
|
589
|
+
typeof team.Source === "string" && dirname(team.Source) === TEAM_FOLDERS_DIR && /^[0-9a-f]{16}$/.test(basename(team.Source)));
|
|
590
|
+
return Boolean((mounts?.length === 1 || (mounts?.length === 2 && teamOk)) &&
|
|
569
591
|
mounts[0]?.Type === "bind" &&
|
|
570
592
|
sourceMatches &&
|
|
571
593
|
mounts[0]?.Destination === VM_WORKSPACE_GUEST &&
|
|
@@ -602,7 +624,9 @@ export function containerRunArgs(runtime, password = "CHANGE_ME", target = SHARE
|
|
|
602
624
|
const guestIds = guestIdsFor(runtime, desktop.platform, desktop.hostUser);
|
|
603
625
|
common.push("--mount", runtime === "podman"
|
|
604
626
|
? `type=bind,source=${target.workspaceDir},target=${VM_WORKSPACE_GUEST},relabel=private`
|
|
605
|
-
: `type=bind,source=${target.workspaceDir},target=${VM_WORKSPACE_GUEST}`, "
|
|
627
|
+
: `type=bind,source=${target.workspaceDir},target=${VM_WORKSPACE_GUEST}`, ...(desktop.teamDir && runtime !== "container" ? ["--mount", runtime === "podman"
|
|
628
|
+
? `type=bind,source=${desktop.teamDir},target=${TEAM_FOLDER_GUEST},relabel=shared`
|
|
629
|
+
: `type=bind,source=${desktop.teamDir},target=${TEAM_FOLDER_GUEST}`] : []), "-e", `VNC_PW=${password}`, "-p", target.viewerPort
|
|
606
630
|
? `127.0.0.1:${target.viewerPort}:${INTERNAL_VIEWER_PORT}`
|
|
607
631
|
: `127.0.0.1::${INTERNAL_VIEWER_PORT}`, IMAGE);
|
|
608
632
|
if (guestIds)
|
|
@@ -637,7 +661,7 @@ async function prepareManagedImage(runtime, runner) {
|
|
|
637
661
|
await rm(context, { recursive: true, force: true });
|
|
638
662
|
}
|
|
639
663
|
}
|
|
640
|
-
export async function containerComputerAction(action, runner = sh, platform = process.platform, target = SHARED_LOCAL_VM_TARGET, resources = DEFAULT_DESKTOP_RESOURCES, runningLimit) {
|
|
664
|
+
export async function containerComputerAction(action, runner = sh, platform = process.platform, target = SHARED_LOCAL_VM_TARGET, resources = DEFAULT_DESKTOP_RESOURCES, runningLimit, teamDir) {
|
|
641
665
|
if (runner === sh && platform === process.platform)
|
|
642
666
|
screenshotStatusCache.delete(target.key);
|
|
643
667
|
const before = await containerComputerStatus(runner, platform, target);
|
|
@@ -673,6 +697,8 @@ export async function containerComputerAction(action, runner = sh, platform = pr
|
|
|
673
697
|
else {
|
|
674
698
|
if (action === "run")
|
|
675
699
|
await ensureVmWorkspace(platform, target, runtime);
|
|
700
|
+
if (action === "run" && teamDir)
|
|
701
|
+
await ensureVmWorkspace(platform, { ...target, workspaceDir: teamDir }, runtime);
|
|
676
702
|
if (action === "start" && runtime !== "container") {
|
|
677
703
|
await applyResourcesBeforeStart(target.containerName, resources, (args, timeoutMs) => runner(runtime, args, timeoutMs));
|
|
678
704
|
}
|
|
@@ -681,6 +707,7 @@ export async function containerComputerAction(action, runner = sh, platform = pr
|
|
|
681
707
|
platform,
|
|
682
708
|
resources,
|
|
683
709
|
hostUser: currentHostUser(platform),
|
|
710
|
+
...(teamDir ? { teamDir } : {}),
|
|
684
711
|
})
|
|
685
712
|
: action === "remove"
|
|
686
713
|
? ["rm", runtime === "container" ? "--force" : "-f", target.containerName]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { writeFileAtomic } from "./atomic.js";
|
|
4
|
-
import { DEFAULT_BOT_COLOR, DEFAULT_BOT_NAME, defaultBotPerson } from "../shared/default-bot.js";
|
|
4
|
+
import { DEFAULT_BOT_COLOR, DEFAULT_BOT_NAME, LEGACY_DEFAULT_BOT_NAMES, defaultBotPerson } from "../shared/default-bot.js";
|
|
5
5
|
import { takeImportName } from "../shared/import-name.js";
|
|
6
6
|
/** Where each place (key "") and Team Cloud member (their email) is recorded as having had its MausBot, so one that is
|
|
7
7
|
* gone is never made twice. */
|
|
@@ -71,7 +71,7 @@ export function seededMausBot(bots) {
|
|
|
71
71
|
const oldest = bots.reduce((first, bot) => !first || bot.createdAt < first.createdAt ? bot : first, undefined);
|
|
72
72
|
if (!oldest || oldest.hidden || oldest.movedTo || oldest.section?.trim() || oldest.installedPackage)
|
|
73
73
|
return undefined;
|
|
74
|
-
return oldest.name
|
|
74
|
+
return [DEFAULT_BOT_NAME, ...LEGACY_DEFAULT_BOT_NAMES].includes(oldest.name) || oldest.color === STARTER_COLOR ? oldest : undefined;
|
|
75
75
|
}
|
|
76
76
|
/** Puts the intro where its person sees it next: in its open conversation while nobody has written there, else at the
|
|
77
77
|
* top of a new one, so no earlier message moves. */
|
|
@@ -507,6 +507,9 @@ export async function callTool(called, input, context) {
|
|
|
507
507
|
if (name === "list_team_setup") {
|
|
508
508
|
return { text: JSON.stringify(await api("/api/internal/team-setup-catalog")) };
|
|
509
509
|
}
|
|
510
|
+
if (name === "diagnose_limix") {
|
|
511
|
+
return { text: JSON.stringify(await api("/api/internal/limix-diagnosis")) };
|
|
512
|
+
}
|
|
510
513
|
if (name === "list_team_library") {
|
|
511
514
|
return { text: JSON.stringify(await api("/api/internal/team-library")) };
|
|
512
515
|
}
|
|
@@ -354,7 +354,7 @@ const TOOL_DEFINITIONS = [
|
|
|
354
354
|
},
|
|
355
355
|
{
|
|
356
356
|
name: "create_bot",
|
|
357
|
-
description: "Chief of Staff only:
|
|
357
|
+
description: "Chief of Staff only: propose one specialist for your section on a review card; it is added only if the person approves. Prefer propose_team_setup for ready-made bots, several bots or a group chat. instructions become its soul. Omit modelSelection for the workspace default, or use exact IDs from list_team_setup. It starts with your connected apps, at the default access level. Assign work with coordinate_bots. At most four per turn.",
|
|
358
358
|
inputSchema: {
|
|
359
359
|
type: "object",
|
|
360
360
|
properties: {
|
|
@@ -379,14 +379,19 @@ const TOOL_DEFINITIONS = [
|
|
|
379
379
|
description: "Chief of Staff only: list authorized teams, teammate IDs, and exact engine/model choices for team setup. Call before proposing configuration; never invent model IDs. Existing thread models are independent of bot defaults.",
|
|
380
380
|
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
381
381
|
},
|
|
382
|
+
{
|
|
383
|
+
name: "diagnose_limix",
|
|
384
|
+
description: "Chief of Staff only: read-only health check of Limix Bot: Telegram/Zalo/Discord connection status (running, stopped, token refused, conflict), AI engines that are signed out or missing, and whether any bot exists, each problem with a suggested fix. Call it when the person reports a bot or chat connection not answering, before guessing. It changes nothing: tell the person what is wrong and the fix, and use propose_team_setup for any bot change. Secrets are never included.",
|
|
385
|
+
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
386
|
+
},
|
|
382
387
|
{
|
|
383
388
|
name: "list_team_library",
|
|
384
|
-
description: "Chief of Staff only: ready-made teams, each with a summary and roles (lead = the team's Chief).
|
|
389
|
+
description: "Chief of Staff only: ready-made teams, each with a summary and roles (lead = the team's Chief), and botTemplates: ready-made single bots. Propose either with propose_team_setup (template = a botTemplates id).",
|
|
385
390
|
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
386
391
|
},
|
|
387
392
|
{
|
|
388
393
|
name: "propose_team_setup",
|
|
389
|
-
description: "Chief of Staff only: submit all requested specialist creation, profile/model configuration, Chief assignments, and authorized team moves in ONE combined plan. Use exact catalog engine/model IDs from list_team_setup. Combine all fields for each bot; use the same create key or botId to coalesce repeated entries. New teams must be named explicitly in newTeams and have a specialist in this plan; access is granted only to those new teams. Existing unauthorized teams cannot be included. Models change bot defaults for groups/new threads; existing threads and execution permissions stay unchanged.
|
|
394
|
+
description: "Chief of Staff only: submit all requested specialist creation, profile/model configuration, Chief assignments, and authorized team moves in ONE combined plan. Use exact catalog engine/model IDs from list_team_setup. Combine all fields for each bot; use the same create key or botId to coalesce repeated entries. New teams must be named explicitly in newTeams and have a specialist in this plan; access is granted only to those new teams. Existing unauthorized teams cannot be included. Models change bot defaults for groups/new threads; existing threads and execution permissions stay unchanged. Every setup waits for the person's decision on a card: end your turn; the decision and structured result automatically resume you once. Do not ask again, poll, or repeat the proposal. Never claim success without an applied result.",
|
|
390
395
|
inputSchema: {
|
|
391
396
|
type: "object", additionalProperties: false,
|
|
392
397
|
properties: {
|
|
@@ -397,19 +402,24 @@ const TOOL_DEFINITIONS = [
|
|
|
397
402
|
properties: {
|
|
398
403
|
action: { type: "string", enum: ["create", "update"] },
|
|
399
404
|
key: { type: "string", description: "For create: your stable short name for this new bot in this plan." },
|
|
405
|
+
template: { type: "string", description: "For create: a botTemplates id from list_team_library. Fills name, title, description and soul; fields you give override them." },
|
|
400
406
|
botId: { type: "string", description: "For update: exact existing bot ID from list_team_setup." },
|
|
401
407
|
fields: { type: "object", additionalProperties: false, properties: {
|
|
402
408
|
name: { type: "string", maxLength: 100 }, title: { type: "string", maxLength: 200 },
|
|
403
409
|
chiefOfStaff: { type: "boolean", description: "Appoint or remove this team's Chief. At most one Chief per team: explicitly demote the current Chief in the same plan when replacing them. Does not grant access to other teams or change execution permissions." },
|
|
404
|
-
description: { type: "string", maxLength: 4000 }, soul: { type: "string", description: "Standing instructions;
|
|
410
|
+
description: { type: "string", maxLength: 4000 }, soul: { type: "string", description: "Standing instructions; every new bot needs name, title and soul (a template fills them). modelSelection defaults to yours." },
|
|
405
411
|
cwd: { type: "string", maxLength: 1024, description: "Create only: absolute path of the folder the new bot's tools read and write in. It must already exist. Leave it out for a private workspace." },
|
|
406
412
|
section: { type: "string", maxLength: 60, description: "Exact authorized existing team, or a team explicitly named in newTeams. Empty string means General." },
|
|
407
413
|
modelSelection: { type: "object", additionalProperties: false, properties: {
|
|
408
414
|
instanceId: { type: "string" }, model: { type: "string" }, effort: { type: "string" }, variant: { type: "string" },
|
|
409
415
|
}, required: ["instanceId", "model"] },
|
|
410
416
|
} },
|
|
411
|
-
}, required: ["action"
|
|
417
|
+
}, required: ["action"],
|
|
412
418
|
} },
|
|
419
|
+
room: { type: "object", additionalProperties: false, description: "Offer a group chat with these bots, led by you; the person chooses on the card whether to create it.", properties: {
|
|
420
|
+
name: { type: "string", minLength: 1, maxLength: 100 },
|
|
421
|
+
members: { type: "array", maxItems: 24, items: { type: "string" }, description: "Create keys from this plan or existing bot IDs; omit for every bot this plan creates." },
|
|
422
|
+
}, required: ["name"] },
|
|
413
423
|
}, required: ["reason", "operations"],
|
|
414
424
|
},
|
|
415
425
|
},
|
|
@@ -857,7 +867,7 @@ const SKILL_TOOL_NAMES = new Set(["skills_list", "skill_manage"]);
|
|
|
857
867
|
export const SHARED_COMPUTER_TOOL_NAMES = new Set(["list_shared_computers", "shared_computer"]);
|
|
858
868
|
const VOICE_TOOL_NAMES = new Set(["send_voice_note"]);
|
|
859
869
|
const CHIEF_ONLY_TOOL_NAMES = new Set([
|
|
860
|
-
"create_bot", "list_team_setup", "list_team_library", "propose_team_setup", "propose_bot_deletion", "manage_room", "retry_thread",
|
|
870
|
+
"create_bot", "list_team_setup", "diagnose_limix", "list_team_library", "propose_team_setup", "propose_bot_deletion", "manage_room", "retry_thread",
|
|
861
871
|
]);
|
|
862
872
|
const CHIEF_TARGET_TOOL_NAMES = new Set(["propose_profile", "propose_model"]);
|
|
863
873
|
const WATCHER_TOOL_NAMES = new Set(["create_options_card"]);
|
|
@@ -154,6 +154,9 @@ import { coordinateTooLong } from "./too-long.js";
|
|
|
154
154
|
import { chiefAbsentFrom, createChiefRooms } from "./host/chief-rooms.js";
|
|
155
155
|
import { chiefLevel, readTeamRolesWith } from "./chief-level.js";
|
|
156
156
|
import { defaultBotRefusal, ensureDefaultBot } from "./default-bot.js";
|
|
157
|
+
import { renameLegacyDefaultBots } from "./limix-assistant-name.js";
|
|
158
|
+
import { withBotDesktopResources } from "./limix-desktop-resources.js";
|
|
159
|
+
import { teamDesktopKey, teamDesktopMembers, teamDesktopResources } from "./limix-team-desktop.js";
|
|
157
160
|
import { buildRecall, recallRooms, recallThreadIds, withRecalled } from "./recall.js";
|
|
158
161
|
import { hostTimeZone, takesTurnClock, turnClockLine, withTurnClock } from "./turn-clock.js";
|
|
159
162
|
import { createMemoryUpkeep, dreamConversations, upkeepEnabled } from "./memory-upkeep.js";
|
|
@@ -165,7 +168,7 @@ import { createPersonPreference } from "./host/person-preference.js";
|
|
|
165
168
|
import { botMemoryUpdate, ownersOwnAsk } from "./memory-forget.js";
|
|
166
169
|
import { canManage, canReach, hasTeamAuthority, livePeerRoster, livePeerRosterBlock, peerName, peerRosterSystemPrompt, peerStatus, peerStatusWords, reachablePeers, resolveTeammate, roomPeerRosterSystemPrompt, roomRosterLine } from "./peer-roster.js";
|
|
167
170
|
import { roomPostRefusal, sharedNamesNote, unreachedMentionLines } from "./same-name-mentions.js";
|
|
168
|
-
import { containerComputerAction, containerComputerFrame, containerComputerStatus, containerExec, containerRuntimeStatus, localVmWakeAction, perBotLocalVmTarget, poolLocalVmTarget, SHARED_LOCAL_VM_TARGET, setupCommands, VM_WORKSPACE_GUEST, } from "./container-computer.js";
|
|
171
|
+
import { containerComputerAction, containerComputerFrame, containerComputerStatus, containerExec, containerRuntimeStatus, localVmWakeAction, perBotLocalVmTarget, teamLocalVmTarget, teamFolderDir, TEAM_FOLDER_GUEST, poolLocalVmTarget, SHARED_LOCAL_VM_TARGET, setupCommands, VM_WORKSPACE_GUEST, } from "./container-computer.js";
|
|
169
172
|
import { containerComputerMcp } from "./local-vm-box.js";
|
|
170
173
|
import { attachForTurn, saveBotAttachment } from "./bot-attachment.js";
|
|
171
174
|
import { cacheUntilConfigChanges, ensureDirs, instanceConfigs, loadConfig, changedInstanceIds, engineLaunches, localVmIdleTimeoutMinutes, localVmMaxInstances, localVmMode, localVmPreservesInstalledApps, localVmResources, roomTurnTimeoutMinutes, mcpCallTimeoutMinutes, cacheKeepWarmSettings, threadEventLogMaxBytes, threadEventLogRetentionDays, saveConfig, showToolCallsEnabled, claudeUserMcpEnabled, skillAuthoringEnabled, skillAutoApplyEnabled, skillReviewEnabled, skillReviewSteps, autoRecallEnabled, captureQuietMs, roomMemoryCaptureEnabled, tidyHour, sharedComputersEnabled, ownerLendingEnabled, builtInBrowserEnabled, persistableInstanceConfigs, vpsSshAlias, DATA_DIR, EVENTS_DIR, onConfigSaved, CLAUDE_API_INSTANCE, openCodeProviderKeys, } from "./config.js";
|
|
@@ -523,7 +526,8 @@ import { createGroupOrderRoutes } from "./routes/group-order.js";
|
|
|
523
526
|
import { createBotLifecycleRoutes } from "./routes/bot-lifecycle.js";
|
|
524
527
|
import { createBotSkillsRoutes } from "./routes/bot-skills.js";
|
|
525
528
|
import { startHubAutoSync } from "./limix-skill-hub.js";
|
|
526
|
-
import { startLimixGatewaySidecar } from "./limix-gateway-sidecar.js";
|
|
529
|
+
import { limixGatewayConnections, startLimixGatewaySidecar } from "./limix-gateway-sidecar.js";
|
|
530
|
+
import { createLimixManagedGrant, limixManagedGrantConfig } from "./limix-managed-grant.js";
|
|
527
531
|
import { limixBundledFor, limixSelectBundled, limixSkillDefaultsMigration } from "./limix-skill-store.js";
|
|
528
532
|
import { createSkillShareRoutes } from "./routes/skill-share.js";
|
|
529
533
|
import { createTeamContextRoutes } from "./routes/team-context.js";
|
|
@@ -682,6 +686,10 @@ if (CLOUD_HOME) {
|
|
|
682
686
|
repairMovedWorkspacePaths(DATA_DIR);
|
|
683
687
|
acceptLegacyOrigins(CLOUD_HOME.legacyOrigins);
|
|
684
688
|
}
|
|
689
|
+
const LIMIX_MANAGED_GRANT = limixManagedGrantConfig();
|
|
690
|
+
const limixManagedGrant = LIMIX_MANAGED_GRANT ? createLimixManagedGrant(LIMIX_MANAGED_GRANT, sessions) : null;
|
|
691
|
+
if (LIMIX_MANAGED_GRANT && !CLOUD_HOME)
|
|
692
|
+
acceptLegacyOrigins([LIMIX_MANAGED_GRANT.origin]);
|
|
685
693
|
if (CLOUD_PERSONAL)
|
|
686
694
|
sessions.requireAdmin(userError("serverError.cloud.personal"));
|
|
687
695
|
const lendingEnabled = () => sharedComputersEnabled(cfg) || CLOUD_HOME !== null || ownHome.here();
|
|
@@ -2892,6 +2900,7 @@ for (const pending of startupCatalogs) {
|
|
|
2892
2900
|
}
|
|
2893
2901
|
const firstHourFresh = Boolean(CLOUD_PERSONAL) && store.needsSeed();
|
|
2894
2902
|
testedAi.seed({ defaultBot: !CLOUD_TEAM, ...(firstHourFresh ? { intro: (bot) => greetingMessage(bot, { name: cfg.profile?.name }, cfg.language) } : {}) });
|
|
2903
|
+
renameLegacyDefaultBots(store);
|
|
2895
2904
|
moveFreeze.hold(() => { if (!CLOUD_TEAM)
|
|
2896
2905
|
ensureDefaultBot(store, { dataDir: DATA_DIR }); }, () => { });
|
|
2897
2906
|
if (CLOUD_TEAM)
|
|
@@ -2939,7 +2948,7 @@ const wireTask = (task, botModel, awaiting = threadsAwaitingTeammates()) => {
|
|
|
2939
2948
|
// Snoozes heal on read against the server clock; the 0 sentinel ("until new activity") survives reads.
|
|
2940
2949
|
const { snoozedUntil, ...base } = toWireTask(task, botModel);
|
|
2941
2950
|
const keepWarm = cacheKeepWarmStatus(task.threadId);
|
|
2942
|
-
const coordinated = { ...base, waitingForTeammates: awaiting.has(task.threadId) && !task.busy, ...(keepWarm ? { cacheKeepWarm: keepWarm } : {}), ...(teamHost.ownTurn(task.threadId) ? { private: true } : {}), ...teamMessages.inbox.wire(task.threadId), ...runOwners.askedBy(task) };
|
|
2951
|
+
const coordinated = { ...base, ...(task.botApi && isLimixOwnerThread(task.threadId) ? { channelOwner: true } : {}), waitingForTeammates: awaiting.has(task.threadId) && !task.busy, ...(keepWarm ? { cacheKeepWarm: keepWarm } : {}), ...(teamHost.ownTurn(task.threadId) ? { private: true } : {}), ...teamMessages.inbox.wire(task.threadId), ...runOwners.askedBy(task) };
|
|
2943
2952
|
const asleep = snoozedUntil === 0 || (snoozedUntil !== undefined && snoozedUntil > Date.now());
|
|
2944
2953
|
return asleep ? { ...coordinated, snoozedUntil } : coordinated;
|
|
2945
2954
|
};
|
|
@@ -2978,7 +2987,7 @@ function previewSystemPrompt(bot) {
|
|
|
2978
2987
|
const computerPromptKind = resolveComputerPromptKind({
|
|
2979
2988
|
kind: previewComputer === "vm" ? "vm" : previewComputer === "cloud"
|
|
2980
2989
|
? bot.cloudBackend === "vps" ? "vps" : "box" : previewComputer === "local" ? "local" : null,
|
|
2981
|
-
vmPrivate: localVmMode(cfg) === "per-bot",
|
|
2990
|
+
vmPrivate: localVmMode(cfg) === "per-bot" && !bot.desktopTeam,
|
|
2982
2991
|
});
|
|
2983
2992
|
const peers = reachablePeers(store.bots, bot);
|
|
2984
2993
|
const coordination = chiefLevel(bot)
|
|
@@ -3004,7 +3013,7 @@ function previewSystemPrompt(bot) {
|
|
|
3004
3013
|
}),
|
|
3005
3014
|
},
|
|
3006
3015
|
{ id: "shell", label: "Long-running commands", text: privateWorkspace ? longCommandsPrompt(computerPromptKind) : "" },
|
|
3007
|
-
{ id: "computer", label: "Computer", text: computerPrompt(computerPromptKind) },
|
|
3016
|
+
{ id: "computer", label: "Computer", text: computerPrompt(computerPromptKind) + (computerPromptKind === "vm-private" || computerPromptKind === "vm-shared" ? limixTeamDesktopNote(bot) : "") },
|
|
3008
3017
|
{ id: "team-computer", label: "Team computer", text: teamComputerPrompt(teamComputer) },
|
|
3009
3018
|
{ id: "plan", label: "Surface", text: previewPlan.computer === undefined ? "" : surfacePrompt({
|
|
3010
3019
|
computer: previewPlan.computer && previewPlan.computer !== "off" && computerPromptKind ? previewPlan.computer : null,
|
|
@@ -3115,6 +3124,42 @@ function sourceApprovalMode(botId, threadId) {
|
|
|
3115
3124
|
function fullAccessForSource(botId, threadId) {
|
|
3116
3125
|
return sourceApprovalMode(botId, threadId) === "full";
|
|
3117
3126
|
}
|
|
3127
|
+
/** Limix: tells a bot which teammates share its desktop or its department folder, so they can split work on the same files. */
|
|
3128
|
+
function limixTeamDesktopNote(bot) {
|
|
3129
|
+
if (localVmMode(cfg) !== "per-bot")
|
|
3130
|
+
return "";
|
|
3131
|
+
const team = teamDesktopKey(bot);
|
|
3132
|
+
const mates = (shared) => store.bots.filter((other) => other.id !== bot.id && !other.hidden && teamDesktopKey(other) === team
|
|
3133
|
+
&& (shared ? other.desktopTeam : other.desktopTeamFolder && !other.desktopTeam)).map((other) => `@${other.name}`);
|
|
3134
|
+
if (bot.desktopTeam) {
|
|
3135
|
+
const names = mates(true);
|
|
3136
|
+
return ` This desktop is your department's: ${names.length ? names.join(", ") + " use" : "teammates who join use"} it too, one at a time, so leave files and windows tidy for them.`;
|
|
3137
|
+
}
|
|
3138
|
+
if (!bot.desktopTeamFolder)
|
|
3139
|
+
return "";
|
|
3140
|
+
const names = mates(false);
|
|
3141
|
+
return ` Your desktop also has ${TEAM_FOLDER_GUEST}, a folder shared with ${names.length ? names.join(", ") : "your department's bots that join it"}, each on their own desktop; work there on shared files and tell them with coordinate_bots what you changed.`;
|
|
3142
|
+
}
|
|
3143
|
+
/** Limix: a bot with its own desktop that joined its department's folder gets that folder mounted when the desktop is created. */
|
|
3144
|
+
function localVmTeamFolderFor(target) {
|
|
3145
|
+
if (!target.key.startsWith("bot:"))
|
|
3146
|
+
return undefined;
|
|
3147
|
+
const bot = store.bots.find((candidate) => perBotLocalVmTarget(candidate.id).key === target.key);
|
|
3148
|
+
return bot?.desktopTeamFolder && !bot.desktopTeam ? teamFolderDir(teamDesktopKey(bot)) : undefined;
|
|
3149
|
+
}
|
|
3150
|
+
/** Limix: a bot's own desktop takes that bot's size when it set one; the shared and pooled desktops keep the workspace's. */
|
|
3151
|
+
function localVmResourcesFor(target) {
|
|
3152
|
+
if (target.key.startsWith("team:")) {
|
|
3153
|
+
const team = [...new Set(store.bots.filter((candidate) => candidate.desktopTeam).map(teamDesktopKey))].find((key) => teamLocalVmTarget(key).key === target.key);
|
|
3154
|
+
const capacity = limixVmCapacity(localVmResources(cfg));
|
|
3155
|
+
const { chosen: _chosen, ...size } = teamDesktopResources(localVmResources(cfg), team === undefined ? [] : teamDesktopMembers(store.bots, team), capacity);
|
|
3156
|
+
return size;
|
|
3157
|
+
}
|
|
3158
|
+
const bot = target.key.startsWith("bot:") ? store.bots.find((candidate) => perBotLocalVmTarget(candidate.id).key === target.key) : undefined;
|
|
3159
|
+
return withBotDesktopResources(localVmResources(cfg), bot);
|
|
3160
|
+
}
|
|
3161
|
+
/** Limix: bot and team changes the assistant proposes always wait for the person's decision on a card. */
|
|
3162
|
+
function limixProposalsWaitForReview() { return null; }
|
|
3118
3163
|
function appliesDirectly(botId, threadId) {
|
|
3119
3164
|
return appliesNow({ fullAccess: fullAccessForSource(botId, threadId), ownerMustConfirm: cloudGuestDriven(threadId) || !connectorThread(botId, threadId) });
|
|
3120
3165
|
}
|
|
@@ -5751,7 +5796,7 @@ let localVmProvisionBusy = false;
|
|
|
5751
5796
|
let localVmModeChangeBusy = false;
|
|
5752
5797
|
const localVmUpdates = createLocalVmUpdater({
|
|
5753
5798
|
status: (target) => containerComputerStatus(undefined, undefined, target),
|
|
5754
|
-
act: (action, target) => containerComputerAction(action, undefined, undefined, target,
|
|
5799
|
+
act: (action, target) => containerComputerAction(action, undefined, undefined, target, localVmResourcesFor(target), () => localVmMaxInstances(cfg), localVmTeamFolderFor(target)),
|
|
5755
5800
|
imageBusy: { get: () => localVmImageBusy, set: (busy) => { localVmImageBusy = busy; } },
|
|
5756
5801
|
provisionBusy: { get: () => localVmProvisionBusy, set: (busy) => { localVmProvisionBusy = busy; } },
|
|
5757
5802
|
lifecycleBusy: localVmLifecycleBusy,
|
|
@@ -6349,7 +6394,11 @@ function claimManagedVpsMutation(containerName) {
|
|
|
6349
6394
|
return claimBotComputerLifecycle(owner.id);
|
|
6350
6395
|
}
|
|
6351
6396
|
function localVmTargetForBot(botId) {
|
|
6352
|
-
|
|
6397
|
+
if (localVmMode(cfg) !== "per-bot")
|
|
6398
|
+
return SHARED_LOCAL_VM_TARGET;
|
|
6399
|
+
const bot = store.bot(botId);
|
|
6400
|
+
// Limix: a bot that opted in shares its department's desktop with the others that did.
|
|
6401
|
+
return bot?.desktopTeam ? teamLocalVmTarget(teamDesktopKey(bot)) : perBotLocalVmTarget(botId);
|
|
6353
6402
|
}
|
|
6354
6403
|
function localVmPoolSeatHolder(seat) {
|
|
6355
6404
|
return localVmLeases.forTarget(poolLocalVmTarget(seat).key).current(localVmOwnerBusy);
|
|
@@ -8579,7 +8628,7 @@ async function beginTurn(botId, text, opts) {
|
|
|
8579
8628
|
}
|
|
8580
8629
|
const computerPromptKind = resolveComputerPromptKind({
|
|
8581
8630
|
kind: computerKind,
|
|
8582
|
-
vmPrivate: localVmMode(cfg) === "per-bot",
|
|
8631
|
+
vmPrivate: localVmMode(cfg) === "per-bot" && !bot.desktopTeam,
|
|
8583
8632
|
});
|
|
8584
8633
|
const coordinationNode = opts?.coordination ? coordinator.node(opts.coordination.id) : undefined;
|
|
8585
8634
|
if (opts?.coordination && (!coordinationNode || coordinationNode.status !== "running" || roomHandoffProblem(coordinationNode, coordinationNode.parentId ? coordinator.node(coordinationNode.parentId) : undefined))) {
|
|
@@ -8601,7 +8650,7 @@ async function beginTurn(botId, text, opts) {
|
|
|
8601
8650
|
}) },
|
|
8602
8651
|
{ id: "files", label: "File locations", text: worksInWorkspace ? workspaceLocationsPrompt(bot.id, cwd, liveBot?.cwd ?? bot.cwd, { attachFile: Boolean(integrations.agents) && !CLOUD_HOME && !HOSTED_WORKSPACE }) : "" },
|
|
8603
8652
|
{ id: "shell", label: "Long-running commands", text: worksInWorkspace ? longCommandsPrompt(computerPromptKind) : "" },
|
|
8604
|
-
{ id: "computer", label: "Computer", text: computerPrompt(computerPromptKind) },
|
|
8653
|
+
{ id: "computer", label: "Computer", text: computerPrompt(computerPromptKind) + (computerPromptKind === "vm-private" || computerPromptKind === "vm-shared" ? limixTeamDesktopNote(bot) : "") },
|
|
8605
8654
|
{ id: "team-computer", label: "Team computer", text: teamComputerPrompt(teamComputer) },
|
|
8606
8655
|
{ id: "plan", label: "Surface", text: surfacePrompt({ computer: mountedComputer, browser: Boolean(integrations.browser) }, { pinned: plan.pinned, note: plan.note + vpsUnavailableNote + vmUpdateNote + (computerSkipped && plan.computer !== "off" ? computerSkippedNote(redactSecretsInText(computerSkipped)) : "") + (computerSelectionTurns.get(threadId)?.handoff && !integrations.browser ? HANDOFF_BROWSER_NOTE : ""), canSelect: computerSelectionTurns.has(threadId) && !computerSelectionTurns.get(threadId)?.handoff, cloudHome: Boolean(CLOUD_HOME), botOpened: plan.botOpened, ownComputer: CLOUD_HOME && integrations.agents && lendingEnabled() ? sharedComputers.known(CLOUD_HOME_LENDER) : undefined }) },
|
|
8607
8656
|
{ id: "cloud-home", label: "My Cloud", text: CLOUD_HOME ? cloudHomePrompt(Boolean(integrations.agents) && lendingEnabled(), syncedFolders(DATA_DIR), sharedComputers.known(CLOUD_HOME_LENDER), CLOUD_PERSONAL) + firstHourHooks.prompt(bot.id, threadId) : "" }, phoneLinkPart(),
|
|
@@ -9525,7 +9574,16 @@ const modelRequests = new ModelRequestService({
|
|
|
9525
9574
|
const teamSetupTeams = () => [...new Set(["", ...readSections(), ...store.bots.map((bot) => sectionKey(bot.section)), ...store.groups.map((group) => sectionKey(group.section))])];
|
|
9526
9575
|
const teamSetupRequests = new TeamSetupRequestService({
|
|
9527
9576
|
store, teams: teamSetupTeams, hasTeamAuthority, canPersist: proposalPersistence, maxBots: MAX_WORKSPACE_BOTS,
|
|
9528
|
-
autoApply:
|
|
9577
|
+
autoApply: limixProposalsWaitForReview,
|
|
9578
|
+
createRoom: (request, botIds) => {
|
|
9579
|
+
const chief = store.bot(request.botId);
|
|
9580
|
+
if (!chief || chief.hidden)
|
|
9581
|
+
throw new TeamSetupError("The assistant that proposed this group chat is no longer active", 409);
|
|
9582
|
+
const group = createChannel({ name: redactSecretsInText(request.room.name), memberIds: [...new Set([chief.id, ...botIds])], section: chief.section,
|
|
9583
|
+
setup: { bulletin: "", defaultResponder: deciderReady(cfg, "roomRouting") ? { kind: "auto", fallbackBotId: chief.id } : { kind: "member", botId: chief.id } } });
|
|
9584
|
+
broadcast({ kind: "group", group: publicGroupState(group) });
|
|
9585
|
+
return { id: group.id, name: group.name };
|
|
9586
|
+
},
|
|
9529
9587
|
validateChange: (before, fields) => assertTeamComputerChangeIdle(before, { ...before, ...fields }),
|
|
9530
9588
|
ownsThread: (botId, threadId) => Boolean(connectorThread(botId, threadId)),
|
|
9531
9589
|
targetBusy: (botId, sourceThreadId) => {
|
|
@@ -10425,7 +10483,7 @@ setupRetry = 0) {
|
|
|
10425
10483
|
recordTurnPlace(bot.id, threadId, (roomTeamComputer ? "cloud" : roomVmTarget ? "vm" : surfaceOfComputerKind(roomComputerKind)) ?? (integrations.browser ? "browser" : null));
|
|
10426
10484
|
const roomComputerPromptKind = resolveComputerPromptKind({
|
|
10427
10485
|
kind: roomTeamComputer || roomComputerKind === "box" ? "box" : roomVmTarget ? "vm" : roomComputerKind,
|
|
10428
|
-
vmPrivate: localVmMode(cfg) === "per-bot",
|
|
10486
|
+
vmPrivate: localVmMode(cfg) === "per-bot" && !bot.desktopTeam,
|
|
10429
10487
|
});
|
|
10430
10488
|
{
|
|
10431
10489
|
const crossing = claimRecallCrossings(threadId, recentLines.filter((line) => line.private).map((line) => line.threadId));
|
|
@@ -10448,7 +10506,7 @@ setupRetry = 0) {
|
|
|
10448
10506
|
{ id: "files", label: "File locations", text: workspace ? workspaceLocationsPrompt(bot.id, cwd, readyBot.cwd, { attachFile: Boolean(integrations.agents) && !CLOUD_HOME && !HOSTED_WORKSPACE }) : "" },
|
|
10449
10507
|
{ id: "shell", label: "Long-running commands", text: workspace ? longCommandsPrompt(roomComputerPromptKind) : "" },
|
|
10450
10508
|
{ id: "mcp", label: "MCP servers", text: customMcpPrompt(Object.keys(integrations.custom ?? {}), mcpServersHost.off(bot)) + teamConnections.prompt(threadId, internalGeneration, integrations) },
|
|
10451
|
-
{ id: "computer", label: "Computer", text: computerPrompt(roomComputerPromptKind) },
|
|
10509
|
+
{ id: "computer", label: "Computer", text: computerPrompt(roomComputerPromptKind) + (roomComputerPromptKind === "vm-private" || roomComputerPromptKind === "vm-shared" ? limixTeamDesktopNote(bot) : "") },
|
|
10452
10510
|
{ id: "team-computer", label: "Team computer", text: teamComputerPrompt(roomTeamComputer) },
|
|
10453
10511
|
{ id: "plan", label: "Surface", text: surfacePrompt({ computer: roomTeamComputer ? "cloud" : roomVmTarget ? "vm" : surfaceOfComputerKind(roomComputerKind), browser: Boolean(integrations.browser) }, { note: roomPlan.note, cloudHome: Boolean(CLOUD_HOME), ownComputer: CLOUD_HOME && integrations.agents && lendingEnabled() ? sharedComputers.known(CLOUD_HOME_LENDER) : undefined }) },
|
|
10454
10512
|
{ id: "cloud-home", label: "My Cloud", text: CLOUD_HOME ? cloudHomePrompt(Boolean(integrations.agents) && lendingEnabled(), syncedFolders(DATA_DIR), sharedComputers.known(CLOUD_HOME_LENDER), CLOUD_PERSONAL) : "" }, phoneLinkPart(),
|
|
@@ -11882,7 +11940,7 @@ async function readyLocalVmForTurn(botId, target, isCurrent = () => true) {
|
|
|
11882
11940
|
return status;
|
|
11883
11941
|
broadcast({ kind: "computer", botId, state: "provisioning" });
|
|
11884
11942
|
try {
|
|
11885
|
-
status = await containerComputerAction(action, undefined, undefined, target,
|
|
11943
|
+
status = await containerComputerAction(action, undefined, undefined, target, localVmResourcesFor(target), () => localVmMaxInstances(cfg), localVmTeamFolderFor(target));
|
|
11886
11944
|
}
|
|
11887
11945
|
catch {
|
|
11888
11946
|
// `run` can throw after the container exists, so arm the idle backstop anyway.
|
|
@@ -11977,6 +12035,7 @@ function configStatus() {
|
|
|
11977
12035
|
automaticCapacity: localVmAutomaticCapacity(cfg),
|
|
11978
12036
|
idleTimeoutMinutes: localVmIdleTimeoutMinutes(cfg),
|
|
11979
12037
|
preserveInstalledApps: localVmPreservesInstalledApps(cfg),
|
|
12038
|
+
resources: localVmResources(cfg),
|
|
11980
12039
|
},
|
|
11981
12040
|
features: {
|
|
11982
12041
|
skillAuthoring: skillAuthoringEnabled(cfg),
|
|
@@ -12904,6 +12963,8 @@ const handleRequest = async (req, res) => {
|
|
|
12904
12963
|
if (await emailSignInRoute({ cloudHome: Boolean(CLOUD_HOME), emailSignIn, sessions, cookieName: SESSION_COOKIE, target: (r) => signInMailTarget(publicUrl(), requestOrigin(r)),
|
|
12905
12964
|
environment: () => environmentDescriptor({ environmentId: ENVIRONMENT_ID, ...TEAM_LABEL, desktopManaged: DESKTOP_MANAGED, emailSignIn: true, sharedComputers: lendingEnabled() }) }, req, res, path, method))
|
|
12906
12965
|
return;
|
|
12966
|
+
if (limixManagedGrant && await limixManagedGrant.handle(req, res, path, method))
|
|
12967
|
+
return;
|
|
12907
12968
|
if ((cloudSigned && await cloudSigned({ req, res, url, path, method })) || chatApps.serveFile(req, res, path, method))
|
|
12908
12969
|
return;
|
|
12909
12970
|
if (method === "POST" && path === "/api/auth/pair") {
|
|
@@ -13914,7 +13975,7 @@ const handleRequest = async (req, res) => {
|
|
|
13914
13975
|
return json(res, 201, proposed);
|
|
13915
13976
|
}
|
|
13916
13977
|
if (await dispatchRoutes([createBurstProposalRoutes({ requireActive: requireActiveInternalCapability, readBody: readInternalBody, refusal: () => burstProposalRefusal({ owner: connectorThread(internalSender.id, internalCapability.threadId), outside: outsideWorkStaysHere(internalCapability.threadId), self: selfThreadRefusal({ handoff: Boolean(internalCapability.roomHandoffId), requestLine: store.activePath(internalCapability.threadId).findLast((line) => line.role === "user" && line.kind === "text") }) }), model: () => burst.model(internalSender, internalCapability.threadId), propose: (plan) => burst.propose({ ...plan, botId: internalSender.id, threadId: internalCapability.threadId }) }), createInternalChiefTeamRoutes({ bot: () => store.bot(internalCapability.botId), requireActive: requireActiveInternalCapability,
|
|
13917
|
-
teams: teamSetupTeams, bots: () => store.bots, instances: () => registry.describe() }), createInternalModelRoutes({ requireActive: requireActiveInternalCapability, menu: (search) => ownThreads.menu(internalCapability.botId, internalCapability.threadId, search) })], { req, res, url, path, method, auth, json, readBody }))
|
|
13978
|
+
teams: teamSetupTeams, bots: () => store.bots, instances: () => registry.describe(), channels: limixGatewayConnections }), createInternalModelRoutes({ requireActive: requireActiveInternalCapability, menu: (search) => ownThreads.menu(internalCapability.botId, internalCapability.threadId, search) })], { req, res, url, path, method, auth, json, readBody }))
|
|
13918
13979
|
return;
|
|
13919
13980
|
if (method === "POST" && path === "/api/internal/team-setup-requests") {
|
|
13920
13981
|
const parsed = z.object({ fromBotId: z.string().optional(), fromThreadId: z.string().optional(), plan: z.unknown() }).strict().safeParse(await readInternalBody());
|
|
@@ -14750,7 +14811,7 @@ const handleRequest = async (req, res) => {
|
|
|
14750
14811
|
source: "appliedBy" in proposed ? proposed.appliedBy : "profile" });
|
|
14751
14812
|
}
|
|
14752
14813
|
if (proposed.state === "pending")
|
|
14753
|
-
return json(res, 201, proposed);
|
|
14814
|
+
return json(res, 201, { ...proposed, ...(botNameClash.warning(name) ? { warning: botNameClash.warning(name) } : {}) });
|
|
14754
14815
|
const createdId = "result" in proposed ? proposed.result.bots.find((bot) => bot.action === "created")?.id : undefined;
|
|
14755
14816
|
const created = createdId ? store.bot(createdId) : undefined;
|
|
14756
14817
|
if (!created)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DEFAULT_BOT_NAME, LEGACY_DEFAULT_BOT_NAMES } from "../shared/default-bot.js";
|
|
2
|
+
const plain = (name) => name.trim().toLowerCase();
|
|
3
|
+
/** The built-in helper takes the current name only while it still has an old default one; a name the person chose stays. */
|
|
4
|
+
export function renameLegacyDefaultBots(store) {
|
|
5
|
+
const legacy = new Set(LEGACY_DEFAULT_BOT_NAMES.map(plain));
|
|
6
|
+
const renamed = [];
|
|
7
|
+
for (const bot of store.bots) {
|
|
8
|
+
if (!bot.defaultBot || !legacy.has(plain(bot.name)))
|
|
9
|
+
continue;
|
|
10
|
+
const section = bot.section?.trim() ?? "";
|
|
11
|
+
const taken = store.bots.some((other) => other.id !== bot.id && !other.defaultBot && !other.hidden && (other.section?.trim() ?? "") === section && plain(other.name) === plain(DEFAULT_BOT_NAME));
|
|
12
|
+
if (taken)
|
|
13
|
+
continue;
|
|
14
|
+
store.patchBot(bot.id, { name: DEFAULT_BOT_NAME });
|
|
15
|
+
renamed.push(bot.id);
|
|
16
|
+
}
|
|
17
|
+
return renamed;
|
|
18
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { readFileSync, writeFileSync, renameSync, mkdirSync, existsSync } from "node:fs";
|
|
3
3
|
import { dirname } from "node:path";
|
|
4
|
+
// oxlint-disable-next-line no-control-regex -- control characters are exactly what this refuses
|
|
4
5
|
const id = z.string().min(1).max(200).regex(/^[^\x00-\x1f]+$/);
|
|
5
6
|
export const channelConversationSchema = z.object({
|
|
6
7
|
connectionId: id, platform: z.enum(["telegram", "zalo", "discord", "facebook"]),
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
2
2
|
import { basename, dirname, resolve } from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { ATTACHMENTS_DIR, deleteAttachment, saveFile, saveImage } from "./attachments.js";
|
|
5
|
-
|
|
4
|
+
import { ATTACHMENTS_DIR, deleteAttachment, IMAGE_MAX_BYTES, saveFile, saveImage } from "./attachments.js";
|
|
5
|
+
// Limix: up to what the platforms carry (Telegram sends 50 MB a file); files ride as base64 in one JSON body, so a
|
|
6
|
+
// message holds at most this much in all, however many files.
|
|
7
|
+
export const CHANNEL_MEDIA_MAX_BYTES = 200 * 1024 * 1024;
|
|
6
8
|
export const channelAttachmentSchema = z.object({
|
|
9
|
+
// oxlint-disable-next-line no-control-regex -- control characters are exactly what this refuses
|
|
7
10
|
name: z.string().min(1).max(200).refine((s) => !/[\\/\x00-\x1f]/.test(s), "Use a filename, not a path"),
|
|
8
11
|
mime: z.string().min(1).max(128),
|
|
9
|
-
|
|
12
|
+
// A plain character-class test: a grouped repeat runs out of stack on a file this large.
|
|
13
|
+
data: z.string().min(4).max(Math.ceil(CHANNEL_MEDIA_MAX_BYTES / 3) * 4)
|
|
14
|
+
.refine((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/.test(value), "Send the file as base64"),
|
|
10
15
|
});
|
|
11
16
|
const attribute = (s) => s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
12
17
|
export async function saveChannelAttachments(items) {
|
|
13
18
|
if (items.reduce((sum, item) => sum + Buffer.byteLength(item.data, "base64"), 0) > CHANNEL_MEDIA_MAX_BYTES) {
|
|
14
|
-
throw Object.assign(new Error("Attachments exceed
|
|
19
|
+
throw Object.assign(new Error("Attachments exceed 200 MB per message"), { status: 413, forCaller: true });
|
|
15
20
|
}
|
|
16
21
|
const saved = [];
|
|
17
22
|
try {
|
|
18
23
|
for (const item of items) {
|
|
19
24
|
const bytes = Buffer.from(item.data, "base64");
|
|
20
|
-
|
|
25
|
+
// A photo larger than the chat preview takes is kept as a file.
|
|
26
|
+
if (item.mime.startsWith("image/") && bytes.byteLength <= IMAGE_MAX_BYTES) {
|
|
21
27
|
saved.push({ ...saveImage(bytes, item.mime), kind: "image", name: item.name });
|
|
22
28
|
}
|
|
23
29
|
else {
|
|
@@ -49,7 +55,7 @@ export function channelReplyAttachments(lines) {
|
|
|
49
55
|
if (dirname(path) !== resolve(ATTACHMENTS_DIR) || lstatSync(path).isSymbolicLink() || dirname(realpathSync(path)) !== realpathSync(ATTACHMENTS_DIR))
|
|
50
56
|
throw new Error("not an attachment");
|
|
51
57
|
const stat = lstatSync(path);
|
|
52
|
-
if (!stat.isFile() ||
|
|
58
|
+
if (!stat.isFile() || total + stat.size > CHANNEL_MEDIA_MAX_BYTES)
|
|
53
59
|
throw new Error("too large");
|
|
54
60
|
const data = readFileSync(path);
|
|
55
61
|
total += data.length;
|