@warlock.js/ai-deepseek 5.51.0 → 5.53.0

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/cjs/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["OpenAISDK"],"sources":["../../../../../../../packages/ai-deepseek/src/known-context-windows.ts","../../../../../../../packages/ai-deepseek/src/known-models.ts","../../../../../../../packages/ai-deepseek/src/sdk.ts","../../../../../../../packages/ai-deepseek/src/known-lifecycle.ts"],"sourcesContent":["/*\n * Context windows of DeepSeek chat models. `deepseek-flash` and the\n * `deepseek-v4-*` ids document 1M tokens (DeepSeek's model table);\n * the retired `deepseek-chat` and `deepseek-reasoner` documented 128K.\n * The longest matching prefix wins; ids that match nothing resolve to `undefined`, so a\n * window-relative trigger stays inert until the window is set with\n * `deepseek.model({ name, contextWindow })`.\n */\nconst KNOWN_WINDOWS: ReadonlyArray<readonly [prefix: string, window: number]> = [\n [\"deepseek-chat\", 128_000],\n [\"deepseek-reasoner\", 128_000],\n [\"deepseek-v4\", 1_000_000],\n [\"deepseek-flash\", 1_000_000],\n];\n\n/**\n * The known context window (tokens, input plus output) of a DeepSeek chat\n * model id, or `undefined` when it is not in the table.\n *\n * @example\n * inferContextWindow(\"deepseek-chat\"); // → 128000\n */\nexport function inferContextWindow(modelId: string): number | undefined {\n const id = modelId.toLowerCase();\n let best: readonly [string, number] | undefined;\n\n for (const entry of KNOWN_WINDOWS) {\n const prefix = entry[0];\n\n if (id.startsWith(prefix) && (!best || prefix.length > best[0].length)) {\n best = entry;\n }\n }\n\n return best?.[1];\n}\n","/**\n * Capability inference for DeepSeek chat model ids.\n *\n * DeepSeek's API is OpenAI-compatible on the wire (`@warlock.js/ai-deepseek`\n * wraps {@link OpenAISDK}), but its model **names** are not OpenAI names —\n * so OpenAI's own prefix lists (`gpt-4o`, `o3`, …) never match them. This\n * module supplies DeepSeek's OWN name-based inference, which the\n * {@link DeepSeekSDK} injects as explicit capability booleans into the\n * wrapped `openai.model(...)` call (explicit config wins over OpenAI's\n * inference inside `OpenAIModel`).\n *\n * Verified against the official DeepSeek API docs (api-docs.deepseek.com):\n * base URL `https://api.deepseek.com`, OpenAI-compatible Chat Completions.\n * The reasoning-capable surfaces are the `*-pro` tier and the retired\n * `deepseek-reasoner` name. Vision inference is conservatively `false` for\n * every id; opt in per model with `vision: true`.\n */\n\n/**\n * Current DeepSeek chat model ids, surfaced for discovery and docs.\n *\n * - `deepseek-flash` — the fast tier (served by DeepSeek-V4.1-Flash; 1M\n * context, thinking on by default, accepts image input per DeepSeek).\n * - `deepseek-v4-pro` — the quality tier; thinks by default.\n *\n * The older names are retired and recorded in {@link DEEPSEEK_MODEL_LIFECYCLE}:\n * `deepseek-chat` / `deepseek-reasoner` (retired 2026-07-24) and\n * `deepseek-v4-flash`, which DeepSeek still accepts and bills at the\n * `deepseek-flash` price. The list is informational only —\n * `deepseek.model({ name })` accepts any id the upstream serves.\n */\nexport const DEEPSEEK_CHAT_MODELS = [\"deepseek-flash\", \"deepseek-v4-pro\"] as const;\n\n/**\n * Substrings identifying DeepSeek model ids that expose a reasoning /\n * thinking channel and accept the reasoning-effort knob.\n *\n * - `deepseek-reasoner` — the dedicated thinking surface (R1 lineage).\n * - `-pro` — the V4 quality tier (`deepseek-v4-pro`), which thinks by\n * default per DeepSeek's docs.\n *\n * `deepseek-chat` (the V3 non-thinking surface) and `deepseek-v4-flash`\n * stay `false`. A substring match tolerates date/preview suffixes the\n * provider may append. Override per-model via\n * `deepseek.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\"deepseek-reasoner\", \"-pro\"];\n\n/**\n * Infer whether a DeepSeek model id is reasoning-capable based on the\n * known substrings. Unknown ids default to `false` so the adapter never\n * forwards an unsupported reasoning param to a non-thinking model.\n *\n * @example\n * inferReasoningCapability(\"deepseek-reasoner\"); // → true\n * inferReasoningCapability(\"deepseek-v4-pro\"); // → true\n * inferReasoningCapability(\"deepseek-chat\"); // → false\n * inferReasoningCapability(\"deepseek-v4-flash\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Substrings identifying DeepSeek model ids that accept image (vision)\n * input.\n *\n * Currently **empty**: as of mid-2026, no DeepSeek chat model documents\n * vision input on the OpenAI-compatible Chat Completions endpoint, so\n * inference returns `false` for every id and passing an image attachment\n * surfaces a clear, agent-side capability error instead of an opaque 400.\n * Append a fragment here (and a paired spec case) the day DeepSeek ships a\n * multimodal chat model. Devs can always opt in per-model via\n * `deepseek.model({ name, vision: true })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS: readonly string[] = [];\n\n/**\n * Infer whether a DeepSeek model id supports vision based on the known\n * substrings. Today this is always `false` (see\n * {@link VISION_CAPABLE_SUBSTRINGS}); kept as a function so the\n * {@link DeepSeekSDK} call site and the override semantics stay identical\n * to the other adapters, ready for a future multimodal id.\n *\n * @example\n * inferVisionCapability(\"deepseek-chat\"); // → false\n * inferVisionCapability(\"deepseek-reasoner\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n","import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ImageModelContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type {\n DeepSeekEmbedderConfig,\n DeepSeekImageConfig,\n DeepSeekModelConfig,\n DeepSeekSDKConfig,\n} from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport { inferReasoningCapability, inferVisionCapability } from \"./known-models\";\n\n/**\n * DeepSeek's OpenAI-compatible Chat Completions endpoint. Verified against\n * the official API docs (api-docs.deepseek.com, mid-2026).\n */\nconst DEEPSEEK_BASE_URL = \"https://api.deepseek.com\";\n\n/** Default upstream label for models produced by this SDK. */\nconst DEEPSEEK_PROVIDER = \"deepseek\";\n\n/** The date the {@link DEEPSEEK_DEFAULT_PRICING} rates were last checked against DeepSeek's pricing page. */\nexport const DEEPSEEK_DEFAULT_PRICING_AS_OF = \"2026-11-06\";\n\n/**\n * Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed\n * by model name; `cachedInput` is the cache-hit input rate.\n *\n * Source: https://api-docs.deepseek.com/quick_start/pricing, as of\n * {@link DEEPSEEK_DEFAULT_PRICING_AS_OF}. DeepSeek bills by time of day: peak hours (01:00–04:00 and\n * 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat\n * `ModelPricing` cannot follow the clock, so these are the **peak** rates —\n * an upper bound that keeps USD budgets safe; off-peak calls really cost\n * half. Pass {@link DEEPSEEK_OFF_PEAK_PRICING} (or your own) as `pricing`\n * when you know you run off-peak.\n *\n * `deepseek-v4-flash` is the legacy name of `deepseek-flash` and bills at\n * the same rate. `deepseek-chat` / `deepseek-reasoner` are gone from the\n * price list (discontinued 2026-07-24) and stay unpriced.\n *\n * A caller-supplied SDK `pricing` registry, or a per-model `pricing`,\n * overrides any entry here.\n */\nexport const DEEPSEEK_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-pro\": { input: 1.32, output: 3.96, cachedInput: 0.044 },\n};\n\n/**\n * DeepSeek's off-peak rates (half the peak {@link DEEPSEEK_DEFAULT_PRICING}),\n * same source and date. Opt in per SDK:\n *\n * @example\n * new DeepSeekSDK({ apiKey, pricing: DEEPSEEK_OFF_PEAK_PRICING });\n */\nexport const DEEPSEEK_OFF_PEAK_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-pro\": { input: 0.66, output: 1.98, cachedInput: 0.022 },\n};\n\n/**\n * DeepSeek-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for DeepSeek models. DeepSeek's API is\n * OpenAI-compatible on the wire, so rather than reimplementing the\n * battle-tested Chat Completions translation, this is a **thin wrapper**\n * over {@link OpenAISDK} from `@warlock.js/ai-openai`: it constructs one\n * internal `OpenAISDK` pinned to DeepSeek's `baseURL` and the `\"deepseek\"`\n * provider label, and delegates `model()` / `embedder()` / `image()` /\n * `count()` straight to it. Construct one `DeepSeekSDK` per account and\n * reuse it everywhere.\n *\n * **What the wrapper adds over a bare `OpenAISDK`.** DeepSeek's model\n * **names** are not OpenAI names, so OpenAI's own vision/reasoning prefix\n * lists never match them. This wrapper injects DeepSeek's OWN capability\n * inference (see `known-models.ts`) and built-in DeepSeek pricing defaults\n * as explicit values on every `model()` call — so `deepseek-reasoner` is\n * correctly flagged reasoning-capable and `deepseek-chat` is not, even\n * though neither matches an OpenAI prefix. An explicit `vision` /\n * `reasoning` / `pricing` you pass per model always wins over these\n * injected defaults.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth, DeepSeek base URL)\n * and DeepSeek's capability + pricing defaults.\n * - Does NOT own: the wire protocol, streaming loop, message/tool\n * translation, or error wrapping — all inherited unchanged from\n * `OpenAISDK` / `OpenAIModel`.\n *\n * @example\n * const deepseek = new DeepSeekSDK({ apiKey: process.env.DEEPSEEK_API_KEY! });\n * const chat = deepseek.model({ name: \"deepseek-chat\" }); // reasoning=false\n * const reasoner = deepseek.model({ name: \"deepseek-reasoner\" }); // reasoning=true\n *\n * @example\n * // Compose into an `ai.deepseek` namespace for ergonomic agent wiring\n * const ai = { agent, tool, deepseek: new DeepSeekSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.deepseek.model({ name: \"deepseek-reasoner\" }) });\n */\nexport class DeepSeekSDK implements SDKAdapterContract {\n /** The wrapped OpenAI-compatible client, pinned to DeepSeek. */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing: Record<string, ModelPricing>;\n\n public constructor(config: DeepSeekSDKConfig) {\n const { provider, pricing, baseURL, ...clientOptions } = config;\n\n this.provider = provider ?? DEEPSEEK_PROVIDER;\n // Caller pricing overrides the built-in DeepSeek defaults entry-by-entry.\n this.pricing = { ...DEEPSEEK_DEFAULT_PRICING, ...pricing };\n\n // The internal OpenAISDK carries the DeepSeek base URL + provider label;\n // pricing stays on THIS wrapper so it can be merged with the built-in\n // defaults before each per-model resolution below.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? DEEPSEEK_BASE_URL,\n provider: this.provider,\n });\n }\n\n /**\n * Build a `ModelContract` for a DeepSeek model. Delegates to the wrapped\n * `OpenAISDK.model()`, but first injects this provider's defaults:\n * - `vision` / `reasoning` inferred from DeepSeek's model-name lists\n * (`known-models.ts`) — so the right capabilities are set even though\n * the names aren't OpenAI names.\n * - `pricing` resolved from the built-in DeepSeek table merged with any\n * caller-supplied SDK registry.\n *\n * An explicit `vision` / `reasoning` / `pricing` on `config` always wins\n * over the injected default. Everything else (sampling, structured\n * output, streaming, error wrapping) is inherited unchanged from\n * `OpenAIModel`.\n */\n public model(config: DeepSeekModelConfig): ModelContract {\n const window = config.contextWindow ?? inferContextWindow(config.name);\n const resolved: DeepSeekModelConfig = {\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n pricing: config.pricing ?? this.pricing[config.name],\n };\n\n return this.openai.model(resolved);\n }\n\n /**\n * Rough offline token-count estimate. Delegated to the wrapped\n * `OpenAISDK.count()` (the core character-heuristic) — good for\n * budgeting/quota guards, not billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an `EmbedderContract`. Delegated verbatim to\n * `OpenAISDK.embedder()`.\n *\n * NOTE: DeepSeek does not officially document an OpenAI-compatible\n * embeddings endpoint (mid-2026); this delegate works against a\n * compatible gateway you point `baseURL` at, but may fail against the\n * stock DeepSeek endpoint. Prefer a dedicated embeddings provider for\n * RAG.\n */\n public embedder(config: DeepSeekEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n /**\n * Build an `ImageModelContract`. Delegated verbatim to\n * `OpenAISDK.image()`.\n *\n * NOTE: DeepSeek does not document an image-generation endpoint\n * (mid-2026); provided for adapter parity. A non-image model id is\n * rejected at construction by the wrapped OpenAI image model.\n */\n public image(config: DeepSeekImageConfig): ImageModelContract {\n return this.openai.image(config);\n }\n /**\n * List the models this DeepSeek account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. DeepSeek lists its chat models (`deepseek-chat`, `deepseek-reasoner`). Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await deepseek.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n","import type { ModelLifecycle } from \"@warlock.js/ai\";\n\n/**\n * Where DeepSeek's docs put its chat model names, as of\n * {@link DEEPSEEK_MODEL_LIFECYCLE_AS_OF}. `deepseek-chat` and\n * `deepseek-reasoner` were retired on 2026-07-24. `deepseek-v4-flash` is\n * retired as a model, but DeepSeek still accepts the name and serves it\n * with `deepseek-flash`, billed at the Flash price; it published no\n * shutdown date for the name.\n *\n * Sources: https://api-docs.deepseek.com/news/news260424 and\n * https://api-docs.deepseek.com/quick_start/pricing\n */\nexport const DEEPSEEK_MODEL_LIFECYCLE: Readonly<Record<string, ModelLifecycle>> = {\n \"deepseek-flash\": { status: \"current\" },\n \"deepseek-v4-pro\": { status: \"current\" },\n \"deepseek-v4-flash\": { status: \"retired\", replacement: \"deepseek-flash\" },\n \"deepseek-chat\": { status: \"retired\", retiresOn: \"2026-07-24\", replacement: \"deepseek-v4-flash\" },\n \"deepseek-reasoner\": {\n status: \"retired\",\n retiresOn: \"2026-07-24\",\n replacement: \"deepseek-v4-flash\",\n },\n};\n\n/** The date {@link DEEPSEEK_MODEL_LIFECYCLE} was last checked against DeepSeek's docs. */\nexport const DEEPSEEK_MODEL_LIFECYCLE_AS_OF = \"2026-11-06\";\n\n/**\n * Look up the lifecycle of a DeepSeek model id (exact match), or\n * `undefined` when the table does not cover it.\n *\n * @example\n * deepseekLifecycleFor(\"deepseek-chat\"); // { status: \"retired\", retiresOn: \"2026-07-24\", … }\n */\nexport function deepseekLifecycleFor(modelName: string): ModelLifecycle | undefined {\n return Object.hasOwn(DEEPSEEK_MODEL_LIFECYCLE, modelName)\n ? DEEPSEEK_MODEL_LIFECYCLE[modelName]\n : undefined;\n}\n"],"mappings":";;;;AAQA,MAAM,gBAA0E;CAC9E,CAAC,iBAAiB,KAAO;CACzB,CAAC,qBAAqB,KAAO;CAC7B,CAAC,eAAe,GAAS;CACzB,CAAC,kBAAkB,GAAS;AAC9B;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KAAK,QAAQ,YAAY;CAC/B,IAAI;CAEJ,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,SAAS,MAAM;EAErB,IAAI,GAAG,WAAW,MAAM,MAAM,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC,SAC7D,OAAO;CAEX;CAEA,OAAO,OAAO;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA,MAAa,uBAAuB,CAAC,kBAAkB,iBAAiB;;;;;;;;;;;;;;AAexE,MAAM,+BAA+B,CAAC,qBAAqB,MAAM;;;;;;;;;;;;AAajE,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;AAcA,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AAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,SAAS,OAAO,WAAW,KAAK,QAAQ,OAAO;EACjD;EAEA,OAAO,KAAK,OAAO,MAAM,QAAQ;CACnC;;;;;;CAOA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAAkD;EAChE,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;CAUA,AAAO,MAAM,QAAiD;EAC5D,OAAO,KAAK,OAAO,MAAM,MAAM;CACjC;;;;;;;;;;;CAWA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF;;;;;;;;;;;;;;;AChMA,MAAa,2BAAqE;CAChF,kBAAkB,EAAE,QAAQ,UAAU;CACtC,mBAAmB,EAAE,QAAQ,UAAU;CACvC,qBAAqB;EAAE,QAAQ;EAAW,aAAa;CAAiB;CACxE,iBAAiB;EAAE,QAAQ;EAAW,WAAW;EAAc,aAAa;CAAoB;CAChG,qBAAqB;EACnB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;AACF;;AAGA,MAAa,iCAAiC;;;;;;;;AAS9C,SAAgB,qBAAqB,WAA+C;CAClF,OAAO,OAAO,OAAO,0BAA0B,SAAS,IACpD,yBAAyB,aACzB;AACN"}
1
+ {"version":3,"file":"index.cjs","names":["OpenAISDK"],"sources":["../../../../../../../packages/ai-deepseek/src/known-context-windows.ts","../../../../../../../packages/ai-deepseek/src/known-models.ts","../../../../../../../packages/ai-deepseek/src/sdk.ts","../../../../../../../packages/ai-deepseek/src/known-lifecycle.ts"],"mappings":";;;;AAQA,MAAM,gBAA0E;CAC9E,CAAC,iBAAiB,KAAO;CACzB,CAAC,qBAAqB,KAAO;CAC7B,CAAC,eAAe,GAAS;CACzB,CAAC,kBAAkB,GAAS;AAC9B;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KA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;;AAGA,MAAa,iCAAiC;;;;;;;;AAS9C,SAAgB,qBAAqB,WAA+C;CAClF,OAAO,OAAO,OAAO,0BAA0B,SAAS,IACpD,yBAAyB,aACzB;AACN"}
@@ -1 +1 @@
1
- {"version":3,"file":"known-context-windows.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-context-windows.ts"],"sourcesContent":["/*\n * Context windows of DeepSeek chat models. `deepseek-flash` and the\n * `deepseek-v4-*` ids document 1M tokens (DeepSeek's model table);\n * the retired `deepseek-chat` and `deepseek-reasoner` documented 128K.\n * The longest matching prefix wins; ids that match nothing resolve to `undefined`, so a\n * window-relative trigger stays inert until the window is set with\n * `deepseek.model({ name, contextWindow })`.\n */\nconst KNOWN_WINDOWS: ReadonlyArray<readonly [prefix: string, window: number]> = [\n [\"deepseek-chat\", 128_000],\n [\"deepseek-reasoner\", 128_000],\n [\"deepseek-v4\", 1_000_000],\n [\"deepseek-flash\", 1_000_000],\n];\n\n/**\n * The known context window (tokens, input plus output) of a DeepSeek chat\n * model id, or `undefined` when it is not in the table.\n *\n * @example\n * inferContextWindow(\"deepseek-chat\"); // → 128000\n */\nexport function inferContextWindow(modelId: string): number | undefined {\n const id = modelId.toLowerCase();\n let best: readonly [string, number] | undefined;\n\n for (const entry of KNOWN_WINDOWS) {\n const prefix = entry[0];\n\n if (id.startsWith(prefix) && (!best || prefix.length > best[0].length)) {\n best = entry;\n }\n }\n\n return best?.[1];\n}\n"],"mappings":";AAQA,MAAM,gBAA0E;CAC9E,CAAC,iBAAiB,KAAO;CACzB,CAAC,qBAAqB,KAAO;CAC7B,CAAC,eAAe,GAAS;CACzB,CAAC,kBAAkB,GAAS;AAC9B;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KAAK,QAAQ,YAAY;CAC/B,IAAI;CAEJ,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,SAAS,MAAM;EAErB,IAAI,GAAG,WAAW,MAAM,MAAM,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC,SAC7D,OAAO;CAEX;CAEA,OAAO,OAAO;AAChB"}
1
+ {"version":3,"file":"known-context-windows.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-context-windows.ts"],"mappings":";AAQA,MAAM,gBAA0E;CAC9E,CAAC,iBAAiB,KAAO;CACzB,CAAC,qBAAqB,KAAO;CAC7B,CAAC,eAAe,GAAS;CACzB,CAAC,kBAAkB,GAAS;AAC9B;;;;;;;;AASA,SAAgB,mBAAmB,SAAqC;CACtE,MAAM,KAAK,QAAQ,YAAY;CAC/B,IAAI;CAEJ,KAAK,MAAM,SAAS,eAAe;EACjC,MAAM,SAAS,MAAM;EAErB,IAAI,GAAG,WAAW,MAAM,MAAM,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,CAAC,SAC7D,OAAO;CAEX;CAEA,OAAO,OAAO;AAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"known-lifecycle.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-lifecycle.ts"],"sourcesContent":["import type { ModelLifecycle } from \"@warlock.js/ai\";\n\n/**\n * Where DeepSeek's docs put its chat model names, as of\n * {@link DEEPSEEK_MODEL_LIFECYCLE_AS_OF}. `deepseek-chat` and\n * `deepseek-reasoner` were retired on 2026-07-24. `deepseek-v4-flash` is\n * retired as a model, but DeepSeek still accepts the name and serves it\n * with `deepseek-flash`, billed at the Flash price; it published no\n * shutdown date for the name.\n *\n * Sources: https://api-docs.deepseek.com/news/news260424 and\n * https://api-docs.deepseek.com/quick_start/pricing\n */\nexport const DEEPSEEK_MODEL_LIFECYCLE: Readonly<Record<string, ModelLifecycle>> = {\n \"deepseek-flash\": { status: \"current\" },\n \"deepseek-v4-pro\": { status: \"current\" },\n \"deepseek-v4-flash\": { status: \"retired\", replacement: \"deepseek-flash\" },\n \"deepseek-chat\": { status: \"retired\", retiresOn: \"2026-07-24\", replacement: \"deepseek-v4-flash\" },\n \"deepseek-reasoner\": {\n status: \"retired\",\n retiresOn: \"2026-07-24\",\n replacement: \"deepseek-v4-flash\",\n },\n};\n\n/** The date {@link DEEPSEEK_MODEL_LIFECYCLE} was last checked against DeepSeek's docs. */\nexport const DEEPSEEK_MODEL_LIFECYCLE_AS_OF = \"2026-11-06\";\n\n/**\n * Look up the lifecycle of a DeepSeek model id (exact match), or\n * `undefined` when the table does not cover it.\n *\n * @example\n * deepseekLifecycleFor(\"deepseek-chat\"); // { status: \"retired\", retiresOn: \"2026-07-24\", … }\n */\nexport function deepseekLifecycleFor(modelName: string): ModelLifecycle | undefined {\n return Object.hasOwn(DEEPSEEK_MODEL_LIFECYCLE, modelName)\n ? DEEPSEEK_MODEL_LIFECYCLE[modelName]\n : undefined;\n}\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,2BAAqE;CAChF,kBAAkB,EAAE,QAAQ,UAAU;CACtC,mBAAmB,EAAE,QAAQ,UAAU;CACvC,qBAAqB;EAAE,QAAQ;EAAW,aAAa;CAAiB;CACxE,iBAAiB;EAAE,QAAQ;EAAW,WAAW;EAAc,aAAa;CAAoB;CAChG,qBAAqB;EACnB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;AACF;;AAGA,MAAa,iCAAiC;;;;;;;;AAS9C,SAAgB,qBAAqB,WAA+C;CAClF,OAAO,OAAO,OAAO,0BAA0B,SAAS,IACpD,yBAAyB,aACzB;AACN"}
1
+ {"version":3,"file":"known-lifecycle.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-lifecycle.ts"],"mappings":";;;;;;;;;;;;AAaA,MAAa,2BAAqE;CAChF,kBAAkB,EAAE,QAAQ,UAAU;CACtC,mBAAmB,EAAE,QAAQ,UAAU;CACvC,qBAAqB;EAAE,QAAQ;EAAW,aAAa;CAAiB;CACxE,iBAAiB;EAAE,QAAQ;EAAW,WAAW;EAAc,aAAa;CAAoB;CAChG,qBAAqB;EACnB,QAAQ;EACR,WAAW;EACX,aAAa;CACf;AACF;;AAGA,MAAa,iCAAiC;;;;;;;;AAS9C,SAAgB,qBAAqB,WAA+C;CAClF,OAAO,OAAO,OAAO,0BAA0B,SAAS,IACpD,yBAAyB,aACzB;AACN"}
@@ -1 +1 @@
1
- {"version":3,"file":"known-models.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-models.ts"],"sourcesContent":["/**\n * Capability inference for DeepSeek chat model ids.\n *\n * DeepSeek's API is OpenAI-compatible on the wire (`@warlock.js/ai-deepseek`\n * wraps {@link OpenAISDK}), but its model **names** are not OpenAI names —\n * so OpenAI's own prefix lists (`gpt-4o`, `o3`, …) never match them. This\n * module supplies DeepSeek's OWN name-based inference, which the\n * {@link DeepSeekSDK} injects as explicit capability booleans into the\n * wrapped `openai.model(...)` call (explicit config wins over OpenAI's\n * inference inside `OpenAIModel`).\n *\n * Verified against the official DeepSeek API docs (api-docs.deepseek.com):\n * base URL `https://api.deepseek.com`, OpenAI-compatible Chat Completions.\n * The reasoning-capable surfaces are the `*-pro` tier and the retired\n * `deepseek-reasoner` name. Vision inference is conservatively `false` for\n * every id; opt in per model with `vision: true`.\n */\n\n/**\n * Current DeepSeek chat model ids, surfaced for discovery and docs.\n *\n * - `deepseek-flash` — the fast tier (served by DeepSeek-V4.1-Flash; 1M\n * context, thinking on by default, accepts image input per DeepSeek).\n * - `deepseek-v4-pro` — the quality tier; thinks by default.\n *\n * The older names are retired and recorded in {@link DEEPSEEK_MODEL_LIFECYCLE}:\n * `deepseek-chat` / `deepseek-reasoner` (retired 2026-07-24) and\n * `deepseek-v4-flash`, which DeepSeek still accepts and bills at the\n * `deepseek-flash` price. The list is informational only —\n * `deepseek.model({ name })` accepts any id the upstream serves.\n */\nexport const DEEPSEEK_CHAT_MODELS = [\"deepseek-flash\", \"deepseek-v4-pro\"] as const;\n\n/**\n * Substrings identifying DeepSeek model ids that expose a reasoning /\n * thinking channel and accept the reasoning-effort knob.\n *\n * - `deepseek-reasoner` — the dedicated thinking surface (R1 lineage).\n * - `-pro` — the V4 quality tier (`deepseek-v4-pro`), which thinks by\n * default per DeepSeek's docs.\n *\n * `deepseek-chat` (the V3 non-thinking surface) and `deepseek-v4-flash`\n * stay `false`. A substring match tolerates date/preview suffixes the\n * provider may append. Override per-model via\n * `deepseek.model({ name, reasoning: true | false })`.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\"deepseek-reasoner\", \"-pro\"];\n\n/**\n * Infer whether a DeepSeek model id is reasoning-capable based on the\n * known substrings. Unknown ids default to `false` so the adapter never\n * forwards an unsupported reasoning param to a non-thinking model.\n *\n * @example\n * inferReasoningCapability(\"deepseek-reasoner\"); // → true\n * inferReasoningCapability(\"deepseek-v4-pro\"); // → true\n * inferReasoningCapability(\"deepseek-chat\"); // → false\n * inferReasoningCapability(\"deepseek-v4-flash\"); // → false\n */\nexport function inferReasoningCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Substrings identifying DeepSeek model ids that accept image (vision)\n * input.\n *\n * Currently **empty**: as of mid-2026, no DeepSeek chat model documents\n * vision input on the OpenAI-compatible Chat Completions endpoint, so\n * inference returns `false` for every id and passing an image attachment\n * surfaces a clear, agent-side capability error instead of an opaque 400.\n * Append a fragment here (and a paired spec case) the day DeepSeek ships a\n * multimodal chat model. Devs can always opt in per-model via\n * `deepseek.model({ name, vision: true })`.\n */\nconst VISION_CAPABLE_SUBSTRINGS: readonly string[] = [];\n\n/**\n * Infer whether a DeepSeek model id supports vision based on the known\n * substrings. Today this is always `false` (see\n * {@link VISION_CAPABLE_SUBSTRINGS}); kept as a function so the\n * {@link DeepSeekSDK} call site and the override semantics stay identical\n * to the other adapters, ready for a future multimodal id.\n *\n * @example\n * inferVisionCapability(\"deepseek-chat\"); // → false\n * inferVisionCapability(\"deepseek-reasoner\"); // → false\n */\nexport function inferVisionCapability(modelId: string): boolean {\n const normalized = modelId.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,uBAAuB,CAAC,kBAAkB,iBAAiB;;;;;;;;;;;;;;AAexE,MAAM,+BAA+B,CAAC,qBAAqB,MAAM;;;;;;;;;;;;AAajE,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;AAcA,MAAM,4BAA+C,CAAC;;;;;;;;;;;;AAatD,SAAgB,sBAAsB,SAA0B;CAC9D,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF"}
1
+ {"version":3,"file":"known-models.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/known-models.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,uBAAuB,CAAC,kBAAkB,iBAAiB;;;;;;;;;;;;;;AAexE,MAAM,+BAA+B,CAAC,qBAAqB,MAAM;;;;;;;;;;;;AAajE,SAAgB,yBAAyB,SAA0B;CACjE,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;;;;AAcA,MAAM,4BAA+C,CAAC;;;;;;;;;;;;AAatD,SAAgB,sBAAsB,SAA0B;CAC9D,MAAM,aAAa,QAAQ,YAAY;CAEvC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF"}
package/esm/sdk.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.mjs","names":[],"sources":["../../../../../../../packages/ai-deepseek/src/sdk.ts"],"sourcesContent":["import type {\n ListModelsOptions,\n ModelInfo,\n EmbedderContract,\n ImageModelContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type {\n DeepSeekEmbedderConfig,\n DeepSeekImageConfig,\n DeepSeekModelConfig,\n DeepSeekSDKConfig,\n} from \"./config.type\";\nimport { inferContextWindow } from \"./known-context-windows\";\nimport { inferReasoningCapability, inferVisionCapability } from \"./known-models\";\n\n/**\n * DeepSeek's OpenAI-compatible Chat Completions endpoint. Verified against\n * the official API docs (api-docs.deepseek.com, mid-2026).\n */\nconst DEEPSEEK_BASE_URL = \"https://api.deepseek.com\";\n\n/** Default upstream label for models produced by this SDK. */\nconst DEEPSEEK_PROVIDER = \"deepseek\";\n\n/** The date the {@link DEEPSEEK_DEFAULT_PRICING} rates were last checked against DeepSeek's pricing page. */\nexport const DEEPSEEK_DEFAULT_PRICING_AS_OF = \"2026-11-06\";\n\n/**\n * Built-in DeepSeek pricing defaults, in USD per 1,000,000 tokens, keyed\n * by model name; `cachedInput` is the cache-hit input rate.\n *\n * Source: https://api-docs.deepseek.com/quick_start/pricing, as of\n * {@link DEEPSEEK_DEFAULT_PRICING_AS_OF}. DeepSeek bills by time of day: peak hours (01:00–04:00 and\n * 06:00–10:00 UTC, Monday to Friday) cost twice the off-peak rate. A flat\n * `ModelPricing` cannot follow the clock, so these are the **peak** rates —\n * an upper bound that keeps USD budgets safe; off-peak calls really cost\n * half. Pass {@link DEEPSEEK_OFF_PEAK_PRICING} (or your own) as `pricing`\n * when you know you run off-peak.\n *\n * `deepseek-v4-flash` is the legacy name of `deepseek-flash` and bills at\n * the same rate. `deepseek-chat` / `deepseek-reasoner` are gone from the\n * price list (discontinued 2026-07-24) and stay unpriced.\n *\n * A caller-supplied SDK `pricing` registry, or a per-model `pricing`,\n * overrides any entry here.\n */\nexport const DEEPSEEK_DEFAULT_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-flash\": { input: 0.3, output: 1.2, cachedInput: 0.006 },\n \"deepseek-v4-pro\": { input: 1.32, output: 3.96, cachedInput: 0.044 },\n};\n\n/**\n * DeepSeek's off-peak rates (half the peak {@link DEEPSEEK_DEFAULT_PRICING}),\n * same source and date. Opt in per SDK:\n *\n * @example\n * new DeepSeekSDK({ apiKey, pricing: DEEPSEEK_OFF_PEAK_PRICING });\n */\nexport const DEEPSEEK_OFF_PEAK_PRICING: Readonly<Record<string, ModelPricing>> = {\n \"deepseek-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-flash\": { input: 0.15, output: 0.6, cachedInput: 0.003 },\n \"deepseek-v4-pro\": { input: 0.66, output: 1.98, cachedInput: 0.022 },\n};\n\n/**\n * DeepSeek-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for DeepSeek models. DeepSeek's API is\n * OpenAI-compatible on the wire, so rather than reimplementing the\n * battle-tested Chat Completions translation, this is a **thin wrapper**\n * over {@link OpenAISDK} from `@warlock.js/ai-openai`: it constructs one\n * internal `OpenAISDK` pinned to DeepSeek's `baseURL` and the `\"deepseek\"`\n * provider label, and delegates `model()` / `embedder()` / `image()` /\n * `count()` straight to it. Construct one `DeepSeekSDK` per account and\n * reuse it everywhere.\n *\n * **What the wrapper adds over a bare `OpenAISDK`.** DeepSeek's model\n * **names** are not OpenAI names, so OpenAI's own vision/reasoning prefix\n * lists never match them. This wrapper injects DeepSeek's OWN capability\n * inference (see `known-models.ts`) and built-in DeepSeek pricing defaults\n * as explicit values on every `model()` call — so `deepseek-reasoner` is\n * correctly flagged reasoning-capable and `deepseek-chat` is not, even\n * though neither matches an OpenAI prefix. An explicit `vision` /\n * `reasoning` / `pricing` you pass per model always wins over these\n * injected defaults.\n *\n * **Responsibility.**\n * - Owns: one long-lived internal `OpenAISDK` (auth, DeepSeek base URL)\n * and DeepSeek's capability + pricing defaults.\n * - Does NOT own: the wire protocol, streaming loop, message/tool\n * translation, or error wrapping — all inherited unchanged from\n * `OpenAISDK` / `OpenAIModel`.\n *\n * @example\n * const deepseek = new DeepSeekSDK({ apiKey: process.env.DEEPSEEK_API_KEY! });\n * const chat = deepseek.model({ name: \"deepseek-chat\" }); // reasoning=false\n * const reasoner = deepseek.model({ name: \"deepseek-reasoner\" }); // reasoning=true\n *\n * @example\n * // Compose into an `ai.deepseek` namespace for ergonomic agent wiring\n * const ai = { agent, tool, deepseek: new DeepSeekSDK({ apiKey }) };\n * const myAgent = ai.agent({ model: ai.deepseek.model({ name: \"deepseek-reasoner\" }) });\n */\nexport class DeepSeekSDK implements SDKAdapterContract {\n /** The wrapped OpenAI-compatible client, pinned to DeepSeek. */\n private readonly openai: OpenAISDK;\n private readonly provider: string;\n private readonly pricing: Record<string, ModelPricing>;\n\n public constructor(config: DeepSeekSDKConfig) {\n const { provider, pricing, baseURL, ...clientOptions } = config;\n\n this.provider = provider ?? DEEPSEEK_PROVIDER;\n // Caller pricing overrides the built-in DeepSeek defaults entry-by-entry.\n this.pricing = { ...DEEPSEEK_DEFAULT_PRICING, ...pricing };\n\n // The internal OpenAISDK carries the DeepSeek base URL + provider label;\n // pricing stays on THIS wrapper so it can be merged with the built-in\n // defaults before each per-model resolution below.\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? DEEPSEEK_BASE_URL,\n provider: this.provider,\n });\n }\n\n /**\n * Build a `ModelContract` for a DeepSeek model. Delegates to the wrapped\n * `OpenAISDK.model()`, but first injects this provider's defaults:\n * - `vision` / `reasoning` inferred from DeepSeek's model-name lists\n * (`known-models.ts`) — so the right capabilities are set even though\n * the names aren't OpenAI names.\n * - `pricing` resolved from the built-in DeepSeek table merged with any\n * caller-supplied SDK registry.\n *\n * An explicit `vision` / `reasoning` / `pricing` on `config` always wins\n * over the injected default. Everything else (sampling, structured\n * output, streaming, error wrapping) is inherited unchanged from\n * `OpenAIModel`.\n */\n public model(config: DeepSeekModelConfig): ModelContract {\n const window = config.contextWindow ?? inferContextWindow(config.name);\n const resolved: DeepSeekModelConfig = {\n ...config,\n ...(window !== undefined ? { contextWindow: window } : {}),\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n pricing: config.pricing ?? this.pricing[config.name],\n };\n\n return this.openai.model(resolved);\n }\n\n /**\n * Rough offline token-count estimate. Delegated to the wrapped\n * `OpenAISDK.count()` (the core character-heuristic) — good for\n * budgeting/quota guards, not billing.\n */\n public async count(text: string, model?: string): Promise<number> {\n return this.openai.count(text, model);\n }\n\n /**\n * Build an `EmbedderContract`. Delegated verbatim to\n * `OpenAISDK.embedder()`.\n *\n * NOTE: DeepSeek does not officially document an OpenAI-compatible\n * embeddings endpoint (mid-2026); this delegate works against a\n * compatible gateway you point `baseURL` at, but may fail against the\n * stock DeepSeek endpoint. Prefer a dedicated embeddings provider for\n * RAG.\n */\n public embedder(config: DeepSeekEmbedderConfig): EmbedderContract {\n return this.openai.embedder(config);\n }\n\n /**\n * Build an `ImageModelContract`. Delegated verbatim to\n * `OpenAISDK.image()`.\n *\n * NOTE: DeepSeek does not document an image-generation endpoint\n * (mid-2026); provided for adapter parity. A non-image model id is\n * rejected at construction by the wrapped OpenAI image model.\n */\n public image(config: DeepSeekImageConfig): ImageModelContract {\n return this.openai.image(config);\n }\n /**\n * List the models this DeepSeek account can use, live from the provider's\n * OpenAI-compatible `GET /models`, mapped to the common `ModelInfo`\n * shape. DeepSeek lists its chat models (`deepseek-chat`, `deepseek-reasoner`). Failures are thrown as the adapter's usual provider\n * errors, never an empty list.\n *\n * @example\n * const models = await deepseek.models();\n * models.map((model) => model.id);\n */\n public async models(options?: ListModelsOptions): Promise<ModelInfo[]> {\n return this.openai.models(options);\n }\n}\n"],"mappings":";;;;;;;;;AAuBA,MAAM,oBAAoB;;AAG1B,MAAM,oBAAoB;;AAG1B,MAAa,iCAAiC;;;;;;;;;;;;;;;;;;;;AAqB9C,MAAa,2BAAmE;CAC9E,kBAAkB;EAAE,OAAO;EAAK,QAAQ;EAAK,aAAa;CAAM;CAChE,qBA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sB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;GACnE,SAAS,OAAO,WAAW,KAAK,QAAQ,OAAO;EACjD;EAEA,OAAO,KAAK,OAAO,MAAM,QAAQ;CACnC;;;;;;CAOA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAAkD;EAChE,OAAO,KAAK,OAAO,SAAS,MAAM;CACpC;;;;;;;;;CAUA,AAAO,MAAM,QAAiD;EAC5D,OAAO,KAAK,OAAO,MAAM,MAAM;CACjC;;;;;;;;;;;CAWA,MAAa,OAAO,SAAmD;EACrE,OAAO,KAAK,OAAO,OAAO,OAAO;CACnC;AACF"}
package/package.json CHANGED
@@ -14,13 +14,13 @@
14
14
  "directory": "packages/ai-deepseek"
15
15
  },
16
16
  "dependencies": {
17
- "@warlock.js/ai-openai": "5.51.0",
18
- "@warlock.js/logger": "5.51.0"
17
+ "@warlock.js/ai-openai": "5.53.0",
18
+ "@warlock.js/logger": "5.53.0"
19
19
  },
20
20
  "peerDependencies": {
21
- "@warlock.js/ai": "5.51.0"
21
+ "@warlock.js/ai": "5.53.0"
22
22
  },
23
- "version": "5.51.0",
23
+ "version": "5.53.0",
24
24
  "main": "./cjs/index.cjs",
25
25
  "module": "./esm/index.mjs",
26
26
  "types": "./esm/index.d.mts",