Skip to content

Commit 8f74750

Browse files
author
Theodore Li
committed
Fix lint
1 parent d8c0bd4 commit 8f74750

File tree

8 files changed

+52
-27
lines changed

8 files changed

+52
-27
lines changed

apps/sim/app/api/copilot/chat/route.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ export async function POST(req: NextRequest) {
193193

194194
const userMessageIdToUse = userMessageId || crypto.randomUUID()
195195
try {
196-
logger.error(appendCopilotLogContext('Received chat POST', {
196+
logger.error(
197+
appendCopilotLogContext('Received chat POST', {
197198
requestId: tracker.requestId,
198199
messageId: userMessageIdToUse,
199200
}),
@@ -249,7 +250,8 @@ export async function POST(req: NextRequest) {
249250
actualChatId
250251
)
251252
agentContexts = processed
252-
logger.error(appendCopilotLogContext('Contexts processed for request', {
253+
logger.error(
254+
appendCopilotLogContext('Contexts processed for request', {
253255
requestId: tracker.requestId,
254256
messageId: userMessageIdToUse,
255257
}),
@@ -355,7 +357,8 @@ export async function POST(req: NextRequest) {
355357
)
356358

357359
try {
358-
logger.error(appendCopilotLogContext('About to call Sim Agent', {
360+
logger.error(
361+
appendCopilotLogContext('About to call Sim Agent', {
359362
requestId: tracker.requestId,
360363
messageId: userMessageIdToUse,
361364
}),
@@ -552,7 +555,8 @@ export async function POST(req: NextRequest) {
552555
provider: typeof requestPayload?.provider === 'string' ? requestPayload.provider : undefined,
553556
}
554557

555-
logger.error(appendCopilotLogContext('Non-streaming response from orchestrator', {
558+
logger.error(
559+
appendCopilotLogContext('Non-streaming response from orchestrator', {
556560
requestId: tracker.requestId,
557561
messageId: userMessageIdToUse,
558562
}),
@@ -596,7 +600,8 @@ export async function POST(req: NextRequest) {
596600

597601
// Start title generation in parallel if this is first message (non-streaming)
598602
if (actualChatId && !currentChat.title && conversationHistory.length === 0) {
599-
logger.error(appendCopilotLogContext('Starting title generation for non-streaming response', {
603+
logger.error(
604+
appendCopilotLogContext('Starting title generation for non-streaming response', {
600605
requestId: tracker.requestId,
601606
messageId: userMessageIdToUse,
602607
})
@@ -611,7 +616,8 @@ export async function POST(req: NextRequest) {
611616
updatedAt: new Date(),
612617
})
613618
.where(eq(copilotChats.id, actualChatId!))
614-
logger.error(appendCopilotLogContext(`Generated and saved title: ${title}`, {
619+
logger.error(
620+
appendCopilotLogContext(`Generated and saved title: ${title}`, {
615621
requestId: tracker.requestId,
616622
messageId: userMessageIdToUse,
617623
})
@@ -639,7 +645,8 @@ export async function POST(req: NextRequest) {
639645
.where(eq(copilotChats.id, actualChatId!))
640646
}
641647

642-
logger.error(appendCopilotLogContext('Returning non-streaming response', {
648+
logger.error(
649+
appendCopilotLogContext('Returning non-streaming response', {
643650
requestId: tracker.requestId,
644651
messageId: userMessageIdToUse,
645652
}),
@@ -771,7 +778,8 @@ export async function GET(req: NextRequest) {
771778
...(streamSnapshot ? { streamSnapshot } : {}),
772779
}
773780

774-
logger.error(appendCopilotLogContext(`Retrieved chat ${chatId}`, {
781+
logger.error(
782+
appendCopilotLogContext(`Retrieved chat ${chatId}`, {
775783
messageId: chat.conversationId || undefined,
776784
})
777785
)

apps/sim/app/api/copilot/chat/stream/route.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export async function GET(request: NextRequest) {
3636
const toParam = url.searchParams.get('to')
3737
const toEventId = toParam ? Number(toParam) : undefined
3838

39-
logger.error(appendCopilotLogContext('[Resume] Received resume request', {
39+
logger.error(
40+
appendCopilotLogContext('[Resume] Received resume request', {
4041
messageId: streamId || undefined,
4142
}),
4243
{
@@ -123,7 +124,8 @@ export async function GET(request: NextRequest) {
123124
const flushEvents = async () => {
124125
const events = await readStreamEvents(streamId, lastEventId)
125126
if (events.length > 0) {
126-
logger.error(appendCopilotLogContext('[Resume] Flushing events', { messageId: streamId }),
127+
logger.error(
128+
appendCopilotLogContext('[Resume] Flushing events', { messageId: streamId }),
127129
{
128130
streamId,
129131
fromEventId: lastEventId,

apps/sim/app/api/mothership/chat/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ export async function POST(req: NextRequest) {
113113
const userMessageId = providedMessageId || crypto.randomUUID()
114114
userMessageIdForLogs = userMessageId
115115

116-
logger.error(appendCopilotLogContext('Received mothership chat start request', {
116+
logger.error(
117+
appendCopilotLogContext('Received mothership chat start request', {
117118
requestId: tracker.requestId,
118119
messageId: userMessageId,
119120
}),

apps/sim/app/api/v1/copilot/chat/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export async function POST(req: NextRequest) {
8383
const chatId = parsed.chatId || crypto.randomUUID()
8484

8585
messageId = crypto.randomUUID()
86-
logger.error(appendCopilotLogContext('Received headless copilot chat start request', { messageId }),
86+
logger.error(
87+
appendCopilotLogContext('Received headless copilot chat start request', { messageId }),
8788
{
8889
workflowId: resolved.workflowId,
8990
workflowName: parsed.workflowName,

apps/sim/lib/copilot/chat-payload.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ export async function buildCopilotRequestPayload(
201201
})
202202
}
203203
if (mcpTools.length > 0) {
204-
logger.error(appendCopilotLogContext('Added MCP tools to copilot payload', {
204+
logger.error(
205+
appendCopilotLogContext('Added MCP tools to copilot payload', {
205206
messageId: userMessageId,
206207
}),
207208
{ count: mcpTools.length }

apps/sim/lib/copilot/chat-streaming.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ export function createSSEStream(params: StreamingOrchestrationParams): ReadableS
440440
})
441441

442442
if (abortController.signal.aborted) {
443-
logger.error(appendCopilotLogContext('Stream aborted by explicit stop', { requestId, messageId })
443+
logger.error(
444+
appendCopilotLogContext('Stream aborted by explicit stop', { requestId, messageId })
444445
)
445446
await eventWriter.close().catch(() => {})
446447
await setStreamMeta(streamId, { status: 'cancelled', userId, executionId, runId })
@@ -455,7 +456,8 @@ export function createSSEStream(params: StreamingOrchestrationParams): ReadableS
455456
'An unexpected error occurred while processing the response.'
456457

457458
if (clientDisconnected) {
458-
logger.error(appendCopilotLogContext('Stream failed after client disconnect', {
459+
logger.error(
460+
appendCopilotLogContext('Stream failed after client disconnect', {
459461
requestId,
460462
messageId,
461463
}),
@@ -498,15 +500,17 @@ export function createSSEStream(params: StreamingOrchestrationParams): ReadableS
498500
await updateRunStatus(runId, 'complete', { completedAt: new Date() }).catch(() => {})
499501
} catch (error) {
500502
if (abortController.signal.aborted) {
501-
logger.error(appendCopilotLogContext('Stream aborted by explicit stop', { requestId, messageId })
503+
logger.error(
504+
appendCopilotLogContext('Stream aborted by explicit stop', { requestId, messageId })
502505
)
503506
await eventWriter.close().catch(() => {})
504507
await setStreamMeta(streamId, { status: 'cancelled', userId, executionId, runId })
505508
await updateRunStatus(runId, 'cancelled', { completedAt: new Date() }).catch(() => {})
506509
return
507510
}
508511
if (clientDisconnected) {
509-
logger.error(appendCopilotLogContext('Stream errored after client disconnect', {
512+
logger.error(
513+
appendCopilotLogContext('Stream errored after client disconnect', {
510514
requestId,
511515
messageId,
512516
}),

apps/sim/lib/copilot/orchestrator/sse/handlers/handlers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ export const sseHandlers: Record<string, SSEHandler> = {
309309
const rid = typeof event.data === 'string' ? event.data : undefined
310310
if (rid) {
311311
context.requestId = rid
312-
logger.error(appendCopilotLogContext('Mapped copilot message to Go trace ID', {
312+
logger.error(
313+
appendCopilotLogContext('Mapped copilot message to Go trace ID', {
313314
messageId: context.messageId,
314315
}),
315316
{

apps/sim/lib/copilot/orchestrator/sse/handlers/tool-execution.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ async function maybeWriteOutputToFile(
187187
contentType
188188
)
189189

190-
logger.error(appendCopilotLogContext('Tool output written to file', { messageId: context.messageId }),
190+
logger.error(
191+
appendCopilotLogContext('Tool output written to file', { messageId: context.messageId }),
191192
{
192193
toolName,
193194
fileName,
@@ -396,7 +397,8 @@ async function maybeWriteOutputToTable(
396397
}
397398
})
398399

399-
logger.error(appendCopilotLogContext('Tool output written to table', { messageId: context.messageId }),
400+
logger.error(
401+
appendCopilotLogContext('Tool output written to table', { messageId: context.messageId }),
400402
{
401403
toolName,
402404
tableId: outputTable,
@@ -522,7 +524,8 @@ async function maybeWriteReadCsvToTable(
522524
}
523525
})
524526

525-
logger.error(appendCopilotLogContext('Read output written to table', { messageId: context.messageId }),
527+
logger.error(
528+
appendCopilotLogContext('Read output written to table', { messageId: context.messageId }),
526529
{
527530
toolName,
528531
tableId: outputTable,
@@ -592,11 +595,14 @@ export async function executeToolAndReport(
592595
toolCall.status = 'executing'
593596
await markAsyncToolRunning(toolCall.id, 'sim-stream').catch(() => {})
594597

595-
logger.error(appendCopilotLogContext('Tool execution started', { messageId: context.messageId }), {
596-
toolCallId: toolCall.id,
597-
toolName: toolCall.name,
598-
params: toolCall.params,
599-
})
598+
logger.error(
599+
appendCopilotLogContext('Tool execution started', { messageId: context.messageId }),
600+
{
601+
toolCallId: toolCall.id,
602+
toolName: toolCall.name,
603+
params: toolCall.params,
604+
}
605+
)
600606

601607
try {
602608
let result = await executeToolServerSide(toolCall, execContext)
@@ -683,7 +689,8 @@ export async function executeToolAndReport(
683689
: raw && typeof raw === 'object'
684690
? JSON.stringify(raw).slice(0, 200)
685691
: undefined
686-
logger.error(appendCopilotLogContext('Tool execution succeeded', { messageId: context.messageId }),
692+
logger.error(
693+
appendCopilotLogContext('Tool execution succeeded', { messageId: context.messageId }),
687694
{
688695
toolCallId: toolCall.id,
689696
toolName: toolCall.name,

0 commit comments

Comments
 (0)