Skip to content

Commit 9da574a

Browse files
committed
Fix dev
1 parent 0638604 commit 9da574a

File tree

8 files changed

+25
-24
lines changed

8 files changed

+25
-24
lines changed

apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,6 @@ export function useChat(
12961296
const tc = blocks[parentIdx].toolCall!
12971297
tc.status = 'executing'
12981298
tc.result = undefined
1299-
tc.error = undefined
13001299
flush()
13011300
break
13021301
}

apps/sim/lib/copilot/request/go/stream.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,14 @@ export async function runStreamLoop(
276276
newOperation: operation,
277277
}
278278
)
279-
const cleared = clearIntentsForWorkspace(execContext.workspaceId)
280-
if (cleared > 0) {
281-
logger.warn('Cleared orphaned execution intents from store', {
282-
cleared,
283-
workspaceId: execContext.workspaceId,
284-
})
279+
if (execContext.workspaceId) {
280+
const cleared = clearIntentsForWorkspace(execContext.workspaceId)
281+
if (cleared > 0) {
282+
logger.warn('Cleared orphaned execution intents from store', {
283+
cleared,
284+
workspaceId: execContext.workspaceId,
285+
})
286+
}
285287
}
286288
}
287289

apps/sim/lib/copilot/request/handlers/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export type StreamHandler = (
2424
options: OrchestratorOptions
2525
) => void | Promise<void>
2626

27-
export type ToolScope = MothershipStreamV1StreamScope['lane']
27+
export type ToolScope = 'main' | MothershipStreamV1StreamScope['lane']
2828

2929
const logger = createLogger('CopilotHandlerHelpers')
3030

apps/sim/lib/copilot/tools/handlers/vfs.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ function isOversizedReadPlaceholder(content: string): boolean {
2121
)
2222
}
2323

24-
function hasImageAttachment(result: { attachment?: { type?: string } }): boolean {
25-
return result.attachment?.type === 'image'
24+
function hasImageAttachment(result: unknown): boolean {
25+
if (!result || typeof result !== 'object') {
26+
return false
27+
}
28+
const attachment = (result as { attachment?: { type?: string } }).attachment
29+
return attachment?.type === 'image'
2630
}
2731

2832
export async function executeVfsGrep(

apps/sim/lib/copilot/tools/server/files/create-file.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ export const createFileServerTool: BaseServerTool<CreateFileArgs, CreateFileResu
4040
return { success: false, message: 'Workspace ID is required' }
4141
}
4242

43-
const raw = params as Record<string, unknown>
44-
const nested = raw.args as Record<string, unknown> | undefined
45-
const fileName = (params.fileName as string) ?? (nested?.fileName as string) ?? ''
46-
const explicitType =
47-
(params.contentType as string) ?? (nested?.contentType as string) ?? undefined
43+
const nested = params.args
44+
const fileName = params.fileName || (nested?.fileName as string) || ''
45+
const explicitType = params.contentType || (nested?.contentType as string) || undefined
4846

4947
const nameError = validateFlatWorkspaceFileName(fileName)
5048
if (nameError) return { success: false, message: nameError }

apps/sim/lib/copilot/tools/server/files/delete-file.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ export const deleteFileServerTool: BaseServerTool<DeleteFileArgs, DeleteFileResu
3333
return { success: false, message: 'Workspace ID is required' }
3434
}
3535

36-
const raw = params as Record<string, unknown>
37-
const nested = raw.args as Record<string, unknown> | undefined
38-
const fileId = (params.fileId as string) ?? (nested?.fileId as string) ?? ''
36+
const nested = params.args
37+
const fileId = params.fileId || (nested?.fileId as string) || ''
3938

4039
if (!fileId) return { success: false, message: 'fileId is required' }
4140

apps/sim/lib/copilot/tools/server/files/file-intent-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import type { UserFile } from '@/lib/uploads/contexts/workspace/workspace-file-manager'
1+
import type { WorkspaceFileRecord } from '@/lib/uploads/contexts/workspace/workspace-file-manager'
22

33
export type PendingFileIntent = {
44
operation: 'append' | 'update' | 'patch'
55
fileId: string
66
workspaceId: string
77
userId: string
8-
fileRecord: UserFile
8+
fileRecord: WorkspaceFileRecord
99
existingContent?: string
1010
edit?: {
1111
strategy: string

apps/sim/lib/copilot/tools/server/files/rename-file.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ export const renameFileServerTool: BaseServerTool<RenameFileArgs, RenameFileResu
3939
return { success: false, message: 'Workspace ID is required' }
4040
}
4141

42-
const raw = params as Record<string, unknown>
43-
const nested = raw.args as Record<string, unknown> | undefined
44-
const fileId = (params.fileId as string) ?? (nested?.fileId as string) ?? ''
45-
const newName = (params.newName as string) ?? (nested?.newName as string) ?? ''
42+
const nested = params.args
43+
const fileId = params.fileId || (nested?.fileId as string) || ''
44+
const newName = params.newName || (nested?.newName as string) || ''
4645

4746
if (!fileId) return { success: false, message: 'fileId is required' }
4847

0 commit comments

Comments
 (0)