Repository navigation
docs: split and rewrite the server API reference - #4841
Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e92cc712ce
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45163e33ee
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
45163e3 to
6ebacde
Compare
* fix(agent-core-v2): truncate oversized skill content (#4834) * fix(kap-server): bind the main agent when a session is created (#4839) * fix(kap-server): bind the main agent when a session is created * fix(kap-server): reject a profile on prompt submissions * fix(kap-server): reject a profile change through the session profile * fix(kap-server): wait for model configuration before binding a new session * fix(agent-core-v2): deduplicate restored task notifications (#4836) * fix(agent-core-v2): deduplicate restored task notifications * chore: add notification replay fix changeset * fix(agent-core-v2): preserve task notifications after prompt-only crashes * fix(agent-core-v2): complete prompts before ending turns * test: align lifecycle snapshots with prompt completion order * fix(agent-core-v2): settle all prompts during turn finalization * fix(kap-server): drop reserved metadata keys from session profile updates (#4842) * fix(kap-server): drop reserved metadata keys from session profile updates * fix(kap-server): keep stored reserved metadata keys on profile updates * docs: split and rewrite the server API reference (#4841) * docs: split and rewrite the server API reference * docs: redirect old server API anchors to the split pages * docs: describe profile metadata as a replacement * docs: mark question responses as answered-only * fix(kap-server): avoid heartbeat timeout after scheduling stalls (#4823) * fix(kap-server): avoid heartbeat timeout reaping after stalls or clock jumps * fix(kap-server): grace heartbeat window for short scheduling stalls * fix(kap-server): treat only clearly late heartbeats as scheduling stalls * fix(kap-server): time heartbeats on a monotonic clock and drain queued input before reaping --------- Co-authored-by: Kimi Code (Grok Bot) <[email protected]> * fix(kap-server): undo a turn only once when requests race (#4846) * docs: describe heartbeat stall handling (#4849) * docs: describe heartbeat stall handling * docs: explain the monotonic clock in the heartbeat notes * fix(agent-core-v2): acquire session lock before loop restoration (#4848) * fix(agent-core-v2): acquire session lock before loop restoration * chore: add session lock lifecycle changeset * fix(agent-core-v2): hold session lock through loop restoration - add an operation-scoped lease to the session run gate - hold it across loop initialization, reset, and pending drains - cover idle timeout and release ordering * fix(agent-core-v2): keep the output of stopped tool calls (#4854) * fix(kap-server): drop the partial reply of a retried step (#4855) * fix(agent-core-v2): dedupe historical tool schemas (#4862) * fix(agent-core-v2): dedupe historical tool schemas * chore: add duplicate tool schema changeset * fix(agent-core-v2): preserve first tool schema declaration * fix(agent-core-v2): remind on changed tool schemas * fix(agent-core-v2): block stale tool schema calls * fix(agent-core-v2): normalize registry schemas in pending checks * fix(agent-core-v2): import registry tool metadata type * fix(agent-core-v2): preserve abort handling during validation * fix(agent-core-v2): refine validation hook preparation * fix(agent-core-v2): make validation hooks synchronous * fix(agent-core-v2): preserve tool result notes on fork (#4867) * fix(agent-core-v2): preserve tool result notes on fork * chore: add fork tool result note changeset * fix(agent-core-v2): scope tool result note restoration to forks * fix(agent-core-v2): normalize inherited tool result notes * fix(agent-core-v2): isolate fork note restoration * feat(tui): sweep running titles toward text and add KIMI_CODE_TUI_ANIMATION_FPS (#4843) (#4870) * chore: sync web dist from code-app (#4871) code-app: 8ab17294e031323186d357d121c5360b8353900e Co-authored-by: kimi-agent-bot <[email protected]> * ci: release packages (#4835) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * chore: sync web dist from code-app code-app: 5835391dac3a2b9e0c65ffbd418f0d6042a7adb2 --------- Co-authored-by: Haozhe <[email protected]> Co-authored-by: qer <[email protected]> Co-authored-by: Kimi Code (Grok Bot) <[email protected]> Co-authored-by: grapedge <[email protected]> Co-authored-by: kimi-agent-bot <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Requirement or Bug
服务 API 文档(
docs/{zh,en}/reference/server-api.md)是一个 2500 行的单页,170 多个标题,客户端最需要的 WebSocket 协议压在页尾,几种帧的字段挤在单个长段落里,基本不可读;并且有多处说法和当前实现不一致。这个 PR 把它拆成一组页面重写,内容以当前实现为准,作为这一版对外发布的服务 API 文档。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
页面结构(中英文镜像,导航挂在参考手册「服务 API【测试版】」下):
docs/{zh,en}/reference/ -└── server-api.md # 一页包含全部内容 +├── server-api.md # 概览:地址、鉴权、信封、错误码、分页、入门流程、各页入口 +├── server-api-conversation.md # 会话与对话:WebSocket 协议和客户端流程 +├── server-api-sessions.md # 会话接口:/api/v1/sessions 下的 REST 接口和 /api/v2/sessions +├── server-api-service.md # 服务与配置接口:登录、远程控制、配置、模型、插件、工作区、上传、搜索、/api/v2/mcp +└── server-api-files.md # 文件接口:会话、工作区、本机文件,以及二进制与流式端点「会话与对话」是新写的客户端协议指南,按客户端的使用顺序组织:连接与心跳、订阅会话(含订阅后的帧序)、帧的投递范围和顺序、轮次与条目、实时更新的处理规则、提交输入(开始还是排队、幂等、插话)、停止 / 撤销 / 压缩、审批与提问、任务、Agent 状态、断线恢复、全局事件。三个参考页沿用原文的接口说明,改成统一格式:一句话说明、参数表、三个以上字段的响应用表格、错误码列表放最后。
写法上:短句、一段一件事;不用破折号串补充说明;字段说明进表格;术语按
docs/AGENTS.md统一(Skill、main agent、subagent、轮次等)。按当前实现修正的内容
每一条都对照了
packages/kap-server和packages/agent-core-v2的代码。主要的:task.list和状态帧 →turns(异步,可能晚于实时状态帧);对话帧不会早于turns。:reload后订阅仍有效且会重发turns、会话归档或删除时订阅被移除、帧的发送顺序保证、usage按 250 毫秒合并、prompt_id幂等的细节、插话的可用条件、停止一轮后队列里的输入会继续、多客户端回应同一交互(40902/40404)、任务输出的续传合并规则、重连后应丢弃本地轮次等。event.session.deleted、event.config.warning、event.plugin.changed、event.capability.changed和各事件的 payload;删掉服务端并不发出的event.session.status_changed;删掉「目前没有会话删除事件」。prompts/{prompt_id}:abort删掉不存在的40903(已结束或不存在时返回40402);:abort无论是否在运行都返回{ aborted: true }。:compact删掉不存在的compaction.*帧,改为客户端实际看到的agent.compacting、system轮次和compaction.cancelled通知;目标接口的goal.updated同理改为goal帧。metadata和swarm_mode会生效(原文说不生效);设置的应用顺序和生效时机写清楚。:delete、创建会话的environment_id/environment_cwd、profile 的tower_mode/tower_base、目标的预算字段、供应商的api_key_env、:import_registry的credential_env、能力安装的stopRunningProcesses、文件条目的is_directory、会话fs:list/fs:read的allow_external_symlinks等;删掉 schema 声明了但实现从不返回的文件条目字段(git_status等)。metadata是整体替换,不是原文说的「合并」;保留键被忽略、已存的值保留这一句对应 fix(kap-server): drop reserved metadata keys from session profile updates #4842 的修复。untrust接口后面从别处复制残留的错误码。/api/v2/mcp的cwd位置、shutdown路由的挂载条件、插件市场按平台过滤的规则、:refresh_oauth只刷新managed:kimi-code等描述按代码改准。删掉或合并的内容
没有删除事实,只合并了重复:
POST /api/v1/config请求体参数表和GET响应表逐字段重复,改为链接,只单列请求体特有的两条规则。40001/40401、工作区文件接口共有的40001/40410,合并到「共同规则」。/api/v2/sessions:archive与:restore、v2 MCP 的 CRUD 和 OAuth 接口)拆成每个接口一节,共用的错误码按适用范围分到各接口。其他
#post-apiv1sessions...风格)在 VitePress 下本来就打不开,全部改为 VitePress 实际生成的锚点;config-files.md里指向这一页和另外两处坏掉的锚点一并修正。docs/.vitepress/theme/serverApiLegacyAnchors.ts,映射表由旧页面的全部标题生成,改名和拆分的章节手动对应)。docs/AGENTS.md默认不改 H1 和导航标签)。从
docs/zh/reference/server-api-conversation.md开始读。Behavior Changes and Affected Users
None。只改文档和文档站导航,产物代码未改动。
对文档读者的影响:原来指向
server-api.md#某个接口或某个章节的书签和外部链接,会自动跳转到子页面的新位置;仓库内所有指向这一页的链接都已更新,并用和 VitePress 相同的锚点规则逐个校验。vitepress build通过。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.