@deepseek-ai/dsh-llm-deepseek-account 0.1.7-rc.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
2
+ # section, a hash of its English and Chinese blocks outside code blocks and generated regions.
3
+ # After editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/llm/llm-deepseek-account/README.md
5
+ /:
6
+ en: 5bbc9f976d7dcfda
7
+ zh: 5de13a931c992603
8
+ /deepseek-ai-dsh-llm-deepseek-account:
9
+ en: 8fa1148e0ee9d351
10
+ zh: 634ec9d79d5ffbf0
11
+ /deepseek-ai-dsh-llm-deepseek-account/summary:
12
+ en: d859ec7a1db8a41b
13
+ zh: b05ff7d19cb94667
14
+ /deepseek-ai-dsh-llm-deepseek-account/table-of-contents:
15
+ en: 23386452a66b2fbd
16
+ zh: 4cf93c4bf17b3da2
17
+ /deepseek-ai-dsh-llm-deepseek-account/use-this-package:
18
+ en: 4fde33a269d60030
19
+ zh: 22e522f4a3e25e8c
20
+ /deepseek-ai-dsh-llm-deepseek-account/understand-the-implementation:
21
+ en: 695b9c7263f6f3b5
22
+ zh: 84d5fc9d958c4fe7
23
+ /deepseek-ai-dsh-llm-deepseek-account/further-exploration:
24
+ en: e8bf99d78aa7035f
25
+ zh: e4a74d2d48b6d271
26
+ /deepseek-ai-dsh-llm-deepseek-account/model-experience:
27
+ en: 215e7ba838619b7b
28
+ zh: a311da3843709f90
29
+ /deepseek-ai-dsh-llm-deepseek-account/model-experience/authenticated-model-requests:
30
+ en: 5cf024f0d3370159
31
+ zh: ed480db8f348a42f
32
+ /deepseek-ai-dsh-llm-deepseek-account/model-experience/authenticated-model-requests/what-the-model-sees:
33
+ en: bd62360e6e6965ab
34
+ zh: 519626fc34672187
35
+ /deepseek-ai-dsh-llm-deepseek-account/model-experience/authenticated-model-requests/token-effect:
36
+ en: fecefb75b719c317
37
+ zh: f0c2322f657c5914
38
+ /deepseek-ai-dsh-llm-deepseek-account/model-experience/authenticated-model-requests/kv-cache-effect:
39
+ en: 2004df60d997da79
40
+ zh: a215a6586b44746b
41
+ /deepseek-ai-dsh-llm-deepseek-account/known-limitations-and-deferred-work:
42
+ en: d5880c883b1b678f
43
+ zh: bf7a4da24ba75280
44
+ /deepseek-ai-dsh-llm-deepseek-account/known-limitations-and-deferred-work/dev-note:
45
+ en: 0525041e573e96b6
46
+ zh: b05ed8d852498e6b
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ ---
2
+ description: "DeepSeek account authentication and model discovery."
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-llm-deepseek-account
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ Register authentication and model discovery for `deepseek-account`. This plugin shares the [Messages transport](../llm-deepseek/README.md) and owns credential resolution and catalog availability.
13
+
14
+ Authentication resolution returns `x-dsh-auth-token` and a failure callback capturing the same token. HTTP 401 classification and rejection stay in this provider; a rejected older request cannot clear a replacement login.
15
+
16
+ ## Table of Contents
17
+
18
+ - [Use this package](#use-this-package)
19
+ - [Understand the implementation](#understand-the-implementation)
20
+ - [Further Exploration](#further-exploration)
21
+ - [Model Experience](#model-experience)
22
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
23
+ - [Dev Note](#dev-note)
24
+
25
+ <a id="use-this-package"></a>
26
+ ## Use this package
27
+
28
+ Only `deepseekAccount.resolveToken(baseURL)` supplies the token; the account service validates the destination. Signed-out or ineligible requests fail with `ACCOUNT_SIGN_IN_REQUIRED` and discovery returns an empty catalog. The route never falls back to an API key. Other credential lookup errors propagate.
29
+
30
+ ```yaml
31
+ - id: llm-deepseek-account
32
+ name: '@deepseek-ai/dsh-llm-deepseek-account'
33
+ config:
34
+ reasoningEffort: high
35
+ ```
36
+
37
+ An account request HTTP 401 maps to `ACCOUNT_TOKEN_INVALID` independently of the response body. The account service removes the credential only if it still matches the request token. HTTP 403 and other failures do not clear the login. The account module owns task cancellation after sign-out; this plugin does not inspect Agents.
38
+
39
+ `models` is an independently configurable catalog for this provider; defaults and protocol capabilities come from the shared transport. Discovery does not probe inference endpoints. The settings namespace is the Cordis entry id, or the plugin name without an entry. Product profiles retain the official entry id `llm-deepseek` and use `llm-deepseek-account` for the account route.
40
+
41
+ <a id="understand-the-implementation"></a>
42
+ ## Understand the implementation
43
+
44
+ Registrations and listeners dispose with the plugin. Shared Host wiring supplies attachments, request extensions, anonymous identity, and atomic retry-policy updates; this plugin registers only its own route. No invariant companion is published: discovery derives directly from configuration and credentials without an independent copy.
45
+
46
+ A failed request the shared transport classifies as `QUOTA` is rewritten to `ACCOUNT_QUOTA` before it leaves this provider, covering an HTTP 402 response and an in-band SSE error alike. The shared transport and the `deepseek-official` route keep `QUOTA`, so the account route's top-up action never appears for an API-key or third-party failure.
47
+
48
+ <a id="further-exploration"></a>
49
+ ## Further Exploration
50
+
51
+ [LLM streaming](../../../docs/subsystems/llm-streaming.md) · [Messages](../llm-deepseek/README.md)
52
+
53
+ <a id="model-experience"></a>
54
+ ## Model Experience
55
+
56
+ ### Authenticated model requests
57
+
58
+ #### What the model sees
59
+
60
+ Requests on `deepseek-account` add no model-visible text from this plugin; the shared Messages transport serializes requests.
61
+
62
+ #### Token effect
63
+
64
+ Authentication and discovery add no input tokens; the selected model and request content determine actual usage.
65
+
66
+ #### KV Cache effect
67
+
68
+ Credentials and catalog availability do not enter model input; the protocol transport owns request-prefix serialization.
69
+
70
+ ## Known Limitations and Deferred Work
71
+
72
+ <a id="known-limitations-and-deferred-work"></a>
73
+
74
+ - The catalog is configuration metadata, not remote validation that a model is accepted; actual calls can still fail.
75
+
76
+ <a id="dev-note"></a>
77
+ ### Dev Note
78
+
79
+ Registration and authentication tests also cover the Loader composition in the shared transport package.
package/README.zh.md ADDED
@@ -0,0 +1,79 @@
1
+ ---
2
+ description: "DeepSeek 账号 authentication and model discovery."
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-llm-deepseek-account
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 为 `deepseek-account` 注册独立的鉴权和模型发现插件。通过 [llm-deepseek](../llm-deepseek/README.zh.md) 共用 Messages 请求实现;本包拥有凭据解析和目录可用性判断。
13
+
14
+ 鉴权解析返回 `x-dsh-auth-token` 和捕获同一 token 的失败回调。HTTP 401 的分类和凭据失效处理由此提供方负责;被拒绝的旧请求不能清除替换后的登录。
15
+
16
+ ## 目录
17
+
18
+ - [使用此包](#use-this-package)
19
+ - [理解实现](#understand-the-implementation)
20
+ - [进一步探索](#further-exploration)
21
+ - [模型体验](#model-experience)
22
+ - [已知限制与后续工作](#known-limitations-and-deferred-work)
23
+ - [开发备注](#dev-note)
24
+
25
+ <a id="use-this-package"></a>
26
+ ## 使用此包
27
+
28
+ 账号 token 仅由 `deepseekAccount.resolveToken(baseURL)` 提供,目标地址必须满足账号服务的来源校验。未登录或目标不允许账号鉴权时,请求以 `ACCOUNT_SIGN_IN_REQUIRED` 失败,目录为空;不会回退到 API key。其他凭据查询错误继续向调用者报告。
29
+
30
+ ```yaml
31
+ - id: llm-deepseek-account
32
+ name: '@deepseek-ai/dsh-llm-deepseek-account'
33
+ config:
34
+ reasoningEffort: high
35
+ ```
36
+
37
+ 账号请求的 HTTP 401 与响应正文无关:映射为 `ACCOUNT_TOKEN_INVALID`,并要求账号服务仅在当前 token 仍与请求所用 token 相同时清除凭据。403 和其他错误不会触发清除。账号模块负责退登后打断任务,本插件不遍历 Agent。
38
+
39
+ `models` 是该 provider 独立的可配置目录;默认值和协议能力来自共享传输包。目录判断不探测推理端点。设置命名空间采用 Cordis entry id,没有 entry 时采用插件名。产品保留 official 的 `llm-deepseek` entry id,账号使用 `llm-deepseek-account`。
40
+
41
+ <a id="understand-the-implementation"></a>
42
+ ## 理解实现
43
+
44
+ 注册和监听随插件生命周期释放。共享 Host 绑定提供附件访问、请求扩展、匿名标识和重试策略的原子更新;本包只注册自己的路由。无需 invariant companion:目录直接由同一次配置和凭据读取派生,不维护独立副本。
45
+
46
+ 共享传输判定为 `QUOTA` 的失败请求离开本提供方前会被改写为 `ACCOUNT_QUOTA`,HTTP 402 响应与流内 SSE 错误都适用。共享传输与 `deepseek-official` 路由保留 `QUOTA`,因此账号路由的充值操作不会出现在 API Key 或第三方失败上。
47
+
48
+ <a id="further-exploration"></a>
49
+ ## 进一步探索
50
+
51
+ [LLM streaming](../../../docs/subsystems/llm-streaming.zh.md) · [Messages](../llm-deepseek/README.zh.md)
52
+
53
+ <a id="model-experience"></a>
54
+ ## 模型体验
55
+
56
+ ### 已鉴权的模型请求
57
+
58
+ #### What the model sees
59
+
60
+ `deepseek-account` 请求不包含本插件添加的模型可见文本;请求由共享 Messages 传输序列化。
61
+
62
+ #### Token effect
63
+
64
+ 鉴权和目录过滤不增加输入 token;实际调用的 token 由所选模型与请求内容决定。
65
+
66
+ #### KV Cache effect
67
+
68
+ 凭据与目录可用性不进入模型输入;协议传输拥有请求前缀的序列化。
69
+
70
+ ## 已知限制与后续工作
71
+
72
+ <a id="known-limitations-and-deferred-work"></a>
73
+
74
+ - 目录是配置元数据,不验证远端是否接受模型;实际调用仍可能失败。
75
+
76
+ <a id="dev-note"></a>
77
+ ### 开发备注
78
+
79
+ 注册与鉴权的测试也覆盖共享传输包中的 Loader 组合场景。
package/lib/index.js ADDED
@@ -0,0 +1,62 @@
1
+ import { ACCOUNT_QUOTA_EXCEEDED_CODE, LlmError, QUOTA_EXCEEDED_CODE } from "@deepseek-ai/dsh-llm";
2
+ import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
3
+ import { Config as Config$1, catalogModelInfo, plainOptions, registerDeepSeekProvider, resolveAdapterOptions } from "@deepseek-ai/dsh-llm-deepseek";
4
+ //#region lib/types/config.js
5
+ /** Account providers expose protocol settings without an API-key reference. */
6
+ const Config = Config$1;
7
+ //#endregion
8
+ //#region lib/types/index.js
9
+ const name = "llm-deepseek-account";
10
+ const inject = ["llm"];
11
+ const PROVIDER = "deepseek-account";
12
+ function apply(ctx, config) {
13
+ const options = () => resolveAdapterOptions(plainOptions(config), launchEnvironmentOf(ctx));
14
+ options();
15
+ const resolveAuth = async (connection) => {
16
+ const account = ctx.get("deepseekAccount");
17
+ const token = await account?.resolveToken(connection.baseURL);
18
+ if (token === void 0) throw new LlmError("Sign in to DeepSeek to use the account provider. The request destination must allow account authentication.", "ACCOUNT_SIGN_IN_REQUIRED");
19
+ return {
20
+ headers: { "x-dsh-auth-token": token },
21
+ onRequestError: async (error) => {
22
+ if (!(error instanceof LlmError)) return error;
23
+ if (error.code === QUOTA_EXCEEDED_CODE) return new LlmError(error.message, ACCOUNT_QUOTA_EXCEEDED_CODE, {
24
+ ...error.failure,
25
+ cause: error
26
+ });
27
+ if (error.failure.status !== 401) return error;
28
+ const rejected = new LlmError(error.message, "ACCOUNT_TOKEN_INVALID", {
29
+ ...error.failure,
30
+ cause: error
31
+ });
32
+ try {
33
+ await account?.rejectToken(token);
34
+ } catch (_credentialRemovalFailed) {}
35
+ return rejected;
36
+ }
37
+ };
38
+ };
39
+ ctx.llm.registerConfigurableProviders([{
40
+ provider: PROVIDER,
41
+ displayName: "DeepSeek Account",
42
+ settingsNs: ctx.fiber.entry?.options.id ?? "llm-deepseek-account",
43
+ settingsPath: []
44
+ }]);
45
+ registerDeepSeekProvider(ctx, PROVIDER, {
46
+ options,
47
+ resolveAuth,
48
+ providerName: "DeepSeek Account",
49
+ discoverModels: async (provider) => {
50
+ const connection = options();
51
+ try {
52
+ await resolveAuth(connection);
53
+ } catch (error) {
54
+ if (error instanceof LlmError && error.code === "ACCOUNT_SIGN_IN_REQUIRED") return [];
55
+ throw error;
56
+ }
57
+ return connection.models.map((model) => catalogModelInfo(provider, model));
58
+ }
59
+ });
60
+ }
61
+ //#endregion
62
+ export { Config, apply, inject, name };
@@ -0,0 +1,44 @@
1
+ /** Account providers expose protocol settings without an API-key reference. */
2
+ import { Config as ProtocolConfig } from '@deepseek-ai/dsh-llm-deepseek';
3
+ /** Account route configuration; authentication comes exclusively from the account service. */
4
+ export type Config = ProtocolConfig;
5
+ export declare const Config: import("@deepseek-ai/schemastery").default<Schemastery.ObjectS<NoInfer<{
6
+ baseURL: import("@deepseek-ai/schemastery").default<string, string, "volatile">;
7
+ thinking: import("@deepseek-ai/schemastery").default<"enabled" | "disabled", "enabled" | "disabled", "volatile">;
8
+ reasoningEffort: import("@deepseek-ai/schemastery").default<"low" | "off" | "high" | "max", "low" | "off" | "high" | "max", "volatile">;
9
+ maxTokens: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
10
+ defaultContextWindow: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
11
+ models: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/dsh-llm-deepseek").DeepSeekCatalogModel[]>, NoInfer<import("@deepseek-ai/dsh-llm-deepseek").DeepSeekCatalogModel[]>, "volatile-defined">;
12
+ streamIdleTimeoutMs: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
13
+ maxRequestFilesBytes: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
14
+ maxInlineRequestImageBytes: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
15
+ maxImagesPerRequest: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
16
+ imageOffloadByteQuantum: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
17
+ inlineImageOffloadByteQuantum: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
18
+ imageOffloadCountQuantum: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
19
+ filesApiTimeoutMs: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
20
+ fileExpiresAfterSeconds: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
21
+ fileRefreshMarginSeconds: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
22
+ fileQuotaCleanupBatch: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
23
+ retryPolicy: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/dsh-llm").RetryPolicyConfig>, NoInfer<import("@deepseek-ai/dsh-llm").RetryPolicyConfig>, "volatile">;
24
+ }>>, Schemastery.ObjectT<NoInfer<{
25
+ baseURL: import("@deepseek-ai/schemastery").default<string, string, "volatile">;
26
+ thinking: import("@deepseek-ai/schemastery").default<"enabled" | "disabled", "enabled" | "disabled", "volatile">;
27
+ reasoningEffort: import("@deepseek-ai/schemastery").default<"low" | "off" | "high" | "max", "low" | "off" | "high" | "max", "volatile">;
28
+ maxTokens: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
29
+ defaultContextWindow: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
30
+ models: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/dsh-llm-deepseek").DeepSeekCatalogModel[]>, NoInfer<import("@deepseek-ai/dsh-llm-deepseek").DeepSeekCatalogModel[]>, "volatile-defined">;
31
+ streamIdleTimeoutMs: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
32
+ maxRequestFilesBytes: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
33
+ maxInlineRequestImageBytes: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
34
+ maxImagesPerRequest: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
35
+ imageOffloadByteQuantum: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
36
+ inlineImageOffloadByteQuantum: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
37
+ imageOffloadCountQuantum: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
38
+ filesApiTimeoutMs: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
39
+ fileExpiresAfterSeconds: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
40
+ fileRefreshMarginSeconds: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
41
+ fileQuotaCleanupBatch: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
42
+ retryPolicy: import("@deepseek-ai/schemastery").default<NoInfer<import("@deepseek-ai/dsh-llm").RetryPolicyConfig>, NoInfer<import("@deepseek-ai/dsh-llm").RetryPolicyConfig>, "volatile">;
43
+ }>>, "plain">;
44
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,7 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { Config } from './config.ts';
3
+ export { Config } from './config.ts';
4
+ export declare const name = "llm-deepseek-account";
5
+ export declare const inject: string[];
6
+ export declare function apply(ctx: Context, config: Config): void;
7
+ //# sourceMappingURL=index.d.ts.map
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@deepseek-ai/dsh-llm-deepseek-account",
3
+ "description": "DeepSeek account provider authentication and discovery",
4
+ "version": "0.1.7-rc.2",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/llm/llm-deepseek-account"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./src/*": "./src/*",
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "lib/index.js",
26
+ "lib/types/**/*.d.ts"
27
+ ],
28
+ "license": "MIT",
29
+ "peerDependencies": {
30
+ "@deepseek-ai/cordis": "~4.0.4",
31
+ "@deepseek-ai/dsh-llm": "0.1.7-rc.2",
32
+ "@deepseek-ai/dsh-launch-environment": "0.1.7-rc.2",
33
+ "@deepseek-ai/dsh-llm-deepseek": "0.1.7-rc.2",
34
+ "@deepseek-ai/dsh-deepseek-account": "0.1.7-rc.2",
35
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.5"
36
+ },
37
+ "devDependencies": {
38
+ "@deepseek-ai/cordis": "~4.0.4",
39
+ "@deepseek-ai/dsh-llm": "0.1.7-rc.2",
40
+ "@deepseek-ai/dsh-llm-deepseek": "0.1.7-rc.2",
41
+ "@deepseek-ai/dsh-launch-environment": "0.1.7-rc.2",
42
+ "@deepseek-ai/dsh-deepseek-account": "0.1.7-rc.2",
43
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.5",
44
+ "@deepseek-ai/dsh-llm-deepseek-api-key": "0.1.7-rc.2"
45
+ },
46
+ "peerDependenciesMeta": {
47
+ "@deepseek-ai/dsh-deepseek-account": {
48
+ "optional": true
49
+ },
50
+ "@deepseek-ai/cordis-plugin-loader": {
51
+ "optional": true
52
+ }
53
+ }
54
+ }