DSH / Atlas
2026-11-23implementedarchitecture

Deployment-supplied pi-ai providers as provider rows

以提供方条目承载部署方下发的 pi-ai 提供方

Every pi-ai provider route lives in one field: the `providers` dict of the `llm-pi-ai` row's config. A patch that sets a row's `config` replaces the whole config of the layers before it. The Models page stores a person's providers as an override of that row in the profile patch, and a deployment that supplies providers to every profile of a machine writes its home patch, which applies after the profile patch. The two

Source compatibility: Chinese title uses a compatible non-canonical header

English

Problem

Every pi-ai provider route lives in one field: the providers dict of the llm-pi-ai row's config. A patch that sets a row's config replaces the whole config of the layers before it. The Models page stores a person's providers as an override of that row in the profile patch, and a deployment that supplies providers to every profile of a machine writes its home patch, which applies after the profile patch. The two therefore write the same field in two layers, with two results:

  • The home patch's dict replaces the person's dict, so the person's providers stop serving.
  • The configuration editor refuses every later save of that row, because the composed config differs from what it would store (Configuration for "llm-pi-ai" is overridden by a home patch or command-line overlay).

The same holds for a --patch overlay and for any layer that adds a provider after the profile patch.

Decision

A layer that adds a provider writes a row of its own, and the dict stays as it is.

  • @deepseek-ai/dsh-llm-pi-ai/provider is a second plugin of the adapter package. Its config is the route key in provider and the profile fields of a dict entry beside it, built from the same field schemas, each one live.
  • The row registers its route through ctx.piAiProviders, which the adapter row provides. The adapter serves the registered routes together with its dict's.
  • Of the declarations that name one route, the one that comes last in the composed entry list is in effect. The dict takes the position of the adapter's row, so a row that a home patch or an overlay adds replaces the dict entry of the same route, and that entry serves again when the row leaves. This is the precedence patches already have: the later layer decides.
  • The configurable-provider directory addresses a route that a row serves by that row (settingsNs is the row id, settingsPath is empty) and every other route by its dict entry.
  • Settings and the configuration editor are unchanged. The Models page recognizes a provider row from what settings already sends: the row's form declares the fields of a dict entry's form, because both are built from the same field schemas. It keeps its reads and writes of the dict, lists a route that a row serves beside them without a deletion, and opens it as a pi-ai card at the root of the row's namespace. A typed key is stored under the credential reference the row names; a changed field goes to the configuration editor, which refuses a row that a home patch or an overlay adds.

The dict, the stored profile patches, and the page's writes of the dict are unchanged, so no stored configuration is converted and no interface is removed.

Alternatives considered

  • Every provider as a row, without the dict. Each layer then adds, changes, or removes one route, and a person's providers and a deployment's are symmetric. It removes the dict that released profile patches store, so it needs a conversion of every stored profile at launch, a refusal for files the launcher does not own, an upgrade guide, generic operations that add and remove plugin rows from a settings page, and a Models page that drafts rows. An implementation of it added about 5,500 lines, tests and documents included, across the launcher, the configuration editor, settings, its Remote controller, and the page. The problem above needs none of that: only the layer that currently overwrites the dict has to stop writing it.
  • Deep-merging config across patch layers, or a path-addressed patch operation. Either changes what every patch of every plugin means, or adds a patch form that all layers must learn, to serve one dict. A second provider source in the adapter is local to the package that owns the dict.
  • A second llm-pi-ai row for the deployment. The adapter provides one directory and one model-discovery registration per composition; a second row fails to start with DUPLICATE_DIRECTORY.
  • A dedicated file for deployment providers beside the patch files. It adds a configuration source that the Loader, hot reload, and the configuration editor do not know.
  • Letting both declarations of one route serve, told apart by display name. The route key is what a request, a Session record, and the default-model setting name, and pi-ai dispatches on it, so one key selects one profile. A deployment that offers a provider beside a person's own of the same vendor gives its row another route key and a displayName. Renaming a colliding key automatically was rejected: the key would change when the other layer appears or leaves, while stored Sessions and the default model point at it.
  • Marking a deployment's providers on the Models page. A tag and a read-only card for a row that a later layer decides need the configuration editor to report which layer decides each row, and settings and its Remote controller to carry that to the page. The configuration editor already refuses the write, so those packages stay as they are and the card shows the refusal. Whether a settings page may edit a row that the home patch decides is a question for the configuration editor, apart from this adapter.
  • Telling the page which rows are provider rows through a new field. A field on the directory entry of dsh-llm, or the plugin name of each namespace forwarded by settings, would name the row's adapter. The form that settings already sends identifies the row, so no interface carries it.

