@warlock.js/ai-mistral 4.6.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.
@@ -0,0 +1,154 @@
1
+ //#region ../@warlock.js/ai-mistral/src/known-models.ts
2
+ /**
3
+ * Model-name fragments identifying Mistral families that accept image
4
+ * input (vision / multimodal).
5
+ *
6
+ * - `pixtral` — Mistral's dedicated multimodal family
7
+ * (`pixtral-large-latest`, `pixtral-12b`); documents, charts, and
8
+ * natural images.
9
+ * - `mistral-large` / `mistral-medium` — the recent frontier generations
10
+ * (Large 3, Medium 3.5) are natively multimodal.
11
+ * - `ministral-3` — the current small open-weight line ships with
12
+ * best-in-class text + vision.
13
+ *
14
+ * Matched as a **substring** (not a strict prefix) so the date / version
15
+ * suffixes Mistral appends (`pixtral-large-2411`, `mistral-large-2512`)
16
+ * and the `-latest` aliases are all covered without enumerating every
17
+ * release tag. Override per-model via
18
+ * `mistral.model({ name, vision: true | false })` — explicit config
19
+ * always wins over inference.
20
+ *
21
+ * Maintenance: append a fragment when Mistral ships a multimodal family
22
+ * that doesn't already match.
23
+ */
24
+ const VISION_CAPABLE_SUBSTRINGS = [
25
+ "pixtral",
26
+ "mistral-large",
27
+ "mistral-medium",
28
+ "ministral-3"
29
+ ];
30
+ /**
31
+ * Model-name fragments identifying Mistral families that perform
32
+ * explicit chain-of-thought reasoning.
33
+ *
34
+ * - `magistral` — Mistral's dedicated reasoning family
35
+ * (`magistral-medium-latest`, `magistral-small-latest`); emits
36
+ * tokenized thinking chunks.
37
+ * - `mistral-small-4` / `mistral-small` — the current Small generation
38
+ * is a hybrid model that unifies instruct + reasoning + coding.
39
+ *
40
+ * Matched as a **substring** so version-tagged ids
41
+ * (`magistral-medium-2509`, `mistral-small-2603`) and `-latest` aliases
42
+ * are covered. Override per-model via
43
+ * `mistral.model({ name, reasoning: true | false })` — explicit config
44
+ * always wins over inference.
45
+ *
46
+ * Maintenance: append a fragment when Mistral ships a reasoning family
47
+ * that doesn't already match.
48
+ */
49
+ const REASONING_CAPABLE_SUBSTRINGS = ["magistral", "mistral-small"];
50
+ /**
51
+ * Infer whether a Mistral model id accepts image input (vision) based on
52
+ * the known multimodal-family fragments. Unknown ids default to `false`
53
+ * so passing an image attachment to a text-only model surfaces a clear,
54
+ * agent-side capability error instead of an opaque Mistral 400.
55
+ *
56
+ * @example
57
+ * inferVisionCapability("pixtral-large-latest"); // → true
58
+ * inferVisionCapability("mistral-large-2512"); // → true
59
+ * inferVisionCapability("magistral-medium-latest");// → false
60
+ * inferVisionCapability("mistral-embed"); // → false
61
+ */
62
+ function inferVisionCapability(modelName) {
63
+ const normalized = modelName.toLowerCase();
64
+ return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));
65
+ }
66
+ /**
67
+ * Infer whether a Mistral model id is a reasoning model (the `magistral`
68
+ * family plus the hybrid `mistral-small` generation) based on the known
69
+ * fragments. Unknown ids default to `false` so the adapter never forwards
70
+ * an unsupported `reasoning_effort` param to a non-reasoning model.
71
+ *
72
+ * @example
73
+ * inferReasoningCapability("magistral-medium-latest"); // → true
74
+ * inferReasoningCapability("mistral-small-2603"); // → true
75
+ * inferReasoningCapability("mistral-large-latest"); // → false
76
+ * inferReasoningCapability("pixtral-12b"); // → false
77
+ */
78
+ function inferReasoningCapability(modelName) {
79
+ const normalized = modelName.toLowerCase();
80
+ return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));
81
+ }
82
+ /**
83
+ * Stable `-latest` alias ids for the headline Mistral chat / embeddings
84
+ * models, grouped by role. Convenience constants only — `mistral.model()`
85
+ * accepts any id string, so a version-pinned id
86
+ * (`mistral-large-2512`, `magistral-medium-2509`) works just as well.
87
+ * Capability inference keys off the family fragment, not this list, so a
88
+ * newer alias is recognized the moment its name matches a fragment in
89
+ * {@link inferVisionCapability} / {@link inferReasoningCapability}.
90
+ */
91
+ const MISTRAL_MODELS = {
92
+ /** General-purpose multimodal flagship / mid / small chat aliases. */
93
+ chat: [
94
+ "mistral-large-latest",
95
+ "mistral-medium-latest",
96
+ "mistral-small-latest"
97
+ ],
98
+ /** Dedicated multimodal (vision) aliases — the `pixtral` family. */
99
+ vision: ["pixtral-large-latest", "pixtral-12b"],
100
+ /** Dedicated reasoning aliases — the `magistral` family. */
101
+ reasoning: ["magistral-medium-latest", "magistral-small-latest"],
102
+ /** Embeddings model reachable via the OpenAI-compatible `/v1/embeddings`. */
103
+ embedding: ["mistral-embed"]
104
+ };
105
+ /**
106
+ * Conservative default USD pricing registry (per 1,000,000 tokens),
107
+ * keyed by stable `-latest` alias, surfaced onto every model unless the
108
+ * caller overrides it via SDK-level or per-model `pricing`.
109
+ *
110
+ * These are sane published-list approximations for budgeting / cost-truth
111
+ * out of the box — Mistral revises rates and ships new generations, so
112
+ * pass an explicit `pricing` registry to `new MistralSDK({ pricing })`
113
+ * for billing-grade numbers. Resolution at `model()` time always lets a
114
+ * caller-supplied rate win: per-model `pricing` > SDK `pricing` > these
115
+ * defaults > `undefined`.
116
+ */
117
+ const MISTRAL_DEFAULT_PRICING = {
118
+ "mistral-large-latest": {
119
+ input: 2,
120
+ output: 6
121
+ },
122
+ "mistral-medium-latest": {
123
+ input: .4,
124
+ output: 2
125
+ },
126
+ "mistral-small-latest": {
127
+ input: .1,
128
+ output: .3
129
+ },
130
+ "pixtral-large-latest": {
131
+ input: 2,
132
+ output: 6
133
+ },
134
+ "pixtral-12b": {
135
+ input: .15,
136
+ output: .15
137
+ },
138
+ "magistral-medium-latest": {
139
+ input: 2,
140
+ output: 5
141
+ },
142
+ "magistral-small-latest": {
143
+ input: .5,
144
+ output: 1.5
145
+ },
146
+ "mistral-embed": {
147
+ input: .1,
148
+ output: 0
149
+ }
150
+ };
151
+
152
+ //#endregion
153
+ export { MISTRAL_DEFAULT_PRICING, MISTRAL_MODELS, inferReasoningCapability, inferVisionCapability };
154
+ //# sourceMappingURL=known-models.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"known-models.mjs","names":[],"sources":["../../../../../../@warlock.js/ai-mistral/src/known-models.ts"],"sourcesContent":["import type { ModelPricing } from \"@warlock.js/ai\";\n\n/**\n * Model-name fragments identifying Mistral families that accept image\n * input (vision / multimodal).\n *\n * - `pixtral` — Mistral's dedicated multimodal family\n * (`pixtral-large-latest`, `pixtral-12b`); documents, charts, and\n * natural images.\n * - `mistral-large` / `mistral-medium` — the recent frontier generations\n * (Large 3, Medium 3.5) are natively multimodal.\n * - `ministral-3` — the current small open-weight line ships with\n * best-in-class text + vision.\n *\n * Matched as a **substring** (not a strict prefix) so the date / version\n * suffixes Mistral appends (`pixtral-large-2411`, `mistral-large-2512`)\n * and the `-latest` aliases are all covered without enumerating every\n * release tag. Override per-model via\n * `mistral.model({ name, vision: true | false })` — explicit config\n * always wins over inference.\n *\n * Maintenance: append a fragment when Mistral ships a multimodal family\n * that doesn't already match.\n */\nconst VISION_CAPABLE_SUBSTRINGS = [\n \"pixtral\",\n \"mistral-large\",\n \"mistral-medium\",\n \"ministral-3\",\n] as const;\n\n/**\n * Model-name fragments identifying Mistral families that perform\n * explicit chain-of-thought reasoning.\n *\n * - `magistral` — Mistral's dedicated reasoning family\n * (`magistral-medium-latest`, `magistral-small-latest`); emits\n * tokenized thinking chunks.\n * - `mistral-small-4` / `mistral-small` — the current Small generation\n * is a hybrid model that unifies instruct + reasoning + coding.\n *\n * Matched as a **substring** so version-tagged ids\n * (`magistral-medium-2509`, `mistral-small-2603`) and `-latest` aliases\n * are covered. Override per-model via\n * `mistral.model({ name, reasoning: true | false })` — explicit config\n * always wins over inference.\n *\n * Maintenance: append a fragment when Mistral ships a reasoning family\n * that doesn't already match.\n */\nconst REASONING_CAPABLE_SUBSTRINGS = [\"magistral\", \"mistral-small\"] as const;\n\n/**\n * Infer whether a Mistral model id accepts image input (vision) based on\n * the known multimodal-family fragments. Unknown ids default to `false`\n * so passing an image attachment to a text-only model surfaces a clear,\n * agent-side capability error instead of an opaque Mistral 400.\n *\n * @example\n * inferVisionCapability(\"pixtral-large-latest\"); // → true\n * inferVisionCapability(\"mistral-large-2512\"); // → true\n * inferVisionCapability(\"magistral-medium-latest\");// → false\n * inferVisionCapability(\"mistral-embed\"); // → false\n */\nexport function inferVisionCapability(modelName: string): boolean {\n const normalized = modelName.toLowerCase();\n\n return VISION_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Infer whether a Mistral model id is a reasoning model (the `magistral`\n * family plus the hybrid `mistral-small` generation) based on the known\n * fragments. Unknown ids default to `false` so the adapter never forwards\n * an unsupported `reasoning_effort` param to a non-reasoning model.\n *\n * @example\n * inferReasoningCapability(\"magistral-medium-latest\"); // → true\n * inferReasoningCapability(\"mistral-small-2603\"); // → true\n * inferReasoningCapability(\"mistral-large-latest\"); // → false\n * inferReasoningCapability(\"pixtral-12b\"); // → false\n */\nexport function inferReasoningCapability(modelName: string): boolean {\n const normalized = modelName.toLowerCase();\n\n return REASONING_CAPABLE_SUBSTRINGS.some((fragment) => normalized.includes(fragment));\n}\n\n/**\n * Stable `-latest` alias ids for the headline Mistral chat / embeddings\n * models, grouped by role. Convenience constants only — `mistral.model()`\n * accepts any id string, so a version-pinned id\n * (`mistral-large-2512`, `magistral-medium-2509`) works just as well.\n * Capability inference keys off the family fragment, not this list, so a\n * newer alias is recognized the moment its name matches a fragment in\n * {@link inferVisionCapability} / {@link inferReasoningCapability}.\n */\nexport const MISTRAL_MODELS = {\n /** General-purpose multimodal flagship / mid / small chat aliases. */\n chat: [\"mistral-large-latest\", \"mistral-medium-latest\", \"mistral-small-latest\"],\n /** Dedicated multimodal (vision) aliases — the `pixtral` family. */\n vision: [\"pixtral-large-latest\", \"pixtral-12b\"],\n /** Dedicated reasoning aliases — the `magistral` family. */\n reasoning: [\"magistral-medium-latest\", \"magistral-small-latest\"],\n /** Embeddings model reachable via the OpenAI-compatible `/v1/embeddings`. */\n embedding: [\"mistral-embed\"],\n} as const;\n\n/**\n * Conservative default USD pricing registry (per 1,000,000 tokens),\n * keyed by stable `-latest` alias, surfaced onto every model unless the\n * caller overrides it via SDK-level or per-model `pricing`.\n *\n * These are sane published-list approximations for budgeting / cost-truth\n * out of the box — Mistral revises rates and ships new generations, so\n * pass an explicit `pricing` registry to `new MistralSDK({ pricing })`\n * for billing-grade numbers. Resolution at `model()` time always lets a\n * caller-supplied rate win: per-model `pricing` > SDK `pricing` > these\n * defaults > `undefined`.\n */\nexport const MISTRAL_DEFAULT_PRICING: Record<string, ModelPricing> = {\n \"mistral-large-latest\": { input: 2, output: 6 },\n \"mistral-medium-latest\": { input: 0.4, output: 2 },\n \"mistral-small-latest\": { input: 0.1, output: 0.3 },\n \"pixtral-large-latest\": { input: 2, output: 6 },\n \"pixtral-12b\": { input: 0.15, output: 0.15 },\n \"magistral-medium-latest\": { input: 2, output: 5 },\n \"magistral-small-latest\": { input: 0.5, output: 1.5 },\n \"mistral-embed\": { input: 0.1, output: 0 },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,4BAA4B;CAChC;CACA;CACA;CACA;AACF;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,+BAA+B,CAAC,aAAa,eAAe;;;;;;;;;;;;;AAclE,SAAgB,sBAAsB,WAA4B;CAChE,MAAM,aAAa,UAAU,YAAY;CAEzC,OAAO,0BAA0B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACnF;;;;;;;;;;;;;AAcA,SAAgB,yBAAyB,WAA4B;CACnE,MAAM,aAAa,UAAU,YAAY;CAEzC,OAAO,6BAA6B,MAAM,aAAa,WAAW,SAAS,QAAQ,CAAC;AACtF;;;;;;;;;;AAWA,MAAa,iBAAiB;;CAE5B,MAAM;EAAC;EAAwB;EAAyB;CAAsB;;CAE9E,QAAQ,CAAC,wBAAwB,aAAa;;CAE9C,WAAW,CAAC,2BAA2B,wBAAwB;;CAE/D,WAAW,CAAC,eAAe;AAC7B;;;;;;;;;;;;;AAcA,MAAa,0BAAwD;CACnE,wBAAwB;EAAE,OAAO;EAAG,QAAQ;CAAE;CAC9C,yBAAyB;EAAE,OAAO;EAAK,QAAQ;CAAE;CACjD,wBAAwB;EAAE,OAAO;EAAK,QAAQ;CAAI;CAClD,wBAAwB;EAAE,OAAO;EAAG,QAAQ;CAAE;CAC9C,eAAe;EAAE,OAAO;EAAM,QAAQ;CAAK;CAC3C,2BAA2B;EAAE,OAAO;EAAG,QAAQ;CAAE;CACjD,0BAA0B;EAAE,OAAO;EAAK,QAAQ;CAAI;CACpD,iBAAiB;EAAE,OAAO;EAAK,QAAQ;CAAE;AAC3C"}
package/esm/sdk.d.mts ADDED
@@ -0,0 +1,99 @@
1
+ import { MistralModelConfig, MistralSDKConfig } from "./config.type.mjs";
2
+ import { EmbedderConfig, EmbedderContract, ModelContract, SDKAdapterContract } from "@warlock.js/ai";
3
+
4
+ //#region ../@warlock.js/ai-mistral/src/sdk.d.ts
5
+ /**
6
+ * Mistral-backed implementation of `SDKAdapterContract`.
7
+ *
8
+ * **Role.** The package entry point for Mistral AI chat + embeddings.
9
+ * Mistral exposes an **OpenAI-compatible** API (`/v1/chat/completions`,
10
+ * `/v1/embeddings`), so `MistralSDK` is a *thin wrapper* over the
11
+ * battle-tested {@link OpenAISDK} — it does NOT re-implement the wire
12
+ * protocol, streaming loop, tool-call accumulation, structured-output
13
+ * mapping, error wrapping, or token accounting. It constructs one
14
+ * internal `OpenAISDK` pointed at Mistral's `baseURL` with
15
+ * `provider: "mistral"`, and delegates `model()` / `embedder()` /
16
+ * `count()` straight to it.
17
+ *
18
+ * **What this wrapper adds on top of the OpenAI adapter:**
19
+ * - **Defaults.** Injects Mistral's `baseURL` + `provider` label and a
20
+ * default {@link MISTRAL_DEFAULT_PRICING} registry so cost truth works
21
+ * out of the box. All are overridable via config.
22
+ * - **Provider-correct capability inference.** Mistral's model names
23
+ * aren't OpenAI names, so the OpenAI prefix lists never match. Before
24
+ * delegating `model()`, this wrapper infers `vision` (the `pixtral`
25
+ * family + recent multimodal generations) and `reasoning` (the
26
+ * `magistral` family + hybrid `mistral-small`) from *this provider's*
27
+ * fragment lists and passes them as explicit overrides — which the
28
+ * inner `OpenAISDK` honors verbatim. A caller-supplied explicit
29
+ * `vision` / `reasoning` still wins.
30
+ *
31
+ * Construct one SDK per account and reuse it everywhere; the single
32
+ * underlying `OpenAI` client (connection pool, auth, rate-limit state)
33
+ * is shared by every model / embedder produced here.
34
+ *
35
+ * **Note — no image generation.** Mistral has no OpenAI-compatible image
36
+ * endpoint, so `image()` is intentionally NOT exposed. The structural
37
+ * absence of the method IS the capability guard (see
38
+ * `SDKAdapterContract.image`): `ai.mistral.image(...)` is a compile-time
39
+ * error rather than a runtime failure.
40
+ *
41
+ * @example
42
+ * const mistral = new MistralSDK({ apiKey: process.env.MISTRAL_API_KEY! });
43
+ * const model = mistral.model({ name: "mistral-large-latest", temperature: 0.7 });
44
+ * const embedder = mistral.embedder({ name: "mistral-embed" });
45
+ *
46
+ * @example
47
+ * // Compose into an `ai.mistral` namespace for ergonomic agent wiring.
48
+ * const ai = { agent, tool, systemPrompt, mistral: new MistralSDK({ apiKey }) };
49
+ * const reasoner = ai.agent({ model: ai.mistral.model({ name: "magistral-medium-latest" }) });
50
+ */
51
+ declare class MistralSDK implements SDKAdapterContract {
52
+ /**
53
+ * The wrapped OpenAI-compatible adapter doing all the real work. Built
54
+ * once in the constructor with Mistral's `baseURL`, `provider` label,
55
+ * and merged pricing registry; every public method delegates to it.
56
+ */
57
+ private readonly openai;
58
+ constructor(config: MistralSDKConfig);
59
+ /**
60
+ * Build a `ModelContract` for a Mistral chat model.
61
+ *
62
+ * Delegates to the inner `OpenAISDK.model()` but first injects
63
+ * **Mistral-aware capability inference**: when the caller omits
64
+ * `vision` / `reasoning`, they're inferred from this provider's family
65
+ * fragments (`pixtral` → vision, `magistral` / `mistral-small` →
66
+ * reasoning, see `known-models.ts`) and passed down as explicit
67
+ * overrides. Without this step the wrapped OpenAI adapter would check
68
+ * Mistral ids against OpenAI prefixes (`gpt-4o`, `o3`, …) and wrongly
69
+ * report every Mistral model as non-vision / non-reasoning.
70
+ *
71
+ * A caller-supplied explicit `vision` / `reasoning` is preserved as-is
72
+ * (explicit config always wins over inference). Pricing resolution is
73
+ * handled downstream by `OpenAISDK` against the merged registry:
74
+ * per-model `pricing` > SDK registry (caller + Mistral defaults) >
75
+ * `undefined`.
76
+ */
77
+ model(config: MistralModelConfig): ModelContract;
78
+ /**
79
+ * Rough offline token-count estimate. Delegates to the wrapped
80
+ * `OpenAISDK.count()` (the shared character-heuristic from the core
81
+ * package) — good for budgeting / quota guards, not billing. The
82
+ * optional model id is forwarded but currently ignored.
83
+ */
84
+ count(text: string, model?: string): Promise<number>;
85
+ /**
86
+ * Build an `EmbedderContract` bound to this SDK's client. Mistral
87
+ * serves embeddings (`mistral-embed`) through the OpenAI-compatible
88
+ * `/v1/embeddings` endpoint, so this delegates straight to
89
+ * `OpenAISDK.embedder()`.
90
+ *
91
+ * @example
92
+ * const embedder = mistral.embedder({ name: "mistral-embed" });
93
+ * const { vector } = await embedder.embed("Hello world");
94
+ */
95
+ embedder(config: EmbedderConfig): EmbedderContract;
96
+ }
97
+ //#endregion
98
+ export { MistralSDK };
99
+ //# sourceMappingURL=sdk.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.d.mts","names":[],"sources":["../../../../../../@warlock.js/ai-mistral/src/sdk.ts"],"mappings":";;;;;;AAmEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0E2D;;;;;;;;;;;;;;cA1E9C,UAAA,YAAsB,kBAAA;;;;;;mBAMhB,MAAA;cAEE,MAAA,EAAQ,gBAAA;;;;;;;;;;;;;;;;;;;EAoCpB,KAAA,CAAM,MAAA,EAAQ,kBAAA,GAAqB,aAAA;;;;;;;EAgB7B,KAAA,CAAM,IAAA,UAAc,KAAA,YAAiB,OAAA;;;;;;;;;;;EAc3C,QAAA,CAAS,MAAA,EAAQ,cAAA,GAAiB,gBAAA;AAAA"}
package/esm/sdk.mjs ADDED
@@ -0,0 +1,121 @@
1
+ import { MISTRAL_DEFAULT_PRICING, inferReasoningCapability, inferVisionCapability } from "./known-models.mjs";
2
+ import { OpenAISDK } from "@warlock.js/ai-openai";
3
+
4
+ //#region ../@warlock.js/ai-mistral/src/sdk.ts
5
+ /** Default OpenAI-compatible base URL for the Mistral API. */
6
+ const MISTRAL_BASE_URL = "https://api.mistral.ai/v1";
7
+ /** Default provider label stamped onto every model this SDK produces. */
8
+ const MISTRAL_PROVIDER = "mistral";
9
+ /**
10
+ * Mistral-backed implementation of `SDKAdapterContract`.
11
+ *
12
+ * **Role.** The package entry point for Mistral AI chat + embeddings.
13
+ * Mistral exposes an **OpenAI-compatible** API (`/v1/chat/completions`,
14
+ * `/v1/embeddings`), so `MistralSDK` is a *thin wrapper* over the
15
+ * battle-tested {@link OpenAISDK} — it does NOT re-implement the wire
16
+ * protocol, streaming loop, tool-call accumulation, structured-output
17
+ * mapping, error wrapping, or token accounting. It constructs one
18
+ * internal `OpenAISDK` pointed at Mistral's `baseURL` with
19
+ * `provider: "mistral"`, and delegates `model()` / `embedder()` /
20
+ * `count()` straight to it.
21
+ *
22
+ * **What this wrapper adds on top of the OpenAI adapter:**
23
+ * - **Defaults.** Injects Mistral's `baseURL` + `provider` label and a
24
+ * default {@link MISTRAL_DEFAULT_PRICING} registry so cost truth works
25
+ * out of the box. All are overridable via config.
26
+ * - **Provider-correct capability inference.** Mistral's model names
27
+ * aren't OpenAI names, so the OpenAI prefix lists never match. Before
28
+ * delegating `model()`, this wrapper infers `vision` (the `pixtral`
29
+ * family + recent multimodal generations) and `reasoning` (the
30
+ * `magistral` family + hybrid `mistral-small`) from *this provider's*
31
+ * fragment lists and passes them as explicit overrides — which the
32
+ * inner `OpenAISDK` honors verbatim. A caller-supplied explicit
33
+ * `vision` / `reasoning` still wins.
34
+ *
35
+ * Construct one SDK per account and reuse it everywhere; the single
36
+ * underlying `OpenAI` client (connection pool, auth, rate-limit state)
37
+ * is shared by every model / embedder produced here.
38
+ *
39
+ * **Note — no image generation.** Mistral has no OpenAI-compatible image
40
+ * endpoint, so `image()` is intentionally NOT exposed. The structural
41
+ * absence of the method IS the capability guard (see
42
+ * `SDKAdapterContract.image`): `ai.mistral.image(...)` is a compile-time
43
+ * error rather than a runtime failure.
44
+ *
45
+ * @example
46
+ * const mistral = new MistralSDK({ apiKey: process.env.MISTRAL_API_KEY! });
47
+ * const model = mistral.model({ name: "mistral-large-latest", temperature: 0.7 });
48
+ * const embedder = mistral.embedder({ name: "mistral-embed" });
49
+ *
50
+ * @example
51
+ * // Compose into an `ai.mistral` namespace for ergonomic agent wiring.
52
+ * const ai = { agent, tool, systemPrompt, mistral: new MistralSDK({ apiKey }) };
53
+ * const reasoner = ai.agent({ model: ai.mistral.model({ name: "magistral-medium-latest" }) });
54
+ */
55
+ var MistralSDK = class {
56
+ constructor(config) {
57
+ const { provider, baseURL, pricing, ...clientOptions } = config;
58
+ const mergedPricing = {
59
+ ...MISTRAL_DEFAULT_PRICING,
60
+ ...pricing
61
+ };
62
+ this.openai = new OpenAISDK({
63
+ ...clientOptions,
64
+ baseURL: baseURL ?? MISTRAL_BASE_URL,
65
+ provider: provider ?? MISTRAL_PROVIDER,
66
+ pricing: mergedPricing
67
+ });
68
+ }
69
+ /**
70
+ * Build a `ModelContract` for a Mistral chat model.
71
+ *
72
+ * Delegates to the inner `OpenAISDK.model()` but first injects
73
+ * **Mistral-aware capability inference**: when the caller omits
74
+ * `vision` / `reasoning`, they're inferred from this provider's family
75
+ * fragments (`pixtral` → vision, `magistral` / `mistral-small` →
76
+ * reasoning, see `known-models.ts`) and passed down as explicit
77
+ * overrides. Without this step the wrapped OpenAI adapter would check
78
+ * Mistral ids against OpenAI prefixes (`gpt-4o`, `o3`, …) and wrongly
79
+ * report every Mistral model as non-vision / non-reasoning.
80
+ *
81
+ * A caller-supplied explicit `vision` / `reasoning` is preserved as-is
82
+ * (explicit config always wins over inference). Pricing resolution is
83
+ * handled downstream by `OpenAISDK` against the merged registry:
84
+ * per-model `pricing` > SDK registry (caller + Mistral defaults) >
85
+ * `undefined`.
86
+ */
87
+ model(config) {
88
+ const resolvedConfig = {
89
+ ...config,
90
+ vision: config.vision ?? inferVisionCapability(config.name),
91
+ reasoning: config.reasoning ?? inferReasoningCapability(config.name)
92
+ };
93
+ return this.openai.model(resolvedConfig);
94
+ }
95
+ /**
96
+ * Rough offline token-count estimate. Delegates to the wrapped
97
+ * `OpenAISDK.count()` (the shared character-heuristic from the core
98
+ * package) — good for budgeting / quota guards, not billing. The
99
+ * optional model id is forwarded but currently ignored.
100
+ */
101
+ async count(text, model) {
102
+ return this.openai.count(text, model);
103
+ }
104
+ /**
105
+ * Build an `EmbedderContract` bound to this SDK's client. Mistral
106
+ * serves embeddings (`mistral-embed`) through the OpenAI-compatible
107
+ * `/v1/embeddings` endpoint, so this delegates straight to
108
+ * `OpenAISDK.embedder()`.
109
+ *
110
+ * @example
111
+ * const embedder = mistral.embedder({ name: "mistral-embed" });
112
+ * const { vector } = await embedder.embed("Hello world");
113
+ */
114
+ embedder(config) {
115
+ return this.openai.embedder(config);
116
+ }
117
+ };
118
+
119
+ //#endregion
120
+ export { MistralSDK };
121
+ //# sourceMappingURL=sdk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.mjs","names":[],"sources":["../../../../../../@warlock.js/ai-mistral/src/sdk.ts"],"sourcesContent":["import type {\n EmbedderConfig,\n EmbedderContract,\n ModelContract,\n ModelPricing,\n SDKAdapterContract,\n} from \"@warlock.js/ai\";\nimport { OpenAISDK } from \"@warlock.js/ai-openai\";\nimport type { MistralModelConfig, MistralSDKConfig } from \"./config.type\";\nimport {\n inferReasoningCapability,\n inferVisionCapability,\n MISTRAL_DEFAULT_PRICING,\n} from \"./known-models\";\n\n/** Default OpenAI-compatible base URL for the Mistral API. */\nconst MISTRAL_BASE_URL = \"https://api.mistral.ai/v1\";\n\n/** Default provider label stamped onto every model this SDK produces. */\nconst MISTRAL_PROVIDER = \"mistral\";\n\n/**\n * Mistral-backed implementation of `SDKAdapterContract`.\n *\n * **Role.** The package entry point for Mistral AI chat + embeddings.\n * Mistral exposes an **OpenAI-compatible** API (`/v1/chat/completions`,\n * `/v1/embeddings`), so `MistralSDK` is a *thin wrapper* over the\n * battle-tested {@link OpenAISDK} — it does NOT re-implement the wire\n * protocol, streaming loop, tool-call accumulation, structured-output\n * mapping, error wrapping, or token accounting. It constructs one\n * internal `OpenAISDK` pointed at Mistral's `baseURL` with\n * `provider: \"mistral\"`, and delegates `model()` / `embedder()` /\n * `count()` straight to it.\n *\n * **What this wrapper adds on top of the OpenAI adapter:**\n * - **Defaults.** Injects Mistral's `baseURL` + `provider` label and a\n * default {@link MISTRAL_DEFAULT_PRICING} registry so cost truth works\n * out of the box. All are overridable via config.\n * - **Provider-correct capability inference.** Mistral's model names\n * aren't OpenAI names, so the OpenAI prefix lists never match. Before\n * delegating `model()`, this wrapper infers `vision` (the `pixtral`\n * family + recent multimodal generations) and `reasoning` (the\n * `magistral` family + hybrid `mistral-small`) from *this provider's*\n * fragment lists and passes them as explicit overrides — which the\n * inner `OpenAISDK` honors verbatim. A caller-supplied explicit\n * `vision` / `reasoning` still wins.\n *\n * Construct one SDK per account and reuse it everywhere; the single\n * underlying `OpenAI` client (connection pool, auth, rate-limit state)\n * is shared by every model / embedder produced here.\n *\n * **Note — no image generation.** Mistral has no OpenAI-compatible image\n * endpoint, so `image()` is intentionally NOT exposed. The structural\n * absence of the method IS the capability guard (see\n * `SDKAdapterContract.image`): `ai.mistral.image(...)` is a compile-time\n * error rather than a runtime failure.\n *\n * @example\n * const mistral = new MistralSDK({ apiKey: process.env.MISTRAL_API_KEY! });\n * const model = mistral.model({ name: \"mistral-large-latest\", temperature: 0.7 });\n * const embedder = mistral.embedder({ name: \"mistral-embed\" });\n *\n * @example\n * // Compose into an `ai.mistral` namespace for ergonomic agent wiring.\n * const ai = { agent, tool, systemPrompt, mistral: new MistralSDK({ apiKey }) };\n * const reasoner = ai.agent({ model: ai.mistral.model({ name: \"magistral-medium-latest\" }) });\n */\nexport class MistralSDK implements SDKAdapterContract {\n /**\n * The wrapped OpenAI-compatible adapter doing all the real work. Built\n * once in the constructor with Mistral's `baseURL`, `provider` label,\n * and merged pricing registry; every public method delegates to it.\n */\n private readonly openai: OpenAISDK;\n\n public constructor(config: MistralSDKConfig) {\n const { provider, baseURL, pricing, ...clientOptions } = config;\n\n // Caller pricing wins per model id; otherwise fall back to this\n // provider's published-list defaults so cost truth works out of the box.\n const mergedPricing: Record<string, ModelPricing> = {\n ...MISTRAL_DEFAULT_PRICING,\n ...pricing,\n };\n\n this.openai = new OpenAISDK({\n ...clientOptions,\n baseURL: baseURL ?? MISTRAL_BASE_URL,\n provider: provider ?? MISTRAL_PROVIDER,\n pricing: mergedPricing,\n });\n }\n\n /**\n * Build a `ModelContract` for a Mistral chat model.\n *\n * Delegates to the inner `OpenAISDK.model()` but first injects\n * **Mistral-aware capability inference**: when the caller omits\n * `vision` / `reasoning`, they're inferred from this provider's family\n * fragments (`pixtral` → vision, `magistral` / `mistral-small` →\n * reasoning, see `known-models.ts`) and passed down as explicit\n * overrides. Without this step the wrapped OpenAI adapter would check\n * Mistral ids against OpenAI prefixes (`gpt-4o`, `o3`, …) and wrongly\n * report every Mistral model as non-vision / non-reasoning.\n *\n * A caller-supplied explicit `vision` / `reasoning` is preserved as-is\n * (explicit config always wins over inference). Pricing resolution is\n * handled downstream by `OpenAISDK` against the merged registry:\n * per-model `pricing` > SDK registry (caller + Mistral defaults) >\n * `undefined`.\n */\n public model(config: MistralModelConfig): ModelContract {\n const resolvedConfig: MistralModelConfig = {\n ...config,\n vision: config.vision ?? inferVisionCapability(config.name),\n reasoning: config.reasoning ?? inferReasoningCapability(config.name),\n };\n\n return this.openai.model(resolvedConfig);\n }\n\n /**\n * Rough offline token-count estimate. Delegates to the wrapped\n * `OpenAISDK.count()` (the shared character-heuristic from the core\n * package) — good for budgeting / quota guards, not billing. The\n * optional model id is forwarded but currently ignored.\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` bound to this SDK's client. Mistral\n * serves embeddings (`mistral-embed`) through the OpenAI-compatible\n * `/v1/embeddings` endpoint, so this delegates straight to\n * `OpenAISDK.embedder()`.\n *\n * @example\n * const embedder = mistral.embedder({ name: \"mistral-embed\" });\n * const { vector } = await embedder.embed(\"Hello world\");\n */\n public embedder(config: EmbedderConfig): EmbedderContract {\n // `embedder` is optional on the contract but always present on the\n // wrapped OpenAI adapter — assert it for the delegation.\n return this.openai.embedder!(config);\n }\n}\n"],"mappings":";;;;;AAgBA,MAAM,mBAAmB;;AAGzB,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDzB,IAAa,aAAb,MAAsD;CAQpD,AAAO,YAAY,QAA0B;EAC3C,MAAM,EAAE,UAAU,SAAS,SAAS,GAAG,kBAAkB;EAIzD,MAAM,gBAA8C;GAClD,GAAG;GACH,GAAG;EACL;EAEA,KAAK,SAAS,IAAI,UAAU;GAC1B,GAAG;GACH,SAAS,WAAW;GACpB,UAAU,YAAY;GACtB,SAAS;EACX,CAAC;CACH;;;;;;;;;;;;;;;;;;;CAoBA,AAAO,MAAM,QAA2C;EACtD,MAAM,iBAAqC;GACzC,GAAG;GACH,QAAQ,OAAO,UAAU,sBAAsB,OAAO,IAAI;GAC1D,WAAW,OAAO,aAAa,yBAAyB,OAAO,IAAI;EACrE;EAEA,OAAO,KAAK,OAAO,MAAM,cAAc;CACzC;;;;;;;CAQA,MAAa,MAAM,MAAc,OAAiC;EAChE,OAAO,KAAK,OAAO,MAAM,MAAM,KAAK;CACtC;;;;;;;;;;;CAYA,AAAO,SAAS,QAA0C;EAGxD,OAAO,KAAK,OAAO,SAAU,MAAM;CACrC;AACF"}
package/llms-full.txt ADDED
@@ -0,0 +1,105 @@
1
+ # Warlock AI Mistral — full skills
2
+
3
+ > Package: `@warlock.js/ai-mistral`
4
+
5
+ > Generated artifact. Concatenates every SKILL.md and reference file under `@warlock.js/ai-mistral/skills/`. Re-run `node scripts/generate-llms.mjs` after any change.
6
+
7
+ ## setup-mistral `@warlock.js/ai-mistral/setup-mistral/SKILL.md`
8
+
9
+ ---
10
+ name: setup-mistral
11
+ description: 'Wire @warlock.js/ai-mistral — new MistralSDK({apiKey, baseURL?, provider?, pricing?}) for Mistral AI, a thin wrapper over the OpenAI adapter that uses Mistral''s OpenAI-compatible endpoint (https://api.mistral.ai/v1). .model({name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio?}) for a ModelContract with Mistral-aware capabilities (vision auto-inferred for the pixtral family, reasoning for the magistral family + hybrid mistral-small), .embedder({name, dimensions?}) for mistral-embed via /v1/embeddings. Triggers: `MistralSDK`, `mistral.model`, `mistral.embedder`, `pixtral`, `magistral`, `mistral-large`, `mistral-small`, `mistral-medium`, `ministral`, `mistral-embed`, `api.mistral.ai`, OpenAI-compatible Mistral, `reasoning_effort`, `responseFormat`, `pricing`; "use mistral", "wire mistral into a warlock agent", "configure mistral-large", "use magistral reasoning", "pixtral vision", "mistral embeddings with warlock". Skip: image generation (Mistral has no OpenAI-compatible image endpoint — `mistral.image()` does not exist); the wrapped adapter internals `@warlock.js/ai-openai`; agent wiring `@warlock.js/ai/run-ai-agent/SKILL.md`; embedder usage `@warlock.js/ai/embed-text/SKILL.md`; provider picking `@warlock.js/ai/pick-ai-provider/SKILL.md`; siblings `@warlock.js/ai-google`, `@warlock.js/ai-anthropic`, `@warlock.js/ai-bedrock`, `@warlock.js/ai-ollama`; raw `@mistralai/mistralai`, Vercel `@ai-sdk/mistral`.'
12
+ ---
13
+
14
+ # `@warlock.js/ai-mistral`
15
+
16
+ Provider adapter for Mistral AI. Mistral exposes an **OpenAI-compatible** API, so `MistralSDK` is a **thin wrapper** over [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — it does not re-implement the wire protocol, streaming, tool calls, structured output, error wrapping, or token accounting. It builds one internal `OpenAISDK` pointed at Mistral's `baseURL` with `provider: "mistral"`, then layers on this provider's own capability inference + default pricing. Pair with `@warlock.js/ai` for the agent / tool / system-prompt surface.
17
+
18
+ ## Construction
19
+
20
+ ```ts
21
+ import { MistralSDK } from "@warlock.js/ai-mistral";
22
+
23
+ const mistral = new MistralSDK({ apiKey: process.env.MISTRAL_API_KEY! });
24
+ ```
25
+
26
+ `baseURL` defaults to `https://api.mistral.ai/v1` (the OpenAI-compatible endpoint serving `/chat/completions` and `/embeddings`). `provider` defaults to `"mistral"` and flows through to `ModelContract.provider`, `AgentReport.model.provider`, and logs. Override `baseURL` only to reach a Mistral-compatible gateway/proxy. Every other upstream OpenAI `ClientOptions` value (`timeout`, `maxRetries`, `defaultHeaders`, `fetch`, …) is forwarded verbatim.
27
+
28
+ ## Producing a model
29
+
30
+ ```ts
31
+ mistral.model({ name: "mistral-large-latest" }) // multimodal flagship
32
+ mistral.model({ name: "magistral-medium-latest" }) // reasoning
33
+ mistral.model({ name: "pixtral-large-latest" }) // vision
34
+ mistral.model({ name: "some-fine-tune", vision: true }) // explicit capability override
35
+ ```
36
+
37
+ Returns a `ModelContract` you pass straight into `ai.agent({ model })`.
38
+
39
+ ## Capabilities — what's auto-set
40
+
41
+ The wrapper injects **Mistral-aware** inference before delegating to the OpenAI adapter (the OpenAI prefix lists never match Mistral names):
42
+
43
+ | Flag | Default |
44
+ | --- | --- |
45
+ | `vision` | Inferred from the model name. `true` for the `pixtral` family and the recent multimodal generations (`mistral-large`, `mistral-medium`, `ministral-3`); `false` otherwise. |
46
+ | `reasoning` | Inferred from the model name. `true` for the `magistral` family and the hybrid `mistral-small` generation; `false` otherwise. Drives whether `reasoning_effort` is forwarded. |
47
+ | `structuredOutput` | `true`, unless `responseFormat` is forced to `"json_object"` / `"text"` (loose modes). |
48
+ | `promptCaching` | `true` (inherited from the OpenAI adapter — read-side `cachedTokens` accounting). |
49
+ | `pdf` / `audio` | `false` by default (opt-in `.model({ pdf: true })` / `{ audio: true }`). |
50
+
51
+ **Override any flag explicitly** via `.model({ name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio? })` — an explicit value always wins over inference. The known-family fragments live in `known-models.ts` (`inferVisionCapability`, `inferReasoningCapability`).
52
+
53
+ The headline `-latest` aliases are exported as `MISTRAL_MODELS` ({ chat, vision, reasoning, embedding }) for convenience — `mistral.model()` also accepts any version-pinned id (`mistral-large-2512`, `magistral-medium-2509`).
54
+
55
+ ## Uses the OpenAI-compatible endpoint
56
+
57
+ Because Mistral speaks the OpenAI Chat Completions + Embeddings protocol, everything the OpenAI adapter does applies unchanged: streaming deltas + consolidated tool calls, `response_format: json_schema` structured output (override per model with `responseFormat`), `reasoning_effort` for reasoning models, multipart image input, and the neutral `Usage` breakdown (`input` / `output` / `cachedTokens` / `reasoningTokens`). See [`@warlock.js/ai-openai`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) for the wire-level detail — it is identical here.
58
+
59
+ **No image generation.** Mistral has no OpenAI-compatible image endpoint, so `MistralSDK` intentionally does **not** expose `image()` — the structural absence is the capability guard (`ai.mistral.image(...)` is a compile-time error).
60
+
61
+ ## Embeddings
62
+
63
+ ```ts
64
+ const embedder = mistral.embedder({ name: "mistral-embed" });
65
+
66
+ const { vector, dimensions, usage } = await embedder.embed("Hello world");
67
+ const { vectors } = await embedder.embedMany(["doc 1", "doc 2"]);
68
+ ```
69
+
70
+ `mistral-embed` is reachable through the OpenAI-compatible `/v1/embeddings`; the embedder delegates to the wrapped OpenAI embedder.
71
+
72
+ ## Pricing — per-model registry
73
+
74
+ The adapter ships a conservative default registry (`MISTRAL_DEFAULT_PRICING`, USD per 1,000,000 tokens) so cost truth works out of the box. Pass your own `pricing` to win per model id:
75
+
76
+ ```ts
77
+ const mistral = new MistralSDK({
78
+ apiKey,
79
+ pricing: {
80
+ // USD per 1M tokens — billing-grade overrides.
81
+ "mistral-large-latest": { input: 2, output: 6 },
82
+ "magistral-medium-latest": { input: 2, output: 5 },
83
+ },
84
+ });
85
+ ```
86
+
87
+ Resolution at `model()` time: per-model `pricing` (`mistral.model({ name, pricing })`) > SDK-level `pricing` > `MISTRAL_DEFAULT_PRICING` > `undefined`. The defaults are list-price approximations — pass explicit rates for billing.
88
+
89
+ ## Errors
90
+
91
+ Raw errors are wrapped into the typed `@warlock.js/ai` `AIError` hierarchy by the wrapped OpenAI adapter (dispatch keys on `APIError.status + code`) — see [`@warlock.js/ai/handle-ai-errors/SKILL.md`](@warlock.js/ai/handle-ai-errors/SKILL.md).
92
+
93
+ ## When NOT to use this skill
94
+
95
+ - Image generation — Mistral has no OpenAI-compatible image endpoint; `mistral.image()` does not exist.
96
+ - Other providers — OpenAI `@warlock.js/ai-openai`, Gemini `@warlock.js/ai-google`, Anthropic `@warlock.js/ai-anthropic`, Bedrock `@warlock.js/ai-bedrock`, Ollama `@warlock.js/ai-ollama`.
97
+ - Raw `@mistralai/mistralai` SDK or Vercel `@ai-sdk/mistral` without going through `@warlock.js/ai` agents.
98
+
99
+ ## See also
100
+
101
+ - [`@warlock.js/ai-openai/skills/setup-openai/SKILL.md`](@warlock.js/ai-openai/skills/setup-openai/SKILL.md) — the wrapped adapter; identical wire behavior.
102
+ - [`@warlock.js/ai/run-ai-agent/SKILL.md`](@warlock.js/ai/run-ai-agent/SKILL.md) — passing the model into `ai.agent({...})`.
103
+ - [`@warlock.js/ai/pick-ai-provider/SKILL.md`](@warlock.js/ai/pick-ai-provider/SKILL.md) — adapter comparison.
104
+
105
+
package/llms.txt ADDED
@@ -0,0 +1,9 @@
1
+ # Warlock AI Mistral
2
+
3
+ > Package: `@warlock.js/ai-mistral`
4
+
5
+ > Mistral AI adapter for @warlock.js/ai (OpenAI-compatible)
6
+
7
+ ## Skills
8
+
9
+ - [setup-mistral](@warlock.js/ai-mistral/setup-mistral/SKILL.md): Wire @warlock.js/ai-mistral — new MistralSDK({apiKey, baseURL?, provider?, pricing?}) for Mistral AI, a thin wrapper over the OpenAI adapter that uses Mistral's OpenAI-compatible endpoint (https://api.mistral.ai/v1). .model({name, vision?, reasoning?, structuredOutput?, responseFormat?, pdf?, audio?}) for a ModelContract with Mistral-aware capabilities (vision auto-inferred for the pixtral family, reasoning for the magistral family + hybrid mistral-small), .embedder({name, dimensions?}) for mistral-embed via /v1/embeddings. Triggers: `MistralSDK`, `mistral.model`, `mistral.embedder`, `pixtral`, `magistral`, `mistral-large`, `mistral-small`, `mistral-medium`, `ministral`, `mistral-embed`, `api.mistral.ai`, OpenAI-compatible Mistral, `reasoning_effort`, `responseFormat`, `pricing`; "use mistral", "wire mistral into a warlock agent", "configure mistral-large", "use magistral reasoning", "pixtral vision", "mistral embeddings with warlock". Skip: image generation (Mistral has no OpenAI-compatible image endpoint — `mistral.image()` does not exist); the wrapped adapter internals `@warlock.js/ai-openai`; agent wiring `@warlock.js/ai/run-ai-agent/SKILL.md`; embedder usage `@warlock.js/ai/embed-text/SKILL.md`; provider picking `@warlock.js/ai/pick-ai-provider/SKILL.md`; siblings `@warlock.js/ai-google`, `@warlock.js/ai-anthropic`, `@warlock.js/ai-bedrock`, `@warlock.js/ai-ollama`; raw `@mistralai/mistralai`, Vercel `@ai-sdk/mistral`.
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@warlock.js/ai-mistral",
3
+ "description": "Mistral AI adapter for @warlock.js/ai (OpenAI-compatible)",
4
+ "keywords": [
5
+ "warlock",
6
+ "ai",
7
+ "mistral",
8
+ "pixtral",
9
+ "magistral"
10
+ ],
11
+ "author": "Hasan Zohdy",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/warlockjs/ai-mistral"
16
+ },
17
+ "dependencies": {
18
+ "@warlock.js/ai-openai": "4.6.0",
19
+ "@warlock.js/logger": "4.6.0"
20
+ },
21
+ "peerDependencies": {
22
+ "@warlock.js/ai": "4.6.0"
23
+ },
24
+ "version": "4.6.0",
25
+ "main": "./cjs/index.cjs",
26
+ "module": "./esm/index.mjs",
27
+ "types": "./esm/index.d.mts",
28
+ "exports": {
29
+ ".": {
30
+ "import": {
31
+ "types": "./esm/index.d.mts",
32
+ "default": "./esm/index.mjs"
33
+ },
34
+ "require": {
35
+ "types": "./esm/index.d.mts",
36
+ "default": "./cjs/index.cjs"
37
+ }
38
+ }
39
+ }
40
+ }