@aws/ml-container-creator 0.9.1 → 0.10.3

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 (90) hide show
  1. package/LICENSE-THIRD-PARTY +9304 -0
  2. package/bin/cli.js +2 -0
  3. package/config/bootstrap-e2e-stack.json +341 -0
  4. package/config/bootstrap-stack.json +40 -3
  5. package/config/parameter-schema-v2.json +2049 -0
  6. package/config/tune-catalog.json +1781 -0
  7. package/infra/ci-harness/buildspec.yml +1 -0
  8. package/infra/ci-harness/lambda/path-prover/brain.ts +306 -0
  9. package/infra/ci-harness/lambda/path-prover/write-results.ts +152 -0
  10. package/infra/ci-harness/lib/ci-harness-stack.ts +837 -7
  11. package/infra/ci-harness/state-machines/path-prover.asl.json +496 -0
  12. package/package.json +53 -68
  13. package/servers/base-image-picker/index.js +121 -121
  14. package/servers/e2e-status/index.js +297 -0
  15. package/servers/e2e-status/manifest.json +14 -0
  16. package/servers/e2e-status/package.json +15 -0
  17. package/servers/endpoint-picker/LICENSE +202 -0
  18. package/servers/endpoint-picker/index.js +536 -0
  19. package/servers/endpoint-picker/manifest.json +14 -0
  20. package/servers/endpoint-picker/package.json +18 -0
  21. package/servers/hyperpod-cluster-picker/index.js +125 -125
  22. package/servers/instance-sizer/index.js +138 -138
  23. package/servers/instance-sizer/lib/instance-ranker.js +76 -76
  24. package/servers/instance-sizer/lib/model-resolver.js +61 -61
  25. package/servers/instance-sizer/lib/quota-resolver.js +113 -113
  26. package/servers/instance-sizer/lib/vram-estimator.js +31 -31
  27. package/servers/lib/bedrock-client.js +38 -38
  28. package/servers/lib/catalogs/jumpstart-public.json +101 -16
  29. package/servers/lib/catalogs/model-servers.json +201 -3
  30. package/servers/lib/catalogs/models.json +182 -26
  31. package/servers/lib/custom-validators.js +13 -13
  32. package/servers/lib/dynamic-resolver.js +4 -4
  33. package/servers/marketplace-picker/index.js +342 -0
  34. package/servers/marketplace-picker/manifest.json +14 -0
  35. package/servers/marketplace-picker/package.json +18 -0
  36. package/servers/model-picker/index.js +382 -382
  37. package/servers/region-picker/index.js +56 -56
  38. package/servers/workload-picker/LICENSE +202 -0
  39. package/servers/workload-picker/catalogs/workload-profiles.json +67 -0
  40. package/servers/workload-picker/index.js +171 -0
  41. package/servers/workload-picker/manifest.json +16 -0
  42. package/servers/workload-picker/package.json +16 -0
  43. package/src/app.js +4 -390
  44. package/src/lib/bootstrap-command-handler.js +710 -1148
  45. package/src/lib/bootstrap-config.js +36 -0
  46. package/src/lib/bootstrap-profile-manager.js +641 -0
  47. package/src/lib/bootstrap-provisioners.js +421 -0
  48. package/src/lib/ci-register-helpers.js +74 -0
  49. package/src/lib/config-loader.js +408 -0
  50. package/src/lib/config-manager.js +66 -1685
  51. package/src/lib/config-mcp-client.js +118 -0
  52. package/src/lib/config-validator.js +634 -0
  53. package/src/lib/cuda-resolver.js +149 -0
  54. package/src/lib/e2e-catalog-validator.js +251 -3
  55. package/src/lib/e2e-ci-recorder.js +103 -0
  56. package/src/lib/generated/cli-options.js +315 -311
  57. package/src/lib/generated/parameter-matrix.js +671 -0
  58. package/src/lib/generated/validation-rules.js +71 -71
  59. package/src/lib/marketplace-flow.js +276 -0
  60. package/src/lib/mcp-query-runner.js +768 -0
  61. package/src/lib/parameter-schema-validator.js +62 -18
  62. package/src/lib/path-prover-brain.js +607 -0
  63. package/src/lib/prompt-runner.js +41 -1504
  64. package/src/lib/prompts/feature-prompts.js +172 -0
  65. package/src/lib/prompts/index.js +48 -0
  66. package/src/lib/prompts/infrastructure-prompts.js +690 -0
  67. package/src/lib/prompts/model-prompts.js +552 -0
  68. package/src/lib/prompts/project-prompts.js +82 -0
  69. package/src/lib/prompts.js +2 -1446
  70. package/src/lib/registry-command-handler.js +135 -3
  71. package/src/lib/secrets-prompt-runner.js +251 -0
  72. package/src/lib/template-variable-resolver.js +422 -0
  73. package/src/lib/tune-catalog-validator.js +37 -4
  74. package/templates/Dockerfile +9 -0
  75. package/templates/code/adapter_sidecar.py +444 -0
  76. package/templates/code/serve +6 -0
  77. package/templates/code/serve.d/vllm.ejs +1 -1
  78. package/templates/do/.benchmark_writer.py +1476 -0
  79. package/templates/do/.tune_helper.py +982 -57
  80. package/templates/do/__pycache__/.benchmark_writer.cpython-312.pyc +0 -0
  81. package/templates/do/adapter +149 -0
  82. package/templates/do/benchmark +639 -85
  83. package/templates/do/config +108 -5
  84. package/templates/do/deploy.d/managed-inference.ejs +192 -11
  85. package/templates/do/optimize +106 -37
  86. package/templates/do/register +89 -0
  87. package/templates/do/test +13 -0
  88. package/templates/do/tune +378 -59
  89. package/templates/do/validate +44 -4
  90. package/config/parameter-schema.json +0 -88
@@ -18,18 +18,18 @@
18
18
  * Returns: { values, choices, message }
19
19
  */
20
20
 
21
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
22
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
23
- import { z } from 'zod'
24
- import { readFileSync } from 'node:fs'
25
- import { fileURLToPath } from 'node:url'
26
- import { resolve, dirname } from 'node:path'
27
- import { DynamicResolver } from '../lib/dynamic-resolver.js'
21
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
22
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
23
+ import { z } from 'zod';
24
+ import { readFileSync } from 'node:fs';
25
+ import { fileURLToPath } from 'node:url';
26
+ import { resolve, dirname } from 'node:path';
27
+ import { DynamicResolver } from '../lib/dynamic-resolver.js';
28
28
 
29
29
  // ── Catalog loader ───────────────────────────────────────────────────────────
30
30
 
31
- const __filename = fileURLToPath(import.meta.url)
32
- const __dirname = dirname(__filename)
31
+ const __filename = fileURLToPath(import.meta.url);
32
+ const __dirname = dirname(__filename);
33
33
 
34
34
  /**
35
35
  * Load and parse a JSON catalog file relative to the server directory.
@@ -39,17 +39,17 @@ const __dirname = dirname(__filename)
39
39
  * @returns {any} Parsed JSON content
40
40
  */
41
41
  function loadCatalog(relativePath) {
42
- const fullPath = resolve(__dirname, relativePath)
43
- let raw
42
+ const fullPath = resolve(__dirname, relativePath);
43
+ let raw;
44
44
  try {
45
- raw = readFileSync(fullPath, 'utf8')
45
+ raw = readFileSync(fullPath, 'utf8');
46
46
  } catch (err) {
47
- throw new Error(`Catalog file not found: ${fullPath}`)
47
+ throw new Error(`Catalog file not found: ${fullPath}`);
48
48
  }
49
49
  try {
50
- return JSON.parse(raw)
50
+ return JSON.parse(raw);
51
51
  } catch (err) {
52
- throw new Error(`Failed to parse catalog ${fullPath}: ${err.message}`)
52
+ throw new Error(`Failed to parse catalog ${fullPath}: ${err.message}`);
53
53
  }
54
54
  }
55
55
 
@@ -71,8 +71,8 @@ class ModelResolver extends DynamicResolver {
71
71
  * @param {object} options - { fields, limit, context }
72
72
  * @returns {Promise<object|null>} Model metadata or null
73
73
  */
74
- async fetchModelMetadata(modelId, options = {}) {
75
- throw new Error('fetchModelMetadata() must be implemented by subclass')
74
+ async fetchModelMetadata(modelId, _options = {}) {
75
+ throw new Error('fetchModelMetadata() must be implemented by subclass');
76
76
  }
77
77
 
78
78
  /**
@@ -80,17 +80,17 @@ class ModelResolver extends DynamicResolver {
80
80
  * @returns {string[]} e.g. ['hf:org/model'] for HuggingFace org/model pattern
81
81
  */
82
82
  supportedPatterns() {
83
- throw new Error('supportedPatterns() must be implemented by subclass')
83
+ throw new Error('supportedPatterns() must be implemented by subclass');
84
84
  }
85
85
 
86
86
  // ── DynamicResolver interface bridge ─────────────────────────────────
87
87
 
88
88
  async fetch(key, options = {}) {
89
- return this.fetchModelMetadata(key, options)
89
+ return this.fetchModelMetadata(key, options);
90
90
  }
91
91
 
92
92
  supportedKeys() {
93
- return this.supportedPatterns()
93
+ return this.supportedPatterns();
94
94
  }
95
95
  }
96
96
 
@@ -106,30 +106,30 @@ class ModelResolver extends DynamicResolver {
106
106
  */
107
107
  class StaticCatalogResolver extends ModelResolver {
108
108
  constructor(catalog) {
109
- super()
110
- this._catalog = catalog
109
+ super();
110
+ this._catalog = catalog;
111
111
  }
112
112
 
113
113
  supportedPatterns() {
114
- return ['*']
114
+ return ['*'];
115
115
  }
116
116
 
117
- async fetchModelMetadata(modelId, options = {}) {
117
+ async fetchModelMetadata(modelId, _options = {}) {
118
118
  // Exact match first
119
119
  if (this._catalog[modelId]) {
120
- return { ...this._catalog[modelId] }
120
+ return { ...this._catalog[modelId] };
121
121
  }
122
122
 
123
123
  // Glob pattern match (e.g., 'meta-llama/Llama-2-*')
124
124
  for (const [pattern, metadata] of Object.entries(this._catalog)) {
125
125
  if (pattern.includes('*') || pattern.includes('?')) {
126
126
  if (this._globMatch(modelId, pattern)) {
127
- return { ...metadata }
127
+ return { ...metadata };
128
128
  }
129
129
  }
130
130
  }
131
131
 
132
- return null
132
+ return null;
133
133
  }
134
134
 
135
135
  /**
@@ -142,9 +142,9 @@ class StaticCatalogResolver extends ModelResolver {
142
142
  */
143
143
  _globMatch(str, pattern) {
144
144
  const regex = new RegExp(
145
- '^' + pattern.replace(/\*/g, '.*').replace(/\?/g, '.') + '$'
146
- )
147
- return regex.test(str)
145
+ `^${ pattern.replace(/\*/g, '.*').replace(/\?/g, '.') }$`
146
+ );
147
+ return regex.test(str);
148
148
  }
149
149
  }
150
150
 
@@ -163,47 +163,47 @@ class StaticCatalogResolver extends ModelResolver {
163
163
  */
164
164
  class HuggingFaceResolver extends ModelResolver {
165
165
  constructor(options = {}) {
166
- super()
167
- this.baseUrl = options.baseUrl || 'https://huggingface.co'
168
- this.timeout = options.timeout || 5000
166
+ super();
167
+ this.baseUrl = options.baseUrl || 'https://huggingface.co';
168
+ this.timeout = options.timeout || 5000;
169
169
  }
170
170
 
171
171
  supportedPatterns() {
172
- return ['hf:*/*']
172
+ return ['hf:*/*'];
173
173
  }
174
174
 
175
175
  async fetchModelMetadata(modelId, options = {}) {
176
- const { fields } = options
177
- const metadata = {}
176
+ const { fields } = options;
177
+ const metadata = {};
178
178
 
179
179
  // Fetch model info (always)
180
180
  const modelInfo = await this._fetchJson(
181
181
  `${this.baseUrl}/api/models/${modelId}`
182
- )
182
+ );
183
183
  if (modelInfo) {
184
- metadata.tags = modelInfo.tags || []
185
- metadata.gated = modelInfo.gated || false
186
- metadata.pipeline_tag = modelInfo.pipeline_tag || null
184
+ metadata.tags = modelInfo.tags || [];
185
+ metadata.gated = modelInfo.gated || false;
186
+ metadata.pipeline_tag = modelInfo.pipeline_tag || null;
187
187
  }
188
188
 
189
189
  // Fetch tokenizer config (conditional)
190
190
  if (!fields || fields.includes('chat_template')) {
191
191
  const tokenizerConfig = await this._fetchJson(
192
192
  `${this.baseUrl}/${modelId}/resolve/main/tokenizer_config.json`
193
- )
194
- metadata.chat_template = tokenizerConfig?.chat_template || null
193
+ );
194
+ metadata.chat_template = tokenizerConfig?.chat_template || null;
195
195
  }
196
196
 
197
197
  // Fetch model config (conditional)
198
198
  if (!fields || fields.includes('architecture') || fields.includes('model_type')) {
199
199
  const modelConfig = await this._fetchJson(
200
200
  `${this.baseUrl}/${modelId}/resolve/main/config.json`
201
- )
202
- metadata.architecture = modelConfig?.architectures?.[0] || null
203
- metadata.model_type = modelConfig?.model_type || null
201
+ );
202
+ metadata.architecture = modelConfig?.architectures?.[0] || null;
203
+ metadata.model_type = modelConfig?.model_type || null;
204
204
  }
205
205
 
206
- return Object.keys(metadata).length > 0 ? metadata : null
206
+ return Object.keys(metadata).length > 0 ? metadata : null;
207
207
  }
208
208
 
209
209
  /**
@@ -214,26 +214,26 @@ class HuggingFaceResolver extends ModelResolver {
214
214
  * @returns {Promise<object|null>}
215
215
  */
216
216
  async _fetchJson(url) {
217
- const controller = new AbortController()
218
- const timer = setTimeout(() => controller.abort(), this.timeout)
217
+ const controller = new AbortController();
218
+ const timer = setTimeout(() => controller.abort(), this.timeout);
219
219
  try {
220
- const response = await fetch(url, { signal: controller.signal })
221
- clearTimeout(timer)
220
+ const response = await fetch(url, { signal: controller.signal });
221
+ clearTimeout(timer);
222
222
  if (response.status === 429) {
223
223
  process.stderr.write(
224
224
  `[model-picker] Rate limited: ${url}\n`
225
- )
226
- return null
225
+ );
226
+ return null;
227
227
  }
228
- if (response.status === 404) return null
229
- if (!response.ok) return null
230
- return await response.json()
228
+ if (response.status === 404) return null;
229
+ if (!response.ok) return null;
230
+ return await response.json();
231
231
  } catch (err) {
232
- clearTimeout(timer)
232
+ clearTimeout(timer);
233
233
  process.stderr.write(
234
234
  `[model-picker] Fetch failed: ${url} — ${err.message}\n`
235
- )
236
- return null
235
+ );
236
+ return null;
237
237
  }
238
238
  }
239
239
  }
@@ -253,7 +253,7 @@ const CREDENTIAL_ERROR_NAMES = new Set([
253
253
  'InvalidIdentityToken',
254
254
  'NoSuchTokenException',
255
255
  'UnrecognizedClientException'
256
- ])
256
+ ]);
257
257
 
258
258
  /**
259
259
  * JumpStartPublicResolver — fetches model metadata from the JumpStart public
@@ -270,16 +270,16 @@ const CREDENTIAL_ERROR_NAMES = new Set([
270
270
  */
271
271
  class JumpStartPublicResolver extends ModelResolver {
272
272
  constructor(options = {}) {
273
- super()
274
- this.timeout = options.timeout ?? 10000
275
- this.region = options.region || process.env.AWS_REGION || 'us-east-1'
276
- this._client = null
277
- this._sdkModule = null
278
- this._staticCatalog = options.staticCatalog || null
273
+ super();
274
+ this.timeout = options.timeout ?? 10000;
275
+ this.region = options.region || process.env.AWS_REGION || 'us-east-1';
276
+ this._client = null;
277
+ this._sdkModule = null;
278
+ this._staticCatalog = options.staticCatalog || null;
279
279
  }
280
280
 
281
281
  supportedPatterns() {
282
- return ['jumpstart://*']
282
+ return ['jumpstart://*'];
283
283
  }
284
284
 
285
285
  /**
@@ -297,61 +297,61 @@ class JumpStartPublicResolver extends ModelResolver {
297
297
  * @param {object} options - { fields, context }
298
298
  * @returns {Promise<object|null>} ModelMetadata or null
299
299
  */
300
- async fetchModelMetadata(modelId, options = {}) {
301
- const bareId = modelId.replace(/^jumpstart:\/\//, '')
300
+ async fetchModelMetadata(modelId, _options = {}) {
301
+ const bareId = modelId.replace(/^jumpstart:\/\//, '');
302
302
 
303
303
  try {
304
- const sdk = await this._loadSdk()
305
- const client = this._createClient(sdk)
304
+ const sdk = await this._loadSdk();
305
+ const client = this._createClient(sdk);
306
306
 
307
307
  // Fetch the manifest
308
308
  const manifestCmd = new sdk.GetObjectCommand({
309
309
  Bucket: this._bucketName(),
310
310
  Key: 'models_manifest.json'
311
- })
312
- const manifestResp = await client.send(manifestCmd)
313
- const manifestBody = await manifestResp.Body.transformToString()
314
- const manifest = JSON.parse(manifestBody)
311
+ });
312
+ const manifestResp = await client.send(manifestCmd);
313
+ const manifestBody = await manifestResp.Body.transformToString();
314
+ const manifest = JSON.parse(manifestBody);
315
315
 
316
316
  if (!Array.isArray(manifest) || manifest.length === 0) {
317
- return null
317
+ return null;
318
318
  }
319
319
 
320
320
  // List mode — return metadata from the first manifest entry
321
321
  if (!bareId || bareId === '*') {
322
- return this._mapToMetadata(manifest[0], manifest[0].model_id || '*')
322
+ return this._mapToMetadata(manifest[0], manifest[0].model_id || '*');
323
323
  }
324
324
 
325
325
  // Find the latest version entry for the requested model
326
- const entry = this._findLatestEntry(manifest, bareId)
326
+ const entry = this._findLatestEntry(manifest, bareId);
327
327
  if (!entry || !entry.spec_key) {
328
328
  process.stderr.write(
329
329
  `[jumpstart] Model not found in manifest: ${bareId}\n`
330
- )
331
- return this._fallbackToStaticCatalog(modelId)
330
+ );
331
+ return this._fallbackToStaticCatalog(modelId);
332
332
  }
333
333
 
334
334
  // Fetch the full spec using the spec_key from the manifest
335
335
  const specCmd = new sdk.GetObjectCommand({
336
336
  Bucket: this._bucketName(),
337
337
  Key: entry.spec_key
338
- })
339
- const specResp = await client.send(specCmd)
340
- const specBody = await specResp.Body.transformToString()
341
- const spec = JSON.parse(specBody)
342
- return this._mapToMetadata(spec, bareId)
338
+ });
339
+ const specResp = await client.send(specCmd);
340
+ const specBody = await specResp.Body.transformToString();
341
+ const spec = JSON.parse(specBody);
342
+ return this._mapToMetadata(spec, bareId);
343
343
  } catch (err) {
344
344
  if (this._isCredentialError(err)) {
345
345
  process.stderr.write(
346
- `[jumpstart] AWS credentials not available. Falling back to static catalog.\n`
347
- )
348
- return this._fallbackToStaticCatalog(modelId)
346
+ '[jumpstart] AWS credentials not available. Falling back to static catalog.\n'
347
+ );
348
+ return this._fallbackToStaticCatalog(modelId);
349
349
  }
350
350
 
