Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
feat: restrict SaaS workflow collaboration to paid plans (#45549)
非法操作45279b704d44
diff --git a/api/controllers/console/socketio/workflow.py b/api/controllers/console/socketio/workflow.pyindex e062c0cd5a3..0e6b978e603 100644--- a/api/controllers/console/socketio/workflow.py+++ b/api/controllers/console/socketio/workflow.py@@ -11,7 +11,8 @@ from extensions.otel.workflow_collaboration import observe_workflow_eventfrom libs.passport import PassportServicefrom libs.token import extract_access_tokenfrom repositories.workflow_collaboration_repository import WorkflowCollaborationRepository-from services.workflow_collaboration_service import WorkflowCollaborationService+from services.errors.billing import BillingUpstreamError+from services.workflow_collaboration_service import WorkflowCollaborationNotEntitledError, WorkflowCollaborationServicerepository = WorkflowCollaborationRepository()collaboration_service = WorkflowCollaborationService(repository, sio)@@ -72,8 +73,14 @@ def handle_user_connect(sid, data):if not workflow_id:return {"msg": "workflow_id is required"}, 400- with sio.app.app_context(), session_factory.create_session() as session:- result = collaboration_service.authorize_and_join_workflow_room(workflow_id, sid, session=session)+ try:+ with sio.app.app_context(), session_factory.create_session() as session:+ result = collaboration_service.authorize_and_join_workflow_room(workflow_id, sid, session=session)+ except BillingUpstreamError:+ logging.exception("Failed to check collaboration entitlement (workflow_id=%s)", workflow_id)+ return {"msg": "collaboration_unavailable"}, 503+ except WorkflowCollaborationNotEntitledError:+ return {"msg": "not_entitled"}, 403if not result:return {"msg": "unauthorized"}, 401diff --git a/api/openapi/markdown/console-openapi.md b/api/openapi/markdown/console-openapi.mdindex ef329f4fa2b..556f4b4310a 100644--- a/api/openapi/markdown/console-openapi.md+++ b/api/openapi/markdown/console-openapi.md@@ -26329,6 +26329,7 @@ Effective feature availability and limits for the current workspace.| model_load_balancing_enabled | boolean | | Yes || trigger_event | [Quota](#quota) | | Yes || webapp_copyright_enabled | boolean | | Yes |+| workflow_collaboration_enabled | boolean | | Yes || workspace_members | [LicenseLimitationModel](#licenselimitationmodel) | | Yes |#### Feedback@@ -35570,7 +35571,6 @@ Non-sensitive bootstrap snapshot exposed before Console or Web authentication.| deployment_edition | [DeploymentEdition](#deploymentedition) | | Yes || enable_app_deploy | boolean | | Yes || enable_change_email | boolean, <br>**Default:** true | | Yes |-| enable_collaboration_mode | boolean, <br>**Default:** true | | Yes || enable_creators_platform | boolean | | Yes || enable_email_code_login | boolean | | Yes || enable_email_password_login | boolean, <br>**Default:** true | | Yes |diff --git a/api/openapi/markdown/web-openapi.md b/api/openapi/markdown/web-openapi.mdindex 3d35c1c8d14..b73eee0f45a 100644--- a/api/openapi/markdown/web-openapi.md+++ b/api/openapi/markdown/web-openapi.md@@ -2399,7 +2399,6 @@ Non-sensitive bootstrap snapshot exposed before Console or Web authentication.| deployment_edition | [DeploymentEdition](#deploymentedition) | | Yes || enable_app_deploy | boolean | | Yes || enable_change_email | boolean, <br>**Default:** true | | Yes |-| enable_collaboration_mode | boolean, <br>**Default:** true | | Yes || enable_creators_platform | boolean | | Yes || enable_email_code_login | boolean | | Yes || enable_email_password_login | boolean, <br>**Default:** true | | Yes |diff --git a/api/services/entities/feature_entities.py b/api/services/entities/feature_entities.pyindex 77badc2b40e..393451bc379 100644--- a/api/services/entities/feature_entities.py+++ b/api/services/entities/feature_entities.py@@ -151,6 +151,7 @@ class FeatureModel(FeatureResponseModel):education: EducationModel = EducationModel()enable_skill: bool = Trueenable_knowledge_fs: bool = False+ workflow_collaboration_enabled: bool = Falsemembers: LimitationModel = LimitationModel(size=0, limit=1)apps: LimitationModel = LimitationModel(size=0, limit=10)# Indexing tasks still consume this internally; Console queries vector usage separately.@@ -195,7 +196,6 @@ class SystemFeatureModel(FeatureResponseModel):enable_email_code_login: bool = Falseenable_email_password_login: bool = Trueenable_social_oauth_login: bool = False- enable_collaboration_mode: bool = Trueis_allow_register: bool = Falseis_email_setup: bool = Falselicense: LicenseStatusModel = LicenseStatusModel()diff --git a/api/services/feature_service.py b/api/services/feature_service.pyindex b9473289a40..74646dcb6f9 100644--- a/api/services/feature_service.py+++ b/api/services/feature_service.py@@ -34,6 +34,17 @@ class FeatureService:billing_info = BillingService.get_info(tenant_id, exclude_vector_space=True)return CloudPlan(billing_info.subscription.plan)+ @classmethod+ def can_use_workflow_collaboration(cls, tenant_id: str, *, plan: CloudPlan | None = None) -> bool:+ """Return the workspace entitlement using its loaded plan, or propagate billing failures."""+ if not dify_config.ENABLE_COLLABORATION_MODE:+ return False+ if dify_config.DEPLOYMENT_EDITION != DeploymentEdition.CLOUD:+ return True+ if not tenant_id:+ return False+ return (plan if plan is not None else cls.get_workspace_plan(tenant_id)).is_paid+@classmethoddef get_features(cls, tenant_id: str, exclude_vector_space: bool = False) -> feature_entities.FeatureModel:features = feature_entities.FeatureModel()@@ -59,6 +70,9 @@ class FeatureService:features=features,tenant_id=tenant_id,)+ features.workflow_collaboration_enabled = cls.can_use_workflow_collaboration(+ tenant_id, plan=features.billing.subscription.plan+ )return featuresdiff --git a/api/services/system_feature_service.py b/api/services/system_feature_service.pyindex 58e3c7ab522..448d49c3181 100644--- a/api/services/system_feature_service.py+++ b/api/services/system_feature_service.py@@ -148,7 +148,6 @@ class SystemFeatureService:system_features.enable_email_code_login = dify_config.ENABLE_EMAIL_CODE_LOGINsystem_features.enable_email_password_login = dify_config.ENABLE_EMAIL_PASSWORD_LOGINsystem_features.enable_social_oauth_login = dify_config.ENABLE_SOCIAL_OAUTH_LOGIN- system_features.enable_collaboration_mode = dify_config.ENABLE_COLLABORATION_MODEsystem_features.is_allow_register = dify_config.ALLOW_REGISTERsystem_features.is_email_setup = dify_config.MAIL_TYPE is not None and dify_config.MAIL_TYPE != ""system_features.enable_change_email = dify_config.ENABLE_CHANGE_EMAILdiff --git a/api/services/workflow_collaboration_service.py b/api/services/workflow_collaboration_service.pyindex 8e1f0c8a01a..efca0b8b190 100644--- a/api/services/workflow_collaboration_service.py+++ b/api/services/workflow_collaboration_service.py@@ -18,6 +18,7 @@ from models.account import Accountfrom models.model import Appfrom repositories.workflow_collaboration_repository import WorkflowCollaborationRepository, WorkflowSessionInfofrom services.enterprise.rbac_service import RBACService+from services.feature_service import FeatureServicelogger = logging.getLogger(__name__)@@ -27,6 +28,10 @@ _PROCESS_SERVER_ID: str | None = None_PROCESS_SERVER_ID_PID: int | None = None+class WorkflowCollaborationNotEntitledError(Exception):+ """The workspace cannot use workflow collaboration."""++def _get_process_server_id() -> str:global _PROCESS_SERVER_ID, _PROCESS_SERVER_ID_PID # pylint: disable=global-statement@@ -104,10 +109,11 @@ class WorkflowCollaborationService:self, workflow_id: str, sid: str, *, session: Session) -> tuple[str, bool] | None:"""- Join a collaboration room only after validating the socket session and tenant-scoped app access.+ Join a collaboration room only after validating the socket session, app access, and workspace entitlement.The Socket.IO payload still calls the room key `workflow_id`, but the identifier is the workflow app's- `App.id`. Returning `None` lets the controller reject the join before any Redis or room state is created.+ `App.id`. Missing access returns `None`; an ineligible workspace raises+ `WorkflowCollaborationNotEntitledError` before any Redis or room state is created."""socket_session = self._socketio.get_session(sid)user_id = socket_session.get("user_id")@@ -125,6 +131,9 @@ class WorkflowCollaborationService:)return None+ if not FeatureService.can_use_workflow_collaboration(str(tenant_id)):+ raise WorkflowCollaborationNotEntitledError+self._ensure_server_heartbeat_started()session_info: WorkflowSessionInfo = {diff --git a/api/tests/e2e_tests/containers/services/test_feature_service.py b/api/tests/e2e_tests/containers/services/test_feature_service.pyindex b4b4ec25a43..6a362c34cd5 100644--- a/api/tests/e2e_tests/containers/services/test_feature_service.py+++ b/api/tests/e2e_tests/containers/services/test_feature_service.py@@ -269,7 +269,6 @@ class TestFeatureService:mock_config.ENABLE_EMAIL_CODE_LOGIN = Truemock_config.ENABLE_EMAIL_PASSWORD_LOGIN = Truemock_config.ENABLE_SOCIAL_OAUTH_LOGIN = False- mock_config.ENABLE_COLLABORATION_MODE = Truemock_config.ALLOW_REGISTER = Falsemock_config.ALLOW_CREATE_WORKSPACE = Falsemock_config.MAIL_TYPE = "smtp"@@ -294,7 +293,6 @@ class TestFeatureService:# Verify authentication settingsassert result.enable_email_code_login is Trueassert result.enable_email_password_login is False- assert result.enable_collaboration_mode is Trueassert result.is_allow_register is False# Verify branding configuration@@ -438,7 +436,6 @@ class TestFeatureService:mock_config.ENABLE_EMAIL_CODE_LOGIN = Truemock_config.ENABLE_EMAIL_PASSWORD_LOGIN = Truemock_config.ENABLE_SOCIAL_OAUTH_LOGIN = False- mock_config.ENABLE_COLLABORATION_MODE = Falsemock_config.ENABLE_CHANGE_EMAIL = Truemock_config.ALLOW_REGISTER = Truemock_config.ALLOW_CREATE_WORKSPACE = True@@ -462,7 +459,6 @@ class TestFeatureService:assert result.enable_email_code_login is Trueassert result.enable_email_password_login is Trueassert result.enable_social_oauth_login is False- assert result.enable_collaboration_mode is Falseassert result.is_allow_register is Trueassert result.is_email_setup is Truediff --git a/api/tests/unit_tests/controllers/console/socketio/test_workflow.py b/api/tests/unit_tests/controllers/console/socketio/test_workflow.pyindex f4a4ecaa89c..d5eaddb10b5 100644--- a/api/tests/unit_tests/controllers/console/socketio/test_workflow.py+++ b/api/tests/unit_tests/controllers/console/socketio/test_workflow.py@@ -9,13 +9,16 @@ from engineio.socket import Socketfrom flask import Flaskfrom opentelemetry.sdk.metrics import MeterProviderfrom opentelemetry.sdk.metrics.export import Gauge, Histogram, InMemoryMetricReader, Metric, Sum-from socketio.packet import CONNECT_ERROR, Packet+from socketio.packet import ACK, CONNECT_ERROR, Packet+from sqlalchemy.orm import Sessionfrom werkzeug.test import EnvironBuilderfrom controllers.console.socketio import workflowfrom extensions.ext_redis import RedisClientWrapperfrom extensions.otel import workflow_collaborationfrom extensions.otel.workflow_collaboration import WorkflowCollaborationMetrics+from services.errors.billing import BillingUpstreamUnavailableError+from services.workflow_collaboration_service import WorkflowCollaborationNotEntitledError@pytest.fixture@@ -103,6 +106,65 @@ def test_connect_without_auth_payload_records_one_rejection(_assert_single_event(_read_metrics(reader), "connect", "rejected")+def test_user_connect_returns_ack_when_billing_is_unavailable(+ collaboration_server: tuple[socketio.Server, WorkflowCollaborationMetrics, InMemoryMetricReader],+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """Billing failures return a 503 ACK to the client."""+ server, _, reader = collaboration_server+ eio_sid = "billing-unavailable"+ transport = Socket(server.eio, eio_sid)+ server.eio.sockets[eio_sid] = transport+ sid = server.manager.connect(eio_sid, "/")++ def billing_unavailable(*_args: object, **_kwargs: object) -> None:+ raise BillingUpstreamUnavailableError("billing unavailable")++ monkeypatch.setattr(workflow.session_factory, "create_session", Session)+ monkeypatch.setattr(workflow.collaboration_service, "authorize_and_join_workflow_room", billing_unavailable)++ server._handle_event_internal(server, sid, eio_sid, ["user_connect", {"workflow_id": "wf-1"}], "/", 42)++ response = Packet(encoded_packet=transport.queue.get_nowait().data)+ assert response.packet_type == ACK+ assert response.id == 42+ assert response.data == [{"msg": "collaboration_unavailable"}, 503]+ _assert_single_event(_read_metrics(reader), "user_connect", "error")+++def test_user_connect_distinguishes_plan_rejection_from_missing_access(+ collaboration_server: tuple[socketio.Server, WorkflowCollaborationMetrics, InMemoryMetricReader],+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ server, _, _ = collaboration_server+ monkeypatch.setattr(workflow.session_factory, "create_session", Session)++ def not_entitled(*_args: object, **_kwargs: object) -> None:+ raise WorkflowCollaborationNotEntitledError++ monkeypatch.setattr(workflow.collaboration_service, "authorize_and_join_workflow_room", not_entitled)+ assert server.handlers["/"]["user_connect"]("sid-1", {"workflow_id": "wf-1"}) == ({"msg": "not_entitled"}, 403)++ monkeypatch.setattr(workflow.collaboration_service, "authorize_and_join_workflow_room", lambda *_args, **_kw: None)+ assert server.handlers["/"]["user_connect"]("sid-1", {"workflow_id": "wf-1"}) == ({"msg": "unauthorized"}, 401)+++def test_user_connect_does_not_hide_unrelated_errors(+ collaboration_server: tuple[socketio.Server, WorkflowCollaborationMetrics, InMemoryMetricReader],+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ server, _, _ = collaboration_server++ def unexpected_error(*_args: object, **_kwargs: object) -> None:+ raise RuntimeError("unexpected error")++ monkeypatch.setattr(workflow.session_factory, "create_session", Session)+ monkeypatch.setattr(workflow.collaboration_service, "authorize_and_join_workflow_room", unexpected_error)++ with pytest.raises(RuntimeError, match="unexpected error"):+ server.handlers["/"]["user_connect"]("sid-1", {"workflow_id": "wf-1"})++def test_disconnect_with_reason_records_one_success(collaboration_server: tuple[socketio.Server, WorkflowCollaborationMetrics, InMemoryMetricReader],redis_transport: tuple[RedisClientWrapper, MagicMock],diff --git a/api/tests/unit_tests/controllers/console/test_feature.py b/api/tests/unit_tests/controllers/console/test_feature.pyindex 6d9327721b7..00f1a686805 100644--- a/api/tests/unit_tests/controllers/console/test_feature.py+++ b/api/tests/unit_tests/controllers/console/test_feature.py@@ -241,6 +241,7 @@ def test_public_system_features_exposes_gate_without_account_app_or_provider(assert response.status_code == 200payload = response.get_json()assert payload["agent_tracing_api_collection_enabled"] is enabled+ assert "enable_collaboration_mode" not in payloadassert "tracing_provider" not in payloadassert "runtime_enabled" not in payloadassert "queryable" not in payloaddiff --git a/api/tests/unit_tests/dev/test_generate_swagger_specs.py b/api/tests/unit_tests/dev/test_generate_swagger_specs.pyindex 8421365a32b..ca5c764e3e6 100644--- a/api/tests/unit_tests/dev/test_generate_swagger_specs.py+++ b/api/tests/unit_tests/dev/test_generate_swagger_specs.py@@ -495,6 +495,7 @@ def test_console_file_and_audio_responses_declare_binary_success_and_json_errorsdef test_system_features_specs_exclude_backend_only_fields(generated_specs: list[Path]):excluded_fields = {+ "enable_collaboration_mode","enable_trial_app","is_allow_create_workspace","max_plugin_package_size",diff --git a/api/tests/unit_tests/services/test_feature_service.py b/api/tests/unit_tests/services/test_feature_service.pyindex 6e813f32c92..217da3f7dbb 100644--- a/api/tests/unit_tests/services/test_feature_service.py+++ b/api/tests/unit_tests/services/test_feature_service.py@@ -19,6 +19,47 @@ def test_education_feature_is_disabled_by_default() -> None:assert FeatureModel().education.enabled is False+ ("edition", "plan", "enabled", "expected"),+ [+ (DeploymentEdition.CLOUD, CloudPlan.SANDBOX, True, False),+ (DeploymentEdition.CLOUD, CloudPlan.PROFESSIONAL, True, True),+ (DeploymentEdition.CLOUD, CloudPlan.TEAM, True, True),+ (DeploymentEdition.CLOUD, CloudPlan.TEAM, False, False),+ (DeploymentEdition.COMMUNITY, CloudPlan.SANDBOX, True, True),+ (DeploymentEdition.ENTERPRISE, CloudPlan.SANDBOX, True, True),+ (DeploymentEdition.COMMUNITY, CloudPlan.SANDBOX, False, False),+ ],+)+def test_workflow_collaboration_feature_uses_the_loaded_plan(+ monkeypatch: pytest.MonkeyPatch,+ config_overrides: Callable[..., None],+ edition: DeploymentEdition,+ plan: CloudPlan,+ enabled: bool,+ expected: bool,+) -> None:+ config_overrides(DEPLOYMENT_EDITION=edition, ENABLE_COLLABORATION_MODE=enabled)+ billing_calls: list[str] = []++ def fill_billing(features: FeatureModel, tenant_id: str, exclude_vector_space: bool = False) -> None:+ assert exclude_vector_space is False+ billing_calls.append(tenant_id)+ features.billing.subscription.plan = plan++ def fail_extra_plan_lookup(_tenant_id: str) -> CloudPlan:+ raise AssertionError("the loaded plan should be reused")++ monkeypatch.setattr(FeatureService, "_fulfill_params_from_billing_api", fill_billing)+ monkeypatch.setattr(FeatureService, "get_workspace_plan", fail_extra_plan_lookup)+ monkeypatch.setattr(feature_service_module.EnterpriseService, "get_workspace_info", lambda _tenant_id: {})++ features = FeatureService.get_features("tenant-1")++ assert features.workflow_collaboration_enabled is expected+ assert billing_calls == (["tenant-1"] if edition == DeploymentEdition.CLOUD else [])++@pytest.mark.parametrize("edition", list(DeploymentEdition))def test_education_is_advertised_only_where_its_endpoints_exist(config_overrides: Callable[..., None], edition: DeploymentEditiondiff --git a/api/tests/unit_tests/services/test_system_feature_service.py b/api/tests/unit_tests/services/test_system_feature_service.pyindex 2ddd731db6e..75f330d7267 100644--- a/api/tests/unit_tests/services/test_system_feature_service.py+++ b/api/tests/unit_tests/services/test_system_feature_service.py@@ -25,6 +25,15 @@ def test_get_system_features_excludes_app_dsl_version() -> None:assert "app_dsl_version" not in result[email protected]("enabled", [False, True])+def test_get_system_features_excludes_collaboration_deployment_flag(+ config_overrides: Callable[..., None], enabled: bool+) -> None:+ config_overrides(ENABLE_COLLABORATION_MODE=enabled)++ assert "enable_collaboration_mode" not in SystemFeatureService.get_public_system_features().model_dump()++@pytest.mark.parametrize("enabled", [False, True])def test_get_system_features_reads_enable_change_email(config_overrides: Callable[..., None],diff --git a/api/tests/unit_tests/services/test_workflow_collaboration_service.py b/api/tests/unit_tests/services/test_workflow_collaboration_service.pyindex 4414debdc74..5435b72b4b4 100644--- a/api/tests/unit_tests/services/test_workflow_collaboration_service.py+++ b/api/tests/unit_tests/services/test_workflow_collaboration_service.py@@ -9,12 +9,17 @@ from sqlalchemy import Enginefrom sqlalchemy.orm import Sessionfrom core.rbac import RBACPermission, RBACResourceScope+from enums import CloudPlan, DeploymentEditionfrom extensions.ext_redis import RedisClientWrapperfrom models.account import Account, Tenantfrom models.base import TypeBasefrom models.model import App, AppModefrom repositories.workflow_collaboration_repository import WorkflowCollaborationRepository-from services.workflow_collaboration_service import SYNC_REQUEST_TIMEOUT_SECONDS, WorkflowCollaborationService+from services.workflow_collaboration_service import (+ SYNC_REQUEST_TIMEOUT_SECONDS,+ WorkflowCollaborationNotEntitledError,+ WorkflowCollaborationService,+)from tests.helpers.unit.config_override import config_overrides_contextfrom tests.helpers.unit.model_factories import make_appfrom tests.helpers.unit.services.workflow_collaboration_fixtures import RedisState, seed_session, seed_sessions@@ -63,6 +68,82 @@ def _app(*, app_id: str, tenant_id: str, maintainer: str | None = None) -> App:class TestWorkflowCollaborationService:+ @pytest.mark.parametrize(+ ("edition", "plan", "enabled", "allowed"),+ [+ (DeploymentEdition.CLOUD, CloudPlan.SANDBOX, True, False),+ (DeploymentEdition.CLOUD, CloudPlan.PROFESSIONAL, True, True),+ (DeploymentEdition.CLOUD, CloudPlan.TEAM, True, True),+ (DeploymentEdition.COMMUNITY, CloudPlan.SANDBOX, True, True),+ (DeploymentEdition.ENTERPRISE, CloudPlan.SANDBOX, True, True),+ (DeploymentEdition.CLOUD, CloudPlan.TEAM, False, False),+ (DeploymentEdition.COMMUNITY, CloudPlan.SANDBOX, False, False),+ ],+ )+ def test_join_respects_workspace_entitlement(+ self,+ real_service: ServiceFixture,+ db_session: Session,+ edition: DeploymentEdition,+ plan: CloudPlan,+ enabled: bool,+ allowed: bool,+ ) -> None:+ service, repository, socketio = real_service+ socketio.get_session.return_value = {"user_id": "u-1", "tenant_id": "t-1"}+ db_session.add(_app(app_id="wf-1", tenant_id="t-1"))+ db_session.commit()++ with (+ config_overrides_context(DEPLOYMENT_EDITION=edition, ENABLE_COLLABORATION_MODE=enabled, RBAC_ENABLED=False),+ patch(+ "services.workflow_collaboration_service.FeatureService.get_workspace_plan", return_value=plan+ ) as get_plan,+ ):+ if allowed:+ result = service.authorize_and_join_workflow_room("wf-1", "sid-1", session=db_session)+ assert result is not None+ else:+ with pytest.raises(WorkflowCollaborationNotEntitledError):+ service.authorize_and_join_workflow_room("wf-1", "sid-1", session=db_session)++ if edition == DeploymentEdition.CLOUD and enabled:+ get_plan.assert_called_once_with("t-1")+ else:+ get_plan.assert_not_called()+ assert bool(repository.list_sessions("wf-1")) is allowed+ assert socketio.enter_room.called is allowed+ assert socketio.start_background_task.called is allowed+ assert repository.server_heartbeat_exists("server-1") is allowed+ if not allowed:+ socketio.emit.assert_not_called()++ def test_join_does_not_create_session_when_billing_fails(+ self, real_service: ServiceFixture, db_session: Session+ ) -> None:+ service, repository, socketio = real_service+ socketio.get_session.return_value = {"user_id": "u-1", "tenant_id": "t-1"}+ db_session.add(_app(app_id="wf-1", tenant_id="t-1"))+ db_session.commit()++ with (+ config_overrides_context(+ DEPLOYMENT_EDITION=DeploymentEdition.CLOUD, ENABLE_COLLABORATION_MODE=True, RBAC_ENABLED=False+ ),+ patch(+ "services.workflow_collaboration_service.FeatureService.get_workspace_plan",+ side_effect=ValueError("invalid billing response"),+ ),+ pytest.raises(ValueError, match="invalid billing response"),+ ):+ service.authorize_and_join_workflow_room("wf-1", "sid-1", session=db_session)++ assert repository.list_sessions("wf-1") == []+ assert not repository.server_heartbeat_exists("server-1")+ socketio.start_background_task.assert_not_called()+ socketio.enter_room.assert_not_called()+ socketio.emit.assert_not_called()+def test_authorize_and_join_workflow_room_returns_leader_status(self, real_service: ServiceFixture, db_session: Session) -> None:@@ -147,16 +228,18 @@ class TestWorkflowCollaborationService:db_session.commit()with (- config_overrides_context(RBAC_ENABLED=True),+ config_overrides_context(RBAC_ENABLED=True, DEPLOYMENT_EDITION=DeploymentEdition.CLOUD),patch("services.workflow_collaboration_service.RBACService.CheckAccess.check", return_value=False) as check_access,+ patch("services.workflow_collaboration_service.FeatureService.get_workspace_plan") as get_plan,patch.object(collaboration_service, "get_or_set_leader") as get_leader,patch.object(collaboration_service, "broadcast_online_users") as broadcast_online_users,):result = collaboration_service.authorize_and_join_workflow_room("wf-1", "sid-1", session=db_session)assert result is None+ get_plan.assert_not_called()check_access.assert_called_once_with("t-1","u-1",diff --git a/packages/contracts/generated/api/console/features/types.gen.ts b/packages/contracts/generated/api/console/features/types.gen.tsindex c9991184421..b5ad2eb9dad 100644--- a/packages/contracts/generated/api/console/features/types.gen.ts+++ b/packages/contracts/generated/api/console/features/types.gen.ts@@ -22,6 +22,7 @@ export type FeatureModel = {model_load_balancing_enabled: booleantrigger_event: Quotawebapp_copyright_enabled: boolean+ workflow_collaboration_enabled: booleanworkspace_members: LicenseLimitationModel}diff --git a/packages/contracts/generated/api/console/features/zod.gen.ts b/packages/contracts/generated/api/console/features/zod.gen.tsindex 2b64335853c..209206ddf35 100644--- a/packages/contracts/generated/api/console/features/zod.gen.ts+++ b/packages/contracts/generated/api/console/features/zod.gen.ts@@ -129,6 +129,7 @@ export const zFeatureModel = z.object({usage: 0,}),webapp_copyright_enabled: z.boolean().default(false),+ workflow_collaboration_enabled: z.boolean().default(false),workspace_members: zLicenseLimitationModel.default({enabled: false,limit: 0,diff --git a/packages/contracts/generated/api/console/system-features/types.gen.ts b/packages/contracts/generated/api/console/system-features/types.gen.tsindex 6fd2007682e..359e7f9e433 100644--- a/packages/contracts/generated/api/console/system-features/types.gen.ts+++ b/packages/contracts/generated/api/console/system-features/types.gen.ts@@ -10,7 +10,6 @@ export type SystemFeatureModel = {deployment_edition: DeploymentEditionenable_app_deploy: booleanenable_change_email: boolean- enable_collaboration_mode: booleanenable_creators_platform: booleanenable_email_code_login: booleanenable_email_password_login: booleandiff --git a/packages/contracts/generated/api/console/system-features/zod.gen.ts b/packages/contracts/generated/api/console/system-features/zod.gen.tsindex a263864a563..a77adb6d7bd 100644--- a/packages/contracts/generated/api/console/system-features/zod.gen.ts+++ b/packages/contracts/generated/api/console/system-features/zod.gen.ts@@ -139,7 +139,6 @@ export const zSystemFeatureModel = z.object({deployment_edition: zDeploymentEdition,enable_app_deploy: z.boolean().default(false),enable_change_email: z.boolean().default(true),- enable_collaboration_mode: z.boolean().default(true),enable_creators_platform: z.boolean().default(false),enable_email_code_login: z.boolean().default(false),enable_email_password_login: z.boolean().default(true),diff --git a/packages/contracts/generated/api/web/types.gen.ts b/packages/contracts/generated/api/web/types.gen.tsindex fde08efc68b..90418dae330 100644--- a/packages/contracts/generated/api/web/types.gen.ts+++ b/packages/contracts/generated/api/web/types.gen.ts@@ -1242,7 +1242,6 @@ export type SystemFeatureModel = {deployment_edition: DeploymentEditionenable_app_deploy: booleanenable_change_email: boolean- enable_collaboration_mode: booleanenable_creators_platform: booleanenable_email_code_login: booleanenable_email_password_login: booleandiff --git a/packages/contracts/generated/api/web/zod.gen.ts b/packages/contracts/generated/api/web/zod.gen.tsindex 315710c0355..1d36633be07 100644--- a/packages/contracts/generated/api/web/zod.gen.ts+++ b/packages/contracts/generated/api/web/zod.gen.ts@@ -2019,7 +2019,6 @@ export const zSystemFeatureModel = z.object({deployment_edition: zDeploymentEdition,enable_app_deploy: z.boolean().default(false),enable_change_email: z.boolean().default(true),- enable_collaboration_mode: z.boolean().default(true),enable_creators_platform: z.boolean().default(false),enable_email_code_login: z.boolean().default(false),enable_email_password_login: z.boolean().default(true),diff --git a/web/app/components/apps/__tests__/delete-app.browser.spec.tsx b/web/app/components/apps/__tests__/delete-app.browser.spec.tsxindex df60592d13b..69cf5b1f0b0 100644--- a/web/app/components/apps/__tests__/delete-app.browser.spec.tsx+++ b/web/app/components/apps/__tests__/delete-app.browser.spec.tsx@@ -86,7 +86,6 @@ async function setup(initialApps: AppPartial[], initialStarredApps: AppPartial[]systemFeatures: {rbac_enabled: true,enable_learn_app: false,- enable_collaboration_mode: false,},})const screen = await render(diff --git a/web/app/components/apps/__tests__/index.spec.tsx b/web/app/components/apps/__tests__/index.spec.tsxindex 4a601904a11..1aed9780fe7 100644--- a/web/app/components/apps/__tests__/index.spec.tsx+++ b/web/app/components/apps/__tests__/index.spec.tsx@@ -164,7 +164,6 @@ async function setup({deployment_edition: cloud ? 'CLOUD' : 'COMMUNITY',enable_learn_app: true,rbac_enabled: true,- enable_collaboration_mode: false,},features: { apps: { size: 0, limit: 10 } },},diff --git a/web/app/components/apps/__tests__/list.spec.tsx b/web/app/components/apps/__tests__/list.spec.tsxindex 45c0d4ca0e8..3cc227ded17 100644--- a/web/app/components/apps/__tests__/list.spec.tsx+++ b/web/app/components/apps/__tests__/list.spec.tsx@@ -5,6 +5,7 @@ import type { StepByStepTourSessionState } from '@/app/components/step-by-step-timport type { consoleClient } from '@/service/console'import type { ConsoleQueryTestOptions } from '@/test/console/query-data'import { zAppPagination } from '@dify/contracts/api/console/apps/zod.gen'+import { zGetFeaturesResponse } from '@dify/contracts/api/console/features/zod.gen'import { act, fireEvent, screen, waitFor, within } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { createStore, Provider as JotaiProvider } from 'jotai'@@ -42,6 +43,7 @@ vi.mock('@/service/console', async (importOriginal) => {return {...actual,consoleQuery: withConsoleResponses(actual.consoleQuery, {+ 'features.get': async () => zGetFeaturesResponse.parse({}),'apps.get': api.apps,'apps.byAppId.delete': api.delete,'apps.starred.get': api.starred,@@ -146,7 +148,6 @@ async function setup(systemFeatures: {rbac_enabled: true,enable_learn_app: false,- enable_collaboration_mode: false,},...options,})@@ -247,7 +248,7 @@ it('waits for both initial requests before announcing results', async () => {})it('queries collaborators only for workflow apps when collaboration is enabled', async () => {- await setup('', { systemFeatures: { enable_collaboration_mode: true } })+ await setup('', { features: { workflow_collaboration_enabled: true } })await waitFor(() => expect(api.online).toHaveBeenCalledWith({ body: { app_ids: ['app-2'] } }))})diff --git a/web/app/components/apps/app-list-catalog.tsx b/web/app/components/apps/app-list-catalog.tsxindex 936a937decf..34b2db7cd90 100644--- a/web/app/components/apps/app-list-catalog.tsx+++ b/web/app/components/apps/app-list-catalog.tsx@@ -73,6 +73,7 @@ type AppListCatalogContentProps = Omit<AppListCatalogProps, 'appListQuery'> &onFetchNextPage: () => Promise<unknown>starredApps: AppPartial[]systemFeatures: GetSystemFeaturesResponse+ isCollaborationEnabled: boolean}>function CatalogSkeleton() {@@ -98,6 +99,7 @@ function AppListCatalogContent({isFetching,isFetchingNextPage,isPlaceholderData,+ isCollaborationEnabled,onCreateBlank,onCreateLearnDify,onCreateTemplate,@@ -137,7 +139,7 @@ function AppListCatalogContent({const { onlineUsersMap: workflowOnlineUsersMap } = useWorkflowOnlineUsers({appIds: workflowOnlineUserAppIds,- enabled: systemFeatures.enable_collaboration_mode,+ enabled: isCollaborationEnabled,})const hasResolvedFirstPage = appListPages.length > 0@@ -372,6 +374,12 @@ export function AppListCatalog(props: AppListCatalogProps) {} = propsconst systemFeaturesQuery = useQuery(systemFeaturesQueryOptions())const systemFeatures = systemFeaturesQuery.data+ const { data: isCollaborationEnabled = false } = useQuery(+ consoleQuery.features.get.queryOptions({+ retry: false,+ select: (features) => features.workflow_collaboration_enabled,+ }),+ )const appList = useInfiniteQuery(consoleQuery.apps.get.infiniteOptions({input: (pageParam) => ({@@ -383,7 +391,7 @@ export function AppListCatalog(props: AppListCatalogProps) {getNextPageParam: (lastPage) => (lastPage.has_more ? lastPage.page + 1 : undefined),initialPageParam: 1,placeholderData: keepPreviousData,- refetchInterval: systemFeatures?.enable_collaboration_mode ? 10000 : false,+ refetchInterval: isCollaborationEnabled ? 10000 : false,}),)const starredAppList = useQuery(@@ -421,6 +429,7 @@ export function AppListCatalog(props: AppListCatalogProps) {isFetching={appList.isFetching}isFetchingNextPage={appList.isFetchingNextPage}isPlaceholderData={appList.isPlaceholderData}+ isCollaborationEnabled={isCollaborationEnabled}onCreateBlank={onCreateBlank}onCreateLearnDify={onCreateLearnDify}onCreateTemplate={onCreateTemplate}diff --git a/web/app/components/explore/try-app/__tests__/index.spec.tsx b/web/app/components/explore/try-app/__tests__/index.spec.tsxindex 1f1ce235aae..e46b2c4c844 100644--- a/web/app/components/explore/try-app/__tests__/index.spec.tsx+++ b/web/app/components/explore/try-app/__tests__/index.spec.tsx@@ -76,7 +76,7 @@ async function setup(props: Partial<Props> = {}) {{...props}/></NuqsTestingAdapter>,- { queryClient, features: {}, systemFeatures: { enable_collaboration_mode: false } },+ { queryClient, features: {} },),)return { user: userEvent.setup(), onCreate }diff --git a/web/app/components/header/account-setting/__tests__/index.hitl-v2.spec.tsx b/web/app/components/header/account-setting/__tests__/index.hitl-v2.spec.tsxindex bd8c7fe8e85..6faeff88cd9 100644--- a/web/app/components/header/account-setting/__tests__/index.hitl-v2.spec.tsx+++ b/web/app/components/header/account-setting/__tests__/index.hitl-v2.spec.tsx@@ -251,7 +251,6 @@ describe('AccountSetting', () => {webapp_auth: { enabled: true },branding: { enabled: false },enable_marketplace: true,- enable_collaboration_mode: false,rbac_enabled: rbacEnabled,},},diff --git a/web/app/components/rag-pipeline/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/__tests__/index.spec.tsxindex 50186e4771e..c085e5374a7 100644--- a/web/app/components/rag-pipeline/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/__tests__/index.spec.tsx@@ -1,8 +1,10 @@import type { Viewport } from 'reactflow'import type { FetchWorkflowDraftResponse } from '@/types/workflow'import { act, screen } from '@testing-library/react'+import { useAtomValue } from 'jotai'import { createEdge, createNode } from '@/app/components/workflow/__tests__/fixtures'import { WorkflowInitializationProbe } from '@/app/components/workflow/__tests__/workflow-initialization-probe'+import { editorCollaborationEnabledAtom } from '@/app/components/workflow/editor-resource/state'import knowledgeBaseDefault from '@/app/components/workflow/nodes/knowledge-base/default'import { BlockEnum } from '@/app/components/workflow/types'import DatasetDetailContext from '@/context/dataset-detail'@@ -37,11 +39,17 @@ vi.mock('@/service/console', async (importOriginal) => {}})+function CollaborationModeProbe() {+ const enabled = useAtomValue(editorCollaborationEnabledAtom)+ return <output aria-label="Collaboration mode">{enabled ? 'enabled' : 'disabled'}</output>+}+// Full pipeline editing has its own suite; retain the real initialization/provider boundary.vi.mock('../components/rag-pipeline-main', () => ({default: ({ viewport }: { viewport: Viewport }) => (<><WorkflowInitializationProbe />+ <CollaborationModeProbe /><output aria-label="Initial viewport">{JSON.stringify(viewport)}</output></>),@@ -88,12 +96,16 @@ const draft = (): FetchWorkflowDraftResponse => ({marked_comment: '',})-const renderPipeline = (pipelineId: string | null = 'pipeline-1') => {+const renderPipeline = (+ pipelineId: string | null = 'pipeline-1',+ options?: Parameters<typeof renderWithConsoleQuery>[1],+) => {const DatasetProvider = DatasetDetailContext.Providerreturn renderWithConsoleQuery(<DatasetProvider value={{ dataset: createDatasetFixture({ pipeline_id: pipelineId }) }}><RagPipelineWrapper /></DatasetProvider>,+ options,)}@@ -114,12 +126,23 @@ const expectGraph = async () => {describe('RagPipeline', () => {it('offers conversion when the dataset has no pipeline', () => {- renderPipeline(null)+ renderPipeline(null, { systemFeatures: null })expect(screen.getByRole('button', { name: 'datasetPipeline.operations.convert' }),).toBeInTheDocument()expect(requests.draft).not.toHaveBeenCalled()})+ it('disables collaboration even when enabled for the workspace', async () => {+ renderPipeline('pipeline-1', {+ systemFeatures: { deployment_edition: 'CLOUD' },+ features: { workflow_collaboration_enabled: true },+ })+ expect(await screen.findByLabelText('Collaboration mode')).toHaveTextContent('disabled')+ })+ it('does not need deployment features or the workspace subscription to open the editor', async () => {+ renderPipeline('pipeline-1', { systemFeatures: null })+ expect(await screen.findByLabelText('Collaboration mode')).toHaveTextContent('disabled')+ })it('keeps the editor gated until the pipeline draft arrives', async () => {const pending = createDeferred<FetchWorkflowDraftResponse>()requests.draft.mockReturnValue(pending.promise)diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/__tests__/index.spec.tsxindex feacf642ee6..56f0b483730 100644--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/publisher/__tests__/index.spec.tsx@@ -165,7 +165,6 @@ function renderPipeline({const { queryClient } = createConsoleQueryWrapper({systemFeatures: {deployment_edition: 'CLOUD',- enable_collaboration_mode: false,enable_marketplace: false,},features: { knowledge_pipeline: { publish_enabled: publishEnabled } },diff --git a/web/app/components/snippets/__tests__/index.spec.tsx b/web/app/components/snippets/__tests__/index.spec.tsxindex 522a285dafd..31ac4187948 100644--- a/web/app/components/snippets/__tests__/index.spec.tsx+++ b/web/app/components/snippets/__tests__/index.spec.tsx@@ -1,7 +1,9 @@import type { SnippetWorkflow } from '@/types/snippet'import { act, screen, waitFor } from '@testing-library/react'+import { useAtomValue } from 'jotai'import { createEdge, createNode } from '@/app/components/workflow/__tests__/fixtures'import { WorkflowInitializationProbe } from '@/app/components/workflow/__tests__/workflow-initialization-probe'+import { editorCollaborationEnabledAtom } from '@/app/components/workflow/editor-resource/state'import codeNodeDefault from '@/app/components/workflow/nodes/code/default'import { consoleQuery } from '@/service/console'import { createHttpError } from '@/service/http-error'@@ -33,11 +35,17 @@ vi.mock('@/service/console', async (importOriginal) => {}})+function CollaborationModeProbe() {+ const enabled = useAtomValue(editorCollaborationEnabledAtom)+ return <output aria-label="Collaboration mode">{enabled ? 'enabled' : 'disabled'}</output>+}+// SnippetMain owns editing and publishing; this page owns fetching and choosing the initial graph.vi.mock('../components/snippet-main', () => ({default: ({ hasPublishedWorkflow }: { hasPublishedWorkflow: boolean }) => (<><WorkflowInitializationProbe />+ <CollaborationModeProbe /><output aria-label="Published workflow">{String(hasPublishedWorkflow)}</output></>),@@ -125,6 +133,20 @@ describe('SnippetPage', () => {},)+ it.each(['sandbox', 'team'] as const)(+ 'disables collaboration for the %s workspace plan',+ async (plan) => {+ renderWithConsoleQuery(<SnippetPage snippetId="snippet-1" />, {+ systemFeatures: { deployment_edition: 'CLOUD' },+ features: {+ billing: { subscription: { plan } },+ workflow_collaboration_enabled: plan === 'team',+ },+ })+ expect(await screen.findByLabelText('Collaboration mode')).toHaveTextContent('disabled')+ },+ )+it('keeps the loading fallback when the snippet is unavailable', async () => {requests.detail.mockRejectedValue(createHttpError(new Response(null, { status: 404 }), { message: 'Not found' }),diff --git a/web/app/components/snippets/components/__tests__/snippet-main.spec.tsx b/web/app/components/snippets/components/__tests__/snippet-main.spec.tsxindex 847438877ef..c9c3b16943a 100644--- a/web/app/components/snippets/components/__tests__/snippet-main.spec.tsx+++ b/web/app/components/snippets/components/__tests__/snippet-main.spec.tsx@@ -117,7 +117,7 @@ function renderSnippet({published = false,}: { canEdit?: boolean; nodes?: Node[]; published?: boolean } = {}) {const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: false, enable_marketplace: false },+ systemFeatures: { enable_marketplace: false },workspacePermissionKeys: canEdit ? ['snippets.create_and_modify'] : ['snippets.management'],})seedAppDslVersion(queryClient)diff --git a/web/app/components/snippets/hooks/__tests__/use-snippet-refresh-draft.spec.tsx b/web/app/components/snippets/hooks/__tests__/use-snippet-refresh-draft.spec.tsxindex 45b1a65b09d..817a8d64799 100644--- a/web/app/components/snippets/hooks/__tests__/use-snippet-refresh-draft.spec.tsx+++ b/web/app/components/snippets/hooks/__tests__/use-snippet-refresh-draft.spec.tsx@@ -52,7 +52,6 @@ const localViewport = { x: 80, y: 60, zoom: 0.8 }function setup() {const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: false },appDslVersion: '0.6.0',})seedModelProviderQueries(queryClient)diff --git a/web/app/components/workflow-app/__tests__/index.spec.tsx b/web/app/components/workflow-app/__tests__/index.spec.tsxindex 05c087bd708..5f8be52328a 100644--- a/web/app/components/workflow-app/__tests__/index.spec.tsx+++ b/web/app/components/workflow-app/__tests__/index.spec.tsx@@ -1,16 +1,20 @@import type { AppDetailWithSite } from '@dify/contracts/api/console/apps/types.gen'import type { ReactElement } from 'react'-import { screen, waitFor } from '@testing-library/react'+import { zGetFeaturesResponse } from '@dify/contracts/api/console/features/zod.gen'+import { act, screen, waitFor } from '@testing-library/react'+import userEvent from '@testing-library/user-event'+import { useAtomValue } from 'jotai'import { StrictMode } from 'react'import { createEdge, createNode } from '@/app/components/workflow/__tests__/fixtures'import { WorkflowInitializationProbe } from '@/app/components/workflow/__tests__/workflow-initialization-probe'+import { editorCollaborationEnabledAtom } from '@/app/components/workflow/editor-resource/state'import { useWorkflowStore } from '@/app/components/workflow/store'import { useTriggerStatusStore } from '@/app/components/workflow/store/trigger-status'import { BlockEnum } from '@/app/components/workflow/types'import { consoleQuery } from '@/service/console'import { createAccountProfileQueryClient } from '@/test/console/account-profile'import { createQueryClientWrapper } from '@/test/console/query-client'-import { seedAppDetail } from '@/test/console/query-data'+import { seedAppDetail, seedFeatures, seedSystemFeatures } from '@/test/console/query-data'import { render as renderWithConsoleState } from '@/test/console/render'import { createAppDetailFixture } from '@/test/fixtures/app'import { createFileUploadConfigFixture } from '@/test/fixtures/file-upload-config'@@ -24,6 +28,7 @@ let workflowStore: ReturnType<typeof useWorkflowStore>let appDetail: AppDetailWithSiteconst fetchDraft = vi.fn()+const fetchFeatures = vi.fn()let consoleState: {isLoadingCurrentWorkspace: boolean@@ -47,8 +52,18 @@ let appTriggersState: {let searchParamsValue: string | null = null-const render = (ui: ReactElement) => {+const render = (+ ui: ReactElement,+ options?: {+ collaboration?: boolean | null+ },+) => {const queryClient = createAccountProfileQueryClient(consoleState.userProfile)+ seedSystemFeatures(queryClient)+ if (options?.collaboration !== null)+ seedFeatures(queryClient, {+ workflow_collaboration_enabled: options?.collaboration ?? true,+ })seedAppDetail(queryClient, appDetail)queryClient.setQueryData(consoleQuery.apps.byAppId.triggers.get.queryKey({@@ -65,9 +80,10 @@ const render = (ui: ReactElement) => {})),},)- return renderWithConsoleState(ui, {- wrapper: createQueryClientWrapper(queryClient),- })+ return {+ ...renderWithConsoleState(ui, { wrapper: createQueryClientWrapper(queryClient) }),+ queryClient,+ }}vi.mock('@/context/workspace-state', async () => {@@ -108,6 +124,7 @@ vi.mock('@/service/console', async (importOriginal) => {return {...actual,consoleQuery: withConsoleResponses(actual.consoleQuery, {+ 'features.get': () => fetchFeatures(),'files.upload.get': () => createFileUploadConfigFixture(),'apps.byAppId.workflows.defaultWorkflowBlockConfigs.get': () => [],'apps.byAppId.workflows.publish.get': () => createWorkflowResponseFixture(),@@ -131,6 +148,9 @@ vi.mock('@/app/components/workflow-app/components/workflow-main', () => ({<section aria-label="Workflow canvas"><WorkflowInitializationProbe /><output aria-label="Saved viewport">{JSON.stringify(viewport)}</output>+ <output aria-label="Collaboration enabled">+ {String(useAtomValue(editorCollaborationEnabledAtom))}+ </output></section>)},@@ -172,9 +192,100 @@ describe('WorkflowApp', () => {}appTriggersState = {}searchParamsValue = null+ fetchFeatures.mockReset()mockFetchRunDetail.mockReset().mockResolvedValue({ inputs: null })})+ it.each([false, true])(+ 'initializes the editor with collaboration capability %s',+ async (enabled) => {+ render(<WorkflowApp />, { collaboration: enabled })+ expect(await screen.findByRole('region', { name: 'Workflow canvas' })).toBeInTheDocument()+ expect(screen.getByLabelText('Collaboration enabled')).toHaveTextContent(String(enabled))+ },+ )++ it.each([false, true])(+ 'keeps the initial editor mode when workspace capability changes from %s',+ async (initial) => {+ const { queryClient } = render(<WorkflowApp />, { collaboration: initial })+ expect(await screen.findByRole('region', { name: 'Workflow canvas' })).toBeInTheDocument()+ act(() => seedFeatures(queryClient, { workflow_collaboration_enabled: !initial }))+ expect(screen.getByLabelText('Collaboration enabled')).toHaveTextContent(String(initial))+ },+ )++ it('waits for workspace capabilities before starting the editor', async () => {+ let resolveFeatures!: (features: ReturnType<typeof zGetFeaturesResponse.parse>) => void+ fetchFeatures.mockReturnValue(+ new Promise((resolve) => {+ resolveFeatures = resolve+ }),+ )+ fetchDraft.mockClear()++ render(<WorkflowApp />, { collaboration: null })+ expect(screen.getByLabelText('common.loading')).toBeInTheDocument()+ expect(screen.queryByRole('region', { name: 'Workflow canvas' })).not.toBeInTheDocument()+ expect(fetchDraft).not.toHaveBeenCalled()++ await act(async () =>+ resolveFeatures(zGetFeaturesResponse.parse({ workflow_collaboration_enabled: false })),+ )+ expect(await screen.findByRole('region', { name: 'Workflow canvas' })).toBeInTheDocument()+ expect(screen.getByLabelText('Collaboration enabled')).toHaveTextContent('false')+ })++ it('blocks the editor when workspace capabilities cannot be loaded and retries in place', async () => {+ const user = userEvent.setup()+ let resolveRetry!: (features: ReturnType<typeof zGetFeaturesResponse.parse>) => void+ fetchFeatures.mockRejectedValueOnce(new Error('billing unavailable')).mockReturnValueOnce(+ new Promise((resolve) => {+ resolveRetry = resolve+ }),+ )++ render(<WorkflowApp />, { collaboration: null })+ const retry = await screen.findByRole('button', { name: 'common.operation.retry' })+ expect(screen.getByRole('alert')).toHaveTextContent(+ 'workflow.collaboration.capabilityUnavailable',+ )+ expect(screen.queryByRole('region', { name: 'Workflow canvas' })).not.toBeInTheDocument()++ await user.click(retry)+ expect(screen.getByLabelText('common.loading')).toBeInTheDocument()+ expect(screen.queryByRole('region', { name: 'Workflow canvas' })).not.toBeInTheDocument()+ await act(async () =>+ resolveRetry(zGetFeaturesResponse.parse({ workflow_collaboration_enabled: true })),+ )+ expect(await screen.findByRole('region', { name: 'Workflow canvas' })).toBeInTheDocument()+ expect(screen.getByLabelText('Collaboration enabled')).toHaveTextContent('true')+ expect(fetchFeatures).toHaveBeenCalledTimes(2)+ })++ it.each([false, true])(+ 'keeps the editor session in mode %s when a background capability refresh fails',+ async (enabled) => {+ fetchFeatures.mockRejectedValue(new Error('billing unavailable'))+ fetchDraft.mockClear()+ const { queryClient } = render(<WorkflowApp />, { collaboration: enabled })+ const canvas = await screen.findByRole('region', { name: 'Workflow canvas' })+ await screen.findByRole('status', { name: 'Draft hash' })+ const draftCalls = fetchDraft.mock.calls.length++ await act(async () => {+ await queryClient.invalidateQueries({ queryKey: consoleQuery.features.get.queryKey() })+ })++ expect(queryClient.getQueryState(consoleQuery.features.get.queryKey())?.status).toBe('error')+ expect(screen.getByRole('region', { name: 'Workflow canvas' })).toBe(canvas)+ expect(screen.getByLabelText('Collaboration enabled')).toHaveTextContent(String(enabled))+ expect(screen.getByRole('status', { name: 'Draft hash' })).toHaveTextContent('loaded-draft')+ expect(fetchDraft).toHaveBeenCalledTimes(draftCalls)+ expect(screen.queryByRole('alert')).not.toBeInTheDocument()+ },+ )+it('keeps the canvas gated until the workflow draft arrives', async () => {let resolveDraft!: (value: ReturnType<typeof createWorkflowResponseFixture>) => voidfetchDraft.mockReturnValueOnce(diff --git a/web/app/components/workflow-app/__tests__/provider-contract.spec.tsx b/web/app/components/workflow-app/__tests__/provider-contract.spec.tsxindex d805aa3657b..7e5b3083e4d 100644--- a/web/app/components/workflow-app/__tests__/provider-contract.spec.tsx+++ b/web/app/components/workflow-app/__tests__/provider-contract.spec.tsx@@ -6,13 +6,15 @@ import { BlockEnum } from '@/app/components/workflow/types'import { consoleQuery } from '@/service/console'import { createAccountProfileQueryClient } from '@/test/console/account-profile'import { createQueryClientWrapper } from '@/test/console/query-client'-import { seedAppDetail } from '@/test/console/query-data'+import { seedAppDetail, seedFeatures, seedSystemFeatures } from '@/test/console/query-data'import { render as renderWithConsoleState } from '@/test/console/render'import { createAppDetailFixture } from '@/test/fixtures/app'import WorkflowApp from '../index'const render = (ui: ReactElement) => {const queryClient = createAccountProfileQueryClient()+ seedSystemFeatures(queryClient)+ seedFeatures(queryClient, { workflow_collaboration_enabled: true })seedAppDetail(queryClient,createAppDetailFixture({diff --git a/web/app/components/workflow-app/components/__tests__/workflow-main.spec.tsx b/web/app/components/workflow-app/components/__tests__/workflow-main.spec.tsxindex f56145c51bb..9209509fc60 100644--- a/web/app/components/workflow-app/components/__tests__/workflow-main.spec.tsx+++ b/web/app/components/workflow-app/components/__tests__/workflow-main.spec.tsx@@ -14,6 +14,7 @@ import { CollectionType } from '@/app/components/tools/types'import WorkflowWithDefaultContext from '@/app/components/workflow'import { createStartNode } from '@/app/components/workflow/__tests__/fixtures'import { renderWorkflowComponent } from '@/app/components/workflow/__tests__/workflow-test-env'+import { createSocket } from '@/app/components/workflow/collaboration/core/__tests__/test-socket'import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager'import { DSL_EXPORT_CHECK } from '@/app/components/workflow/constants'import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type'@@ -43,6 +44,11 @@ const api = vi.hoisted(() => ({saveDraft:vi.fn<typeof import('@/service/console').consoleClient.apps.byAppId.workflows.draft.post>(),}))+const socketIo = vi.hoisted(() => vi.fn<typeof import('socket.io-client').io>())+vi.mock('socket.io-client', async (importOriginal) => ({+ ...(await importOriginal<typeof import('socket.io-client')>()),+ io: socketIo,+}))vi.mock('@/next/navigation', async (importOriginal) => ({...(await importOriginal<typeof import('@/next/navigation')>()),useParams: () => ({ appId: 'app-1' }),@@ -107,6 +113,7 @@ const draft = (})beforeEach(() => {+ socketIo.mockReset()for (const listeners of Object.values(events)) listeners.clear()vi.spyOn(collaborationManager, 'connect').mockResolvedValue('connection-1')vi.spyOn(collaborationManager, 'disconnect').mockImplementation(() => {})@@ -195,7 +202,7 @@ async function renderMain({triggers?: TriggerWithProvider[]} = {}) {const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: collaboration, enable_marketplace: false },+ systemFeatures: { enable_marketplace: false },})seedAppDslVersion(queryClient)seedAppDetail(@@ -256,7 +263,16 @@ async function renderMain({</NuqsTestingAdapter>,{queryClient,- initialStoreState: { isWorkflowDataLoaded: true, ...initialStoreState },+ resource: {+ kind: 'app',+ appId: 'app-1',+ mode: 'workflow',+ collaborationEnabled: collaboration,+ },+ initialStoreState: {+ isWorkflowDataLoaded: true,+ ...initialStoreState,+ },injectWorkflowStoreSliceFn: createWorkflowSlice as InjectWorkflowStoreSliceFn,},),@@ -264,6 +280,95 @@ async function renderMain({return { ...view, queryClient, features, eventEmitter }}+function useRealCollaborationTransport() {+ for (const name of [+ 'connect',+ 'disconnect',+ 'isConnected',+ 'getIsLeader',+ 'canPersistLocalGraph',+ 'onGraphReadyChange',+ ] as const)+ vi.mocked(collaborationManager[name]).mockRestore()++ const transport = createSocket('socket-app-1', false)+ vi.spyOn(transport.socket, 'disconnect').mockImplementation(() => {+ transport.receive('disconnect', 'io client disconnect')+ return transport.socket+ })+ socketIo.mockReturnValue(transport.socket)+ return transport+}++it.each([+ [401, 'unauthorized', 'workflow.collaboration.joinDenied'],+ [403, 'not_entitled', 'workflow.collaboration.joinDenied'],+ [503, 'collaboration_unavailable', 'workflow.collaboration.joinUnavailable'],+] as const)(+ 'shows the join error for a %s response and blocks saving',+ async (status, message, text) => {+ const user = userEvent.setup()+ const reload = vi.spyOn(window.location, 'reload').mockImplementation(() => {})+ const transport = useRealCollaborationTransport()+ const { store } = await renderMain()+ const originalNodes = store.getState().nodes+ await waitFor(() => expect(socketIo).toHaveBeenCalled())+ act(() => {+ transport.receive('connect')+ transport.acknowledge('user_connect', { msg: message }, status)+ })+ expect(+ within(screen.getByTestId('collaboration-graph-loading')).getByRole('status'),+ ).toHaveTextContent(text)+ expect(collaborationManager.canPersistLocalGraph()).toBe(false)+ expect(store.getState().nodes).toEqual(originalNodes)+ await user.click(screen.getByRole('button', { name: 'workflow.collaboration.reloadPage' }))+ expect(reload).toHaveBeenCalledOnce()+ },+)++it('keeps an established canvas on join failure without offering to reload it', async () => {+ const transport = useRealCollaborationTransport()+ const { store } = await renderMain()+ const originalNodes = store.getState().nodes+ await waitFor(() => expect(socketIo).toHaveBeenCalled())+ act(() => {+ transport.receive('connect')+ transport.receive('status', { isLeader: true })+ transport.acknowledge('user_connect', { msg: 'connected' })+ collaborationManager.emitCursorMove({ x: 1, y: 2, userId: 'user-1', timestamp: 1 })+ transport.acknowledge('mouse_move', { msg: 'unauthorized' }, 401)+ transport.acknowledge('user_connect', { msg: 'not_entitled' }, 403)+ })+ expect(screen.getByText('workflow.collaboration.joinUnavailable')).toBeVisible()+ expect(+ screen.queryByRole('button', { name: 'workflow.collaboration.reloadPage' }),+ ).not.toBeInTheDocument()+ expect(collaborationManager.canPersistLocalGraph()).toBe(false)+ expect(store.getState().nodes).toEqual(originalNodes)+})++it('clears a join error after a successful reconnect even when status precedes the acknowledgement', async () => {+ const transport = useRealCollaborationTransport()+ await renderMain()+ await waitFor(() => expect(socketIo).toHaveBeenCalled())+ act(() => {+ transport.receive('connect')+ transport.acknowledge('user_connect', { msg: 'collaboration_unavailable' }, 503)+ })+ expect(+ within(screen.getByTestId('collaboration-graph-loading')).getByRole('status'),+ ).toHaveTextContent('workflow.collaboration.joinUnavailable')+ act(() => {+ transport.receive('disconnect', 'transport close')+ transport.socket.id = 'socket-app-1-new'+ transport.receive('connect')+ transport.receive('status', { isLeader: true })+ transport.acknowledge('user_connect', { msg: 'connected' })+ })+ expect(screen.queryByText('workflow.collaboration.joinUnavailable')).not.toBeInTheDocument()+})+it('shows synchronization status until the collaborative graph is ready', async () => {await renderMain()expect(screen.queryByText('workflow.common.syncingData')).not.toBeInTheDocument()diff --git a/web/app/components/workflow-app/components/__tests__/workflow-publishing.spec.tsx b/web/app/components/workflow-app/components/__tests__/workflow-publishing.spec.tsxindex 9ffbe4f7949..11d5983e079 100644--- a/web/app/components/workflow-app/components/__tests__/workflow-publishing.spec.tsx+++ b/web/app/components/workflow-app/components/__tests__/workflow-publishing.spec.tsx@@ -200,7 +200,6 @@ function renderEditor({const { queryClient } = createConsoleQueryWrapper({systemFeatures: {deployment_edition: edition,- enable_collaboration_mode: false,enable_marketplace: false,webapp_auth: { enabled: false },},diff --git a/web/app/components/workflow-app/components/workflow-main.tsx b/web/app/components/workflow-app/components/workflow-main.tsxindex 37e9567dfdc..e8aed5e30e0 100644--- a/web/app/components/workflow-app/components/workflow-main.tsx+++ b/web/app/components/workflow-app/components/workflow-main.tsx@@ -1,9 +1,14 @@import type { Features as FeaturesData } from '@/app/components/base/features/types'import type { WorkflowProps } from '@/app/components/workflow'-import type { CollaborationUpdate } from '@/app/components/workflow/collaboration/types/collaboration'+import type {+ CollaborationUpdate,+ JoinFailure,+} from '@/app/components/workflow/collaboration/types/collaboration'import type { Shape as HooksStoreShape } from '@/app/components/workflow/hooks-store/store'import type { Edge, Node } from '@/app/components/workflow/types'import type { FetchWorkflowDraftResponse } from '@/types/workflow'+import { Button } from '@langgenius/dify-ui/button'+import { cn } from '@langgenius/dify-ui/cn'import { useSuspenseQuery } from '@tanstack/react-query'import { useAtomValue } from 'jotai'import { useCallback, useEffect, useMemo, useRef, useState } from 'react'@@ -64,6 +69,7 @@ const WorkflowMain = ({ nodes, edges, viewport }: WorkflowMainProps) => {appId: null as string | null,isReady: false,})+ const [joinFailure, setJoinFailure] = useState<JoinFailure | null>(null)const reactFlow = useReactFlow()const { getWorkflowDraftGraphForCanvas } = useWorkflowDraftGraphForCanvas(appDetail.mode)@@ -128,6 +134,11 @@ const WorkflowMain = ({ nodes, edges, viewport }: WorkflowMainProps) => {})}, [appId, isCollaborationEnabled])+ useEffect(() => {+ if (!appId || !isCollaborationEnabled) return+ return collaborationManager.onJoinFailure(setJoinFailure)+ }, [appId, isCollaborationEnabled])+const handleWorkflowDataUpdate = useCallback((payload: WorkflowDataUpdatePayload) => {const { features, conversation_variables, environment_variables } = payload@@ -551,18 +562,42 @@ const WorkflowMain = ({ nodes, edges, viewport }: WorkflowMainProps) => {(collaborationGraphState.appId !== appId || !collaborationGraphState.isReady) && (<divdata-testid="collaboration-graph-loading"- className="absolute inset-0 z-50 flex cursor-wait items-center justify-center"+ className={cn(+ 'absolute inset-0 z-50 flex items-center justify-center',+ !joinFailure && 'cursor-wait',+ )}><divrole="status"aria-live="polite"className="flex items-center gap-1.5 rounded-lg border-[0.5px] border-components-panel-border bg-components-panel-bg-blur px-3 py-2 system-xs-medium text-text-secondary shadow-lg backdrop-blur-[5px]">- <span- aria-hidden="true"- className="i-ri-loader-4-line size-4 animate-spin text-text-accent motion-reduce:animate-none"- />- <span>{t(($) => $['common.syncingData'], { ns: 'workflow' })}</span>+ {joinFailure ? (+ <>+ <span>+ {joinFailure === 'denied'+ ? t(($) => $['collaboration.joinDenied'], { ns: 'workflow' })+ : t(($) => $['collaboration.joinUnavailable'], { ns: 'workflow' })}+ </span>+ {joinFailure !== 'session_unavailable' && (+ <Button+ size="small"+ variant="secondary"+ onClick={() => window.location.reload()}+ >+ {t(($) => $['collaboration.reloadPage'], { ns: 'workflow' })}+ </Button>+ )}+ </>+ ) : (+ <>+ <span+ aria-hidden="true"+ className="i-ri-loader-4-line size-4 animate-spin text-text-accent motion-reduce:animate-none"+ />+ <span>{t(($) => $['common.syncingData'], { ns: 'workflow' })}</span>+ </>+ )}</div></div>)}diff --git a/web/app/components/workflow-app/hooks/__tests__/use-nodes-sync-draft.spec.ts b/web/app/components/workflow-app/hooks/__tests__/use-nodes-sync-draft.spec.tsindex 463fd0dece5..13acd200629 100644--- a/web/app/components/workflow-app/hooks/__tests__/use-nodes-sync-draft.spec.ts+++ b/web/app/components/workflow-app/hooks/__tests__/use-nodes-sync-draft.spec.ts@@ -127,9 +127,7 @@ const renderSyncDraft = <R>(}: SyncDraftCanvas = {},) => {const featuresStore = createFeaturesStore(features ? { features } : undefined)- const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: isCollaborationEnabled },- })+ const { queryClient } = createConsoleQueryWrapper()seedAppDetail(queryClient, createAppDetailFixture({ id: 'app-1', mode: appMode }))return renderWorkflowCanvasHook(hook, {@@ -138,6 +136,7 @@ const renderSyncDraft = <R>(kind: 'app',appId: 'app-1',mode: appMode === 'advanced-chat' ? 'advanced-chat' : 'workflow',+ collaborationEnabled: isCollaborationEnabled,},nodes,edges,@@ -205,6 +204,30 @@ describe('useNodesSyncDraft', () => {})describe('payload', () => {+ it('saves a full draft when collaboration is disabled', async () => {+ const { result } = renderUseNodesSyncDraft({+ isCollaborationEnabled: false,+ })++ await act(async () => {+ await result.current.doSyncWorkflowDraft()+ })++ expect(mockSyncWorkflowDraft).toHaveBeenCalledOnce()+ expect(mockSyncWorkflowDraft).toHaveBeenCalledWith(+ draftRequest(expect.not.objectContaining({ _is_collaborative: expect.anything() })),+ )+ expect(mockSyncWorkflowDraft).toHaveBeenCalledWith(+ draftRequest(+ expect.objectContaining({+ features: expect.anything(),+ conversation_variables: expect.anything(),+ }),+ ),+ )+ expect(mockCollaborationRequestWorkflowSync).not.toHaveBeenCalled()+ })+it.each(['draft sync', 'page close'] as const)('removes Workflow LLM memory from %s without changing the canvas nodes',async (savePath) => {diff --git a/web/app/components/workflow-app/hooks/__tests__/use-workflow-refresh-draft.spec.tsx b/web/app/components/workflow-app/hooks/__tests__/use-workflow-refresh-draft.spec.tsxindex e844900fcfe..d0865eb8e8a 100644--- a/web/app/components/workflow-app/hooks/__tests__/use-workflow-refresh-draft.spec.tsx+++ b/web/app/components/workflow-app/hooks/__tests__/use-workflow-refresh-draft.spec.tsx@@ -91,7 +91,6 @@ const draftResponse: FetchWorkflowDraftResponse = {function setup(mode: AppMode = 'advanced-chat') {const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: false },appDslVersion: '0.6.0',})seedModelProviderQueries(queryClient)diff --git a/web/app/components/workflow-app/hooks/__tests__/use-workflow-run.spec.tsx b/web/app/components/workflow-app/hooks/__tests__/use-workflow-run.spec.tsxindex f454af4e6eb..181e5d80f53 100644--- a/web/app/components/workflow-app/hooks/__tests__/use-workflow-run.spec.tsx+++ b/web/app/components/workflow-app/hooks/__tests__/use-workflow-run.spec.tsx@@ -143,7 +143,6 @@ async function setup() {const queryClient = createConsoleQueryClient()const { wrapper: ConsoleProvider } = createConsoleQueryWrapper({queryClient,- systemFeatures: { enable_collaboration_mode: false },})seedAppDetail(queryClient, createAppDetailFixture({ id: 'app-1', mode: 'workflow' }))queryClient.setQueryData(consoleQuery.workspaces.current.triggers.get.queryKey({ input: {} }), [])@@ -172,7 +171,9 @@ async function setup() {function Providers({ children }: { children: ReactNode }) {return (<ConsoleProvider>- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ >{/* oxlint-disable-next-line eslint-react/no-context-provider -- use-context-selector requires its Provider API. */}<WorkflowContext.Provider value={store}><FeaturesContext value={features}>@@ -282,7 +283,12 @@ it('saves the graph before running and applies streamed results to the real workresult: { status: WorkflowRunningStatus.Succeeded, outputs: { answer: 'Result' } },resultText: 'Result',})- expect(api.inspect).toHaveBeenCalledWith({ kind: 'app', appId: 'app-1', mode: 'workflow' })+ expect(api.inspect).toHaveBeenCalledWith({+ kind: 'app',+ collaborationEnabled: false,+ appId: 'app-1',+ mode: 'workflow',+ })})it('marks the active node failed and reports the current trace in bounded analytics chunks', async () => {diff --git a/web/app/components/workflow-app/hooks/__tests__/use-workflow-start-run.spec.tsx b/web/app/components/workflow-app/hooks/__tests__/use-workflow-start-run.spec.tsxindex 22ba28ea358..67eddf5ec6e 100644--- a/web/app/components/workflow-app/hooks/__tests__/use-workflow-start-run.spec.tsx+++ b/web/app/components/workflow-app/hooks/__tests__/use-workflow-start-run.spec.tsx@@ -1,6 +1,6 @@import type { ReactNode } from 'react'import type { Features } from '@/app/components/base/features/types'-import type { EditorResource } from '@/app/components/workflow/editor-resource/resource'+import type { TestEditorResource } from '@/app/components/workflow/editor-resource/__tests__/fixture-resource'import type { Shape } from '@/app/components/workflow/store'import type { Node } from '@/app/components/workflow/types'import { act } from '@testing-library/react'@@ -39,7 +39,7 @@ let workflowStore: ReturnType<typeof renderWorkflowCanvasHook>['store']const toNodes = (nodes: { id: string; data: Record<string, unknown> }[]) =>nodes.map(({ id, data }) => createNode({ id, data }))-const renderHook = <R,>(callback: () => R, { resource }: { resource: EditorResource }) => {+const renderHook = <R,>(callback: () => R, { resource }: { resource: TestEditorResource }) => {const featuresStore = createFeaturesStore({ features })const rendered = renderWorkflowCanvasHook(callback, {resource,diff --git a/web/app/components/workflow-app/hooks/use-nodes-sync-draft.ts b/web/app/components/workflow-app/hooks/use-nodes-sync-draft.tsindex b802b15add9..dcd9ff6478a 100644--- a/web/app/components/workflow-app/hooks/use-nodes-sync-draft.ts+++ b/web/app/components/workflow-app/hooks/use-nodes-sync-draft.ts@@ -5,7 +5,7 @@ import type {SyncDraftResult,} from '@/app/components/workflow/hooks-store'import { safe } from '@orpc/client'-import { skipToken, useQuery, useSuspenseQuery } from '@tanstack/react-query'+import { skipToken, useQuery } from '@tanstack/react-query'import { produce } from 'immer'import { useAtomValue } from 'jotai'import { useCallback, useEffect, useRef } from 'react'@@ -13,7 +13,10 @@ import { useTranslation } from 'react-i18next'import { useStoreApi } from 'reactflow'import { useFeaturesStore } from '@/app/components/base/features/hooks'import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager'-import { workflowAppIdentityAtom } from '@/app/components/workflow/editor-resource/state'+import {+ editorCollaborationEnabledAtom,+ workflowAppIdentityAtom,+} from '@/app/components/workflow/editor-resource/state'import { useSerialAsyncCallback } from '@/app/components/workflow/hooks/use-serial-async-callback'import {useNodesReadOnly,@@ -27,7 +30,6 @@ import { useWorkflowStore } from '@/app/components/workflow/store'import { BlockEnum } from '@/app/components/workflow/types'import { normalizeWorkflowNodes } from '@/app/components/workflow/utils/normalize-workflow-nodes'import { API_PREFIX } from '@/config'-import { systemFeaturesQueryOptions } from '@/features/system-features/client'import { isAppDeletingOrDeleted } from '@/service/app-deletion'import { consoleClient, consoleQuery } from '@/service/console'import { postWithKeepalive } from '@/service/fetch'@@ -52,10 +54,7 @@ const useNodesSyncDraftBase = (getNodesReadOnly: () => boolean) => {}),)const { handleRefreshWorkflowDraft } = useWorkflowRefreshDraft()- const { data: isCollaborationEnabled } = useSuspenseQuery({- ...systemFeaturesQueryOptions(),- select: (s) => s.enable_collaboration_mode,- })+ const isCollaborationEnabled = useAtomValue(editorCollaborationEnabledAtom)const isMountedRef = useRef(false)const emptySyncPendingRef = useRef(false)const cancelConfirmationRef = useRef<(() => void) | undefined>(undefined)diff --git a/web/app/components/workflow-app/index.tsx b/web/app/components/workflow-app/index.tsxindex 8b4fea57306..e740e471fc1 100644--- a/web/app/components/workflow-app/index.tsx+++ b/web/app/components/workflow-app/index.tsx@@ -2,9 +2,11 @@import type { Features as FeaturesData } from '@/app/components/base/features/types'import type { InjectWorkflowStoreSliceFn } from '@/app/components/workflow/store'+import { Button } from '@langgenius/dify-ui/button'import { useQuery, useSuspenseQuery } from '@tanstack/react-query'import { useAtomValue } from 'jotai'import { useEffect, useMemo } from 'react'+import { useTranslation } from 'react-i18next'import { isWorkflowAppMode } from '@/app/components/apps/app-type'import { FeaturesProvider } from '@/app/components/base/features'import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'@@ -144,6 +146,12 @@ const WorkflowAppWithAdditionalContext = () => {const WorkflowAppWrapper = () => {const { appId } = useParams<{ appId: string }>()+ const { t } = useTranslation(['common', 'workflow'])+ const collaboration = useQuery({+ ...consoleQuery.features.get.queryOptions(),+ retry: false,+ select: (features) => features.workflow_collaboration_enabled,+ })const { data: mode } = useSuspenseQuery(consoleQuery.apps.byAppId.get.queryOptions({input: { params: { app_id: appId } },@@ -152,8 +160,30 @@ const WorkflowAppWrapper = () => {)if (!isWorkflowAppMode(mode)) throw new Error('This app does not have a workflow editor')+ if (collaboration.data === undefined && collaboration.isPending) {+ return (+ <div className="relative flex size-full items-center justify-center">+ <LoadingPlaceholder />+ </div>+ )+ }+ if (collaboration.data === undefined) {+ return (+ <div className="flex size-full flex-col items-center justify-center gap-4">+ <div role="alert" className="system-sm-regular text-text-tertiary">+ {t(($) => $['collaboration.capabilityUnavailable'], { ns: 'workflow' })}+ </div>+ <Button size="small" variant="secondary" onClick={() => void collaboration.refetch()}>+ {t(($) => $['operation.retry'], { ns: 'common' })}+ </Button>+ </div>+ )+ }+return (- <EditorResourceScope resource={{ kind: 'app', appId, mode }}>+ <EditorResourceScope+ resource={{ kind: 'app', appId, mode, collaborationEnabled: collaboration.data }}+ ><WorkflowContextProviderinjectWorkflowStoreSliceFn={createWorkflowSlice as InjectWorkflowStoreSliceFn}>diff --git a/web/app/components/workflow/__tests__/edge-insert-focus.browser.spec.tsx b/web/app/components/workflow/__tests__/edge-insert-focus.browser.spec.tsxindex 07f34d8ac68..1e90a586247 100644--- a/web/app/components/workflow/__tests__/edge-insert-focus.browser.spec.tsx+++ b/web/app/components/workflow/__tests__/edge-insert-focus.browser.spec.tsx@@ -54,7 +54,9 @@ const edges = [function Fixture() {const [store] = useState(() => createWorkflowStore({}))return (- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ ><WorkflowContext value={store}><ReactFlowProvider><button type="button">Before canvas</button>diff --git a/web/app/components/workflow/__tests__/panel-contextmenu.spec.tsx b/web/app/components/workflow/__tests__/panel-contextmenu.spec.tsxindex 1365e03afc7..7b4aed436e8 100644--- a/web/app/components/workflow/__tests__/panel-contextmenu.spec.tsx+++ b/web/app/components/workflow/__tests__/panel-contextmenu.spec.tsx@@ -1,12 +1,10 @@import type { AvailableNodesMetaData } from '../hooks-store'import { ContextMenu } from '@langgenius/dify-ui/context-menu'import { detectPlatform } from '@tanstack/react-hotkeys'-import { useQueryClient } from '@tanstack/react-query'import { act, screen, waitFor } from '@testing-library/react'import userEvent from '@testing-library/user-event'import { use, useLayoutEffect, useState } from 'react'import { useStoreApi } from 'reactflow'-import { seedSystemFeatures } from '@/test/console/query-data'import { renderWorkflowEditor } from '@/test/workflow-editor'import { fullWorkflowAccessControl, HooksStoreContext } from '../hooks-store'import { useWorkflowNodeCatalog } from '../node-catalog'@@ -27,10 +25,8 @@ function setup(options: Parameters<typeof renderWorkflowEditor>[1] = {}) {const preview = vi.fn()const exportDSL = vi.fn(async () => {})let flow: ReturnType<typeof useStoreApi>- let queryClient: ReturnType<typeof useQueryClient>function Menu() {flow = useStoreApi()- queryClient = useQueryClient()const [open, setOpen] = useState(true)const catalog = useWorkflowNodeCatalog()const hooksStore = use(HooksStoreContext)!@@ -65,7 +61,6 @@ function setup(options: Parameters<typeof renderWorkflowEditor>[1] = {}) {})return {...result,- queryClient: queryClient!,user,run,preview,@@ -151,10 +146,10 @@ it('opens app import but omits that action for snippets', async () => {})it('allows comments but not node editing when editing permission is denied', async () => {- const { user, store, queryClient } = setup({+ const { user, store } = setup({+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled: true },hooksStoreProps: { accessControl: { ...fullWorkflowAccessControl, canEdit: false } },})- act(() => seedSystemFeatures(queryClient, { enable_collaboration_mode: true }))const comment = await screen.findByRole('menuitem', {name: 'workflowComments.comments.actions.addComment',})diff --git a/web/app/components/workflow/__tests__/workflow-browser-test-env.tsx b/web/app/components/workflow/__tests__/workflow-browser-test-env.tsxindex 73244e36a56..01192737b1c 100644--- a/web/app/components/workflow/__tests__/workflow-browser-test-env.tsx+++ b/web/app/components/workflow/__tests__/workflow-browser-test-env.tsx@@ -16,7 +16,6 @@ export async function renderWorkflowBrowserComponent() {const { queryClient: defaultClient } = createConsoleQueryWrapper({appDslVersion: '0.6.0',- systemFeatures: { enable_collaboration_mode: false },})const queryClient = options.queryClient ?? defaultClientseedModelProviderQueries(queryClient)diff --git a/web/app/components/workflow/__tests__/workflow-edge-events.spec.tsx b/web/app/components/workflow/__tests__/workflow-edge-events.spec.tsxindex eedb1d1240b..68615288b45 100644--- a/web/app/components/workflow/__tests__/workflow-edge-events.spec.tsx+++ b/web/app/components/workflow/__tests__/workflow-edge-events.spec.tsx@@ -121,18 +121,18 @@ function GraphApi({ apiRef }: { apiRef: RefObject<ReactFlowInstance | null> }) {function renderSubject({initialStoreState,+ collaborationEnabled = false,graphNodes = nodes,edges = [],isCollaborationEnabled = false,}: {initialStoreState?: Partial<Shape>+ collaborationEnabled?: booleanisCollaborationEnabled?: booleangraphNodes?: WorkflowProps['nodes']edges?: WorkflowProps['edges']} = {}) {- const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: true },- })+ const { queryClient } = createConsoleQueryWrapper()seedAppDslVersion(queryClient)seedModelProviderQueries(queryClient)seedToolProviders(queryClient, {@@ -167,6 +167,7 @@ function renderSubject({)const view = renderWorkflowComponent(subject(), {queryClient,+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled },initialStoreState,hooksStoreProps: {doSyncWorkflowDraft: saveDraft,@@ -383,7 +384,13 @@ it('navigates unresolved comments and deletes a thread only after confirmation',comments = comments.filter((item) => item.id !== params.comment_id)return { result: 'success' }})- renderSubject({ initialStoreState: { showUserComments: true, showResolvedComments: false } })+ renderSubject({+ collaborationEnabled: true,+ initialStoreState: {+ showUserComments: true,+ showResolvedComments: false,+ },+ })await user.click(await screen.findByRole('button', { name: 'workflow.keyboard.openComment:{"name":"Alice"}' }),)@@ -443,7 +450,7 @@ it('deletes a reply through the real thread confirmation and refreshes its contedetail.replies = []return { result: 'success' }})- renderSubject({ initialStoreState: { showUserComments: true } })+ renderSubject({ collaborationEnabled: true, initialStoreState: { showUserComments: true } })await user.click(await screen.findByRole('button', { name: 'workflow.keyboard.openComment:{"name":"Alice"}' }),)diff --git a/web/app/components/workflow/__tests__/workflow-test-providers.tsx b/web/app/components/workflow/__tests__/workflow-test-providers.tsxindex 71141ed7882..832b622c82c 100644--- a/web/app/components/workflow/__tests__/workflow-test-providers.tsx+++ b/web/app/components/workflow/__tests__/workflow-test-providers.tsx@@ -1,5 +1,5 @@import type { ReactNode } from 'react'-import type { EditorResource } from '../editor-resource/resource'+import type { TestEditorResource } from '../editor-resource/__tests__/fixture-resource'import type { Shape as HooksStoreShape } from '../hooks-store/store'import type { InjectWorkflowStoreSliceFn, Shape } from '../store/workflow'import type { WorkflowHistoryState } from '../store/workflow/history-slice'@@ -16,6 +16,7 @@ import {} from '@/test/console/query-data'import { createAppDetailFixture } from '@/test/fixtures/app'import { WorkflowContext } from '../context'+import { editorResourceForTest } from '../editor-resource/__tests__/fixture-resource'import { EditorResourceScope } from '../editor-resource/provider'import { HooksStoreContext } from '../hooks-store/provider'import { createHooksStore } from '../hooks-store/store'@@ -51,7 +52,7 @@ type HistoryStoreConfig = {export type WorkflowProviderOptions = {injectWorkflowStoreSliceFn?: InjectWorkflowStoreSliceFn- resource?: EditorResource+ resource?: TestEditorResourceinitialStoreState?: Partial<Shape>hooksStoreProps?: Partial<HooksStoreShape>historyStore?: HistoryStoreConfig@@ -76,7 +77,12 @@ export function createWorkflowWrapper(stores: StoreInstances,historyConfig?: HistoryStoreConfig,externalQueryClient?: QueryClient,- resource: EditorResource = { kind: 'app', appId: 'app-1', mode: 'workflow' },+ resource: TestEditorResource = {+ kind: 'app',+ appId: 'app-1',+ mode: 'workflow',+ collaborationEnabled: false,+ },) {if (historyConfig) {stores.store.temporal.getState().pause()@@ -125,7 +131,7 @@ export function createWorkflowWrapper(return ({ children }: { children: ReactNode }) => (<QueryClientWrapper>- <EditorResourceScope resource={resource}>+ <EditorResourceScope resource={editorResourceForTest(resource)}><WorkflowContext value={stores.store}>{stores.hooksStore ? (<HooksStoreContext value={stores.hooksStore}>{children}</HooksStoreContext>diff --git a/web/app/components/workflow/block-selector/__tests__/agent-selector.spec.tsx b/web/app/components/workflow/block-selector/__tests__/agent-selector.spec.tsxindex 2afb33d38b7..47e4dcb1a90 100644--- a/web/app/components/workflow/block-selector/__tests__/agent-selector.spec.tsx+++ b/web/app/components/workflow/block-selector/__tests__/agent-selector.spec.tsx@@ -50,7 +50,7 @@ const createAgent = (overrides: Record<string, unknown> = {}) => ({const renderMenu = async ({onSelect = vi.fn<(agent: AgentRosterNodeData) => void>(),onStartFromScratch,- identity = { kind: 'app', appId: 'app-1', mode: 'workflow' },+ identity = { kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' },}: {onSelect?: ReturnType<typeof vi.fn<(agent: AgentRosterNodeData) => void>>onStartFromScratch?: () => void@@ -154,7 +154,9 @@ describe('AgentSelectorMenu', () => {render(<QueryClientProvider client={queryClient}>- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ ><AgentSelectorMenu><AgentSelectorMenuContent onSelect={vi.fn()} /><AgentSelectorMenuTrigger render={<Button loading />}>diff --git a/web/app/components/workflow/block-selector/__tests__/blocks.spec.tsx b/web/app/components/workflow/block-selector/__tests__/blocks.spec.tsxindex 954c6594cba..36d012167c5 100644--- a/web/app/components/workflow/block-selector/__tests__/blocks.spec.tsx+++ b/web/app/components/workflow/block-selector/__tests__/blocks.spec.tsx@@ -576,7 +576,9 @@ function ReadyBlocks({ children }: { children: ReactNode }) {function render(ui: ReactElement) {return baseRender(ui, {wrapper: ({ children }) => (- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ ><ReactFlowProvider><ReactFlow nodes={runtimeState.nodes} edges={[]} /><ReadyBlocks>{children}</ReadyBlocks>diff --git a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.socket-and-subscriptions.spec.ts b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.socket-and-subscriptions.spec.tsindex 0748054afae..fe5192d65ce 100644--- a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.socket-and-subscriptions.spec.ts+++ b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.socket-and-subscriptions.spec.ts@@ -13,6 +13,176 @@ const { createSession, connect, transports, setup, cleanup } = createCollaboratibeforeEach(setup)afterEach(cleanup)+it.each([+ [401, 'unauthorized', 'denied'],+ [403, 'not_entitled', 'denied'],+ [503, 'collaboration_unavailable', 'unavailable'],+] as const)(+ 'reports a %s join response after the socket connects',+ async (status, msg, expectedFailure) => {+ const { manager, receive, acknowledge, emit } = await createSession({+ connected: false,+ role: 'pending',+ })+ const failures = vi.fn()+ manager.onJoinFailure(failures)+ receive('connect')+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(1)+ acknowledge('user_connect', { msg }, status)+ expect(failures).toHaveBeenLastCalledWith(expectedFailure)+ expect(manager.canPersistLocalGraph()).toBe(false)+ },+)++it.each([+ [401, undefined],+ [{ msg: 'unauthorized' }, undefined],+ [{ msg: 'access denied' }, 401],+] as const)('treats an unauthorized join acknowledgement as denied', async (body, status) => {+ const { manager, receive, acknowledge } = await createSession({+ connected: false,+ role: 'pending',+ })+ const failures = vi.fn()+ manager.onJoinFailure(failures)+ receive('connect')+ acknowledge('user_connect', body, status)+ expect(failures).toHaveBeenLastCalledWith('denied')+ expect(manager.canPersistLocalGraph()).toBe(false)+})++it('starts joining before notifying connection listeners', async () => {+ const { manager, receive, emit } = await createSession({ connected: false, role: 'pending' })+ const onStateChange = vi.fn((state: { isConnected?: boolean }) => {+ if (state.isConnected)+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(1)+ })+ manager.onStateChange(onStateChange)+ receive('connect')+ expect(onStateChange).toHaveBeenCalledWith({ isConnected: true })+})++it('handles a status and join acknowledgement delivered synchronously', async () => {+ const { manager, receive, emit, socket } = await createSession({+ connected: false,+ role: 'pending',+ })+ emit.mockImplementation((event, ...args) => {+ if (event === 'user_connect') {+ receive('status', { isLeader: true })+ const ack = args[1]+ if (typeof ack === 'function') ack({ msg: 'connected' })+ }+ return socket+ })+ receive('connect')+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(1)+ expect(manager.canPersistLocalGraph()).toBe(true)+})++it('ignores the old join acknowledgement after a socket reconnects', async () => {+ const { manager, receive, acknowledge, emit, socket } = await createSession({+ connected: false,+ role: 'pending',+ })+ const failures = vi.fn()+ manager.onJoinFailure(failures)+ receive('connect')+ const oldAck = emit.mock.calls.find(([event]) => event === 'user_connect')?.[2]+ if (typeof oldAck !== 'function') throw new Error('Missing initial join acknowledgement')++ receive('disconnect', 'transport close')+ socket.id = 'new-session'+ receive('connect')+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(2)+ receive('status', { isLeader: true })+ acknowledge('user_connect', { msg: 'connected' })+ oldAck({ msg: 'not_entitled' }, 403)+ expect(failures).toHaveBeenLastCalledWith(null)+ // A fresh CRDT must still recover the authoritative graph after reconnect.+ expect(manager.canPersistLocalGraph()).toBe(false)+})++it('keeps the existing canvas blocked when an established session cannot rejoin', async () => {+ const { manager, acknowledge } = await createSession({ nodes: [createNode('local')] })+ const failures = vi.fn()+ manager.onJoinFailure(failures)+ manager.emitCursorMove({ x: 1, y: 2, userId: 'user-1', timestamp: 1 })+ acknowledge('mouse_move', { msg: 'unauthorized' }, 401)+ acknowledge('user_connect', { msg: 'not_entitled' }, 403)+ expect(failures).toHaveBeenLastCalledWith('session_unavailable')+ expect(manager.getNodes()).toEqual([expect.objectContaining({ id: 'local' })])+ expect(manager.canPersistLocalGraph()).toBe(false)+})++it('does not start concurrent rejoins and accepts status before the successful acknowledgement', async () => {+ const { manager, acknowledge, receive, emit } = await createSession()+ manager.emitCursorMove({ x: 1, y: 2, userId: 'user-1', timestamp: 1 })+ acknowledge('mouse_move', { msg: 'unauthorized' }, 401)+ manager.emitCursorMove({ x: 2, y: 3, userId: 'user-1', timestamp: 2 })+ acknowledge('mouse_move', { msg: 'unauthorized' }, 401)+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(1)+ receive('status', { isLeader: true })+ acknowledge('user_connect', { msg: 'connected' })+ expect(manager.canPersistLocalGraph()).toBe(true)+})++it.each(['before', 'after'] as const)(+ 'rejoins after status without an initial acknowledgement and ignores its stale acknowledgement %s the rejoin',+ async (oldAckOrder) => {+ const { manager, acknowledge, emit, receive } = await createSession({+ role: 'pending',+ preserveEmits: true,+ })+ const failures = vi.fn()+ manager.onJoinFailure(failures)+ const initialAck = emit.mock.calls.find(([event]) => event === 'user_connect')?.[2]+ if (typeof initialAck !== 'function') throw new Error('Missing initial join acknowledgement')++ receive('status', { isLeader: true })+ manager.emitCursorMove({ x: 1, y: 2, userId: 'user-1', timestamp: 1 })+ acknowledge('mouse_move', { msg: 'unauthorized' }, 401)+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(2)++ if (oldAckOrder === 'before') initialAck({ msg: 'not_entitled' }, 403)+ receive('status', { isLeader: true })+ acknowledge('user_connect', { msg: 'connected' })+ if (oldAckOrder === 'after') initialAck({ msg: 'not_entitled' }, 403)+ expect(failures).toHaveBeenLastCalledWith(null)+ expect(manager.canPersistLocalGraph()).toBe(true)+ },+)++it('ignores a rejoin acknowledgement after the editor disconnects', async () => {+ const { manager, acknowledge, emit, connectionId } = await createSession()+ manager.emitCursorMove({ x: 1, y: 2, userId: 'user-1', timestamp: 1 })+ acknowledge('mouse_move', { msg: 'unauthorized' }, 401)+ const rejoinAck = emit.mock.calls.find(([event]) => event === 'user_connect')?.[2]+ if (typeof rejoinAck !== 'function') throw new Error('Missing rejoin acknowledgement')++ manager.disconnect(connectionId)+ rejoinAck({ msg: 'not_entitled' }, 403)+ const failures = vi.fn()+ manager.onJoinFailure(failures)+ expect(failures).toHaveBeenLastCalledWith(null)+})++it('waits for the new connection status before rejoining after an automatic reconnect', async () => {+ const { manager, acknowledge, emit, receive, socket } = await createSession()+ receive('disconnect', 'transport close')+ socket.id = 'new-session'+ receive('connect')+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(1)+ manager.emitCursorMove({ x: 1, y: 2, userId: 'user-1', timestamp: 1 })+ acknowledge('mouse_move', { msg: 'unauthorized' }, 401)+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(1)++ receive('status', { isLeader: true })+ manager.emitCursorMove({ x: 2, y: 3, userId: 'user-1', timestamp: 2 })+ acknowledge('mouse_move', { msg: 'unauthorized' }, 401)+ expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(2)+})+it('allows local draft fallback only before the first connection', async () => {const { manager, receive } = await createSession({ connected: false, role: 'pending' })expect(manager.canUseLocalDraftFallback()).toBe(true)@@ -160,7 +330,7 @@ it('allows a hidden page-close flush only for the sole trusted leader session',expect(manager.canFlushGraphOnPageClose()).toBe(true)})-it('deduplicates rejoin attempts and disconnects after an unauthorized rejoin', async () => {+it('deduplicates rejoin attempts and blocks saving after an unauthorized rejoin', async () => {const { manager, acknowledge, emit } = await createSession()const cursor = { x: 1, y: 2, userId: 'user-1', timestamp: 1000 }manager.emitCursorMove(cursor)@@ -169,8 +339,8 @@ it('deduplicates rejoin attempts and disconnects after an unauthorized rejoin',acknowledge('mouse_move', { msg: 'unauthorized' })expect(emit.mock.calls.filter(([event]) => event === 'user_connect')).toHaveLength(1)acknowledge('user_connect', { msg: 'unauthorized' })- expect(webSocketClient.disconnect).toHaveBeenCalledWith('app-1')- expect(manager.isConnected()).toBe(false)+ expect(webSocketClient.disconnect).not.toHaveBeenCalled()+ expect(manager.isConnected()).toBe(true)expect(manager.canPersistLocalGraph()).toBe(false)})diff --git a/web/app/components/workflow/collaboration/core/__tests__/test-collaboration-session.ts b/web/app/components/workflow/collaboration/core/__tests__/test-collaboration-session.tsindex 4aafb966c5c..70913accbae 100644--- a/web/app/components/workflow/collaboration/core/__tests__/test-collaboration-session.ts+++ b/web/app/components/workflow/collaboration/core/__tests__/test-collaboration-session.ts@@ -37,12 +37,14 @@ export const createCollaborationTestEnvironment = () => {role = 'leader',nodes = [],edges = [],+ preserveEmits = false,}: {appId?: stringconnected?: booleanrole?: 'leader' | 'follower' | 'pending'nodes?: Node[]edges?: Edge[]+ preserveEmits?: boolean} = {}) => {const transport = createSocket(`socket-${appId}`, connected)transports.set(appId, transport)@@ -59,8 +61,11 @@ export const createCollaborationTestEnvironment = () => {}const store = { getState: () => state }const connectionId = await connect(manager, appId, store)- if (role !== 'pending') transport.receive('status', { isLeader: role === 'leader' })- transport.emit.mockClear()+ if (role !== 'pending') {+ transport.receive('status', { isLeader: role === 'leader' })+ if (connected) transport.acknowledge('user_connect', { msg: 'connected' })+ }+ if (!preserveEmits) transport.emit.mockClear()return { manager, store, state, connectionId, ...transport }}diff --git a/web/app/components/workflow/collaboration/core/__tests__/websocket-manager.test.ts b/web/app/components/workflow/collaboration/core/__tests__/websocket-manager.test.tsindex 295de1b4dda..e7d1741de12 100644--- a/web/app/components/workflow/collaboration/core/__tests__/websocket-manager.test.ts+++ b/web/app/components/workflow/collaboration/core/__tests__/websocket-manager.test.ts@@ -46,7 +46,7 @@ it.each([true, false])(},)-it('connects using cookies and joins the requested workflow after connecting', () => {+it('connects using cookies without joining a workflow', () => {const { socket, emit, receive } = createTransport('socket-auth', false)ioMock.mockReturnValue(socket)const client = createClient()@@ -58,11 +58,7 @@ it('connects using cookies and joins the requested workflow after connecting', (})expect(emit).not.toHaveBeenCalled()receive('connect')- expect(emit).toHaveBeenCalledWith(- 'user_connect',- { workflow_id: 'app-auth' },- expect.any(Function),- )+ expect(emit).not.toHaveBeenCalled()})it('disconnects a specific app and reports it as unavailable', () => {diff --git a/web/app/components/workflow/collaboration/core/collaboration-manager.ts b/web/app/components/workflow/collaboration/core/collaboration-manager.tsindex 0192cad57d0..3f4e30079fb 100644--- a/web/app/components/workflow/collaboration/core/collaboration-manager.ts+++ b/web/app/components/workflow/collaboration/core/collaboration-manager.ts@@ -8,6 +8,7 @@ import type {CollaborationUpdate,CursorPosition,GraphReloadRequest,+ JoinFailure,NodePanelPresenceMap,NodePanelPresenceUser,OnlineUser,@@ -21,7 +22,12 @@ import type { CRDTProvider } from './crdt-provider'import { cloneDeep } from 'es-toolkit/object'import { isEqual } from 'es-toolkit/predicate'import { EventEmitter } from './event-emitter'-import { emitWithAuthGuard, isDefaultSocketUrl, webSocketClient } from './websocket-manager'+import {+ emitWithAuthGuard,+ isDefaultSocketUrl,+ isUnauthorizedAck,+ webSocketClient,+} from './websocket-manager'type CrdtRuntime = (typeof import('./crdt-runtime'))['crdtRuntime']@@ -178,6 +184,11 @@ export class CollaborationManager {private initialSyncRetryTimer: ReturnType<typeof setTimeout> | null = nullprivate initialSyncRetryAttempt = 0private rejoinInProgress = false+ private joinFailure: JoinFailure | null = null+ private joinPending = false+ private hasJoinedRoom = false+ private joinAttempt = 0+ private receivedConnectionStatus = falseprivate pendingGraphImportEmit = falseprivate pendingGraphResyncBroadcast = falseprivate graphViewActive: boolean | null = null@@ -218,32 +229,76 @@ export class CollaborationManager {return webSocketClient.getSocket(this.currentAppId)}- private handleSessionUnauthorized = (): void => {- if (this.rejoinInProgress) return- if (!this.currentAppId) return+ private handleJoinAck = (...args: unknown[]): void => {+ const [body, status] = args+ const message = body && typeof body === 'object' && 'msg' in body ? body.msg : undefined+ if (message === 'connected') {+ this.joinPending = false+ this.joinFailure = null+ this.eventEmitter.emit('joinFailure', null)+ this.emitGraphReadyState()+ return+ }+ if (isUnauthorizedAck(...args) || status === 403 || body === 403 || message === 'not_entitled')+ this.joinFailure = this.hasJoinedRoom ? 'session_unavailable' : 'denied'+ else if (status === 503 || body === 503 || message === 'collaboration_unavailable')+ this.joinFailure = this.hasJoinedRoom ? 'session_unavailable' : 'unavailable'+ else return- const socket = this.getActiveSocket()- if (!socket) return+ this.joinPending = false+ this.crdtTrusted = false+ this.eventEmitter.emit('joinFailure', this.joinFailure)+ this.emitGraphReadyState()+ }- this.rejoinInProgress = true- console.warn('Collaboration session expired, attempting to rejoin workflow.')+ onJoinFailure(callback: (failure: JoinFailure | null) => void): () => void {+ const unsubscribe = this.eventEmitter.on('joinFailure', callback)+ callback(this.joinFailure)+ return unsubscribe+ }++ private joinWorkflow(socket: Socket): void {+ if (!this.currentAppId || !socket.connected) return++ this.joinPending = true+ const attempt = ++this.joinAttempt+ const sid = socket.idemitWithAuthGuard(socket,'user_connect',{ workflow_id: this.currentAppId },{- onAck: () => {- this.rejoinInProgress = false- },- onUnauthorized: () => {+ onAck: (...args) => {+ if (+ this.getActiveSocket() !== socket ||+ socket.id !== sid ||+ this.joinAttempt !== attempt+ )+ returnthis.rejoinInProgress = false- console.error('Rejoin failed due to authorization error, forcing disconnect.')- this.forceDisconnect()+ this.handleJoinAck(...args)},},)}+ private handleSessionUnauthorized = (): void => {+ if (+ this.joinFailure ||+ this.rejoinInProgress ||+ (this.joinPending && !this.receivedConnectionStatus)+ )+ return+ if (!this.currentAppId) return++ const socket = this.getActiveSocket()+ if (!socket?.connected) return++ this.rejoinInProgress = true+ console.warn('Collaboration session expired, attempting to rejoin workflow.')+ this.joinWorkflow(socket)+ }+private sendCollaborationEvent(payload: CollaborationEventPayload): void {const socket = this.getActiveSocket()if (!socket) return@@ -702,13 +757,7 @@ export class CollaborationManager {this.emitGraphReadyState()// Force user_connect if already connected- if (socket.connected)- emitWithAuthGuard(- socket,- 'user_connect',- { workflow_id: appId },- { onUnauthorized: this.handleSessionUnauthorized },- )+ if (socket.connected) this.joinWorkflow(socket)return connectionId}@@ -732,6 +781,12 @@ export class CollaborationManager {preserveConnectIntent = false,}: { preserveConnectIntent?: boolean } = {}): void => {this.localDraftFallbackActive = false+ this.joinFailure = null+ this.eventEmitter.emit('joinFailure', null)+ this.joinPending = false+ this.hasJoinedRoom = false+ this.joinAttempt += 1+ this.receivedConnectionStatus = falseif (this.currentAppId) webSocketClient.disconnect(this.currentAppId)this.clearInitialSyncRetry()@@ -805,6 +860,7 @@ export class CollaborationManager {}canPersistLocalGraph(): boolean {+ if (this.joinFailure) return falseif (this.localDraftFallbackActive) return truereturn this.crdtTrusted && !this.graphReloadRequired && this.graphViewActive !== false}@@ -1871,11 +1927,15 @@ export class CollaborationManager {socket.on('status', (data: { isLeader: boolean }) => {try {+ if (this.joinFailure && !this.joinPending) returnif (!data || typeof data.isLeader !== 'boolean') {console.warn('Invalid status data:', data)return}+ this.hasJoinedRoom = true+ this.receivedConnectionStatus = true+const wasLeader = this.isLeaderconst wasAwaitingSnapshotImport = this.awaitingSnapshotImportthis.isLeader = data.isLeader@@ -1920,6 +1980,7 @@ export class CollaborationManager {})socket.on('connect', () => {+ this.receivedConnectionStatus = falsethis.hasEstablishedConnection = trueif (this.rebuildCrdtOnNextConnect) {this.initializeCrdt(socket)@@ -1928,12 +1989,17 @@ export class CollaborationManager {this.awaitingSnapshotImport = falsethis.crdtTrusted = false}+ this.pendingInitialSync = true+ this.joinWorkflow(socket)this.emitGraphReadyState()this.eventEmitter.emit('stateChange', { isConnected: true })- this.pendingInitialSync = true})socket.on('disconnect', (reason) => {+ this.joinPending = false+ this.rejoinInProgress = false+ this.joinAttempt += 1+ this.receivedConnectionStatus = falsethis.clearInitialSyncRetry()this.cursors = {}this.onlineUsers = []diff --git a/web/app/components/workflow/collaboration/core/websocket-manager.ts b/web/app/components/workflow/collaboration/core/websocket-manager.tsindex 918aa22c26d..d51c8d8c868 100644--- a/web/app/components/workflow/collaboration/core/websocket-manager.ts+++ b/web/app/components/workflow/collaboration/core/websocket-manager.ts@@ -8,7 +8,7 @@ type AckArgs = unknown[]export const isDefaultSocketUrl = (socketUrl = SOCKET_URL) =>socketUrl === 'ws://localhost' || socketUrl === 'ws://localhost:5001'-const isUnauthorizedAck = (...ackArgs: AckArgs): boolean => {+export const isUnauthorizedAck = (...ackArgs: AckArgs): boolean => {const [first, second] = ackArgsif (second === 401 || first === 401) return true@@ -133,7 +133,6 @@ export class WebSocketClient {private setupBaseEventListeners(socket: Socket, appId: string): void {socket.on('connect', () => {this.connecting.delete(appId)- emitWithAuthGuard(socket, 'user_connect', { workflow_id: appId })})socket.on('disconnect', () => {diff --git a/web/app/components/workflow/collaboration/hooks/__tests__/use-collaboration.spec.ts b/web/app/components/workflow/collaboration/hooks/__tests__/use-collaboration.spec.tsindex d70475b7de8..f39ab3a5db2 100644--- a/web/app/components/workflow/collaboration/hooks/__tests__/use-collaboration.spec.ts+++ b/web/app/components/workflow/collaboration/hooks/__tests__/use-collaboration.spec.ts@@ -1,6 +1,10 @@import type { CursorPosition, NodePanelPresenceMap, OnlineUser } from '../../types/collaboration'-import { act, waitFor } from '@testing-library/react'-import { renderHookWithConsoleQuery } from '@/test/console/query-data'+import { act, renderHook, waitFor } from '@testing-library/react'+import { createElement } from 'react'+import { WorkflowContext } from '@/app/components/workflow/context'+import { EditorResourceScope } from '@/app/components/workflow/editor-resource/provider'+import { createWorkflowStore } from '@/app/components/workflow/store/workflow'+import { createConsoleQueryWrapper } from '@/test/console/query-data'import { useCollaboration } from '../use-collaboration'type HookReactFlowStore = NonNullable<Parameters<typeof useCollaboration>[2]>@@ -30,6 +34,27 @@ const unsubscribeLeader = vi.hoisted(() => vi.fn())let isCollaborationEnabled = true+const renderCollaboration = (hook: () => ReturnType<typeof useCollaboration>, enabled: boolean) => {+ const { wrapper: QueryWrapper } = createConsoleQueryWrapper()+ const store = createWorkflowStore({})+ return renderHook(hook, {+ wrapper: ({ children }) =>+ createElement(+ QueryWrapper,+ null,+ createElement(EditorResourceScope, {+ resource: {+ kind: 'app',+ appId: 'app-1',+ mode: 'workflow',+ collaborationEnabled: enabled,+ },+ children: createElement(WorkflowContext, { value: store }, children),+ }),+ ),+ })+}+const mockStartTracking = vi.hoisted(() => vi.fn())const mockStopTracking = vi.hoisted(() => vi.fn())vi.mock('../../core/collaboration-manager', () => ({@@ -92,11 +117,9 @@ describe('useCollaboration', () => {const reactFlowStore: HookReactFlowStore = {getState: vi.fn(),}- const { result, unmount } = renderHookWithConsoleQuery(+ const { result, unmount } = renderCollaboration(() => useCollaboration('app-1', true, reactFlowStore),- {- systemFeatures: { enable_collaboration_mode: isCollaborationEnabled },- },+ isCollaborationEnabled,)await waitFor(() => {@@ -156,9 +179,10 @@ describe('useCollaboration', () => {'does not connect or track cursors when a collaboration gate is disabled',async (featureEnabled, canEdit) => {isCollaborationEnabled = featureEnabled- const { result } = renderHookWithConsoleQuery(() => useCollaboration('app-1', canEdit), {- systemFeatures: { enable_collaboration_mode: featureEnabled },- })+ const { result } = renderCollaboration(+ () => useCollaboration('app-1', canEdit),+ featureEnabled,+ )await waitFor(() => {expect(mockConnect).not.toHaveBeenCalled()diff --git a/web/app/components/workflow/collaboration/hooks/use-collaboration.ts b/web/app/components/workflow/collaboration/hooks/use-collaboration.tsindex 10bd1a3df9f..f06d9ac2e0e 100644--- a/web/app/components/workflow/collaboration/hooks/use-collaboration.ts+++ b/web/app/components/workflow/collaboration/hooks/use-collaboration.ts@@ -5,9 +5,9 @@ import type {NodePanelPresenceMap,OnlineUser,} from '../types/collaboration'-import { useSuspenseQuery } from '@tanstack/react-query'+import { useAtomValue } from 'jotai'import { useEffect, useRef, useState } from 'react'-import { systemFeaturesQueryOptions } from '@/features/system-features/client'+import { editorCollaborationEnabledAtom } from '@/app/components/workflow/editor-resource/state'import { collaborationManager } from '../core/collaboration-manager'import { CursorService } from '../services/cursor-service'@@ -38,10 +38,7 @@ export function useCollaboration(const cursorServiceRef = useRef<CursorService | null>(null)const lastDisconnectReasonRef = useRef<string | null>(null)- const { data: isCollaborationEnabled } = useSuspenseQuery({- ...systemFeaturesQueryOptions(),- select: (s) => s.enable_collaboration_mode,- })+ const isCollaborationEnabled = useAtomValue(editorCollaborationEnabledAtom)useEffect(() => {if (!appId || !isCollaborationEnabled || !canEdit) {diff --git a/web/app/components/workflow/collaboration/types/collaboration.ts b/web/app/components/workflow/collaboration/types/collaboration.tsindex c8f788b4c15..7aab9e55e64 100644--- a/web/app/components/workflow/collaboration/types/collaboration.ts+++ b/web/app/components/workflow/collaboration/types/collaboration.ts@@ -1,3 +1,5 @@+export type JoinFailure = 'denied' | 'unavailable' | 'session_unavailable'+export type OnlineUser = {user_id: stringusername: stringdiff --git a/web/app/components/workflow/comment/__tests__/comment-close-focus.spec.tsx b/web/app/components/workflow/comment/__tests__/comment-close-focus.spec.tsxindex bcf1ca67178..f11d4bd0ab1 100644--- a/web/app/components/workflow/comment/__tests__/comment-close-focus.spec.tsx+++ b/web/app/components/workflow/comment/__tests__/comment-close-focus.spec.tsx@@ -126,9 +126,10 @@ function renderCommentCanvas(comments = [comment]) {)const queryClient = createConsoleQueryClient()seedAccountProfileQuery(queryClient, { id: 'user-1', name: 'Alice' })- seedSystemFeatures(queryClient, { enable_collaboration_mode: true })+ seedSystemFeatures(queryClient)return renderWorkflowFlowComponent(<CommentCanvas />, {queryClient,+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled: true },initialStoreState: {comments,showUserComments: true,diff --git a/web/app/components/workflow/comment/mention-input.spec.tsx b/web/app/components/workflow/comment/mention-input.spec.tsxindex 018bf0fcf30..c66dd23d5e5 100644--- a/web/app/components/workflow/comment/mention-input.spec.tsx+++ b/web/app/components/workflow/comment/mention-input.spec.tsx@@ -12,7 +12,9 @@ const render = (ui: ReactElement, cachedUsers?: UserProfile[]) => {const store = createWorkflowStore({})if (cachedUsers) store.getState().setMentionableUsersCache('app-1', cachedUsers)return renderComponent(- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ ><WorkflowContext value={store}>{ui}</WorkflowContext></EditorResourceScope>,)diff --git a/web/app/components/workflow/comment/reply-deletion.browser.spec.tsx b/web/app/components/workflow/comment/reply-deletion.browser.spec.tsxindex 3dc58be4845..d7aeb66e525 100644--- a/web/app/components/workflow/comment/reply-deletion.browser.spec.tsx+++ b/web/app/components/workflow/comment/reply-deletion.browser.spec.tsx@@ -55,7 +55,9 @@ function Fixture({ onDelete }: { onDelete: (id: string) => void }) {)return (<QueryClientProvider client={queryClient}>- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ ><Suspense fallback={<p>Loading profile</p>}><button type="button">Outside thread</button><div id="workflow-container" style={{ position: 'relative', width: 1000, height: 650 }}>diff --git a/web/app/components/workflow/editor-resource/__tests__/fixture-resource.ts b/web/app/components/workflow/editor-resource/__tests__/fixture-resource.tsnew file mode 100644index 00000000000..48b05057490--- /dev/null+++ b/web/app/components/workflow/editor-resource/__tests__/fixture-resource.ts@@ -0,0 +1,12 @@+import type { EditorResource } from '../resource'++type AppResource = Extract<EditorResource, { kind: 'app' }>+export type TestEditorResource =+ | Exclude<EditorResource, AppResource>+ | (Omit<AppResource, 'collaborationEnabled'> & { collaborationEnabled?: boolean })++export function editorResourceForTest(resource: TestEditorResource): EditorResource {+ return resource.kind === 'app'+ ? { ...resource, collaborationEnabled: resource.collaborationEnabled ?? false }+ : resource+}diff --git a/web/app/components/workflow/editor-resource/__tests__/render.ts b/web/app/components/workflow/editor-resource/__tests__/render.tsindex c68881da155..8707b11771e 100644--- a/web/app/components/workflow/editor-resource/__tests__/render.ts+++ b/web/app/components/workflow/editor-resource/__tests__/render.ts@@ -1,6 +1,6 @@import type { RenderHookOptions, RenderOptions } from '@testing-library/react'import type { ReactElement, ReactNode } from 'react'-import type { EditorResource } from '../resource'+import type { TestEditorResource } from './fixture-resource'import type { ConsoleQueryTestOptions } from '@/test/console/query-data'import { useQueryClient } from '@tanstack/react-query'import { createElement } from 'react'@@ -10,8 +10,9 @@ import { QueryClientTestProvider } from '@/test/console/query-provider'import { render, renderHook } from '@/test/console/render'import { createAppDetailFixture } from '@/test/fixtures/app'import { EditorResourceScope } from '../provider'+import { editorResourceForTest } from './fixture-resource'-type ResourceOption = { resource?: EditorResource }+type ResourceOption = { resource?: TestEditorResource }function createWrapper({resource = { kind: 'app', appId: 'app-1', mode: 'workflow' },@@ -31,7 +32,7 @@ function createWrapper({return createElement(QueryClientTestProvider,{ queryClient: client },- createElement(EditorResourceScope, { resource, children }),+ createElement(EditorResourceScope, { resource: editorResourceForTest(resource), children }),)}function EditorWrapper({ children }: { children: ReactNode }) {diff --git a/web/app/components/workflow/editor-resource/__tests__/scope.spec.tsx b/web/app/components/workflow/editor-resource/__tests__/scope.spec.tsxindex 509d63acc95..4878ef9dae8 100644--- a/web/app/components/workflow/editor-resource/__tests__/scope.spec.tsx+++ b/web/app/components/workflow/editor-resource/__tests__/scope.spec.tsx@@ -10,13 +10,18 @@ import { QueryClientTestProvider } from '@/test/console/query-provider'import { createAppDetailFixture } from '@/test/fixtures/app'import { EditorResourceScope } from '../provider'import { getEditorResourceId } from '../resource'-import { editorResourceAtom, isChatflowAtom } from '../state'+import { editorCollaborationEnabledAtom, editorResourceAtom, isChatflowAtom } from '../state'import { renderEditorHook } from './render'function ResourceSummary({ label }: { label: string }) {const id = getEditorResourceId(useAtomValue(editorResourceAtom))const isChatflow = useAtomValue(isChatflowAtom)- return <output aria-label={label}>{`${id}:${isChatflow ? 'chatflow' : 'other'}`}</output>+ const collaborationEnabled = useAtomValue(editorCollaborationEnabledAtom)+ return (+ <output+ aria-label={label}+ >{`${id}:${isChatflow ? 'chatflow' : 'other'}:${collaborationEnabled ? 'collaboration' : 'ordinary'}`}</output>+ )}function EditorSession() {@@ -50,7 +55,9 @@ describe('workflow editor resource scope', () => {seedAppDetail(queryClient, app)const { unmount } = render(<QueryClientTestProvider queryClient={queryClient}>- <EditorResourceScope resource={{ kind: 'app', appId: app.id, mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', appId: app.id, mode: 'workflow', collaborationEnabled: false }}+ ><ResourceSummary label="Editor" /></EditorResourceScope></QueryClientTestProvider>,@@ -78,10 +85,19 @@ describe('workflow editor resource scope', () => {)render(<QueryClientTestProvider queryClient={queryClient}>- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'advanced-chat' }}>+ <EditorResourceScope+ resource={{+ kind: 'app',+ appId: 'app-1',+ mode: 'advanced-chat',+ collaborationEnabled: true,+ }}+ ><ResourceSummary label="App" /></EditorResourceScope>- <EditorResourceScope resource={{ kind: 'app', appId: 'app-2', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', appId: 'app-2', mode: 'workflow', collaborationEnabled: false }}+ ><ResourceSummary label="Second App" /></EditorResourceScope><EditorResourceScope resource={{ kind: 'knowledge-pipeline', pipelineId: 'pipeline-1' }}>@@ -92,17 +108,22 @@ describe('workflow editor resource scope', () => {</EditorResourceScope></QueryClientTestProvider>,)- expect(screen.getByLabelText('App')).toHaveTextContent('app-1:chatflow')- expect(screen.getByLabelText('Second App')).toHaveTextContent('app-2:other')- expect(screen.getByLabelText('Pipeline')).toHaveTextContent('pipeline-1:other')- expect(screen.getByLabelText('Snippet')).toHaveTextContent('snippet-1:other')+ expect(screen.getByLabelText('App')).toHaveTextContent('app-1:chatflow:collaboration')+ expect(screen.getByLabelText('Second App')).toHaveTextContent('app-2:other:ordinary')+ expect(screen.getByLabelText('Pipeline')).toHaveTextContent('pipeline-1:other:ordinary')+ expect(screen.getByLabelText('Snippet')).toHaveTextContent('snippet-1:other:ordinary')})it('keeps the supplied resource mode independent of cached App details', () => {const queryClient = createConsoleQueryClient()const app = createAppDetailFixture({ id: 'app-1', mode: 'workflow' })seedAppDetail(queryClient, app)- const resource = { kind: 'app', appId: app.id, mode: 'advanced-chat' } as const+ const resource = {+ kind: 'app',+ appId: app.id,+ mode: 'advanced-chat',+ collaborationEnabled: false,+ } as constconst { result } = renderEditorHook(() => useAtomValue(editorResourceAtom), {queryClient,resource,@@ -126,10 +147,15 @@ describe('workflow editor resource scope', () => {queryClient,createAppDetailFixture({ id: 'app-2', mode: 'advanced-chat', name: 'Second' }),)- const view = (appId: string) => (+ const view = (appId: string, collaborationEnabled: boolean) => (<QueryClientTestProvider queryClient={queryClient}><EditorResourceScope- resource={{ kind: 'app', appId, mode: appId === 'app-1' ? 'workflow' : 'advanced-chat' }}+ resource={{+ kind: 'app',+ appId,+ mode: appId === 'app-1' ? 'workflow' : 'advanced-chat',+ collaborationEnabled,+ }}><WorkflowContextProvider><EditorSession />@@ -137,7 +163,7 @@ describe('workflow editor resource scope', () => {</EditorResourceScope></QueryClientTestProvider>)- const { rerender } = render(view('app-1'))+ const { rerender } = render(view('app-1', false))await user.type(screen.getByRole('textbox', { name: 'Unsaved draft' }), 'Unpublished changes')await user.click(screen.getByRole('button', { name: 'Open preview' }))@@ -149,14 +175,15 @@ describe('workflow editor resource scope', () => {)})await waitFor(() => expect(screen.getByLabelText('Editor')).toHaveTextContent('app-1:other'))- rerender(view('app-1'))+ rerender(view('app-1', true))expect(screen.getByRole('textbox', { name: 'Unsaved draft' })).toHaveValue('Unpublished changes',)expect(screen.getByRole('region', { name: 'Preview' })).toBeVisible()+ expect(screen.getByLabelText('Editor')).toHaveTextContent('app-1:other:ordinary')- rerender(view('app-2'))- expect(screen.getByLabelText('Editor')).toHaveTextContent('app-2:chatflow')+ rerender(view('app-2', true))+ expect(screen.getByLabelText('Editor')).toHaveTextContent('app-2:chatflow:collaboration')expect(screen.getByRole('textbox', { name: 'Unsaved draft' })).toHaveValue('')expect(screen.queryByRole('region', { name: 'Preview' })).not.toBeInTheDocument()})diff --git a/web/app/components/workflow/editor-resource/resource.ts b/web/app/components/workflow/editor-resource/resource.tsindex 5ebeedb291e..6a84358b6b0 100644--- a/web/app/components/workflow/editor-resource/resource.ts+++ b/web/app/components/workflow/editor-resource/resource.ts@@ -1,7 +1,7 @@import type { WorkflowAppMode } from '@/app/components/apps/app-type'export type EditorResource =- | Readonly<{ kind: 'app'; appId: string; mode: WorkflowAppMode }>+ | Readonly<{ kind: 'app'; appId: string; mode: WorkflowAppMode; collaborationEnabled: boolean }>| Readonly<{ kind: 'knowledge-pipeline'; pipelineId: string }>| Readonly<{ kind: 'snippet'; snippetId: string }>diff --git a/web/app/components/workflow/editor-resource/state.ts b/web/app/components/workflow/editor-resource/state.tsindex 6dd538c8547..f392444960c 100644--- a/web/app/components/workflow/editor-resource/state.ts+++ b/web/app/components/workflow/editor-resource/state.ts@@ -8,6 +8,10 @@ export const editorResourceAtom = atomWithLazy<EditorResource>(() => {})export const editorResourceKindAtom = atom((get) => get(editorResourceAtom).kind)+export const editorCollaborationEnabledAtom = atom((get) => {+ const resource = get(editorResourceAtom)+ return resource.kind === 'app' && resource.collaborationEnabled+})export const editorAppIdAtom = atom((get) => {const resource = get(editorResourceAtom)return resource.kind === 'app' ? resource.appId : undefineddiff --git a/web/app/components/workflow/hooks/__tests__/selection-interactions.browser.spec.tsx b/web/app/components/workflow/hooks/__tests__/selection-interactions.browser.spec.tsxindex 8686c3ada1c..b01648ba9ad 100644--- a/web/app/components/workflow/hooks/__tests__/selection-interactions.browser.spec.tsx+++ b/web/app/components/workflow/hooks/__tests__/selection-interactions.browser.spec.tsx@@ -111,7 +111,6 @@ async function setup() {const { queryClient, wrapper: Wrapper } = createConsoleQueryWrapper({workspacePermissionKeys: [],appDslVersion: '0.6.0',- systemFeatures: { enable_collaboration_mode: false },features: {},})seedModelProviderQueries(queryClient)@@ -130,7 +129,9 @@ async function setup() {const screen = await render(<NuqsTestingAdapter><Wrapper>- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ ><WorkflowContext value={createWorkflowStore({})}><HooksStoreContext value={createHooksStore({})}><ReactFlowProvider>diff --git a/web/app/components/workflow/hooks/__tests__/use-auto-generate-webhook-url.spec.ts b/web/app/components/workflow/hooks/__tests__/use-auto-generate-webhook-url.spec.tsindex 287caf22715..95d53b8d822 100644--- a/web/app/components/workflow/hooks/__tests__/use-auto-generate-webhook-url.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-auto-generate-webhook-url.spec.ts@@ -46,7 +46,7 @@ describe('useAutoGenerateWebhookUrl', () => {nodes: useNodes<WebhookFlowNode['data']>(),}),{- resource: { kind: 'app', appId: 'app-123', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'app-123', mode: 'workflow' },nodes: createFlowNodes(),edges: [],},@@ -112,7 +112,7 @@ describe('useAutoGenerateWebhookUrl', () => {webhook_url: 'https://example.com/other-webhook',webhook_debug_url: 'https://example.com/other-debug',})- rerender(view({ kind: 'app', appId: 'app-456', mode: 'workflow' }))+ rerender(view({ kind: 'app', collaborationEnabled: false, appId: 'app-456', mode: 'workflow' }))await user.click(screen.getByRole('button', { name: 'Generate URL' }))await waitFor(() =>expect(mockRequest).toHaveBeenCalledWith(diff --git a/web/app/components/workflow/hooks/__tests__/use-checklist.spec.tsx b/web/app/components/workflow/hooks/__tests__/use-checklist.spec.tsxindex b706779199a..dd8d588c0b7 100644--- a/web/app/components/workflow/hooks/__tests__/use-checklist.spec.tsx+++ b/web/app/components/workflow/hooks/__tests__/use-checklist.spec.tsx@@ -107,7 +107,9 @@ function createChecklistWrapper({ nodes, edges }: Graph, options: ChecklistOptioconst store = createTestWorkflowStore({ nodes })const wrapper = ({ children }: { children: ReactNode }) => (<QueryProvider>- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ ><WorkflowContext value={store}><ReactFlowProvider><CatalogProvider>diff --git a/web/app/components/workflow/hooks/__tests__/use-fetch-workflow-inspect-vars.spec.ts b/web/app/components/workflow/hooks/__tests__/use-fetch-workflow-inspect-vars.spec.tsindex ba9f22df390..e628ea4520c 100644--- a/web/app/components/workflow/hooks/__tests__/use-fetch-workflow-inspect-vars.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-fetch-workflow-inspect-vars.spec.ts@@ -121,6 +121,7 @@ describe('use-fetch-workflow-inspect-vars', () => {kind: 'app',appId: 'app-1',mode: 'workflow',+ collaborationEnabled: false,})expect(result.current.getNodes()[0]!.data._runningStatus).toBeUndefined()expect(store.getState().nodesWithInspectVars).toEqual([@@ -206,6 +207,7 @@ describe('use-fetch-workflow-inspect-vars', () => {kind: 'app',appId: 'flow-id',mode: 'workflow',+ collaborationEnabled: false,})expect(store.getState().nodesWithInspectVars).toEqual([expect.objectContaining({diff --git a/web/app/components/workflow/hooks/__tests__/use-inspect-vars-crud-common.spec.ts b/web/app/components/workflow/hooks/__tests__/use-inspect-vars-crud-common.spec.tsindex 7cb15acdc97..d552ca44d4a 100644--- a/web/app/components/workflow/hooks/__tests__/use-inspect-vars-crud-common.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-inspect-vars-crud-common.spec.ts@@ -135,7 +135,7 @@ describe('useInspectVarsCrudCommon', () => {await waitFor(() => {expect(mockFetchNodeInspectVars).toHaveBeenCalledWith(- { kind: 'app', appId: 'app-1', mode: 'workflow' },+ { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled: false },'node-1',)expect(store.getState().nodesWithInspectVars[0]).toMatchObject({diff --git a/web/app/components/workflow/hooks/__tests__/use-inspect-vars-crud.spec.ts b/web/app/components/workflow/hooks/__tests__/use-inspect-vars-crud.spec.tsindex b96f22318d5..9ea497ef459 100644--- a/web/app/components/workflow/hooks/__tests__/use-inspect-vars-crud.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-inspect-vars-crud.spec.ts@@ -71,11 +71,13 @@ describe('useInspectVarsCrud', () => {kind: 'app',appId: 'app-1',mode: 'workflow',+ collaborationEnabled: false,})expect(mockUseSysVarValues).toHaveBeenCalledWith({kind: 'app',appId: 'app-1',mode: 'workflow',+ collaborationEnabled: false,})})diff --git a/web/app/components/workflow/hooks/__tests__/use-workflow-comment.spec.ts b/web/app/components/workflow/hooks/__tests__/use-workflow-comment.spec.tsindex 9d7a7d53b2c..7fb77a3b54b 100644--- a/web/app/components/workflow/hooks/__tests__/use-workflow-comment.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-workflow-comment.spec.ts@@ -112,9 +112,7 @@ const baseCommentDetail = (): WorkflowCommentDetail => ({const createSeededQueryClient = () => {const queryClient = createConsoleQueryClient()seedAccountProfileQuery(queryClient, mockConsoleState.userProfile)- seedSystemFeatures(queryClient, {- enable_collaboration_mode: globalFeatureState.enableCollaboration,- })+ seedSystemFeatures(queryClient)return queryClient}@@ -123,6 +121,12 @@ const useCommentCanvas = () => ({ ...useWorkflowComment(), flow: useReactFlow()const renderWorkflowHook: typeof renderWorkflowFlowHook = (hook, options) =>renderWorkflowFlowHook(hook, {...options,+ resource: {+ kind: 'app',+ appId: 'app-1',+ mode: 'workflow',+ collaborationEnabled: globalFeatureState.enableCollaboration,+ },reactFlowProps: { fitView: false, defaultViewport: { x: 80, y: 160, zoom: 2 } },})diff --git a/web/app/components/workflow/hooks/__tests__/use-workflow-panel-interactions.spec.tsx b/web/app/components/workflow/hooks/__tests__/use-workflow-panel-interactions.spec.tsxindex 91c437882c4..aee2e5575b7 100644--- a/web/app/components/workflow/hooks/__tests__/use-workflow-panel-interactions.spec.tsx+++ b/web/app/components/workflow/hooks/__tests__/use-workflow-panel-interactions.spec.tsx@@ -15,7 +15,11 @@ const setup = (state: Partial<Shape> = {}) =>{nodes: [createNode({ id: 'a', data: { _isBundled: true } }), createNode({ id: 'b' })],edges: [createEdge({ source: 'a', target: 'b', data: { _isBundled: true } })],- initialStoreState: { controlMode: ControlMode.Pointer, ...state },+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled: true },+ initialStoreState: {+ controlMode: ControlMode.Pointer,+ ...state,+ },},)diff --git a/web/app/components/workflow/hooks/use-workflow-comment.ts b/web/app/components/workflow/hooks/use-workflow-comment.tsindex 1f2a0a04eba..43b4a48da8b 100644--- a/web/app/components/workflow/hooks/use-workflow-comment.ts+++ b/web/app/components/workflow/hooks/use-workflow-comment.ts@@ -8,9 +8,11 @@ import { useAtomValue } from 'jotai'import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from 'react'import { useReactFlow } from 'reactflow'import { collaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager'-import { editorAppIdAtom } from '@/app/components/workflow/editor-resource/state'+import {+ editorAppIdAtom,+ editorCollaborationEnabledAtom,+} from '@/app/components/workflow/editor-resource/state'import { userProfileQueryOptions } from '@/features/account-profile/client'-import { systemFeaturesQueryOptions } from '@/features/system-features/client'import { consoleClient } from '@/service/console'import { useStore } from '../store'import { ControlMode } from '../types'@@ -72,10 +74,7 @@ export const useWorkflowComment = () => {...userProfileQueryOptions(),select: (data) => data.profile,})- const { data: isCollaborationEnabled } = useSuspenseQuery({- ...systemFeaturesQueryOptions(),- select: (s) => s.enable_collaboration_mode,- })+ const isCollaborationEnabled = useAtomValue(editorCollaborationEnabledAtom)const commentDetailCacheRef = useRef<Record<string, WorkflowCommentDetail>>(commentDetailCache)const activeCommentIdRef = useRef<string | null>(null)const commentFocusToRestoreRef = useRef<string | null>(null)diff --git a/web/app/components/workflow/hooks/use-workflow-panel-interactions.ts b/web/app/components/workflow/hooks/use-workflow-panel-interactions.tsindex 9f59eaeee71..f9c8fecbff3 100644--- a/web/app/components/workflow/hooks/use-workflow-panel-interactions.ts+++ b/web/app/components/workflow/hooks/use-workflow-panel-interactions.ts@@ -1,6 +1,6 @@-import { useSuspenseQuery } from '@tanstack/react-query'+import { useAtomValue } from 'jotai'import { useCallback } from 'react'-import { systemFeaturesQueryOptions } from '@/features/system-features/client'+import { editorCollaborationEnabledAtom } from '../editor-resource/state'import { useStore, useWorkflowStore } from '../store'import { ControlMode, WorkflowRunningStatus } from '../types'import { useEdgesInteractionsWithoutSync } from './use-edges-interactions-without-sync'@@ -34,10 +34,7 @@ export const useWorkflowMoveMode = () => {const isRestoring = useStore((s) => s.isRestoring)const { getNodesReadOnly } = useNodesReadOnly()const { handleSelectionCancel } = useSelectionInteractions()- const { data: isCommentModeAvailable } = useSuspenseQuery({- ...systemFeaturesQueryOptions(),- select: (s) => s.enable_collaboration_mode,- })+ const isCommentModeAvailable = useAtomValue(editorCollaborationEnabledAtom)const isCommentModeOperationBlocked = !!(workflowRunningData?.result.status === WorkflowRunningStatus.Running ||workflowRunningData?.result.status === WorkflowRunningStatus.Paused ||diff --git a/web/app/components/workflow/nodes/__tests__/index.hitl-v2.browser.spec.tsx b/web/app/components/workflow/nodes/__tests__/index.hitl-v2.browser.spec.tsxindex 6ac45a736f4..08dd8009329 100644--- a/web/app/components/workflow/nodes/__tests__/index.hitl-v2.browser.spec.tsx+++ b/web/app/components/workflow/nodes/__tests__/index.hitl-v2.browser.spec.tsx@@ -89,7 +89,6 @@ it('replaces the visible panel configuration on migration and undo without closiconst { queryClient } = createConsoleQueryWrapper({queryClient: createChannelsQueryClient([]),appDslVersion: '0.6.0',- systemFeatures: { enable_collaboration_mode: false },})onTestFinished(() => queryClient.clear())seedAccountProfileQuery(queryClient)diff --git a/web/app/components/workflow/nodes/_base/__tests__/node.spec.tsx b/web/app/components/workflow/nodes/_base/__tests__/node.spec.tsxindex 0bd398ddd32..272005d9228 100644--- a/web/app/components/workflow/nodes/_base/__tests__/node.spec.tsx+++ b/web/app/components/workflow/nodes/_base/__tests__/node.spec.tsx@@ -24,7 +24,7 @@ const view = (node: Node) => ()function renderNode(node: Node, parents: Node[] = []) {const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: false, enable_marketplace: false },+ systemFeatures: { enable_marketplace: false },workspacePermissionKeys: ['plugin.install'],})seedAppDslVersion(queryClient)diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/__tests__/helpers.spec.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/__tests__/helpers.spec.tsxindex 2edb9258450..e796a3d6bc5 100644--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/__tests__/helpers.spec.tsx+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/__tests__/helpers.spec.tsx@@ -22,7 +22,7 @@ describe('workflow-panel helpers', () => {payload: Partial<CustomRunFormProps['payload']>,): CustomRunFormProps => ({nodeId: 'node-1',- resource: { kind: 'app', appId: 'flow-1', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'flow-1', mode: 'workflow' },payload: payload as CustomRunFormProps['payload'],setRunResult: vi.fn(),diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/__tests__/index.spec.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/__tests__/index.spec.tsxindex 959fb72ad98..c8f7c286c98 100644--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/__tests__/index.spec.tsx+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/__tests__/index.spec.tsx@@ -149,7 +149,6 @@ function renderPanel({selected?: boolean} = {}) {const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: false },workspacePermissionKeys: ['credential.use'],})seedAppDslVersion(queryClient)diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/__tests__/use-last-run.hitl-v2.spec.ts b/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/__tests__/use-last-run.hitl-v2.spec.tsindex c727011a817..be6cb947463 100644--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/__tests__/use-last-run.hitl-v2.spec.ts+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/__tests__/use-last-run.hitl-v2.spec.ts@@ -86,7 +86,12 @@ describe('useLastRun', () => {() =>useLastRun({id: 'human-input-node',- resource: { kind: 'app', appId: 'flow-id', mode: 'workflow' },+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'flow-id',+ mode: 'workflow',+ },data: humanInputData(version),defaultRunInputData: {},@@ -135,7 +140,12 @@ describe('useLastRun', () => {() =>useLastRun({id: 'human-input-node',- resource: { kind: 'app', appId: 'flow-id', mode: 'workflow' },+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'flow-id',+ mode: 'workflow',+ },data: humanInputData('2'),defaultRunInputData: {},@@ -169,7 +179,12 @@ describe('useLastRun', () => {() =>useLastRun({id: 'human-input-node',- resource: { kind: 'app', appId: 'flow-id', mode: 'workflow' },+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'flow-id',+ mode: 'workflow',+ },data: humanInputData('2'),defaultRunInputData: {},diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/__tests__/use-last-run.spec.ts b/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/__tests__/use-last-run.spec.tsindex 2d133c69ee1..08bc32ee223 100644--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/__tests__/use-last-run.spec.ts+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/__tests__/use-last-run.spec.ts@@ -79,7 +79,12 @@ describe('useLastRun', () => {() => ({...useLastRun({id: 'iteration',- resource: { kind: 'app', appId: 'flow-id', mode: 'workflow' },+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'flow-id',+ mode: 'workflow',+ },data,defaultRunInputData: {},isPaused: false,@@ -87,7 +92,7 @@ describe('useLastRun', () => {flow: useStoreApi(),}),{- resource: { kind: 'app', appId: 'flow-id', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'flow-id', mode: 'workflow' },nodes: [createNode({id: 'source',diff --git a/web/app/components/workflow/nodes/_base/hooks/__tests__/use-one-step-run.spec.ts b/web/app/components/workflow/nodes/_base/hooks/__tests__/use-one-step-run.spec.tsindex abf869c7b38..c19f2cbceac 100644--- a/web/app/components/workflow/nodes/_base/hooks/__tests__/use-one-step-run.spec.ts+++ b/web/app/components/workflow/nodes/_base/hooks/__tests__/use-one-step-run.spec.ts@@ -64,7 +64,7 @@ const renderUseOneStepRun = (type: BlockEnum = BlockEnum.IfElse) => {() =>useOneStepRun({id: 'if-else-node',- resource: { kind: 'app', appId: 'app-id', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'app-id', mode: 'workflow' },data: {type,@@ -76,7 +76,7 @@ const renderUseOneStepRun = (type: BlockEnum = BlockEnum.IfElse) => {isPaused: false,}),{- resource: { kind: 'app', appId: 'app-id', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'app-id', mode: 'workflow' },nodes,edges,historyStore: { nodes, edges },@@ -227,7 +227,7 @@ describe('useOneStepRun single-run input vars', () => {const { result } = renderHook(() =>useOneStepRun<HumanInputV2NodeType>({id: 'human-v2',- resource: { kind: 'app', appId: 'app-id', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'app-id', mode: 'workflow' },data: {type: BlockEnum.HumanInput,diff --git a/web/app/components/workflow/nodes/agent-v2/__tests__/panel-bindings.spec.tsx b/web/app/components/workflow/nodes/agent-v2/__tests__/panel-bindings.spec.tsxindex d813d87f015..c8dda3d92b7 100644--- a/web/app/components/workflow/nodes/agent-v2/__tests__/panel-bindings.spec.tsx+++ b/web/app/components/workflow/nodes/agent-v2/__tests__/panel-bindings.spec.tsx@@ -198,7 +198,7 @@ describe('Agent panel bindings', () => {})it.each([- { kind: 'app', appId: 'app-1', mode: 'workflow' },+ { kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' },{ kind: 'snippet', snippetId: 'snippet-1' },] satisfies EditorResource[])('copies a roster agent through the $kind endpoint and opens the new inline agent',diff --git a/web/app/components/workflow/nodes/agent-v2/__tests__/panel-test-env.tsx b/web/app/components/workflow/nodes/agent-v2/__tests__/panel-test-env.tsxindex e26dd352e62..49ebe1a5f88 100644--- a/web/app/components/workflow/nodes/agent-v2/__tests__/panel-test-env.tsx+++ b/web/app/components/workflow/nodes/agent-v2/__tests__/panel-test-env.tsx@@ -26,7 +26,7 @@ export const createData = (overrides: Partial<AgentV2NodeType> = {}): AgentV2Nodexport function createPanelEnvironment({data = createData(),- resource = { kind: 'app', appId: 'app-1', mode: 'workflow' },+ resource = { kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' },}: { data?: AgentV2NodeType; resource?: EditorResource } = {}) {const { queryClient } = createConsoleQueryWrapper({workspacePermissionKeys: ['agent.create'],diff --git a/web/app/components/workflow/nodes/agent-v2/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/agent-v2/__tests__/panel.spec.tsxindex 202c8a34782..5baf2919c9f 100644--- a/web/app/components/workflow/nodes/agent-v2/__tests__/panel.spec.tsx+++ b/web/app/components/workflow/nodes/agent-v2/__tests__/panel.spec.tsx@@ -32,7 +32,7 @@ const openOutputs = async (user: ReturnType<typeof userEvent.setup>) => {describe('Agent task and declared outputs', () => {it('shows the calling workflow tracing summary only inside a workflow app', () => {const workflow = createPanelEnvironment({- resource: { kind: 'app', appId: 'workflow-1', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'workflow-1', mode: 'workflow' },})const { unmount } = workflow.render()expect(screen.getByTestId('inherited-tracing')).toHaveTextContent('workflow-1')diff --git a/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx b/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsxindex 32b22a4d601..cde49696bc0 100644--- a/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx+++ b/web/app/components/workflow/nodes/agent-v2/components/__tests__/agent-orchestrate-panel-content.spec.tsx@@ -178,7 +178,7 @@ function renderWorkspace({)const props: ComponentProps<typeof WorkflowInlineAgentConfigureWorkspace> = {agentId: 'agent-1',- resource: { kind: 'app', appId: 'app-1', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' },inlineComposerState: composer ?? undefined,nodeId: 'node-1',open,diff --git a/web/app/components/workflow/nodes/agent-v2/components/__tests__/save-inline-agent-to-roster-dialog.spec.tsx b/web/app/components/workflow/nodes/agent-v2/components/__tests__/save-inline-agent-to-roster-dialog.spec.tsxindex d23a73b4349..f09b83cea7b 100644--- a/web/app/components/workflow/nodes/agent-v2/components/__tests__/save-inline-agent-to-roster-dialog.spec.tsx+++ b/web/app/components/workflow/nodes/agent-v2/components/__tests__/save-inline-agent-to-roster-dialog.spec.tsx@@ -36,7 +36,7 @@ const renderDialog = (agent: AgentComposerAgentResponse = inlineAgent) => {render(<SaveInlineAgentToRosterDialog- resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}initialAgent={agent}nodeId="node-1"open@@ -233,7 +233,7 @@ describe('SaveInlineAgentToRosterDialog', () => {}const { rerender } = render(<SaveInlineAgentToRosterDialog- resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}initialAgent={inlineAgent}nodeId="node-1"open@@ -244,7 +244,7 @@ describe('SaveInlineAgentToRosterDialog', () => {rerender(<SaveInlineAgentToRosterDialog- resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}initialAgent={updatedInlineAgent}nodeId="node-1"open@@ -264,7 +264,7 @@ describe('SaveInlineAgentToRosterDialog', () => {rerender(<SaveInlineAgentToRosterDialog- resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}initialAgent={updatedInlineAgent}nodeId="node-1"open={false}@@ -278,7 +278,7 @@ describe('SaveInlineAgentToRosterDialog', () => {rerender(<SaveInlineAgentToRosterDialog- resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}initialAgent={updatedInlineAgent}nodeId="node-1"opendiff --git a/web/app/components/workflow/nodes/human-input-v2/__tests__/message-template.spec.tsx b/web/app/components/workflow/nodes/human-input-v2/__tests__/message-template.spec.tsxindex 2ff0744bc80..86347262825 100644--- a/web/app/components/workflow/nodes/human-input-v2/__tests__/message-template.spec.tsx+++ b/web/app/components/workflow/nodes/human-input-v2/__tests__/message-template.spec.tsx@@ -107,6 +107,7 @@ const renderTemplate = (configuredProviders?: ChannelSummary['provider'][],resource: EditorResource = {kind: 'app',+ collaborationEnabled: false,appId: 'app-template-test',mode: 'workflow',},@@ -516,6 +517,7 @@ describe('Human Input v2 Message Template', () => {)const { props } = renderTemplate({}, {}, ['resend', 'lark'], {kind: 'app',+ collaborationEnabled: false,appId: 'app-template-test',mode: chat ? 'advanced-chat' : 'workflow',})@@ -579,6 +581,7 @@ describe('Human Input v2 Message Template', () => {rerenderEnvironment({resource: {kind: 'app',+ collaborationEnabled: false,appId: 'another-app',mode: 'workflow',},@@ -788,13 +791,23 @@ describe('Human Input v2 Message Template', () => {reason: 'read-only',readonly: true,canRun: true,- resource: { kind: 'app', appId: 'app-template-test', mode: 'workflow' } as const,+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'app-template-test',+ mode: 'workflow',+ } as const,},{reason: 'no run permission',readonly: false,canRun: false,- resource: { kind: 'app', appId: 'app-template-test', mode: 'workflow' } as const,+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'app-template-test',+ mode: 'workflow',+ } as const,},{reason: 'snippet',@@ -806,7 +819,7 @@ describe('Human Input v2 Message Template', () => {reason: 'missing app ID',readonly: false,canRun: true,- resource: { kind: 'app', appId: '', mode: 'workflow' } as const,+ resource: { kind: 'app', collaborationEnabled: false, appId: '', mode: 'workflow' } as const,},])('does not offer test sending for $reason', async ({ readonly, canRun, resource }) => {const user = userEvent.setup()diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/test-email-sender.spec.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/test-email-sender.spec.tsxindex 558717e8931..725462932c2 100644--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/test-email-sender.spec.tsx+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/test-email-sender.spec.tsx@@ -51,7 +51,9 @@ const renderWithProviders = (ui: ReactNode) => {return render(<QueryClientProvider client={queryClient}>- <EditorResourceScope resource={{ kind: 'app', appId: 'app-1', mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'workflow' }}+ ><HooksStoreContext.Provider value={hooksStore}>{ui}</HooksStoreContext.Provider></EditorResourceScope></QueryClientProvider>,diff --git a/web/app/components/workflow/nodes/llm/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/llm/__tests__/panel.spec.tsxindex 402c480522f..a7805e4da10 100644--- a/web/app/components/workflow/nodes/llm/__tests__/panel.spec.tsx+++ b/web/app/components/workflow/nodes/llm/__tests__/panel.spec.tsx@@ -74,7 +74,7 @@ const sharedModel: EnvironmentVariable = {const renderPanel = ({data = createData(),- resource = { kind: 'app', appId: 'test-app', mode: 'workflow' },+ resource = { kind: 'app', collaborationEnabled: false, appId: 'test-app', mode: 'workflow' },environmentVariables = [sharedModel],}: {data?: LLMNodeTypediff --git a/web/app/components/workflow/nodes/question-classifier/__tests__/use-config.spec.ts b/web/app/components/workflow/nodes/question-classifier/__tests__/use-config.spec.tsindex b07a38b550e..dfa6e8bf430 100644--- a/web/app/components/workflow/nodes/question-classifier/__tests__/use-config.spec.ts+++ b/web/app/components/workflow/nodes/question-classifier/__tests__/use-config.spec.ts@@ -36,7 +36,12 @@ const createPayload = (const setup = (payload = createPayload(),- resource: EditorResource = { kind: 'app', appId: 'app-1', mode: 'workflow' },+ resource: EditorResource = {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'app-1',+ mode: 'workflow',+ },) => {const { queryClient } = createConsoleQueryWrapper()seedToolProviders(queryClient, {@@ -117,9 +122,22 @@ it('persists consecutive model, completion and class edits without losing earlieit.each([{ resource: { kind: 'snippet', snippetId: 'snippet-1' } as EditorResource, selector: [] },- { resource: { kind: 'app', appId: 'app-1', mode: 'workflow' } as EditorResource, selector: [] },{- resource: { kind: 'app', appId: 'app-1', mode: 'advanced-chat' } as EditorResource,+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'app-1',+ mode: 'workflow',+ } as EditorResource,+ selector: [],+ },+ {+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'app-1',+ mode: 'advanced-chat',+ } as EditorResource,selector: ['start', 'sys.query'],},])('derives the default query selector from $resource', async ({ resource, selector }) => {diff --git a/web/app/components/workflow/nodes/start-placeholder/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/start-placeholder/__tests__/panel.spec.tsxindex f6723210ac8..9408b1b634e 100644--- a/web/app/components/workflow/nodes/start-placeholder/__tests__/panel.spec.tsx+++ b/web/app/components/workflow/nodes/start-placeholder/__tests__/panel.spec.tsx@@ -81,7 +81,7 @@ it('replaces the placeholder and generates webhook URLs only after the graph is})const { queryClient } = createConsoleQueryWrapper({appDslVersion: '0.6.0',- systemFeatures: { enable_marketplace: false, enable_collaboration_mode: false },+ systemFeatures: { enable_marketplace: false },})queryClient.setQueryData(consoleQuery.workspaces.current.triggers.get.queryKey({ input: {} }), [])const { store } = renderWorkflowFlowComponent(diff --git a/web/app/components/workflow/operator/__tests__/control.spec.tsx b/web/app/components/workflow/operator/__tests__/control.spec.tsxindex 9e192f25cf7..e0814f9124e 100644--- a/web/app/components/workflow/operator/__tests__/control.spec.tsx+++ b/web/app/components/workflow/operator/__tests__/control.spec.tsx@@ -36,12 +36,15 @@ const renderControl = ({} = {}) => {const { queryClient } = createConsoleQueryWrapper({accountProfile: { name: 'Ada' },- systemFeatures: { enable_collaboration_mode: collaborationEnabled },})return renderWorkflowFlowComponent(<Control />, {queryClient,+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled },nodes: [createNode({ id: 'node-1' })],- initialStoreState: { controlMode: ControlMode.Pointer, ...initialStoreState },+ initialStoreState: {+ controlMode: ControlMode.Pointer,+ ...initialStoreState,+ },})}diff --git a/web/app/components/workflow/operator/__tests__/zoom-in-out.spec.tsx b/web/app/components/workflow/operator/__tests__/zoom-in-out.spec.tsxindex 75ec2fdbee4..227404ff670 100644--- a/web/app/components/workflow/operator/__tests__/zoom-in-out.spec.tsx+++ b/web/app/components/workflow/operator/__tests__/zoom-in-out.spec.tsx@@ -17,19 +17,20 @@ const renderZoomInOut = ({ui?: React.ReactElementinitialZoom?: number} = {}) => {- const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: collaborationEnabled },- })+ const { queryClient } = createConsoleQueryWrapper()const doSyncWorkflowDraft = vi.fn<HooksStoreShape['doSyncWorkflowDraft']>().mockResolvedValue(undefined)const view = renderWorkflowFlowComponent(ui, {queryClient,+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled },nodes: [createNode({ id: 'left', position: { x: 0, y: 0 }, width: 240, height: 80 }),createNode({ id: 'right', position: { x: 1600, y: 400 }, width: 240, height: 80 }),],- initialStoreState: { canvasReadOnly: workflowReadOnly },+ initialStoreState: {+ canvasReadOnly: workflowReadOnly,+ },hooksStoreProps: { doSyncWorkflowDraft },reactFlowProps: {fitView: false,diff --git a/web/app/components/workflow/operator/zoom-in-out.tsx b/web/app/components/workflow/operator/zoom-in-out.tsxindex 7e83979db57..11c71ad1820 100644--- a/web/app/components/workflow/operator/zoom-in-out.tsx+++ b/web/app/components/workflow/operator/zoom-in-out.tsx@@ -9,11 +9,11 @@ import {MenuSeparator,MenuTrigger,} from '@langgenius/dify-ui/menu'-import { useSuspenseQuery } from '@tanstack/react-query'+import { useAtomValue } from 'jotai'import { Fragment, memo, useState } from 'react'import { useTranslation } from 'react-i18next'import { useReactFlow, useViewport } from 'reactflow'-import { systemFeaturesQueryOptions } from '@/features/system-features/client'+import { editorCollaborationEnabledAtom } from '@/app/components/workflow/editor-resource/state'import { useNodesSyncDraft } from '../hooks/use-nodes-sync-draft'import { useWorkflowReadOnly } from '../hooks/use-workflow'import { handleWorkflowMenuKeyDown } from '../shortcuts/handle-workflow-menu-key-down'@@ -59,10 +59,7 @@ const ZoomInOut: FC<ZoomInOutProps> = ({const { zoom } = useViewport()const { handleSyncWorkflowDraft } = useNodesSyncDraft()const { workflowReadOnly, getWorkflowReadOnly } = useWorkflowReadOnly()- const { data: isCollaborationEnabled } = useSuspenseQuery({- ...systemFeaturesQueryOptions(),- select: (s) => s.enable_collaboration_mode,- })+ const isCollaborationEnabled = useAtomValue(editorCollaborationEnabledAtom)const zoomOptions = [[diff --git a/web/app/components/workflow/panel/chat-record/__tests__/index.spec.tsx b/web/app/components/workflow/panel/chat-record/__tests__/index.spec.tsxindex 1f8a967a6d6..30176409faf 100644--- a/web/app/components/workflow/panel/chat-record/__tests__/index.spec.tsx+++ b/web/app/components/workflow/panel/chat-record/__tests__/index.spec.tsx@@ -127,7 +127,9 @@ describe('ChatRecord', () => {limit: 20,})const view = (appId: string) => (- <EditorResourceScope resource={{ kind: 'app', appId, mode: 'workflow' }}>+ <EditorResourceScope+ resource={{ kind: 'app', collaborationEnabled: false, appId, mode: 'workflow' }}+ ><ChatRecord /></EditorResourceScope>)diff --git a/web/app/components/workflow/panel/chat-variable-panel/__tests__/index.spec.tsx b/web/app/components/workflow/panel/chat-variable-panel/__tests__/index.spec.tsxindex d2db34f454e..602b2d03664 100644--- a/web/app/components/workflow/panel/chat-variable-panel/__tests__/index.spec.tsx+++ b/web/app/components/workflow/panel/chat-variable-panel/__tests__/index.spec.tsx@@ -24,11 +24,17 @@ function InspectVariables({ children }: { children: ReactNode }) {flowStore = useStoreApi()const invalidateConversationVarValues = useInvalidateConversationVarValues({kind: 'app',+ collaborationEnabled: false,appId: 'app-1',mode: 'advanced-chat',})const [hooks] = useState(() => createHooksStore({ invalidateConversationVarValues }))- const { data } = useConversationVarValues({ kind: 'app', appId: 'app-1', mode: 'advanced-chat' })+ const { data } = useConversationVarValues({+ kind: 'app',+ collaborationEnabled: false,+ appId: 'app-1',+ mode: 'advanced-chat',+ })return (<HooksStoreContext value={hooks}>{children}diff --git a/web/app/components/workflow/panel/comments-panel/__tests__/index.spec.tsx b/web/app/components/workflow/panel/comments-panel/__tests__/index.spec.tsxindex 6565015b5aa..0bbf061be44 100644--- a/web/app/components/workflow/panel/comments-panel/__tests__/index.spec.tsx+++ b/web/app/components/workflow/panel/comments-panel/__tests__/index.spec.tsx@@ -8,10 +8,10 @@ import CommentsPanel from '../index'function setup() {const { queryClient } = createConsoleQueryWrapper({accountProfile: { id: 'user-1' },- systemFeatures: { enable_collaboration_mode: true },})return renderWorkflowFlowComponent(<CommentsPanel />, {queryClient,+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled: true },initialStoreState: { showResolvedComments: true },})}diff --git a/web/app/components/workflow/panel/env-panel/__tests__/index.spec.tsx b/web/app/components/workflow/panel/env-panel/__tests__/index.spec.tsxindex 8de4a5acf62..a1799861890 100644--- a/web/app/components/workflow/panel/env-panel/__tests__/index.spec.tsx+++ b/web/app/components/workflow/panel/env-panel/__tests__/index.spec.tsx@@ -272,12 +272,15 @@ const renderPanelWithNuqs = createNuqsTestRenderer(collaboration = false,initialStoreState = {},nodes = [],- resource = { kind: 'app', appId: 'app-1', mode: 'workflow' },+ resource = {+ kind: 'app',+ appId: 'app-1',+ mode: 'workflow',+ collaborationEnabled: collaboration,+ },}: RenderPanelOptions = {},) => {- const { queryClient } = createConsoleQueryWrapper({- systemFeatures: { enable_collaboration_mode: collaboration },- })+ const { queryClient } = createConsoleQueryWrapper()seedModelProviderQueries(queryClient, [createModelCatalogFixture({provider: 'old-provider',diff --git a/web/app/components/workflow/shortcuts/__tests__/workflow-canvas.browser.spec.tsx b/web/app/components/workflow/shortcuts/__tests__/workflow-canvas.browser.spec.tsxindex 0d83e3e6d4e..82423bfc1a2 100644--- a/web/app/components/workflow/shortcuts/__tests__/workflow-canvas.browser.spec.tsx+++ b/web/app/components/workflow/shortcuts/__tests__/workflow-canvas.browser.spec.tsx@@ -170,7 +170,6 @@ async function setup(props: CanvasProps = {}, commentMode = false) {await page.viewport(1000, 700)const { queryClient } = createConsoleQueryWrapper({appDslVersion: '0.6.0',- systemFeatures: { enable_collaboration_mode: commentMode },})// Draft persistence is supplied by the owning editor; graph mutations and history stay real.const save = vi.fn(async () => undefined)@@ -181,6 +180,12 @@ async function setup(props: CanvasProps = {}, commentMode = false) {</>,{queryClient,+ resource: {+ kind: 'app',+ appId: 'app-1',+ mode: 'workflow',+ collaborationEnabled: commentMode,+ },initialStoreState: { controlMode: ControlMode.Hand },hooksStoreProps: { doSyncWorkflowDraft: save },historyStore: { nodes: props.nodes ?? initialNodes, edges: props.edges ?? [] },diff --git a/web/app/components/workflow/shortcuts/__tests__/workflow-canvas.spec.tsx b/web/app/components/workflow/shortcuts/__tests__/workflow-canvas.spec.tsxindex 4864c71b315..46b9d5bdcf1 100644--- a/web/app/components/workflow/shortcuts/__tests__/workflow-canvas.spec.tsx+++ b/web/app/components/workflow/shortcuts/__tests__/workflow-canvas.spec.tsx@@ -93,11 +93,13 @@ function renderCanvas({nodes = [selectedNode()],edges = [],readOnly = false,+ collaborationEnabled = false,platform = 'windows',}: {nodes?: Node[]edges?: Edge[]readOnly?: boolean+ collaborationEnabled?: booleanplatform?: 'mac' | 'windows'} = {}) {const { queryClient } = createConsoleQueryWrapper({ appDslVersion: '1.0.0' })@@ -112,6 +114,7 @@ function renderCanvas({</HotkeysProvider>,{queryClient,+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow', collaborationEnabled },initialStoreState: { canvasReadOnly: readOnly },historyStore: { nodes, edges },hooksStoreProps: { doSyncWorkflowDraft: sync },@@ -150,7 +153,7 @@ describe('Workflow canvas commands', () => {'owns save and mode commands only while its canvas is focused on %s',async (platform) => {const user = userEvent.setup()- const { store, sync } = renderCanvas({ platform })+ const { store, sync } = renderCanvas({ platform, collaborationEnabled: true })const mod = platform === 'mac' ? 'Meta' : 'Control'focusCanvas()diff --git a/web/app/components/workflow/variable-inspect/__tests__/resource-requests.spec.tsx b/web/app/components/workflow/variable-inspect/__tests__/resource-requests.spec.tsxindex 9a45de757aa..5e6f1770b5a 100644--- a/web/app/components/workflow/variable-inspect/__tests__/resource-requests.spec.tsx+++ b/web/app/components/workflow/variable-inspect/__tests__/resource-requests.spec.tsx@@ -45,9 +45,17 @@ const summary: WorkflowDraftVariableWithoutValueResponse = {}const variable: WorkflowDraftVariableResponse = { ...summary, value: 'result', full_content: null }const hosts: { resource: EditorResource; prefix: string }[] = [- { resource: { kind: 'app', appId: 'workflow-1', mode: 'workflow' }, prefix: '/apps/workflow-1' },{- resource: { kind: 'app', appId: 'chatflow-1', mode: 'advanced-chat' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'workflow-1', mode: 'workflow' },+ prefix: '/apps/workflow-1',+ },+ {+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'chatflow-1',+ mode: 'advanced-chat',+ },prefix: '/apps/chatflow-1',},{@@ -132,7 +140,12 @@ describe.each(hosts)('inspector requests for $prefix', ({ resource, prefix }) =>it('invalidates only the current app variable queries and leaves other editors cached', async () => {request.mockResolvedValue(Response.json({ items: [variable] }))const client = createTestQueryClient()- const current: EditorResource = { kind: 'app', appId: 'app-1', mode: 'advanced-chat' }+ const current: EditorResource = {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'app-1',+ mode: 'advanced-chat',+ }const input = (appId: string) => ({ input: { params: { app_id: appId } } })const conversation = consoleQuery.apps.byAppId.workflows.draft.conversationVariables.getconst system = consoleQuery.apps.byAppId.workflows.draft.systemVariables.get@@ -176,7 +189,7 @@ it.each(hosts.filter(({ resource }) => resource.kind !== 'app'))(const lastRunTargets = [{- resource: { kind: 'app', appId: 'shared-id', mode: 'workflow' },+ resource: { kind: 'app', collaborationEnabled: false, appId: 'shared-id', mode: 'workflow' },keyForNode: (nodeId: string) =>consoleQuery.apps.byAppId.workflows.draft.nodes.byNodeId.lastRun.get.queryKey({input: { params: { app_id: 'shared-id', node_id: nodeId } },@@ -197,7 +210,12 @@ const lastRunTargets = [}),},{- resource: { kind: 'app', appId: 'other-app', mode: 'advanced-chat' },+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'other-app',+ mode: 'advanced-chat',+ },keyForNode: (nodeId: string) =>consoleQuery.apps.byAppId.workflows.draft.nodes.byNodeId.lastRun.get.queryKey({input: { params: { app_id: 'other-app', node_id: nodeId } },diff --git a/web/i18n/locales/ar-TN/workflow.json b/web/i18n/locales/ar-TN/workflow.jsonindex 13575c96a32..102957c9b97 100644--- a/web/i18n/locales/ar-TN/workflow.json+++ b/web/i18n/locales/ar-TN/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "المحتوى المخزن","chatVariable.tips": "نصائح","chatVariable.updatedAt": "تم التحديث في ",+ "collaboration.capabilityUnavailable": "تعذّر تحديد ما إذا كان التعاون متاحًا لمساحة العمل هذه.","collaboration.historyAction.generic": "قام متعاون بعملية تراجع/إعادة",+ "collaboration.joinDenied": "تعذّر الانضمام إلى التعاون. تحقّق من صلاحية الوصول وخطة مساحة العمل، ثم أعد فتح المحرّر.",+ "collaboration.joinUnavailable": "تعذر الاتصال بالتحرير التعاوني. قد لا تُحفظ التغييرات في هذه اللوحة.",+ "collaboration.reloadPage": "إعادة تحميل الصفحة","common.accessAPIReference": "الوصول إلى مرجع API","common.accessPointDescription": "تهيئة تطبيق الويب وواجهة API وMCP والمشغلات","common.addBlock": "إضافة عقدة",diff --git a/web/i18n/locales/az-AZ/workflow.json b/web/i18n/locales/az-AZ/workflow.jsonindex 3703371dcb3..9b95f171f1a 100644--- a/web/i18n/locales/az-AZ/workflow.json+++ b/web/i18n/locales/az-AZ/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Saxlanılmış məzmun","chatVariable.tips": "Məsləhətlər","chatVariable.updatedAt": "Yenilənib ",+ "collaboration.capabilityUnavailable": "Bu iş məkanında əməkdaşlığın mövcud olub-olmadığını müəyyən etmək mümkün olmadı.","collaboration.historyAction.generic": "Əməkdaş əməliyyatı geri qaytardı və ya yenidən tətbiq etdi",+ "collaboration.joinDenied": "Birgə redaktəyə qoşulmaq mümkün olmadı. Giriş icazənizi və iş sahəsinin planını yoxlayın, sonra redaktoru yenidən açın.",+ "collaboration.joinUnavailable": "Birgə redaktəyə qoşulmaq olmadı. Bu lövhədəki dəyişikliklər saxlanmamış ola bilər.",+ "collaboration.reloadPage": "Səhifəni yenidən yüklə","common.accessAPIReference": "API istinad sənədlərinə keç","common.accessPointDescription": "Veb tətbiqini, API-ni, MCP-ni və tətikləyiciləri konfiqurasiya edin","common.addBlock": "Düyün əlavə et",diff --git a/web/i18n/locales/de-DE/workflow.json b/web/i18n/locales/de-DE/workflow.jsonindex d13e3250f70..aae61a7b8a8 100644--- a/web/i18n/locales/de-DE/workflow.json+++ b/web/i18n/locales/de-DE/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Gespeicherter Inhalt","chatVariable.tips": "Tipps","chatVariable.updatedAt": "Aktualisiert am ",+ "collaboration.capabilityUnavailable": "Es konnte nicht ermittelt werden, ob die Zusammenarbeit für diesen Arbeitsbereich verfügbar ist.","collaboration.historyAction.generic": "Ein Mitbearbeiter hat Rückgängig/Wiederholen ausgeführt",+ "collaboration.joinDenied": "Die Verbindung zur Zusammenarbeit konnte nicht hergestellt werden. Prüfe deine Zugriffsrechte und den Tarif des Arbeitsbereichs und öffne den Editor erneut.",+ "collaboration.joinUnavailable": "Verbindung zur Zusammenarbeit fehlgeschlagen. Änderungen auf dieser Arbeitsfläche sind möglicherweise nicht gespeichert.",+ "collaboration.reloadPage": "Seite neu laden","common.accessAPIReference": "API-Referenz aufrufen","common.accessPointDescription": "Web-App, API, MCP und Trigger konfigurieren","common.addBlock": "Knoten hinzufügen",diff --git a/web/i18n/locales/en-US/workflow.json b/web/i18n/locales/en-US/workflow.jsonindex 607d74e74f6..b1c3ac7b9aa 100644--- a/web/i18n/locales/en-US/workflow.json+++ b/web/i18n/locales/en-US/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Stored content","chatVariable.tips": "Tips","chatVariable.updatedAt": "Updated at ",+ "collaboration.capabilityUnavailable": "Unable to determine whether collaboration is available for this workspace.","collaboration.historyAction.generic": "A collaborator performed an undo/redo action",+ "collaboration.joinDenied": "Unable to join collaboration. Check your access and workspace plan, then reopen the editor.",+ "collaboration.joinUnavailable": "Unable to connect to collaboration. Changes on this canvas may not be saved.",+ "collaboration.reloadPage": "Reload Page","common.accessAPIReference": "Access API Reference","common.accessPointDescription": "Configure web app, API, MCP, and triggers","common.addBlock": "Add Node",diff --git a/web/i18n/locales/es-ES/workflow.json b/web/i18n/locales/es-ES/workflow.jsonindex 3caf00687fe..2184a063e63 100644--- a/web/i18n/locales/es-ES/workflow.json+++ b/web/i18n/locales/es-ES/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Contenido almacenado","chatVariable.tips": "Consejos","chatVariable.updatedAt": "Actualizado el ",+ "collaboration.capabilityUnavailable": "No se ha podido determinar si la colaboración está disponible para este espacio de trabajo.","collaboration.historyAction.generic": "Un colaborador realizó deshacer/rehacer",+ "collaboration.joinDenied": "No se pudo iniciar la colaboración. Comprueba tus permisos y el plan del espacio de trabajo, y vuelve a abrir el editor.",+ "collaboration.joinUnavailable": "No se pudo conectar a la colaboración. Es posible que los cambios en este lienzo no se hayan guardado.",+ "collaboration.reloadPage": "Recargar Página","common.accessAPIReference": "Acceder a la referencia de la API","common.accessPointDescription": "Configurar la aplicación web, la API, MCP y los activadores","common.addBlock": "Agregar nodo",diff --git a/web/i18n/locales/fa-IR/workflow.json b/web/i18n/locales/fa-IR/workflow.jsonindex 5c05dcf0c69..8f31d5a85f9 100644--- a/web/i18n/locales/fa-IR/workflow.json+++ b/web/i18n/locales/fa-IR/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "محتوای ذخیرهشده","chatVariable.tips": "نکات","chatVariable.updatedAt": "بهروزرسانی شده در ",+ "collaboration.capabilityUnavailable": "امکان تشخیص در دسترس بودن همکاری برای این فضای کاری وجود ندارد.","collaboration.historyAction.generic": "یک همکار عملیات برگرداندن/انجام مجدد را انجام داد",+ "collaboration.joinDenied": "پیوستن به ویرایش مشارکتی ممکن نشد. دسترسی خود و طرح فضای کاری را بررسی کنید و ویرایشگر را دوباره باز کنید.",+ "collaboration.joinUnavailable": "اتصال به ویرایش مشارکتی ممکن نشد. تغییرات این بوم ممکن است ذخیره نشده باشند.",+ "collaboration.reloadPage": "بارگذاری مجدد صفحه","common.accessAPIReference": "دسترسی به مستندات API","common.accessPointDescription": "برنامه وب، API، MCP و محرکها را پیکربندی کنید","common.addBlock": "افزودن گره",diff --git a/web/i18n/locales/fr-FR/workflow.json b/web/i18n/locales/fr-FR/workflow.jsonindex f761a38d82f..7a3ac58036c 100644--- a/web/i18n/locales/fr-FR/workflow.json+++ b/web/i18n/locales/fr-FR/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Contenu stocké","chatVariable.tips": "Conseils","chatVariable.updatedAt": "Mis à jour le ",+ "collaboration.capabilityUnavailable": "Impossible de déterminer si la collaboration est disponible pour cet espace de travail.","collaboration.historyAction.generic": "Un collaborateur a effectué une annulation/une réexécution",+ "collaboration.joinDenied": "Impossible de rejoindre la collaboration. Vérifiez vos droits d’accès et l’offre de l’espace de travail, puis rouvrez l’éditeur.",+ "collaboration.joinUnavailable": "Impossible de se connecter à la collaboration. Les modifications de ce canevas ne sont peut-être pas enregistrées.",+ "collaboration.reloadPage": "Recharger la Page","common.accessAPIReference": "Accéder à la référence API","common.accessPointDescription": "Configurer l’application web, l’API, MCP et les déclencheurs","common.addBlock": "Ajouter un nœud",diff --git a/web/i18n/locales/hi-IN/workflow.json b/web/i18n/locales/hi-IN/workflow.jsonindex f651e48fd00..690a95c054f 100644--- a/web/i18n/locales/hi-IN/workflow.json+++ b/web/i18n/locales/hi-IN/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "संग्रहीत सामग्री","chatVariable.tips": "सुझाव","chatVariable.updatedAt": "अपडेट किया गया ",+ "collaboration.capabilityUnavailable": "यह निर्धारित नहीं किया जा सका कि इस कार्यक्षेत्र के लिए सहयोग उपलब्ध है या नहीं।","collaboration.historyAction.generic": "एक सहयोगी ने Undo/Redo किया",+ "collaboration.joinDenied": "सहयोग से जुड़ना संभव नहीं हुआ। अपनी पहुँच और कार्यक्षेत्र का प्लान जाँचें, फिर संपादक दोबारा खोलें।",+ "collaboration.joinUnavailable": "सहयोग से कनेक्ट नहीं हो सका। इस कैनवास के बदलाव सहेजे नहीं गए हो सकते हैं।",+ "collaboration.reloadPage": "पेज रीलोड करें","common.accessAPIReference": "एपीआई संदर्भ तक पहुंचें","common.accessPointDescription": "वेब ऐप, API, MCP और ट्रिगर कॉन्फ़िगर करें","common.addBlock": "नोड जोड़ें",diff --git a/web/i18n/locales/id-ID/workflow.json b/web/i18n/locales/id-ID/workflow.jsonindex a9a0f9e68fb..f987cdc0118 100644--- a/web/i18n/locales/id-ID/workflow.json+++ b/web/i18n/locales/id-ID/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Konten yang disimpan","chatVariable.tips": "Tips","chatVariable.updatedAt": "Diperbarui pada",+ "collaboration.capabilityUnavailable": "Tidak dapat menentukan apakah kolaborasi tersedia untuk ruang kerja ini.","collaboration.historyAction.generic": "Seorang kolaborator melakukan urungkan/ulang",+ "collaboration.joinDenied": "Tidak dapat bergabung dalam kolaborasi. Periksa akses dan paket ruang kerja Anda, lalu buka kembali editor.",+ "collaboration.joinUnavailable": "Tidak dapat terhubung ke kolaborasi. Perubahan pada kanvas ini mungkin belum disimpan.",+ "collaboration.reloadPage": "Muat Ulang Halaman","common.accessAPIReference": "Referensi API Akses","common.accessPointDescription": "Konfigurasikan aplikasi web, API, MCP, dan pemicu","common.addBlock": "Tambahkan Node",diff --git a/web/i18n/locales/it-IT/workflow.json b/web/i18n/locales/it-IT/workflow.jsonindex 2a4851a8a0c..0783d38feba 100644--- a/web/i18n/locales/it-IT/workflow.json+++ b/web/i18n/locales/it-IT/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Contenuto memorizzato","chatVariable.tips": "Suggerimenti","chatVariable.updatedAt": "Aggiornato il ",+ "collaboration.capabilityUnavailable": "Impossibile determinare se la collaborazione è disponibile per questo spazio di lavoro.","collaboration.historyAction.generic": "Un collaboratore ha eseguito annulla/ripristina",+ "collaboration.joinDenied": "Impossibile partecipare alla collaborazione. Controlla i permessi di accesso e il piano dell’area di lavoro, quindi riapri l’editor.",+ "collaboration.joinUnavailable": "Impossibile connettersi alla collaborazione. Le modifiche a questa area di lavoro potrebbero non essere salvate.",+ "collaboration.reloadPage": "Ricarica Pagina","common.accessAPIReference": "Accedi alla Riferimento API","common.accessPointDescription": "Configura app web, API, MCP e trigger","common.addBlock": "Aggiungi nodo",diff --git a/web/i18n/locales/ja-JP/workflow.json b/web/i18n/locales/ja-JP/workflow.jsonindex 16b29095f29..1e59dcb4586 100644--- a/web/i18n/locales/ja-JP/workflow.json+++ b/web/i18n/locales/ja-JP/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "保存内容","chatVariable.tips": "ヒント","chatVariable.updatedAt": "最終更新:",+ "collaboration.capabilityUnavailable": "このワークスペースで共同編集を利用できるか確認できませんでした。","collaboration.historyAction.generic": "共同編集者が元に戻す/やり直しを実行しました",+ "collaboration.joinDenied": "共同編集に参加できません。アクセス権とワークスペースのプランを確認し、エディターを開き直してください。",+ "collaboration.joinUnavailable": "共同編集に接続できません。このキャンバスの変更は保存されていない可能性があります。",+ "collaboration.reloadPage": "ページを再読み込み","common.accessAPIReference": "API リファレンス","common.accessPointDescription": "Web アプリ、API、MCP、トリガーを設定","common.addBlock": "ブロックを追加",diff --git a/web/i18n/locales/ko-KR/workflow.json b/web/i18n/locales/ko-KR/workflow.jsonindex 19a082dd6b2..a97da6ea4e6 100644--- a/web/i18n/locales/ko-KR/workflow.json+++ b/web/i18n/locales/ko-KR/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "저장된 내용","chatVariable.tips": "팁","chatVariable.updatedAt": "업데이트 시간: ",+ "collaboration.capabilityUnavailable": "이 작업 공간에서 공동 작업을 사용할 수 있는지 확인할 수 없습니다.","collaboration.historyAction.generic": "공동 작업자가 실행 취소/다시 실행을 수행했습니다",+ "collaboration.joinDenied": "공동 편집에 참여할 수 없습니다. 접근 권한과 워크스페이스 요금제를 확인한 후 편집기를 다시 열어 주세요.",+ "collaboration.joinUnavailable": "공동 편집에 연결할 수 없습니다. 이 캔버스의 변경 사항이 저장되지 않았을 수 있습니다.",+ "collaboration.reloadPage": "페이지 새로고침","common.accessAPIReference": "API 참조 접근","common.accessPointDescription": "웹 앱, API, MCP 및 트리거를 구성합니다","common.addBlock": "노드 추가",diff --git a/web/i18n/locales/lo-LA/workflow.json b/web/i18n/locales/lo-LA/workflow.jsonindex 755f3ed38a9..314a2b0dd3f 100644--- a/web/i18n/locales/lo-LA/workflow.json+++ b/web/i18n/locales/lo-LA/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "ເນື້ອໃນທີ່ເກັບໄວ້","chatVariable.tips": "ຄຳແນະນຳ","chatVariable.updatedAt": "ອັບເດດເມື່ອ ",+ "collaboration.capabilityUnavailable": "ບໍ່ສາມາດກວດສອບໄດ້ວ່າການຮ່ວມມືມີໃຫ້ໃຊ້ສຳລັບພື້ນທີ່ເຮັດວຽກນີ້ຫຼືບໍ່.","collaboration.historyAction.generic": "ຜູ້ຮ່ວມງານໄດ້ເຮັດການ Undo/Redo",+ "collaboration.joinDenied": "ບໍ່ສາມາດເຂົ້າຮ່ວມການແກ້ໄຂຮ່ວມກັນໄດ້. ກວດສອບສິດເຂົ້າເຖິງ ແລະ ແພັກເກັດຂອງພື້ນທີ່ເຮັດວຽກ ແລ້ວເປີດໂຕແກ້ໄຂອີກຄັ້ງ.",+ "collaboration.joinUnavailable": "ບໍ່ສາມາດເຊື່ອມຕໍ່ການແກ້ໄຂຮ່ວມກັນໄດ້. ການປ່ຽນແປງໃນກະດານນີ້ອາດຍັງບໍ່ຖືກບັນທຶກ.",+ "collaboration.reloadPage": "ໂຫຼດໜ້າຄືນໃໝ່","common.accessAPIReference": "ເບິ່ງເອກະສານອ້າງອີງ API","common.accessPointDescription": "ຕັ້ງຄ່າເວັບແອັບ, API, MCP ແລະ ຕົວກະຕຸ້ນ","common.addBlock": "ເພີ່ມໂນດ",diff --git a/web/i18n/locales/nl-NL/workflow.json b/web/i18n/locales/nl-NL/workflow.jsonindex 81f9760056f..143e008ec0b 100644--- a/web/i18n/locales/nl-NL/workflow.json+++ b/web/i18n/locales/nl-NL/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Stored content","chatVariable.tips": "Tips","chatVariable.updatedAt": "Updated at ",+ "collaboration.capabilityUnavailable": "Kan niet bepalen of samenwerking beschikbaar is voor deze werkruimte.","collaboration.historyAction.generic": "Een medewerker heeft een ongedaan maken/opnieuw uitvoeren-actie uitgevoerd",+ "collaboration.joinDenied": "Deelname aan de samenwerking is niet gelukt. Controleer je toegangsrechten en het abonnement van de werkruimte en open de editor opnieuw.",+ "collaboration.joinUnavailable": "Kan geen verbinding maken voor samenwerking. Wijzigingen op dit canvas zijn mogelijk niet opgeslagen.",+ "collaboration.reloadPage": "Pagina herladen","common.accessAPIReference": "Access API Reference","common.accessPointDescription": "Webapp, API, MCP en triggers configureren","common.addBlock": "Add Node",diff --git a/web/i18n/locales/pl-PL/workflow.json b/web/i18n/locales/pl-PL/workflow.jsonindex ee6b26e1958..e196c45ca0e 100644--- a/web/i18n/locales/pl-PL/workflow.json+++ b/web/i18n/locales/pl-PL/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Przechowywana zawartość","chatVariable.tips": "Wskazówki","chatVariable.updatedAt": "Zaktualizowano ",+ "collaboration.capabilityUnavailable": "Nie można ustalić, czy współpraca jest dostępna w tym obszarze roboczym.","collaboration.historyAction.generic": "Współpracownik wykonał cofnięcie/ponowienie",+ "collaboration.joinDenied": "Nie można dołączyć do współpracy. Sprawdź dostęp i plan obszaru roboczego, a następnie otwórz edytor ponownie.",+ "collaboration.joinUnavailable": "Nie udało się połączyć ze współpracą. Zmiany na tym obszarze roboczym mogły nie zostać zapisane.",+ "collaboration.reloadPage": "Odśwież stronę","common.accessAPIReference": "Uzyskaj dostęp do dokumentacji API","common.accessPointDescription": "Skonfiguruj aplikację internetową, API, MCP i wyzwalacze","common.addBlock": "Dodaj węzeł",diff --git a/web/i18n/locales/pt-BR/workflow.json b/web/i18n/locales/pt-BR/workflow.jsonindex 5958b92c5de..57133958c78 100644--- a/web/i18n/locales/pt-BR/workflow.json+++ b/web/i18n/locales/pt-BR/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Conteúdo armazenado","chatVariable.tips": "Dicas","chatVariable.updatedAt": "Atualizado em ",+ "collaboration.capabilityUnavailable": "Não foi possível determinar se a colaboração está disponível para este espaço de trabalho.","collaboration.historyAction.generic": "Um colaborador realizou desfazer/refazer",+ "collaboration.joinDenied": "Não foi possível entrar na colaboração. Verifique seu acesso e o plano do espaço de trabalho e abra o editor novamente.",+ "collaboration.joinUnavailable": "Não foi possível conectar à colaboração. As alterações nesta área podem não ter sido salvas.",+ "collaboration.reloadPage": "Recarregar Página","common.accessAPIReference": "Acessar referência da API","common.accessPointDescription": "Configurar aplicativo web, API, MCP e gatilhos","common.addBlock": "Adicionar Nó",diff --git a/web/i18n/locales/ro-RO/workflow.json b/web/i18n/locales/ro-RO/workflow.jsonindex bcfae9b1b9c..afc7b069f1b 100644--- a/web/i18n/locales/ro-RO/workflow.json+++ b/web/i18n/locales/ro-RO/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Conținut stocat","chatVariable.tips": "Sfaturi","chatVariable.updatedAt": "Actualizat la ",+ "collaboration.capabilityUnavailable": "Nu s-a putut determina dacă colaborarea este disponibilă pentru acest spațiu de lucru.","collaboration.historyAction.generic": "Un colaborator a efectuat anulare/refacere",+ "collaboration.joinDenied": "Nu te poți alătura colaborării. Verifică accesul și abonamentul spațiului de lucru, apoi redeschide editorul.",+ "collaboration.joinUnavailable": "Nu s-a putut conecta la colaborare. Modificările de pe acest spațiu de lucru ar putea să nu fie salvate.",+ "collaboration.reloadPage": "Reîncarcă pagina","common.accessAPIReference": "Accesează referința API","common.accessPointDescription": "Configurează aplicația web, API, MCP și declanșatoarele","common.addBlock": "Adaugă nod",diff --git a/web/i18n/locales/ru-RU/workflow.json b/web/i18n/locales/ru-RU/workflow.jsonindex ce3563a19d8..4ee420273bf 100644--- a/web/i18n/locales/ru-RU/workflow.json+++ b/web/i18n/locales/ru-RU/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Сохраненный контент","chatVariable.tips": "Советы","chatVariable.updatedAt": "Обновлено в ",+ "collaboration.capabilityUnavailable": "Не удалось определить, доступно ли совместное редактирование в этом рабочем пространстве.","collaboration.historyAction.generic": "Участник выполнил отмену/повтор",+ "collaboration.joinDenied": "Не удалось присоединиться к совместному редактированию. Проверьте права доступа и тариф рабочего пространства, затем откройте редактор снова.",+ "collaboration.joinUnavailable": "Не удалось подключиться к совместной работе. Изменения на этом холсте могут быть не сохранены.",+ "collaboration.reloadPage": "Перезагрузить страницу","common.accessAPIReference": "Доступ к справочнику API","common.accessPointDescription": "Настроить веб-приложение, API, MCP и триггеры","common.addBlock": "Добавить узел",diff --git a/web/i18n/locales/sl-SI/workflow.json b/web/i18n/locales/sl-SI/workflow.jsonindex fd7cfe1126a..042cccc09de 100644--- a/web/i18n/locales/sl-SI/workflow.json+++ b/web/i18n/locales/sl-SI/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Shranjena vsebina","chatVariable.tips": "Nasveti","chatVariable.updatedAt": "Posodobljeno ob",+ "collaboration.capabilityUnavailable": "Ni mogoče ugotoviti, ali je sodelovanje na voljo za ta delovni prostor.","collaboration.historyAction.generic": "Sodelavec je izvedel razveljavitev/ponovitev",+ "collaboration.joinDenied": "Pridružitev sodelovanju ni uspela. Preverite dostop in paket delovnega prostora ter znova odprite urejevalnik.",+ "collaboration.joinUnavailable": "Povezava za sodelovanje ni uspela. Spremembe na tem platnu morda niso shranjene.",+ "collaboration.reloadPage": "Znova naloži stran","common.accessAPIReference": "Dostop do referenčnega API-ja","common.accessPointDescription": "Nastavi spletno aplikacijo, API, MCP in sprožilce","common.addBlock": "Dodaj vozlišče",diff --git a/web/i18n/locales/th-TH/workflow.json b/web/i18n/locales/th-TH/workflow.jsonindex e2487b8c778..6550695a6d5 100644--- a/web/i18n/locales/th-TH/workflow.json+++ b/web/i18n/locales/th-TH/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "เนื้อหาที่เก็บไว้","chatVariable.tips": "เคล็ดลับ","chatVariable.updatedAt": "อัพเดทเมื่อ",+ "collaboration.capabilityUnavailable": "ไม่สามารถตรวจสอบได้ว่าพื้นที่ทำงานนี้สามารถใช้งานการทำงานร่วมกันได้หรือไม่","collaboration.historyAction.generic": "ผู้ร่วมงานได้ทำการยกเลิก/ทำซ้ำ",+ "collaboration.joinDenied": "ไม่สามารถเข้าร่วมการแก้ไขร่วมกันได้ โปรดตรวจสอบสิทธิ์การเข้าถึงและแพ็กเกจพื้นที่ทำงาน แล้วเปิดตัวแก้ไขอีกครั้ง",+ "collaboration.joinUnavailable": "ไม่สามารถเชื่อมต่อการทำงานร่วมกันได้ การเปลี่ยนแปลงบนพื้นที่นี้อาจยังไม่ได้รับการบันทึก",+ "collaboration.reloadPage": "โหลดหน้าใหม่","common.accessAPIReference": "การอ้างอิง API การเข้าถึง","common.accessPointDescription": "กำหนดค่าเว็บแอป, API, MCP และทริกเกอร์","common.addBlock": "เพิ่มโนด",diff --git a/web/i18n/locales/tr-TR/workflow.json b/web/i18n/locales/tr-TR/workflow.jsonindex 7049b4f7903..13128d41dcd 100644--- a/web/i18n/locales/tr-TR/workflow.json+++ b/web/i18n/locales/tr-TR/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Depolanan içerik","chatVariable.tips": "İpuçları","chatVariable.updatedAt": "Güncellenme zamanı: ",+ "collaboration.capabilityUnavailable": "Bu çalışma alanında iş birliğinin kullanılabilir olup olmadığı belirlenemedi.","collaboration.historyAction.generic": "Bir işbirlikçi geri alma/yeniden yapma gerçekleştirdi",+ "collaboration.joinDenied": "Ortak düzenlemeye katılamadınız. Erişim izninizi ve çalışma alanı planını kontrol edip düzenleyiciyi yeniden açın.",+ "collaboration.joinUnavailable": "Ortak düzenlemeye bağlanılamadı. Bu tuvaldeki değişiklikler kaydedilmemiş olabilir.",+ "collaboration.reloadPage": "Sayfayı Yenile","common.accessAPIReference": "API Referansına Eriş","common.accessPointDescription": "Web uygulamasını, API'yi, MCP'yi ve tetikleyicileri yapılandır","common.addBlock": "Düğüm Ekle",diff --git a/web/i18n/locales/uk-UA/workflow.json b/web/i18n/locales/uk-UA/workflow.jsonindex 2c6a0d0b897..92de92ecd36 100644--- a/web/i18n/locales/uk-UA/workflow.json+++ b/web/i18n/locales/uk-UA/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Збережений вміст","chatVariable.tips": "Поради","chatVariable.updatedAt": "Оновлено ",+ "collaboration.capabilityUnavailable": "Не вдалося визначити, чи доступне спільне редагування в цьому робочому просторі.","collaboration.historyAction.generic": "Співавтор виконав скасування/повторення",+ "collaboration.joinDenied": "Не вдалося приєднатися до спільного редагування. Перевірте доступ і тариф робочого простору, а потім відкрийте редактор знову.",+ "collaboration.joinUnavailable": "Не вдалося підключитися до спільної роботи. Зміни на цьому полотні можуть бути не збережені.",+ "collaboration.reloadPage": "Перезавантажити сторінку","common.accessAPIReference": "Доступ до довідника API","common.accessPointDescription": "Налаштувати вебзастосунок, API, MCP і тригери","common.addBlock": "Додати вузол",diff --git a/web/i18n/locales/vi-VN/workflow.json b/web/i18n/locales/vi-VN/workflow.jsonindex 321730e0ef1..6ed16e52368 100644--- a/web/i18n/locales/vi-VN/workflow.json+++ b/web/i18n/locales/vi-VN/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "Nội dung đã lưu","chatVariable.tips": "Mẹo","chatVariable.updatedAt": "Cập nhật lúc ",+ "collaboration.capabilityUnavailable": "Không thể xác định tính năng cộng tác có khả dụng cho không gian làm việc này hay không.","collaboration.historyAction.generic": "Một cộng tác viên đã thực hiện hoàn tác/làm lại",+ "collaboration.joinDenied": "Không thể tham gia chỉnh sửa cộng tác. Hãy kiểm tra quyền truy cập và gói của không gian làm việc, sau đó mở lại trình chỉnh sửa.",+ "collaboration.joinUnavailable": "Không thể kết nối cộng tác. Các thay đổi trên bảng này có thể chưa được lưu.",+ "collaboration.reloadPage": "Tải lại trang","common.accessAPIReference": "Truy cập tài liệu API","common.accessPointDescription": "Cấu hình ứng dụng web, API, MCP và trình kích hoạt","common.addBlock": "Thêm Node",diff --git a/web/i18n/locales/zh-Hans/workflow.json b/web/i18n/locales/zh-Hans/workflow.jsonindex 41611157ccf..c75374e7e57 100644--- a/web/i18n/locales/zh-Hans/workflow.json+++ b/web/i18n/locales/zh-Hans/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "存储内容","chatVariable.tips": "提示","chatVariable.updatedAt": "更新时间 ",+ "collaboration.capabilityUnavailable": "无法确定此工作区是否支持协作编辑。","collaboration.historyAction.generic": "协作者执行了撤销/重做操作",+ "collaboration.joinDenied": "无法加入协作。请检查访问权限和工作区套餐,然后重新打开编辑器。",+ "collaboration.joinUnavailable": "无法连接协作编辑,此画布上的修改可能尚未保存。",+ "collaboration.reloadPage": "重新加载页面","common.accessAPIReference": "访问 API","common.accessPointDescription": "配置 Web 应用、API、MCP 和触发器","common.addBlock": "添加节点",diff --git a/web/i18n/locales/zh-Hant/workflow.json b/web/i18n/locales/zh-Hant/workflow.jsonindex d68b909d7b6..d3252744555 100644--- a/web/i18n/locales/zh-Hant/workflow.json+++ b/web/i18n/locales/zh-Hant/workflow.json@@ -109,7 +109,11 @@"chatVariable.storedContent": "已儲存內容","chatVariable.tips": "提示","chatVariable.updatedAt": "更新於 ",+ "collaboration.capabilityUnavailable": "無法確認此工作區是否支援協作編輯。","collaboration.historyAction.generic": "協作者執行了復原/重做操作",+ "collaboration.joinDenied": "無法加入協作。請檢查存取權限和工作區方案,然後重新開啟編輯器。",+ "collaboration.joinUnavailable": "無法連線至協作編輯,此畫布上的變更可能尚未儲存。",+ "collaboration.reloadPage": "重新載入頁面","common.accessAPIReference": "訪問 API","common.accessPointDescription": "設定 Web 應用、API、MCP 和觸發器","common.addBlock": "新增節點",diff --git a/web/i18n/resources.generated.d.ts b/web/i18n/resources.generated.d.tsindex 48060ccb99b..32ed243cec1 100644--- a/web/i18n/resources.generated.d.ts+++ b/web/i18n/resources.generated.d.ts@@ -5810,7 +5810,11 @@ export default interface Resources {'chatVariable.storedContent': 'Stored content''chatVariable.tips': 'Tips''chatVariable.updatedAt': 'Updated at '+ 'collaboration.capabilityUnavailable': 'Unable to determine whether collaboration is available for this workspace.''collaboration.historyAction.generic': 'A collaborator performed an undo/redo action'+ 'collaboration.joinDenied': 'Unable to join collaboration. Check your access and workspace plan, then reopen the editor.'+ 'collaboration.joinUnavailable': 'Unable to connect to collaboration. Changes on this canvas may not be saved.'+ 'collaboration.reloadPage': 'Reload Page''common.accessAPIReference': 'Access API Reference''common.accessPointDescription': 'Configure web app, API, MCP, and triggers''common.addBlock': 'Add Node'diff --git a/web/service/__tests__/delete-workflow-version.spec.ts b/web/service/__tests__/delete-workflow-version.spec.tsindex 7eb91c9e338..bfe43fbf20e 100644--- a/web/service/__tests__/delete-workflow-version.spec.ts+++ b/web/service/__tests__/delete-workflow-version.spec.ts@@ -10,7 +10,12 @@ vi.mock('@/service/base', () => ({ request }))const cases = [{- resource: { kind: 'app', appId: 'owner', mode: 'workflow' } satisfies EditorResource,+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'owner',+ mode: 'workflow',+ } satisfies EditorResource,path: '/apps/owner/workflows/version-1',key: (id: string) =>consoleQuery.apps.byAppId.workflows.get.key({ input: { params: { app_id: id } } }),diff --git a/web/service/__tests__/use-workflow.spec.tsx b/web/service/__tests__/use-workflow.spec.tsxindex 6aad7f0e6d8..6b7ffe10733 100644--- a/web/service/__tests__/use-workflow.spec.tsx+++ b/web/service/__tests__/use-workflow.spec.tsx@@ -194,7 +194,12 @@ describe('useUpdateWorkflow', () => {it.each([{- resource: { kind: 'app', appId: 'owner', mode: 'workflow' } satisfies EditorResource,+ resource: {+ kind: 'app',+ collaborationEnabled: false,+ appId: 'owner',+ mode: 'workflow',+ } satisfies EditorResource,path: '/apps/owner',key: (id: string) =>consoleQuery.apps.byAppId.workflows.get.key({ input: { params: { app_id: id } } }),@@ -538,7 +543,10 @@ describe('useUpdateWorkflow', () => {describe('useRestoreWorkflow', () => {const resources = [- { resource: { kind: 'app', appId: 'app-1', mode: 'advanced-chat' }, path: '/apps/app-1' },+ {+ resource: { kind: 'app', collaborationEnabled: false, appId: 'app-1', mode: 'advanced-chat' },+ path: '/apps/app-1',+ },{resource: { kind: 'knowledge-pipeline', pipelineId: 'pipeline-1' },path: '/rag/pipelines/pipeline-1',diff --git a/web/service/use-workflow.ts b/web/service/use-workflow.tsindex ca242d2a1d8..0a0f7a1b672 100644--- a/web/service/use-workflow.ts+++ b/web/service/use-workflow.ts@@ -93,7 +93,7 @@ export const useResetWorkflowVersionHistory = () => {type UpdateVersionParams = {resource:- | Omit<Extract<EditorResource, { kind: 'app' }>, 'mode'>+ | Omit<Extract<EditorResource, { kind: 'app' }>, 'mode' | 'collaborationEnabled'>| Exclude<EditorResource, { kind: 'app' }>versionId: stringtitle: stringdiff --git a/web/test/console/system-features.ts b/web/test/console/system-features.tsindex 0ebe648312a..004f1ffbbf4 100644--- a/web/test/console/system-features.ts+++ b/web/test/console/system-features.ts@@ -24,7 +24,6 @@ const baseSystemFeatures = {enable_email_code_login: false,enable_email_password_login: true,enable_social_oauth_login: false,- enable_collaboration_mode: true,is_allow_register: false,is_email_setup: false,enable_change_email: true,diff --git a/web/test/workflow-editor.tsx b/web/test/workflow-editor.tsxindex ec9d0474fca..a732e2ddd21 100644--- a/web/test/workflow-editor.tsx+++ b/web/test/workflow-editor.tsx@@ -12,8 +12,6 @@ export function renderWorkflowEditor() {const { queryClient } = createConsoleQueryWrapper({appDslVersion: '0.6.0',- // Local editing tests do not establish a collaboration socket or hydrate a CRDT document.- systemFeatures: { enable_collaboration_mode: false },})seedModelProviderQueries(queryClient)seedToolProviders(queryClient, {