Skip to content

完善 Channel registration runtime-config API 并新增后台配置页面 #3617

Description

@louis4li

背景

当前 feature/integrate 已经具备 channel registration 的基础能力,不需要再新增一套 Channel Agent Config CRUD:

  • GET /api/channels/me
  • POST /api/channels/registrations
  • GET /api/channels/registrations
  • GET /api/channels/registrations/{registrationId}/status
  • POST /api/channels/registrations/{registrationId}/runtime-config
  • workflow result delivery repair、test-reply、delete 等已有操作
  • ChannelBotRuntimeConfig 已经进入 registration 的 command、event、projection/read model,并被 channel conversation 使用

本需求是在现有 registration/runtime-config 链路上补齐管理能力,并新增一个简单的 Console 后台页面。不要创建平行的配置存储、第二套 agent lifecycle 或第二条聊天链路。

后端需求

1. 丰富现有 runtime-config API

保留现有更新接口:

POST /api/channels/registrations/{registrationId}/runtime-config

新增读取接口:

GET /api/channels/registrations/{registrationId}/runtime-config

读取接口返回当前 registration 的 runtime config 和页面所需的非敏感状态。读写都必须复用现有 registration query/read model 与 command/event/projection 链路。

可编辑字段以当前 ChannelBotRuntimeConfig 为准:

  • instructions
  • default_skill.name
  • default_skill.version
  • tool_set_refs
  • extra_tool_names
  • nyxid_service_selectors[].service_slug
  • nyxid_service_selectors[].endpoint_names

要求:

  • 使用明确的 typed request/response 字段,不新增通用 Metadata/Dictionary 配置袋。
  • 保持 owner/scope 授权校验;无权限或不存在的 registration 采用一致的错误语义。
  • 更新响应返回 accepted receipt,并包含 registration_idcommand_id 或等价追踪信息。
  • 补充字段级校验和稳定错误,例如配置结构、长度、空值和不允许的 tool/service/endpoint 引用。
  • 明确 omitted、empty、whitespace-only 字段的行为;保存后页面可通过 GET 重新读取结果。
  • runtime config 的修改对下一次 channel turn 生效,不要求重新 onboarding 或创建新 conversation。

2. 对接最新 registration 服务授权接口

registration 创建接口已经使用以下字段表达服务授权:

  • authorization_modenyxid_defaultexplicit_service_allowlist
  • service_ids:经过 NyxID owner/inventory 校验的 service identity

管理页面和 API 应复用这套 registration contract:

  • 页面可以编辑 channel 需要使用的 NyxID service selection。
  • service_ids 是 registration 层的授权输入,不能把 runtime service_slug 当成未经校验的授权事实。
  • runtime nyxid_service_selectors 的 service 必须来自 registration 已授权且经过服务端验证的服务;服务端负责保持授权列表与 runtime selector 的一致性。
  • endpoint names 可以作为 runtime selector 的细粒度选择,但不能绕过 registration 的 service authorization。
  • 不要在页面或 API 中猜测、拼接或硬编码 service id、service slug、skill/template 名称。

3. Registration list 增加管理页面摘要

扩展现有:

GET /api/channels/registrations

返回页面列表所需的安全摘要,例如:

  • registration id、platform、label/scope 展示信息
  • authorization_mode 和已授权 service 的非敏感展示信息
  • default skill
  • 是否配置 instructions、tool sets、extra tools
  • NyxID selector 摘要
  • agent key id/readiness/status
  • workflow result delivery status
  • state/config version 和最后观测时间

完整 runtime config 由 detail API 返回。列表默认只返回当前用户可访问的 registrations;现有 admin scope=all 语义继续遵守服务端授权。

4. Agent key、workflow 和 NyxID 配置边界

页面可以管理或展示 agent key 的状态,并在已有能力支持时提供 repair/rotation action,但不能把 key 当普通文本配置编辑。以下内容禁止进入 API response、浏览器状态、日志或页面:

  • raw/full agent key
  • vault secret value
  • access token
  • workflow result delivery credential
  • NyxID API key 或其他第三方 secret

页面只显示非敏感的 key readiness/status、key id、错误状态和时间信息。NyxID 服务的实际 credential 配置继续进入现有 NyxID 配置流程;Aevatar 只保存和编辑 typed service selection/selector。

前端需求

在 Console 增加一个简单的 channel 配置管理页面,例如:

/settings/channels

保留现有 /channels onboarding 页面,不把 onboarding 改造成后台配置页。

页面需要支持:

  • 查看当前 owner 的 channel registrations。
  • 打开 registration 的 runtime-config detail。
  • 编辑并保存 instructions、default skill、tool set refs、extra tools、NyxID service selectors。
  • 编辑 registration 的 authorization_mode/service_ids,并使用服务端返回的已验证 service 数据,不自行构造身份。
  • 展示 agent key、workflow result delivery、NyxID service authorization/configuration 状态。
  • 复用现有 status、repair、test-reply、delete 和 /api/ai/agents profile/default-binding 能力入口。
  • 保存后通过正常的 GET/read-model 状态读取展示结果和最终一致性状态。
  • 使用服务端返回的字段级错误,不只依赖 UI 校验。

页面先做简单、可用、响应式的管理界面,不需要复杂视觉设计。

验收标准

  • 用户可以在 Console 看到自己有权限访问的 channel registrations。
  • 用户可以查看某个 registration 的完整 runtime config。
  • 用户可以编辑并保存 instructions、default skill、tool set refs、extra tools 和 NyxID selectors。
  • 用户可以通过现有 registration contract 管理 authorization_modeservice_ids;未授权 service 不能被 runtime selector 绕过。
  • 保存后通过 GET/read model 可以看到更新后的配置,后续同一 channel conversation 的新 turn 使用最新配置。
  • 不存在或无权限的 registration 不会泄露配置或 secret。
  • 无效配置返回明确且稳定的字段级错误。
  • 页面可以查看 agent key/workflow/NyxID 的非敏感状态,但任何 raw key、token、vault 值都不会出现在接口、浏览器、日志或测试快照中。
  • 现有 /channels onboarding、registration、status、repair、test-reply、delete 和已有 agent profile 流程不被破坏。
  • 不新增独立 Channel Agent Config 资源、第二套 projection/read model、第二条 chat/conversation 路径或运行时硬编码 skill/template 名称。
  • 补充后端 API 测试和前端页面测试,至少覆盖 runtime-config GET/POST、owner scope、registration service authorization、字段校验、readback、secret redaction、页面加载/保存/错误状态。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions