@aws/ml-container-creator 0.9.0 → 0.10.0
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/bin/cli.js +31 -137
- package/config/parameter-schema-v2.json +2065 -0
- package/package.json +6 -3
- package/servers/lib/catalogs/jumpstart-public.json +101 -16
- package/servers/lib/catalogs/models.json +182 -26
- package/src/app.js +6 -389
- package/src/lib/bootstrap-command-handler.js +75 -1078
- package/src/lib/bootstrap-profile-manager.js +634 -0
- package/src/lib/bootstrap-provisioners.js +421 -0
- package/src/lib/config-loader.js +405 -0
- package/src/lib/config-manager.js +59 -1668
- package/src/lib/config-mcp-client.js +118 -0
- package/src/lib/config-validator.js +634 -0
- package/src/lib/cuda-resolver.js +140 -0
- package/src/lib/e2e-catalog-validator.js +251 -3
- package/src/lib/e2e-ci-recorder.js +103 -0
- package/src/lib/generated/cli-options.js +471 -0
- package/src/lib/generated/parameter-matrix.js +671 -0
- package/src/lib/generated/validation-rules.js +202 -0
- package/src/lib/marketplace-flow.js +276 -0
- package/src/lib/mcp-query-runner.js +768 -0
- package/src/lib/parameter-schema-validator.js +62 -18
- package/src/lib/prompt-runner.js +41 -1504
- package/src/lib/prompts/feature-prompts.js +172 -0
- package/src/lib/prompts/index.js +48 -0
- package/src/lib/prompts/infrastructure-prompts.js +690 -0
- package/src/lib/prompts/model-prompts.js +552 -0
- package/src/lib/prompts/project-prompts.js +70 -0
- package/src/lib/prompts.js +2 -1446
- package/src/lib/registry-command-handler.js +135 -3
- package/src/lib/secrets-prompt-runner.js +251 -0
- package/src/lib/template-variable-resolver.js +398 -0
- package/templates/code/serve +5 -134
- package/templates/code/serve.d/lmi.ejs +19 -0
- package/templates/code/serve.d/sglang.ejs +47 -0
- package/templates/code/serve.d/tensorrt-llm.ejs +53 -0
- package/templates/code/serve.d/vllm.ejs +48 -0
- package/templates/do/clean +1 -1387
- package/templates/do/clean.d/async-inference.ejs +508 -0
- package/templates/do/clean.d/batch-transform.ejs +512 -0
- package/templates/do/clean.d/hyperpod-eks.ejs +481 -0
- package/templates/do/clean.d/managed-inference.ejs +1043 -0
- package/templates/do/deploy +1 -1766
- package/templates/do/deploy.d/async-inference.ejs +501 -0
- package/templates/do/deploy.d/batch-transform.ejs +529 -0
- package/templates/do/deploy.d/hyperpod-eks.ejs +339 -0
- package/templates/do/deploy.d/managed-inference.ejs +726 -0
- package/config/parameter-schema.json +0 -88
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Config MCP Client - Handles MCP server queries for configuration.
|
|
6
|
+
* Uses delegation pattern: receives parent ConfigManager reference to access shared state.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import { McpClient } from './mcp-client.js';
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = path.dirname(__filename);
|
|
16
|
+
const GENERATOR_ROOT = path.resolve(__dirname, '..', '..');
|
|
17
|
+
|
|
18
|
+
export default class ConfigMcpClient {
|
|
19
|
+
constructor(manager) {
|
|
20
|
+
this.manager = manager;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Query configured MCP servers for unbounded parameter values.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
async _queryMcpServers() {
|
|
28
|
+
// No-op: MCP queries now happen on-demand during prompting
|
|
29
|
+
// via queryMcpServer(). This method is kept for backward compatibility.
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Query a single named MCP server on-demand with the given context.
|
|
34
|
+
* @param {string} serverName - Name of the server in mcpServers config
|
|
35
|
+
* @param {object} context - Context to pass to the MCP tool
|
|
36
|
+
* @returns {Promise<{ values: object, choices: object } | null>}
|
|
37
|
+
*/
|
|
38
|
+
async queryMcpServer(serverName, context = {}) {
|
|
39
|
+
let mcpServerConfigs;
|
|
40
|
+
try {
|
|
41
|
+
const configPath = path.join(GENERATOR_ROOT, 'config', 'mcp.json');
|
|
42
|
+
if (!fs.existsSync(configPath)) return null;
|
|
43
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
44
|
+
mcpServerConfigs = config.mcpServers;
|
|
45
|
+
} catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!mcpServerConfigs || !mcpServerConfigs[serverName]) return null;
|
|
50
|
+
|
|
51
|
+
const smart = this.manager.options.smart === true;
|
|
52
|
+
const discover = this.manager.options.discover !== false;
|
|
53
|
+
const serverConfig = mcpServerConfigs[serverName];
|
|
54
|
+
|
|
55
|
+
const client = new McpClient(serverConfig, {
|
|
56
|
+
timeout: 15000,
|
|
57
|
+
parameterMatrix: this.manager.parameterMatrix,
|
|
58
|
+
smart,
|
|
59
|
+
discover
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Override the _buildContext to merge our search context
|
|
63
|
+
const origBuildContext = client._buildContext.bind(client);
|
|
64
|
+
client._buildContext = () => ({ ...origBuildContext(), ...context });
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
const result = await client.query();
|
|
68
|
+
await client.close();
|
|
69
|
+
|
|
70
|
+
if (!result) {
|
|
71
|
+
const diag = client.getDiagnosticMessage();
|
|
72
|
+
if (diag) console.log(` ⚠️ ${serverName}: ${diag}`);
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Store values
|
|
77
|
+
for (const [param, value] of Object.entries(result.values || {})) {
|
|
78
|
+
const paramConfig = this.manager.parameterMatrix[param];
|
|
79
|
+
if (paramConfig && paramConfig.valueSpace === 'unbounded' && paramConfig.mcp === true) {
|
|
80
|
+
this.manager.mcpSources[param] = {
|
|
81
|
+
server: serverName,
|
|
82
|
+
value,
|
|
83
|
+
timestamp: new Date().toISOString()
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Store choices
|
|
89
|
+
for (const [param, choices] of Object.entries(result.choices || {})) {
|
|
90
|
+
const paramConfig = this.manager.parameterMatrix[param];
|
|
91
|
+
if (paramConfig && paramConfig.valueSpace === 'unbounded' && paramConfig.mcp === true && Array.isArray(choices)) {
|
|
92
|
+
this.manager.mcpChoices[param] = choices;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return result;
|
|
97
|
+
} catch (err) {
|
|
98
|
+
await client.close().catch(() => {});
|
|
99
|
+
console.log(` ⚠️ ${serverName}: ${err.message}`);
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get the names of configured MCP servers.
|
|
106
|
+
* @returns {string[]}
|
|
107
|
+
*/
|
|
108
|
+
getMcpServerNames() {
|
|
109
|
+
try {
|
|
110
|
+
const configPath = path.join(GENERATOR_ROOT, 'config', 'mcp.json');
|
|
111
|
+
if (!fs.existsSync(configPath)) return [];
|
|
112
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
113
|
+
return Object.keys(config.mcpServers || {});
|
|
114
|
+
} catch {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|