mulesoft-anypoint-cli-agent-fabric-plugin 1.0.5
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.
- package/LICENSE +21 -0
- package/README.md +321 -0
- package/bin/run +5 -0
- package/bin/run.cmd +3 -0
- package/dist/commands/agent-network/project/build.d.ts +26 -0
- package/dist/commands/agent-network/project/build.js +192 -0
- package/dist/commands/agent-network/project/build.js.map +1 -0
- package/dist/commands/agent-network/project/create.d.ts +28 -0
- package/dist/commands/agent-network/project/create.js +101 -0
- package/dist/commands/agent-network/project/create.js.map +1 -0
- package/dist/commands/agent-network/project/deploy.d.ts +67 -0
- package/dist/commands/agent-network/project/deploy.js +580 -0
- package/dist/commands/agent-network/project/deploy.js.map +1 -0
- package/dist/commands/agent-network/project/publish.d.ts +27 -0
- package/dist/commands/agent-network/project/publish.js +159 -0
- package/dist/commands/agent-network/project/publish.js.map +1 -0
- package/dist/commands/agent-network/setup/dependencies.d.ts +12 -0
- package/dist/commands/agent-network/setup/dependencies.js +65 -0
- package/dist/commands/agent-network/setup/dependencies.js.map +1 -0
- package/dist/commands/agent-network/setup/gateways.d.ts +31 -0
- package/dist/commands/agent-network/setup/gateways.js +175 -0
- package/dist/commands/agent-network/setup/gateways.js.map +1 -0
- package/dist/errors/base-error.d.ts +8 -0
- package/dist/errors/base-error.js +81 -0
- package/dist/errors/base-error.js.map +1 -0
- package/dist/errors/error-factory.d.ts +71 -0
- package/dist/errors/error-factory.js +362 -0
- package/dist/errors/error-factory.js.map +1 -0
- package/dist/helpers/dependency-manager.d.ts +30 -0
- package/dist/helpers/dependency-manager.js +366 -0
- package/dist/helpers/dependency-manager.js.map +1 -0
- package/dist/helpers/entitlement-utils.d.ts +4 -0
- package/dist/helpers/entitlement-utils.js +20 -0
- package/dist/helpers/entitlement-utils.js.map +1 -0
- package/dist/helpers/policy-helper.d.ts +21 -0
- package/dist/helpers/policy-helper.js +96 -0
- package/dist/helpers/policy-helper.js.map +1 -0
- package/dist/helpers/project/api-project-dependency-fetcher.d.ts +10 -0
- package/dist/helpers/project/api-project-dependency-fetcher.js +213 -0
- package/dist/helpers/project/api-project-dependency-fetcher.js.map +1 -0
- package/dist/helpers/project/constants.d.ts +52 -0
- package/dist/helpers/project/constants.js +52 -0
- package/dist/helpers/project/constants.js.map +1 -0
- package/dist/helpers/project/debug-messages.d.ts +4 -0
- package/dist/helpers/project/debug-messages.js +8 -0
- package/dist/helpers/project/debug-messages.js.map +1 -0
- package/dist/helpers/project/templates.d.ts +1 -0
- package/dist/helpers/project/templates.js +6 -0
- package/dist/helpers/project/templates.js.map +1 -0
- package/dist/helpers/project/uris.d.ts +2 -0
- package/dist/helpers/project/uris.js +8 -0
- package/dist/helpers/project/uris.js.map +1 -0
- package/dist/helpers/project/validation-commons.d.ts +6 -0
- package/dist/helpers/project/validation-commons.js +50 -0
- package/dist/helpers/project/validation-commons.js.map +1 -0
- package/dist/helpers/types.d.ts +54 -0
- package/dist/helpers/types.js +10 -0
- package/dist/helpers/types.js.map +1 -0
- package/dist/helpers/utils.d.ts +68 -0
- package/dist/helpers/utils.js +374 -0
- package/dist/helpers/utils.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/mule-generation-dependencies.json +1 -0
- package/dist/resources/runtime-dependencies.json +13 -0
- package/dist/resources/schemas/mule-generation-dependencies-schema.json +52 -0
- package/dist/resources/schemas/runtime-dependencies-schema.json +57 -0
- package/dist/types/agent-network.d.ts +214 -0
- package/dist/types/agent-network.js +13 -0
- package/dist/types/agent-network.js.map +1 -0
- package/dist/types/types.d.ts +296 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/access-management.d.ts +5 -0
- package/dist/utils/access-management.js +14 -0
- package/dist/utils/access-management.js.map +1 -0
- package/dist/utils/api-instance-builder.d.ts +28 -0
- package/dist/utils/api-instance-builder.js +450 -0
- package/dist/utils/api-instance-builder.js.map +1 -0
- package/dist/utils/asset-builder.d.ts +28 -0
- package/dist/utils/asset-builder.js +248 -0
- package/dist/utils/asset-builder.js.map +1 -0
- package/dist/utils/constants.d.ts +73 -0
- package/dist/utils/constants.js +87 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/exchange.d.ts +4 -0
- package/dist/utils/exchange.js +26 -0
- package/dist/utils/exchange.js.map +1 -0
- package/dist/utils/files.d.ts +63 -0
- package/dist/utils/files.js +300 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/gateway.d.ts +12 -0
- package/dist/utils/gateway.js +83 -0
- package/dist/utils/gateway.js.map +1 -0
- package/dist/utils/naming.d.ts +1 -0
- package/dist/utils/naming.js +17 -0
- package/dist/utils/naming.js.map +1 -0
- package/dist/utils/report/junit-report.d.ts +2 -0
- package/dist/utils/report/junit-report.js +19 -0
- package/dist/utils/report/junit-report.js.map +1 -0
- package/dist/utils/report/validation-report.d.ts +27 -0
- package/dist/utils/report/validation-report.js +16 -0
- package/dist/utils/report/validation-report.js.map +1 -0
- package/dist/utils/uris.d.ts +26 -0
- package/dist/utils/uris.js +41 -0
- package/dist/utils/uris.js.map +1 -0
- package/dist/utils/variables.d.ts +6 -0
- package/dist/utils/variables.js +22 -0
- package/dist/utils/variables.js.map +1 -0
- package/package.json +100 -0
- package/scripts/post-install.js +102 -0
- package/templates/agent-network.yaml.template +89 -0
- package/templates/exchange.json.template +36 -0
package/package.json
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mulesoft-anypoint-cli-agent-fabric-plugin",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Agent Fabric CLI Plugin",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"files": [
|
|
7
|
+
"/bin",
|
|
8
|
+
"/dist",
|
|
9
|
+
"/scripts",
|
|
10
|
+
"/templates",
|
|
11
|
+
"/npm-shrinkwrap.json",
|
|
12
|
+
"/oclif.manifest.json"
|
|
13
|
+
],
|
|
14
|
+
"bin": {
|
|
15
|
+
"anypoint-cli-agent-fabric-plugin": "./bin/run"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@oclif/core": "1.26.1",
|
|
19
|
+
"@oclif/plugin-version": "1.0.4",
|
|
20
|
+
"ajv": "^8.17.1",
|
|
21
|
+
"ajv-formats": "^3.0.1",
|
|
22
|
+
"ajv-keywords": "^5.1.0",
|
|
23
|
+
"anypoint-project-builder": "2.2.4-3",
|
|
24
|
+
"anypoint-cli-command": "1.6.8",
|
|
25
|
+
"anypoint-cli-exchange-library": "0.1.13",
|
|
26
|
+
"fs-extra": "^11.3.0",
|
|
27
|
+
"jszip": "^3.10.1",
|
|
28
|
+
"junit-report-builder": "^3.2.1",
|
|
29
|
+
"semver": "^7.7.2",
|
|
30
|
+
"whatwg-url": "^11.0.0",
|
|
31
|
+
"xml2js": "^0.6.2",
|
|
32
|
+
"yaml": "^2.6.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"axios": "*"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@oclif/test": "^2",
|
|
39
|
+
"@types/fs-extra": "^11.0.4",
|
|
40
|
+
"@types/mocha": "^9.0.0",
|
|
41
|
+
"@types/node": "^20.14.8",
|
|
42
|
+
"@types/semver": "^7.7.1",
|
|
43
|
+
"@types/xml2js": "^0.4.14",
|
|
44
|
+
"chai": "^4",
|
|
45
|
+
"eslint": "^7.32.0",
|
|
46
|
+
"eslint-config-oclif": "^4.0.0",
|
|
47
|
+
"eslint-config-oclif-typescript": "1.0.3",
|
|
48
|
+
"eslint-plugin-mocha": "^10.0.3",
|
|
49
|
+
"eslint-plugin-node": "^11.1.0",
|
|
50
|
+
"eslint-plugin-unicorn": "^39.0.0",
|
|
51
|
+
"lint-staged": "^16.1.6",
|
|
52
|
+
"mocha": "^9",
|
|
53
|
+
"nyc": "^15.1.0",
|
|
54
|
+
"oclif": "^3",
|
|
55
|
+
"sinon": "^16.1.1",
|
|
56
|
+
"ts-node": "^10.2.1",
|
|
57
|
+
"tslib": "^2.3.1",
|
|
58
|
+
"typescript": "^4.4.3"
|
|
59
|
+
},
|
|
60
|
+
"oclif": {
|
|
61
|
+
"bin": "anypoint-cli-agent-fabric-plugin",
|
|
62
|
+
"dirname": "anypoint-cli-agent-fabric-plugin",
|
|
63
|
+
"commands": "./dist/commands",
|
|
64
|
+
"plugins": [
|
|
65
|
+
"anypoint-cli-command"
|
|
66
|
+
],
|
|
67
|
+
"topicSeparator": " ",
|
|
68
|
+
"topics": {
|
|
69
|
+
"agent-network": {
|
|
70
|
+
"description": "Set up and operate Agent Network projects."
|
|
71
|
+
},
|
|
72
|
+
"agent-network:project": {
|
|
73
|
+
"description": "Create, build, publish and deploy Agent Network projects."
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"setup": "mvn org.apache.maven.plugins:maven-dependency-plugin:3.6.1:copy -Dartifact=com.mulesoft.agents:agent-fabric-transformation:1.0.0-EAP-SNAPSHOT:jar:uber-jar -DoutputDirectory=./jvmLib/ -Dmdep.stripVersion=true ",
|
|
79
|
+
"build": "rm -rf dist && tsc -b && cp -r src/resources dist/resources",
|
|
80
|
+
"prepack": "rm -f oclif.manifest.json",
|
|
81
|
+
"postinstall": "node ./scripts/post-install.js",
|
|
82
|
+
"lint": "eslint . --ext .ts --config .eslintrc --fix",
|
|
83
|
+
"lint:staged": "lint-staged",
|
|
84
|
+
"test": "XDG_CONFIG_HOME=. SPAWN_WRAP_SHIM_ROOT=. NODE_NO_WARNINGS=1 npx nyc --extension .ts --reporter=lcov --reporter=html --reporter=text mocha --require test/helpers/init.js --forbid-only \"test/**/*.test.ts\"",
|
|
85
|
+
"dev": "npm run build && oclif manifest",
|
|
86
|
+
"dev:readme": "npm run dev && oclif readme"
|
|
87
|
+
},
|
|
88
|
+
"lint-staged": {
|
|
89
|
+
"*.{ts,js}": [
|
|
90
|
+
"eslint --fix"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"engines": {
|
|
94
|
+
"node": ">=20.0.0"
|
|
95
|
+
},
|
|
96
|
+
"keywords": [
|
|
97
|
+
"oclif"
|
|
98
|
+
],
|
|
99
|
+
"main": "dist/index.js"
|
|
100
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
const {execSync} = require('child_process')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const os = require('os')
|
|
5
|
+
|
|
6
|
+
// Get the correct executable path based on the operating system
|
|
7
|
+
function getExecutablePath(projectRoot) {
|
|
8
|
+
const isWindows = os.platform() === 'win32'
|
|
9
|
+
const executableName = isWindows ? 'run.cmd' : 'run'
|
|
10
|
+
return path.join(projectRoot, 'bin', executableName)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function validateProjectPath(projectRoot)
|
|
14
|
+
{
|
|
15
|
+
const resolvedPath = path.resolve(projectRoot);
|
|
16
|
+
const allowedPath = process.cwd();
|
|
17
|
+
if (!resolvedPath.startsWith(allowedPath)) {
|
|
18
|
+
throw new Error('Invalid project path');
|
|
19
|
+
}
|
|
20
|
+
return resolvedPath;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Build the project and generate oclif manifest
|
|
24
|
+
function buildProject(projectRoot) {
|
|
25
|
+
console.info('Building the project (dependencies command not found)...')
|
|
26
|
+
execSync('npm run build', {
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
cwd: validateProjectPath(projectRoot),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Generate the oclif manifest to ensure commands are properly registered
|
|
32
|
+
console.info('Generating oclif manifest...')
|
|
33
|
+
execSync('npx oclif manifest', {
|
|
34
|
+
stdio: 'inherit',
|
|
35
|
+
cwd: validateProjectPath(projectRoot),
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// Verify that the CLI is available and working
|
|
39
|
+
console.info('Verifying CLI availability...')
|
|
40
|
+
try {
|
|
41
|
+
const executablePath = getExecutablePath(projectRoot)
|
|
42
|
+
execSync(`"${executablePath}" --help`, {
|
|
43
|
+
stdio: 'pipe',
|
|
44
|
+
cwd: validateProjectPath(projectRoot),
|
|
45
|
+
})
|
|
46
|
+
console.info('✅ CLI is available and working')
|
|
47
|
+
} catch (verifyError) {
|
|
48
|
+
console.error('❌ CLI verification failed:', verifyError.message)
|
|
49
|
+
throw new Error('CLI is not properly built or available')
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function main() {
|
|
54
|
+
// Check if we should skip postinstall
|
|
55
|
+
if (process.env.SKIP_POSTINSTALL) {
|
|
56
|
+
console.info('Skipping postinstall steps')
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
// Get the directory where this script is located
|
|
62
|
+
const scriptDir = __dirname
|
|
63
|
+
const projectRoot = path.dirname(scriptDir)
|
|
64
|
+
const cliPath = getExecutablePath(projectRoot)
|
|
65
|
+
|
|
66
|
+
console.info(`Running CLI setup from: scriptDir:${scriptDir}, projectRoot:${projectRoot}, cliPath:${cliPath}`)
|
|
67
|
+
|
|
68
|
+
// Build the project only if the dependencies command doesn't exist
|
|
69
|
+
const dependenciesCommandPath = path.join(projectRoot, 'dist', 'commands', 'agent-network', 'setup', 'dependencies.js')
|
|
70
|
+
if (fs.existsSync(dependenciesCommandPath)) {
|
|
71
|
+
console.info('✅ Dependencies command already exists, skipping build')
|
|
72
|
+
} else {
|
|
73
|
+
buildProject(projectRoot)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Run the dependencies setup command
|
|
77
|
+
console.info('Running dependencies setup...')
|
|
78
|
+
const executablePath = getExecutablePath(projectRoot)
|
|
79
|
+
execSync(`"${executablePath}" agent-network setup dependencies`, {
|
|
80
|
+
stdio: 'inherit',
|
|
81
|
+
cwd: validateProjectPath(projectRoot),
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
console.info('✅ Post-install setup completed successfully!')
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('❌ Post-install setup failed:', error.message)
|
|
87
|
+
throw error
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Only run main when executed directly, not when required by tests
|
|
92
|
+
if (require.main === module) {
|
|
93
|
+
main()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Export functions for testing and reuse
|
|
97
|
+
module.exports = {
|
|
98
|
+
getExecutablePath,
|
|
99
|
+
validateProjectPath,
|
|
100
|
+
buildProject,
|
|
101
|
+
main,
|
|
102
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
schemaVersion: 1.0.0
|
|
2
|
+
label: Agent Network 1
|
|
3
|
+
brokers:
|
|
4
|
+
broker1:
|
|
5
|
+
card:
|
|
6
|
+
protocolVersion: 0.3.0
|
|
7
|
+
name: Broker 1
|
|
8
|
+
description: Provide a description for your broker, such as "This broker provides all capabilities...".
|
|
9
|
+
url: ${ingressgw.url}/broker1
|
|
10
|
+
capabilities:
|
|
11
|
+
pushNotifications: true
|
|
12
|
+
version: 1.0.0
|
|
13
|
+
securitySchemes: {}
|
|
14
|
+
defaultInputModes:
|
|
15
|
+
- Provide one or more media types, such as "application/json" or "text/plain".
|
|
16
|
+
defaultOutputModes:
|
|
17
|
+
- Provide one or more media types, such as "application/json" or "text/plain".
|
|
18
|
+
skills:
|
|
19
|
+
- id: Provide an id for a skill. For example, "weather".
|
|
20
|
+
name: Provide a name for a skill. For example, "Returns the weather for a given location".
|
|
21
|
+
description: Provide a description for this skill. For example, "Get the weather conditions for a specified location".
|
|
22
|
+
examples:
|
|
23
|
+
- Provide an example for what this skill can be leveraged to do. For example "What is the weather like in New York".
|
|
24
|
+
inputModes:
|
|
25
|
+
- Provide one or more media types, such as "application/json" or "text/plain".
|
|
26
|
+
outputModes:
|
|
27
|
+
- Provide one or more media types, such as "application/json" or "text/plain".
|
|
28
|
+
tags: []
|
|
29
|
+
spec:
|
|
30
|
+
llm:
|
|
31
|
+
ref:
|
|
32
|
+
name: open-ai
|
|
33
|
+
configuration:
|
|
34
|
+
model: gpt-5-mini
|
|
35
|
+
instructions:
|
|
36
|
+
- Instructions
|
|
37
|
+
links:
|
|
38
|
+
- agent:
|
|
39
|
+
ref:
|
|
40
|
+
name: agent1
|
|
41
|
+
tools:
|
|
42
|
+
- mcp:
|
|
43
|
+
ref:
|
|
44
|
+
name: mcpServer1
|
|
45
|
+
agents:
|
|
46
|
+
agent1:
|
|
47
|
+
label: Agent 1
|
|
48
|
+
metadata:
|
|
49
|
+
protocol: a2a
|
|
50
|
+
platform: Bedrock
|
|
51
|
+
|
|
52
|
+
mcpServers:
|
|
53
|
+
mcpServer1:
|
|
54
|
+
label: MCP Server 1
|
|
55
|
+
metadata:
|
|
56
|
+
transport:
|
|
57
|
+
kind: streamableHttp
|
|
58
|
+
path: /mcp
|
|
59
|
+
|
|
60
|
+
llmProviders:
|
|
61
|
+
open-ai:
|
|
62
|
+
label: OpenAI
|
|
63
|
+
description: OpenAI LLM Provider
|
|
64
|
+
metadata:
|
|
65
|
+
platform: OpenAI
|
|
66
|
+
|
|
67
|
+
connections:
|
|
68
|
+
agent1Connection:
|
|
69
|
+
kind: agent
|
|
70
|
+
ref:
|
|
71
|
+
name: agent1
|
|
72
|
+
spec:
|
|
73
|
+
url: ${agent1.url}
|
|
74
|
+
mcpServer1Connection:
|
|
75
|
+
kind: mcp
|
|
76
|
+
ref:
|
|
77
|
+
name: mcpServer1
|
|
78
|
+
spec:
|
|
79
|
+
url: ${mcpServer1.url}
|
|
80
|
+
|
|
81
|
+
my-open-ai-connection:
|
|
82
|
+
kind: llm
|
|
83
|
+
ref:
|
|
84
|
+
name: open-ai
|
|
85
|
+
spec:
|
|
86
|
+
url: https://api.openai.com/v1/
|
|
87
|
+
configuration:
|
|
88
|
+
apiKey: ${openai.apiKey}
|
|
89
|
+
timeout: 600000
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"main": "{{mainFile}}",
|
|
3
|
+
"name": "{{projectName}}",
|
|
4
|
+
"classifier": "agent-network",
|
|
5
|
+
"organizationId": "{{groupId}}",
|
|
6
|
+
"descriptorVersion": "1.0.0",
|
|
7
|
+
"tags": [],
|
|
8
|
+
"groupId": "{{groupId}}",
|
|
9
|
+
"assetId": "{{assetId}}",
|
|
10
|
+
"version": "{{assetVersion}}",
|
|
11
|
+
"dependencies": [],
|
|
12
|
+
"metadata": {
|
|
13
|
+
"variables": {
|
|
14
|
+
"agent1": {
|
|
15
|
+
"url": {
|
|
16
|
+
"description": "Agent 1 URL",
|
|
17
|
+
"default": "",
|
|
18
|
+
"secret": false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"mcpServer1": {
|
|
22
|
+
"url": {
|
|
23
|
+
"description": "MCP Server 1 URL",
|
|
24
|
+
"default": "",
|
|
25
|
+
"secret": false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"openai": {
|
|
29
|
+
"apiKey": {
|
|
30
|
+
"description": "OpenAI API key",
|
|
31
|
+
"default": ""
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|