Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 12 additions & 1 deletion command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,18 @@
"command": "org:open:agent",
"flagAliases": ["urlonly"],
"flagChars": ["b", "n", "o", "r"],
"flags": ["api-name", "api-version", "browser", "flags-dir", "json", "private", "target-org", "url-only"],
"flags": [
"api-name",
"api-version",
"authoring-bundle",
"browser",
"flags-dir",
"json",
"private",
"target-org",
"url-only",
"version"
],
"plugin": "@salesforce/plugin-org"
},
{
Expand Down
28 changes: 28 additions & 0 deletions messages/open.agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Open an agent in your org's Agent Builder UI in a browser.

Use the --api-name flag to open an agent using its API name in the Agent Builder UI of your org. To find the agent's API name, go to Setup in your org and navigate to the agent's details page.

Alternatively, use the --authoring-bundle flag to open an agent in Agentforce Builder. Optionally include --version to open a specific version of the agent. You'll specify the api name of the authoring bundle.

To generate the URL but not launch it in your browser, specify --url-only.

To open Agent Builder in a specific browser, use the --browser flag. Supported browsers are "chrome", "edge", and "firefox". If you don't specify --browser, the org opens in your default browser.
Expand All @@ -24,6 +26,14 @@ To open Agent Builder in a specific browser, use the --browser flag. Supported b

$ <%= config.bin %> <%= command.id %> --target-org MyTestOrg1 --browser firefox --api-name Coral_Cloud_Agent

- Open an agent in Agentforce Builder using its authoring bundle name:

$ <%= config.bin %> <%= command.id %> --authoring-bundle MyAgent

- Open a specific version of an agent in Agentforce Builder:

$ <%= config.bin %> <%= command.id %> --authoring-bundle MyAgent --version 1

# flags.api-name.summary

API name, also known as developer name, of the agent you want to open in the org's Agent Builder UI.
Expand All @@ -39,3 +49,21 @@ Browser where the org opens.
# flags.url-only.summary

Display navigation URL, but don’t launch browser.

# flags.authoring-bundle.summary

API name of the agent to open in Agentforce Builder.

# flags.authoring-bundle.description

The API name of the agent to open directly in Agentforce Builder. Optionally specify --version to open a specific
version.

# flags.version.summary

Version number of the agent to open in Agentforce Builder.

# flags.version.description

The version number of the agent to open directly in Agentforce Builder. Can only be used with the --authoring-bundle
flag.
32 changes: 31 additions & 1 deletion messages/open.authoring-bundle.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# summary

Open your org in Agentforce Studio, specifically in the list view showing the list of agents.
Open your org in Agentforce Studio, specifically in the list view showing the list of agents, or open a specific agent in Agentforce Builder.

# description

The list view shows the agents in your org that are implemented with Agent Script and an authoring bundle. Click on an agent name to open it in Agentforce Builder in a new browser window.

To open a specific agent directly in Agentforce Builder, provide the --api-name flag. Optionally include --version to open a specific version of the agent.

To generate the URL but not launch it in your browser, specify --url-only.

# examples
Expand All @@ -14,6 +16,14 @@ To generate the URL but not launch it in your browser, specify --url-only.

$ <%= config.bin %> <%= command.id %>

- Open a specific agent directly in Agentforce Builder:

$ <%= config.bin %> <%= command.id %> --api-name MyAgent

- Open a specific version of an agent in Agentforce Builder:

$ <%= config.bin %> <%= command.id %> --api-name MyAgent --version 1

- Open the agents list view in an incognito window of your default browser:

$ <%= config.bin %> <%= command.id %> --private
Expand All @@ -22,6 +32,26 @@ To generate the URL but not launch it in your browser, specify --url-only.

$ <%= config.bin %> <%= command.id %> --target-org MyTestOrg1 --browser firefox

- Open a specific agent in a different org and display the URL only:

$ <%= config.bin %> <%= command.id %> --api-name MyAgent --version 2 --target-org MyTestOrg1 --url-only

# flags.api-name.summary

API name of the agent to open in Agentforce Builder.

# flags.api-name.description

The API name of the agent to open directly in Agentforce Builder. Optionally specify --version to open a specific version.

# flags.version.summary

Version number of the agent to open in Agentforce Builder.

# flags.version.description

The version number of the agent to open directly in Agentforce Builder. Can only be used with the --api-name flag.

# flags.private.summary

Open the org in the default browser using private (incognito) mode.
Expand Down
29 changes: 26 additions & 3 deletions src/commands/org/open/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class OrgOpenAgent extends OrgOpenCommandBase<OrgOpenOutput> {
'api-name': Flags.string({
char: 'n',
summary: messages.getMessage('flags.api-name.summary'),
required: true,
exactlyOne: ['api-name', 'authoring-bundle'],
}),
private: Flags.boolean({
summary: messages.getMessage('flags.private.summary'),
Expand All @@ -52,16 +52,39 @@ export class OrgOpenAgent extends OrgOpenCommandBase<OrgOpenOutput> {
aliases: ['urlonly'],
deprecateAliases: true,
}),
'authoring-bundle': Flags.string({
summary: messages.getMessage('flags.authoring-bundle.summary'),
description: messages.getMessage('flags.authoring-bundle.description'),
exactlyOne: ['api-name', 'authoring-bundle'],
}),
version: Flags.string({
summary: messages.getMessage('flags.version.summary'),
description: messages.getMessage('flags.version.description'),
dependsOn: ['authoring-bundle'],
}),
};

public async run(): Promise<OrgOpenOutput> {
const { flags } = await this.parse(OrgOpenAgent);
this.org = flags['target-org'];
this.connection = this.org.getConnection(flags['api-version']);

const agentBuilderRedirect = await buildRetUrl(this.connection, flags['api-name']);
let path: string;
if (flags['api-name']) {
path = await buildRetUrl(this.connection, flags['api-name']);
} else {
// authoring-bundle is provided
const queryParams = new URLSearchParams({
// flags.authoring-bundle guaranteed by OCLIF definition
projectName: flags['authoring-bundle']!,
});
if (flags.version) {
queryParams.set('projectVersionNumber', flags.version);
}
path = `AgentAuthoring/agentAuthoringBuilder.app#/project?${queryParams.toString()}`;
}

return this.openOrgUI(flags, await this.org.getFrontDoorUrl(agentBuilderRedirect));
return this.openOrgUI(flags, await this.org.getFrontDoorUrl(path));
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/commands/org/open/authoring-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export class OrgOpenAuthoringBundle extends OrgOpenCommandBase<OrgOpenOutput> {
public static readonly summary = messages.getMessage('summary');
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessages('examples');
public static readonly state = 'deprecated';
public static readonly deprecationOptions = { to: 'org open agent --authoring-bundle' };

public static readonly flags = {
...OrgOpenCommandBase.flags,
Expand Down
Loading
Loading