Consequences

  • A providers dict that cannot start fails the adapter row, and the provider rows wait for the service that row provides, so no pi-ai route serves until the dict is repaired. A provider row that cannot start fails alone.
  • A row under a route key that names no installed pi-ai provider inherits no catalog: it declares api, baseURL, and models.
  • A dict entry behind a row of the same route serves nothing and is not shown by the Models page while the row runs.
  • Nothing on the Models page tells a deployment's provider from a person's own apart from the missing delete control, and a changed field of a row that a home patch or an overlay adds is refused only when it is saved.
  • The page treats any namespace whose form declares exactly the fields of a pi-ai profile as a provider row.
  • A reconciled configuration can move rows without restarting them. The registry re-evaluates the rows in effect on app-boot/config-reload; a composition that reorders rows by another means keeps the previous order until a row registers, changes, or is withdrawn.
  • A home patch that overrides the config of the llm-pi-ai row replaces the stored dict, and the configuration editor refuses a save of that row.

中文

问题

所有 pi-ai 提供方路由都位于同一个字段:llm-pi-ai 条目配置中的 providers 字典。设置条目 config 的 patch 会替换此前各层的整个配置。Models 页把用户的提供方保存为 profile patch 中对该条目的覆盖;为一台机器上每个 profile 下发提供方的部署方则写入 home patch,而 home patch 在 profile patch 之后应用。两者因此在两个层里写同一个字段,造成两个结果:

  • home patch 的字典替换用户的字典,用户的提供方不再提供服务。
  • 配置编辑器拒绝此后对该条目的每一次保存,因为组合出的配置与它将要保存的内容不同(Configuration for "llm-pi-ai" is overridden by a home patch or command-line overlay)。

--patch overlay 以及任何在 profile patch 之后添加提供方的层同样如此。

决策

添加提供方的层写一个独立的条目,字典保持不变。

  • @deepseek-ai/dsh-llm-pi-ai/provider 是适配器包的第二个插件。它的配置是 provider 中的路由键,以及与之并列的字典条目的各 profile 字段;这些字段由同一组字段 schema 构建,每个字段都可实时生效。
  • 该条目通过适配器条目提供的 ctx.piAiProviders 注册自己的路由。适配器把已注册的路由与字典的路由一并提供。
  • 多处声明同一条路由时,组合后条目列表中位置最靠后的那处生效。字典按适配器条目所在的位置计,因此 home patch 或 overlay 添加的条目会替换字典中同一路由的条目,该条目离开后字典条目重新提供服务。这与 patch 既有的优先级一致:由靠后的层决定。
  • 可配置提供方目录对条目所服务的路由以该条目寻址(settingsNs 为条目 id,settingsPath 为空),其余路由以字典条目寻址。
  • Settings 和配置编辑器没有变化。Models 页凭 settings 已经发送的内容识别提供方条目:条目的表单声明的字段与字典条目表单的字段相同,因为两者由同一组字段 schema 构建。页面保留对字典的读写,把条目所服务的路由与字典的路由并列列出且不提供删除,并在条目 namespace 的根部以 pi-ai 卡片打开它。输入的密钥保存在条目指名的凭据引用下;修改后的字段交给配置编辑器,它拒绝由 home patch 或 overlay 添加的条目。