351
351
  process.stderr.write(
352
352
  `[jumpstart] JumpStart S3 bucket unreachable: ${err.name || err.code || 'Unknown'}. Falling back to static catalog.\n`
353
- )
354
- return this._fallbackToStaticCatalog(modelId)
353
+ );
354
+ return this._fallbackToStaticCatalog(modelId);
355
355
  }
356
356
  }
357
357
 
@@ -369,7 +369,7 @@ class JumpStartPublicResolver extends ModelResolver {
369
369
  _findLatestEntry(manifest, bareId) {
370
370
  return manifest.find(e => e.model_id === bareId && !e.deprecated) ||
371
371
  manifest.find(e => e.model_id === bareId) ||
372
- null
372
+ null;
373
373
  }
374
374
 
375
375
  /**
@@ -378,9 +378,9 @@ class JumpStartPublicResolver extends ModelResolver {
378
378
  */
379
379
  async _loadSdk() {
380
380
  if (!this._sdkModule) {
381
- this._sdkModule = await import('@aws-sdk/client-s3')
381
+ this._sdkModule = await import('@aws-sdk/client-s3');
382
382
  }
383
- return this._sdkModule
383
+ return this._sdkModule;
384
384
  }
385
385
 
386
386
  /**
@@ -401,9 +401,9 @@ class JumpStartPublicResolver extends ModelResolver {
401
401
  requestTimeout: this.timeout
402
402
  },
403
403
  signer: { sign: async (request) => request }
404
- })
404
+ });
405
405
  }
406
- return this._client
406
+ return this._client;
407
407
  }
408
408
 
409
409
  /**
@@ -411,7 +411,7 @@ class JumpStartPublicResolver extends ModelResolver {
411
411
  * @returns {string} Bucket name
412
412
  */
413
413
  _bucketName() {
414
- return `jumpstart-cache-prod-${this.region}`
414
+ return `jumpstart-cache-prod-${this.region}`;
415
415
  }
416
416
 
417
417
  /**
@@ -428,58 +428,58 @@ class JumpStartPublicResolver extends ModelResolver {
428
428
  * @returns {object} ModelMetadata
429
429
  */
430
430
  _mapToMetadata(spec, bareId) {
431
- if (!spec) return null
431
+ if (!spec) return null;
432
432
 
433
- const modelId = spec.model_id || bareId
433
+ const modelId = spec.model_id || bareId;
434
434
  const metadata = {
435
435
  provider: 'jumpstart',
436
436
  modelId: `jumpstart://${modelId}`,
437
437
  description: this._humanReadableId(modelId)
438
- }
438
+ };
439
439
 
440
440
  // Extract framework from hosting_ecr_specs (full spec) or spec.framework
441
441
  const framework = spec.hosting_ecr_specs?.framework ||
442
442
  spec.hosting_ecr_specs?.Framework ||
443
- spec.framework
443
+ spec.framework;
444
444
  if (framework) {
445
- metadata.framework = framework
445
+ metadata.framework = framework;
446
446
  }
447
447
 
448
448
  // Extract tags from search_keywords or task-related fields
449
- const tags = []
449
+ const tags = [];
450
450
  if (Array.isArray(spec.search_keywords)) {
451
- tags.push(...spec.search_keywords)
451
+ tags.push(...spec.search_keywords);
452
452
  }
453
- if (spec.model_type) tags.push(spec.model_type)
454
- if (spec.inference_task) tags.push(spec.inference_task)
453
+ if (spec.model_type) tags.push(spec.model_type);
454
+ if (spec.inference_task) tags.push(spec.inference_task);
455
455
  if (tags.length > 0) {
456
- metadata.tags = [...new Set(tags)]
456
+ metadata.tags = [...new Set(tags)];
457
457
  }
458
458
 
459
459
  // Extract default instance type if available
460
460
  if (spec.default_inference_instance_type) {
461
- metadata.defaultInstanceType = spec.default_inference_instance_type
461
+ metadata.defaultInstanceType = spec.default_inference_instance_type;
462
462
  }
463
463
 
464
464
  // Extract supported instance types if available
465
465
  if (Array.isArray(spec.supported_inference_instance_types) &&
466
466
  spec.supported_inference_instance_types.length > 0) {
467
- metadata.supportedInstanceTypes = spec.supported_inference_instance_types
467
+ metadata.supportedInstanceTypes = spec.supported_inference_instance_types;
468
468
  }
469
469
 
470
470
  // Extract artifact URI from hosting artifact keys
471
471
  // Prefer hosting_prepacked_artifact_key (pre-packaged model ready for serving)
472
472
  // Fall back to hosting_artifact_key (raw model artifacts)
473
- const artifactKey = spec.hosting_prepacked_artifact_key || spec.hosting_artifact_key
473
+ const artifactKey = spec.hosting_prepacked_artifact_key || spec.hosting_artifact_key;
474
474
  if (artifactKey) {
475
- metadata.artifactUri = `s3://${this._bucketName()}/${artifactKey}`
475
+ metadata.artifactUri = `s3://${this._bucketName()}/${artifactKey}`;
476
476
  } else {
477
477
  process.stderr.write(
478
478
  `[jumpstart] No artifact key found for model ${modelId}. artifactUri will be undefined.\n`
479
- )
479
+ );
480
480
  }
481
481
 
482
- return metadata
482
+ return metadata;
483
483
  }
484
484
 
485
485
  /**
@@ -490,11 +490,11 @@ class JumpStartPublicResolver extends ModelResolver {
490
490
  * @returns {string} Title-cased, space-separated description
491
491
  */
492
492
  _humanReadableId(id) {
493
- if (!id) return ''
493
+ if (!id) return '';
494
494
  return id
495
495
  .split('-')
496
496
  .map(w => w.charAt(0).toUpperCase() + w.slice(1))
497
- .join(' ')
497
+ .join(' ');
498
498
  }
499
499
 
500
500
  /**
@@ -505,7 +505,7 @@ class JumpStartPublicResolver extends ModelResolver {
505
505
  _isCredentialError(err) {
506
506
  return CREDENTIAL_ERROR_NAMES.has(err.name) ||
507
507
  CREDENTIAL_ERROR_NAMES.has(err.Code) ||
508
- (err.message && err.message.includes('credentials'))
508
+ (err.message && err.message.includes('credentials'));
509
509
  }
510
510
 
511
511
  /**
@@ -515,9 +515,9 @@ class JumpStartPublicResolver extends ModelResolver {
515
515
  */
516
516
  _fallbackToStaticCatalog(modelId) {
517
517
  if (this._staticCatalog && this._staticCatalog[modelId]) {
518
- return { ...this._staticCatalog[modelId] }
518
+ return { ...this._staticCatalog[modelId] };
519
519
  }
520
- return null
520
+ return null;
521
521
  }
522
522
  }
523
523
 
@@ -543,15 +543,15 @@ class JumpStartPublicResolver extends ModelResolver {
543
543
  */
544
544
  class JumpStartPrivateResolver extends ModelResolver {
545
545
  constructor(options = {}) {
546
- super()
547
- this.timeout = options.timeout ?? 10000
548
- this.region = options.region || process.env.AWS_REGION || 'us-east-1'
549
- this._client = null
550
- this._sdkModule = null
546
+ super();
547
+ this.timeout = options.timeout ?? 10000;
548
+ this.region = options.region || process.env.AWS_REGION || 'us-east-1';
549
+ this._client = null;
550
+ this._sdkModule = null;
551
551
  }
552
552
 
553
553
  supportedPatterns() {
554
- return ['jumpstart-hub://*']
554
+ return ['jumpstart-hub://*'];
555
555
  }
556
556
 
557
557
  /**
@@ -561,20 +561,20 @@ class JumpStartPrivateResolver extends ModelResolver {
561
561
  * @returns {{ hubName: string, modelName: string } | null}
562
562
  */
563
563
  _parseHubUri(modelId) {
564
- const withoutPrefix = modelId.replace(/^jumpstart-hub:\/\//, '')
565
- if (!withoutPrefix) return null
564
+ const withoutPrefix = modelId.replace(/^jumpstart-hub:\/\//, '');
565
+ if (!withoutPrefix) return null;
566
566
 
567
- const slashIndex = withoutPrefix.indexOf('/')
567
+ const slashIndex = withoutPrefix.indexOf('/');
568
568
  if (slashIndex === -1) {
569
569
  // Only hub name, no model name — list mode
570
- return { hubName: withoutPrefix, modelName: null }
570
+ return { hubName: withoutPrefix, modelName: null };
571
571
  }
572
572
 
573
- const hubName = withoutPrefix.slice(0, slashIndex)
574
- const modelName = withoutPrefix.slice(slashIndex + 1) || null
573
+ const hubName = withoutPrefix.slice(0, slashIndex);
574
+ const modelName = withoutPrefix.slice(slashIndex + 1) || null;
575
575
 
576
- if (!hubName) return null
577
- return { hubName, modelName }
576
+ if (!hubName) return null;
577
+ return { hubName, modelName };
578
578
  }
579
579
 
580
580
  /**
@@ -584,20 +584,20 @@ class JumpStartPrivateResolver extends ModelResolver {
584
584
  * @param {object} options - { fields, context }
585
585
  * @returns {Promise<object|null>} ModelMetadata or null
586
586
  */
587
- async fetchModelMetadata(modelId, options = {}) {
588
- const parsed = this._parseHubUri(modelId)
587
+ async fetchModelMetadata(modelId, _options = {}) {
588
+ const parsed = this._parseHubUri(modelId);
589
589
  if (!parsed) {
590
590
  process.stderr.write(
591
591
  `[jumpstart-hub] Invalid hub URI: ${modelId}\n`
592
- )
593
- return null
592
+ );
593
+ return null;
594
594
  }
595
595
 
596
- const { hubName, modelName } = parsed
596
+ const { hubName, modelName } = parsed;
597
597
 
598
598
  try {
599
- const sdk = await this._loadSdk()
600
- const client = this._createClient(sdk)
599
+ const sdk = await this._loadSdk();
600
+ const client = this._createClient(sdk);
601
601
 
602
602
  // If a specific model is requested, describe it
603
603
  if (modelName) {
@@ -605,24 +605,24 @@ class JumpStartPrivateResolver extends ModelResolver {
605
605
  HubName: hubName,
606
606
  HubContentName: modelName,
607
607
  HubContentType: 'Model'
608
- })
609
- const response = await client.send(command)
610
- return this._mapToMetadata(response, hubName)
608
+ });
609
+ const response = await client.send(command);
610
+ return this._mapToMetadata(response, hubName);
611
611
  }
612
612
 
613
613
  // Otherwise list hub contents
614
614
  const command = new sdk.ListHubContentsCommand({
615
615
  HubName: hubName,
616
616
  HubContentType: 'Model'
617
- })
618
- const response = await client.send(command)
617
+ });
618
+ const response = await client.send(command);
619
619
  if (response.HubContentSummaries && response.HubContentSummaries.length > 0) {
620
- return this._mapToMetadata(response.HubContentSummaries[0], hubName)
620
+ return this._mapToMetadata(response.HubContentSummaries[0], hubName);
621
621
  }
622
622
 
623
- return null
623
+ return null;
624
624
  } catch (err) {
625
- return this._handleError(err, hubName, modelName)
625
+ return this._handleError(err, hubName, modelName);
626
626
  }
