Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5478d76
test: enabling NUTs against a devhub for now
WillieRuemmele Dec 12, 2025
47f18c4
chore: remove env from pjson
WillieRuemmele Dec 12, 2025
cf80719
chore: skip failing NUT until 12/16
WillieRuemmele Dec 12, 2025
41ace9e
chore: working on refactor
WillieRuemmele Dec 12, 2025
8f5b242
chore: more refactoring consumption
WillieRuemmele Dec 12, 2025
4141efb
chore: refactoring, builds
WillieRuemmele Dec 15, 2025
25b6bb5
chore: working on consumption
WillieRuemmele Dec 15, 2025
1004182
chore: fix selection types
WillieRuemmele Dec 15, 2025
9bcefd2
chore: let library save traces
WillieRuemmele Dec 15, 2025
65e541d
chore: use correct names
WillieRuemmele Dec 16, 2025
631999b
chore: update snapshot
WillieRuemmele Dec 19, 2025
aed5169
test: fix tests
WillieRuemmele Dec 19, 2025
d6ddb8e
chore: merge main, resolve conflicts
WillieRuemmele Dec 19, 2025
f170922
chore: merge main, resolve conflicts
WillieRuemmele Jan 8, 2026
46f5100
test: downgrade SDR to avoid AAB deploy bug
WillieRuemmele Jan 8, 2026
1996550
chore: delete unused NUT project files
WillieRuemmele Jan 8, 2026
ea7516e
chore: bump SDR
WillieRuemmele Jan 9, 2026
c47dc90
chore: merge main, resolve conflicts
WillieRuemmele Jan 9, 2026
bf8a4a3
chore: try pinning SDR to before AAB validation on deploy
WillieRuemmele Jan 12, 2026
432b784
chore: bump agents
WillieRuemmele Jan 13, 2026
8c5a819
chore: set skip aab in test setup
WillieRuemmele Jan 13, 2026
dd2b33e
test: add timeouts to befores for shared test-setup
WillieRuemmele Jan 13, 2026
b74e368
chore: merge main, resolve conflicts
WillieRuemmele Jan 14, 2026
55a5877
chore: remove resolution
WillieRuemmele Jan 14, 2026
96d8c60
test: add preview NUT
WillieRuemmele Jan 14, 2026
d32418e
test: fix preview NUTs
WillieRuemmele Jan 15, 2026
63d70d9
docs: remove client-app requirements from README/help
WillieRuemmele Jan 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,6 @@ USAGE
[--authoring-bundle <value>] [-d <value>] [-x] [--use-live-actions]

FLAGS
-c, --client-app=<value> Name of the linked client app to use for the connection to the published and active
agent.
-d, --output-dir=<value> Directory where conversation transcripts are saved.
-n, --api-name=<value> API name of the published and active agent you want to interact with.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
Expand Down Expand Up @@ -560,14 +558,6 @@ DESCRIPTION
the files are saved to the "./temp/agent-preview" directory. Specify a new default directory with the --output-dir
flag.

NOTE: You can also use this command to connect to a published and active agent, which are labeled "(Published)" if you
let this command provide the list of agents to preview. That use case, however, requires additional security and
configuration in both your org and your DX project. The examples in this help are for previewing an agent from its
Agent Script file in your DX project and require only simple authorization of your org, such as with the "org login
web" command. The --client-app and --api-name flags are used only for previewing published and active agents, they
don't apply to Agent Script agents. See "Connect to a Published Agent" in the "Agentforce Developer Guide" for
complete documentation: https://developer.salesforce.com/docs/einstein/genai/guide/agent-dx-preview.html.

