@aifabrix/builder 2.51.1 → 2.52.1

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 (187) hide show
  1. package/jest.isolated-projects.js +25 -2
  2. package/jest.projects.js +4 -1
  3. package/lib/api/datasources-extended.api.js +8 -8
  4. package/lib/api/keycloak.api.js +92 -0
  5. package/lib/api/token-providers.api.js +77 -0
  6. package/lib/api/types/keycloak.types.js +23 -0
  7. package/lib/api/types/token-providers.types.js +65 -0
  8. package/lib/app/down.js +16 -1
  9. package/lib/app/run-container-start.js +4 -0
  10. package/lib/app/run-deploy-job.js +135 -27
  11. package/lib/app/run-env-compose.js +32 -0
  12. package/lib/app/run-env-recovery.js +35 -0
  13. package/lib/app/run-helpers.js +5 -6
  14. package/lib/app/run.js +11 -3
  15. package/lib/channels/add-channel.js +126 -19
  16. package/lib/channels/approval-guides/chatgpt.js +12 -9
  17. package/lib/channels/approval-guides/microsoft-copilot.js +16 -12
  18. package/lib/channels/channel-add-ensure.js +128 -0
  19. package/lib/channels/channel-artifact-generator.js +11 -1
  20. package/lib/channels/channel-branding.js +94 -0
  21. package/lib/channels/channel-credential.js +8 -0
  22. package/lib/channels/channel-discovery.js +330 -0
  23. package/lib/channels/channel-external-system.js +1 -1
  24. package/lib/channels/channel-runtime-resolver.js +103 -14
  25. package/lib/channels/channel-status-display.js +7 -1
  26. package/lib/channels/channel-targets.js +18 -1
  27. package/lib/channels/chatgpt-runtime-contract.js +1 -1
  28. package/lib/channels/microsoft-copilot-channel-add.js +138 -0
  29. package/lib/channels/microsoft-copilot-entra-sso-form.js +180 -0
  30. package/lib/channels/microsoft-copilot-entra-sso.js +264 -0
  31. package/lib/channels/microsoft-copilot-icons.js +74 -0
  32. package/lib/channels/microsoft-copilot-limits.js +84 -0
  33. package/lib/channels/microsoft-copilot-package.js +130 -49
  34. package/lib/channels/microsoft-copilot-validate.js +197 -0
  35. package/lib/cli/index.js +2 -0
  36. package/lib/cli/infra-guided-footers.js +1 -1
  37. package/lib/cli/infra-guided-public-url-warn.js +55 -0
  38. package/lib/cli/infra-guided.js +78 -62
  39. package/lib/cli/setup-app.help.js +4 -0
  40. package/lib/cli/setup-app.test-commands.js +59 -28
  41. package/lib/cli/setup-external-system.js +50 -12
  42. package/lib/cli/setup-infra.js +31 -4
  43. package/lib/commands/channel-add-setup.js +35 -10
  44. package/lib/commands/channel.js +27 -12
  45. package/lib/commands/deploy-gate-orchestrator.js +3 -2
  46. package/lib/commands/governance-verify-external.js +2 -5
  47. package/lib/commands/integration-definition.js +158 -0
  48. package/lib/commands/lifecycle-external.js +14 -7
  49. package/lib/commands/repair-auth-apply.js +19 -5
  50. package/lib/commands/repair-datasource-sync-operations.js +4 -1
  51. package/lib/commands/role-assistant-test-output.js +200 -0
  52. package/lib/commands/role-assistant.js +131 -114
  53. package/lib/commands/test-governance-external.js +2 -5
  54. package/lib/commands/up-miso.js +61 -24
  55. package/lib/commands/upload-data-sync-finalize.js +20 -3
  56. package/lib/commands/verify-governance-external.js +2 -5
  57. package/lib/commands/verify-operations-external.js +2 -5
  58. package/lib/commands/verify-operations-step-plan.js +31 -0
  59. package/lib/commands/verify-trust-command-action.js +2 -5
  60. package/lib/datasource/capability/capability-resolve.js +15 -5
  61. package/lib/datasource/capability/copy-operations.js +14 -4
  62. package/lib/datasource/datasource-identifier.js +4 -3
  63. package/lib/datasource/integration-context.js +3 -3
  64. package/lib/datasource/resolve-app.js +90 -8
  65. package/lib/datasource/test-e2e.js +2 -2
  66. package/lib/datasource/unified-validation-run-body.js +15 -1
  67. package/lib/datasource/unified-validation-run-resolve.js +2 -2
  68. package/lib/external-system/deploy-helpers.js +9 -5
  69. package/lib/external-system/deploy.js +2 -1
  70. package/lib/external-system/test-system-level.js +21 -3
  71. package/lib/external-system/test.js +4 -4
  72. package/lib/generator/builders.js +9 -15
  73. package/lib/infrastructure/index.js +19 -4
  74. package/lib/integration-definition/apply.js +478 -0
  75. package/lib/integration-definition/canonical-json.js +51 -0
  76. package/lib/integration-definition/emit-suite-bid.js +94 -0
  77. package/lib/integration-definition/enrich-crm-field-mappings.js +240 -0
  78. package/lib/integration-definition/enrich-openapi-operations.js +434 -0
  79. package/lib/integration-definition/from-discovery.js +339 -0
  80. package/lib/integration-definition/hash.js +37 -0
  81. package/lib/integration-definition/index.js +37 -0
  82. package/lib/integration-definition/openapi-enrichment/hubspot-crm-companies.json +205 -0
  83. package/lib/integration-definition/resource-type-catalog.js +59 -0
  84. package/lib/integration-definition/system-kind-enum.js +40 -0
  85. package/lib/integration-definition/validate.js +148 -0
  86. package/lib/programmatic/builder-api-request.js +5 -1
  87. package/lib/programmatic/builder-help-governance.js +3 -2
  88. package/lib/programmatic/capability-registry.js +19 -0
  89. package/lib/programmatic/openapi-component-schemas.js +6 -1
  90. package/lib/programmatic/openapi-descriptions.js +40 -0
  91. package/lib/programmatic/openapi-envelope-examples.js +269 -0
  92. package/lib/programmatic/openapi-operation-bindings.js +45 -0
  93. package/lib/programmatic/openapi-request-schemas.js +14 -0
  94. package/lib/programmatic/openapi-result-schemas-overflow.js +101 -0
  95. package/lib/programmatic/openapi-result-schemas.js +46 -99
  96. package/lib/programmatic/openapi-schema-descriptions-core.js +7 -4
  97. package/lib/programmatic/openapi-schema-descriptions-help.js +1 -1
  98. package/lib/programmatic/openapi-schema-descriptions-operations.js +24 -0
  99. package/lib/programmatic/openapi-schema-helpers.js +9 -9
  100. package/lib/programmatic/openapi-spec.js +11 -1
  101. package/lib/programmatic/orchestration-openapi-meta.js +10 -0
  102. package/lib/programmatic/route-handler-map.js +29 -1
  103. package/lib/programmatic/run-channel-package.js +236 -0
  104. package/lib/programmatic/run-integration-definition.js +69 -0
  105. package/lib/role-assistant/knowledge-markdown-frontmatter.js +75 -0
  106. package/lib/role-assistant/knowledge-sync-logging.js +58 -0
  107. package/lib/role-assistant/knowledge-sync.js +104 -89
  108. package/lib/role-assistant/test-cases-bid.js +155 -0
  109. package/lib/role-assistant/test-cases-evaluate.js +9 -1
  110. package/lib/role-assistant/test-cases-honesty.js +24 -10
  111. package/lib/role-assistant/test-cases.js +28 -0
  112. package/lib/role-assistant/test-runner-bid-apply.js +122 -0
  113. package/lib/role-assistant/test-runner-bid-document.js +278 -0
  114. package/lib/role-assistant/test-runner-workhub-answers.js +289 -46
  115. package/lib/role-assistant/test-runner-workhub.js +121 -25
  116. package/lib/role-assistant/test-suite.js +119 -0
  117. package/lib/schema/application-schema.json +64 -32
  118. package/lib/schema/external-datasource.schema.json +103 -17
  119. package/lib/schema/external-system.schema.json +54 -3
  120. package/lib/schema/infra.parameter.yaml +0 -20
  121. package/lib/schema/integration-definition.schema.json +195 -0
  122. package/lib/utils/authentication-shape.js +6 -0
  123. package/lib/utils/certify-external-workspace.js +40 -0
  124. package/lib/utils/docker-build.js +3 -3
  125. package/lib/utils/docker-run-ephemeral.js +77 -17
  126. package/lib/utils/health-check-public-warn.js +31 -13
  127. package/lib/utils/health-check.js +11 -1
  128. package/lib/utils/help-builder.js +1 -0
  129. package/lib/utils/paths.js +13 -15
  130. package/lib/utils/promote-dev-docker-image.js +97 -18
  131. package/lib/utils/role-assistant-paths.js +76 -14
  132. package/lib/utils/transient-developer-id.js +28 -0
  133. package/lib/utils/upload-sync-options.js +7 -4
  134. package/lib/validation/reserved-system-key-prefixes.js +56 -0
  135. package/lib/validation/validate.js +54 -19
  136. package/package.json +1 -1
  137. package/scripts/pnpm/af.mjs +24 -9
  138. package/scripts/pnpm/help.mjs +1 -1
  139. package/templates/applications/builder-api/application.yaml +3 -3
  140. package/templates/applications/dataplane/application.yaml +5 -5
  141. package/templates/applications/dataplane/env.template +8 -7
  142. package/templates/applications/dataplane/rbac.yaml +10 -10
  143. package/templates/applications/keycloak/application.yaml +2 -2
  144. package/templates/applications/keycloak/env.template +5 -2
  145. package/templates/applications/miso-controller/application.yaml +25 -11
  146. package/templates/applications/miso-controller/env.template +24 -5
  147. package/templates/channels/README.md +11 -1
  148. package/templates/channels/brand/color-192.png +0 -0
  149. package/templates/channels/brand/dark/128.png +0 -0
  150. package/templates/channels/brand/dark/192.png +0 -0
  151. package/templates/channels/brand/dark/256.png +0 -0
  152. package/templates/channels/brand/dark/32.png +0 -0
  153. package/templates/channels/brand/dark/512.png +0 -0
  154. package/templates/channels/brand/dark/64.png +0 -0
  155. package/templates/channels/brand/light/128.png +0 -0
  156. package/templates/channels/brand/light/192.png +0 -0
  157. package/templates/channels/brand/light/256.png +0 -0
  158. package/templates/channels/brand/light/32.png +0 -0
  159. package/templates/channels/brand/light/512.png +0 -0
  160. package/templates/channels/brand/light/64.png +0 -0
  161. package/templates/channels/brand/mono-white/128.png +0 -0
  162. package/templates/channels/brand/mono-white/192.png +0 -0
  163. package/templates/channels/brand/mono-white/256.png +0 -0
  164. package/templates/channels/brand/mono-white/32.png +0 -0
  165. package/templates/channels/brand/mono-white/512.png +0 -0
  166. package/templates/channels/brand/mono-white/64.png +0 -0
  167. package/templates/channels/brand/outline-32.png +0 -0
  168. package/templates/channels/chatgpt/install.template.md.hbs +76 -36
  169. package/templates/channels/chatgpt/integration/README.md +4 -4
  170. package/templates/channels/chatgpt/integration/chatgpt-system.json +1 -16
  171. package/templates/channels/chatgpt/manifest.template.json.hbs +3 -3
  172. package/templates/channels/microsoft-copilot/ai-plugin.template.json.hbs +10 -16
  173. package/templates/channels/microsoft-copilot/declarative-agent.template.json.hbs +5 -3
  174. package/templates/channels/microsoft-copilot/entra-sso-registration.template.md.hbs +27 -0
  175. package/templates/channels/microsoft-copilot/install.template.md.hbs +39 -20
  176. package/templates/channels/microsoft-copilot/integration/README.md +2 -3
  177. package/templates/channels/microsoft-copilot/integration/microsoft-copilot-system.json +1 -22
  178. package/templates/channels/microsoft-copilot/manifest.template.json.hbs +7 -7
  179. package/templates/channels/microsoft-copilot/oauth-plugin-vault-required.template.md.hbs +11 -0
  180. package/templates/channels/slack/install.template.md.hbs +6 -1
  181. package/templates/channels/slack/integration/README.md +2 -4
  182. package/templates/channels/teams-bot/install.template.md.hbs +4 -0
  183. package/templates/channels/teams-bot/integration/README.md +3 -5
  184. package/templates/channels/web-embed/integration/web-embed-system.json +1 -16
  185. package/templates/python/docker-compose.hbs +10 -0
  186. package/templates/typescript/docker-compose.hbs +10 -0
  187. /package/.cursor/plans/{Done → Archive}/157.1-security-quality-violations-by-type.csv +0 -0
@@ -66,6 +66,20 @@ const OPENAPI_REQUEST_SCHEMAS = {
66
66
  },
67
67
  ['appName', 'source']
68
68
  ),
69
+ IntegrationDefinitionApplyRequest: frozenObject({
70
+ integrationDefinition: {
71
+ type: 'object',
72
+ additionalProperties: true,
73
+ description: 'Builder Integration Definition (aifabrix.builder.integrationDefinition).'
74
+ },
75
+ bid: {
76
+ type: 'object',
77
+ additionalProperties: true,
78
+ description: 'Alias for integrationDefinition.'
79
+ },
80
+ force: { type: 'boolean' },
81
+ dryRun: { type: 'boolean' }
82
+ }),
69
83
  RepairRequest: frozenObject({
70
84
  dryRun: { type: 'boolean' },
71
85
  auth: { type: 'string' },
@@ -0,0 +1,101 @@
1
+ 'use strict';
2
+
3
+ const { frozenObject, schemaRef } = require('./openapi-schema-helpers');
4
+
5
+ const OPENAPI_RESULT_SCHEMA_OVERFLOW = {
6
+ LifecycleRunStep: frozenObject(
7
+ {
8
+ pillar: { type: 'string' },
9
+ success: { type: 'boolean' },
10
+ error: { type: 'string' }
11
+ },
12
+ ['pillar', 'success']
13
+ ),
14
+ LifecycleRunReport: frozenObject(
15
+ {
16
+ systemKey: schemaRef('SystemKey'),
17
+ certification: schemaRef('CertificationSummary')
18
+ },
19
+ ['systemKey']
20
+ ),
21
+ CertifyLifecycleRunResultData: frozenObject(
22
+ {
23
+ report: schemaRef('LifecycleRunReport'),
24
+ stepsRun: { type: 'array', items: schemaRef('LifecycleRunStep') }
25
+ },
26
+ ['report']
27
+ ),
28
+ CertifyResultData: {
29
+ oneOf: [
30
+ schemaRef('CertifyOperationsResultData'),
31
+ schemaRef('CertifyTrustResultData'),
32
+ schemaRef('CertifyGovernanceResultData'),
33
+ schemaRef('CertifyLifecycleRunResultData')
34
+ ]
35
+ },
36
+ LifecycleReportData: frozenObject(
37
+ {
38
+ systemKey: schemaRef('SystemKey'),
39
+ certification: schemaRef('CertificationSummary'),
40
+ operationalReadinessPercent: { type: 'number' },
41
+ summary: { type: 'boolean' },
42
+ details: { type: 'boolean' }
43
+ },
44
+ ['systemKey']
45
+ ),
46
+ EnterpriseMcpToolOutput: frozenObject({
47
+ success: { type: 'boolean' },
48
+ status: { type: 'string' },
49
+ message: { type: 'string' },
50
+ branch: { type: 'string' },
51
+ pullRequestUrl: { type: 'string', format: 'uri' },
52
+ syncDirection: schemaRef('RepositorySyncDirection'),
53
+ commitSha: { type: 'string' },
54
+ workflowRunId: { type: 'string' }
55
+ }),
56
+ WorkspaceRemoteUnavailable: frozenObject(
57
+ {
58
+ unavailable: { type: 'boolean', enum: [true] },
59
+ message: { type: 'string' }
60
+ },
61
+ ['unavailable', 'message']
62
+ ),
63
+ WorkspaceRemoteStatus: {
64
+ oneOf: [
65
+ schemaRef('EnterpriseMcpToolOutput'),
66
+ schemaRef('WorkspaceRemoteUnavailable'),
67
+ { type: 'null' }
68
+ ]
69
+ },
70
+ EnterpriseMcpInvocationData: frozenObject(
71
+ {
72
+ capabilityKey: { type: 'string' },
73
+ result: schemaRef('EnterpriseMcpToolOutput')
74
+ },
75
+ ['capabilityKey', 'result']
76
+ ),
77
+ WorkspaceStatusData: frozenObject(
78
+ {
79
+ local: schemaRef('SystemManifestData'),
80
+ remote: schemaRef('WorkspaceRemoteStatus')
81
+ },
82
+ ['local', 'remote']
83
+ ),
84
+ RepositoryStatusData: frozenObject(
85
+ {
86
+ capabilityKey: { type: 'string', enum: ['repository.status'] },
87
+ result: schemaRef('EnterpriseMcpToolOutput')
88
+ },
89
+ ['capabilityKey', 'result']
90
+ ),
91
+ HealthData: frozenObject({ status: { type: 'string', enum: ['ok'] } }, ['status']),
92
+ ReadyData: frozenObject(
93
+ {
94
+ status: { type: 'string', enum: ['ready'] },
95
+ dataplaneUrl: { type: ['string', 'null'], format: 'uri' }
96
+ },
97
+ ['status']
98
+ )
99
+ };
100
+
101
+ module.exports = { OPENAPI_RESULT_SCHEMA_OVERFLOW };
@@ -9,6 +9,7 @@
9
9
  'use strict';
10
10
 
11
11
  const { frozenObject, schemaRef, stringArraySchema } = require('./openapi-schema-helpers');
12
+ const { OPENAPI_RESULT_SCHEMA_OVERFLOW } = require('./openapi-result-schemas-overflow');
12
13
 
13
14
  /** @type {Record<string, Object>} */
14
15
  const OPENAPI_RESULT_SCHEMAS = {
@@ -19,9 +20,9 @@ const OPENAPI_RESULT_SCHEMAS = {
19
20
  title: { type: 'string' },
20
21
  status: { type: 'integer', minimum: 100, maximum: 599 },
21
22
  detail: { type: 'string' },
22
- instance: { type: 'string' },
23
+ instance: { type: 'string', format: 'uri' },
23
24
  correlationId: { type: 'string' },
24
- errors: { type: 'array', items: schemaRef('ProblemValidationError') }
25
+ errors: { type: 'array', items: schemaRef('ValidationError') }
25
26
  },
26
27
  ['type', 'title', 'status', 'detail', 'correlationId', 'instance', 'errors']
27
28
  ),
@@ -31,9 +32,15 @@ const OPENAPI_RESULT_SCHEMAS = {
31
32
  title: 'Unauthorized',
32
33
  status: 401,
33
34
  detail: 'Missing or invalid Bearer token.',
34
- instance: '/api/v1/builder/workspaces/me/systems',
35
+ instance: 'https://api.example.com/api/v1/builder/workspaces/me/systems',
35
36
  correlationId: '00000000-0000-4000-8000-000000000003',
36
- errors: []
37
+ errors: [
38
+ {
39
+ field: 'authorization',
40
+ message: 'Missing or invalid Bearer token.',
41
+ value: null
42
+ }
43
+ ]
37
44
  }
38
45
  }
39
46
  ),
