Skip to content

Commit

Permalink
chore: main merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
iowillhoit committed Nov 12, 2024
2 parents 2713ecd + ecf43b0 commit c92959b
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 115 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# [1.3.0](https://github.com/salesforcecli/plugin-agent/compare/1.2.1...1.3.0) (2024-11-12)

### Bug Fixes

- update success message ([f37d979](https://github.com/salesforcecli/plugin-agent/commit/f37d979937eb7bbc19373bcca470d569facc4a2b))
- update UX ([10fcd5e](https://github.com/salesforcecli/plugin-agent/commit/10fcd5ed44ecc41316fdb17cc54cf44da6815e2b))

### Features

- add multi-stage-output ([633e484](https://github.com/salesforcecli/plugin-agent/commit/633e4849c304bc54ce3b028497607efd5007299b))

## [1.2.1](https://github.com/salesforcecli/plugin-agent/compare/1.2.0...1.2.1) (2024-11-12)

### Bug Fixes

- add salesforce/agents ([ce88c06](https://github.com/salesforcecli/plugin-agent/commit/ce88c06bbdfbff83a8633e00c4f99eb6bd6652e4))
- use agents library ([d66ff89](https://github.com/salesforcecli/plugin-agent/commit/d66ff89ddcd9bfa453455eeb3bd2826a307354c9))

# [1.2.0](https://github.com/salesforcecli/plugin-agent/compare/1.1.3...1.2.0) (2024-11-09)

### Bug Fixes
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ Create an Agent from an agent spec.

```
USAGE
$ sf agent create -o <value> -f <value> [--json] [--flags-dir <value>] [--api-version <value>]
$ sf agent create -o <value> -f <value> -n <value> [--json] [--flags-dir <value>] [--api-version <value>]
FLAGS
-f, --spec=<value> (required) The path to an agent spec file.
-f, --job-spec=<value> (required) The path to an agent spec file.
-n, --name=<value> (required) The name of the agent.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
--api-version=<value> Override the api version used for api requests made by this command
Expand All @@ -95,28 +96,28 @@ EXAMPLES
$ sf agent create --spec ./agent-spec.json
FLAG DESCRIPTIONS
-f, --spec=<value> The path to an agent spec file.
-f, --job-spec=<value> The path to an agent spec file.
The agent spec file defines job titles and descriptions for the agent and can be created using the `sf agent create
spec` command.
```

_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.2.0/src/commands/agent/create.ts)_
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.3.0/src/commands/agent/create.ts)_

## `sf agent generate spec`

Create an Agent spec.

```
USAGE
$ sf agent generate spec -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>] [-t
$ sf agent generate spec -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-t
customer_facing|employee_facing] [--role <value>] [--company-name <value>] [--company-description <value>]
[--company-website <value>] [-d <value>]
[--company-website <value>] [-d <value>] [-f <value>]
FLAGS
-d, --output-dir=<value> [default: config] The location within the project where the agent spec will be
written.
-n, --name=<value> The name of the agent to create.
-f, --file-name=<value> [default: agentSpec.json] The name of the file to write the agent spec to.
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
-t, --type=<option> The type of agent to create.
Expand Down Expand Up @@ -144,7 +145,7 @@ EXAMPLES
--company-description "A meaningful description"
```

_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.2.0/src/commands/agent/generate/spec.ts)_
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.3.0/src/commands/agent/generate/spec.ts)_

## `sf agent test cancel`

Expand Down Expand Up @@ -175,7 +176,7 @@ EXAMPLES
$ sf agent test cancel --id AiEvalId
```

_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.2.0/src/commands/agent/test/cancel.ts)_
_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.3.0/src/commands/agent/test/cancel.ts)_

## `sf agent test run`

Expand Down Expand Up @@ -217,6 +218,6 @@ FLAG DESCRIPTIONS
If the command continues to run after the wait period, the CLI returns control of the terminal window to you.
```

_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.2.0/src/commands/agent/test/run.ts)_
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.3.0/src/commands/agent/test/run.ts)_

<!-- commandsstop -->
126 changes: 45 additions & 81 deletions command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,82 +1,46 @@
[
{
"alias": [],
"command": "agent:create",
"flagAliases": [],
"flagChars": [
"f",
"o"
],
"flags": [
"api-version",
"flags-dir",
"json",
"spec",
"target-org"
],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:generate:spec",
"flagAliases": [],
"flagChars": [
"d",
"n",
"o",
"t"
],
"flags": [
"api-version",
"company-description",
"company-name",
"company-website",
"flags-dir",
"json",
"name",
"output-dir",
"role",
"target-org",
"type"
],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:test:cancel",
"flagAliases": [],
"flagChars": [
"i",
"o",
"r"
],
"flags": [
"flags-dir",
"job-id",
"json",
"target-org",
"use-most-recent"
],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:test:run",
"flagAliases": [],
"flagChars": [
"d",
"i",
"o",
"w"
],
"flags": [
"flags-dir",
"id",
"json",
"output-dir",
"target-org",
"wait"
],
"plugin": "@salesforce/plugin-agent"
}
]
{
"alias": [],
"command": "agent:create",
"flagAliases": [],
"flagChars": ["f", "n", "o"],
"flags": ["api-version", "flags-dir", "job-spec", "json", "name", "target-org"],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:generate:spec",
"flagAliases": [],
"flagChars": ["d", "f", "o", "t"],
"flags": [
"api-version",
"company-description",
"company-name",
"company-website",
"file-name",
"flags-dir",
"json",
"output-dir",
"role",
"target-org",
"type"
],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:test:cancel",
"flagAliases": [],
"flagChars": ["i", "o", "r"],
"flags": ["flags-dir", "job-id", "json", "target-org", "use-most-recent"],
"plugin": "@salesforce/plugin-agent"
},
{
"alias": [],
"command": "agent:test:run",
"flagAliases": [],
"flagChars": ["d", "i", "o", "w"],
"flags": ["flags-dir", "id", "json", "output-dir", "target-org", "wait"],
"plugin": "@salesforce/plugin-agent"
}
]
8 changes: 6 additions & 2 deletions messages/agent.create.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ Create an Agent from an agent spec.

Create an Agent from an agent spec. Agent metadata is created in the target org and retrieved to the local project.

# flags.spec.summary
# flags.job-spec.summary

The path to an agent spec file.

# flags.spec.description
# flags.job-spec.description

The agent spec file defines job titles and descriptions for the agent and can be created using the `sf agent create spec` command.

# flags.name.summary

The name of the agent.

# examples

- Create an Agent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ Create an Agent spec.

Create an Agent spec, which is a list of job titles and descriptions that the agent performs.

# flags.name.summary

The name of the agent to create.

# flags.type.summary

The type of agent to create.
Expand All @@ -34,6 +30,10 @@ The website URL for the company.

The location within the project where the agent spec will be written.

# flags.file-name.summary

The name of the file to write the agent spec to.

# examples

- Create an Agent spec in the default location:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@salesforce/plugin-agent",
"description": "Commands to interact with Salesforce agents",
"version": "1.2.0",
"version": "1.3.0",
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
Expand All @@ -10,6 +10,7 @@
"@inquirer/select": "^4.0.1",
"@oclif/core": "^4",
"@salesforce/agents": "^0.1.3",
"@oclif/multi-stage-output": "^0.7.12",
"@salesforce/core": "^8.5.2",
"@salesforce/kit": "^3.2.1",
"@salesforce/sf-plugins-core": "^12",
Expand Down
45 changes: 41 additions & 4 deletions src/commands/agent/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import { Duration, sleep } from '@salesforce/kit';
import { MultiStageOutput } from '@oclif/multi-stage-output';
import { colorize } from '@oclif/core/ux';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.create');
Expand All @@ -29,24 +31,59 @@ export default class AgentCreate extends SfCommand<AgentCreateResult> {
public static readonly flags = {
'target-org': Flags.requiredOrg(),
'api-version': Flags.orgApiVersion(),
spec: Flags.file({
'job-spec': Flags.file({
char: 'f',
required: true,
summary: messages.getMessage('flags.spec.summary'),
description: messages.getMessage('flags.spec.description'),
summary: messages.getMessage('flags.job-spec.summary'),
description: messages.getMessage('flags.job-spec.description'),
}),
name: Flags.string({
char: 'n',
required: true,
summary: messages.getMessage('flags.name.summary'),
}),
};

public async run(): Promise<AgentCreateResult> {
const { flags } = await this.parse(AgentCreate);
const jsonParsingStage = `Parsing ${flags['job-spec']}`;
const mso = new MultiStageOutput({
jsonEnabled: this.jsonEnabled(),
title: `Creating ${flags.name} Agent`,
stages: [
jsonParsingStage,
'Generating GenAiPlanner metadata',
'Creating agent in org',
'Retrieving agent metadata',
],
});

mso.goto(jsonParsingStage);
await sleep(Duration.milliseconds(200));

mso.goto('Generating GenAiPlanner metadata');
await sleep(Duration.milliseconds(200));

this.log(`Creating agent from spec: ${flags.spec}`);
mso.goto('Creating agent in org');

// POST to /services/data/{api-version}/connect/attach-agent-topics

// To simulate time spent on the server generating the spec.
await sleep(Duration.seconds(5));

mso.goto('Retrieving agent metadata');
await sleep(Duration.seconds(3));

mso.stop();

this.log(
colorize(
'green',
`Successfully created ${flags.name} in ${flags['target-org'].getUsername() ?? 'the target org'}.`
)
);
this.log(`Use ${colorize('dim', `sf org open agent --name ${flags.name}`)} to view the agent in the browser.`);

return { isSuccess: true };
}
}
Loading

0 comments on commit c92959b

Please sign in to comment.