@aifabrix/builder 2.53.1 → 2.54.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.
- package/bin/aifabrix.js +2 -2
- package/lib/api/assistants.api.js +8 -5
- package/lib/api/channel-identity.api.js +41 -0
- package/lib/api/evidence-authoring.api.js +5 -1
- package/lib/api/evidence.api.js +2 -0
- package/lib/api/types/evidence.types.js +2 -0
- package/lib/api/work-search.api.js +136 -0
- package/lib/channels/add-channel.js +163 -126
- package/lib/channels/approval-guides/chatgpt.js +14 -18
- package/lib/channels/approval-guides/claude.js +29 -0
- package/lib/channels/approval-guides/index.js +88 -22
- package/lib/channels/approval-guides/mcp-client.js +27 -0
- package/lib/channels/approval-guides/microsoft-copilot.js +52 -3
- package/lib/channels/approval-guides/slack.js +10 -10
- package/lib/channels/approval-guides/teams-bot.js +8 -12
- package/lib/channels/channel-add-continuations.js +91 -0
- package/lib/channels/channel-add-ensure.js +124 -27
- package/lib/channels/channel-add-existing.js +160 -28
- package/lib/channels/channel-add-failure.js +60 -0
- package/lib/channels/channel-add-remaining.js +486 -0
- package/lib/channels/channel-add-tty.js +190 -0
- package/lib/channels/channel-add-wizard-config.js +138 -0
- package/lib/channels/channel-add-wizard.js +250 -0
- package/lib/channels/channel-artifact-generator.js +27 -13
- package/lib/channels/channel-cardinality.js +83 -0
- package/lib/channels/channel-catalog-icon.js +45 -0
- package/lib/channels/channel-cli-instructions.js +75 -0
- package/lib/channels/channel-configuration-map.js +213 -0
- package/lib/channels/channel-credential.js +11 -14
- package/lib/channels/channel-definition-project.js +101 -0
- package/lib/channels/channel-definition-registry.js +154 -0
- package/lib/channels/channel-description.js +59 -2
- package/lib/channels/channel-discovery.js +16 -2
- package/lib/channels/channel-external-system.js +86 -9
- package/lib/channels/channel-install-envelope-actions.js +88 -0
- package/lib/channels/channel-install-envelope-microsoft.js +155 -0
- package/lib/channels/channel-install-envelope.js +356 -0
- package/lib/channels/channel-install-help-md.js +172 -0
- package/lib/channels/channel-install-http-payload.js +62 -0
- package/lib/channels/channel-install-inventory.js +115 -0
- package/lib/channels/channel-install-profiles.js +90 -0
- package/lib/channels/channel-instance-collision.js +118 -0
- package/lib/channels/channel-instance-key.js +100 -0
- package/lib/channels/channel-instance-materialize.js +240 -0
- package/lib/channels/channel-integration-generator.js +16 -9
- package/lib/channels/channel-integration-template.js +101 -22
- package/lib/channels/channel-inventory-fetch.js +79 -0
- package/lib/channels/channel-oauth-preflight.js +104 -0
- package/lib/channels/channel-package-version.js +76 -0
- package/lib/channels/channel-predefined-client.js +154 -0
- package/lib/channels/channel-probe.js +7 -2
- package/lib/channels/channel-runtime-resolver.js +180 -72
- package/lib/channels/channel-status-display.js +86 -16
- package/lib/channels/channel-targets.js +106 -92
- package/lib/channels/chatgpt-callback.js +318 -0
- package/lib/channels/chatgpt-channel-add.js +229 -0
- package/lib/channels/chatgpt-preflight.js +396 -0
- package/lib/channels/chatgpt-runtime-contract.js +17 -0
- package/lib/channels/chatgpt-setup-values.js +124 -0
- package/lib/channels/claude-callback.js +67 -0
- package/lib/channels/claude-channel-add.js +254 -0
- package/lib/channels/claude-runtime-contract.js +40 -0
- package/lib/channels/claude-runtime.js +58 -0
- package/lib/channels/claude-setup-values.js +89 -0
- package/lib/channels/mcp-client/config-merge.js +148 -0
- package/lib/channels/mcp-client/ensure-client.js +231 -0
- package/lib/channels/mcp-client/paths.js +53 -0
- package/lib/channels/mcp-client/profiles.js +122 -0
- package/lib/channels/mcp-client/redirect-uris.js +99 -0
- package/lib/channels/mcp-client/runtime.js +59 -0
- package/lib/channels/mcp-client-channel-add.js +186 -0
- package/lib/channels/microsoft-copilot-channel-add.js +117 -7
- package/lib/channels/microsoft-copilot-entra-identifier-uris.js +187 -0
- package/lib/channels/microsoft-copilot-entra-sso-form.js +106 -18
- package/lib/channels/microsoft-copilot-entra-sso.js +31 -2
- package/lib/channels/microsoft-copilot-package-prior.js +107 -0
- package/lib/channels/microsoft-copilot-package.js +29 -28
- package/lib/channels/microsoft-provisioning/a365.js +80 -0
- package/lib/channels/microsoft-provisioning/auth-config.js +240 -0
- package/lib/channels/microsoft-provisioning/auth.js +179 -0
- package/lib/channels/microsoft-provisioning/cli.js +71 -0
- package/lib/channels/microsoft-provisioning/constants.js +75 -0
- package/lib/channels/microsoft-provisioning/errors.js +117 -0
- package/lib/channels/microsoft-provisioning/index.js +55 -0
- package/lib/channels/microsoft-provisioning/install-atk.js +158 -0
- package/lib/channels/microsoft-provisioning/install-teams.js +115 -0
- package/lib/channels/microsoft-provisioning/login-portal-device.js +236 -0
- package/lib/channels/microsoft-provisioning/login-portal-parse.js +71 -0
- package/lib/channels/microsoft-provisioning/login-portal-teams.js +193 -0
- package/lib/channels/microsoft-provisioning/login-portal.js +230 -0
- package/lib/channels/microsoft-provisioning/persist.js +110 -0
- package/lib/channels/microsoft-provisioning/teams-bot-args.js +119 -0
- package/lib/channels/microsoft-provisioning/teams-bot-controller.js +123 -0
- package/lib/channels/microsoft-provisioning/teams-bot-parse.js +134 -0
- package/lib/channels/microsoft-provisioning/teams-bot-persist.js +113 -0
- package/lib/channels/microsoft-provisioning/teams-bot-provision.js +234 -0
- package/lib/channels/microsoft-provisioning/teams-bot-secrets.js +45 -0
- package/lib/channels/microsoft-provisioning/teams-cli.js +82 -0
- package/lib/channels/runtime-tool-catalog.js +5 -2
- package/lib/channels/slack-channel-add-portal.js +130 -0
- package/lib/channels/slack-channel-add-tty-auth.js +95 -0
- package/lib/channels/slack-channel-add.js +258 -0
- package/lib/channels/slack-provisioning/apps.js +181 -0
- package/lib/channels/slack-provisioning/auth-store.js +110 -0
- package/lib/channels/slack-provisioning/auth-ticket.js +185 -0
- package/lib/channels/slack-provisioning/auth.js +115 -0
- package/lib/channels/slack-provisioning/callbacks.js +41 -0
- package/lib/channels/slack-provisioning/cli.js +226 -0
- package/lib/channels/slack-provisioning/constants.js +37 -0
- package/lib/channels/slack-provisioning/credentials.js +169 -0
- package/lib/channels/slack-provisioning/curl-shim.js +132 -0
- package/lib/channels/slack-provisioning/developer-install.js +118 -0
- package/lib/channels/slack-provisioning/env-file.js +120 -0
- package/lib/channels/slack-provisioning/errors.js +47 -0
- package/lib/channels/slack-provisioning/go-ca-bundle.js +137 -0
- package/lib/channels/slack-provisioning/index.js +250 -0
- package/lib/channels/slack-provisioning/install-cli.js +323 -0
- package/lib/channels/slack-provisioning/manifest.js +89 -0
- package/lib/channels/slack-provisioning/oauth-lock.js +33 -0
- package/lib/channels/slack-provisioning/offer-cli.js +113 -0
- package/lib/channels/slack-provisioning/onboard-members.js +122 -0
- package/lib/channels/slack-provisioning/onboard.js +89 -0
- package/lib/channels/slack-provisioning/persist.js +95 -0
- package/lib/channels/slack-provisioning/remaining-urls.js +158 -0
- package/lib/channels/slack-provisioning/with-curl-on-path.js +48 -0
- package/lib/channels/teams-bot-channel-add.js +94 -0
- package/lib/channels/vendor-dataplane-url.js +249 -0
- package/lib/cli/setup-certification.help.js +2 -0
- package/lib/cli/setup-external-system-help.js +2 -0
- package/lib/cli/setup-external-system.js +1 -1
- package/lib/commands/channel-add-help.js +366 -0
- package/lib/commands/channel-add-setup.js +162 -80
- package/lib/commands/channel-configure.js +118 -0
- package/lib/commands/channel.js +10 -1
- package/lib/commands/governance-upload-external.js +6 -3
- package/lib/commands/lifecycle-command-action.js +2 -5
- package/lib/commands/lifecycle-external.js +93 -21
- package/lib/commands/repair-datasource-test-payload.js +4 -2
- package/lib/commands/repair-datasource-webhooks-sync-bridge.js +23 -2
- package/lib/commands/repair-datasource.js +3 -0
- package/lib/commands/repair-external-run.js +59 -25
- package/lib/commands/repair-openapi-rest-runtime.js +127 -0
- package/lib/commands/repair-orchestration-tag-merge.js +339 -0
- package/lib/commands/repair-rbac-catalog-defaults.js +96 -0
- package/lib/commands/repair-rbac-platform-preset.js +26 -15
- package/lib/commands/repair-rbac-reader-roles.js +8 -21
- package/lib/commands/repair-rbac.js +10 -34
- package/lib/commands/repair-system-permissions.js +24 -22
- package/lib/commands/role-assistant-test-output.js +14 -0
- package/lib/commands/role-assistant.js +59 -21
- package/lib/commands/test-e2e-external.js +148 -21
- package/lib/commands/upload-credential-push-log.js +2 -1
- package/lib/commands/upload-publish-context.js +1 -1
- package/lib/commands/upload-role-assistant-shell.js +124 -0
- package/lib/commands/upload-sidecar-followups.js +6 -3
- package/lib/commands/upload.js +18 -3
- package/lib/core/secrets-docker-env.js +4 -1
- package/lib/core/secrets-env-content.js +17 -3
- package/lib/datasource/capability/capability-manifest.js +0 -3
- package/lib/datasource/capability/copy-test-payload.js +3 -0
- package/lib/external-system/deploy-helpers.js +26 -1
- package/lib/external-system/deploy.js +10 -6
- package/lib/external-system/download-helpers.js +29 -2
- package/lib/external-system/download-role-assistant.js +83 -4
- package/lib/external-system/download.js +40 -30
- package/lib/external-system/sync-deploy-manifest.js +3 -2
- package/lib/external-system/upload-identity.js +42 -0
- package/lib/generator/index.js +19 -15
- package/lib/generator/split.js +13 -2
- package/lib/lifecycle/role-assistant-governance.js +146 -0
- package/lib/lifecycle/scenario-upload.js +181 -30
- package/lib/programmatic/builder-api-cors.js +143 -0
- package/lib/programmatic/builder-api-request.js +6 -0
- package/lib/programmatic/builder-api-route-dispatch.js +56 -42
- package/lib/programmatic/builder-api-server.js +8 -1
- package/lib/programmatic/capability-registry.js +54 -0
- package/lib/programmatic/channel-install-help-resolve.js +359 -0
- package/lib/programmatic/channel-install-session.js +218 -0
- package/lib/programmatic/help-content/channel-onboarding.md +2 -0
- package/lib/programmatic/help-content/cip-overview.md +3 -1
- package/lib/programmatic/http-raw-response.js +62 -0
- package/lib/programmatic/openapi-channel-install-bindings.js +179 -0
- package/lib/programmatic/openapi-channel-install-schemas.js +286 -0
- package/lib/programmatic/openapi-component-schemas.js +18 -1
- package/lib/programmatic/openapi-description-enricher.js +3 -1
- package/lib/programmatic/openapi-descriptions.js +74 -3
- package/lib/programmatic/openapi-envelope-examples.js +117 -0
- package/lib/programmatic/openapi-operation-bindings.js +4 -1
- package/lib/programmatic/openapi-schema-descriptions-channel.js +316 -0
- package/lib/programmatic/openapi-spec.js +12 -8
- package/lib/programmatic/platform-rbac-catalog.js +36 -18
- package/lib/programmatic/route-handler-map.js +51 -1
- package/lib/programmatic/route-handlers-context.js +2 -1
- package/lib/programmatic/run-auth-permissions.js +54 -0
- package/lib/programmatic/run-channel-catalog.js +196 -0
- package/lib/programmatic/run-channel-install-artifacts.js +137 -0
- package/lib/programmatic/run-channel-install-copilot.js +353 -0
- package/lib/programmatic/run-channel-install-options.js +232 -0
- package/lib/programmatic/run-channel-install-teams-bot.js +204 -0
- package/lib/programmatic/run-channel-install.js +346 -0
- package/lib/programmatic/run-channel-package.js +87 -7
- package/lib/programmatic/workspace-context.js +2 -0
- package/lib/role-assistant/evidence-sync.js +4 -2
- package/lib/role-assistant/evidence-validation-issues.js +51 -0
- package/lib/role-assistant/knowledge-sync.js +10 -4
- package/lib/role-assistant/settings.js +49 -2
- package/lib/role-assistant/test-cases-evaluate.js +30 -2
- package/lib/role-assistant/test-cases-evidence.js +175 -0
- package/lib/role-assistant/test-cases-search.js +229 -0
- package/lib/role-assistant/test-cases.js +37 -4
- package/lib/role-assistant/test-runner-search.js +149 -0
- package/lib/role-assistant/test-runner-workhub-helpers.js +40 -2
- package/lib/role-assistant/test-runner-workhub-soft.js +9 -3
- package/lib/role-assistant/test-runner-workhub.js +29 -11
- package/lib/role-assistant/test-runner.js +16 -1
- package/lib/schema/external-datasource.schema.json +112 -18
- package/lib/schema/external-system.schema.json +159 -2
- package/lib/schema/mcp-client-profile.schema.json +103 -0
- package/lib/utils/app-path-resolve.js +4 -0
- package/lib/utils/authentication-env-template.js +44 -6
- package/lib/utils/credential-secrets-env.js +6 -1
- package/lib/utils/env-copy.js +19 -7
- package/lib/utils/external-env-template.js +20 -2
- package/lib/utils/paths.js +18 -1
- package/lib/utils/platform-shell-package.js +69 -0
- package/lib/utils/port-resolver.js +50 -1
- package/lib/utils/rewrite-name-flag.js +20 -0
- package/lib/utils/role-assistant-paths.js +13 -10
- package/lib/utils/schema-resolver.js +11 -1
- package/lib/utils/secrets-helpers.js +12 -21
- package/lib/utils/token-manager.js +10 -5
- package/lib/validation/validate.js +40 -0
- package/package.json +1 -1
- package/templates/README.md +1 -1
- package/templates/applications/builder-api/Dockerfile +1 -1
- package/templates/applications/builder-api/env.template +7 -0
- package/templates/applications/dataplane/application.yaml +6 -5
- package/templates/applications/dataplane/env.template +2 -2
- package/templates/applications/dataplane/rbac.yaml +7 -2
- package/templates/applications/keycloak/Dockerfile +30 -4
- package/templates/applications/keycloak/application.yaml +2 -2
- package/templates/applications/keycloak/cimd-lenient-parse/AbstractClientIdMetadataDocumentExecutor.java +896 -0
- package/templates/applications/keycloak/cimd-lenient-parse/SOURCE.md +19 -0
- package/templates/applications/keycloak/env.template +3 -0
- package/templates/applications/miso-controller/application.yaml +1 -2
- package/templates/applications/miso-controller/env.template +2 -0
- package/templates/channels/README.md +5 -5
- package/templates/channels/chatgpt/TROUBLESHOOTING.md +51 -0
- package/templates/channels/chatgpt/channel.json +59 -0
- package/templates/channels/chatgpt/icon.svg +1 -0
- package/templates/channels/chatgpt/install.template.md.hbs +20 -95
- package/templates/channels/chatgpt/integration/README.md +1 -1
- package/templates/channels/chatgpt/integration/application.json +2 -2
- package/templates/channels/chatgpt/integration/chatgpt-system.json +49 -4
- package/templates/channels/chatgpt/integration/env.template +2 -4
- package/templates/channels/chatgpt/integration/rbac.json +13 -0
- package/templates/channels/claude/TROUBLESHOOTING.md +41 -0
- package/templates/channels/claude/channel.json +59 -0
- package/templates/channels/claude/icon.svg +1 -0
- package/templates/channels/claude/install.template.md.hbs +21 -0
- package/templates/channels/claude/integration/README.md +14 -0
- package/templates/channels/claude/integration/application.json +15 -0
- package/templates/channels/claude/integration/claude-system.json +59 -0
- package/templates/channels/claude/integration/env.template +2 -0
- package/templates/channels/claude/integration/rbac.json +13 -0
- package/templates/channels/claude/manifest.template.json.hbs +40 -0
- package/templates/channels/mcp-client/channel.json +72 -0
- package/templates/channels/mcp-client/icon.svg +1 -0
- package/templates/channels/mcp-client/install.template.md.hbs +24 -0
- package/templates/channels/mcp-client/integration/README.md +13 -0
- package/templates/channels/mcp-client/integration/application.json +15 -0
- package/templates/channels/mcp-client/integration/env.template +2 -0
- package/templates/channels/mcp-client/integration/mcp-client-system.json +72 -0
- package/templates/channels/mcp-client/integration/rbac.json +13 -0
- package/templates/channels/mcp-client/manifest.template.json.hbs +41 -0
- package/templates/channels/mcp-client/profiles/cursor.json +26 -0
- package/templates/channels/mcp-client/profiles/github-copilot.json +29 -0
- package/templates/channels/mcp-client/profiles/vscode.json +29 -0
- package/templates/channels/microsoft-copilot/channel.json +73 -0
- package/templates/channels/microsoft-copilot/declarative-agent.template.json.hbs +8 -4
- package/templates/channels/microsoft-copilot/entra-sso-registration.template.md.hbs +65 -5
- package/templates/channels/microsoft-copilot/icon.svg +1 -0
- package/templates/channels/microsoft-copilot/install.template.md.hbs +9 -9
- package/templates/channels/microsoft-copilot/integration/README.md +1 -1
- package/templates/channels/microsoft-copilot/integration/application.json +2 -2
- package/templates/channels/microsoft-copilot/integration/env.template +3 -6
- package/templates/channels/microsoft-copilot/integration/microsoft-copilot-system.json +63 -4
- package/templates/channels/microsoft-copilot/integration/rbac.json +13 -0
- package/templates/channels/microsoft-copilot/oauth-plugin-vault-required.template.md.hbs +5 -5
- package/templates/channels/slack/channel.json +223 -0
- package/templates/channels/slack/icon.svg +1 -0
- package/templates/channels/slack/install.template.md.hbs +36 -28
- package/templates/channels/slack/integration/README.md +245 -22
- package/templates/channels/slack/integration/application.json +44 -7
- package/templates/channels/slack/integration/env.template +15 -6
- package/templates/channels/slack/integration/openapi/openapi.json +126 -0
- package/templates/channels/slack/integration/rbac.json +84 -0
- package/templates/channels/slack/integration/slack-datasource-commands.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-conversations.json +28 -3
- package/templates/channels/slack/integration/slack-datasource-events.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-interactive.json +154 -0
- package/templates/channels/slack/integration/slack-datasource-messages.json +40 -2
- package/templates/channels/slack/integration/slack-system.json +155 -77
- package/templates/channels/slack/manifest.template.json.hbs +5 -2
- package/templates/channels/teams-bot/channel.json +161 -0
- package/templates/channels/teams-bot/icon.svg +1 -0
- package/templates/channels/teams-bot/install.template.md.hbs +12 -13
- package/templates/channels/teams-bot/integration/README.md +5 -4
- package/templates/channels/teams-bot/integration/application.json +6 -4
- package/templates/channels/teams-bot/integration/env.template +5 -4
- package/templates/channels/teams-bot/integration/openapi/openapi.json +68 -0
- package/templates/channels/teams-bot/integration/rbac.json +21 -0
- package/templates/channels/teams-bot/integration/teams-bot-datasource-activities.json +154 -0
- package/templates/channels/teams-bot/integration/teams-bot-system.json +128 -23
- package/templates/channels/web-embed/channel.json +60 -0
- package/templates/channels/web-embed/install.template.md.hbs +1 -1
- package/templates/channels/web-embed/integration/README.md +2 -2
- package/templates/channels/web-embed/integration/application.json +2 -2
- package/templates/channels/web-embed/integration/env.template +1 -1
- package/templates/channels/web-embed/integration/rbac.json +13 -0
- package/templates/channels/web-embed/integration/web-embed-system.json +50 -4
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer-facing ChatGPT form values: Name, Description, Server URL, OAuth.
|
|
3
|
+
* Discovery may still resolve authorization/token endpoints internally.
|
|
4
|
+
* Never invent Keycloak paths or tell admins to copy from a Miso profile.
|
|
5
|
+
*
|
|
6
|
+
* @fileoverview ChatGPT channel form values — describe, don't configure
|
|
7
|
+
* @author AI Fabrix Team
|
|
8
|
+
* @version 1.1.0
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
CHATGPT_OAUTH2_PROFILE_ID,
|
|
15
|
+
CHATGPT_OAUTH2_PROFILE_PATH,
|
|
16
|
+
CHATGPT_APPS_CREATE_URL
|
|
17
|
+
} = require('./chatgpt-runtime-contract');
|
|
18
|
+
const { getDefaultChannelDescription } = require('./channel-targets');
|
|
19
|
+
|
|
20
|
+
const CHATGPT_AUTHENTICATION = 'OAuth';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {Object|null|undefined} integrationClient
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
function resolveChatGptClientId(integrationClient) {
|
|
27
|
+
const fromClient =
|
|
28
|
+
integrationClient && typeof integrationClient.keycloakClientId === 'string'
|
|
29
|
+
? integrationClient.keycloakClientId.trim()
|
|
30
|
+
: '';
|
|
31
|
+
return fromClient || CHATGPT_OAUTH2_PROFILE_ID;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Prefer live discovery endpoints; never fall back to invented realm paths.
|
|
36
|
+
* @param {Object|null|undefined} asMetadata
|
|
37
|
+
* @param {string} field
|
|
38
|
+
* @returns {string|null}
|
|
39
|
+
*/
|
|
40
|
+
function discoveryEndpoint(asMetadata, field) {
|
|
41
|
+
const value = asMetadata && asMetadata[field];
|
|
42
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return value.trim();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {Object} params
|
|
50
|
+
* @param {Object} params.runtimeValues
|
|
51
|
+
* @param {Object|null} [params.integrationClient]
|
|
52
|
+
* @param {Object|null} [params.asMetadata]
|
|
53
|
+
* @returns {Object}
|
|
54
|
+
*/
|
|
55
|
+
function buildChatGptFormValues(params) {
|
|
56
|
+
const runtimeValues = params.runtimeValues || {};
|
|
57
|
+
const asMetadata = params.asMetadata || null;
|
|
58
|
+
const authorizationUrl = discoveryEndpoint(asMetadata, 'authorization_endpoint');
|
|
59
|
+
const tokenUrl = discoveryEndpoint(asMetadata, 'token_endpoint');
|
|
60
|
+
const oauth2ProfileUrl =
|
|
61
|
+
typeof runtimeValues.oauth2ProfileUrl === 'string' ? runtimeValues.oauth2ProfileUrl : '';
|
|
62
|
+
return {
|
|
63
|
+
name: runtimeValues.appName || runtimeValues.baseName || '',
|
|
64
|
+
description:
|
|
65
|
+
(typeof runtimeValues.appDescription === 'string' && runtimeValues.appDescription.trim()) ||
|
|
66
|
+
getDefaultChannelDescription(),
|
|
67
|
+
connection: 'Server URL',
|
|
68
|
+
serverUrl: runtimeValues.mcpUrl || '',
|
|
69
|
+
authentication: CHATGPT_AUTHENTICATION,
|
|
70
|
+
clientId: resolveChatGptClientId(params.integrationClient),
|
|
71
|
+
authorizationUrl,
|
|
72
|
+
tokenUrl,
|
|
73
|
+
oauth2ProfileId: CHATGPT_OAUTH2_PROFILE_ID,
|
|
74
|
+
oauth2ProfilePath: CHATGPT_OAUTH2_PROFILE_PATH,
|
|
75
|
+
oauth2ProfileUrl,
|
|
76
|
+
appsCreateUrl: CHATGPT_APPS_CREATE_URL
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @param {Object} values
|
|
82
|
+
* @returns {string[]}
|
|
83
|
+
*/
|
|
84
|
+
function formatChatGptFormValueLines(values) {
|
|
85
|
+
const lines = [];
|
|
86
|
+
if (values.name) {
|
|
87
|
+
lines.push(`Name: ${values.name}`);
|
|
88
|
+
}
|
|
89
|
+
if (values.description) {
|
|
90
|
+
lines.push(`Description: ${values.description}`);
|
|
91
|
+
}
|
|
92
|
+
if (values.serverUrl) {
|
|
93
|
+
lines.push(`Server URL: ${values.serverUrl}`);
|
|
94
|
+
}
|
|
95
|
+
if (values.authentication) {
|
|
96
|
+
lines.push(`Authentication: ${values.authentication}`);
|
|
97
|
+
}
|
|
98
|
+
return lines;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @param {string|null|undefined} blocker
|
|
103
|
+
* @returns {string}
|
|
104
|
+
*/
|
|
105
|
+
function chatgptDiscoveryBlockerLabel(blocker) {
|
|
106
|
+
if (blocker === 'remoteMcpUnavailable') {
|
|
107
|
+
return 'Runtime MCP endpoint is unavailable.';
|
|
108
|
+
}
|
|
109
|
+
if (blocker === 'discoveryUnavailable') {
|
|
110
|
+
return 'Runtime discovery is unavailable.';
|
|
111
|
+
}
|
|
112
|
+
if (typeof blocker === 'string' && blocker.trim()) {
|
|
113
|
+
return blocker.trim();
|
|
114
|
+
}
|
|
115
|
+
return 'Runtime is not ready.';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = {
|
|
119
|
+
CHATGPT_APPS_CREATE_URL,
|
|
120
|
+
resolveChatGptClientId,
|
|
121
|
+
buildChatGptFormValues,
|
|
122
|
+
formatChatGptFormValueLines,
|
|
123
|
+
chatgptDiscoveryBlockerLabel
|
|
124
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register Claude callback URLs on the existing claude Integration Client.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Thin ChatGPT-callback wrapper with the Claude OAuth contract
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
registerChatGptCallbackUrl,
|
|
11
|
+
registerChatGptCallbackUrls,
|
|
12
|
+
findChatGptIntegrationClient,
|
|
13
|
+
chatgptProfileUrl
|
|
14
|
+
} = require('./chatgpt-callback');
|
|
15
|
+
const {
|
|
16
|
+
CLAUDE_INTEGRATION_CLIENT_KEY,
|
|
17
|
+
CLAUDE_OAUTH2_PROFILE_ID,
|
|
18
|
+
CLAUDE_OAUTH2_PROFILE_PATH
|
|
19
|
+
} = require('./claude-runtime-contract');
|
|
20
|
+
|
|
21
|
+
const CLAUDE_CALLBACK_CONTRACT = {
|
|
22
|
+
integrationClientKey: CLAUDE_INTEGRATION_CLIENT_KEY,
|
|
23
|
+
oauth2ProfileId: CLAUDE_OAUTH2_PROFILE_ID,
|
|
24
|
+
oauth2ProfilePath: CLAUDE_OAUTH2_PROFILE_PATH,
|
|
25
|
+
vendorLabel: 'Claude'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {Object} ctx
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
function claudeProfileUrl(ctx) {
|
|
33
|
+
return chatgptProfileUrl(ctx, CLAUDE_CALLBACK_CONTRACT);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {Object} ctx
|
|
38
|
+
* @param {Object} [deps]
|
|
39
|
+
* @returns {Promise<Object>}
|
|
40
|
+
*/
|
|
41
|
+
async function findClaudeIntegrationClient(ctx, deps = {}) {
|
|
42
|
+
return findChatGptIntegrationClient(ctx, { ...deps, contract: CLAUDE_CALLBACK_CONTRACT });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {Object} params
|
|
47
|
+
* @returns {Promise<Object>}
|
|
48
|
+
*/
|
|
49
|
+
async function registerClaudeCallbackUrls(params) {
|
|
50
|
+
return registerChatGptCallbackUrls({ ...params, contract: CLAUDE_CALLBACK_CONTRACT });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {Object} params
|
|
55
|
+
* @returns {Promise<Object>}
|
|
56
|
+
*/
|
|
57
|
+
async function registerClaudeCallbackUrl(params) {
|
|
58
|
+
return registerChatGptCallbackUrl({ ...params, contract: CLAUDE_CALLBACK_CONTRACT });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
CLAUDE_CALLBACK_CONTRACT,
|
|
63
|
+
claudeProfileUrl,
|
|
64
|
+
findClaudeIntegrationClient,
|
|
65
|
+
registerClaudeCallbackUrl,
|
|
66
|
+
registerClaudeCallbackUrls
|
|
67
|
+
};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude continuation for channel add: preflight, form values, callback PUT.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Keep add-channel.js free of Claude-specific continuation logic
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
printValidating,
|
|
11
|
+
printRuntimeDeployed,
|
|
12
|
+
printRuntimeUnavailable,
|
|
13
|
+
printOAuthConnected,
|
|
14
|
+
printOAuthNotConnected,
|
|
15
|
+
printLabeledUrl,
|
|
16
|
+
printUseLines,
|
|
17
|
+
printRemainingSteps,
|
|
18
|
+
printFixThenRerun
|
|
19
|
+
} = require('./channel-add-tty');
|
|
20
|
+
const { formatWarningLine } = require('../utils/cli-layout-chalk');
|
|
21
|
+
const logger = require('../utils/logger');
|
|
22
|
+
const { runChatGptPreflight } = require('./chatgpt-preflight');
|
|
23
|
+
const {
|
|
24
|
+
buildClaudeFormValues,
|
|
25
|
+
formatClaudeFormValueLines,
|
|
26
|
+
CLAUDE_CONNECTORS_URL
|
|
27
|
+
} = require('./claude-setup-values');
|
|
28
|
+
const {
|
|
29
|
+
registerClaudeCallbackUrls,
|
|
30
|
+
findClaudeIntegrationClient,
|
|
31
|
+
claudeProfileUrl
|
|
32
|
+
} = require('./claude-callback');
|
|
33
|
+
const { CLAUDE_KNOWN_CALLBACK_URIS, CLAUDE_REMAINING_STEPS } = require('./claude-runtime-contract');
|
|
34
|
+
const { resolveChannelRuntimeValues } = require('./channel-runtime-resolver');
|
|
35
|
+
const { vendorFacingUrlsFromCtx } = require('./vendor-dataplane-url');
|
|
36
|
+
const { loadChannelPackageContext } = require('./channel-discovery');
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} message
|
|
40
|
+
* @returns {string}
|
|
41
|
+
*/
|
|
42
|
+
function claudePreflightMessage(message) {
|
|
43
|
+
return String(message || '').replace(/^ChatGPT preflight:\s*/i, 'Claude preflight: ');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {Error} error
|
|
48
|
+
* @returns {boolean}
|
|
49
|
+
*/
|
|
50
|
+
function isClaudeOAuthPreflightError(error) {
|
|
51
|
+
const message = error && error.message ? String(error.message) : '';
|
|
52
|
+
return /pkce|authorization.server|protected resource/i.test(message);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param {Object} params
|
|
57
|
+
* @returns {string}
|
|
58
|
+
*/
|
|
59
|
+
function claudeResumeCommand(params) {
|
|
60
|
+
const name =
|
|
61
|
+
(params.options && params.options.name) ||
|
|
62
|
+
(params.runtimeValues && (params.runtimeValues.baseName || params.runtimeValues.appName)) ||
|
|
63
|
+
'';
|
|
64
|
+
const quoted = name ? `"${name}"` : '"<name>"';
|
|
65
|
+
return `aifabrix channel add claude --name ${quoted}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param {Object} params
|
|
70
|
+
* @param {Error} error
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
73
|
+
function printClaudePreflightFailure(params, error) {
|
|
74
|
+
if (isClaudeOAuthPreflightError(error)) {
|
|
75
|
+
printRuntimeDeployed();
|
|
76
|
+
printOAuthNotConnected();
|
|
77
|
+
printFixThenRerun('Fix OAuth discovery', claudeResumeCommand(params));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
printRuntimeUnavailable();
|
|
81
|
+
printFixThenRerun('Fix the Runtime connection', claudeResumeCommand(params));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Fail-closed MCP/OAuth checks before Claude instructions.
|
|
86
|
+
* @param {Object} params
|
|
87
|
+
* @returns {Promise<Object|null>}
|
|
88
|
+
*/
|
|
89
|
+
async function maybeAssertClaudePreflight(params) {
|
|
90
|
+
if (params.channelTarget !== 'claude') {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
printValidating('Claude');
|
|
94
|
+
try {
|
|
95
|
+
params.preflight = await runChatGptPreflight(params);
|
|
96
|
+
printRuntimeDeployed();
|
|
97
|
+
if (!(params.preflight && params.preflight.skipped)) {
|
|
98
|
+
printOAuthConnected();
|
|
99
|
+
}
|
|
100
|
+
return params.preflight;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
if (error && error.message) {
|
|
103
|
+
error.message = claudePreflightMessage(error.message);
|
|
104
|
+
}
|
|
105
|
+
printClaudePreflightFailure(params, error);
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {Object} ctx
|
|
112
|
+
* @returns {Promise<Object|null>}
|
|
113
|
+
*/
|
|
114
|
+
async function loadClaudeClientOrNull(ctx) {
|
|
115
|
+
try {
|
|
116
|
+
return await findClaudeIntegrationClient(ctx);
|
|
117
|
+
} catch {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @param {Object} values
|
|
124
|
+
* @returns {void}
|
|
125
|
+
*/
|
|
126
|
+
function printClaudeFormValues(values) {
|
|
127
|
+
printLabeledUrl('Open Claude connectors', CLAUDE_CONNECTORS_URL);
|
|
128
|
+
printUseLines(formatClaudeFormValueLines(values));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @param {Object} options
|
|
133
|
+
* @returns {string[]}
|
|
134
|
+
*/
|
|
135
|
+
function callbackUrlsForAdd(options = {}) {
|
|
136
|
+
const urls = [...CLAUDE_KNOWN_CALLBACK_URIS];
|
|
137
|
+
const extra = typeof options.callbackUrl === 'string' ? options.callbackUrl.trim() : '';
|
|
138
|
+
if (extra && !urls.includes(extra)) {
|
|
139
|
+
urls.push(extra);
|
|
140
|
+
}
|
|
141
|
+
return urls;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @param {Object} result
|
|
146
|
+
* @param {Object} ctx
|
|
147
|
+
* @returns {void}
|
|
148
|
+
*/
|
|
149
|
+
function printClaudeCallbackResult(result, ctx) {
|
|
150
|
+
if (!result.fallback) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
logger.log(
|
|
154
|
+
formatWarningLine(
|
|
155
|
+
`Missing integration-client:update. Add the callback on the Claude profile: ${result.profileUrl || claudeProfileUrl(ctx)}`
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Remaining Anthropic-owned steps after AI Fabrix prep.
|
|
162
|
+
* @returns {void}
|
|
163
|
+
*/
|
|
164
|
+
function printClaudeRemainingSteps() {
|
|
165
|
+
printRemainingSteps('Claude', CLAUDE_REMAINING_STEPS);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @param {Object} params
|
|
170
|
+
* @returns {Promise<void>}
|
|
171
|
+
*/
|
|
172
|
+
async function runClaudeChannelAddContinuation(params) {
|
|
173
|
+
const preflight = params.preflight || (await runChatGptPreflight(params));
|
|
174
|
+
const client = await loadClaudeClientOrNull(params.ctx);
|
|
175
|
+
const values = buildClaudeFormValues({
|
|
176
|
+
runtimeValues: params.runtimeValues,
|
|
177
|
+
integrationClient: client,
|
|
178
|
+
asMetadata: preflight && preflight.asMetadata
|
|
179
|
+
});
|
|
180
|
+
printClaudeFormValues(values);
|
|
181
|
+
const result = await registerClaudeCallbackUrls({
|
|
182
|
+
ctx: params.ctx,
|
|
183
|
+
callbackUrls: callbackUrlsForAdd(params.options)
|
|
184
|
+
});
|
|
185
|
+
printClaudeCallbackResult(result, params.ctx);
|
|
186
|
+
printClaudeRemainingSteps();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @param {Object} params
|
|
191
|
+
* @returns {Promise<void>}
|
|
192
|
+
*/
|
|
193
|
+
async function maybeRunClaudeContinuation(params) {
|
|
194
|
+
if (params.channelTarget !== 'claude') {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
await runClaudeChannelAddContinuation(params);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* After callback PUT: re-validate Runtime and OAuth.
|
|
202
|
+
* @param {Object} ctx
|
|
203
|
+
* @returns {Promise<void>}
|
|
204
|
+
*/
|
|
205
|
+
async function runClaudeConfigureValidate(ctx) {
|
|
206
|
+
let packageContext = null;
|
|
207
|
+
try {
|
|
208
|
+
packageContext = await loadChannelPackageContext({
|
|
209
|
+
dataplaneBaseUrl: ctx.dataplaneUrl,
|
|
210
|
+
authConfig: ctx.authConfig,
|
|
211
|
+
channelTarget: 'claude'
|
|
212
|
+
});
|
|
213
|
+
} catch {
|
|
214
|
+
packageContext = null;
|
|
215
|
+
}
|
|
216
|
+
const vendor = vendorFacingUrlsFromCtx(ctx);
|
|
217
|
+
const runtimeValues = resolveChannelRuntimeValues({
|
|
218
|
+
dataplaneBaseUrl: vendor.dataplaneBaseUrl,
|
|
219
|
+
controllerUrl: vendor.controllerUrl,
|
|
220
|
+
channelTarget: 'claude',
|
|
221
|
+
appName: 'Claude',
|
|
222
|
+
environment: ctx.environment,
|
|
223
|
+
packageContext
|
|
224
|
+
});
|
|
225
|
+
await maybeAssertClaudePreflight({
|
|
226
|
+
channelTarget: 'claude',
|
|
227
|
+
runtimeValues,
|
|
228
|
+
ctx,
|
|
229
|
+
options: {}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Dry-run TTY: no live OAuth.
|
|
235
|
+
* @param {Object} params
|
|
236
|
+
* @returns {void}
|
|
237
|
+
*/
|
|
238
|
+
function printClaudeDryRunTty(params) {
|
|
239
|
+
printValidating('Claude');
|
|
240
|
+
printRuntimeDeployed();
|
|
241
|
+
const values = buildClaudeFormValues({ runtimeValues: params.runtimeValues || {} });
|
|
242
|
+
printLabeledUrl('Open Claude connectors', CLAUDE_CONNECTORS_URL);
|
|
243
|
+
printUseLines(formatClaudeFormValueLines(values));
|
|
244
|
+
printRemainingSteps('Claude', CLAUDE_REMAINING_STEPS);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
module.exports = {
|
|
248
|
+
maybeAssertClaudePreflight,
|
|
249
|
+
maybeRunClaudeContinuation,
|
|
250
|
+
runClaudeChannelAddContinuation,
|
|
251
|
+
runClaudeConfigureValidate,
|
|
252
|
+
printClaudeDryRunTty,
|
|
253
|
+
callbackUrlsForAdd
|
|
254
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude custom connector runtime contract constants (plan 178.0).
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Runtime MCP + Anthropic connector URLs used by the claude channel
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
RUNTIME_ORCHESTRATION_SYSTEM_KEY,
|
|
11
|
+
CHATGPT_RUNTIME_TRANSPORT,
|
|
12
|
+
CHATGPT_RUNTIME_AUTH_MODE
|
|
13
|
+
} = require('./chatgpt-runtime-contract');
|
|
14
|
+
|
|
15
|
+
const CLAUDE_RUNTIME_SYSTEM_KEY = RUNTIME_ORCHESTRATION_SYSTEM_KEY;
|
|
16
|
+
const CLAUDE_RUNTIME_TRANSPORT = CHATGPT_RUNTIME_TRANSPORT;
|
|
17
|
+
const CLAUDE_RUNTIME_AUTH_MODE = CHATGPT_RUNTIME_AUTH_MODE;
|
|
18
|
+
const CLAUDE_OAUTH2_PROFILE_ID = 'miso-claude';
|
|
19
|
+
const CLAUDE_OAUTH2_PROFILE_PATH = '/external-access/oauth2-profiles/miso-claude';
|
|
20
|
+
const CLAUDE_INTEGRATION_CLIENT_KEY = 'claude';
|
|
21
|
+
const CLAUDE_CONNECTORS_URL = 'https://claude.ai/new#settings/customize-connectors';
|
|
22
|
+
const CLAUDE_CALLBACK_URI = 'https://claude.ai/api/mcp/auth_callback';
|
|
23
|
+
const CLAUDE_KNOWN_CALLBACK_URIS = [CLAUDE_CALLBACK_URI];
|
|
24
|
+
const CLAUDE_CONNECTOR_DESCRIPTION =
|
|
25
|
+
'Use governed enterprise work tools only. Resolve Role Assistants dynamically and keep business reasoning inside authorized Role Assistant boundaries.';
|
|
26
|
+
const CLAUDE_REMAINING_STEPS = [];
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
CLAUDE_RUNTIME_SYSTEM_KEY,
|
|
30
|
+
CLAUDE_RUNTIME_TRANSPORT,
|
|
31
|
+
CLAUDE_RUNTIME_AUTH_MODE,
|
|
32
|
+
CLAUDE_OAUTH2_PROFILE_ID,
|
|
33
|
+
CLAUDE_OAUTH2_PROFILE_PATH,
|
|
34
|
+
CLAUDE_INTEGRATION_CLIENT_KEY,
|
|
35
|
+
CLAUDE_CONNECTORS_URL,
|
|
36
|
+
CLAUDE_CALLBACK_URI,
|
|
37
|
+
CLAUDE_KNOWN_CALLBACK_URIS,
|
|
38
|
+
CLAUDE_CONNECTOR_DESCRIPTION,
|
|
39
|
+
CLAUDE_REMAINING_STEPS
|
|
40
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime values for the Claude custom-connector channel.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Same Runtime MCP as ChatGPT; Claude OAuth profile and connector URL
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
CLAUDE_RUNTIME_SYSTEM_KEY,
|
|
11
|
+
CLAUDE_RUNTIME_TRANSPORT,
|
|
12
|
+
CLAUDE_RUNTIME_AUTH_MODE,
|
|
13
|
+
CLAUDE_OAUTH2_PROFILE_ID,
|
|
14
|
+
CLAUDE_OAUTH2_PROFILE_PATH,
|
|
15
|
+
CLAUDE_CONNECTORS_URL,
|
|
16
|
+
CLAUDE_CONNECTOR_DESCRIPTION
|
|
17
|
+
} = require('./claude-runtime-contract');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} [controllerUrl]
|
|
21
|
+
* @param {string} [dataplaneBaseUrl]
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
function authorizationServerBase(controllerUrl, dataplaneBaseUrl) {
|
|
25
|
+
const candidate = controllerUrl || dataplaneBaseUrl;
|
|
26
|
+
try {
|
|
27
|
+
return `${new URL(candidate).origin}/auth/realms/aifabrix`;
|
|
28
|
+
} catch {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {Object} resolved
|
|
35
|
+
* @param {Object} params
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
function applyClaudeRuntimeValues(resolved, params) {
|
|
39
|
+
resolved.runtimeSystemKey = CLAUDE_RUNTIME_SYSTEM_KEY;
|
|
40
|
+
resolved.runtimeTransport = CLAUDE_RUNTIME_TRANSPORT;
|
|
41
|
+
resolved.runtimeAuthMode = CLAUDE_RUNTIME_AUTH_MODE;
|
|
42
|
+
resolved.layerBToolNames = Array.isArray(params.layerBToolNames) ? [...params.layerBToolNames] : [];
|
|
43
|
+
resolved.scopes = Array.isArray(params.scopes) ? [...params.scopes] : [];
|
|
44
|
+
resolved.scopesJson = JSON.stringify(resolved.scopes);
|
|
45
|
+
resolved.oauth2ProfileId = CLAUDE_OAUTH2_PROFILE_ID;
|
|
46
|
+
resolved.oauth2ProfilePath = CLAUDE_OAUTH2_PROFILE_PATH;
|
|
47
|
+
resolved.claudeConnectorDescription = CLAUDE_CONNECTOR_DESCRIPTION;
|
|
48
|
+
resolved.claudeConnectorsUrl = CLAUDE_CONNECTORS_URL;
|
|
49
|
+
const controllerUrl = typeof params.controllerUrl === 'string' ? params.controllerUrl.trim() : '';
|
|
50
|
+
if (controllerUrl) {
|
|
51
|
+
resolved.oauth2ProfileUrl = `${controllerUrl.replace(/\/$/, '')}${CLAUDE_OAUTH2_PROFILE_PATH}`;
|
|
52
|
+
}
|
|
53
|
+
resolved.authorizationServerBase = authorizationServerBase(controllerUrl, resolved.dataplaneBaseUrl);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
applyClaudeRuntimeValues
|
|
58
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer-facing Claude connector form values: Name and Server URL.
|
|
3
|
+
*
|
|
4
|
+
* @fileoverview Claude channel form values — describe, don't configure
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
CLAUDE_OAUTH2_PROFILE_ID,
|
|
11
|
+
CLAUDE_OAUTH2_PROFILE_PATH,
|
|
12
|
+
CLAUDE_CONNECTORS_URL
|
|
13
|
+
} = require('./claude-runtime-contract');
|
|
14
|
+
const { getDefaultChannelDescription } = require('./channel-targets');
|
|
15
|
+
|
|
16
|
+
const CLAUDE_AUTHENTICATION = 'OAuth';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object|null|undefined} integrationClient
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
function resolveClaudeClientId(integrationClient) {
|
|
23
|
+
const fromClient =
|
|
24
|
+
integrationClient && typeof integrationClient.keycloakClientId === 'string'
|
|
25
|
+
? integrationClient.keycloakClientId.trim()
|
|
26
|
+
: '';
|
|
27
|
+
return fromClient || CLAUDE_OAUTH2_PROFILE_ID;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {Object|null|undefined} asMetadata
|
|
32
|
+
* @param {string} field
|
|
33
|
+
* @returns {string|null}
|
|
34
|
+
*/
|
|
35
|
+
function discoveryEndpoint(asMetadata, field) {
|
|
36
|
+
const value = asMetadata && asMetadata[field];
|
|
37
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return value.trim();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {Object} params
|
|
45
|
+
* @returns {Object}
|
|
46
|
+
*/
|
|
47
|
+
function buildClaudeFormValues(params) {
|
|
48
|
+
const runtimeValues = params.runtimeValues || {};
|
|
49
|
+
const asMetadata = params.asMetadata || null;
|
|
50
|
+
const oauth2ProfileUrl =
|
|
51
|
+
typeof runtimeValues.oauth2ProfileUrl === 'string' ? runtimeValues.oauth2ProfileUrl : '';
|
|
52
|
+
return {
|
|
53
|
+
name: runtimeValues.appName || runtimeValues.baseName || '',
|
|
54
|
+
description:
|
|
55
|
+
(typeof runtimeValues.appDescription === 'string' && runtimeValues.appDescription.trim()) ||
|
|
56
|
+
getDefaultChannelDescription(),
|
|
57
|
+
serverUrl: runtimeValues.mcpUrl || '',
|
|
58
|
+
authentication: CLAUDE_AUTHENTICATION,
|
|
59
|
+
clientId: resolveClaudeClientId(params.integrationClient),
|
|
60
|
+
authorizationUrl: discoveryEndpoint(asMetadata, 'authorization_endpoint'),
|
|
61
|
+
tokenUrl: discoveryEndpoint(asMetadata, 'token_endpoint'),
|
|
62
|
+
oauth2ProfileId: CLAUDE_OAUTH2_PROFILE_ID,
|
|
63
|
+
oauth2ProfilePath: CLAUDE_OAUTH2_PROFILE_PATH,
|
|
64
|
+
oauth2ProfileUrl,
|
|
65
|
+
connectorsUrl: CLAUDE_CONNECTORS_URL
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {Object} values
|
|
71
|
+
* @returns {string[]}
|
|
72
|
+
*/
|
|
73
|
+
function formatClaudeFormValueLines(values) {
|
|
74
|
+
const lines = [];
|
|
75
|
+
if (values.name) {
|
|
76
|
+
lines.push(`Name: ${values.name}`);
|
|
77
|
+
}
|
|
78
|
+
if (values.serverUrl) {
|
|
79
|
+
lines.push(`Server URL: ${values.serverUrl}`);
|
|
80
|
+
}
|
|
81
|
+
return lines;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = {
|
|
85
|
+
CLAUDE_CONNECTORS_URL,
|
|
86
|
+
resolveClaudeClientId,
|
|
87
|
+
buildClaudeFormValues,
|
|
88
|
+
formatClaudeFormValueLines
|
|
89
|
+
};
|