627
627
  }
628
628
 
@@ -632,9 +632,9 @@ class JumpStartPrivateResolver extends ModelResolver {
632
632
  */
633
633
  async _loadSdk() {
634
634
  if (!this._sdkModule) {
635
- this._sdkModule = await import('@aws-sdk/client-sagemaker')
635
+ this._sdkModule = await import('@aws-sdk/client-sagemaker');
636
636
  }
637
- return this._sdkModule
637
+ return this._sdkModule;
638
638
  }
639
639
 
640
640
  /**
@@ -651,9 +651,9 @@ class JumpStartPrivateResolver extends ModelResolver {
651
651
  requestHandler: {
652
652
  requestTimeout: this.timeout
653
653
  }
654
- })
654
+ });
655
655
  }
656
- return this._client
656
+ return this._client;
657
657
  }
658
658
 
659
659
  /**
@@ -664,35 +664,35 @@ class JumpStartPrivateResolver extends ModelResolver {
664
664
  * @returns {object} ModelMetadata
665
665
  */
666
666
  _mapToMetadata(apiResponse, hubName) {
667
- if (!apiResponse) return null
667
+ if (!apiResponse) return null;
668
668
 
669
- const contentName = apiResponse.HubContentName || apiResponse.HubContentDisplayName || ''
669
+ const contentName = apiResponse.HubContentName || apiResponse.HubContentDisplayName || '';
670
670
  const metadata = {
671
671
  provider: 'jumpstart-hub',
672
672
  modelId: `jumpstart-hub://${hubName}/${contentName}`,
673
673
  description: apiResponse.HubContentDescription || apiResponse.HubContentDisplayName || contentName,
674
674
  hubName
675
- }
675
+ };
676
676
 
677
677
  // Extract framework from hub content document schema or search keywords
678
678
  if (apiResponse.HubContentDocument) {
679
679
  try {
680
680
  const doc = typeof apiResponse.HubContentDocument === 'string'
681
681
  ? JSON.parse(apiResponse.HubContentDocument)
682
- : apiResponse.HubContentDocument
682
+ : apiResponse.HubContentDocument;
683
683
  if (doc.Framework) {
684
- metadata.framework = doc.Framework
684
+ metadata.framework = doc.Framework;
685
685
  }
686
686
  if (doc.ModelFormat) {
687
- metadata.modelFormat = doc.ModelFormat
687
+ metadata.modelFormat = doc.ModelFormat;
688
688
  }
689
689
  // artifactUri extraction (Requirement 1.2): extract from
690
690
  // HubContentDocument — check both ArtifactUri and HostingArtifactUri
691
691
  // as the field name varies by hub content document schema
692
692
  if (doc.ArtifactUri) {
693
- metadata.artifactUri = doc.ArtifactUri
693
+ metadata.artifactUri = doc.ArtifactUri;
694
694
  } else if (doc.HostingArtifactUri) {
695
- metadata.artifactUri = doc.HostingArtifactUri
695
+ metadata.artifactUri = doc.HostingArtifactUri;
696
696
  }
697
697
  } catch {
698
698
  // Ignore JSON parse errors in hub content document
@@ -701,10 +701,10 @@ class JumpStartPrivateResolver extends ModelResolver {
701
701
 
702
702
  // Extract tags from search keywords
703
703
  if (Array.isArray(apiResponse.HubContentSearchKeywords)) {
704
- metadata.tags = apiResponse.HubContentSearchKeywords
704
+ metadata.tags = apiResponse.HubContentSearchKeywords;
705
705
  }
706
706
 
707
- return metadata
707
+ return metadata;
708
708
  }
709
709
 
710
710
  /**
@@ -715,7 +715,7 @@ class JumpStartPrivateResolver extends ModelResolver {
715
715
  _isCredentialError(err) {
716
716
  return CREDENTIAL_ERROR_NAMES.has(err.name) ||
717
717
  CREDENTIAL_ERROR_NAMES.has(err.Code) ||
718
- (err.message && err.message.includes('credentials'))
718
+ (err.message && err.message.includes('credentials'));
719
719
  }
720
720
 
721
721
  /**
@@ -729,36 +729,36 @@ class JumpStartPrivateResolver extends ModelResolver {
729
729
  _handleError(err, hubName, modelName) {
730
730
  if (this._isCredentialError(err)) {
731
731
  process.stderr.write(
732
- `[jumpstart-hub] AWS credentials required for private hub access.\n`
733
- )
734
- return null
732
+ '[jumpstart-hub] AWS credentials required for private hub access.\n'
733
+ );
734
+ return null;
735
735
  }
736
736
 
737
737
  if (err.name === 'ResourceNotFoundException' || err.Code === 'ResourceNotFoundException') {
738
738
  if (modelName) {
739
739
  process.stderr.write(
740
740
  `[jumpstart-hub] Model not found in hub: ${hubName}/${modelName}\n`
741
- )
741
+ );
742
742
  } else {
743
743
  process.stderr.write(
744
744
  `[jumpstart-hub] Hub not found: ${hubName}\n`
745
- )
745
+ );
746
746
  }
747
- return null
747
+ return null;
748
748
  }
749
749
 
750
750
  if (err.name === 'AccessDeniedException' || err.Code === 'AccessDeniedException' ||
751
751
  err.$metadata?.httpStatusCode === 403) {
752
752
  process.stderr.write(
753
753
  `[jumpstart-hub] Access denied to hub: ${hubName}\n`
754
- )
755
- return null
754
+ );
755
+ return null;
756
756
  }
757
757
 
758
758
  process.stderr.write(
759
759
  `[jumpstart-hub] SageMaker API error: ${err.name || err.code || 'Unknown'}.\n`
760
- )
761
- return null
760
+ );
761
+ return null;
762
762
  }
763
763
  }
764
764
 
@@ -779,15 +779,15 @@ class JumpStartPrivateResolver extends ModelResolver {
779
779
  */
780
780
  class ModelRegistryResolver extends ModelResolver {
781
781
  constructor(options = {}) {
782
- super()
783
- this.timeout = options.timeout ?? 10000
784
- this.region = options.region || process.env.AWS_REGION || 'us-east-1'
785
- this._client = null
786
- this._sdkModule = null
782
+ super();
783
+ this.timeout = options.timeout ?? 10000;
784
+ this.region = options.region || process.env.AWS_REGION || 'us-east-1';
785
+ this._client = null;
786
+ this._sdkModule = null;
787
787
  }
788
788
 
789
789
  supportedPatterns() {
790
- return ['registry://*']
790
+ return ['registry://*'];
791
791
  }
792
792
 
793
793
  /**
@@ -797,20 +797,20 @@ class ModelRegistryResolver extends ModelResolver {
797
797
  * @returns {{ groupName: string, version: string|null } | null}
798
798
  */
799
799
  _parseRegistryUri(modelId) {
800
- const withoutPrefix = modelId.replace(/^registry:\/\//, '')
801
- if (!withoutPrefix) return null
800
+ const withoutPrefix = modelId.replace(/^registry:\/\//, '');
801
+ if (!withoutPrefix) return null;
802
802
 
803
- const slashIndex = withoutPrefix.indexOf('/')
803
+ const slashIndex = withoutPrefix.indexOf('/');
804
804
  if (slashIndex === -1) {
805
805
  // Only group name, no version — list mode
806
- return { groupName: withoutPrefix, version: null }
806
+ return { groupName: withoutPrefix, version: null };
807
807
  }
808
808
 
809
- const groupName = withoutPrefix.slice(0, slashIndex)
810
- const version = withoutPrefix.slice(slashIndex + 1) || null
809
+ const groupName = withoutPrefix.slice(0, slashIndex);
810
+ const version = withoutPrefix.slice(slashIndex + 1) || null;
811
811
 
812
- if (!groupName) return null
813
- return { groupName, version }
812
+ if (!groupName) return null;
813
+ return { groupName, version };
814
814
  }
815
815
 
816
816
  /**
@@ -820,42 +820,42 @@ class ModelRegistryResolver extends ModelResolver {
820
820
  * @param {object} options - { fields, context }
821
821
  * @returns {Promise<object|null>} ModelMetadata or null
822
822
  */
823
- async fetchModelMetadata(modelId, options = {}) {
824
- const parsed = this._parseRegistryUri(modelId)
823
+ async fetchModelMetadata(modelId, _options = {}) {
824
+ const parsed = this._parseRegistryUri(modelId);
825
825
  if (!parsed) {
826
826
  process.stderr.write(
827
827
  `[registry] Invalid registry URI: ${modelId}\n`
828
- )
829
- return null
828
+ );
829
+ return null;
830
830
  }
831
831
 
832
- const { groupName, version } = parsed
832
+ const { groupName, version } = parsed;
833
833
 
834
834
  try {
835
- const sdk = await this._loadSdk()
836
- const client = this._createClient(sdk)
835
+ const sdk = await this._loadSdk();
836
+ const client = this._createClient(sdk);
837
837
 
838
838
  // If a specific version is requested, describe that model package
839
839
  if (version) {
840
840
  const command = new sdk.DescribeModelPackageCommand({
841
841
  ModelPackageName: `${groupName}/${version}`
842
- })
843
- const response = await client.send(command)
844
- return this._mapToMetadata(response, groupName)
842
+ });
843
+ const response = await client.send(command);
844
+ return this._mapToMetadata(response, groupName);
845
845
  }
846
846
 
847
847
  // Otherwise list model packages in the group
848
848
  const command = new sdk.ListModelPackagesCommand({
849
849
  ModelPackageGroupName: groupName
850
- })
851
- const response = await client.send(command)
850
+ });
851
+ const response = await client.send(command);
852
852
  if (response.ModelPackageSummaryList && response.ModelPackageSummaryList.length > 0) {
853
- return this._mapToMetadata(response.ModelPackageSummaryList[0], groupName)
853
+ return this._mapToMetadata(response.ModelPackageSummaryList[0], groupName);
854
854
  }
855
855
 
856
- return null
856
+ return null;
857
857
  } catch (err) {
858
- return this._handleError(err, groupName)
858
+ return this._handleError(err, groupName);
859
859
  }
860
860
  }
861
861
 
@@ -865,9 +865,9 @@ class ModelRegistryResolver extends ModelResolver {
865
865
  */
866
866
  async _loadSdk() {
867
867
  if (!this._sdkModule) {
868
- this._sdkModule = await import('@aws-sdk/client-sagemaker')
868
+ this._sdkModule = await import('@aws-sdk/client-sagemaker');
869
869
  }
870
- return this._sdkModule
870
+ return this._sdkModule;
871
871
  }
872
872
 
873
873
  /**
@@ -884,9 +884,9 @@ class ModelRegistryResolver extends ModelResolver {
884
884
  requestHandler: {
885
885
  requestTimeout: this.timeout
886
886
  }
887
- })
887
+ });
888
888
  }
889
- return this._client
889
+ return this._client;
890
890
  }
891
891
 
892
892
  /**
@@ -897,52 +897,52 @@ class ModelRegistryResolver extends ModelResolver {
897
897
  * @returns {object} ModelMetadata
898
898
  */
899
899
  _mapToMetadata(apiResponse, groupName) {
900
- if (!apiResponse) return null
900
+ if (!apiResponse) return null;
901
901
 
902
902
  const metadata = {
903
903
  provider: 'registry',
904
904
  modelId: `registry://${groupName}`,
905
905
  description: apiResponse.ModelPackageDescription || `Model package group: ${groupName}`
906
- }
906
+ };
907
907
 
908
908
  // Model package ARN
909
909
  if (apiResponse.ModelPackageArn) {
910
- metadata.modelPackageArn = apiResponse.ModelPackageArn
910
+ metadata.modelPackageArn = apiResponse.ModelPackageArn;
911
911
  }
912
912
 
913
913
  // Group name
914
- metadata.modelPackageGroupName = apiResponse.ModelPackageGroupName || groupName
914
+ metadata.modelPackageGroupName = apiResponse.ModelPackageGroupName || groupName;
915
915
 
916
916
  // Version
917
917
  if (apiResponse.ModelPackageVersion !== undefined && apiResponse.ModelPackageVersion !== null) {
918
- metadata.modelPackageVersion = apiResponse.ModelPackageVersion
919
- metadata.modelId = `registry://${groupName}/${apiResponse.ModelPackageVersion}`
918
+ metadata.modelPackageVersion = apiResponse.ModelPackageVersion;
919
+ metadata.modelId = `registry://${groupName}/${apiResponse.ModelPackageVersion}`;
920
920
  }
921
921
 
922
922
  // Approval status
923
923
  if (apiResponse.ModelApprovalStatus) {
924
- metadata.approvalStatus = apiResponse.ModelApprovalStatus
924
+ metadata.approvalStatus = apiResponse.ModelApprovalStatus;
925
925
  }
926
926
 
927
927
  // artifactUri extraction (Requirement 1.3): extract from
928
928
  // InferenceSpecification.Containers[0].ModelDataUrl — the S3 URI
929
929
  // where the registered model package stores its inference artifacts
930
- const container = apiResponse.InferenceSpecification?.Containers?.[0]
930
+ const container = apiResponse.InferenceSpecification?.Containers?.[0];
931
931
  if (container) {
932
932
  if (container.Framework) {
933
- metadata.framework = container.Framework
933
+ metadata.framework = container.Framework;
934
934
  }
935
935
  if (container.ModelDataUrl) {
936
- metadata.artifactUri = container.ModelDataUrl
936
+ metadata.artifactUri = container.ModelDataUrl;
937
937
  }
938
938
  }
939
939
 
940
940
  // Fallback: top-level ModelDataUrl when InferenceSpecification is absent
941
941
  if (!metadata.artifactUri && apiResponse.ModelDataUrl) {
942
- metadata.artifactUri = apiResponse.ModelDataUrl
942
+ metadata.artifactUri = apiResponse.ModelDataUrl;
943
943
  }
944
944
 
945
- return metadata
945
+ return metadata;
946
946
  }
947
947
 
948
948
  /**
@@ -953,7 +953,7 @@ class ModelRegistryResolver extends ModelResolver {
953
953
  _isCredentialError(err) {
954
954
  return CREDENTIAL_ERROR_NAMES.has(err.name) ||
955
955
  CREDENTIAL_ERROR_NAMES.has(err.Code) ||
956
- (err.message && err.message.includes('credentials'))
956
+ (err.message && err.message.includes('credentials'));
957
957
  }
958
958
 
959
959
  /**
@@ -966,31 +966,31 @@ class ModelRegistryResolver extends ModelResolver {
966
966
  _handleError(err, groupName) {
967
967
  if (this._isCredentialError(err)) {
968
968
  process.stderr.write(
969
- `[registry] AWS credentials required for Model Registry access.\n`
970
- )
971
- return null
969
+ '[registry] AWS credentials required for Model Registry access.\n'
970
+ );
971
+ return null;
972
972
  }
973
973
 
974
974
  if (err.name === 'ResourceNotFoundException' || err.Code === 'ResourceNotFoundException' ||
975
975
  err.name === 'ValidationException') {
976
976
  process.stderr.write(
977
977
  `[registry] Model package group not found: ${groupName}\n`
978
- )
979
- return null
978
+ );
979
+ return null;
980
980
  }
981
981
 
982
982
  if (err.name === 'AccessDeniedException' || err.Code === 'AccessDeniedException' ||
983
983
  err.$metadata?.httpStatusCode === 403) {
984
984
  process.stderr.write(
985
985
  `[registry] Access denied to model package group: ${groupName}\n`
986
- )
987
- return null
986
+ );
987
+ return null;
988
988
  }
989
989
 
990
990
  process.stderr.write(
991
991
  `[registry] SageMaker API error: ${err.name || err.code || 'Unknown'}.\n`
992
- )
993
- return null
992
+ );
993
+ return null;
994
994
  }
995
995
  }
996
996
 
@@ -1012,15 +1012,15 @@ class ModelRegistryResolver extends ModelResolver {
1012
1012
  */
1013
1013
  class S3Resolver extends ModelResolver {
1014
1014
  constructor(options = {}) {
1015
- super()
1016
- this.timeout = options.timeout ?? 10000
1017
- this.region = options.region || process.env.AWS_REGION || 'us-east-1'
1018
- this._client = null
1019
- this._sdkModule = null
1015
+ super();
1016
+ this.timeout = options.timeout ?? 10000;
1017
+ this.region = options.region || process.env.AWS_REGION || 'us-east-1';
1018
+ this._client = null;
1019
+ this._sdkModule = null;
1020
1020
  }
1021
1021
 
1022
1022
  supportedPatterns() {
1023
- return ['s3://*']
1023
+ return ['s3://*'];
1024
1024
  }
1025
1025
 
1026
1026
  /**
@@ -1030,20 +1030,20 @@ class S3Resolver extends ModelResolver {
1030
1030
  * @param {object} options - { fields, context }
1031
1031
  * @returns {Promise<object|null>} ModelMetadata or null
1032
1032
  */
1033
- async fetchModelMetadata(modelId, options = {}) {
1034
- const parsed = parseS3Uri(modelId)
1033
+ async fetchModelMetadata(modelId, _options = {}) {
1034
+ const parsed = parseS3Uri(modelId);
1035
1035
  if (parsed.error) {
1036
1036
  process.stderr.write(
1037
1037
  `[s3] Invalid S3 URI: ${parsed.error}\n`
1038
- )
1039
- return null
1038
+ );
1039
+ return null;
1040
1040
  }
1041
1041
 
1042
- const { bucket, key } = parsed
1042
+ const { bucket, key } = parsed;
1043
1043
 
1044
1044
  try {
1045
- const sdk = await this._loadSdk()
1046
- const client = this._createClient(sdk)
1045
+ const sdk = await this._loadSdk();
1046
+ const client = this._createClient(sdk);
1047
1047
 
1048
1048
  // Try HeadObject first to check if it's a single file
1049
1049
  if (key && !key.endsWith('/')) {
@@ -1051,11 +1051,11 @@ class S3Resolver extends ModelResolver {
1051
1051
  const headCommand = new sdk.HeadObjectCommand({
1052
1052
  Bucket: bucket,
1053
1053
  Key: key
1054
- })
1055
- const headResponse = await client.send(headCommand)
1054
+ });
1055
+ const headResponse = await client.send(headCommand);
1056
1056
 
1057
1057
  const artifactType = key.endsWith('.tar.gz') || key.endsWith('.tgz')
1058
- ? 'tarball' : 'single-file'
1058
+ ? 'tarball' : 'single-file';
1059
1059
 
1060
1060
  const metadata = {
1061
1061
  provider: 's3',
@@ -1069,53 +1069,53 @@ class S3Resolver extends ModelResolver {
1069
1069
  artifactSizeBytes: headResponse.ContentLength ?? null,
1070
1070
  lastModified: headResponse.LastModified
1071
1071
  ? headResponse.LastModified.toISOString() : null
1072
- }
1072
+ };
1073
1073
 
1074
- return metadata
1074
+ return metadata;
1075
1075
  } catch (headErr) {
1076
1076
  // If it's a 404, the key might be a directory prefix — fall through to ListObjectsV2
1077
1077
  if (headErr.name !== 'NotFound' && headErr.$metadata?.httpStatusCode !== 404) {
1078
- throw headErr
1078
+ throw headErr;
1079
1079
  }
1080
1080
  }
1081
1081
  }
1082
1082
 
1083
1083
  // List objects under the key prefix (directory-style artifact)
1084
- const prefix = key ? (key.endsWith('/') ? key : key + '/') : ''
1084
+ const prefix = key ? (key.endsWith('/') ? key : `${key }/`) : '';
1085
1085
  const listCommand = new sdk.ListObjectsV2Command({
1086
1086
  Bucket: bucket,
1087
1087
  Prefix: prefix,
1088
1088
  MaxKeys: 1000
1089
- })
1090
- const listResponse = await client.send(listCommand)
1089
+ });
1090
+ const listResponse = await client.send(listCommand);
1091
1091
 
1092
1092
  if (!listResponse.Contents || listResponse.Contents.length === 0) {
1093
1093
  process.stderr.write(
1094
1094
  `[s3] Key not found: ${bucket}/${key}\n`
1095
- )
1096
- return null
1095
+ );
1096
+ return null;
1097
1097
  }
