@salesforce/agents 0.18.3-nga.1 → 0.18.3-nga.2

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.js CHANGED
@@ -355,7 +355,7 @@ topic escalation:
355
355
  static async compileAgentScript(connection, agentScriptContent) {
356
356
  // Ensure we use the correct connection for this API call
357
357
  const orgJwtConnection = await (0, utils_1.useNamedUserJwt)(connection);
358
- const url = 'https://api.salesforce.com/einstein/ai-agent/v1.1/authoring/compile';
358
+ const url = `https://${kit_1.env.getBoolean('SF_TEST_API') ? 'test.' : ''}api.salesforce.com/einstein/ai-agent/v1.1/authoring/scripts`;
359
359
  getLogger().debug(`Compiling .agent : ${agentScriptContent}`);
360
360
  const compileData = {
361
361
  assets: [
package/lib/agent.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,gDAAkC;AAClC,+CAAsE;AACtE,qDAAwD;AACxD,2CAAgH;AAChH,+EAAyE;AACzE,yCAA2C;AAC3C,gDAAwB;AAmBxB,6CAAyC;AACzC,mCAAmF;;AAGnF,MAAM,QAAQ,OAAG,eAAQ,CAAc,oBAAoB,EAAE,QAAQ,kuBAAC,CAAC;AAEvE,IAAI,MAAc,CAAC;AACnB,MAAM,SAAS,GAAG,GAAW,EAAE;IAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,aAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;;GAIG;AACU,QAAA,0BAA0B,GAAG;IACxC,QAAQ,EAAE,eAAe;IACzB,UAAU,EAAE,iBAAiB;IAC7B,UAAU,EAAE,iBAAiB;CAC9B,CAAC;AA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AAU,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,OAAO,CAAwB,MAAM,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;QACvG,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,WAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC;QACjG,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,CAAC,WAAW,CAAC,sBAAsB,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;QACnG,CAAC;IACH,CAAC;CACF;AAtgBD,sBAsgBC;AAED,8CAA8C;AAC9C,MAAM,qBAAqB,GAAG,CAAC,MAAgC,EAAQ,EAAE;IACvE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC/D,MAAM,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC;AAEF,wDAAwD;AACxD,MAAM,cAAc,GAAG,CAAmB,QAAW,EAAK,EAAE,CAC1D,IAAI,CAAC,KAAK,CAAC,IAAA,0BAAkB,EAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAM,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Connection } from '@salesforce/core';
2
- import { type AgentPreviewEndResponse, type AgentPreviewStartResponse, type AgentPreviewSendResponse, type ApiStatus, type EndReason } from './types.js';
2
+ import { AgentPreviewBase } from './agentPreviewBase';
3
+ import { type AgentPreviewStartResponse, type AgentPreviewSendResponse, type AgentPreviewEndResponse, type ApiStatus, type EndReason } from './types.js';
3
4
  /**
4
5
  * A service to interact with an agent. Start an interactive session,
5
6
  * send messages to the agent, and end the session.
@@ -26,14 +27,9 @@ import { type AgentPreviewEndResponse, type AgentPreviewStartResponse, type Agen
26
27
  *
27
28
  * `agentPreview.toggleApexDebugMode(true);`
28
29
  */
29
- export declare class AgentPreview {
30
- private readonly apiBase;
31
- private connection;
32
- private logger;
33
- private maybeMock;
34
- private apexDebugMode?;
35
- private apexTraceFlag?;
36
- private botId;
30
+ export declare class AgentPreview extends AgentPreviewBase {
31
+ protected readonly apiBase: string;
32
+ private readonly botId;
37
33
  /**
38
34
  * Create an instance of the service.
39
35
  *
@@ -69,13 +65,6 @@ export declare class AgentPreview {
69
65
  * @returns `ApiStatus`
70
66
  */
71
67
  status(): Promise<ApiStatus>;
72
- /**
73
- * Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user
74
- * and create apex debug logs for use within VS Code's Apex Replay Debugger.
75
- *
76
- * @param enable Whether to enable or disable Apex Debug Mode.
77
- */
78
- toggleApexDebugMode(enable: boolean): void;
79
68
  private getBotUserId;
80
69
  private ensureTraceFlag;
81
70
  }
@@ -18,8 +18,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.AgentPreview = void 0;
19
19
  const node_crypto_1 = require("node:crypto");
20
20
  const core_1 = require("@salesforce/core");
21
+ const kit_1 = require("@salesforce/kit");
21
22
  const agent_1 = require("./agent");
22
- const maybe_mock_1 = require("./maybe-mock");
23
+ const agentPreviewBase_1 = require("./agentPreviewBase");
24
+ const utils_1 = require("./utils");
23
25
  const apexUtils_1 = require("./apexUtils");
24
26
  ;
25
27
  const messages = new core_1.Messages('@salesforce/agents', 'agentPreview', new Map([["invalidBotId", "The Bot ID provided must begin with \"0Xx\" and be either 15 or 18 characters. Found: %s"], ["agentApexDebuggingError", "Agent must have a user assigned to enable apex debug mode."]]));
@@ -49,13 +51,8 @@ const messages = new core_1.Messages('@salesforce/agents', 'agentPreview', new M
49
51
  *
50
52
  * `agentPreview.toggleApexDebugMode(true);`
51
53
  */
52
- class AgentPreview {
53
- apiBase = 'https://api.salesforce.com/einstein/ai-agent/v1';
54
- connection;
55
- logger;
56
- maybeMock;
57
- apexDebugMode;
58
- apexTraceFlag;
54
+ class AgentPreview extends agentPreviewBase_1.AgentPreviewBase {
55
+ apiBase = `https://${kit_1.env.getBoolean('SF_TEST_API') ? 'test.' : ''}api.salesforce.com/einstein/ai-agent/v1`;
59
56
  botId;
60
57
  /**
61
58
  * Create an instance of the service.
@@ -64,9 +61,7 @@ class AgentPreview {
64
61
  * @param botId The ID of the agent (`Bot` ID).
65
62
  */
66
63
  constructor(connection, botId) {
67
- this.connection = connection;
68
- this.logger = core_1.Logger.childFromRoot(this.constructor.name);
69
- this.maybeMock = new maybe_mock_1.MaybeMock(connection);
64
+ super({ connection });
70
65
  if (!botId.startsWith('0Xx') || ![15, 18].includes(botId.length)) {
71
66
  throw messages.createError('invalidBotId', [botId]);
72
67
  }
@@ -91,7 +86,17 @@ class AgentPreview {
91
86
  bypassUser: true,
92
87
  };
93
88
  try {
94
- return await this.maybeMock.request('POST', url, body);
89
+ const response = await this.maybeMock.request('POST', url, body);
90
+ // Persist any initial agent messages (welcome, etc.)
91
+ await (0, utils_1.appendTranscriptEntry)({
92
+ timestamp: new Date().toISOString(),
93
+ agentId: this.botId,
94
+ sessionId: response.sessionId,
95
+ role: 'agent',
96
+ text: response.messages.map((m) => m.message).join('\n'),
97
+ raw: response.messages,
98
+ }, true);
99
+ return response;
95
100
  }
96
101
  catch (err) {
97
102
  throw core_1.SfError.wrap(err);
@@ -125,6 +130,27 @@ class AgentPreview {
125
130
  await this.ensureTraceFlag();
126
131
  }
127
132
  const response = await this.maybeMock.request('POST', url, body);
133
+ // Save user entry
134
+ await (0, utils_1.appendTranscriptEntry)({
135
+ timestamp: new Date().toISOString(),
136
+ agentId: this.botId,
137
+ sessionId,
138
+ role: 'user',
139
+ text: message,
140
+ });
141
+ // Save agent response entry
142
+ const agentText = (response.messages ?? [])
143
+ .map((m) => m.message)
144
+ .filter(Boolean)
145
+ .join('\n');
146
+ await (0, utils_1.appendTranscriptEntry)({
147
+ timestamp: new Date().toISOString(),
148
+ agentId: this.botId,
149
+ sessionId,
150
+ role: 'agent',
151
+ text: agentText || undefined,
152
+ raw: response.messages,
153
+ });
128
154
  if (this.apexDebugMode) {
129
155
  // get apex debug logs and look for a log within the start and end time
130
156
  const apexLog = await (0, apexUtils_1.getDebugLog)(this.connection, start, Date.now());
@@ -155,9 +181,18 @@ class AgentPreview {
155
181
  this.logger.debug(`Ending agent preview session for botId: ${this.botId} with sessionId: ${sessionId}`);
156
182
  try {
157
183
  // https://developer.salesforce.com/docs/einstein/genai/guide/agent-api-examples.html#end-session
158
- return await this.maybeMock.request('DELETE', url, undefined, {
184
+ const response = await this.maybeMock.request('DELETE', url, undefined, {
159
185
  'x-session-end-reason': reason,
160
186
  });
187
+ await (0, utils_1.appendTranscriptEntry)({
188
+ timestamp: new Date().toISOString(),
189
+ agentId: this.botId,
190
+ sessionId,
191
+ role: 'agent',
192
+ reason,
193
+ raw: response.messages,
194
+ });
195
+ return response;
161
196
  }
162
197
  catch (err) {
163
198
  throw core_1.SfError.wrap(err);
@@ -169,8 +204,7 @@ class AgentPreview {
169
204
  * @returns `ApiStatus`
170
205
  */
171
206
  async status() {
172
- const base = 'https://test.api.salesforce.com';
173
- const url = `${base}/einstein/ai-agent/v1/status`;
207
+ const url = `https://${kit_1.env.getBoolean('SF_TEST_API') ? 'test.' : ''}api.salesforce.com/einstein/ai-agent/v1/status`;
174
208
  try {
175
209
  return await this.maybeMock.request('GET', url);
176
210
  }
@@ -178,16 +212,6 @@ class AgentPreview {
178
212
  throw core_1.SfError.wrap(err);
179
213
  }
180
214
  }
181
- /**
182
- * Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user
183
- * and create apex debug logs for use within VS Code's Apex Replay Debugger.
184
- *
185
- * @param enable Whether to enable or disable Apex Debug Mode.
186
- */
187
- toggleApexDebugMode(enable) {
188
- this.apexDebugMode = enable;
189
- this.logger.debug(`Apex Debug Mode is now ${enable ? 'enabled' : 'disabled'}`);
190
- }
191
215
  async getBotUserId() {
192
216
  const agent = new agent_1.Agent({ connection: this.connection, nameOrId: this.botId });
193
217
  const botMetadata = await agent.getBotMetadata();
@@ -1 +1 @@
1
- {"version":3,"file":"agentPreview.js","sourceRoot":"","sources":["../src/agentPreview.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,6CAAyC;AACzC,2CAAyE;AACzE,mCAAgC;AAChC,6CAAyC;AAQzC,2CAA8F;;AAG9F,MAAM,QAAQ,OAAG,eAAQ,CAAc,oBAAoB,EAAE,cAAc,qNAAC,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,YAAY;IACN,OAAO,GAAG,iDAAiD,CAAC;IACrE,UAAU,CAAa;IACvB,MAAM,CAAS;IACf,SAAS,CAAY;IACrB,aAAa,CAAW;IACxB,aAAa,CAAiB;IAC9B,KAAK,CAAS;IAEtB;;;;;OAKG;IACH,YAAmB,UAAsB,EAAE,KAAa;QACtD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,aAAM,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC1D,IAAI,CAAC,SAAS,GAAG,IAAI,sBAAS,CAAC,UAAU,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACjE,MAAM,QAAQ,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,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AAE,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/E,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QACjD,OAAO,WAAW,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED,8EAA8E;IAC9E,8CAA8C;IAC9C,uCAAuC;IACvC,mBAAmB;IACnB,6BAA6B;IACrB,KAAK,CAAC,eAAe;QAC3B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;YAClD,IAAI,OAAO,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC;gBAC9C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qDAAqD,OAAO,EAAE,CAAC,CAAC;gBAClF,OAAO;YACT,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,QAAQ,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,IAAA,yBAAa,EAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,IAAA,2BAAe,EAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF;AA9MD,oCA8MC"}
@@ -0,0 +1,51 @@
1
+ import { Connection, Logger } from '@salesforce/core';
2
+ import { MaybeMock } from './maybe-mock';
3
+ import { type AgentPreviewEndResponse, type AgentPreviewStartResponse, type AgentPreviewSendResponse, type EndReason, type BaseAgentConfig, type AgentInteractionBase } from './types.js';
4
+ /**
5
+ * Abstract base class for agent runners that provides common functionality
6
+ * for interacting with agents through the Einstein AI Agent API.
7
+ */
8
+ export declare abstract class AgentPreviewBase implements AgentInteractionBase {
9
+ protected connection: Connection;
10
+ protected apexTraceFlag?: {
11
+ Id?: string;
12
+ ExpirationDate?: string;
13
+ };
14
+ protected readonly logger: Logger;
15
+ protected readonly maybeMock: MaybeMock;
16
+ protected apexDebugMode?: boolean;
17
+ protected constructor(config: BaseAgentConfig);
18
+ /**
19
+ * Get the base API URL for the agent service.
20
+ * This is overridden by child classes to provide their specific API base.
21
+ */
22
+ protected abstract get apiBase(): string;
23
+ /**
24
+ * Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user
25
+ * and create apex debug logs for use within VS Code's Apex Replay Debugger.
26
+ *
27
+ * @param enable Whether to enable or disable Apex Debug Mode.
28
+ */
29
+ setApexDebugMode(enable: boolean): void;
30
+ /**
31
+ * Start an interactive session with the agent.
32
+ * This is implemented by child classes to provide their specific start logic.
33
+ */
34
+ abstract start(): Promise<AgentPreviewStartResponse>;
35
+ /**
36
+ * Send a message to the agent using the session ID obtained by calling `start()`.
37
+ *
38
+ * @param sessionId A session ID provided by first calling `start()`.
39
+ * @param message A message to send to the agent.
40
+ * @returns `AgentPreviewSendResponse`
41
+ */
42
+ abstract send(sessionId: string, message: string): Promise<AgentPreviewSendResponse>;
43
+ /**
44
+ * Ends an interactive session with the agent.
45
+ *
46
+ * @param sessionId A session ID provided by first calling `start()`.
47
+ * @param reason A reason why the interactive session was ended.
48
+ * @returns `AgentPreviewEndResponse`
49
+ */
50
+ abstract end(sessionId: string, reason: EndReason): Promise<AgentPreviewEndResponse>;
51
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2025, Salesforce, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.AgentPreviewBase = void 0;
19
+ const core_1 = require("@salesforce/core");
20
+ const maybe_mock_1 = require("./maybe-mock");
21
+ /**
22
+ * Abstract base class for agent runners that provides common functionality
23
+ * for interacting with agents through the Einstein AI Agent API.
24
+ */
25
+ class AgentPreviewBase {
26
+ connection;
27
+ apexTraceFlag;
28
+ logger;
29
+ maybeMock;
30
+ apexDebugMode;
31
+ constructor(config) {
32
+ if (!config.connection) {
33
+ throw new Error('Connection is required');
34
+ }
35
+ // Protected properties
36
+ const connection = config.connection;
37
+ const logger = config.logger ?? core_1.Logger.childFromRoot(this.constructor.name);
38
+ // Initialize protected properties
39
+ this.connection = connection;
40
+ this.logger = logger;
41
+ this.maybeMock = new maybe_mock_1.MaybeMock(connection);
42
+ }
43
+ /**
44
+ * Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user
45
+ * and create apex debug logs for use within VS Code's Apex Replay Debugger.
46
+ *
47
+ * @param enable Whether to enable or disable Apex Debug Mode.
48
+ */
49
+ setApexDebugMode(enable) {
50
+ this.apexDebugMode = enable;
51
+ this.logger.debug(`Apex Debug Mode is now ${enable ? 'enabled' : 'disabled'}`);
52
+ }
53
+ }
54
+ exports.AgentPreviewBase = AgentPreviewBase;
55
+ //# sourceMappingURL=agentPreviewBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentPreviewBase.js","sourceRoot":"","sources":["../src/agentPreviewBase.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2CAAsD;AACtD,6CAAyC;AAUzC;;;GAGG;AACH,MAAsB,gBAAgB;IAC1B,UAAU,CAAa;IACvB,aAAa,CAA4C;IAChD,MAAM,CAAS;IACf,SAAS,CAAY;IAC9B,aAAa,CAAW;IAElC,YAAsB,MAAuB;QAC3C,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;QAED,uBAAuB;QACvB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACrC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,aAAM,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAE5E,kCAAkC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,sBAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;IAOD;;;;;OAKG;IACI,gBAAgB,CAAC,MAAe;QACrC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;IACjF,CAAC;CAyBF;AA7DD,4CA6DC"}
@@ -0,0 +1,78 @@
1
+ import { Connection } from '@salesforce/core';
2
+ import { AgentPreviewBase } from './agentPreviewBase';
3
+ import { type AgentPreviewEndResponse, type AgentPreviewSendResponse, type AgentPreviewStartResponse, PlannerResponse } from './types.js';
4
+ /**
5
+ * A service to simulate interactions with an agent using a local .agent file.
6
+ * The file will be compiled using Agent.compileAgent before being used
7
+ * with the simulation endpoints.
8
+ *
9
+ * **Examples**
10
+ *
11
+ * Create an instance of the service:
12
+ *
13
+ * `const agentSimulate = new AgentSimulate(connection, './path/to/agent.agent');`
14
+ *
15
+ * Start an interactive session:
16
+ *
17
+ * `const { sessionId } = await agentSimulate.start();`
18
+ *
19
+ * Send a message to the agent using the session ID from the startResponse:
20
+ *
21
+ * `const sendResponse = await agentSimulate.send(sessionId, message);`
22
+ *
23
+ * End an interactive session:
24
+ *
25
+ * `await agentSimulate.end(sessionId, 'UserRequest');`
26
+ *
27
+ * Enable Apex Debug Mode:
28
+ *
29
+ * `agentSimulate.toggleApexDebugMode(true);`
30
+ */
31
+ export declare class AgentSimulate extends AgentPreviewBase {
32
+ /**
33
+ * The client can specify whether the actions will run in a simulated mode ("mock actions", no side effects, mockActions=true) or a non-simulated mode ("real actions", actions with side effects, mockActions=false)
34
+ */
35
+ mockActions: boolean;
36
+ protected readonly apiBase: string;
37
+ private readonly agentFilePath;
38
+ private compiledAgent?;
39
+ /**
40
+ * Create an instance of the service.
41
+ *
42
+ * @param connection The connection to use to make requests.
43
+ * @param agentFilePath Path to the .agent file to simulate.
44
+ * @param mockActions whether or not to mock the actions of the simulated agent
45
+ */
46
+ constructor(connection: Connection, agentFilePath: string, mockActions: boolean);
47
+ /**
48
+ * Start an interactive simulation session with the agent.
49
+ * This will first compile the agent script if it hasn't been compiled yet.
50
+ *
51
+ * @returns `AgentPreviewStartResponse`, which includes a session ID needed for other actions.
52
+ */
53
+ start(): Promise<AgentPreviewStartResponse>;
54
+ /**
55
+ * Send a message to the agent using the session ID obtained by calling `start()`.
56
+ *
57
+ * @param sessionId A session ID provided by first calling `agentSimulate.start()`.
58
+ * @param message A message to send to the agent.
59
+ * @returns `AgentPreviewSendResponse`
60
+ */
61
+ send(sessionId: string, message: string): Promise<AgentPreviewSendResponse>;
62
+ /**
63
+ * Ending is not required, or supported, for AgentSimulation
64
+ * this is a noop method to support easier consumer typings
65
+ *
66
+ * @returns `AgentPreviewEndResponse`
67
+ */
68
+ end(): Promise<AgentPreviewEndResponse>;
69
+ /**
70
+ * Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user
71
+ * and create apex debug logs for use within VS Code's Apex Replay Debugger.
72
+ *
73
+ * @param enable Whether to enable or disable Apex Debug Mode.
74
+ */
75
+ toggleApexDebugMode(enable: boolean): void;
76
+ trace(sessionId: string, messageId: string): Promise<PlannerResponse>;
77
+ private ensureTraceFlag;
78
+ }
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2025, Salesforce, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.AgentSimulate = void 0;
19
+ const promises_1 = require("node:fs/promises");
20
+ const node_path_1 = require("node:path");
21
+ const node_crypto_1 = require("node:crypto");
22
+ const core_1 = require("@salesforce/core");
23
+ const kit_1 = require("@salesforce/kit");
24
+ const agent_1 = require("./agent");
25
+ const agentPreviewBase_1 = require("./agentPreviewBase");
26
+ const apexUtils_1 = require("./apexUtils");
27
+ const utils_1 = require("./utils");
28
+ /**
29
+ * A service to simulate interactions with an agent using a local .agent file.
30
+ * The file will be compiled using Agent.compileAgent before being used
31
+ * with the simulation endpoints.
32
+ *
33
+ * **Examples**
34
+ *
35
+ * Create an instance of the service:
36
+ *
37
+ * `const agentSimulate = new AgentSimulate(connection, './path/to/agent.agent');`
38
+ *
39
+ * Start an interactive session:
40
+ *
41
+ * `const { sessionId } = await agentSimulate.start();`
42
+ *
43
+ * Send a message to the agent using the session ID from the startResponse:
44
+ *
45
+ * `const sendResponse = await agentSimulate.send(sessionId, message);`
46
+ *
47
+ * End an interactive session:
48
+ *
49
+ * `await agentSimulate.end(sessionId, 'UserRequest');`
50
+ *
51
+ * Enable Apex Debug Mode:
52
+ *
53
+ * `agentSimulate.toggleApexDebugMode(true);`
54
+ */
55
+ class AgentSimulate extends agentPreviewBase_1.AgentPreviewBase {
56
+ /**
57
+ * The client can specify whether the actions will run in a simulated mode ("mock actions", no side effects, mockActions=true) or a non-simulated mode ("real actions", actions with side effects, mockActions=false)
58
+ */
59
+ mockActions;
60
+ apiBase = `https://${kit_1.env.getBoolean('SF_TEST_API') ? 'test.' : ''}api.salesforce.com/einstein/ai-agent`;
61
+ agentFilePath;
62
+ compiledAgent;
63
+ /**
64
+ * Create an instance of the service.
65
+ *
66
+ * @param connection The connection to use to make requests.
67
+ * @param agentFilePath Path to the .agent file to simulate.
68
+ * @param mockActions whether or not to mock the actions of the simulated agent
69
+ */
70
+ constructor(connection, agentFilePath, mockActions) {
71
+ super({ connection });
72
+ this.agentFilePath = agentFilePath;
73
+ this.mockActions = mockActions;
74
+ }
75
+ /**
76
+ * Start an interactive simulation session with the agent.
77
+ * This will first compile the agent script if it hasn't been compiled yet.
78
+ *
79
+ * @returns `AgentPreviewStartResponse`, which includes a session ID needed for other actions.
80
+ */
81
+ async start() {
82
+ if (!this.compiledAgent) {
83
+ void core_1.Lifecycle.getInstance().emit('agents:compiling', {});
84
+ this.logger.debug(`Compiling agent script from ${this.agentFilePath}`);
85
+ const agentString = await (0, promises_1.readFile)(this.agentFilePath, 'utf-8');
86
+ const compiledAgent = await agent_1.Agent.compileAgentScript(this.connection, agentString);
87
+ if (compiledAgent.status === 'success' && compiledAgent.compiledArtifact) {
88
+ this.compiledAgent = compiledAgent.compiledArtifact;
89
+ }
90
+ else {
91
+ const formattedError = compiledAgent.errors
92
+ .map((e) => `- ${e.errorType} ${e.description}: ${e.lineStart}:${e.colStart} / ${e.lineEnd}:${e.colEnd}`)
93
+ .join('\n');
94
+ throw new core_1.SfError('Failed to compile agent script', formattedError);
95
+ }
96
+ }
97
+ this.logger.debug('Starting agent simulation session');
98
+ const body = {
99
+ agentDefinition: this.compiledAgent,
100
+ enableSimulationMode: this.mockActions,
101
+ externalSessionKey: (0, node_crypto_1.randomUUID)(),
102
+ instanceConfig: {
103
+ endpoint: this.connection.instanceUrl,
104
+ },
105
+ variables: [],
106
+ parameters: {},
107
+ streamingCapabilities: {
108
+ chunkTypes: ['Text', 'LightningChunk'],
109
+ },
110
+ richContentCapabilities: {},
111
+ bypassUser: true,
112
+ executionHistory: [],
113
+ conversationContext: [],
114
+ };
115
+ try {
116
+ void core_1.Lifecycle.getInstance().emit('agents:simulation-starting', {});
117
+ const response = await this.maybeMock.request('POST', `${this.apiBase}/v1.1/preview/sessions`, body);
118
+ const agentIdForStorage = (0, node_path_1.basename)(this.agentFilePath);
119
+ await (0, utils_1.appendTranscriptEntry)({
120
+ timestamp: new Date().toISOString(),
121
+ agentId: agentIdForStorage,
122
+ sessionId: response.sessionId,
123
+ role: 'agent',
124
+ text: response.messages.map((m) => m.message).join('\n'),
125
+ raw: response.messages,
126
+ }, true);
127
+ return response;
128
+ }
129
+ catch (err) {
130
+ throw core_1.SfError.wrap(err);
131
+ }
132
+ }
133
+ /**
134
+ * Send a message to the agent using the session ID obtained by calling `start()`.
135
+ *
136
+ * @param sessionId A session ID provided by first calling `agentSimulate.start()`.
137
+ * @param message A message to send to the agent.
138
+ * @returns `AgentPreviewSendResponse`
139
+ */
140
+ async send(sessionId, message) {
141
+ if (!this.compiledAgent) {
142
+ throw new core_1.SfError('Agent not compiled, please call .start() first');
143
+ }
144
+ const url = `${this.apiBase}/v1.1/preview/sessions/${sessionId}/messages`;
145
+ const body = {
146
+ message: {
147
+ sequenceId: Date.now(),
148
+ type: 'Text',
149
+ text: message,
150
+ },
151
+ variables: [],
152
+ };
153
+ this.logger.debug(`Sending message with apexDebugMode ${this.apexDebugMode ? 'enabled' : 'disabled'}`);
154
+ const agentIdForStorage = (0, node_path_1.basename)(this.agentFilePath);
155
+ try {
156
+ const start = Date.now();
157
+ if (this.apexDebugMode && !this.mockActions) {
158
+ await this.ensureTraceFlag();
159
+ }
160
+ await (0, utils_1.appendTranscriptEntry)({
161
+ timestamp: new Date().toISOString(),
162
+ agentId: agentIdForStorage,
163
+ sessionId,
164
+ role: 'user',
165
+ text: message,
166
+ });
167
+ const response = await this.maybeMock.request('POST', url, body);
168
+ await (0, utils_1.appendTranscriptEntry)({
169
+ timestamp: new Date().toISOString(),
170
+ agentId: agentIdForStorage,
171
+ sessionId,
172
+ role: 'agent',
173
+ text: response.messages.map((m) => m.message).join('\n'),
174
+ raw: response.messages,
175
+ });
176
+ if (this.apexDebugMode && !this.mockActions) {
177
+ const apexLog = await (0, apexUtils_1.getDebugLog)(this.connection, start, Date.now());
178
+ if (apexLog) {
179
+ if (apexLog.Id)
180
+ this.logger.debug(`Apex debug log ID for message is ${apexLog.Id}`);
181
+ response.apexDebugLog = apexLog;
182
+ }
183
+ else {
184
+ this.logger.debug('No apex debug log found for this message');
185
+ }
186
+ }
187
+ return response;
188
+ }
189
+ catch (err) {
190
+ throw core_1.SfError.wrap(err);
191
+ }
192
+ }
193
+ /**
194
+ * Ending is not required, or supported, for AgentSimulation
195
+ * this is a noop method to support easier consumer typings
196
+ *
197
+ * @returns `AgentPreviewEndResponse`
198
+ */
199
+ // eslint-disable-next-line class-methods-use-this
200
+ async end() {
201
+ return Promise.resolve({ messages: [], _links: [] });
202
+ }
203
+ /**
204
+ * Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user
205
+ * and create apex debug logs for use within VS Code's Apex Replay Debugger.
206
+ *
207
+ * @param enable Whether to enable or disable Apex Debug Mode.
208
+ */
209
+ toggleApexDebugMode(enable) {
210
+ this.setApexDebugMode(enable);
211
+ }
212
+ async trace(sessionId, messageId) {
213
+ return this.maybeMock.request('GET', `${this.apiBase}/v1.1/preview/sessions/${sessionId}/plans/${messageId}`);
214
+ }
215
+ // once we're previewing agents in the org, with mockActions = false, we'll have to figure out how to get the correct user that was simulated for apex invocattion
216
+ async ensureTraceFlag() {
217
+ if (this.apexTraceFlag) {
218
+ const expDate = this.apexTraceFlag.ExpirationDate;
219
+ if (expDate && new Date(expDate) > new Date()) {
220
+ this.logger.debug(`Using cached apexTraceFlag with ExpirationDate of ${expDate}`);
221
+ return;
222
+ }
223
+ else {
224
+ this.logger.debug('Cached apex trace flag is expired');
225
+ }
226
+ }
227
+ const user = this.compiledAgent?.globalConfiguration.defaultAgentUser ?? this.connection.getUsername();
228
+ const userId = (await this.connection.singleRecordQuery(`SELECT Id FROM User WHERE Username = '${user}'`)).Id;
229
+ this.apexTraceFlag = await (0, apexUtils_1.findTraceFlag)(this.connection, userId);
230
+ if (!this.apexTraceFlag) {
231
+ await (0, apexUtils_1.createTraceFlag)(this.connection, userId);
232
+ }
233
+ }
234
+ }
235
+ exports.AgentSimulate = AgentSimulate;
236
+ //# sourceMappingURL=agentSimulate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentSimulate.js","sourceRoot":"","sources":["../src/agentSimulate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+CAA4C;AAC5C,yCAAqC;AACrC,6CAAyC;AACzC,2CAAkE;AAClE,yCAAsC;AACtC,mCAAgC;AAChC,yDAAsD;AAQtD,2CAA0E;AAC1E,mCAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,aAAc,SAAQ,mCAAgB;IACjD;;OAEG;IACI,WAAW,CAAU;IACT,OAAO,GAAG,WAC3B,SAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAC5C,sCAAsC,CAAC;IACtB,aAAa,CAAS;IAC/B,aAAa,CAAa;IAElC;;;;;;OAMG;IACH,YAAmB,UAAsB,EAAE,aAAqB,EAAE,WAAoB;QACpF,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,K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KAAkK;IAC1J,KAAK,CAAC,eAAe;QAC3B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;YAClD,IAAI,OAAO,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC;gBAC9C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qDAAqD,OAAO,EAAE,CAAC,CAAC;gBAClF,OAAO;YACT,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC,gBAAgB,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,EAAG,CAAC;QAExG,MAAM,MAAM,GAAG,CACb,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAiB,yCAAyC,IAAI,GAAG,CAAC,CAC1G,CAAC,EAAE,CAAC;QAEL,IAAI,CAAC,aAAa,GAAG,MAAM,IAAA,yBAAa,EAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,MAAM,IAAA,2BAAe,EAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF;AA5MD,sCA4MC"}
package/lib/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- export { type AgentScriptContent, type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecCreateConfig, type AgentOptions, type AgentTone, type AgentType, type AgentPreviewMessageLinks, type AgentPreviewMessage, type AgentPreviewStartResponse, type AgentPreviewSendResponse, type AgentPreviewEndResponse, type AgentTraceResponse, type AgentTraceStep, type BotMetadata, type BotVersionMetadata, type CompilationError, type DraftAgentTopics, type DraftAgentTopicsBody, type DraftAgentTopicsResponse, type AvailableDefinition, type AgentTestResultsResponse, type AgentTestStartResponse, type AgentTestStatusResponse, type TestCaseResult, type TestStatus, } from './types';
2
- export { metric, findAuthoringBundle } from './utils';
1
+ export { type AgentInteractionBase, type BaseAgentConfig, type AgentPreviewStartResponse, type AgentPreviewSendResponse, type AgentPreviewEndResponse, type EndReason, type ApiStatus, type AgentJson, type AgentCompilationSuccess, type AgentScriptContent, type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecCreateConfig, type AgentOptions, type AgentTone, type AgentType, type BotMetadata, type BotVersionMetadata, type CompilationError, type DraftAgentTopics, type DraftAgentTopicsBody, type DraftAgentTopicsResponse, type AvailableDefinition, type AgentPreviewMessageLinks, type AgentPreviewMessage, type AgentPreviewError, AgentSource, type ScriptAgent, type PublishedAgent, type AgentTestResultsResponse, type AgentTestStartResponse, type AgentTestStatusResponse, type TestCaseResult, type TestStatus, type AgentTestConfig, type TestCase, type TestSpec, type MetadataMetric, type MetadataExpectation, type MetadataCustomEvaluation, type AiEvaluationDefinition, type AgentTraceResponse, type AgentTraceStep, type UserInputStep, type LLMExecutionStep, type UpdateTopicStep, type EventStep, type ReasoningStep, type PlannerResponseStep, } from './types';
2
+ export { metric, findAuthoringBundle, readTranscriptEntries } from './utils';
3
3
  export { Agent, AgentCreateLifecycleStages } from './agent';
4
4
  export { AgentTester } from './agentTester';
5
5
  export { AgentTest, AgentTestCreateLifecycleStages } from './agentTest';
6
6
  export { AgentTrace } from './agentTrace';
7
7
  export { convertTestResultsToFormat, humanFriendlyName } from './agentTestResults';
8
8
  export { AgentPreview } from './agentPreview';
9
+ export { AgentSimulate } from './agentSimulate';
9
10
  export { writeDebugLog } from './apexUtils';
11
+ export { AgentPreviewBase } from './agentPreviewBase';
package/lib/index.js CHANGED
@@ -15,10 +15,13 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.writeDebugLog = exports.AgentPreview = exports.humanFriendlyName = exports.convertTestResultsToFormat = exports.AgentTrace = exports.AgentTestCreateLifecycleStages = exports.AgentTest = exports.AgentTester = exports.AgentCreateLifecycleStages = exports.Agent = exports.findAuthoringBundle = exports.metric = void 0;
18
+ exports.AgentPreviewBase = exports.writeDebugLog = exports.AgentSimulate = exports.AgentPreview = exports.humanFriendlyName = exports.convertTestResultsToFormat = exports.AgentTrace = exports.AgentTestCreateLifecycleStages = exports.AgentTest = exports.AgentTester = exports.AgentCreateLifecycleStages = exports.Agent = exports.readTranscriptEntries = exports.findAuthoringBundle = exports.metric = exports.AgentSource = void 0;
19
+ var types_1 = require("./types");
20
+ Object.defineProperty(exports, "AgentSource", { enumerable: true, get: function () { return types_1.AgentSource; } });
19
21
  var utils_1 = require("./utils");
20
22
  Object.defineProperty(exports, "metric", { enumerable: true, get: function () { return utils_1.metric; } });
21
23
  Object.defineProperty(exports, "findAuthoringBundle", { enumerable: true, get: function () { return utils_1.findAuthoringBundle; } });
24
+ Object.defineProperty(exports, "readTranscriptEntries", { enumerable: true, get: function () { return utils_1.readTranscriptEntries; } });
22
25
  var agent_1 = require("./agent");
23
26
  Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
24
27
  Object.defineProperty(exports, "AgentCreateLifecycleStages", { enumerable: true, get: function () { return agent_1.AgentCreateLifecycleStages; } });
@@ -34,6 +37,10 @@ Object.defineProperty(exports, "convertTestResultsToFormat", { enumerable: true,
34
37
  Object.defineProperty(exports, "humanFriendlyName", { enumerable: true, get: function () { return agentTestResults_1.humanFriendlyName; } });
35
38
  var agentPreview_1 = require("./agentPreview");
36
39
  Object.defineProperty(exports, "AgentPreview", { enumerable: true, get: function () { return agentPreview_1.AgentPreview; } });
40
+ var agentSimulate_1 = require("./agentSimulate");
41
+ Object.defineProperty(exports, "AgentSimulate", { enumerable: true, get: function () { return agentSimulate_1.AgentSimulate; } });
37
42
  var apexUtils_1 = require("./apexUtils");
38
43
  Object.defineProperty(exports, "writeDebugLog", { enumerable: true, get: function () { return apexUtils_1.writeDebugLog; } });
44
+ var agentPreviewBase_1 = require("./agentPreviewBase");
45
+ Object.defineProperty(exports, "AgentPreviewBase", { enumerable: true, get: function () { return agentPreviewBase_1.AgentPreviewBase; } });
39
46
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AA+BH,iCAAsD;AAA7C,+FAAA,MAAM,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AACpC,iCAA4D;AAAnD,8FAAA,KAAK,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAC1C,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,yCAAwE;AAA/D,sGAAA,SAAS,OAAA;AAAE,2HAAA,8BAA8B,OAAA;AAClD,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uDAAmF;AAA1E,8HAAA,0BAA0B,OAAA;AAAE,qHAAA,iBAAiB,OAAA;AACtD,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,yCAA4C;AAAnC,0GAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iCA4DiB;AA3Bf,oGAAA,WAAW,OAAA;AA6Bb,iCAA6E;AAApE,+FAAA,MAAM,OAAA;AAAE,4GAAA,mBAAmB,OAAA;AAAE,8GAAA,qBAAqB,OAAA;AAC3D,iCAA4D;AAAnD,8FAAA,KAAK,OAAA;AAAE,mHAAA,0BAA0B,OAAA;AAC1C,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,yCAAwE;AAA/D,sGAAA,SAAS,OAAA;AAAE,2HAAA,8BAA8B,OAAA;AAClD,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,uDAAmF;AAA1E,8HAAA,0BAA0B,OAAA;AAAE,qHAAA,iBAAiB,OAAA;AACtD,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yCAA4C;AAAnC,0GAAA,aAAa,OAAA;AACtB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA"}
package/lib/types.d.ts CHANGED
@@ -1,7 +1,17 @@
1
- import { Connection, SfProject } from '@salesforce/core';
1
+ import { Connection, Logger, SfProject } from '@salesforce/core';
2
2
  import { FileProperties } from '@salesforce/source-deploy-retrieve';
3
3
  import { type ApexLog } from '@salesforce/types/tooling';
4
4
  import { metric } from './utils';
5
+ export type AgentInteractionBase = {
6
+ start(): Promise<AgentPreviewStartResponse>;
7
+ send(sessionId: string, message: string): Promise<AgentPreviewSendResponse>;
8
+ end(sessionId: string, reason: EndReason): Promise<AgentPreviewEndResponse>;
9
+ setApexDebugMode(enable: boolean): void;
10
+ };
11
+ export type BaseAgentConfig = {
12
+ connection: Connection;
13
+ logger?: Logger;
14
+ };
5
15
  /**
6
16
  * Options for creating instances of agents from an org.
7
17
  */
@@ -539,6 +549,26 @@ export type AgentTraceResponse = {
539
549
  error: unknown[];
540
550
  }>;
541
551
  };
552
+ export type PlannerResponse = {
553
+ type: 'PlanSuccessResponse';
554
+ planId: string;
555
+ sessionId: string;
556
+ intent: string;
557
+ topic: string;
558
+ plan: PlanStep[];
559
+ };
560
+ export type PlanStep = UserInputStep | LLMExecutionStep | UpdateTopicStep | EventStep | FunctionStep | PlannerResponseStep;
561
+ export type FunctionStep = {
562
+ type: 'FunctionStep';
563
+ function: {
564
+ name: string;
565
+ input: Record<string, unknown>;
566
+ output: Record<string, unknown>;
567
+ };
568
+ executionLatency: number;
569
+ startExecutionTime: number;
570
+ endExecutionTime: number;
571
+ };
542
572
  export type CompileAgentScriptResponse = AgentCompilationSuccess | AgentCompilationError;
543
573
  export type AgentCompilationSuccess = {
544
574
  status: 'success';
@@ -641,6 +671,20 @@ export type AgentJson = {
641
671
  };
642
672
  };
643
673
  export type AgentScriptContent = string;
674
+ export declare enum AgentSource {
675
+ PUBLISHED = "published",
676
+ SCRIPT = "script"
677
+ }
678
+ export type ScriptAgent = {
679
+ DeveloperName: string;
680
+ source: AgentSource.SCRIPT;
681
+ path: string;
682
+ };
683
+ export type PublishedAgent = {
684
+ Id: string;
685
+ DeveloperName: string;
686
+ source: AgentSource.PUBLISHED;
687
+ };
644
688
  export type NamedUserJwtResponse = {
645
689
  access_token: string;
646
690
  token_format: 'jwt';
package/lib/types.js CHANGED
@@ -15,4 +15,10 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.AgentSource = void 0;
19
+ var AgentSource;
20
+ (function (AgentSource) {
21
+ AgentSource["PUBLISHED"] = "published";
22
+ AgentSource["SCRIPT"] = "script";
23
+ })(AgentSource || (exports.AgentSource = AgentSource = {}));
18
24
  //# sourceMappingURL=types.js.map
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAivBH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,sCAAuB,CAAA;IACvB,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB"}
package/lib/utils.d.ts CHANGED
@@ -23,4 +23,35 @@ export declare const decodeHtmlEntities: (str?: string) => string;
23
23
  * @returns The path to the authoring bundle directory if found, undefined otherwise
24
24
  */
25
25
  export declare const findAuthoringBundle: (dirOrDirs: string | string[], botName: string) => string | undefined;
26
+ /**
27
+ * Find all local agent files in a directory by recursively searching for files ending with '.agent'
28
+ *
29
+ * @param dir - The directory to start searching from
30
+ * @returns Array of paths to agent files
31
+ */
32
+ export declare const findLocalAgents: (dir: string) => string[];
26
33
  export declare const useNamedUserJwt: (connection: Connection) => Promise<Connection>;
34
+ export type TranscriptRole = 'user' | 'agent';
35
+ export type TranscriptEntry = {
36
+ timestamp: string;
37
+ agentId: string;
38
+ sessionId: string;
39
+ role: TranscriptRole;
40
+ text?: string;
41
+ raw?: any;
42
+ reason?: string;
43
+ };
44
+ /**
45
+ * Append a transcript entry to the last conversation JSON file under the project local .sfdx folder.
46
+ * If the entry has event: 'start', this will clear the previous conversation and start fresh.
47
+ * Path: <project>/.sfdx/agents/conversations/<agentId>/history.json
48
+ */
49
+ export declare const appendTranscriptEntry: (entry: TranscriptEntry, newSession?: boolean) => Promise<void>;
50
+ /**
51
+ * Read and parse the last conversation's transcript entries from JSON.
52
+ * Path: <project>/.sfdx/agents/conversations/<agentId>/history.json
53
+ *
54
+ * @param agentId The agent's API name (developerName)
55
+ * @returns Array of TranscriptEntry in file order (chronological append order).
56
+ */
57
+ export declare const readTranscriptEntries: (agentId: string) => Promise<TranscriptEntry[]>;
package/lib/utils.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.useNamedUserJwt = exports.findAuthoringBundle = exports.decodeHtmlEntities = exports.sanitizeFilename = exports.metric = void 0;
36
+ exports.readTranscriptEntries = exports.appendTranscriptEntry = exports.useNamedUserJwt = exports.findLocalAgents = exports.findAuthoringBundle = exports.decodeHtmlEntities = exports.sanitizeFilename = exports.metric = void 0;
37
37
  /*
38
38
  * Copyright 2025, Salesforce, Inc.
39
39
  *
@@ -50,6 +50,7 @@ exports.useNamedUserJwt = exports.findAuthoringBundle = exports.decodeHtmlEntiti
50
50
  * limitations under the License.
51
51
  */
52
52
  const node_fs_1 = require("node:fs");
53
+ const promises_1 = require("node:fs/promises");
53
54
  const path = __importStar(require("node:path"));
54
55
  const core_1 = require("@salesforce/core");
55
56
  exports.metric = ['completeness', 'coherence', 'conciseness', 'output_latency_milliseconds'];
@@ -159,6 +160,36 @@ const findAuthoringBundle = (dirOrDirs, botName) => {
159
160
  return undefined;
160
161
  };
161
162
  exports.findAuthoringBundle = findAuthoringBundle;
163
+ /**
164
+ * Find all local agent files in a directory by recursively searching for files ending with '.agent'
165
+ *
166
+ * @param dir - The directory to start searching from
167
+ * @returns Array of paths to agent files
168
+ */
169
+ const findLocalAgents = (dir) => {
170
+ const results = [];
171
+ try {
172
+ const files = (0, node_fs_1.readdirSync)(dir);
173
+ for (const file of files) {
174
+ const filePath = path.join(dir, file);
175
+ const statResult = (0, node_fs_1.statSync)(filePath, { throwIfNoEntry: false });
176
+ if (!statResult)
177
+ continue;
178
+ if (statResult.isDirectory()) {
179
+ results.push(...(0, exports.findLocalAgents)(filePath));
180
+ }
181
+ else if (file.endsWith('.agent')) {
182
+ results.push(filePath);
183
+ }
184
+ }
185
+ }
186
+ catch (err) {
187
+ // Directory doesn't exist or can't be read
188
+ return [];
189
+ }
190
+ return results;
191
+ };
192
+ exports.findLocalAgents = findLocalAgents;
162
193
  const useNamedUserJwt = async (connection) => {
163
194
  // Refresh the connection to ensure we have the latest, valid access token
164
195
  try {
@@ -208,4 +239,58 @@ const useNamedUserJwt = async (connection) => {
208
239
  }
209
240
  };
210
241
  exports.useNamedUserJwt = useNamedUserJwt;
242
+ const resolveProjectLocalSfdx = async () => {
243
+ try {
244
+ const project = await core_1.SfProject.resolve();
245
+ return path.join(project.getPath(), '.sfdx');
246
+ }
247
+ catch (_e) {
248
+ return undefined;
249
+ }
250
+ };
251
+ const getConversationDir = async (agentId) => {
252
+ const base = (await resolveProjectLocalSfdx()) ?? path.join(process.cwd(), '.sfdx');
253
+ const dir = path.join(base, 'agents', agentId);
254
+ await (0, promises_1.mkdir)(dir, { recursive: true });
255
+ return dir;
256
+ };
257
+ const getLastConversationPath = async (agentId) => path.join(await getConversationDir(agentId), 'history.json');
258
+ /**
259
+ * Append a transcript entry to the last conversation JSON file under the project local .sfdx folder.
260
+ * If the entry has event: 'start', this will clear the previous conversation and start fresh.
261
+ * Path: <project>/.sfdx/agents/conversations/<agentId>/history.json
262
+ */
263
+ const appendTranscriptEntry = async (entry, newSession = false) => {
264
+ const filePath = await getLastConversationPath(entry.agentId);
265
+ const line = `${JSON.stringify(entry)}\n`;
266
+ // If this is a new session start, clear the file first
267
+ if (newSession) {
268
+ await (0, promises_1.writeFile)(filePath, line, 'utf-8');
269
+ }
270
+ else {
271
+ await (0, promises_1.appendFile)(filePath, line);
272
+ }
273
+ };
274
+ exports.appendTranscriptEntry = appendTranscriptEntry;
275
+ /**
276
+ * Read and parse the last conversation's transcript entries from JSON.
277
+ * Path: <project>/.sfdx/agents/conversations/<agentId>/history.json
278
+ *
279
+ * @param agentId The agent's API name (developerName)
280
+ * @returns Array of TranscriptEntry in file order (chronological append order).
281
+ */
282
+ const readTranscriptEntries = async (agentId) => {
283
+ const filePath = await getLastConversationPath(agentId);
284
+ try {
285
+ const data = await (0, promises_1.readFile)(filePath, 'utf-8');
286
+ return data
287
+ .split('\n')
288
+ .filter((l) => l.trim().length > 0)
289
+ .map((l) => JSON.parse(l));
290
+ }
291
+ catch (_e) {
292
+ return [];
293
+ }
294
+ };
295
+ exports.readTranscriptEntries = readTranscriptEntries;
211
296
  //# sourceMappingURL=utils.js.map
package/lib/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,qCAAgD;AAChD,gDAAkC;AAClC,2CAAuD;AAG1C,QAAA,MAAM,GAAG,CAAC,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,6BAA6B,CAAU,CAAC;AAE3G;;;;;;GAMG;AACI,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC3D,IAAI,CAAC,QAAQ;QAAE,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AAC,CAAC;QAC/C,OAAO,IAAI;aACR,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;aAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAoB,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,qBAAqB,yBAWhC"}
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.18.3-nga.1",
4
+ "version": "0.18.3-nga.2",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Salesforce",
7
7
  "main": "lib/index",