allenheltondev/oncall-agent
GitHub: allenheltondev/oncall-agent
基于 Bun/TypeScript 构建的本地持久化值班 Agent,通过 Teleport 身份授权和 LLM 驱动实现安全可控的事件调查与自动化修复。
Stars: 0 | Forks: 0
# oncall-agent
具备运行时身份和限定权限的本地持久化值班事件响应 Agent。
## 技术栈
- 运行时:**Bun**
- 语言:**TypeScript**
## 快速开始
```
bun install
bun run dev
```
或者使用 Docker Compose:
```
docker compose up --build
```
或者在 devcontainer 中运行:
- 在 VS Code Dev Containers 中打开
- 容器创建时会运行 `bun install`
## 脚本
- `bun run dev` - watch 模式
- `bun run start` - 单次运行
- `bun run cli -- setup` - Momento/Teleport/GitHub/Slack/LLM 的交互式完整配置向导
- `bun run cli -- setup --modules llm,slack` - 仅配置选定模块(支持暂停流程)
- 默认 Momento topic 建议:`oncall-agent..incidents`
- `bun run cli -- setup --non-interactive --env-file .env --config config/identity-map.v1.json ...flags` - CI/脚本化配置
- `bun run cli -- config validate --config config/identity-map.v1.json` - 校验身份映射配置
- `bun run cli -- config llm set --api-key --model gpt-5.3-codex` - 配置 Codex 凭证/模型
- `bun run cli -- config llm show` - 显示当前 LLM 配置(API 密钥已脱敏)
- `bun run cli -- doctor` - 运行连接性/配置就绪检查矩阵
- `bun run cli -- start --config config/identity-map.v1.json` - 启动 Agent 并进行显式配置路径检查
- `bun run typecheck` - TypeScript 类型检查
- `bun test` - 单元测试
- `bun run publish:simulate data/incidents/synthetic.failure.v1.json --dry-run` - 在 dry-run 模式下发送模拟事件
- `bun run publish:simulate data/incidents/synthetic.failure.v1.json --live` - 向真实的 Momento topic 发布模拟事件(需要 `MOMENTO_API_KEY`)
## 环境变量
复制 `.env.example` 并根据需要设置值。
关键变量:
- `MOMENTO_API_KEY`, `MOMENTO_CACHE_NAME`, `MOMENTO_TOPIC_NAME`
- `TELEPORT_PROXY`, `TELEPORT_CLUSTER`, `TELEPORT_AUDIENCE`, `TELEPORT_MOCK_IDENTITY`
- `AWS_REGION`
- `GITHUB_OWNER`, `GITHUB_REPO`
## 初始结构
- `src/agent` - 持久化运行时循环
- `src/publisher` - 事件信号发布器(Momento)
- `src/identity` - Teleport 运行时身份流程
- `src/workflows` - 调查/修复工作流
- `src/types` - 共享契约
- `src/config` - 运行时配置加载与校验
- `docs` - 架构/ADR/运维手册
- `infra` - 基础设施资源
## 架构决策
- ADR-0001:`docs/adr/0001-system-architecture.md`
## 运维文档
- 架构:`docs/architecture-overview.md`
- 信任边界:`docs/trust-boundaries.md`
- 运维手册(Runbook):`docs/ops-runbook.md`
- LLM 编排:`docs/llm-orchestration.md`
- Codex 提供商:`docs/codex-provider.md`
- Momento 实时订阅:`docs/momento-subscription.md`
- Teleport 运行时签发:`docs/teleport-runtime-issuance.md`
- 修复执行:`docs/remediation-execution.md`
- 密钥加固:`docs/security-secrets.md`
- 生产就绪检查清单:`docs/production-readiness-checklist.md`
- 分阶段上线计划:`docs/staged-go-live-plan.md`
- SQLite 存储模式:`docs/sqlite-storage.md`
## 身份映射配置
- 文件:`config/identity-map.v1.json`
- 用途:按环境将 AWS 账户/角色与 GitHub 目标仓库和 Teleport 身份上下文进行配对
标签:Bun, C2, DevContainer, Docker, GitHub集成, LLM集成, Momento, PE 加载器, Slack集成, Teleport, TypeScript, 作用域权限, 值班机器人, 告警分派, 安全插件, 安全防御评估, 持久化运行, 本地代理, 漏洞利用检测, 自动化攻击, 自动化运维, 请求拦截, 运维工具, 运行时身份