@@ -20,8 +20,8 @@ import type {
20
20
ConversationVariable ,
21
21
} from '@salesforce/types/metadata' ;
22
22
23
- export type GenAiPlannerExt = {
24
- GenAiPlanner : GenAiPlanner & { botTemplate ?: string } ;
23
+ export type GenAiPlannerBundleExt = {
24
+ GenAiPlannerBundle : GenAiPlanner & { botTemplate ?: string } ;
25
25
} ;
26
26
27
27
export type BotTemplateExt = {
@@ -46,7 +46,7 @@ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
46
46
const messages = Messages . loadMessages ( '@salesforce/plugin-agent' , 'agent.generate.template' ) ;
47
47
48
48
export type AgentGenerateTemplateResult = {
49
- genAiPlannerPath : string ;
49
+ genAiPlannerBundlePath : string ;
50
50
botTemplatePath : string ;
51
51
} ;
52
52
export default class AgentGenerateTemplate extends SfCommand < AgentGenerateTemplateResult > {
@@ -82,41 +82,45 @@ export default class AgentGenerateTemplate extends SfCommand<AgentGenerateTempla
82
82
const builder = new XMLBuilder ( { format : true , ignoreAttributes : false , indentBy : ' ' } ) ;
83
83
84
84
const botName = basename ( agentFile , '.bot-meta.xml' ) ;
85
- // Since we are cloning the GenAiPlanner , we need to use a different name than the Agent (Bot) we started with
85
+ // Since we are cloning the GenAiPlannerBundle , we need to use a different name than the Agent (Bot) we started with
86
86
// We will use this name for the BotTemplate also to make it clear they are related
87
87
const finalFilename = `${ botName } _v${ botVersion } _Template` ;
88
88
89
89
// Build the base dir from the AgentFile
90
90
const basePath = resolve ( dirname ( agentFile ) , '..' , '..' ) ;
91
91
const botDir = join ( basePath , 'bots' , botName ) ;
92
- const genAiPlannerDir = join ( basePath , 'genAiPlanners ' ) ;
92
+ const genAiPlannerBundleDir = join ( basePath , 'genAiPlannerBundles ' ) ;
93
93
const botTemplateDir = join ( basePath , 'botTemplates' ) ;
94
94
95
95
const botTemplateFilePath = join ( botTemplateDir , `${ finalFilename } .botTemplate-meta.xml` ) ;
96
- const clonedGenAiPlannerFilePath = join ( genAiPlannerDir , `${ finalFilename } .genAiPlanner-meta.xml` ) ;
96
+ const clonedGenAiPlannerBundleFilePath = join (
97
+ genAiPlannerBundleDir ,
98
+ finalFilename ,
99
+ `${ finalFilename } .genAiPlannerBundle`
100
+ ) ;
97
101
98
102
// Parse the metadata files as JSON
99
103
const botJson = xmlToJson < BotExt > ( join ( botDir , `${ botName } .bot-meta.xml` ) , parser ) ;
100
104
const botVersionJson = xmlToJson < BotVersionExt > ( join ( botDir , `v${ botVersion } .botVersion-meta.xml` ) , parser ) ;
101
- const genAiPlannerMetaJson = xmlToJson < GenAiPlannerExt > (
102
- join ( genAiPlannerDir , `${ botName } .genAiPlanner-meta.xml ` ) ,
105
+ const genAiPlannerBundleMetaJson = xmlToJson < GenAiPlannerBundleExt > (
106
+ join ( genAiPlannerBundleDir , botName , `${ botName } .genAiPlannerBundle ` ) ,
103
107
parser
104
108
) ;
105
109
106
110
// Modify the metadata files for final output
107
111
// TODO: Confirm this name (might be conversationDefinitionPlanners)
108
- genAiPlannerMetaJson . GenAiPlanner . botTemplate = finalFilename ;
112
+ genAiPlannerBundleMetaJson . GenAiPlannerBundle . botTemplate = finalFilename ;
109
113
const botTemplate = convertBotToBotTemplate ( botJson , botVersionJson , finalFilename , botTemplateFilePath ) ;
110
114
111
115
// Build and save the metadata files
112
- jsonToXml < GenAiPlannerExt > ( clonedGenAiPlannerFilePath , genAiPlannerMetaJson , builder ) ;
116
+ jsonToXml < GenAiPlannerBundleExt > ( clonedGenAiPlannerBundleFilePath , genAiPlannerBundleMetaJson , builder ) ;
113
117
jsonToXml < BotTemplateExt > ( botTemplateFilePath , botTemplate , builder ) ;
114
118
115
119
this . log ( `\nSaved BotTemplate to:\n - ${ botTemplateFilePath } ` ) ;
116
- this . log ( `Saved GenAiPlanner to:\n - ${ clonedGenAiPlannerFilePath } ` ) ;
120
+ this . log ( `Saved GenAiPlannerBundle to:\n - ${ clonedGenAiPlannerBundleFilePath } ` ) ;
117
121
118
122
return {
119
- genAiPlannerPath : clonedGenAiPlannerFilePath ,
123
+ genAiPlannerBundlePath : clonedGenAiPlannerBundleFilePath ,
120
124
botTemplatePath : botTemplateFilePath ,
121
125
} ;
122
126
}
0 commit comments