Skip to content

Commit 1d45057

Browse files
fix(copilot): legacy tool display names (#2911)
1 parent c6d408c commit 1d45057

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

apps/sim/lib/copilot/tools/client/blocks/get-block-config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
GetBlockConfigInput,
1111
GetBlockConfigResult,
1212
} from '@/lib/copilot/tools/shared/schemas'
13-
import { getBlock } from '@/blocks/registry'
13+
import { getLatestBlock } from '@/blocks/registry'
1414

1515
interface GetBlockConfigArgs {
1616
blockType: string
@@ -40,8 +40,7 @@ export class GetBlockConfigClientTool extends BaseClientTool {
4040
},
4141
getDynamicText: (params, state) => {
4242
if (params?.blockType && typeof params.blockType === 'string') {
43-
// Look up the block config to get the human-readable name
44-
const blockConfig = getBlock(params.blockType)
43+
const blockConfig = getLatestBlock(params.blockType)
4544
const blockName = (blockConfig?.name ?? params.blockType.replace(/_/g, ' ')).toLowerCase()
4645
const opSuffix = params.operation ? ` (${params.operation})` : ''
4746

apps/sim/lib/copilot/tools/client/blocks/get-block-options.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
GetBlockOptionsInput,
1111
GetBlockOptionsResult,
1212
} from '@/lib/copilot/tools/shared/schemas'
13-
import { getBlock } from '@/blocks/registry'
13+
import { getLatestBlock } from '@/blocks/registry'
1414

1515
interface GetBlockOptionsArgs {
1616
blockId: string
@@ -43,8 +43,7 @@ export class GetBlockOptionsClientTool extends BaseClientTool {
4343
(params as any)?.block_id ||
4444
(params as any)?.block_type
4545
if (typeof blockId === 'string') {
46-
// Look up the block config to get the human-readable name
47-
const blockConfig = getBlock(blockId)
46+
const blockConfig = getLatestBlock(blockId)
4847
const blockName = (blockConfig?.name ?? blockId.replace(/_/g, ' ')).toLowerCase()
4948

5049
switch (state) {

apps/sim/lib/copilot/tools/server/blocks/get-block-config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
GetBlockConfigResult,
66
type GetBlockConfigResultType,
77
} from '@/lib/copilot/tools/shared/schemas'
8-
import { registry as blockRegistry } from '@/blocks/registry'
8+
import { registry as blockRegistry, getLatestBlock } from '@/blocks/registry'
99
import type { SubBlockConfig } from '@/blocks/types'
1010
import { getUserPermissionConfig } from '@/executor/utils/permission-check'
1111
import { PROVIDER_DEFINITIONS } from '@/providers/models'
@@ -452,9 +452,12 @@ export const getBlockConfigServerTool: BaseServerTool<
452452
const inputs = extractInputsFromSubBlocks(subBlocks, operation, trigger)
453453
const outputs = extractOutputs(blockConfig, operation, trigger)
454454

455+
const latestBlock = getLatestBlock(blockType)
456+
const displayName = latestBlock?.name ?? blockConfig.name
457+
455458
const result = {
456459
blockType,
457-
blockName: blockConfig.name,
460+
blockName: displayName,
458461
operation,
459462
trigger,
460463
inputs,

apps/sim/lib/copilot/tools/server/blocks/get-block-options.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
GetBlockOptionsResult,
66
type GetBlockOptionsResultType,
77
} from '@/lib/copilot/tools/shared/schemas'
8-
import { registry as blockRegistry } from '@/blocks/registry'
8+
import { registry as blockRegistry, getLatestBlock } from '@/blocks/registry'
99
import { getUserPermissionConfig } from '@/executor/utils/permission-check'
1010
import { tools as toolsRegistry } from '@/tools/registry'
1111

@@ -113,9 +113,12 @@ export const getBlockOptionsServerTool: BaseServerTool<
113113
}
114114
}
115115

116+
const latestBlock = getLatestBlock(blockId)
117+
const displayName = latestBlock?.name ?? blockConfig.name
118+
116119
const result = {
117120
blockId,
118-
blockName: blockConfig.name,
121+
blockName: displayName,
119122
operations,
120123
}
121124

0 commit comments

Comments
 (0)