MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / flow_attr_push

Method flow_attr_push

masfactory/visualizer/runtime.py:539–580  ·  view source on GitHub ↗

Record an attribute-push flow event. Args: node: Node performing the push. scope: Optional scope label. changes: Pushed key/value changes. total_keys: Total number of keys pushed when only a subset is included. truncated: Whether v

(
        self,
        node: object,
        *,
        scope: str | None = None,
        changes: dict[str, object] | None = None,
        total_keys: int | None = None,
        truncated: bool = False,
    )

Source from the content-addressed store, hash-verified

537 self._record_history(payload)
538
539 def flow_attr_push(
540 self,
541 node: object,
542 *,
543 scope: str | None = None,
544 changes: dict[str, object] | None = None,
545 total_keys: int | None = None,
546 truncated: bool = False,
547 ) -> None:
548 """Record an attribute-push flow event.
549
550 Args:
551 node: Node performing the push.
552 scope: Optional scope label.
553 changes: Pushed key/value changes.
554 total_keys: Total number of keys pushed when only a subset is included.
555 truncated: Whether values were truncated for transport/history bounds.
556 """
557 node_id = self._resolve_node_id(node)
558 if not node_id:
559 return
560 if not changes:
561 return
562
563 payload: dict[str, object] = {
564 "type": "FLOW",
565 "kind": "ATTR_PUSH",
566 "ts": _now_ms(),
567 "node": node_id,
568 "changes": self._safe_for_history(changes),
569 }
570 if scope:
571 payload["scope"] = scope
572 if isinstance(total_keys, int) and total_keys >= 0:
573 payload["totalKeys"] = total_keys
574 if truncated:
575 payload["truncated"] = True
576
577 if self.is_streaming():
578 self._enqueue(payload)
579 else:
580 self._record_history(payload)
581
582 def log(self, level: str, message: str) -> None:
583 payload = {

Callers

nothing calls this directly

Calls 6

_resolve_node_idMethod · 0.95
_safe_for_historyMethod · 0.95
is_streamingMethod · 0.95
_enqueueMethod · 0.95
_record_historyMethod · 0.95
_now_msFunction · 0.85

Tested by

no test coverage detected