@deepseek-ai/dsh-deepseek-llm-api-extensions 0.1.2-alpha.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,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write packages/llm/deepseek-llm-api-extensions/README.md
5
+ README.md: cc5d2687ada61843e000b6ab180ab9c19eeee395
6
+ README.zh.md: 03b7969669d4acd2c6cc290f0d34883199040f2c
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: "Official DeepSeek request-extension registry for provider plugins contributing lifecycle-owned top-level API fields."
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-deepseek-llm-api-extensions
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ Provider-specific registry for additive top-level fields on official DeepSeek LLM API requests. `DeepSeekLlmApiExtensionRegistry` registers `ctx.deepseekLlmApiExtensions`; contributor plugins claim one declaration-merged field, and `dsh-llm-deepseek` prepares the current contributions after serializing its base request. Use it when a plugin must add a validated provider-specific field without changing the base adapter.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Service](#service)
17
+ - [Model Experience](#model-experience)
18
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
19
+ - [Dev Note](#dev-note)
20
+
21
+ -----
22
+
23
+ <a id="service"></a>
24
+ ## Service
25
+
26
+ - `register(field, provider)` reserves one field for the calling fiber. Duplicate or malformed names fail synchronously; disposing the registration releases it for a later provider.
27
+ - `prepare(request)` snapshots the registered providers, prepares them concurrently, clones and freezes returned JSON values, and returns `{ fields, accept }`. A preparation failure rejects before HTTP dispatch; request cancellation stops awaiting providers even when one ignores its signal.
28
+ - `accept()` runs every captured post-2xx callback once. Concurrent calls join the same settlement, every callback settles before failures are reported, and several failures become one `AggregateError`.
29
+
30
+ Each provider sees the exact serialized base body, the request `AbortSignal`, plus optional `sessionId` and auxiliary-call `purpose`. It must stop its own work promptly after cancellation and returns `undefined` when its field does not apply to that request. A prepared operation retains the providers it captured even if HMR removes their registrations before HTTP acceptance.
31
+
32
+ The registry owns addition and lifecycle, not field semantics. `@deepseek-ai/dsh-session-log-deepseek` owns `dsh_session_log`; `@deepseek-ai/dsh-plugin-package-inventory-deepseek` owns `dsh_plugin_packages`. The provider-neutral LLM seam and `llm-pi-ai` do not consume this registry.
33
+
34
+ <a id="model-experience"></a>
35
+ ## Model Experience
36
+
37
+ Indirectly, through `@deepseek-ai/dsh-llm-deepseek`, which sends registered fields outside the model's `messages`, system prompt, and tool schemas.
38
+
39
+ #### KV Cache effect
40
+
41
+ None; registry fields are model-hidden provider metadata and do not alter the serialized model-input prefix.
42
+
43
+ ## Known Limitations and Deferred Work
44
+
45
+ <a id="known-limitations-and-deferred-work"></a>
46
+
47
+ - **Official DeepSeek requests only** — the registry intentionally has no provider-neutral routing or pi-ai adapter integration.
48
+ - **No field ordering contract** — JSON object member order follows registration preparation but receivers address fields by name.
49
+
50
+
51
+ <a id="dev-note"></a>
52
+ ### Dev Note
53
+
54
+ <details>
55
+ <summary>Working context for maintainers — click to expand</summary>
56
+
57
+ None.
58
+
59
+ </details>
package/README.zh.md ADDED
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: "面向提供方插件的官方 DeepSeek 请求扩展注册表,用于贡献具有生命周期归属的顶层 API 字段。"
3
+ kind: "package-reference"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-deepseek-llm-api-extensions
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 用于向 DeepSeek 官方 LLM API 请求添加顶层字段的提供方特定注册表。`DeepSeekLlmApiExtensionRegistry` 注册 `ctx.deepseekLlmApiExtensions`;贡献插件分别认领一个经声明合并的字段,`dsh-llm-deepseek` 则在序列化基础请求后准备当前贡献。当插件必须添加经过验证的提供方特定字段且不能修改基础 adapter 时,请使用它。
13
+
14
+ ## 目录
15
+
16
+ - [服务](#service)
17
+ - [模型体验](#model-experience)
18
+ - [已知限制与暂缓事项](#known-limitations-and-deferred-work)
19
+ - [开发备注](#dev-note)
20
+
21
+ -----
22
+
23
+ <a id="service"></a>
24
+ ## 服务
25
+
26
+ - `register(field, provider)` 为调用 fiber 保留一个字段。重复或格式错误的名称会同步失败;dispose(资源释放)该注册后,后续提供方可以再次认领。
27
+ - `prepare(request)` 对已注册提供方取快照,并发准备贡献,克隆并冻结返回的 JSON 值,然后返回 `{ fields, accept }`。准备失败会在 HTTP 分发前拒绝请求;请求取消后,即使某个提供方忽略信号,注册表也会停止等待。
28
+ - `accept()` 对每个捕获的 2xx 后回调只运行一次。并发调用会等待同一次结算,所有回调都在报告失败前完成,多个失败会合并为一个 `AggregateError`。
29
+
30
+ 每个提供方都会看到确切的已序列化基础正文、请求 `AbortSignal`,以及可选的 `sessionId` 与辅助调用 `purpose`。提供方必须在取消后迅速停止自身工作;字段不适用于当前请求时返回 `undefined`。即使 HMR(热模块替换)在 HTTP 接受前移除了注册,已准备的操作仍会保留其捕获的提供方。
31
+
32
+ 注册表拥有字段添加与生命周期,不拥有字段语义。`@deepseek-ai/dsh-session-log-deepseek` 拥有 `dsh_session_log`;`@deepseek-ai/dsh-plugin-package-inventory-deepseek` 拥有 `dsh_plugin_packages`。提供方无关的 LLM seam 与 `llm-pi-ai` 都不消费该注册表。
33
+
34
+ <a id="model-experience"></a>
35
+ ## 模型体验
36
+
37
+ 通过 `@deepseek-ai/dsh-llm-deepseek` 间接生效;该包在模型的 `messages`、系统提示词与工具 schema 之外发送已注册字段。
38
+
39
+ #### KV Cache 影响
40
+
41
+ 无;注册表字段是模型不可见的提供方元数据,不改变已序列化的模型输入前缀。
42
+
43
+ ## 已知限制与暂缓事项
44
+
45
+ <a id="known-limitations-and-deferred-work"></a>
46
+
47
+ - **仅限 DeepSeek 官方请求**——该注册表刻意不提供提供方无关的路由,也不集成 pi-ai 适配器。
48
+ - **不约定字段顺序**——JSON 对象成员顺序取决于注册准备顺序,但接收方按名称寻址字段。
49
+
50
+
51
+ <a id="dev-note"></a>
52
+ ### 开发备注
53
+
54
+ <details>
55
+ <summary>维护者工作上下文——点击展开</summary>
56
+
57
+ 无。
58
+
59
+ </details>
package/lib/index.js ADDED
@@ -0,0 +1,94 @@
1
+ import { Service } from "@deepseek-ai/cordis";
2
+ //#region lib/types/index.js
3
+ /**
4
+ * DeepSeek LLM API extension registry: plugins own independent top-level request
5
+ * fields while the official adapter performs one preparation and acceptance transaction.
6
+ * @module @deepseek-ai/dsh-deepseek-llm-api-extensions
7
+ */
8
+ /** Recursively freeze a fresh structured clone. */
9
+ function freezeJson(value) {
10
+ if (value !== null && typeof value === "object") {
11
+ for (const child of Array.isArray(value) ? value : Object.values(value)) freezeJson(child);
12
+ Object.freeze(value);
13
+ }
14
+ return value;
15
+ }
16
+ /** Settle every acceptance callback before reporting failures. */
17
+ async function acceptAll(callbacks) {
18
+ const failures = (await Promise.allSettled(callbacks.map((callback) => Promise.resolve().then(callback)))).filter((outcome) => outcome.status === "rejected").map((outcome) => outcome.reason);
19
+ if (failures.length === 1) throw failures[0];
20
+ if (failures.length > 1) throw new AggregateError(failures, "DeepSeek LLM API extension acceptance failed");
21
+ }
22
+ /** Stop awaiting provider work when the containing model request is cancelled. */
23
+ async function abortable(work, signal) {
24
+ signal.throwIfAborted();
25
+ const aborted = Promise.withResolvers();
26
+ const onAbort = () => {
27
+ aborted.reject(signal.reason);
28
+ };
29
+ signal.addEventListener("abort", onAbort, { once: true });
30
+ try {
31
+ const result = await Promise.race([work, aborted.promise]);
32
+ signal.throwIfAborted();
33
+ return result;
34
+ } finally {
35
+ signal.removeEventListener("abort", onAbort);
36
+ }
37
+ }
38
+ /** Registry of independently owned top-level fields for official DeepSeek requests. */
39
+ var DeepSeekLlmApiExtensionRegistry = class extends Service {
40
+ providers = /* @__PURE__ */ new Map();
41
+ constructor(ctx) {
42
+ super(ctx, "deepseekLlmApiExtensions");
43
+ }
44
+ /**
45
+ * Register the sole provider of one top-level request field. Registration is effect-scoped.
46
+ * @param field - declaration-merged field owned by the provider.
47
+ * @param provider - request-time field preparation and optional acceptance behavior.
48
+ * @returns disposer that releases the field.
49
+ */
50
+ register(field, provider) {
51
+ const fieldName = field;
52
+ if (fieldName.length === 0 || fieldName.trim() !== fieldName) throw new Error("deepseek-llm-api-extensions: field must be a non-blank trimmed string");
53
+ const providers = this.providers;
54
+ const erased = provider;
55
+ return this.ctx.effect(() => {
56
+ if (providers.has(fieldName)) throw new Error(`deepseek-llm-api-extensions: field ${JSON.stringify(fieldName)} is already registered`);
57
+ providers.set(fieldName, erased);
58
+ return () => {
59
+ providers.delete(fieldName);
60
+ };
61
+ }, `deepseekLlmApiExtensions.register(${JSON.stringify(fieldName)})`);
62
+ }
63
+ /**
64
+ * Prepare every currently registered field from one immutable base request.
65
+ * Preparation failures reject before HTTP dispatch. Field values are cloned and frozen;
66
+ * providers retain no mutable alias to the outgoing request.
67
+ * @param request - exact serialized request facts before extension fields.
68
+ * @returns detached fields and their idempotent joint acceptance transaction.
69
+ */
70
+ async prepare(request) {
71
+ request.signal.throwIfAborted();
72
+ const entries = [...this.providers.entries()];
73
+ const prepared = await abortable(Promise.all(entries.map(async ([field, provider]) => ({
74
+ field,
75
+ result: await provider.prepare(request)
76
+ }))), request.signal);
77
+ const fields = Object.create(null);
78
+ const callbacks = [];
79
+ for (const { field, result } of prepared) {
80
+ if (result === void 0) continue;
81
+ fields[field] = freezeJson(structuredClone(result.value));
82
+ const accept = result.accept;
83
+ if (accept !== void 0) callbacks.push(accept.bind(result));
84
+ }
85
+ Object.freeze(fields);
86
+ let acceptance;
87
+ return {
88
+ fields,
89
+ accept: () => acceptance ??= acceptAll(callbacks)
90
+ };
91
+ }
92
+ };
93
+ //#endregion
94
+ export { DeepSeekLlmApiExtensionRegistry, DeepSeekLlmApiExtensionRegistry as default };
@@ -0,0 +1,20 @@
1
+ //#region lib/types/invariant.js
2
+ /** Package-owned invariant companion for `@deepseek-ai/dsh-deepseek-llm-api-extensions`. */
3
+ const PACKAGE_NAME = "@deepseek-ai/dsh-deepseek-llm-api-extensions";
4
+ /** Cordis companion plugin name. */
5
+ const name = "deepseek-llm-api-extensions-invariant";
6
+ /** Service required before the companion can reserve package ownership. */
7
+ const inject = ["invariants"];
8
+ /**
9
+ * No runtime invariant: duplicate ownership, detached output, and one acceptance
10
+ * settlement are enforced inside the registry operation that owns each decision.
11
+ */
12
+ const install = () => {};
13
+ /**
14
+ * Register this package's invariant companion.
15
+ * @param ctx - Cordis context carrying the invariant service.
16
+ * @returns the installed registration's disposer after setup succeeds.
17
+ */
18
+ const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
19
+ //#endregion
20
+ export { apply, inject, name };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * DeepSeek LLM API extension registry: plugins own independent top-level request
3
+ * fields while the official adapter performs one preparation and acceptance transaction.
4
+ * @module @deepseek-ai/dsh-deepseek-llm-api-extensions
5
+ */
6
+ import { Context, Service } from '@deepseek-ai/cordis';
7
+ import type { DeepSeekLlmApiExtensionMap, DeepSeekLlmApiExtensionProvider, DeepSeekLlmApiExtensionRequest, PreparedDeepSeekLlmApiExtensions } from './types.ts';
8
+ export type * from './types.ts';
9
+ declare module '@deepseek-ai/cordis' {
10
+ interface Context {
11
+ deepseekLlmApiExtensions: DeepSeekLlmApiExtensionRegistry;
12
+ }
13
+ }
14
+ /** Registry of independently owned top-level fields for official DeepSeek requests. */
15
+ export declare class DeepSeekLlmApiExtensionRegistry extends Service {
16
+ private readonly providers;
17
+ constructor(ctx: Context);
18
+ /**
19
+ * Register the sole provider of one top-level request field. Registration is effect-scoped.
20
+ * @param field - declaration-merged field owned by the provider.
21
+ * @param provider - request-time field preparation and optional acceptance behavior.
22
+ * @returns disposer that releases the field.
23
+ */
24
+ register<K extends keyof DeepSeekLlmApiExtensionMap>(field: K, provider: DeepSeekLlmApiExtensionProvider<DeepSeekLlmApiExtensionMap[K]>): () => Promise<void>;
25
+ /**
26
+ * Prepare every currently registered field from one immutable base request.
27
+ * Preparation failures reject before HTTP dispatch. Field values are cloned and frozen;
28
+ * providers retain no mutable alias to the outgoing request.
29
+ * @param request - exact serialized request facts before extension fields.
30
+ * @returns detached fields and their idempotent joint acceptance transaction.
31
+ */
32
+ prepare(request: DeepSeekLlmApiExtensionRequest): Promise<PreparedDeepSeekLlmApiExtensions>;
33
+ }
34
+ export default DeepSeekLlmApiExtensionRegistry;
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,105 @@
1
+ /**
2
+ * DeepSeek LLM API extension registry: plugins own independent top-level request
3
+ * fields while the official adapter performs one preparation and acceptance transaction.
4
+ * @module @deepseek-ai/dsh-deepseek-llm-api-extensions
5
+ */
6
+ import { Service } from '@deepseek-ai/cordis';
7
+ /** Recursively freeze a fresh structured clone. */
8
+ function freezeJson(value) {
9
+ if (value !== null && typeof value === 'object') {
10
+ for (const child of Array.isArray(value) ? value : Object.values(value))
11
+ freezeJson(child);
12
+ Object.freeze(value);
13
+ }
14
+ return value;
15
+ }
16
+ /** Settle every acceptance callback before reporting failures. */
17
+ async function acceptAll(callbacks) {
18
+ const outcomes = await Promise.allSettled(callbacks.map(callback => Promise.resolve().then(callback)));
19
+ const failures = outcomes
20
+ .filter((outcome) => outcome.status === 'rejected')
21
+ .map(outcome => outcome.reason);
22
+ if (failures.length === 1)
23
+ throw failures[0];
24
+ if (failures.length > 1)
25
+ throw new AggregateError(failures, 'DeepSeek LLM API extension acceptance failed');
26
+ }
27
+ /** Stop awaiting provider work when the containing model request is cancelled. */
28
+ async function abortable(work, signal) {
29
+ signal.throwIfAborted();
30
+ const aborted = Promise.withResolvers();
31
+ const onAbort = () => { aborted.reject(signal.reason); };
32
+ signal.addEventListener('abort', onAbort, { once: true });
33
+ try {
34
+ const result = await Promise.race([work, aborted.promise]);
35
+ signal.throwIfAborted();
36
+ return result;
37
+ }
38
+ finally {
39
+ signal.removeEventListener('abort', onAbort);
40
+ }
41
+ }
42
+ /** Registry of independently owned top-level fields for official DeepSeek requests. */
43
+ export class DeepSeekLlmApiExtensionRegistry extends Service {
44
+ providers = new Map();
45
+ constructor(ctx) {
46
+ super(ctx, 'deepseekLlmApiExtensions');
47
+ }
48
+ /**
49
+ * Register the sole provider of one top-level request field. Registration is effect-scoped.
50
+ * @param field - declaration-merged field owned by the provider.
51
+ * @param provider - request-time field preparation and optional acceptance behavior.
52
+ * @returns disposer that releases the field.
53
+ */
54
+ register(field, provider) {
55
+ const fieldName = field;
56
+ if (fieldName.length === 0 || fieldName.trim() !== fieldName) {
57
+ throw new Error('deepseek-llm-api-extensions: field must be a non-blank trimmed string');
58
+ }
59
+ const providers = this.providers;
60
+ const erased = provider;
61
+ const dispose = this.ctx.effect(() => {
62
+ if (providers.has(fieldName)) {
63
+ throw new Error(`deepseek-llm-api-extensions: field ${JSON.stringify(fieldName)} is already registered`);
64
+ }
65
+ providers.set(fieldName, erased);
66
+ return () => {
67
+ providers.delete(fieldName);
68
+ };
69
+ }, `deepseekLlmApiExtensions.register(${JSON.stringify(fieldName)})`);
70
+ return dispose;
71
+ }
72
+ /**
73
+ * Prepare every currently registered field from one immutable base request.
74
+ * Preparation failures reject before HTTP dispatch. Field values are cloned and frozen;
75
+ * providers retain no mutable alias to the outgoing request.
76
+ * @param request - exact serialized request facts before extension fields.
77
+ * @returns detached fields and their idempotent joint acceptance transaction.
78
+ */
79
+ async prepare(request) {
80
+ request.signal.throwIfAborted();
81
+ const entries = [...this.providers.entries()];
82
+ const prepared = await abortable(Promise.all(entries.map(async ([field, provider]) => ({
83
+ field,
84
+ result: await provider.prepare(request),
85
+ }))), request.signal);
86
+ const fields = Object.create(null);
87
+ const callbacks = [];
88
+ for (const { field, result } of prepared) {
89
+ if (result === undefined)
90
+ continue;
91
+ fields[field] = freezeJson(structuredClone(result.value));
92
+ const accept = result.accept;
93
+ if (accept !== undefined)
94
+ callbacks.push(accept.bind(result));
95
+ }
96
+ Object.freeze(fields);
97
+ let acceptance;
98
+ return {
99
+ fields,
100
+ accept: () => acceptance ??= acceptAll(callbacks),
101
+ };
102
+ }
103
+ }
104
+ export default DeepSeekLlmApiExtensionRegistry;
105
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,13 @@
1
+ /** Package-owned invariant companion for `@deepseek-ai/dsh-deepseek-llm-api-extensions`. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ /** Cordis companion plugin name. */
4
+ export declare const name = "deepseek-llm-api-extensions-invariant";
5
+ /** Service required before the companion can reserve package ownership. */
6
+ export declare const inject: string[];
7
+ /**
8
+ * Register this package's invariant companion.
9
+ * @param ctx - Cordis context carrying the invariant service.
10
+ * @returns the installed registration's disposer after setup succeeds.
11
+ */
12
+ export declare const apply: (ctx: Context) => Promise<() => void>;
13
+ //# sourceMappingURL=invariant.d.ts.map
@@ -0,0 +1,19 @@
1
+ /** Package-owned invariant companion for `@deepseek-ai/dsh-deepseek-llm-api-extensions`. */
2
+ const PACKAGE_NAME = '@deepseek-ai/dsh-deepseek-llm-api-extensions';
3
+ /** Cordis companion plugin name. */
4
+ export const name = 'deepseek-llm-api-extensions-invariant';
5
+ /** Service required before the companion can reserve package ownership. */
6
+ export const inject = ['invariants'];
7
+ /**
8
+ * No runtime invariant: duplicate ownership, detached output, and one acceptance
9
+ * settlement are enforced inside the registry operation that owns each decision.
10
+ */
11
+ const install = () => { };
12
+ /**
13
+ * Register this package's invariant companion.
14
+ * @param ctx - Cordis context carrying the invariant service.
15
+ * @returns the installed registration's disposer after setup succeeds.
16
+ */
17
+ export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
18
+ /* jscpd:ignore-end */
19
+ //# sourceMappingURL=invariant.js.map
@@ -0,0 +1,49 @@
1
+ /** Provider-specific JSON and contribution types for DeepSeek request extensions. */
2
+ /** Lossless JSON value accepted by the DeepSeek request body. */
3
+ export type DeepSeekLlmApiJson = null | boolean | number | string | DeepSeekLlmApiJson[] | {
4
+ [key: string]: DeepSeekLlmApiJson;
5
+ };
6
+ /**
7
+ * Merge-extensible table of top-level DeepSeek request extension fields.
8
+ * Contributor packages declaration-merge the field they own.
9
+ */
10
+ export interface DeepSeekLlmApiExtensionMap {
11
+ }
12
+ /** Exact serialized request facts visible to extension providers. */
13
+ export interface DeepSeekLlmApiExtensionRequest {
14
+ /** Base DeepSeek request body before extension fields are merged. */
15
+ readonly body: Readonly<Record<string, DeepSeekLlmApiJson>>;
16
+ /** Session identity carried by the model request, when present. */
17
+ readonly sessionId?: string;
18
+ /** Auxiliary request classification, when present. */
19
+ readonly purpose?: 'compaction' | 'session-title';
20
+ /** Cancellation for request preparation; providers must stop promptly after abort. */
21
+ readonly signal: AbortSignal;
22
+ }
23
+ /** One prepared field value and its optional post-2xx commit. */
24
+ export interface PreparedDeepSeekLlmApiExtension<T extends DeepSeekLlmApiJson> {
25
+ /** Detached value merged under the provider's registered field. */
26
+ readonly value: T;
27
+ /** Commit state that depends on confirmed provider acceptance. */
28
+ accept?(): void | Promise<void>;
29
+ }
30
+ /** Provider registered under one key of {@link DeepSeekLlmApiExtensionMap}. */
31
+ export interface DeepSeekLlmApiExtensionProvider<T extends DeepSeekLlmApiJson> {
32
+ /**
33
+ * Prepare one field for an exact serialized request.
34
+ * @param request - immutable base request facts.
35
+ * @returns the prepared field, or `undefined` when this request has no value for it.
36
+ */
37
+ prepare(request: DeepSeekLlmApiExtensionRequest): PreparedDeepSeekLlmApiExtension<T> | undefined | Promise<PreparedDeepSeekLlmApiExtension<T> | undefined>;
38
+ }
39
+ /** All fields prepared for one request plus their joint acceptance transaction. */
40
+ export interface PreparedDeepSeekLlmApiExtensions {
41
+ /** Detached top-level fields to merge into the base request. */
42
+ readonly fields: Readonly<Partial<DeepSeekLlmApiExtensionMap>>;
43
+ /**
44
+ * Commit every captured provider after HTTP 2xx. Repeated calls join the same settlement.
45
+ * @returns fulfillment after every commit succeeds.
46
+ */
47
+ accept(): Promise<void>;
48
+ }
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Provider-specific JSON and contribution types for DeepSeek request extensions. */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@deepseek-ai/dsh-deepseek-llm-api-extensions",
3
+ "description": "Additive request-field registry for the official DeepSeek LLM API adapter",
4
+ "version": "0.1.2-alpha.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/deepseek-llm-api-extensions"
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
+ "./invariant": {
22
+ "types": "./lib/types/invariant.d.ts",
23
+ "default": "./lib/invariant.js"
24
+ },
25
+ "./types": {
26
+ "types": "./lib/types/types.d.ts",
27
+ "default": "./lib/types/types.js"
28
+ },
29
+ "./src/*": "./src/*",
30
+ "./package.json": "./package.json"
31
+ },
32
+ "files": [
33
+ "lib/index.js",
34
+ "lib/invariant.js",
35
+ "lib/types/**/*.js",
36
+ "lib/types/**/*.d.ts"
37
+ ],
38
+ "license": "MIT",
39
+ "peerDependencies": {
40
+ "@deepseek-ai/cordis": "^4.0.2",
41
+ "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2"
42
+ },
43
+ "devDependencies": {
44
+ "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
45
+ "@deepseek-ai/cordis": "^4.0.2"
46
+ }
47
+ }