mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-04-28 11:40:47 +00:00
Return LogOutput object and update callers
Introduce a LogOutput dataclass (items, start, end) and change Log.output to return a LogOutput instead of a bare list. Update callers to unwrap items: api_log_get now reads log_output.items, and state_snapshot builds logs and log_end from the LogOutput and uses log_end for log_version. Also re-enable the @extensible decorator on AgentContext.output. These changes expose log metadata (start/end) alongside items for consumers.
This commit is contained in:
parent
8d82979157
commit
2cf73c4b4a
4 changed files with 19 additions and 5 deletions
|
|
@ -224,7 +224,13 @@ async def build_snapshot_from_request(*, request: StateRequestV1) -> SnapshotV1:
|
|||
|
||||
active_context = AgentContext.get(ctxid) if ctxid else None
|
||||
|
||||
logs = active_context.log.output(start=from_no) if active_context else []
|
||||
if active_context:
|
||||
log_output = active_context.log.output(start=from_no)
|
||||
logs = log_output.items
|
||||
log_end = log_output.end
|
||||
else:
|
||||
logs = []
|
||||
log_end = 0
|
||||
|
||||
notification_manager = AgentContext.get_notification_manager()
|
||||
notifications = notification_manager.output(start=notifications_from_no)
|
||||
|
|
@ -290,7 +296,7 @@ async def build_snapshot_from_request(*, request: StateRequestV1) -> SnapshotV1:
|
|||
"tasks": tasks,
|
||||
"logs": logs,
|
||||
"log_guid": active_context.log.guid if active_context else "",
|
||||
"log_version": len(active_context.log.updates) if active_context else 0,
|
||||
"log_version": log_end,
|
||||
"log_progress": active_context.log.progress if active_context else 0,
|
||||
"log_progress_active": bool(active_context.log.progress_active) if active_context else False,
|
||||
"paused": active_context.paused if active_context else False,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue