diff --git a/packages/ingest-types/src/types.gen.ts b/packages/ingest-types/src/types.gen.ts index 64e947fef27..165549b564d 100644 --- a/packages/ingest-types/src/types.gen.ts +++ b/packages/ingest-types/src/types.gen.ts @@ -13619,6 +13619,10 @@ export type GetFeaturesResponses = { * Whether new free-tier subscriptions are enabled for this caller. Current servers always emit a boolean; clients should tolerate absence when talking to older servers that predate this declared field. */ new_free_tier_subscriptions?: boolean + /** + * Whether the frontend should enable Open on Cloud. True enables the feature and false disables it, overriding the client build default. Optional so older servers or an unconfigured rollout leave the client build default in effect (enabled in development, disabled in production). This is a UI rollout switch, not authorization to access workflows or execute jobs on Cloud. + */ + open_on_cloud_enabled?: boolean /** * Whether this environment advertises the authenticated private saved-workflow UUID link contract (?workflow=UUID&workspace=ID, with deployment=ID for a custom environment or environment=standard). Absent or false means unsupported. Published only from an explicit boolean FrontendFeatureFlags dynamic-config entry, enabled by an operator after the matching frontend release. This describes URL support, not workflow access or deployment eligibility; those remain authenticated checks. No default configuration enables it. */ diff --git a/packages/ingest-types/src/zod.gen.ts b/packages/ingest-types/src/zod.gen.ts index fd42a0093cf..d44e0f28e3c 100644 --- a/packages/ingest-types/src/zod.gen.ts +++ b/packages/ingest-types/src/zod.gen.ts @@ -6227,6 +6227,7 @@ export const zGetFeaturesResponse = z.object({ max_upload_size: z.int().optional(), model_upload_folders: z.array(z.string()).optional(), new_free_tier_subscriptions: z.boolean().optional(), + open_on_cloud_enabled: z.boolean().optional(), private_workflow_links_enabled: z.boolean().optional(), sso_enabled: z.boolean().optional(), stripe_publishable_key: z.string().optional(), diff --git a/src/composables/__mocks__/useFeatureFlags.ts b/src/composables/__mocks__/useFeatureFlags.ts index 080e774cf66..fa36bad365a 100644 --- a/src/composables/__mocks__/useFeatureFlags.ts +++ b/src/composables/__mocks__/useFeatureFlags.ts @@ -24,6 +24,7 @@ const defaultFlags: FeatureFlags = { userSecretsEnabled: false, nodeReplacementsEnabled: false, deployToCloud: false, + openOnCloudEnabled: false, nodeLibraryEssentialsEnabled: false, comfyHubUploadEnabled: false, comfyHubProfileGateEnabled: false, diff --git a/src/composables/useFeatureFlags.test.ts b/src/composables/useFeatureFlags.test.ts index db8be790058..7317e58c8c2 100644 --- a/src/composables/useFeatureFlags.test.ts +++ b/src/composables/useFeatureFlags.test.ts @@ -597,6 +597,43 @@ describe('useFeatureFlags', () => { }) }) + describe('openOnCloudEnabled', () => { + beforeEach(() => { + vi.mocked(api.getServerFeature).mockImplementation( + (_path, defaultValue) => defaultValue + ) + }) + + afterEach(() => { + remoteConfig.value = {} + }) + + it('stays off in a production build that serves no value', () => { + vi.stubEnv('DEV', false) + + expect(useFeatureFlags().flags.openOnCloudEnabled).toBe(false) + }) + + it('defaults on in a development build that serves no value', () => { + vi.stubEnv('DEV', true) + + expect(useFeatureFlags().flags.openOnCloudEnabled).toBe(true) + }) + + it.for([ + { dev: false, served: true, expected: true }, + { dev: true, served: false, expected: false } + ])( + 'follows a remote config $served over the dev=$dev default', + ({ dev, served, expected }) => { + vi.stubEnv('DEV', dev) + remoteConfig.value = { open_on_cloud_enabled: served } + + expect(useFeatureFlags().flags.openOnCloudEnabled).toBe(expected) + } + ) + }) + describe('assetsEnabled', () => { it.for([ ['stable cohort without the flag', undefined, false], diff --git a/src/composables/useFeatureFlags.ts b/src/composables/useFeatureFlags.ts index bd8874048a1..0ec9b16413c 100644 --- a/src/composables/useFeatureFlags.ts +++ b/src/composables/useFeatureFlags.ts @@ -214,6 +214,13 @@ export function useFeatureFlags() { get nodeReplacementsEnabled() { return api.getServerFeature(ServerFeatureFlag.NODE_REPLACEMENTS, false) }, + get openOnCloudEnabled() { + return resolveFlag( + ServerFeatureFlag.OPEN_ON_CLOUD_ENABLED, + remoteConfig.value.open_on_cloud_enabled, + import.meta.env.DEV + ) + }, get deployToCloud() { return api.getServerFeature(ServerFeatureFlag.DEPLOY_TO_CLOUD, false) }, @@ -425,6 +432,7 @@ export function startFeatureFlagTelemetry() { flags.partnerNodeGovernanceEnabled, [ServerFeatureFlag.USER_SECRETS_ENABLED]: flags.userSecretsEnabled, [ServerFeatureFlag.NODE_REPLACEMENTS]: flags.nodeReplacementsEnabled, + [ServerFeatureFlag.OPEN_ON_CLOUD_ENABLED]: flags.openOnCloudEnabled, [ServerFeatureFlag.NODE_LIBRARY_ESSENTIALS_ENABLED]: flags.nodeLibraryEssentialsEnabled, [ServerFeatureFlag.COMFYHUB_UPLOAD_ENABLED]: flags.comfyHubUploadEnabled, diff --git a/src/platform/remoteConfig/serverFeatureFlag.ts b/src/platform/remoteConfig/serverFeatureFlag.ts index 8e2670e735e..298a9b7d3f0 100644 --- a/src/platform/remoteConfig/serverFeatureFlag.ts +++ b/src/platform/remoteConfig/serverFeatureFlag.ts @@ -16,6 +16,7 @@ export enum ServerFeatureFlag { DEPLOYMENT_START_ENABLED = 'deployment_start_enabled', USER_SECRETS_ENABLED = 'user_secrets_enabled', NODE_REPLACEMENTS = 'node_replacements', + OPEN_ON_CLOUD_ENABLED = 'open_on_cloud_enabled', DEPLOY_TO_CLOUD = 'deploy_to_cloud', NODE_LIBRARY_ESSENTIALS_ENABLED = 'node_library_essentials_enabled', COMFYHUB_UPLOAD_ENABLED = 'comfyhub_upload_enabled',