@plurnk/plurnk-providers 0.5.1 → 0.8.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/README.md +1 -0
- package/SPEC.md +5 -4
- package/dist/OpenAICompat.d.ts +2 -1
- package/dist/OpenAICompat.d.ts.map +1 -1
- package/dist/OpenAICompat.js +52 -14
- package/dist/OpenAICompat.js.map +1 -1
- package/dist/standardProviders.d.ts.map +1 -1
- package/dist/standardProviders.js +45 -2
- package/dist/standardProviders.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ Framework + contract for `@plurnk/plurnk-providers-*` sibling packages (LLM tran
|
|
|
5
5
|
## Documentation
|
|
6
6
|
|
|
7
7
|
- [`SPEC.md`](./SPEC.md) — author-facing contract for sibling implementers.
|
|
8
|
+
- [`.env.example`](./.env.example) — the authoritative operator config reference: every env knob the provider layer reads (all required, fail-hard, no defaults).
|
|
8
9
|
- Constellation: [plurnk-grammar](https://github.com/plurnk/plurnk-grammar) (HEREDOC + AST), [plurnk-mimetypes](https://github.com/plurnk/plurnk-mimetypes), [plurnk-schemes](https://github.com/plurnk/plurnk-schemes), [plurnk-execs](https://github.com/plurnk/plurnk-execs) (the reference family this one mirrors).
|
|
9
10
|
|
|
10
11
|
## Write a provider
|
package/SPEC.md
CHANGED
|
@@ -107,7 +107,8 @@ Each provider's `fromEnv` reads these:
|
|
|
107
107
|
- **`PLURNK_PROVIDERS_REASONING_BUDGET`** — REQUIRED integer `>= -1`. One knob carries the whole side-channel-reasoning space: **`0`** off, **`-1`** on/adaptive (no cap — model/backend decides depth), **`N>0`** on/capped at `N`. The provider maps this single intent to the active backend's mechanism — llama-server `chat_template_kwargs: { enable_thinking }` (always emitted; the explicit FALSE is the only working off-switch — llama-server ignores `think` and per-request budgets, and its `--reasoning-budget` default otherwise keeps the channel live, fatal under an active grammar, §13), Ollama `think`, relay `include_reasoning`, cloud `reasoning_effort` (tier from `N`; adaptive `-1` omits the field, letting the API pick its depth), Anthropic `thinking: { type: "adaptive" }` (`-1`) / `budget_tokens` (`N`). For native backends the magnitude is irrelevant — only zero vs non-zero matters. Consumers state intent, never mechanism. (There is deliberately **no** knob for in-DSL `<<PLAN>>` reasoning — PLAN is forced by the grammar itself, the `plurnk-plan.gbnf` variant whose root opens with `<<PLAN:`, plus a consumer prompt line; it has no provider footprint. The former `PLURNK_PLAN` assistant-prefill was removed in 0.4.0 — it broke under grammar-constrained generation, stacking malformed plans, since the prefill is prompt text the grammar never sees. Plan-forcing now lives entirely in the grammar (`plurnk-plan.gbnf`) and the service prompt, #16.)
|
|
108
108
|
|
|
109
109
|
Read via `reasoningBudgetFromEnv` and **fail hard when unset** — configuration lives in the operator's env (the consumer's `.env.example` declares every var); the framework never defaults a knob in code.
|
|
110
|
-
- **`PLURNK_FETCH_TIMEOUT`** — service-wide ms ceiling on any single outbound request. Each `fromEnv` reads and passes as `AbortSignal.timeout`. Per-provider override envs are NOT part of the contract.
|
|
110
|
+
- **`PLURNK_FETCH_TIMEOUT`** — service-wide ms ceiling on any single outbound request (**per attempt**, not shared across retries). Each `fromEnv` reads and passes as `AbortSignal.timeout`. Per-provider override envs are NOT part of the contract.
|
|
111
|
+
- **`PLURNK_PROVIDER_RETRY_ATTEMPTS`** — REQUIRED non-negative integer (read via `parseRequiredInt`). The transient-failure retry budget: **`0`** surfaces the first failure; **`N`** retries up to `N` times on a *transient* classification only (`rate_limit` / `network_failure` — 429, 5xx, timeout, connection reset). Terminal kinds (`unauthorized`, `quota_exceeded`, `invalid_response`, `model_refused`) are never retried. Backoff is exponential from a `2000ms` base (`base * 2^(attempt-1)`), unless the server sent a `Retry-After` (which wins). The caller's `signal` aborts both the in-flight request and the backoff sleep. Lives in the shared `OpenAICompatProvider` so every provider inherits it uniformly; rides on the existing `classifyProviderError` (#18).
|
|
111
112
|
- **`PLURNK_PROVIDER_CONTEXT_SIZE`** — optional positive-integer override for the model's reported context window. Resolution: this env var → provider probe/config/table → `null`.
|
|
112
113
|
|
|
113
114
|
## §5 Alias cascade resolution
|
|
@@ -133,12 +134,12 @@ This package's exported resolution surface:
|
|
|
133
134
|
|
|
134
135
|
**Two-tier provider resolution — owned entirely by this package.** A provider name resolves in this order:
|
|
135
136
|
|
|
136
|
-
1. **Standard provider** (`§11`) — if `isStandardProvider(name)`, instantiated directly via `standardProviderFromEnv(name, env, model)`. No package is imported. Covers every plain OpenAI-compatible endpoint (`openai`, `groq`, `deepseek`, `mistral`, `together`, `fireworks`, `deepinfra`, …). The standard table is **authoritative**: a scanned package whose name duplicates a standard one is shadowed (tier 1 returns first).
|
|
137
|
-
2. **Discovered package** — otherwise, a **scope-agnostic `node_modules` scan** (`discover()`) maps the provider name to the installed package that declares `plurnk: { kind: "provider", name }`, which is dynamic-imported and `fromEnv(env, model)`-called. Covers first-party daughters with real runtime surface (`openrouter`, `ollama`, `google`, `xai`, `cloudflare`, the planned `
|
|
137
|
+
1. **Standard provider** (`§11`) — if `isStandardProvider(name)`, instantiated directly via `standardProviderFromEnv(name, env, model)`. No package is imported. Covers every plain OpenAI-compatible endpoint (`openai`, `groq`, `deepseek`, `mistral`, `together`, `fireworks`, `deepinfra`, `anthropic`, `bedrock`, …) — including first-party Claude (Anthropic's compat endpoint, bearer auth, the `thinking` reasoning param) and AWS Bedrock (its compat endpoint, Bedrock-API-key bearer, region-templated `BEDROCK_BASE_URL`); neither needs a daughter. The standard table is **authoritative**: a scanned package whose name duplicates a standard one is shadowed (tier 1 returns first).
|
|
138
|
+
2. **Discovered package** — otherwise, a **scope-agnostic `node_modules` scan** (`discover()`) maps the provider name to the installed package that declares `plurnk: { kind: "provider", name }`, which is dynamic-imported and `fromEnv(env, model)`-called. Covers first-party daughters with real runtime surface (`openrouter`, `ollama`, `google`, `xai`, `cloudflare`, the planned `vertex`/`cohere`) **and any third-party provider published under its own scope** (`@acme/llm-provider-foo`) — no involvement from us, no `@plurnk` scope assumption. Two installed packages claiming the same name → fail-hard naming both. Unknown name → fail-hard. The scan runs once per process and is memoized.
|
|
138
139
|
|
|
139
140
|
Discovery honors the host **trust gate** `PLURNK_PLUGINS_TRUSTED_ONLY` — the same env var the execs/mimes/schemes families read (plurnk-service#229, #15). OFF (unset/empty/`0`) trusts every installed provider; ON (any value) trusts `@plurnk/*` plus a comma-separated allowlist and declines the rest. A declined package is recorded in `skipped` (never registered, never thrown), so requesting its name yields a precise *untrusted* error rather than *unknown*.
|
|
140
141
|
|
|
141
|
-
The framework is **contract-only** — it does **not** depend on its daughters. First-party daughters install flat via the [`@plurnk/plurnk-providers-all`](https://github.com/plurnk/plurnk-providers-all) aggregator (a code-free package depping the five daughters directly), so npm hoists them to the top of `node_modules` where the scan finds them; a consumer installs `@plurnk/plurnk-providers` + `@plurnk/plurnk-providers-all`. Each daughter declares the framework as a `peerDependency` (
|
|
142
|
+
The framework is **contract-only** — it does **not** depend on its daughters. First-party daughters install flat via the [`@plurnk/plurnk-providers-all`](https://github.com/plurnk/plurnk-providers-all) aggregator (a code-free package depping the five daughters directly), so npm hoists them to the top of `node_modules` where the scan finds them; a consumer installs `@plurnk/plurnk-providers` + `@plurnk/plurnk-providers-all`. Each daughter declares the framework as a `peerDependency` with a deliberately wide range (`>=0.7.0 <1.0.0`) so one shared copy lives in the tree (class identity for `instanceof ProviderError` included) **without** a framework minor forcing a daughter republish — the next forced bump is `1.0.0`. This mirrors `@plurnk/plurnk-execs` + `@plurnk/plurnk-execs-all`, which proved that framework-aggregates-daughters (execs `0.4.2`) nests the daughters and breaks the scan — reverted at `0.4.3` to exactly this flat-aggregator shape (#12/#14).
|
|
142
143
|
|
|
143
144
|
## §6 Engine → provider guarantees (consumer side)
|
|
144
145
|
|
package/dist/OpenAICompat.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChatMessage, Provider, ProviderResponse, ProviderUsage } from "./types.ts";
|
|
2
|
-
export type ReasoningStyle = "none" | "think" | "include_reasoning" | "effort" | "template";
|
|
2
|
+
export type ReasoningStyle = "none" | "think" | "include_reasoning" | "effort" | "template" | "anthropic";
|
|
3
3
|
export type OpenAICompatConfig = {
|
|
4
4
|
model: string;
|
|
5
5
|
url: string;
|
|
@@ -14,6 +14,7 @@ export type OpenAICompatConfig = {
|
|
|
14
14
|
supportsSlotPinning?: boolean;
|
|
15
15
|
slotCount?: number | null;
|
|
16
16
|
reasoningBudget: number;
|
|
17
|
+
retryAttempts: number;
|
|
17
18
|
};
|
|
18
19
|
export declare const effortFromBudget: (budget: number) => "low" | "medium" | "high";
|
|
19
20
|
export default class OpenAICompatProvider implements Provider {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAICompat.d.ts","sourceRoot":"","sources":["../src/OpenAICompat.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAgB,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"OpenAICompat.d.ts","sourceRoot":"","sources":["../src/OpenAICompat.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAgB,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAoBvG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,mBAAmB,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAE1G,MAAM,MAAM,kBAAkB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAK1B,eAAe,EAAE,MAAM,CAAC;IAIxB,aAAa,EAAE,MAAM,CAAC;CACzB,CAAC;AAqCF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,KAAK,GAAG,QAAQ,GAAG,MAIpE,CAAC;AAIF,MAAM,CAAC,OAAO,OAAO,oBAAqB,YAAW,QAAQ;;gBAgB7C,MAAM,EAAE,kBAAkB;IAiBtC,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAA8B;IAC9D,IAAI,KAAK,IAAI,MAAM,CAAwB;IAE3C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IACjC,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM;IAuD/B,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE;QAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAiDrM"}
|
package/dist/OpenAICompat.js
CHANGED
|
@@ -7,15 +7,35 @@
|
|
|
7
7
|
// A sibling's fromEnv probes whatever it needs (catalog, pricing, context
|
|
8
8
|
// window), builds the config, and returns `new OpenAICompatProvider(config)`.
|
|
9
9
|
// Pure-config providers come from ./standardProviders.ts with no sibling at all.
|
|
10
|
-
import { chatCompletionStream } from "./openaiStream.js";
|
|
10
|
+
import { chatCompletionStream, OpenAiHttpError } from "./openaiStream.js";
|
|
11
11
|
import { normalizeUsage } from "./usage.js";
|
|
12
|
-
import { toProviderError } from "./telemetry.js";
|
|
12
|
+
import { toProviderError, classifyProviderError } from "./telemetry.js";
|
|
13
13
|
// Sampling guard under an active grammar (SPEC §13): greedy decoding under
|
|
14
14
|
// hard constraint masks degenerates into repetition loops at the server
|
|
15
15
|
// default of 1.0, so the floor rides per-request with every attached grammar —
|
|
16
16
|
// never rely on server launch flags. Probed on llama.cpp b894 + gemma-4-26B
|
|
17
17
|
// (plurnk-providers#9; reference: plurnk-grammar test/llama/gbnf-live.test.ts).
|
|
18
18
|
const GRAMMAR_REPEAT_PENALTY_FLOOR = 1.15;
|
|
19
|
+
// Exponential-backoff base for transient-failure retries (#18). Attempt N waits
|
|
20
|
+
// RETRY_BASE_DELAY_MS * 2^(N-1), unless the server sent a Retry-After (which
|
|
21
|
+
// wins). The magnitude is mechanism, not operator intent — the COUNT is the
|
|
22
|
+
// knob (PLURNK_PROVIDER_RETRY_ATTEMPTS); the base stays a constant.
|
|
23
|
+
const RETRY_BASE_DELAY_MS = 2000;
|
|
24
|
+
// Only these two classifications are transient and worth retrying: rate_limit
|
|
25
|
+
// (429) and network_failure (5xx, timeout, connection reset). unauthorized,
|
|
26
|
+
// quota_exceeded, invalid_response, model_refused are terminal — retrying just
|
|
27
|
+
// burns time and budget.
|
|
28
|
+
const RETRYABLE = new Set(["rate_limit", "network_failure"]);
|
|
29
|
+
// Sleep that rejects the moment `signal` aborts (caller cancellation must not
|
|
30
|
+
// wait out a backoff). Resolves normally on timeout.
|
|
31
|
+
const sleepWithAbort = (ms, signal) => new Promise((resolve, reject) => {
|
|
32
|
+
if (signal?.aborted) {
|
|
33
|
+
reject(signal.reason);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const timer = setTimeout(resolve, ms);
|
|
37
|
+
signal?.addEventListener("abort", () => { clearTimeout(timer); reject(signal.reason); }, { once: true });
|
|
38
|
+
});
|
|
19
39
|
// SPEC §2 closed set. Wire values outside it (provider-specific or absent)
|
|
20
40
|
// collapse to null — the consumer treats null as "no signal".
|
|
21
41
|
const FINISH_REASONS = new Set(["stop", "length", "tool_calls", "content_filter"]);
|
|
@@ -43,6 +63,7 @@ export default class OpenAICompatProvider {
|
|
|
43
63
|
#supportsGrammar;
|
|
44
64
|
#supportsSlotPinning;
|
|
45
65
|
#slotCount;
|
|
66
|
+
#retryAttempts;
|
|
46
67
|
constructor(config) {
|
|
47
68
|
this.#model = config.model;
|
|
48
69
|
this.#url = config.url;
|
|
@@ -50,6 +71,7 @@ export default class OpenAICompatProvider {
|
|
|
50
71
|
this.#headers = config.headers ?? {};
|
|
51
72
|
this.#contextSize = config.contextSize ?? null;
|
|
52
73
|
this.#reasoningBudget = config.reasoningBudget;
|
|
74
|
+
this.#retryAttempts = config.retryAttempts;
|
|
53
75
|
this.#reasoningStyle = config.reasoningStyle ?? "none";
|
|
54
76
|
this.#countTokens = config.countTokens ?? heuristicTokens;
|
|
55
77
|
this.#costFor = config.costFor ?? (() => 0);
|
|
@@ -75,6 +97,11 @@ export default class OpenAICompatProvider {
|
|
|
75
97
|
// effort tiers from a capped budget; adaptive (-1) omits the field
|
|
76
98
|
// (lets the API pick its default depth); off (0) omits.
|
|
77
99
|
case "effort": return b > 0 ? { reasoning_effort: effortFromBudget(b) } : {};
|
|
100
|
+
// Anthropic compat: explicit thinking object. 0 → disabled; N>0 →
|
|
101
|
+
// enabled with budget_tokens; -1 adaptive → omit (the API default).
|
|
102
|
+
case "anthropic": return b === 0
|
|
103
|
+
? { thinking: { type: "disabled" } }
|
|
104
|
+
: b > 0 ? { thinking: { type: "enabled", budget_tokens: b } } : {};
|
|
78
105
|
case "none": return {};
|
|
79
106
|
}
|
|
80
107
|
}
|
|
@@ -115,8 +142,6 @@ export default class OpenAICompatProvider {
|
|
|
115
142
|
throw new Error("generate: runId is required — the run's stable, opaque identity");
|
|
116
143
|
// Reject before any wire call when already aborted (SPEC §10.8).
|
|
117
144
|
signal?.throwIfAborted();
|
|
118
|
-
const timeoutSignal = AbortSignal.timeout(this.#fetchTimeoutMs);
|
|
119
|
-
const effectiveSignal = signal !== undefined ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
|
|
120
145
|
const body = {
|
|
121
146
|
model: this.#model,
|
|
122
147
|
messages,
|
|
@@ -125,17 +150,30 @@ export default class OpenAICompatProvider {
|
|
|
125
150
|
...(maxTokens !== undefined ? { max_tokens: maxTokens } : {}),
|
|
126
151
|
...this.#slotBody(runId),
|
|
127
152
|
};
|
|
153
|
+
// Transient-failure retry (#18). Each attempt gets a FRESH fetch timeout
|
|
154
|
+
// (the budget is per-request, not shared across retries); the caller's
|
|
155
|
+
// signal spans them all. Retry only the transient classifications, prefer
|
|
156
|
+
// a server Retry-After over the backoff, and let the caller's abort cut
|
|
157
|
+
// through both the in-flight request and the backoff sleep.
|
|
128
158
|
let raw;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
159
|
+
for (let attempt = 0;; attempt++) {
|
|
160
|
+
const timeoutSignal = AbortSignal.timeout(this.#fetchTimeoutMs);
|
|
161
|
+
const effectiveSignal = signal !== undefined ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
|
|
162
|
+
try {
|
|
163
|
+
raw = await chatCompletionStream({ url: this.#url, headers: this.#headers, body, signal: effectiveSignal });
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
// Caller-initiated abort is cancellation — never retried or wrapped.
|
|
168
|
+
if (signal?.aborted)
|
|
169
|
+
throw err;
|
|
170
|
+
const { kind } = classifyProviderError(err);
|
|
171
|
+
// Terminal kind, or budget spent → surface the classified failure.
|
|
172
|
+
if (!RETRYABLE.has(kind) || attempt >= this.#retryAttempts)
|
|
173
|
+
throw toProviderError(err, this.#source);
|
|
174
|
+
const retryAfter = err instanceof OpenAiHttpError ? err.retryAfter : null;
|
|
175
|
+
await sleepWithAbort(retryAfter ?? RETRY_BASE_DELAY_MS * 2 ** attempt, signal);
|
|
176
|
+
}
|
|
139
177
|
}
|
|
140
178
|
return {
|
|
141
179
|
assistant: {
|
package/dist/OpenAICompat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAICompat.js","sourceRoot":"","sources":["../src/OpenAICompat.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,oEAAoE;AACpE,wEAAwE;AACxE,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,8EAA8E;AAC9E,iFAAiF;AAGjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"OpenAICompat.js","sourceRoot":"","sources":["../src/OpenAICompat.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,oEAAoE;AACpE,wEAAwE;AACxE,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,8EAA8E;AAC9E,iFAAiF;AAGjF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AA4CxE,2EAA2E;AAC3E,wEAAwE;AACxE,+EAA+E;AAC/E,4EAA4E;AAC5E,gFAAgF;AAChF,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAE1C,gFAAgF;AAChF,6EAA6E;AAC7E,4EAA4E;AAC5E,oEAAoE;AACpE,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,8EAA8E;AAC9E,4EAA4E;AAC5E,+EAA+E;AAC/E,yBAAyB;AACzB,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,iBAAiB,CAAC,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AK,IAAI,IAAI,CAAC,MAAM;aAClC;YACD,YAAY,EAAE,GAAG;SACpB,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standardProviders.d.ts","sourceRoot":"","sources":["../src/standardProviders.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"standardProviders.d.ts","sourceRoot":"","sources":["../src/standardProviders.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAC1D,OAA6B,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAsC,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAK3F,KAAK,oBAAoB,GAAG;IAGxB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IAGxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,EAAE,MAAM,CAAC;IAIjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,eAAe,CAAC;IAClC,eAAe,EAAE,MAAM,CAAC;IAOxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CA8D5E,CAAC;AAEH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,OAAqC,CAAC;AAwDxF,eAAO,MAAM,uBAAuB,GAAU,MAAM,MAAM,EAAE,KAAK,MAAM,CAAC,UAAU,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAmE1H,CAAC"}
|
|
@@ -5,12 +5,15 @@
|
|
|
5
5
|
// sibling package; the framework instantiates them directly.
|
|
6
6
|
//
|
|
7
7
|
// Two-tier resolution (SPEC §5): the consumer tries standardProviderFromEnv
|
|
8
|
-
// first, then falls back to
|
|
9
|
-
//
|
|
8
|
+
// first, then falls back to the discover() node_modules scan for the bespoke
|
|
9
|
+
// ones (openrouter, ollama, google, xai, cloudflare, third-party). The scan
|
|
10
|
+
// resolves the package specifier — it is NOT a hardcoded @plurnk/ pattern.
|
|
10
11
|
import OpenAICompatProvider from "./OpenAICompat.js";
|
|
11
12
|
import { parseRequiredInt, parseOptionalInt, requireEnv, reasoningBudgetFromEnv } from "./env.js";
|
|
12
13
|
import { parseTokenizerFamily, tokenizerFor } from "./tokenizers.js";
|
|
13
14
|
import { providerSource } from "./telemetry.js";
|
|
15
|
+
import { computeCost } from "./usage.js";
|
|
16
|
+
import { lookup } from "@plurnk/plurnk-models";
|
|
14
17
|
// Frozen so a downstream can't mutate the shared table.
|
|
15
18
|
export const STANDARD_PROVIDERS = Object.freeze({
|
|
16
19
|
// Generic OpenAI-compatible endpoint (OpenAI proper, llama-server, vLLM,
|
|
@@ -52,6 +55,28 @@ export const STANDARD_PROVIDERS = Object.freeze({
|
|
|
52
55
|
baseUrl: "https://api.deepinfra.com/v1/openai", baseUrlVar: "DEEPINFRA_BASE_URL", chatPath: "/chat/completions",
|
|
53
56
|
reasoningStyle: "none", tokenizerDefault: "heuristic", tokenizerEnvVar: "DEEPINFRA_TOKENIZER",
|
|
54
57
|
},
|
|
58
|
+
// First-party Claude via Anthropic's OpenAI-compat endpoint: bearer auth,
|
|
59
|
+
// OpenAI SSE, the `thinking` reasoning param (reasoning_effort is ignored).
|
|
60
|
+
// No probe — context/cost come from the @plurnk/plurnk-models catalog.
|
|
61
|
+
anthropic: {
|
|
62
|
+
apiKeyVar: "ANTHROPIC_API_KEY", apiKeyRequired: true,
|
|
63
|
+
baseUrl: "https://api.anthropic.com/v1", baseUrlVar: "ANTHROPIC_BASE_URL", chatPath: "/chat/completions",
|
|
64
|
+
reasoningStyle: "anthropic", tokenizerDefault: "heuristic", tokenizerEnvVar: "ANTHROPIC_TOKENIZER",
|
|
65
|
+
},
|
|
66
|
+
// AWS Bedrock via its OpenAI-compat chat-completions endpoint, authed with a
|
|
67
|
+
// Bedrock API key as a bearer token (SigV4 is optional, not required). The
|
|
68
|
+
// base URL is region-templated, so the operator MUST set BEDROCK_BASE_URL
|
|
69
|
+
// (e.g. https://bedrock-runtime.us-east-1.amazonaws.com/v1). Multi-model
|
|
70
|
+
// relay (Claude, gpt-oss, Llama, …) → no single reasoning toggle. Model ids
|
|
71
|
+
// are inference profiles like `us.anthropic.claude-sonnet-4-6`, which the
|
|
72
|
+
// models.dev catalog does NOT key on — so bedrock has no catalog
|
|
73
|
+
// context/cost; set PLURNK_PROVIDER_CONTEXT_SIZE for a context window (a
|
|
74
|
+
// catalog inference-profile mapping is a deliberate follow-on, #19).
|
|
75
|
+
bedrock: {
|
|
76
|
+
apiKeyVar: "AWS_BEARER_TOKEN_BEDROCK", apiKeyRequired: true,
|
|
77
|
+
baseUrlVar: "BEDROCK_BASE_URL", chatPath: "/chat/completions",
|
|
78
|
+
reasoningStyle: "none", tokenizerDefault: "heuristic", tokenizerEnvVar: "BEDROCK_TOKENIZER",
|
|
79
|
+
},
|
|
55
80
|
});
|
|
56
81
|
export const isStandardProvider = (name) => name in STANDARD_PROVIDERS;
|
|
57
82
|
const resolveUrl = (spec, env, label) => {
|
|
@@ -133,6 +158,22 @@ export const standardProviderFromEnv = async (name, env, model) => {
|
|
|
133
158
|
if (probe.llamaServer)
|
|
134
159
|
slotCount = await probeSlotCount(url, headers, fetchTimeoutMs);
|
|
135
160
|
}
|
|
161
|
+
// Vendored-snapshot FALLBACK (#19) — live always wins. contextSize already
|
|
162
|
+
// preferred env then the live probe; the catalog only fills a still-null
|
|
163
|
+
// window for a known cloud model (groq/deepseek/mistral/…, which don't
|
|
164
|
+
// probe). A local llama-server model misses the catalog and keeps its
|
|
165
|
+
// probed n_ctx. Standard providers carry NO live pricing, so the catalog is
|
|
166
|
+
// the sole — never shadowing — cost source; per-1M USD → pico-USD/token (×1e6).
|
|
167
|
+
const fallback = lookup(name, model);
|
|
168
|
+
contextSize ??= fallback?.contextWindow ?? null;
|
|
169
|
+
const cost = fallback?.cost;
|
|
170
|
+
const costFor = cost === undefined
|
|
171
|
+
? undefined
|
|
172
|
+
: (usage) => computeCost(usage, {
|
|
173
|
+
input: cost.inputPer1M * 1e6,
|
|
174
|
+
output: cost.outputPer1M * 1e6,
|
|
175
|
+
cached: (cost.cacheReadPer1M ?? cost.inputPer1M) * 1e6,
|
|
176
|
+
});
|
|
136
177
|
return new OpenAICompatProvider({
|
|
137
178
|
model,
|
|
138
179
|
url,
|
|
@@ -140,8 +181,10 @@ export const standardProviderFromEnv = async (name, env, model) => {
|
|
|
140
181
|
contextSize,
|
|
141
182
|
fetchTimeoutMs,
|
|
142
183
|
reasoningBudget: reasoningBudgetFromEnv(env, name),
|
|
184
|
+
retryAttempts: parseRequiredInt(env.PLURNK_PROVIDER_RETRY_ATTEMPTS, "PLURNK_PROVIDER_RETRY_ATTEMPTS", name),
|
|
143
185
|
reasoningStyle,
|
|
144
186
|
countTokens: tokenizerFor(family),
|
|
187
|
+
costFor,
|
|
145
188
|
source: providerSource(name),
|
|
146
189
|
supportsGrammar,
|
|
147
190
|
// The same fingerprint backs both llama-server dialect extensions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standardProviders.js","sourceRoot":"","sources":["../src/standardProviders.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,6DAA6D;AAC7D,EAAE;AACF,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"standardProviders.js","sourceRoot":"","sources":["../src/standardProviders.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,6DAA6D;AAC7D,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EA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WAAW,KAAK,QAAQ,EAAE,aAAa,IAAI,IAAI,CAAC;IAChD,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAI,KAAK,SAAS;QAC9B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,CAAC,KAAoB,EAAU,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE;YACnD,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG;YAC5B,MAAM,EAAE,IAAI,CAAC,WAAW,GAAG,GAAG;YAC9B,MAAM,EAAE,CAAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG;SACzD,CAAC,CAAC;IAEP,OAAO,IAAI,oBAAoB,CAAC;QAC5B,KAAK;QACL,GAAG;QACH,OAAO;QACP,WAAW;QACX,cAAc;QACd,eAAe,EAAE,sBAAsB,CAAC,GAAG,EAAE,IAAI,CAAC;QAClD,aAAa,EAAE,gBAAgB,CAAC,GAAG,CAAC,8BAA8B,EAAE,gCAAgC,EAAE,IAAI,CAAC;QAC3G,cAAc;QACd,WAAW,EAAE,YAAY,CAAC,MAAM,CAAC;QACjC,OAAO;QACP,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC;QAC5B,eAAe;QACf,mEAAmE;QACnE,mBAAmB,EAAE,eAAe;QACpC,SAAS;KACZ,CAAC,CAAC;AACP,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plurnk/plurnk-providers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Framework + contract for the @plurnk/plurnk-providers-* LLM transport family.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"plurnk",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"typescript": "^6.0.3"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"@plurnk/plurnk-models": "0.1.0",
|
|
53
54
|
"gpt-tokenizer": "^3.4.0",
|
|
54
55
|
"llama-tokenizer-js": "^1.2.2"
|
|
55
56
|
}
|