limixbot 0.3.40 → 0.3.42

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.
Files changed (131) hide show
  1. package/dist/assets/{ActivityPanel-C78UlJ_B.js → ActivityPanel-DCma9uyE.js} +1 -1
  2. package/dist/assets/{App-DoK6OnP_.js → App-DXJc2BkK.js} +76 -76
  3. package/dist/assets/{AppEventEditor-CrUG4a3D.js → AppEventEditor--1r4Rhb5.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog-CvcYYLw-.js → BotSettingsDialog-C2GUAtVy.js} +1 -1
  5. package/dist/assets/{BrowserPanel-CCfO4ItU.js → BrowserPanel-yYQciSsv.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-BfuF_oUa.js → BrowserProfilesManager-J4frwtTk.js} +1 -1
  7. package/dist/assets/{CloudAddDialog-DSqiG9RZ.js → CloudAddDialog-CWG_5f_5.js} +1 -1
  8. package/dist/assets/{ComputerFilesPane-q5cwxKow.js → ComputerFilesPane-DhJI4EDI.js} +1 -1
  9. package/dist/assets/{ComputerPanel-Cqw5ivpE.js → ComputerPanel-BRoVU_JM.js} +2 -2
  10. package/dist/assets/{DataPanel-CI_7GCCI.js → DataPanel-BswXe1SS.js} +1 -1
  11. package/dist/assets/{DesktopViewer-BX0YJJ9T.js → DesktopViewer-aVjkMSMD.js} +1 -1
  12. package/dist/assets/{FilesView-CePiPQtk.js → FilesView-KlQYYEex.js} +1 -1
  13. package/dist/assets/{GrokMoveDialog-plHjPcxW.js → GrokMoveDialog-B5A_vTNG.js} +1 -1
  14. package/dist/assets/{InspectorPanel-BtJWpmNb.js → InspectorPanel-pu2nQso0.js} +1 -1
  15. package/dist/assets/{KeyboardShortcutsModal-CvI39Dyv.js → KeyboardShortcutsModal-Ba53-9RO.js} +1 -1
  16. package/dist/assets/{LiveDesktop-CWCNNVVb.js → LiveDesktop-DcAhBYbR.js} +1 -1
  17. package/dist/assets/{LocalVmWorkspace-Dj0D8KZg.js → LocalVmWorkspace-CdQ9A3co.js} +1 -1
  18. package/dist/assets/{MacLocalControl-DI9rmipM.js → MacLocalControl-BwhiID40.js} +1 -1
  19. package/dist/assets/{MarkdownFilePreview-C2wq8ggW.js → MarkdownFilePreview-BnHovW53.js} +1 -1
  20. package/dist/assets/{MenuMotion-9KpZfoc6.js → MenuMotion-DYvg3Y0j.js} +1 -1
  21. package/dist/assets/{NewBotDialog-yH4tNqbg.js → NewBotDialog-BN31PKyf.js} +1 -1
  22. package/dist/assets/{PhoneAppDialog-C7-lv79J.js → PhoneAppDialog-BPu4Ooi9.js} +1 -1
  23. package/dist/assets/{PlacesRail-DgLRkWzN.js → PlacesRail-lvsLiimN.js} +1 -1
  24. package/dist/assets/{PluginsPanel-BjhDlFfS.js → PluginsPanel-xz9u_V9X.js} +1 -1
  25. package/dist/assets/{ProIntroduction-CX5wa_L9.js → ProIntroduction-S1AIId97.js} +1 -1
  26. package/dist/assets/{RemoteAgentSettingsPanel-uKPEbc5u.js → RemoteAgentSettingsPanel-DrB6J9TX.js} +1 -1
  27. package/dist/assets/{RoomPanel-CUN0w3uU.js → RoomPanel-BLefAXNP.js} +1 -1
  28. package/dist/assets/{RoutinesPage-C1DsUtyJ.js → RoutinesPage-bbG1WhCI.js} +1 -1
  29. package/dist/assets/{SettingsModal-Ly5CgfzY.js → SettingsModal-BN25csS0.js} +4 -4
  30. package/dist/assets/{ShareTeamDialog-bekuOz52.js → ShareTeamDialog-D6LqWTAK.js} +1 -1
  31. package/dist/assets/{SignedInSites-B3Pypdn7.js → SignedInSites-cV_GRWs2.js} +1 -1
  32. package/dist/assets/{TeamLibraryPanel-D6jp7yJH.js → TeamLibraryPanel-GpP3Y3QX.js} +1 -1
  33. package/dist/assets/{TeamMapPage-Ds-NTRhm.js → TeamMapPage-BX3AQz4A.js} +1 -1
  34. package/dist/assets/{TriggersPage-B9I-fybZ.js → TriggersPage-B1ZBCBQR.js} +1 -1
  35. package/dist/assets/{VisibilitySection-Bmoy4R5T.js → VisibilitySection-HEBpPuJS.js} +1 -1
  36. package/dist/assets/{WebhookTrigger-D222Fm7h.js → WebhookTrigger-DiSLV5TC.js} +1 -1
  37. package/dist/assets/{WorksOnGrid-Ihbs1ZDY.js → WorksOnGrid-D35BZJQ-.js} +1 -1
  38. package/dist/assets/{abnfDiagram-YUKMZFIV-iRkRRTmn.js → abnfDiagram-YUKMZFIV-CBW50M4i.js} +1 -1
  39. package/dist/assets/{activity-D3yGGWz9.js → activity-Do2k3mZG.js} +1 -1
  40. package/dist/assets/{architectureDiagram-47P4ROYG-B-l-Tbc0.js → architectureDiagram-47P4ROYG-COydFAli.js} +1 -1
  41. package/dist/assets/{blockDiagram-E7TT5TSB-BPHNVO2-.js → blockDiagram-E7TT5TSB-Bdo2_X9c.js} +1 -1
  42. package/dist/assets/{c4Diagram-CRA5TL53-Ces14mNL.js → c4Diagram-CRA5TL53-BYk2S2UT.js} +1 -1
  43. package/dist/assets/{calendar-days-DNgw_jzq.js → calendar-days-BeTMH5fp.js} +1 -1
  44. package/dist/assets/channel-B9n_GxPq.js +1 -0
  45. package/dist/assets/{chunk-2Q5K7J3B-BBv2HgLY.js → chunk-2Q5K7J3B-DOtIddN3.js} +1 -1
  46. package/dist/assets/{chunk-5VM5RSS4-Ms8vx6uj.js → chunk-5VM5RSS4-B4C7BoQt.js} +1 -1
  47. package/dist/assets/{chunk-7TKQ45FW-CoQ_n3fY.js → chunk-7TKQ45FW-B0BHWucP.js} +1 -1
  48. package/dist/assets/{chunk-AW2ZBBNX-CLnH6qE9.js → chunk-AW2ZBBNX-CJrwE9R9.js} +1 -1
  49. package/dist/assets/{chunk-FVRAUYC3-CzEI0PkV.js → chunk-FVRAUYC3-DF93Bqmk.js} +2 -2
  50. package/dist/assets/{chunk-HTAEGDNF-tQeKhP4P.js → chunk-HTAEGDNF-la8NgRgV.js} +1 -1
  51. package/dist/assets/{chunk-JWPE2WC7-Bels7hbY.js → chunk-JWPE2WC7-L0lPJGK0.js} +1 -1
  52. package/dist/assets/{chunk-KQW6MTUR-C_OPTqju.js → chunk-KQW6MTUR-DqtGsigA.js} +1 -1
  53. package/dist/assets/{chunk-XXDRQBXY-lLPvGZOB.js → chunk-XXDRQBXY-CdZZyfPW.js} +1 -1
  54. package/dist/assets/{classDiagram-v2-K4WV4PDN-DEGC9KSb.js → classDiagram-v2-K4WV4PDN-BmzBwOGd.js} +1 -1
  55. package/dist/assets/{coins-BUPhLqLr.js → coins-S-i07yhx.js} +1 -1
  56. package/dist/assets/{core-Cmvm9EBY.js → core-CQDnfyPc.js} +1 -1
  57. package/dist/assets/{cose-bilkent-JH36ORCC-B4guJJ7b.js → cose-bilkent-JH36ORCC-DKZB2O3B.js} +1 -1
  58. package/dist/assets/{cynefin-EF2NZ3EQ-DzL2Ko-S.js → cynefin-EF2NZ3EQ-B6pmxRta.js} +1 -1
  59. package/dist/assets/{cynefinDiagram-3GCD6N5R-DOhRhSCa.js → cynefinDiagram-3GCD6N5R-B13ZC2BI.js} +1 -1
  60. package/dist/assets/{dagre-W4DXFKR2-ClVlfmbp.js → dagre-W4DXFKR2-BGVzBIbu.js} +1 -1
  61. package/dist/assets/{diagram-2UJZ2QOL-CCORQMGQ.js → diagram-2UJZ2QOL-DYi3uAFS.js} +1 -1
  62. package/dist/assets/{diagram-OVF4WLC6-BA05pSeN.js → diagram-OVF4WLC6-CC_ICBIc.js} +1 -1
  63. package/dist/assets/{diagram-PFPMY2P6-Buk95mAY.js → diagram-PFPMY2P6-aCEZHESH.js} +1 -1
  64. package/dist/assets/{diagram-UMYRVEAY-C_N8yC5C.js → diagram-UMYRVEAY-CvmaQeZP.js} +1 -1
  65. package/dist/assets/{diagram-YEKJPTXX-BcGFdDU0.js → diagram-YEKJPTXX-1fMOPjTt.js} +1 -1
  66. package/dist/assets/{diagram-ZIFT7M5P-CrsI0m0f.js → diagram-ZIFT7M5P-qc3RhTvH.js} +1 -1
  67. package/dist/assets/{ebnfDiagram-VR2GEFS7-ZuofO3J3.js → ebnfDiagram-VR2GEFS7-B_u7ZpcW.js} +1 -1
  68. package/dist/assets/{elk-IJKZMXRS-B9HPBoMc.js → elk-IJKZMXRS-TGCsQDlL.js} +1 -1
  69. package/dist/assets/{erDiagram-O2IAPWRE-yblUS7CX.js → erDiagram-O2IAPWRE-BKMwoO3H.js} +1 -1
  70. package/dist/assets/{file-up-CJGgT920.js → file-up-DbsojZOa.js} +1 -1
  71. package/dist/assets/{flowDiagram-OXPTDLAJ-BoRQKWEE.js → flowDiagram-OXPTDLAJ-ByQ8sl5K.js} +1 -1
  72. package/dist/assets/{ganttDiagram-R7TSEDQI-Mqmf_lTP.js → ganttDiagram-R7TSEDQI-BO5jsZ4i.js} +1 -1
  73. package/dist/assets/{gitGraphDiagram-XJZIOB7I-ChOVYU-I.js → gitGraphDiagram-XJZIOB7I-B22KG2ho.js} +1 -1
  74. package/dist/assets/{import-name-D_O0Z9qB.js → import-name-BN3ehFKr.js} +1 -1
  75. package/dist/assets/{index-BvjpOIdn.js → index-DTwv-3kB.js} +1 -1
  76. package/dist/assets/{index-BNuCZ6CX.js → index-Dx025Lvw.js} +2 -2
  77. package/dist/assets/{infoDiagram-5W2HQ5XZ-DzVrRFee.js → infoDiagram-5W2HQ5XZ-HdwUwMOS.js} +1 -1
  78. package/dist/assets/{ishikawaDiagram-K3B6WC7H-B1AtMtWp.js → ishikawaDiagram-K3B6WC7H-CoAJTIyF.js} +1 -1
  79. package/dist/assets/{journeyDiagram-COXZFDF6-D98AinIQ.js → journeyDiagram-COXZFDF6-DHyU5Xir.js} +1 -1
  80. package/dist/assets/{kanban-definition-P3RFRI5V-DyF07Cia.js → kanban-definition-P3RFRI5V-RgsXG5FT.js} +1 -1
  81. package/dist/assets/{mcp-servers-CWLCIWVv.js → mcp-servers-BW3-oEJ-.js} +1 -1
  82. package/dist/assets/{mermaid.core-BkGLuasi.js → mermaid.core-BpAUyD7f.js} +4 -4
  83. package/dist/assets/{mindmap-definition-LZFPQGKD-CtEZ4egD.js → mindmap-definition-LZFPQGKD-CTf8RGLd.js} +1 -1
  84. package/dist/assets/{minimize-D02to6Fy.js → minimize-B34Shsdr.js} +1 -1
  85. package/dist/assets/{monitor-cPSwTZbh.js → monitor-BS4ugqnK.js} +1 -1
  86. package/dist/assets/{new-bot-BAm0i3N-.js → new-bot-CvJdQAVP.js} +1 -1
  87. package/dist/assets/{org-library-CVRs5XpH.js → org-library-9HkPvWAd.js} +1 -1
  88. package/dist/assets/{package-format-nP_LfEpp.js → package-format-DGcr7zou.js} +1 -1
  89. package/dist/assets/{pegDiagram-BGZESJAR-BA9RLREu.js → pegDiagram-BGZESJAR-B4QXE8kd.js} +1 -1
  90. package/dist/assets/{pieDiagram-CAPJLFHJ-BR2mMjlL.js → pieDiagram-CAPJLFHJ-Rkmvk88E.js} +1 -1
  91. package/dist/assets/{quadrantDiagram-GDMTTRAM-F5WV656C.js → quadrantDiagram-GDMTTRAM-_jDgqTi0.js} +1 -1
  92. package/dist/assets/{rail-C4RLSvjm.js → rail-CNXlLBbY.js} +1 -1
  93. package/dist/assets/{railroadDiagram-SM67HX2B-Cd6uxfxc.js → railroadDiagram-SM67HX2B-BLkj9MvC.js} +1 -1
  94. package/dist/assets/{remote-desktop-panel-eUh-91Nm.js → remote-desktop-panel-CWPzFIRb.js} +1 -1
  95. package/dist/assets/{requirementDiagram-X7JNWC4A-Cfo_0cMh.js → requirementDiagram-X7JNWC4A-Bgsg8iiY.js} +1 -1
  96. package/dist/assets/{sankeyDiagram-UM26HJRW-TDjyYx-y.js → sankeyDiagram-UM26HJRW-B1TLh0eZ.js} +1 -1
  97. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Ko062Fce.js → sequenceDiagram-ZO4K6R2Y-CO__-6Wr.js} +1 -1
  98. package/dist/assets/{sizeCapture-INFHLROL-BrrtOSNi.js → sizeCapture-INFHLROL-BI46RDzq.js} +1 -1
  99. package/dist/assets/{stateDiagram-v2-TBUQTH76-B1qzPqwN.js → stateDiagram-v2-TBUQTH76-OzLDaTpE.js} +1 -1
  100. package/dist/assets/{styles-CYPAO9i1.js → styles-CewcaVc5.js} +2 -2
  101. package/dist/assets/{swimlanes-N4OXWK64-Dsuqhiei.js → swimlanes-N4OXWK64-CsPs93Ij.js} +1 -1
  102. package/dist/assets/swimlanesDiagram-K3J5GTZL-DUfFJSi9.js +8 -0
  103. package/dist/assets/{team-share-zViFUsSH.js → team-share-BjJaxqdW.js} +1 -1
  104. package/dist/assets/{timeline-definition-YOQAKGHF-zBd8HYLV.js → timeline-definition-YOQAKGHF-_ZwJoWnd.js} +1 -1
  105. package/dist/assets/{usecaseDiagram-VIAY4XPW-DkA9LTMv.js → usecaseDiagram-VIAY4XPW-BC05iPIW.js} +1 -1
  106. package/dist/assets/{vennDiagram-BLWOH2XV-BU2g61ns.js → vennDiagram-BLWOH2XV-xgthUL1H.js} +1 -1
  107. package/dist/assets/vi-DcBzysyy.js +15 -0
  108. package/dist/assets/{wardleyDiagram-YMQ3BMBF-Bigp2Sxm.js → wardleyDiagram-YMQ3BMBF-BLcV7LRh.js} +1 -1
  109. package/dist/assets/{xychartDiagram-TAQBALBS-DrSgdkAt.js → xychartDiagram-TAQBALBS-C2IwACfF.js} +1 -1
  110. package/dist/index.html +2 -2
  111. package/dist/rail.html +4 -4
  112. package/dist-server/index.js +2815 -2799
  113. package/dist-server/openmausbot.js +32 -32
  114. package/dist-server/package.json +1 -1
  115. package/dist-server/pair-cli.js +32 -32
  116. package/dist-server/server/agents-turn.js +1 -1
  117. package/dist-server/server/bot-api-host.js +20 -12
  118. package/dist-server/server/bot-visibility.js +6 -2
  119. package/dist-server/server/host/visibility-host.js +4 -1
  120. package/dist-server/server/index.js +25 -6
  121. package/dist-server/server/limix-channel-identity.js +41 -0
  122. package/dist-server/server/limix-channel-review.js +53 -0
  123. package/dist-server/server/limix-image-routing.js +9 -0
  124. package/dist-server/server/routes/bot-messages.js +3 -0
  125. package/dist-server/server/routes/image-tools.js +1 -1
  126. package/dist-server/server/system-prompt.js +2 -0
  127. package/dist-server/shared/bot-api.js +1 -0
  128. package/package.json +1 -1
  129. package/dist/assets/channel-CLFluAXE.js +0 -1
  130. package/dist/assets/swimlanesDiagram-K3J5GTZL-Ck2z47VC.js +0 -8
  131. package/dist/assets/vi-D2CCwYiV.js +0 -15
@@ -1,3 +1,7 @@
1
+ import { imageConnectorRefusal } from "./limix-image-routing.js";
2
+ import { channelReviewRoute, channelReviewUntil } from "./limix-channel-review.js";
3
+ import { ChannelIdentityRegistry } from "./limix-channel-identity.js";
4
+ import { BOT_API_INTERNAL_CHAT_REQUIRED } from "../shared/bot-api.js";
1
5
  // Import first: it reads a Cloud home's secrets off the launcher's pipe before any module can start a process.
2
6
  import { BOOT_CLOUD_SECRETS } from "./cloud-secrets-boot.js";
3
7
  import { startFailureText } from "./start-failure-text.js";
@@ -1157,8 +1161,7 @@ async function answeringCardAs(auth, threadId, requestId, work, via) {
1157
1161
  }
1158
1162
  const { viewerFor, threadOwner, visibleTo, forgetVisibility, threadShown, subjectVisible, hiddenRoutineTarget, roomFeedsBot, settleRoomFloor } = createVisibilityHost({ store: () => store, routines: () => routines,
1159
1163
  team: Boolean(CLOUD_TEAM), audiencesFor: (viewer) => { const audiences = teamHost.audiencesFor(viewer), person = audiences?.person; return audiences && person ? { ...audiences, routineHome: teamRoutines.home, ownTask: (task) => personRooms.taskForPerson(task, person) } : audiences && { ...audiences, routineHome: teamRoutines.home }; }, threadsReferencing });
1160
- if (CLOUD_TEAM)
1161
- hideOthersSyncFolders(() => store.bots, threadShown);
1164
+ hideOthersSyncFolders(() => store.bots, threadShown);
1162
1165
  const notificationListed = notificationListedFor(threadShown, CLOUD_TEAM ? (auth, entry) => teamOwners.routing.notificationReaches(teamOwners.viewer(auth), entry) : undefined, CLOUD_TEAM ? (auth) => (auth.kind === "session" ? personKey(auth.session) : null) : undefined);
1163
1166
  const botAccess = createBotAccessHost({ visibleFor: (auth) => visibleTo(viewerFor(auth)), store: () => store, routines: () => routines, threadOwner, routineWriter: (id) => cloudRoutineAuthors?.writer(id) }), { levelOf } = botAccess;
1164
1167
  const accessRequests = createAccessRequests({ team: CLOUD_TEAM, store: () => store, people: () => teamOwners.people?.list() ?? [], profileName: (email) => teamHost.people.profile(personKey({ id: "", email })).name, inbox: () => teamMessages.inbox, visibleTo, levelOf, writeAccess: (bot, access) => writeAccess({ store, publicGroupState, broadcast, audienceChanged }, bot, access), record: (row, by) => appendAdminAction(DATA_DIR, { ...row, actor: { kind: "session", sessionId: "", label: by, email: by } }) });
