@salesforce/plugin-agent 1.38.1 → 1.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,12 +13,20 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Flags, SfCommand, toHelpSection } from '@salesforce/sf-plugins-core';
17
- import { Messages, SfError, Lifecycle, EnvironmentVariable } from '@salesforce/core';
16
+ import { Flags, SfCommand, toHelpSection, prompts } from '@salesforce/sf-plugins-core';
17
+ import { Messages, SfError, EnvironmentVariable } from '@salesforce/core';
18
18
  import { Agent, ProductionAgent, ScriptAgent } from '@salesforce/agents';
19
- import { getCachedSessionIds, removeCache, validatePreviewSession } from '../../../previewSessionStore.js';
19
+ import { getCachedSessionIds, listCachedSessions, removeCache, validatePreviewSession, } from '../../../previewSessionStore.js';
20
20
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
21
21
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview.end');
22
+ async function callPreviewEnd(agent) {
23
+ if (agent instanceof ScriptAgent) {
24
+ await agent.preview.end();
25
+ }
26
+ else if (agent instanceof ProductionAgent) {
27
+ await agent.preview.end('UserRequest');
28
+ }
29
+ }
22
30
  export default class AgentPreviewEnd extends SfCommand {
23
31
  static summary = messages.getMessage('summary');
24
32
  static description = messages.getMessage('description');
@@ -27,8 +35,10 @@ export default class AgentPreviewEnd extends SfCommand {
27
35
  static envVariablesSection = toHelpSection('ENVIRONMENT VARIABLES', EnvironmentVariable.SF_TARGET_ORG);
28
36
  static errorCodes = toHelpSection('ERROR CODES', {
29
37
  'Succeeded (0)': 'Preview session ended successfully and traces saved.',
38
+ 'ExactlyOneRequired (2)': 'Neither --api-name nor --authoring-bundle was provided (required when --all is not set).',
30
39
  'NotFound (2)': 'Agent not found, or no preview session exists for this agent.',
31
40
  'PreviewEndFailed (4)': 'Failed to end the preview session.',
41
+ 'PreviewEndPartialFailure (68)': 'With --all, one or more sessions failed to end while others succeeded.',
32
42
  'SessionAmbiguous (5)': 'Multiple preview sessions found; specify --session-id to choose one.',
33
43
  });
34
44
  static flags = {
@@ -37,77 +47,230 @@ export default class AgentPreviewEnd extends SfCommand {
37
47
  'session-id': Flags.string({
38
48
  summary: messages.getMessage('flags.session-id.summary'),
39
49
  required: false,
50
+ exclusive: ['all'],
40
51
  }),
41
52
  'api-name': Flags.string({
42
53
  summary: messages.getMessage('flags.api-name.summary'),
43
54
  char: 'n',
44
- exactlyOne: ['api-name', 'authoring-bundle'],
55
+ exclusive: ['authoring-bundle'],
45
56
  }),
46
57
  'authoring-bundle': Flags.string({
47
58
  summary: messages.getMessage('flags.authoring-bundle.summary'),
48
- exactlyOne: ['api-name', 'authoring-bundle'],
59
+ exclusive: ['api-name'],
60
+ }),
61
+ all: Flags.boolean({
62
+ summary: messages.getMessage('flags.all.summary'),
63
+ exclusive: ['session-id'],
64
+ }),
65
+ 'no-prompt': Flags.boolean({
66
+ summary: messages.getMessage('flags.no-prompt.summary'),
67
+ char: 'p',
49
68
  }),
50
69
  };
51
70
  async run() {
52
71
  const { flags } = await this.parse(AgentPreviewEnd);
53
72
  const conn = flags['target-org'].getConnection(flags['api-version']);
54
- const agentIdentifier = flags['authoring-bundle'] ?? flags['api-name'];
55
- // Initialize agent with error tracking
56
- let agent;
57
- try {
58
- agent = flags['authoring-bundle']
59
- ? await Agent.init({ connection: conn, project: this.project, aabName: flags['authoring-bundle'] })
60
- : await Agent.init({ connection: conn, project: this.project, apiNameOrId: flags['api-name'] });
73
+ if (flags['all']) {
74
+ return this.endAll(flags, conn);
61
75
  }
62
- catch (error) {
63
- const wrapped = SfError.wrap(error);
64
- await Lifecycle.getInstance().emitTelemetry({ eventName: 'agent_preview_end_agent_not_found' });
65
- throw new SfError(messages.getMessage('error.agentNotFound', [agentIdentifier]), 'AgentNotFound', [], 2, wrapped);
76
+ // Without --all, exactly one of --api-name or --authoring-bundle is required.
77
+ if (!flags['api-name'] && !flags['authoring-bundle']) {
78
+ throw new SfError(messages.getMessage('error.exactlyOneRequired'), 'ExactlyOneRequired', [], 2);
66
79
  }
67
- // Get or validate session ID
80
+ const agent = await this.initAgent(flags, conn);
68
81
  let sessionId = flags['session-id'];
69
82
  if (sessionId === undefined) {
70
83
  const cached = await getCachedSessionIds(this.project, agent);
71
84
  if (cached.length === 0) {
72
- await Lifecycle.getInstance().emitTelemetry({ eventName: 'agent_preview_end_no_session' });
73
85
  throw new SfError(messages.getMessage('error.noSession'), 'PreviewSessionNotFound', [], 2);
74
86
  }
75
87
  if (cached.length > 1) {
76
- await Lifecycle.getInstance().emitTelemetry({ eventName: 'agent_preview_end_multiple_sessions' });
77
88
  throw new SfError(messages.getMessage('error.multipleSessions', [cached.join(', ')]), 'PreviewSessionAmbiguous', [], 5);
78
89
  }
79
90
  sessionId = cached[0];
80
91
  }
81
92
  agent.setSessionId(sessionId);
82
- // Validate session
83
93
  try {
84
94
  await validatePreviewSession(agent);
85
95
  }
86
96
  catch (error) {
87
97
  const wrapped = SfError.wrap(error);
88
- await Lifecycle.getInstance().emitTelemetry({ eventName: 'agent_preview_end_session_invalid' });
89
98
  throw new SfError(messages.getMessage('error.sessionInvalid', [sessionId]), 'PreviewSessionInvalid', [], 2, wrapped);
90
99
  }
91
100
  const tracesPath = await agent.getHistoryDir();
92
- await removeCache(agent);
93
- // End preview with error tracking
94
101
  try {
95
- if (agent instanceof ScriptAgent) {
96
- await agent.preview.end();
97
- }
98
- else if (agent instanceof ProductionAgent) {
99
- await agent.preview.end('UserRequest');
100
- }
102
+ await callPreviewEnd(agent);
101
103
  }
102
104
  catch (error) {
103
105
  const wrapped = SfError.wrap(error);
104
- await Lifecycle.getInstance().emitTelemetry({ eventName: 'agent_preview_end_failed' });
105
106
  throw new SfError(messages.getMessage('error.endFailed', [wrapped.message]), 'PreviewEndFailed', [wrapped.message], 4, wrapped);
106
107
  }
107
- await Lifecycle.getInstance().emitTelemetry({ eventName: 'agent_preview_end_success' });
108
+ // ProductionAgent.endSession() clears this.sessionId after the server call; re-set it so
109
+ // removeCache can call getHistoryDir() without throwing "No sessionId set on agent".
110
+ agent.setSessionId(sessionId);
111
+ await removeCache(agent);
108
112
  const result = { sessionId, tracesPath };
109
113
  this.log(messages.getMessage('output.tracesPath', [tracesPath]));
110
114
  return result;
111
115
  }
116
+ async initAgent(flags, conn) {
117
+ const agentIdentifier = flags['authoring-bundle'] ?? flags['api-name'];
118
+ try {
119
+ return flags['authoring-bundle']
120
+ ? await Agent.init({
121
+ connection: conn,
122
+ project: this.project,
123
+ aabName: flags['authoring-bundle'],
124
+ })
125
+ : await Agent.init({ connection: conn, project: this.project, apiNameOrId: flags['api-name'] });
126
+ }
127
+ catch (error) {
128
+ const wrapped = SfError.wrap(error);
129
+ throw new SfError(messages.getMessage('error.agentNotFound', [agentIdentifier]), 'AgentNotFound', [], 2, wrapped);
130
+ }
131
+ }
132
+ async endAll(flags, conn) {
133
+ const hasAgentIdentifier = flags['api-name'] !== undefined || flags['authoring-bundle'] !== undefined;
134
+ if (hasAgentIdentifier) {
135
+ return this.endAllForAgent(flags, conn);
136
+ }
137
+ return this.endAllAgents(conn, flags['no-prompt'] ?? false);
138
+ }
139
+ /**
140
+ * Path 1: --all + --api-name or --authoring-bundle
141
+ * Ends all sessions for a single specified agent. This is the original behaviour.
142
+ */
143
+ async endAllForAgent(flags, conn) {
144
+ const agent = await this.initAgent(flags, conn);
145
+ const agentLabel = flags['api-name'] ?? flags['authoring-bundle'];
146
+ const sessionIds = await getCachedSessionIds(this.project, agent);
147
+ const sessionsToEnd = sessionIds.map((sessionId) => ({ sessionId }));
148
+ if (sessionsToEnd.length === 0) {
149
+ this.log(messages.getMessage('output.noSessionsFound'));
150
+ return { ended: [] };
151
+ }
152
+ if (!flags['no-prompt']) {
153
+ const confirmed = await prompts.confirm({
154
+ message: messages.getMessage('prompt.confirmAll', [sessionsToEnd.length, agentLabel]),
155
+ });
156
+ if (!confirmed) {
157
+ return { ended: [] };
158
+ }
159
+ }
160
+ const { ended, failed } = await endSessionsForAgent(agent, sessionsToEnd);
161
+ return this.finishEndAll(ended, failed);
162
+ }
163
+ /**
164
+ * Path 2: --all alone (no agent identifier).
165
+ * Reads all agents from the local cache via listCachedSessions and ends every session.
166
+ * sessionType 'published' → ProductionAgent (server-side DELETE). 'simulated'/'live' → ScriptAgent (local only).
167
+ * session-meta.json is always present for entries returned by listCachedSessions, so sessionType is always defined.
168
+ */
169
+ async endAllAgents(conn, noPrompt) {
170
+ const entries = await listCachedSessions(this.project);
171
+ const totalSessions = entries.reduce((sum, e) => sum + e.sessions.length, 0);
172
+ if (totalSessions === 0) {
173
+ this.log(messages.getMessage('output.noSessionsFound'));
174
+ return { ended: [] };
175
+ }
176
+ if (!noPrompt) {
177
+ const agentBreakdown = entries
178
+ .map((e) => {
179
+ const label = e.displayName ?? e.agentId;
180
+ const type = e.sessions[0]?.sessionType === 'published' ? 'bot' : 'bundle'; // 'bot'/'bundle' labels confirmed by PM — intentional deviation from raw sessionType value
181
+ return ` - ${label} (${type}): ${e.sessions.length} session(s)`;
182
+ })
183
+ .join('\n');
184
+ const confirmed = await prompts.confirm({
185
+ message: `${messages.getMessage('prompt.confirmAllAgents', [
186
+ totalSessions,
187
+ entries.length,
188
+ ])}\n${agentBreakdown}`,
189
+ });
190
+ if (!confirmed) {
191
+ return { ended: [] };
192
+ }
193
+ }
194
+ const ended = [];
195
+ const failed = [];
196
+ for (const entry of entries) {
197
+ const { agentId, sessions } = entry;
198
+ let agent;
199
+ try {
200
+ const isProduction = sessions[0]?.sessionType === 'published';
201
+ if (isProduction) {
202
+ // eslint-disable-next-line no-await-in-loop
203
+ agent = await Agent.init({ connection: conn, project: this.project, apiNameOrId: agentId });
204
+ }
205
+ else {
206
+ // eslint-disable-next-line no-await-in-loop
207
+ agent = await Agent.init({ connection: conn, project: this.project, aabName: agentId });
208
+ }
209
+ }
210
+ catch (error) {
211
+ // If we can't init the agent, mark all its sessions as failed.
212
+ const errMsg = SfError.wrap(error).message;
213
+ for (const s of sessions) {
214
+ failed.push({ task: { sessionId: s.sessionId }, error: errMsg });
215
+ }
216
+ continue;
217
+ }
218
+ // eslint-disable-next-line no-await-in-loop
219
+ const { ended: agentEnded, failed: agentFailed } = await endSessionsForAgent(agent, sessions.map((s) => ({ sessionId: s.sessionId })));
220
+ ended.push(...agentEnded);
221
+ failed.push(...agentFailed);
222
+ }
223
+ return this.finishEndAll(ended, failed);
224
+ }
225
+ /**
226
+ * Called by endAllForAgent (single specified agent) and endAllAgents (all agents from cache)
227
+ * once ended/failed arrays have been fully aggregated.
228
+ * Throws a partial-failure error if needed; logs success otherwise.
229
+ */
230
+ finishEndAll(ended, failed) {
231
+ if (failed.length > 0) {
232
+ const failedList = failed.map((f) => `${f.task.sessionId}: ${f.error}`).join(', ');
233
+ const endedIds = ended.map((e) => e.sessionId).join(', ');
234
+ const msg = `Failed to end ${failed.length} session(s): [${failedList}]. Successfully ended ${ended.length} session(s)${ended.length > 0 ? `: [${endedIds}]` : ''}.`;
235
+ throw new SfError(msg, 'PreviewEndPartialFailure', [], 68);
236
+ }
237
+ this.log(messages.getMessage('output.endedAll', [ended.length]));
238
+ return { ended };
239
+ }
240
+ }
241
+ /**
242
+ * Ends a list of sessions on the given agent object serially.
243
+ * Returns { ended, failed } so callers can aggregate results.
244
+ * Does NOT throw on partial failure — callers decide what to do.
245
+ * On failure, the local cache entry is NOT removed (consistent with single-session path behaviour).
246
+ */
247
+ async function endSessionsForAgent(agent, sessionsToEnd) {
248
+ const ended = [];
249
+ const failed = [];
250
+ // Sessions are ended serially because setSessionId mutates shared state on the agent object.
251
+ // Parallelising would introduce a race condition where concurrent calls overwrite each other's sessionId.
252
+ for (const task of sessionsToEnd) {
253
+ const { sessionId } = task;
254
+ try {
255
+ agent.setSessionId(sessionId);
256
+ // eslint-disable-next-line no-await-in-loop
257
+ await validatePreviewSession(agent);
258
+ // eslint-disable-next-line no-await-in-loop
259
+ const tracesPath = await agent.getHistoryDir();
260
+ // ScriptAgent flushes traces to disk; ProductionAgent issues the server-side end request.
261
+ // eslint-disable-next-line no-await-in-loop
262
+ await callPreviewEnd(agent);
263
+ // ProductionAgent.endSession() clears this.sessionId after the server call; re-set it so
264
+ // removeCache can call getHistoryDir() without throwing "No sessionId set on agent".
265
+ agent.setSessionId(sessionId);
266
+ // eslint-disable-next-line no-await-in-loop
267
+ await removeCache(agent);
268
+ ended.push({ sessionId, tracesPath });
269
+ }
270
+ catch (error) {
271
+ failed.push({ task, error: SfError.wrap(error).message });
272
+ }
273
+ }
274
+ return { ended, failed };
112
275
  }
113
276
  //# sourceMappingURL=end.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"end.js","sourceRoot":"","sources":["../../../../src/commands/agent/preview/end.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE3G,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,CAAC;AAOxF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAgC;IACpE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,C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YAC5C,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;YAC5B,yFAAyF;YACzF,qFAAqF;YACrF,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;YAC9B,4CAA4C;YAC5C,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC"}
@@ -6,7 +6,9 @@ End an existing programmatic agent preview session and get trace location.
6
6
 
7
7
  You must have previously started a programmatic agent preview session with the "agent preview start" command to then use this command to end it. This command also displays the local directory where the session trace files are stored.
8
8
 
9
- The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata directory.
9
+ The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respectively. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata directory.
10
+
11
+ Use the --all flag to end all active preview sessions at once. You can combine --all with --api-name or --authoring-bundle to end only sessions for a specific agent, or use --all on its own to end every session across all agents in the project.
10
12
 
11
13
  # flags.session-id.summary
12
14
 
@@ -20,6 +22,18 @@ API name of the activated published agent you want to preview.
20
22
 
21
23
  API name of the authoring bundle metadata component that contains the agent's Agent Script file.
22
24
 
25
+ # flags.all.summary
26
+
27
+ End all active preview sessions. Combine with --api-name or --authoring-bundle to limit to a specific agent, or use with only --target-org to end sessions for all agents found in the local session cache. Requires --target-org.
28
+
29
+ # flags.no-prompt.summary
30
+
31
+ Don't prompt for confirmation before ending sessions. Has an effect only when used with --all.
32
+
33
+ # error.exactlyOneRequired
34
+
35
+ Exactly one of the following must be provided: --api-name, --authoring-bundle
36
+
23
37
  # error.noSession
24
38
 
25
39
  No agent preview session found. Run "sf agent preview start" to start a new agent preview session.
@@ -44,9 +58,25 @@ Failed to end preview session: %s
44
58
 
45
59
  Session traces: %s
46
60
 
61
+ # output.noSessionsFound
62
+
63
+ No active preview sessions found.
64
+
65
+ # output.endedAll
66
+
67
+ Ended %s preview session(s).
68
+
69
+ # prompt.confirmAll
70
+
71
+ About to end %s preview session(s) for agent '%s'. Continue?
72
+
73
+ # prompt.confirmAllAgents
74
+
75
+ About to end %s preview session(s) across %s agent(s). Continue?
76
+
47
77
  # examples
48
78
 
49
- - End a preview session of a published agent by specifying its session ID and API name ; use the default org:
79
+ - End a preview session of a published agent by specifying its session ID and API name; use the default org:
50
80
 
51
81
  <%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --api-name My_Published_Agent
52
82
 
@@ -57,3 +87,11 @@ Session traces: %s
57
87
  - End a preview session of an agent using its authoring bundle API name; you get an error if the agent has more than one active session.
58
88
 
59
89
  <%= config.bin %> <%= command.id %> --authoring-bundle My_Local_Agent
90
+
91
+ - End all active preview sessions for a specific agent without prompting:
92
+
93
+ <%= config.bin %> <%= command.id %> --all --authoring-bundle My_Local_Agent --target-org <target_org> --no-prompt
94
+
95
+ - End all active preview sessions across every agent in the local session cache for an org:
96
+
97
+ <%= config.bin %> <%= command.id %> --all --target-org <target_org>
@@ -1,24 +1,26 @@
1
1
  # summary
2
2
 
3
- Delete agent preview trace files.
3
+ Delete trace files from an agent preview session.
4
4
 
5
5
  # description
6
6
 
7
- Deletes trace files recorded during agent preview sessions. By default, shows a preview of what will be deleted and prompts for confirmation. Use --no-prompt to skip confirmation.
7
+ When you run an agent preview conversation (either interactive or programmatic), trace files are automatically recorded and saved in your local DX project. Use this command to delete some or all of the trace files.
8
8
 
9
- Without filters, deletes all traces for all agents and sessions. Use flags to narrow the scope: filter by agent name (--agent), by session (--session-id), or by age (--older-than).
9
+ By default, this command shows a preview of what will be deleted and prompts for confirmation. Use --no-prompt to skip confirmation.
10
+
11
+ Without filters, this comamnd deletes all trace files for all agents and sessions. Use flags to narrow the scope: filter by agent API name (--agent), by session (--session-id), or by age (--older-than).
10
12
 
11
13
  # flags.agent.summary
12
14
 
13
- Only delete traces for this agent name (substring match). Matches against the name used when starting the session, whether that's an authoring bundle or a published agent API name.
15
+ API name of the agent used to filter the list of trace files you want to delete. Matches against the API name used when starting the session, either an authoring bundle or a published agent API name.
14
16
 
15
17
  # flags.session-id.summary
16
18
 
17
- Only delete traces from this session ID.
19
+ Session ID used to filter the list of trace files you want to delete. Use the "agent preview sessions" CLI command to list all known agent preview sessions along with their session IDs.
18
20
 
19
21
  # flags.older-than.summary
20
22
 
21
- Only delete traces older than this duration. Accepts a number followed by a unit: m/minutes, h/hours, d/days, w/weeks (e.g. 7d, 24h, 2w).
23
+ Duration used to filter the list of trace files; only files older than the duration are deleted. Accepts a number followed by a unit: m/minutes, h/hours, d/days, w/weeks. Examples: 7d, 24h, 2w.
22
24
 
23
25
  # flags.no-prompt.summary
24
26
 
@@ -26,11 +28,11 @@ Skip the confirmation prompt and delete immediately.
26
28
 
27
29
  # error.invalidOlderThan
28
30
 
29
- Invalid --older-than value: '%s'. Use a number followed by a unit: m/minutes, h/hours, d/days, w/weeks (e.g. 7d, 24h, 30m, 2w).
31
+ Invalid --older-than value: '%s'. Use a number followed by a unit: m/minutes, h/hours, d/days, w/weeks, Examples: 7d, 24h, 30m, 2w.
30
32
 
31
33
  # prompt.confirm
32
34
 
33
- Delete %s trace file(s)? This cannot be undone.
35
+ Delete %s trace file(s)? This can't be undone.
34
36
 
35
37
  # output.noneFound
36
38
 
@@ -62,7 +64,7 @@ Plan ID
62
64
 
63
65
  # examples
64
66
 
65
- - Delete all traces for all agents and sessions (with confirmation prompt):
67
+ - Delete all traces for all agents and sessions; prompt for confirmation:
66
68
 
67
69
  <%= config.bin %> <%= command.id %>
68
70
 
@@ -78,10 +80,10 @@ Plan ID
78
80
 
79
81
  <%= config.bin %> <%= command.id %> --older-than 7d
80
82
 
81
- - Delete traces older than 24 hours for a specific agent, no prompt:
83
+ - Delete traces older than 24 hours for a specific agent; don't prompt for confirmation:
82
84
 
83
85
  <%= config.bin %> <%= command.id %> --agent My_Agent --older-than 24h --no-prompt
84
86
 
85
- - Delete all traces without confirmation:
87
+ - Delete all traces for all agents and sessions; don't prompt for confirmation:
86
88
 
87
89
  <%= config.bin %> <%= command.id %> --no-prompt
@@ -1,20 +1,20 @@
1
1
  # summary
2
2
 
3
- List the trace files that were recorded during all agent preview sessions.
3
+ List the available trace files that were recorded during all agent preview sessions.
4
4
 
5
5
  # description
6
6
 
7
- Lists trace files recorded during agent preview sessions. By default, lists all traces for all agents and all of their sessions. Use flags to narrow results: filter by agent name (--agent), by session (--session-id), or by date (--since).
7
+ When you run an agent preview conversation (either interactive or programmatic), trace files are automatically recorded and saved in your local DX project. By default, this command lists all trace files for all agents and all of their sessions. Use flags to narrow results: filter by agent name (--agent), by session (--session-id), or by date (--since).
8
8
 
9
9
  Each row in the output corresponds to one trace file, which in turn corresponds to one agent session. The Agent column shows the authoring bundle or API name used when starting the session.
10
10
 
11
11
  # flags.agent.summary
12
12
 
13
- Only show traces for this agent name (substring match). Matches against the name used when starting the session, whether that's an authoring bundle or a published agent API name.
13
+ API name of the agent used to filter the list of available trace files. Matches against the API name used when starting the session, either an authoring bundle or a published agent API name.
14
14
 
15
15
  # flags.session-id.summary
16
16
 
17
- Session ID used to filter the list of trace files.
17
+ Session ID used to filter the list of trace files. Use the "agent preview sessions" CLI command to list all known agent preview sessions along with their session IDs.
18
18
 
19
19
  # flags.since.summary
20
20
 
@@ -58,23 +58,23 @@ Path
58
58
 
59
59
  # examples
60
60
 
61
- - List all traces for all agents and sessions:
61
+ - List all trace files for all agents and sessions:
62
62
 
63
63
  <%= config.bin %> <%= command.id %>
64
64
 
65
- - List all traces for a specific agent:
65
+ - List all trace files for a specific agent:
66
66
 
67
67
  <%= config.bin %> <%= command.id %> --agent My_Agent
68
68
 
69
- - List traces for a specific session:
69
+ - List trace files for a specific session:
70
70
 
71
71
  <%= config.bin %> <%= command.id %> --session-id <SESSION_ID>
72
72
 
73
- - List traces recorded on or after April 20, 2026 (date-only, interpreted as UTC midnight):
73
+ - List trace files recorded on or after April 20, 2026 (date-only, interpreted as UTC midnight):
74
74
 
75
75
  <%= config.bin %> <%= command.id %> --since 2026-04-20
76
76
 
77
- - List traces recorded on or after a specific UTC time:
77
+ - List trace files recorded on or after a specific UTC time:
78
78
 
79
79
  <%= config.bin %> <%= command.id %> --since 2026-04-20T14:00:00Z
80
80
 
@@ -1,64 +1,67 @@
1
1
  # summary
2
2
 
3
- Read and analyze trace files from an agent preview session.
3
+ Read trace files from an agent preview session.
4
4
 
5
5
  # description
6
6
 
7
- Reads trace files recorded during an agent preview session and outputs them in one of three formats.
7
+ When you run an agent preview conversation (either interactive or programmatic), trace files are automatically recorded and saved in your local DX project. Each turn (utterance or response) of a conversation creates trace data. Use this command to view trace data for a specific preview session, so you can then analyze the trace data to observe, monitor, investigate, and troubleshoot agent events and behavior.
8
8
 
9
- **--format summary** (default): A per-turn narrative showing topic routing, actions executed, and the agent's response. Use this to quickly understand what happened in a session.
9
+ Use the --format flag to specify one of these formats of the outputted trace data:
10
10
 
11
- **--format detail**: Diagnostic drill-down into a specific dimension (--dimension required). Filters output to only the trace steps relevant to that dimension, minimizing noise.
11
+ - summary (Default): A per-turn narrative showing topic routing, actions executed, and the agent's response. Use this to quickly understand what happened in a preview session.
12
+ - detail: Diagnostic drill-down into a specific dimension. Filters output to only the trace steps relevant to that dimension, minimizing noise.
13
+ - raw: Unprocessed trace JSON. Use this as a fallback when the trace schema has changed or you need to perform custom analysis.
12
14
 
13
- **--format raw**: Unprocessed trace JSON. Use this as a fallback when the trace schema has changed or you need to perform custom analysis.
15
+ If you specify "--format detail", you must also specify a dimension with the --dimension flag. Dimensions are a way to slice and analyze the agent execution trace from a specific angle or concern. Instead of looking at the raw sequence of everything that happened, each dimension filters and organizes the trace data to answer a specific type of question. These are the available dimensions and the information they provide:
14
16
 
15
- Available dimensions for --format detail: actions, grounding, routing, errors.
16
-
17
- Use --turn N to scope output to a single conversation turn.
17
+ - actions: The actions the agent executed. Includes action name, input parameters, output, and latency. Use this dimension to understand what the agent actually did when answering an utterance in the preview session.
18
+ - grounding: The reasoning steps used by the LLM. Use this dimension to see how the agent "thought" about the problem - the AI reasoning that determined which actions to take.
19
+ - routing: How the agent navigated between subagents. Use this dimension to understand conversation flow - when and why the agent switched between different subagents or contexts during the conversation.
20
+ - errors: Aggregates all errors during the session. Use this dimension to quickly identify and debug issues across all steps.
18
21
 
19
22
  # flags.session-id.summary
20
23
 
21
- Session ID to read traces for.
24
+ Session ID to read traces for. Use the "agent preview sessions" CLI command to list all known agent preview sessions along with their session IDs
22
25
 
23
26
  # flags.format.summary
24
27
 
25
- Output format: summary (default), detail, or raw. Use detail with --dimension to drill into a specific aspect of the trace.
28
+ Output format of the trace data; specifies the level of detail you want in the trace files.
26
29
 
27
30
  # flags.dimension.summary
28
31
 
29
- Dimension to drill into when using --format detail. One of: actions, grounding, routing, errors. Required when --format is detail.
32
+ Dimension to drill into when using "--format detail"; used to filter and organize the trace data to answer a specific type of question.
30
33
 
31
34
  # flags.turn.summary
32
35
 
33
- Scope output to this conversation turn number.
36
+ Turn number for which you want trace data. A turn is a single utterance or response in a conversation, starting with 1.
34
37
 
35
38
  # error.detailRequiresDimension
36
39
 
37
- --format detail requires --dimension. Specify one of: actions, grounding, routing, errors.
40
+ The "--format detail" flag requires --dimension. Specify one of: actions, grounding, routing, errors.
38
41
 
39
42
  # error.sessionNotFound
40
43
 
41
- Session '%s' was not found in the local session cache. Run "sf agent trace list" to see available sessions.
44
+ Session '%s' wasn't found in the local session cache. Run "sf agent trace list" to see available sessions.
42
45
 
43
46
  # error.turnIndexNotFound
44
47
 
45
- No turn index found for session '%s'. Cannot filter by --turn without a turn index.
48
+ No turn index found for session '%s'. Can't filter by --turn without a turn index.
46
49
 
47
50
  # error.turnNotFound
48
51
 
49
- Turn %s was not found in session '%s'.
52
+ Turn %s wasn't found in session '%s'.
50
53
 
51
54
  # error.parseFailedAll
52
55
 
53
- Trace parsing failed for all files: %s. The trace schema may have changed. Try --format raw to access unprocessed trace data.
56
+ Trace parsing failed for all files: %s. The trace schema may have changed. Try "--format raw" to access unprocessed trace data.
54
57
 
55
58
  # warn.dimensionIgnored
56
59
 
57
- --dimension is ignored when --format is '%s'. Use --format detail to drill into a dimension.
60
+ The --dimension flag is ignored when --format is '%s'. Use "--format detail" to drill into a dimension.
58
61
 
59
62
  # warn.parseFailed
60
63
 
61
- Trace parsing failed for some files (skipped): %s. Try --format raw to access unprocessed trace data.
64
+ Trace parsing failed for some files (skipped): %s. Try "--format raw" to access unprocessed trace data.
62
65
 
63
66
  # output.empty
64
67
 
@@ -142,11 +145,11 @@ Message
142
145
 
143
146
  # examples
144
147
 
145
- - Show a session summary (all turns):
148
+ - Show a session trace summary for all turns in the session with the specified ID:
146
149
 
147
150
  <%= config.bin %> <%= command.id %> --session-id <SESSION_ID>
148
151
 
149
- - Show summary for a single turn:
152
+ - Show a trace summary for the second turn (utterance or response) of the conversation:
150
153
 
151
154
  <%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --turn 2
152
155
 
@@ -154,7 +157,7 @@ Message
154
157
 
155
158
  <%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --format detail --dimension actions
156
159
 
157
- - Drill into routing decisions for a specific turn:
160
+ - Drill into routing decisions for the first turn of the conversation:
158
161
 
159
162
  <%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --format detail --dimension routing --turn 1
160
163