Skip to content

Commit 283a521

Browse files
Sg312icecrasher321waleedlatif1Lutherwavesemir-karabeg
authored
feat(copilot): subagents (#2731)
* fix(helm): add custom egress rules to realtime network policy (#2481) The realtime service network policy was missing the custom egress rules section that allows configuration of additional egress rules via values.yaml. This caused the realtime pods to be unable to connect to external databases (e.g., PostgreSQL on port 5432) when using external database configurations. The app network policy already had this section, but the realtime network policy was missing it, creating an inconsistency and preventing the realtime service from accessing external databases configured via networkPolicy.egress values. This fix adds the same custom egress rules template section to the realtime network policy, matching the app network policy behavior and allowing users to configure database connectivity via values.yaml. * Add subagents * Edit, plan, debug subagents * Tweaks * Message queue * Many subagents * Fix bugs * Trigger request * Overlays * Diff in chat * Remove context usage code * Diff view in chat * Options * Lint * Fix rendering of edit subblocks * Add deploy mcp tools * Add evaluator subagent * Editor component * Options select * Fixes to options * Fix spacing between options * Subagent rendering * Fix previews * Plan * Streaming * Fix thinking scroll * Renaming * Fix thinking text * Persist and load chats properly * Diff view * Fix lint * Previous options should not be selectable * Enable images * improvement(copilot): ui/ux * improvement(copilot): diff controls * Fix ops bug * Fix ops * Stuff * Fix config --------- Co-authored-by: Vikhyath Mondreti <[email protected]> Co-authored-by: Waleed <[email protected]> Co-authored-by: Martin Yankov <[email protected]> Co-authored-by: Emir Karabeg <[email protected]> Co-authored-by: waleedlatif1 <[email protected]> Co-authored-by: Adam Gough <[email protected]> Co-authored-by: aadamgough <[email protected]> Co-authored-by: Emir Karabeg <[email protected]>
1 parent 92fabe7 commit 283a521

File tree

74 files changed

+5623
-1322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+5623
-1322
lines changed

apps/sim/app/api/copilot/chat/update-messages/route.ts

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,30 @@ const logger = createLogger('CopilotChatUpdateAPI')
1717
const UpdateMessagesSchema = z.object({
1818
chatId: z.string(),
1919
messages: z.array(
20-
z.object({
21-
id: z.string(),
22-
role: z.enum(['user', 'assistant']),
23-
content: z.string(),
24-
timestamp: z.string(),
25-
toolCalls: z.array(z.any()).optional(),
26-
contentBlocks: z.array(z.any()).optional(),
27-
fileAttachments: z
28-
.array(
29-
z.object({
30-
id: z.string(),
31-
key: z.string(),
32-
filename: z.string(),
33-
media_type: z.string(),
34-
size: z.number(),
35-
})
36-
)
37-
.optional(),
38-
})
20+
z
21+
.object({
22+
id: z.string(),
23+
role: z.enum(['user', 'assistant', 'system']),
24+
content: z.string(),
25+
timestamp: z.string(),
26+
toolCalls: z.array(z.any()).optional(),
27+
contentBlocks: z.array(z.any()).optional(),
28+
fileAttachments: z
29+
.array(
30+
z.object({
31+
id: z.string(),
32+
key: z.string(),
33+
filename: z.string(),
34+
media_type: z.string(),
35+
size: z.number(),
36+
})
37+
)
38+
.optional(),
39+
contexts: z.array(z.any()).optional(),
40+
citations: z.array(z.any()).optional(),
41+
errorType: z.string().optional(),
42+
})
43+
.passthrough() // Preserve any additional fields for future compatibility
3944
),
4045
planArtifact: z.string().nullable().optional(),
4146
config: z
@@ -57,6 +62,19 @@ export async function POST(req: NextRequest) {
5762
}
5863

5964
const body = await req.json()
65+
66+
// Debug: Log what we received
67+
const lastMsg = body.messages?.[body.messages.length - 1]
68+
if (lastMsg?.role === 'assistant') {
69+
logger.info(`[${tracker.requestId}] Received messages to save`, {
70+
messageCount: body.messages?.length,
71+
lastMsgId: lastMsg.id,
72+
lastMsgContentLength: lastMsg.content?.length || 0,
73+
lastMsgContentBlockCount: lastMsg.contentBlocks?.length || 0,
74+
lastMsgContentBlockTypes: lastMsg.contentBlocks?.map((b: any) => b?.type) || [],
75+
})
76+
}
77+
6078
const { chatId, messages, planArtifact, config } = UpdateMessagesSchema.parse(body)
6179

6280
// Verify that the chat belongs to the user

apps/sim/app/api/copilot/context-usage/route.ts

Lines changed: 0 additions & 134 deletions
This file was deleted.

apps/sim/app/workspace/[workspaceId]/utils/commands-utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { GlobalCommand } from '@/app/workspace/[workspaceId]/providers/glob
77
* ad-hoc ids or shortcuts to ensure a single source of truth.
88
*/
99
export type CommandId =
10+
| 'accept-diff-changes'
1011
| 'add-agent'
1112
| 'goto-templates'
1213
| 'goto-logs'
@@ -43,6 +44,11 @@ export interface CommandDefinition {
4344
* All global commands must be declared here to be usable.
4445
*/
4546
export const COMMAND_DEFINITIONS: Record<CommandId, CommandDefinition> = {
47+
'accept-diff-changes': {
48+
id: 'accept-diff-changes',
49+
shortcut: 'Mod+Shift+Enter',
50+
allowInEditable: true,
51+
},
4652
'add-agent': {
4753
id: 'add-agent',
4854
shortcut: 'Mod+Shift+A',

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/command-list/command-list.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import { useCallback } from 'react'
44
import { createLogger } from '@sim/logger'
5-
import { Layout, LibraryBig, Search } from 'lucide-react'
5+
import { Layout, Search } from 'lucide-react'
66
import Image from 'next/image'
77
import { useParams, useRouter } from 'next/navigation'
8-
import { Button } from '@/components/emcn'
8+
import { Button, Library } from '@/components/emcn'
99
import { AgentIcon } from '@/components/icons'
1010
import { cn } from '@/lib/core/utils/cn'
1111
import { usePreventZoom } from '@/app/workspace/[workspaceId]/w/[workflowId]/hooks'
@@ -41,7 +41,7 @@ const commands: CommandItem[] = [
4141
},
4242
{
4343
label: 'Logs',
44-
icon: LibraryBig,
44+
icon: Library,
4545
shortcut: 'L',
4646
},
4747
{

0 commit comments

Comments
 (0)