@@ -41,14 +48,27 @@ const OPENAPI_RESULT_SCHEMAS = {
41
48
  ProblemDetails: {
42
49
  allOf: [schemaRef('ProblemDetail')]
43
50
  },
44
- ProblemValidationError: frozenObject(
51
+ ValidationError: Object.assign(
52
+ frozenObject(
53
+ {
54
+ field: { type: 'string' },
55
+ message: { type: 'string' },
56
+ value: { type: ['string', 'null'] }
57
+ },
58
+ ['field', 'message', 'value']
59
+ ),
45
60
  {
46
- field: { type: 'string' },
47
- message: { type: 'string' },
48
- value: { type: 'string' }
49
- },
50
- ['message']
61
+ example: {
62
+ field: 'authorization',
63
+ message: 'Missing or invalid Bearer token.',
64
+ value: null
65
+ }
66
+ }
51
67
  ),
68
+ /** Legacy alias — published REST requires ValidationError (OAPI-249/608). */
69
+ ProblemValidationError: {
70
+ allOf: [schemaRef('ValidationError')]
71
+ },
52
72
  LifecycleVerdict: {
53
73
  type: 'string',
54
74
  enum: ['VERIFIED', 'FAILED', 'NOT_VERIFIED', 'NOT_APPLICABLE']
@@ -131,6 +151,21 @@ const OPENAPI_RESULT_SCHEMAS = {
131
151
  },
132
152
  ['systemKey', 'status']
133
153
  ),
154
+ IntegrationDefinitionApplyData: frozenObject(
155
+ {
156
+ status: {
157
+ type: 'string',
158
+ enum: ['created', 'updated', 'idempotent', 'dryRun']
159
+ },
160
+ systemKey: schemaRef('SystemKey'),
161
+ outputDir: { type: 'string' },
162
+ definitionId: { type: 'string' },
163
+ definitionHash: { type: 'string' },
164
+ packageVersion: { type: 'string' },
165
+ files: stringArraySchema()
166
+ },
167
+ ['status', 'systemKey']
168
+ ),
134
169
  RepairResultData: frozenObject(
135
170
  {
136
171
  updated: { type: 'boolean' },
@@ -397,95 +432,7 @@ const OPENAPI_RESULT_SCHEMAS = {
397
432
  },
398
433
  ['command', 'systemKey', 'verdict', 'enforcementScenarios', 'datasourceRows']
399
434
  ),
400
- LifecycleRunStep: frozenObject(
401
- {
402
- pillar: { type: 'string' },
403
- success: { type: 'boolean' },
404
- error: { type: 'string' }
405
- },
406
- ['pillar', 'success']
407
- ),
408
- LifecycleRunReport: frozenObject(
409
- {
410
- systemKey: schemaRef('SystemKey'),
411
- certification: schemaRef('CertificationSummary')
412
- },
413
- ['systemKey']
414
- ),
415
- CertifyLifecycleRunResultData: frozenObject(
416
- {
417
- report: schemaRef('LifecycleRunReport'),
418
- stepsRun: { type: 'array', items: schemaRef('LifecycleRunStep') }
419
- },
420
- ['report']
421
- ),
422
- CertifyResultData: {
423
- oneOf: [
424
- schemaRef('CertifyOperationsResultData'),
425
- schemaRef('CertifyTrustResultData'),
426
- schemaRef('CertifyGovernanceResultData'),
427
- schemaRef('CertifyLifecycleRunResultData')
428
- ]
429
- },
430
- LifecycleReportData: frozenObject(
431
- {
432
- systemKey: schemaRef('SystemKey'),
433
- certification: schemaRef('CertificationSummary'),
434
- operationalReadinessPercent: { type: 'number' },
435
- summary: { type: 'boolean' },
436
- details: { type: 'boolean' }
437
- },
438
- ['systemKey']
439
- ),
440
- EnterpriseMcpToolOutput: frozenObject({
441
- success: { type: 'boolean' },
442
- status: { type: 'string' },
443
- message: { type: 'string' },
444
- branch: { type: 'string' },
445
- pullRequestUrl: { type: 'string', format: 'uri' },
446
- syncDirection: schemaRef('RepositorySyncDirection'),
447
- commitSha: { type: 'string' },
448
- workflowRunId: { type: 'string' }
449
- }),
450
- WorkspaceRemoteUnavailable: frozenObject(
451
- {
452
- unavailable: { type: 'boolean', enum: [true] },
453
- message: { type: 'string' }
454
- },
455
- ['unavailable', 'message']
456
- ),
457
- WorkspaceRemoteStatus: {
458
- oneOf: [schemaRef('EnterpriseMcpToolOutput'), schemaRef('WorkspaceRemoteUnavailable'), { type: 'null' }]
459
- },
460
- EnterpriseMcpInvocationData: frozenObject(
461
- {
462
- capabilityKey: { type: 'string' },
463
- result: schemaRef('EnterpriseMcpToolOutput')
464
- },
465
- ['capabilityKey', 'result']
466
- ),
467
- WorkspaceStatusData: frozenObject(
468
- {
469
- local: schemaRef('SystemManifestData'),
470
- remote: schemaRef('WorkspaceRemoteStatus')
471
- },
472
- ['local', 'remote']
473
- ),
474
- RepositoryStatusData: frozenObject(
475
- {
476
- capabilityKey: { type: 'string', enum: ['repository.status'] },
477
- result: schemaRef('EnterpriseMcpToolOutput')
478
- },
479
- ['capabilityKey', 'result']
480
- ),
481
- HealthData: frozenObject({ status: { type: 'string', enum: ['ok'] } }, ['status']),
482
- ReadyData: frozenObject(
483
- {
484
- status: { type: 'string', enum: ['ready'] },
485
- dataplaneUrl: { type: ['string', 'null'], format: 'uri' }
486
- },
487
- ['status']
488
- )
435
+ ...OPENAPI_RESULT_SCHEMA_OVERFLOW
489
436
  };
490
437
 
491
438
  module.exports = {
@@ -28,18 +28,21 @@ const CORE_SCHEMA_DESCRIPTIONS = {
28
28
  title: 'Short human-readable error title.',
29
29
  status: 'HTTP status code echoed in the body.',
30
30
  detail: 'Actionable error detail safe for operators and agents.',
31
- instance: 'Request path or instance identifier.',
31
+ instance: 'Request URL for this occurrence (URI).',
32
32
  correlationId: 'Correlation id for log lookup across services.',
33
- errors: 'Field-level validation errors when status is 400.'
33
+ errors: 'Field-level validation errors (non-empty when status is 400/422).'
34
34
  },
35
35
  ProblemDetails: {
36
36
  _schema: 'Alias of ProblemDetail (allOf) for backward-compatible $refs.'
37
37
  },
38
- ProblemValidationError: {
38
+ ValidationError: {
39
39
  _schema: 'Single field validation error inside ProblemDetail.errors.',
40
40
  field: 'JSON pointer or field name that failed validation.',
41
41
  message: 'Validation failure message.',
42
- value: 'Rejected value when safe to echo (may be omitted for secrets).'
42
+ value: 'Rejected value when safe to echo (null when omitted for secrets).'
43
+ },
44
+ ProblemValidationError: {
45
+ _schema: 'Legacy alias of ValidationError (allOf) for older $refs.'
43
46
  },
44
47
  LifecycleVerdict: {
45
48
  _schema: 'Lifecycle verification outcome: VERIFIED, FAILED, NOT_VERIFIED, or NOT_APPLICABLE.'
@@ -12,7 +12,7 @@
12
12
  const HELP_SCHEMA_DESCRIPTIONS = Object.freeze({
13
13
  BuilderHelpTopic: {
14
14
  _schema:
15
- 'Help topic enum: overview, sections, section, dependencyGraph, repairRules, workflow, schemaCatalog, subscriptionGuide, cipOverview, goldenExamples, goldenExample, evidencePatterns, evidencePattern.'
15
+ 'Help topic enum including resourceTypeCatalog (taxonomy keys for BID datasources[].resourceType), overview, sections, schemaCatalog, platformRoles, dimensionsGuide, and related bootstrap topics.'
16
16
  },
17
17
  BuilderHelpData: {
18
18
  _schema: 'Deterministic LLM help payload for one topic (read-only product documentation).',
@@ -46,6 +46,30 @@ const OPERATIONS_SCHEMA_DESCRIPTIONS = {
46
46
  preferences: 'Optional expose, RBAC, and sync generation flags.',
47
47
  debug: 'When true, enable verbose wizard logging (also available as query param).'
48
48
  },
49
+ IntegrationDefinitionApplyRequest: {
50
+ _schema: 'Apply a Builder Integration Definition (BID) into the workspace package.',
51
+ integrationDefinition: 'BID document (aifabrix.builder.integrationDefinition).',
52
+ bid: 'Alias for integrationDefinition.',
53
+ force: 'When true, rewrite package even if definitionHash matches stamp.',
54
+ dryRun: 'When true, return planned files without writing.'
55
+ },
56
+ IntegrationDefinitionApplyResponse: {
57
+ _schema: '200 response envelope for applyIntegrationDefinition.',
58
+ success: 'Always true for successful builder-api JSON responses.',
59
+ data: 'Typed payload; see IntegrationDefinitionApplyData.',
60
+ correlationId: 'UUID correlating logs for this request.',
61
+ requestId: 'Optional per-request UUID when emitted by the server.'
62
+ },
63
+ IntegrationDefinitionApplyData: {
64
+ _schema: 'Typed apply result payload.',
65
+ status: 'created, updated, unchanged, or dryRun.',
66
+ systemKey: 'Integration system key that was materialized.',
67
+ outputDir: 'Absolute workspace integration directory.',
68
+ definitionId: 'BID definitionId.',
69
+ definitionHash: 'Canonical definitionHash written to stamp.',
70
+ packageVersion: 'Package version from packageIdentity.',
71
+ files: 'Relative package file names written or planned.'
72
+ },
49
73
  RepairRequest: {
50
74
  _schema: 'Optional flags for workspace repair aligning manifest files with on-disk JSON.',
51
75
  dryRun: 'Preview repair actions without writing files.',
@@ -41,14 +41,14 @@ function stringArraySchema() {
41
41
  * @returns {Object}
42
42
  */
43
43
  function buildSuccessEnvelopeSchema(dataSchemaName) {
44
- const dataExamples = {
45
- HealthData: { status: 'ok' },
46
- ReadyData: { status: 'ready', dataplaneUrl: 'http://localhost:3601' },
47
- ListSystemsData: { systems: [] },
48
- EmptyResultData: {},
49
- WorkspaceStatusData: { status: 'ready' },
50
- RepositoryStatusData: { status: 'ready' }
51
- };
44
+ const { OPENAPI_ENVELOPE_DATA_EXAMPLES } = require('./openapi-envelope-examples');
45
+ const dataExample = OPENAPI_ENVELOPE_DATA_EXAMPLES[dataSchemaName];
46
+ if (dataExample === undefined) {
47
+ throw new Error(
48
+ `Missing OpenAPI envelope data example for ${dataSchemaName} (OAPI-136). ` +
49
+ 'Add it to lib/programmatic/openapi-envelope-examples.js'
50
+ );
51
+ }
52
52
  const schema = frozenObject(
53
53
  {
54
54
  success: { type: 'boolean', enum: [true] },
@@ -60,7 +60,7 @@ function buildSuccessEnvelopeSchema(dataSchemaName) {
60
60
  );
61
61
  schema.example = {
62
62
  success: true,
63
- data: dataExamples[dataSchemaName] || {},
63
+ data: dataExample,
64
64
  correlationId: '00000000-0000-4000-8000-000000000001',
65
65
  requestId: '00000000-0000-4000-8000-000000000002'
66
66
  };
@@ -73,7 +73,7 @@ function buildStandardErrorResponses() {
73
73
  * @returns {boolean}
74
74
  */
75
75
  function requiresBearerAuth(handlerId) {
76
- return handlerId !== 'health' && handlerId !== 'ready';
76
+ return handlerId !== 'health' && handlerId !== 'ready' && handlerId !== 'getBuilderHelp';
77
77
  }
78
78
 
79
79
  /**
@@ -149,10 +149,20 @@ function buildOpenApiTags() {
149
149
  { name: 'template', description: 'Enterprise MCP template.materializeWorkspace and workspace reset.' },
150
150
  { name: 'repository', description: 'Enterprise MCP repository.sync, createReview, status, dispatchPipeline.' },
151
151
  { name: 'infra', description: 'Liveness and readiness probes (no authentication).' },
152
+ {
153
+ name: 'help',
154
+ description:
155
+ 'Deterministic LLM help topics (resourceTypeCatalog, schemaCatalog, …). No authentication.'
156
+ },
152
157
  {
153
158
  name: 'evidence',
154
159
  description:
155
160
  'BTA-facing Evidence authoring: metadata, download, upload (validate+certify), and human-gated activate.'
161
+ },
162
+ {
163
+ name: 'channel',
164
+ description:
165
+ 'Discovery-driven channel packaging (Copilot, ChatGPT, Slack, Teams): build, summary, ZIP, branding.'
156
166
  }
157
167
  ];
158
168
  }
@@ -71,6 +71,16 @@ const ORCHESTRATION_TAG_CATALOG = Object.freeze({
71
71
  resourceType: 'role-evidence',
72
72
  permissionClass: 'evidence',
73
73
  displayName: 'Evidence'
74
+ },
75
+ channel: {
76
+ resourceType: 'channel',
77
+ permissionClass: 'channel',
78
+ displayName: 'Channel'
79
+ },
80
+ help: {
81
+ resourceType: 'document',
82
+ permissionClass: 'read',
83
+ displayName: 'Help'
74
84
  }
75
85
  });
76
86
 
@@ -11,6 +11,9 @@
11
11
  const { buildContext } = require('./route-handlers-context');
12
12
  const { listSystems, createSystem, getSystemManifest, deleteSystem } = require('./workspace-ops');
13
13
  const { runWizard } = require('./run-wizard');
14
+ const {
15
+ applyIntegrationDefinitionInWorkspace
16
+ } = require('./run-integration-definition');
14
17
  const { runRepair } = require('./run-repair');
15
18
  const { runValidate } = require('./run-validate');
16
19
  const { runPreviewUpload, runUpload } = require('./run-upload');
@@ -41,6 +44,15 @@ const {
41
44
  activateEvidenceCandidates
42
45
  } = require('./run-evidence-authoring');
43
46
 
47
+ const {
48
+ buildChannelPackage,
49
+ getChannelPackageSummary,
50
+ getChannelPackageZip,
51
+ patchChannelBranding,
52
+ getChannelBranding
53
+ } = require('./run-channel-package');
54
+ const { handleGetBuilderHelp } = require('./builder-help');
55
+
44
56
  /** @type {Record<string, Function>} */
45
57
  const HANDLER_MAP = {
46
58
  listSystems: (_params, auth) => listSystems(buildContext(auth, '_meta')),
@@ -57,6 +69,11 @@ const HANDLER_MAP = {
57
69
  runWizard(buildContext(auth, params.systemKey), body, {
58
70
  debug: query.debug === 'true' || body.debug === true
59
71
  }),
72
+ applyIntegrationDefinition: (params, auth, body) =>
73
+ applyIntegrationDefinitionInWorkspace(
74
+ buildContext(auth, params.systemKey),
75
+ body && typeof body === 'object' ? body : {}
76
+ ),
60
77
  runRepair: (params, auth, body, query) =>
61
78
  runRepair(buildContext(auth, params.systemKey), {
62
79
  dryRun: query.dryRun === 'true' || body.dryRun === true,
@@ -179,6 +196,7 @@ const HANDLER_MAP = {
179
196
  runRepositoryDispatchPipeline(buildContext(auth, params.systemKey), body),
180
197
  health: () => ({ status: 'ok' }),
181
198
  ready: () => ({ status: 'ready', dataplaneUrl: process.env.DATAPLANE_URL || null }),
199
+ getBuilderHelp: (_params, _auth, _body, query) => handleGetBuilderHelp(query || {}),
182
200
  getEvidenceMetadata: (params, auth) =>
183
201
  getEvidenceMetadata(buildContext(auth, '_evidence'), params.roleKey),
184
202
  downloadEvidence: (params, auth, _body, query) =>
@@ -199,7 +217,17 @@ const HANDLER_MAP = {
199
217
  roleKey: (body && body.roleKey) || params.roleKey
200
218
  }),
201
219
  activateEvidenceCandidates: (_params, auth, body) =>
202
- activateEvidenceCandidates(buildContext(auth, '_evidence'), body)
220
+ activateEvidenceCandidates(buildContext(auth, '_evidence'), body),
221
+ buildChannelPackage: (params, auth, body) =>
222
+ buildChannelPackage(buildContext(auth, params.systemKey), body || {}),
223
+ getChannelPackageSummary: (params, auth) =>
224
+ getChannelPackageSummary(buildContext(auth, params.systemKey)),
225
+ getChannelPackageZip: (params, auth) =>
226
+ getChannelPackageZip(buildContext(auth, params.systemKey)),
227
+ getChannelBranding: (params, auth) =>
228
+ getChannelBranding(buildContext(auth, params.systemKey)),
229
+ patchChannelBranding: (params, auth, body) =>
230
+ patchChannelBranding(buildContext(auth, params.systemKey), body || {})
203
231
  };
204
232
 
205
233
  /**