@hilbras/omnihilbras 1.41.0 → 1.43.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.
@@ -35,7 +35,7 @@ export const CLINE_OAUTH = {
35
35
  };
36
36
  const defaultRefreshSkewMs = 60_000;
37
37
  /** Reported to Cline as this client's version. */
38
- const omnihilbrasVersion = '1.41.0';
38
+ const omnihilbrasVersion = '1.43.0';
39
39
  /** Cline only accepts WorkOS JWTs with an explicit prefix. */
40
40
  export function toClineAccessToken(token) {
41
41
  const trimmed = token.trim();
@@ -0,0 +1,124 @@
1
+ import type { ChatRequest } from '../types.js';
2
+ /**
3
+ * OpenCode Zen's free-tier request contract.
4
+ *
5
+ * ## Why this exists, and why it was not written sooner
6
+ *
7
+ * Every free model on an `opencode` connection was refused:
8
+ *
9
+ * ```
10
+ * mimo-v2.6-flash-free 403 {"type":"FreeTierError","message":"OpenCode's free tier can only be used from within OpenCode"}
11
+ * big-pickle 403 (identical)
12
+ * nemotron-3.5-…-free 403 (identical)
13
+ * ```
14
+ *
15
+ * The message names the OpenCode client, so the obvious reading was that the free tier wanted the
16
+ * **CLI's own credential** — a 356-char account session token rather than the Zen API key this
17
+ * adapter holds. That reading was wrong, and it was wrong because it was inferred from one refusal
18
+ * instead of measured. `/home/gin/work/OmniRoute` implements the same models through the same base
19
+ * URL with `authType: "apikey"`, and `open-sse/executors/opencodeFreeTierContract.ts` records the
20
+ * contract it measured against the live endpoint: the gate is the **request**, not the credential.
21
+ *
22
+ * ## The four conditions
23
+ *
24
+ * 1. `stream: true` in the body.
25
+ * 2. a non-empty `tools` array — the upstream does not inspect its contents, only that it is there
26
+ * and non-empty. The official client's placeholder name is `_noop`.
27
+ * 3. an `x-opencode-session` header shaped `ses_` + 12 hex + 14 base62. **The shape is checked and the
28
+ * value is not**, so a random id satisfies it; no attempt is made to reproduce the client's
29
+ * algorithm.
30
+ * 4. a `User-Agent` carrying `opencode/<version>` with version >= 1.17.
31
+ *
32
+ * ## What is *not* claimed here
33
+ *
34
+ * The four conditions are necessary. Measured from this machine, applying all four **still** answers
35
+ * 403 — so something beyond the request also decides, and OmniRoute's own comments name the likely
36
+ * candidate twice: the CLI identity headers exist because "Cloudflare requires [them] on VPS egress",
37
+ * and the free tier "rejects generic client UAs from datacenter IPs". This machine's egress is
38
+ * `AS204044`, a hosting provider.
39
+ *
40
+ * That is a hypothesis and it is recorded as one. What is *not* left to hypothesis is the user-facing
41
+ * consequence: a free model refused after the contract was applied is **not** a credential problem,
42
+ * and saying so is what stops the next person from rotating a working key.
43
+ *
44
+ * ## No `node:crypto` here, and that is load-bearing
45
+ *
46
+ * The first version of this file imported `randomBytes` from `node:crypto` and used `Buffer`. The
47
+ * dashboard imports the SDK barrel, Vite bundled this module for the browser, and it failed with
48
+ *
49
+ * ```
50
+ * [Unhandled error] Module "node:crypto" has been externalized for browser compatibility.
51
+ * ```
52
+ *
53
+ * — a **blank page**, on the release that introduced it, and nothing in the build said so because the
54
+ * dashboard's typecheck only ever ran the adapter through Node. `tests/sdk-browser-safety.test.js` now
55
+ * fails on any `node:` import or `Buffer` reference in the SDK, because this module is reachable from
56
+ * a `.tsx` whether or not any component calls it.
57
+ *
58
+ * `crypto.getRandomValues` is Web Crypto: present in Node 18+ and in every browser, no polyfill and no
59
+ * bundler shim. `TextEncoder` is the same story for UTF-8 bytes.
60
+ */
61
+ /** The minimum `User-Agent` version the upstream accepts; older answers 426, not 403. */
62
+ export declare const MINIMUM_ZEN_USER_AGENT_MINOR = 17;
63
+ /**
64
+ * The placeholder tool the official client declares to satisfy the gate.
65
+ *
66
+ * **A moving target.** OmniRoute records that one made-up name was accepted on `big-pickle` and refused
67
+ * on two other free models that had accepted it the day before, which is an observation about someone
68
+ * else's service rather than a fact this project controls. It is therefore a default that
69
+ * `OMNIHILBRAS_ZEN_PLACEHOLDER_TOOL` can replace without a release, and the refusal path names it so a
70
+ * wrong guess is diagnosable rather than mysterious.
71
+ */
72
+ export declare const DEFAULT_ZEN_PLACEHOLDER_TOOL = "_noop";
73
+ /** `ses_` + 12 hex + 14 base62 — the shape the upstream checks. */
74
+ export declare function zenSessionId(seed?: string): string;
75
+ /** Whether a `User-Agent` already satisfies the upstream's version rule, so it need not be replaced. */
76
+ export declare function satisfiesZenUserAgentContract(userAgent: string | null | undefined): boolean;
77
+ /** The default synthesized identity. Overridable so a newer real client version needs no release. */
78
+ export declare function zenUserAgent(): string;
79
+ /** The placeholder tool name, overridable because the accepted names move over time. */
80
+ export declare function zenPlaceholderToolName(): string;
81
+ /**
82
+ * The headers half of the contract, for a free-tier request.
83
+ *
84
+ * `x-opencode-session` is passed in rather than synthesised here because the caller owns conversation
85
+ * affinity: two turns of one conversation must present one session id, and a helper that minted a fresh
86
+ * one per call would defeat the only thing the upstream cache keys on.
87
+ */
88
+ export declare function zenFreeTierHeaders(sessionId: string): Record<string, string>;
89
+ /** A tool that satisfies the gate and is never called, so it cannot change an answer. */
90
+ export declare function zenPlaceholderTool(): {
91
+ type: "function";
92
+ function: {
93
+ name: string;
94
+ description: string;
95
+ parameters: {
96
+ type: "object";
97
+ properties: {};
98
+ additionalProperties: boolean;
99
+ };
100
+ };
101
+ };
102
+ /**
103
+ * Whether a body and header set satisfy the contract, for the refusal message.
104
+ *
105
+ * Exported so the failure path can state *which* conditions were met rather than guessing, which is
106
+ * the difference between "check your key" and "the gate is not the key".
107
+ */
108
+ export declare function zenContractSatisfied(headers: Record<string, string>, body: Record<string, unknown>): boolean;
109
+ /**
110
+ * Whether a refusal is the free-tier gate rather than the credential.
111
+ *
112
+ * `FreeTierError` is the upstream's own envelope, so this is not a guess at the meaning — it matches the
113
+ * literal type it sends.
114
+ */
115
+ export declare function isZenFreeTierRefusal(status: number, payload: unknown): boolean;
116
+ /**
117
+ * A stable fingerprint of one conversation, so its turns share an upstream session.
118
+ *
119
+ * Only the shape of the conversation goes in, and only its digest reaches the network — the conversation
120
+ * itself is neither stored nor sent here. Lives here rather than on the adapter because it is a property
121
+ * of the contract, not of Zen's transport.
122
+ */
123
+ export declare function zenConversationSeed(request: Pick<ChatRequest, 'model' | 'messages' | 'tools'>): string;
124
+ //# sourceMappingURL=zen-free-tier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zen-free-tier.d.ts","sourceRoot":"","sources":["../../src/adapters/zen-free-tier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,yFAAyF;AACzF,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,UAAU,CAAC;AA4BpD,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlD;AAwBD,wGAAwG;AACxG,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAO3F;AAED,qGAAqG;AACrG,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wFAAwF;AACxF,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ5E;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB;;;;;;;;;;;EASjC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAS5G;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAI9E;AAUD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG,MAAM,CAMtG"}
@@ -0,0 +1,215 @@
1
+ /**
2
+ * OpenCode Zen's free-tier request contract.
3
+ *
4
+ * ## Why this exists, and why it was not written sooner
5
+ *
6
+ * Every free model on an `opencode` connection was refused:
7
+ *
8
+ * ```
9
+ * mimo-v2.6-flash-free 403 {"type":"FreeTierError","message":"OpenCode's free tier can only be used from within OpenCode"}
10
+ * big-pickle 403 (identical)
11
+ * nemotron-3.5-…-free 403 (identical)
12
+ * ```
13
+ *
14
+ * The message names the OpenCode client, so the obvious reading was that the free tier wanted the
15
+ * **CLI's own credential** — a 356-char account session token rather than the Zen API key this
16
+ * adapter holds. That reading was wrong, and it was wrong because it was inferred from one refusal
17
+ * instead of measured. `/home/gin/work/OmniRoute` implements the same models through the same base
18
+ * URL with `authType: "apikey"`, and `open-sse/executors/opencodeFreeTierContract.ts` records the
19
+ * contract it measured against the live endpoint: the gate is the **request**, not the credential.
20
+ *
21
+ * ## The four conditions
22
+ *
23
+ * 1. `stream: true` in the body.
24
+ * 2. a non-empty `tools` array — the upstream does not inspect its contents, only that it is there
25
+ * and non-empty. The official client's placeholder name is `_noop`.
26
+ * 3. an `x-opencode-session` header shaped `ses_` + 12 hex + 14 base62. **The shape is checked and the
27
+ * value is not**, so a random id satisfies it; no attempt is made to reproduce the client's
28
+ * algorithm.
29
+ * 4. a `User-Agent` carrying `opencode/<version>` with version >= 1.17.
30
+ *
31
+ * ## What is *not* claimed here
32
+ *
33
+ * The four conditions are necessary. Measured from this machine, applying all four **still** answers
34
+ * 403 — so something beyond the request also decides, and OmniRoute's own comments name the likely
35
+ * candidate twice: the CLI identity headers exist because "Cloudflare requires [them] on VPS egress",
36
+ * and the free tier "rejects generic client UAs from datacenter IPs". This machine's egress is
37
+ * `AS204044`, a hosting provider.
38
+ *
39
+ * That is a hypothesis and it is recorded as one. What is *not* left to hypothesis is the user-facing
40
+ * consequence: a free model refused after the contract was applied is **not** a credential problem,
41
+ * and saying so is what stops the next person from rotating a working key.
42
+ *
43
+ * ## No `node:crypto` here, and that is load-bearing
44
+ *
45
+ * The first version of this file imported `randomBytes` from `node:crypto` and used `Buffer`. The
46
+ * dashboard imports the SDK barrel, Vite bundled this module for the browser, and it failed with
47
+ *
48
+ * ```
49
+ * [Unhandled error] Module "node:crypto" has been externalized for browser compatibility.
50
+ * ```
51
+ *
52
+ * — a **blank page**, on the release that introduced it, and nothing in the build said so because the
53
+ * dashboard's typecheck only ever ran the adapter through Node. `tests/sdk-browser-safety.test.js` now
54
+ * fails on any `node:` import or `Buffer` reference in the SDK, because this module is reachable from
55
+ * a `.tsx` whether or not any component calls it.
56
+ *
57
+ * `crypto.getRandomValues` is Web Crypto: present in Node 18+ and in every browser, no polyfill and no
58
+ * bundler shim. `TextEncoder` is the same story for UTF-8 bytes.
59
+ */
60
+ /** The minimum `User-Agent` version the upstream accepts; older answers 426, not 403. */
61
+ export const MINIMUM_ZEN_USER_AGENT_MINOR = 17;
62
+ /**
63
+ * The placeholder tool the official client declares to satisfy the gate.
64
+ *
65
+ * **A moving target.** OmniRoute records that one made-up name was accepted on `big-pickle` and refused
66
+ * on two other free models that had accepted it the day before, which is an observation about someone
67
+ * else's service rather than a fact this project controls. It is therefore a default that
68
+ * `OMNIHILBRAS_ZEN_PLACEHOLDER_TOOL` can replace without a release, and the refusal path names it so a
69
+ * wrong guess is diagnosable rather than mysterious.
70
+ */
71
+ export const DEFAULT_ZEN_PLACEHOLDER_TOOL = '_noop';
72
+ const BASE62 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
73
+ function base62(bytes, length) {
74
+ let out = '';
75
+ for (let index = 0; index < length; index += 1)
76
+ out += BASE62[bytes[index] % 62];
77
+ return out;
78
+ }
79
+ function toHex(bytes) {
80
+ let out = '';
81
+ for (const byte of bytes)
82
+ out += byte.toString(16).padStart(2, '0');
83
+ return out;
84
+ }
85
+ /** Random bytes from Web Crypto, which exists in Node 18+ and in every browser. */
86
+ function randomBytes(length) {
87
+ const bytes = new Uint8Array(length);
88
+ crypto.getRandomValues(bytes);
89
+ return bytes;
90
+ }
91
+ /** UTF-8 bytes, without `Buffer` — the other Node-only thing the first version reached for. */
92
+ function utf8(text) {
93
+ return new TextEncoder().encode(text);
94
+ }
95
+ /** `ses_` + 12 hex + 14 base62 — the shape the upstream checks. */
96
+ export function zenSessionId(seed) {
97
+ const bytes = seed ? hashSeed(seed) : randomBytes(20);
98
+ return `ses_${toHex(bytes.subarray(0, 6))}${base62(bytes, 14)}`;
99
+ }
100
+ /**
101
+ * A stable id for one conversation, so the upstream's prompt cache stays warm across its turns.
102
+ *
103
+ * Derived from the request rather than random: a fresh random id per request is a new upstream session
104
+ * every time, and the cache that depends on it never hits.
105
+ */
106
+ function hashSeed(seed) {
107
+ const out = new Uint8Array(20);
108
+ // FNV-1a widened to 20 bytes. Not a security primitive and not asked to be: this only has to be
109
+ // stable across a conversation and different between conversations.
110
+ let h = 0x811c9dc5;
111
+ for (const byte of utf8(`zen ${seed}`)) {
112
+ h ^= byte;
113
+ h = Math.imul(h, 0x01000193) >>> 0;
114
+ for (let i = 0; i < 5; i += 1) {
115
+ out[i * 4] = (h >>> ((i * 8) % 32)) & 0xff;
116
+ }
117
+ h = Math.imul(h ^ 0x9e3779b9, 0x85ebca6b) >>> 0;
118
+ }
119
+ return out;
120
+ }
121
+ /** Whether a `User-Agent` already satisfies the upstream's version rule, so it need not be replaced. */
122
+ export function satisfiesZenUserAgentContract(userAgent) {
123
+ const match = String(userAgent ?? '').match(/opencode\/(?:[a-z]+\/)?v?(\d+)\.(\d+)/i);
124
+ if (!match)
125
+ return false;
126
+ const major = Number.parseInt(match[1], 10);
127
+ const minor = Number.parseInt(match[2], 10);
128
+ if (!Number.isFinite(major) || !Number.isFinite(minor))
129
+ return false;
130
+ return major > 1 || (major === 1 && minor >= MINIMUM_ZEN_USER_AGENT_MINOR);
131
+ }
132
+ /** The default synthesized identity. Overridable so a newer real client version needs no release. */
133
+ export function zenUserAgent() {
134
+ return process.env.OMNIHILBRAS_ZEN_USER_AGENT?.trim() || 'opencode/1.18.31';
135
+ }
136
+ /** The placeholder tool name, overridable because the accepted names move over time. */
137
+ export function zenPlaceholderToolName() {
138
+ return process.env.OMNIHILBRAS_ZEN_PLACEHOLDER_TOOL?.trim() || DEFAULT_ZEN_PLACEHOLDER_TOOL;
139
+ }
140
+ /**
141
+ * The headers half of the contract, for a free-tier request.
142
+ *
143
+ * `x-opencode-session` is passed in rather than synthesised here because the caller owns conversation
144
+ * affinity: two turns of one conversation must present one session id, and a helper that minted a fresh
145
+ * one per call would defeat the only thing the upstream cache keys on.
146
+ */
147
+ export function zenFreeTierHeaders(sessionId) {
148
+ return {
149
+ 'user-agent': zenUserAgent(),
150
+ 'x-opencode-client': 'desktop',
151
+ 'x-opencode-project': 'global',
152
+ 'x-opencode-session': sessionId,
153
+ 'x-opencode-request': zenSessionId(),
154
+ };
155
+ }
156
+ /** A tool that satisfies the gate and is never called, so it cannot change an answer. */
157
+ export function zenPlaceholderTool() {
158
+ return {
159
+ type: 'function',
160
+ function: {
161
+ name: zenPlaceholderToolName(),
162
+ description: 'Declared to satisfy the provider free-tier request contract. Never called.',
163
+ parameters: { type: 'object', properties: {}, additionalProperties: false },
164
+ },
165
+ };
166
+ }
167
+ /**
168
+ * Whether a body and header set satisfy the contract, for the refusal message.
169
+ *
170
+ * Exported so the failure path can state *which* conditions were met rather than guessing, which is
171
+ * the difference between "check your key" and "the gate is not the key".
172
+ */
173
+ export function zenContractSatisfied(headers, body) {
174
+ const tools = body.tools;
175
+ return (body.stream === true &&
176
+ Array.isArray(tools) &&
177
+ tools.length > 0 &&
178
+ typeof headers['x-opencode-session'] === 'string' &&
179
+ satisfiesZenUserAgentContract(headers['user-agent']));
180
+ }
181
+ /**
182
+ * Whether a refusal is the free-tier gate rather than the credential.
183
+ *
184
+ * `FreeTierError` is the upstream's own envelope, so this is not a guess at the meaning — it matches the
185
+ * literal type it sends.
186
+ */
187
+ export function isZenFreeTierRefusal(status, payload) {
188
+ if (status !== 403 && status !== 402 && status !== 429)
189
+ return false;
190
+ const text = typeof payload === 'string' ? payload : safeJson(payload);
191
+ return /freetiererror|free tier|freeusage/i.test(text);
192
+ }
193
+ function safeJson(value) {
194
+ try {
195
+ return JSON.stringify(value) ?? '';
196
+ }
197
+ catch {
198
+ return '';
199
+ }
200
+ }
201
+ /**
202
+ * A stable fingerprint of one conversation, so its turns share an upstream session.
203
+ *
204
+ * Only the shape of the conversation goes in, and only its digest reaches the network — the conversation
205
+ * itself is neither stored nor sent here. Lives here rather than on the adapter because it is a property
206
+ * of the contract, not of Zen's transport.
207
+ */
208
+ export function zenConversationSeed(request) {
209
+ return [
210
+ request.model,
211
+ request.messages.map((message) => `${message.role}:${typeof message.content === 'string' ? message.content : ''}`).join('|'),
212
+ (request.tools ?? []).map((tool) => tool.name).join(','),
213
+ ].join(' ');
214
+ }
215
+ //# sourceMappingURL=zen-free-tier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zen-free-tier.js","sourceRoot":"","sources":["../../src/adapters/zen-free-tier.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,yFAAyF;AACzF,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAEpD,MAAM,MAAM,GAAG,gEAAgE,CAAC;AAEhF,SAAS,MAAM,CAAC,KAAiB,EAAE,MAAc;IAC/C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;QAAE,GAAG,IAAI,MAAM,CAAC,K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AI,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACvE,OAAO,oCAAoC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA0D;IAC5F,OAAO;QACL,OAAO,CAAC,KAAK;QACb,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAC5H,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;KACzD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC"}
@@ -61,6 +61,39 @@ export declare class ZenAdapter implements ProviderAdapter {
61
61
  * happily. So this reports what it established, and the dashboard says what that means.
62
62
  */
63
63
  healthCheck(context?: ProviderRequestContext): Promise<ProviderHealth>;
64
+ /**
65
+ * A free-tier chat, with the request contract applied.
66
+ *
67
+ * The contract requires `stream: true`, so this always sends a stream and re-aggregates it into the
68
+ * `ChatResponse` the caller asked for. A caller that wanted JSON is not getting a different request;
69
+ * they are getting the same one the gate permits, decoded. That is stated in the method name rather
70
+ * than hidden in the body, because "why is a JSON request streaming?" is a fair question.
71
+ */
72
+ private gatedChat;
73
+ /**
74
+ * The one request this adapter sends for a free model: contract applied, stream requested.
75
+ *
76
+ * The refusal below is the part worth reading. Measured from this machine, a request carrying **all
77
+ * four** conditions still answers `403 FreeTierError`, and the working implementation's own comments
78
+ * name the likely reason twice — the CLI identity headers exist because "Cloudflare requires [them]
79
+ * on VPS egress", and the free tier "rejects generic client UAs from datacenter IPs". So when the
80
+ * contract has been applied and the request is *still* refused, telling the user to check their
81
+ * access sends them to rotate a key that was already accepted. It says what was sent and names the
82
+ * network as the likely cause, which is the thing they can act on.
83
+ */
84
+ private streamGated;
85
+ /**
86
+ * Pass the stream through, turning a transport-level refusal into the gated one.
87
+ *
88
+ * `transport.stream` raises its own `ProviderError` for a non-2xx **before** yielding a single event,
89
+ * so the gate's refusal arrives as a throw and never reaches the chunk loop below. Left alone the user
90
+ * sees the transport's generic *"The provider refused the request."* — the reasonless verdict this
91
+ * whole change exists to remove, arriving from the layer underneath. Wrapping is the only place that
92
+ * can still tell it was the gate, because by the time it throws the contract state is gone.
93
+ */
94
+ private captureGateRefusal;
95
+ /** The refusal, naming what was sent — the difference between a key problem and a network one. */
96
+ private gatedRefusal;
64
97
  /** The messages lane: raw key in `x-api-key`, plus the required version header. */
65
98
  private apiKeyHeaders;
66
99
  private authHeaders;
@@ -1 +1 @@
1
- {"version":3,"file":"zen.d.ts","sourceRoot":"","sources":["../../src/adapters/zen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAe,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAgB,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,sBAAsB,EAAc,MAAM,aAAa,CAAC;AAEzN;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,4BAA4B,CAAC;AACtD,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AA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;;OAIG;IACI,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,sBAA2B,GAAG,aAAa,CAAC,SAAS,CAAC;IAoBvG;;;;;;;OAOG;IACG,WAAW,CAAC,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,cAAc,CAAC;IAchF;;;;;;;OAOG;YACW,SAAS;IAmBvB;;;;;;;;;;OAUG;YACY,WAAW;IAiD1B;;;;;;;;OAQG;YACY,kBAAkB;IAUjC,kGAAkG;IAClG,OAAO,CAAC,YAAY;IAwBpB,mFAAmF;IACnF,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,WAAW;CASpB"}
@@ -1,6 +1,8 @@
1
1
  import { ProviderError } from '../errors.js';
2
2
  import { FetchHttpTransport } from '../transport.js';
3
3
  import { OpenAICompatibleAdapter } from './openai-compatible.js';
4
+ import { parseSseJson, parseSseStream } from '../streaming.js';
5
+ import { isZenFreeTierRefusal, zenFreeTierHeaders, zenPlaceholderTool, zenSessionId, zenContractSatisfied, zenConversationSeed } from './zen-free-tier.js';
4
6
  /**
5
7
  * OpenCode Zen serves one catalog through three different wire formats. Which
6
8
  * format a model uses is a property of the model, not of the connection, so a
@@ -16,6 +18,54 @@ export const ZEN_LANES = {
16
18
  messages: `${ZEN_BASE_URL}/v1/messages`,
17
19
  responses: `${ZEN_BASE_URL}/v1/responses`,
18
20
  };
21
+ function toGatedMessage(message) {
22
+ return {
23
+ role: message.role,
24
+ content: messageText(message),
25
+ ...(message.name ? { name: message.name } : {}),
26
+ ...(message.toolCallId ? { tool_call_id: message.toolCallId } : {}),
27
+ };
28
+ }
29
+ /**
30
+ * A tool in the shape the upstream expects.
31
+ *
32
+ * Kept local rather than imported because `openai-compatible.ts` keeps its own copy private, and a
33
+ * second export used once would be a wider surface than the duplication is worth.
34
+ */
35
+ function toGatedTool(tool) {
36
+ return {
37
+ type: 'function',
38
+ function: { name: tool.name, ...(tool.description ? { description: tool.description } : {}), parameters: tool.parameters },
39
+ };
40
+ }
41
+ function toGatedFinishReason(reason) {
42
+ const map = {
43
+ stop: 'stop', length: 'length', tool_calls: 'tool_calls', function_call: 'tool_calls', content_filter: 'content_filter',
44
+ };
45
+ return map[reason] ?? 'stop';
46
+ }
47
+ /**
48
+ * The upstream's own words, wherever they ended up.
49
+ *
50
+ * Two shapes reach here: a payload envelope from the stream (`{error: {message}}`), and the
51
+ * `ProviderError` the transport raised, which carries the provider's text in `details.providerMessage`.
52
+ * Reading only the first is what produced a bare "The provider refused the request." on every gated
53
+ * model — the cause was in hand and the code was not looking at it.
54
+ */
55
+ function readGatedErrorReason(payload) {
56
+ const details = payload?.details;
57
+ if (typeof details?.providerMessage === 'string')
58
+ return details.providerMessage;
59
+ const error = payload?.error;
60
+ if (typeof error === 'string')
61
+ return error;
62
+ const message = error?.message;
63
+ if (typeof message === 'string')
64
+ return message;
65
+ return typeof payload?.message === 'string'
66
+ ? payload.message
67
+ : undefined;
68
+ }
19
69
  /**
20
70
  * Model families with a published non-chat endpoint. Matched by prefix so a new
21
71
  * `claude-*` or `gpt-*` is routed correctly without a code change, and matched
@@ -27,6 +77,17 @@ const responsesFamily = /^(gpt-|grok-|muse-spark-)/;
27
77
  /** Models Zen serves from an endpoint this adapter does not implement. */
28
78
  const unsupported = new Set(['jev-1.13', 'jev-1.13-free']);
29
79
  const unsupportedFamily = /^gemini-/;
80
+ /**
81
+ * Whether a model is on the gated free tier, and so needs the request contract.
82
+ *
83
+ * The suffix is the whole test rather than a list, because **the upstream rotates its free lineup** —
84
+ * OmniRoute records `minimax-m2.5-free`, `ling-2.6-1t-free` and three others being delisted and
85
+ * replaced within a week. A list would be stale the day after it was written and would keep serving
86
+ * models that no longer exist while refusing ones that do. A suffix tracks the tier.
87
+ */
88
+ function isFreeTierModel(id) {
89
+ return /-free$/.test(id);
90
+ }
30
91
  /** The lane a model is served from, and whether this adapter can speak it. */
31
92
  export function zenLaneFor(model) {
32
93
  const id = model.includes('/') ? model.slice(model.lastIndexOf('/') + 1) : model;
@@ -227,8 +288,13 @@ export class ZenAdapter {
227
288
  const id = request.model.includes('/') ? request.model.slice(request.model.lastIndexOf('/') + 1) : request.model;
228
289
  if (!supported)
229
290
  throw unsupportedLane(request.model, id);
230
- if (lane === 'chat')
291
+ if (lane === 'chat') {
292
+ // Free-tier models need the request contract, which the delegated chat lane knows nothing
293
+ // about — it sends `stream: false` and whatever tools the caller declared, which is a refusal.
294
+ if (isFreeTierModel(id))
295
+ return this.gatedChat(request, context);
231
296
  return this.chatLane.chat(request, context);
297
+ }
232
298
  const isResponses = lane === 'responses';
233
299
  const response = await this.transport.request({
234
300
  method: 'POST',
@@ -269,6 +335,13 @@ export class ZenAdapter {
269
335
  publicMessage: `Streaming is not implemented for this OpenCode Zen model. Use a non-streaming request.`,
270
336
  });
271
337
  }
338
+ if (isFreeTierModel(id)) {
339
+ // The contract requires a stream, so a free model is streamed upstream **regardless** of what the
340
+ // caller asked for — `gatedChat` aggregates that same stream back into one response. Asking
341
+ // upstream for JSON instead is refused with `FreeTierError`, so there is no other path to take.
342
+ yield* this.streamGated(request, context);
343
+ return;
344
+ }
272
345
  yield* this.chatLane.streamChat(request, context);
273
346
  }
274
347
  /**
@@ -293,6 +366,130 @@ export class ZenAdapter {
293
366
  };
294
367
  }
295
368
  }
369
+ /**
370
+ * A free-tier chat, with the request contract applied.
371
+ *
372
+ * The contract requires `stream: true`, so this always sends a stream and re-aggregates it into the
373
+ * `ChatResponse` the caller asked for. A caller that wanted JSON is not getting a different request;
374
+ * they are getting the same one the gate permits, decoded. That is stated in the method name rather
375
+ * than hidden in the body, because "why is a JSON request streaming?" is a fair question.
376
+ */
377
+ async gatedChat(request, context) {
378
+ let text = '';
379
+ let finishReason;
380
+ let responseId = '';
381
+ for await (const chunk of this.streamGated(request, context)) {
382
+ responseId = chunk.id || responseId;
383
+ if (chunk.delta?.content)
384
+ text += chunk.delta.content;
385
+ if (chunk.finishReason)
386
+ finishReason = chunk.finishReason;
387
+ }
388
+ return {
389
+ id: responseId || `zen-${request.model}`,
390
+ providerId: this.id,
391
+ model: request.model,
392
+ createdAt: new Date().toISOString(),
393
+ message: { role: 'assistant', content: text },
394
+ finishReason: finishReason ?? 'stop',
395
+ };
396
+ }
397
+ /**
398
+ * The one request this adapter sends for a free model: contract applied, stream requested.
399
+ *
400
+ * The refusal below is the part worth reading. Measured from this machine, a request carrying **all
401
+ * four** conditions still answers `403 FreeTierError`, and the working implementation's own comments
402
+ * name the likely reason twice — the CLI identity headers exist because "Cloudflare requires [them]
403
+ * on VPS egress", and the free tier "rejects generic client UAs from datacenter IPs". So when the
404
+ * contract has been applied and the request is *still* refused, telling the user to check their
405
+ * access sends them to rotate a key that was already accepted. It says what was sent and names the
406
+ * network as the likely cause, which is the thing they can act on.
407
+ */
408
+ async *streamGated(request, context) {
409
+ const id = request.model.includes('/') ? request.model.slice(request.model.lastIndexOf('/') + 1) : request.model;
410
+ const headers = this.authHeaders(context.credential, zenFreeTierHeaders(zenSessionId(zenConversationSeed(request))));
411
+ const body = {
412
+ model: id,
413
+ messages: request.messages.map(toGatedMessage),
414
+ stream: true,
415
+ // The caller's tools when there are any; the placeholder otherwise, because an empty array is a
416
+ // refusal. A tool the model could actually call is never removed to make room for the placeholder.
417
+ tools: request.tools && request.tools.length > 0 ? request.tools.map(toGatedTool) : [zenPlaceholderTool()],
418
+ ...(request.maxOutputTokens === undefined ? {} : { max_tokens: request.maxOutputTokens }),
419
+ ...(request.temperature === undefined ? {} : { temperature: request.temperature }),
420
+ ...(request.topP === undefined ? {} : { top_p: request.topP }),
421
+ };
422
+ const satisfied = zenContractSatisfied(headers, body);
423
+ const events = this.captureGateRefusal(this.transport.stream({
424
+ method: 'POST',
425
+ providerId: this.id,
426
+ url: ZEN_LANES.chat,
427
+ headers: { ...headers, accept: 'text/event-stream' },
428
+ body: JSON.stringify(body),
429
+ ...(context.signal ? { signal: context.signal } : {}),
430
+ }), request.model, satisfied);
431
+ let opened = false;
432
+ for await (const event of parseSseStream(events)) {
433
+ if (event.data.trim() === '[DONE]')
434
+ return;
435
+ const chunk = parseSseJson(event, this.id);
436
+ if (!chunk)
437
+ continue;
438
+ opened = true;
439
+ if (chunk.error)
440
+ throw this.gatedRefusal(request.model, chunk, satisfied);
441
+ const chunkId = chunk.id ?? `zen-${id}`;
442
+ const delta = chunk.choices?.[0]?.delta?.content;
443
+ if (delta)
444
+ yield { id: chunkId, providerId: this.id, model: id, delta: { content: delta } };
445
+ const finish = chunk.choices?.[0]?.finish_reason;
446
+ if (finish)
447
+ yield { id: chunkId, providerId: this.id, model: id, delta: {}, finishReason: toGatedFinishReason(finish) };
448
+ }
449
+ // The stream closed without a single payload: either the gate refused before the first event, or
450
+ // the answer was JSON rather than SSE. Those need different messages, so it is read rather than
451
+ // guessed at.
452
+ if (!opened)
453
+ throw this.gatedRefusal(request.model, undefined, satisfied);
454
+ }
455
+ /**
456
+ * Pass the stream through, turning a transport-level refusal into the gated one.
457
+ *
458
+ * `transport.stream` raises its own `ProviderError` for a non-2xx **before** yielding a single event,
459
+ * so the gate's refusal arrives as a throw and never reaches the chunk loop below. Left alone the user
460
+ * sees the transport's generic *"The provider refused the request."* — the reasonless verdict this
461
+ * whole change exists to remove, arriving from the layer underneath. Wrapping is the only place that
462
+ * can still tell it was the gate, because by the time it throws the contract state is gone.
463
+ */
464
+ async *captureGateRefusal(stream, model, satisfied) {
465
+ try {
466
+ yield* stream;
467
+ }
468
+ catch (error) {
469
+ throw error instanceof ProviderError && /refused the request/i.test(error.message)
470
+ ? this.gatedRefusal(model, error, satisfied)
471
+ : error;
472
+ }
473
+ }
474
+ /** The refusal, naming what was sent — the difference between a key problem and a network one. */
475
+ gatedRefusal(model, payload, satisfied) {
476
+ // `providerErrorFromResponse` maps every 403 to `PROVIDER_REQUEST_FAILED` and attaches no
477
+ // `statusCode`, so the status cannot be recovered from the thrown error — but the **cause** can,
478
+ // and that is what decides the code. Recognising the gate by the provider's own `FreeTierError`
479
+ // wording rather than by status is therefore more honest than assuming a 403: a 429 on the free
480
+ // tier stays `RATE_LIMITED` and a 5xx stays `PROVIDER_UNAVAILABLE`, instead of every gated refusal
481
+ // collapsing into one code that means nothing to the retry policy.
482
+ const reason = readGatedErrorReason(payload);
483
+ const gated = isZenFreeTierRefusal(403, payload) || /freetiererror|free tier/i.test(reason ?? '');
484
+ const message = satisfied
485
+ ? `OpenCode Zen refused ${model} after this gateway sent everything its free-tier request contract requires — a streaming request, a declared tool, a session header and a client version. The API key was accepted, so this is not a credential problem: OpenCode limits its free tier to non-datacenter networks, and this host's egress address is the likely cause.`
486
+ : `OpenCode Zen refused ${model}, and this gateway could not satisfy its free-tier request contract.`;
487
+ return new ProviderError(gated ? 'PROVIDER_UNAVAILABLE' : 'PROVIDER_REQUEST_FAILED', message, {
488
+ providerId: this.id,
489
+ publicMessage: message,
490
+ ...(reason ? { details: { providerReason: reason } } : {}),
491
+ });
492
+ }
296
493
  /** The messages lane: raw key in `x-api-key`, plus the required version header. */
297
494
  apiKeyHeaders(credential) {
298
495
  const value = credential?.type === 'none' ? '' : credential?.value ?? '';
@@ -1 +1 @@
1
- {"version":3,"file":"zen.js","sourceRoot":"","sources":["../../src/adapters/zen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGjE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,GAAG,YAAY,sBAAsB;IAC3C,QAAQ,EAAE,GAAG,YAAY,cAAc;IACvC,SAAS,EAAE,GAAG,YAAY,eAAe;CACjC,CAAC;AAIX;;;;GAIG;AACH,MAAM,cAAc,GAAG,UAAU,CAAC;AAClC,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,eAAe,EAAE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KAAK;YACR,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hilbras/omnihilbras",
3
- "version": "1.41.0",
3
+ "version": "1.43.0",
4
4
  "description": "Typed provider SDK for the OmniHilbras gateway: normalized chat, streaming, model listing, and capability contracts for OpenAI, Anthropic, Gemini, and OpenAI-compatible providers.",
5
5
  "license": "MIT",
6
6
  "author": "Hilbras",