Skip to content

Commit 8fb0d26

Browse files
authored
W-17909761 - fix: resolve plugins from planner for agent pseudo type resolution (#1528)
* fix: read planner for plugins * chore: make TS happy
1 parent 40b1119 commit 8fb0d26

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/resolve/pseudoTypes/agentResolver.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,22 @@ const resolveAgentFromConnection = async (connection: Connection, botName: strin
110110
if (genAiPluginNames.length) {
111111
genAiPluginNames.map((r) => mdEntries.push(`GenAiPlugin:${r.DeveloperName}`));
112112
} else {
113-
getLogger().debug(`No GenAiPlugin metadata matches for plannerId: ${plannerId15}`);
113+
getLogger().debug(
114+
`No GenAiPlugin metadata matches for plannerId: ${plannerId15}. Reading the planner metadata for plugins...`
115+
);
116+
// read the planner metadata from the org
117+
// @ts-expect-error jsForce types don't know about GenAiPlanner yet
118+
const genAiPlannerMd = await connection.metadata.read<GenAiPlanner>('GenAiPlanner', botName);
119+
const genAiPlannerMdArr = ensureArray(genAiPlannerMd) as unknown as GenAiPlanner[];
120+
if (genAiPlannerMdArr?.length && genAiPlannerMdArr[0]?.genAiPlugins.length) {
121+
genAiPlannerMdArr[0].genAiPlugins.map((plugin) => {
122+
if (plugin.genAiPluginName?.length) {
123+
mdEntries.push(`GenAiPlugin:${plugin.genAiPluginName}`);
124+
}
125+
});
126+
} else {
127+
getLogger().debug(`No GenAiPlugin metadata found in planner file for API name: ${botName}`);
128+
}
114129
}
115130
} else {
116131
getLogger().debug(`No GenAiPlanner metadata matches for Bot: ${botName}`);

0 commit comments

Comments
 (0)