EXAMPLES
Preview an agent in simulated mode by choosing from a list of authoring bundles provided by the command; use the org
with alias "my-dev-org":
Expand Down
3 changes: 1 addition & 2 deletions command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@
"alias": [],
"command": "agent:preview",
"flagAliases": [],
"flagChars": ["c", "d", "n", "o", "x"],
"flagChars": ["d", "n", "o", "x"],
"flags": [
"apex-debug",
"api-name",
"api-version",
"authoring-bundle",
"client-app",
"flags-dir",
"output-dir",
"target-org",
Expand Down
6 changes: 0 additions & 6 deletions messages/agent.preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ The interface is simple: in the "Start typing..." prompt, enter a statement, que

When the session concludes, the command asks if you want to save the API responses and chat transcripts. By default, the files are saved to the "./temp/agent-preview" directory. Specify a new default directory with the --output-dir flag.

NOTE: You can also use this command to connect to a published and active agent, which are labeled "(Published)" if you let this command provide the list of agents to preview. That use case, however, requires additional security and configuration in both your org and your DX project. The examples in this help are for previewing an agent from its Agent Script file in your DX project and require only simple authorization of your org, such as with the "org login web" command. The --client-app and --api-name flags are used only for previewing published and active agents, they don't apply to Agent Script agents. See "Connect to a Published Agent" in the "Agentforce Developer Guide" for complete documentation: https://developer.salesforce.com/docs/einstein/genai/guide/agent-dx-preview.html.

# flags.api-name.summary

API name of the published and active agent you want to interact with.
Expand All @@ -27,10 +25,6 @@ API name of the published and active agent you want to interact with.

API name of the authoring bundle metadata component that contains the agent's Agent Script file.

# flags.client-app.summary

Name of the linked client app to use for the connection to the published and active agent.

# flags.output-dir.summary

Directory where conversation transcripts are saved.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@inquirer/prompts": "^7.10.1",
"@oclif/core": "^4",
"@oclif/multi-stage-output": "^0.8.29",
"@salesforce/agents": "^0.20.0",
"@salesforce/agents": "0.20.0-beta.4",
"@salesforce/core": "^8.24.0",
"@salesforce/kit": "^3.2.3",
"@salesforce/sf-plugins-core": "^12.2.6",
Expand Down
17 changes: 10 additions & 7 deletions src/agentActivation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import { Connection, Messages, Org, SfError } from '@salesforce/core';
import { Agent, type BotMetadata } from '@salesforce/agents';
import { Messages, Org, SfError, SfProject } from '@salesforce/core';
import { Agent, type BotMetadata, ProductionAgent } from '@salesforce/agents';
import { select } from '@inquirer/prompts';

type Choice<Value> = {
Expand Down Expand Up @@ -67,16 +67,15 @@ export const getAgentChoices = (agents: BotMetadata[], status: 'Active' | 'Inact
});

export const getAgentForActivation = async (config: {
conn: Connection;
targetOrg: Org;
status: 'Active' | 'Inactive';
apiNameFlag?: string;
}): Promise<Agent> => {
const { conn, targetOrg, status, apiNameFlag } = config;
}): Promise<ProductionAgent> => {
const { targetOrg, status, apiNameFlag } = config;

let agentsInOrg: BotMetadata[] = [];
try {
agentsInOrg = await Agent.listRemote(conn);
agentsInOrg = await Agent.listRemote(targetOrg.getConnection());
} catch (error) {
throw SfError.create({
message: 'Error listing agents in org',
Expand Down Expand Up @@ -105,5 +104,9 @@ export const getAgentForActivation = async (config: {
selectedAgent = agentsInOrg.find((agent) => agent.DeveloperName === agentChoice.DeveloperName);
}

return new Agent({ connection: conn, nameOrId: selectedAgent!.Id });
return Agent.init({
connection: targetOrg.getConnection(),
apiNameOrId: selectedAgent!.Id,
project: SfProject.getInstance(),
});
};
3 changes: 1 addition & 2 deletions src/commands/agent/activate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ export default class AgentActivate extends SfCommand<void> {

const apiNameFlag = flags['api-name'];
const targetOrg = flags['target-org'];
const conn = targetOrg.getConnection(flags['api-version']);

if (!apiNameFlag && this.jsonEnabled()) {
throw messages.createError('error.missingRequiredFlags', ['api-name']);
}

const agent = await getAgentForActivation({ conn, targetOrg, status: 'Active', apiNameFlag });
const agent = await getAgentForActivation({ targetOrg, status: 'Active', apiNameFlag });
await agent.activate();
const agentName = (await agent.getBotMetadata()).DeveloperName;

Expand Down
3 changes: 1 addition & 2 deletions src/commands/agent/deactivate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ export default class AgentDeactivate extends SfCommand<void> {

const apiNameFlag = flags['api-name'];
const targetOrg = flags['target-org'];
const conn = targetOrg.getConnection(flags['api-version']);

if (!apiNameFlag && this.jsonEnabled()) {
throw messages.createError('error.missingRequiredFlags', ['api-name']);
}

const agent = await getAgentForActivation({ conn, targetOrg, status: 'Inactive', apiNameFlag });
const agent = await getAgentForActivation({ targetOrg, status: 'Inactive', apiNameFlag });
await agent.deactivate();
const agentName = (await agent.getBotMetadata()).DeveloperName;

Expand Down
8 changes: 3 additions & 5 deletions src/commands/agent/generate/authoring-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { join, resolve } from 'node:path';
import { readFileSync, existsSync } from 'node:fs';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { generateApiName, Messages, SfError } from '@salesforce/core';
import { Agent, AgentJobSpec } from '@salesforce/agents';
import { AgentJobSpec, ScriptAgent } from '@salesforce/agents';
import YAML from 'yaml';
import { input as inquirerInput } from '@inquirer/prompts';
import { theme } from '../../../inquirer-theme.js';
Expand Down Expand Up @@ -102,7 +102,7 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat

public async run(): Promise<AgentGenerateAuthoringBundleResult> {
const { flags } = await this.parse(AgentGenerateAuthoringBundle);
const { 'output-dir': outputDir, 'target-org': targetOrg } = flags;
const { 'output-dir': outputDir } = flags;

// If we don't have a spec yet, prompt for it
const spec = flags.spec ?? (await promptForYamlFile(AgentGenerateAuthoringBundle.FLAGGABLE_PROMPTS['spec']));
Expand Down Expand Up @@ -135,10 +135,8 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat
const metaXmlPath = join(targetOutputDir, `${bundleApiName}.bundle-meta.xml`);

// Write Agent file
const conn = targetOrg.getConnection(flags['api-version']);
const specContents = YAML.parse(readFileSync(spec, 'utf8')) as AgentJobSpec;
await Agent.createAuthoringBundle({
connection: conn,
await ScriptAgent.createAuthoringBundle({
agentSpec: { ...specContents, ...{ name, developerName: bundleApiName } },
project: this.project!,
bundleApiName,
Expand Down
Loading