@salesforce/agents 0.20.1-beta.0 → 0.21.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/README.md +2 -0
- package/lib/agent.d.ts +14 -11
- package/lib/agent.js +22 -14
- package/lib/agent.js.map +1 -1
- package/lib/{agentInteractionBase.d.ts → agents/agentBase.d.ts} +17 -26
- package/lib/{agentInteractionBase.js → agents/agentBase.js} +11 -89
- package/lib/agents/agentBase.js.map +1 -0
- package/lib/{productionAgent.d.ts → agents/productionAgent.d.ts} +11 -5
- package/lib/{productionAgent.js → agents/productionAgent.js} +146 -50
- package/lib/agents/productionAgent.js.map +1 -0
- package/lib/{scriptAgent.d.ts → agents/scriptAgent.d.ts} +13 -7
- package/lib/{scriptAgent.js → agents/scriptAgent.js} +194 -176
- package/lib/agents/scriptAgent.js.map +1 -0
- package/lib/{agentPublisher.d.ts → agents/scriptAgentPublisher.d.ts} +8 -20
- package/lib/{agentPublisher.js → agents/scriptAgentPublisher.js} +20 -47
- package/lib/agents/scriptAgentPublisher.js.map +1 -0
- package/lib/apexUtils.d.ts +0 -1
- package/lib/apexUtils.js +0 -10
- package/lib/apexUtils.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib/templates/agentScriptTemplate.d.ts +9 -0
- package/lib/templates/agentScriptTemplate.js +149 -0
- package/lib/templates/agentScriptTemplate.js.map +1 -0
- package/lib/types.d.ts +24 -7
- package/lib/types.js.map +1 -1
- package/lib/utils.d.ts +56 -26
- package/lib/utils.js +182 -38
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/lib/agentInteractionBase.js.map +0 -1
- package/lib/agentPublisher.js.map +0 -1
- package/lib/productionAgent.js.map +0 -1
- package/lib/scriptAgent.js.map +0 -1
package/README.md
CHANGED
package/lib/agent.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection, SfProject } from '@salesforce/core';
|
|
2
2
|
import { type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecCreateConfig, type BotMetadata, ProductionAgentOptions, PreviewableAgent, ScriptAgentOptions } from './types';
|
|
3
|
-
import { ScriptAgent } from './scriptAgent';
|
|
4
|
-
import { ProductionAgent } from './productionAgent';
|
|
3
|
+
import { ScriptAgent } from './agents/scriptAgent';
|
|
4
|
+
import { ProductionAgent } from './agents/productionAgent';
|
|
5
5
|
/**
|
|
6
6
|
* Events emitted during Agent.create() for consumers to listen to and keep track of progress
|
|
7
7
|
*
|
|
@@ -13,14 +13,24 @@ export declare const AgentCreateLifecycleStages: {
|
|
|
13
13
|
Retrieving: string;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* A client side representation of an agent
|
|
16
|
+
* A client side representation of an agent. Also provides utilities
|
|
17
17
|
* such as creating agents, listing agents, and creating agent specs.
|
|
18
18
|
*
|
|
19
19
|
* **Examples**
|
|
20
20
|
*
|
|
21
21
|
* Create a new instance and get the ID (uses the `Bot` ID):
|
|
22
22
|
*
|
|
23
|
-
* `const id =
|
|
23
|
+
* `const id = await Agent.init({connection, project, apiNameOrId: 'myBot' }).getId();`
|
|
24
|
+
*
|
|
25
|
+
* Create a new instance of an agent script based agent
|
|
26
|
+
*
|
|
27
|
+
* const agent = await Agent.init({connection, project, aabName: 'myBot' });
|
|
28
|
+
*
|
|
29
|
+
* Start a preview session
|
|
30
|
+
*
|
|
31
|
+
* const agent = await Agent.init({connection, project, aabName: 'myBot' });
|
|
32
|
+
* await agent.preview.start();
|
|
33
|
+
* await agent.preview.send('hi there');
|
|
24
34
|
*
|
|
25
35
|
* Create a new agent in the org:
|
|
26
36
|
*
|
|
@@ -31,13 +41,6 @@ export declare const AgentCreateLifecycleStages: {
|
|
|
31
41
|
* `const agentList = await Agent.list(project);`
|
|
32
42
|
*/
|
|
33
43
|
export declare class Agent {
|
|
34
|
-
/**
|
|
35
|
-
* Create an instance of an agent in an org. Must provide a connection to an org
|
|
36
|
-
* and the agent (Bot) API name or ID as part of `AgentOptions`.
|
|
37
|
-
*
|
|
38
|
-
* @param options
|
|
39
|
-
*/
|
|
40
|
-
constructor();
|
|
41
44
|
static init(options: ScriptAgentOptions): Promise<ScriptAgent>;
|
|
42
45
|
static init(options: ProductionAgentOptions): Promise<ProductionAgent>;
|
|
43
46
|
/**
|
package/lib/agent.js
CHANGED
|
@@ -58,8 +58,8 @@ const kit_1 = require("@salesforce/kit");
|
|
|
58
58
|
const types_1 = require("./types");
|
|
59
59
|
const maybe_mock_1 = require("./maybe-mock");
|
|
60
60
|
const utils_1 = require("./utils");
|
|
61
|
-
const scriptAgent_1 = require("./scriptAgent");
|
|
62
|
-
const productionAgent_1 = require("./productionAgent");
|
|
61
|
+
const scriptAgent_1 = require("./agents/scriptAgent");
|
|
62
|
+
const productionAgent_1 = require("./agents/productionAgent");
|
|
63
63
|
;
|
|
64
64
|
const messages = new core_1.Messages('@salesforce/agents', 'agents', new Map([["invalidAgentSpecConfig", "Missing one or more of the required agent spec arguments: type, role, companyName, companyDescription"], ["missingAgentName", "The \"agentName\" configuration property is required when saving an agent."], ["agentRetrievalError", "Unable to retrieve newly created Agent metadata. Due to: %s"], ["agentRetrievalErrorActions", "Retrieve the agent metadata using the \"project retrieve start\" command."], ["missingAgentNameOrId", "The \"nameOrId\" agent option is required when creating an Agent instance."], ["agentIsDeleted", "The %s agent has been deleted and its activation state can't be changed."], ["agentActivationError", "Changing the agent's activation status was unsuccessful due to %s."]]));
|
|
65
65
|
let logger;
|
|
@@ -80,14 +80,24 @@ exports.AgentCreateLifecycleStages = {
|
|
|
80
80
|
Retrieving: 'retrievingAgent',
|
|
81
81
|
};
|
|
82
82
|
/**
|
|
83
|
-
* A client side representation of an agent
|
|
83
|
+
* A client side representation of an agent. Also provides utilities
|
|
84
84
|
* such as creating agents, listing agents, and creating agent specs.
|
|
85
85
|
*
|
|
86
86
|
* **Examples**
|
|
87
87
|
*
|
|
88
88
|
* Create a new instance and get the ID (uses the `Bot` ID):
|
|
89
89
|
*
|
|
90
|
-
* `const id =
|
|
90
|
+
* `const id = await Agent.init({connection, project, apiNameOrId: 'myBot' }).getId();`
|
|
91
|
+
*
|
|
92
|
+
* Create a new instance of an agent script based agent
|
|
93
|
+
*
|
|
94
|
+
* const agent = await Agent.init({connection, project, aabName: 'myBot' });
|
|
95
|
+
*
|
|
96
|
+
* Start a preview session
|
|
97
|
+
*
|
|
98
|
+
* const agent = await Agent.init({connection, project, aabName: 'myBot' });
|
|
99
|
+
* await agent.preview.start();
|
|
100
|
+
* await agent.preview.send('hi there');
|
|
91
101
|
*
|
|
92
102
|
* Create a new agent in the org:
|
|
93
103
|
*
|
|
@@ -98,13 +108,6 @@ exports.AgentCreateLifecycleStages = {
|
|
|
98
108
|
* `const agentList = await Agent.list(project);`
|
|
99
109
|
*/
|
|
100
110
|
class Agent {
|
|
101
|
-
/**
|
|
102
|
-
* Create an instance of an agent in an org. Must provide a connection to an org
|
|
103
|
-
* and the agent (Bot) API name or ID as part of `AgentOptions`.
|
|
104
|
-
*
|
|
105
|
-
* @param options
|
|
106
|
-
*/
|
|
107
|
-
constructor() { }
|
|
108
111
|
// Implementation
|
|
109
112
|
static async init(options) {
|
|
110
113
|
const username = options.connection.getUsername();
|
|
@@ -115,8 +118,8 @@ class Agent {
|
|
|
115
118
|
const isolatedConnection = await core_1.Connection.create({ authInfo });
|
|
116
119
|
// Upgrade the isolated connection with JWT
|
|
117
120
|
const jwtConnection = await (0, utils_1.useNamedUserJwt)(isolatedConnection);
|
|
118
|
-
// Type guard: check if it's ScriptAgentOptions by looking for '
|
|
119
|
-
if ('
|
|
121
|
+
// Type guard: check if it's ScriptAgentOptions by looking for 'aabName'
|
|
122
|
+
if ('aabName' in options) {
|
|
120
123
|
// TypeScript now knows this is ScriptAgentOptions
|
|
121
124
|
return new scriptAgent_1.ScriptAgent({ ...options, connection: jwtConnection });
|
|
122
125
|
}
|
|
@@ -176,6 +179,11 @@ class Agent {
|
|
|
176
179
|
const results = new Array();
|
|
177
180
|
const orgAgents = await this.listRemote(connection);
|
|
178
181
|
for (const agent of orgAgents) {
|
|
182
|
+
// Only include agents that have at least one active bot version
|
|
183
|
+
const hasActiveVersion = agent.BotVersions?.records?.some((version) => version.Status === 'Active') ?? false;
|
|
184
|
+
if (!hasActiveVersion) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
179
187
|
const previewableAgent = {
|
|
180
188
|
name: agent.MasterLabel,
|
|
181
189
|
source: types_1.AgentSource.PUBLISHED,
|
|
@@ -207,7 +215,7 @@ class Agent {
|
|
|
207
215
|
const previewableAgent = {
|
|
208
216
|
name: agentName,
|
|
209
217
|
source: types_1.AgentSource.SCRIPT,
|
|
210
|
-
|
|
218
|
+
aabName: agentName,
|
|
211
219
|
};
|
|
212
220
|
results.push(previewableAgent);
|
|
213
221
|
}
|
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,+CAAiD;AACjD,2CAS0B;AAC1B,+EAAyE;AACzE,yCAA2C;AAC3C,mCAYiB;AACjB,6CAAyC;AACzC,mCAA+E;AAC/E
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,gDAAkC;AAClC,+CAAiD;AACjD,2CAS0B;AAC1B,+EAAyE;AACzE,yCAA2C;AAC3C,mCAYiB;AACjB,6CAAyC;AACzC,mCAA+E;AAC/E,sDAAmD;AACnD,8DAA2D;;AAG3D,MAAM,QAAQ,OAAG,eAAQ,CAAc,oBAAoB,EAAE,QAAQ,kuB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,IAAA,0BAAkB,EAAC,QAAQ,CAAiB,CAAC;QACtD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,qDAAqD;IACrD,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,yDAAyD;QACzD,OAAO,CAAC,GAAG,CAAC,GAAG,IAAA,sBAAc,EAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,OAAY,CAAC;AACtB,CAAC,CAAC;AA1BW,QAAA,cAAc,kBA0BzB"}
|
|
@@ -1,40 +1,23 @@
|
|
|
1
1
|
import { Connection } from '@salesforce/core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
* Common preview interface that both ScriptAgent and ProductionAgent implement
|
|
5
|
-
*/
|
|
6
|
-
export type AgentPreviewInterface = {
|
|
7
|
-
start: (...args: unknown[]) => Promise<AgentPreviewStartResponse>;
|
|
8
|
-
send: (message: string) => Promise<AgentPreviewSendResponse>;
|
|
9
|
-
getAllTraces: () => Promise<PlannerResponse[]>;
|
|
10
|
-
end: (...args: unknown[]) => Promise<AgentPreviewEndResponse>;
|
|
11
|
-
saveSession: (outputDir?: string) => Promise<string>;
|
|
12
|
-
setApexDebugging: (apexDebugging: boolean) => void;
|
|
13
|
-
};
|
|
2
|
+
import { AgentPreviewInterface, type AgentPreviewSendResponse, type PlannerResponse, PreviewMetadata } from '../types';
|
|
3
|
+
import { TranscriptEntry } from '../utils';
|
|
14
4
|
/**
|
|
15
5
|
* Abstract base class for agent preview functionality.
|
|
16
6
|
* Contains shared properties and methods between ScriptAgent and ProductionAgent.
|
|
17
7
|
*/
|
|
18
|
-
export declare abstract class
|
|
8
|
+
export declare abstract class AgentBase {
|
|
19
9
|
protected readonly connection: Connection;
|
|
20
10
|
/**
|
|
21
11
|
* The display name of the agent (user-friendly name, not API name)
|
|
22
12
|
*/
|
|
23
13
|
name: string | undefined;
|
|
24
14
|
protected sessionId: string | undefined;
|
|
25
|
-
protected
|
|
15
|
+
protected historyDir: string | undefined;
|
|
26
16
|
protected apexDebugging: boolean | undefined;
|
|
27
17
|
protected planIds: Set<string>;
|
|
28
18
|
abstract preview: AgentPreviewInterface;
|
|
29
19
|
protected constructor(connection: Connection);
|
|
30
20
|
restoreConnection(): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Send a message to the agent using the session ID obtained by calling `start()`.
|
|
33
|
-
*
|
|
34
|
-
* @param message A message to send to the agent.
|
|
35
|
-
* @returns `AgentPreviewSendResponse`
|
|
36
|
-
*/
|
|
37
|
-
protected sendMessage(message: string): Promise<AgentPreviewSendResponse>;
|
|
38
21
|
/**
|
|
39
22
|
* Get all traces from the current session
|
|
40
23
|
* Reads traces from the session directory if available, otherwise fetches from API
|
|
@@ -58,7 +41,7 @@ export declare abstract class AgentInteractionBase {
|
|
|
58
41
|
* @param outputDir Optional output directory. If not provided, uses default location.
|
|
59
42
|
* @returns The path to the copied session directory
|
|
60
43
|
*/
|
|
61
|
-
protected
|
|
44
|
+
protected saveSessionTo(outputDir: string): Promise<string>;
|
|
62
45
|
/**
|
|
63
46
|
* Set the Apex debugging mode for the agent preview.
|
|
64
47
|
* This can be called before starting a session.
|
|
@@ -66,6 +49,13 @@ export declare abstract class AgentInteractionBase {
|
|
|
66
49
|
* @param apexDebugging true to enable Apex debugging, false to disable
|
|
67
50
|
*/
|
|
68
51
|
protected setApexDebugging(apexDebugging: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* Send a message to the agent using the session ID obtained by calling `start()`.
|
|
54
|
+
*
|
|
55
|
+
* @param message A message to send to the agent.
|
|
56
|
+
* @returns `AgentPreviewSendResponse`
|
|
57
|
+
*/
|
|
58
|
+
protected abstract sendMessage(message: string): Promise<AgentPreviewSendResponse>;
|
|
69
59
|
/**
|
|
70
60
|
* Get the agent ID to use for storage/transcript purposes
|
|
71
61
|
*/
|
|
@@ -79,8 +69,9 @@ export declare abstract class AgentInteractionBase {
|
|
|
79
69
|
*/
|
|
80
70
|
protected abstract handleApexDebuggingSetup(): Promise<void>;
|
|
81
71
|
protected abstract getTrace(planId: string): Promise<PlannerResponse | undefined>;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
protected abstract getHistoryFromDisc(): Promise<{
|
|
73
|
+
metadata: PreviewMetadata | null;
|
|
74
|
+
transcript: TranscriptEntry[];
|
|
75
|
+
traces: PlannerResponse[];
|
|
76
|
+
}>;
|
|
86
77
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AgentBase = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright 2026, Salesforce, Inc.
|
|
6
6
|
*
|
|
@@ -19,20 +19,18 @@ exports.AgentInteractionBase = void 0;
|
|
|
19
19
|
const promises_1 = require("node:fs/promises");
|
|
20
20
|
const node_path_1 = require("node:path");
|
|
21
21
|
const core_1 = require("@salesforce/core");
|
|
22
|
-
const utils_1 = require("./utils");
|
|
23
|
-
const apexUtils_1 = require("./apexUtils");
|
|
24
22
|
/**
|
|
25
23
|
* Abstract base class for agent preview functionality.
|
|
26
24
|
* Contains shared properties and methods between ScriptAgent and ProductionAgent.
|
|
27
25
|
*/
|
|
28
|
-
class
|
|
26
|
+
class AgentBase {
|
|
29
27
|
connection;
|
|
30
28
|
/**
|
|
31
29
|
* The display name of the agent (user-friendly name, not API name)
|
|
32
30
|
*/
|
|
33
31
|
name;
|
|
34
32
|
sessionId;
|
|
35
|
-
|
|
33
|
+
historyDir;
|
|
36
34
|
apexDebugging;
|
|
37
35
|
planIds = new Set();
|
|
38
36
|
constructor(connection) {
|
|
@@ -42,94 +40,17 @@ class AgentInteractionBase {
|
|
|
42
40
|
delete this.connection.accessToken;
|
|
43
41
|
await this.connection.refreshAuth();
|
|
44
42
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Send a message to the agent using the session ID obtained by calling `start()`.
|
|
47
|
-
*
|
|
48
|
-
* @param message A message to send to the agent.
|
|
49
|
-
* @returns `AgentPreviewSendResponse`
|
|
50
|
-
*/
|
|
51
|
-
async sendMessage(message) {
|
|
52
|
-
if (!this.sessionId) {
|
|
53
|
-
throw core_1.SfError.create({ name: 'noSessionId', message: 'Agent not started, please call .start() first' });
|
|
54
|
-
}
|
|
55
|
-
const url = this.getSendMessageUrl();
|
|
56
|
-
const body = {
|
|
57
|
-
message: {
|
|
58
|
-
sequenceId: Date.now(),
|
|
59
|
-
type: 'Text',
|
|
60
|
-
text: message,
|
|
61
|
-
},
|
|
62
|
-
variables: [],
|
|
63
|
-
};
|
|
64
|
-
try {
|
|
65
|
-
const start = Date.now();
|
|
66
|
-
// Handle Apex debugging setup if needed
|
|
67
|
-
if (this.apexDebugging && this.canApexDebug()) {
|
|
68
|
-
await this.handleApexDebuggingSetup();
|
|
69
|
-
}
|
|
70
|
-
const agentId = await this.getAgentIdForStorage();
|
|
71
|
-
// Ensure session directory exists
|
|
72
|
-
if (!this.sessionDir) {
|
|
73
|
-
this.sessionDir = await (0, utils_1.getSessionDir)(agentId, this.sessionId);
|
|
74
|
-
}
|
|
75
|
-
void (0, utils_1.appendTranscriptEntryToSession)({
|
|
76
|
-
timestamp: new Date().toISOString(),
|
|
77
|
-
agentId,
|
|
78
|
-
sessionId: this.sessionId,
|
|
79
|
-
role: 'user',
|
|
80
|
-
text: message,
|
|
81
|
-
}, this.sessionDir);
|
|
82
|
-
const response = await this.connection.request({
|
|
83
|
-
method: 'POST',
|
|
84
|
-
url,
|
|
85
|
-
body: JSON.stringify(body),
|
|
86
|
-
headers: {
|
|
87
|
-
'x-client-name': 'afdx',
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
const planId = response.messages.at(0).planId;
|
|
91
|
-
this.planIds.add(planId);
|
|
92
|
-
await (0, utils_1.appendTranscriptEntryToSession)({
|
|
93
|
-
timestamp: new Date().toISOString(),
|
|
94
|
-
agentId,
|
|
95
|
-
sessionId: this.sessionId,
|
|
96
|
-
role: 'agent',
|
|
97
|
-
text: response.messages.at(0)?.message,
|
|
98
|
-
raw: response.messages,
|
|
99
|
-
}, this.sessionDir);
|
|
100
|
-
// Fetch and write trace immediately if available
|
|
101
|
-
if (planId) {
|
|
102
|
-
try {
|
|
103
|
-
const trace = await this.getTrace(planId);
|
|
104
|
-
await (0, utils_1.writeTraceToSession)(planId, trace, this.sessionDir);
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
throw core_1.SfError.wrap(error);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (this.apexDebugging && this.canApexDebug()) {
|
|
111
|
-
const apexLog = await (0, apexUtils_1.getDebugLog)(this.connection, start, Date.now());
|
|
112
|
-
if (apexLog) {
|
|
113
|
-
response.apexDebugLog = apexLog;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return response;
|
|
117
|
-
}
|
|
118
|
-
catch (err) {
|
|
119
|
-
throw core_1.SfError.wrap(err);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
43
|
/**
|
|
123
44
|
* Get all traces from the current session
|
|
124
45
|
* Reads traces from the session directory if available, otherwise fetches from API
|
|
125
46
|
*/
|
|
126
47
|
async getAllTracesFromDisc() {
|
|
127
|
-
if (!this.
|
|
48
|
+
if (!this.historyDir) {
|
|
128
49
|
throw core_1.SfError.create({ message: 'history never created' });
|
|
129
50
|
}
|
|
130
51
|
const traces = [];
|
|
131
52
|
// If we have a session directory, try reading traces from disk first
|
|
132
|
-
const tracesDir = (0, node_path_1.join)(this.
|
|
53
|
+
const tracesDir = (0, node_path_1.join)(this.historyDir, 'traces');
|
|
133
54
|
const files = await (0, promises_1.readdir)(tracesDir);
|
|
134
55
|
const tracePromises = files
|
|
135
56
|
.filter((file) => file.endsWith('.json'))
|
|
@@ -158,8 +79,8 @@ class AgentInteractionBase {
|
|
|
158
79
|
* @param outputDir Optional output directory. If not provided, uses default location.
|
|
159
80
|
* @returns The path to the copied session directory
|
|
160
81
|
*/
|
|
161
|
-
async
|
|
162
|
-
if (!this.sessionId || !this.
|
|
82
|
+
async saveSessionTo(outputDir) {
|
|
83
|
+
if (!this.sessionId || !this.historyDir) {
|
|
163
84
|
throw core_1.SfError.create({ name: 'noSessionId', message: 'No active session. Call .start() first.' });
|
|
164
85
|
}
|
|
165
86
|
const agentId = await this.getAgentIdForStorage();
|
|
@@ -167,7 +88,8 @@ class AgentInteractionBase {
|
|
|
167
88
|
const destDir = (0, node_path_1.join)(outputDir, agentId, `session_${this.sessionId}`);
|
|
168
89
|
// Copy the entire session directory from .sfdx to the output directory
|
|
169
90
|
// This includes transcript.jsonl, traces/, and metadata.json
|
|
170
|
-
await (0,
|
|
91
|
+
await (0, promises_1.mkdir)(destDir, { recursive: true });
|
|
92
|
+
await (0, promises_1.cp)(this.historyDir, destDir, { recursive: true });
|
|
171
93
|
return destDir;
|
|
172
94
|
}
|
|
173
95
|
/**
|
|
@@ -180,5 +102,5 @@ class AgentInteractionBase {
|
|
|
180
102
|
this.apexDebugging = apexDebugging;
|
|
181
103
|
}
|
|
182
104
|
}
|
|
183
|
-
exports.
|
|
184
|
-
//# sourceMappingURL=
|
|
105
|
+
exports.AgentBase = AgentBase;
|
|
106
|
+
//# sourceMappingURL=agentBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentBase.js","sourceRoot":"","sources":["../../src/agents/agentBase.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,+CAAgE;AAChE,yCAAiC;AACjC,2CAAuD;AAIvD;;;GAGG;AACH,MAAsB,SAAS;IAWY;IAVzC;;OAEG;IACI,IAAI,CAAqB;IACtB,SAAS,CAAqB;IAC9B,UAAU,CAAqB;IAC/B,aAAa,CAAsB;IACnC,OAAO,GAAG,IAAI,GAAG,EAA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C,UAAU,EAAE,CAAC;YACxC,MAAM,cAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,yCAAyC,EAAE,CAAC,CAAC;QACpG,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAElD,6BAA6B;QAC7B,MAAM,OAAO,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,OAAO,EAAE,WAAW,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QAEtE,uEAAuE;QACvE,6DAA6D;QAC7D,MAAM,IAAA,gBAAK,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,MAAM,IAAA,aAAE,EAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAExD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACO,gBAAgB,CAAC,aAAsB;QAC/C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;CA+BF;AApHD,8BAoHC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type BotMetadata, type BotVersionMetadata, PlannerResponse, ProductionAgentOptions } from '
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { AgentPreviewInterface, type AgentPreviewSendResponse, type BotMetadata, type BotVersionMetadata, PlannerResponse, PreviewMetadata, ProductionAgentOptions } from '../types';
|
|
2
|
+
import { TranscriptEntry } from '../utils';
|
|
3
|
+
import { AgentBase } from './agentBase';
|
|
4
|
+
export declare class ProductionAgent extends AgentBase {
|
|
4
5
|
private options;
|
|
5
6
|
preview: AgentPreviewInterface;
|
|
6
7
|
private botMetadata;
|
|
@@ -16,6 +17,11 @@ export declare class ProductionAgent extends AgentInteractionBase {
|
|
|
16
17
|
*/
|
|
17
18
|
getLatestBotVersionMetadata(): Promise<BotVersionMetadata>;
|
|
18
19
|
getTrace(planId: string): Promise<PlannerResponse | undefined>;
|
|
20
|
+
getHistoryFromDisc(sessionId?: string): Promise<{
|
|
21
|
+
metadata: PreviewMetadata | null;
|
|
22
|
+
transcript: TranscriptEntry[];
|
|
23
|
+
traces: PlannerResponse[];
|
|
24
|
+
}>;
|
|
19
25
|
/**
|
|
20
26
|
* Returns the ID for this agent.
|
|
21
27
|
*
|
|
@@ -34,10 +40,10 @@ export declare class ProductionAgent extends AgentInteractionBase {
|
|
|
34
40
|
* @returns void
|
|
35
41
|
*/
|
|
36
42
|
deactivate(): Promise<void>;
|
|
37
|
-
|
|
43
|
+
getAgentIdForStorage(): string;
|
|
38
44
|
protected canApexDebug(): boolean;
|
|
39
45
|
protected handleApexDebuggingSetup(): Promise<void>;
|
|
40
|
-
protected
|
|
46
|
+
protected sendMessage(message: string): Promise<AgentPreviewSendResponse>;
|
|
41
47
|
private setAgentStatus;
|
|
42
48
|
private startPreview;
|
|
43
49
|
/**
|