mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-20 19:46:16 +00:00
* feat(runtime): persist tool-progress phase transitions Record bounded warn, block, and recover decisions for lead and task subagent runs while preserving event-loop isolation, fail-open behavior, and concurrent transition order. * fix(runtime): trust server-owned tool progress attribution * fix(runtime): centralize trusted audit attribution * fix(runtime): preserve complete tool progress audit state * docs: trim tool progress guidance to pass size check * fix(runtime): fence subagent audit recorder loop * docs(readme): sync tool-progress event coverage Signed-off-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com> --------- Signed-off-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com> Co-authored-by: PeaceMaker-best <221849497+PeaceMaker-best@users.noreply.github.com> Co-authored-by: 嗜鵼 <hy2010hy2010@qq.com> Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
"""Private runtime-context helpers for narrowly scoped audit recorders."""
|
|
|
|
from typing import Any
|
|
|
|
LOOP_DETECTION_RECORDER_CONTEXT_KEY = "__run_loop_detection_recorder"
|
|
TOOL_PROMOTION_RECORDER_CONTEXT_KEY = "__run_tool_promotion_recorder"
|
|
TOOL_PROGRESS_RECORDER_CONTEXT_KEY = "__run_tool_progress_recorder"
|
|
|
|
|
|
def resolve_audit_recorder(
|
|
context: object,
|
|
*,
|
|
recorder_key: str,
|
|
) -> tuple[Any | None, bool, str | None]:
|
|
"""Resolve a recorder and trusted lead/subagent attribution.
|
|
|
|
Ordinary lead runs own ``__run_journal``. Task-tool subagents receive only
|
|
a server-installed narrow recorder, so its presence is the authority for
|
|
subagent attribution; caller-supplied ``is_subagent`` is never consulted.
|
|
"""
|
|
if not isinstance(context, dict):
|
|
return None, False, None
|
|
|
|
recorder = context.get(recorder_key)
|
|
if recorder is not None:
|
|
agent_id = context.get("agent_id")
|
|
return recorder, True, agent_id if isinstance(agent_id, str) else None
|
|
|
|
return context.get("__run_journal"), False, None
|