@salesforce/agents 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/agent.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  import { Connection, SfProject } from '@salesforce/core';
2
2
  import { type SfAgent, type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecCreateConfig } from './types.js';
3
+ export declare const AgentCreateLifecycleStages: {
4
+ CreatingLocally: string;
5
+ DeployingMetadata: string;
6
+ CreatingRemotely: string;
7
+ RetrievingMetadata: string;
8
+ };
3
9
  /**
4
10
  * Class for creating Agents and agent specs.
5
11
  */
@@ -7,7 +13,15 @@ export declare class Agent implements SfAgent {
7
13
  private project;
8
14
  private logger;
9
15
  private maybeMock;
16
+ private readonly connection;
10
17
  constructor(connection: Connection, project: SfProject);
18
+ /**
19
+ * From an AgentCreateConfig, deploy the required metadata, call the connect/attach-agent-topics endpoint, and then retrieve
20
+ * the newly updated metadata back to the local project
21
+ *
22
+ * @param {AgentCreateConfig} config
23
+ * @returns {Promise<AgentCreateResponse>}
24
+ */
11
25
  create(config: AgentCreateConfig): Promise<AgentCreateResponse>;
12
26
  /**
13
27
  * Create an agent spec from provided data.
@@ -17,4 +31,5 @@ export declare class Agent implements SfAgent {
17
31
  createSpec(config: AgentJobSpecCreateConfig): Promise<AgentJobSpec>;
18
32
  private verifyAgentSpecConfig;
19
33
  private buildAgentJobSpecUrl;
34
+ private createMetadata;
20
35
  }
package/lib/agent.js CHANGED
@@ -5,12 +5,24 @@
5
5
  * Licensed under the BSD 3-Clause license.
6
6
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
8
11
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Agent = void 0;
12
+ exports.Agent = exports.AgentCreateLifecycleStages = void 0;
10
13
  const node_util_1 = require("node:util");
14
+ const node_path_1 = __importDefault(require("node:path"));
15
+ const node_fs_1 = __importDefault(require("node:fs"));
11
16
  const core_1 = require("@salesforce/core");
17
+ const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
12
18
  const kit_1 = require("@salesforce/kit");
13
19
  const maybe_mock_1 = require("./maybe-mock");
20
+ exports.AgentCreateLifecycleStages = {
21
+ CreatingLocally: 'creatinglocally',
22
+ DeployingMetadata: 'deployingmetadata',
23
+ CreatingRemotely: 'creatingremotely',
24
+ RetrievingMetadata: 'retrievingmetadata',
25
+ };
14
26
  /**
15
27
  * Class for creating Agents and agent specs.
16
28
  */
@@ -18,18 +30,60 @@ class Agent {
18
30
  project;
19
31
  logger;
20
32
  maybeMock;
33
+ connection;
21
34
  constructor(connection, project) {
22
35
  this.project = project;
23
36
  this.logger = core_1.Logger.childFromRoot(this.constructor.name);
24
37
  this.maybeMock = new maybe_mock_1.MaybeMock(connection);
38
+ this.connection = connection;
25
39
  }
40
+ /**
41
+ * From an AgentCreateConfig, deploy the required metadata, call the connect/attach-agent-topics endpoint, and then retrieve
42
+ * the newly updated metadata back to the local project
43
+ *
44
+ * @param {AgentCreateConfig} config
45
+ * @returns {Promise<AgentCreateResponse>}
46
+ */
26
47
  async create(config) {
27
48
  this.logger.debug(`Creating Agent using config: ${(0, node_util_1.inspect)(config)} in project: ${this.project.getPath()}`);
28
- // Generate a GenAiPlanner in the local project and deploy
29
- // make API request to /services/data/{api-version}/connect/attach-agent-topics
30
- await (0, kit_1.sleep)(kit_1.Duration.seconds(3));
31
- // on success, retrieve all Agent metadata
32
- return { isSuccess: true };
49
+ await core_1.Lifecycle.getInstance().emit(exports.AgentCreateLifecycleStages.CreatingLocally, {});
50
+ const sourcepaths = await this.createMetadata(config);
51
+ await core_1.Lifecycle.getInstance().emit(exports.AgentCreateLifecycleStages.DeployingMetadata, {});
52
+ const cs = await source_deploy_retrieve_1.ComponentSetBuilder.build({ sourcepath: sourcepaths });
53
+ const deploy = await cs.deploy({ usernameOrConnection: this.connection });
54
+ const result = await deploy.pollStatus({ timeout: kit_1.Duration.minutes(10_000), frequency: kit_1.Duration.seconds(1) });
55
+ if (!result.response.success) {
56
+ throw new core_1.SfError(result.response.errorMessage ?? `Unable to deploy ${result.response.id}`);
57
+ }
58
+ await core_1.Lifecycle.getInstance().emit(exports.AgentCreateLifecycleStages.CreatingRemotely, {});
59
+ const plannerId = (await this.connection.singleRecordQuery(`SELECT Id
60
+ FROM GenAiPlanner
61
+ WHERE MasterLabel = 'MasterLabel for ${config.name}'`, { tooling: true })).Id;
62
+ const url = `${this.connection.instanceUrl}/services/data/v${this.connection.getApiVersion()}/connect/attach-agent-topics`;
63
+ const body = {
64
+ plannerId,
65
+ agentJobSpecs: config.jobSpec,
66
+ companyDescription: config.companyDescription,
67
+ role: config.role,
68
+ companyName: config.companyName,
69
+ agentType: config.type,
70
+ };
71
+ const response = await this.maybeMock.request('POST', url, body);
72
+ await core_1.Lifecycle.getInstance().emit(exports.AgentCreateLifecycleStages.RetrievingMetadata, {});
73
+ const retrieve = await cs.retrieve({
74
+ usernameOrConnection: this.connection,
75
+ merge: true,
76
+ format: 'source',
77
+ output: this.project.getDefaultPackage().path ?? 'force-app',
78
+ });
79
+ const retrieveResult = await retrieve.pollStatus({
80
+ frequency: kit_1.Duration.seconds(1),
81
+ timeout: kit_1.Duration.minutes(10_000),
82
+ });
83
+ if (!retrieveResult.response.success) {
84
+ throw new core_1.SfError(`Unable to retrieve ${retrieveResult.response.id}`);
85
+ }
86
+ return response;
33
87
  }
34
88
  /**
35
89
  * Create an agent spec from provided data.
@@ -60,8 +114,265 @@ class Agent {
60
114
  // eslint-disable-next-line class-methods-use-this
61
115
  buildAgentJobSpecUrl(config) {
62
116
  const { type, role, companyName, companyDescription, companyWebsite } = config;
63
- const website = companyWebsite ? `&companyWebsite=${companyWebsite}` : '';
64
- return `/connect/agent-job-spec?agentType=${type}&role=${role}&companyName=${companyName}&companyDescription=${companyDescription}${website}`;
117
+ const encodedType = `agentType=${encodeURIComponent(type)}`;
118
+ const encodedRole = `role=${encodeURIComponent(role)}`;
119
+ const encodedCompanyName = `companyName=${encodeURIComponent(companyName)}`;
120
+ const encodedCompanyDescription = `companyDescription=${encodeURIComponent(companyDescription)}`;
121
+ const encodedCompanyWebsite = companyWebsite ? `&companyWebsite=${companyWebsite}` : '';
122
+ return `/connect/agent-job-spec?${encodedType}&${encodedRole}&${encodedCompanyName}&${encodedCompanyDescription}${encodedCompanyWebsite}`;
123
+ }
124
+ async createMetadata(config) {
125
+ const genAiSourceDirPath = node_path_1.default.join(this.project.getPath(), 'force-app', 'main', 'default', 'genAiPlanners');
126
+ const botDirPath = node_path_1.default.join(this.project.getPath(), 'force-app', 'main', 'default', 'bots', config.name);
127
+ const genAiSourcePath = node_path_1.default.join(genAiSourceDirPath, `${config.name}.genAiPlanner-meta.xml`);
128
+ const botSourcePath = node_path_1.default.join(botDirPath, `${config.name}.bot-meta.xml`);
129
+ const botVersionSourcePath = node_path_1.default.join(botDirPath, 'v1.botVersion-meta.xml');
130
+ // TODO: will this need to be user specified? Something to update for V2 APIs
131
+ const botUser = (await this.connection.singleRecordQuery("SELECT Username FROM User Where Profile.name='Einstein Agent User' LIMIT 1")).Username;
132
+ this.logger.debug(`Creating Agent using config: ${(0, node_util_1.inspect)(config)} in project: ${this.project.getPath()}`);
133
+ await Promise.all([
134
+ node_fs_1.default.promises.mkdir(genAiSourceDirPath, { recursive: true }),
135
+ node_fs_1.default.promises.mkdir(botDirPath, { recursive: true }),
136
+ ]);
137
+ // the dirs must exist before we write the files
138
+ await Promise.all([
139
+ node_fs_1.default.promises.writeFile(genAiSourcePath, `<?xml version="1.0" encoding="UTF-8"?>
140
+ <GenAiPlanner xmlns="http://soap.sforce.com/2006/04/metadata">
141
+ <description>description for ${config.name}</description>
142
+ <masterLabel>MasterLabel for ${config.name}</masterLabel>
143
+ <plannerType>AiCopilot__ReAct</plannerType>
144
+ </GenAiPlanner>
145
+ `),
146
+ node_fs_1.default.promises.writeFile(botSourcePath, `<?xml version="1.0" encoding="UTF-8"?>
147
+ <Bot xmlns="http://soap.sforce.com/2006/04/metadata">
148
+ <botMlDomain>
149
+ <label>${config.name}</label>
150
+ <name>${config.name}</name>
151
+ </botMlDomain>
152
+ <botUser>${botUser}</botUser>
153
+ <contextVariables>
154
+ <contextVariableMappings>
155
+ <SObjectType>MessagingSession</SObjectType>
156
+ <fieldName>MessagingSession.MessagingEndUserId</fieldName>
157
+ <messageType>Facebook</messageType>
158
+ </contextVariableMappings>
159
+ <contextVariableMappings>
160
+ <SObjectType>MessagingSession</SObjectType>
161
+ <fieldName>MessagingSession.MessagingEndUserId</fieldName>
162
+ <messageType>EmbeddedMessaging</messageType>
163
+ </contextVariableMappings>
164
+ <contextVariableMappings>
165
+ <SObjectType>MessagingSession</SObjectType>
166
+ <fieldName>MessagingSession.MessagingEndUserId</fieldName>
167
+ <messageType>AppleBusinessChat</messageType>
168
+ </contextVariableMappings>
169
+ <contextVariableMappings>
170
+ <SObjectType>MessagingSession</SObjectType>
171
+ <fieldName>MessagingSession.MessagingEndUserId</fieldName>
172
+ <messageType>WhatsApp</messageType>
173
+ </contextVariableMappings>
174
+ <contextVariableMappings>
175
+ <SObjectType>MessagingSession</SObjectType>
176
+ <fieldName>MessagingSession.MessagingEndUserId</fieldName>
177
+ <messageType>Text</messageType>
178
+ </contextVariableMappings>
179
+ <contextVariableMappings>
180
+ <SObjectType>MessagingSession</SObjectType>
181
+ <fieldName>MessagingSession.MessagingEndUserId</fieldName>
182
+ <messageType>Line</messageType>
183
+ </contextVariableMappings>
184
+ <dataType>Id</dataType>
185
+ <developerName>EndUserId</developerName>
186
+ <label>End User Id</label>
187
+ </contextVariables>
188
+ <contextVariables>
189
+ <contextVariableMappings>
190
+ <SObjectType>MessagingSession</SObjectType>
191
+ <fieldName>MessagingSession.Id</fieldName>
192
+ <messageType>Line</messageType>
193
+ </contextVariableMappings>
194
+ <contextVariableMappings>
195
+ <SObjectType>MessagingSession</SObjectType>
196
+ <fieldName>MessagingSession.Id</fieldName>
197
+ <messageType>EmbeddedMessaging</messageType>
198
+ </contextVariableMappings>
199
+ <contextVariableMappings>
200
+ <SObjectType>MessagingSession</SObjectType>
201
+ <fieldName>MessagingSession.Id</fieldName>
202
+ <messageType>AppleBusinessChat</messageType>
203
+ </contextVariableMappings>
204
+ <contextVariableMappings>
205
+ <SObjectType>MessagingSession</SObjectType>
206
+ <fieldName>MessagingSession.Id</fieldName>
207
+ <messageType>WhatsApp</messageType>
208
+ </contextVariableMappings>
209
+ <contextVariableMappings>
210
+ <SObjectType>MessagingSession</SObjectType>
211
+ <fieldName>MessagingSession.Id</fieldName>
212
+ <messageType>Text</messageType>
213
+ </contextVariableMappings>
214
+ <contextVariableMappings>
215
+ <SObjectType>MessagingSession</SObjectType>
216
+ <fieldName>MessagingSession.Id</fieldName>
217
+ <messageType>Facebook</messageType>
218
+ </contextVariableMappings>
219
+ <dataType>Id</dataType>
220
+ <developerName>RoutableId</developerName>
221
+ <label>Routable Id</label>
222
+ </contextVariables>
223
+ <contextVariables>
224
+ <contextVariableMappings>
225
+ <SObjectType>MessagingSession</SObjectType>
226
+ <fieldName>MessagingSession.EndUserLanguage</fieldName>
227
+ <messageType>Line</messageType>
228
+ </contextVariableMappings>
229
+ <contextVariableMappings>
230
+ <SObjectType>MessagingSession</SObjectType>
231
+ <fieldName>MessagingSession.EndUserLanguage</fieldName>
232
+ <messageType>EmbeddedMessaging</messageType>
233
+ </contextVariableMappings>
234
+ <contextVariableMappings>
235
+ <SObjectType>MessagingSession</SObjectType>
236
+ <fieldName>MessagingSession.EndUserLanguage</fieldName>
237
+ <messageType>AppleBusinessChat</messageType>
238
+ </contextVariableMappings>
239
+ <contextVariableMappings>
240
+ <SObjectType>MessagingSession</SObjectType>
241
+ <fieldName>MessagingSession.EndUserLanguage</fieldName>
242
+ <messageType>WhatsApp</messageType>
243
+ </contextVariableMappings>
244
+ <contextVariableMappings>
245
+ <SObjectType>MessagingSession</SObjectType>
246
+ <fieldName>MessagingSession.EndUserLanguage</fieldName>
247
+ <messageType>Text</messageType>
248
+ </contextVariableMappings>
249
+ <contextVariableMappings>
250
+ <SObjectType>MessagingSession</SObjectType>
251
+ <fieldName>MessagingSession.EndUserLanguage</fieldName>
252
+ <messageType>Facebook</messageType>
253
+ </contextVariableMappings>
254
+ <dataType>Text</dataType>
255
+ <developerName>EndUserLanguage</developerName>
256
+ <label>End User Language</label>
257
+ </contextVariables>
258
+ <contextVariables>
259
+ <contextVariableMappings>
260
+ <SObjectType>MessagingEndUser</SObjectType>
261
+ <fieldName>MessagingEndUser.ContactId</fieldName>
262
+ <messageType>Line</messageType>
263
+ </contextVariableMappings>
264
+ <contextVariableMappings>
265
+ <SObjectType>MessagingEndUser</SObjectType>
266
+ <fieldName>MessagingEndUser.ContactId</fieldName>
267
+ <messageType>EmbeddedMessaging</messageType>
268
+ </contextVariableMappings>
269
+ <contextVariableMappings>
270
+ <SObjectType>MessagingEndUser</SObjectType>
271
+ <fieldName>MessagingEndUser.ContactId</fieldName>
272
+ <messageType>AppleBusinessChat</messageType>
273
+ </contextVariableMappings>
274
+ <contextVariableMappings>
275
+ <SObjectType>MessagingEndUser</SObjectType>
276
+ <fieldName>MessagingEndUser.ContactId</fieldName>
277
+ <messageType>WhatsApp</messageType>
278
+ </contextVariableMappings>
279
+ <contextVariableMappings>
280
+ <SObjectType>MessagingEndUser</SObjectType>
281
+ <fieldName>MessagingEndUser.ContactId</fieldName>
282
+ <messageType>Text</messageType>
283
+ </contextVariableMappings>
284
+ <contextVariableMappings>
285
+ <SObjectType>MessagingEndUser</SObjectType>
286
+ <fieldName>MessagingEndUser.ContactId</fieldName>
287
+ <messageType>Facebook</messageType>
288
+ </contextVariableMappings>
289
+ <dataType>Id</dataType>
290
+ <developerName>ContactId</developerName>
291
+ <label>Contact Id</label>
292
+ </contextVariables>
293
+ <description>${config.companyDescription}</description>
294
+ <label>${config.name}</label>
295
+ <logPrivateConversationData>false</logPrivateConversationData>
296
+ <richContentEnabled>true</richContentEnabled>
297
+ <sessionTimeout>480</sessionTimeout>
298
+ <type>ExternalCopilot</type>
299
+ </Bot>
300
+ `),
301
+ node_fs_1.default.promises.writeFile(botVersionSourcePath, `<?xml version="1.0" encoding="UTF-8"?>
302
+ <BotVersion xmlns="http://soap.sforce.com/2006/04/metadata">
303
+ <fullName>v1</fullName>
304
+ <articleAnswersGPTEnabled>false</articleAnswersGPTEnabled>
305
+ <botDialogs>
306
+ <botSteps>
307
+ <botMessages>
308
+ <message>Hi, I&apos;m an AI assistant. How can I help you?</message>
309
+ <messageIdentifier>bfafa206-133e-44e0-8560-c47c45715124</messageIdentifier>
310
+ </botMessages>
311
+ <stepIdentifier>f85fa042-f009-4722-ba6a-6f743ebd44e8</stepIdentifier>
312
+ <type>Message</type>
313
+ </botSteps>
314
+ <botSteps>
315
+ <stepIdentifier>cc7b5414-18df-43aa-b97a-c5d2682eee62</stepIdentifier>
316
+ <type>Wait</type>
317
+ </botSteps>
318
+ <developerName>Welcome</developerName>
319
+ <isPlaceholderDialog>false</isPlaceholderDialog>
320
+ <label>Hi! I&apos;m your helpful bot.</label>
321
+ <showInFooterMenu>false</showInFooterMenu>
322
+ </botDialogs>
323
+ <botDialogs>
324
+ <botSteps>
325
+ <botMessages>
326
+ <message>Sorry, it looks like something has gone wrong.</message>
327
+ <messageIdentifier>41556708-3dda-4bc7-9444-fb9d3972a47f</messageIdentifier>
328
+ </botMessages>
329
+ <stepIdentifier>76ef6e29-6a3e-42fb-a325-606736f36268</stepIdentifier>
330
+ <type>Message</type>
331
+ </botSteps>
332
+ <botSteps>
333
+ <stepIdentifier>c2964b65-3c22-4cfb-9974-1a91820011e0</stepIdentifier>
334
+ <type>Wait</type>
335
+ </botSteps>
336
+ <developerName>Error_Handling</developerName>
337
+ <isPlaceholderDialog>false</isPlaceholderDialog>
338
+ <label>Unfortunately, a system error occurred. Let us start again.</label>
339
+ <showInFooterMenu>false</showInFooterMenu>
340
+ </botDialogs>
341
+ <botDialogs>
342
+ <botSteps>
343
+ <botMessages>
344
+ <message>One moment while I connect you to the next available service representative.</message>
345
+ <messageIdentifier>ddf568e3-4805-4529-a71d-4601ec9b5e16</messageIdentifier>
346
+ </botMessages>
347
+ <stepIdentifier>fc998b13-39e8-4142-aa14-80b5c80934dc</stepIdentifier>
348
+ <type>Message</type>
349
+ </botSteps>
350
+ <botSteps>
351
+ <conversationSystemMessage>
352
+ <type>Transfer</type>
353
+ </conversationSystemMessage>
354
+ <stepIdentifier>e9a1f351-66fc-4a2e-8871-905ea08bdfa5</stepIdentifier>
355
+ <type>SystemMessage</type>
356
+ </botSteps>
357
+ <developerName>Transfer_To_Agent</developerName>
358
+ <isPlaceholderDialog>false</isPlaceholderDialog>
359
+ <label>Transfer To Agent</label>
360
+ <showInFooterMenu>false</showInFooterMenu>
361
+ </botDialogs>
362
+ <citationsEnabled>false</citationsEnabled>
363
+ <conversationDefinitionPlanners>
364
+ <genAiPlannerName>${config.name}</genAiPlannerName>
365
+ </conversationDefinitionPlanners>
366
+ <entryDialog>Welcome</entryDialog>
367
+ <intentDisambiguationEnabled>false</intentDisambiguationEnabled>
368
+ <intentV3Enabled>false</intentV3Enabled>
369
+ <knowledgeFallbackEnabled>false</knowledgeFallbackEnabled>
370
+ <smallTalkEnabled>false</smallTalkEnabled>
371
+ <toneType>Casual</toneType>
372
+ </BotVersion>
373
+ `),
374
+ ]);
375
+ return [genAiSourcePath, botSourcePath, botVersionSourcePath];
65
376
  }
66
377
  }
67
378
  exports.Agent = Agent;
package/lib/agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yCAAoC;AACpC,2CAA0E;AAC1E,yCAAkD;AAClD,6CAAyC;AAUzC;;GAEG;AACH,MAAa,KAAK;IAImC;IAH3C,MAAM,CAAS;IACf,SAAS,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EAAE,IAAI,EAAE,CAAC;SACnD,CAAC,CAAC;QACH,gDAAgD;QAChD,MAAM,OAAO,CAAC,GAAG,CAAC;YAChB,iBAAE,CAAC,QAAQ,CAAC,SAAS,CACnB,eAAe,EACf;;mCAE2B,MAAM,CAAC,IAAI;mCACX,MAAM,CAAC,IAAI;;;OAGvC,CACA;YACD,iBAAE,CAAC,QAAQ,CAAC,SAAS,CACnB,aAAa,EACb;;;iBAGS,MAAM,CAAC,IAAI;gBACZ,MAAM,CAAC,IAAI;;eAEZ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA6IH,MAAM,CAAC,kBAAkB;aAC/B,MAAM,CAAC,IAAI;;;;;;CAMvB,CACM;YACD,iBAAE,CAAC,QAAQ,CAAC,SAAS,CACnB,oBAAoB,EACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA+DoB,MAAM,CAAC,IAAI;;;;;;;;;CAStC,CACM;SACF,CAAC,CAAC;QAEH,OAAO,CAAC,eAAe,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAC;IAChE,CAAC;CACF;AAhYD,sBAgYC"}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecCreateConfig, type AgentJobSpecCreateResponse, SfAgent, } from './types';
2
- export { Agent } from './agent';
2
+ export { Agent, AgentCreateLifecycleStages } from './agent';
3
3
  export { AgentTester, humanFormat, jsonFormat, junitFormat, type AgentTestDetailsResponse, type AgentTestStartResponse, type AgentTestStatusResponse, type TestCaseResult, type TestStatus, } from './agentTester';
package/lib/index.js CHANGED
@@ -6,9 +6,10 @@
6
6
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.junitFormat = exports.jsonFormat = exports.humanFormat = exports.AgentTester = exports.Agent = void 0;
9
+ exports.junitFormat = exports.jsonFormat = exports.humanFormat = exports.AgentTester = exports.AgentCreateLifecycleStages = exports.Agent = void 0;
10
10
  var agent_1 = require("./agent");
11
11
  Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
12
+ Object.defineProperty(exports, "AgentCreateLifecycleStages", { enumerable: true, get: function () { return agent_1.AgentCreateLifecycleStages; } });
12
13
  var agentTester_1 = require("./agentTester");
13
14
  Object.defineProperty(exports, "AgentTester", { enumerable: true, get: function () { return agentTester_1.AgentTester; } });
14
15
  Object.defineProperty(exports, "humanFormat", { enumerable: true, get: function () { return agentTester_1.humanFormat; } });
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAUH,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,6CAUuB;AATrB,0GAAA,WAAW,OAAA;AACX,0GAAA,WAAW,OAAA;AACX,yGAAA,UAAU,OAAA;AACV,0GAAA,WAAW,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAUH,iCAA4D;AAAnD,8FAAA,KAAK,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAC1C,6CAUuB;AATrB,0GAAA,WAAW,OAAA;AACX,0GAAA,WAAW,OAAA;AACX,yGAAA,UAAU,OAAA;AACV,0GAAA,WAAW,OAAA"}
package/lib/types.d.ts CHANGED
@@ -8,6 +8,17 @@ export type AgentJobSpec = [
8
8
  jobDescription: string;
9
9
  }
10
10
  ];
11
+ /**
12
+ * The body POST'd to /services/data/{api-version}/connect/attach-agent-topics
13
+ */
14
+ export type AttachAgentTopicsBody = {
15
+ plannerId: string;
16
+ role: string;
17
+ companyName: string;
18
+ companyDescription: string;
19
+ agentType: string;
20
+ agentJobSpecs: AgentJobSpec;
21
+ };
11
22
  /**
12
23
  * The parameters used to generate an agent spec.
13
24
  */
@@ -25,7 +36,7 @@ export type AgentJobSpecCreateConfig = {
25
36
  * NOTE: This is likely to change with planned serverside APIs.
26
37
  */
27
38
  export type AgentCreateConfig = AgentJobSpecCreateConfig & {
28
- jobSpecs: AgentJobSpec;
39
+ jobSpec: AgentJobSpec;
29
40
  };
30
41
  /**
31
42
  * An interface for working with Agents.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/agents",
3
3
  "description": "Client side APIs for working with Salesforce agents",
4
- "version": "0.4.0",
4
+ "version": "0.4.1",
5
5
  "license": "BSD-3-Clause",
6
6
  "author": "Salesforce",
7
7
  "main": "lib/index",
@@ -15,6 +15,7 @@
15
15
  "@salesforce/core": "^8.8.0",
16
16
  "@salesforce/kit": "^3.2.3",
17
17
  "@salesforce/sf-plugins-core": "^12.1.0",
18
+ "@salesforce/source-deploy-retrieve": "^12.10.2",
18
19
  "fast-xml-parser": "^4",
19
20
  "nock": "^13.5.6"
20
21
  },