-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
211 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# summary | ||
|
||
Create an Agent from an agent spec. | ||
|
||
# description | ||
|
||
Create an Agent from an agent spec. Agent metadata is created in the target org and retrieved to the local project. | ||
|
||
# flags.planner.summary | ||
|
||
The agent planner API name. | ||
|
||
# flags.spec.summary | ||
|
||
The path to an agent spec file. | ||
|
||
# flags.spec.description | ||
|
||
The agent spec file defines job descriptions for the agent and can be created using the `sf agent create spec` command. | ||
|
||
# examples | ||
|
||
- Create an Agent: | ||
|
||
<%= config.bin %> <%= command.id %> --planner MyAgentPlanner --spec ./agent-spec.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# summary | ||
|
||
Create an Agent spec. | ||
|
||
# description | ||
|
||
Create an Agent spec, which is a list of job descriptions for the agent. | ||
|
||
# flags.agent-type.summary | ||
|
||
The type of agent to create. | ||
|
||
# flags.role.summary | ||
|
||
The role of the agent. | ||
|
||
# flags.company-name.summary | ||
|
||
The name of the company. | ||
|
||
# flags.company-description.summary | ||
|
||
The description of the company, containing details to be used when generating agent job descriptions. | ||
|
||
# flags.company-website.summary | ||
|
||
The website URL for the company. | ||
|
||
# flags.output-dir.summary | ||
|
||
The location within the project where the agent spec will be written. | ||
|
||
# examples | ||
|
||
- Create an Agent spec in the default location: | ||
|
||
<%= config.bin %> <%= command.id %> --agent-type customer-facing --role Support --company-name "Coral Cloud" --company-description "A meaningful description" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 2024, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; | ||
import { Messages } from '@salesforce/core'; | ||
|
||
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); | ||
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.create'); | ||
|
||
export type AgentCreateResult = { | ||
isSuccess: boolean; | ||
errorMessage?: string; | ||
}; | ||
|
||
// This is a POST to /services/data/{api-version}/connect/attach-agent-topics | ||
|
||
export default class AgentCreate extends SfCommand<AgentCreateResult> { | ||
public static readonly summary = messages.getMessage('summary'); | ||
public static readonly description = messages.getMessage('description'); | ||
public static readonly examples = messages.getMessages('examples'); | ||
|
||
public static readonly flags = { | ||
'target-org': Flags.requiredOrg(), | ||
'api-version': Flags.orgApiVersion(), | ||
spec: Flags.file({ | ||
char: 'f', | ||
required: true, | ||
summary: messages.getMessage('flags.spec.summary'), | ||
description: messages.getMessage('flags.spec.description'), | ||
}), | ||
planner: Flags.string({ | ||
char: 'p', | ||
required: true, | ||
summary: messages.getMessage('flags.spec.summary'), | ||
}), | ||
}; | ||
|
||
public async run(): Promise<AgentCreateResult> { | ||
const { flags } = await this.parse(AgentCreate); | ||
|
||
this.log(`Creating agent from spec: ${flags.spec}`); | ||
|
||
// POST to /services/data/{api-version}/connect/attach-agent-topics | ||
|
||
return { isSuccess: true }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright (c) 2024, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; | ||
import { Messages } from '@salesforce/core'; | ||
|
||
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); | ||
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.create.spec'); | ||
|
||
export type AgentCreateSpecResult = { | ||
isSuccess: boolean; | ||
errorMessage?: string; | ||
jobSpec?: string; | ||
}; | ||
|
||
// This is a GET of '/services/data/v62.0/connect/agent-job-spec?agentType... | ||
|
||
export default class AgentCreateSpec extends SfCommand<AgentCreateSpecResult> { | ||
public static readonly summary = messages.getMessage('summary'); | ||
public static readonly description = messages.getMessage('description'); | ||
public static readonly examples = messages.getMessages('examples'); | ||
|
||
public static readonly flags = { | ||
'target-org': Flags.requiredOrg(), | ||
'api-version': Flags.orgApiVersion(), | ||
'agent-type': Flags.string({ | ||
required: true, | ||
summary: messages.getMessage('flags.agent-type.summary'), | ||
options: ['customer_facing', 'employee_facing'], | ||
}), | ||
role: Flags.string({ | ||
required: true, | ||
summary: messages.getMessage('flags.role.summary'), | ||
}), | ||
'company-name': Flags.string({ | ||
required: true, | ||
summary: messages.getMessage('flags.company-name.summary'), | ||
}), | ||
'company-description': Flags.string({ | ||
required: true, | ||
summary: messages.getMessage('flags.company-description.summary'), | ||
}), | ||
'company-website': Flags.string({ | ||
summary: messages.getMessage('flags.company-website.summary'), | ||
}), | ||
'output-dir': Flags.directory({ | ||
char: 'd', | ||
exists: true, | ||
summary: messages.getMessage('flags.output-dir.summary'), | ||
default: 'config', | ||
}), | ||
}; | ||
|
||
public async run(): Promise<AgentCreateSpecResult> { | ||
const { flags } = await this.parse(AgentCreateSpec); | ||
|
||
this.log(`Creating agent spec in: ${flags['output-dir']}`); | ||
|
||
// GET to /services/data/{api-version}/connect/agent-job-spec | ||
|
||
// Write a file with the returned job specs | ||
|
||
return { | ||
isSuccess: true, | ||
}; | ||
} | ||
} |