Skip to content

Commit 7d743f6

Browse files
chore(docs): Batch 1-4 仓库治理——安全脱敏、别名替换、配置修正、API同步、文档修复
Batch 1 (CRITICAL): 生产 IP 随 deployment-record.md 移出至 .ops/,OIDC client ID 脱敏 Batch 2 (HIGH): hk1/hk2/us1/us2 别名全局替换为通用术语,.env.example 变量名修正, config.yaml Redis 端口 6380→6379,dev-start 脚本 Hub 端口修正, dev-up migrate 死代码移除,config.docker.yaml dev-secret 清空, Makefile benchmark/govulncheck 修正 Batch 3 (API): OpenAPI 幽灵端点标记 planned/deprecated,HTTP 方法 PATCH→PUT 修正, 4 个 Hub 路由路径 x-deprecated,events.md 补 9 个未记录事件类型, 标记 planned/defined-not-emitted 事件 Batch 4 (Docs): 5 个死链修复,reference/INDEX.md 标注过期, docs/archive/INDEX.md 补齐编目,项目计数 21→25 统一,孤儿文件编目 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 12b1148 commit 7d743f6

36 files changed

Lines changed: 359 additions & 262 deletions

.env.example

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,29 @@ AGENTHUB_TOKENDANCE_ID_ALLOWED_REDIRECT_URIS=http://127.0.0.1/callback,http://lo
6060
# ─────────────────────────────────────────────
6161

6262
# ── Edge Server ─────────────────────────────
63+
# Listen address (default: 127.0.0.1:3210)
64+
# AGENTHUB_ADDR=127.0.0.1:3210
65+
66+
# Default agent name registered on this edge
67+
# AGENTHUB_AGENT_DEFAULT=claude
68+
69+
# Default model for agents spawned by this edge
70+
# AGENTHUB_AGENT_MODEL=claude-sonnet-4-20250514
71+
72+
# Shared secret for edge-to-hub authentication
73+
# AGENTHUB_EDGE_AUTH_TOKEN=
74+
6375
# Claude Code CLI 路径(Windows 示例)
64-
# CLAUDE_CODE_PATH=C:\Users\<user>\.local\bin\claude.exe
76+
# AGENTHUB_CLAUDE_CODE_PATH=C:\Users\<user>\.local\bin\claude.exe
6577
# macOS/Linux 示例
66-
# CLAUDE_CODE_PATH=/usr/local/bin/claude
78+
# AGENTHUB_CLAUDE_CODE_PATH=/usr/local/bin/claude
6779

6880
# OpenCode CLI 路径
69-
# OPENCODE_PATH=opencode
81+
# AGENTHUB_OPENCODE_PATH=opencode
7082

7183
# Codex CLI 路径
72-
# CODEX_PATH=codex
84+
# AGENTHUB_CODEX_PATH=codex
7385

7486
# ── Desktop ─────────────────────────────────
7587
# VITE_EDGE_URL=http://127.0.0.1:3210
76-
# VITE_HUB_URL=http://127.0.0.1:4210
88+
# VITE_HUB_URL=http://127.0.0.1:8080

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ yarn-error.log*
7878
*.backup
7979
*.sql.gz
8080

81-
# AgentHub deployment state (hk2 production)
81+
# AgentHub deployment state (production)
8282
hub-server/deployments/.env.production
8383
hub-server/deployments/.env
8484
hub-server/deployments/backups/

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test-hub-full:
3030

3131
bench:
3232
cd edge-server && go test -bench=. -benchmem ./internal/events/
33-
cd hub-server && go test -bench=. -benchmem ./internal/middleware/
33+
cd hub-server && go test -bench=. -benchmem ./internal/service/
3434

3535
# ── Lint ─────────────────────────────────────────
3636

@@ -49,8 +49,8 @@ coverage:
4949
sec:
5050
cd edge-server && gosec ./...
5151
cd hub-server && gosec ./...
52-
govulncheck ./edge-server/...
53-
govulncheck ./hub-server/...
52+
cd edge-server && govulncheck ./...
53+
cd hub-server && govulncheck ./...
5454

5555
# ── All checks (CI pipeline) ─────────────────────
5656

api/events.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,34 +110,36 @@ Runner stdout/stderr 不要一行一帧直接刷给 UI。
110110
| type | 阶段 | 说明 |
111111
|---|---|---|
112112
| `project.created` | P0 | 项目创建或注册 |
113-
| `project.updated` | P0 | 项目元数据更新 |
114-
| `conversation.created` | P1 | 会话创建 |
115-
| `conversation.member.added` | P1 | 会话成员加入 |
113+
| `project.updated` | P0 | 项目元数据更新 (planned) |
114+
| `conversation.created` | P1 | 会话创建 (planned) |
115+
| `conversation.member.added` | P1 | 会话成员加入 (planned) |
116116
| `thread.created` | P0 | Thread 创建 |
117117
| `thread.updated` | P0 | Thread 状态或标题更新 |
118-
| `thread.forked` | P1 | Thread 分支创建 |
118+
| `thread.deleted` | P0 | Thread 删除 |
119+
| `thread.forked` | P1 | Thread 分支创建 (planned) |
119120
| `message.created` | P0 | 消息创建 |
120121
| `message.delta` | P0 | Agent 消息流式增量 |
121122
| `item.created` | P0 | Thread Item 创建 |
122-
| `item.updated` | P0 | Thread Item 状态更新 |
123+
| `item.updated` | P0 | Thread Item 状态更新 (planned) |
123124

124125
### Execution / Runtime
125126

126127
| type | 阶段 | 说明 |
127128
|---|---|---|
128-
| `runner.online` | P0 | Runtime/target compatibility event: legacy Runner 在线 |
129-
| `runner.offline` | P0 | Runtime/target compatibility event: legacy Runner 离线 |
129+
| `runner.online` | P0 | Runtime/target compatibility event: legacy Runner 在线 (planned) |
130+
| `runner.offline` | P0 | Runtime/target compatibility event: legacy Runner 离线 (planned) |
130131
| `run.queued` | P0 | AgentRun 已排队 |
131132
| `run.started` | P0 | AgentRun 已启动 |
132-
| `run.output` | P0 | 单条 stdout/stderr 输出 |
133+
| `run.output` | P0 | 单条 stdout/stderr 输出 (planned — 当前仅 `run.output.batch` 已实现) |
133134
| `run.output.batch` | P0 | 批量 stdout/stderr 输出 |
134-
| `run.status.changed` | P0 | AgentRun 状态变化 |
135-
| `approval.requested` | P0 | 请求用户审批 |
136-
| `approval.decided` | P0 | 用户已审批 |
137-
| `artifact.created` | P0 | 产物创建 |
138-
| `artifact.updated` | P1 | 产物元数据更新 |
139-
| `preview.ready` | P0 | 预览可用 |
140-
| `preview.stopped` | P1 | 预览停止 |
135+
| `run.status.changed` | P0 | AgentRun 状态变化 (planned) |
136+
| `run.persistence_error` | P0 | 持久化错误,payload: `{ runId, error }` |
137+
| `approval.requested` | P0 | 请求用户审批 (planned) |
138+
| `approval.decided` | P0 | 用户已审批 (planned) |
139+
| `artifact.created` | P0 | 产物创建 (planned) |
140+
| `artifact.updated` | P1 | 产物元数据更新 (planned) |
141+
| `preview.ready` | P0 | 预览可用 (planned) |
142+
| `preview.stopped` | P1 | 预览停止 (planned) |
141143
| `run.finished` | P0 | AgentRun 正常结束 |
142144
| `run.failed` | P0 | AgentRun 失败 |
143145
| `run.cancelled` | P1 | AgentRun 已取消(已实现,补文档) |
@@ -153,9 +155,16 @@ Runner stdout/stderr 不要一行一帧直接刷给 UI。
153155
| `run.agent.compact_boundary` | P1 | 上下文压缩边界 |
154156
| `run.agent.api_retry` | P1 | API 重试通知 |
155157
| `run.agent.task_started` | P1 | 子代理任务启动 |
158+
| `run.agent.task_dispatched` | P1 | 子代理任务已派发 |
156159
| `run.agent.task_progress` | P1 | 子代理任务进度 |
157160
| `run.agent.task_notification` | P1 | 子代理任务完成/失败 |
161+
| `run.agent.sub_agents_complete` | P1 | 所有子代理执行完毕,payload: `{ parentId, childCount, allComplete }` |
158162
| `run.agent.session_state_changed` | P1 | 会话状态变更(idle/running/requires_action) |
163+
| `run.agent.status_change` | P1 | Agent 适配器状态变更 |
164+
| `run.agent.session_metrics` | P1 | 会话度量信息 |
165+
| `run.agent.context_usage` | P1 | 上下文使用量报告 |
166+
| `run.agent.context_warning` | P1 | 上下文容量警告 |
167+
| `run.agent.context_compaction` | P1 | 上下文压缩通知 |
159168
| `run.agent.hook_started` | P1 | Hook 执行开始 |
160169
| `run.agent.hook_progress` | P1 | Hook 执行输出 |
161170
| `run.agent.hook_response` | P1 | Hook 执行完成 |
@@ -294,11 +303,11 @@ Hub 使用扁平帧格式(与 Edge 的 EventEnvelope 不同):
294303

