feat: 跨主机 agent 日志实时上报 (issue #18) - #21
Merged
Merged
Conversation
Add POST /api/ingest endpoint and run.sh upload hook so agents running on any machine can stream their JSONL events to the deployed dashboard in real time. - ui/server/src/routes/ingest.ts: new endpoint. Validates Bearer token (KIP_INGEST_TOKEN env var, optional), checks agent/runId are safe path segments, writes events to agents/<agent>/logs/<runId>/absorber.jsonl and maintains meta.json (creates on first event, updates completedAt and status on session_end). No extra WebSocket wiring needed — the existing fs.watch in logs.ts detects the appended bytes and pushes them to connected clients automatically. - ui/server/src/index.ts: register ingest route. - agents/blueprint-absorber/run.sh: add ingest() inside the inline Python log-parser. Reads KIP_INGEST_URL / KIP_INGEST_TOKEN from env; if KIP_INGEST_URL is unset the function is a no-op so local-only mode is unchanged. Fire-and-forget with 3s timeout — failures are silently ignored and never block the agent. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Owner
|
这个写的是只针对于absorber的,还会有其他的agent负责不同的环节。我们后面把其他流程的agent都做好了,再合并这个pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 issue:#18
完成了什么
让不同机器上跑的 agent,日志能实时汇聚到部署在服务器上的 dashboard,不需要登录工作机也能监控运行进度。
改动说明
ui/server/src/routes/ingest.ts(新文件)新增
POST /api/ingest端点:KIP_INGEST_TOKEN环境变量)agents/<agent>/logs/<runId>/目录和meta.jsonsession_endevent 时更新 meta.json 的completedAt和statusabsorber.jsonllogs.ts里已有的fs.watch检测到新字节后会自动推送给前端agents/blueprint-absorber/run.sh在 Python 内联日志解析脚本的
emit()函数末尾加了ingest(row)调用:KIP_INGEST_URL/KIP_INGEST_TOKEN环境变量KIP_INGEST_URL时为 no-op,本地模式完全不受影响工作机使用方式
验证