1098
1098
 
1099
1099
  // Calculate total size and find last modified
1100
- let totalSize = 0
1101
- let latestModified = null
1102
- const fileNames = []
1100
+ let totalSize = 0;
1101
+ let latestModified = null;
1102
+ const fileNames = [];
1103
1103
 
1104
1104
  for (const obj of listResponse.Contents) {
1105
- totalSize += obj.Size ?? 0
1105
+ totalSize += obj.Size ?? 0;
1106
1106
  if (obj.LastModified && (!latestModified || obj.LastModified > latestModified)) {
1107
- latestModified = obj.LastModified
1107
+ latestModified = obj.LastModified;
1108
1108
  }
1109
1109
  // Extract relative file name from the key
1110
- const relativeName = prefix ? obj.Key.slice(prefix.length) : obj.Key
1110
+ const relativeName = prefix ? obj.Key.slice(prefix.length) : obj.Key;
1111
1111
  if (relativeName) {
1112
- fileNames.push(relativeName)
1112
+ fileNames.push(relativeName);
1113
1113
  }
1114
1114
  }
1115
1115
 
1116
1116
  // Try to infer framework from config files
1117
- const configFiles = {}
1118
- const configFileNames = ['config.json', 'tokenizer_config.json', 'serving.properties']
1117
+ const configFiles = {};
1118
+ const configFileNames = ['config.json', 'tokenizer_config.json', 'serving.properties'];
1119
1119
 
1120
1120
  for (const cfgName of configFileNames) {
1121
1121
  if (fileNames.includes(cfgName)) {
@@ -1123,17 +1123,17 @@ class S3Resolver extends ModelResolver {
1123
1123
  const getCommand = new sdk.GetObjectCommand({
1124
1124
  Bucket: bucket,
1125
1125
  Key: prefix + cfgName
1126
- })
1127
- const getResponse = await client.send(getCommand)
1128
- const body = await getResponse.Body.transformToString()
1129
- configFiles[cfgName] = body
1126
+ });
1127
+ const getResponse = await client.send(getCommand);
1128
+ const body = await getResponse.Body.transformToString();
1129
+ configFiles[cfgName] = body;
1130
1130
  } catch {
1131
1131
  // Ignore errors reading individual config files
1132
1132
  }
1133
1133
  }
1134
1134
  }
1135
1135
 
1136
- const framework = this._inferFramework(configFiles)
1136
+ const framework = this._inferFramework(configFiles);
1137
1137
 
1138
1138
  const metadata = {
1139
1139
  provider: 's3',
@@ -1146,15 +1146,15 @@ class S3Resolver extends ModelResolver {
1146
1146
  artifactType: 'directory',
1147
1147
  artifactSizeBytes: totalSize,
1148
1148
  lastModified: latestModified ? latestModified.toISOString() : null
1149
- }
1149
+ };
1150
1150
 
1151
1151
  if (framework) {
1152
- metadata.framework = framework
1152
+ metadata.framework = framework;
1153
1153
  }
1154
1154
 
1155
- return metadata
1155
+ return metadata;
1156
1156
  } catch (err) {
1157
- return this._handleError(err, bucket, key, modelId)
1157
+ return this._handleError(err, bucket, key, modelId);
1158
1158
  }
1159
1159
  }
1160
1160
 
