Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

7 changes: 2 additions & 5 deletions apps/sim/lib/copilot/chat/effective-transcript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ function buildLiveAssistantMessage(params: {
const toolIndexById = new Map<string, number>()
const subagentByParentToolCallId = new Map<string, string>()
const subagentBySpanId = new Map<string, string>()
let activeSubagent: string | undefined
let activeSubagentParentToolCallId: string | undefined
const activeCompactionIdByLane = new Map<string, string>()
let runningText = ''
Expand All @@ -143,8 +142,8 @@ function buildLiveAssistantMessage(params: {
let lastTimestamp: string | undefined

// Scope-only resolution (mirrors the live browser stream loop): with
// concurrent subagents the legacy activeSubagent fallback / name-match scan
// would mis-attribute interleaved replayed events to the wrong lane.
// concurrent subagents the legacy name-match scan would mis-attribute
// interleaved replayed events to the wrong lane.
const resolveScopedSubagent = (
agentId: string | undefined,
parentToolCallId: string | undefined,
Expand Down Expand Up @@ -404,7 +403,6 @@ function buildLiveAssistantMessage(params: {
if (parentToolCallId) {
subagentByParentToolCallId.set(parentToolCallId, name)
}
activeSubagent = name
activeSubagentParentToolCallId = parentToolCallId
blocks.push({
type: MothershipStreamV1EventType.span,
Expand All @@ -431,7 +429,6 @@ function buildLiveAssistantMessage(params: {
// or an unscoped end — never by agent name, which would tear down a
// concurrent same-name sibling that is still open.
if (!parentToolCallId || parentToolCallId === activeSubagentParentToolCallId) {
activeSubagent = undefined
activeSubagentParentToolCallId = undefined
}
blocks.push({
Expand Down
40 changes: 0 additions & 40 deletions apps/sim/lib/copilot/chat/process-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,46 +558,6 @@ async function processWorkflowFromDb(
}
}

async function processPastChat(chatId: string, tagOverride?: string): Promise<AgentContext | null> {
try {
// boundary-raw-fetch: GET /api/mothership/chat?chatId=... has no defineRouteContract;
// the route forwards to the copilot chat handler and emits a free-form chat envelope
// that isn't covered by mothershipChatGetQuerySchema or copilotChatGetContract.
const resp = await fetch(`/api/mothership/chat?chatId=${encodeURIComponent(chatId)}`)
if (!resp.ok) {
logger.error('Failed to fetch past chat', { chatId, status: resp.status })
return null
}
const data = await resp.json()
const messages = Array.isArray(data?.chat?.messages) ? data.chat.messages : []
const content = messages
.map((m: any) => {
const role = m.role || 'user'
// Prefer contentBlocks text if present (joins text blocks), else use content
let text = ''
if (Array.isArray(m.contentBlocks) && m.contentBlocks.length > 0) {
text = m.contentBlocks
.filter((b: any) => b?.type === 'text')
.map((b: any) => String(b.content || ''))
.join('')
.trim()
}
if (!text && typeof m.content === 'string') text = m.content
return `${role}: ${text}`.trim()
})
.filter((s: string) => s.length > 0)
.join('\n')
logger.info('Processed past_chat context via API', { chatId, length: content.length })

return { type: 'past_chat', tag: tagOverride || '@', content }
} catch (error) {
logger.error('Error processing past chat', { chatId, error })
return null
}
}

// Back-compat alias; used by processContexts above

async function processKnowledgeFromDb(
knowledgeBaseId: string,
userId: string | undefined,
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/lib/copilot/request/lifecycle/headless.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createLogger } from '@sim/logger'
import { generateId } from '@sim/utils/id'
import type { RequestTraceV1Outcome as RequestTraceOutcome } from '@/lib/copilot/generated/request-trace-v1'
import {
Expand All @@ -12,8 +11,6 @@ import { withCopilotOtelContext } from '@/lib/copilot/request/otel'
import { TraceCollector } from '@/lib/copilot/request/trace'
import type { OrchestratorResult } from '@/lib/copilot/request/types'

const logger = createLogger('CopilotHeadlessLifecycle')

export async function runHeadlessCopilotLifecycle(
requestPayload: Record<string, unknown>,
options: CopilotLifecycleOptions
Expand Down
14 changes: 0 additions & 14 deletions apps/sim/lib/copilot/tool-executor/router.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { TOOL_CATALOG, type ToolCatalogEntry } from '@/lib/copilot/generated/tool-catalog-v1'

export type ToolRouteTarget = ToolCatalogEntry['route']

export function isToolInCatalog(toolId: string): boolean {
return toolId in TOOL_CATALOG
}
Expand All @@ -10,18 +8,6 @@ export function getToolEntry(toolId: string): ToolCatalogEntry | undefined {
return TOOL_CATALOG[toolId]
}

export type ToolRoute = {
route: ToolRouteTarget
mode: ToolCatalogEntry['mode']
subagentId?: string
}

export function routeToolCall(toolId: string): ToolRoute | null {
const entry = getToolEntry(toolId)
if (!entry) return null
return { route: entry.route, mode: entry.mode, subagentId: entry.subagentId }
}

export function isSimExecuted(toolId: string): boolean {
return getToolEntry(toolId)?.route === 'sim'
}
Expand Down
2 changes: 0 additions & 2 deletions apps/sim/lib/copilot/tools/handlers/vfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ export async function executeVfsRead(
}
}

let resolvedReadPath = path
let result = await vfs.read(path, offset, limit)
if (!result) {
// Same name, wrong encoding (spaces instead of %20) is the most common
Expand All @@ -576,7 +575,6 @@ export async function executeVfsRead(
requested: path,
resolved: decodedEquivalent,
})
resolvedReadPath = decodedEquivalent
result = await vfs.read(decodedEquivalent, offset, limit)
}
}
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/lib/copilot/tools/handlers/workflow/queries.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createLogger } from '@sim/logger'
import { executeCopilotCustomToolUseCase } from '@/lib/copilot/application/execute-custom-tool-use-case'
import { executeCopilotFileUseCase } from '@/lib/copilot/application/execute-file-use-case'
import { executeCopilotMcpServerUseCase } from '@/lib/copilot/application/execute-mcp-server-use-case'
Expand Down Expand Up @@ -26,8 +25,6 @@ import type {
GetWorkflowRunOptionsParams,
} from '../param-types'

const logger = createLogger('WorkflowQueries')

export async function executeGetWorkflowRunOptions(
params: GetWorkflowRunOptionsParams,
context: ExecutionContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ export const downloadToWorkspaceFileServerTool: BaseServerTool<
params: DownloadToWorkspaceFileArgs,
context?: ServerToolContext
): Promise<DownloadToWorkspaceFileResult> {
const withMessageId = (message: string) =>
context?.messageId ? `${message} [messageId:${context.messageId}]` : message

if (!context?.userId) {
throw new Error('Authentication required')
}
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/lib/copilot/tools/server/image/generate-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ export const generateImageServerTool: BaseServerTool<GenerateImageArgs, Generate
params: GenerateImageArgs,
context?: ServerToolContext
): Promise<GenerateImageResult> {
const withMessageId = (message: string) =>
context?.messageId ? `${message} [messageId:${context.messageId}]` : message

if (!context?.userId) {
throw new Error('Authentication required')
}
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/lib/copilot/tools/server/table/user-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ function mergeViewPredicate(
export const userTableServerTool: BaseServerTool<UserTableArgs, UserTableResult> = {
name: UserTable.id,
async execute(params: UserTableArgs, context?: ServerToolContext): Promise<UserTableResult> {
const withMessageId = (message: string) =>
context?.messageId ? `${message} [messageId:${context.messageId}]` : message

if (!context?.userId) {
logger.error('Unauthorized attempt to access user table - no authenticated user context')
throw new Error('Authentication required')
Expand Down
1 change: 0 additions & 1 deletion apps/sim/lib/copilot/vfs/workspace-vfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,6 @@ export class WorkspaceVFS {
}
const folderPath = wf.folderId ? folderPaths.get(wf.folderId) : null
const prefix = `${canonicalWorkflowVfsDir({ name: wf.name, folderPath })}/`
const workflowPath = prefix.replace(/\/$/, '')

const inheritedFolderLock = wf.folderId ? lockedFolderIds.has(wf.folderId) : false
this.files.set(
Expand Down
2 changes: 0 additions & 2 deletions apps/sim/lib/uploads/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ export const SUPPORTED_VIDEO_MIME_TYPES: Record<SupportedVideoExtension, string[
}

export const ACCEPTED_FILE_TYPES = Object.values(SUPPORTED_MIME_TYPES).flat()
export const ACCEPTED_AUDIO_TYPES = Object.values(SUPPORTED_AUDIO_MIME_TYPES).flat()
export const ACCEPTED_VIDEO_TYPES = Object.values(SUPPORTED_VIDEO_MIME_TYPES).flat()
export const ACCEPTED_FILE_EXTENSIONS = SUPPORTED_DOCUMENT_EXTENSIONS.map((ext) => `.${ext}`)

export const ACCEPT_ATTRIBUTE = [...ACCEPTED_FILE_TYPES, ...ACCEPTED_FILE_EXTENSIONS].join(',')
Expand Down
4 changes: 2 additions & 2 deletions apps/sim/lib/workflows/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function resolveInitialValue(subBlock: SubBlockConfig): unknown {
if (typeof subBlock.value === 'function') {
try {
return cloneDefaultValue(subBlock.value({}))
} catch (error) {
// Ignore resolution errors and fall back to default/null values
} catch {
/* Ignore resolution errors and fall back to default/null values. */
}
}

Expand Down
2 changes: 1 addition & 1 deletion apps/sim/lib/workflows/diff/diff-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ function hasBlockChanged(currentBlock: BlockState, proposedBlock: BlockState): b
if (currentSubKeys.length !== proposedSubKeys.length) return true

for (const key of currentSubKeys) {
if (!proposedSubKeys.includes(key)) return true
const currentSub = currentBlock.subBlocks[key]
const proposedSub = proposedBlock.subBlocks?.[key]
/* Also covers a key missing from `proposedBlock`, which reads back undefined. */
if (!proposedSub) return true
if (JSON.stringify(currentSub.value) !== JSON.stringify(proposedSub.value)) return true
}
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/lib/workflows/executor/execution-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ async function executeWorkflowCoreImpl(
runFromBlock,
} = options
loggingSession.setExecutionDeadlineAt(getExecutionDeadlineAt(abortSignal))
const { metadata, workflow, input, workflowVariables, selectedOutputs } = snapshot
const { metadata, input, workflowVariables, selectedOutputs } = snapshot
const { requestId, workflowId, userId, triggerType, executionId, triggerBlockId, useDraftState } =
metadata
const { onBlockStart, onBlockComplete, onStream, onChildWorkflowInstanceReady } = callbacks
Expand Down
4 changes: 2 additions & 2 deletions apps/sim/tools/error-extractors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ export function extractErrorMessageWithId(
if (message?.trim()) {
return message
}
} catch (error) {}
} catch {}

return `Request failed with status ${errorInfo?.status || 'unknown'}`
}
Expand Down Expand Up @@ -564,7 +564,7 @@ export function extractErrorMessage(errorInfo?: ErrorInfo, extractorId?: string)
if (message?.trim()) {
return message
}
} catch (error) {}
} catch {}
}

return `Request failed with status ${errorInfo?.status || 'unknown'}`
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/tools/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createLogger } from '@sim/logger'
import { stripVersionSuffix } from '@sim/utils/string'
import {
normalizeRecord,
Expand All @@ -12,8 +11,6 @@ import { environmentKeys } from '@/hooks/queries/environment'
import { tools } from '@/tools/registry'
import type { ToolConfig } from '@/tools/types'

const logger = createLogger('ToolsUtils')

/**
* Strips version suffix (_v2, _v3, etc.) from a tool ID or name.
* Re-exported from the canonical `@sim/utils/string` helper so existing
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/triggers/gmail/poller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createLogger } from '@sim/logger'
import { GmailIcon } from '@/components/icons'
import type { TriggerConfig } from '@/triggers/types'

const logger = createLogger('GmailPollingTrigger')

export const gmailPollingTrigger: TriggerConfig = {
id: 'gmail_poller',
name: 'Gmail Email Trigger',
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/triggers/hubspot/poller.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { createLogger } from '@sim/logger'
import { HubspotIcon } from '@/components/icons'
import { getScopesForService } from '@/lib/oauth/utils'
import type { TriggerConfig } from '@/triggers/types'

const logger = createLogger('HubSpotPollingTrigger')

export const hubspotPollingTrigger: TriggerConfig = {
id: 'hubspot_poller',
name: 'HubSpot CRM Trigger',
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/triggers/imap/poller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createLogger } from '@sim/logger'
import { MailServerIcon } from '@/components/icons'
import type { TriggerConfig } from '@/triggers/types'

const logger = createLogger('ImapPollingTrigger')

export const imapPollingTrigger: TriggerConfig = {
id: 'imap_poller',
name: 'IMAP Email Trigger',
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/triggers/outlook/poller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createLogger } from '@sim/logger'
import { OutlookIcon } from '@/components/icons'
import type { TriggerConfig } from '@/triggers/types'

const logger = createLogger('OutlookPollingTrigger')

export const outlookPollingTrigger: TriggerConfig = {
id: 'outlook_poller',
name: 'Outlook Email Trigger',
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/triggers/webflow/collection_item_changed.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createLogger } from '@sim/logger'
import { WebflowIcon } from '@/components/icons'
import type { TriggerConfig } from '../types'

const logger = createLogger('webflow-collection-item-changed-trigger')

export const webflowCollectionItemChangedTrigger: TriggerConfig = {
id: 'webflow_collection_item_changed',
name: 'Collection Item Changed',
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/triggers/webflow/collection_item_created.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createLogger } from '@sim/logger'
import { WebflowIcon } from '@/components/icons'
import type { TriggerConfig } from '../types'

const logger = createLogger('webflow-collection-item-created-trigger')

export const webflowCollectionItemCreatedTrigger: TriggerConfig = {
id: 'webflow_collection_item_created',
name: 'Collection Item Created',
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/triggers/webflow/collection_item_deleted.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createLogger } from '@sim/logger'
import { WebflowIcon } from '@/components/icons'
import type { TriggerConfig } from '../types'

const logger = createLogger('webflow-collection-item-deleted-trigger')

export const webflowCollectionItemDeletedTrigger: TriggerConfig = {
id: 'webflow_collection_item_deleted',
name: 'Collection Item Deleted',
Expand Down
3 changes: 0 additions & 3 deletions apps/sim/triggers/webflow/form_submission.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { createLogger } from '@sim/logger'
import { WebflowIcon } from '@/components/icons'
import type { TriggerConfig } from '../types'

const logger = createLogger('webflow-form-submission-trigger')

export const webflowFormSubmissionTrigger: TriggerConfig = {
id: 'webflow_form_submission',
name: 'Form Submission',
Expand Down
Loading