295304
| type | 说明 |
296305
|------|------|
297-
| `session.created` | 会话创建,payload: `{ session_id, type, name, owner_id, members[] }` |
298-
| `session.dissolved` | 群解散,payload: `{ session_id }` |
299-
| `session.member_joined` | 成员加入,payload: `{ session_id, member_id, member_type }` |
300-
| `session.member_left` | 成员离开,payload: `{ session_id, member_id }` |
301-
| `session.info_updated` | 会话信息变更,payload: `{ session_id, changes{} }` |
306+
| `session.created` | 会话创建 (defined, not yet emitted),payload: `{ session_id, type, name, owner_id, members[] }` |
307+
| `session.dissolved` | 群解散 (defined, not yet emitted),payload: `{ session_id }` |
308+
| `session.member_joined` | 成员加入 (defined, not yet emitted),payload: `{ session_id, member_id, member_type }` |
309+
| `session.member_left` | 成员离开 (defined, not yet emitted),payload: `{ session_id, member_id }` |
310+
| `session.info_updated` | 会话信息变更 (defined, not yet emitted),payload: `{ session_id, changes{} }` |
302311

303312
#### Device 事件(Hub→Client)
304313

api/openapi.yaml

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ servers:
3030
- url: http://localhost:8080
3131
description: Local Hub Server
3232
- url: http://api.hub.vectorcontrol.tech
33-
description: Production Hub Server (hk2)
33+
description: Production Hub Server
3434
tags:
3535
- name: Foundation
3636
description: Health, capability and event stream handshake.
@@ -42,6 +42,44 @@ tags:
4242
description: Auth, user, contact, group, device, edge, sync, relay and cloud APIs.
4343

4444
paths:
45+
# ═══════════════════════════════════════════════════════════
46+
# Edge Server — Implementation Status
47+
#
48+
# IMPLEMENTED: /v1/health, /v1/events, /v1/projects (GET/POST),
49+
# /v1/projects/{projectId} (GET only), /v1/threads (GET/POST),
50+
# /v1/threads/{threadId} (GET/PATCH/DELETE), /v1/threads/{threadId}/items,
51+
# /v1/threads/{threadId}/messages, /v1/items/{itemId},
52+
# /v1/runners (GET only), /v1/agents, /v1/runs (GET/POST),
53+
# /v1/runs/{runId} (GET), /v1/runs/{runId}:cancel,
54+
# /v1/metrics, /v1/agent-instances (GET only),
55+
# /v1/permissions/decide
56+
#
57+
# PLANNED (documented but not yet implemented):
58+
# PATCH/DELETE /v1/projects/{projectId},
59+
# GET/PATCH /v1/projects/{projectId}/memory,
60+
# GET/POST /v1/conversations,
61+
# GET/PATCH /v1/conversations/{conversationId},
62+
# POST /v1/conversations/{conversationId}:archive,
63+
# GET/POST /v1/conversations/{conversationId}/members,
64+
# DELETE /v1/conversations/{conversationId}/members/{memberId},
65+
# POST /v1/threads/{threadId}:archive,
66+
# POST /v1/threads/{threadId}:fork,
67+
# GET /v1/runners/{runnerId},
68+
# POST /v1/runners/{runnerId}:ping,
69+
# POST /v1/runners/{runnerId}:drain,
70+
# POST /v1/runs/{runId}:interrupt,
71+
# POST /v1/runs/{runId}:resume,
72+
# POST /v1/runs/{runId}:retry,
73+
# GET /v1/runs/{runId}/items,
74+
# GET /v1/runs/{runId}/logs,
75+
# GET /v1/runs/{runId}/diff,
76+
# GET/POST /v1/approvals and nested,
77+
# GET/POST /v1/artifacts and nested,
78+
# GET/POST /v1/previews and nested,
79+
# GET /v1/workspaces/{workspaceId} and nested,
80+
# POST /v1/agent-instances
81+
# ═══════════════════════════════════════════════════════════
82+
4583
/v1/health:
4684
get:
4785
tags: [Foundation]
@@ -1319,7 +1357,7 @@ paths:
13191357
$ref: "#/components/responses/Ok"
13201358

13211359
/client/contacts/{userId}/remark:
1322-
patch:
1360+
put:
13231361
tags: [HubSyncRelay]
13241362
operationId: hubUpdateRemark
13251363
summary: Update contact remark.
@@ -1594,6 +1632,8 @@ paths:
15941632
tags: [HubSyncRelay]
15951633
operationId: hubRecallMessage
15961634
summary: Recall (delete) a message.
1635+
x-deprecated: true
1636+
description: Deprecated session-scoped path. Use `POST /client/messages/{id}:recall` instead.
15971637
x-agenthub-status: implemented
15981638
x-agenthub-owner: Hub
15991639
security: [{ bearerAuth: [] }]
@@ -1612,6 +1652,8 @@ paths:
16121652
tags: [HubSyncRelay]
16131653
operationId: hubPinMessage
16141654
summary: Pin a message.
1655+
x-deprecated: true
1656+
description: Deprecated session-scoped path. Use `POST /client/messages/{id}:pin` instead.
16151657
x-agenthub-status: implemented
16161658
x-agenthub-owner: Hub
16171659
security: [{ bearerAuth: [] }]
@@ -1630,6 +1672,8 @@ paths:
16301672
tags: [HubSyncRelay]
16311673
operationId: hubUnpinMessage
16321674
summary: Unpin a message.
1675+
x-deprecated: true
1676+
description: Deprecated session-scoped path. Use `DELETE /client/messages/{id}/pin` instead.
16331677
x-agenthub-status: implemented
16341678
x-agenthub-owner: Hub
16351679
security: [{ bearerAuth: [] }]
@@ -1648,6 +1692,8 @@ paths:
16481692
tags: [HubSyncRelay]
16491693
operationId: hubMarkMessageRead
16501694
summary: Mark a message as read.
1695+
x-deprecated: true
1696+
description: Deprecated. No corresponding route exists in Hub router.
16511697
x-agenthub-status: implemented
16521698
x-agenthub-owner: Hub
16531699
security: [{ bearerAuth: [] }]
@@ -1950,7 +1996,7 @@ paths:
19501996
responses:
19511997
"200":
19521998
$ref: "#/components/responses/Ok"
1953-
patch:
1999+
put:
19542000
tags: [HubSyncRelay]
19552001
operationId: hubUpdateCustomAgent
19562002
summary: Update a custom agent.
@@ -4143,8 +4189,7 @@ components:
41434189
device_id:
41444190
type: string
41454191
format: uuid
4146-
description: Bound Hub desktop device id. Current target-bound dispatch requires an owner-owned desktop device; remote/cloud routing remains future work.
4147-
description: Stable Hub device UUID; must match the callback request.
4192+
description: Stable Hub device UUID; must match the callback request. Current target-bound dispatch requires an owner-owned desktop device; remote/cloud routing remains future work.
41484193
redirect_uri:
41494194
type: string
41504195
format: uri

app/web/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,4 @@ git diff --check
114114
- 根入口:[../../README.md](../../README.md)
115115
- API 契约:[../../api/README.md](../../api/README.md)
116116
- Shared 包:[../shared/README.md](../shared/README.md)
117-
- 系统架构:[../../docs/system-architecture.md](../../docs/system-architecture.md)
117+
- 系统架构:[../../docs/architecture/system-architecture.md](../../docs/architecture/system-architecture.md)

docs/architecture/implementation-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ version / id / seq / type / scope / sentAt / payload
242242
- Agent 生成的代码由对应开发者负责审查、测试和解释。
243243
- 首次克隆后运行 `.\scripts\setup.ps1` 启用本地 hooks;需要参考仓库时运行 `.\scripts\setup.ps1 -Reference core`
244244
- 并行开发使用 `.worktrees/`,具体规则见 `AGENTS.md`
245-
- 客户端后续以 `docs/roadmap.md``docs/roadmaps/client.md``docs/handoff/STATE.md` 为当前入口;`docs/operations/client-roadmap.md` 仅保留为客户端方向轻量索引,`docs/operations/client-handoff.md` 是历史快照,不作为默认接手指南。
245+
- 客户端后续以 `docs/roadmap.md``docs/roadmaps/client.md``docs/handoff/STATE.md` 为当前入口;`docs/operations/client-roadmap.md` 仅保留为客户端方向轻量索引,`docs/archive/client-handoff.md` 是历史快照,不作为默认接手指南。
246246

247247
PR 说明按影响选择填写:
248248

docs/archive/INDEX.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
| `client-handoff.md` | 历史交接 | 2026-05-22 历史快照,引用已废弃的 `runner/` 目录、旧分支名 `feat/client-dev`、旧 PR #26。当前客户端接手入口为 `docs/handoff/STATE.md`|
5656
| `desktop-shell-layout-progress-2026-05-25.md` | 进度记录 | Desktop shell 布局进度快照。已完成项已合入 `docs/roadmap.md` batch B,8 项后续 TODO 已提取到群聊评论。 |
5757
| `PLAN-adapt-trump-ui.md` | 历史计划 |`worktree-adapt-trump-ui` 工作计划。涉及从 Trump 5 页面 UI 提取共享组件、工程规范、测试框架和 WebUI 集成。相关代号已过期,当前以主文档、roadmap 和 handoff 状态为准。 |
58+
| `RESEARCH-SUMMARY-2026-05-24.md` | 研究交付 | 研究交付封面备忘录,汇总调研成果和参考来源。 |
59+
| `desktop-frontend-handoff.md` | 历史交接 | React 渲染循环修复交接文档,记录无限重渲染根因和修复方案。 |
60+
| `branches/` | 历史归档 | 历史分支归档(14 个文件),包含已合入或废弃的功能分支快照。 |
61+
| `review-archive/` | 审计归档 | 已归档的代码审查报告。 |
5862

5963
### 可参考原则 - 需要按新术语重解释
6064

docs/archive/build-specs/backend/01-protocol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ type DiffArtifact struct {
627627
Additions int `json:"additions"`
628628
Deletions int `json:"deletions"`
629629
FileDiffs []FileDiff `json:"fileDiffs"`
630-
AgentID string `json:"agentId"` // 参考 cross-analysis-im-ux.md:"Generated by [Edge:us1] Claude"
630+
AgentID string `json:"agentId"` // 参考 cross-analysis-im-ux.md:"Generated by [Edge:edge-01] Claude"
631631
ToolCallID string `json:"toolCallId"` // 参考 cross-analysis-im-ux.md:追溯到 tool_use
632632
CanApply bool `json:"canApply"` // 参考 cross-analysis-sandbox-tools.md:WorkspaceProvider.ApplyPatch
633633
CanDiscard bool `json:"canDiscard"` // 参考 cross-analysis-sandbox-tools.md:WorkspaceProvider.Discard

docs/archive/build-specs/backend/07-observability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func NewLogger(format string, level slog.Level, attrs ...slog.Attr) *slog.Logger
7070

7171
**生产 JSON**
7272
```json
73-
{"time":"2026-05-21T10:00:00.000Z","level":"INFO","msg":"run started","run_id":"abc123","agent":"claude-code","model":"claude-sonnet-4-6","service":"runner","edge_id":"us1"}
73+
{"time":"2026-05-21T10:00:00.000Z","level":"INFO","msg":"run started","run_id":"abc123","agent":"claude-code","model":"claude-sonnet-4-6","service":"runner","edge_id":"edge-01"}
7474
```
7575

7676
**本地 Text**

0 commit comments

Comments
 (0)