字典、已保存的 profile patch 以及页面对字典的写入都没有变化,因此不需要转换任何已保存的配置,也没有接口被移除。

考虑过的替代方案

  • 每个提供方都是条目,不再保留字典。 这样每一层只添加、修改或移除一条路由,用户的提供方与部署方的提供方是对称的。但它移除了已发布版本的 profile patch 所保存的字典,因此需要在启动时转换每个已保存的 profile、对启动器不拥有的文件给出拒绝、编写升级指南、提供供设置页添加和移除插件条目的通用操作,并让 Models 页以条目起草。它的一个实现在启动器、配置编辑器、settings、其 Remote 控制器和页面上共新增约 5,500 行(含测试与文档)。上述问题不需要这些:只需让当前覆盖字典的那一层不再写它。
  • 跨 patch 层深度合并 config,或增加按路径寻址的 patch 操作。 前者改变每个插件每个 patch 的含义,后者增加一种所有层都要理解的 patch 形式,而目的只是服务一个字典。在适配器里增加第二个提供方来源,只影响拥有该字典的包。
  • 为部署方再挂一个 llm-pi-ai 条目。 每个组合中适配器只提供一份目录和一次模型发现注册;第二个条目会以 DUPLICATE_DIRECTORY 启动失败。
  • 在 patch 文件之外为部署方提供方设置专用文件。 这会增加一个 Loader、热重载和配置编辑器都不认识的配置来源。
  • 让同一条路由的两处声明同时提供服务,以显示名称区分。 请求、Session 记录和默认模型设置都以路由键指名,pi-ai 也按它分派,因此一个键只选择一份 profile。部署方若要在用户自己的同厂商提供方旁边提供另一个提供方,应给条目使用另一个路由键并设置 displayName。自动重命名冲突的键被否决:这个键会随另一层的出现或离开而变化,而已保存的 Session 和默认模型都指向它。
  • 在 Models 页标出部署方的提供方。 为由后续层决定的条目显示标签和只读卡片,需要配置编辑器报告每个条目由哪一层决定,并由 settings 及其 Remote 控制器把它传给页面。配置编辑器本来就拒绝这类写入,因此这些包保持原样,卡片显示这次拒绝。设置页能否编辑由 home patch 决定的条目,是配置编辑器的问题,与本适配器无关。
  • 用一个新字段告诉页面哪些条目是提供方条目。 在 dsh-llm 的目录条目上加字段,或由 settings 转发每个 namespace 的插件名,都可以指明条目的适配器。settings 已经发送的表单足以识别该条目,因此没有接口承载它。

影响

  • providers 字典无法启动时适配器条目失败,各提供方条目等待该条目提供的服务,因此字典修复前没有任何 pi-ai 路由可用。无法启动的提供方条目只让自身失败。
  • 路由键不对应任何已安装 pi-ai 提供方的条目不继承目录:它需要声明 api、baseURL 和 models。
  • 字典条目位于同一路由的条目之后时不提供任何服务,在该条目运行期间 Models 页也不显示它。
  • 除了没有删除控件之外,Models 页上没有任何内容把部署方的提供方与用户自己的区分开;修改由 home patch 或 overlay 添加的条目的字段,要到保存时才被拒绝。
  • 页面把表单恰好声明 pi-ai profile 各字段的任何 namespace 都视为提供方条目。
  • 重新组合的配置可以在不重启条目的情况下移动条目。注册表在 app-boot/config-reload 时重新判定生效的条目;以其他方式调整条目顺序的组合,在有条目注册、变更或撤回之前保持原先的顺序。
  • 覆盖 llm-pi-ai 条目配置的 home patch 会替换已保存的字典,配置编辑器拒绝对该条目的保存。