@salesforce/agents 0.5.10 → 0.6.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 -1
- package/lib/agent.js +53 -4
- package/lib/agent.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +65 -0
- package/messages/agents.md +3 -0
- package/package.json +3 -3
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 AgentJobSpecCreateConfig } from './types.js';
|
|
2
|
+
import { type SfAgent, type AgentCreateConfig, type AgentCreateResponse, 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
|
*
|
|
@@ -30,6 +30,8 @@ export declare class Agent implements SfAgent {
|
|
|
30
30
|
* From an AgentCreateConfig, deploy the required metadata, call the connect/attach-agent-topics endpoint, and then retrieve
|
|
31
31
|
* the newly updated metadata back to the local project
|
|
32
32
|
*
|
|
33
|
+
* @deprecated Use the V2 APIs.
|
|
34
|
+
*
|
|
33
35
|
* @param {AgentCreateConfig} config
|
|
34
36
|
* @returns {Promise<AgentCreateResponse>}
|
|
35
37
|
*/
|
|
@@ -37,9 +39,19 @@ export declare class Agent implements SfAgent {
|
|
|
37
39
|
/**
|
|
38
40
|
* Create an agent spec from provided data.
|
|
39
41
|
*
|
|
42
|
+
* @deprecated Use the V2 APIs.
|
|
43
|
+
*
|
|
40
44
|
* @param config The configuration used to generate an agent spec.
|
|
41
45
|
*/
|
|
42
46
|
createSpec(config: AgentJobSpecCreateConfig): Promise<AgentJobSpec>;
|
|
47
|
+
/**
|
|
48
|
+
* Create an agent spec from provided data.
|
|
49
|
+
*
|
|
50
|
+
* V2 API: /connect/ai-assist/draft-agent-topics
|
|
51
|
+
*
|
|
52
|
+
* @param config The configuration used to generate an agent spec.
|
|
53
|
+
*/
|
|
54
|
+
createSpecV2(config: AgentJobSpecCreateConfigV2): Promise<AgentJobSpecV2>;
|
|
43
55
|
private verifyAgentSpecConfig;
|
|
44
56
|
private buildAgentJobSpecUrl;
|
|
45
57
|
private createMetadata;
|
package/lib/agent.js
CHANGED
|
@@ -17,6 +17,8 @@ const core_1 = require("@salesforce/core");
|
|
|
17
17
|
const source_deploy_retrieve_1 = require("@salesforce/source-deploy-retrieve");
|
|
18
18
|
const kit_1 = require("@salesforce/kit");
|
|
19
19
|
const maybe_mock_1 = require("./maybe-mock");
|
|
20
|
+
core_1.Messages.importMessagesDirectory(__dirname);
|
|
21
|
+
const messages = core_1.Messages.loadMessages('@salesforce/agents', 'agents');
|
|
20
22
|
/**
|
|
21
23
|
* Events emitted during Agent.create() for consumers to listen to and keep track of progress
|
|
22
24
|
*
|
|
@@ -52,6 +54,8 @@ class Agent {
|
|
|
52
54
|
* From an AgentCreateConfig, deploy the required metadata, call the connect/attach-agent-topics endpoint, and then retrieve
|
|
53
55
|
* the newly updated metadata back to the local project
|
|
54
56
|
*
|
|
57
|
+
* @deprecated Use the V2 APIs.
|
|
58
|
+
*
|
|
55
59
|
* @param {AgentCreateConfig} config
|
|
56
60
|
* @returns {Promise<AgentCreateResponse>}
|
|
57
61
|
*/
|
|
@@ -102,10 +106,11 @@ class Agent {
|
|
|
102
106
|
/**
|
|
103
107
|
* Create an agent spec from provided data.
|
|
104
108
|
*
|
|
109
|
+
* @deprecated Use the V2 APIs.
|
|
110
|
+
*
|
|
105
111
|
* @param config The configuration used to generate an agent spec.
|
|
106
112
|
*/
|
|
107
113
|
async createSpec(config) {
|
|
108
|
-
this.verifyAgentSpecConfig(config);
|
|
109
114
|
let agentSpec;
|
|
110
115
|
const response = await this.maybeMock.request('GET', this.buildAgentJobSpecUrl(config));
|
|
111
116
|
if (response.isSuccess && response.jobSpecs) {
|
|
@@ -119,11 +124,55 @@ class Agent {
|
|
|
119
124
|
}
|
|
120
125
|
return agentSpec;
|
|
121
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Create an agent spec from provided data.
|
|
129
|
+
*
|
|
130
|
+
* V2 API: /connect/ai-assist/draft-agent-topics
|
|
131
|
+
*
|
|
132
|
+
* @param config The configuration used to generate an agent spec.
|
|
133
|
+
*/
|
|
134
|
+
async createSpecV2(config) {
|
|
135
|
+
this.verifyAgentSpecConfig(config);
|
|
136
|
+
const url = '/connect/ai-assist/draft-agent-topics';
|
|
137
|
+
const body = {
|
|
138
|
+
agentType: config.agentType,
|
|
139
|
+
generationInfo: {
|
|
140
|
+
defaultInfo: {
|
|
141
|
+
role: config.role,
|
|
142
|
+
companyName: config.companyName,
|
|
143
|
+
companyDescription: config.companyDescription,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
generationSettings: {
|
|
147
|
+
maxNumOfTopics: config.maxNumOfTopics ?? 10,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
if (config.companyWebsite) {
|
|
151
|
+
body.generationInfo.defaultInfo.companyWebsite = config.companyWebsite;
|
|
152
|
+
}
|
|
153
|
+
if (config.promptTemplateName) {
|
|
154
|
+
body.generationInfo.customizedInfo = { promptTemplateName: config.promptTemplateName };
|
|
155
|
+
if (config.groundingContext) {
|
|
156
|
+
body.generationInfo.customizedInfo.groundingContext = config.groundingContext;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const response = await this.maybeMock.request('POST', url, body);
|
|
160
|
+
if (response.isSuccess && response.topics) {
|
|
161
|
+
return { ...config, topics: response.topics };
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
throw core_1.SfError.create({
|
|
165
|
+
name: 'AgentJobSpecCreateError',
|
|
166
|
+
message: response.errorMessage ?? 'unknown',
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
122
170
|
// eslint-disable-next-line class-methods-use-this
|
|
123
171
|
verifyAgentSpecConfig(config) {
|
|
124
|
-
|
|
125
|
-
if (
|
|
126
|
-
|
|
172
|
+
const { agentType, role, companyName, companyDescription } = config;
|
|
173
|
+
if (!agentType || !role || !companyName || !companyDescription) {
|
|
174
|
+
throw messages.createError('invalidAgentSpecConfig');
|
|
175
|
+
}
|
|
127
176
|
}
|
|
128
177
|
// eslint-disable-next-line class-methods-use-this
|
|
129
178
|
buildAgentJobSpecUrl(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,
|
|
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;AAc3C,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,EAAE,iBAAiB;IAClC,iBAAiB,EAAE,mBAAmB;IACtC,gBAAgB,EAAE,kBAAkB;IACpC,kBAAkB,EAAE,oBAAoB;CACzC,CAAC;AAEF;;GAEG;AACH,MAAa,KAAK;IAWmC;IAV3C,MAAM,CAAS;IACf,SAAS,CAAY;IACZ,UAAU,CAAa;IAExC;;;;;OAKG;IACH,YAAmB,UAAsB,EAAU,OAAkB;QAAlB,YAAO,GAAP,OAAO,CAAW;QACnE,IAAI,CAAC,MAAM,GAAG,aAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAjcD,sBAicC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecCreateConfig, type AgentJobSpecCreateResponse, SfAgent, } from './types';
|
|
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
2
|
export { Agent, AgentCreateLifecycleStages } from './agent';
|
|
3
3
|
export { AgentTester, humanFormat, jsonFormat, junitFormat, tapFormat, type AgentTestDetailsResponse, type AgentTestStartResponse, type AgentTestStatusResponse, type TestCaseResult, type TestStatus, } from './agentTester';
|
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;;;AAeH,iCAA4D;AAAnD,8FAAA,KAAK,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAC1C,6CAWuB;AAVrB,0GAAA,WAAW,OAAA;AACX,0GAAA,WAAW,OAAA;AACX,yGAAA,UAAU,OAAA;AACV,0GAAA,WAAW,OAAA;AACX,wGAAA,SAAS,OAAA"}
|
package/lib/types.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export type AgentJobSpec = [
|
|
|
8
8
|
jobDescription: string;
|
|
9
9
|
}
|
|
10
10
|
];
|
|
11
|
+
export type AgentJobSpecV2 = AgentJobSpecCreateConfigV2 & {
|
|
12
|
+
topics: DraftAgentTopics;
|
|
13
|
+
};
|
|
11
14
|
/**
|
|
12
15
|
* The body POST'd to /services/data/{api-version}/connect/attach-agent-topics
|
|
13
16
|
*/
|
|
@@ -30,6 +33,33 @@ export type AgentJobSpecCreateConfig = {
|
|
|
30
33
|
companyDescription: string;
|
|
31
34
|
companyWebsite?: string;
|
|
32
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* The parameters used to generate an agent spec V2.
|
|
38
|
+
*/
|
|
39
|
+
export type AgentJobSpecCreateConfigV2 = {
|
|
40
|
+
/**
|
|
41
|
+
* Internal type is copilots; used by customers' employees.
|
|
42
|
+
* Customer type is agents; used by customers' customers.
|
|
43
|
+
*/
|
|
44
|
+
agentType: 'customer' | 'internal';
|
|
45
|
+
role: string;
|
|
46
|
+
companyName: string;
|
|
47
|
+
companyDescription: string;
|
|
48
|
+
companyWebsite?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The maximum number of topics to create in the spec.
|
|
51
|
+
* Default is 10.
|
|
52
|
+
*/
|
|
53
|
+
maxNumOfTopics?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Developer name of the prompt template.
|
|
56
|
+
*/
|
|
57
|
+
promptTemplateName?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Context info to be used in customized prompt template
|
|
60
|
+
*/
|
|
61
|
+
groundingContext?: string;
|
|
62
|
+
};
|
|
33
63
|
/**
|
|
34
64
|
* The parameters used to generate an agent in an org.
|
|
35
65
|
*
|
|
@@ -38,6 +68,27 @@ export type AgentJobSpecCreateConfig = {
|
|
|
38
68
|
export type AgentCreateConfig = AgentJobSpecCreateConfig & {
|
|
39
69
|
jobSpec: AgentJobSpec;
|
|
40
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* The request body to send to the `draft-agent-topics` API.
|
|
73
|
+
*/
|
|
74
|
+
export type DraftAgentTopicsBody = {
|
|
75
|
+
agentType: 'customer' | 'internal';
|
|
76
|
+
generationInfo: {
|
|
77
|
+
defaultInfo: {
|
|
78
|
+
role: string;
|
|
79
|
+
companyName: string;
|
|
80
|
+
companyDescription: string;
|
|
81
|
+
companyWebsite?: string;
|
|
82
|
+
};
|
|
83
|
+
customizedInfo?: {
|
|
84
|
+
promptTemplateName: string;
|
|
85
|
+
groundingContext?: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
generationSettings: {
|
|
89
|
+
maxNumOfTopics?: number;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
41
92
|
/**
|
|
42
93
|
* An interface for working with Agents.
|
|
43
94
|
*/
|
|
@@ -60,3 +111,17 @@ export type AgentCreateResponse = {
|
|
|
60
111
|
isSuccess: boolean;
|
|
61
112
|
errorMessage?: string;
|
|
62
113
|
};
|
|
114
|
+
export type DraftAgentTopics = [
|
|
115
|
+
{
|
|
116
|
+
name: string;
|
|
117
|
+
description: string;
|
|
118
|
+
}
|
|
119
|
+
];
|
|
120
|
+
/**
|
|
121
|
+
* The response from the `draft-agent-topics` API.
|
|
122
|
+
*/
|
|
123
|
+
export type DraftAgentTopicsResponse = {
|
|
124
|
+
isSuccess: boolean;
|
|
125
|
+
errorMessage?: string;
|
|
126
|
+
topics: DraftAgentTopics;
|
|
127
|
+
};
|
package/messages/agents.md
CHANGED
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
|
+
"version": "0.6.0",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "Salesforce",
|
|
7
7
|
"main": "lib/index",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@salesforce/kit": "^3.2.3",
|
|
16
16
|
"@salesforce/sf-plugins-core": "^12.1.2",
|
|
17
17
|
"@salesforce/source-deploy-retrieve": "^12.12.3",
|
|
18
|
-
"ansis": "^3.
|
|
18
|
+
"ansis": "^3.8.1",
|
|
19
19
|
"fast-xml-parser": "^4",
|
|
20
20
|
"nock": "^13.5.6"
|
|
21
21
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@salesforce/cli-plugins-testkit": "^5.3.38",
|
|
24
24
|
"@salesforce/dev-scripts": "^10.2.10",
|
|
25
25
|
"ts-node": "^10.9.2",
|
|
26
|
-
"typescript": "^5.
|
|
26
|
+
"typescript": "^5.7.3"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=18.0.0"
|