:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(access-control): add resource access control for workflows (#65314)
Reece Jones24f856e499d9
diff --git a/common/storybook/.storybook/app-context.ts b/common/storybook/.storybook/app-context.tsindex f12b3950bdd5..64c6a0bc9621 100644--- a/common/storybook/.storybook/app-context.ts+++ b/common/storybook/.storybook/app-context.ts@@ -74,6 +74,7 @@ export const getStorybookAppContext = (): AppContext => ({resource_access_control: {action: 'manager',feature_flag: 'manager',+ hog_flow: 'manager',dashboard: 'manager',dashboard_template: 'manager',insight: 'manager',diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 0f32b4fd1307..feee305e9107 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6619,9 +6619,9 @@ snapshots:scenes-app-settings-authentication-domains--one-unverified-domain--light:hash: v1.k794b7964.b1ae6dbc8feb673159fcc13f4a8fd5ee856c63ad1204e839a1b55ef70d109c81.W5sqRIJDHcdkKlYg4ghfwpbKS2FmlQKF_N-1C83h9Mgscenes-app-settings-environment--settings-environment-access-control--dark:- hash: v1.k794b7964.a0125503884f0d49a6eba7c118e0db43af03da0857b5bc1837df7201ccb9d602.6rTAKIz6E2uU0hDWTI7EqZ7q2MbsHXNrCDdTL7pvWnA+ hash: v1.k794b7964.5bdb625b2aa06881aa45de062d90db4a79c1d5db3a98d19bd32732ca7bbf131d.c-3ldkVa3GNd3un6_Kz92eUf4lDgv_J9gRENX6TzpHIscenes-app-settings-environment--settings-environment-access-control--light:- hash: v1.k794b7964.da4e21b370f25af16cc80f6feb3cc9e44714290ca057df0e39633baa9be87400.lHR_PFoDZHI1Ndl69I4QdieG0059wkrcdR_HGEVT7Us+ hash: v1.k794b7964.5c5044164897f6364215a0895d4b5ad61512f876a7a8960e0e515ca096ff6331.6B9W_QyrpxTnrwOjIWXdpDxc-7JlvDA6KOMec3_sYbEscenes-app-settings-environment--settings-environment-autocapture--dark:hash: v1.k794b7964.2183cf0082a1556d6df553572df4ab3813c96288a8b9a80e669c005908230c3e.-ybX8d6KyxaSa-yJDVccZm2CkK8Fl8qLSbw9jGhSIx4scenes-app-settings-environment--settings-environment-autocapture--light:diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/ScopeIcon.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/ScopeIcon.tsxindex bad6fe4d6268..f3be71840df8 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/ScopeIcon.tsx+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/ResourceAccessControlsV2/ScopeIcon.tsx@@ -5,6 +5,7 @@ import {IconCursor,IconDashboard,IconDatabase,+ IconDecisionTree,IconDownload,IconFlask,IconHome,@@ -56,6 +57,8 @@ export function ScopeIcon(props: { scope: APIScopeObject }): JSX.Element | nullreturn <IconDatabase />case 'feature_flag':return <IconToggle />+ case 'hog_flow':+ return <IconDecisionTree />case 'insight':return <IconTrends />case 'llm_analytics':diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.tsindex cbd847b29c3c..e703d460b770 100644--- a/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts+++ b/frontend/src/layout/navigation-3000/sidepanel/panels/access_control/resourcesAccessControlLogic.ts@@ -309,6 +309,7 @@ export const resourcesAccessControlLogic = kea<resourcesAccessControlLogicType>(AccessControlResourceType.ErrorTracking,AccessControlResourceType.Survey,AccessControlResourceType.WebAnalytics,+ AccessControlResourceType.Workflow,]return allResources.filter((resource) => {diff --git a/frontend/src/lib/utils/accessControlUtils.ts b/frontend/src/lib/utils/accessControlUtils.tsindex 9fe4f9bb99cc..55ab8432b3ba 100644--- a/frontend/src/lib/utils/accessControlUtils.ts+++ b/frontend/src/lib/utils/accessControlUtils.ts@@ -76,6 +76,8 @@ export const pluralizeResource = (resource: APIScopeObject): string => {return 'logs'} else if (resource === AccessControlResourceType.Tracing) {return 'tracing'+ } else if (resource === AccessControlResourceType.Workflow) {+ return 'workflows'}return resource.replace(/_/g, ' ') + 's'@@ -116,6 +118,8 @@ export const resourceTypeToString = (resourceType: AccessControlResourceType): sreturn 'web analytics resource'} else if (resourceType === AccessControlResourceType.ExternalDataSource) {return 'data warehouse source'+ } else if (resourceType === AccessControlResourceType.Workflow) {+ return 'workflow'}return resourceType.replace(/_/g, ' ')diff --git a/frontend/src/scenes/sceneTypes.ts b/frontend/src/scenes/sceneTypes.tsindex fec00192733e..e99e89517284 100644--- a/frontend/src/scenes/sceneTypes.ts+++ b/frontend/src/scenes/sceneTypes.ts@@ -353,6 +353,10 @@ export const sceneToAccessControlResourceType: Partial<Record<Scene, AccessContr// Endpoints[Scene.EndpointsScene]: AccessControlResourceType.Endpoint,+ // Workflows+ [Scene.Workflow]: AccessControlResourceType.Workflow,+ [Scene.Workflows]: AccessControlResourceType.Workflow,+// Product Tours[Scene.ProductTour]: AccessControlResourceType.ProductTour,[Scene.ProductTours]: AccessControlResourceType.ProductTour,diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex 581bceb8f6b0..7226fc7ef745 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -289,6 +289,7 @@ export enum AccessControlResourceType {Survey = 'survey',Logs = 'logs',Endpoint = 'endpoint',+ Workflow = 'hog_flow',EarlyAccessFeature = 'early_access_feature',ProductTour = 'product_tour',Experiment = 'experiment',diff --git a/posthog/rbac/user_access_control.py b/posthog/rbac/user_access_control.pyindex 43010d8ed97f..8c58125f75b9 100644--- a/posthog/rbac/user_access_control.py+++ b/posthog/rbac/user_access_control.py@@ -68,6 +68,7 @@ ACCESS_CONTROL_RESOURCES: tuple[APIScopeObject, ...] = ("external_data_source","warehouse_objects","feature_flag",+ "hog_flow","insight","llm_analytics","notebook",@@ -150,6 +151,8 @@ def resource_to_display_name(resource: APIScopeObject) -> str:# Handle special casesif resource == "organization":return "organization" # singular+ if resource == "hog_flow":+ return "workflows"if resource == "external_data_source":return "data warehouse sources"if resource == "warehouse_objects":@@ -311,6 +314,10 @@ def model_to_resource(model: Model) -> Optional[APIScopeObject]:return "experiment_holdout"if name == "endpointversion":return "endpoint"+ # The workflow scope is "hog_flow" but the model is "hogflow"; its batch jobs and schedules have no+ # route of their own and inherit the parent workflow's access (same idea as endpointversion → endpoint).+ if name in ("hogflow", "hogflowbatchjob", "hogflowschedule"):+ return "hog_flow"if name == "externaldatasource":return "external_data_source"if name == "externaldataschema":diff --git a/products/notifications/backend/tests/test_logic.py b/products/notifications/backend/tests/test_logic.pyindex 1d23aa41b878..3ff59bae868c 100644--- a/products/notifications/backend/tests/test_logic.py+++ b/products/notifications/backend/tests/test_logic.py@@ -399,14 +399,14 @@ class TestPublishResourceEdited(BaseTest):@patch("products.notifications.backend.logic.get_producer")@patch.object(RecipientsResolver, "filter_by_access_control")def test_skips_access_control_filtering_for_non_ac_resource(self, mock_ac_filter, mock_get_producer, mock_ff):- # hog_flow is not an access-controlled resource type, so recipients are not AC-filtered.+ # annotation is not an access-controlled resource type, so recipients are not AC-filtered.with self.captureOnCommitCallbacks(execute=True):publish_resource_edited(team=self.team,- resource_type="HogFlow",- resource_id="flow-123",+ resource_type="Annotation",+ resource_id="annotation-123",updated_at="2026-06-16T00:00:00+00:00",- ac_resource_type="hog_flow",+ ac_resource_type="annotation",)mock_ac_filter.assert_not_called()diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.pyindex 3ea51cade932..d3459afc675d 100644--- a/products/workflows/backend/api/hog_flow.py+++ b/products/workflows/backend/api/hog_flow.py@@ -8,7 +8,7 @@ from typing import Any, Optional, castfrom django.core.exceptions import ValidationError as DjangoValidationErrorfrom django.db import transactionfrom django.db.models import QuerySet-from django.http import HttpResponse+from django.http import Http404, HttpResponsefrom django.utils import timezonefrom django.utils.dateparse import parse_datetime@@ -58,6 +58,8 @@ from posthog.plugins.plugin_server_api import (create_hog_flow_scheduled_invocation,rerun_hog_invocations,)+from posthog.rbac.access_control_api_mixin import AccessControlViewSetMixin+from posthog.rbac.user_access_control import UserAccessControlSerializerMixinfrom posthog.utils import relative_date_parse_with_delta_mappingfrom products.cdp.backend.models.hog_function_template import HogFunctionTemplate@@ -809,7 +811,7 @@ class HogFlowScheduleSerializer(serializers.ModelSerializer):return super().update(instance, validated_data)-class HogFlowMinimalSerializer(serializers.ModelSerializer):+class HogFlowMinimalSerializer(UserAccessControlSerializerMixin, serializers.ModelSerializer):created_by = UserBasicSerializer(read_only=True)class Meta:@@ -832,6 +834,7 @@ class HogFlowMinimalSerializer(serializers.ModelSerializer):"abort_action","variables","billable_action_types",+ "user_access_level",]read_only_fields = fields@@ -945,6 +948,7 @@ class HogFlowSerializer(HogFlowMinimalSerializer):"variables","billable_action_types","schedules",+ "user_access_level",]read_only_fields = ["id",@@ -956,6 +960,7 @@ class HogFlowSerializer(HogFlowMinimalSerializer):"abort_action","billable_action_types", # Computed field, not user-editable"schedules", # Managed via the schedules sub-resource, surfaced read-only here+ "user_access_level",]def validate(self, data):@@ -1229,7 +1234,9 @@ class StaleWorkflowUpdateError(exceptions.APIException):@extend_schema(extensions={"x-product": "workflows"})-class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, viewsets.ModelViewSet):+class HogFlowViewSet(+ TeamAndOrgViewSetMixin, AccessControlViewSetMixin, LogEntryMixin, AppMetricsMixin, viewsets.ModelViewSet+):scope_object = "hog_flow"scope_object_read_actions = ["list",@@ -1545,7 +1552,11 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, viedef invocations(self, request: Request, *args, **kwargs):try:hog_flow = self.get_object()- except Exception:+ except (Http404, exceptions.NotFound):+ # Only a genuinely missing workflow lands here (e.g. testing from the builder before first+ # save) — fall back to testing the submitted payload. Permission failures never reach this+ # fallback: a resource-level denial 403s upstream before this method runs, and an object-level+ # PermissionDenied from get_object() is deliberately not caught, so it surfaces as a 403.hog_flow = Noneserializer = HogFlowInvocationSerializer(@@ -1568,6 +1579,13 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, vie@extend_schema(request=BlastRadiusRequestSerializer, responses=BlastRadiusSerializer)@action(methods=["POST"], detail=False)def user_blast_radius(self, request: Request, **kwargs):+ # detail=False, so there's no workflow object for AccessControlPermission to check — it falls back to+ # "has access to any one workflow" (has_any_specific_access_for_resource). That's too weak for a+ # project-wide person/group count: require resource-level workflow access so an object-level grant on+ # a single workflow can't be used as a project-wide audience oracle.+ if not self.user_access_control.check_access_level_for_resource("hog_flow", "viewer"):+ raise exceptions.PermissionDenied("You do not have access to workflows.")+param_serializer = BlastRadiusRequestSerializer(data=request.data)param_serializer.is_valid(raise_exception=True)params = param_serializer.validated_data@@ -1793,8 +1811,18 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, vieexcept ValueError:return Response({"error": "One or more IDs are not valid UUIDs"}, status=400)- queryset = self.get_queryset().filter(id__in=validated_ids, status="archived")- deleted_count, _ = queryset.delete()+ # Match the single destroy path: deleting a workflow needs object-level editor access, not just+ # visibility. filter_queryset_by_access_level only drops effective-"none" (invisible) objects, so an+ # object-specific viewer override would otherwise be bulk-deletable. Check each candidate explicitly.+ candidates = list(self.get_queryset().filter(id__in=validated_ids, status="archived"))+ self.user_access_control.preload_object_access_controls(candidates)+ deletable_ids = [+ flow.id+ for flow in candidates+ if self.user_access_control.check_access_level_for_object(flow, required_level="editor")+ ]++ deleted_count, _ = self.get_queryset().filter(id__in=deletable_ids).delete()return Response({"deleted": deleted_count})@@ -1806,7 +1834,9 @@ class HogFlowViewSet(TeamAndOrgViewSetMixin, LogEntryMixin, AppMetricsMixin, viedef batch_jobs(self, request: Request, *args, **kwargs):try:hog_flow = self.get_object()- except Exception:+ except (Http404, exceptions.NotFound):+ # A PermissionDenied from the object-level access check propagates as a 403; only a genuine+ # missing workflow becomes a friendly 404.raise exceptions.NotFound(f"Workflow {kwargs.get('pk')} not found")if request.method == "POST":diff --git a/products/workflows/backend/api/test/test_hog_flow_access_control.py b/products/workflows/backend/api/test/test_hog_flow_access_control.pynew file mode 100644index 000000000000..42d81e4d2170--- /dev/null+++ b/products/workflows/backend/api/test/test_hog_flow_access_control.py@@ -0,0 +1,258 @@+import pytest+from posthog.test.base import APIBaseTest, ClickhouseTestMixin++from django.test import SimpleTestCase++from parameterized import parameterized+from rest_framework import status++from posthog.constants import AvailableFeature+from posthog.models.organization import OrganizationMembership+from posthog.models.user import User+from posthog.rbac.user_access_control import ACCESS_CONTROL_RESOURCES, model_to_resource++from products.workflows.backend.models.hog_flow.hog_flow import HogFlow+from products.workflows.backend.models.hog_flow_batch_job import HogFlowBatchJob+from products.workflows.backend.models.hog_flow_schedule import HogFlowSchedule++try:+ from ee.models.rbac.access_control import AccessControl+except ImportError:+ pass+++TRIGGER_ACTION = {+ "id": "trigger_node",+ "name": "trigger_1",+ "type": "trigger",+ "config": {+ "type": "event",+ "filters": {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]},+ },+}++# Any UUID — the parent workflow's object-level check rejects before the schedule is ever looked up.+MISSING_SCHEDULE_ID = "00000000-0000-0000-0000-000000000000"+++class TestHogFlowResourceRegistration(SimpleTestCase):+ def test_hog_flow_is_a_controllable_resource(self):+ self.assertIn("hog_flow", ACCESS_CONTROL_RESOURCES)++ def test_hog_flow_model_maps_to_hog_flow_resource(self):+ self.assertEqual(model_to_resource(HogFlow()), "hog_flow")++ @parameterized.expand([("batch_job", HogFlowBatchJob), ("schedule", HogFlowSchedule)])+ def test_child_models_inherit_parent_hog_flow_resource(self, _name, model_cls):+ # Batch jobs and schedules have no route of their own, so access control on them resolves to the+ # parent workflow resource via the model_to_resource override.+ self.assertEqual(model_to_resource(model_cls()), "hog_flow")+++class TestHogFlowAccessControl(ClickhouseTestMixin, APIBaseTest):+ def setUp(self):+ super().setUp()++ self.organization.available_product_features = [+ {"key": AvailableFeature.ACCESS_CONTROL, "name": AvailableFeature.ACCESS_CONTROL},+ {"key": AvailableFeature.ROLE_BASED_ACCESS, "name": AvailableFeature.ROLE_BASED_ACCESS},+ ]+ self.organization.save()++ self.viewer_user = User.objects.create_and_join(self.organization, "[email protected]", "testtest")+ self.editor_user = User.objects.create_and_join(self.organization, "[email protected]", "testtest")+ self.no_access_user = User.objects.create_and_join(self.organization, "[email protected]", "testtest")++ self.hog_flow = self._create_workflow(name="my_workflow")++ def _create_workflow(self, name="my_workflow", state=HogFlow.State.DRAFT) -> HogFlow:+ return HogFlow.objects.create(+ team=self.team,+ name=name,+ created_by=self.user,+ status=state,+ actions=[TRIGGER_ACTION],+ edges=[],+ )++ def _create_access_control(self, user, resource="hog_flow", resource_id=None, access_level="viewer"):+ membership = OrganizationMembership.objects.get(user=user, organization=self.organization)+ return AccessControl.objects.create(+ team=self.team,+ resource=resource,+ resource_id=resource_id,+ access_level=access_level,+ organization_member=membership,+ )++ def _create_project_default(self, resource="hog_flow", access_level="none"):+ return AccessControl.objects.create(+ team=self.team,+ resource=resource,+ resource_id=None,+ access_level=access_level,+ organization_member=None,+ role=None,+ )++ def _list_url(self) -> str:+ return f"/api/projects/{self.team.pk}/hog_flows"++ def _detail_url(self, flow_id=None) -> str:+ return f"/api/projects/{self.team.pk}/hog_flows/{flow_id or self.hog_flow.id}"++ def _create_payload(self, name="new_workflow") -> dict:+ return {"name": name, "actions": [TRIGGER_ACTION]}++ @parameterized.expand(+ [+ ("viewer", "get", status.HTTP_200_OK),+ ("viewer", "patch", status.HTTP_403_FORBIDDEN),+ ("viewer", "delete", status.HTTP_403_FORBIDDEN),+ ("editor", "get", status.HTTP_200_OK),+ ("editor", "patch", status.HTTP_200_OK),+ ("editor", "delete", status.HTTP_204_NO_CONTENT),+ ("none", "get", status.HTTP_403_FORBIDDEN),+ ]+ )+ def test_access_level_matrix(self, access_level, method, expected_status):+ user = {"viewer": self.viewer_user, "editor": self.editor_user, "none": self.no_access_user}[access_level]+ self._create_access_control(user, access_level=access_level)+ self.client.force_login(user)++ if method == "get":+ response = self.client.get(self._detail_url())+ elif method == "patch":+ response = self.client.patch(self._detail_url(), data={"description": "updated"}, format="json")+ else:+ response = self.client.delete(self._detail_url())++ self.assertEqual(response.status_code, expected_status, getattr(response, "data", None))++ def test_user_access_level_in_retrieve_and_list(self):+ self._create_access_control(self.editor_user, access_level="editor")+ self.client.force_login(self.editor_user)++ retrieve = self.client.get(self._detail_url())+ self.assertEqual(retrieve.status_code, status.HTTP_200_OK)+ self.assertEqual(retrieve.json()["user_access_level"], "editor")++ list_response = self.client.get(self._list_url())+ self.assertEqual(list_response.status_code, status.HTTP_200_OK)+ results = list_response.json()["results"]+ self.assertTrue(results)+ self.assertTrue(all(row["user_access_level"] == "editor" for row in results))++ def test_project_default_none_blocks_retrieve(self):+ self._create_project_default(access_level="none")+ self.client.force_login(self.viewer_user)+ self.assertEqual(self.client.get(self._detail_url()).status_code, status.HTTP_403_FORBIDDEN)++ def test_object_level_none_blocks_and_excludes_from_list(self):+ self._create_access_control(self.viewer_user, access_level="viewer")+ self._create_access_control(self.viewer_user, resource_id=str(self.hog_flow.id), access_level="none")+ self.client.force_login(self.viewer_user)++ self.assertEqual(self.client.get(self._detail_url()).status_code, status.HTTP_403_FORBIDDEN)+ ids = [row["id"] for row in self.client.get(self._list_url()).json()["results"]]+ self.assertNotIn(str(self.hog_flow.id), ids)++ def test_create_blocked_without_resource_editor_access(self):+ # A project default of "none" leaves the member below editor, so create is rejected.+ self._create_project_default(access_level="none")+ self._create_access_control(self.viewer_user, access_level="viewer")+ self.client.force_login(self.viewer_user)+ response = self.client.post(self._list_url(), data=self._create_payload(), format="json")+ self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)+ self.assertFalse(HogFlow.objects.filter(team=self.team, name="new_workflow").exists())++ def test_create_allowed_with_resource_editor_access(self):+ self._create_access_control(self.editor_user, access_level="editor")+ self.client.force_login(self.editor_user)+ response = self.client.post(self._list_url(), data=self._create_payload(name="editor_create"), format="json")+ self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.json())+ self.assertTrue(HogFlow.objects.filter(team=self.team, name="editor_create").exists())++ @parameterized.expand(+ [+ ("batch_jobs_list", "get", "/batch_jobs", None),+ ("batch_jobs_create", "post", "/batch_jobs", {}),+ ("schedules_list", "get", "/schedules", None),+ ("schedules_create", "post", "/schedules", {"rrule": "FREQ=DAILY", "starts_at": "2026-01-01T00:00:00Z"}),+ ("schedule_update", "patch", f"/schedules/{MISSING_SCHEDULE_ID}", {"status": "paused"}),+ ("schedule_delete", "delete", f"/schedules/{MISSING_SCHEDULE_ID}", None),+ ("invocation_results", "get", "/invocation_results", None),+ ("invocations", "post", "/invocations", {"globals": {}}),+ (+ "graph",+ "patch",+ "/graph",+ {"operations": [{"op": "update_action", "id": "trigger_node", "patch": {"name": "x"}}]},+ ),+ ]+ )+ def test_custom_actions_enforce_object_level_access(self, _label, method, suffix, body):+ # An object-level "none" on the workflow must 403 every custom action — they all resolve the parent+ # workflow via self.get_object() first (and must not swallow the resulting PermissionDenied).+ self._create_access_control(self.no_access_user, resource_id=str(self.hog_flow.id), access_level="none")+ self.client.force_login(self.no_access_user)++ url = self._detail_url() + suffix+ client_method = getattr(self.client, method)+ response = client_method(url) if body is None else client_method(url, data=body, format="json")++ self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN, getattr(response, "data", response.content))++ def test_bulk_delete_only_deletes_editable_workflows(self):+ # Bulk delete must enforce object-level editor access, exactly like the single destroy path — not+ # mere visibility. A resource-level editor with an object override below editor keeps the workflow.+ archived_ok = self._create_workflow(name="archived_ok", state=HogFlow.State.ARCHIVED)+ archived_denied = self._create_workflow(name="archived_denied", state=HogFlow.State.ARCHIVED)+ archived_viewer = self._create_workflow(name="archived_viewer", state=HogFlow.State.ARCHIVED)+ self._create_access_control(self.editor_user, access_level="editor")+ self._create_access_control(self.editor_user, resource_id=str(archived_denied.id), access_level="none")+ # Visible but not editable: an object-specific viewer override must block deletion even though the+ # caller has resource-level editor access.+ self._create_access_control(self.editor_user, resource_id=str(archived_viewer.id), access_level="viewer")+ self.client.force_login(self.editor_user)++ response = self.client.post(+ f"{self._list_url()}/bulk_delete",+ data={"ids": [str(archived_ok.id), str(archived_denied.id), str(archived_viewer.id)]},+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK, getattr(response, "data", response.content))+ self.assertEqual(response.json()["deleted"], 1)+ self.assertFalse(HogFlow.objects.filter(id=archived_ok.id).exists())+ self.assertTrue(HogFlow.objects.filter(id=archived_denied.id).exists())+ self.assertTrue(HogFlow.objects.filter(id=archived_viewer.id).exists())++ def test_user_blast_radius_requires_resource_level_access(self):+ # user_blast_radius is detail=False, so AccessControlPermission falls back to "access to any one+ # workflow". A viewer grant on a single workflow must not unlock the project-wide audience count:+ # the action requires resource-level workflow access.+ self._create_project_default(access_level="none")+ self._create_access_control(self.no_access_user, resource_id=str(self.hog_flow.id), access_level="viewer")+ self.client.force_login(self.no_access_user)++ response = self.client.post(+ f"{self._list_url()}/user_blast_radius",+ data={"filters": {"properties": []}},+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN, getattr(response, "data", response.content))++ def test_org_admin_bypasses_object_level_denial(self):+ # self.user is the organization owner; object-level denials never apply to org admins.+ self._create_access_control(self.user, resource_id=str(self.hog_flow.id), access_level="none")+ self.client.force_login(self.user)+ self.assertEqual(self.client.get(self._detail_url()).status_code, status.HTTP_200_OK)++ def test_no_enforcement_without_access_control_feature(self):+ # Drop the entitlement — access control rows become inert and ordinary members regain access.+ self.organization.available_product_features = []+ self.organization.save()+ self._create_access_control(self.no_access_user, resource_id=str(self.hog_flow.id), access_level="none")+ self.client.force_login(self.no_access_user)+ self.assertEqual(self.client.get(self._detail_url()).status_code, status.HTTP_200_OK)diff --git a/products/workflows/frontend/Workflows/WorkflowSceneHeader.tsx b/products/workflows/frontend/Workflows/WorkflowSceneHeader.tsxindex 64134aee74bd..6fdf11130ce7 100644--- a/products/workflows/frontend/Workflows/WorkflowSceneHeader.tsx+++ b/products/workflows/frontend/Workflows/WorkflowSceneHeader.tsx@@ -5,6 +5,7 @@ import { useEffect, useRef, useState } from 'react'import { IconArchive, IconCopy, IconScreen } from '@posthog/icons'import { LemonButton, LemonDivider } from '@posthog/lemon-ui'+import { AccessControlAction } from 'lib/components/AccessControlAction'import { SceneMenuBarFileItems } from 'lib/components/Scenes/SceneMenuBarFileItems'import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'@@ -18,6 +19,7 @@ import {} from '~/layout/scenes/components/SceneMenuBar'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { ScenePanel, ScenePanelActionsSection, ScenePanelDivider } from '~/layout/scenes/SceneLayout'+import { AccessControlLevel, AccessControlResourceType } from '~/types'import { HogFlowManualTriggerButton } from './hogflows/HogFlowManualTriggerButton'import { SaveAsTemplateModal } from './templates/SaveAsTemplateModal'@@ -33,6 +35,7 @@ export const WorkflowSceneHeader = (props: WorkflowSceneLogicProps = {}): JSX.ElworkflowLoading,workflowHasErrors,workflowHasActionErrors,+ workflowUserAccessLevel,} = useValues(workflowLogic)const { saveWorkflowPartial, submitWorkflow, setWorkflowValue, duplicate, archiveWorkflow, discardChanges } =useActions(workflowLogic)@@ -75,14 +78,24 @@ export const WorkflowSceneHeader = (props: WorkflowSceneLogicProps = {}): JSX.El<SceneMenuBarMenu label="File" dataAttr="workflow-menubar-file"><SceneMenuBarFileItems dataAttrKey="workflow" /><SceneMenuBarSeparator />- <SceneMenuBarItem- variant="destructive"- onClick={() => archiveWorkflow(workflow)}- data-attr="workflow-menubar-archive"+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={workflowUserAccessLevel ?? undefined}>- <IconArchive />- Archive- </SceneMenuBarItem>+ {({ disabledReason }) => (+ <SceneMenuBarItem+ variant="destructive"+ onClick={() => archiveWorkflow(workflow)}+ data-attr="workflow-menubar-archive"+ disabled={!!disabledReason}+ tooltip={disabledReason ?? undefined}+ >+ <IconArchive />+ Archive+ </SceneMenuBarItem>+ )}+ </AccessControlAction></SceneMenuBarMenu><SceneMenuBarMenu label="Edit" dataAttr="workflow-menubar-edit"><SceneMenuBarItem onClick={() => duplicate()} data-attr="workflow-menubar-duplicate">@@ -114,32 +127,38 @@ export const WorkflowSceneHeader = (props: WorkflowSceneLogicProps = {}): JSX.El{isManualWorkflow && <HogFlowManualTriggerButton {...props} />}{isSavedWorkflow && (<>- <LemonButton- type={displayStatus === 'active' ? 'primary' : 'secondary'}- onClick={() =>- saveWorkflowPartial({- status: workflow?.status === 'draft' ? 'active' : 'draft',- })- }- size="small"- disabledReason={- hasUnsavedChanges- ? 'Save changes first'- : workflow?.status === 'draft' && workflowHasActionErrors- ? 'Fix all errors before enabling'- : undefined- }- className="transition-colors duration-300 ease-in-out"- data-attr="workflow-launch"+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={workflowUserAccessLevel ?? undefined}>- <span- className={`inline-block transition-opacity duration-300 ease-in-out ${- isTransitioning ? 'opacity-0' : 'opacity-100'- }`}+ <LemonButton+ type={displayStatus === 'active' ? 'primary' : 'secondary'}+ onClick={() =>+ saveWorkflowPartial({+ status: workflow?.status === 'draft' ? 'active' : 'draft',+ })+ }+ size="small"+ disabledReason={+ hasUnsavedChanges+ ? 'Save changes first'+ : workflow?.status === 'draft' && workflowHasActionErrors+ ? 'Fix all errors before enabling'+ : undefined+ }+ className="transition-colors duration-300 ease-in-out"+ data-attr="workflow-launch">- {displayStatus === 'draft' ? 'Enable' : 'Disable'}- </span>- </LemonButton>+ <span+ className={`inline-block transition-opacity duration-300 ease-in-out ${+ isTransitioning ? 'opacity-0' : 'opacity-100'+ }`}+ >+ {displayStatus === 'draft' ? 'Enable' : 'Disable'}+ </span>+ </LemonButton>+ </AccessControlAction><LemonDivider vertical /><ScenePanel><ScenePanelActionsSection>@@ -162,15 +181,25 @@ export const WorkflowSceneHeader = (props: WorkflowSceneLogicProps = {}): JSX.El</ScenePanelActionsSection><ScenePanelDivider /><ScenePanelActionsSection>- <ButtonPrimitive- menuItem- onClick={() => archiveWorkflow(workflow)}- variant="danger"- data-attr="workflow-archive-btn"+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={workflowUserAccessLevel ?? undefined}>- <IconArchive />- Archive- </ButtonPrimitive>+ {({ disabledReason }) => (+ <ButtonPrimitive+ menuItem+ onClick={() => archiveWorkflow(workflow)}+ variant="danger"+ data-attr="workflow-archive-btn"+ disabled={!!disabledReason}+ tooltip={disabledReason ?? undefined}+ >+ <IconArchive />+ Archive+ </ButtonPrimitive>+ )}+ </AccessControlAction></ScenePanelActionsSection></ScenePanel></>@@ -195,26 +224,34 @@ export const WorkflowSceneHeader = (props: WorkflowSceneLogicProps = {}): JSX.ElUpdate template</LemonButton>) : (- <LemonButton- data-attr="workflow-save"- type="primary"- size="small"- htmlType="submit"- form="workflow"- onClick={submitWorkflow}- loading={isWorkflowSubmitting}- disabledReason={- workflowHasErrors- ? 'Some fields still need work'- : isCreatedFromTemplate- ? undefined- : hasUnsavedChanges- ? undefined- : 'No changes to save'+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={+ props.id === 'new' ? undefined : (workflowUserAccessLevel ?? undefined)}>- {props.id === 'new' ? 'Create as draft' : 'Save'}- </LemonButton>+ <LemonButton+ data-attr="workflow-save"+ type="primary"+ size="small"+ htmlType="submit"+ form="workflow"+ onClick={submitWorkflow}+ loading={isWorkflowSubmitting}+ disabledReason={+ workflowHasErrors+ ? 'Some fields still need work'+ : isCreatedFromTemplate+ ? undefined+ : hasUnsavedChanges+ ? undefined+ : 'No changes to save'+ }+ >+ {props.id === 'new' ? 'Create as draft' : 'Save'}+ </LemonButton>+ </AccessControlAction>)}</>}diff --git a/products/workflows/frontend/Workflows/WorkflowsTable.tsx b/products/workflows/frontend/Workflows/WorkflowsTable.tsxindex 0edeea694a69..0221911139f5 100644--- a/products/workflows/frontend/Workflows/WorkflowsTable.tsx+++ b/products/workflows/frontend/Workflows/WorkflowsTable.tsx@@ -3,6 +3,7 @@ import { useMemo } from 'react'import { LemonCheckbox, LemonDivider, LemonInput, LemonSelect, LemonTag, Link, Tooltip } from '@posthog/lemon-ui'+import { AccessControlAction } from 'lib/components/AccessControlAction'import { AppMetricsSparkline } from 'lib/components/AppMetrics/AppMetricsSparkline'import { MailHog } from 'lib/components/hedgehogs'import { MemberSelect } from 'lib/components/MemberSelect'@@ -17,6 +18,8 @@ import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'import { capitalizeFirstLetter } from 'lib/utils/strings'import { urls } from 'scenes/urls'+import { AccessControlLevel, AccessControlResourceType } from '~/types'+import { getHogFlowStep } from './hogflows/steps/HogFlowSteps'import { HogFlow } from './hogflows/types'import { newWorkflowLogic } from './newWorkflowLogic'@@ -256,19 +259,25 @@ export function WorkflowsTable(): JSX.Element {overlay={<>{workflow.status !== 'archived' && (- <LemonButton- data-attr="workflow-edit"- fullWidth- status={workflow.status === 'draft' ? 'default' : 'danger'}- onClick={() => toggleWorkflowStatus(workflow)}- tooltip={- workflow.status === 'draft'- ? 'Enables the workflow to start sending messages'- : 'Disables the workflow from sending any new messages. In-progress workflows will end immediately.'- }+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={workflow.user_access_level}>- {workflow.status === 'draft' ? 'Enable' : 'Disable'}- </LemonButton>+ <LemonButton+ data-attr="workflow-edit"+ fullWidth+ status={workflow.status === 'draft' ? 'default' : 'danger'}+ onClick={() => toggleWorkflowStatus(workflow)}+ tooltip={+ workflow.status === 'draft'+ ? 'Enables the workflow to start sending messages'+ : 'Disables the workflow from sending any new messages. In-progress workflows will end immediately.'+ }+ >+ {workflow.status === 'draft' ? 'Enable' : 'Disable'}+ </LemonButton>+ </AccessControlAction>)}<LemonButtondata-attr="workflow-duplicate"@@ -278,27 +287,39 @@ export function WorkflowsTable(): JSX.Element {Duplicate</LemonButton><LemonDivider />- <LemonButton- data-attr="workflow-archive-restore"- fullWidth- status={workflow.status === 'archived' ? 'default' : 'danger'}- onClick={() => {- workflow.status === 'archived'- ? restoreWorkflow(workflow)- : archiveWorkflow(workflow)- }}+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={workflow.user_access_level}>- {workflow.status === 'archived' ? 'Restore' : 'Archive'}- </LemonButton>- {workflow.status === 'archived' && (<LemonButton- data-attr="workflow-delete"+ data-attr="workflow-archive-restore"fullWidth- status="danger"- onClick={() => deleteWorkflow(workflow)}+ status={workflow.status === 'archived' ? 'default' : 'danger'}+ onClick={() => {+ workflow.status === 'archived'+ ? restoreWorkflow(workflow)+ : archiveWorkflow(workflow)+ }}>- Delete+ {workflow.status === 'archived' ? 'Restore' : 'Archive'}</LemonButton>+ </AccessControlAction>+ {workflow.status === 'archived' && (+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}+ userAccessLevel={workflow.user_access_level}+ >+ <LemonButton+ data-attr="workflow-delete"+ fullWidth+ status="danger"+ onClick={() => deleteWorkflow(workflow)}+ >+ Delete+ </LemonButton>+ </AccessControlAction>)}</>}diff --git a/products/workflows/frontend/Workflows/hogflows/types.ts b/products/workflows/frontend/Workflows/hogflows/types.tsindex a6f315e5ab29..392fefddb18d 100644--- a/products/workflows/frontend/Workflows/hogflows/types.ts+++ b/products/workflows/frontend/Workflows/hogflows/types.ts@@ -3,7 +3,7 @@ import z from 'zod'import { CyclotronJobInputsValidationResult } from 'lib/components/CyclotronJob/CyclotronJobInputsValidation'-import { UserBasicType } from '~/types'+import { AccessControlLevel, UserBasicType } from '~/types'import { CyclotronJobInputSchemaTypeSchema, HogFlowActionSchema, HogFlowTriggerSchema } from './steps/types'@@ -80,6 +80,8 @@ export const HogFlowBatchJobSchema = z.object({// NOTE: these are purposefully exported as interfaces to support kea typegenexport interface HogFlow extends z.infer<typeof HogFlowSchema> {created_by?: UserBasicType | null+ // Effective access level of the current user for this workflow (resource access control).+ user_access_level?: AccessControlLevel}export interface HogFlowEdge extends z.infer<typeof HogFlowEdgeSchema> {}export interface HogFlowActionEdge extends Edge<{ edge: HogFlowEdge; label?: string }> {}diff --git a/products/workflows/frontend/Workflows/workflowLogic.ts b/products/workflows/frontend/Workflows/workflowLogic.tsindex 81914160f963..7f9f5b18b9c9 100644--- a/products/workflows/frontend/Workflows/workflowLogic.ts+++ b/products/workflows/frontend/Workflows/workflowLogic.ts@@ -20,7 +20,7 @@ import { projectLogic } from 'scenes/projectLogic'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'-import { HogFunctionTemplateType } from '~/types'+import { AccessControlLevel, HogFunctionTemplateType } from '~/types'import { resourceEditedLogic } from 'products/notifications/frontend/resourceEditedLogic'@@ -427,6 +427,10 @@ export const workflowLogic = kea<workflowLogicType>([}),selectors({logicProps: [() => [(_, props: WorkflowLogicProps) => props], (props): WorkflowLogicProps => props],+ workflowUserAccessLevel: [+ (s) => [s.originalWorkflow],+ (originalWorkflow): AccessControlLevel | null => originalWorkflow?.user_access_level ?? null,+ ],currentSchedule: [(s) => [s.schedules], (schedules): HogFlowSchedule | null => schedules[0] ?? null],pendingSchedule: [(s) => [s.currentSchedule, s.scheduleState, s.scheduleStartsAt, s.scheduleTimezone, s.isScheduleRepeating],diff --git a/products/workflows/frontend/Workflows/workflowSceneLogic.test.ts b/products/workflows/frontend/Workflows/workflowSceneLogic.test.tsnew file mode 100644index 000000000000..02f2db3e3e83--- /dev/null+++ b/products/workflows/frontend/Workflows/workflowSceneLogic.test.ts@@ -0,0 +1,31 @@+import { initKeaTests } from '~/test/init'+import { ActivityScope } from '~/types'++import { workflowSceneLogic } from './workflowSceneLogic'++describe('workflowSceneLogic', () => {+ beforeEach(() => {+ initKeaTests()+ })++ // Guards the side panel wiring: the access control (and activity) tab only appears when the scene logic+ // — the one sidePanelContextLogic reads SIDE_PANEL_CONTEXT_KEY from — exposes the hog_flow resource.+ it('exposes the hog_flow access control context for a saved workflow', () => {+ const logic = workflowSceneLogic({ id: '0190abcd-1234-7000-8000-000000000000' })+ logic.mount()++ expect(logic.values.sidePanelContext).toEqual({+ activity_scope: ActivityScope.HOG_FLOW,+ activity_item_id: '0190abcd-1234-7000-8000-000000000000',+ access_control_resource: 'hog_flow',+ access_control_resource_id: '0190abcd-1234-7000-8000-000000000000',+ })+ })++ it('exposes no access control context for an unsaved workflow', () => {+ const logic = workflowSceneLogic({ id: 'new' })+ logic.mount()++ expect(logic.values.sidePanelContext).toBeNull()+ })+})diff --git a/products/workflows/frontend/Workflows/workflowSceneLogic.ts b/products/workflows/frontend/Workflows/workflowSceneLogic.tsindex 0c50afe62e2c..117be2173611 100644--- a/products/workflows/frontend/Workflows/workflowSceneLogic.ts+++ b/products/workflows/frontend/Workflows/workflowSceneLogic.ts@@ -4,7 +4,8 @@ import { urlToAction } from 'kea-router'import { Scene } from 'scenes/sceneTypes'import { urls } from 'scenes/urls'-import { Breadcrumb } from '~/types'+import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'+import { ActivityScope, Breadcrumb } from '~/types'import type { workflowSceneLogicType } from './workflowSceneLogicType'@@ -50,6 +51,21 @@ export const workflowSceneLogic = kea<workflowSceneLogicType>([]},],+ // Drives the side panel: surfaces the Access control (and Activity) tab for a saved workflow.+ // Must live on the scene logic — sidePanelContextLogic reads SIDE_PANEL_CONTEXT_KEY off the+ // scene's registered logic, not workflowLogic.+ [SIDE_PANEL_CONTEXT_KEY]: [+ () => [(_, props) => props.id as WorkflowSceneLogicProps['id']],+ (id): SidePanelSceneContext | null =>+ id && id !== 'new'+ ? {+ activity_scope: ActivityScope.HOG_FLOW,+ activity_item_id: id,+ access_control_resource: 'hog_flow',+ access_control_resource_id: id,+ }+ : null,+ ],}),urlToAction(({ actions, values }) => ({'/workflows/:id/:tab': ({ tab }) => {diff --git a/products/workflows/frontend/WorkflowsScene.tsx b/products/workflows/frontend/WorkflowsScene.tsxindex 07735016af68..42266842c29e 100644--- a/products/workflows/frontend/WorkflowsScene.tsx+++ b/products/workflows/frontend/WorkflowsScene.tsx@@ -5,6 +5,7 @@ import { IconLetter, IconPlusSmall } from '@posthog/icons'import { LemonButton, LemonMenu, LemonMenuItems } from '@posthog/lemon-ui'import api from 'lib/api'+import { AccessControlAction } from 'lib/components/AccessControlAction'import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'import { TeamMembershipLevel } from 'lib/constants'import { integrationsLogic } from 'lib/integrations/integrationsLogic'@@ -20,7 +21,7 @@ import { urls } from 'scenes/urls'import { SceneContent } from '~/layout/scenes/components/SceneContent'import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'-import { Breadcrumb } from '~/types'+import { AccessControlLevel, AccessControlResourceType, Breadcrumb } from '~/types'import { MessageChannels } from './Channels/MessageChannels'import { optOutCategoriesLogic } from './OptOuts/optOutCategoriesLogic'@@ -180,30 +181,40 @@ export function WorkflowsScene(props: WorkflowsSceneProps = {}): JSX.Element {actions={<>{currentTab === 'workflows' && (- <LemonButton- data-attr="new-workflow"- onClick={() => {- void addProductIntent({- product_type: ProductKey.WORKFLOWS,- intent_context: ProductIntentContext.WORKFLOW_CREATED,- })- showNewWorkflowModal()- }}- type="primary"- size="small"+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}>- New workflow- </LemonButton>+ <LemonButton+ data-attr="new-workflow"+ onClick={() => {+ void addProductIntent({+ product_type: ProductKey.WORKFLOWS,+ intent_context: ProductIntentContext.WORKFLOW_CREATED,+ })+ showNewWorkflowModal()+ }}+ type="primary"+ size="small"+ >+ New workflow+ </LemonButton>+ </AccessControlAction>)}{currentTab === 'library' && (- <LemonButton- data-attr="new-message-button"- to={urls.workflowsLibraryTemplateNew()}- type="primary"- size="small"+ <AccessControlAction+ resourceType={AccessControlResourceType.Workflow}+ minAccessLevel={AccessControlLevel.Editor}>- New template- </LemonButton>+ <LemonButton+ data-attr="new-message-button"+ to={urls.workflowsLibraryTemplateNew()}+ type="primary"+ size="small"+ >+ New template+ </LemonButton>+ </AccessControlAction>)}{currentTab === 'channels' && (<LemonMenu items={newChannelMenuItems} matchWidth>diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.tsindex 215b46d8ff4e..d1cd7e4769ee 100644--- a/products/workflows/frontend/generated/api.schemas.ts+++ b/products/workflows/frontend/generated/api.schemas.ts@@ -287,6 +287,9 @@ export interface UserBasicApi {role_at_organization?: RoleAtOrganizationEnumApi | BlankEnumApi | null}+/**+ * Mixin for serializers to add user access control fields+ */export interface HogFlowMinimalApi {readonly id: string/** @nullable */@@ -307,6 +310,11 @@ export interface HogFlowMinimalApi {readonly abort_action: string | nullreadonly variables: unknownreadonly billable_action_types: unknown+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level: string | null}export interface PaginatedHogFlowMinimalListApi {@@ -467,6 +475,9 @@ export interface HogFlowScheduleApi {readonly updated_at: string}+/**+ * Mixin for serializers to add user access control fields+ */export interface HogFlowApi {readonly id: string/**@@ -510,6 +521,11 @@ export interface HogFlowApi {readonly billable_action_types: unknown/** Recurring schedules attached to this workflow (read-only here; manage via the schedules sub-resource). A batch/schedule workflow only fires when it's active AND has an active schedule. Empty for non-scheduled workflows. */readonly schedules: readonly HogFlowScheduleApi[]+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level: string | null}/**@@ -517,6 +533,9 @@ export interface HogFlowApi {*/export type PatchedHogFlowApiVariablesItem = { [key: string]: string }+/**+ * Mixin for serializers to add user access control fields+ */export interface PatchedHogFlowApi {readonly id?: string/**@@ -560,6 +579,11 @@ export interface PatchedHogFlowApi {readonly billable_action_types?: unknown/** Recurring schedules attached to this workflow (read-only here; manage via the schedules sub-resource). A batch/schedule workflow only fires when it's active AND has an active schedule. Empty for non-scheduled workflows. */readonly schedules?: readonly HogFlowScheduleApi[]+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level?: string | null}export interface MessageAssetApi {diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.tsindex 58b26864bd5e..8f24a9bd4149 100644--- a/products/workflows/frontend/generated/api.zod.ts+++ b/products/workflows/frontend/generated/api.zod.ts@@ -398,238 +398,196 @@ export const hogFlowsCreateBodyActionsItemTypeMax = 100export const hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault = `events`export const hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault = `events`-export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(hogFlowsCreateBodyNameMax).nullish().describe('Workflow name.'),- description: zod.string().default(hogFlowsCreateBodyDescriptionDefault).describe('Optional description.'),- status: zod- .enum(['draft', 'active', 'archived'])- .describe('\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived')- .optional()- .describe(- 'draft (no execution), active (live), archived (disabled).\n\n\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived'- ),- trigger_masking: zod- .union([- zod.object({- ttl: zod- .number()- .min(hogFlowsCreateBodyTriggerMaskingOneTtlMin)- .max(hogFlowsCreateBodyTriggerMaskingOneTtlMax)- .nullish()- .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),- threshold: zod- .number()- .nullish()- .describe(- 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'- ),- hash: zod- .string()- .describe(- "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."- ),- bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),- }),- zod.null(),- ])- .optional()- .describe(- "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."- ),- conversion: zod- .union([- zod.object({- filters: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional()- .describe(- "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."- ),- events: zod- .array(- zod.object({- filters: zod- .object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- })- .describe(- "Event\/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."- ),- })- )- .optional()- .describe(- "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."- ),- window_minutes: zod- .number()- .nullish()- .describe(- 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'- ),- bytecode: zod- .unknown()- .optional()- .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),- }),- zod.null(),- ])- .optional()- .describe(- 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'- ),- exit_condition: zod- .enum([- 'exit_on_conversion',- 'exit_on_trigger_not_matched',- 'exit_on_trigger_not_matched_or_conversion',- 'exit_only_at_end',- ])- .describe(- '\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End'- )- .optional()- .describe(- "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End"- ),- edges: zod- .array(- zod.object({- to: zod.string().describe('Target action id.'),- type: zod- .enum(['continue', 'branch'])- .describe('\* `continue` - continue\n\* `branch` - branch')- .describe(- "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n\* `continue` - continue\n\* `branch` - branch"- ),- index: zod- .number()- .optional()- .describe(- "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."- ),- from: zod.string().describe('Source action id.'),- })- )- .optional()- .describe(- "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch \/ wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."- ),- actions: zod- .array(- zod.object({- id: zod.string().describe('Unique node ID within the workflow.'),- name: zod.string().max(hogFlowsCreateBodyActionsItemNameMax).describe('Display name.'),- description: zod- .string()- .default(hogFlowsCreateBodyActionsItemDescriptionDefault)- .describe('Optional description.'),- on_error: zod- .union([- zod.enum(['continue', 'abort']).describe('\* `continue` - continue\n\* `abort` - abort'),- zod.null(),- ])- .optional()- .describe(- 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n\* `continue` - continue\n\* `abort` - abort'- ),- created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),- updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsCreateBodyActionsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()- .describe('Property filters gating this action.'),- type: zod- .string()- .max(hogFlowsCreateBodyActionsItemTypeMax)- .describe(- 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'- ),- config: zod- .union([- zod- .record(zod.string(), zod.unknown())- .describe(- 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'- ),- zod- .object({- condition: zod+export const HogFlowsCreateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(hogFlowsCreateBodyNameMax).nullish().describe('Workflow name.'),+ description: zod.string().default(hogFlowsCreateBodyDescriptionDefault).describe('Optional description.'),+ status: zod+ .enum(['draft', 'active', 'archived'])+ .describe('\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived')+ .optional()+ .describe(+ 'draft (no execution), active (live), archived (disabled).\n\n\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived'+ ),+ trigger_masking: zod+ .union([+ zod.object({+ ttl: zod+ .number()+ .min(hogFlowsCreateBodyTriggerMaskingOneTtlMin)+ .max(hogFlowsCreateBodyTriggerMaskingOneTtlMax)+ .nullish()+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),+ bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."+ ),+ conversion: zod+ .union([+ zod.object({+ filters: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional()+ .describe(+ "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod.object({- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault- ),- actions: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- events: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- data_warehouse: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- properties: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table']).describe(- 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'- ),- name: zod.string().optional().describe('Optional display name.'),+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),})- .optional().describe(- "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ "Event\/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."),- events: zod- .array(- zod.object({+ })+ )+ .optional()+ .describe(+ "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."+ ),+ window_minutes: zod+ .number()+ .nullish()+ .describe(+ 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'+ ),+ bytecode: zod+ .unknown()+ .optional()+ .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'+ ),+ exit_condition: zod+ .enum([+ 'exit_on_conversion',+ 'exit_on_trigger_not_matched',+ 'exit_on_trigger_not_matched_or_conversion',+ 'exit_only_at_end',+ ])+ .describe(+ '\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End'+ )+ .optional()+ .describe(+ "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End"+ ),+ edges: zod+ .array(+ zod.object({+ to: zod.string().describe('Target action id.'),+ type: zod+ .enum(['continue', 'branch'])+ .describe('\* `continue` - continue\n\* `branch` - branch')+ .describe(+ "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n\* `continue` - continue\n\* `branch` - branch"+ ),+ index: zod+ .number()+ .optional()+ .describe(+ "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."+ ),+ from: zod.string().describe('Source action id.'),+ })+ )+ .optional()+ .describe(+ "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch \/ wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."+ ),+ actions: zod+ .array(+ zod.object({+ id: zod.string().describe('Unique node ID within the workflow.'),+ name: zod.string().max(hogFlowsCreateBodyActionsItemNameMax).describe('Display name.'),+ description: zod+ .string()+ .default(hogFlowsCreateBodyActionsItemDescriptionDefault)+ .describe('Optional description.'),+ on_error: zod+ .union([+ zod.enum(['continue', 'abort']).describe('\* `continue` - continue\n\* `abort` - abort'),+ zod.null(),+ ])+ .optional()+ .describe(+ 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n\* `continue` - continue\n\* `abort` - abort'+ ),+ created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),+ updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table'])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsCreateBodyActionsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe('Property filters gating this action.'),+ type: zod+ .string()+ .max(hogFlowsCreateBodyActionsItemTypeMax)+ .describe(+ 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'+ ),+ config: zod+ .union([+ zod+ .record(zod.string(), zod.unknown())+ .describe(+ 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'+ ),+ zod+ .object({+ condition: zod+ .object({filters: zod.union([zod.object({@@ -639,7 +597,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({'\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table').default(- hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown()))@@ -662,40 +620,92 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({]).optional().describe(- 'Event\/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'),name: zod.string().optional().describe('Optional display name.'),})- )- .optional()- .describe(- "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."- ),- max_wait_duration: zod- .string()- .describe("'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."),- })- .describe(- "Config for type='wait_until_condition'. Provide 'condition' and\/or 'events' — an events-only wait (no condition) is valid."- ),- ])- .describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."- ),- output_variable: zod- .unknown()- .optional()- .describe('Output variable definition for downstream actions.'),- })- )- .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),- variables: zod- .array(- zod.record(zod.string(), zod.string()).describe('Variable: {key, type: string|number|boolean, default}.')- )- .optional()- .describe('Workflow vars (key, type, default). Total <5KB.'),-})+ .optional()+ .describe(+ "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ ])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ ),+ actions: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ events: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ data_warehouse: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ properties: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Event\/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ ),+ name: zod.string().optional().describe('Optional display name.'),+ })+ )+ .optional()+ .describe(+ "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."+ ),+ max_wait_duration: zod+ .string()+ .describe(+ "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."+ ),+ })+ .describe(+ "Config for type='wait_until_condition'. Provide 'condition' and\/or 'events' — an events-only wait (no condition) is valid."+ ),+ ])+ .describe(+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ ),+ output_variable: zod+ .unknown()+ .optional()+ .describe('Output variable definition for downstream actions.'),+ })+ )+ .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),+ variables: zod+ .array(+ zod+ .record(zod.string(), zod.string())+ .describe('Variable: {key, type: string|number|boolean, default}.')+ )+ .optional()+ .describe('Workflow vars (key, type, default). Total <5KB.'),+ })+ .describe('Mixin for serializers to add user access control fields')export const hogFlowsUpdateBodyNameMax = 400@@ -713,238 +723,196 @@ export const hogFlowsUpdateBodyActionsItemTypeMax = 100export const hogFlowsUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault = `events`export const hogFlowsUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault = `events`-export const HogFlowsUpdateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(hogFlowsUpdateBodyNameMax).nullish().describe('Workflow name.'),- description: zod.string().default(hogFlowsUpdateBodyDescriptionDefault).describe('Optional description.'),- status: zod- .enum(['draft', 'active', 'archived'])- .describe('\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived')- .optional()- .describe(- 'draft (no execution), active (live), archived (disabled).\n\n\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived'- ),- trigger_masking: zod- .union([- zod.object({- ttl: zod- .number()- .min(hogFlowsUpdateBodyTriggerMaskingOneTtlMin)- .max(hogFlowsUpdateBodyTriggerMaskingOneTtlMax)- .nullish()- .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),- threshold: zod- .number()- .nullish()- .describe(- 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'- ),- hash: zod- .string()- .describe(- "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."- ),- bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),- }),- zod.null(),- ])- .optional()- .describe(- "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."- ),- conversion: zod- .union([- zod.object({- filters: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional()- .describe(- "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."- ),- events: zod- .array(- zod.object({- filters: zod- .object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsUpdateBodyConversionOneEventsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- })- .describe(- "Event\/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."- ),- })- )- .optional()- .describe(- "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."- ),- window_minutes: zod- .number()- .nullish()- .describe(- 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'- ),- bytecode: zod- .unknown()- .optional()- .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),- }),- zod.null(),- ])- .optional()- .describe(- 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'- ),- exit_condition: zod- .enum([- 'exit_on_conversion',- 'exit_on_trigger_not_matched',- 'exit_on_trigger_not_matched_or_conversion',- 'exit_only_at_end',- ])- .describe(- '\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End'- )- .optional()- .describe(- "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End"- ),- edges: zod- .array(- zod.object({- to: zod.string().describe('Target action id.'),- type: zod- .enum(['continue', 'branch'])- .describe('\* `continue` - continue\n\* `branch` - branch')- .describe(- "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n\* `continue` - continue\n\* `branch` - branch"- ),- index: zod- .number()- .optional()- .describe(- "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."- ),- from: zod.string().describe('Source action id.'),- })- )- .optional()- .describe(- "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch \/ wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."- ),- actions: zod- .array(- zod.object({- id: zod.string().describe('Unique node ID within the workflow.'),- name: zod.string().max(hogFlowsUpdateBodyActionsItemNameMax).describe('Display name.'),- description: zod- .string()- .default(hogFlowsUpdateBodyActionsItemDescriptionDefault)- .describe('Optional description.'),- on_error: zod- .union([- zod.enum(['continue', 'abort']).describe('\* `continue` - continue\n\* `abort` - abort'),- zod.null(),- ])- .optional()- .describe(- 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n\* `continue` - continue\n\* `abort` - abort'- ),- created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),- updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsUpdateBodyActionsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()- .describe('Property filters gating this action.'),- type: zod- .string()- .max(hogFlowsUpdateBodyActionsItemTypeMax)- .describe(- 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'- ),- config: zod- .union([- zod- .record(zod.string(), zod.unknown())- .describe(- 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'- ),- zod- .object({- condition: zod+export const HogFlowsUpdateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(hogFlowsUpdateBodyNameMax).nullish().describe('Workflow name.'),+ description: zod.string().default(hogFlowsUpdateBodyDescriptionDefault).describe('Optional description.'),+ status: zod+ .enum(['draft', 'active', 'archived'])+ .describe('\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived')+ .optional()+ .describe(+ 'draft (no execution), active (live), archived (disabled).\n\n\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived'+ ),+ trigger_masking: zod+ .union([+ zod.object({+ ttl: zod+ .number()+ .min(hogFlowsUpdateBodyTriggerMaskingOneTtlMin)+ .max(hogFlowsUpdateBodyTriggerMaskingOneTtlMax)+ .nullish()+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),+ bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."+ ),+ conversion: zod+ .union([+ zod.object({+ filters: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional()+ .describe(+ "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod.object({- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault- ),- actions: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- events: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- data_warehouse: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- properties: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table']).describe(- 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'- ),- name: zod.string().optional().describe('Optional display name.'),+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsUpdateBodyConversionOneEventsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),})- .optional().describe(- "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ "Event\/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."),- events: zod- .array(- zod.object({+ })+ )+ .optional()+ .describe(+ "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."+ ),+ window_minutes: zod+ .number()+ .nullish()+ .describe(+ 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'+ ),+ bytecode: zod+ .unknown()+ .optional()+ .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'+ ),+ exit_condition: zod+ .enum([+ 'exit_on_conversion',+ 'exit_on_trigger_not_matched',+ 'exit_on_trigger_not_matched_or_conversion',+ 'exit_only_at_end',+ ])+ .describe(+ '\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End'+ )+ .optional()+ .describe(+ "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End"+ ),+ edges: zod+ .array(+ zod.object({+ to: zod.string().describe('Target action id.'),+ type: zod+ .enum(['continue', 'branch'])+ .describe('\* `continue` - continue\n\* `branch` - branch')+ .describe(+ "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n\* `continue` - continue\n\* `branch` - branch"+ ),+ index: zod+ .number()+ .optional()+ .describe(+ "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."+ ),+ from: zod.string().describe('Source action id.'),+ })+ )+ .optional()+ .describe(+ "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch \/ wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."+ ),+ actions: zod+ .array(+ zod.object({+ id: zod.string().describe('Unique node ID within the workflow.'),+ name: zod.string().max(hogFlowsUpdateBodyActionsItemNameMax).describe('Display name.'),+ description: zod+ .string()+ .default(hogFlowsUpdateBodyActionsItemDescriptionDefault)+ .describe('Optional description.'),+ on_error: zod+ .union([+ zod.enum(['continue', 'abort']).describe('\* `continue` - continue\n\* `abort` - abort'),+ zod.null(),+ ])+ .optional()+ .describe(+ 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n\* `continue` - continue\n\* `abort` - abort'+ ),+ created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),+ updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table'])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsUpdateBodyActionsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe('Property filters gating this action.'),+ type: zod+ .string()+ .max(hogFlowsUpdateBodyActionsItemTypeMax)+ .describe(+ 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'+ ),+ config: zod+ .union([+ zod+ .record(zod.string(), zod.unknown())+ .describe(+ 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'+ ),+ zod+ .object({+ condition: zod+ .object({filters: zod.union([zod.object({@@ -954,7 +922,7 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod.object({'\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table').default(- hogFlowsUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ hogFlowsUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown()))@@ -977,40 +945,92 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod.object({]).optional().describe(- 'Event\/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'),name: zod.string().optional().describe('Optional display name.'),})- )- .optional()- .describe(- "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."- ),- max_wait_duration: zod- .string()- .describe("'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."),- })- .describe(- "Config for type='wait_until_condition'. Provide 'condition' and\/or 'events' — an events-only wait (no condition) is valid."- ),- ])- .describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."- ),- output_variable: zod- .unknown()- .optional()- .describe('Output variable definition for downstream actions.'),- })- )- .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),- variables: zod- .array(- zod.record(zod.string(), zod.string()).describe('Variable: {key, type: string|number|boolean, default}.')- )- .optional()- .describe('Workflow vars (key, type, default). Total <5KB.'),-})+ .optional()+ .describe(+ "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ ])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ ),+ actions: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ events: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ data_warehouse: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ properties: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Event\/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ ),+ name: zod.string().optional().describe('Optional display name.'),+ })+ )+ .optional()+ .describe(+ "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."+ ),+ max_wait_duration: zod+ .string()+ .describe(+ "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."+ ),+ })+ .describe(+ "Config for type='wait_until_condition'. Provide 'condition' and\/or 'events' — an events-only wait (no condition) is valid."+ ),+ ])+ .describe(+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ ),+ output_variable: zod+ .unknown()+ .optional()+ .describe('Output variable definition for downstream actions.'),+ })+ )+ .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),+ variables: zod+ .array(+ zod+ .record(zod.string(), zod.string())+ .describe('Variable: {key, type: string|number|boolean, default}.')+ )+ .optional()+ .describe('Workflow vars (key, type, default). Total <5KB.'),+ })+ .describe('Mixin for serializers to add user access control fields')export const hogFlowsPartialUpdateBodyNameMax = 400@@ -1028,240 +1048,201 @@ export const hogFlowsPartialUpdateBodyActionsItemTypeMax = 100export const hogFlowsPartialUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault = `events`export const hogFlowsPartialUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault = `events`-export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(hogFlowsPartialUpdateBodyNameMax).nullish().describe('Workflow name.'),- description: zod.string().default(hogFlowsPartialUpdateBodyDescriptionDefault).describe('Optional description.'),- status: zod- .enum(['draft', 'active', 'archived'])- .describe('\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived')- .optional()- .describe(- 'draft (no execution), active (live), archived (disabled).\n\n\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived'- ),- trigger_masking: zod- .union([- zod.object({- ttl: zod- .number()- .min(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMin)- .max(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMax)- .nullish()- .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),- threshold: zod- .number()- .nullish()- .describe(- 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'- ),- hash: zod- .string()- .describe(- "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."- ),- bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),- }),- zod.null(),- ])- .optional()- .describe(- "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."- ),- conversion: zod- .union([- zod.object({- filters: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional()- .describe(- "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."- ),- events: zod- .array(- zod.object({- filters: zod- .object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault- ),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- })+export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(hogFlowsPartialUpdateBodyNameMax).nullish().describe('Workflow name.'),+ description: zod+ .string()+ .default(hogFlowsPartialUpdateBodyDescriptionDefault)+ .describe('Optional description.'),+ status: zod+ .enum(['draft', 'active', 'archived'])+ .describe('\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived')+ .optional()+ .describe(+ 'draft (no execution), active (live), archived (disabled).\n\n\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived'+ ),+ trigger_masking: zod+ .union([+ zod.object({+ ttl: zod+ .number()+ .min(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMin)+ .max(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMax)+ .nullish()+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),+ bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."+ ),+ conversion: zod+ .union([+ zod.object({+ filters: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional()+ .describe(+ "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod+ .object({+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table'])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault+ ),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ })+ .describe(+ "Event\/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."+ ),+ })+ )+ .optional()+ .describe(+ "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."+ ),+ window_minutes: zod+ .number()+ .nullish()+ .describe(+ 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'+ ),+ bytecode: zod+ .unknown()+ .optional()+ .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'+ ),+ exit_condition: zod+ .enum([+ 'exit_on_conversion',+ 'exit_on_trigger_not_matched',+ 'exit_on_trigger_not_matched_or_conversion',+ 'exit_only_at_end',+ ])+ .describe(+ '\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End'+ )+ .optional()+ .describe(+ "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End"+ ),+ edges: zod+ .array(+ zod.object({+ to: zod.string().describe('Target action id.'),+ type: zod+ .enum(['continue', 'branch'])+ .describe('\* `continue` - continue\n\* `branch` - branch')+ .describe(+ "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n\* `continue` - continue\n\* `branch` - branch"+ ),+ index: zod+ .number()+ .optional()+ .describe(+ "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."+ ),+ from: zod.string().describe('Source action id.'),+ })+ )+ .optional()+ .describe(+ "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch \/ wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."+ ),+ actions: zod+ .array(+ zod.object({+ id: zod.string().describe('Unique node ID within the workflow.'),+ name: zod.string().max(hogFlowsPartialUpdateBodyActionsItemNameMax).describe('Display name.'),+ description: zod+ .string()+ .default(hogFlowsPartialUpdateBodyActionsItemDescriptionDefault)+ .describe('Optional description.'),+ on_error: zod+ .union([+ zod.enum(['continue', 'abort']).describe('\* `continue` - continue\n\* `abort` - abort'),+ zod.null(),+ ])+ .optional()+ .describe(+ 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n\* `continue` - continue\n\* `abort` - abort'+ ),+ created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),+ updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table'])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsPartialUpdateBodyActionsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe('Property filters gating this action.'),+ type: zod+ .string()+ .max(hogFlowsPartialUpdateBodyActionsItemTypeMax)+ .describe(+ 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'+ ),+ config: zod+ .union([+ zod+ .record(zod.string(), zod.unknown()).describe(- "Event\/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."+ 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'),- })- )- .optional()- .describe(- "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."- ),- window_minutes: zod- .number()- .nullish()- .describe(- 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'- ),- bytecode: zod- .unknown()- .optional()- .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),- }),- zod.null(),- ])- .optional()- .describe(- 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'- ),- exit_condition: zod- .enum([- 'exit_on_conversion',- 'exit_on_trigger_not_matched',- 'exit_on_trigger_not_matched_or_conversion',- 'exit_only_at_end',- ])- .describe(- '\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End'- )- .optional()- .describe(- "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End"- ),- edges: zod- .array(- zod.object({- to: zod.string().describe('Target action id.'),- type: zod- .enum(['continue', 'branch'])- .describe('\* `continue` - continue\n\* `branch` - branch')- .describe(- "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n\* `continue` - continue\n\* `branch` - branch"- ),- index: zod- .number()- .optional()- .describe(- "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."- ),- from: zod.string().describe('Source action id.'),- })- )- .optional()- .describe(- "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch \/ wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."- ),- actions: zod- .array(- zod.object({- id: zod.string().describe('Unique node ID within the workflow.'),- name: zod.string().max(hogFlowsPartialUpdateBodyActionsItemNameMax).describe('Display name.'),- description: zod- .string()- .default(hogFlowsPartialUpdateBodyActionsItemDescriptionDefault)- .describe('Optional description.'),- on_error: zod- .union([- zod.enum(['continue', 'abort']).describe('\* `continue` - continue\n\* `abort` - abort'),- zod.null(),- ])- .optional()- .describe(- 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n\* `continue` - continue\n\* `abort` - abort'- ),- created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),- updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsPartialUpdateBodyActionsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()- .describe('Property filters gating this action.'),- type: zod- .string()- .max(hogFlowsPartialUpdateBodyActionsItemTypeMax)- .describe(- 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'- ),- config: zod- .union([- zod- .record(zod.string(), zod.unknown())- .describe(- 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'- ),- zod- .object({- condition: zod- .object({- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsPartialUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault- ),- actions: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- events: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- data_warehouse: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- properties: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()- .describe(- 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'- ),- name: zod.string().optional().describe('Optional display name.'),- })- .optional()- .describe(- "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."- ),- events: zod- .array(- zod.object({+ zod+ .object({+ condition: zod+ .object({filters: zod.union([zod.object({@@ -1271,7 +1252,7 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({'\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table').default(- hogFlowsPartialUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ hogFlowsPartialUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown()))@@ -1294,41 +1275,93 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({]).optional().describe(- 'Event\/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'),name: zod.string().optional().describe('Optional display name.'),})- )- .optional()- .describe(- "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."- ),- max_wait_duration: zod- .string()- .describe("'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."),- })- .describe(- "Config for type='wait_until_condition'. Provide 'condition' and\/or 'events' — an events-only wait (no condition) is valid."- ),- ])- .describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."- ),- output_variable: zod- .unknown()- .optional()- .describe('Output variable definition for downstream actions.'),- })- )- .optional()- .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),- variables: zod- .array(- zod.record(zod.string(), zod.string()).describe('Variable: {key, type: string|number|boolean, default}.')- )- .optional()- .describe('Workflow vars (key, type, default). Total <5KB.'),-})+ .optional()+ .describe(+ "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ ])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsPartialUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ ),+ actions: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ events: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ data_warehouse: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ properties: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Event\/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ ),+ name: zod.string().optional().describe('Optional display name.'),+ })+ )+ .optional()+ .describe(+ "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."+ ),+ max_wait_duration: zod+ .string()+ .describe(+ "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."+ ),+ })+ .describe(+ "Config for type='wait_until_condition'. Provide 'condition' and\/or 'events' — an events-only wait (no condition) is valid."+ ),+ ])+ .describe(+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ ),+ output_variable: zod+ .unknown()+ .optional()+ .describe('Output variable definition for downstream actions.'),+ })+ )+ .optional()+ .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),+ variables: zod+ .array(+ zod+ .record(zod.string(), zod.string())+ .describe('Variable: {key, type: string|number|boolean, default}.')+ )+ .optional()+ .describe('Workflow vars (key, type, default). Total <5KB.'),+ })+ .describe('Mixin for serializers to add user access control fields')export const HogFlowsBatchJobsCreateBody = /* @__PURE__ */ zod.object({status: zod@@ -1873,7 +1906,12 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({.describe("Recurring schedules attached to this workflow (read-only here; manage via the schedules sub-resource). A batch\/schedule workflow only fires when it's active AND has an active schedule. Empty for non-scheduled workflows."),+ user_access_level: zod+ .string()+ .nullable()+ .describe('The effective access level the user has for this object'),})+ .describe('Mixin for serializers to add user access control fields').optional().describe('Optional override; omit to use saved definition.'),globals: zod@@ -1984,273 +2022,234 @@ export const hogFlowsSchedulesPartialUpdateBodyTimezoneMax = 64export const HogFlowsSchedulesPartialUpdateBody = /* @__PURE__ */ zod.object({rrule: zod- .string()- .optional()- .describe(- "iCalendar RRULE string (e.g. 'FREQ=DAILY;INTERVAL=1'). Must produce occurrences at most once per hour."- ),- starts_at: zod.iso.datetime({ offset: true }).optional().describe('ISO 8601 datetime the schedule starts from.'),- timezone: zod- .string()- .max(hogFlowsSchedulesPartialUpdateBodyTimezoneMax)- .optional()- .describe("IANA timezone for interpreting the RRULE (default 'UTC')."),- variables: zod- .unknown()- .optional()- .describe('Variable value overrides merged with the workflow defaults on each run.'),-})--export const hogFlowsBulkDeleteCreateBodyNameMax = 400--export const hogFlowsBulkDeleteCreateBodyDescriptionDefault = ``-export const hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMin = 60-export const hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMax = 94608000--export const hogFlowsBulkDeleteCreateBodyConversionOneEventsItemFiltersOneSourceDefault = `events`-export const hogFlowsBulkDeleteCreateBodyActionsItemNameMax = 400--export const hogFlowsBulkDeleteCreateBodyActionsItemDescriptionDefault = ``-export const hogFlowsBulkDeleteCreateBodyActionsItemFiltersOneSourceDefault = `events`-export const hogFlowsBulkDeleteCreateBodyActionsItemTypeMax = 100--export const hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault = `events`-export const hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault = `events`--export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(hogFlowsBulkDeleteCreateBodyNameMax).nullish().describe('Workflow name.'),- description: zod.string().default(hogFlowsBulkDeleteCreateBodyDescriptionDefault).describe('Optional description.'),- status: zod- .enum(['draft', 'active', 'archived'])- .describe('\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived')- .optional()- .describe(- 'draft (no execution), active (live), archived (disabled).\n\n\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived'- ),- trigger_masking: zod- .union([- zod.object({- ttl: zod- .number()- .min(hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMin)- .max(hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMax)- .nullish()- .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),- threshold: zod- .number()- .nullish()- .describe(- 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'- ),- hash: zod- .string()- .describe(- "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."- ),- bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),- }),- zod.null(),- ])- .optional()- .describe(- "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."- ),- conversion: zod- .union([- zod.object({- filters: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional()- .describe(- "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."- ),- events: zod- .array(- zod.object({- filters: zod- .object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsBulkDeleteCreateBodyConversionOneEventsItemFiltersOneSourceDefault- ),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- })- .describe(- "Event\/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."- ),- })- )- .optional()- .describe(- "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."- ),- window_minutes: zod- .number()- .nullish()- .describe(- 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'- ),- bytecode: zod- .unknown()- .optional()- .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),- }),- zod.null(),- ])- .optional()- .describe(- 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'- ),- exit_condition: zod- .enum([- 'exit_on_conversion',- 'exit_on_trigger_not_matched',- 'exit_on_trigger_not_matched_or_conversion',- 'exit_only_at_end',- ])- .describe(- '\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End'- )- .optional()- .describe(- "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End"- ),- edges: zod- .array(- zod.object({- to: zod.string().describe('Target action id.'),- type: zod- .enum(['continue', 'branch'])- .describe('\* `continue` - continue\n\* `branch` - branch')- .describe(- "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n\* `continue` - continue\n\* `branch` - branch"- ),- index: zod- .number()- .optional()- .describe(- "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."- ),- from: zod.string().describe('Source action id.'),- })- )+ .string().optional().describe(- "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch \/ wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."+ "iCalendar RRULE string (e.g. 'FREQ=DAILY;INTERVAL=1'). Must produce occurrences at most once per hour."),- actions: zod- .array(- zod.object({- id: zod.string().describe('Unique node ID within the workflow.'),- name: zod.string().max(hogFlowsBulkDeleteCreateBodyActionsItemNameMax).describe('Display name.'),- description: zod- .string()- .default(hogFlowsBulkDeleteCreateBodyActionsItemDescriptionDefault)- .describe('Optional description.'),- on_error: zod- .union([- zod.enum(['continue', 'abort']).describe('\* `continue` - continue\n\* `abort` - abort'),- zod.null(),- ])- .optional()- .describe(- 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n\* `continue` - continue\n\* `abort` - abort'- ),- created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),- updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsBulkDeleteCreateBodyActionsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()- .describe('Property filters gating this action.'),- type: zod- .string()- .max(hogFlowsBulkDeleteCreateBodyActionsItemTypeMax)- .describe(- 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'- ),- config: zod- .union([- zod- .record(zod.string(), zod.unknown())- .describe(- 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'- ),- zod- .object({- condition: zod+ starts_at: zod.iso.datetime({ offset: true }).optional().describe('ISO 8601 datetime the schedule starts from.'),+ timezone: zod+ .string()+ .max(hogFlowsSchedulesPartialUpdateBodyTimezoneMax)+ .optional()+ .describe("IANA timezone for interpreting the RRULE (default 'UTC')."),+ variables: zod+ .unknown()+ .optional()+ .describe('Variable value overrides merged with the workflow defaults on each run.'),+})++export const hogFlowsBulkDeleteCreateBodyNameMax = 400++export const hogFlowsBulkDeleteCreateBodyDescriptionDefault = ``+export const hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMin = 60+export const hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMax = 94608000++export const hogFlowsBulkDeleteCreateBodyConversionOneEventsItemFiltersOneSourceDefault = `events`+export const hogFlowsBulkDeleteCreateBodyActionsItemNameMax = 400++export const hogFlowsBulkDeleteCreateBodyActionsItemDescriptionDefault = ``+export const hogFlowsBulkDeleteCreateBodyActionsItemFiltersOneSourceDefault = `events`+export const hogFlowsBulkDeleteCreateBodyActionsItemTypeMax = 100++export const hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault = `events`+export const hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault = `events`++export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(hogFlowsBulkDeleteCreateBodyNameMax).nullish().describe('Workflow name.'),+ description: zod+ .string()+ .default(hogFlowsBulkDeleteCreateBodyDescriptionDefault)+ .describe('Optional description.'),+ status: zod+ .enum(['draft', 'active', 'archived'])+ .describe('\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived')+ .optional()+ .describe(+ 'draft (no execution), active (live), archived (disabled).\n\n\* `draft` - Draft\n\* `active` - Active\n\* `archived` - Archived'+ ),+ trigger_masking: zod+ .union([+ zod.object({+ ttl: zod+ .number()+ .min(hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMin)+ .max(hogFlowsBulkDeleteCreateBodyTriggerMaskingOneTtlMax)+ .nullish()+ .describe('Seconds (60 to ~94M \/ 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup\/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),+ bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ "Optional dedup\/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."+ ),+ conversion: zod+ .union([+ zod.object({+ filters: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional()+ .describe(+ "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod.object({- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault- ),- actions: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- events: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- data_warehouse: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- properties: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table']).describe(- 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsBulkDeleteCreateBodyConversionOneEventsItemFiltersOneSourceDefault),- name: zod.string().optional().describe('Optional display name.'),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),})- .optional().describe(- "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ "Event\/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."),- events: zod- .array(- zod.object({+ })+ )+ .optional()+ .describe(+ "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."+ ),+ window_minutes: zod+ .number()+ .nullish()+ .describe(+ 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'+ ),+ bytecode: zod+ .unknown()+ .optional()+ .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'+ ),+ exit_condition: zod+ .enum([+ 'exit_on_conversion',+ 'exit_on_trigger_not_matched',+ 'exit_on_trigger_not_matched_or_conversion',+ 'exit_only_at_end',+ ])+ .describe(+ '\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End'+ )+ .optional()+ .describe(+ "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n\* `exit_on_conversion` - Conversion\n\* `exit_on_trigger_not_matched` - Trigger Not Matched\n\* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n\* `exit_only_at_end` - Only At End"+ ),+ edges: zod+ .array(+ zod.object({+ to: zod.string().describe('Target action id.'),+ type: zod+ .enum(['continue', 'branch'])+ .describe('\* `continue` - continue\n\* `branch` - branch')+ .describe(+ "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n\* `continue` - continue\n\* `branch` - branch"+ ),+ index: zod+ .number()+ .optional()+ .describe(+ "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."+ ),+ from: zod.string().describe('Source action id.'),+ })+ )+ .optional()+ .describe(+ "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch \/ wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."+ ),+ actions: zod+ .array(+ zod.object({+ id: zod.string().describe('Unique node ID within the workflow.'),+ name: zod.string().max(hogFlowsBulkDeleteCreateBodyActionsItemNameMax).describe('Display name.'),+ description: zod+ .string()+ .default(hogFlowsBulkDeleteCreateBodyActionsItemDescriptionDefault)+ .describe('Optional description.'),+ on_error: zod+ .union([+ zod.enum(['continue', 'abort']).describe('\* `continue` - continue\n\* `abort` - abort'),+ zod.null(),+ ])+ .optional()+ .describe(+ 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n\* `continue` - continue\n\* `abort` - abort'+ ),+ created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),+ updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table'])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsBulkDeleteCreateBodyActionsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe('Property filters gating this action.'),+ type: zod+ .string()+ .max(hogFlowsBulkDeleteCreateBodyActionsItemTypeMax)+ .describe(+ 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'+ ),+ config: zod+ .union([+ zod+ .record(zod.string(), zod.unknown())+ .describe(+ 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'+ ),+ zod+ .object({+ condition: zod+ .object({filters: zod.union([zod.object({@@ -2260,7 +2259,7 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({'\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table').default(- hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown()))@@ -2283,40 +2282,92 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({]).optional().describe(- 'Event\/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'),name: zod.string().optional().describe('Optional display name.'),})- )- .optional()- .describe(- "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."- ),- max_wait_duration: zod- .string()- .describe("'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."),- })- .describe(- "Config for type='wait_until_condition'. Provide 'condition' and\/or 'events' — an events-only wait (no condition) is valid."- ),- ])- .describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."- ),- output_variable: zod- .unknown()- .optional()- .describe('Output variable definition for downstream actions.'),- })- )- .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),- variables: zod- .array(- zod.record(zod.string(), zod.string()).describe('Variable: {key, type: string|number|boolean, default}.')- )- .optional()- .describe('Workflow vars (key, type, default). Total <5KB.'),-})+ .optional()+ .describe(+ "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ ])+ .describe(+ '\* `events` - events\n\* `person-updates` - person-updates\n\* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsBulkDeleteCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ ),+ actions: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ events: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ data_warehouse: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ properties: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Event\/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ ),+ name: zod.string().optional().describe('Optional display name.'),+ })+ )+ .optional()+ .describe(+ "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."+ ),+ max_wait_duration: zod+ .string()+ .describe(+ "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."+ ),+ })+ .describe(+ "Config for type='wait_until_condition'. Provide 'condition' and\/or 'events' — an events-only wait (no condition) is valid."+ ),+ ])+ .describe(+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ ),+ output_variable: zod+ .unknown()+ .optional()+ .describe('Output variable definition for downstream actions.'),+ })+ )+ .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),+ variables: zod+ .array(+ zod+ .record(zod.string(), zod.string())+ .describe('Variable: {key, type: string|number|boolean, default}.')+ )+ .optional()+ .describe('Workflow vars (key, type, default). Total <5KB.'),+ })+ .describe('Mixin for serializers to add user access control fields')export const HogFlowsUserBlastRadiusCreateBody = /* @__PURE__ */ zod.object({filters: zod.record(zod.string(), zod.unknown()).describe('Property filters to apply'),diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 4fe978a52215..1f7b0fc5be27 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -26775,6 +26775,9 @@ export namespace Schemas {readonly updated_at: string;}+ /**+ * Mixin for serializers to add user access control fields+ */export interface HogFlow {readonly id: string;/**@@ -26818,6 +26821,11 @@ export namespace Schemas {readonly billable_action_types: unknown;/** Recurring schedules attached to this workflow (read-only here; manage via the schedules sub-resource). A batch/schedule workflow only fires when it's active AND has an active schedule. Empty for non-scheduled workflows. */readonly schedules: readonly HogFlowSchedule[];+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level: string | null;}/**@@ -26920,6 +26928,9 @@ export namespace Schemas {current_action_id?: string;}+ /**+ * Mixin for serializers to add user access control fields+ */export interface HogFlowMinimal {readonly id: string;/** @nullable */@@ -26940,6 +26951,11 @@ export namespace Schemas {readonly abort_action: string | null;readonly variables: unknown;readonly billable_action_types: unknown;+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level: string | null;}/**@@ -40705,6 +40721,9 @@ export namespace Schemas {*/export type PatchedHogFlowVariablesItem = {[key: string]: string};+ /**+ * Mixin for serializers to add user access control fields+ */export interface PatchedHogFlow {readonly id?: string;/**@@ -40748,6 +40767,11 @@ export namespace Schemas {readonly billable_action_types?: unknown;/** Recurring schedules attached to this workflow (read-only here; manage via the schedules sub-resource). A batch/schedule workflow only fires when it's active AND has an active schedule. Empty for non-scheduled workflows. */readonly schedules?: readonly HogFlowSchedule[];+ /**+ * The effective access level the user has for this object+ * @nullable+ */+ readonly user_access_level?: string | null;}export interface PatchedHogFlowGraphUpdate {diff --git a/services/mcp/src/generated/workflows/api.ts b/services/mcp/src/generated/workflows/api.tsindex 60208acfb34a..720ed6947217 100644--- a/services/mcp/src/generated/workflows/api.ts+++ b/services/mcp/src/generated/workflows/api.ts@@ -53,238 +53,196 @@ export const hogFlowsCreateBodyActionsItemTypeMax = 100export const hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault = `events`export const hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault = `events`-export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(hogFlowsCreateBodyNameMax).nullish().describe('Workflow name.'),- description: zod.string().default(hogFlowsCreateBodyDescriptionDefault).describe('Optional description.'),- status: zod- .enum(['draft', 'active', 'archived'])- .describe('* `draft` - Draft\n* `active` - Active\n* `archived` - Archived')- .optional()- .describe(- 'draft (no execution), active (live), archived (disabled).\n\n* `draft` - Draft\n* `active` - Active\n* `archived` - Archived'- ),- trigger_masking: zod- .union([- zod.object({- ttl: zod- .number()- .min(hogFlowsCreateBodyTriggerMaskingOneTtlMin)- .max(hogFlowsCreateBodyTriggerMaskingOneTtlMax)- .nullish()- .describe('Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.'),- threshold: zod- .number()- .nullish()- .describe(- 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'- ),- hash: zod- .string()- .describe(- "HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl."- ),- bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),- }),- zod.null(),- ])- .optional()- .describe(- "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."- ),- conversion: zod- .union([- zod.object({- filters: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional()- .describe(- "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."- ),- events: zod- .array(- zod.object({- filters: zod- .object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- })- .describe(- "Event/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."- ),- })- )- .optional()- .describe(- "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."- ),- window_minutes: zod- .number()- .nullish()- .describe(- 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'- ),- bytecode: zod- .unknown()- .optional()- .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),- }),- zod.null(),- ])- .optional()- .describe(- 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'- ),- exit_condition: zod- .enum([- 'exit_on_conversion',- 'exit_on_trigger_not_matched',- 'exit_on_trigger_not_matched_or_conversion',- 'exit_only_at_end',- ])- .describe(- '* `exit_on_conversion` - Conversion\n* `exit_on_trigger_not_matched` - Trigger Not Matched\n* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n* `exit_only_at_end` - Only At End'- )- .optional()- .describe(- "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n* `exit_on_conversion` - Conversion\n* `exit_on_trigger_not_matched` - Trigger Not Matched\n* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n* `exit_only_at_end` - Only At End"- ),- edges: zod- .array(- zod.object({- to: zod.string().describe('Target action id.'),- type: zod- .enum(['continue', 'branch'])- .describe('* `continue` - continue\n* `branch` - branch')- .describe(- "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n* `continue` - continue\n* `branch` - branch"- ),- index: zod- .number()- .optional()- .describe(- "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."- ),- from: zod.string().describe('Source action id.'),- })- )- .optional()- .describe(- "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch / wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."- ),- actions: zod- .array(- zod.object({- id: zod.string().describe('Unique node ID within the workflow.'),- name: zod.string().max(hogFlowsCreateBodyActionsItemNameMax).describe('Display name.'),- description: zod- .string()- .default(hogFlowsCreateBodyActionsItemDescriptionDefault)- .describe('Optional description.'),- on_error: zod- .union([- zod.enum(['continue', 'abort']).describe('* `continue` - continue\n* `abort` - abort'),- zod.null(),- ])- .optional()- .describe(- 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n* `continue` - continue\n* `abort` - abort'- ),- created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),- updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsCreateBodyActionsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()- .describe('Property filters gating this action.'),- type: zod- .string()- .max(hogFlowsCreateBodyActionsItemTypeMax)- .describe(- 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'- ),- config: zod- .union([- zod- .record(zod.string(), zod.unknown())- .describe(- 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'- ),- zod- .object({- condition: zod+export const HogFlowsCreateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(hogFlowsCreateBodyNameMax).nullish().describe('Workflow name.'),+ description: zod.string().default(hogFlowsCreateBodyDescriptionDefault).describe('Optional description.'),+ status: zod+ .enum(['draft', 'active', 'archived'])+ .describe('* `draft` - Draft\n* `active` - Active\n* `archived` - Archived')+ .optional()+ .describe(+ 'draft (no execution), active (live), archived (disabled).\n\n* `draft` - Draft\n* `active` - Active\n* `archived` - Archived'+ ),+ trigger_masking: zod+ .union([+ zod.object({+ ttl: zod+ .number()+ .min(hogFlowsCreateBodyTriggerMaskingOneTtlMin)+ .max(hogFlowsCreateBodyTriggerMaskingOneTtlMax)+ .nullish()+ .describe('Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),+ bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."+ ),+ conversion: zod+ .union([+ zod.object({+ filters: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional()+ .describe(+ "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod.object({- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault- ),- actions: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- events: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- data_warehouse: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- properties: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table']).describe(- 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'- ),- name: zod.string().optional().describe('Optional display name.'),+ '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),})- .optional().describe(- "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ "Event/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."),- events: zod- .array(- zod.object({+ })+ )+ .optional()+ .describe(+ "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."+ ),+ window_minutes: zod+ .number()+ .nullish()+ .describe(+ 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'+ ),+ bytecode: zod+ .unknown()+ .optional()+ .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'+ ),+ exit_condition: zod+ .enum([+ 'exit_on_conversion',+ 'exit_on_trigger_not_matched',+ 'exit_on_trigger_not_matched_or_conversion',+ 'exit_only_at_end',+ ])+ .describe(+ '* `exit_on_conversion` - Conversion\n* `exit_on_trigger_not_matched` - Trigger Not Matched\n* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n* `exit_only_at_end` - Only At End'+ )+ .optional()+ .describe(+ "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n* `exit_on_conversion` - Conversion\n* `exit_on_trigger_not_matched` - Trigger Not Matched\n* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n* `exit_only_at_end` - Only At End"+ ),+ edges: zod+ .array(+ zod.object({+ to: zod.string().describe('Target action id.'),+ type: zod+ .enum(['continue', 'branch'])+ .describe('* `continue` - continue\n* `branch` - branch')+ .describe(+ "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n* `continue` - continue\n* `branch` - branch"+ ),+ index: zod+ .number()+ .optional()+ .describe(+ "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."+ ),+ from: zod.string().describe('Source action id.'),+ })+ )+ .optional()+ .describe(+ "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch / wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."+ ),+ actions: zod+ .array(+ zod.object({+ id: zod.string().describe('Unique node ID within the workflow.'),+ name: zod.string().max(hogFlowsCreateBodyActionsItemNameMax).describe('Display name.'),+ description: zod+ .string()+ .default(hogFlowsCreateBodyActionsItemDescriptionDefault)+ .describe('Optional description.'),+ on_error: zod+ .union([+ zod.enum(['continue', 'abort']).describe('* `continue` - continue\n* `abort` - abort'),+ zod.null(),+ ])+ .optional()+ .describe(+ 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n* `continue` - continue\n* `abort` - abort'+ ),+ created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),+ updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table'])+ .describe(+ '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsCreateBodyActionsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe('Property filters gating this action.'),+ type: zod+ .string()+ .max(hogFlowsCreateBodyActionsItemTypeMax)+ .describe(+ 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'+ ),+ config: zod+ .union([+ zod+ .record(zod.string(), zod.unknown())+ .describe(+ 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'+ ),+ zod+ .object({+ condition: zod+ .object({filters: zod.union([zod.object({@@ -294,7 +252,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({'* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table').default(- hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ hogFlowsCreateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown()))@@ -317,40 +275,92 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({]).optional().describe(- 'Event/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'),name: zod.string().optional().describe('Optional display name.'),})- )- .optional()- .describe(- "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."- ),- max_wait_duration: zod- .string()- .describe("'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."),- })- .describe(- "Config for type='wait_until_condition'. Provide 'condition' and/or 'events' — an events-only wait (no condition) is valid."- ),- ])- .describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."- ),- output_variable: zod- .unknown()- .optional()- .describe('Output variable definition for downstream actions.'),- })- )- .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),- variables: zod- .array(- zod.record(zod.string(), zod.string()).describe('Variable: {key, type: string|number|boolean, default}.')- )- .optional()- .describe('Workflow vars (key, type, default). Total <5KB.'),-})+ .optional()+ .describe(+ "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ ])+ .describe(+ '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsCreateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ ),+ actions: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ events: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ data_warehouse: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ properties: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Event/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ ),+ name: zod.string().optional().describe('Optional display name.'),+ })+ )+ .optional()+ .describe(+ "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."+ ),+ max_wait_duration: zod+ .string()+ .describe(+ "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."+ ),+ })+ .describe(+ "Config for type='wait_until_condition'. Provide 'condition' and/or 'events' — an events-only wait (no condition) is valid."+ ),+ ])+ .describe(+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ ),+ output_variable: zod+ .unknown()+ .optional()+ .describe('Output variable definition for downstream actions.'),+ })+ )+ .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),+ variables: zod+ .array(+ zod+ .record(zod.string(), zod.string())+ .describe('Variable: {key, type: string|number|boolean, default}.')+ )+ .optional()+ .describe('Workflow vars (key, type, default). Total <5KB.'),+ })+ .describe('Mixin for serializers to add user access control fields')export const HogFlowsRetrieveParams = /* @__PURE__ */ zod.object({id: zod.string().describe('A UUID string identifying this hog flow.'),@@ -385,233 +395,191 @@ export const hogFlowsPartialUpdateBodyActionsItemTypeMax = 100export const hogFlowsPartialUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault = `events`export const hogFlowsPartialUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault = `events`-export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({- name: zod.string().max(hogFlowsPartialUpdateBodyNameMax).nullish().describe('Workflow name.'),- description: zod.string().optional().describe('Optional description.'),- trigger_masking: zod- .union([- zod.object({- ttl: zod- .number()- .min(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMin)- .max(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMax)- .nullish()- .describe('Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.'),- threshold: zod- .number()- .nullish()- .describe(- 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'- ),- hash: zod- .string()- .describe(- "HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl."- ),- bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),- }),- zod.null(),- ])- .optional()- .describe(- "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."- ),- conversion: zod- .union([- zod.object({- filters: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional()- .describe(- "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."- ),- events: zod- .array(- zod.object({- filters: zod- .object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault- ),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- })- .describe(- "Event/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."- ),- })- )- .optional()- .describe(- "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."- ),- window_minutes: zod- .number()- .nullish()- .describe(- 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'- ),- bytecode: zod- .unknown()- .optional()- .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),- }),- zod.null(),- ])- .optional()- .describe(- 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'- ),- exit_condition: zod- .enum([- 'exit_on_conversion',- 'exit_on_trigger_not_matched',- 'exit_on_trigger_not_matched_or_conversion',- 'exit_only_at_end',- ])- .describe(- '* `exit_on_conversion` - Conversion\n* `exit_on_trigger_not_matched` - Trigger Not Matched\n* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n* `exit_only_at_end` - Only At End'- )- .optional()- .describe(- "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n* `exit_on_conversion` - Conversion\n* `exit_on_trigger_not_matched` - Trigger Not Matched\n* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n* `exit_only_at_end` - Only At End"- ),- edges: zod- .array(- zod.object({- to: zod.string().describe('Target action id.'),- type: zod- .enum(['continue', 'branch'])- .describe('* `continue` - continue\n* `branch` - branch')- .describe(- "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n* `continue` - continue\n* `branch` - branch"- ),- index: zod- .number()- .optional()- .describe(- "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."- ),- from: zod.string().describe('Source action id.'),- })- )- .optional()- .describe(- "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch / wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."- ),- actions: zod- .array(- zod.object({- id: zod.string().describe('Unique node ID within the workflow.'),- name: zod.string().max(hogFlowsPartialUpdateBodyActionsItemNameMax).describe('Display name.'),- description: zod- .string()- .default(hogFlowsPartialUpdateBodyActionsItemDescriptionDefault)- .describe('Optional description.'),- on_error: zod- .union([- zod.enum(['continue', 'abort']).describe('* `continue` - continue\n* `abort` - abort'),- zod.null(),- ])- .optional()- .describe(- 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n* `continue` - continue\n* `abort` - abort'- ),- created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),- updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'- )- .default(hogFlowsPartialUpdateBodyActionsItemFiltersOneSourceDefault),- actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()- .describe('Property filters gating this action.'),- type: zod- .string()- .max(hogFlowsPartialUpdateBodyActionsItemTypeMax)- .describe(- 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'- ),- config: zod- .union([- zod- .record(zod.string(), zod.unknown())- .describe(- 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'- ),- zod- .object({- condition: zod+export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod+ .object({+ name: zod.string().max(hogFlowsPartialUpdateBodyNameMax).nullish().describe('Workflow name.'),+ description: zod.string().optional().describe('Optional description.'),+ trigger_masking: zod+ .union([+ zod.object({+ ttl: zod+ .number()+ .min(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMin)+ .max(hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMax)+ .nullish()+ .describe('Seconds (60 to ~94M / 3y) to suppress repeat firings of the same hash.'),+ threshold: zod+ .number()+ .nullish()+ .describe(+ 'Fire once per N matches of the same hash within ttl — a sampler: N=3 fires on the 1st, 4th, 7th… match. Omit to fire on the first match, then suppress repeats within ttl.'+ ),+ hash: zod+ .string()+ .describe(+ "HogQL template defining the dedup/grouping key, e.g. '{person.id}' (once per person) within ttl."+ ),+ bytecode: zod.unknown().optional().describe('Auto-compiled from hash. Do not set.'),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ "Optional dedup/throttle on an already-matched trigger: {hash: <HogQL template>, ttl: <seconds, 60-94608000>, threshold?: <int>}. Without threshold: fire once per hash, then suppress repeats within ttl (hash '{person.id}' = once per person per ttl). With threshold N: fire once per N matches of the same hash — a sampler, the 1st then every Nth. Throttles an already-qualifying trigger; it doesn't decide who enters. Server compiles bytecode from hash; omit to disable."+ ),+ conversion: zod+ .union([+ zod.object({+ filters: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional()+ .describe(+ "Property-based conversion conditions, as an ARRAY of property filters: [{key, value, operator, type: event|person|group}, ...]. Event-based goals do NOT go here — put them in 'events'. Empty array = any event within the window converts."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod.object({- filters: zod- .union([- zod.object({- source: zod- .enum(['events', 'person-updates', 'data-warehouse-table'])- .describe(- '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'- )- .default(- hogFlowsPartialUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault- ),- actions: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- events: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- data_warehouse: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- properties: zod- .array(zod.record(zod.string(), zod.unknown()))- .optional(),- bytecode: zod.unknown().optional(),- transpiled: zod.unknown().optional(),- filter_test_accounts: zod.boolean().optional(),- bytecode_error: zod.string().optional(),- }),- zod.null(),- ])- .optional()+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table']).describe(- 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'+ '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault),- name: zod.string().optional().describe('Optional display name.'),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),})- .optional().describe(- "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ "Event/action filters for this conversion event, same shape as trigger filters: {events: [{id, name, type: 'events', properties?: [<cond>]}], actions?: [...], properties?: [<cond>]}. bytecode is compiled server-side."),- events: zod- .array(- zod.object({+ })+ )+ .optional()+ .describe(+ "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]."+ ),+ window_minutes: zod+ .number()+ .nullish()+ .describe(+ 'Conversion window in minutes after a person enters the workflow. null = no explicit window.'+ ),+ bytecode: zod+ .unknown()+ .optional()+ .describe("Compiled server-side from 'filters'. Do not set; ignored if sent."),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Conversion goal. filters: ARRAY of property conditions [{key, value, operator, type: event|person|group}]; events: event-based goals [{filters: {events: [...]}}]; window_minutes: minutes after entry. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'+ ),+ exit_condition: zod+ .enum([+ 'exit_on_conversion',+ 'exit_on_trigger_not_matched',+ 'exit_on_trigger_not_matched_or_conversion',+ 'exit_only_at_end',+ ])+ .describe(+ '* `exit_on_conversion` - Conversion\n* `exit_on_trigger_not_matched` - Trigger Not Matched\n* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n* `exit_only_at_end` - Only At End'+ )+ .optional()+ .describe(+ "exit_only_at_end: only at exit node (default). exit_on_conversion: also on conversion (needs 'conversion'; silent no-op otherwise). exit_on_trigger_not_matched: also when trigger filter stops matching. exit_on_trigger_not_matched_or_conversion: both (needs 'conversion').\n\n* `exit_on_conversion` - Conversion\n* `exit_on_trigger_not_matched` - Trigger Not Matched\n* `exit_on_trigger_not_matched_or_conversion` - Trigger Not Matched Or Conversion\n* `exit_only_at_end` - Only At End"+ ),+ edges: zod+ .array(+ zod.object({+ to: zod.string().describe('Target action id.'),+ type: zod+ .enum(['continue', 'branch'])+ .describe('* `continue` - continue\n* `branch` - branch')+ .describe(+ "continue: fall-through (sequential or the no-match path of conditional_branch). branch: requires 'index' matching config.conditions[index].\n\n* `continue` - continue\n* `branch` - branch"+ ),+ index: zod+ .number()+ .optional()+ .describe(+ "Required for type='branch'. conditional_branch: index into config.conditions[index]. wait_until_condition: use index:0 — it advances via the index:0 branch edge when it resolves (a condition match or an events entry firing)."+ ),+ from: zod.string().describe('Source action id.'),+ })+ )+ .optional()+ .describe(+ "Graph edges: [{from, to, type: 'continue'|'branch', index?}]. 'continue' = fall-through (sequential, or no-match path of conditional_branch). 'branch' requires 'index': matches config.conditions[index] on conditional_branch / wait_until_condition. Every non-exit action needs a reachable next action ('No next action found' otherwise)."+ ),+ actions: zod+ .array(+ zod.object({+ id: zod.string().describe('Unique node ID within the workflow.'),+ name: zod.string().max(hogFlowsPartialUpdateBodyActionsItemNameMax).describe('Display name.'),+ description: zod+ .string()+ .default(hogFlowsPartialUpdateBodyActionsItemDescriptionDefault)+ .describe('Optional description.'),+ on_error: zod+ .union([+ zod.enum(['continue', 'abort']).describe('* `continue` - continue\n* `abort` - abort'),+ zod.null(),+ ])+ .optional()+ .describe(+ 'On failure: continue (skip the action and proceed) or abort (stop the run).\n\n* `continue` - continue\n* `abort` - abort'+ ),+ created_at: zod.number().optional().describe('Created at (epoch ms). Frontend-managed.'),+ updated_at: zod.number().optional().describe('Updated at (epoch ms). Frontend-managed.'),+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum(['events', 'person-updates', 'data-warehouse-table'])+ .describe(+ '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'+ )+ .default(hogFlowsPartialUpdateBodyActionsItemFiltersOneSourceDefault),+ actions: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ events: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ data_warehouse: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ properties: zod.array(zod.record(zod.string(), zod.unknown())).optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe('Property filters gating this action.'),+ type: zod+ .string()+ .max(hogFlowsPartialUpdateBodyActionsItemTypeMax)+ .describe(+ 'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'+ ),+ config: zod+ .union([+ zod+ .record(zod.string(), zod.unknown())+ .describe(+ 'Config for every action type except wait_until_condition — see the field description for per-type shapes.'+ ),+ zod+ .object({+ condition: zod+ .object({filters: zod.union([zod.object({@@ -621,7 +589,7 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({'* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table').default(- hogFlowsPartialUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ hogFlowsPartialUpdateBodyActionsItemConfigTwoConditionFiltersOneSourceDefault),actions: zod.array(zod.record(zod.string(), zod.unknown()))@@ -644,41 +612,93 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({]).optional().describe(- 'Event/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ 'Property conditions, e.g. {properties: [{key, value, operator, type}]}.'),name: zod.string().optional().describe('Optional display name.'),})- )- .optional()- .describe(- "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."- ),- max_wait_duration: zod- .string()- .describe("'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."),- })- .describe(- "Config for type='wait_until_condition'. Provide 'condition' and/or 'events' — an events-only wait (no condition) is valid."- ),- ])- .describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."- ),- output_variable: zod- .unknown()- .optional()- .describe('Output variable definition for downstream actions.'),- })- )- .optional()- .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),- variables: zod- .array(- zod.record(zod.string(), zod.string()).describe('Variable: {key, type: string|number|boolean, default}.')- )- .optional()- .describe('Workflow vars (key, type, default). Total <5KB.'),-})+ .optional()+ .describe(+ "Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout."+ ),+ events: zod+ .array(+ zod.object({+ filters: zod+ .union([+ zod.object({+ source: zod+ .enum([+ 'events',+ 'person-updates',+ 'data-warehouse-table',+ ])+ .describe(+ '* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table'+ )+ .default(+ hogFlowsPartialUpdateBodyActionsItemConfigTwoEventsItemFiltersOneSourceDefault+ ),+ actions: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ events: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ data_warehouse: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ properties: zod+ .array(zod.record(zod.string(), zod.unknown()))+ .optional(),+ bytecode: zod.unknown().optional(),+ transpiled: zod.unknown().optional(),+ filter_test_accounts: zod.boolean().optional(),+ bytecode_error: zod.string().optional(),+ }),+ zod.null(),+ ])+ .optional()+ .describe(+ 'Event/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped).'+ ),+ name: zod.string().optional().describe('Optional display name.'),+ })+ )+ .optional()+ .describe(+ "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}."+ ),+ max_wait_duration: zod+ .string()+ .describe(+ "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay)."+ ),+ })+ .describe(+ "Config for type='wait_until_condition'. Provide 'condition' and/or 'events' — an events-only wait (no condition) is valid."+ ),+ ])+ .describe(+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: {delay_duration: '<number><unit>'} where unit is m|h|d. Fractions OK ('0.5m'=30s; seconds unsupported). Per-unit max m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ ),+ output_variable: zod+ .unknown()+ .optional()+ .describe('Output variable definition for downstream actions.'),+ })+ )+ .optional()+ .describe("Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too."),+ variables: zod+ .array(+ zod+ .record(zod.string(), zod.string())+ .describe('Variable: {key, type: string|number|boolean, default}.')+ )+ .optional()+ .describe('Workflow vars (key, type, default). Total <5KB.'),+ })+ .describe('Mixin for serializers to add user access control fields')export const HogFlowsBatchJobsListParams = /* @__PURE__ */ zod.object({id: zod.string().describe('A UUID string identifying this hog flow.'),diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.jsonindex 7b688c83f911..cd585f968563 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json@@ -1,5 +1,6 @@{"$schema": "https://json-schema.org/draft/2020-12/schema",+ "description": "Mixin for serializers to add user access control fields","properties": {"actions": {"description": "Ordered action nodes. Exactly one type='trigger' required. Typically one type='exit' too.",