@salesforce/agents 0.6.3 → 0.7.0
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 +13 -3
- package/lib/agent.js +51 -3
- package/lib/agent.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +110 -0
- package/package.json +1 -1
package/lib/agent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Connection, SfProject } from '@salesforce/core';
|
|
2
|
-
import { type SfAgent, type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecV2, type AgentJobSpecCreateConfig, type AgentJobSpecCreateConfigV2 } from './types.js';
|
|
2
|
+
import { type SfAgent, type AgentCreateConfig, type AgentCreateConfigV2, type AgentCreateResponse, type AgentCreateResponseV2, type AgentJobSpec, type AgentJobSpecV2, type AgentJobSpecCreateConfig, type AgentJobSpecCreateConfigV2 } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Events emitted during Agent.create() for consumers to listen to and keep track of progress
|
|
5
5
|
*
|
|
@@ -11,6 +11,11 @@ export declare const AgentCreateLifecycleStages: {
|
|
|
11
11
|
CreatingRemotely: string;
|
|
12
12
|
RetrievingMetadata: string;
|
|
13
13
|
};
|
|
14
|
+
export declare const AgentCreateLifecycleStagesV2: {
|
|
15
|
+
Creating: string;
|
|
16
|
+
Previewing: string;
|
|
17
|
+
Retrieving: string;
|
|
18
|
+
};
|
|
14
19
|
/**
|
|
15
20
|
* Class for creating Agents and agent specs.
|
|
16
21
|
*/
|
|
@@ -36,6 +41,13 @@ export declare class Agent implements SfAgent {
|
|
|
36
41
|
* @returns {Promise<AgentCreateResponse>}
|
|
37
42
|
*/
|
|
38
43
|
create(config: AgentCreateConfig): Promise<AgentCreateResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Creates an agent from a configuration, optionally saving the agent in an org.
|
|
46
|
+
*
|
|
47
|
+
* @param config a configuration for creating or previewing an agent
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
createV2(config: AgentCreateConfigV2): Promise<AgentCreateResponseV2>;
|
|
39
51
|
/**
|
|
40
52
|
* Create an agent spec from provided data.
|
|
41
53
|
*
|
|
@@ -47,8 +59,6 @@ export declare class Agent implements SfAgent {
|
|
|
47
59
|
/**
|
|
48
60
|
* Create an agent spec from provided data.
|
|
49
61
|
*
|
|
50
|
-
* V2 API: /connect/ai-assist/draft-agent-topics
|
|
51
|
-
*
|
|
52
62
|
* @param config The configuration used to generate an agent spec.
|
|
53
63
|
*/
|
|
54
64
|
createSpecV2(config: AgentJobSpecCreateConfigV2): Promise<AgentJobSpecV2>;
|
package/lib/agent.js
CHANGED
|
@@ -9,7 +9,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Agent = exports.AgentCreateLifecycleStages = void 0;
|
|
12
|
+
exports.Agent = exports.AgentCreateLifecycleStagesV2 = exports.AgentCreateLifecycleStages = void 0;
|
|
13
13
|
const node_util_1 = require("node:util");
|
|
14
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
15
15
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
@@ -30,6 +30,11 @@ exports.AgentCreateLifecycleStages = {
|
|
|
30
30
|
CreatingRemotely: 'creatingremotely',
|
|
31
31
|
RetrievingMetadata: 'retrievingmetadata',
|
|
32
32
|
};
|
|
33
|
+
exports.AgentCreateLifecycleStagesV2 = {
|
|
34
|
+
Creating: 'creatingAgent',
|
|
35
|
+
Previewing: 'previewingAgent',
|
|
36
|
+
Retrieving: 'retrievingAgent',
|
|
37
|
+
};
|
|
33
38
|
/**
|
|
34
39
|
* Class for creating Agents and agent specs.
|
|
35
40
|
*/
|
|
@@ -103,6 +108,51 @@ class Agent {
|
|
|
103
108
|
}
|
|
104
109
|
return response;
|
|
105
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Creates an agent from a configuration, optionally saving the agent in an org.
|
|
113
|
+
*
|
|
114
|
+
* @param config a configuration for creating or previewing an agent
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
async createV2(config) {
|
|
118
|
+
const url = '/connect/ai-assist/create-agent';
|
|
119
|
+
// When previewing agent creation just return the response.
|
|
120
|
+
if (!config.saveAgent) {
|
|
121
|
+
this.logger.debug(`Previewing agent creation using config: ${(0, node_util_1.inspect)(config)} in project: ${this.project.getPath()}`);
|
|
122
|
+
await core_1.Lifecycle.getInstance().emit(exports.AgentCreateLifecycleStagesV2.Previewing, {});
|
|
123
|
+
return this.maybeMock.request('POST', url, config);
|
|
124
|
+
}
|
|
125
|
+
// When saving agent creation we need to retrieve the created metadata.
|
|
126
|
+
this.logger.debug(`Creating agent using config: ${(0, node_util_1.inspect)(config)} in project: ${this.project.getPath()}`);
|
|
127
|
+
await core_1.Lifecycle.getInstance().emit(exports.AgentCreateLifecycleStagesV2.Creating, {});
|
|
128
|
+
const response = await this.maybeMock.request('POST', url, config);
|
|
129
|
+
await core_1.Lifecycle.getInstance().emit(exports.AgentCreateLifecycleStagesV2.Retrieving, {});
|
|
130
|
+
//
|
|
131
|
+
// When retrieving all agent metadata by a Bot API name works in SDR we can use that.
|
|
132
|
+
//
|
|
133
|
+
// Query for the Bot API name by the Bot ID.
|
|
134
|
+
// const botApiName = this.connection.singleRecordQuery('get bot from response.agentId?.botId');
|
|
135
|
+
// const cs = await ComponentSetBuilder.build({
|
|
136
|
+
// metadata: {
|
|
137
|
+
// metadataEntries: [`Bot:${}`],
|
|
138
|
+
// directoryPaths: [this.project.getDefaultPackage().path],
|
|
139
|
+
// }
|
|
140
|
+
// });
|
|
141
|
+
// const retrieve = await cs.retrieve({
|
|
142
|
+
// usernameOrConnection: this.connection,
|
|
143
|
+
// merge: true,
|
|
144
|
+
// format: 'source',
|
|
145
|
+
// output: this.project.getDefaultPackage().path ?? 'force-app',
|
|
146
|
+
// });
|
|
147
|
+
// const retrieveResult = await retrieve.pollStatus({
|
|
148
|
+
// frequency: Duration.milliseconds(200),
|
|
149
|
+
// timeout: Duration.minutes(5),
|
|
150
|
+
// });
|
|
151
|
+
// if (!retrieveResult.response.success) {
|
|
152
|
+
// throw new SfError(`Unable to retrieve ${retrieveResult.response.id}`);
|
|
153
|
+
// }
|
|
154
|
+
return response;
|
|
155
|
+
}
|
|
106
156
|
/**
|
|
107
157
|
* Create an agent spec from provided data.
|
|
108
158
|
*
|
|
@@ -127,8 +177,6 @@ class Agent {
|
|
|
127
177
|
/**
|
|
128
178
|
* Create an agent spec from provided data.
|
|
129
179
|
*
|
|
130
|
-
* V2 API: /connect/ai-assist/draft-agent-topics
|
|
131
|
-
*
|
|
132
180
|
* @param config The configuration used to generate an agent spec.
|
|
133
181
|
*/
|
|
134
182
|
async createSpecV2(config) {
|
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,0DAA6B;AAC7B,sDAAyB;AACzB,2CAA+F;AAC/F,+EAAyE;AACzE,yCAA2C;
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,yCAAoC;AACpC,0DAA6B;AAC7B,sDAAyB;AACzB,2CAA+F;AAC/F,+EAAyE;AACzE,yCAA2C;AAgB3C,6CAAyC;AAEzC,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;AAEvE;;;;GAIG;AACU,QAAA,0BAA0B,GAAG;IACxC,eAAe,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C,QAAQ,CAAC,KAAK,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;YAC1D,iBAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,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;AAtfD,sBAsfC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecV2, type AgentJobSpecCreateConfig, type AgentJobSpecCreateConfigV2, type AgentJobSpecCreateResponse, type DraftAgentTopics, type DraftAgentTopicsBody, type DraftAgentTopicsResponse, SfAgent, } from './types';
|
|
2
|
-
export { Agent, AgentCreateLifecycleStages } from './agent';
|
|
1
|
+
export { type AgentCreateConfig, type AgentCreateConfigV2, type AgentCreateResponse, type AgentCreateResponseV2, type AgentJobSpec, type AgentJobSpecV2, type AgentJobSpecCreateConfig, type AgentJobSpecCreateConfigV2, type AgentJobSpecCreateResponse, type DraftAgentTopics, type DraftAgentTopicsBody, type DraftAgentTopicsResponse, SfAgent, } from './types';
|
|
2
|
+
export { Agent, AgentCreateLifecycleStages, AgentCreateLifecycleStagesV2 } from './agent';
|
|
3
3
|
export { AgentTester, convertTestResultsToFormat, type AgentTestResultsResponse, type AgentTestStartResponse, type AgentTestStatusResponse, type TestCaseResult, type TestStatus, } from './agentTester';
|
package/lib/index.js
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
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.convertTestResultsToFormat = exports.AgentTester = exports.AgentCreateLifecycleStages = exports.Agent = void 0;
|
|
9
|
+
exports.convertTestResultsToFormat = exports.AgentTester = exports.AgentCreateLifecycleStagesV2 = 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
12
|
Object.defineProperty(exports, "AgentCreateLifecycleStages", { enumerable: true, get: function () { return agent_1.AgentCreateLifecycleStages; } });
|
|
13
|
+
Object.defineProperty(exports, "AgentCreateLifecycleStagesV2", { enumerable: true, get: function () { return agent_1.AgentCreateLifecycleStagesV2; } });
|
|
13
14
|
var agentTester_1 = require("./agentTester");
|
|
14
15
|
Object.defineProperty(exports, "AgentTester", { enumerable: true, get: function () { return agentTester_1.AgentTester; } });
|
|
15
16
|
Object.defineProperty(exports, "convertTestResultsToFormat", { enumerable: true, get: function () { return agentTester_1.convertTestResultsToFormat; } });
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAiBH,iCAA0F;AAAjF,8FAAA,KAAK,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAAE,qHAAA,4BAA4B,OAAA;AACxE,6CAQuB;AAPrB,0GAAA,WAAW,OAAA;AACX,yHAAA,0BAA0B,OAAA"}
|
package/lib/types.d.ts
CHANGED
|
@@ -68,6 +68,70 @@ export type AgentJobSpecCreateConfigV2 = {
|
|
|
68
68
|
export type AgentCreateConfig = AgentJobSpecCreateConfig & {
|
|
69
69
|
jobSpec: AgentJobSpec;
|
|
70
70
|
};
|
|
71
|
+
export type AgentCreateConfigV2 = DraftAgentTopicsBody & {
|
|
72
|
+
generationInfo: {
|
|
73
|
+
defaultInfo: {
|
|
74
|
+
/**
|
|
75
|
+
* List of topics from an agent spec.
|
|
76
|
+
*/
|
|
77
|
+
preDefinedTopics?: DraftAgentTopics;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Whether to persist the agent creation in the org (true) or preview
|
|
82
|
+
* what would be created (false).
|
|
83
|
+
*
|
|
84
|
+
* Default: false
|
|
85
|
+
*/
|
|
86
|
+
saveAgent?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Settings for the agent being created. Needed only when saveAgent=true
|
|
89
|
+
*/
|
|
90
|
+
agentSettings?: {
|
|
91
|
+
/**
|
|
92
|
+
* The name to use for the Agent metadata to be created.
|
|
93
|
+
*/
|
|
94
|
+
agentName: string;
|
|
95
|
+
/**
|
|
96
|
+
* The API name to use for the Agent metadata to be created.
|
|
97
|
+
*/
|
|
98
|
+
agentApiName?: string;
|
|
99
|
+
/**
|
|
100
|
+
* The GenAiPlanner metadata ID if already created in the org.
|
|
101
|
+
*/
|
|
102
|
+
plannerId?: string;
|
|
103
|
+
/**
|
|
104
|
+
* User ID of an existing user.
|
|
105
|
+
*
|
|
106
|
+
* Determines what this agent can access and do. If your agent uses
|
|
107
|
+
* features or objects that require additional permissions, assign
|
|
108
|
+
* a custom user.
|
|
109
|
+
*/
|
|
110
|
+
userId?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Store conversation transcripts, including end-user data, in event logs
|
|
113
|
+
* for this agent for troubleshooting. If false, conversation data is
|
|
114
|
+
* replaced with, "Sensitive data not available."
|
|
115
|
+
*
|
|
116
|
+
* Default: false
|
|
117
|
+
*/
|
|
118
|
+
enrichLogs?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* The conversational style of your agent's responses. Can be one of:
|
|
121
|
+
* formal, casual, or neutral.
|
|
122
|
+
*
|
|
123
|
+
* Default: casual
|
|
124
|
+
*/
|
|
125
|
+
tone?: 'casual' | 'formal' | 'neutral';
|
|
126
|
+
/**
|
|
127
|
+
* The language your agent uses in conversations. Agent currently
|
|
128
|
+
* supports English only.
|
|
129
|
+
*
|
|
130
|
+
* Default: en_US
|
|
131
|
+
*/
|
|
132
|
+
primaryLanguage?: 'en_US';
|
|
133
|
+
};
|
|
134
|
+
};
|
|
71
135
|
/**
|
|
72
136
|
* The request body to send to the `draft-agent-topics` API.
|
|
73
137
|
*/
|
|
@@ -111,6 +175,52 @@ export type AgentCreateResponse = {
|
|
|
111
175
|
isSuccess: boolean;
|
|
112
176
|
errorMessage?: string;
|
|
113
177
|
};
|
|
178
|
+
export type AgentCreateResponseV2 = {
|
|
179
|
+
isSuccess: boolean;
|
|
180
|
+
errorMessage?: string;
|
|
181
|
+
/**
|
|
182
|
+
* If the agent was created with saveAgent=true, these are the
|
|
183
|
+
* IDs that make up an agent; Bot, BotVersion, and GenAiPlanner metadata.
|
|
184
|
+
*/
|
|
185
|
+
agentId?: {
|
|
186
|
+
botId: string;
|
|
187
|
+
botVersionId: string;
|
|
188
|
+
plannerId: string;
|
|
189
|
+
};
|
|
190
|
+
agentDefinition: {
|
|
191
|
+
agentDescription: string;
|
|
192
|
+
topics: [
|
|
193
|
+
{
|
|
194
|
+
scope: string;
|
|
195
|
+
topic: string;
|
|
196
|
+
actions: [
|
|
197
|
+
{
|
|
198
|
+
actionName: string;
|
|
199
|
+
exampleOutput: string;
|
|
200
|
+
actionDescription: string;
|
|
201
|
+
inputs: [
|
|
202
|
+
{
|
|
203
|
+
inputName: string;
|
|
204
|
+
inputDataType: string;
|
|
205
|
+
inputDescription: string;
|
|
206
|
+
}
|
|
207
|
+
];
|
|
208
|
+
outputs: [
|
|
209
|
+
{
|
|
210
|
+
outputName: string;
|
|
211
|
+
outputDataType: string;
|
|
212
|
+
outputDescription: string;
|
|
213
|
+
}
|
|
214
|
+
];
|
|
215
|
+
}
|
|
216
|
+
];
|
|
217
|
+
instructions: string[];
|
|
218
|
+
classificationDescription: string;
|
|
219
|
+
}
|
|
220
|
+
];
|
|
221
|
+
sampleUtterances: string[];
|
|
222
|
+
};
|
|
223
|
+
};
|
|
114
224
|
export type DraftAgentTopics = [
|
|
115
225
|
{
|
|
116
226
|
name: string;
|