@salesforce/plugin-agent 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,280 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { readFile, writeFile } from 'node:fs/promises';
17
+ import { join } from 'node:path';
18
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
+ import { Messages, SfError, SfProject } from '@salesforce/core';
20
+ import { ApiCatalog, findAuthoringBundle, McpAgentScript, } from '@salesforce/agents';
21
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
22
+ const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.mcp.asset.afscript');
23
+ const TOOL_PREFIX = 'McpTool__';
24
+ // An 18-char record id with a correct checksum names the same record as its first 15 chars, so both
25
+ // forms key by the 15-char form. Any other value (a wrong checksum included) keys as is and matches nothing new.
26
+ const CHECKSUM_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345';
27
+ export const idKey = (id) => {
28
+ if (!/^[a-zA-Z0-9]{18}$/.test(id))
29
+ return id;
30
+ const id15 = id.slice(0, 15);
31
+ const checksum = [0, 5, 10]
32
+ .map((start) => {
33
+ let bits = 0;
34
+ for (let i = 0; i < 5; i++)
35
+ if (/[A-Z]/.test(id15[start + i]))
36
+ bits |= 1 << i;
37
+ return CHECKSUM_CHARS[bits];
38
+ })
39
+ .join('');
40
+ return checksum === id.slice(15).toUpperCase() ? id15 : id;
41
+ };
42
+ // The Connect API reports failures through the error name (jsforce sets name to the error code;
43
+ // SfError.wrap keeps it); the message always carries the API text.
44
+ const errorKind = (error) => {
45
+ const name = error?.name ?? '';
46
+ if (/FORBIDDEN|FUNCTIONALITY_NOT_ENABLED|INSUFFICIENT_ACCESS|ERROR_HTTP_403/i.test(name))
47
+ return 'forbidden';
48
+ if (/BAD_REQUEST|ERROR_HTTP_400/i.test(name))
49
+ return 'badRequest';
50
+ if (/NOT_FOUND|ERROR_HTTP_404/i.test(name))
51
+ return 'notFound';
52
+ return 'other';
53
+ };
54
+ // Agentforce Builder places action blocks at 8 spaces (subagent actions:) and reasoning entries at 12
55
+ // (subagent reasoning: actions:). The API returns them flush left; --json keeps the raw strings.
56
+ const indent = (text, n) => text
57
+ .split('\n')
58
+ .map((line) => (line.trim() ? ' '.repeat(n) + line : line))
59
+ .join('\n');
60
+ const leading = (line) => line.length - line.trimStart().length;
61
+ // End of the section that starts at `header`: the first later non-blank line at `depth` spaces or less (or `end`).
62
+ const sectionEnd = (lines, header, depth, end) => {
63
+ for (let i = header + 1; i < end; i++)
64
+ if (lines[i].trim() && leading(lines[i]) <= depth)
65
+ return i;
66
+ return end;
67
+ };
68
+ // Index after the last non-blank line in [from, to), so new lines go before trailing blank lines.
69
+ const afterLastContent = (lines, from, to) => {
70
+ let at = from;
71
+ for (let i = from; i < to; i++)
72
+ if (lines[i].trim())
73
+ at = i + 1;
74
+ return at;
75
+ };
76
+ // Index of the line that is exactly `header` (trailing spaces ignored) in [from, to), or -1.
77
+ const findHeader = (lines, header, from, to) => {
78
+ for (let i = from; i < to; i++)
79
+ if (lines[i].trimEnd() === header)
80
+ return i;
81
+ return -1;
82
+ };
83
+ const keyOf = (line) => line.trim().match(/^(\S+):/)?.[1] ?? '';
84
+ /**
85
+ * Adds each action block under the subagent's `actions:` (8 spaces) and each reasoning reference under its
86
+ * `reasoning:` > `actions:` (12 spaces), the places Agentforce Builder uses. Creates a missing section. Skips an
87
+ * action whose key is already in the subagent's actions, so a second run changes nothing.
88
+ */
89
+ export const addToSubagent = (content, subagent, actions) => {
90
+ const eol = content.includes('\r\n') ? '\r\n' : '\n';
91
+ const lines = content.split(/\r?\n/);
92
+ const start = lines.findIndex((l) => [`subagent ${subagent}:`, `start_agent ${subagent}:`].includes(l.trimEnd()));
93
+ if (start < 0) {
94
+ const names = lines.map((l) => l.trimEnd().match(/^(?:subagent|start_agent) (\S+):$/)?.[1]).filter(Boolean);
95
+ throw new SfError(messages.getMessage('error.subagentNotFound', [subagent, names.join(', ')]), 'SubagentNotFound', [], 1);
96
+ }
97
+ const blockEnd = () => sectionEnd(lines, start, 0, lines.length);
98
+ const keysAt = (from, to, depth) => new Set(lines
99
+ .slice(from, to)
100
+ .filter((l) => l.trim() && leading(l) === depth)
101
+ .map(keyOf));
102
+ // Subagent actions: header at 4 spaces, blocks at 8.
103
+ let header = findHeader(lines, ' actions:', start + 1, blockEnd());
104
+ if (header < 0) {
105
+ header = afterLastContent(lines, start, blockEnd());
106
+ lines.splice(header, 0, ' actions:');
107
+ }
108
+ const existing = keysAt(header + 1, sectionEnd(lines, header, 4, blockEnd()), 8);
109
+ const added = actions.filter((a) => !existing.has(a.name));
110
+ const skipped = actions.filter((a) => existing.has(a.name)).map((a) => a.name);
111
+ if (added.length === 0)
112
+ return { content, added: [], skipped };
113
+ const blocksAt = afterLastContent(lines, header, sectionEnd(lines, header, 4, blockEnd()));
114
+ lines.splice(blocksAt, 0, ...added.flatMap((a) => indent(a.actionBlock, 8).split('\n')));
115
+ // Reasoning actions: reasoning at 4 spaces, its actions at 8, references at 12.
116
+ let reasoning = findHeader(lines, ' reasoning:', start + 1, blockEnd());
117
+ if (reasoning < 0) {
118
+ reasoning = afterLastContent(lines, start, blockEnd());
119
+ lines.splice(reasoning, 0, ' reasoning:');
120
+ }
121
+ const reasoningEnd = () => sectionEnd(lines, reasoning, 4, blockEnd());
122
+ let refHeader = findHeader(lines, ' actions:', reasoning + 1, reasoningEnd());
123
+ if (refHeader < 0) {
124
+ refHeader = afterLastContent(lines, reasoning, reasoningEnd());
125
+ lines.splice(refHeader, 0, ' actions:');
126
+ }
127
+ const refs = keysAt(refHeader + 1, sectionEnd(lines, refHeader, 8, reasoningEnd()), 12);
128
+ const refsAt = afterLastContent(lines, refHeader, sectionEnd(lines, refHeader, 8, reasoningEnd()));
129
+ lines.splice(refsAt, 0, ...added.filter((a) => !refs.has(a.name)).flatMap((a) => indent(a.reasoningReference, 12).split('\n')));
130
+ return { content: lines.join(eol), added: added.map((a) => a.name), skipped };
131
+ };
132
+ export default class ApiCatalogMcpServerAssetAfscript extends SfCommand {
133
+ static summary = messages.getMessage('summary');
134
+ static description = messages.getMessage('description');
135
+ static examples = messages.getMessages('examples');
136
+ static enableJsonFlag = true;
137
+ static state = 'preview';
138
+ static flags = {
139
+ 'target-org': Flags.requiredOrg(),
140
+ 'api-version': Flags.orgApiVersion(),
141
+ 'mcp-server-id': Flags.string({
142
+ summary: messages.getMessage('flags.mcp-server-id.summary'),
143
+ char: 'i',
144
+ required: true,
145
+ }),
146
+ tool: Flags.string({
147
+ summary: messages.getMessage('flags.tool.summary'),
148
+ char: 't',
149
+ multiple: true,
150
+ }),
151
+ 'asset-id': Flags.string({
152
+ summary: messages.getMessage('flags.asset-id.summary'),
153
+ multiple: true,
154
+ }),
155
+ 'authoring-bundle': Flags.string({
156
+ summary: messages.getMessage('flags.authoring-bundle.summary'),
157
+ dependsOn: ['subagent'],
158
+ }),
159
+ subagent: Flags.string({
160
+ summary: messages.getMessage('flags.subagent.summary'),
161
+ multiple: true,
162
+ dependsOn: ['authoring-bundle'],
163
+ }),
164
+ };
165
+ async run() {
166
+ const { flags } = await this.parse(ApiCatalogMcpServerAssetAfscript);
167
+ const tools = flags.tool ?? [];
168
+ const assetIds = flags['asset-id'] ?? [];
169
+ if (tools.length === 0 && assetIds.length === 0) {
170
+ throw new SfError(messages.getMessage('error.noSelection'), 'NoToolSelected', [], 1);
171
+ }
172
+ const connection = flags['target-org'].getConnection(flags['api-version']);
173
+ let assets;
174
+ try {
175
+ assets = (await ApiCatalog.listMcpServerAssets(connection, flags['mcp-server-id'])).assets ?? [];
176
+ }
177
+ catch (error) {
178
+ const wrapped = SfError.wrap(error);
179
+ throw new SfError(messages.getMessage('error.listFailed', [wrapped.message]), 'ListMcpServerAssetsFailed', [], 4, wrapped);
180
+ }
181
+ // Request order: every --tool in the order given, then every --asset-id in the order given.
182
+ const mcpTools = assets.filter((a) => a.kind === 'MCP_TOOL');
183
+ const selected = [];
184
+ const missing = new Set();
185
+ for (const tool of tools) {
186
+ const name = tool.startsWith(TOOL_PREFIX) ? tool : `${TOOL_PREFIX}${tool}`;
187
+ const asset = mcpTools.find((a) => a.name === name);
188
+ if (asset)
189
+ selected.push(asset);
190
+ else
191
+ missing.add(tool);
192
+ }
193
+ for (const id of assetIds) {
194
+ const asset = mcpTools.find((a) => idKey(a.id) === idKey(id));
195
+ if (asset)
196
+ selected.push(asset);
197
+ else
198
+ missing.add(id);
199
+ }
200
+ // Some orgs omit `active` from asset list; only an explicit false blocks. The API rejects a tool with no GenAiFunction.
201
+ const inactive = [...new Set(selected.filter((a) => a.active === false).map((a) => a.name))];
202
+ if (missing.size > 0 || inactive.length > 0) {
203
+ const available = mcpTools.map((a) => a.name).join(', ');
204
+ const key = (() => {
205
+ if (missing.size > 0 && inactive.length > 0)
206
+ return 'error.notFoundAndNotAllowlisted';
207
+ return missing.size > 0 ? 'error.toolsNotFound' : 'error.notAllowlisted';
208
+ })();
209
+ const tokens = {
210
+ 'error.toolsNotFound': [[...missing].join(', '), available],
211
+ 'error.notAllowlisted': [inactive.join(', ')],
212
+ 'error.notFoundAndNotAllowlisted': [[...missing].join(', '), available, inactive.join(', ')],
213
+ }[key];
214
+ throw new SfError(messages.getMessage(key, tokens), missing.size > 0 ? 'ToolNotFound' : 'AssetNotAllowlisted', [], 1);
215
+ }
216
+ const toolIds = [...new Set(selected.map((a) => a.id))];
217
+ let result;
218
+ try {
219
+ result = await McpAgentScript.generateActions(connection, toolIds);
220
+ }
221
+ catch (error) {
222
+ const wrapped = SfError.wrap(error);
223
+ const kind = errorKind(error);
224
+ const key = {
225
+ badRequest: 'error.badRequest',
226
+ forbidden: 'error.forbidden',
227
+ notFound: 'error.notFoundApi',
228
+ other: 'error.failed',
229
+ }[kind];
230
+ throw new SfError(messages.getMessage(key, [wrapped.message]), 'GenerateMcpAgentScriptFailed', [], 4, wrapped);
231
+ }
232
+ const bundleName = flags['authoring-bundle'];
233
+ if (bundleName) {
234
+ return {
235
+ ...result,
236
+ bundle: await this.updateBundle(bundleName, flags.subagent ?? [], result.actions),
237
+ };
238
+ }
239
+ if (!this.jsonEnabled()) {
240
+ this.log([
241
+ '# subagent actions:',
242
+ ...result.actions.map((a) => indent(a.actionBlock, 8)),
243
+ '# reasoning actions:',
244
+ ...result.actions.map((a) => indent(a.reasoningReference, 12)),
245
+ ].join('\n'));
246
+ }
247
+ return result;
248
+ }
249
+ /** Adds the actions to each subagent of the local bundle. Validate or deploy the bundle separately. */
250
+ async updateBundle(name, subagents, actions) {
251
+ let project;
252
+ try {
253
+ project = this.project ?? (await SfProject.resolve());
254
+ }
255
+ catch (error) {
256
+ throw new SfError(messages.getMessage('error.notInProject'), 'NotInProject', [], 1, SfError.wrap(error));
257
+ }
258
+ const dir = findAuthoringBundle(project.getPackageDirectories().map((p) => p.fullPath), name);
259
+ if (!dir)
260
+ throw new SfError(messages.getMessage('error.bundleNotFound', [name]), 'AuthoringBundleNotFound', [], 1);
261
+ const file = join(dir, `${name}.agent`);
262
+ const original = await readFile(file, 'utf8');
263
+ let content = original;
264
+ const updates = [];
265
+ for (const subagent of [...new Set(subagents)]) {
266
+ const r = addToSubagent(content, subagent, actions);
267
+ content = r.content;
268
+ updates.push({ name: subagent, added: r.added, skipped: r.skipped });
269
+ }
270
+ for (const s of updates) {
271
+ this.log(messages.getMessage('info.subagentUpdated', [s.name, s.added.join(', ') || '-', s.skipped.join(', ') || '-']));
272
+ }
273
+ if (content === original)
274
+ return { name, file, subagents: updates };
275
+ await writeFile(file, content, 'utf8');
276
+ this.log(messages.getMessage('info.bundleUpdated', [file]));
277
+ return { name, file, subagents: updates };
278
+ }
279
+ }
280
+ //# sourceMappingURL=afscript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"afscript.js","sourceRoot":"","sources":["../../../../../src/commands/agent/mcp/asset/afscript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,cAAc,GAIf,MAAM,oBAAoB,CAAC;AAE5B,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,CAAC;AAQ/F,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,oGAAoG;AACpG,iHAAiH;AACjH,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAU,EAAE;IAC1C,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7C,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;SACxB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,IAA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CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC"}
@@ -0,0 +1,107 @@
1
+ # summary
2
+
3
+ Print or add the Agent Script action blocks and reasoning actions for MCP tools of a server.
4
+
5
+ # description
6
+
7
+ Prints the same Agent Script blocks that Agentforce Builder writes when you add the tool to an agent: one action block for the subagent actions section and one reasoning action for the reasoning actions section, for each tool. The blocks are indented for a subagent: action blocks at 8 spaces (under `actions:`) and reasoning actions at 12 spaces (under `reasoning:` > `actions:`). Paste them as printed. With --json, the blocks are returned without indentation.
8
+
9
+ Select tools by name with --tool (with or without the `McpTool__` prefix) or by asset ID with --asset-id. You must use at least one of the two flags. Each tool must be allowlisted (active) on the MCP server; run "agent mcp asset replace" to allowlist a tool. The output follows the order of the flags: all --tool values first, then all --asset-id values. Duplicates are sent once.
10
+
11
+ To add the blocks to a local authoring bundle instead of printing them, use --authoring-bundle with one or more --subagent flags. The command adds each action block under the subagent's `actions:` and each reasoning action under its `reasoning:` > `actions:`, and creates a missing section. It skips an action that the subagent already has, so you can run it again safely. It does not compile the bundle; run "agent validate authoring-bundle" after it. Run the command from a Salesforce DX project.
12
+
13
+ The API call also assigns the MCP runtime permissions that Agentforce Builder assigns, so it is not read-only.
14
+
15
+ # examples
16
+
17
+ - Print the Agent Script for one tool of an MCP server:
18
+
19
+ <%= config.bin %> <%= command.id %> --target-org myOrg --mcp-server-id 0XSxx0000000001 --tool hello_world
20
+
21
+ - Print the Agent Script for two tools:
22
+
23
+ <%= config.bin %> <%= command.id %> --target-org myOrg --mcp-server-id 0XSxx0000000001 --tool hello_world --tool add
24
+
25
+ - Select a tool by its asset ID and output as JSON:
26
+
27
+ <%= config.bin %> <%= command.id %> --target-org myOrg --mcp-server-id 0XSxx0000000001 --asset-id 1XOxx0000000001 --json
28
+
29
+ - Add two tools to the "order_status" and "returns" subagents of the "My_Agent" authoring bundle:
30
+
31
+ <%= config.bin %> <%= command.id %> --target-org myOrg --mcp-server-id 0XSxx0000000001 --tool hello_world --tool add --authoring-bundle My_Agent --subagent order_status --subagent returns
32
+
33
+ # flags.mcp-server-id.summary
34
+
35
+ The ID of the MCP server that owns the tools.
36
+
37
+ # flags.tool.summary
38
+
39
+ Name of a tool on the server, with or without the `McpTool__` prefix. Repeat the flag for more tools.
40
+
41
+ # flags.asset-id.summary
42
+
43
+ Asset ID (1XO...) of a tool on the server. Repeat the flag for more tools.
44
+
45
+ # flags.authoring-bundle.summary
46
+
47
+ API name of a local authoring bundle to update instead of printing the blocks. Requires --subagent.
48
+
49
+ # flags.subagent.summary
50
+
51
+ Name of a subagent (or the start agent) in the authoring bundle to add the tools to. Repeat the flag for more subagents. Requires --authoring-bundle.
52
+
53
+ # info.subagentUpdated
54
+
55
+ Subagent %s: added %s; already present %s.
56
+
57
+ # info.bundleUpdated
58
+
59
+ Updated %s.
60
+
61
+ # error.notInProject
62
+
63
+ --authoring-bundle needs a Salesforce DX project. Run the command from the project directory.
64
+
65
+ # error.bundleNotFound
66
+
67
+ Cannot find an authoring bundle named %s in the project's package directories.
68
+
69
+ # error.subagentNotFound
70
+
71
+ Cannot find subagent %s in the authoring bundle. Subagents in the file: %s
72
+
73
+ # error.noSelection
74
+
75
+ Specify at least one tool with --tool or --asset-id.
76
+
77
+ # error.listFailed
78
+
79
+ Failed to list MCP server assets: %s
80
+
81
+ # error.toolsNotFound
82
+
83
+ These tools were not found on the MCP server: %s. Available tools: %s
84
+
85
+ # error.notAllowlisted
86
+
87
+ These assets are not allowlisted: %s. Run "sf agent mcp asset replace" to allowlist them.
88
+
89
+ # error.notFoundAndNotAllowlisted
90
+
91
+ Not found on the MCP server: %s. Available tools: %s. Not allowlisted: %s. Run "sf agent mcp asset replace" to allowlist them.
92
+
93
+ # error.badRequest
94
+
95
+ The API rejected the request (400): %s
96
+
97
+ # error.forbidden
98
+
99
+ The API denied access (403). The API is not enabled for this org, or you cannot author agents: %s
100
+
101
+ # error.notFoundApi
102
+
103
+ The API was not found (404). The org needs API version 68.0 (release 264) or later: %s
104
+
105
+ # error.failed
106
+
107
+ Failed to generate the Agent Script for the MCP tools: %s