Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

fix(console): make group chat fields required in contracts

raullopez-sandbox2d020a00027e
diff --git a/console/apps/switch-console-desktop/src/main/core/chats/chat-stream.test.ts b/console/apps/switch-console-desktop/src/main/core/chats/chat-stream.test.ts
index a2d4c3a00..fcb202895 100644
--- a/console/apps/switch-console-desktop/src/main/core/chats/chat-stream.test.ts
+++ b/console/apps/switch-console-desktop/src/main/core/chats/chat-stream.test.ts
@@ -32,7 +32,7 @@ function message(roomId: string, seq: number): ChatMessage {
format: null,
threadRootId: null,
attachments: [],
- clientTxn: null,
+ clientTxn: null, namedAgentIds: [], threadReplyCount: 0, threadLastReplySeq: null,
};
}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/chats/stores/chat-timeline-threads.test.ts b/console/apps/switch-console-desktop/src/renderer/features/chats/stores/chat-timeline-threads.test.ts
index fe601d1df..315c08555 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/chats/stores/chat-timeline-threads.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/chats/stores/chat-timeline-threads.test.ts
@@ -21,6 +21,8 @@ const makeMessage = (overrides: Partial<ChatMessage> = {}): ChatMessage => ({
attachments: [],
clientTxn: null,
namedAgentIds: [],
+ threadReplyCount: 0,
+ threadLastReplySeq: null,
...overrides,
});
diff --git a/console/apps/switch-console-desktop/src/renderer/features/chats/stores/empty-chat-finder.test.ts b/console/apps/switch-console-desktop/src/renderer/features/chats/stores/empty-chat-finder.test.ts
index 7315f17e1..48497f460 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/chats/stores/empty-chat-finder.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/chats/stores/empty-chat-finder.test.ts
@@ -8,7 +8,7 @@ const makeChat = (overrides: Partial<ChatSummary> = {}): ChatSummary => ({
channelType: 'direct',
bridgeType: null,
channelName: null,
- agents: [{ id: 'agent-1', name: 'Agent', displayName: null, iconUrl: null, provider: null }],
+ agents: [{ id: 'agent-1', name: 'Agent', displayName: null, iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false }],
canManage: false,
ownsAgent: false,
lastMessage: null,
@@ -32,7 +32,7 @@ const makeMessage = (overrides: Partial<ChatMessage> = {}): ChatMessage => ({
format: null,
threadRootId: null,
attachments: [],
- clientTxn: null,
+ clientTxn: null, namedAgentIds: [], threadReplyCount: 0, threadLastReplySeq: null,
...overrides,
});
@@ -222,7 +222,7 @@ describe('EmptyChatFinder', () => {
const chat = makeChat({
roomId: 'room-1',
name: 'Chat with Agent',
- agents: [{ id: 'agent-1', name: 'Agent', displayName: null, iconUrl: null, provider: null }],
+ agents: [{ id: 'agent-1', name: 'Agent', displayName: null, iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false }],
lastMessage: {
seq: 1,
sentAt: '2024-01-01T00:00:00Z',
@@ -243,7 +243,7 @@ describe('EmptyChatFinder', () => {
const chat = makeChat({
roomId: 'room-1',
name: 'New Chat',
- agents: [{ id: 'agent-1', name: 'Agent', displayName: null, iconUrl: null, provider: null }],
+ agents: [{ id: 'agent-1', name: 'Agent', displayName: null, iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false }],
lastMessage: {
seq: 1,
sentAt: '2024-01-01T00:00:00Z',
@@ -264,7 +264,7 @@ describe('EmptyChatFinder', () => {
const chat = makeChat({
roomId: 'room-1',
name: 'New chat',
- agents: [{ id: 'agent-1', name: 'Agent', displayName: null, iconUrl: null, provider: null }],
+ agents: [{ id: 'agent-1', name: 'Agent', displayName: null, iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false }],
lastMessage: {
seq: 1,
sentAt: '2024-01-01T00:00:00Z',
@@ -285,7 +285,7 @@ describe('EmptyChatFinder', () => {
const chat = makeChat({
roomId: 'room-1',
name: 'Chat with Ada',
- agents: [{ id: 'agent-1', name: 'ada', displayName: 'Ada', iconUrl: null, provider: null }],
+ agents: [{ id: 'agent-1', name: 'ada', displayName: 'Ada', iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false }],
lastMessage: {
seq: 1,
sentAt: '2024-01-01T00:00:00Z',
@@ -347,8 +347,8 @@ describe('EmptyChatFinder', () => {
roomId: 'room-1',
name: 'Chat with Ada, Bob',
agents: [
- { id: 'agent-1', name: 'ada', displayName: 'Ada', iconUrl: null, provider: null },
- { id: 'agent-2', name: 'bob', displayName: 'Bob', iconUrl: null, provider: null },
+ { id: 'agent-1', name: 'ada', displayName: 'Ada', iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false },
+ { id: 'agent-2', name: 'bob', displayName: 'Bob', iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false },
],
lastMessage: {
seq: 1,
diff --git a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.test.ts b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.test.ts
index 22b2a3034..00d276985 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/features/switch-servers/room-filters.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
import { isConsoleDirectChat, isConsoleDirectChatSummary } from './room-filters';
-const agent = { id: 'a', name: 'a', displayName: null, iconUrl: null, provider: null };
+const agent = { id: 'a', name: 'a', displayName: null, iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false };
describe('isConsoleDirectChat', () => {
it('returns true for a direct unbridged room with one agent', () => {
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chat-agent-conversations.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chat-agent-conversations.test.ts
index 85cbe2578..5fb475eca 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/chat-agent-conversations.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chat-agent-conversations.test.ts
@@ -11,7 +11,7 @@ const agent = (id: string, name: string, displayName: string | null = null) => (
name,
displayName,
iconUrl: null,
- provider: null,
+ provider: null, alias: null, ownerName: null, ownedByViewer: false,
});
const summary = (overrides: Partial<ChatSummary>): ChatSummary => ({
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-store.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-store.test.ts
index 8b36343fe..36b2e534b 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-store.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chat-timeline-store.test.ts
@@ -19,7 +19,7 @@ function message(seq: number, extra: Partial<ChatMessage> = {}): ChatMessage {
format: null,
threadRootId: null,
attachments: [],
- clientTxn: null,
+ clientTxn: null, namedAgentIds: [], threadReplyCount: 0, threadLastReplySeq: null,
...extra,
};
}
@@ -44,6 +44,7 @@ function api(overrides: Partial<TimelineApi> = {}) {
const calls = { send: [] as Parameters<TimelineApi['send']>[1][], upload: [] as string[] };
const value: TimelineApi = {
messages: async () => ({ messages: [], headSeq: 0, hasMore: false }),
+ threadMessages: async () => [],
upload: async (_room, file) => {
calls.upload.push(file.uploadId);
return {
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chat-titler.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chat-titler.test.ts
index 854675816..a8cb18759 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/chat-titler.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chat-titler.test.ts
@@ -9,7 +9,7 @@ function summary(roomId: string, channelType: ChatSummary['channelType'] = 'dire
channelType,
bridgeType: null,
channelName: null,
- agents: [{ id: 'a1', name: 'ada', displayName: null, iconUrl: null, provider: null }],
+ agents: [{ id: 'a1', name: 'ada', displayName: null, iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false }],
canManage: true,
ownsAgent: false,
lastMessage: null,
diff --git a/console/apps/switch-console-desktop/src/renderer/tests/chats-store.test.ts b/console/apps/switch-console-desktop/src/renderer/tests/chats-store.test.ts
index e62a079a4..3b9f23e76 100644
--- a/console/apps/switch-console-desktop/src/renderer/tests/chats-store.test.ts
+++ b/console/apps/switch-console-desktop/src/renderer/tests/chats-store.test.ts
@@ -20,7 +20,7 @@ function summary(roomId: string, seq: number): ChatSummary {
channelType: 'direct',
bridgeType: null,
channelName: null,
- agents: [{ id: 'a1', name: 'ada', displayName: null, iconUrl: null, provider: null }],
+ agents: [{ id: 'a1', name: 'ada', displayName: null, iconUrl: null, provider: null, alias: null, ownerName: null, ownedByViewer: false }],
canManage: true,
ownsAgent: false,
lastMessage: { seq, sentAt: '2026-01-01T00:00:00Z', preview: 'hi', senderName: 'Ada' },
@@ -39,7 +39,7 @@ function message(roomId: string, seq: number): ChatMessage {
format: null,
threadRootId: null,
attachments: [],
- clientTxn: null,
+ clientTxn: null, namedAgentIds: [], threadReplyCount: 0, threadLastReplySeq: null,
};
}
diff --git a/console/apps/switch-console-desktop/src/shared/core/chats/chats.ts b/console/apps/switch-console-desktop/src/shared/core/chats/chats.ts
index d3768b12f..fda5c4f33 100644
--- a/console/apps/switch-console-desktop/src/shared/core/chats/chats.ts
+++ b/console/apps/switch-console-desktop/src/shared/core/chats/chats.ts
@@ -13,9 +13,9 @@ export const chatAgentSchema = z.object({
displayName: z.string().nullable(),
iconUrl: z.string().nullable(),
provider: z.string().nullable(),
- alias: z.string().optional(),
- ownerName: z.string().optional(),
- ownedByViewer: z.boolean().optional(),
+ alias: z.string().nullable(),
+ ownerName: z.string().nullable(),
+ ownedByViewer: z.boolean(),
});
export type ChatAgent = z.infer<typeof chatAgentSchema>;
@@ -70,9 +70,9 @@ export const chatMessageSchema = z.object({
threadRootId: z.string().nullable(),
attachments: z.array(chatAttachmentSchema),
clientTxn: z.string().nullable(),
- namedAgentIds: z.array(z.string()).optional(),
- threadReplyCount: z.number().int().optional(),
- threadLastReplySeq: z.number().int().nullable().optional(),
+ namedAgentIds: z.array(z.string()),
+ threadReplyCount: z.number().int(),
+ threadLastReplySeq: z.number().int().nullable(),
});
export type ChatMessage = z.infer<typeof chatMessageSchema>;