From 43049eb3804b643ffa65a93147bd050f272ca52a Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Tue, 20 Jan 2026 21:07:30 -0800 Subject: [PATCH] fix(copilot): legacy tool display names --- .../lib/copilot/tools/client/blocks/get-block-config.ts | 5 ++--- .../lib/copilot/tools/client/blocks/get-block-options.ts | 5 ++--- .../lib/copilot/tools/server/blocks/get-block-config.ts | 7 +++++-- .../lib/copilot/tools/server/blocks/get-block-options.ts | 7 +++++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/sim/lib/copilot/tools/client/blocks/get-block-config.ts b/apps/sim/lib/copilot/tools/client/blocks/get-block-config.ts index be4196c443..a76971df07 100644 --- a/apps/sim/lib/copilot/tools/client/blocks/get-block-config.ts +++ b/apps/sim/lib/copilot/tools/client/blocks/get-block-config.ts @@ -10,7 +10,7 @@ import { GetBlockConfigInput, GetBlockConfigResult, } from '@/lib/copilot/tools/shared/schemas' -import { getBlock } from '@/blocks/registry' +import { getLatestBlock } from '@/blocks/registry' interface GetBlockConfigArgs { blockType: string @@ -40,8 +40,7 @@ export class GetBlockConfigClientTool extends BaseClientTool { }, getDynamicText: (params, state) => { if (params?.blockType && typeof params.blockType === 'string') { - // Look up the block config to get the human-readable name - const blockConfig = getBlock(params.blockType) + const blockConfig = getLatestBlock(params.blockType) const blockName = (blockConfig?.name ?? params.blockType.replace(/_/g, ' ')).toLowerCase() const opSuffix = params.operation ? ` (${params.operation})` : '' diff --git a/apps/sim/lib/copilot/tools/client/blocks/get-block-options.ts b/apps/sim/lib/copilot/tools/client/blocks/get-block-options.ts index f830bed84e..06efb6ffc1 100644 --- a/apps/sim/lib/copilot/tools/client/blocks/get-block-options.ts +++ b/apps/sim/lib/copilot/tools/client/blocks/get-block-options.ts @@ -10,7 +10,7 @@ import { GetBlockOptionsInput, GetBlockOptionsResult, } from '@/lib/copilot/tools/shared/schemas' -import { getBlock } from '@/blocks/registry' +import { getLatestBlock } from '@/blocks/registry' interface GetBlockOptionsArgs { blockId: string @@ -43,8 +43,7 @@ export class GetBlockOptionsClientTool extends BaseClientTool { (params as any)?.block_id || (params as any)?.block_type if (typeof blockId === 'string') { - // Look up the block config to get the human-readable name - const blockConfig = getBlock(blockId) + const blockConfig = getLatestBlock(blockId) const blockName = (blockConfig?.name ?? blockId.replace(/_/g, ' ')).toLowerCase() switch (state) { diff --git a/apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts b/apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts index d6e7adb7a8..ca4a00c3e7 100644 --- a/apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts +++ b/apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts @@ -5,7 +5,7 @@ import { GetBlockConfigResult, type GetBlockConfigResultType, } from '@/lib/copilot/tools/shared/schemas' -import { registry as blockRegistry } from '@/blocks/registry' +import { registry as blockRegistry, getLatestBlock } from '@/blocks/registry' import type { SubBlockConfig } from '@/blocks/types' import { getUserPermissionConfig } from '@/executor/utils/permission-check' import { PROVIDER_DEFINITIONS } from '@/providers/models' @@ -452,9 +452,12 @@ export const getBlockConfigServerTool: BaseServerTool< const inputs = extractInputsFromSubBlocks(subBlocks, operation, trigger) const outputs = extractOutputs(blockConfig, operation, trigger) + const latestBlock = getLatestBlock(blockType) + const displayName = latestBlock?.name ?? blockConfig.name + const result = { blockType, - blockName: blockConfig.name, + blockName: displayName, operation, trigger, inputs, diff --git a/apps/sim/lib/copilot/tools/server/blocks/get-block-options.ts b/apps/sim/lib/copilot/tools/server/blocks/get-block-options.ts index e98be96900..b5e5b2373b 100644 --- a/apps/sim/lib/copilot/tools/server/blocks/get-block-options.ts +++ b/apps/sim/lib/copilot/tools/server/blocks/get-block-options.ts @@ -5,7 +5,7 @@ import { GetBlockOptionsResult, type GetBlockOptionsResultType, } from '@/lib/copilot/tools/shared/schemas' -import { registry as blockRegistry } from '@/blocks/registry' +import { registry as blockRegistry, getLatestBlock } from '@/blocks/registry' import { getUserPermissionConfig } from '@/executor/utils/permission-check' import { tools as toolsRegistry } from '@/tools/registry' @@ -113,9 +113,12 @@ export const getBlockOptionsServerTool: BaseServerTool< } } + const latestBlock = getLatestBlock(blockId) + const displayName = latestBlock?.name ?? blockConfig.name + const result = { blockId, - blockName: blockConfig.name, + blockName: displayName, operations, }