@salesforce/plugin-agent 1.24.14-demo.8 → 1.24.14

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.
Files changed (67) hide show
  1. package/LICENSE.txt +6 -200
  2. package/README.md +24 -132
  3. package/lib/agentActivation.js +4 -13
  4. package/lib/agentActivation.js.map +1 -1
  5. package/lib/agentTestCache.js +4 -13
  6. package/lib/agentTestCache.js.map +1 -1
  7. package/lib/commands/agent/activate.js +4 -13
  8. package/lib/commands/agent/activate.js.map +1 -1
  9. package/lib/commands/agent/create.js +4 -13
  10. package/lib/commands/agent/create.js.map +1 -1
  11. package/lib/commands/agent/deactivate.js +4 -13
  12. package/lib/commands/agent/deactivate.js.map +1 -1
  13. package/lib/commands/agent/generate/agent-spec.js +4 -13
  14. package/lib/commands/agent/generate/agent-spec.js.map +1 -1
  15. package/lib/commands/agent/generate/template.js +4 -13
  16. package/lib/commands/agent/generate/template.js.map +1 -1
  17. package/lib/commands/agent/generate/test-spec.js +4 -13
  18. package/lib/commands/agent/generate/test-spec.js.map +1 -1
  19. package/lib/commands/agent/preview.d.ts +2 -2
  20. package/lib/commands/agent/preview.js +8 -30
  21. package/lib/commands/agent/preview.js.map +1 -1
  22. package/lib/commands/agent/test/create.js +4 -13
  23. package/lib/commands/agent/test/create.js.map +1 -1
  24. package/lib/commands/agent/test/list.js +4 -13
  25. package/lib/commands/agent/test/list.js.map +1 -1
  26. package/lib/commands/agent/test/results.js +4 -13
  27. package/lib/commands/agent/test/results.js.map +1 -1
  28. package/lib/commands/agent/test/resume.js +4 -13
  29. package/lib/commands/agent/test/resume.js.map +1 -1
  30. package/lib/commands/agent/test/run.js +4 -14
  31. package/lib/commands/agent/test/run.js.map +1 -1
  32. package/lib/components/agent-preview-react.js +37 -72
  33. package/lib/components/agent-preview-react.js.map +1 -1
  34. package/lib/flags.d.ts +2 -6
  35. package/lib/flags.js +20 -55
  36. package/lib/flags.js.map +1 -1
  37. package/lib/handleTestResults.js +4 -13
  38. package/lib/handleTestResults.js.map +1 -1
  39. package/lib/index.js +4 -13
  40. package/lib/index.js.map +1 -1
  41. package/lib/inquirer-theme.js +4 -13
  42. package/lib/inquirer-theme.js.map +1 -1
  43. package/lib/testStages.js +4 -13
  44. package/lib/testStages.js.map +1 -1
  45. package/lib/yes-no-cancel.js +4 -13
  46. package/lib/yes-no-cancel.js.map +1 -1
  47. package/messages/agent.preview.md +0 -4
  48. package/messages/agent.test.run.md +0 -4
  49. package/npm-shrinkwrap.json +17924 -0
  50. package/oclif.lock +9492 -0
  51. package/oclif.manifest.json +3 -289
  52. package/package.json +12 -11
  53. package/lib/commands/agent/generate/authoring-bundle.d.ts +0 -22
  54. package/lib/commands/agent/generate/authoring-bundle.js +0 -146
  55. package/lib/commands/agent/generate/authoring-bundle.js.map +0 -1
  56. package/lib/commands/agent/publish/authoring-bundle.d.ts +0 -19
  57. package/lib/commands/agent/publish/authoring-bundle.js +0 -131
  58. package/lib/commands/agent/publish/authoring-bundle.js.map +0 -1
  59. package/lib/commands/agent/validate/authoring-bundle.d.ts +0 -18
  60. package/lib/commands/agent/validate/authoring-bundle.js +0 -123
  61. package/lib/commands/agent/validate/authoring-bundle.js.map +0 -1
  62. package/messages/agent.generate.authoring-bundle.md +0 -47
  63. package/messages/agent.publish.authoring-bundle.md +0 -45
  64. package/messages/agent.validate.authoring-bundle.md +0 -41
  65. package/schemas/agent-generate-authoring__bundle.json +0 -22
  66. package/schemas/agent-publish-authoring__bundle.json +0 -25
  67. package/schemas/agent-validate-authoring__bundle.json +0 -22