@@ -1168,12 +1168,12 @@ class S3Resolver extends ModelResolver {
1168
1168
  // Check config.json for HuggingFace transformer architectures
1169
1169
  if (configFiles['config.json']) {
1170
1170
  try {
1171
- const config = JSON.parse(configFiles['config.json'])
1171
+ const config = JSON.parse(configFiles['config.json']);
1172
1172
  if (config.architectures && Array.isArray(config.architectures) && config.architectures.length > 0) {
1173
- return 'huggingface'
1173
+ return 'huggingface';
1174
1174
  }
1175
1175
  if (config.model_type) {
1176
- return 'huggingface'
1176
+ return 'huggingface';
1177
1177
  }
1178
1178
  } catch {
1179
1179
  // Invalid JSON — skip
@@ -1183,8 +1183,8 @@ class S3Resolver extends ModelResolver {
1183
1183
  // Check tokenizer_config.json — presence implies HuggingFace
1184
1184
  if (configFiles['tokenizer_config.json']) {
1185
1185
  try {
1186
- JSON.parse(configFiles['tokenizer_config.json'])
1187
- return 'huggingface'
1186
+ JSON.parse(configFiles['tokenizer_config.json']);
1187
+ return 'huggingface';
1188
1188
  } catch {
1189
1189
  // Invalid JSON — skip
1190
1190
  }
@@ -1192,13 +1192,13 @@ class S3Resolver extends ModelResolver {
1192
1192
 
1193
1193
  // Check serving.properties for DJL serving configuration
1194
1194
  if (configFiles['serving.properties']) {
1195
- const content = configFiles['serving.properties']
1195
+ const content = configFiles['serving.properties'];
1196
1196
  if (content.includes('model_id') || content.includes('option.model_id')) {
1197
- return 'djl'
1197
+ return 'djl';
1198
1198
  }
1199
1199
  }
1200
1200
 
1201
- return null
1201
+ return null;
1202
1202
  }
1203
1203
 
1204
1204
  /**
@@ -1207,9 +1207,9 @@ class S3Resolver extends ModelResolver {
1207
1207
  */
1208
1208
  async _loadSdk() {
1209
1209
  if (!this._sdkModule) {
1210
- this._sdkModule = await import('@aws-sdk/client-s3')
1210
+ this._sdkModule = await import('@aws-sdk/client-s3');
1211
1211
  }
1212
- return this._sdkModule
1212
+ return this._sdkModule;
1213
1213
  }
1214
1214
 
1215
1215
  /**
@@ -1226,9 +1226,9 @@ class S3Resolver extends ModelResolver {
1226
1226
  requestHandler: {
1227
1227
  requestTimeout: this.timeout
1228
1228
  }
1229
- })
1229
+ });
1230
1230
  }
1231
- return this._client
1231
+ return this._client;
1232
1232
  }
1233
1233
 
1234
1234
  /**
@@ -1239,7 +1239,7 @@ class S3Resolver extends ModelResolver {
1239
1239
  _isCredentialError(err) {
1240
1240
  return CREDENTIAL_ERROR_NAMES.has(err.name) ||
1241
1241
  CREDENTIAL_ERROR_NAMES.has(err.Code) ||
1242
- (err.message && err.message.includes('credentials'))
1242
+ (err.message && err.message.includes('credentials'));
1243
1243
  }
1244
1244
 
1245
1245
  /**
@@ -1254,38 +1254,38 @@ class S3Resolver extends ModelResolver {
1254
1254
  _handleError(err, bucket, key, uri) {
1255
1255
  if (this._isCredentialError(err)) {
1256
1256
  process.stderr.write(
1257
- `[s3] AWS credentials required for S3 access.\n`
1258
- )
1259
- return null
1257
+ '[s3] AWS credentials required for S3 access.\n'
1258
+ );
1259
+ return null;
1260
1260
  }
1261
1261
 
1262
1262
  if (err.name === 'NoSuchBucket' || err.Code === 'NoSuchBucket') {
1263
1263
  process.stderr.write(
1264
1264
  `[s3] Bucket not found: ${bucket}\n`
1265
- )
1266
- return null
1265
+ );
1266
+ return null;
1267
1267
  }
1268
1268
 
1269
1269
  if (err.name === 'NoSuchKey' || err.Code === 'NoSuchKey' ||
1270
1270
  err.name === 'NotFound' || err.$metadata?.httpStatusCode === 404) {
1271
1271
  process.stderr.write(
1272
1272
  `[s3] Key not found: ${bucket}/${key}\n`
1273
- )
1274
- return null
1273
+ );
1274
+ return null;
1275
1275
  }
1276
1276
 
1277
1277
  if (err.name === 'AccessDenied' || err.Code === 'AccessDenied' ||
1278
1278
  err.$metadata?.httpStatusCode === 403) {
1279
1279
  process.stderr.write(
1280
1280
  `[s3] Access denied: ${uri}\n`
1281
- )
1282
- return null
1281
+ );
1282
+ return null;
1283
1283
  }
1284
1284
 
1285
1285
  process.stderr.write(
1286
1286
  `[s3] S3 API error: ${err.name || err.code || 'Unknown'}.\n`
1287
- )
1288
- return null
1287
+ );
1288
+ return null;
1289
1289
  }
1290
1290
  }
1291
1291
 
@@ -1301,8 +1301,8 @@ class S3Resolver extends ModelResolver {
1301
1301
  */
1302
1302
  class ResolverRegistry {
1303
1303
  constructor() {
1304
- this._resolvers = []
1305
- this._defaultResolver = null
1304
+ this._resolvers = [];
1305
+ this._defaultResolver = null;
1306
1306
  }
1307
1307
 
1308
1308
  /**
@@ -1311,7 +1311,7 @@ class ResolverRegistry {
1311
1311
  * @param {function(string): boolean} matchFn
1312
1312
  */
1313
1313
  register(resolver, matchFn) {
1314
- this._resolvers.push({ resolver, matchFn })
1314
+ this._resolvers.push({ resolver, matchFn });
1315
1315
  }
1316
1316
 
1317
1317
  /**
@@ -1319,7 +1319,7 @@ class ResolverRegistry {
1319
1319
  * @param {ModelResolver} resolver
1320
1320
  */
1321
1321
  setDefault(resolver) {
1322
- this._defaultResolver = resolver
1322
+ this._defaultResolver = resolver;
1323
1323
  }
1324
1324
 
1325
1325
  /**
@@ -1329,9 +1329,9 @@ class ResolverRegistry {
1329
1329
  */
1330
1330
  getResolver(modelId) {
1331
1331
  for (const { resolver, matchFn } of this._resolvers) {
1332
- if (matchFn(modelId)) return resolver
1332
+ if (matchFn(modelId)) return resolver;
1333
1333
  }
1334
- return this._defaultResolver
1334
+ return this._defaultResolver;
1335
1335
  }
1336
1336
  }
1337
1337
 
@@ -1346,18 +1346,18 @@ class ResolverRegistry {
1346
1346
  * @returns {object|null} Merged metadata, or null if both inputs are null
1347
1347
  */
1348
1348
  function mergeMetadata(liveData, staticData) {
1349
- if (!liveData && !staticData) return null
1350
- if (!liveData) return { ...staticData }
1351
- if (!staticData) return { ...liveData }
1349
+ if (!liveData && !staticData) return null;
1350
+ if (!liveData) return { ...staticData };
1351
+ if (!staticData) return { ...liveData };
1352
1352
 
1353
1353
  // Shallow merge: live takes precedence for non-null fields
1354
- const merged = { ...staticData }
1354
+ const merged = { ...staticData };
1355
1355
  for (const [key, value] of Object.entries(liveData)) {
1356
1356
  if (value !== null && value !== undefined) {
1357
- merged[key] = value
1357
+ merged[key] = value;
1358
1358
  }
1359
1359
  }
1360
- return merged
1360
+ return merged;
1361
1361
  }
1362
1362
 
1363
1363
  // ── S3 URI parsing ───────────────────────────────────────────────────────────
@@ -1366,7 +1366,7 @@ function mergeMetadata(liveData, staticData) {
1366
1366
  * Regex for valid S3 bucket names: 3–63 chars, lowercase letters/numbers/hyphens/periods,
1367
1367
  * no consecutive periods, not an IP address format.
1368
1368
  */
1369
- const S3_BUCKET_REGEX = /^(?!(\d{1,3}\.){3}\d{1,3}$)[a-z0-9]([a-z0-9.\-]*[a-z0-9])?$/
1369
+ const S3_BUCKET_REGEX = /^(?!(\d{1,3}\.){3}\d{1,3}$)[a-z0-9]([a-z0-9.-]*[a-z0-9])?$/;
1370
1370
 
1371
1371
  /**
1372
1372
  * Parse and validate an S3 URI into bucket and key components.
@@ -1383,38 +1383,38 @@ const S3_BUCKET_REGEX = /^(?!(\d{1,3}\.){3}\d{1,3}$)[a-z0-9]([a-z0-9.\-]*[a-z0-9
1383
1383
  */
1384
1384
  function parseS3Uri(uri) {
1385
1385
  if (typeof uri !== 'string') {
1386
- return { error: 'S3 URI must be a string' }
1386
+ return { error: 'S3 URI must be a string' };
1387
1387
  }
1388
1388
 
1389
1389
  if (!uri.startsWith('s3://')) {
1390
- return { error: 'S3 URI must start with s3://' }
1390
+ return { error: 'S3 URI must start with s3://' };
1391
1391
  }
1392
1392
 
1393
- const withoutPrefix = uri.slice(5) // strip 's3://'
1394
- const slashIndex = withoutPrefix.indexOf('/')
1395
- const bucket = slashIndex === -1 ? withoutPrefix : withoutPrefix.slice(0, slashIndex)
1396
- const key = slashIndex === -1 ? '' : withoutPrefix.slice(slashIndex + 1)
1393
+ const withoutPrefix = uri.slice(5); // strip 's3://'
1394
+ const slashIndex = withoutPrefix.indexOf('/');
1395
+ const bucket = slashIndex === -1 ? withoutPrefix : withoutPrefix.slice(0, slashIndex);
1396
+ const key = slashIndex === -1 ? '' : withoutPrefix.slice(slashIndex + 1);
1397
1397
 
1398
1398
  // Validate bucket name
1399
1399
  if (bucket.length === 0) {
1400
- return { error: 'Bucket name must not be empty' }
1400
+ return { error: 'Bucket name must not be empty' };
1401
1401
  }
1402
1402
  if (bucket.length < 3 || bucket.length > 63) {
1403
- return { error: `Bucket name must be 3–63 characters, got ${bucket.length}` }
1403
+ return { error: `Bucket name must be 3–63 characters, got ${bucket.length}` };
1404
1404
  }
1405
1405
  if (bucket.includes('..')) {
1406
- return { error: 'Bucket name must not contain consecutive periods' }
1406
+ return { error: 'Bucket name must not contain consecutive periods' };
1407
1407
  }
1408
1408
  if (!S3_BUCKET_REGEX.test(bucket)) {
1409
- return { error: `Invalid bucket name: ${bucket}` }
1409
+ return { error: `Invalid bucket name: ${bucket}` };
1410
1410
  }
1411
1411
 
1412
1412
  // Validate key length
1413
1413
  if (key.length > 1024) {
1414
- return { error: `Key must be ≤ 1024 characters, got ${key.length}` }
1414
+ return { error: `Key must be ≤ 1024 characters, got ${key.length}` };
1415
1415
  }
1416
1416
 
1417
- return { bucket, key }
1417
+ return { bucket, key };
1418
1418
  }
1419
1419
 
1420
1420
  /**
@@ -1425,54 +1425,54 @@ function parseS3Uri(uri) {
1425
1425
  * @returns {string} 's3://<bucket>/<key>'
1426
1426
  */
1427
1427
  function buildS3Uri(bucket, key) {
1428
- return `s3://${bucket}/${key}`
1428
+ return `s3://${bucket}/${key}`;
1429
1429
  }
1430
1430
 
1431
1431
  // ── Load catalogs ────────────────────────────────────────────────────────────
1432
1432
 
1433
- let POPULAR_MODELS_CATALOG
1433
+ let POPULAR_MODELS_CATALOG;
1434
1434
 
1435
1435
  try {
1436
1436
  POPULAR_MODELS_CATALOG = {
1437
1437
  ...loadCatalog('../lib/catalogs/models.json'),
1438
1438
  ...loadCatalog('../lib/catalogs/jumpstart-public.json')
1439
- }
1439
+ };
1440
1440
  } catch (err) {
1441
- process.stderr.write(`[model-picker] Fatal: ${err.message}\n`)
1442
- process.exit(1)
1441
+ process.stderr.write(`[model-picker] Fatal: ${err.message}\n`);
1442
+ process.exit(1);
1443
1443
  }
1444
1444
 
1445
1445
  // ── Wiring ───────────────────────────────────────────────────────────────────
1446
1446
 
1447
- const staticResolver = new StaticCatalogResolver(POPULAR_MODELS_CATALOG)
1448
- const hfResolver = new HuggingFaceResolver()
1449
- const jumpStartPublicResolver = new JumpStartPublicResolver()
1450
- const jumpStartPrivateResolver = new JumpStartPrivateResolver()
1451
- const modelRegistryResolver = new ModelRegistryResolver()
1452
- const s3Resolver = new S3Resolver()
1453
- const registry = new ResolverRegistry()
1447
+ const staticResolver = new StaticCatalogResolver(POPULAR_MODELS_CATALOG);
1448
+ const hfResolver = new HuggingFaceResolver();
1449
+ const jumpStartPublicResolver = new JumpStartPublicResolver();
1450
+ const jumpStartPrivateResolver = new JumpStartPrivateResolver();
1451
+ const modelRegistryResolver = new ModelRegistryResolver();
1452
+ const s3Resolver = new S3Resolver();
1453
+ const registry = new ResolverRegistry();
1454
1454
 
1455
1455
  registry.register(
1456
1456
  jumpStartPublicResolver,
1457
1457
  id => id.startsWith('jumpstart://')
1458
- )
1458
+ );
1459
1459
  registry.register(
1460
1460
  jumpStartPrivateResolver,
1461
1461
  id => id.startsWith('jumpstart-hub://')
1462
- )
1462
+ );
1463
1463
  registry.register(
1464
1464
  modelRegistryResolver,
1465
1465
  id => id.startsWith('registry://')
1466
- )
1466
+ );
1467
1467
  registry.register(
1468
1468
  s3Resolver,
1469
1469
  id => id.startsWith('s3://')
1470
- )
1470
+ );
1471
1471
  registry.register(
1472
1472
  hfResolver,
1473
1473
  id => /^[^/]+\/[^/]+$/.test(id) && !id.includes('://')
1474
- )
1475
- registry.setDefault(staticResolver)
1474
+ );
1475
+ registry.setDefault(staticResolver);
1476
1476
 
1477
1477
  // ── Choice formatting helpers ─────────────────────────────────────────────────
1478
1478
 
@@ -1485,7 +1485,7 @@ const PROVIDER_LABELS = {
1485
1485
  'registry': '[Registry]',
1486
1486
  's3': '[S3]',
1487
1487
  'huggingface': '[HuggingFace]'
1488
- }
1488
+ };
1489
1489
 
1490
1490
  /**
1491
1491
  * Format a model choice with a provider prefix label.
@@ -1494,12 +1494,12 @@ const PROVIDER_LABELS = {
1494
1494
  * @returns {string} Formatted choice string, e.g. '[JumpStart] huggingface-llm-falcon-7b'
1495
1495
  */
1496
1496
  function formatModelChoice(metadata) {
1497
- if (!metadata || !metadata.modelId) return ''
1498
- const label = PROVIDER_LABELS[metadata.provider]
1497
+ if (!metadata || !metadata.modelId) return '';
1498
+ const label = PROVIDER_LABELS[metadata.provider];
1499
1499
  if (label) {
1500
- return `${label} ${metadata.modelId}`
1500
+ return `${label} ${metadata.modelId}`;
1501
1501
  }
1502
- return metadata.modelId
1502
+ return metadata.modelId;
1503
1503
  }
1504
1504
 
1505
1505
  /**
@@ -1510,8 +1510,8 @@ function formatModelChoice(metadata) {
1510
1510
  * @returns {object[]} Filtered array containing only models whose `provider` matches
1511
1511
  */
1512
1512
  function filterByProvider(models, provider) {
1513
- if (!Array.isArray(models) || !provider) return models || []
1514
- return models.filter(m => m && m.provider === provider)
1513
+ if (!Array.isArray(models) || !provider) return models || [];
1514
+ return models.filter(m => m && m.provider === provider);
1515
1515
  }
1516
1516
 
1517
1517
  // ── Tool handler ─────────────────────────────────────────────────────────────
@@ -1528,67 +1528,67 @@ function filterByProvider(models, provider) {
1528
1528
  * @returns {Promise<{content: Array}>} MCP response
1529
1529
  */
1530
1530
  async function resolveModel({ model_id, fields, mode = 'discover', context }) {
1531
- let values = {}
1532
- let message = null
1531
+ let values = {};
1532
+ let message = null;
1533
1533
 
1534
1534
  // Reject deprecated JumpStart prefixes
1535
1535
  if (model_id.startsWith('jumpstart://') || model_id.startsWith('jumpstart-hub://')) {
1536
- const bareId = model_id.replace(/^jumpstart(-hub)?:\/\//, '')
1537
- message = `JumpStart is no longer supported. Use the HuggingFace model ID directly: ${bareId}`
1536
+ const bareId = model_id.replace(/^jumpstart(-hub)?:\/\//, '');
1537
+ message = `JumpStart is no longer supported. Use the HuggingFace model ID directly: ${bareId}`;
1538
1538
  return {
1539
1539
  content: [{
1540
1540
  type: 'text',
1541
1541
  text: JSON.stringify({ values: {}, choices: {}, message })
1542
1542
  }]
1543
- }
1543
+ };
1544
1544
  }
1545
1545
 
1546
1546
  if (mode === 'static') {
1547
1547
  // Static mode: use StaticCatalogResolver only
1548
- const metadata = await staticResolver.fetchModelMetadata(model_id, { fields })
1548
+ const metadata = await staticResolver.fetchModelMetadata(model_id, { fields });
1549
1549
  if (metadata) {
1550
- values = { ...metadata }
1550
+ values = { ...metadata };
1551
1551
  } else {
1552
- message = `Model not found in static catalog: ${model_id}`
1552
+ message = `Model not found in static catalog: ${model_id}`;
1553
1553
  }
1554
1554
  } else {
1555
1555
  // Discover mode: use ResolverRegistry for live data, merge with static
1556
- const resolver = registry.getResolver(model_id)
1557
- let liveData = null
1558
- let resolverFailed = false
1556
+ const resolver = registry.getResolver(model_id);
1557
+ let liveData = null;
1558
+ let resolverFailed = false;
1559
1559
 
1560
1560
  if (resolver) {
1561
- liveData = await resolver.fetchModelMetadata(model_id, { fields })
1561
+ liveData = await resolver.fetchModelMetadata(model_id, { fields });
1562
1562
  if (liveData === null) {
1563
- resolverFailed = true
1563
+ resolverFailed = true;
1564
1564
  }
1565
1565
  }
1566
1566
 
1567
- const staticData = await staticResolver.fetchModelMetadata(model_id, { fields })
1568
- const merged = mergeMetadata(liveData, staticData)
1567
+ const staticData = await staticResolver.fetchModelMetadata(model_id, { fields });
1568
+ const merged = mergeMetadata(liveData, staticData);
1569
1569
 
1570
1570
  if (merged) {
1571
- values = { ...merged }
1571
+ values = { ...merged };
1572
1572
  // If the resolver failed but we got data from static catalog, note the fallback
1573
1573
  if (resolverFailed && !liveData && staticData) {
1574
1574
  if (model_id.startsWith('registry://')) {
1575
- message = '[registry] SageMaker API unreachable. Using static catalog fallback.'
1575
+ message = '[registry] SageMaker API unreachable. Using static catalog fallback.';
1576
1576
  } else if (model_id.startsWith('s3://')) {
1577
- message = '[s3] S3 API unreachable. Using static catalog fallback.'
1577
+ message = '[s3] S3 API unreachable. Using static catalog fallback.';
1578
1578
  }
1579
1579
  }
1580
1580
  } else {
1581
1581
  // No data from either source
1582
1582
  if (resolverFailed) {
1583
1583
  if (model_id.startsWith('registry://')) {
1584
- message = `[registry] Resolver could not fetch data for: ${model_id}`
1584
+ message = `[registry] Resolver could not fetch data for: ${model_id}`;
1585
1585
  } else if (model_id.startsWith('s3://')) {
1586
- message = `[s3] Resolver could not fetch data for: ${model_id}`
1586
+ message = `[s3] Resolver could not fetch data for: ${model_id}`;
1587
1587
  } else {
1588
- message = `Model not found: ${model_id}`
1588
+ message = `Model not found: ${model_id}`;
1589
1589
  }
1590
1590
  } else {
1591
- message = `Model not found: ${model_id}`
1591
+ message = `Model not found: ${model_id}`;
1592
1592
  }
1593
1593
  }
1594
1594
  }
@@ -1596,40 +1596,40 @@ async function resolveModel({ model_id, fields, mode = 'discover', context }) {
1596
1596
  // Apply provider filter from context
1597
1597
  if (context && context.provider && Object.keys(values).length > 0) {
1598
1598
  if (values.provider && values.provider !== context.provider) {
1599
- message = `Model ${model_id} is from provider '${values.provider}', not '${context.provider}'`
1600
- values = {}
1599
+ message = `Model ${model_id} is from provider '${values.provider}', not '${context.provider}'`;
1600
+ values = {};
1601
1601
  }
1602
1602
  }
1603
1603
 
1604
1604
  // Filter fields if specified
1605
1605
  if (fields && fields.length > 0 && Object.keys(values).length > 0) {
1606
- const filtered = {}
1606
+ const filtered = {};
1607
1607
  for (const field of fields) {
1608
1608
  if (field in values) {
1609
- filtered[field] = values[field]
1609
+ filtered[field] = values[field];
1610
1610
  }
1611
1611
  }
1612
- values = filtered
1612
+ values = filtered;
1613
1613
  }
1614
1614
 
1615
1615
  // Exclude jumpstart:// prefixed results from output
1616
- const resolvedModelId = values.modelId || model_id
1616
+ const resolvedModelId = values.modelId || model_id;
1617
1617
  if (resolvedModelId.startsWith('jumpstart://') || resolvedModelId.startsWith('jumpstart-hub://')) {
1618
- const bareId = resolvedModelId.replace(/^jumpstart(-hub)?:\/\//, '')
1618
+ const bareId = resolvedModelId.replace(/^jumpstart(-hub)?:\/\//, '');
1619
1619
  return {
1620
1620
  content: [{
1621
1621
  type: 'text',
1622
1622
  text: JSON.stringify({ values: {}, choices: {}, message: `JumpStart is no longer supported. Use the HuggingFace model ID directly: ${bareId}` })
1623
1623
  }]
1624
- }
1624
+ };
1625
1625
  }
1626
1626
 
1627
1627
  // Build choices with provider prefix labels
1628
- const choices = {}
1628
+ const choices = {};
1629
1629
  if (Object.keys(values).length > 0) {
1630
- const choiceLabel = formatModelChoice(values)
1630
+ const choiceLabel = formatModelChoice(values);
1631
1631
  if (choiceLabel) {
1632
- choices[choiceLabel] = values.modelId || model_id
1632
+ choices[choiceLabel] = values.modelId || model_id;
1633
1633
  }
1634
1634
  }
1635
1635
 
@@ -1638,7 +1638,7 @@ async function resolveModel({ model_id, fields, mode = 'discover', context }) {
1638
1638
  type: 'text',
1639
1639
  text: JSON.stringify({ values, choices, message })
1640
1640
  }]
1641
- }
1641
+ };
1642
1642
  }
1643
1643
 
1644
1644
  // ── MCP Server ───────────────────────────────────────────────────────────────
@@ -1646,7 +1646,7 @@ async function resolveModel({ model_id, fields, mode = 'discover', context }) {
1646
1646
  const server = new McpServer({
1647
1647
  name: 'model-picker',
1648
1648
  version: '1.0.0'
1649
- })
1649
+ });
1650
1650
 
1651
1651
  server.tool(
1652
1652
  'get_models',
@@ -1663,7 +1663,7 @@ server.tool(
1663
1663
  )
1664
1664
  },
1665
1665
  async (params) => resolveModel(params)
1666
- )
1666
+ );
1667
1667
 
1668
1668
  // ── Exports for testing ──────────────────────────────────────────────────────
1669
1669
 
@@ -1691,14 +1691,14 @@ export {
1691
1691
  s3Resolver,
1692
1692
  registry,
1693
1693
  POPULAR_MODELS_CATALOG
1694
- }
1694
+ };
1695
1695
 
1696
1696
  // ── Main guard ───────────────────────────────────────────────────────────────
1697
1697
 
1698
- const isMain = process.argv[1] && resolve(process.argv[1]) === __filename
1698
+ const isMain = process.argv[1] && resolve(process.argv[1]) === __filename;
1699
1699
 
1700
1700
  if (isMain) {
1701
- process.stderr.write('[model-picker] Starting model-picker MCP server\n')
1702
- const transport = new StdioServerTransport()
1703
- await server.connect(transport)
1701
+ process.stderr.write('[model-picker] Starting model-picker MCP server\n');
1702
+ const transport = new StdioServerTransport();
1703
+ await server.connect(transport);
1704
1704
  }