commandnet 0.4.0__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commandnet
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: A lightweight, Pydantic-powered, distributed event-driven state machine and typed node graph runtime.
5
5
  Author: Christopher Vaz
6
6
  Author-email: christophervaz160@gmail.com
@@ -11,6 +11,7 @@ class Event(BaseModel):
11
11
  subject_id: str
12
12
  node_name: str
13
13
  payload: Optional[Dict[str, Any]] = None
14
+ headers: Dict[str, str] = Field(default_factory=dict)
14
15
 
15
16
  timestamp: str = Field(default_factory=utcnow_iso)
16
17
  run_at: str = Field(default_factory=utcnow_iso)
@@ -127,6 +127,9 @@ class Engine:
127
127
  duration: float = 0.0,
128
128
  payload: Any = None,
129
129
  ):
130
+ headers = {}
131
+ if hasattr(context, "trace_headers") and context.trace_headers:
132
+ headers = context.trace_headers
130
133
  # 1. Interrupt (Cancellation)
131
134
  if isinstance(target, Interrupt):
132
135
  await self.cancel_subject(target.subject_id, target.hard)
@@ -192,7 +195,8 @@ class Engine:
192
195
  await self.observer.on_transition(subject_id, "RUN", node_name, duration)
193
196
 
194
197
  p_load = payload.model_dump() if hasattr(payload, "model_dump") else payload
195
- evt = Event(subject_id=subject_id, node_name=node_name, payload=p_load)
198
+
199
+ evt = Event(subject_id=subject_id, node_name=node_name, payload=p_load, headers=headers)
196
200
  ctx_dict = self._dump_ctx(context)
197
201
 
198
202
  if "#" in subject_id:
@@ -292,6 +296,7 @@ class Engine:
292
296
  payload=p_load,
293
297
  run_at=run_at_dt.isoformat(),
294
298
  idempotency_key=target.idempotency_key,
299
+ headers=headers,
295
300
  )
296
301
 
297
302
  await self.db.schedule_event(scheduled_evt)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "commandnet"
3
- version = "0.4.0"
3
+ version = "0.4.2"
4
4
  description = "A lightweight, Pydantic-powered, distributed event-driven state machine and typed node graph runtime."
5
5
  authors = [
6
6
  { name = "Christopher Vaz", email = "christophervaz160@gmail.com" }
File without changes