@deepseek-ai/dsh-llm-pi-ai 0.2.1-alpha.1 → 0.2.1-alpha.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.i18n.yaml +19 -16
- package/README.md +34 -6
- package/README.zh.md +34 -6
- package/lib/index.js +397 -68
- package/lib/types/adapter.d.ts +3 -1
- package/lib/types/catalog.d.ts +8 -5
- package/lib/types/context.d.ts +10 -3
- package/lib/types/models.d.ts +7 -0
- package/lib/types/provider-data.d.ts +10 -0
- package/lib/types/provider-data.generated.d.ts +10 -0
- package/lib/types/replay.d.ts +1 -0
- package/locale/en.json +5 -0
- package/locale/zh.json +6 -0
- package/package.json +30 -28
package/README.i18n.yaml
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
en: 376f83206858b601
|
|
31
31
|
zh: 38bb6993609c96a6
|
|
32
32
|
/deepseek-ai-dsh-llm-pi-ai/use-this-package/run-with-reasoning-and-wire-compatibility:
|
|
33
|
-
en:
|
|
34
|
-
zh:
|
|
33
|
+
en: b58b917e7f250aee
|
|
34
|
+
zh: aff599081bac08c3
|
|
35
35
|
/deepseek-ai-dsh-llm-pi-ai/use-this-package/change-configuration-at-runtime:
|
|
36
36
|
en: 92f554e1718614ca
|
|
37
37
|
zh: f17ed3ad3e5d28e2
|
|
@@ -39,23 +39,26 @@
|
|
|
39
39
|
en: 6619e8cfe7555c73
|
|
40
40
|
zh: b2f80c25acb81cf8
|
|
41
41
|
/deepseek-ai-dsh-llm-pi-ai/use-this-package/failures-and-recovery:
|
|
42
|
-
en:
|
|
43
|
-
zh:
|
|
42
|
+
en: 3c1edbc63de24a1a
|
|
43
|
+
zh: 01592718c3a2c79f
|
|
44
44
|
/deepseek-ai-dsh-llm-pi-ai/understand-the-implementation:
|
|
45
45
|
en: 1598ac8a8bb9b6bf
|
|
46
46
|
zh: fdd089c5ae7722cd
|
|
47
47
|
/deepseek-ai-dsh-llm-pi-ai/understand-the-implementation/design-philosophy:
|
|
48
|
-
en:
|
|
49
|
-
zh:
|
|
48
|
+
en: 8aba1113937b368a
|
|
49
|
+
zh: 804a4ca672a776df
|
|
50
50
|
/deepseek-ai-dsh-llm-pi-ai/understand-the-implementation/source-map:
|
|
51
|
-
en:
|
|
52
|
-
zh:
|
|
51
|
+
en: 64912b8a3a336419
|
|
52
|
+
zh: 33a245969b4194f6
|
|
53
53
|
/deepseek-ai-dsh-llm-pi-ai/understand-the-implementation/registration-and-directory:
|
|
54
|
-
en:
|
|
55
|
-
zh:
|
|
54
|
+
en: 0c6df3e8b6a75372
|
|
55
|
+
zh: 476666a6f209542c
|
|
56
|
+
/deepseek-ai-dsh-llm-pi-ai/understand-the-implementation/generated-provider-metadata:
|
|
57
|
+
en: 477d277e9ac35c8f
|
|
58
|
+
zh: 96870ca333fb6510
|
|
56
59
|
/deepseek-ai-dsh-llm-pi-ai/understand-the-implementation/replay-and-vocabulary:
|
|
57
|
-
en:
|
|
58
|
-
zh:
|
|
60
|
+
en: 73242ca9b8a98c76
|
|
61
|
+
zh: 4ab98526ae70bd23
|
|
59
62
|
/deepseek-ai-dsh-llm-pi-ai/further-exploration:
|
|
60
63
|
en: a2a2ccdeae59d408
|
|
61
64
|
zh: c47ee091aa90ad91
|
|
@@ -66,8 +69,8 @@
|
|
|
66
69
|
en: e7348db3f7115960
|
|
67
70
|
zh: 5fd5fb09d7d09982
|
|
68
71
|
/deepseek-ai-dsh-llm-pi-ai/model-experience/provider-request-through-pi-ai/what-the-model-sees:
|
|
69
|
-
en:
|
|
70
|
-
zh:
|
|
72
|
+
en: 948e7c8ec2ffda92
|
|
73
|
+
zh: 72bd6c7a4691a355
|
|
71
74
|
/deepseek-ai-dsh-llm-pi-ai/model-experience/provider-request-through-pi-ai/token-effect:
|
|
72
75
|
en: 820221e8ae37aa61
|
|
73
76
|
zh: 7e6ff4db10067fc0
|
|
@@ -87,8 +90,8 @@
|
|
|
87
90
|
en: b6bd570c0159ba08
|
|
88
91
|
zh: 7d2d91eea6a8d830
|
|
89
92
|
/deepseek-ai-dsh-llm-pi-ai/known-limitations-and-deferred-work:
|
|
90
|
-
en:
|
|
91
|
-
zh:
|
|
93
|
+
en: ee870ac2ac87decc
|
|
94
|
+
zh: 9e66c5e7400c4bc6
|
|
92
95
|
/deepseek-ai-dsh-llm-pi-ai/known-limitations-and-deferred-work/dev-note:
|
|
93
96
|
en: 3678dd0f6642c2a5
|
|
94
97
|
zh: 75cbdd064cc64282
|
package/README.md
CHANGED
|
@@ -102,6 +102,8 @@ A profile's `models` list replaces the route's installed catalog rather than ext
|
|
|
102
102
|
|
|
103
103
|
`reasoningEfforts` declares a model's selectable thinking levels: each key is a level selectors offer, its value the spelling dispatch sends on the wire, so `max: ultra` renames a level for a gateway with its own vocabulary. Omitting the field keeps the installed catalog entry's capability; `false` declares a non-reasoning model. `compat` switches reshape the request for endpoints pi-ai cannot recognize — which role carries the system prompt, which field caps output, how a thinking level travels — configurable per route and per model. A model neither the entry nor the installed catalog sizes takes the route's `defaultContextWindow` and `defaultMaxTokens` fallbacks.
|
|
104
104
|
|
|
105
|
+
Exact-model metadata lists `reasoning.efforts` from least to greatest selectable effort. A configuration function can select from that list before `prepareCall()` validates the concrete effort. The adapter receives only the resolved controls. Selecting `off` does not guarantee disabled reasoning: a protocol that expresses it by omitting the reasoning field leaves the gateway's default in effect. Reasoning tokens at any selected level count toward the request's output cap.
|
|
106
|
+
|
|
105
107
|
For self-hosted Chat Completions endpoints, `thinkingTokenBudgetField` selects the reasoning-budget parameter, and `vllmPriority` sets an integer scheduler priority when the server enables priority scheduling. Template arguments accept `$var: thinking.budget`. `openai-responses` gateways can set `supportsMaxOutputTokens: false` to omit `max_output_tokens`; Azure and Codex transports ignore this shared compatibility field. These controls are opt-in; catalog-owned Anthropic effort and fallback capabilities are not configurable switches.
|
|
106
108
|
|
|
107
109
|
### Change configuration at runtime
|
|
@@ -120,6 +122,8 @@ Config updates strictly validate changed providers. Initial loading retains stor
|
|
|
120
122
|
|
|
121
123
|
Changing `displayName`, `apiKeyEnv`, or `baseURL` without resolving the provider's model errors still rejects the save. For example, renaming an OpenRouter route whose model `111` needs an `api` cannot be saved on its own: repair or remove that model in the same editor draft, then save the complete provider configuration. Intermediate repairs remain in the draft until the whole provider validates; other providers can be saved independently.
|
|
122
124
|
|
|
125
|
+
Model discovery resolves each route’s credential configuration. A missing required credential yields an empty catalog; other resolution errors propagate. Routes with native authentication or no required key retain their configured catalog. This check does not probe the inference endpoint.
|
|
126
|
+
|
|
123
127
|
-----
|
|
124
128
|
|
|
125
129
|
<a id="understand-the-implementation"></a>
|
|
@@ -134,6 +138,8 @@ This section explains the design behind the adapter; the observable behavior is
|
|
|
134
138
|
|
|
135
139
|
The adapter is built on immutable snapshots and per-operation resolution. Each operation captures a whole snapshot — the profiles plus a `createModels()` collection holding the `Provider` each route built — before its first `await`, and a configuration change builds a new collection rather than mutating the one in use, so a request that started under one configuration never finishes under another. A route's own credential reference resolves through the harness seam and rides as the request's `apiKey` option, which pi-ai treats as the highest-priority auth override — that is what keeps the fail-loud reference semantics. Everything that override does not cover reaches pi-ai through the collection's own auth: the credential store holds the records a login wrote and a refresh rotates (addressed as `llm-pi-ai/<provider id>`), and the auth context answers the ambient questions a provider asks while resolving. Both are stable across snapshots, so a configuration change rebuilds the collection without forgetting who is signed in. Runtime imports use pi-ai's provider, API, and utility entry points; `src/models.ts` supplies the small model-helper subset this adapter needs without evaluating pi-ai's aggregate entry point.
|
|
136
140
|
|
|
141
|
+
Initial prompt text and active tools use pi-ai's `Context.systemPrompt` and `Context.tools`; later system and tool updates remain in `Context.messages`. pi-ai normalizes these fields and applies the selected protocol's serialization rules.
|
|
142
|
+
|
|
137
143
|
### Source map
|
|
138
144
|
|
|
139
145
|
| File | Role |
|
|
@@ -143,6 +149,7 @@ The adapter is built on immutable snapshots and per-operation resolution. Each o
|
|
|
143
149
|
| [`src/login.ts`](src/login.ts) | Authorization flows for the installed providers that ship a login |
|
|
144
150
|
| [`src/config.ts`](src/config.ts) | Profile schema, resolution, and serviceability checks |
|
|
145
151
|
| [`src/catalog.ts`](src/catalog.ts) | Installed-catalog integration and drift gates |
|
|
152
|
+
| [`src/provider-data.ts`](src/provider-data.ts) | Generated authentication and endpoint metadata for configuration surfaces |
|
|
146
153
|
| [`src/models.ts`](src/models.ts) | Model collections, static providers, and reasoning levels over narrow pi-ai entry points |
|
|
147
154
|
| [`src/provider.ts`](src/provider.ts) | The supported-protocol table and provider construction |
|
|
148
155
|
| [`src/context.ts`](src/context.ts) | Harness-to-pi-ai context conversion, image handling, replay restore |
|
|
@@ -152,11 +159,30 @@ The adapter is built on immutable snapshots and per-operation resolution. Each o
|
|
|
152
159
|
|
|
153
160
|
### Registration and directory
|
|
154
161
|
|
|
155
|
-
The plugin declares every installed catalog provider it can authenticate in the configurable-provider directory, joined with every route the current profiles declare, so configuration surfaces can offer the full catalog before any route exists. Each entry carries `declared` — whether pi-ai ships nothing under that key — because only the adapter can distinguish a hand-declared route from a narrowed catalog route. Route registration is atomic: a candidate set that collides with another adapter leaves the previous routes serving. A bare mount with zero routes is the dormant posture: nothing registers until the Config supplies profiles, and routes drop when it empties.
|
|
162
|
+
The plugin declares every installed catalog provider it can authenticate in the configurable-provider directory, joined with every route the current profiles declare, so configuration surfaces can offer the full catalog before any route exists. A catalog provider whose catalog lists models but no chat model, such as one of classifier models alone, is left out and gets no sign-in flow, because this adapter dispatches chat requests only. Each entry carries `declared` — whether pi-ai ships nothing under that key — because only the adapter can distinguish a hand-declared route from a narrowed catalog route. A catalog entry carries `defaultBaseURL` for a fixed provider endpoint or a fixed endpoint shared by all its models, `baseURLEnv` for endpoint configuration variables, and `nativeAuth` for authentication variables and OAuth availability. Different model endpoints and unresolved URL templates are not presented as one fixed default. Route registration is atomic: a candidate set that collides with another adapter leaves the previous routes serving. A bare mount with zero routes is the dormant posture: nothing registers until the Config supplies profiles, and routes drop when it empties.
|
|
163
|
+
|
|
164
|
+
<a id="generated-provider-metadata"></a>
|
|
165
|
+
### Generated provider metadata
|
|
166
|
+
|
|
167
|
+
[`scripts/gen-provider-data.ts`](scripts/gen-provider-data.ts) owns [`src/provider-data.generated.ts`](src/provider-data.generated.ts). It uses public resolvers with synthetic `AuthContext` answers to discover environment reads across empty, individual and suffix configurations. Resolver failures use `findEnvKeys` through the temporary compatibility entry. All current authentication variables come from resolvers; no authentication supplement is needed. The generator reports fallback use and fails if fallback metadata is missing. It does not read real credentials, start a login flow, or send a model request. Probing covers the installed resolvers; it does not prove all possible value-dependent branches.
|
|
168
|
+
|
|
169
|
+
Endpoint data comes from the public provider/model catalog and uppercase URL placeholders. Azure, Vertex and Bedrock need small supplements for variables read outside the auth context. Runtime directory reads execute no probes. The dependency range remains unchanged. A provider added by a newer consumer installation has no generated authentication hints until regeneration. For an existing provider, changed environment names and endpoints also remain at the generated snapshot until regeneration. Environment hints check only the listed credential references; they do not inspect provider-managed files such as AWS profiles or Google application-default credentials.
|
|
170
|
+
|
|
171
|
+
After updating pi-ai or changing the generator, install the updated locked dependencies, then run these commands from the repository root:
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
pnpm run gen-provider-data
|
|
175
|
+
pnpm run verify-provider-data
|
|
176
|
+
git add packages/llm/llm-pi-ai/src/provider-data.generated.ts
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Review the generated diff and stage the dependency or generator changes with it. Do not edit the generated file by hand. Generation errors must be resolved before committing.
|
|
180
|
+
|
|
181
|
+
The `pre-commit` hook runs `node_modules/.bin/tsx packages/llm/llm-pi-ai/scripts/gen-provider-data.ts --check --cached` when `pnpm-lock.yaml`, this package's `package.json`, the generator, or the generated file is staged. It compares the staged generated file with expected data computed from the installed dependency and current generator. It does not rewrite files or stage them. Updating only the working file is insufficient; stage the generated file too. If the check reports stale metadata, rerun the commands above before retrying the commit. CI runs `pnpm run verify-provider-data` against the checkout and installed lockfile dependencies even when the local hook was not triggered.
|
|
156
182
|
|
|
157
183
|
### Replay and vocabulary
|
|
158
184
|
|
|
159
|
-
Successful assistant responses store a versioned, lossless-JSON replay state beside the provider and model that produced them — response-level facts plus one per-block entry per streamed block. At request time, `LlmRuntime` passes replay state only when the same adapter instance owns both routes; the adapter validates it and restores native response ids, provider signatures, and optional `providerThinkingLevel` effort metadata, keeping absent effort metadata absent. Replay validates the requested model identity against the assistant source and uses it to retain same-model signatures; provider-reported response models remain diagnostic metadata. Absent or unusable replay state degrades to provider-neutral content while preserving the assistant source’s required provider and model. pi-ai tool-call arguments are parsed objects, so the adapter parses input and re-stringifies output to the harness raw-JSON convention; pi-ai in-stream error events map to terminal `finish` chunks.
|
|
185
|
+
Successful assistant responses store a versioned, lossless-JSON replay state beside the provider and model that produced them — response-level facts plus one per-block entry per streamed block. At request time, `LlmRuntime` passes replay state only when the same adapter instance owns both routes; the adapter validates it and restores native response ids, provider signatures, and optional `providerThinkingLevel` effort metadata, keeping absent effort metadata absent. Replay validates the requested model identity against the assistant source and uses it to retain same-model signatures; provider-reported response models remain diagnostic metadata. Absent or unusable replay state degrades to provider-neutral content while preserving the assistant source’s required provider and model. pi-ai tool-call arguments are parsed objects, so the adapter parses input and re-stringifies output to the harness raw-JSON convention; pi-ai in-stream error events map to terminal `finish` chunks. Protocol conversion operates on request-local copies. Switching from A to B and back to A preserves the stored content, including empty text blocks, tool ids, original block order, and native replay metadata; unsupported signatures are omitted only from the foreign request.
|
|
160
186
|
|
|
161
187
|
</details>
|
|
162
188
|
|
|
@@ -183,7 +209,7 @@ Read these pages when the package-level contract is not enough. They move from t
|
|
|
183
209
|
|
|
184
210
|
#### What the model sees
|
|
185
211
|
|
|
186
|
-
The selected catalog model receives
|
|
212
|
+
The selected catalog model receives system-message text, conversation history, tools, and supported sampling fields. The adapter preserves later system messages in history order; pi-ai owns protocol-specific placement and concatenates them at the beginning for models without mid-conversation system support. One-shot `GenerateOptions.system` precedes the initial history prompt. Repeated system messages remain repeated; empty system messages are skipped without discarding earlier text. Tool-update capabilities select the shared historical declaration projection; pi-ai receives initially active tools and grouped developer updates carrying additions and supported removals. When every projected declaration of an Anthropic request with tool updates is deferred, the initially active tools are one placeholder, `DeferredToolPlaceholder`, whose description tells the model never to call it; a call reaches the ordinary unknown-tool result. Anthropic receives later tool definitions inline in the update message. Replay preserves tool-call namespaces for dynamically loaded Responses tools. Each retained image is preceded by text naming its complete attachment id and actual request dimensions. When the current execution filesystem maps the attachment provider's host object, the text also carries a read-only normalized-object path and warns that normalization or request projection may have resized or re-encoded the upload. Each occurrence selected by a logged image-offload decision keeps its own identity and currently resolved access in replacement text, and its normalized attachment is not read or transformed. When the retained occurrences' exact base64 payload still exceeds the route's `maxRequestImageBytes`, the call fails with `IMAGE_OFFLOAD_REQUIRED` so `dsh-compaction-image-offload` records the selected occurrences in an `image/offload` event and retries the step. Provider-native replay metadata is restored only when the adapter validates it for the historical content. `imageRequestTarget(provider, model, image)` exposes the same request-image dimensions and byte target to screenshot consumers; adapters without image resizing preserve the normalized source.
|
|
187
213
|
|
|
188
214
|
#### Token effect
|
|
189
215
|
|
|
@@ -216,20 +242,22 @@ These limits define where the adapter stops and future work begins. They are cur
|
|
|
216
242
|
|
|
217
243
|
- **`maxRequestImageBytes` counts base64 image payload only** — text, tools, descriptors, and JSON structure ride outside the bound, so it must sit below the gateway's request-body cap with headroom.
|
|
218
244
|
- **A sign-in lives only in the process that started it** — an authorization attempt is not durable, so reloading the page mid-login abandons it and the human starts over. Signing out is `deleteRecord` on the stored record, which forgets it locally without telling the issuer.
|
|
245
|
+
- **OpenAI offers no ChatGPT sign-in** — pi-ai's Sign in with ChatGPT identifies the installation to OpenAI with a stable UUID the app supplies, and the harness keeps no installation ID meant for a third-party account sign-in; the `openai` route signs in with an API key.
|
|
219
246
|
- **Provider-native discovery answers through this plugin's ambient context** — a route naming no credential defers to the catalog provider's own resolution, which asks for environment values (`AZURE_OPENAI_API_KEY`, `AWS_PROFILE`, and each provider's own set) and for local credential files. Both questions are answered here: the credential seam is consulted before the process environment, and file existence is checked against the host process's filesystem with `~` expanded. What it cannot do is *read* a credential file's contents — a provider that parses `~/.aws/credentials` itself does so directly, outside the seam.
|
|
220
247
|
- **Reset restores inherited configuration** — resetting a route supplied by a lower profile layer restores that route.
|
|
221
248
|
- **Complete Config replacement can remove inherited dictionary entries** — a field reset instead restores its inherited value.
|
|
222
249
|
- **`headers` can carry a credential the redactor never sees** — profile resolution rejects names and values Fetch cannot represent, but the dict remains plain strings; store credentials as `apiKeyEnv` references.
|
|
223
250
|
- **Discovery does not change configured models** — adopt discovery results explicitly into the route configuration.
|
|
224
251
|
- **Anthropic discovery reads at most 1,000 models** — the request uses the API's maximum page size but does not traverse `has_more`; entries beyond the first page must be added by hand.
|
|
225
|
-
- **
|
|
252
|
+
- **Uncataloged models need an unambiguous protocol** — catalog routes preserve each model's protocol, including both Azure APIs under `azure`. A model absent from a mixed-protocol catalog needs an explicit route-level `api`, which overrides every model on the route and must be one of the supported custom protocols. For Azure deployment names, keep the catalog model ID and set `AZURE_OPENAI_DEPLOYMENT_NAME_MAP`.
|
|
226
253
|
- **A modality declaration is not verified** — a model declaring `image` its gateway does not serve is refused by the provider after prompt admission. The durable image remains in history and the same misdeclared model can fail again; switching to a text-only model remains possible because the shared LLM runtime projects image references into stable text for that request.
|
|
227
254
|
- **An unauthenticated route depends on its protocol** — a route naming no credential resolves as configured-but-keyless, but pi-ai's OpenAI-compatible implementation still requires an API key or an `Authorization` header, so a keyless local server needs a placeholder credential referenced by `apiKeyEnv` or an `Authorization` entry in `headers`.
|
|
228
255
|
- **`GenerateOptions.stop` is unsupported** — pi-ai's common stream options cannot guarantee stop-sequence behavior across providers.
|
|
229
|
-
- **
|
|
256
|
+
- **Conversation update support comes only from the installed pi-ai catalog** — a route receives in-history prompt and tool updates only when its catalog model declares the mid-conversation compat flags, and profiles cannot set them; hand-declared routes and unflagged models receive the concatenated system messages and the complete current tool list at the start of each request.
|
|
257
|
+
- **Images are accepted only in user and tool-result messages** — images in system, developer, or assistant history fail with `UNSUPPORTED_CONTENT` on both conversion paths.
|
|
230
258
|
- **Provider HTTP status is unavailable** — pi-ai error events do not expose a stable HTTP status across providers.
|
|
231
259
|
- **Retry policy is provider-owned, not an SDK retry** — pi-ai SDK retries stay disabled so durable agent steps and `llm/retry` events own every visible attempt, and direct `ctx.llm.stream()` calls remain single-attempt.
|
|
232
|
-
- **Streamed tool-call arguments
|
|
260
|
+
- **Streamed JSON tool-call arguments avoid per-delta reparsing** — the installed pi-ai carries [`patches/@earendil-works__pi-ai@1.1.0.patch`](../../../patches/@earendil-works__pi-ai@1.1.0.patch), which removes the per-delta re-parse of the whole accumulated argument JSON in every stream adapter (upstream [earendil-works/pi#9265](https://github.com/earendil-works/pi/issues/9265)); unpatched, a multi-megabyte argument stream costs O(n²) CPU on the event loop and stalls every session in the process. Completion events supply parsed arguments; Responses may parse at both argument completion and output-item completion. This adapter reads only delta strings and finalized arguments. Re-apply or retire the patch on every pi-ai upgrade.
|
|
233
261
|
|
|
234
262
|
<a id="dev-note"></a>
|
|
235
263
|
### Dev Note
|
package/README.zh.md
CHANGED
|
@@ -102,6 +102,8 @@ profile 的 `models` 列表会替换而非扩展路由的已安装目录;每
|
|
|
102
102
|
|
|
103
103
|
`reasoningEfforts` 声明模型可选择的 thinking 等级:每个键都是选择器提供的等级,其值是分派时在协议中发送的拼写,因此 `max: ultra` 可以为拥有自有词汇的网关重命名等级。省略该字段时保留已安装目录条目的能力;`false` 声明非推理模型。对于 pi-ai 无法识别的端点,`compat` 开关重塑请求——哪个角色携带系统提示词、哪个字段限制输出、thinking 等级如何传递——可逐路由、逐模型配置。条目与已安装目录都没有尺寸的模型,会采用路由的 `defaultContextWindow` 与 `defaultMaxTokens` 回退值。
|
|
104
104
|
|
|
105
|
+
确切模型元数据将 `reasoning.efforts` 按可选强度从低到高排列。配置函数可从该列表中选择,再由 `prepareCall()` 校验具体强度。适配器只接收解析后的控制项。选择 `off` 不保证禁用推理:以省略推理字段表达该值的协议会沿用网关默认行为。所选等级下产生的推理 token 都计入该请求的输出上限。
|
|
106
|
+
|
|
105
107
|
对于自托管 Chat Completions 端点,`thinkingTokenBudgetField` 选择推理预算参数,`vllmPriority` 在服务端启用优先级调度时设置整数调度优先级。模板参数接受 `$var: thinking.budget`。`openai-responses` 网关可设置 `supportsMaxOutputTokens: false` 来省略 `max_output_tokens`;Azure 与 Codex 传输会忽略这个共享兼容字段。这些控制均需显式启用;目录拥有的 Anthropic effort 和回退能力不是可配置开关。
|
|
106
108
|
|
|
107
109
|
### 运行时更改配置
|
|
@@ -120,6 +122,8 @@ Config 更新严格验证发生变化的 provider。初始加载将已存储的
|
|
|
120
122
|
|
|
121
123
|
只修改 `displayName`、`apiKeyEnv` 或 `baseURL` 而未解决提供方的模型配置错误时,保存仍会被拒绝。例如,OpenRouter 路由的模型 `111` 缺少 `api` 时,不能单独保存路由名称的修改:需要在同一份编辑草稿中修复或删除该模型,再保存完整的提供方配置。中间修复状态保留在草稿中,直到整条提供方配置通过校验;其他提供方可以独立保存。
|
|
122
124
|
|
|
125
|
+
模型发现会解析各路由的凭据配置。缺少必需凭据时返回空目录;其他解析错误继续抛出。使用原生认证或无需密钥的路由保留其配置的目录。此检查不会探测推理端点。
|
|
126
|
+
|
|
123
127
|
-----
|
|
124
128
|
|
|
125
129
|
<a id="understand-the-implementation"></a>
|
|
@@ -134,6 +138,8 @@ Config 更新严格验证发生变化的 provider。初始加载将已存储的
|
|
|
134
138
|
|
|
135
139
|
适配器建立在不可变快照与按操作解析之上。每个操作都会在第一次 `await` 前捕获整个快照——profile 加一个持有每条路由所构建 `Provider` 的 `createModels()` 集合——配置变更会构建新集合而非修改使用中的集合,因此在一个配置下开始的请求绝不会在另一个配置下结束。路由自己的凭据引用经 harness seam 解析,并以请求 `apiKey` 选项传入,pi-ai 将其视为优先级最高的 auth 覆盖——这正是明确失败引用语义的所在。该覆盖未覆盖的一切都经集合自身的 auth 到达 pi-ai:凭据存储持有登录写入、刷新轮换的记录(以 `llm-pi-ai/<provider id>` 寻址),auth context 回答提供方解析时提出的 ambient 问题。两者跨快照保持稳定,因此配置变更重建集合时不会忘记谁已登录。运行时 import 使用 pi-ai 的 provider、API 与 utility 入口;`src/models.ts` 提供本适配器所需的少量 model helper,而不会求值 pi-ai 聚合入口。
|
|
136
140
|
|
|
141
|
+
初始提示词文本和可用工具分别使用 pi-ai 的 `Context.systemPrompt` 与 `Context.tools`;后续系统消息和工具更新保留在 `Context.messages` 中。pi-ai 负责规范化这些字段,并应用所选协议的序列化规则。
|
|
142
|
+
|
|
137
143
|
### 源码地图
|
|
138
144
|
|
|
139
145
|
| 文件 | 职责 |
|
|
@@ -143,6 +149,7 @@ Config 更新严格验证发生变化的 provider。初始加载将已存储的
|
|
|
143
149
|
| [`src/login.ts`](src/login.ts) | 面向提供登录的已安装提供方的授权流程 |
|
|
144
150
|
| [`src/config.ts`](src/config.ts) | Profile schema、解析与可服务性校验 |
|
|
145
151
|
| [`src/catalog.ts`](src/catalog.ts) | 已安装目录集成与漂移门禁 |
|
|
152
|
+
| [`src/provider-data.ts`](src/provider-data.ts) | 配置界面使用的认证与端点生成数据 |
|
|
146
153
|
| [`src/models.ts`](src/models.ts) | 基于 pi-ai 窄入口的 model collection、静态 provider 与 reasoning level |
|
|
147
154
|
| [`src/provider.ts`](src/provider.ts) | 受支持协议表与提供方构建 |
|
|
148
155
|
| [`src/context.ts`](src/context.ts) | Harness 到 pi-ai 的上下文转换、图片处理、回放恢复 |
|
|
@@ -152,11 +159,30 @@ Config 更新严格验证发生变化的 provider。初始加载将已存储的
|
|
|
152
159
|
|
|
153
160
|
### 注册与目录
|
|
154
161
|
|
|
155
|
-
插件会在可配置提供方目录中声明它能认证的每个已安装目录提供方,并加入当前 profile
|
|
162
|
+
插件会在可配置提供方目录中声明它能认证的每个已安装目录提供方,并加入当前 profile 声明的每条路由,因此配置界面可以在任何路由存在之前提供完整目录。目录列出了模型却没有聊天模型的提供方(例如只有分类器模型)不进入目录,也不注册登录流程,因为本适配器只分派聊天请求。每个条目都携带 `declared`——pi-ai 是否在该键下不提供任何内容——因为只有适配器能区分手工声明路由与收窄目录路由。目录条目以 `defaultBaseURL` 表示提供方的固定端点或全部模型共用的固定端点,以 `baseURLEnv` 表示端点配置变量,以 `nativeAuth` 表示认证变量和 OAuth 可用性。不同模型的端点和未展开的 URL 模板不会显示为单一固定默认值。路由注册具有原子性:与其他适配器冲突的候选集合会让此前路由继续服务。零路由的裸挂载即休眠姿态:settings 分节提供 profile 前不注册任何内容,分节清空时路由随之消失。
|
|
163
|
+
|
|
164
|
+
<a id="generated-provider-metadata"></a>
|
|
165
|
+
### 生成的提供方元数据
|
|
166
|
+
|
|
167
|
+
[`scripts/gen-provider-data.ts`](scripts/gen-provider-data.ts) 负责生成 [`src/provider-data.generated.ts`](src/provider-data.generated.ts)。它通过公开 resolver 和模拟的 `AuthContext` 回答,探测空配置、单个变量及变量后缀组合下的环境读取。resolver 失败时使用临时兼容入口的 `findEnvKeys`。当前所有认证变量都来自 resolver,无需认证变量补充。生成器会报告回退;缺少回退数据时生成失败。它不读取真实凭据,不启动登录流程,也不发送模型请求。探测覆盖已安装的 resolver,不能证明所有依赖具体变量值的分支。
|
|
168
|
+
|
|
169
|
+
端点数据来自公开的提供方及模型目录,以及 URL 中的大写变量占位符。Azure、Vertex 和 Bedrock 需补充认证上下文之外读取的变量。运行时读取目录不执行探测。依赖范围保持不变。用户安装的新版本新增提供方时,重新生成之前不显示其认证变量提示。已有提供方的环境变量名和端点发生变化时,也会继续使用生成快照,直到重新生成。环境提示只检查列出的凭据引用,不检查 AWS profile 或 Google 应用默认凭据等提供方管理的文件。
|
|
170
|
+
|
|
171
|
+
更新 pi-ai 或修改生成器后,先按更新的锁文件安装依赖,再从仓库根目录运行以下命令:
|
|
172
|
+
|
|
173
|
+
```sh
|
|
174
|
+
pnpm run gen-provider-data
|
|
175
|
+
pnpm run verify-provider-data
|
|
176
|
+
git add packages/llm/llm-pi-ai/src/provider-data.generated.ts
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
检查生成的 diff,并一同暂存依赖或生成器的改动。不要手工编辑生成文件。生成失败时,先解决错误再提交。
|
|
180
|
+
|
|
181
|
+
暂存 `pnpm-lock.yaml`、本包的 `package.json`、生成器或生成文件时,`pre-commit` 钩子会直接运行 `node_modules/.bin/tsx packages/llm/llm-pi-ai/scripts/gen-provider-data.ts --check --cached`,无需 Git 客户端的 PATH 中有 `pnpm`。它将暂存的生成文件与基于已安装依赖和当前生成器计算的预期数据比较,不改写或暂存文件。只更新工作区文件还不够;生成文件也必须暂存。检查报告元数据过期时,请重新运行上述命令,再尝试提交。即使本地钩子未触发,CI 仍会基于检出文件和按锁文件安装的依赖运行 `pnpm run verify-provider-data`。
|
|
156
182
|
|
|
157
183
|
### 回放与词汇
|
|
158
184
|
|
|
159
|
-
成功 assistant 响应会存储带版本的、无损 JSON 回放状态,与产生它们的提供方和模型放在一起——响应级事实加每个流式块一条逐块条目。请求时,`LlmRuntime` 仅当同一适配器实例拥有两条路由时才传递回放状态;适配器校验它并恢复原生响应 id、提供方签名与可选的 `providerThinkingLevel` effort 元数据,缺失的 effort 元数据仍保持缺失。回放会对照 assistant 来源校验请求模型身份,并用它保留同模型签名;提供方报告的响应模型仅作为诊断元数据。回放状态缺失或无法使用时会降级为提供方无关内容,并保留 assistant 来源中必需的提供方和模型。pi-ai 工具调用参数是解析后的对象,因此适配器解析输入并重新字符串化输出,以符合 harness 原始 JSON 约定;pi-ai 流内错误事件映射为终止 `finish` 分片。
|
|
185
|
+
成功 assistant 响应会存储带版本的、无损 JSON 回放状态,与产生它们的提供方和模型放在一起——响应级事实加每个流式块一条逐块条目。请求时,`LlmRuntime` 仅当同一适配器实例拥有两条路由时才传递回放状态;适配器校验它并恢复原生响应 id、提供方签名与可选的 `providerThinkingLevel` effort 元数据,缺失的 effort 元数据仍保持缺失。回放会对照 assistant 来源校验请求模型身份,并用它保留同模型签名;提供方报告的响应模型仅作为诊断元数据。回放状态缺失或无法使用时会降级为提供方无关内容,并保留 assistant 来源中必需的提供方和模型。pi-ai 工具调用参数是解析后的对象,因此适配器解析输入并重新字符串化输出,以符合 harness 原始 JSON 约定;pi-ai 流内错误事件映射为终止 `finish` 分片。 协议转换仅作用于请求副本。从 A 切换到 B 再切回 A 时,存储的内容保持完整,包括空文本块、工具 id、原始块顺序和原生回放元数据;不受支持的签名仅从发给其他协议的请求中省略。
|
|
160
186
|
|
|
161
187
|
</details>
|
|
162
188
|
|
|
@@ -183,7 +209,7 @@ Config 更新严格验证发生变化的 provider。初始加载将已存储的
|
|
|
183
209
|
|
|
184
210
|
#### 模型看到什么
|
|
185
211
|
|
|
186
|
-
|
|
212
|
+
所选目录模型会收到系统消息文本、对话历史、工具以及支持的采样字段。适配器按历史顺序保留后续系统消息;pi-ai 负责各协议的消息位置,并为不支持对话中系统消息的模型将它们拼接到开头。单次调用的 `GenerateOptions.system` 放在初始历史提示词之前。重复的系统消息仍会重复发送;空系统消息会被跳过,不会丢弃之前的文本。工具更新能力选择共享的历史声明投影;pi-ai 接收初始可用工具,以及按开发者消息分组的新增和受支持的移除更新。当包含工具更新的 Anthropic 请求中所有投影后的声明均为延迟加载时,初始可用工具为一个占位工具 `DeferredToolPlaceholder`,其描述要求模型永不调用它;若被调用,会得到普通的未知工具结果。Anthropic 在更新消息中以内联方式接收后续工具定义。回放会保留工具调用命名空间,以支持动态加载的 Responses 工具。每张保留图片前都会有文本,注明其完整附件 id 与实际请求尺寸。当前执行文件系统可以映射附件提供方的宿主对象时,该文本还会携带只读规范化对象路径,并警告规范化或请求投影可能缩放或重新编码上传内容。日志中的图片省略决策选中的每个出现位置都会在替换文本中保留自己的身份与当前已解析访问方式,其规范化附件不会读取或变换。当保留的出现位置按精确 base64 载荷仍超过路由的 `maxRequestImageBytes` 时,调用以 `IMAGE_OFFLOAD_REQUIRED` 失败,由 `dsh-compaction-image-offload` 用 `image/offload` 事件记录所选位置并重试步骤。提供方原生回放元数据只在适配器针对历史内容校验通过后恢复。 `imageRequestTarget(provider, model, image)` 向截图调用方提供与模型请求一致的图片尺寸和字节目标;不缩放图片的适配器保留归一化后的原图。
|
|
187
213
|
|
|
188
214
|
#### Token 影响
|
|
189
215
|
|
|
@@ -216,20 +242,22 @@ pi-ai 事件变成 harness 的推理、文本、工具调用、用量与 finish
|
|
|
216
242
|
|
|
217
243
|
- **`maxRequestImageBytes` 只计算 base64 图片载荷**,文本、工具、描述符与 JSON 结构在该上限之外,因此它必须留有余量地低于网关请求体上限。
|
|
218
244
|
- **登录只存在于发起它的进程中**——授权尝试不持久,因此登录中途刷新页面会放弃它,用户需要重新开始。退出登录是对已存储记录执行 `deleteRecord`,只在本地忘记它,不会告知签发方。
|
|
245
|
+
- **OpenAI 不提供 ChatGPT 登录**——pi-ai 的 Sign in with ChatGPT 用应用提供的稳定 UUID 向 OpenAI 标识安装实例,而 harness 没有用于第三方账号登录的安装 ID;`openai` 路由改用 API key 登录。
|
|
219
246
|
- **提供方原生发现经本插件的 ambient context 回答**——不点名凭据的路由交由目录提供方自身解析,它会询问环境值(`AZURE_OPENAI_API_KEY`、`AWS_PROFILE` 及各提供方自有集合)与本地凭据文件。两个问题都在这里得到回答:凭据 seam 先于进程环境被查询,文件存在性则针对宿主进程的文件系统以 `~` 展开后检查。它做不到的是*读取*凭据文件内容——自行解析 `~/.aws/credentials` 的提供方会直接读取,不经该 seam。
|
|
220
247
|
- **重置恢复继承配置**——重置下层 profile 提供的路由会恢复该路由。
|
|
221
248
|
- **完整替换 Config 可以移除继承的字典条目**——字段重置则恢复其继承值。
|
|
222
249
|
- **`headers` 可以携带 redactor 永远看不到的凭据**——profile 解析会拒绝 Fetch 无法表示的名称与值,但该字典仍是纯字符串;以 `apiKeyEnv` 引用存储凭据。
|
|
223
250
|
- **发现操作不更改已配置模型**——需显式将发现结果采纳到路由配置中。
|
|
224
251
|
- **Anthropic 模型发现最多读取 1,000 个模型**——请求使用 API 的最大页大小,但不会遍历 `has_more`;第一页之外的条目需要手工添加。
|
|
225
|
-
-
|
|
252
|
+
- **目录外模型需要明确的协议**——目录路由保留每个模型的协议,包括 `azure` 下的两种 Azure API。混合协议目录中不存在的模型需要显式设置路由级 `api`;该设置覆盖路由上的所有模型,且必须属于受支持的自定义协议。Azure 部署名称应通过 `AZURE_OPENAI_DEPLOYMENT_NAME_MAP` 设置,模型 ID 保持为目录中的 ID。
|
|
226
253
|
- **模态声明不受校验**——声明 `image` 而其网关不支持的模型会在提示词准入后被提供方拒绝。持久图片仍留在历史中,同一误声明模型可能再次失败;切换到纯文本模型仍然可行,因为共享 LLM 运行时会针对该请求把图片引用投影为稳定文本。
|
|
227
254
|
- **未认证路由取决于其协议**——不点名凭据的路由解析为已配置但无密钥,但 pi-ai 的 OpenAI 兼容实现仍要求 API 密钥或 `Authorization` 标头,因此无密钥本地服务器需要由 `apiKeyEnv` 引用或 `headers` 中的 `Authorization` 条目提供的占位凭据。
|
|
228
255
|
- **不支持 `GenerateOptions.stop`**——pi-ai 的通用流式选项无法跨提供方保证停止序列行为。
|
|
229
|
-
-
|
|
256
|
+
- **对话更新支持只来自已安装的 pi-ai 目录**——只有当路由的目录模型声明了对话中 compat 标志时,该路由才会在历史中接收提示词与工具更新,且 profile 不能设置这些标志;手工声明的路由与未标记的模型会在每次请求开头接收拼接后的系统消息与完整的当前工具列表。
|
|
257
|
+
- **图片只在 user 与工具结果消息中被接受**——system、developer 或 assistant 历史中的图片在两条转换路径上都会以 `UNSUPPORTED_CONTENT` 失败。
|
|
230
258
|
- **提供方 HTTP 状态不可用**——pi-ai 错误事件不跨提供方暴露稳定 HTTP 状态。
|
|
231
259
|
- **重试策略由提供方自有,而非 SDK 重试**——pi-ai SDK 重试保持禁用,因此持久 agent(智能体)步骤与 `llm/retry` 事件拥有每个可见尝试,直接 `ctx.llm.stream()` 调用仍是单次尝试。
|
|
232
|
-
-
|
|
260
|
+
- **流式 JSON 工具调用参数避免逐 delta 重复解析**——安装的 pi-ai 带有 [`patches/@earendil-works__pi-ai@1.1.0.patch`](../../../patches/@earendil-works__pi-ai@1.1.0.patch),它移除了每个流适配器中对整段累计参数 JSON 的逐 delta 重新解析(上游 [earendil-works/pi#9265](https://github.com/earendil-works/pi/issues/9265));未打补丁时,数 MB 的参数流会在事件循环上消耗 O(n²) CPU,并使进程内所有会话停滞。完成事件提供解析后的参数;Responses 可能在参数完成和输出项完成时分别解析。本适配器只读取 delta 字符串与最终参数。每次升级 pi-ai 时都要重新应用或撤销该补丁。
|
|
233
261
|
|
|
234
262
|
<a id="dev-note"></a>
|
|
235
263
|
### 开发备注
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { brandString } from "@deepseek-ai/dsh-brand";
|
|
|
6
6
|
import { requestImageDimensions } from "@deepseek-ai/dsh-attachment";
|
|
7
7
|
import z from "@deepseek-ai/schemastery";
|
|
8
8
|
import { credentialKey, credentialKeyId, credentialKeyScope, credentialRef, isCredentialKeySegment, isCredentialRefName } from "@deepseek-ai/dsh-credentials";
|
|
9
|
-
import { builtinModels, builtinProviders,
|
|
9
|
+
import { builtinModels, builtinProviders, getAllBuiltinModels, getBuiltinModels } from "@earendil-works/pi-ai/providers/all";
|
|
10
10
|
import { anthropicMessagesApi } from "@earendil-works/pi-ai/api/anthropic-messages.lazy";
|
|
11
11
|
import { openAICompletionsApi } from "@earendil-works/pi-ai/api/openai-completions.lazy";
|
|
12
12
|
import { openAIResponsesApi } from "@earendil-works/pi-ai/api/openai-responses.lazy";
|
|
@@ -84,7 +84,8 @@ function toPiReplayState(message, requestedModel = message.model) {
|
|
|
84
84
|
};
|
|
85
85
|
case "toolCall": return {
|
|
86
86
|
type: "tool-call",
|
|
87
|
-
...block.thoughtSignature === void 0 ? {} : { thoughtSignature: block.thoughtSignature }
|
|
87
|
+
...block.thoughtSignature === void 0 ? {} : { thoughtSignature: block.thoughtSignature },
|
|
88
|
+
...block.namespace === void 0 ? {} : { namespace: block.namespace }
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
})
|
|
@@ -130,7 +131,8 @@ function readReplayState(value) {
|
|
|
130
131
|
for (const signature of [
|
|
131
132
|
"textSignature",
|
|
132
133
|
"thinkingSignature",
|
|
133
|
-
"thoughtSignature"
|
|
134
|
+
"thoughtSignature",
|
|
135
|
+
"namespace"
|
|
134
136
|
]) if (block[signature] !== void 0 && typeof block[signature] !== "string") return invalidReplay(`block ${index} ${signature} must be a string`);
|
|
135
137
|
if (block["redacted"] !== void 0 && typeof block["redacted"] !== "boolean") return invalidReplay(`block ${index} redacted must be boolean`);
|
|
136
138
|
}
|
|
@@ -206,7 +208,8 @@ function replayedAssistant(message, source, rawState) {
|
|
|
206
208
|
id: block.id,
|
|
207
209
|
name: block.name,
|
|
208
210
|
arguments: parseArguments(block.arguments),
|
|
209
|
-
...replay.type === "tool-call" && replay.thoughtSignature !== void 0 ? { thoughtSignature: replay.thoughtSignature } : {}
|
|
211
|
+
...replay.type === "tool-call" && replay.thoughtSignature !== void 0 ? { thoughtSignature: replay.thoughtSignature } : {},
|
|
212
|
+
...replay.type === "tool-call" && replay.namespace !== void 0 ? { namespace: replay.namespace } : {}
|
|
210
213
|
};
|
|
211
214
|
/* v8 ignore next -- readReplayState rejects unknown replay tags, so an equal plugin-added Harness tag cannot reach this switch */
|
|
212
215
|
default: return invalidReplay(`block ${index} has an unsupported Harness type`);
|
|
@@ -337,34 +340,49 @@ const CHAT_TEMPLATE_VARS = Object.keys({
|
|
|
337
340
|
});
|
|
338
341
|
let providerIndex;
|
|
339
342
|
/**
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
343
|
+
* Whether this adapter serves one installed catalog provider. It dispatches
|
|
344
|
+
* chat requests only, so a provider whose catalog lists models but no chat
|
|
345
|
+
* model (image-generation or classifier models alone) is not a catalog route;
|
|
346
|
+
* a provider whose catalog lists no models at all stays one.
|
|
347
|
+
* @param provider - the installed provider.
|
|
348
|
+
* @returns whether the provider ships a chat model or lists no models.
|
|
349
|
+
*/
|
|
350
|
+
function servesChat(provider) {
|
|
351
|
+
const id = provider.id;
|
|
352
|
+
return getBuiltinModels(id).length > 0 || getAllBuiltinModels(id).length === 0;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Installed catalog providers this adapter serves, by id, constructed once.
|
|
356
|
+
* Each entry owns the API implementations for its own models, which is why a
|
|
357
|
+
* catalog route reuses this provider instead of being rebuilt from parts.
|
|
358
|
+
* @returns the catalog provider index, in catalog order.
|
|
344
359
|
*/
|
|
345
360
|
function catalogProviders() {
|
|
346
|
-
providerIndex ??= new Map(builtinProviders().map((provider) => [provider.id, provider]));
|
|
361
|
+
providerIndex ??= new Map(builtinProviders().filter(servesChat).map((provider) => [provider.id, provider]));
|
|
347
362
|
return providerIndex;
|
|
348
363
|
}
|
|
349
364
|
/**
|
|
350
|
-
* The installed catalog provider for one route, when pi-ai ships one
|
|
365
|
+
* The installed catalog provider for one route, when pi-ai ships one this
|
|
366
|
+
* adapter serves.
|
|
351
367
|
* @param provider - provider route key.
|
|
352
|
-
* @returns the catalog provider, or `undefined` for a route pi-ai does not ship
|
|
368
|
+
* @returns the catalog provider, or `undefined` for a route pi-ai does not ship
|
|
369
|
+
* or ships without a chat model.
|
|
353
370
|
*/
|
|
354
371
|
function catalogProvider(provider) {
|
|
355
372
|
return catalogProviders().get(provider);
|
|
356
373
|
}
|
|
357
374
|
/**
|
|
358
|
-
* Every provider route the installed pi-ai catalog ships
|
|
359
|
-
*
|
|
375
|
+
* Every provider route the installed pi-ai catalog ships and this adapter
|
|
376
|
+
* serves: a provider whose catalog lists models but no chat model is left out.
|
|
377
|
+
* @returns the catalog provider ids, in catalog order.
|
|
360
378
|
*/
|
|
361
379
|
function catalogProviderIds() {
|
|
362
|
-
return
|
|
380
|
+
return [...catalogProviders().keys()];
|
|
363
381
|
}
|
|
364
382
|
/**
|
|
365
383
|
* The installed catalog models for one route, indexed by model id.
|
|
366
384
|
* @param provider - provider route key.
|
|
367
|
-
* @returns catalog models by id; empty for a route
|
|
385
|
+
* @returns catalog models by id; empty for a route {@link catalogProvider} does not return.
|
|
368
386
|
*/
|
|
369
387
|
function catalogModels(provider) {
|
|
370
388
|
if (!catalogProviders().has(provider)) return /* @__PURE__ */ new Map();
|
|
@@ -759,6 +777,20 @@ function getSupportedThinkingLevels(model) {
|
|
|
759
777
|
return true;
|
|
760
778
|
});
|
|
761
779
|
}
|
|
780
|
+
/**
|
|
781
|
+
* Resolve transcript update modes from the exact model's protocol capabilities.
|
|
782
|
+
* @param model - Materialized pi-ai model, including catalog compatibility flags.
|
|
783
|
+
* @returns Update modes consumed by prompt admission and tool-history projection.
|
|
784
|
+
*/
|
|
785
|
+
function conversationUpdates(model) {
|
|
786
|
+
const compat = model.compat;
|
|
787
|
+
if (compat === void 0 || !("supportsMidConvoSystemMessages" in compat) || !compat.supportsMidConvoSystemMessages) return {};
|
|
788
|
+
const updates = { systemPromptUpdate: "in-history" };
|
|
789
|
+
if (model.api === "anthropic-messages" && "supportsMidConvoToolChanges" in compat && compat.supportsMidConvoToolChanges) updates.toolUpdate = "in-history";
|
|
790
|
+
else if (model.api === "openai-completions" && "supportsMidConvoToolAdditions" in compat && compat.supportsMidConvoToolAdditions) updates.toolUpdate = "addition-only";
|
|
791
|
+
else if ((model.api === "openai-responses" || model.api === "azure-openai-responses" || model.api === "openai-codex-responses") && ("supportsAdditionalTools" in compat && compat.supportsAdditionalTools || "supportsToolSearch" in compat && compat.supportsToolSearch)) updates.toolUpdate = "addition-only";
|
|
792
|
+
return updates;
|
|
793
|
+
}
|
|
762
794
|
//#endregion
|
|
763
795
|
//#region lib/types/provider.js
|
|
764
796
|
/**
|
|
@@ -1177,12 +1209,12 @@ function toolResultOf(message, toolNames, content) {
|
|
|
1177
1209
|
timestamp: 0
|
|
1178
1210
|
};
|
|
1179
1211
|
}
|
|
1180
|
-
/** Reject
|
|
1212
|
+
/** Reject misplaced tool-change blocks and unsupported image roles before replay or image offloading. */
|
|
1181
1213
|
function assertSupportedHistory(messages) {
|
|
1182
1214
|
for (const message of messages) {
|
|
1183
|
-
if (message.role
|
|
1184
|
-
if (message.content.some((block) => block.type === "tool-addition" || block.type === "tool-removal")) throw new LlmError("Tool-change blocks require developer role", "UNSUPPORTED_CONTENT");
|
|
1215
|
+
if (message.role !== "developer" && message.content.some((block) => block.type === "tool-addition" || block.type === "tool-removal")) throw new LlmError("Tool-change blocks require developer role", "UNSUPPORTED_CONTENT");
|
|
1185
1216
|
if (message.role !== "user" && message.role !== "tool" && contentHasImage(message.content)) throw new LlmError(`pi-ai cannot represent an image in an in-history ${message.role} message`, "UNSUPPORTED_CONTENT");
|
|
1217
|
+
if (message.role === "system" && message.content.some((block) => block.type !== "text")) throw new LlmError("pi-ai cannot represent non-text system messages", "UNSUPPORTED_CONTENT");
|
|
1186
1218
|
}
|
|
1187
1219
|
}
|
|
1188
1220
|
function userContent(blocks, requestImages, resolveImageAccess) {
|
|
@@ -1226,35 +1258,29 @@ async function prepareRequestImages(messages, attachments, budget, signal) {
|
|
|
1226
1258
|
for (const [index, ref] of orderedRefs.entries()) versions.set(ref.attachmentId, prepared[index]);
|
|
1227
1259
|
return versions;
|
|
1228
1260
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
return
|
|
1261
|
+
/** Convert a projected declaration without its harness-owned activation marker. */
|
|
1262
|
+
function piTool(tool) {
|
|
1263
|
+
return {
|
|
1232
1264
|
name: tool.name,
|
|
1233
1265
|
description: tool.description,
|
|
1234
1266
|
parameters: tool.parameters
|
|
1235
|
-
}
|
|
1267
|
+
};
|
|
1236
1268
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
* message. Otherwise a leading `system` history message supplies the prompt
|
|
1242
|
-
* and leaves the converted history; empty leading text sends no prompt.
|
|
1243
|
-
*/
|
|
1269
|
+
function toolsOf(options) {
|
|
1270
|
+
return options.tools?.filter((tool) => !tool.deferLoading).map(piTool);
|
|
1271
|
+
}
|
|
1272
|
+
/** Combine request-level text and leading system history into the initial prompt. */
|
|
1244
1273
|
function splitSystemPrompt(options) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
messages: options.messages
|
|
1253
|
-
};
|
|
1254
|
-
const text = flattenText(first);
|
|
1274
|
+
const text = [options.system];
|
|
1275
|
+
let end = 0;
|
|
1276
|
+
for (const message of options.messages) {
|
|
1277
|
+
if (message.role !== "system") break;
|
|
1278
|
+
text.push(flattenText(message));
|
|
1279
|
+
end++;
|
|
1280
|
+
}
|
|
1255
1281
|
return {
|
|
1256
|
-
systemPrompt: text.
|
|
1257
|
-
messages:
|
|
1282
|
+
systemPrompt: text.filter(Boolean).join("\n\n") || void 0,
|
|
1283
|
+
messages: options.messages.slice(end)
|
|
1258
1284
|
};
|
|
1259
1285
|
}
|
|
1260
1286
|
/** Assemble the request-level pi-ai context envelope shared by both conversion paths. */
|
|
@@ -1266,17 +1292,54 @@ function piContext(systemPrompt, options, messages) {
|
|
|
1266
1292
|
...tools !== void 0 && tools.length > 0 ? { tools } : {}
|
|
1267
1293
|
};
|
|
1268
1294
|
}
|
|
1295
|
+
/** Keep one developer event in one system update, resolving its projected tool declarations. */
|
|
1296
|
+
function appendDeveloper(message, options, messages) {
|
|
1297
|
+
const content = [];
|
|
1298
|
+
const toolsAdded = [];
|
|
1299
|
+
const toolsRemoved = [];
|
|
1300
|
+
for (const block of message.content) switch (block.type) {
|
|
1301
|
+
case "text":
|
|
1302
|
+
if (block.text.length > 0) content.push({
|
|
1303
|
+
type: "text",
|
|
1304
|
+
text: block.text
|
|
1305
|
+
});
|
|
1306
|
+
break;
|
|
1307
|
+
case "tool-addition": {
|
|
1308
|
+
const tool = options.tools?.find((tool) => tool.name === block.toolName);
|
|
1309
|
+
if (tool === void 0) throw new LlmError(`pi-ai tool update references undeclared tool "${block.toolName}"`, "INVALID_REQUEST");
|
|
1310
|
+
toolsAdded.push(piTool(tool));
|
|
1311
|
+
break;
|
|
1312
|
+
}
|
|
1313
|
+
case "tool-removal":
|
|
1314
|
+
toolsRemoved.push({ name: block.toolName });
|
|
1315
|
+
break;
|
|
1316
|
+
default: throw new LlmError(`pi-ai cannot represent developer content ${block.type}`, "UNSUPPORTED_CONTENT");
|
|
1317
|
+
}
|
|
1318
|
+
if (content.length === 0 && toolsAdded.length === 0 && toolsRemoved.length === 0) return;
|
|
1319
|
+
messages.push({
|
|
1320
|
+
role: "system",
|
|
1321
|
+
content,
|
|
1322
|
+
timestamp: 0,
|
|
1323
|
+
...toolsAdded.length === 0 ? {} : { toolsAdded },
|
|
1324
|
+
...toolsRemoved.length === 0 ? {} : { toolsRemoved }
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1269
1327
|
function appendAssistant(message, messages, toolNames, onReplayDegrade) {
|
|
1270
1328
|
const assistant = toPiAssistant(message, onReplayDegrade);
|
|
1271
1329
|
for (const block of assistant.content) if (block.type === "toolCall") toolNames.set(brandString(block.id), block.name);
|
|
1272
1330
|
messages.push(assistant);
|
|
1273
1331
|
}
|
|
1274
|
-
/** Append
|
|
1275
|
-
function
|
|
1332
|
+
/** Append shared system, developer, and assistant roles; true when consumed. */
|
|
1333
|
+
function appendSharedHistory(message, options, messages, toolNames, onReplayDegrade) {
|
|
1334
|
+
if (message.role === "developer") {
|
|
1335
|
+
appendDeveloper(message, options, messages);
|
|
1336
|
+
return true;
|
|
1337
|
+
}
|
|
1276
1338
|
if (message.role === "system") {
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1339
|
+
const content = flattenText(message);
|
|
1340
|
+
if (content.length > 0) messages.push({
|
|
1341
|
+
role: "system",
|
|
1342
|
+
content,
|
|
1280
1343
|
timestamp: 0
|
|
1281
1344
|
});
|
|
1282
1345
|
return true;
|
|
@@ -1294,7 +1357,7 @@ function textOnlyContext(options, onReplayDegrade) {
|
|
|
1294
1357
|
const messages = [];
|
|
1295
1358
|
for (const message of split.messages) {
|
|
1296
1359
|
if (contentHasImage(message.content)) throw new LlmError("pi-ai image conversion requires the durable attachment service", "UNSUPPORTED_CONTENT");
|
|
1297
|
-
if (
|
|
1360
|
+
if (appendSharedHistory(message, options, messages, toolNames, onReplayDegrade)) continue;
|
|
1298
1361
|
if (message.role === "tool") {
|
|
1299
1362
|
messages.push(toolResultOf(message, toolNames, flattenText(message)));
|
|
1300
1363
|
continue;
|
|
@@ -1307,7 +1370,12 @@ function textOnlyContext(options, onReplayDegrade) {
|
|
|
1307
1370
|
}
|
|
1308
1371
|
return piContext(split.systemPrompt, options, messages);
|
|
1309
1372
|
}
|
|
1310
|
-
/**
|
|
1373
|
+
/**
|
|
1374
|
+
* Resolve the request target for one source under the route budgets.
|
|
1375
|
+
* @param ref - normalized source image.
|
|
1376
|
+
* @param budget - resolved route pixel and byte limits.
|
|
1377
|
+
* @returns dimensions and byte target shared by serialization and screenshot coordinate mapping.
|
|
1378
|
+
*/
|
|
1311
1379
|
function requestImageTarget(ref, budget) {
|
|
1312
1380
|
return {
|
|
1313
1381
|
...requestImageDimensions(ref.width, ref.height, budget.maxPixels),
|
|
@@ -1337,7 +1405,7 @@ async function toPiContextWithImages(options, images, onReplayDegrade) {
|
|
|
1337
1405
|
const toolNames = /* @__PURE__ */ new Map();
|
|
1338
1406
|
const messages = [];
|
|
1339
1407
|
for (const message of exactMessages) {
|
|
1340
|
-
if (
|
|
1408
|
+
if (appendSharedHistory(message, options, messages, toolNames, onReplayDegrade)) continue;
|
|
1341
1409
|
if (message.role === "tool") {
|
|
1342
1410
|
messages.push(toolResultOf(message, toolNames, userContent(message.content, requestImages, resolveImageAccess)));
|
|
1343
1411
|
continue;
|
|
@@ -1670,6 +1738,18 @@ var __disposeResources = (function(SuppressedError) {
|
|
|
1670
1738
|
var e = new Error(message);
|
|
1671
1739
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1672
1740
|
});
|
|
1741
|
+
/**
|
|
1742
|
+
* Initially active declaration added to an Anthropic request whose projected
|
|
1743
|
+
* tools are all deferred, because Anthropic rejects a tool list without one.
|
|
1744
|
+
*/
|
|
1745
|
+
const ANTHROPIC_TOOL_UPDATE_PLACEHOLDER = {
|
|
1746
|
+
name: "DeferredToolPlaceholder",
|
|
1747
|
+
description: "Reserved placeholder that keeps deferred tool loading active; never call this tool.",
|
|
1748
|
+
parameters: {
|
|
1749
|
+
type: "object",
|
|
1750
|
+
properties: {}
|
|
1751
|
+
}
|
|
1752
|
+
};
|
|
1673
1753
|
/** Copy profile stream knobs into pi-ai's common option vocabulary. */
|
|
1674
1754
|
function profileOptions(profile, reasoning, apiKey) {
|
|
1675
1755
|
const enabledReasoning = reasoning === "off" ? void 0 : reasoning;
|
|
@@ -1754,6 +1834,15 @@ var PiAiAdapter = class extends LlmAdapter {
|
|
|
1754
1834
|
super();
|
|
1755
1835
|
this.config = config;
|
|
1756
1836
|
}
|
|
1837
|
+
imageRequestTarget(provider, model, image) {
|
|
1838
|
+
const snapshot = this.current();
|
|
1839
|
+
this.modelOf(snapshot, provider, model);
|
|
1840
|
+
const profile = this.profileOf(snapshot, provider);
|
|
1841
|
+
return requestImageTarget(image, {
|
|
1842
|
+
maxPixels: profile.requestImagePixelBudget,
|
|
1843
|
+
maxBytes: profile.requestImageMaxBytes
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1757
1846
|
/**
|
|
1758
1847
|
* The snapshot for the current profiles. Resolution memoizes its result, so
|
|
1759
1848
|
* an unchanged configuration is recognized by identity; a changed one gets a
|
|
@@ -1796,9 +1885,15 @@ var PiAiAdapter = class extends LlmAdapter {
|
|
|
1796
1885
|
return this.current().profiles.get(provider)?.retryPolicy;
|
|
1797
1886
|
}
|
|
1798
1887
|
listModels(provider) {
|
|
1799
|
-
return Promise.resolve().then(() => {
|
|
1888
|
+
return Promise.resolve().then(async () => {
|
|
1800
1889
|
const snapshot = this.current();
|
|
1801
|
-
this.profileOf(snapshot, provider);
|
|
1890
|
+
const profile = this.profileOf(snapshot, provider);
|
|
1891
|
+
try {
|
|
1892
|
+
await this.config.resolveApiKey(provider, profile);
|
|
1893
|
+
} catch (error) {
|
|
1894
|
+
if (error instanceof LlmError && error.code === "MISSING_CREDENTIAL") return [];
|
|
1895
|
+
throw error;
|
|
1896
|
+
}
|
|
1802
1897
|
return snapshot.models.getModels(provider).map((model) => ({
|
|
1803
1898
|
provider,
|
|
1804
1899
|
id: model.id,
|
|
@@ -1825,7 +1920,8 @@ var PiAiAdapter = class extends LlmAdapter {
|
|
|
1825
1920
|
inputModalities: [...resolvedModel.input],
|
|
1826
1921
|
context: { contextWindow: resolvedModel.contextWindow },
|
|
1827
1922
|
...configuredMaxTokens === void 0 ? {} : { defaultMaxTokens: configuredMaxTokens },
|
|
1828
|
-
...reasoningInfo(resolvedModel, defaultLevel)
|
|
1923
|
+
...reasoningInfo(resolvedModel, defaultLevel),
|
|
1924
|
+
...conversationUpdates(resolvedModel)
|
|
1829
1925
|
};
|
|
1830
1926
|
}
|
|
1831
1927
|
prepareCall(provider, model, _signal) {
|
|
@@ -1848,6 +1944,12 @@ var PiAiAdapter = class extends LlmAdapter {
|
|
|
1848
1944
|
if (options.stop !== void 0) throw new LlmError("llm-pi-ai does not support GenerateOptions.stop", "UNSUPPORTED_OPTION");
|
|
1849
1945
|
const profile = this.profileOf(snapshot, options.provider);
|
|
1850
1946
|
const model = this.modelOf(snapshot, options.provider, options.model);
|
|
1947
|
+
const updates = conversationUpdates(model);
|
|
1948
|
+
const tools = options.tools ?? [];
|
|
1949
|
+
const request = model.api === "anthropic-messages" && updates.toolUpdate === "in-history" && tools.every((tool) => tool.deferLoading === true) && options.messages.some((message) => message.role === "developer" && message.content.some((block) => block.type === "tool-addition" || block.type === "tool-removal")) ? {
|
|
1950
|
+
...options,
|
|
1951
|
+
tools: [ANTHROPIC_TOOL_UPDATE_PLACEHOLDER, ...tools]
|
|
1952
|
+
} : options;
|
|
1851
1953
|
const reasoning = resolveReasoningLevel(model, options.reasoningEffort ?? profile.reasoning);
|
|
1852
1954
|
const apiKey = await this.config.resolveApiKey(options.provider, profile);
|
|
1853
1955
|
const consumer = new AbortController();
|
|
@@ -1866,8 +1968,8 @@ var PiAiAdapter = class extends LlmAdapter {
|
|
|
1866
1968
|
reason
|
|
1867
1969
|
});
|
|
1868
1970
|
};
|
|
1869
|
-
const context = attachments === void 0 ? toPiContext(
|
|
1870
|
-
...
|
|
1971
|
+
const context = attachments === void 0 ? toPiContext(request, void 0, onReplayDegrade) : await toPiContext({
|
|
1972
|
+
...request,
|
|
1871
1973
|
signal: watchdog.signal
|
|
1872
1974
|
}, {
|
|
1873
1975
|
attachments,
|
|
@@ -1890,8 +1992,6 @@ var PiAiAdapter = class extends LlmAdapter {
|
|
|
1890
1992
|
try {
|
|
1891
1993
|
while (true) {
|
|
1892
1994
|
const result = await watchdog.next(iterator);
|
|
1893
|
-
const timeout = timeoutOf(watchdog.signal, "LLM_STREAM_IDLE_TIMEOUT");
|
|
1894
|
-
if (timeout !== void 0) throw timeout;
|
|
1895
1995
|
if (result.done) {
|
|
1896
1996
|
exhausted = true;
|
|
1897
1997
|
return;
|
|
@@ -1901,9 +2001,8 @@ var PiAiAdapter = class extends LlmAdapter {
|
|
|
1901
2001
|
} finally {
|
|
1902
2002
|
if (!exhausted) {
|
|
1903
2003
|
consumer.abort("pi-ai stream consumer stopped");
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
} catch (_abortedSdkTeardown) {}
|
|
2004
|
+
/* v8 ignore next -- the detached drain only rejects while unwinding an abandoned stream. */
|
|
2005
|
+
iterator.return(void 0).catch(() => {});
|
|
1907
2006
|
}
|
|
1908
2007
|
}
|
|
1909
2008
|
} catch (error) {
|
|
@@ -2346,18 +2445,28 @@ async function discoverModels(request, storedProfile) {
|
|
|
2346
2445
|
* @module dsh-llm-pi-ai/login
|
|
2347
2446
|
*/
|
|
2348
2447
|
/**
|
|
2448
|
+
* Catalog providers whose OAuth login this adapter does not offer. pi-ai's Sign
|
|
2449
|
+
* in with ChatGPT (`openai`) identifies the installation to OpenAI with a
|
|
2450
|
+
* stable UUID that the app supplies through `LoginOptions.getDeviceId`, and it
|
|
2451
|
+
* refuses to start without one. The harness keeps no installation ID meant for
|
|
2452
|
+
* a third-party account sign-in, so the route signs in with an API key.
|
|
2453
|
+
*/
|
|
2454
|
+
const UNSERVED_OAUTH = new Set(["openai"]);
|
|
2455
|
+
/**
|
|
2349
2456
|
* The login methods one catalog provider offers.
|
|
2350
2457
|
*
|
|
2351
|
-
* A method appears only when pi-ai can actually run it: `oauth`
|
|
2352
|
-
*
|
|
2353
|
-
*
|
|
2354
|
-
*
|
|
2458
|
+
* A method appears only when pi-ai can actually run it: `oauth` carries a
|
|
2459
|
+
* `login` that runs without app-supplied login options except for the
|
|
2460
|
+
* providers in {@link UNSERVED_OAUTH}, while an api-key method has one only
|
|
2461
|
+
* when the provider collects its key interactively — which every installed one
|
|
2462
|
+
* currently does, so a key is typed into pi-ai's own prompt rather than into
|
|
2463
|
+
* the settings form.
|
|
2355
2464
|
* @param provider - the installed catalog provider, if pi-ai ships one.
|
|
2356
2465
|
* @returns its methods, most preferred first; empty when it offers no login.
|
|
2357
2466
|
*/
|
|
2358
2467
|
function loginMethods(provider) {
|
|
2359
2468
|
const methods = [];
|
|
2360
|
-
const oauth = provider
|
|
2469
|
+
const oauth = provider === void 0 || UNSERVED_OAUTH.has(provider.id) ? void 0 : provider.auth.oauth;
|
|
2361
2470
|
if (oauth !== void 0) methods.push({
|
|
2362
2471
|
id: "oauth",
|
|
2363
2472
|
label: oauth.loginLabel ?? oauth.name
|
|
@@ -2486,6 +2595,222 @@ function registerPiAiFlows(ctx, auth) {
|
|
|
2486
2595
|
}
|
|
2487
2596
|
}
|
|
2488
2597
|
//#endregion
|
|
2598
|
+
//#region lib/types/provider-data.generated.js
|
|
2599
|
+
/** Generated from the installed pi-ai catalog. Run pnpm gen-provider-data; do not edit. */
|
|
2600
|
+
/** Catalog endpoints and environment names; no credentials are evaluated at runtime. */
|
|
2601
|
+
const PROVIDER_DATA = {
|
|
2602
|
+
"amazon-bedrock": {
|
|
2603
|
+
env: [
|
|
2604
|
+
"AWS_BEARER_TOKEN_BEDROCK",
|
|
2605
|
+
"AWS_PROFILE",
|
|
2606
|
+
"AWS_ACCESS_KEY_ID",
|
|
2607
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
2608
|
+
"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",
|
|
2609
|
+
"AWS_CONTAINER_CREDENTIALS_FULL_URI",
|
|
2610
|
+
"AWS_WEB_IDENTITY_TOKEN_FILE"
|
|
2611
|
+
],
|
|
2612
|
+
baseURLEnv: ["AWS_REGION", "AWS_DEFAULT_REGION"]
|
|
2613
|
+
},
|
|
2614
|
+
"ant-ling": {
|
|
2615
|
+
env: ["ANT_LING_API_KEY"],
|
|
2616
|
+
defaultBaseURL: "https://api.ant-ling.com/v1"
|
|
2617
|
+
},
|
|
2618
|
+
"anthropic": {
|
|
2619
|
+
env: [
|
|
2620
|
+
"ANTHROPIC_AUTH_TOKEN",
|
|
2621
|
+
"ANTHROPIC_OAUTH_TOKEN",
|
|
2622
|
+
"ANTHROPIC_API_KEY",
|
|
2623
|
+
"ANTHROPIC_FEDERATION_RULE_ID",
|
|
2624
|
+
"ANTHROPIC_ORGANIZATION_ID",
|
|
2625
|
+
"ANTHROPIC_IDENTITY_TOKEN_FILE",
|
|
2626
|
+
"ANTHROPIC_SERVICE_ACCOUNT_ID",
|
|
2627
|
+
"ANTHROPIC_WORKSPACE_ID"
|
|
2628
|
+
],
|
|
2629
|
+
defaultBaseURL: "https://api.anthropic.com"
|
|
2630
|
+
},
|
|
2631
|
+
"azure": {
|
|
2632
|
+
env: ["AZURE_OPENAI_API_KEY"],
|
|
2633
|
+
baseURLEnv: ["AZURE_OPENAI_BASE_URL", "AZURE_OPENAI_RESOURCE_NAME"]
|
|
2634
|
+
},
|
|
2635
|
+
"baseten": {
|
|
2636
|
+
env: ["BASETEN_API_KEY"],
|
|
2637
|
+
defaultBaseURL: "https://inference.baseten.co/v1"
|
|
2638
|
+
},
|
|
2639
|
+
"cerebras": {
|
|
2640
|
+
env: ["CEREBRAS_API_KEY"],
|
|
2641
|
+
defaultBaseURL: "https://api.cerebras.ai/v1"
|
|
2642
|
+
},
|
|
2643
|
+
"cloudflare-ai-gateway": {
|
|
2644
|
+
env: [
|
|
2645
|
+
"CLOUDFLARE_API_KEY",
|
|
2646
|
+
"CLOUDFLARE_ACCOUNT_ID",
|
|
2647
|
+
"CLOUDFLARE_GATEWAY_ID"
|
|
2648
|
+
],
|
|
2649
|
+
baseURLEnv: ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_GATEWAY_ID"]
|
|
2650
|
+
},
|
|
2651
|
+
"cloudflare-workers-ai": {
|
|
2652
|
+
env: ["CLOUDFLARE_API_KEY", "CLOUDFLARE_ACCOUNT_ID"],
|
|
2653
|
+
baseURLEnv: ["CLOUDFLARE_ACCOUNT_ID"]
|
|
2654
|
+
},
|
|
2655
|
+
"deepseek": {
|
|
2656
|
+
env: ["DEEPSEEK_API_KEY"],
|
|
2657
|
+
defaultBaseURL: "https://api.deepseek.com"
|
|
2658
|
+
},
|
|
2659
|
+
"fireworks": {
|
|
2660
|
+
env: ["FIREWORKS_API_KEY"],
|
|
2661
|
+
defaultBaseURL: "https://api.fireworks.ai/inference"
|
|
2662
|
+
},
|
|
2663
|
+
"github-copilot": {
|
|
2664
|
+
env: ["COPILOT_GITHUB_TOKEN"],
|
|
2665
|
+
defaultBaseURL: "https://api.individual.githubcopilot.com"
|
|
2666
|
+
},
|
|
2667
|
+
"google": {
|
|
2668
|
+
env: ["GEMINI_API_KEY"],
|
|
2669
|
+
defaultBaseURL: "https://generativelanguage.googleapis.com/v1beta"
|
|
2670
|
+
},
|
|
2671
|
+
"google-vertex": {
|
|
2672
|
+
env: [
|
|
2673
|
+
"GOOGLE_CLOUD_API_KEY",
|
|
2674
|
+
"GOOGLE_APPLICATION_CREDENTIALS",
|
|
2675
|
+
"GOOGLE_CLOUD_PROJECT",
|
|
2676
|
+
"GCLOUD_PROJECT",
|
|
2677
|
+
"GOOGLE_CLOUD_LOCATION"
|
|
2678
|
+
],
|
|
2679
|
+
baseURLEnv: [
|
|
2680
|
+
"GOOGLE_CLOUD_PROJECT",
|
|
2681
|
+
"GCLOUD_PROJECT",
|
|
2682
|
+
"GOOGLE_CLOUD_LOCATION"
|
|
2683
|
+
]
|
|
2684
|
+
},
|
|
2685
|
+
"groq": {
|
|
2686
|
+
env: ["GROQ_API_KEY"],
|
|
2687
|
+
defaultBaseURL: "https://api.groq.com/openai/v1"
|
|
2688
|
+
},
|
|
2689
|
+
"huggingface": {
|
|
2690
|
+
env: ["HF_TOKEN"],
|
|
2691
|
+
defaultBaseURL: "https://router.huggingface.co/v1"
|
|
2692
|
+
},
|
|
2693
|
+
"kimi-coding": {
|
|
2694
|
+
env: ["KIMI_API_KEY"],
|
|
2695
|
+
defaultBaseURL: "https://api.kimi.com/coding"
|
|
2696
|
+
},
|
|
2697
|
+
"meta": {
|
|
2698
|
+
env: ["META_API_KEY"],
|
|
2699
|
+
defaultBaseURL: "https://api.meta.ai/v1"
|
|
2700
|
+
},
|
|
2701
|
+
"minimax": {
|
|
2702
|
+
env: ["MINIMAX_API_KEY"],
|
|
2703
|
+
defaultBaseURL: "https://api.minimax.io/anthropic"
|
|
2704
|
+
},
|
|
2705
|
+
"minimax-cn": {
|
|
2706
|
+
env: ["MINIMAX_CN_API_KEY"],
|
|
2707
|
+
defaultBaseURL: "https://api.minimaxi.com/anthropic"
|
|
2708
|
+
},
|
|
2709
|
+
"mistral": {
|
|
2710
|
+
env: ["MISTRAL_API_KEY"],
|
|
2711
|
+
defaultBaseURL: "https://api.mistral.ai"
|
|
2712
|
+
},
|
|
2713
|
+
"moonshotai": {
|
|
2714
|
+
env: ["MOONSHOT_API_KEY"],
|
|
2715
|
+
defaultBaseURL: "https://api.moonshot.ai/v1"
|
|
2716
|
+
},
|
|
2717
|
+
"moonshotai-cn": {
|
|
2718
|
+
env: ["MOONSHOT_API_KEY"],
|
|
2719
|
+
defaultBaseURL: "https://api.moonshot.cn/v1"
|
|
2720
|
+
},
|
|
2721
|
+
"nvidia": {
|
|
2722
|
+
env: ["NVIDIA_API_KEY"],
|
|
2723
|
+
defaultBaseURL: "https://integrate.api.nvidia.com/v1"
|
|
2724
|
+
},
|
|
2725
|
+
"openai": {
|
|
2726
|
+
env: ["OPENAI_API_KEY"],
|
|
2727
|
+
defaultBaseURL: "https://api.openai.com/v1"
|
|
2728
|
+
},
|
|
2729
|
+
"openai-codex": {
|
|
2730
|
+
env: [],
|
|
2731
|
+
defaultBaseURL: "https://chatgpt.com/backend-api"
|
|
2732
|
+
},
|
|
2733
|
+
"opencode": { env: ["OPENCODE_API_KEY"] },
|
|
2734
|
+
"opencode-go": { env: ["OPENCODE_API_KEY"] },
|
|
2735
|
+
"openrouter": {
|
|
2736
|
+
env: ["OPENROUTER_API_KEY"],
|
|
2737
|
+
defaultBaseURL: "https://openrouter.ai/api/v1"
|
|
2738
|
+
},
|
|
2739
|
+
"qwen-token-plan": {
|
|
2740
|
+
env: ["QWEN_TOKEN_PLAN_API_KEY"],
|
|
2741
|
+
defaultBaseURL: "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
|
|
2742
|
+
},
|
|
2743
|
+
"qwen-token-plan-cn": {
|
|
2744
|
+
env: ["QWEN_TOKEN_PLAN_CN_API_KEY"],
|
|
2745
|
+
defaultBaseURL: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1"
|
|
2746
|
+
},
|
|
2747
|
+
"qwen-token-plan-individual": {
|
|
2748
|
+
env: ["QWEN_TOKEN_PLAN_API_KEY"],
|
|
2749
|
+
defaultBaseURL: "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
|
|
2750
|
+
},
|
|
2751
|
+
"radius": {
|
|
2752
|
+
env: ["RADIUS_API_KEY"],
|
|
2753
|
+
defaultBaseURL: "https://radius.pi.dev/v1"
|
|
2754
|
+
},
|
|
2755
|
+
"together": {
|
|
2756
|
+
env: ["TOGETHER_API_KEY"],
|
|
2757
|
+
defaultBaseURL: "https://api.together.ai/v1"
|
|
2758
|
+
},
|
|
2759
|
+
"typesafe": { env: ["TYPESAFE_API_KEY"] },
|
|
2760
|
+
"vercel-ai-gateway": {
|
|
2761
|
+
env: ["AI_GATEWAY_API_KEY"],
|
|
2762
|
+
defaultBaseURL: "https://ai-gateway.vercel.sh"
|
|
2763
|
+
},
|
|
2764
|
+
"xai": {
|
|
2765
|
+
env: ["XAI_API_KEY"],
|
|
2766
|
+
defaultBaseURL: "https://api.x.ai/v1"
|
|
2767
|
+
},
|
|
2768
|
+
"xiaomi": {
|
|
2769
|
+
env: ["XIAOMI_API_KEY"],
|
|
2770
|
+
defaultBaseURL: "https://api.xiaomimimo.com/v1"
|
|
2771
|
+
},
|
|
2772
|
+
"xiaomi-token-plan-ams": {
|
|
2773
|
+
env: ["XIAOMI_TOKEN_PLAN_AMS_API_KEY"],
|
|
2774
|
+
defaultBaseURL: "https://token-plan-ams.xiaomimimo.com/v1"
|
|
2775
|
+
},
|
|
2776
|
+
"xiaomi-token-plan-cn": {
|
|
2777
|
+
env: ["XIAOMI_TOKEN_PLAN_CN_API_KEY"],
|
|
2778
|
+
defaultBaseURL: "https://token-plan-cn.xiaomimimo.com/v1"
|
|
2779
|
+
},
|
|
2780
|
+
"xiaomi-token-plan-sgp": {
|
|
2781
|
+
env: ["XIAOMI_TOKEN_PLAN_SGP_API_KEY"],
|
|
2782
|
+
defaultBaseURL: "https://token-plan-sgp.xiaomimimo.com/v1"
|
|
2783
|
+
},
|
|
2784
|
+
"zai": {
|
|
2785
|
+
env: ["ZAI_API_KEY"],
|
|
2786
|
+
defaultBaseURL: "https://api.z.ai/api/coding/paas/v4"
|
|
2787
|
+
},
|
|
2788
|
+
"zai-coding-cn": {
|
|
2789
|
+
env: ["ZAI_CODING_CN_API_KEY"],
|
|
2790
|
+
defaultBaseURL: "https://open.bigmodel.cn/api/coding/paas/v4"
|
|
2791
|
+
}
|
|
2792
|
+
};
|
|
2793
|
+
//#endregion
|
|
2794
|
+
//#region lib/types/provider-data.js
|
|
2795
|
+
/** Installed provider defaults for configuration surfaces. */
|
|
2796
|
+
/**
|
|
2797
|
+
* Return generated display metadata without executing authentication.
|
|
2798
|
+
* @param provider - Installed catalog provider, possibly from a newer consumer dependency.
|
|
2799
|
+
* @returns Known metadata, or only a fixed public endpoint for an unrecorded provider.
|
|
2800
|
+
*/
|
|
2801
|
+
function providerDefaultsOf(provider) {
|
|
2802
|
+
const data = PROVIDER_DATA[provider.id];
|
|
2803
|
+
if (data === void 0) return provider.baseUrl && !provider.baseUrl.includes("{") ? { defaultBaseURL: provider.baseUrl } : {};
|
|
2804
|
+
const { env, ...endpoint } = data;
|
|
2805
|
+
return {
|
|
2806
|
+
...endpoint,
|
|
2807
|
+
nativeAuth: {
|
|
2808
|
+
env,
|
|
2809
|
+
oauth: provider.auth.oauth !== void 0
|
|
2810
|
+
}
|
|
2811
|
+
};
|
|
2812
|
+
}
|
|
2813
|
+
//#endregion
|
|
2489
2814
|
//#region lib/types/index.js
|
|
2490
2815
|
const name = "llm-pi-ai";
|
|
2491
2816
|
const inject = ["llm"];
|
|
@@ -2506,24 +2831,28 @@ function registrationFacts(profiles) {
|
|
|
2506
2831
|
* The configurable-provider directory: every installed catalog route, plus
|
|
2507
2832
|
* every route the current profiles declare. A hand-declared route has no
|
|
2508
2833
|
* catalog entry, so without this union it would have no settings address and
|
|
2509
|
-
* configuration surfaces could neither show nor edit it.
|
|
2834
|
+
* configuration surfaces could neither show nor edit it. A catalog route also
|
|
2835
|
+
* carries its catalog endpoint and native authentication, which a settings
|
|
2836
|
+
* editor shows while the profile leaves the endpoint or the credential
|
|
2837
|
+
* reference unset.
|
|
2510
2838
|
* @param profiles - the currently resolved provider profiles.
|
|
2511
2839
|
* @returns the directory entries in catalog order, declared routes last.
|
|
2512
2840
|
*/
|
|
2513
2841
|
function directoryEntries(profiles, settingsNs) {
|
|
2514
|
-
const catalog = new Set(catalogProviderIds());
|
|
2515
2842
|
const entries = /* @__PURE__ */ new Map();
|
|
2516
2843
|
const declare = (provider, displayName, error) => {
|
|
2844
|
+
const installed = catalogProvider(provider);
|
|
2517
2845
|
entries.set(provider, {
|
|
2518
2846
|
provider,
|
|
2519
2847
|
displayName,
|
|
2520
2848
|
settingsNs,
|
|
2521
2849
|
settingsPath: ["providers", provider],
|
|
2522
|
-
declared:
|
|
2850
|
+
declared: installed === void 0,
|
|
2851
|
+
...installed === void 0 ? {} : providerDefaultsOf(installed),
|
|
2523
2852
|
...error === void 0 ? {} : { error }
|
|
2524
2853
|
});
|
|
2525
2854
|
};
|
|
2526
|
-
for (const provider of
|
|
2855
|
+
for (const provider of catalogProviderIds()) declare(provider, provider);
|
|
2527
2856
|
for (const [provider, profile] of profiles) declare(provider, profile.displayName, profile.catalogError);
|
|
2528
2857
|
return [...entries.values()];
|
|
2529
2858
|
}
|
package/lib/types/adapter.d.ts
CHANGED
|
@@ -36,7 +36,8 @@ export interface PiAiAdapterOptions {
|
|
|
36
36
|
profiles: () => ReadonlyMap<string, ResolvedPiAiProviderProfile>;
|
|
37
37
|
/**
|
|
38
38
|
* Resolve the credential for one already-resolved profile; called once per
|
|
39
|
-
* stream call and frozen for that call
|
|
39
|
+
* stream call and frozen for that call, and by `listModels`, which offers no
|
|
40
|
+
* models while it throws `MISSING_CREDENTIAL`. `undefined` defers to the route's own
|
|
40
41
|
* pi-ai auth, which for an installed catalog route is its provider-native
|
|
41
42
|
* ambient discovery; the plugin allows that only for a profile naming no
|
|
42
43
|
* credential at all, because a named reference that misses throws `LlmError`
|
|
@@ -82,6 +83,7 @@ export declare class PiAiAdapter extends LlmAdapter {
|
|
|
82
83
|
private readonly config;
|
|
83
84
|
private snapshot;
|
|
84
85
|
constructor(config: PiAiAdapterOptions);
|
|
86
|
+
imageRequestTarget(provider: string, model: string, image: ImageAttachmentRef): import("@deepseek-ai/dsh-attachment").ImageRequestTarget;
|
|
85
87
|
/**
|
|
86
88
|
* The snapshot for the current profiles. Resolution memoizes its result, so
|
|
87
89
|
* an unchanged configuration is recognized by identity; a changed one gets a
|
package/lib/types/catalog.d.ts
CHANGED
|
@@ -41,20 +41,23 @@ export type PiAiChatTemplateVar = Extract<ChatTemplateKwargValue, {
|
|
|
41
41
|
/** The request-state placeholders a profile may name. */
|
|
42
42
|
export declare const CHAT_TEMPLATE_VARS: readonly PiAiChatTemplateVar[];
|
|
43
43
|
/**
|
|
44
|
-
* The installed catalog provider for one route, when pi-ai ships one
|
|
44
|
+
* The installed catalog provider for one route, when pi-ai ships one this
|
|
45
|
+
* adapter serves.
|
|
45
46
|
* @param provider - provider route key.
|
|
46
|
-
* @returns the catalog provider, or `undefined` for a route pi-ai does not ship
|
|
47
|
+
* @returns the catalog provider, or `undefined` for a route pi-ai does not ship
|
|
48
|
+
* or ships without a chat model.
|
|
47
49
|
*/
|
|
48
50
|
export declare function catalogProvider(provider: string): Provider | undefined;
|
|
49
51
|
/**
|
|
50
|
-
* Every provider route the installed pi-ai catalog ships
|
|
51
|
-
*
|
|
52
|
+
* Every provider route the installed pi-ai catalog ships and this adapter
|
|
53
|
+
* serves: a provider whose catalog lists models but no chat model is left out.
|
|
54
|
+
* @returns the catalog provider ids, in catalog order.
|
|
52
55
|
*/
|
|
53
56
|
export declare function catalogProviderIds(): readonly string[];
|
|
54
57
|
/**
|
|
55
58
|
* The installed catalog models for one route, indexed by model id.
|
|
56
59
|
* @param provider - provider route key.
|
|
57
|
-
* @returns catalog models by id; empty for a route
|
|
60
|
+
* @returns catalog models by id; empty for a route {@link catalogProvider} does not return.
|
|
58
61
|
*/
|
|
59
62
|
export declare function catalogModels(provider: string): Map<string, Model<Api>>;
|
|
60
63
|
/**
|
package/lib/types/context.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module dsh-llm-pi-ai/context
|
|
5
5
|
*/
|
|
6
6
|
import type { GenerateOptions, ImageAttachmentAccessResolver } from '@deepseek-ai/dsh-llm';
|
|
7
|
-
import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
|
|
7
|
+
import type { AttachmentStore, ImageAttachmentRef, ImageRequestTarget } from '@deepseek-ai/dsh-attachment';
|
|
8
8
|
import type { Context as PiContext } from '@earendil-works/pi-ai';
|
|
9
9
|
/** Inputs that bind deterministic request images to one current tool execution world. */
|
|
10
10
|
export interface PiImageRequestContext {
|
|
@@ -24,10 +24,17 @@ export interface PiImageRequestBudget {
|
|
|
24
24
|
/** Encoded-byte target for one request image. */
|
|
25
25
|
maxBytes: number;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the request target for one source under the route budgets.
|
|
29
|
+
* @param ref - normalized source image.
|
|
30
|
+
* @param budget - resolved route pixel and byte limits.
|
|
31
|
+
* @returns dimensions and byte target shared by serialization and screenshot coordinate mapping.
|
|
32
|
+
*/
|
|
33
|
+
export declare function requestImageTarget(ref: ImageAttachmentRef, budget: PiImageRequestBudget): ImageRequestTarget;
|
|
27
34
|
/**
|
|
28
35
|
* Convert text-only harness history to a synchronous pi-ai Context. Tool
|
|
29
36
|
* result names are recovered from preceding assistant tool calls.
|
|
30
|
-
* @param options -
|
|
37
|
+
* @param options - projected request; one-shot system text precedes the leading history prompt.
|
|
31
38
|
* @param images - absent; selects the synchronous conversion.
|
|
32
39
|
* @param onReplayDegrade - forwarded to {@link toPiAssistant} for each assistant message.
|
|
33
40
|
* @returns the pi-ai context; `tools` is omitted when the request declares none.
|
|
@@ -41,7 +48,7 @@ export declare function toPiContext(options: GenerateOptions, images?: undefined
|
|
|
41
48
|
* retained occurrences' exact base64 payload still exceeds
|
|
42
49
|
* `maxRequestImageBytes`, the call fails with `IMAGE_OFFLOAD_REQUIRED` naming
|
|
43
50
|
* how many more oldest occurrences must be offloaded.
|
|
44
|
-
* @param options -
|
|
51
|
+
* @param options - projected request; one-shot system text precedes the leading history prompt.
|
|
45
52
|
* @param images - attachment provider, current path resolver, and request limits.
|
|
46
53
|
* @param onReplayDegrade - forwarded to {@link toPiAssistant} for each assistant message.
|
|
47
54
|
* @returns the asynchronously resolved pi-ai context.
|
package/lib/types/models.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** pi-ai model helpers assembled from public narrow entry points. */
|
|
2
2
|
import type { Api, CreateModelsOptions, Model, ModelThinkingLevel, MutableModels, Provider, ProviderAuth, ProviderStreams } from '@earendil-works/pi-ai';
|
|
3
|
+
import type { LlmResolvedModelInfo } from '@deepseek-ai/dsh-llm';
|
|
3
4
|
/** Input accepted by the static, single-protocol providers this package builds. */
|
|
4
5
|
interface StaticProviderOptions {
|
|
5
6
|
id: string;
|
|
@@ -27,5 +28,11 @@ export declare function createProvider(input: StaticProviderOptions): Provider;
|
|
|
27
28
|
* @returns supported levels in pi-ai's escalation order.
|
|
28
29
|
*/
|
|
29
30
|
export declare function getSupportedThinkingLevels(model: Model<Api>): ModelThinkingLevel[];
|
|
31
|
+
/**
|
|
32
|
+
* Resolve transcript update modes from the exact model's protocol capabilities.
|
|
33
|
+
* @param model - Materialized pi-ai model, including catalog compatibility flags.
|
|
34
|
+
* @returns Update modes consumed by prompt admission and tool-history projection.
|
|
35
|
+
*/
|
|
36
|
+
export declare function conversationUpdates(model: Model<Api>): Pick<LlmResolvedModelInfo, 'systemPromptUpdate' | 'toolUpdate'>;
|
|
30
37
|
export {};
|
|
31
38
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Installed provider defaults for configuration surfaces. */
|
|
2
|
+
import type { Provider } from '@earendil-works/pi-ai';
|
|
3
|
+
import type { LlmConfigurableProvider } from '@deepseek-ai/dsh-llm';
|
|
4
|
+
/**
|
|
5
|
+
* Return generated display metadata without executing authentication.
|
|
6
|
+
* @param provider - Installed catalog provider, possibly from a newer consumer dependency.
|
|
7
|
+
* @returns Known metadata, or only a fixed public endpoint for an unrecorded provider.
|
|
8
|
+
*/
|
|
9
|
+
export declare function providerDefaultsOf(provider: Provider): Pick<LlmConfigurableProvider, 'nativeAuth' | 'defaultBaseURL' | 'baseURLEnv'>;
|
|
10
|
+
//# sourceMappingURL=provider-data.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Generated from the installed pi-ai catalog. Run pnpm gen-provider-data; do not edit. */
|
|
2
|
+
import type { BuiltinProvider } from '@earendil-works/pi-ai/providers/all';
|
|
3
|
+
import type { LlmConfigurableProvider } from '@deepseek-ai/dsh-llm';
|
|
4
|
+
type ProviderData = Pick<LlmConfigurableProvider, 'defaultBaseURL' | 'baseURLEnv'> & {
|
|
5
|
+
env: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
/** Catalog endpoints and environment names; no credentials are evaluated at runtime. */
|
|
8
|
+
export declare const PROVIDER_DATA: Record<BuiltinProvider, ProviderData> & Partial<Record<string, ProviderData>>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=provider-data.generated.d.ts.map
|
package/lib/types/replay.d.ts
CHANGED
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-llm-pi-ai",
|
|
3
3
|
"description": "pi-ai-backed DeepSeek adapter for the DeepSeek Harness LLM seam (design-verification twin of dsh-llm-deepseek)",
|
|
4
|
-
"version": "0.2.1-alpha.
|
|
4
|
+
"version": "0.2.1-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -19,44 +19,46 @@
|
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
21
|
"./src/*": "./src/*",
|
|
22
|
-
"./package.json": "./package.json"
|
|
22
|
+
"./package.json": "./package.json",
|
|
23
|
+
"./locale/*.json": "./locale/*.json"
|
|
23
24
|
},
|
|
24
25
|
"files": [
|
|
26
|
+
"locale/*.json",
|
|
25
27
|
"lib/index.js",
|
|
26
28
|
"lib/types/**/*.d.ts"
|
|
27
29
|
],
|
|
28
30
|
"license": "MIT",
|
|
29
31
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/cordis": "~4.0.5-alpha.
|
|
31
|
-
"@deepseek-ai/dsh-attachment": "0.2.1-alpha.
|
|
32
|
-
"@deepseek-ai/dsh-authorization": "0.2.1-alpha.
|
|
33
|
-
"@deepseek-ai/dsh-credentials": "0.2.1-alpha.
|
|
34
|
-
"@deepseek-ai/dsh-fs": "0.2.1-alpha.
|
|
35
|
-
"@deepseek-ai/dsh-launch-environment": "0.2.1-alpha.
|
|
36
|
-
"@deepseek-ai/dsh-llm": "0.2.1-alpha.
|
|
37
|
-
"@deepseek-ai/dsh-timeout": "0.2.1-alpha.
|
|
38
|
-
"@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.
|
|
32
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
33
|
+
"@deepseek-ai/dsh-attachment": "0.2.1-alpha.3",
|
|
34
|
+
"@deepseek-ai/dsh-authorization": "0.2.1-alpha.3",
|
|
35
|
+
"@deepseek-ai/dsh-credentials": "0.2.1-alpha.3",
|
|
36
|
+
"@deepseek-ai/dsh-fs": "0.2.1-alpha.3",
|
|
37
|
+
"@deepseek-ai/dsh-launch-environment": "0.2.1-alpha.3",
|
|
38
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
|
|
39
|
+
"@deepseek-ai/dsh-timeout": "0.2.1-alpha.3",
|
|
40
|
+
"@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.2"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@deepseek-ai/dsh-
|
|
43
|
-
"@deepseek-ai/
|
|
44
|
-
"@
|
|
43
|
+
"@deepseek-ai/dsh-brand": "0.2.1-alpha.3",
|
|
44
|
+
"@deepseek-ai/dsh-util-values": "0.2.1-alpha.3",
|
|
45
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.2",
|
|
46
|
+
"@earendil-works/pi-ai": "^1.1.0"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
|
-
"@deepseek-ai/cordis": "~4.0.5-alpha.
|
|
48
|
-
"@deepseek-ai/dsh-attachment": "0.2.1-alpha.
|
|
49
|
-
"@deepseek-ai/dsh-authorization": "0.2.1-alpha.
|
|
50
|
-
"@deepseek-ai/dsh-credentials": "0.2.1-alpha.
|
|
51
|
-
"@deepseek-ai/dsh-fs": "0.2.1-alpha.
|
|
52
|
-
"@deepseek-ai/dsh-launch-environment": "0.2.1-alpha.
|
|
53
|
-
"@deepseek-ai/dsh-llm": "0.2.1-alpha.
|
|
54
|
-
"@deepseek-ai/dsh-llm-deepseek": "0.2.1-alpha.
|
|
55
|
-
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.
|
|
56
|
-
"@deepseek-ai/dsh-timeout": "0.2.1-alpha.
|
|
57
|
-
"@deepseek-ai/dsh-http-proxy": "0.2.1-alpha.
|
|
58
|
-
"@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.
|
|
59
|
-
"@deepseek-ai/dsh-settings": "0.2.1-alpha.
|
|
49
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-attachment": "0.2.1-alpha.3",
|
|
51
|
+
"@deepseek-ai/dsh-authorization": "0.2.1-alpha.3",
|
|
52
|
+
"@deepseek-ai/dsh-credentials": "0.2.1-alpha.3",
|
|
53
|
+
"@deepseek-ai/dsh-fs": "0.2.1-alpha.3",
|
|
54
|
+
"@deepseek-ai/dsh-launch-environment": "0.2.1-alpha.3",
|
|
55
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
|
|
56
|
+
"@deepseek-ai/dsh-llm-deepseek": "0.2.1-alpha.3",
|
|
57
|
+
"@deepseek-ai/dsh-llm-deepseek-api-key": "0.2.1-alpha.3",
|
|
58
|
+
"@deepseek-ai/dsh-timeout": "0.2.1-alpha.3",
|
|
59
|
+
"@deepseek-ai/dsh-http-proxy": "0.2.1-alpha.3",
|
|
60
|
+
"@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.2",
|
|
61
|
+
"@deepseek-ai/dsh-settings": "0.2.1-alpha.3"
|
|
60
62
|
},
|
|
61
63
|
"peerDependenciesMeta": {
|
|
62
64
|
"@deepseek-ai/cordis-plugin-loader": {
|