openclaw-agent-dashboard 1.0.33 → 1.0.35
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.
- package/dashboard/api/agents.py +29 -3
- package/dashboard/data/timeline_reader.py +410 -301
- package/frontend-dist/assets/index-BkM6T7k-.js +24 -0
- package/frontend-dist/assets/index-CFl9xHR7.css +1 -0
- package/frontend-dist/index.html +2 -2
- package/index.js +490 -104
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/frontend-dist/assets/index-xwKb2VFi.js +0 -24
- package/frontend-dist/assets/index-zZLJo64M.css +0 -1
package/dashboard/api/agents.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Agent API 路由
|
|
3
3
|
"""
|
|
4
|
-
from fastapi import APIRouter
|
|
4
|
+
from fastapi import APIRouter, HTTPException
|
|
5
5
|
from pydantic import BaseModel
|
|
6
6
|
from typing import List, Optional
|
|
7
7
|
import sys
|
|
@@ -51,10 +51,37 @@ async def get_agent(agent_id: str):
|
|
|
51
51
|
agent['lastActiveFormatted'] = format_last_active(agent['lastActiveAt'])
|
|
52
52
|
return agent
|
|
53
53
|
|
|
54
|
-
from fastapi import HTTPException
|
|
55
54
|
raise HTTPException(status_code=404, detail=f"Agent {agent_id} not found")
|
|
56
55
|
|
|
57
56
|
|
|
57
|
+
class TimelineContextResponse(BaseModel):
|
|
58
|
+
"""供「实时执行时序」与 runs.json 对齐:使用最新 run 的 childSessionKey 解析独立会话。"""
|
|
59
|
+
childSessionKey: Optional[str] = None
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@router.get("/agents/{agent_id}/timeline-context", response_model=TimelineContextResponse)
|
|
63
|
+
async def get_agent_timeline_context(agent_id: str):
|
|
64
|
+
"""
|
|
65
|
+
返回该 Agent 在 runs.json 中最近一条 run 的 childSessionKey(若有)。
|
|
66
|
+
前端传给 GET /api/timeline/{agent_id}?session_key= 以命中 sessions.json 指定 jsonl,
|
|
67
|
+
避免仅靠 mtime 选文件或误扫主会话合并路径。
|
|
68
|
+
"""
|
|
69
|
+
from data.config_reader import get_agents_list
|
|
70
|
+
from data.subagent_reader import get_agent_runs
|
|
71
|
+
|
|
72
|
+
agents = get_agents_list()
|
|
73
|
+
if not any(a.get("id") == agent_id for a in agents):
|
|
74
|
+
raise HTTPException(status_code=404, detail=f"Agent {agent_id} not found")
|
|
75
|
+
|
|
76
|
+
runs = get_agent_runs(agent_id, limit=1)
|
|
77
|
+
key = None
|
|
78
|
+
if runs:
|
|
79
|
+
key = runs[0].get("childSessionKey") or None
|
|
80
|
+
if isinstance(key, str) and not key.strip():
|
|
81
|
+
key = None
|
|
82
|
+
return TimelineContextResponse(childSessionKey=key)
|
|
83
|
+
|
|
84
|
+
|
|
58
85
|
@router.get("/agents/{agent_id}/output")
|
|
59
86
|
async def get_agent_output(agent_id: str, limit: int = 50):
|
|
60
87
|
"""
|
|
@@ -66,7 +93,6 @@ async def get_agent_output(agent_id: str, limit: int = 50):
|
|
|
66
93
|
|
|
67
94
|
agents = get_agents_list()
|
|
68
95
|
if not any(a.get('id') == agent_id for a in agents):
|
|
69
|
-
from fastapi import HTTPException
|
|
70
96
|
raise HTTPException(status_code=404, detail=f"Agent {agent_id} not found")
|
|
71
97
|
|
|
72
98
|
turns = get_session_turns(agent_id, limit=limit)
|