@@ -2241,10 +2244,10 @@ function hasDirectDispatch(botId) {
2241
2244
  return [...directTurnDispatchClaims.values()].some((claim) => claim.botId === botId);
2242
2245
  }
2243
2246
  /** Must match what startTurn admits for a direct thread. */
2244
- function canAdmitDirectTurn(botId, threadId) {
2247
+ function canAdmitDirectTurn(botId, threadId, startedByABot = true) {
2245
2248
  return admit("peer", {}, {
2246
2249
  threadBusy: threadBusy(botId, threadId),
2247
- atCapacity: botAtThreadCapacity(botId, undefined, true),
2250
+ atCapacity: botAtThreadCapacity(botId, threadId, startedByABot),
2248
2251
  groupTurn: Boolean(activeGroupTurnForBot(botId)),
2249
2252
  }).action === "start";
2250
2253
  }
@@ -7407,6 +7410,9 @@ class DirectSendRefused extends Error {
7407
7410
  }
7408
7411
  }
7409
7412
  function directSendRefusal(botId, threadId) {
7413
+ if (store.taskByThread(botId, threadId)?.botApi) {
7414
+ return new DirectSendRefused(409, { error: BOT_API_INTERNAL_CHAT_REQUIRED, code: "channel_thread" });
7415
+ }
7410
7416
  try {
7411
7417
  assertWithinBudget(cfg, DATA_DIR);
7412
7418
  }
@@ -9793,7 +9799,7 @@ const webhooks = new WebhookManager({
9793
9799
  }, ...createWebhookRoomPost({ store, cfg, roomTalks })
9794
9800
  });
