From d1b0a62e9ed44dfd95bb4694c29563546fcf6459 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 21 Aug 2026 20:56:16 -0700 Subject: [PATCH 1/2] improvement(perf): cut server-only and unused code out of the workspace client bundles Every workspace route shipped JavaScript it never executes. Four independent import edges, each fixed by moving a symbol rather than changing behaviour: - js-tiktoken's BPE rank tables (5.4 MB source / 2.5 MB wire) reached the workflow editor because the tokenization barrel re-exported the exact counters alongside the character heuristics. Split into lib/tokenization/accurate.ts, which the barrel no longer re-exports. - crypto-browserify (~105 KB gzip, all 26 workspace routes) came from the Salesforce and Gong triggers importing webhook provider modules that reach node:crypto through @sim/security. The two symbols they actually needed are now in crypto-free modules. - tables, files and knowledge each imported one dependency-free hook from the sidebar-hooks barrel, whose other exports reach the 5 MB generated tool-metadata artifact. Deep-imported per the code-splitting rule in sim-imports.md. - lib/workflows/subblocks/display.ts imported a string constant from a React module under app/, inverting the app/lib layering. Moved to lib/. Also adds a loading boundary to chat/[chatId]. Without one, a dynamic route is prefetched as nothing, so clicking a chat held the previous chat on screen for the whole server round trip. Measured on a production build, JS downloaded before the load event: /w/[workflowId] 7.38 MB -> 4.80 MB (-35%) /logs 4.57 MB -> 4.44 MB /knowledge 4.35 MB -> 4.22 MB /home 4.57 MB -> 4.44 MB crypto-browserify no longer appears in any shipped chunk. The tool-registry boundary baseline is retightened so the reclaimed graph weight cannot silently regress. --- .../[workspaceId]/chat/[chatId]/loading.tsx | 19 ++ .../workspace/[workspaceId]/files/files.tsx | 8 +- .../components/chunk-editor/chunk-editor.tsx | 2 +- .../[workspaceId]/knowledge/knowledge.tsx | 8 +- .../workflows-list/workflows-list.tsx | 2 +- .../components/log-details/log-details.tsx | 2 +- .../app/workspace/[workspaceId]/logs/logs.tsx | 2 +- .../app/workspace/[workspaceId]/logs/utils.ts | 2 - .../secret-usage-panel/secret-usage-panel.tsx | 3 +- .../workspace/[workspaceId]/tables/tables.tsx | 8 +- .../workflow-selector-input.tsx | 2 +- .../preview-editor/preview-editor.tsx | 10 +- .../executor/handlers/agent/memory.test.ts | 2 +- apps/sim/executor/handlers/agent/memory.ts | 2 +- apps/sim/lib/embeddings/client.ts | 3 +- apps/sim/lib/tokenization/accurate.ts | 186 +++++++++++++ apps/sim/lib/tokenization/estimators.ts | 177 +----------- apps/sim/lib/tokenization/index.ts | 10 +- .../sim/lib/webhooks/providers/gong-config.ts | 9 + apps/sim/lib/webhooks/providers/gong.test.ts | 2 +- apps/sim/lib/webhooks/providers/gong.ts | 2 +- .../webhooks/providers/salesforce-payload.ts | 43 +++ apps/sim/lib/webhooks/providers/salesforce.ts | 32 +-- apps/sim/lib/workflows/subblocks/display.ts | 2 +- apps/sim/lib/workflows/workflow-labels.ts | 10 + apps/sim/triggers/gong/utils.ts | 2 +- apps/sim/triggers/salesforce/utils.ts | 2 +- ...check-tool-registry-boundary.baseline.json | 252 +++++++++--------- 28 files changed, 447 insertions(+), 357 deletions(-) create mode 100644 apps/sim/app/workspace/[workspaceId]/chat/[chatId]/loading.tsx create mode 100644 apps/sim/lib/tokenization/accurate.ts create mode 100644 apps/sim/lib/webhooks/providers/gong-config.ts create mode 100644 apps/sim/lib/webhooks/providers/salesforce-payload.ts create mode 100644 apps/sim/lib/workflows/workflow-labels.ts diff --git a/apps/sim/app/workspace/[workspaceId]/chat/[chatId]/loading.tsx b/apps/sim/app/workspace/[workspaceId]/chat/[chatId]/loading.tsx new file mode 100644 index 00000000000..ff1e96e036e --- /dev/null +++ b/apps/sim/app/workspace/[workspaceId]/chat/[chatId]/loading.tsx @@ -0,0 +1,19 @@ +import { HomeFallback } from '@/app/workspace/[workspaceId]/home/home-fallback' + +/** + * Route-level loading boundary for a chat. + * + * Its real job is prefetching, not painting. With `cacheComponents` off, a + * default `` prefetch degrades to Next's LoadingBoundary strategy, which + * prefetches a dynamic route only as far as its nearest `loading` segment — so + * a route without one is prefetched as nothing, and clicking a chat leaves the + * previous chat frozen on screen until the server responds. This file is what + * makes that click commit immediately. + * + * Renders the same surface `HomeFallback` gives the Suspense boundary inside + * the page, so the loading frame and the mounted frame share a background and + * the transition reads as one step rather than two. + */ +export default function ChatLoading() { + return +} diff --git a/apps/sim/app/workspace/[workspaceId]/files/files.tsx b/apps/sim/app/workspace/[workspaceId]/files/files.tsx index 71800c82e2c..0a3fc8f2eaa 100644 --- a/apps/sim/app/workspace/[workspaceId]/files/files.tsx +++ b/apps/sim/app/workspace/[workspaceId]/files/files.tsx @@ -128,7 +128,13 @@ import { } from '@/app/workspace/[workspaceId]/files/untitled-title' import { useRegisterGlobalCommands } from '@/app/workspace/[workspaceId]/providers/global-commands-provider' import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' +/** + * Deep-imported rather than taken from the `sidebar/hooks` barrel on purpose. That barrel + * also exports `useWorkflowOperations`, whose graph reaches `stores/workflow-diff` -> + * `serializer` -> `tools/metadata`, pulling the 5 MB generated tool-metadata artifact into + * this route's client bundle for a hook that is a dependency-free leaf. + */ +import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu' import { usePinItem, usePinnedIds, useUnpinItem } from '@/hooks/queries/pinned-items' import { useWorkspaceMembersQuery, type WorkspaceMember } from '@/hooks/queries/workspace' import { diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-editor/chunk-editor.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-editor/chunk-editor.tsx index fd6e1f23667..db86183c216 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-editor/chunk-editor.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/chunk-editor/chunk-editor.tsx @@ -6,7 +6,7 @@ import { isApiClientError } from '@/lib/api/client/errors' import { requestJson } from '@/lib/api/client/request' import { getKnowledgeChunkContract } from '@/lib/api/contracts/knowledge' import type { ChunkData, DocumentData } from '@/lib/knowledge/types' -import { getAccurateTokenCount, getTokenStrings } from '@/lib/tokenization/estimators' +import { getAccurateTokenCount, getTokenStrings } from '@/lib/tokenization/accurate' import { useCreateChunk, useUpdateChunk } from '@/hooks/queries/kb/knowledge' import { useAutosave } from '@/hooks/use-autosave' diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx index 6176f1abe9b..f31fad6c0f3 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx @@ -79,7 +79,13 @@ import { } from '@/app/workspace/[workspaceId]/knowledge/search-params' import { useRegisterGlobalCommands } from '@/app/workspace/[workspaceId]/providers/global-commands-provider' import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' +/** + * Deep-imported rather than taken from the `sidebar/hooks` barrel on purpose. That barrel + * also exports `useWorkflowOperations`, whose graph reaches `stores/workflow-diff` -> + * `serializer` -> `tools/metadata`, pulling the 5 MB generated tool-metadata artifact into + * this route's client bundle for a hook that is a dependency-free leaf. + */ +import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu' import { BrandIcon } from '@/blocks/brand-icon' import { CONNECTOR_META_REGISTRY } from '@/connectors/registry' import { useKnowledgeBasesList } from '@/hooks/kb/use-knowledge' diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/workflows-list/workflows-list.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/workflows-list/workflows-list.tsx index e46027442d5..3dae7eee182 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/workflows-list/workflows-list.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/workflows-list/workflows-list.tsx @@ -1,8 +1,8 @@ import { memo } from 'react' import { cn, handleKeyboardActivation } from '@sim/emcn' import { Workflow } from '@sim/emcn/icons' +import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import { FloatingOverflowText } from '@/app/workspace/[workspaceId]/components' -import { DELETED_WORKFLOW_LABEL } from '@/app/workspace/[workspaceId]/logs/utils' import { StatusBar, type StatusBarSegment } from '..' export interface WorkflowExecutionItem { diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx index 7a8c9506a5e..33adb2639ff 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx @@ -47,6 +47,7 @@ import { MothershipHandoffStorage } from '@/lib/core/utils/browser-storage' import { filterHiddenOutputKeys } from '@/lib/logs/execution/trace-spans/trace-spans' import type { TraceSpan } from '@/lib/logs/types' import { sendMothershipMessage } from '@/lib/mothership/events' +import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import { ExecutionSnapshot, FileCards, @@ -58,7 +59,6 @@ import { logDetailsTabUrlKeys, } from '@/app/workspace/[workspaceId]/logs/search-params' import { - DELETED_WORKFLOW_LABEL, formatDate, getDisplayStatus, resolveLogWorkflowId, diff --git a/apps/sim/app/workspace/[workspaceId]/logs/logs.tsx b/apps/sim/app/workspace/[workspaceId]/logs/logs.tsx index d49b7a691fa..054a9e5ae03 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/logs.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/logs.tsx @@ -49,6 +49,7 @@ import { type WorkflowData, } from '@/lib/logs/search-suggestions' import { SEARCH_DEBOUNCE_MS } from '@/lib/url-state' +import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import type { FilterTag, ResourceAction, @@ -94,7 +95,6 @@ import { useFilterStore } from '@/stores/logs/filters/store' import { CORE_TRIGGER_TYPES } from '@/stores/logs/filters/types' import { Dashboard, ExecutionSnapshot, LogDetails, LogRowContextMenu } from './components' import { - DELETED_WORKFLOW_LABEL, formatDate, getDisplayStatus, type LogStatus, diff --git a/apps/sim/app/workspace/[workspaceId]/logs/utils.ts b/apps/sim/app/workspace/[workspaceId]/logs/utils.ts index 05820985af3..4736430b5b2 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/utils.ts +++ b/apps/sim/app/workspace/[workspaceId]/logs/utils.ts @@ -15,8 +15,6 @@ export const LOG_COLUMNS = { duration: { width: 'w-[20%]', minWidth: 'min-w-[100px]', label: 'Duration' }, } as const -export const DELETED_WORKFLOW_LABEL = 'Deleted Workflow' - /** * Resolves the workflow a log row points at, or null when there is nowhere to * navigate. Sim agent jobs have no workflow of their own, and a deleted diff --git a/apps/sim/app/workspace/[workspaceId]/settings/secrets/[credentialId]/components/secret-usage-panel/secret-usage-panel.tsx b/apps/sim/app/workspace/[workspaceId]/settings/secrets/[credentialId]/components/secret-usage-panel/secret-usage-panel.tsx index ea94acb2b74..1e59583d091 100644 --- a/apps/sim/app/workspace/[workspaceId]/settings/secrets/[credentialId]/components/secret-usage-panel/secret-usage-panel.tsx +++ b/apps/sim/app/workspace/[workspaceId]/settings/secrets/[credentialId]/components/secret-usage-panel/secret-usage-panel.tsx @@ -5,8 +5,9 @@ import { ChipLink } from '@sim/emcn' import { formatDateTime } from '@sim/utils/formatting' import { SettingsActionChip } from '@/components/settings/settings-header' import type { SecretUsageEntryPayload, SecretUsageScope } from '@/lib/api/contracts' +import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import { FloatingOverflowText } from '@/app/workspace/[workspaceId]/components' -import { DELETED_WORKFLOW_LABEL, TriggerBadge } from '@/app/workspace/[workspaceId]/logs/utils' +import { TriggerBadge } from '@/app/workspace/[workspaceId]/logs/utils' import { ActivityLog, type ActivityLogEntry, diff --git a/apps/sim/app/workspace/[workspaceId]/tables/tables.tsx b/apps/sim/app/workspace/[workspaceId]/tables/tables.tsx index b5ffc797b04..4455d672304 100644 --- a/apps/sim/app/workspace/[workspaceId]/tables/tables.tsx +++ b/apps/sim/app/workspace/[workspaceId]/tables/tables.tsx @@ -77,7 +77,13 @@ import { tablesSortParams, tablesUrlKeys, } from '@/app/workspace/[workspaceId]/tables/search-params' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' +/** + * Deep-imported rather than taken from the `sidebar/hooks` barrel on purpose. That barrel + * also exports `useWorkflowOperations`, whose graph reaches `stores/workflow-diff` -> + * `serializer` -> `tools/metadata`, pulling the 5 MB generated tool-metadata artifact into + * this route's client bundle for a hook that is a dependency-free leaf. + */ +import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu' import { useCreateFolder, useDeleteFolderMutation, useUpdateFolder } from '@/hooks/queries/folders' import { usePinItem, usePinnedIds, useUnpinItem } from '@/hooks/queries/pinned-items' import { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/workflow-selector/workflow-selector-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/workflow-selector/workflow-selector-input.tsx index 4d1266b273f..c92fe8dc311 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/workflow-selector/workflow-selector-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/workflow-selector/workflow-selector-input.tsx @@ -2,7 +2,7 @@ import { useMemo } from 'react' import { useParams } from 'next/navigation' -import { DELETED_WORKFLOW_LABEL } from '@/app/workspace/[workspaceId]/logs/utils' +import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import { SelectorCombobox } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox' import type { SubBlockConfig } from '@/blocks/types' import type { SelectorContext } from '@/hooks/selectors/types' diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx index e7dd73f90ce..e4a4f79e8b0 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx @@ -37,11 +37,17 @@ import { isSubBlockVisibleForMode, isToolInputOnlySubBlock, } from '@/lib/workflows/subblocks/visibility' -import { DELETED_WORKFLOW_LABEL } from '@/app/workspace/[workspaceId]/logs/utils' +import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import { SubBlock } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components' import { PreviewContextMenu } from '@/app/workspace/[workspaceId]/w/components/preview/components/preview-context-menu' import { PreviewWorkflow } from '@/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' +/** + * Deep-imported rather than taken from the `sidebar/hooks` barrel on purpose. That barrel + * also exports `useWorkflowOperations`, whose graph reaches `stores/workflow-diff` -> + * `serializer` -> `tools/metadata`, pulling the 5 MB generated tool-metadata artifact into + * this route's client bundle for a hook that is a dependency-free leaf. + */ +import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu' import { getBlock } from '@/blocks' import { BlockTile } from '@/blocks/block-tile' import type { BlockConfig, SubBlockConfig, SubBlockType } from '@/blocks/types' diff --git a/apps/sim/executor/handlers/agent/memory.test.ts b/apps/sim/executor/handlers/agent/memory.test.ts index 9a1186b7a4b..465dec67f15 100644 --- a/apps/sim/executor/handlers/agent/memory.test.ts +++ b/apps/sim/executor/handlers/agent/memory.test.ts @@ -33,7 +33,7 @@ const mockMemoryLogger = vi.mocked(loggerMock.createLogger).mock.results[ vi.mocked(loggerMock.createLogger).mock.calls.findIndex(([name]) => name === 'Memory') ].value -vi.mock('@/lib/tokenization/estimators', () => ({ +vi.mock('@/lib/tokenization/accurate', () => ({ getAccurateTokenCount: vi.fn((text: string) => { return Math.ceil(text.length / 4) }), diff --git a/apps/sim/executor/handlers/agent/memory.ts b/apps/sim/executor/handlers/agent/memory.ts index b33d86b0b94..2498aba5dd0 100644 --- a/apps/sim/executor/handlers/agent/memory.ts +++ b/apps/sim/executor/handlers/agent/memory.ts @@ -20,7 +20,7 @@ import { readBoundMemorySecretProvenance, replaceMemorySecretProvenanceInTx, } from '@/lib/memory/secret-provenance' -import { getAccurateTokenCount } from '@/lib/tokenization/estimators' +import { getAccurateTokenCount } from '@/lib/tokenization/accurate' import { MEMORY } from '@/executor/constants' import type { AgentInputs, Message } from '@/executor/handlers/agent/types' import type { ExecutionContext } from '@/executor/types' diff --git a/apps/sim/lib/embeddings/client.ts b/apps/sim/lib/embeddings/client.ts index 825f96d8b6c..28bfe63ccfc 100644 --- a/apps/sim/lib/embeddings/client.ts +++ b/apps/sim/lib/embeddings/client.ts @@ -33,7 +33,8 @@ import { isRetryableError, retryWithExponentialBackoff, } from '@/lib/knowledge/documents/utils' -import { batchByTokenLimit, estimateTokenCount, truncateToTokenLimit } from '@/lib/tokenization' +import { estimateTokenCount } from '@/lib/tokenization' +import { batchByTokenLimit, truncateToTokenLimit } from '@/lib/tokenization/accurate' const logger = createLogger('EmbeddingClient') diff --git a/apps/sim/lib/tokenization/accurate.ts b/apps/sim/lib/tokenization/accurate.ts new file mode 100644 index 00000000000..160196f7a4d --- /dev/null +++ b/apps/sim/lib/tokenization/accurate.ts @@ -0,0 +1,186 @@ +/** + * Exact token counting backed by `js-tiktoken`. + * + * Split out of `estimators.ts` because `js-tiktoken` embeds every BPE rank table + * (5.4 MB of source, 2.5 MB over the wire). `estimators.ts` is reached from the + * workflow editor through `tokenization/index` -> `calculators` -> `estimators`, + * so a static import there put the whole tokenizer on the critical path of a + * route that only needs the character-heuristic estimators. Callers that need an + * exact count import this module directly; nothing re-exports it from the + * barrel, which is what keeps it out of the shared client chunk. + */ + +import { createLogger } from '@sim/logger' +import { encodingForModel, type Tiktoken } from 'js-tiktoken' + +const logger = createLogger('TokenizationAccurate') + +const encodingCache = new Map() + +/** + * Get or create a cached encoding for a model + */ +function getEncoding(modelName: string): Tiktoken { + if (encodingCache.has(modelName)) { + return encodingCache.get(modelName)! + } + + try { + const encoding = encodingForModel(modelName as Parameters[0]) + encodingCache.set(modelName, encoding) + return encoding + } catch (error) { + logger.warn(`Failed to get encoding for model ${modelName}, falling back to cl100k_base`) + const encoding = encodingForModel('gpt-4') + encodingCache.set(modelName, encoding) + return encoding + } +} + +if (typeof process !== 'undefined') { + process.on('beforeExit', () => { + clearEncodingCache() + }) +} + +/** + * Get accurate token count for text using tiktoken + * This is the exact count OpenAI's API will use + */ +export function getAccurateTokenCount(text: string, modelName = 'text-embedding-3-small'): number { + if (!text || text.length === 0) { + return 0 + } + + try { + const encoding = getEncoding(modelName) + const tokens = encoding.encode(text) + return tokens.length + } catch (error) { + logger.error('Error counting tokens with tiktoken:', error) + return Math.ceil(text.length / 4) + } +} + +/** + * Get individual tokens as strings for visualization + * Returns an array of token strings that can be displayed with colors + */ +export function getTokenStrings(text: string, modelName = 'text-embedding-3-small'): string[] { + if (!text || text.length === 0) { + return [] + } + + try { + const encoding = getEncoding(modelName) + const tokenIds = encoding.encode(text) + + const textChars = [...text] + const result: string[] = [] + let prevCharCount = 0 + + for (let i = 0; i < tokenIds.length; i++) { + const decoded = encoding.decode(tokenIds.slice(0, i + 1)) + const currentCharCount = [...decoded].length + const tokenCharCount = currentCharCount - prevCharCount + + const tokenStr = textChars.slice(prevCharCount, prevCharCount + tokenCharCount).join('') + result.push(tokenStr) + prevCharCount = currentCharCount + } + + return result + } catch (error) { + logger.error('Error getting token strings:', error) + return text.split(/(\s+)/).filter((s) => s.length > 0) + } +} + +/** + * Truncate text to a maximum token count + * Useful for handling texts that exceed model limits + */ +export function truncateToTokenLimit( + text: string, + maxTokens: number, + modelName = 'text-embedding-3-small' +): string { + if (!text || maxTokens <= 0) { + return '' + } + + try { + const encoding = getEncoding(modelName) + const tokens = encoding.encode(text) + + if (tokens.length <= maxTokens) { + return text + } + + const truncatedTokens = tokens.slice(0, maxTokens) + const truncatedText = encoding.decode(truncatedTokens) + + logger.warn( + `Truncated text from ${tokens.length} to ${maxTokens} tokens (${text.length} to ${truncatedText.length} chars)` + ) + + return truncatedText + } catch (error) { + logger.error('Error truncating text:', error) + const maxChars = maxTokens * 4 + return text.slice(0, maxChars) + } +} + +/** + * Batch texts by token count to stay within API limits + * Returns array of batches where each batch's total tokens <= maxTokensPerBatch + */ +export function batchByTokenLimit( + texts: string[], + maxTokensPerBatch: number, + modelName = 'text-embedding-3-small' +): string[][] { + const batches: string[][] = [] + let currentBatch: string[] = [] + let currentTokenCount = 0 + + for (const text of texts) { + const tokenCount = getAccurateTokenCount(text, modelName) + + if (tokenCount > maxTokensPerBatch) { + if (currentBatch.length > 0) { + batches.push(currentBatch) + currentBatch = [] + currentTokenCount = 0 + } + + const truncated = truncateToTokenLimit(text, maxTokensPerBatch, modelName) + batches.push([truncated]) + continue + } + + if (currentBatch.length > 0 && currentTokenCount + tokenCount > maxTokensPerBatch) { + batches.push(currentBatch) + currentBatch = [text] + currentTokenCount = tokenCount + } else { + currentBatch.push(text) + currentTokenCount += tokenCount + } + } + + if (currentBatch.length > 0) { + batches.push(currentBatch) + } + + return batches +} + +/** + * Clean up cached encodings (call when shutting down) + */ +export function clearEncodingCache(): void { + encodingCache.clear() + logger.info('Cleared tiktoken encoding cache') +} diff --git a/apps/sim/lib/tokenization/estimators.ts b/apps/sim/lib/tokenization/estimators.ts index 01aed1c1e6d..7e3dac06d13 100644 --- a/apps/sim/lib/tokenization/estimators.ts +++ b/apps/sim/lib/tokenization/estimators.ts @@ -1,185 +1,12 @@ /** - * Token estimation and accurate counting functions for different providers + * Character-heuristic token estimation. Exact, tokenizer-backed counting lives + * in `@/lib/tokenization/accurate`. */ -import { createLogger } from '@sim/logger' -import { encodingForModel, type Tiktoken } from 'js-tiktoken' import { MIN_TEXT_LENGTH_FOR_ESTIMATION, TOKENIZATION_CONFIG } from '@/lib/tokenization/constants' import type { TokenEstimate } from '@/lib/tokenization/types' import { getProviderConfig } from '@/lib/tokenization/utils' -const logger = createLogger('TokenizationEstimators') - -const encodingCache = new Map() - -/** - * Get or create a cached encoding for a model - */ -function getEncoding(modelName: string): Tiktoken { - if (encodingCache.has(modelName)) { - return encodingCache.get(modelName)! - } - - try { - const encoding = encodingForModel(modelName as Parameters[0]) - encodingCache.set(modelName, encoding) - return encoding - } catch (error) { - logger.warn(`Failed to get encoding for model ${modelName}, falling back to cl100k_base`) - const encoding = encodingForModel('gpt-4') - encodingCache.set(modelName, encoding) - return encoding - } -} - -if (typeof process !== 'undefined') { - process.on('beforeExit', () => { - clearEncodingCache() - }) -} - -/** - * Get accurate token count for text using tiktoken - * This is the exact count OpenAI's API will use - */ -export function getAccurateTokenCount(text: string, modelName = 'text-embedding-3-small'): number { - if (!text || text.length === 0) { - return 0 - } - - try { - const encoding = getEncoding(modelName) - const tokens = encoding.encode(text) - return tokens.length - } catch (error) { - logger.error('Error counting tokens with tiktoken:', error) - return Math.ceil(text.length / 4) - } -} - -/** - * Get individual tokens as strings for visualization - * Returns an array of token strings that can be displayed with colors - */ -export function getTokenStrings(text: string, modelName = 'text-embedding-3-small'): string[] { - if (!text || text.length === 0) { - return [] - } - - try { - const encoding = getEncoding(modelName) - const tokenIds = encoding.encode(text) - - const textChars = [...text] - const result: string[] = [] - let prevCharCount = 0 - - for (let i = 0; i < tokenIds.length; i++) { - const decoded = encoding.decode(tokenIds.slice(0, i + 1)) - const currentCharCount = [...decoded].length - const tokenCharCount = currentCharCount - prevCharCount - - const tokenStr = textChars.slice(prevCharCount, prevCharCount + tokenCharCount).join('') - result.push(tokenStr) - prevCharCount = currentCharCount - } - - return result - } catch (error) { - logger.error('Error getting token strings:', error) - return text.split(/(\s+)/).filter((s) => s.length > 0) - } -} - -/** - * Truncate text to a maximum token count - * Useful for handling texts that exceed model limits - */ -export function truncateToTokenLimit( - text: string, - maxTokens: number, - modelName = 'text-embedding-3-small' -): string { - if (!text || maxTokens <= 0) { - return '' - } - - try { - const encoding = getEncoding(modelName) - const tokens = encoding.encode(text) - - if (tokens.length <= maxTokens) { - return text - } - - const truncatedTokens = tokens.slice(0, maxTokens) - const truncatedText = encoding.decode(truncatedTokens) - - logger.warn( - `Truncated text from ${tokens.length} to ${maxTokens} tokens (${text.length} to ${truncatedText.length} chars)` - ) - - return truncatedText - } catch (error) { - logger.error('Error truncating text:', error) - const maxChars = maxTokens * 4 - return text.slice(0, maxChars) - } -} - -/** - * Batch texts by token count to stay within API limits - * Returns array of batches where each batch's total tokens <= maxTokensPerBatch - */ -export function batchByTokenLimit( - texts: string[], - maxTokensPerBatch: number, - modelName = 'text-embedding-3-small' -): string[][] { - const batches: string[][] = [] - let currentBatch: string[] = [] - let currentTokenCount = 0 - - for (const text of texts) { - const tokenCount = getAccurateTokenCount(text, modelName) - - if (tokenCount > maxTokensPerBatch) { - if (currentBatch.length > 0) { - batches.push(currentBatch) - currentBatch = [] - currentTokenCount = 0 - } - - const truncated = truncateToTokenLimit(text, maxTokensPerBatch, modelName) - batches.push([truncated]) - continue - } - - if (currentBatch.length > 0 && currentTokenCount + tokenCount > maxTokensPerBatch) { - batches.push(currentBatch) - currentBatch = [text] - currentTokenCount = tokenCount - } else { - currentBatch.push(text) - currentTokenCount += tokenCount - } - } - - if (currentBatch.length > 0) { - batches.push(currentBatch) - } - - return batches -} - -/** - * Clean up cached encodings (call when shutting down) - */ -export function clearEncodingCache(): void { - encodingCache.clear() - logger.info('Cleared tiktoken encoding cache') -} - /** * Estimates token count for text using provider-specific heuristics */ diff --git a/apps/sim/lib/tokenization/index.ts b/apps/sim/lib/tokenization/index.ts index 1093aa97a2c..32750225ad5 100644 --- a/apps/sim/lib/tokenization/index.ts +++ b/apps/sim/lib/tokenization/index.ts @@ -5,14 +5,16 @@ export { } from '@/lib/tokenization/calculators' export { LLM_BLOCK_TYPES, TOKENIZATION_CONFIG } from '@/lib/tokenization/constants' export { createTokenizationError, TokenizationError } from '@/lib/tokenization/errors' +/** + * The exact, `js-tiktoken`-backed counters are deliberately NOT re-exported here. + * Re-exporting them would put the tokenizer's 5.4 MB of BPE rank tables back into + * every client graph that touches this barrel. Import `@/lib/tokenization/accurate` + * directly when an exact count is required. + */ export { - batchByTokenLimit, - clearEncodingCache, estimateInputTokens, estimateOutputTokens, estimateTokenCount, - getAccurateTokenCount, - truncateToTokenLimit, } from '@/lib/tokenization/estimators' export { processStreamingBlockLog, processStreamingBlockLogs } from '@/lib/tokenization/streaming' export { diff --git a/apps/sim/lib/webhooks/providers/gong-config.ts b/apps/sim/lib/webhooks/providers/gong-config.ts new file mode 100644 index 00000000000..5535a458bb6 --- /dev/null +++ b/apps/sim/lib/webhooks/providers/gong-config.ts @@ -0,0 +1,9 @@ +/** + * Provider-config keys for the Gong webhook trigger. + * + * Separate from `providers/gong.ts` for the same reason as + * `salesforce-payload.ts`: the Gong trigger definition is client-reachable + * through the trigger registry, and the provider module reaches `@sim/security` + * -> `node:crypto`, which Next polyfills to `crypto-browserify` in the browser. + */ +export const GONG_JWT_PUBLIC_KEY_CONFIG_KEY = 'gongJwtPublicKeyPem' diff --git a/apps/sim/lib/webhooks/providers/gong.test.ts b/apps/sim/lib/webhooks/providers/gong.test.ts index d6841cf6194..fd139d07c70 100644 --- a/apps/sim/lib/webhooks/providers/gong.test.ts +++ b/apps/sim/lib/webhooks/providers/gong.test.ts @@ -3,11 +3,11 @@ import * as jose from 'jose' import { NextRequest } from 'next/server' import { describe, expect, it } from 'vitest' import { - GONG_JWT_PUBLIC_KEY_CONFIG_KEY, gongHandler, normalizeGongPublicKeyPem, verifyGongJwtAuth, } from '@/lib/webhooks/providers/gong' +import { GONG_JWT_PUBLIC_KEY_CONFIG_KEY } from '@/lib/webhooks/providers/gong-config' describe('normalizeGongPublicKeyPem', () => { it('passes through PEM', () => { diff --git a/apps/sim/lib/webhooks/providers/gong.ts b/apps/sim/lib/webhooks/providers/gong.ts index 399e9074d20..609b595be90 100644 --- a/apps/sim/lib/webhooks/providers/gong.ts +++ b/apps/sim/lib/webhooks/providers/gong.ts @@ -3,6 +3,7 @@ import { sha256Hex } from '@sim/security/hash' import { toError } from '@sim/utils/errors' import * as jose from 'jose' import { NextResponse } from 'next/server' +import { GONG_JWT_PUBLIC_KEY_CONFIG_KEY } from '@/lib/webhooks/providers/gong-config' import type { AuthContext, FormatInputContext, @@ -13,7 +14,6 @@ import type { const logger = createLogger('WebhookProvider:Gong') /** providerConfig key: PEM or raw base64 RSA public key from Gong (Signed JWT header auth). */ -export const GONG_JWT_PUBLIC_KEY_CONFIG_KEY = 'gongJwtPublicKeyPem' /** * Gong automation webhooks support either URL secrecy (token in path) or a signed JWT in diff --git a/apps/sim/lib/webhooks/providers/salesforce-payload.ts b/apps/sim/lib/webhooks/providers/salesforce-payload.ts new file mode 100644 index 00000000000..ec10073da50 --- /dev/null +++ b/apps/sim/lib/webhooks/providers/salesforce-payload.ts @@ -0,0 +1,43 @@ +/** + * Salesforce webhook payload shape helpers. + * + * Separate from `providers/salesforce.ts` because the Salesforce *trigger* + * definition needs this function, and the trigger registry is client-reachable. + * The provider module imports `providers/utils`, which reaches `@sim/security` + * and therefore `node:crypto` — Next polyfills that to `crypto-browserify` + * (~320 KB) in the browser layer, so importing it from a trigger shipped + * server-only signature verification to every workspace route. + */ + +import { isRecordLike } from '@sim/utils/object' + +export function extractSalesforceObjectTypeFromPayload( + body: Record +): string | undefined { + const direct = + (typeof body.objectType === 'string' && body.objectType) || + (typeof body.sobjectType === 'string' && body.sobjectType) || + undefined + if (direct) { + return direct + } + + const attrs = body.attributes as Record | undefined + if (typeof attrs?.type === 'string') { + return attrs.type + } + + const record = body.record + if (isRecordLike(record)) { + const r = record as Record + if (typeof r.sobjectType === 'string') { + return r.sobjectType + } + const ra = r.attributes as Record | undefined + if (typeof ra?.type === 'string') { + return ra.type + } + } + + return undefined +} diff --git a/apps/sim/lib/webhooks/providers/salesforce.ts b/apps/sim/lib/webhooks/providers/salesforce.ts index f53dcf65f54..0331da2d260 100644 --- a/apps/sim/lib/webhooks/providers/salesforce.ts +++ b/apps/sim/lib/webhooks/providers/salesforce.ts @@ -1,6 +1,7 @@ import { createLogger } from '@sim/logger' import { isRecordLike, toRecord } from '@sim/utils/object' import { NextResponse } from 'next/server' +import { extractSalesforceObjectTypeFromPayload } from '@/lib/webhooks/providers/salesforce-payload' import type { AuthContext, EventMatchContext, @@ -10,37 +11,6 @@ import type { } from '@/lib/webhooks/providers/types' import { buildFallbackDeliveryFingerprint, verifyTokenAuth } from '@/lib/webhooks/providers/utils' -export function extractSalesforceObjectTypeFromPayload( - body: Record -): string | undefined { - const direct = - (typeof body.objectType === 'string' && body.objectType) || - (typeof body.sobjectType === 'string' && body.sobjectType) || - undefined - if (direct) { - return direct - } - - const attrs = body.attributes as Record | undefined - if (typeof attrs?.type === 'string') { - return attrs.type - } - - const record = body.record - if (isRecordLike(record)) { - const r = record as Record - if (typeof r.sobjectType === 'string') { - return r.sobjectType - } - const ra = r.attributes as Record | undefined - if (typeof ra?.type === 'string') { - return ra.type - } - } - - return undefined -} - const logger = createLogger('WebhookProvider:Salesforce') function verifySalesforceSharedSecret(request: Request, secret: string): boolean { diff --git a/apps/sim/lib/workflows/subblocks/display.ts b/apps/sim/lib/workflows/subblocks/display.ts index 37f3f1f9785..fd315db7b77 100644 --- a/apps/sim/lib/workflows/subblocks/display.ts +++ b/apps/sim/lib/workflows/subblocks/display.ts @@ -9,7 +9,7 @@ import { isRecordLike } from '@sim/utils/object' import { truncate } from '@sim/utils/string' import type { FilterRule, SortRule } from '@/lib/table/types' -import { DELETED_WORKFLOW_LABEL } from '@/app/workspace/[workspaceId]/logs/utils' +import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import { getBlock } from '@/blocks' import type { SubBlockConfig } from '@/blocks/types' diff --git a/apps/sim/lib/workflows/workflow-labels.ts b/apps/sim/lib/workflows/workflow-labels.ts new file mode 100644 index 00000000000..350f80f48fc --- /dev/null +++ b/apps/sim/lib/workflows/workflow-labels.ts @@ -0,0 +1,10 @@ +/** + * Display labels for workflow references that no longer resolve. + * + * Lives in `lib/` rather than beside the logs table that first needed it because + * `lib/workflows/subblocks/display.ts` reads it too, and importing it from + * `app/workspace/[workspaceId]/logs/utils` inverted the app/lib layering while + * pulling React, `@sim/emcn`, and the block registry into every consumer of that + * module for the sake of one string. + */ +export const DELETED_WORKFLOW_LABEL = 'Deleted Workflow' diff --git a/apps/sim/triggers/gong/utils.ts b/apps/sim/triggers/gong/utils.ts index f218eb86cf5..ed484b2d39f 100644 --- a/apps/sim/triggers/gong/utils.ts +++ b/apps/sim/triggers/gong/utils.ts @@ -1,4 +1,4 @@ -import { GONG_JWT_PUBLIC_KEY_CONFIG_KEY } from '@/lib/webhooks/providers/gong' +import { GONG_JWT_PUBLIC_KEY_CONFIG_KEY } from '@/lib/webhooks/providers/gong-config' import type { SubBlockConfig } from '@/blocks/types' import type { TriggerOutput } from '@/triggers/types' diff --git a/apps/sim/triggers/salesforce/utils.ts b/apps/sim/triggers/salesforce/utils.ts index 1da79f322ec..5d5c8064209 100644 --- a/apps/sim/triggers/salesforce/utils.ts +++ b/apps/sim/triggers/salesforce/utils.ts @@ -1,4 +1,4 @@ -import { extractSalesforceObjectTypeFromPayload } from '@/lib/webhooks/providers/salesforce' +import { extractSalesforceObjectTypeFromPayload } from '@/lib/webhooks/providers/salesforce-payload' import type { SubBlockConfig } from '@/blocks/types' import type { TriggerOutput } from '@/triggers/types' import { normalizeToken } from '@/triggers/utils/tokens' diff --git a/scripts/check-tool-registry-boundary.baseline.json b/scripts/check-tool-registry-boundary.baseline.json index b8106a8cb7c..9491b8ffb92 100644 --- a/scripts/check-tool-registry-boundary.baseline.json +++ b/scripts/check-tool-registry-boundary.baseline.json @@ -10,29 +10,29 @@ "gateways": {} }, "app/workspace/[workspaceId]/chat/[chatId]/page.tsx": { - "modules": 3039, + "modules": 3047, "gateways": { - "apps/sim/app/workspace/[workspaceId]/home/home.tsx": 1375, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx": 1027, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/index.ts": 888, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/index.ts": 885, + "apps/sim/app/workspace/[workspaceId]/home/home.tsx": 1381, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx": 1031, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/index.ts": 892, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/index.ts": 889, "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 315, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 308, - "apps/sim/lib/auth/index.ts": 224 + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 311, + "apps/sim/lib/auth/index.ts": 227 } }, "app/workspace/[workspaceId]/files/[fileId]/page.tsx": { - "modules": 2030, + "modules": 2006, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 341, - "apps/sim/app/workspace/[workspaceId]/files/files.tsx": 299, - "apps/sim/lib/auth/index.ts": 230, - "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/index.ts": 148, - "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx": 131, - "apps/sim/lib/api/contracts/index.ts": 108, - "apps/sim/lib/webhooks/providers/index.ts": 104 + "apps/sim/app/workspace/[workspaceId]/files/files.tsx": 273, + "apps/sim/lib/auth/index.ts": 233, + "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/index.ts": 151, + "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx": 134, + "apps/sim/lib/api/contracts/index.ts": 109, + "apps/sim/lib/webhooks/providers/index.ts": 107 } }, "app/workspace/[workspaceId]/files/[fileId]/view/page.tsx": { @@ -43,16 +43,16 @@ } }, "app/workspace/[workspaceId]/files/page.tsx": { - "modules": 2030, + "modules": 2006, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 341, - "apps/sim/app/workspace/[workspaceId]/files/files.tsx": 301, - "apps/sim/lib/auth/index.ts": 230, - "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/index.ts": 148, - "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx": 131, - "apps/sim/lib/api/contracts/index.ts": 108, - "apps/sim/lib/webhooks/providers/index.ts": 104 + "apps/sim/app/workspace/[workspaceId]/files/files.tsx": 275, + "apps/sim/lib/auth/index.ts": 233, + "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/index.ts": 151, + "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx": 134, + "apps/sim/lib/api/contracts/index.ts": 109, + "apps/sim/lib/webhooks/providers/index.ts": 107 } }, "app/workspace/[workspaceId]/home/layout.tsx": { @@ -60,23 +60,23 @@ "gateways": {} }, "app/workspace/[workspaceId]/home/page.tsx": { - "modules": 3039, + "modules": 3047, "gateways": { - "apps/sim/app/workspace/[workspaceId]/home/home.tsx": 1375, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx": 1027, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/index.ts": 888, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/index.ts": 885, + "apps/sim/app/workspace/[workspaceId]/home/home.tsx": 1381, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx": 1031, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/index.ts": 892, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/index.ts": 889, "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 315, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 308, - "apps/sim/lib/auth/index.ts": 224 + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 311, + "apps/sim/lib/auth/index.ts": 227 } }, "app/workspace/[workspaceId]/integrations/[block]/page.tsx": { - "modules": 1330, + "modules": 1329, "gateways": { - "apps/sim/app/workspace/[workspaceId]/integrations/[block]/integration-block-detail.tsx": 1304, - "apps/sim/triggers/index.ts": 489, + "apps/sim/app/workspace/[workspaceId]/integrations/[block]/integration-block-detail.tsx": 1303, + "apps/sim/triggers/index.ts": 488, "apps/sim/blocks/registry.ts": 447, "apps/sim/lib/api/contracts/index.ts": 129, "apps/sim/blocks/blocks/credential-group.ts": 106, @@ -86,24 +86,24 @@ } }, "app/workspace/[workspaceId]/integrations/connected/[credentialId]/page.tsx": { - "modules": 1309, + "modules": 1307, "gateways": { - "apps/sim/app/workspace/[workspaceId]/integrations/connected/[credentialId]/connected-credential-detail.tsx": 1308, - "apps/sim/triggers/registry.ts": 488, + "apps/sim/app/workspace/[workspaceId]/integrations/connected/[credentialId]/connected-credential-detail.tsx": 1306, + "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 348, "apps/sim/lib/api/contracts/index.ts": 135, - "apps/sim/stores/workflows/registry/store.ts": 76, - "apps/sim/hooks/queries/deployments.ts": 73, - "apps/sim/lib/workflows/comparison/compare.ts": 70, - "apps/sim/lib/workflows/comparison/resolve-values.ts": 67 + "apps/sim/stores/workflows/registry/store.ts": 77, + "apps/sim/hooks/queries/deployments.ts": 74, + "apps/sim/lib/workflows/comparison/compare.ts": 71, + "apps/sim/lib/workflows/comparison/resolve-values.ts": 68 } }, "app/workspace/[workspaceId]/integrations/page.tsx": { - "modules": 1315, + "modules": 1314, "gateways": { - "apps/sim/app/workspace/[workspaceId]/integrations/integrations.tsx": 1025, - "apps/sim/blocks/registry.ts": 941, - "apps/sim/triggers/index.ts": 489, + "apps/sim/app/workspace/[workspaceId]/integrations/integrations.tsx": 1024, + "apps/sim/blocks/registry.ts": 940, + "apps/sim/triggers/index.ts": 488, "apps/sim/lib/api/contracts/index.ts": 131, "apps/sim/blocks/blocks/credential-group.ts": 107, "apps/sim/stores/workflows/registry/store.ts": 81, @@ -112,10 +112,10 @@ } }, "app/workspace/[workspaceId]/knowledge/[id]/[documentId]/page.tsx": { - "modules": 1538, + "modules": 1537, "gateways": { - "apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx": 1245, - "apps/sim/triggers/registry.ts": 488, + "apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx": 1244, + "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 344, "apps/sim/blocks/registry-maps.ts": 341, "apps/sim/lib/api/contracts/index.ts": 120, @@ -125,12 +125,12 @@ } }, "app/workspace/[workspaceId]/knowledge/[id]/page.tsx": { - "modules": 1553, + "modules": 1548, "gateways": { - "apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx": 1260, - "apps/sim/triggers/registry.ts": 488, - "apps/sim/blocks/registry.ts": 344, - "apps/sim/blocks/registry-maps.ts": 341, + "apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx": 1255, + "apps/sim/triggers/registry.ts": 487, + "apps/sim/blocks/registry.ts": 349, + "apps/sim/blocks/registry-maps.ts": 346, "apps/sim/lib/api/contracts/index.ts": 120, "apps/sim/connectors/registry.ts": 65, "apps/sim/app/workspace/[workspaceId]/components/index.ts": 60, @@ -138,42 +138,42 @@ } }, "app/workspace/[workspaceId]/knowledge/page.tsx": { - "modules": 2255, + "modules": 2230, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 339, - "apps/sim/app/workspace/[workspaceId]/knowledge/prefetch.ts": 289, - "apps/sim/lib/knowledge/application/knowledge-bases.ts": 233, - "apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx": 183, - "apps/sim/lib/auth/index.ts": 178, + "apps/sim/app/workspace/[workspaceId]/knowledge/prefetch.ts": 291, + "apps/sim/lib/knowledge/application/knowledge-bases.ts": 235, + "apps/sim/lib/auth/index.ts": 181, + "apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx": 154, "apps/sim/lib/knowledge/orchestration/index.ts": 148, "apps/sim/lib/knowledge/orchestration/connectors.ts": 142 } }, "app/workspace/[workspaceId]/layout.tsx": { - "modules": 2081, + "modules": 2082, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 340, "apps/sim/app/workspace/[workspaceId]/components/workspace-chrome/index.ts": 305, - "apps/sim/lib/auth/index.ts": 301, + "apps/sim/lib/auth/index.ts": 304, "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx": 297, "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/index.ts": 205, "apps/sim/lib/api/contracts/index.ts": 109, - "apps/sim/lib/webhooks/providers/index.ts": 104 + "apps/sim/lib/webhooks/providers/index.ts": 107 } }, "app/workspace/[workspaceId]/logs/page.tsx": { - "modules": 1770, + "modules": 1747, "gateways": { - "apps/sim/app/workspace/[workspaceId]/logs/logs.tsx": 1479, - "apps/sim/triggers/registry.ts": 488, - "apps/sim/app/workspace/[workspaceId]/logs/components/index.ts": 421, - "apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/execution-snapshot/index.ts": 367, + "apps/sim/app/workspace/[workspaceId]/logs/logs.tsx": 1456, + "apps/sim/triggers/registry.ts": 487, + "apps/sim/app/workspace/[workspaceId]/logs/components/index.ts": 398, + "apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/execution-snapshot/index.ts": 344, "apps/sim/blocks/registry.ts": 335, - "apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/index.ts": 323, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 288, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx": 256 + "apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/index.ts": 300, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 296, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx": 264 } }, "app/workspace/[workspaceId]/page.tsx": { @@ -185,16 +185,16 @@ "gateways": {} }, "app/workspace/[workspaceId]/settings/[section]/page.tsx": { - "modules": 2098, + "modules": 2101, "gateways": { "apps/sim/triggers/registry.ts": 452, - "apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx": 444, + "apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx": 445, "apps/sim/blocks/registry.ts": 339, - "apps/sim/lib/auth/index.ts": 310, + "apps/sim/lib/auth/index.ts": 313, "apps/sim/lib/api/contracts/index.ts": 107, - "apps/sim/lib/webhooks/providers/index.ts": 104, - "apps/sim/lib/api/contracts/tools/index.ts": 59, - "apps/sim/lib/uploads/utils/file-utils.server.ts": 46 + "apps/sim/lib/webhooks/providers/index.ts": 107, + "apps/sim/lib/webhooks/providers/registry.ts": 105, + "apps/sim/lib/api/contracts/tools/index.ts": 59 } }, "app/workspace/[workspaceId]/settings/billing/credit-usage/layout.tsx": { @@ -202,9 +202,9 @@ "gateways": {} }, "app/workspace/[workspaceId]/settings/billing/credit-usage/page.tsx": { - "modules": 1661, + "modules": 1663, "gateways": { - "apps/sim/lib/auth/index.ts": 1524, + "apps/sim/lib/auth/index.ts": 1526, "apps/sim/blocks/registry.ts": 616, "apps/sim/blocks/registry-maps.ts": 613, "apps/sim/triggers/index.ts": 453, @@ -223,23 +223,23 @@ "gateways": {} }, "app/workspace/[workspaceId]/settings/secrets/[credentialId]/page.tsx": { - "modules": 1347, + "modules": 1354, "gateways": { - "apps/sim/triggers/registry.ts": 488, + "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 350, "apps/sim/blocks/registry-maps.ts": 347, "apps/sim/lib/api/contracts/index.ts": 136, + "apps/sim/app/workspace/[workspaceId]/settings/secrets/[credentialId]/secret-detail.tsx": 77, "apps/sim/stores/workflows/registry/store.ts": 76, "apps/sim/hooks/queries/deployments.ts": 73, - "apps/sim/lib/workflows/comparison/compare.ts": 70, - "apps/sim/app/workspace/[workspaceId]/settings/secrets/[credentialId]/secret-detail.tsx": 68 + "apps/sim/lib/workflows/comparison/compare.ts": 70 } }, "app/workspace/[workspaceId]/skills/[skillId]/page.tsx": { - "modules": 1432, + "modules": 1430, "gateways": { - "apps/sim/app/workspace/[workspaceId]/skills/[skillId]/skill-detail.tsx": 1431, - "apps/sim/triggers/registry.ts": 488, + "apps/sim/app/workspace/[workspaceId]/skills/[skillId]/skill-detail.tsx": 1429, + "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 349, "apps/sim/blocks/registry-maps.ts": 347, "apps/sim/lib/api/contracts/index.ts": 127, @@ -249,10 +249,10 @@ } }, "app/workspace/[workspaceId]/skills/new/page.tsx": { - "modules": 1430, + "modules": 1428, "gateways": { - "apps/sim/app/workspace/[workspaceId]/skills/new/skill-create.tsx": 1429, - "apps/sim/triggers/registry.ts": 488, + "apps/sim/app/workspace/[workspaceId]/skills/new/skill-create.tsx": 1427, + "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 349, "apps/sim/blocks/registry-maps.ts": 347, "apps/sim/lib/api/contracts/index.ts": 127, @@ -262,42 +262,42 @@ } }, "app/workspace/[workspaceId]/skills/page.tsx": { - "modules": 1298, + "modules": 1297, "gateways": { - "apps/sim/app/workspace/[workspaceId]/skills/skills.tsx": 1008, - "apps/sim/app/workspace/[workspaceId]/integrations/components/showcase-with-explore/index.ts": 996, - "apps/sim/blocks/registry.ts": 984, - "apps/sim/blocks/registry-maps.ts": 982, - "apps/sim/triggers/index.ts": 489, + "apps/sim/app/workspace/[workspaceId]/skills/skills.tsx": 1007, + "apps/sim/app/workspace/[workspaceId]/integrations/components/showcase-with-explore/index.ts": 995, + "apps/sim/blocks/registry.ts": 983, + "apps/sim/blocks/registry-maps.ts": 981, + "apps/sim/triggers/index.ts": 488, "apps/sim/lib/api/contracts/index.ts": 136, "apps/sim/blocks/blocks/credential-group.ts": 120, "apps/sim/stores/workflows/registry/store.ts": 92 } }, "app/workspace/[workspaceId]/tables/[tableId]/page.tsx": { - "modules": 2293, + "modules": 2273, "gateways": { - "apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx": 585, + "apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx": 563, "apps/sim/triggers/registry.ts": 452, - "apps/sim/app/workspace/[workspaceId]/w/components/preview/index.ts": 337, - "apps/sim/lib/auth/index.ts": 332, + "apps/sim/lib/auth/index.ts": 335, "apps/sim/blocks/registry.ts": 315, - "apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/index.ts": 295, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 267, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx": 236 + "apps/sim/app/workspace/[workspaceId]/w/components/preview/index.ts": 314, + "apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/index.ts": 272, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 268, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx": 237 } }, "app/workspace/[workspaceId]/tables/page.tsx": { - "modules": 1885, + "modules": 1851, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 340, - "apps/sim/lib/auth/index.ts": 321, - "apps/sim/app/workspace/[workspaceId]/tables/tables.tsx": 142, - "apps/sim/lib/api/contracts/index.ts": 112, - "apps/sim/lib/webhooks/providers/index.ts": 104, - "apps/sim/lib/api/contracts/tools/index.ts": 60, - "apps/sim/app/workspace/[workspaceId]/components/index.ts": 58 + "apps/sim/lib/auth/index.ts": 324, + "apps/sim/lib/api/contracts/index.ts": 116, + "apps/sim/lib/webhooks/providers/index.ts": 107, + "apps/sim/app/workspace/[workspaceId]/tables/tables.tsx": 106, + "apps/sim/lib/webhooks/providers/registry.ts": 105, + "apps/sim/lib/api/contracts/tools/index.ts": 60 } }, "app/workspace/[workspaceId]/upgrade/page.tsx": { @@ -314,12 +314,12 @@ } }, "app/workspace/[workspaceId]/w/[workflowId]/layout.tsx": { - "modules": 2240, + "modules": 2241, "gateways": { - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx": 2239, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 544, - "apps/sim/triggers/registry.ts": 488, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 461, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx": 2240, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 547, + "apps/sim/triggers/registry.ts": 487, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 464, "apps/sim/blocks/registry.ts": 335, "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/index.ts": 289, "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx": 162, @@ -327,10 +327,10 @@ } }, "app/workspace/[workspaceId]/w/[workflowId]/page.tsx": { - "modules": 2267, + "modules": 2271, "gateways": { - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 2266, - "apps/sim/triggers/registry.ts": 488, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 2270, + "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 335, "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 308, "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 270, @@ -340,11 +340,11 @@ } }, "app/workspace/[workspaceId]/w/page.tsx": { - "modules": 2240, + "modules": 2241, "gateways": { - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 950, - "apps/sim/triggers/registry.ts": 488, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 461, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 953, + "apps/sim/triggers/registry.ts": 487, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 464, "apps/sim/blocks/registry.ts": 335, "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/index.ts": 289, "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx": 163, @@ -353,23 +353,23 @@ } }, "app/workspace/layout.tsx": { - "modules": 1244, + "modules": 1242, "gateways": { - "apps/sim/app/workspace/providers/socket-provider.tsx": 1234, - "apps/sim/triggers/registry.ts": 488, + "apps/sim/app/workspace/providers/socket-provider.tsx": 1232, + "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 350, "apps/sim/blocks/registry-maps.ts": 347, - "apps/sim/stores/workflows/registry/store.ts": 274, - "apps/sim/hooks/queries/deployments.ts": 271, - "apps/sim/lib/workflows/comparison/compare.ts": 265, - "apps/sim/lib/workflows/comparison/resolve-values.ts": 262 + "apps/sim/stores/workflows/registry/store.ts": 275, + "apps/sim/hooks/queries/deployments.ts": 272, + "apps/sim/lib/workflows/comparison/compare.ts": 266, + "apps/sim/lib/workflows/comparison/resolve-values.ts": 263 } }, "app/workspace/page.tsx": { - "modules": 1238, + "modules": 1237, "gateways": { - "apps/sim/lib/auth/stale-session-recovery.ts": 1001, - "apps/sim/triggers/index.ts": 489, + "apps/sim/lib/auth/stale-session-recovery.ts": 1000, + "apps/sim/triggers/index.ts": 488, "apps/sim/blocks/registry.ts": 350, "apps/sim/blocks/registry-maps.ts": 347, "apps/sim/lib/api/contracts/index.ts": 139, From 2487a0f693e38d2693c0c744d19ae4ca72d37a69 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Fri, 21 Aug 2026 21:04:16 -0700 Subject: [PATCH 2/2] improvement(sidebar): move useContextMenu to shared hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review flagged the four workspace routes deep-importing `useContextMenu` from the sidebar's hooks barrel as a barrel-convention violation. Fair — the code-splitting exception in sim-imports.md is written for `lazy()` splits, and these are static imports. The hook was in the wrong place to begin with. It is entirely generic — no sidebar-specific references, just right-click state and positioning — and nine consumers across tables, files, knowledge, home, the terminal and the preview editor already reached across features to get it. Moved to `@/hooks`, the repo's shared-hooks location, and every consumer including the sidebar's own now imports it from there. This satisfies the barrel convention rather than making an exception to it, and keeps the graph win: tables, knowledge and files stay off the sidebar barrel's path to `stores/workflow-diff -> serializer -> tools/metadata`, unchanged at 20.19 / 20.89 / 21.37 MB of reachable source. --- .../workspace/[workspaceId]/files/files.tsx | 8 +- .../terminal-session/terminal-session.tsx | 2 +- .../knowledge/[id]/[documentId]/document.tsx | 2 +- .../[workspaceId]/knowledge/[id]/base.tsx | 2 +- .../[workspaceId]/knowledge/knowledge.tsx | 8 +- .../workspace/[workspaceId]/tables/tables.tsx | 8 +- .../components/output-panel/output-panel.tsx | 2 +- .../components/terminal/terminal.tsx | 2 +- .../preview-editor/preview-editor.tsx | 8 +- .../components/folder-item/folder-item.tsx | 2 +- .../workflow-item/workflow-item.tsx | 2 +- .../workflow-list/workflow-list.tsx | 2 +- .../w/components/sidebar/hooks/index.ts | 1 - .../w/components/sidebar/sidebar.tsx | 2 +- .../sidebar => }/hooks/use-context-menu.ts | 0 ...check-tool-registry-boundary.baseline.json | 136 +++++++++--------- 16 files changed, 81 insertions(+), 106 deletions(-) rename apps/sim/{app/workspace/[workspaceId]/w/components/sidebar => }/hooks/use-context-menu.ts (100%) diff --git a/apps/sim/app/workspace/[workspaceId]/files/files.tsx b/apps/sim/app/workspace/[workspaceId]/files/files.tsx index 0a3fc8f2eaa..bd49e947710 100644 --- a/apps/sim/app/workspace/[workspaceId]/files/files.tsx +++ b/apps/sim/app/workspace/[workspaceId]/files/files.tsx @@ -128,13 +128,6 @@ import { } from '@/app/workspace/[workspaceId]/files/untitled-title' import { useRegisterGlobalCommands } from '@/app/workspace/[workspaceId]/providers/global-commands-provider' import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' -/** - * Deep-imported rather than taken from the `sidebar/hooks` barrel on purpose. That barrel - * also exports `useWorkflowOperations`, whose graph reaches `stores/workflow-diff` -> - * `serializer` -> `tools/metadata`, pulling the 5 MB generated tool-metadata artifact into - * this route's client bundle for a hook that is a dependency-free leaf. - */ -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu' import { usePinItem, usePinnedIds, useUnpinItem } from '@/hooks/queries/pinned-items' import { useWorkspaceMembersQuery, type WorkspaceMember } from '@/hooks/queries/workspace' import { @@ -153,6 +146,7 @@ import { useUploadWorkspaceFile, useWorkspaceFiles, } from '@/hooks/queries/workspace-files' +import { useContextMenu } from '@/hooks/use-context-menu' import { useDebouncedSearchSetter } from '@/hooks/use-debounced-search-setter' import { useInlineRename } from '@/hooks/use-inline-rename' import { usePermissionConfig } from '@/hooks/use-permission-config' diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/components/terminal-session/terminal-session.tsx b/apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/components/terminal-session/terminal-session.tsx index e6ffdb0eaa7..badaa075443 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/components/terminal-session/terminal-session.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/components/terminal-session/terminal-session.tsx @@ -34,6 +34,7 @@ import { WebLinksAddon } from '@xterm/addon-web-links' import { WebglAddon } from '@xterm/addon-webgl' import { type IBufferRange, Terminal } from '@xterm/xterm' import { useTheme } from 'next-themes' +import { useContextMenu } from '@/hooks/use-context-menu' import '@xterm/xterm/css/xterm.css' import { describeRunningCommand, @@ -73,7 +74,6 @@ import { useMothershipResources } from '@/app/workspace/[workspaceId]/home/compo import { TerminalContextMenu } from '@/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/components/terminal-session/terminal-context-menu' import { TerminalTabIcon } from '@/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/components/terminal-session/terminal-tab-icon' import { ContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/context-menu/context-menu' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' import { useDesktopPreferenceMutation } from '@/hooks/use-desktop-preference-mutation' import { useCopilotTerminalStore } from '@/stores/copilot-terminal/store' import type { ChatContext, TerminalTextSelection } from '@/stores/panel' diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx index 3edc0720140..2c381a7cf1f 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx @@ -59,7 +59,6 @@ import { import { ActionBar } from '@/app/workspace/[workspaceId]/knowledge/[id]/components' import { getDocumentIcon } from '@/app/workspace/[workspaceId]/knowledge/components' import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' import { CONNECTOR_META_REGISTRY } from '@/connectors/registry' import { useDocument, useDocumentChunks, useKnowledgeBase } from '@/hooks/kb/use-knowledge' import { @@ -69,6 +68,7 @@ import { useUpdateChunk, useUpdateDocument, } from '@/hooks/queries/kb/knowledge' +import { useContextMenu } from '@/hooks/use-context-menu' import { useDebounce } from '@/hooks/use-debounce' import { useDebouncedSearchSetter } from '@/hooks/use-debounced-search-setter' import { useInlineRename } from '@/hooks/use-inline-rename' diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx index 1a29f058115..76a061a032d 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx @@ -97,7 +97,6 @@ import { import { getDocumentIcon } from '@/app/workspace/[workspaceId]/knowledge/components' import { useRegisterGlobalCommands } from '@/app/workspace/[workspaceId]/providers/global-commands-provider' import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' import { BrandIcon } from '@/blocks/brand-icon' import { CONNECTOR_META_REGISTRY } from '@/connectors/registry' import { @@ -119,6 +118,7 @@ import { useUpdateDocument, useUpdateKnowledgeBase, } from '@/hooks/queries/kb/knowledge' +import { useContextMenu } from '@/hooks/use-context-menu' import { useDebounce } from '@/hooks/use-debounce' import { useDebouncedSearchSetter } from '@/hooks/use-debounced-search-setter' import { useInlineRename } from '@/hooks/use-inline-rename' diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx index f31fad6c0f3..8ed1934a1a2 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx @@ -79,13 +79,6 @@ import { } from '@/app/workspace/[workspaceId]/knowledge/search-params' import { useRegisterGlobalCommands } from '@/app/workspace/[workspaceId]/providers/global-commands-provider' import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' -/** - * Deep-imported rather than taken from the `sidebar/hooks` barrel on purpose. That barrel - * also exports `useWorkflowOperations`, whose graph reaches `stores/workflow-diff` -> - * `serializer` -> `tools/metadata`, pulling the 5 MB generated tool-metadata artifact into - * this route's client bundle for a hook that is a dependency-free leaf. - */ -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu' import { BrandIcon } from '@/blocks/brand-icon' import { CONNECTOR_META_REGISTRY } from '@/connectors/registry' import { useKnowledgeBasesList } from '@/hooks/kb/use-knowledge' @@ -98,6 +91,7 @@ import { } from '@/hooks/queries/kb/knowledge' import { usePinItem, usePinnedIds, useUnpinItem } from '@/hooks/queries/pinned-items' import { useWorkspaceMembersQuery, type WorkspaceMember } from '@/hooks/queries/workspace' +import { useContextMenu } from '@/hooks/use-context-menu' import { useDebouncedSearchSetter } from '@/hooks/use-debounced-search-setter' import { useInlineRename } from '@/hooks/use-inline-rename' import { usePermissionConfig } from '@/hooks/use-permission-config' diff --git a/apps/sim/app/workspace/[workspaceId]/tables/tables.tsx b/apps/sim/app/workspace/[workspaceId]/tables/tables.tsx index 4455d672304..c6d3c51f10f 100644 --- a/apps/sim/app/workspace/[workspaceId]/tables/tables.tsx +++ b/apps/sim/app/workspace/[workspaceId]/tables/tables.tsx @@ -77,13 +77,6 @@ import { tablesSortParams, tablesUrlKeys, } from '@/app/workspace/[workspaceId]/tables/search-params' -/** - * Deep-imported rather than taken from the `sidebar/hooks` barrel on purpose. That barrel - * also exports `useWorkflowOperations`, whose graph reaches `stores/workflow-diff` -> - * `serializer` -> `tools/metadata`, pulling the 5 MB generated tool-metadata artifact into - * this route's client bundle for a hook that is a dependency-free leaf. - */ -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu' import { useCreateFolder, useDeleteFolderMutation, useUpdateFolder } from '@/hooks/queries/folders' import { usePinItem, usePinnedIds, useUnpinItem } from '@/hooks/queries/pinned-items' import { @@ -99,6 +92,7 @@ import { } from '@/hooks/queries/tables' import { getCanonicalFolderPath } from '@/hooks/queries/utils/folder-tree' import { useWorkspaceMembersQuery, type WorkspaceMember } from '@/hooks/queries/workspace' +import { useContextMenu } from '@/hooks/use-context-menu' import { useDebouncedSearchSetter } from '@/hooks/use-debounced-search-setter' import { useInlineRename } from '@/hooks/use-inline-rename' import { usePermissionConfig } from '@/hooks/use-permission-config' diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/components/output-panel/output-panel.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/components/output-panel/output-panel.tsx index 8582f06c58e..5cf8d3fb57f 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/components/output-panel/output-panel.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/components/output-panel/output-panel.tsx @@ -34,8 +34,8 @@ import { StructuredOutput, } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/components/output-panel/components' import { ToggleButton } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/components/toggle-button' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' import { useCodeViewerFeatures } from '@/hooks/use-code-viewer' +import { useContextMenu } from '@/hooks/use-context-menu' import type { ConsoleEntry } from '@/stores/terminal' import { safeConsoleStringify, useTerminalStore } from '@/stores/terminal' diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx index adbffa83d00..ee8e48aa4b0 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx @@ -47,7 +47,7 @@ import { TERMINAL_CONFIG, type VisibleTerminalRow, } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/utils' -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks' +import { useContextMenu } from '@/hooks/use-context-menu' import { OUTPUT_PANEL_WIDTH, TERMINAL_HEIGHT } from '@/stores/constants' import type { ConsoleEntry } from '@/stores/terminal' import { diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx index e4a4f79e8b0..6bb5e293f16 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx @@ -41,13 +41,6 @@ import { DELETED_WORKFLOW_LABEL } from '@/lib/workflows/workflow-labels' import { SubBlock } from '@/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components' import { PreviewContextMenu } from '@/app/workspace/[workspaceId]/w/components/preview/components/preview-context-menu' import { PreviewWorkflow } from '@/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow' -/** - * Deep-imported rather than taken from the `sidebar/hooks` barrel on purpose. That barrel - * also exports `useWorkflowOperations`, whose graph reaches `stores/workflow-diff` -> - * `serializer` -> `tools/metadata`, pulling the 5 MB generated tool-metadata artifact into - * this route's client bundle for a hook that is a dependency-free leaf. - */ -import { useContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu' import { getBlock } from '@/blocks' import { BlockTile } from '@/blocks/block-tile' import type { BlockConfig, SubBlockConfig, SubBlockType } from '@/blocks/types' @@ -55,6 +48,7 @@ import { normalizeName } from '@/executor/constants' import { navigatePath } from '@/executor/variables/resolvers/reference' import { useWorkflowState } from '@/hooks/queries/workflows' import { useCodeViewerFeatures } from '@/hooks/use-code-viewer' +import { useContextMenu } from '@/hooks/use-context-menu' import type { BlockState, Loop, Parallel, WorkflowState } from '@/stores/workflows/workflow/types' /** diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx index 34032ed3f25..0cc55efc27c 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx @@ -13,7 +13,6 @@ import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/provide import { ContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/context-menu/context-menu' import { DeleteModal } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/delete-modal/delete-modal' import { - useContextMenu, useFolderExpand, useItemDrag, useItemRename, @@ -41,6 +40,7 @@ import { } from '@/hooks/queries/utils/folder-tree' import { getWorkflows } from '@/hooks/queries/utils/workflow-cache' import { useCreateWorkflow } from '@/hooks/queries/workflows' +import { useContextMenu } from '@/hooks/use-context-menu' import { useFolderStore } from '@/stores/folders/store' import type { FolderTreeNode } from '@/stores/folders/types' import { useWorkflowRegistry } from '@/stores/workflows/registry/store' diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx index 5eb559647d7..472e967cc9d 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx @@ -11,7 +11,6 @@ import { ContextMenu } from '@/app/workspace/[workspaceId]/w/components/sidebar/ import { DeleteModal } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/delete-modal/delete-modal' import { Avatars } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/avatars/avatars' import { - useContextMenu, useItemDrag, useItemRename, useSidebarListContext, @@ -37,6 +36,7 @@ import { } from '@/hooks/queries/utils/folder-tree' import { getWorkflows } from '@/hooks/queries/utils/workflow-cache' import { useUpdateWorkflow } from '@/hooks/queries/workflows' +import { useContextMenu } from '@/hooks/use-context-menu' import { useFolderStore } from '@/stores/folders/store' import type { WorkflowMetadata } from '@/stores/workflows/registry/types' diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/workflow-list.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/workflow-list.tsx index 0110c116536..0ae374bc2c6 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/workflow-list.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/workflow-list.tsx @@ -9,7 +9,6 @@ import { FolderItem } from '@/app/workspace/[workspaceId]/w/components/sidebar/c import { WorkflowItem } from '@/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item' import { SidebarListContext, - useContextMenu, useDragDrop, useFolderSelection, useSidebarListContextValue, @@ -20,6 +19,7 @@ import { groupWorkflowsByFolder, } from '@/app/workspace/[workspaceId]/w/components/sidebar/utils' import { useFolderMap, useFolders } from '@/hooks/queries/folders' +import { useContextMenu } from '@/hooks/use-context-menu' import { useFolderStore } from '@/stores/folders/store' import type { FolderTreeNode } from '@/stores/folders/types' import type { WorkflowMetadata } from '@/stores/workflows/registry/types' diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/index.ts b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/index.ts index a9f5875e5c4..abd21345589 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/index.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/index.ts @@ -1,6 +1,5 @@ export { useAutoScroll } from './use-auto-scroll' export { useChatSelection } from './use-chat-selection' -export { useContextMenu } from './use-context-menu' export { type DropIndicator, useDragDrop } from './use-drag-drop' export { useFlyoutInlineRename } from './use-flyout-inline-rename' export { useFolderExpand } from './use-folder-expand' diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx index c5e8d34319a..47fc7095c30 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx @@ -84,7 +84,6 @@ import { } from '@/app/workspace/[workspaceId]/w/components/sidebar/constants' import { useChatSelection, - useContextMenu, useFlyoutInlineRename, useFolderOperations, useHoverMenu, @@ -115,6 +114,7 @@ import { } from '@/hooks/queries/mothership-chats' import { useUpdateWorkflow } from '@/hooks/queries/workflows' import type { Workspace } from '@/hooks/queries/workspace' +import { useContextMenu } from '@/hooks/use-context-menu' import { useMothershipChatEvents } from '@/hooks/use-mothership-chat-events' import { usePermissionConfig } from '@/hooks/use-permission-config' import { useSettingsNavigation } from '@/hooks/use-settings-navigation' diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu.ts b/apps/sim/hooks/use-context-menu.ts similarity index 100% rename from apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-context-menu.ts rename to apps/sim/hooks/use-context-menu.ts diff --git a/scripts/check-tool-registry-boundary.baseline.json b/scripts/check-tool-registry-boundary.baseline.json index 9491b8ffb92..55a080b7f42 100644 --- a/scripts/check-tool-registry-boundary.baseline.json +++ b/scripts/check-tool-registry-boundary.baseline.json @@ -10,25 +10,25 @@ "gateways": {} }, "app/workspace/[workspaceId]/chat/[chatId]/page.tsx": { - "modules": 3047, + "modules": 3050, "gateways": { - "apps/sim/app/workspace/[workspaceId]/home/home.tsx": 1381, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx": 1031, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/index.ts": 892, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/index.ts": 889, + "apps/sim/app/workspace/[workspaceId]/home/home.tsx": 1383, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx": 1033, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/index.ts": 894, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/index.ts": 891, "apps/sim/triggers/registry.ts": 452, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 334, "apps/sim/blocks/registry.ts": 315, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 311, - "apps/sim/lib/auth/index.ts": 227 + "apps/sim/lib/auth/index.ts": 228 } }, "app/workspace/[workspaceId]/files/[fileId]/page.tsx": { - "modules": 2006, + "modules": 2007, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 341, "apps/sim/app/workspace/[workspaceId]/files/files.tsx": 273, - "apps/sim/lib/auth/index.ts": 233, + "apps/sim/lib/auth/index.ts": 234, "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/index.ts": 151, "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx": 134, "apps/sim/lib/api/contracts/index.ts": 109, @@ -43,12 +43,12 @@ } }, "app/workspace/[workspaceId]/files/page.tsx": { - "modules": 2006, + "modules": 2007, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 341, "apps/sim/app/workspace/[workspaceId]/files/files.tsx": 275, - "apps/sim/lib/auth/index.ts": 233, + "apps/sim/lib/auth/index.ts": 234, "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/index.ts": 151, "apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/file-viewer.tsx": 134, "apps/sim/lib/api/contracts/index.ts": 109, @@ -60,16 +60,16 @@ "gateways": {} }, "app/workspace/[workspaceId]/home/page.tsx": { - "modules": 3047, + "modules": 3050, "gateways": { - "apps/sim/app/workspace/[workspaceId]/home/home.tsx": 1381, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx": 1031, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/index.ts": 892, - "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/index.ts": 889, + "apps/sim/app/workspace/[workspaceId]/home/home.tsx": 1383, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/mothership-view.tsx": 1033, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/index.ts": 894, + "apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/index.ts": 891, "apps/sim/triggers/registry.ts": 452, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 334, "apps/sim/blocks/registry.ts": 315, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 311, - "apps/sim/lib/auth/index.ts": 227 + "apps/sim/lib/auth/index.ts": 228 } }, "app/workspace/[workspaceId]/integrations/[block]/page.tsx": { @@ -112,51 +112,51 @@ } }, "app/workspace/[workspaceId]/knowledge/[id]/[documentId]/page.tsx": { - "modules": 1537, + "modules": 1509, "gateways": { - "apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx": 1244, + "apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx": 1216, "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 344, "apps/sim/blocks/registry-maps.ts": 341, - "apps/sim/lib/api/contracts/index.ts": 120, + "apps/sim/lib/api/contracts/index.ts": 129, "apps/sim/connectors/registry.ts": 65, - "apps/sim/app/workspace/[workspaceId]/components/index.ts": 60, + "apps/sim/app/workspace/[workspaceId]/components/index.ts": 61, "apps/sim/lib/api/contracts/tools/index.ts": 60 } }, "app/workspace/[workspaceId]/knowledge/[id]/page.tsx": { - "modules": 1548, + "modules": 1521, "gateways": { - "apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx": 1255, + "apps/sim/app/workspace/[workspaceId]/knowledge/[id]/base.tsx": 1227, "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 349, "apps/sim/blocks/registry-maps.ts": 346, - "apps/sim/lib/api/contracts/index.ts": 120, + "apps/sim/lib/api/contracts/index.ts": 129, "apps/sim/connectors/registry.ts": 65, - "apps/sim/app/workspace/[workspaceId]/components/index.ts": 60, + "apps/sim/app/workspace/[workspaceId]/components/index.ts": 61, "apps/sim/lib/api/contracts/tools/index.ts": 60 } }, "app/workspace/[workspaceId]/knowledge/page.tsx": { - "modules": 2230, + "modules": 2231, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 339, "apps/sim/app/workspace/[workspaceId]/knowledge/prefetch.ts": 291, "apps/sim/lib/knowledge/application/knowledge-bases.ts": 235, - "apps/sim/lib/auth/index.ts": 181, + "apps/sim/lib/auth/index.ts": 182, "apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx": 154, "apps/sim/lib/knowledge/orchestration/index.ts": 148, "apps/sim/lib/knowledge/orchestration/connectors.ts": 142 } }, "app/workspace/[workspaceId]/layout.tsx": { - "modules": 2082, + "modules": 2083, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 340, "apps/sim/app/workspace/[workspaceId]/components/workspace-chrome/index.ts": 305, - "apps/sim/lib/auth/index.ts": 304, + "apps/sim/lib/auth/index.ts": 305, "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx": 297, "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/index.ts": 205, "apps/sim/lib/api/contracts/index.ts": 109, @@ -164,16 +164,16 @@ } }, "app/workspace/[workspaceId]/logs/page.tsx": { - "modules": 1747, + "modules": 1748, "gateways": { - "apps/sim/app/workspace/[workspaceId]/logs/logs.tsx": 1456, + "apps/sim/app/workspace/[workspaceId]/logs/logs.tsx": 1457, "apps/sim/triggers/registry.ts": 487, - "apps/sim/app/workspace/[workspaceId]/logs/components/index.ts": 398, - "apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/execution-snapshot/index.ts": 344, + "apps/sim/app/workspace/[workspaceId]/logs/components/index.ts": 399, + "apps/sim/app/workspace/[workspaceId]/logs/components/log-details/components/execution-snapshot/index.ts": 345, "apps/sim/blocks/registry.ts": 335, - "apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/index.ts": 300, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 296, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx": 264 + "apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/index.ts": 301, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 297, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx": 265 } }, "app/workspace/[workspaceId]/page.tsx": { @@ -185,12 +185,12 @@ "gateways": {} }, "app/workspace/[workspaceId]/settings/[section]/page.tsx": { - "modules": 2101, + "modules": 2102, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/app/workspace/[workspaceId]/settings/[section]/settings.tsx": 445, "apps/sim/blocks/registry.ts": 339, - "apps/sim/lib/auth/index.ts": 313, + "apps/sim/lib/auth/index.ts": 314, "apps/sim/lib/api/contracts/index.ts": 107, "apps/sim/lib/webhooks/providers/index.ts": 107, "apps/sim/lib/webhooks/providers/registry.ts": 105, @@ -202,9 +202,9 @@ "gateways": {} }, "app/workspace/[workspaceId]/settings/billing/credit-usage/page.tsx": { - "modules": 1663, + "modules": 1664, "gateways": { - "apps/sim/lib/auth/index.ts": 1526, + "apps/sim/lib/auth/index.ts": 1527, "apps/sim/blocks/registry.ts": 616, "apps/sim/blocks/registry-maps.ts": 613, "apps/sim/triggers/index.ts": 453, @@ -275,24 +275,24 @@ } }, "app/workspace/[workspaceId]/tables/[tableId]/page.tsx": { - "modules": 2273, + "modules": 2275, "gateways": { - "apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx": 563, + "apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx": 564, "apps/sim/triggers/registry.ts": 452, - "apps/sim/lib/auth/index.ts": 335, + "apps/sim/lib/auth/index.ts": 336, + "apps/sim/app/workspace/[workspaceId]/w/components/preview/index.ts": 315, "apps/sim/blocks/registry.ts": 315, - "apps/sim/app/workspace/[workspaceId]/w/components/preview/index.ts": 314, - "apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/index.ts": 272, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 268, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx": 237 + "apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/index.ts": 273, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 269, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/sub-block.tsx": 238 } }, "app/workspace/[workspaceId]/tables/page.tsx": { - "modules": 1851, + "modules": 1852, "gateways": { "apps/sim/triggers/registry.ts": 452, "apps/sim/blocks/registry.ts": 340, - "apps/sim/lib/auth/index.ts": 324, + "apps/sim/lib/auth/index.ts": 325, "apps/sim/lib/api/contracts/index.ts": 116, "apps/sim/lib/webhooks/providers/index.ts": 107, "apps/sim/app/workspace/[workspaceId]/tables/tables.tsx": 106, @@ -314,42 +314,42 @@ } }, "app/workspace/[workspaceId]/w/[workflowId]/layout.tsx": { - "modules": 2241, + "modules": 2242, "gateways": { - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx": 2240, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 547, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx": 2241, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 548, "apps/sim/triggers/registry.ts": 487, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 464, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 465, "apps/sim/blocks/registry.ts": 335, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/index.ts": 289, - "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx": 162, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/index.ts": 290, + "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx": 182, "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/index.ts": 151 } }, "app/workspace/[workspaceId]/w/[workflowId]/page.tsx": { - "modules": 2271, + "modules": 2272, "gateways": { - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 2270, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx": 2271, "apps/sim/triggers/registry.ts": 487, "apps/sim/blocks/registry.ts": 335, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 308, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 270, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/index.ts": 227, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx": 155, - "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/index.ts": 144 + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 309, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 271, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/index.ts": 228, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx": 176, + "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx": 174 } }, "app/workspace/[workspaceId]/w/page.tsx": { - "modules": 2241, + "modules": 2242, "gateways": { - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 953, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/index.ts": 955, "apps/sim/triggers/registry.ts": 487, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 464, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/index.ts": 465, "apps/sim/blocks/registry.ts": 335, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/index.ts": 289, + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/index.ts": 290, "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/error/index.tsx": 163, "apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/index.ts": 151, - "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 145 + "apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/index.ts": 146 } }, "app/workspace/layout.tsx": {