@aifabrix/builder 2.56.0 → 2.58.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.
Files changed (74) hide show
  1. package/lib/agent-kit/session-report.js +76 -0
  2. package/lib/agent-kit/start.js +124 -57
  3. package/lib/agent-kit/tmux-sessions.js +163 -0
  4. package/lib/api/environments.api.js +38 -0
  5. package/lib/api/marketplace-bootstrap.api.js +31 -0
  6. package/lib/app/push.js +98 -41
  7. package/lib/build/standard-docker-build.js +13 -11
  8. package/lib/cli/setup-app.js +16 -5
  9. package/lib/cli/setup-dev-path-commands.js +49 -2
  10. package/lib/cli/setup-environment.js +89 -19
  11. package/lib/commands/agent-kit-help.js +32 -15
  12. package/lib/commands/agent-kit.js +90 -8
  13. package/lib/commands/dev-registry.js +155 -0
  14. package/lib/commands/dev-show-display.js +10 -2
  15. package/lib/commands/setup-image-refresh.js +26 -0
  16. package/lib/core/config-attach-extensions.js +4 -1
  17. package/lib/deployment/installation/azure-infra-stage.js +191 -0
  18. package/lib/deployment/installation/azure-preflight.js +147 -0
  19. package/lib/deployment/installation/azure-readiness.js +101 -0
  20. package/lib/deployment/installation/docker-register.js +112 -0
  21. package/lib/deployment/installation/environment-auth.js +76 -0
  22. package/lib/deployment/installation/environment-manifest.js +165 -0
  23. package/lib/deployment/installation/environment-stage.js +191 -0
  24. package/lib/deployment/installation/index.js +39 -0
  25. package/lib/deployment/installation/infra-catalog.js +211 -0
  26. package/lib/deployment/installation/infra-manifest.js +176 -0
  27. package/lib/deployment/installation/infra-projection.js +97 -0
  28. package/lib/deployment/installation/public-ip.js +65 -0
  29. package/lib/deployment/installation/registry-auth-mode.js +98 -0
  30. package/lib/deployment/installation/stage-input.js +184 -0
  31. package/lib/deployment/installation/stage-output.js +53 -0
  32. package/lib/deployment/installation/workspace-env.js +76 -0
  33. package/lib/deployment/installation/workspace-files.js +178 -0
  34. package/lib/deployment/installation/workspace-schema.js +40 -0
  35. package/lib/deployment/installation/workspace-secrets.js +66 -0
  36. package/lib/deployment/installation/workspace.js +128 -0
  37. package/lib/deployment/marketplace-environment.js +305 -0
  38. package/lib/generator/builders.js +12 -9
  39. package/lib/generator/helpers.js +55 -56
  40. package/lib/generator/split-variables.js +11 -5
  41. package/lib/internal/fs-real-sync.js +29 -0
  42. package/lib/role-assistant/package-validate.js +4 -0
  43. package/lib/role-assistant/test-runner-clarification-resubmit.js +149 -0
  44. package/lib/role-assistant/test-runner.js +14 -17
  45. package/lib/schema/application-schema.json +20 -2
  46. package/lib/schema/infra-parameter.schema.json +7 -0
  47. package/lib/schema/infra.parameter.yaml +26 -36
  48. package/lib/schema/infrastructure-schema.json +1531 -397
  49. package/lib/schema/installation-environment.schema.json +601 -0
  50. package/lib/utils/app-register-config.js +2 -4
  51. package/lib/utils/build-resolve-image.js +2 -21
  52. package/lib/utils/cli-utils.js +8 -1
  53. package/lib/utils/config-registry-preference.js +106 -0
  54. package/lib/utils/docker-build.js +53 -19
  55. package/lib/utils/env-map.js +23 -6
  56. package/lib/utils/image-tags.js +88 -0
  57. package/lib/utils/promote-dev-docker-image.js +6 -0
  58. package/lib/utils/registry-credentials.js +236 -0
  59. package/lib/utils/resolve-docker-image-ref.js +78 -9
  60. package/lib/utils/secrets-helpers.js +9 -1
  61. package/lib/utils/variable-transformer.js +5 -4
  62. package/lib/validation/required-variables.js +41 -0
  63. package/lib/validation/validator.js +8 -5
  64. package/package.json +6 -1
  65. package/templates/README.md +4 -0
  66. package/templates/agent-kit/instructions/AGENTKIT.md +6 -6
  67. package/templates/agent-kit/skills/shared/hosts.md +10 -10
  68. package/templates/applications/dataplane/application.yaml +1 -1
  69. package/templates/applications/dataplane/env.template +1 -1
  70. package/templates/applications/miso-controller/application.yaml +3 -2
  71. package/templates/applications/miso-controller/env.template +15 -6
  72. package/templates/marketplace/createUiDefinition.json +77 -0
  73. package/templates/marketplace/install.parameters.example.json +9 -0
  74. package/templates/marketplace/main.json +4087 -0
