@@ -77,6 +77,23 @@ class SerializationContext(ABC):
7777 pass
7878
7979
80+ @dataclass (frozen = True )
81+ class WorkflowSerializationContext (SerializationContext ):
82+ """Serialization context for workflows.
83+
84+ Attributes:
85+ workflow_id: The workflow ID.
86+ run_id: The workflow run ID.
87+ workflow_type: The type/name of the workflow.
88+ task_queue: The task queue the workflow is running on.
89+ namespace: The namespace the workflow is running in.
90+ attempt: The current workflow task attempt number (starting from 1).
91+ """
92+
93+ namespace : str
94+ workflow_id : str
95+
96+
8097@dataclass (frozen = True )
8198class ActivitySerializationContext (SerializationContext ):
8299 """Serialization context for activities.
@@ -97,20 +114,9 @@ class ActivitySerializationContext(SerializationContext):
97114
98115
99116@dataclass (frozen = True )
100- class WorkflowSerializationContext (SerializationContext ):
101- """Serialization context for workflows.
102-
103- Attributes:
104- workflow_id: The workflow ID.
105- run_id: The workflow run ID.
106- workflow_type: The type/name of the workflow.
107- task_queue: The task queue the workflow is running on.
108- namespace: The namespace the workflow is running in.
109- attempt: The current workflow task attempt number (starting from 1).
110- """
111-
112- namespace : str
113- workflow_id : str
117+ class NexusOperationSerializationContext (SerializationContext ):
118+ service : str
119+ operation : str
114120
115121
116122class WithSerializationContext (ABC ):
@@ -121,7 +127,16 @@ class WithSerializationContext(ABC):
121127 during serialization and deserialization.
122128 """
123129
124- @abstractmethod
130+ operation : str
131+ service : str
132+ endpoint : str
133+ request_id : str
134+ workflow_task_completed_event_id : int
135+ endpoint_id : str
136+ schedule_to_close_timeout : timedelta
137+ cancellation_type : temporalio .workflow .NexusOperationCancellationType
138+ headers : Mapping [str , str ]
139+
125140 def with_context (self , context : Optional [SerializationContext ]) -> Self :
126141 """Return a copy of this object configured to use the given context.
127142
0 commit comments