dsh-aperture 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +11 -10
- package/README.md +11 -10
- package/lib/client.js +1463 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +2084 -131
- package/lib/{aperture.d.ts → types/aperture.d.ts} +12 -10
- package/lib/types/catalog.d.ts +25 -0
- package/lib/types/config.d.ts +204 -0
- package/lib/types/index.d.ts +37 -0
- package/lib/{metadata → types/metadata}/extract.d.ts +15 -24
- package/lib/types/metadata/modelsdev.d.ts +40 -0
- package/lib/{metadata → types/metadata}/utils.d.ts +2 -0
- package/lib/types/panel.d.ts +71 -0
- package/lib/types/profile.d.ts +55 -0
- package/lib/types/registry.d.ts +31 -0
- package/lib/{relay.d.ts → types/relay.d.ts} +2 -0
- package/lib/types/remote.d.ts +54 -0
- package/lib/types/report.d.ts +115 -0
- package/lib/types/runtime.d.ts +87 -0
- package/lib/{sync.d.ts → types/sync.d.ts} +12 -23
- package/lib/types/types.d.ts +118 -0
- package/lib/{url.d.ts → types/url.d.ts} +5 -3
- package/package.json +44 -22
- package/client/aperture.js +0 -1566
- package/lib/aperture.js +0 -107
- package/lib/catalog.d.ts +0 -35
- package/lib/catalog.js +0 -74
- package/lib/config.d.ts +0 -214
- package/lib/config.js +0 -168
- package/lib/index.d.ts +0 -70
- package/lib/metadata/extract.js +0 -217
- package/lib/metadata/modelsdev.d.ts +0 -53
- package/lib/metadata/modelsdev.js +0 -302
- package/lib/metadata/utils.js +0 -86
- package/lib/panel.d.ts +0 -86
- package/lib/panel.js +0 -263
- package/lib/profile.d.ts +0 -62
- package/lib/profile.js +0 -158
- package/lib/registry.d.ts +0 -48
- package/lib/registry.js +0 -234
- package/lib/relay.js +0 -63
- package/lib/remote.d.ts +0 -64
- package/lib/remote.js +0 -96
- package/lib/report.d.ts +0 -123
- package/lib/report.js +0 -109
- package/lib/runtime.d.ts +0 -97
- package/lib/runtime.js +0 -194
- package/lib/sync.js +0 -176
- package/lib/types.d.ts +0 -116
- package/lib/types.js +0 -10
- package/lib/url.js +0 -67
package/README.en.md
CHANGED
|
@@ -4,7 +4,7 @@ Discover the models an [Aperture](https://tailscale.com/kb/1542/aperture) gatewa
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
Requirements: Node ≥
|
|
7
|
+
Requirements: Node ^22.19.0 or ≥24.0.0 (matching DSH), and an Aperture instance you can reach.
|
|
8
8
|
|
|
9
9
|
### 1. Add the plugin
|
|
10
10
|
|
|
@@ -32,7 +32,7 @@ allowBuilds:
|
|
|
32
32
|
|
|
33
33
|
> That authorization lets this package run code on your machine at install time, outside any agent sandbox. Authorize only source you trust.
|
|
34
34
|
|
|
35
|
-
When editing the code locally, install the checkout directory instead (run `
|
|
35
|
+
When editing the code locally, install the checkout directory instead (run `pnpm run build` first):
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
npx @deepseek-ai/dsh plugin --profile web add /path/to/dsh-aperture
|
|
@@ -96,7 +96,7 @@ The interface is at **Plugins → dsh-aperture**: open this plugin in the plugin
|
|
|
96
96
|
| Where | Effect |
|
|
97
97
|
| --- | --- |
|
|
98
98
|
| Configuration page · Instance address | edits `baseUrl` (written through the settings seam; when it says "Overridden", the "Reset to default" beside it falls back to the default) |
|
|
99
|
-
| Configuration page · Sync toggle | edits `sync`: off discovers without writing `llm-pi-ai`, and that round withdraws whatever this plugin had published (only the
|
|
99
|
+
| Configuration page · Sync toggle | edits `sync`: off discovers without writing `llm-pi-ai`, and that round withdraws whatever this plugin had published (only the three keys it owns; every other provider in the section is left alone); carries the same "Overridden / Reset to default" pair |
|
|
100
100
|
| Configuration page · Save | below the form: writes the address and toggle drafts into the settings document; it is revision-fenced, so a form that has drifted from the settings document is refused rather than overwriting someone else's edit; it returns only once that round of re-discovery has landed, so the interface shows the new configuration right away |
|
|
101
101
|
| Configuration page · Models | one row per model, one card per row: a state dot at its head (green: this round wrote it into the routes; grey: this round synced but did not write it; amber: no route can serve it — hovering it, or a screen reader, hears exactly that), then the name with its "unserved / N overridden / unsaved edits" tags on the first line and labelled facts (route, protocol, capacities, modalities, reasoning, alias) on the second, with long names ellipsised and facts wrapping; expanded, it is that row's override editor — display name, alias and protocol as one group of text fields, context window and max output as the "capacity" group, and two modality checkboxes beside a three-way reasoning switch (follow discovery / on / off); a field keeps only one line naming where its value comes from ("Source: Aperture"), while how-to copy ("Leave it empty to use the discovered name") lives behind the "i" next to the label and only takes up room once opened; the "Refresh now" action at its top right discovers and republishes immediately, and the list and every row's status follow that round |
|
|
102
102
|
| Configuration page · Save / Clear overrides / Cancel | write that row only, clear only the fields the backend report says really were overridden, or drop that row's draft; Save likewise waits for a round of re-discovery, so what you see afterwards is the new value |
|
|
@@ -110,7 +110,7 @@ Every key lives under that row's `config:` in the profile patch document (user l
|
|
|
110
110
|
| Key | Default | Meaning |
|
|
111
111
|
| --- | --- | --- |
|
|
112
112
|
| `baseUrl` | `''` | Aperture instance root. A trailing `/v1` is tolerated and stripped; empty leaves the plugin dormant |
|
|
113
|
-
| `route` | `aperture` | Route key
|
|
113
|
+
| `route` | `aperture` | Route key for Chat Completions models; Responses and Anthropic append `-responses` and `-anthropic`, with all three selector labels derived from it |
|
|
114
114
|
| `apiKeyEnv` | `''` | Credential-seam reference; non-empty suppresses the placeholder header |
|
|
115
115
|
| `headers` | `{}` | Extra request headers; they **win over** the placeholder |
|
|
116
116
|
| `enabledModelIds` | `[]` | Non-empty restricts discovery to these ids (explicit `models` entries are exempt) |
|
|
@@ -138,7 +138,7 @@ Missing capacity and reasoning levels are filled in from Aperture's own fields
|
|
|
138
138
|
git config --global url."git@github.com:".insteadOf "https://github.com/"
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
**Some models never show up in the selector?** Look at the rows tagged `未服务` (unserved) in the Models section of the configuration page. Models that only offer Gemini's native `generateContent` endpoint cannot be attached —
|
|
141
|
+
**Some models never show up in the selector?** Look at the rows tagged `未服务` (unserved) in the Models section of the configuration page. Models that only offer Gemini's native `generateContent` endpoint cannot be attached — this plugin can publish Chat Completions, OpenAI Responses, and Anthropic Messages, but does not translate Gemini's native protocol. Using the wrong endpoint fails loudly, and Aperture names the right one:
|
|
142
142
|
|
|
143
143
|
```
|
|
144
144
|
404 model "gemini-2.5-flash" is available via gemini_generate_content, not openai_chat
|
|
@@ -194,7 +194,7 @@ git config --global url."git@github.com:".insteadOf "https://github.com/"
|
|
|
194
194
|
|
|
195
195
|
**Need a real key instead of the placeholder header?** Aperture authenticates by network identity (Tailscale) and needs none; the plugin writes `authorization: Bearer dsh-aperture` / `x-api-key: dsh-aperture` only to make the adapter willing to send the request. It is **not a key**. When a real credential is needed, point `apiKeyEnv` at a credential-seam record and no placeholder is written.
|
|
196
196
|
|
|
197
|
-
**The old route is still there after changing `route`?** The plugin only knows the
|
|
197
|
+
**The old route is still there after changing `route`?** The plugin only knows the three keys it currently owns (`route`, `route` + `-responses`, and `route` + `-anthropic`), not the names it used before, so the old key stays in `llm-pi-ai.providers`. It does no harm and simply stops refreshing; delete the entry by hand to clean it up.
|
|
198
198
|
|
|
199
199
|
## What it does
|
|
200
200
|
|
|
@@ -203,6 +203,7 @@ GET {baseUrl}/v1/models
|
|
|
203
203
|
│
|
|
204
204
|
├─ per model: supported_endpoints ──► routing
|
|
205
205
|
│ /v1/chat/completions ──► route (openai-completions)
|
|
206
|
+
│ /v1/responses ──► route + -responses (openai-responses)
|
|
206
207
|
│ /v1/messages ──► route + -anthropic (anthropic-messages)
|
|
207
208
|
│ native generateContent only ──► not published (reported under 未服务)
|
|
208
209
|
│
|
|
@@ -212,14 +213,14 @@ GET {baseUrl}/v1/models
|
|
|
212
213
|
└─ llm-pi-ai providers.<route>, written into the profile patch document by revision
|
|
213
214
|
```
|
|
214
215
|
|
|
215
|
-
Writes touch only the
|
|
216
|
+
Writes touch only the three keys under `llm-pi-ai.providers` that this plugin owns: an unchanged section is not rewritten; writes are path-addressed so your hand-written providers survive untouched; a failed discovery never wipes the published catalog; a route that lost its models is removed. Design notes — protocol routing, where each fact comes from, lifecycle and dependencies, write behaviour — are in [docs/internals.md](https://github.com/he0119/dsh-aperture/blob/main/docs/internals.md) (Chinese).
|
|
216
217
|
|
|
217
218
|
## Development
|
|
218
219
|
|
|
219
220
|
```sh
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
pnpm install
|
|
222
|
+
pnpm run build # tsdown -> lib/index.js + lib/types/index.d.ts + lib/client.js
|
|
223
|
+
pnpm test # unit tests + end-to-end (offline; devDependencies must be installed)
|
|
223
224
|
```
|
|
224
225
|
|
|
225
226
|
Working on the plugin — build, tests, and a dedicated development instance — is in [docs/development.md](https://github.com/he0119/dsh-aperture/blob/main/docs/development.md) (Chinese); the release process and what the published package contains are in [docs/releasing.md](https://github.com/he0119/dsh-aperture/blob/main/docs/releasing.md) (Chinese).
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
7
|
-
前提:Node ≥
|
|
7
|
+
前提:Node ^22.19.0 或 ≥24.0.0(与官方 DSH 一致),以及一个你能访问的 Aperture 实例。
|
|
8
8
|
|
|
9
9
|
### 1. 装上插件
|
|
10
10
|
|
|
@@ -32,7 +32,7 @@ allowBuilds:
|
|
|
32
32
|
|
|
33
33
|
> 这项授权等于允许该包在你机器上、于 agent 沙箱之外执行安装脚本。只对信任的源码授权。
|
|
34
34
|
|
|
35
|
-
本地改代码时,直接装仓库目录(先 `
|
|
35
|
+
本地改代码时,直接装仓库目录(先 `pnpm run build`):
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
npx @deepseek-ai/dsh plugin --profile web add /path/to/dsh-aperture
|
|
@@ -93,7 +93,7 @@ npx @deepseek-ai/dsh --profile web --dump-config # 应出现 "# == dsh-apertur
|
|
|
93
93
|
| 位置 | 作用 |
|
|
94
94
|
| --- | --- |
|
|
95
95
|
| 配置页 · 实例地址 | 改 `baseUrl`(写入设置接缝;写着「已覆盖」时旁边那颗「恢复默认」把它放回缺省值) |
|
|
96
|
-
| 配置页 · 同步开关 | 改 `sync`:关掉就只探测、不写 `llm-pi-ai
|
|
96
|
+
| 配置页 · 同步开关 | 改 `sync`:关掉就只探测、不写 `llm-pi-ai`——那一轮刷新会顺手把本插件已经发布的路由撤下来(只撤它拥有的三个键,配置段里其他 provider 原样留着);同样带「已覆盖 / 恢复默认」这一对 |
|
|
97
97
|
| 配置页 · 保存 | 表单下方,把地址与开关的草稿写进设置文档;有版本设栅,表单已经与设置文档脱节时会拒绝写入,而不是覆盖别处的改动;写完等这一轮重新发现落地才返回,界面随即显示新配置 |
|
|
98
98
|
| 配置页 · 模型 | 一行一个模型,一行一张卡:行首一颗状态点(绿=这一轮写进了路由,灰=这一轮同步过而它没写进去,黄=没有路由能服务它,鼠标停在上面或读屏都能听到这句话),第一行是名字与「未服务 / 已覆盖 N 项 / 有未保存的改动」几枚标签,第二行是带标签的事实(路由、协议、容量、模态、推理、别名),长名字省略、事实随宽度换行;点开就是这一行的覆盖编辑器——显示名、别名、协议三个输入框一组,「容量」一组(上下文容量、最大输出),模态两个勾选框与推理一个三段开关(跟随发现 / 开 / 关)并排;字段下面只留一句来源(「来源:Aperture」),「留空即用发现到的名字」这类怎么做的话在标签旁边那颗「i」里,点开才占位置;右上角「立刻刷新」立刻重新发现并发布,清单与每一行的状态跟着变新 |
|
|
99
99
|
| 配置页 · 保存 / 清空覆盖 / 取消 | 只写这一行,或者只清掉后台报告里确实被覆盖过的那几项,或者把这一行的草稿整个丢掉;「保存」同样等一轮重新发现落地,所以按完看到的就是新值 |
|
|
@@ -107,7 +107,7 @@ npx @deepseek-ai/dsh --profile web --dump-config # 应出现 "# == dsh-apertur
|
|
|
107
107
|
| 键 | 默认 | 说明 |
|
|
108
108
|
| --- | --- | --- |
|
|
109
109
|
| `baseUrl` | `''` | Aperture 实例地址。末尾 `/v1` 会被容忍并去掉;空值表示休眠(不探测、不写入) |
|
|
110
|
-
| `route` | `aperture` |
|
|
110
|
+
| `route` | `aperture` | Chat Completions 模型的路由名;Responses、Anthropic 路由分别追加 `-responses`、`-anthropic`,三个选择器名称也由它推出来 |
|
|
111
111
|
| `apiKeyEnv` | `''` | 凭据 seam 里的引用名;非空时不再写占位头 |
|
|
112
112
|
| `headers` | `{}` | 每条请求额外带的头,**优先于**占位头 |
|
|
113
113
|
| `enabledModelIds` | `[]` | 非空时只保留这些 id(`models` 里显式列出的不受限) |
|
|
@@ -135,7 +135,7 @@ npx @deepseek-ai/dsh --profile web --dump-config # 应出现 "# == dsh-apertur
|
|
|
135
135
|
git config --global url."git@github.com:".insteadOf "https://github.com/"
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
**有些模型没出现在选择器里?** 看配置页「模型」那一段里带「未服务」标签的行。只提供 Gemini 原生 `generateContent`
|
|
138
|
+
**有些模型没出现在选择器里?** 看配置页「模型」那一段里带「未服务」标签的行。只提供 Gemini 原生 `generateContent` 端点的模型接不进来——本插件可发布 Chat Completions、OpenAI Responses 与 Anthropic Messages,不能转换 Gemini 原生协议。走错端点时 Aperture 会明确告诉你该用哪个:
|
|
139
139
|
|
|
140
140
|
```
|
|
141
141
|
404 model "gemini-2.5-flash" is available via gemini_generate_content, not openai_chat
|
|
@@ -185,7 +185,7 @@ git config --global url."git@github.com:".insteadOf "https://github.com/"
|
|
|
185
185
|
|
|
186
186
|
**需要真密钥而不是占位头?** Aperture 靠网络身份(Tailscale)认证,本不需要密钥;插件默认写入 `authorization: Bearer dsh-aperture` / `x-api-key: dsh-aperture`,只是让适配器愿意发请求,**不是密钥**。真要密钥时把 `apiKeyEnv` 指向凭据 seam 里的记录,占位头就不会写入。
|
|
187
187
|
|
|
188
|
-
**改了 `route` 之后旧路由还在?**
|
|
188
|
+
**改了 `route` 之后旧路由还在?** 插件只认自己当前拥有的三个键(`route`、`route` + `-responses`、`route` + `-anthropic`),不知道历史上用过哪些名字,所以旧键会留在 `llm-pi-ai.providers` 里。它不报错、只是不再刷新;要清理就手动删掉那一行。
|
|
189
189
|
|
|
190
190
|
## 它做了什么
|
|
191
191
|
|
|
@@ -194,6 +194,7 @@ GET {baseUrl}/v1/models
|
|
|
194
194
|
│
|
|
195
195
|
├─ 每个模型:supported_endpoints ──► 分流
|
|
196
196
|
│ /v1/chat/completions ──► route (openai-completions)
|
|
197
|
+
│ /v1/responses ──► route + -responses (openai-responses)
|
|
197
198
|
│ /v1/messages ──► route + -anthropic (anthropic-messages)
|
|
198
199
|
│ 只有原生 generateContent ──► 不发布(列进「未服务」)
|
|
199
200
|
├─ 容量:Aperture 字段 ─► models.dev ─► 默认值
|
|
@@ -201,14 +202,14 @@ GET {baseUrl}/v1/models
|
|
|
201
202
|
└─ 生成 llm-pi-ai 的 providers.<route>,按 revision 写进 profile 的补丁文档
|
|
202
203
|
```
|
|
203
204
|
|
|
204
|
-
写入只碰 `llm-pi-ai.providers`
|
|
205
|
+
写入只碰 `llm-pi-ai.providers` 下属于本插件的三个键:内容没变就不写;用路径操作写,你手写的其它 provider 原样保留;探测失败绝不删空已有目录;路由没模型了就删掉。实现细节(协议分流、容量与推理的来源优先级、生命周期与依赖、写入行为)见 [docs/internals.md](https://github.com/he0119/dsh-aperture/blob/main/docs/internals.md)。
|
|
205
206
|
|
|
206
207
|
## 开发
|
|
207
208
|
|
|
208
209
|
```sh
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
pnpm install
|
|
211
|
+
pnpm run build # tsdown -> lib/index.js + lib/types/index.d.ts + lib/client.js
|
|
212
|
+
pnpm test # 单元测试 + 端到端(离线运行;需要已安装的 devDependencies)
|
|
212
213
|
```
|
|
213
214
|
|
|
214
215
|
改代码、跑测试与开发实例见 [docs/development.md](https://github.com/he0119/dsh-aperture/blob/main/docs/development.md),发布流程与产物构成见 [docs/releasing.md](https://github.com/he0119/dsh-aperture/blob/main/docs/releasing.md)。
|