@@ -0,0 +1,601 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://raw.githubusercontent.com/esystemsdev/aifabrix-builder/refs/heads/main/lib/schema/installation-environment.schema.json",
4
+ "title": "AI Fabrix Installation Environment File",
5
+ "description": "Committed, non-secret infrastructure/<resource-group>/environment-dev|tst|pro.json. Inherited shared values name environment-infra.json as their source; request is the exact non-secret Miso deploy projection.",
6
+ "metadata": {
7
+ "key": "installation-environment-schema",
8
+ "name": "Installation Environment File Schema",
9
+ "description": "JSON schema for installation workspace environment-dev.json, environment-tst.json and environment-pro.json",
10
+ "version": "2.0.0",
11
+ "type": "schema",
12
+ "category": "infrastructure",
13
+ "author": "AI Fabrix Team",
14
+ "createdAt": "2026-09-16T00:00:00Z",
15
+ "updatedAt": "2026-09-16T00:00:00Z",
16
+ "compatibility": {
17
+ "minVersion": "2.0.0",
18
+ "maxVersion": "2.0.0",
19
+ "deprecated": false
20
+ },
21
+ "tags": [
22
+ "schema",
23
+ "environment",
24
+ "installation"
25
+ ],
26
+ "dependencies": [
27
+ "environment-deploy-request.schema.json"
28
+ ],
29
+ "changelog": [
30
+ {
31
+ "version": "2.0.0",
32
+ "date": "2026-09-16T00:00:00Z",
33
+ "breaking": false,
34
+ "changes": [
35
+ "Initial installation environment file schema"
36
+ ]
37
+ }
38
+ ]
39
+ },
40
+ "type": "object",
41
+ "additionalProperties": false,
42
+ "required": [
43
+ "schemaVersion",
44
+ "environment",
45
+ "name",
46
+ "preset",
47
+ "controllerUrl",
48
+ "serviceName",
49
+ "location",
50
+ "subscriptionId",
51
+ "resourceGroupName",
52
+ "networking",
53
+ "allowedIPs",
54
+ "infrastructureAccess",
55
+ "applications",
56
+ "variables",
57
+ "request",
58
+ "deployment"
59
+ ],
60
+ "properties": {
61
+ "schemaVersion": {
62
+ "const": "2.0.0"
63
+ },
64
+ "environment": {
65
+ "type": "object",
66
+ "required": [
67
+ "value",
68
+ "source",
69
+ "description"
70
+ ],
71
+ "additionalProperties": false,
72
+ "properties": {
73
+ "value": {
74
+ "enum": [
75
+ "dev",
76
+ "tst",
77
+ "pro"
78
+ ]
79
+ },
80
+ "source": {
81
+ "type": "string",
82
+ "minLength": 1
83
+ },
84
+ "description": {
85
+ "type": "string",
86
+ "minLength": 1
87
+ }
88
+ }
89
+ },
90
+ "name": {
91
+ "type": "object",
92
+ "required": [
93
+ "value",
94
+ "source",
95
+ "description"
96
+ ],
97
+ "additionalProperties": false,
98
+ "properties": {
99
+ "value": {
100
+ "type": "string",
101
+ "minLength": 1
102
+ },
103
+ "source": {
104
+ "type": "string",
105
+ "minLength": 1
106
+ },
107
+ "description": {
108
+ "type": "string",
109
+ "minLength": 1
110
+ }
111
+ }
112
+ },
113
+ "preset": {
114
+ "type": "object",
115
+ "required": [
116
+ "value",
117
+ "source",
118
+ "description"
119
+ ],
120
+ "additionalProperties": false,
121
+ "properties": {
122
+ "value": {
123
+ "enum": [
124
+ "s",
125
+ "m",
126
+ "l",
127
+ "xl"
128
+ ]
129
+ },
130
+ "source": {
131
+ "type": "string",
132
+ "minLength": 1
133
+ },
134
+ "description": {
135
+ "type": "string",
136
+ "minLength": 1
137
+ }
138
+ }
139
+ },
140
+ "controllerUrl": {
141
+ "type": "object",
142
+ "required": [
143
+ "value",
144
+ "source",
145
+ "description"
146
+ ],
147
+ "additionalProperties": false,
148
+ "properties": {
149
+ "value": {
150
+ "type": [
151
+ "string",
152
+ "null"
153
+ ],
154
+ "pattern": "^https://"
155
+ },
156
+ "source": {
157
+ "type": "string",
158
+ "minLength": 1
159
+ },
160
+ "description": {
161
+ "type": "string",
162
+ "minLength": 1
163
+ },
164
+ "valueFromEnv": {
165
+ "const": "CONTROLLER_URL"
166
+ }
167
+ }
168
+ },
169
+ "serviceName": {
170
+ "type": "object",
171
+ "required": [
172
+ "source",
173
+ "description"
174
+ ],
175
+ "additionalProperties": false,
176
+ "anyOf": [
177
+ {
178
+ "required": [
179
+ "value"
180
+ ]
181
+ },
182
+ {
183
+ "required": [
184
+ "inheritFrom"
185
+ ]
186
+ }
187
+ ],
188
+ "properties": {
189
+ "value": {
190
+ "type": "string",
191
+ "pattern": "^[a-z0-9-]{2,40}$"
192
+ },
193
+ "inheritFrom": {
194
+ "type": "string",
195
+ "pattern": "^[A-Za-z]+(\\.[A-Za-z]+)*$"
196
+ },
197
+ "source": {
198
+ "type": "string",
199
+ "minLength": 1
200
+ },
201
+ "description": {
202
+ "type": "string",
203
+ "minLength": 1
204
+ }
205
+ }
206
+ },
207
+ "location": {
208
+ "type": "object",
209
+ "required": [
210
+ "source",
211
+ "description"
212
+ ],
213
+ "additionalProperties": false,
214
+ "anyOf": [
215
+ {
216
+ "required": [
217
+ "value"
218
+ ]
219
+ },
220
+ {
221
+ "required": [
222
+ "inheritFrom"
223
+ ]
224
+ }
225
+ ],
226
+ "properties": {
227
+ "value": {
228
+ "type": "string",
229
+ "pattern": "^[a-z0-9]+$"
230
+ },
231
+ "inheritFrom": {
232
+ "type": "string",
233
+ "pattern": "^[A-Za-z]+(\\.[A-Za-z]+)*$"
234
+ },
235
+ "source": {
236
+ "type": "string",
237
+ "minLength": 1
238
+ },
239
+ "description": {
240
+ "type": "string",
241
+ "minLength": 1
242
+ }
243
+ }
244
+ },
245
+ "subscriptionId": {
246
+ "type": "object",
247
+ "required": [
248
+ "source",
249
+ "description"
250
+ ],
251
+ "additionalProperties": false,
252
+ "anyOf": [
253
+ {
254
+ "required": [
255
+ "value"
256
+ ]
257
+ },
258
+ {
259
+ "required": [
260
+ "inheritFrom"
261
+ ]
262
+ }
263
+ ],
264
+ "properties": {
265
+ "value": {
266
+ "type": "string",
267
+ "pattern": "^[0-9a-fA-F-]{36}$"
268
+ },
269
+ "inheritFrom": {
270
+ "type": "string",
271
+ "pattern": "^[A-Za-z]+(\\.[A-Za-z]+)*$"
272
+ },
273
+ "source": {
274
+ "type": "string",
275
+ "minLength": 1
276
+ },
277
+ "description": {
278
+ "type": "string",
279
+ "minLength": 1
280
+ }
281
+ }
282
+ },
283
+ "resourceGroupName": {
284
+ "type": "object",
285
+ "required": [
286
+ "value",
287
+ "source",
288
+ "description"
289
+ ],
290
+ "additionalProperties": false,
291
+ "properties": {
292
+ "value": {
293
+ "type": [
294
+ "string",
295
+ "null"
296
+ ],
297
+ "pattern": "^[a-zA-Z0-9._()-]{1,90}$"
298
+ },
299
+ "source": {
300
+ "type": "string",
301
+ "minLength": 1
302
+ },
303
+ "description": {
304
+ "type": "string",
305
+ "minLength": 1
306
+ }
307
+ }
308
+ },
309
+ "networking": {
310
+ "type": "object",
311
+ "required": [
312
+ "value",
313
+ "source",
314
+ "description"
315
+ ],
316
+ "additionalProperties": false,
317
+ "properties": {
318
+ "value": {
319
+ "type": "object"
320
+ },
321
+ "source": {
322
+ "type": "string",
323
+ "minLength": 1
324
+ },
325
+ "description": {
326
+ "type": "string",
327
+ "minLength": 1
328
+ }
329
+ }
330
+ },
331
+ "allowedIPs": {
332
+ "type": "object",
333
+ "required": [
334
+ "value",
335
+ "source",
336
+ "description"
337
+ ],
338
+ "additionalProperties": false,
339
+ "properties": {
340
+ "value": {
341
+ "type": "array",
342
+ "items": {
343
+ "type": "string"
344
+ }
345
+ },
346
+ "source": {
347
+ "type": "string",
348
+ "minLength": 1
349
+ },
350
+ "description": {
351
+ "type": "string",
352
+ "minLength": 1
353
+ }
354
+ }
355
+ },
356
+ "infrastructureAccess": {
357
+ "type": "object",
358
+ "required": [
359
+ "value",
360
+ "source",
361
+ "description"
362
+ ],
363
+ "additionalProperties": false,
364
+ "properties": {
365
+ "value": {
366
+ "type": "array",
367
+ "items": {
368
+ "type": "object"
369
+ }
370
+ },
371
+ "source": {
372
+ "type": "string",
373
+ "minLength": 1
374
+ },
375
+ "description": {
376
+ "type": "string",
377
+ "minLength": 1
378
+ }
379
+ }
380
+ },
381
+ "applications": {
382
+ "type": "object",
383
+ "required": [
384
+ "value",
385
+ "source",
386
+ "description"
387
+ ],
388
+ "additionalProperties": false,
389
+ "properties": {
390
+ "value": {
391
+ "type": "array",
392
+ "uniqueItems": true,
393
+ "items": {
394
+ "type": "string",
395
+ "pattern": "^[a-z0-9-]+$"
396
+ }
397
+ },
398
+ "source": {
399
+ "type": "string",
400
+ "minLength": 1
401
+ },
402
+ "description": {
403
+ "type": "string",
404
+ "minLength": 1
405
+ }
406
+ }
407
+ },
408
+ "variables": {
409
+ "type": "object",
410
+ "additionalProperties": false,
411
+ "patternProperties": {
412
+ "^[A-Z_][A-Z0-9_]*$": {
413
+ "type": "object",
414
+ "required": [
415
+ "valueFromEnv",
416
+ "requiredBy",
417
+ "source",
418
+ "description"
419
+ ],
420
+ "additionalProperties": false,
421
+ "properties": {
422
+ "valueFromEnv": {
423
+ "type": "string",
424
+ "pattern": "^[A-Z_][A-Z0-9_]*$"
425
+ },
426
+ "requiredBy": {
427
+ "type": "array",
428
+ "uniqueItems": true,
429
+ "items": {
430
+ "type": "string"
431
+ }
432
+ },
433
+ "source": {
434
+ "type": "string",
435
+ "minLength": 1
436
+ },
437
+ "description": {
438
+ "type": "string",
439
+ "minLength": 1
440
+ },
441
+ "resolution": {
442
+ "enum": [
443
+ "resolved",
444
+ "missing"
445
+ ]
446
+ }
447
+ }
448
+ }
449
+ }
450
+ },
451
+ "request": {
452
+ "type": "object",
453
+ "required": [
454
+ "value",
455
+ "source",
456
+ "description"
457
+ ],
458
+ "additionalProperties": false,
459
+ "properties": {
460
+ "value": {
461
+ "anyOf": [
462
+ {
463
+ "type": "null"
464
+ },
465
+ {
466
+ "type": "object",
467
+ "required": [
468
+ "environmentConfig"
469
+ ],
470
+ "additionalProperties": false,
471
+ "properties": {
472
+ "environmentConfig": {
473
+ "type": "object",
474
+ "additionalProperties": false,
475
+ "required": [
476
+ "key",
477
+ "environment",
478
+ "preset",
479
+ "serviceName",
480
+ "location",
481
+ "resourceGroupName",
482
+ "subscriptionId"
483
+ ],
484
+ "properties": {
485
+ "key": {
486
+ "type": "string"
487
+ },
488
+ "environment": {
489
+ "type": "string"
490
+ },
491
+ "preset": {
492
+ "type": "string"
493
+ },
494
+ "serviceName": {
495
+ "type": "string"
496
+ },
497
+ "location": {
498
+ "type": "string"
499
+ },
500
+ "resourceGroupName": {
501
+ "type": "string"
502
+ },
503
+ "subscriptionId": {
504
+ "type": "string"
505
+ }
506
+ }
507
+ }
508
+ }
509
+ }
510
+ ]
511
+ },
512
+ "source": {
513
+ "type": "string",
514
+ "minLength": 1
515
+ },
516
+ "description": {
517
+ "type": "string",
518
+ "minLength": 1
519
+ }
520
+ }
521
+ },
522
+ "deployment": {
523
+ "type": "object",
524
+ "required": [
525
+ "status",
526
+ "id"
527
+ ],
528
+ "additionalProperties": false,
529
+ "properties": {
530
+ "status": {
531
+ "type": "object",
532
+ "required": [
533
+ "value",
534
+ "source",
535
+ "description"
536
+ ],
537
+ "additionalProperties": false,
538
+ "properties": {
539
+ "value": {
540
+ "enum": [
541
+ "not-deployed",
542
+ "running",
543
+ "completed",
544
+ "failed",
545
+ "error",
546
+ "cancelled",
547
+ "timeout"
548
+ ]
549
+ },
550
+ "source": {
551
+ "type": "string",
552
+ "minLength": 1
553
+ },
554
+ "description": {
555
+ "type": "string",
556
+ "minLength": 1
557
+ }
558
+ }
559
+ },
560
+ "id": {
561
+ "type": "object",
562
+ "required": [
563
+ "value",
564
+ "source",
565
+ "description"
566
+ ],
567
+ "additionalProperties": false,
568
+ "properties": {
569
+ "value": {
570
+ "type": [
571
+ "string",
572
+ "null"
573
+ ]
574
+ },
575
+ "source": {
576
+ "type": "string",
577
+ "minLength": 1
578
+ },
579
+ "description": {
580
+ "type": "string",
581
+ "minLength": 1
582
+ }
583
+ }
584
+ },
585
+ "updatedAt": {
586
+ "type": [
587
+ "string",
588
+ "null"
589
+ ],
590
+ "format": "date-time"
591
+ },
592
+ "error": {
593
+ "type": [
594
+ "string",
595
+ "null"
596
+ ]
597
+ }
598
+ }
599
+ }
600
+ }
601
+ }
@@ -80,10 +80,8 @@ async function createMinimalAppIfNeeded(appKey, options) {
80
80
  * @returns {string} Image reference string
81
81
  */
82
82
  function buildImageReference(variables, appKey) {
83
- const imageName = variables.image?.name || variables.app?.key || appKey;
84
- const registry = variables.image?.registry;
85
- const tag = variables.image?.tag || 'latest';
86
- return registry ? `${registry}/${imageName}:${tag}` : `${imageName}:${tag}`;
83
+ const { buildManifestImageReference } = require('./resolve-docker-image-ref');
84
+ return buildManifestImageReference(variables, appKey);
87
85
  }
88
86
 
89
87
  /**
@@ -14,7 +14,8 @@ const { execWithDockerEnv } = require('./docker-exec');
14
14
  const { buildDevImageName, buildDevImageRepositoryPath } = require('./image-name');
15
15
  const {
16
16
  getRepositoryPathFromConfig,
17
- resolveDockerImageRef
17
+ resolveDockerImageRef,
18
+ stripRegistryHostFromRepository
18
19
  } = require('./resolve-docker-image-ref');
19
20
 
20
21
  /**
@@ -48,26 +49,6 @@ function repositoryTail(repoPath) {
48
49
  return parts[parts.length - 1] || repoPath;
49
50
  }
50
51
 
51
- /**
52
- * Remove registry host prefix from a Docker repository path (local build only).
53
- * @param {string} repository
54
- * @returns {string}
55
- */
56
- function stripRegistryHostFromRepository(repository) {
57
- if (!repository || typeof repository !== 'string') {
58
- return repository;
59
- }
60
- const parts = repository.split('/');
61
- if (parts.length <= 1) {
62
- return repository;
63
- }
64
- const host = parts[0];
65
- if (host.includes('.') || host.includes(':') || host === 'localhost') {
66
- return parts.slice(1).join('/');
67
- }
68
- return repository;
69
- }
70
-
71
52
  /**
72
53
  * Strip dev-scoped or -extra suffix from a Docker repository path.
73
54
  * @param {string} repo
@@ -198,6 +198,9 @@ function isAzureCliToolingError(errorMsg) {
198
198
  return false;
199
199
  }
200
200
 
201
+ /** Registry-credential and per-tag push errors that already name the host and the next step. */
202
+ const REGISTRY_ACTIONABLE_ERROR = /dev set-registry|Push failed for |No registry credentials are available/;
203
+
201
204
  /**
202
205
  * Format Azure-related errors
203
206
  * @param {string} errorMsg - Error message
@@ -221,6 +224,10 @@ function formatAzureError(errorMsg) {
221
224
  if (errorMsg.includes('Docker build failed') || errorMsg.includes('Build failed: Docker')) {
222
225
  return null;
223
226
  }
227
+ // Registry-credential and per-tag push errors already carry host-specific next steps.
228
+ if (REGISTRY_ACTIONABLE_ERROR.test(errorMsg)) {
229
+ return null;
230
+ }
224
231
  const lowerMsg = String(errorMsg || '').toLowerCase();
225
232
  const hasAcrDomain = /\b[a-z0-9.-]+\.azurecr\.io\b/i.test(errorMsg);
226
233
  const hasAcrKeyword = /\bacr\b/.test(lowerMsg);
@@ -238,7 +245,7 @@ function formatAzureError(errorMsg) {
238
245
  if (errorMsg.includes('Registry URL is required')) {
239
246
  return [
240
247
  ' Registry URL is required.',
241
- ' Provide via --registry flag or configure in application.yaml under image.registry'
248
+ ' Provide via --registry, set a default with aifabrix dev set-registry <host>, or configure image.registry in application.yaml'
242
249
  ];
243
250
  }
244
251
  return null;