Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

channels: Laya pill also respects routing_mode on #general

Pixel (kwant bot)9ffec8f9a511
diff --git a/frontend/src/channels.ts b/frontend/src/channels.ts
index 2e3f3d47..b03ddd65 100644
--- a/frontend/src/channels.ts
+++ b/frontend/src/channels.ts
@@ -63,8 +63,9 @@ export function channelBotIds(c: ChannelLike): string[] {
/** Whether Laya picks who answers in `c`: #general once the space has 2+ bots, any other channel
* on auto routing with 2+ bots of its own. */
export function layaRoutes(c: ChannelLike, botsInSpace: number): boolean {
+ if ((c.routing_mode ?? 'auto') !== 'auto') return false;
if (c.name === 'general') return botsInSpace >= 2;
- return (c.routing_mode ?? 'auto') === 'auto' && channelBotIds(c).length >= 2;
+ return channelBotIds(c).length >= 2;
}
/** The line under the bot picker, for `picked` bots. */
diff --git a/frontend/tests/newChannel.test.mjs b/frontend/tests/newChannel.test.mjs
index 030ea7f9..d5bf9b7a 100644
--- a/frontend/tests/newChannel.test.mjs
+++ b/frontend/tests/newChannel.test.mjs
@@ -43,6 +43,7 @@ test('the Laya pill follows the routing rule, not the channel name', () => {
assert.equal(c.layaRoutes({ ...two, routing_mode: 'lead' }, 3), false);
assert.equal(c.layaRoutes({ name: 'general', lead_kwant_id: 'a', member_kwants: '[]', routing_mode: 'auto' }, 2), true);
assert.equal(c.layaRoutes({ name: 'general', lead_kwant_id: 'a', member_kwants: '[]', routing_mode: 'auto' }, 1), false);
+ assert.equal(c.layaRoutes({ name: 'general', lead_kwant_id: 'a', member_kwants: '[]', routing_mode: 'lead' }, 3), false, '#general set to lead: no Laya pill');
});
test('the picker explains what one bot versus several means', () => {