9795
9801
  const webhookRequests = new WebhookRequestService({ store, webhooks, botName: (botId) => store.bot(botId)?.name ?? "the bot" });
9796
- const botApi = createBotApiHost({ store, startTurn, threadBusy, canStart: canAdmitDirectTurn, canConfine: (botId) => registry.get(store.bot(botId)?.modelSelection.instanceId ?? "")?.adapter.capabilities.guestTurns === "confined", discard: (botId, threadId) => { store.deleteTask(botId, threadId); }, included: () => !cloudPlanTier.starter(), opened: (threadId) => { if (CLOUD_OWNER_KEY)
9802
+ const botApi = createBotApiHost({ channelIdentities: new ChannelIdentityRegistry(join(DATA_DIR, "limix-channel-identities.json")), store, startTurn, threadBusy, canStart: (botId, threadId) => canAdmitDirectTurn(botId, threadId, false), canConfine: (botId) => registry.get(store.bot(botId)?.modelSelection.instanceId ?? "")?.adapter.capabilities.guestTurns === "confined", discard: (botId, threadId) => { store.deleteTask(botId, threadId); }, included: () => !cloudPlanTier.starter(), opened: (threadId) => { if (CLOUD_OWNER_KEY)
9797
9803
  threadStarters.set(threadId, CLOUD_OWNER_KEY); }, hooksBaseUrl: () => webhookIngressStatus().baseUrl, manageRefusal: (auth, botId) => auth.scopes.includes("admin") || (CLOUD_TEAM && levelOf(auth, botId) === "edit") ? null : refusalFor(store.bot(botId)?.name ?? "this bot", "edit").error, claimRequest: () => { cloudPower?.arrived("/hooks", {}); moveFreeze.assertTurns(); return workspaceMaintenance.request(); }, record: (auth, row) => appendAdminAction(DATA_DIR, { ...row, actor: decisionActorFor(auth) }) });
9798
9804
  const appTriggers = createAppTriggerHost({ store, webhooks, webhookBase: () => webhookIngressStatus().baseUrl, routines: () => routines, botState: unattendedDispatchState, timeZone: routineTimeZone, emit: broadcast, connectionMode: () => composio.connectionMode(cfg),
9799
9805
  access: composio.brokerAccess, connectedApps: () => composio.connectedServices(cfg), visibleBot: (auth, botId) => visibleTo(viewerFor(auth)).bot(botId),
@@ -12994,6 +13000,11 @@ const handleRequest = async (req, res) => {
12994
13000
  if (cloudPower && gate.auth.kind === "session")
12995
13001
  cloudPower.request(path, req.headers, res); // someone using a Cloud home keeps it awake
12996
13002
  const auth = gate.auth;
13003
+ auth.channelReviewUntil = channelReviewUntil(req.headers.cookie);
13004
+ if (await channelReviewRoute({ req, res, url, path, method, auth, json, readBody }))
13005
+ return;
13006
+ if (!auth.channelReviewUntil && (/backup|export|session-search|search|activity|logs/.test(path)) && store.bots.some(bot => bot.tasks?.some(task => task.botApi)))
13007
+ return json(res, 403, { error: "Unlock channel conversations before accessing archives, search or activity." });
12997
13008
  if (HOSTED_WORKSPACE && auth.kind === "session") {
12998
13009
  const failure = workspaceAccess
12999
13010
  ? await workspaceAccess.authorize(req, auth)
@@ -13012,7 +13023,12 @@ const handleRequest = async (req, res) => {
13012
13023
  return json(res, 403, refused);
13013
13024
  // Every bot a member is sent (on a Team Cloud an admin's too) comes narrowed to what they may see once the request is done (memberBot).
13014
13025
  if (viewer.kind === "member" || visible.filtersThreads)
13015
- onJsonBody(res, (body) => memberBody(body, visibleTo(viewer)));
13026
+ onJsonBody(res, (body) => {
13027
+ const narrowed = memberBody(body, visibleTo(viewer));
13028
+ if (!channelReviewUntil(req.headers.cookie) && path.endsWith("/bot-api") && narrowed && typeof narrowed === "object")
13029
+ return { ...narrowed, calls: [] };
13030
+ return narrowed;
13031
+ });
13016
13032
  beginAdminAudit(req, res, method, path, auth);
13017
13033
  if (method === "POST" && path === "/api/workspace-backup/restore" && teamComputers.list().some(computer => computer.section !== null)) {
13018
13034
  return json(res, 409, { error: "Unassign team computers before restoring a workspace; restored team names must not gain access to existing desktops" });
@@ -14983,6 +14999,9 @@ const handleRequest = async (req, res) => {
14983
14999
  const connectorCalls = rpc?.method === "tools/call" && typeof rpcParams?.name === "string"
14984
15000
  ? connectorCallsIn(rpcParams.name, rpcParams.arguments)
14985
15001
  : [];
15002
+ const imageRoutingRefusal = rpc?.method === "tools/call" && typeof rpcParams?.name === "string" ? imageConnectorRefusal(rpcParams.name, rpcParams.arguments) : null;
15003
+ if (imageRoutingRefusal)
15004
+ return refuseOutbound(imageRoutingRefusal);
14986
15005
  if (proactive.fence.refusesConnectorCall(currentSender, internalCapability.threadId, body))
14987
15006
  return refuseOutbound(READ_AND_DRAFT_REFUSAL);
14988
15007
  const scopeRefusal = managedPolicy.appsCallRefusal(connectorCalls, serviceSlugs) ?? await teamConnections.callRefusal(internalCapability, connectorCalls);
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ import { readFileSync, writeFileSync, renameSync, mkdirSync, existsSync } from "node:fs";
3
+ import { dirname } from "node:path";
4
+ const id = z.string().min(1).max(200).regex(/^[^\x00-\x1f]+$/);
5
+ export const channelConversationSchema = z.object({
6
+ connectionId: id, platform: z.enum(["telegram", "zalo", "discord", "facebook"]),
7
+ chatId: id, senderId: id, topicId: id.optional(), kind: z.enum(["private", "group"]),
8
+ }).strict().refine(value => value.kind !== "group" || value.senderId === "group");
9
+ export function channelScope(value, owner) {
10
+ return JSON.stringify([value.platform, value.connectionId, value.kind, value.chatId, value.topicId ?? "", value.senderId, owner]);
11
+ }
12
+ export function parseChannelHeader(value) {
13
+ if (value === undefined)
14
+ return undefined;
15
+ if (typeof value !== "string" || value.length > 2048 || !/^[A-Za-z0-9_-]+$/.test(value))
16
+ throw new Error("Invalid conversation identity");
17
+ return channelConversationSchema.parse(JSON.parse(Buffer.from(value, "base64url").toString("utf8")));
18
+ }
19
+ /** Bindings are additional to Bot API authorization. A different sender cannot continue a bound transcript. */
20
+ export class ChannelIdentityRegistry {
21
+ records;
22
+ file;
23
+ constructor(file) {
24
+ this.file = file;
25
+ this.records = existsSync(file) ? z.record(z.string(), z.string()).parse(JSON.parse(readFileSync(file, "utf8"))) : {};
26
+ }
27
+ matches(thread, identity, owner) {
28
+ const bound = this.records[thread];
29
+ return identity ? bound === channelScope(identity, owner) : bound === undefined;
30
+ }
31
+ bind(thread, identity, owner) {
32
+ const scope = channelScope(identity, owner);
33
+ if (this.records[thread] && this.records[thread] !== scope)
34
+ throw new Error("Conversation identity mismatch");
35
+ const next = { ...this.records, [thread]: scope };
36
+ mkdirSync(dirname(this.file), { recursive: true });
37
+ writeFileSync(this.file + ".tmp", JSON.stringify(next), { mode: 0o600 });
38
+ renameSync(this.file + ".tmp", this.file);
39
+ this.records = next;
40
+ }
41
+ }
@@ -0,0 +1,53 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { limixOwnerCall } from "./limix-owner-lane.js";
3
+ const grants = new Map();
4
+ const tickets = new Map();
5
+ export const channelReviewActive = (until) => until > Date.now() && [...grants.values()].includes(until);
6
+ export function channelReviewUntil(cookie) {
7
+ const token = /(?:^|; )limix_channel_review=([A-Za-z0-9_-]{43})(?:;|$)/.exec(cookie ?? "")?.[1];
8
+ const until = token ? grants.get(token) ?? 0 : 0;
9
+ return until > Date.now() ? until : 0;
10
+ }
11
+ export async function channelReviewRoute(ctx) {
12
+ const { path, method, req, res, auth, json, readBody } = ctx;
13
+ if (!path.startsWith("/api/limix/channel-review/"))
14
+ return false;
15
+ if (!auth.scopes.includes("admin") || method !== "POST") {
16
+ json(res, 403, { error: "Administrator access required" });
17
+ return true;
18
+ }
19
+ for (const map of [grants, tickets])
20
+ for (const [key, expiry] of map)
21
+ if (expiry <= Date.now())
22
+ map.delete(key);
23
+ if (path.endsWith("/grant")) {
24
+ if (!limixOwnerCall(req.headers["x-limix-owner"])) {
25
+ json(res, 403, { error: "Password verification required" });
26
+ return true;
27
+ }
28
+ const token = randomBytes(32).toString("base64url");
29
+ tickets.set(token, Date.now() + 30000);
30
+ json(res, 200, { token });
31
+ return true;
32
+ }
33
+ if (path.endsWith("/unlock")) {
34
+ const body = await readBody(req, 4096);
35
+ const token = body && typeof body.token === "string" ? body.token : "";
36
+ if (!tickets.has(token)) {
37
+ json(res, 403, { error: "Password verification expired" });
38
+ return true;
39
+ }
40
+ tickets.delete(token);
41
+ const session = randomBytes(32).toString("base64url"), until = Date.now() + 5 * 60000;
42
+ grants.set(session, until);
43
+ res.setHeader("set-cookie", `limix_channel_review=${session}; HttpOnly; SameSite=Strict; Path=/; Max-Age=300`);
44
+ json(res, 200, { until });
45
+ return true;
46
+ }
47
+ const token = /(?:^|; )limix_channel_review=([A-Za-z0-9_-]{43})/.exec(req.headers.cookie ?? "")?.[1];
48
+ if (token)
49
+ grants.delete(token);
50
+ res.setHeader("set-cookie", "limix_channel_review=; HttpOnly; SameSite=Strict; Path=/; Max-Age=0");
51
+ json(res, 200, { locked: true });
52
+ return true;
53
+ }
@@ -0,0 +1,9 @@
1
+ import { connectorCallsIn } from "../shared/outbound.js";
2
+ export const IMAGE_ROUTING_PROMPT = "\n\nImage generation: when the person asks to generate an image, call generate_image (through find_tool/use_tool if bridged). It uses the image provider explicitly configured in Settings > AI > Image generation. A chat model or its sign-in does not select or authorize an image provider. Do not discover or call another image provider through Composio, install a generator, search the web, or draw a substitute with code unless the person explicitly requests that alternative. If generate_image reports missing setup, permission denial, or another error, report that exact limitation and the settings path; do not invent who disabled it, assert a global inability of GPT, or claim success. A code-drawn illustration is not a photorealistic generated image. Claim an image was generated only after a successful tool result and attached file. Preserve the requested style in the image prompt.\n";
3
+ export const IMAGE_CONNECTOR_REFUSAL = "Use Limix Bot's generate_image tool for image generation. It routes to the image provider chosen in Settings > AI > Image generation. Do not switch to Gemini or another Composio image provider. If setup is missing or the configured provider refuses, report that error and ask the person to configure image generation. No image was requested from this connector.";
4
+ /** A connector cannot silently choose a different image provider from the configured image tool. */
5
+ export function imageConnectorRefusal(name, args) {
6
+ const calls = connectorCallsIn(name, args);
7
+ return calls.some(({ slug }) => /(?:^|_)(?:GENERATE_IMAGES?|CREATE_IMAGES?|TEXT_TO_IMAGE|TEXT_TO_IMAGE_GENERATION|IMAGE_GENERATION)(?:$|_)/i.test(slug))
8
+ ? IMAGE_CONNECTOR_REFUSAL : null;
9
+ }
@@ -1,3 +1,4 @@
1
+ import { BOT_API_INTERNAL_CHAT_REQUIRED } from "../../shared/bot-api.js";
1
2
  import { randomUUID } from "node:crypto";
2
3
  import { z } from "zod";
3
4
  import { ROOM_VIEW_ONLY } from "../../shared/app.js";
@@ -120,6 +121,8 @@ export function createBotMessageRoutes(deps) {
120
121
  const notYours = cloudGuestSendRefusal(auth, threadId);
121
122
  if (notYours)
122
123
  return json(res, 403, { error: notYours });
124
+ if (store.taskByThread(bot.id, threadId)?.botApi)
125
+ return json(res, 409, { error: BOT_API_INTERNAL_CHAT_REQUIRED, code: "channel_thread" });
123
126
  if (body.mode !== undefined && body.mode !== "chat" && body.mode !== "goal")
124
127
  return json(res, 400, { error: "mode must be chat or goal" });
125
128
  if (body.mode === "goal") {
@@ -5,7 +5,7 @@ import { generateImage, imageGenerationReady, imageProviderName, imageSlots, } f
5
5
  import { createImageDailyCap } from "../image-daily-cap.js";
6
6
  import { PASS } from "./table.js";
7
7
  export const IMAGE_MESSAGES = {
8
- notSetUp: "Image generation isn't set up on this computer. Ask the person to choose an image provider in Settings → AI → Image generation (shown in advanced mode).",
8
+ notSetUp: "Image generation is not configured in Limix Bot on this computer. Open Settings → AI → Image generation and choose the image provider, API protocol and model. Selecting a chat model does not configure image generation. Do not try Gemini, Composio or code-drawn substitutes. No image was generated.",
9
9
  noTurn: "This turn has not started yet or already ended, so the image could not be attached.",
10
10
  notSaved: "The image could not be saved on this computer. Try again shortly.",
11
11
  notPerson: "Images are made only for a person's own message in a chat. This turn was started another way (a routine, a webhook, an app, a guest or a room goal's coordinator), so no image was made. Tell the person they can ask for the image in a chat.",
@@ -1,3 +1,4 @@
1
+ import { IMAGE_ROUTING_PROMPT } from "./limix-image-routing.js";
1
2
  // One builder for every turn's system prompt, so what a bot receives and the "what the model sees" preview are the same bytes.
2
3
  import { soulSystemPrompt } from "./bot-folder.js";
3
4
  import { lentComputersLine, theirComputer } from "./lent-computers.js";
@@ -65,6 +66,7 @@ export function buildSystemPrompt(persona, soul, parts, agents, opts) {
65
66
  { id: "soul", label: "Standing instructions (SOUL.md)", text: soulSystemPrompt(soul) },
66
67
  // Right after the soul: on a direct turn, ahead of every section that names a tool.
67
68
  { id: "tool-bridge", label: "Tool search", text: agentsToolBridged(agents) ? AGENTS_TOOL_BRIDGE_PROMPT : "" },
69
+ { id: "image-routing", label: "Image generation", text: agents?.env?.OMB_IMAGE_GENERATION === "1" ? IMAGE_ROUTING_PROMPT : "" },
68
70
  { id: "reply-style", label: "Reply style", text: replyStylePrompt(opts?.replyStyle) },
69
71
  ...parts,
70
72
  { id: "reply-habits", label: "How to reply", text: REPLY_HABITS_PROMPT },
@@ -15,3 +15,4 @@ export function botApiCurl(endpoint, key = BOT_API_KEY_PLACEHOLDER) {
15
15
  ` -d '{"message": "Hello! What can you do?"}'`,
16
16
  ].join("\n");
17
17
  }
18
+ export const BOT_API_INTERNAL_CHAT_REQUIRED = "This conversation belongs to a connected channel. Open the bot internal chat to configure it; channel messages must arrive through its Bot API.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "limixbot",
3
- "version": "0.3.40",
3
+ "version": "0.3.42",
4
4
  "description": "Run the Limix Bot server anywhere and pair your devices to it (Leox ৹ Limix AI)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{U as a,C as n}from"./mermaid.core-BkGLuasi.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1,8 +0,0 @@
1
- import{c as r,s as e}from"./flowDiagram-OXPTDLAJ-BoRQKWEE.js";import{_ as o}from"./mermaid.core-BkGLuasi.js";import"./chunk-5VM5RSS4-Ms8vx6uj.js";import"./chunk-XXDRQBXY-lLPvGZOB.js";import"./chunk-KQW6MTUR-C_OPTqju.js";import"./chunk-7TKQ45FW-CoQ_n3fY.js";import"./channel-CLFluAXE.js";import"./styles-CYPAO9i1.js";import"./step-CkmJJ7wq.js";var a=o(t=>`${e(t)}
2
- .swimlane.cluster:not([data-color-id]) rect {
3
- stroke: ${t.clusterBorder} !important;
4
- }
5
- [data-look="neo"].cluster rect {
6
- filter: none;
7
- }
8
- `,"getStyles"),m=a,y=r({styles:m});export{y as diagram};