Skip to content

: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.

fix(workflows): add MCP support for wait until and event conversions (#62649)

Daniel Marchuk537675b66f7a
diff --git a/products/workflows/backend/api/graph_validation.py b/products/workflows/backend/api/graph_validation.py
index c415bc431af2..263dfc61d658 100644
--- a/products/workflows/backend/api/graph_validation.py
+++ b/products/workflows/backend/api/graph_validation.py
@@ -74,6 +74,18 @@ def validate_graph(actions: list[dict], edges: list[dict], abort_action: Optiona
if abort_action and abort_action not in actions_by_id:
errors.append(f"abort_action references unknown action '{abort_action}'.")
+ # Every wait_until_condition needs its single resolution edge: a `branch` edge at index 0, taken when
+ # the condition matches or an events entry fires. Without it the node only advances on the
+ # max_wait_duration timeout (the `continue` edge) and silently ignores resolution — a footgun the
+ # frontend never produces (it always wires this edge). seen_branch_keys holds only valid branch edges.
+ for action in actions:
+ if action.get("type") == "wait_until_condition" and (action.get("id"), 0) not in seen_branch_keys:
+ errors.append(
+ f"wait_until_condition '{action.get('id')}' is missing its resolution edge: add a 'branch' edge "
+ f"with index 0 (taken when the condition matches or an events entry fires). Without it the wait "
+ f"only ever advances on the max_wait_duration timeout, never on resolution."
+ )
+
if errors:
raise serializers.ValidationError({"graph": errors})
diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.py
index bfe15eb0046a..ac820fddd1b2 100644
--- a/products/workflows/backend/api/hog_flow.py
+++ b/products/workflows/backend/api/hog_flow.py
@@ -12,7 +12,7 @@ import structlog
import posthoganalytics
from django_filters import BaseInFilter, CharFilter, FilterSet
from django_filters.rest_framework import DjangoFilterBackend
-from drf_spectacular.utils import OpenApiParameter, extend_schema
+from drf_spectacular.utils import OpenApiParameter, extend_schema, extend_schema_field
from rest_framework import exceptions, serializers, viewsets
from rest_framework.decorators import action
from rest_framework.pagination import LimitOffsetPagination
@@ -176,7 +176,11 @@ class HogFlowEdgeSerializer(serializers.Serializer):
)
index = serializers.IntegerField(
required=False,
- help_text="Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition.",
+ help_text=(
+ "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)."
+ ),
)
def get_fields(self):
@@ -187,6 +191,83 @@ class HogFlowEdgeSerializer(serializers.Serializer):
return fields
+# Schema-only typing for the polymorphic action config. The MCP tool schema is generated from this
+# (via zod), the MCP server parses tool input with that zod schema, and handlers receive the PARSED
+# result — a matched zod object branch strips keys it doesn't declare. The free-form branch is
+# deliberately FIRST so it wins union parsing for every config shape: the typed
+# wait_until_condition branch exists purely as shape guidance for agents and never strips or
+# rejects anything.
+_HOG_FLOW_WAIT_UNTIL_EVENT_SCHEMA = {
+ "type": "object",
+ "properties": {
+ "filters": {
+ "anyOf": [{"$ref": "#/components/schemas/HogFunctionFilters"}, {"type": "null"}],
+ "description": (
+ "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": {"type": "string", "description": "Optional display name."},
+ },
+}
+
+HOG_FLOW_ACTION_CONFIG_SCHEMA = {
+ "anyOf": [
+ {
+ "type": "object",
+ "additionalProperties": True,
+ "description": (
+ "Config for every action type except wait_until_condition — see the field "
+ "description for per-type shapes."
+ ),
+ },
+ {
+ "type": "object",
+ "description": (
+ "Config for type='wait_until_condition'. Provide 'condition' and/or 'events' — an "
+ "events-only wait (no condition) is valid."
+ ),
+ "required": ["max_wait_duration"],
+ "properties": {
+ "condition": {
+ "type": "object",
+ "description": (
+ "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."
+ ),
+ "properties": {
+ "filters": {
+ "anyOf": [{"$ref": "#/components/schemas/HogFunctionFilters"}, {"type": "null"}],
+ "description": "Property conditions, e.g. {properties: [{key, value, operator, type}]}.",
+ },
+ "name": {"type": "string", "description": "Optional display name."},
+ },
+ },
+ "events": {
+ "type": "array",
+ "items": _HOG_FLOW_WAIT_UNTIL_EVENT_SCHEMA,
+ "description": (
+ "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": {
+ "type": "string",
+ "description": "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay).",
+ },
+ },
+ },
+ ],
+}
+
+
+@extend_schema_field(HOG_FLOW_ACTION_CONFIG_SCHEMA)
+class HogFlowActionConfigField(serializers.JSONField):
+ # Runtime stays a lenient JSONField: per-type validation lives in HogFlowActionSerializer.validate.
+ pass
+
+
class HogFlowActionSerializer(serializers.Serializer):
id = serializers.CharField(help_text="Unique node ID within the workflow.")
name = serializers.CharField(max_length=400, help_text="Display name.")
@@ -209,7 +290,7 @@ class HogFlowActionSerializer(serializers.Serializer):
"conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit."
),
)
- config = serializers.JSONField(
+ config = HogFlowActionConfigField(
help_text=(
"Type-specific config keyed by action type. "
"trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel, filters?}. "
@@ -224,7 +305,12 @@ class HogFlowActionSerializer(serializers.Serializer):
"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}, max_wait_duration: <duration>} (same rules as delay). "
+ "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}."
),
)
@@ -402,6 +488,13 @@ class HogFlowActionSerializer(serializers.Serializer):
condition["filters"] = serializer.validated_data
if data.get("type") == "wait_until_condition":
+ config = data.get("config")
+ if isinstance(config, dict) and config.get("condition") is None:
+ # The visual editor seeds every wait node with a condition object ({filters: null}) and
+ # StepWaitUntilCondition assumes it's present. MCP/API callers can author an events-only
+ # wait with no condition; default it so the stored shape matches what the editor renders.
+ # An empty condition is ignored at runtime (isEvaluableCondition), so this is behaviour-neutral.
+ config["condition"] = {"filters": None}
wait_events = data.get("config", {}).get("events") or []
# Drop "events to wait for" entries that target neither events nor actions. An empty
# event filter compiles to always-true bytecode, which would wake the job on every
@@ -485,6 +578,69 @@ class HogFlowMaskingSerializer(serializers.Serializer):
return super().validate(attrs)
+@extend_schema_field(HogFunctionFiltersSerializer)
+class HogFlowConversionEventFiltersField(serializers.JSONField):
+ # Schema-typed as HogFunctionFilters for codegen, but runtime-lenient: drafts may hold invalid
+ # filters, and HogFlowSerializer.validate compiles/validates these with draft leniency.
+ pass
+
+
+class HogFlowConversionEventSerializer(serializers.Serializer):
+ filters = HogFlowConversionEventFiltersField(
+ help_text=(
+ "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."
+ )
+ )
+
+
+class HogFlowConversionSerializer(serializers.Serializer):
+ filters = serializers.ListField(
+ child=serializers.DictField(),
+ required=False,
+ help_text=(
+ "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 = serializers.ListField(
+ child=HogFlowConversionEventSerializer(),
+ required=False,
+ help_text="Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}].",
+ )
+ window_minutes = serializers.IntegerField(
+ required=False,
+ allow_null=True,
+ help_text="Conversion window in minutes after a person enters the workflow. null = no explicit window.",
+ )
+ # Not DRF read_only: drf-spectacular puts readOnly fields in the component's `required` list
+ # (shared by request and response schemas), which would make generated write schemas demand a
+ # server-computed field. Instead it's optional here and stripped in to_internal_value, so a
+ # client-supplied value still never reaches validated_data.
+ bytecode = serializers.JSONField(
+ required=False, allow_null=True, help_text="Compiled server-side from 'filters'. Do not set; ignored if sent."
+ )
+
+ def to_internal_value(self, data):
+ # bytecode is server-computed; never trust a client-supplied value (the matcher executes it).
+ if isinstance(data, dict) and "bytecode" in data:
+ data = {k: v for k, v in data.items() if k != "bytecode"}
+ # Legacy shape guard (mirrors the one-time backfill in migration 0009): some clients sent an
+ # event-based goal as an object in 'filters' (e.g. {"events": [...], "source": "events"}).
+ # That belongs in 'events' — relocate it before field validation so the old shape is still
+ # accepted and compiled (filters only takes an array of property conditions) instead of 400ing.
+ if isinstance(data, dict) and isinstance(data.get("filters"), dict) and data["filters"].get("events"):
+ data = {**data, "events": [*(data.get("events") or []), {"filters": data["filters"]}], "filters": []}
+ return super().to_internal_value(data)
+
+ def to_representation(self, value):
+ # Pass stored JSON through untouched — rows written before the 'events' slot existed may hold
+ # legacy shapes (object in 'filters') that field-level coercion would mangle on read.
+ return value
+
+
class HogFlowScheduleSerializer(serializers.ModelSerializer):
class Meta:
model = HogFlowSchedule
@@ -604,13 +760,14 @@ class HogFlowSerializer(HogFlowMinimalSerializer):
"omit to disable."
),
)
- conversion = serializers.JSONField(
+ conversion = HogFlowConversionSerializer(
required=False,
allow_null=True,
help_text=(
- "Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, "
- "type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / "
- "exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side."
+ "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 = serializers.ChoiceField(
@@ -752,16 +909,6 @@ class HogFlowSerializer(HogFlowMinimalSerializer):
conversion = data.get("conversion")
if conversion is not None:
filters = conversion.get("filters")
- # Forward guard for the legacy bad shape (see migration 0009): an event-based conversion
- # goal stored as an object in `conversion.filters` (e.g. {"events": [...], "source": "events"})
- # belongs in `conversion.events`. `conversion.filters` is an array of property filters, so the
- # object both crashes the property picker and is invisible to the matcher. Relocate it here so
- # no client (web UI, API, MCP) can persist the malformed shape; it then compiles through the
- # conversion.events path below.
- if isinstance(filters, dict) and filters.get("events"):
- data["conversion"]["events"] = [*(conversion.get("events") or []), {"filters": filters}]
- data["conversion"]["filters"] = []
- filters = []
if filters:
serializer = HogFunctionFiltersSerializer(data={"properties": filters}, context=self.context)
if not strict:
diff --git a/products/workflows/backend/api/test/test_hog_flow.py b/products/workflows/backend/api/test/test_hog_flow.py
index 370dc669cccf..184966215104 100644
--- a/products/workflows/backend/api/test/test_hog_flow.py
+++ b/products/workflows/backend/api/test/test_hog_flow.py
@@ -311,10 +311,11 @@ class TestHogFlowAPI(APIBaseTest):
assert flow_conversion["bytecode"] == expected_conversion_bytecode
def test_hog_flow_conversion_event_object_in_filters_is_relocated(self):
- # A client (e.g. MCP) that sends an event-based conversion goal as an object in the property
- # slot must not persist the malformed shape: it is relocated to conversion.events and compiled,
- # and conversion.filters is cleared. Mirrors the one-time backfill in migration 0009. Without
- # this guard the object would fail property-list validation (non-draft) or silently persist.
+ # A client (e.g. an LLM via MCP) that sends an event-based conversion goal as an object in
+ # the property slot must not be rejected by the typed conversion field, nor persist the
+ # malformed shape: it is relocated to conversion.events and compiled, and conversion.filters
+ # is cleared. Mirrors the one-time backfill in migration 0009. Without the relocation the
+ # object would fail array validation with a 400.
event_obj = {
"events": [{"id": "purchase", "name": "purchase", "type": "events", "order": 0}],
"source": "events",
@@ -336,6 +337,21 @@ class TestHogFlowAPI(APIBaseTest):
assert moved["bytecode"], moved
assert "purchase" in moved["bytecode"]
+ def test_hog_flow_conversion_client_supplied_bytecode_is_ignored(self):
+ # Top-level conversion bytecode is read-only: the matcher executes it, so a client must not
+ # be able to persist bytecode that didn't come from server-side compilation of filters.
+ hog_flow, _ = self._create_hog_flow_with_action(
+ {"template_id": "template-webhook", "inputs": {"url": {"value": "https://example.com"}}}
+ )
+ hog_flow["status"] = "active"
+ hog_flow["conversion"] = {"filters": [], "window_minutes": 60, "bytecode": ["_H", 1, 32, "injected"]}
+
+ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
+ assert response.status_code == 201, response.json()
+
+ conversion = response.json()["conversion"]
+ assert conversion["bytecode"] == [], conversion
+
def test_hog_flow_conversion_filters_compiles_bytecode_on_update(self):
expected_conversion_bytecode = [
"_H",
@@ -455,6 +471,37 @@ class TestHogFlowAPI(APIBaseTest):
assert "bytecode" in conditions[0]["filters"], conditions[0]["filters"]
assert conditions[0]["filters"]["bytecode"] == ["_H", 1, 32, "custom_event", 32, "event", 1, 1, 11]
+ def test_hog_flow_wait_until_condition_defaults_missing_condition(self):
+ # An events-only wait omits 'condition'; the FE always seeds it and StepWaitUntilCondition
+ # assumes it, so the serializer defaults it to {filters: None} to keep one canonical shape.
+ wait_action = {
+ "id": "wait_1",
+ "name": "wait_1",
+ "type": "wait_until_condition",
+ "config": {
+ "events": [
+ {"filters": {"events": [{"id": "purchase", "name": "purchase", "type": "events", "order": 0}]}}
+ ],
+ "max_wait_duration": "1h",
+ },
+ }
+ trigger_action = {
+ "id": "trigger_node",
+ "name": "trigger_1",
+ "type": "trigger",
+ "config": {
+ "type": "event",
+ "filters": {"events": [{"id": "$pageview", "name": "$pageview", "type": "events", "order": 0}]},
+ },
+ }
+ hog_flow = {"name": "Test Flow", "actions": [trigger_action, wait_action]}
+
+ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)
+ assert response.status_code == 201, response.json()
+
+ wait = next(a for a in response.json()["actions"] if a["type"] == "wait_until_condition")
+ assert wait["config"]["condition"] == {"filters": None}, wait["config"]
+
def test_hog_flow_conditional_branch_condition_missing_filters_rejected(self):
# A bare {properties: [...]} (no 'filters' wrapper) compiles to always-false; reject it in strict mode.
conditional_action = {
@@ -1226,6 +1273,54 @@ class TestHogFlowAPI(APIBaseTest):
assert response.status_code == 400, response.json()
assert "unknown target action 'ghost'" in str(response.json())
+ def _graph_insert_events_only_wait_ops(self) -> list[dict]:
+ # Splice an events-only wait_until_condition (no 'condition') between action_1 and exit_1, wiring
+ # both its edges: a branch edge at index 0 (resolution) and a continue edge (the timeout path).
+ return [
+ {"op": "remove_edge", "edge": {"from": "action_1", "to": "exit_1", "type": "continue"}},
+ {
+ "op": "add_action",
+ "action": {
+ "id": "wait_1",
+ "name": "Wait for purchase",
+ "type": "wait_until_condition",
+ "config": {
+ "events": [
+ {
+ "filters": {
+ "events": [{"id": "purchase", "name": "purchase", "type": "events", "order": 0}]
+ }
+ }
+ ],
+ "max_wait_duration": "1h",
+ },
+ },
+ },
+ {"op": "add_edge", "edge": {"from": "action_1", "to": "wait_1", "type": "continue"}},
+ {"op": "add_edge", "edge": {"from": "wait_1", "to": "exit_1", "type": "branch", "index": 0}},
+ {"op": "add_edge", "edge": {"from": "wait_1", "to": "exit_1", "type": "continue"}},
+ ]
+
+ def test_graph_events_only_wait_defaults_missing_condition(self):
+ # The /graph patch path is becoming the main MCP edit route and routes through the same validate()
+ # as create/update, so an events-only wait authored there must also get condition defaulted to
+ # {filters: None} (otherwise the visual editor's StepWaitUntilCondition crashes on it).
+ flow_id = self._create_draft_flow_with_graph()
+ response = self._patch_graph(flow_id, self._graph_insert_events_only_wait_ops())
+ assert response.status_code == 200, response.json()
+
+ wait = next(a for a in response.json()["actions"] if a["type"] == "wait_until_condition")
+ assert wait["config"]["condition"] == {"filters": None}, wait["config"]
+
+ def test_graph_wait_without_index_0_branch_rejected(self):
+ # A wait_until_condition wired with only a continue (timeout) edge silently never advances on
+ # resolution; the surgical endpoint rejects it so the agent fixes the missing resolution edge.
+ ops = [op for op in self._graph_insert_events_only_wait_ops() if op.get("edge", {}).get("type") != "branch"]
+ flow_id = self._create_draft_flow_with_graph()
+ response = self._patch_graph(flow_id, ops)
+ assert response.status_code == 400, response.json()
+ assert "missing its resolution edge" in str(response.json())
+
def test_can_call_a_test_invocation(self):
hog_flow, _ = self._create_hog_flow_with_action(
{"template_id": "template-webhook", "inputs": {"url": {"value": "https://example.com"}}}
diff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.ts
index 9c07aae7d7d5..9a8d7f9bbef7 100644
--- a/products/workflows/frontend/generated/api.schemas.ts
+++ b/products/workflows/frontend/generated/api.schemas.ts
@@ -323,6 +323,27 @@ export interface PaginatedHogFlowMinimalListApi {
*/
export type HogFlowApiVariablesItem = { [key: string]: string }
+export interface HogFlowConversionEventApi {
+ /** 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. */
+ filters: HogFunctionFiltersApi
+}
+
+export type HogFlowConversionApiFiltersItem = { [key: string]: unknown }
+
+export interface HogFlowConversionApi {
+ /** 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. */
+ filters?: HogFlowConversionApiFiltersItem[]
+ /** Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]. */
+ events?: HogFlowConversionEventApi[]
+ /**
+ * Conversion window in minutes after a person enters the workflow. null = no explicit window.
+ * @nullable
+ */
+ window_minutes?: number | null
+ /** Compiled server-side from 'filters'. Do not set; ignored if sent. */
+ bytecode?: unknown
+}
+
/**
* * `continue` - continue
* * `branch` - branch
@@ -342,12 +363,36 @@ export interface HogFlowEdgeApi {
* * `continue` - continue
* * `branch` - branch */
type: HogFlowEdgeTypeEnumApi
- /** Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition. */
+ /** 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). */
index?: number
/** Source action id. */
from: string
}
+/**
+ * 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}.
+ */
+export type HogFlowActionApiConfig =
+ | { [key: string]: unknown }
+ | {
+ /** 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. */
+ condition?: {
+ /** Property conditions, e.g. {properties: [{key, value, operator, type}]}. */
+ filters?: HogFunctionFiltersApi | null
+ /** Optional display name. */
+ name?: string
+ }
+ /** Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}. */
+ events?: {
+ /** Event/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped). */
+ filters?: HogFunctionFiltersApi | null
+ /** Optional display name. */
+ name?: string
+ }[]
+ /** '<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay). */
+ max_wait_duration: string
+ }
+
export interface HogFlowActionApi {
/** Unique node ID within the workflow. */
id: string
@@ -374,8 +419,8 @@ export interface HogFlowActionApi {
* @maxLength 100
*/
type: string
- /** 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}. */
- config: unknown
+ /** 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}. */
+ config: HogFlowActionApiConfig
/** Output variable definition for downstream actions. */
output_variable?: unknown
}
@@ -445,8 +490,8 @@ export interface HogFlowApi {
readonly trigger: unknown
/** 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. */
trigger_masking?: HogFlowMaskingApi | null
- /** Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side. */
- conversion?: unknown
+ /** 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. */
+ conversion?: HogFlowConversionApi | null
/** 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').
*
* * `exit_on_conversion` - Conversion
@@ -495,8 +540,8 @@ export interface PatchedHogFlowApi {
readonly trigger?: unknown
/** 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. */
trigger_masking?: HogFlowMaskingApi | null
- /** Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side. */
- conversion?: unknown
+ /** 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. */
+ conversion?: HogFlowConversionApi | null
/** 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').
*
* * `exit_on_conversion` - Conversion
diff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.ts
index 5328fdab1fe0..278757eaeb98 100644
--- a/products/workflows/frontend/generated/api.zod.ts
+++ b/products/workflows/frontend/generated/api.zod.ts
@@ -388,12 +388,16 @@ export const hogFlowsCreateBodyDescriptionDefault = ``
export const hogFlowsCreateBodyTriggerMaskingOneTtlMin = 60
export const hogFlowsCreateBodyTriggerMaskingOneTtlMax = 94608000
+export const hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault = `events`
export const hogFlowsCreateBodyActionsItemNameMax = 400
export const hogFlowsCreateBodyActionsItemDescriptionDefault = ``
export const hogFlowsCreateBodyActionsItemFiltersOneSourceDefault = `events`
export const hogFlowsCreateBodyActionsItemTypeMax = 100
+export 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.'),
@@ -433,10 +437,59 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({
"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
- .unknown()
+ .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: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'
+ '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([
@@ -466,7 +519,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch \/ wait_until_condition."
+ "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.'),
})
@@ -524,9 +577,110 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({
'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'
),
config: zod
- .unknown()
+ .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(
+ 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()
+ .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({
+ 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "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()
@@ -549,12 +703,16 @@ export const hogFlowsUpdateBodyDescriptionDefault = ``
export const hogFlowsUpdateBodyTriggerMaskingOneTtlMin = 60
export const hogFlowsUpdateBodyTriggerMaskingOneTtlMax = 94608000
+export const hogFlowsUpdateBodyConversionOneEventsItemFiltersOneSourceDefault = `events`
export const hogFlowsUpdateBodyActionsItemNameMax = 400
export const hogFlowsUpdateBodyActionsItemDescriptionDefault = ``
export const hogFlowsUpdateBodyActionsItemFiltersOneSourceDefault = `events`
export const hogFlowsUpdateBodyActionsItemTypeMax = 100
+export 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.'),
@@ -594,10 +752,59 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod.object({
"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
- .unknown()
+ .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: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'
+ '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([
@@ -627,7 +834,7 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch \/ wait_until_condition."
+ "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.'),
})
@@ -685,9 +892,110 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod.object({
'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'
),
config: zod
- .unknown()
+ .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(
+ 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()
+ .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({
+ 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "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()
@@ -710,12 +1018,16 @@ export const hogFlowsPartialUpdateBodyDescriptionDefault = ``
export const hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMin = 60
export const hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMax = 94608000
+export const hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault = `events`
export const hogFlowsPartialUpdateBodyActionsItemNameMax = 400
export const hogFlowsPartialUpdateBodyActionsItemDescriptionDefault = ``
export const hogFlowsPartialUpdateBodyActionsItemFiltersOneSourceDefault = `events`
export const hogFlowsPartialUpdateBodyActionsItemTypeMax = 100
+export 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.'),
@@ -755,10 +1067,61 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({
"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
- .unknown()
+ .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: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'
+ '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([
@@ -788,7 +1151,7 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch \/ wait_until_condition."
+ "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.'),
})
@@ -846,9 +1209,110 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({
'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'
),
config: zod
- .unknown()
+ .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({
+ 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "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()
@@ -932,7 +1396,7 @@ export const HogFlowsGraphPartialUpdateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch \/ wait_until_condition."
+ "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.'),
})
@@ -952,7 +1416,7 @@ export const HogFlowsGraphPartialUpdateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch \/ wait_until_condition."
+ "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.'),
})
@@ -983,12 +1447,15 @@ export const hogFlowsInvocationsCreateBodyConfigurationOneCreatedByOneEmailMax =
export const hogFlowsInvocationsCreateBodyConfigurationOneTriggerMaskingOneTtlMin = 60
export const hogFlowsInvocationsCreateBodyConfigurationOneTriggerMaskingOneTtlMax = 94608000
+export const hogFlowsInvocationsCreateBodyConfigurationOneConversionOneEventsItemFiltersOneSourceDefault = `events`
export const hogFlowsInvocationsCreateBodyConfigurationOneActionsItemNameMax = 400
export const hogFlowsInvocationsCreateBodyConfigurationOneActionsItemDescriptionDefault = ``
export const hogFlowsInvocationsCreateBodyConfigurationOneActionsItemFiltersOneSourceDefault = `events`
export const hogFlowsInvocationsCreateBodyConfigurationOneActionsItemTypeMax = 100
+export const hogFlowsInvocationsCreateBodyConfigurationOneActionsItemConfigTwoConditionFiltersOneSourceDefault = `events`
+export const hogFlowsInvocationsCreateBodyConfigurationOneActionsItemConfigTwoEventsItemFiltersOneSourceDefault = `events`
export const hogFlowsInvocationsCreateBodyConfigurationOneSchedulesItemTimezoneMax = 64
export const hogFlowsInvocationsCreateBodyMockAsyncFunctionsDefault = true
@@ -1085,10 +1552,63 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
"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
- .unknown()
+ .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(
+ hogFlowsInvocationsCreateBodyConfigurationOneConversionOneEventsItemFiltersOneSourceDefault
+ ),
+ 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: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'
+ '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([
@@ -1118,7 +1638,7 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch \/ wait_until_condition."
+ "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.'),
})
@@ -1183,9 +1703,120 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({
'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'
),
config: zod
- .unknown()
+ .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(
+ hogFlowsInvocationsCreateBodyConfigurationOneActionsItemConfigTwoConditionFiltersOneSourceDefault
+ ),
+ 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({
+ 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(
+ hogFlowsInvocationsCreateBodyConfigurationOneActionsItemConfigTwoEventsItemFiltersOneSourceDefault
+ ),
+ 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "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()
@@ -1308,12 +1939,16 @@ 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.'),
@@ -1353,10 +1988,61 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({
"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
- .unknown()
+ .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: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion \/ exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'
+ '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([
@@ -1386,7 +2072,7 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch \/ wait_until_condition."
+ "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.'),
})
@@ -1444,9 +2130,110 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod.object({
'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'
),
config: zod
- .unknown()
+ .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(
+ 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()
+ .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({
+ 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "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()
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 5b907d9924c6..55fd122a8cda 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -23297,6 +23297,61 @@ export namespace Schemas {
bytecode?: unknown;
}
+ /**
+ * * `events` - events
+ * * `person-updates` - person-updates
+ * * `data-warehouse-table` - data-warehouse-table
+ */
+ export type HogFunctionFiltersSourceEnum = typeof HogFunctionFiltersSourceEnum[keyof typeof HogFunctionFiltersSourceEnum];
+
+
+ export const HogFunctionFiltersSourceEnum = {
+ Events: 'events',
+ PersonUpdates: 'person-updates',
+ DataWarehouseTable: 'data-warehouse-table',
+ } as const;
+
+ export type HogFunctionFiltersActionsItem = { [key: string]: unknown };
+
+ export type HogFunctionFiltersEventsItem = { [key: string]: unknown };
+
+ export type HogFunctionFiltersDataWarehouseItem = { [key: string]: unknown };
+
+ export type HogFunctionFiltersPropertiesItem = { [key: string]: unknown };
+
+ export interface HogFunctionFilters {
+ source?: HogFunctionFiltersSourceEnum;
+ actions?: HogFunctionFiltersActionsItem[];
+ events?: HogFunctionFiltersEventsItem[];
+ data_warehouse?: HogFunctionFiltersDataWarehouseItem[];
+ properties?: HogFunctionFiltersPropertiesItem[];
+ bytecode?: unknown;
+ transpiled?: unknown;
+ filter_test_accounts?: boolean;
+ bytecode_error?: string;
+ }
+
+ export interface HogFlowConversionEvent {
+ /** 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. */
+ filters: HogFunctionFilters;
+ }
+
+ export type HogFlowConversionFiltersItem = { [key: string]: unknown };
+
+ export interface HogFlowConversion {
+ /** 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. */
+ filters?: HogFlowConversionFiltersItem[];
+ /** Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}]. */
+ events?: HogFlowConversionEvent[];
+ /**
+ * Conversion window in minutes after a person enters the workflow. null = no explicit window.
+ * @nullable
+ */
+ window_minutes?: number | null;
+ /** Compiled server-side from 'filters'. Do not set; ignored if sent. */
+ bytecode?: unknown;
+ }
+
/**
* * `continue` - continue
* * `branch` - branch
@@ -23317,7 +23372,7 @@ export namespace Schemas {
* * `continue` - continue
* * `branch` - branch */
type: HogFlowEdgeTypeEnum;
- /** Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition. */
+ /** 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). */
index?: number;
/** Source action id. */
from: string;
@@ -23336,38 +23391,26 @@ export namespace Schemas {
} as const;
/**
- * * `events` - events
- * * `person-updates` - person-updates
- * * `data-warehouse-table` - data-warehouse-table
+ * 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}.
*/
- export type HogFunctionFiltersSourceEnum = typeof HogFunctionFiltersSourceEnum[keyof typeof HogFunctionFiltersSourceEnum];
-
-
- export const HogFunctionFiltersSourceEnum = {
- Events: 'events',
- PersonUpdates: 'person-updates',
- DataWarehouseTable: 'data-warehouse-table',
- } as const;
-
- export type HogFunctionFiltersActionsItem = { [key: string]: unknown };
-
- export type HogFunctionFiltersEventsItem = { [key: string]: unknown };
-
- export type HogFunctionFiltersDataWarehouseItem = { [key: string]: unknown };
-
- export type HogFunctionFiltersPropertiesItem = { [key: string]: unknown };
-
- export interface HogFunctionFilters {
- source?: HogFunctionFiltersSourceEnum;
- actions?: HogFunctionFiltersActionsItem[];
- events?: HogFunctionFiltersEventsItem[];
- data_warehouse?: HogFunctionFiltersDataWarehouseItem[];
- properties?: HogFunctionFiltersPropertiesItem[];
- bytecode?: unknown;
- transpiled?: unknown;
- filter_test_accounts?: boolean;
- bytecode_error?: string;
- }
+ export type HogFlowActionConfig = { [key: string]: unknown } | {
+ /** 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. */
+ condition?: {
+ /** Property conditions, e.g. {properties: [{key, value, operator, type}]}. */
+ filters?: HogFunctionFilters | null;
+ /** Optional display name. */
+ name?: string;
+ };
+ /** Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}. */
+ events?: ({
+ /** Event/action filters; the workflow wakes when a matching event fires. Must target at least one event or action (entries targeting neither are dropped). */
+ filters?: HogFunctionFilters | null;
+ /** Optional display name. */
+ name?: string;
+ })[];
+ /** '<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay). */
+ max_wait_duration: string;
+ };
export interface HogFlowAction {
/** Unique node ID within the workflow. */
@@ -23395,8 +23438,8 @@ export namespace Schemas {
* @maxLength 100
*/
type: string;
- /** 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}. */
- config: unknown;
+ /** 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}. */
+ config: HogFlowActionConfig;
/** Output variable definition for downstream actions. */
output_variable?: unknown;
}
@@ -23466,8 +23509,8 @@ export namespace Schemas {
readonly trigger: unknown;
/** 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. */
trigger_masking?: HogFlowMasking | null;
- /** Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side. */
- conversion?: unknown;
+ /** 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. */
+ conversion?: HogFlowConversion | null;
/** 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').
*
* * `exit_on_conversion` - Conversion
@@ -35159,8 +35202,8 @@ export namespace Schemas {
readonly trigger?: unknown;
/** 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. */
trigger_masking?: HogFlowMasking | null;
- /** Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side. */
- conversion?: unknown;
+ /** 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. */
+ conversion?: HogFlowConversion | null;
/** 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').
*
* * `exit_on_conversion` - Conversion
diff --git a/services/mcp/src/generated/workflows/api.ts b/services/mcp/src/generated/workflows/api.ts
index 60a3d0bb391d..60208acfb34a 100644
--- a/services/mcp/src/generated/workflows/api.ts
+++ b/services/mcp/src/generated/workflows/api.ts
@@ -43,12 +43,16 @@ export const hogFlowsCreateBodyDescriptionDefault = ``
export const hogFlowsCreateBodyTriggerMaskingOneTtlMin = 60
export const hogFlowsCreateBodyTriggerMaskingOneTtlMax = 94608000
+export const hogFlowsCreateBodyConversionOneEventsItemFiltersOneSourceDefault = `events`
export const hogFlowsCreateBodyActionsItemNameMax = 400
export const hogFlowsCreateBodyActionsItemDescriptionDefault = ``
export const hogFlowsCreateBodyActionsItemFiltersOneSourceDefault = `events`
export const hogFlowsCreateBodyActionsItemTypeMax = 100
+export 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.'),
@@ -88,10 +92,59 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({
"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
- .unknown()
+ .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: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'
+ '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([
@@ -121,7 +174,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition."
+ "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.'),
})
@@ -179,9 +232,110 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod.object({
'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'
),
config: zod
- .unknown()
+ .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(
+ 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()
+ .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({
+ 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "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()
@@ -221,12 +375,16 @@ export const hogFlowsPartialUpdateBodyNameMax = 400
export const hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMin = 60
export const hogFlowsPartialUpdateBodyTriggerMaskingOneTtlMax = 94608000
+export const hogFlowsPartialUpdateBodyConversionOneEventsItemFiltersOneSourceDefault = `events`
export const hogFlowsPartialUpdateBodyActionsItemNameMax = 400
export const hogFlowsPartialUpdateBodyActionsItemDescriptionDefault = ``
export const hogFlowsPartialUpdateBodyActionsItemFiltersOneSourceDefault = `events`
export const hogFlowsPartialUpdateBodyActionsItemTypeMax = 100
+export 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.'),
@@ -259,10 +417,61 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({
"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
- .unknown()
+ .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: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side.'
+ '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([
@@ -292,7 +501,7 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition."
+ "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.'),
})
@@ -350,9 +559,110 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod.object({
'trigger | function | function_email | function_sms | delay | conditional_branch | wait_until_condition | wait_until_time_window | random_cohort_branch | exit.'
),
config: zod
- .unknown()
+ .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({
+ 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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "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()
@@ -436,7 +746,7 @@ export const HogFlowsGraphPartialUpdateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition."
+ "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.'),
})
@@ -456,7 +766,7 @@ export const HogFlowsGraphPartialUpdateBody = /* @__PURE__ */ zod.object({
.number()
.optional()
.describe(
- "Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition."
+ "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.'),
})
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
index afa679631619..7b688c83f911 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json
@@ -6,7 +6,193 @@
"items": {
"properties": {
"config": {
- "description": "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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "anyOf": [
+ {
+ "additionalProperties": {},
+ "description": "Config for every action type except wait_until_condition — see the field description for per-type shapes.",
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "description": "Config for type='wait_until_condition'. Provide 'condition' and/or 'events' — an events-only wait (no condition) is valid.",
+ "properties": {
+ "condition": {
+ "description": "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.",
+ "properties": {
+ "filters": {
+ "anyOf": [
+ {
+ "properties": {
+ "actions": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "bytecode": {},
+ "bytecode_error": {
+ "type": "string"
+ },
+ "data_warehouse": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "events": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "filter_test_accounts": {
+ "type": "boolean"
+ },
+ "properties": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "source": {
+ "default": "events",
+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",
+ "enum": [
+ "events",
+ "person-updates",
+ "data-warehouse-table"
+ ],
+ "type": "string"
+ },
+ "transpiled": {}
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Property conditions, e.g. {properties: [{key, value, operator, type}]}."
+ },
+ "name": {
+ "description": "Optional display name.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "events": {
+ "description": "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}.",
+ "items": {
+ "properties": {
+ "filters": {
+ "anyOf": [
+ {
+ "properties": {
+ "actions": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "bytecode": {},
+ "bytecode_error": {
+ "type": "string"
+ },
+ "data_warehouse": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "events": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "filter_test_accounts": {
+ "type": "boolean"
+ },
+ "properties": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "source": {
+ "default": "events",
+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",
+ "enum": [
+ "events",
+ "person-updates",
+ "data-warehouse-table"
+ ],
+ "type": "string"
+ },
+ "transpiled": {}
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "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": {
+ "description": "Optional display name.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "max_wait_duration": {
+ "description": "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay).",
+ "type": "string"
+ }
+ },
+ "required": ["max_wait_duration"],
+ "type": "object"
+ }
+ ],
+ "description": "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}."
},
"created_at": {
"description": "Created at (epoch ms). Frontend-managed.",
@@ -125,7 +311,112 @@
"type": "array"
},
"conversion": {
- "description": "Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side."
+ "anyOf": [
+ {
+ "properties": {
+ "bytecode": {
+ "description": "Compiled server-side from 'filters'. Do not set; ignored if sent."
+ },
+ "events": {
+ "description": "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}].",
+ "items": {
+ "properties": {
+ "filters": {
+ "description": "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.",
+ "properties": {
+ "actions": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "bytecode": {},
+ "bytecode_error": {
+ "type": "string"
+ },
+ "data_warehouse": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "events": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "filter_test_accounts": {
+ "type": "boolean"
+ },
+ "properties": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "source": {
+ "default": "events",
+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",
+ "enum": ["events", "person-updates", "data-warehouse-table"],
+ "type": "string"
+ },
+ "transpiled": {}
+ },
+ "type": "object"
+ }
+ },
+ "required": ["filters"],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "filters": {
+ "description": "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.",
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "window_minutes": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Conversion window in minutes after a person enters the workflow. null = no explicit window."
+ }
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "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."
},
"description": {
"default": "",
@@ -141,7 +432,7 @@
"type": "string"
},
"index": {
- "description": "Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition.",
+ "description": "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).",
"type": "number"
},
"to": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json
index 25bda88bd4cd..3966e0e19bab 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-update.json
@@ -6,7 +6,193 @@
"items": {
"properties": {
"config": {
- "description": "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}, max_wait_duration: <duration>} (same rules as delay). exit: {reason}."
+ "anyOf": [
+ {
+ "additionalProperties": {},
+ "description": "Config for every action type except wait_until_condition — see the field description for per-type shapes.",
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "description": "Config for type='wait_until_condition'. Provide 'condition' and/or 'events' — an events-only wait (no condition) is valid.",
+ "properties": {
+ "condition": {
+ "description": "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.",
+ "properties": {
+ "filters": {
+ "anyOf": [
+ {
+ "properties": {
+ "actions": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "bytecode": {},
+ "bytecode_error": {
+ "type": "string"
+ },
+ "data_warehouse": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "events": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "filter_test_accounts": {
+ "type": "boolean"
+ },
+ "properties": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "source": {
+ "default": "events",
+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",
+ "enum": [
+ "events",
+ "person-updates",
+ "data-warehouse-table"
+ ],
+ "type": "string"
+ },
+ "transpiled": {}
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Property conditions, e.g. {properties: [{key, value, operator, type}]}."
+ },
+ "name": {
+ "description": "Optional display name.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "events": {
+ "description": "Events to wait for: continues when ANY entry fires (OR'd with 'condition'). Each entry: {filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}.",
+ "items": {
+ "properties": {
+ "filters": {
+ "anyOf": [
+ {
+ "properties": {
+ "actions": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "bytecode": {},
+ "bytecode_error": {
+ "type": "string"
+ },
+ "data_warehouse": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "events": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "filter_test_accounts": {
+ "type": "boolean"
+ },
+ "properties": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "source": {
+ "default": "events",
+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",
+ "enum": [
+ "events",
+ "person-updates",
+ "data-warehouse-table"
+ ],
+ "type": "string"
+ },
+ "transpiled": {}
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "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": {
+ "description": "Optional display name.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "max_wait_duration": {
+ "description": "'<number><unit>' with unit m|h|d, e.g. '30m' (same rules as delay).",
+ "type": "string"
+ }
+ },
+ "required": ["max_wait_duration"],
+ "type": "object"
+ }
+ ],
+ "description": "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}."
},
"created_at": {
"description": "Created at (epoch ms). Frontend-managed.",
@@ -125,7 +311,112 @@
"type": "array"
},
"conversion": {
- "description": "Conversion goal: {filters: [<cond>, ...], window_minutes}. <cond>: {key, value, operator, type: event|person|group}. Empty filters = any event in window. Required for exit_on_conversion / exit_on_trigger_not_matched_or_conversion. bytecode compiled server-side."
+ "anyOf": [
+ {
+ "properties": {
+ "bytecode": {
+ "description": "Compiled server-side from 'filters'. Do not set; ignored if sent."
+ },
+ "events": {
+ "description": "Event-based conversion goals: [{filters: {events: [{id, name, type: 'events'}], ...}}].",
+ "items": {
+ "properties": {
+ "filters": {
+ "description": "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.",
+ "properties": {
+ "actions": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "bytecode": {},
+ "bytecode_error": {
+ "type": "string"
+ },
+ "data_warehouse": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "events": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "filter_test_accounts": {
+ "type": "boolean"
+ },
+ "properties": {
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "source": {
+ "default": "events",
+ "description": "* `events` - events\n* `person-updates` - person-updates\n* `data-warehouse-table` - data-warehouse-table",
+ "enum": ["events", "person-updates", "data-warehouse-table"],
+ "type": "string"
+ },
+ "transpiled": {}
+ },
+ "type": "object"
+ }
+ },
+ "required": ["filters"],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "filters": {
+ "description": "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.",
+ "items": {
+ "additionalProperties": {},
+ "propertyNames": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "window_minutes": {
+ "anyOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Conversion window in minutes after a person enters the workflow. null = no explicit window."
+ }
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "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."
},
"description": {
"description": "Optional description.",
@@ -140,7 +431,7 @@
"type": "string"
},
"index": {
- "description": "Required for type='branch'. Index into config.conditions on conditional_branch / wait_until_condition.",
+ "description": "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).",
"type": "number"
},
"to": {
diff --git a/services/mcp/tests/unit/workflows-config-schema.test.ts b/services/mcp/tests/unit/workflows-config-schema.test.ts
new file mode 100644
index 000000000000..34d1b87fc8a3
--- /dev/null
+++ b/services/mcp/tests/unit/workflows-config-schema.test.ts
@@ -0,0 +1,120 @@
+import { describe, expect, it } from 'vitest'
+
+import { HogFlowsCreateBody } from '@/generated/workflows/api'
+
+// The MCP executor passes the zod-PARSED tool input to handlers, and a matched zod object branch
+// strips keys it doesn't declare. The action config schema is a union with a free-form branch
+// first, so parsing must preserve every config verbatim — the typed wait_until_condition branch
+// is shape guidance only. These tests pin that invariant.
+describe('workflows create schema — action config', () => {
+ const triggerAction = {
+ id: 'trigger_node',
+ name: 'Trigger',
+ type: 'trigger',
+ config: {
+ type: 'event',
+ filters: { events: [{ id: '$pageview', name: '$pageview', type: 'events', order: 0 }] },
+ },
+ }
+
+ it('accepts a wait_until_condition action with events to wait for and preserves config verbatim', () => {
+ const waitConfig = {
+ condition: {
+ filters: { properties: [{ key: 'plan', value: ['growth'], operator: 'exact', type: 'person' }] },
+ name: 'If plan is growth',
+ },
+ events: [
+ {
+ filters: { events: [{ id: 'purchase', name: 'purchase', type: 'events', order: 0 }] },
+ name: 'Purchase happened',
+ },
+ ],
+ max_wait_duration: '30m',
+ // Undeclared key: must survive parsing — proves the free-form union branch wins and
+ // the typed branch never strips.
+ some_future_key: 'must survive',
+ }
+ const result = HogFlowsCreateBody.safeParse({
+ name: 'Wait until workflow',
+ actions: [
+ triggerAction,
+ { id: 'wait_1', name: 'Wait for purchase', type: 'wait_until_condition', config: waitConfig },
+ ],
+ })
+
+ expect(result.success).toBe(true)
+ if (!result.success) {
+ throw new Error(result.error.message)
+ }
+ expect(result.data.actions[1]?.config).toEqual(waitConfig)
+ })
+
+ it('accepts an events-only wait (no condition) and preserves config verbatim', () => {
+ // The runtime supports waits with only events to wait for; 'condition' must not be
+ // schema-required, or agents would be nudged into adding an empty condition to satisfy it.
+ const waitConfig = {
+ events: [
+ {
+ filters: { events: [{ id: 'purchase', name: 'purchase', type: 'events', order: 0 }] },
+ },
+ ],
+ max_wait_duration: '1h',
+ }
+ const result = HogFlowsCreateBody.safeParse({
+ name: 'Events-only wait workflow',
+ actions: [
+ triggerAction,
+ { id: 'wait_1', name: 'Wait for purchase', type: 'wait_until_condition', config: waitConfig },
+ ],
+ })
+
+ expect(result.success).toBe(true)
+ if (!result.success) {
+ throw new Error(result.error.message)
+ }
+ expect(result.data.actions[1]?.config).toEqual(waitConfig)
+ })
+
+ it('accepts an empty condition and preserves it (runtime ignores it, relying on events/timeout)', () => {
+ const waitConfig = {
+ condition: { filters: {} },
+ events: [
+ {
+ filters: { events: [{ id: 'purchase', name: 'purchase', type: 'events', order: 0 }] },
+ },
+ ],
+ max_wait_duration: '30m',
+ }
+ const result = HogFlowsCreateBody.safeParse({
+ name: 'Empty condition wait workflow',
+ actions: [
+ triggerAction,
+ { id: 'wait_1', name: 'Wait for purchase', type: 'wait_until_condition', config: waitConfig },
+ ],
+ })
+
+ expect(result.success).toBe(true)
+ if (!result.success) {
+ throw new Error(result.error.message)
+ }
+ expect(result.data.actions[1]?.config).toEqual(waitConfig)
+ })
+
+ it('preserves other action type configs verbatim', () => {
+ const functionConfig = {
+ template_id: 'template-webhook',
+ inputs: { url: { value: 'https://example.com' } },
+ }
+ const result = HogFlowsCreateBody.safeParse({
+ name: 'Function workflow',
+ actions: [triggerAction, { id: 'fn_1', name: 'Webhook', type: 'function', config: functionConfig }],
+ })
+
+ expect(result.success).toBe(true)
+ if (!result.success) {
+ throw new Error(result.error.message)
+ }
+ expect(result.data.actions[0]?.config).toEqual(triggerAction.config)
+ expect(result.data.actions[1]?.config).toEqual(functionConfig)
+ })
+})