This commit is contained in:
Siddharth Ganesan
2026-04-09 14:43:01 -07:00
parent 0638604780
commit 9da574a112
8 changed files with 25 additions and 24 deletions

View File

@@ -1296,7 +1296,6 @@ export function useChat(
const tc = blocks[parentIdx].toolCall!
tc.status = 'executing'
tc.result = undefined
tc.error = undefined
flush()
break
}

View File

@@ -276,12 +276,14 @@ export async function runStreamLoop(
newOperation: operation,
}
)
const cleared = clearIntentsForWorkspace(execContext.workspaceId)
if (cleared > 0) {
logger.warn('Cleared orphaned execution intents from store', {
cleared,
workspaceId: execContext.workspaceId,
})
if (execContext.workspaceId) {
const cleared = clearIntentsForWorkspace(execContext.workspaceId)
if (cleared > 0) {
logger.warn('Cleared orphaned execution intents from store', {
cleared,
workspaceId: execContext.workspaceId,
})
}
}
}

View File

@@ -24,7 +24,7 @@ export type StreamHandler = (
options: OrchestratorOptions
) => void | Promise<void>
export type ToolScope = MothershipStreamV1StreamScope['lane']
export type ToolScope = 'main' | MothershipStreamV1StreamScope['lane']
const logger = createLogger('CopilotHandlerHelpers')

View File

@@ -21,8 +21,12 @@ function isOversizedReadPlaceholder(content: string): boolean {
)
}
function hasImageAttachment(result: { attachment?: { type?: string } }): boolean {
return result.attachment?.type === 'image'
function hasImageAttachment(result: unknown): boolean {
if (!result || typeof result !== 'object') {
return false
}
const attachment = (result as { attachment?: { type?: string } }).attachment
return attachment?.type === 'image'
}
export async function executeVfsGrep(

View File

@@ -40,11 +40,9 @@ export const createFileServerTool: BaseServerTool<CreateFileArgs, CreateFileResu
return { success: false, message: 'Workspace ID is required' }
}
const raw = params as Record<string, unknown>
const nested = raw.args as Record<string, unknown> | undefined
const fileName = (params.fileName as string) ?? (nested?.fileName as string) ?? ''
const explicitType =
(params.contentType as string) ?? (nested?.contentType as string) ?? undefined
const nested = params.args
const fileName = params.fileName || (nested?.fileName as string) || ''
const explicitType = params.contentType || (nested?.contentType as string) || undefined
const nameError = validateFlatWorkspaceFileName(fileName)
if (nameError) return { success: false, message: nameError }

View File

@@ -33,9 +33,8 @@ export const deleteFileServerTool: BaseServerTool<DeleteFileArgs, DeleteFileResu
return { success: false, message: 'Workspace ID is required' }
}
const raw = params as Record<string, unknown>
const nested = raw.args as Record<string, unknown> | undefined
const fileId = (params.fileId as string) ?? (nested?.fileId as string) ?? ''
const nested = params.args
const fileId = params.fileId || (nested?.fileId as string) || ''
if (!fileId) return { success: false, message: 'fileId is required' }

View File

@@ -1,11 +1,11 @@
import type { UserFile } from '@/lib/uploads/contexts/workspace/workspace-file-manager'
import type { WorkspaceFileRecord } from '@/lib/uploads/contexts/workspace/workspace-file-manager'
export type PendingFileIntent = {
operation: 'append' | 'update' | 'patch'
fileId: string
workspaceId: string
userId: string
fileRecord: UserFile
fileRecord: WorkspaceFileRecord
existingContent?: string
edit?: {
strategy: string

View File

@@ -39,10 +39,9 @@ export const renameFileServerTool: BaseServerTool<RenameFileArgs, RenameFileResu
return { success: false, message: 'Workspace ID is required' }
}
const raw = params as Record<string, unknown>
const nested = raw.args as Record<string, unknown> | undefined
const fileId = (params.fileId as string) ?? (nested?.fileId as string) ?? ''
const newName = (params.newName as string) ?? (nested?.newName as string) ?? ''
const nested = params.args
const fileId = params.fileId || (nested?.fileId as string) || ''
const newName = params.newName || (nested?.newName as string) || ''
if (!fileId) return { success: false, message: 'fileId is required' }