@@ -1,131 +0,0 @@
1
- /*
2
- * Copyright 2025, 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 { EOL } from 'node:os';
17
- import { join } from 'node:path';
18
- import { readFileSync } from 'node:fs';
19
- import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
20
- import { MultiStageOutput } from '@oclif/multi-stage-output';
21
- import { Messages, Lifecycle, SfError } from '@salesforce/core';
22
- import { Agent, findAuthoringBundle } from '@salesforce/agents';
23
- import { RequestStatus } from '@salesforce/source-deploy-retrieve';
24
- import { ensureArray } from '@salesforce/kit';
25
- import { promptForAgentFiles } from '../../../flags.js';
26
- Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
27
- const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.publish.authoring-bundle');
28
- export default class AgentPublishAuthoringBundle extends SfCommand {
29
- static summary = messages.getMessage('summary');
30
- static description = messages.getMessage('description');
31
- static examples = messages.getMessages('examples');
32
- static requiresProject = true;
33
- static flags = {
34
- 'target-org': Flags.requiredOrg(),
35
- 'api-version': Flags.orgApiVersion(),
36
- 'api-name': Flags.string({
37
- char: 'n',
38
- summary: messages.getMessage('flags.api-name.summary'),
39
- }),
40
- };
41
- static FLAGGABLE_PROMPTS = {
42
- 'api-name': {
43
- message: messages.getMessage('flags.api-name.summary'),
44
- promptMessage: messages.getMessage('flags.api-name.prompt'),
45
- validate: (d) => {
46
- if (d.length > 80) {
47
- return 'API name cannot be over 80 characters.';
48
- }
49
- const regex = /^[A-Za-z][A-Za-z0-9_]*[A-Za-z0-9]+$/;
50
- if (d.length === 0 || !regex.test(d)) {
51
- return 'Invalid API name.';
52
- }
53
- return true;
54
- },
55
- },
56
- };
57
- async run() {
58
- const { flags } = await this.parse(AgentPublishAuthoringBundle);
59
- // If api-name is not provided, prompt user to select an .agent file from the project and extract the API name from it
60
- const apiName = flags['api-name'] ??
61
- (await promptForAgentFiles(this.project, AgentPublishAuthoringBundle.FLAGGABLE_PROMPTS['api-name']));
62
- const authoringBundleDir = findAuthoringBundle(this.project.getPackageDirectories().map((dir) => dir.fullPath), apiName);
63
- if (!authoringBundleDir) {
64
- throw new SfError(messages.getMessage('error.agentNotFound', [apiName]), 'AgentNotFoundError', [
65
- messages.getMessage('error.agentNotFoundAction'),
66
- ]);
67
- }
68
- // Create multi-stage output
69
- const mso = new MultiStageOutput({
70
- stages: ['Validate Bundle', 'Publish Agent', 'Retrieve Metadata'],
71
- title: 'Publishing Agent',
72
- data: { agentName: apiName },
73
- jsonEnabled: this.jsonEnabled(),
74
- postStagesBlock: [
75
- {
76
- label: 'Agent Name',
77
- type: 'static-key-value',
78
- get: (data) => data?.agentName,
79
- bold: true,
80
- color: 'cyan',
81
- },
82
- ],
83
- });
84
- try {
85
- mso.goto('Validate Bundle');
86
- const targetOrg = flags['target-org'];
87
- const conn = targetOrg.getConnection(flags['api-version']);
88
- // First compile the .agent file to get the Agent JSON
89
- const agentJson = await Agent.compileAgent(conn, readFileSync(join(authoringBundleDir, `${apiName}.agent`), 'utf8'));
90
- mso.skipTo('Publish Agent');
91
- // Then publish the Agent JSON to create the agent
92
- // Set up lifecycle listeners for retrieve events
93
- Lifecycle.getInstance().on('scopedPreRetrieve', () => {
94
- mso.skipTo('Retrieve Metadata');
95
- return Promise.resolve();
96
- });
97
- Lifecycle.getInstance().on('scopedPostRetrieve', (result) => {
98
- if (result.retrieveResult.response.status === RequestStatus.Succeeded) {
99
- mso.stop();
100
- }
101
- else {
102
- const errorMessage = `Metadata retrieval failed: ${ensureArray(
103
- // @ts-expect-error I saw errorMessages populated with useful information during testing
104
- result?.retrieveResult.response?.messages ?? result?.retrieveResult?.response?.errorMessage).join(EOL)}`;
105
- mso.error();
106
- throw new SfError(errorMessage);
107
- }
108
- return Promise.resolve();
109
- });
110
- const result = await Agent.publishAgentJson(conn, this.project, agentJson);
111
- mso.stop();
112
- return {
113
- success: true,
114
- botDeveloperName: result.developerName,
115
- };
116
- }
117
- catch (error) {
118
- // Handle validation errors
119
- const err = SfError.wrap(error);
120
- const errorMessage = messages.getMessage('error.publishFailed', [err.message]);
121
- // Stop the multi-stage output on error
122
- mso.error();
123
- this.error(errorMessage);
124
- return {
125
- success: false,
126
- errors: err.message.split('\n'),
127
- };
128
- }
129
- }
130
- }
131
- //# sourceMappingURL=authoring-bundle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authoring-bundle.js","sourceRoot":"","sources":["../../../../src/commands/agent/publish/authoring-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,aAAa,EAA2B,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAmB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,gCAAgC,CAAC,CAAC;AAQrG,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,SAA4C;IAC5F,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAA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CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;YAE/E,uCAAuC;YACvC,GAAG,CAAC,KAAK,EAAE,CAAC;YAEZ,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAEzB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;aAChC,CAAC;QACJ,CAAC;IACH,CAAC"}
@@ -1,18 +0,0 @@
1
- import { SfCommand } from '@salesforce/sf-plugins-core';
2
- export type AgentValidateAuthoringBundleResult = {
3
- success: boolean;
4
- errors?: string[];
5
- };
6
- export default class AgentValidateAuthoringBundle extends SfCommand<AgentValidateAuthoringBundleResult> {
7
- static readonly summary: string;
8
- static readonly description: string;
9
- static readonly examples: string[];
10
- static readonly requiresProject = true;
11
- static readonly flags: {
12
- 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
13
- 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
- 'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
- };
16
- private static readonly FLAGGABLE_PROMPTS;
17
- run(): Promise<AgentValidateAuthoringBundleResult>;
18
- }
@@ -1,123 +0,0 @@
1
- /*
2
- * Copyright 2025, 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 { readFileSync } from 'node:fs';
17
- import { join } from 'node:path';
18
- import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
- import { Messages, SfError } from '@salesforce/core';
20
- import { MultiStageOutput } from '@oclif/multi-stage-output';
21
- import { Agent, findAuthoringBundle } from '@salesforce/agents';
22
- import { Duration, sleep } from '@salesforce/kit';
23
- import { colorize } from '@oclif/core/ux';
24
- import { promptForAgentFiles } from '../../../flags.js';
25
- Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
26
- const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.validate.authoring-bundle');
27
- export default class AgentValidateAuthoringBundle extends SfCommand {
28
- static summary = messages.getMessage('summary');
29
- static description = messages.getMessage('description');
30
- static examples = messages.getMessages('examples');
31
- static requiresProject = true;
32
- static flags = {
33
- 'target-org': Flags.requiredOrg(),
34
- 'api-version': Flags.orgApiVersion(),
35
- 'api-name': Flags.string({
36
- char: 'n',
37
- summary: messages.getMessage('flags.api-name.summary'),
38
- }),
39
- };
40
- static FLAGGABLE_PROMPTS = {
41
- 'api-name': {
42
- message: messages.getMessage('flags.api-name.summary'),
43
- promptMessage: messages.getMessage('flags.api-name.prompt'),
44
- validate: (d) => {
45
- if (d.length > 80) {
46
- return 'API name cannot be over 80 characters.';
47
- }
48
- const regex = /^[A-Za-z][A-Za-z0-9_]*[A-Za-z0-9]+$/;
49
- if (d.length === 0 || !regex.test(d)) {
50
- return 'Invalid API name.';
51
- }
52
- return true;
53
- },
54
- },
55
- };
56
- async run() {
57
- const { flags } = await this.parse(AgentValidateAuthoringBundle);
58
- // If api-name is not provided, prompt user to select an .agent file from the project and extract the API name from it
59
- const apiName = flags['api-name'] ??
60
- (await promptForAgentFiles(this.project, AgentValidateAuthoringBundle.FLAGGABLE_PROMPTS['api-name']));
61
- const authoringBundleDir = findAuthoringBundle(this.project.getPackageDirectories().map((dir) => dir.fullPath), apiName);
62
- if (!authoringBundleDir) {
63
- throw new SfError(messages.getMessage('error.agentNotFound', [apiName]), 'AgentNotFoundError', [
64
- messages.getMessage('error.agentNotFoundAction'),
65
- ]);
66
- }
67
- const mso = new MultiStageOutput({
68
- jsonEnabled: this.jsonEnabled(),
69
- title: `Validating ${apiName} Authoring Bundle`,
70
- showTitle: true,
71
- stages: ['Validating Authoring Bundle'],
72
- stageSpecificBlock: [
73
- {
74
- stage: 'Validating Authoring Bundle',
75
- label: 'Status',
76
- type: 'dynamic-key-value',
77
- get: (data) => data?.status ?? 'IN PROGRESS',
78
- },
79
- {
80
- stage: 'Validating Authoring Bundle',
81
- label: 'Errors',
82
- type: 'dynamic-key-value',
83
- get: (data) => data?.errors ?? '0',
84
- },
85
- ],
86
- });
87
- try {
88
- mso.skipTo('Validating Authoring Bundle');
89
- const targetOrg = flags['target-org'];
90
- const conn = targetOrg.getConnection(flags['api-version']);
91
- // Call Agent.compileAgent() API
92
- await sleep(Duration.seconds(2));
93
- await Agent.compileAgent(conn, readFileSync(join(authoringBundleDir, `${apiName}.agent`), 'utf8'));
94
- mso.updateData({ status: 'COMPLETED' });
95
- mso.stop('completed');
96
- return {
97
- success: true,
98
- };
99
- }
100
- catch (error) {
101
- // Handle validation errors
102
- const err = SfError.wrap(error);
103
- let count = 0;
104
- const formattedError = err.message
105
- .split('\n')
106
- .map((line) => {
107
- count += 1;
108
- const type = line.split(':')[0];
109
- const rest = line.substring(line.indexOf(':')).trim();
110
- return `- ${colorize('red', type)} ${rest}`;
111
- })
112
- .join('\n');
113
- mso.updateData({ errors: count.toString(), status: 'ERROR' });
114
- mso.error();
115
- this.log(messages.getMessage('error.compilationFailed', [formattedError]));
116
- return {
117
- success: false,
118
- errors: err.message.split('\n'),
119
- };
120
- }
121
- }
122
- }
123
- //# sourceMappingURL=authoring-bundle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authoring-bundle.js","sourceRoot":"","sources":["../../../../src/commands/agent/validate/authoring-bundle.ts"],"names":[],"mappings":"AAAA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CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,2BAA2B;YAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO;iBAC/B,KAAK,CAAC,IAAI,CAAC;iBACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACZ,KAAK,IAAI,CAAC,CAAC;gBACX,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBACtD,OAAO,KAAK,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAC9C,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9D,GAAG,CAAC,KAAK,EAAE,CAAC;YAEZ,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,yBAAyB,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAC3E,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;aAChC,CAAC;QACJ,CAAC;IACH,CAAC"}
@@ -1,47 +0,0 @@
1
- # summary
2
-
3
- Generate an authoring bundle from an agent specification.
4
-
5
- # description
6
-
7
- Generates an authoring bundle containing Agent and its meta.xml file from an agent specification file.
8
-
9
- # flags.spec.summary
10
-
11
- Path to the agent specification file.
12
-
13
- # flags.output-dir.summary
14
-
15
- Directory where the authoring bundle files will be generated.
16
-
17
- # flags.name.summary
18
-
19
- Name (label) of the authoring bundle.
20
-
21
- # flags.api-name.summary
22
-
23
- API name of the new authoring bundle; if not specified, the API name is derived from the authoring bundle name (label); the API name must not exist in the org.
24
-
25
- # flags.api-name.prompt
26
-
27
- API name of the new authoring bundle
28
-
29
- # examples
30
-
31
- - Generate an authoring bundle from a specification file:
32
- <%= config.bin %> <%= command.id %> --spec-file path/to/spec.yaml --name "My Authoring Bundle"
33
-
34
- - Generate an authoring bundle with a custom output directory:
35
- <%= config.bin %> <%= command.id %> --spec-file path/to/spec.yaml --name "My Authoring Bundle" --output-dir path/to/output
36
-
37
- # error.no-spec-file
38
-
39
- No agent specification file found at the specified path.
40
-
41
- # error.invalid-spec-file
42
-
43
- The specified file is not a valid agent specification file.
44
-
45
- # error.failed-to-create-agent
46
-
47
- Failed to create Agent from the agent specification.
@@ -1,45 +0,0 @@
1
- # summary
2
-
3
- Publish an Agent Authoring Bundle as a new agent
4
-
5
- # description
6
-
7
- Publishes an Agent Authoring Bundle by compiling the .agent file and creating a new agent in your org.
8
-
9
- # examples
10
-
11
- - Publish an Agent Authoring Bundle:
12
- <%= config.bin %> <%= command.id %> --api-name path/to/bundle --agent-name "My New Agent" --target-org myorg@example.com
13
-
14
- # flags.api-name.summary
15
-
16
- API name of the Agent Authoring Bundle to publish.
17
-
18
- # flags.api-name.prompt
19
-
20
- API name of the authoring bundle to publish
21
-
22
- # flags.agent-name.summary
23
-
24
- Name for the new agent to be created
25
-
26
- # error.missingRequiredFlags
27
-
28
- Required flag(s) missing: %s
29
-
30
- # error.invalidBundlePath
31
-
32
- Invalid bundle path. Please provide a valid path to an Agent Authoring Bundle.
33
-
34
- # error.publishFailed
35
-
36
- Failed to publish agent with the following errors:
37
- %s
38
-
39
- # error.agentNotFound
40
-
41
- Could not find a .bundle-meta.xml file with API name '%s' in the project.
42
-
43
- # error.agentNotFoundAction
44
-
45
- Please check that the API name is correct and that the .agent file exists in your project directory.
@@ -1,41 +0,0 @@
1
- # summary
2
-
3
- Validate an Agent Authoring Bundle
4
-
5
- # description
6
-
7
- Validates an Agent Authoring Bundle by compiling the .agent file and checking for errors.
8
-
9
- # examples
10
-
11
- - Validate an Agent Authoring Bundle:
12
- <%= config.bin %> <%= command.id %> --api-name path/to/bundle
13
-
14
- # flags.api-name.summary
15
-
16
- API name of the Agent Authoring Bundle to validate.
17
-
18
- # flags.api-name.prompt
19
-
20
- API name of the authoring bundle to validate
21
-
22
- # error.missingRequiredFlags
23
-
24
- Required flag(s) missing: %s
25
-
26
- # error.invalidBundlePath
27
-
28
- Invalid bundle path. Please provide a valid path to an Agent Authoring Bundle.
29
-
30
- # error.compilationFailed
31
-
32
- Agent compilation failed with the following errors:
33
- %s
34
-
35
- # error.agentNotFound
36
-
37
- Could not find a .bundle-meta.xml file with API name '%s' in the project.
38
-
39
- # error.agentNotFoundAction
40
-
41
- Please check that the API name is correct and that the .agent file exists in your project directory.
@@ -1,22 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$ref": "#/definitions/AgentGenerateAuthoringBundleResult",
4
- "definitions": {
5
- "AgentGenerateAuthoringBundleResult": {
6
- "type": "object",
7
- "properties": {
8
- "agentPath": {
9
- "type": "string"
10
- },
11
- "metaXmlPath": {
12
- "type": "string"
13
- },
14
- "outputDir": {
15
- "type": "string"
16
- }
17
- },
18
- "required": ["agentPath", "metaXmlPath", "outputDir"],
19
- "additionalProperties": false
20
- }
21
- }
22
- }
@@ -1,25 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$ref": "#/definitions/AgentPublishAuthoringBundleResult",
4
- "definitions": {
5
- "AgentPublishAuthoringBundleResult": {
6
- "type": "object",
7
- "properties": {
8
- "success": {
9
- "type": "boolean"
10
- },
11
- "botDeveloperName": {
12
- "type": "string"
13
- },
14
- "errors": {
15
- "type": "array",
16
- "items": {
17
- "type": "string"
18
- }
19
- }
20
- },
21
- "required": ["success"],
22
- "additionalProperties": false
23
- }
24
- }
25
- }
@@ -1,22 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$ref": "#/definitions/AgentValidateAuthoringBundleResult",
4
- "definitions": {
5
- "AgentValidateAuthoringBundleResult": {
6
- "type": "object",
7
- "properties": {
8
- "success": {
9
- "type": "boolean"
10
- },
11
- "errors": {
12
- "type": "array",
13
- "items": {
14
- "type": "string"
15
- }
16
- }
17
- },
18
- "required": ["success"],
19
- "additionalProperties": false
20
- }
21
- }
22
- }