@hilbras/omnihilbras 1.7.0 → 1.8.1

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.7.0';
38
+ const omnihilbrasVersion = '1.8.1';
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,38 @@
1
+ /**
2
+ * DeepSeek's proof-of-work, `DeepSeekHashV1`.
3
+ *
4
+ * DeepSeek gates every `/api/v0/chat/completion` call with a small search problem: find a
5
+ * nonce whose hash of `<salt>_<expireAt>_<nonce>` equals a given digest. It is not a
6
+ * leading-zeros problem — the whole 32-byte digest must match, so exactly one nonce in the
7
+ * announced range satisfies it and the work is bounded by that range.
8
+ *
9
+ * The hash is **SHA3-256's sponge with 23 Keccak rounds instead of 24**. That is the entire
10
+ * difference, and it is why `node:crypto` cannot be used for it: the platform gives 24.
11
+ * `sha3_256Fips202Reference` here is the same code at 24 rounds, which *can* be checked
12
+ * against the platform, and that check is what keeps the 23-round version honest.
13
+ *
14
+ * Everything is 32-bit rather than BigInt: a difficulty of 250 000 means 250 000 permutations,
15
+ * and BigInt lanes make that roughly two orders of magnitude slower for no benefit.
16
+ */
17
+ export declare const MAX_DEEPSEEK_POW_DIFFICULTY = 250000;
18
+ /**
19
+ * SHA3-256 proper, at 24 rounds.
20
+ *
21
+ * Exported only so the 23-round implementation below can be checked against the platform:
22
+ * this one must equal `node:crypto`'s SHA3-256 for every input, and if it does not, neither
23
+ * does the other.
24
+ */
25
+ export declare function sha3_256Fips202Reference(input: string): string;
26
+ /** `DeepSeekHashV1` as a readable model. For tests, not for a 250 000-iteration search. */
27
+ export declare function deepSeekHashV1Reference(input: string): string;
28
+ /** `DeepSeekHashV1`, allocation-bounded. */
29
+ export declare function deepSeekHashV1(input: string): string;
30
+ /**
31
+ * Finds the nonce, or -1 if the range does not contain one.
32
+ *
33
+ * The prefix is absorbed **once** and the state is copied per candidate, so a 250 000-wide
34
+ * search re-encodes nothing. Inputs are validated here as well as at the solver boundary, so
35
+ * a hostile challenge cannot coerce this into an unbounded loop or an oversized allocation.
36
+ */
37
+ export declare function findDeepSeekPowNonce(prefix: string, challenge: string, difficulty: number): number;
38
+ //# sourceMappingURL=deepseek-pow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepseek-pow.d.ts","sourceRoot":"","sources":["../../src/adapters/deepseek-pow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAsBH,eAAO,MAAM,2BAA2B,SAAU,CAAC;AA+FnD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,2FAA2F;AAC3F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AAsHD,4CAA4C;AAC5C,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAWD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAsDlG"}
@@ -0,0 +1,301 @@
1
+ /**
2
+ * DeepSeek's proof-of-work, `DeepSeekHashV1`.
3
+ *
4
+ * DeepSeek gates every `/api/v0/chat/completion` call with a small search problem: find a
5
+ * nonce whose hash of `<salt>_<expireAt>_<nonce>` equals a given digest. It is not a
6
+ * leading-zeros problem — the whole 32-byte digest must match, so exactly one nonce in the
7
+ * announced range satisfies it and the work is bounded by that range.
8
+ *
9
+ * The hash is **SHA3-256's sponge with 23 Keccak rounds instead of 24**. That is the entire
10
+ * difference, and it is why `node:crypto` cannot be used for it: the platform gives 24.
11
+ * `sha3_256Fips202Reference` here is the same code at 24 rounds, which *can* be checked
12
+ * against the platform, and that check is what keeps the 23-round version honest.
13
+ *
14
+ * Everything is 32-bit rather than BigInt: a difficulty of 250 000 means 250 000 permutations,
15
+ * and BigInt lanes make that roughly two orders of magnitude slower for no benefit.
16
+ */
17
+ const LANE_MASK = (1n << 64n) - 1n;
18
+ const RATE_BYTES = 136;
19
+ const DOMAIN_SUFFIX = 0x06;
20
+ const OUTPUT_BYTES = 32;
21
+ /** Indexed as `x + 5*y`, matching the FIPS 202 state coordinates. */
22
+ const ROTATION_OFFSETS = [
23
+ 0, 1, 62, 28, 27, 36, 44, 6, 55, 20, 3, 10, 43, 25, 39, 41, 45, 15, 21, 8, 18, 2, 61, 56, 14,
24
+ ];
25
+ const ROUND_CONSTANTS = [
26
+ 0x0000000000000001n, 0x0000000000008082n, 0x800000000000808an, 0x8000000080008000n,
27
+ 0x000000000000808bn, 0x0000000080000001n, 0x8000000080008081n, 0x8000000000008009n,
28
+ 0x000000000000008an, 0x0000000000000088n, 0x0000000080008009n, 0x000000008000000an,
29
+ 0x000000008000808bn, 0x800000000000008bn, 0x8000000000008089n, 0x8000000000008003n,
30
+ 0x8000000000008002n, 0x8000000000000080n, 0x000000000000800an, 0x800000008000000an,
31
+ 0x8000000080008081n, 0x8000000000008080n, 0x0000000080000001n, 0x8000000080008008n,
32
+ ];
33
+ const DEEPSEEK_HASH_ROUNDS = 23;
34
+ export const MAX_DEEPSEEK_POW_DIFFICULTY = 250_000;
35
+ const ROUND_CONSTANTS_LOW = Uint32Array.from(ROUND_CONSTANTS, (v) => Number(v & 0xffffffffn));
36
+ const ROUND_CONSTANTS_HIGH = Uint32Array.from(ROUND_CONSTANTS, (v) => Number((v >> 32n) & 0xffffffffn));
37
+ const RHO_PI_DESTINATION_WORDS = Uint8Array.from({ length: 25 }, (_, lane) => {
38
+ const x = lane % 5;
39
+ const y = Math.floor(lane / 5);
40
+ return 2 * (y + 5 * ((2 * x + 3 * y) % 5));
41
+ });
42
+ const CHI_NEXT_WORDS = Uint8Array.from({ length: 25 }, (_, lane) => {
43
+ const x = lane % 5;
44
+ const row = lane - x;
45
+ return 2 * (row + ((x + 1) % 5));
46
+ });
47
+ const CHI_NEXT_NEXT_WORDS = Uint8Array.from({ length: 25 }, (_, lane) => {
48
+ const x = lane % 5;
49
+ const row = lane - x;
50
+ return 2 * (row + ((x + 2) % 5));
51
+ });
52
+ const HEX_DIGITS = '0123456789abcdef';
53
+ function rotateLeft64(value, amount) {
54
+ if (amount === 0)
55
+ return value;
56
+ const shift = BigInt(amount);
57
+ return ((value << shift) | (value >> (64n - shift))) & LANE_MASK;
58
+ }
59
+ /** The last `roundCount` rounds of KECCAK-p[1600, roundCount], in BigInt. Readable, not fast. */
60
+ function keccakP1600Reference(state, roundCount) {
61
+ const columnParity = new Array(5).fill(0n);
62
+ const thetaMix = new Array(5).fill(0n);
63
+ const rhoPiState = new Array(25).fill(0n);
64
+ const firstRound = ROUND_CONSTANTS.length - roundCount;
65
+ for (let round = firstRound; round < ROUND_CONSTANTS.length; round++) {
66
+ for (let x = 0; x < 5; x++) {
67
+ columnParity[x] = state[x] ^ state[x + 5] ^ state[x + 10] ^ state[x + 15] ^ state[x + 20];
68
+ }
69
+ for (let x = 0; x < 5; x++) {
70
+ thetaMix[x] = columnParity[(x + 4) % 5] ^ rotateLeft64(columnParity[(x + 1) % 5], 1);
71
+ }
72
+ for (let y = 0; y < 5; y++)
73
+ for (let x = 0; x < 5; x++)
74
+ state[x + 5 * y] = state[x + 5 * y] ^ thetaMix[x];
75
+ for (let y = 0; y < 5; y++) {
76
+ for (let x = 0; x < 5; x++) {
77
+ const destinationX = y;
78
+ const destinationY = (2 * x + 3 * y) % 5;
79
+ rhoPiState[destinationX + 5 * destinationY] = rotateLeft64(state[x + 5 * y], ROTATION_OFFSETS[x + 5 * y]);
80
+ }
81
+ }
82
+ for (let y = 0; y < 5; y++) {
83
+ for (let x = 0; x < 5; x++) {
84
+ const row = 5 * y;
85
+ state[x + row] =
86
+ rhoPiState[x + row] ^ (~rhoPiState[((x + 1) % 5) + row] & LANE_MASK & rhoPiState[((x + 2) % 5) + row]);
87
+ }
88
+ }
89
+ state[0] = state[0] ^ ROUND_CONSTANTS[round];
90
+ }
91
+ }
92
+ function absorbReferenceBlock(state, block, roundCount) {
93
+ for (let index = 0; index < RATE_BYTES; index++) {
94
+ const lane = Math.floor(index / 8);
95
+ state[lane] = state[lane] ^ (BigInt(block[index]) << BigInt((index % 8) * 8));
96
+ }
97
+ keccakP1600Reference(state, roundCount);
98
+ }
99
+ /** SHA3-256's sponge with a selectable round count, in BigInt. The readable model. */
100
+ function sha3_256ReferenceWithRoundCount(input, roundCount) {
101
+ const bytes = new TextEncoder().encode(input);
102
+ const state = new Array(25).fill(0n);
103
+ let offset = 0;
104
+ while (offset + RATE_BYTES <= bytes.length) {
105
+ absorbReferenceBlock(state, bytes.subarray(offset, offset + RATE_BYTES), roundCount);
106
+ offset += RATE_BYTES;
107
+ }
108
+ const finalBlock = new Uint8Array(RATE_BYTES);
109
+ finalBlock.set(bytes.subarray(offset));
110
+ finalBlock[bytes.length - offset] = finalBlock[bytes.length - offset] ^ DOMAIN_SUFFIX;
111
+ finalBlock[RATE_BYTES - 1] = finalBlock[RATE_BYTES - 1] ^ 0x80;
112
+ absorbReferenceBlock(state, finalBlock, roundCount);
113
+ const output = new Uint8Array(OUTPUT_BYTES);
114
+ for (let index = 0; index < output.length; index++) {
115
+ const lane = state[Math.floor(index / 8)];
116
+ output[index] = Number((lane >> BigInt((index % 8) * 8)) & 0xffn);
117
+ }
118
+ return Array.from(output, (byte) => byte.toString(16).padStart(2, '0')).join('');
119
+ }
120
+ /**
121
+ * SHA3-256 proper, at 24 rounds.
122
+ *
123
+ * Exported only so the 23-round implementation below can be checked against the platform:
124
+ * this one must equal `node:crypto`'s SHA3-256 for every input, and if it does not, neither
125
+ * does the other.
126
+ */
127
+ export function sha3_256Fips202Reference(input) {
128
+ return sha3_256ReferenceWithRoundCount(input, 24);
129
+ }
130
+ /** `DeepSeekHashV1` as a readable model. For tests, not for a 250 000-iteration search. */
131
+ export function deepSeekHashV1Reference(input) {
132
+ return sha3_256ReferenceWithRoundCount(input, DEEPSEEK_HASH_ROUNDS);
133
+ }
134
+ /** The same permutation in 32-bit words. Each 64-bit lane is adjacent little-endian words. */
135
+ function keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, roundCount) {
136
+ const firstRound = ROUND_CONSTANTS.length - roundCount;
137
+ for (let round = firstRound; round < ROUND_CONSTANTS.length; round++) {
138
+ for (let x = 0; x < 5; x++) {
139
+ const word = 2 * x;
140
+ columnParity[word] = state[word] ^ state[word + 10] ^ state[word + 20] ^ state[word + 30] ^ state[word + 40];
141
+ columnParity[word + 1] = state[word + 1] ^ state[word + 11] ^ state[word + 21] ^ state[word + 31] ^ state[word + 41];
142
+ }
143
+ for (let x = 0; x < 5; x++) {
144
+ const previous = 2 * ((x + 4) % 5);
145
+ const next = 2 * ((x + 1) % 5);
146
+ const rotatedLow = (columnParity[next] << 1) | (columnParity[next + 1] >>> 31);
147
+ const rotatedHigh = (columnParity[next + 1] << 1) | (columnParity[next] >>> 31);
148
+ thetaMix[2 * x] = columnParity[previous] ^ rotatedLow;
149
+ thetaMix[2 * x + 1] = columnParity[previous + 1] ^ rotatedHigh;
150
+ }
151
+ for (let x = 0; x < 5; x++) {
152
+ const word = 2 * x;
153
+ /**
154
+ * XOR, and it has to be XOR.
155
+ *
156
+ * `|=` is tempting here and is wrong: a lane that already has bits set, XORed with a
157
+ * theta value sharing any of those bits, clears them — OR keeps them. The 24-round
158
+ * control does not catch this, because it runs the BigInt path; only the comparison
159
+ * between the fast path and the readable model does.
160
+ */
161
+ const low = thetaMix[word];
162
+ const high = thetaMix[word + 1];
163
+ for (const target of [word, word + 10, word + 20, word + 30, word + 40]) {
164
+ state[target] = state[target] ^ low;
165
+ state[target + 1] = state[target + 1] ^ high;
166
+ }
167
+ }
168
+ rhoPiState[0] = state[0];
169
+ rhoPiState[1] = state[1];
170
+ for (let lane = 1; lane < 25; lane++) {
171
+ const source = 2 * lane;
172
+ const destination = RHO_PI_DESTINATION_WORDS[lane];
173
+ const amount = ROTATION_OFFSETS[lane];
174
+ const low = state[source];
175
+ const high = state[source + 1];
176
+ if (amount < 32) {
177
+ rhoPiState[destination] = (low << amount) | (high >>> (32 - amount));
178
+ rhoPiState[destination + 1] = (high << amount) | (low >>> (32 - amount));
179
+ }
180
+ else {
181
+ const reduced = amount - 32;
182
+ rhoPiState[destination] = (high << reduced) | (low >>> (32 - reduced));
183
+ rhoPiState[destination + 1] = (low << reduced) | (high >>> (32 - reduced));
184
+ }
185
+ }
186
+ for (let lane = 0; lane < 25; lane++) {
187
+ const word = 2 * lane;
188
+ const nextWord = CHI_NEXT_WORDS[lane];
189
+ const nextNextWord = CHI_NEXT_NEXT_WORDS[lane];
190
+ state[word] = rhoPiState[word] ^ (~rhoPiState[nextWord] & rhoPiState[nextNextWord]);
191
+ state[word + 1] = rhoPiState[word + 1] ^ (~rhoPiState[nextWord + 1] & rhoPiState[nextNextWord + 1]);
192
+ }
193
+ state[0] = state[0] ^ ROUND_CONSTANTS_LOW[round];
194
+ state[1] = state[1] ^ ROUND_CONSTANTS_HIGH[round];
195
+ }
196
+ }
197
+ function absorbFullUint32Block(state, bytes, offset, rhoPiState, columnParity, thetaMix, roundCount) {
198
+ for (let index = 0; index < RATE_BYTES; index++) {
199
+ state[index >>> 2] ^= bytes[offset + index] << ((index & 3) * 8);
200
+ }
201
+ keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, roundCount);
202
+ }
203
+ function digestStateToHex(state) {
204
+ let digest = '';
205
+ for (let index = 0; index < OUTPUT_BYTES; index++) {
206
+ const byte = (state[index >>> 2] >>> ((index & 3) * 8)) & 0xff;
207
+ digest += HEX_DIGITS[byte >>> 4] + HEX_DIGITS[byte & 0x0f];
208
+ }
209
+ return digest;
210
+ }
211
+ function sha3_256Uint32WithRoundCount(input, roundCount) {
212
+ const bytes = new TextEncoder().encode(input);
213
+ const state = new Uint32Array(50);
214
+ const rhoPiState = new Uint32Array(50);
215
+ const columnParity = new Uint32Array(10);
216
+ const thetaMix = new Uint32Array(10);
217
+ let offset = 0;
218
+ while (offset + RATE_BYTES <= bytes.length) {
219
+ absorbFullUint32Block(state, bytes, offset, rhoPiState, columnParity, thetaMix, roundCount);
220
+ offset += RATE_BYTES;
221
+ }
222
+ const remaining = bytes.length - offset;
223
+ for (let index = 0; index < remaining; index++) {
224
+ state[index >>> 2] ^= bytes[offset + index] << ((index & 3) * 8);
225
+ }
226
+ state[remaining >>> 2] ^= DOMAIN_SUFFIX << ((remaining & 3) * 8);
227
+ state[(RATE_BYTES - 1) >>> 2] ^= 0x80 << 24;
228
+ keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, roundCount);
229
+ return digestStateToHex(state);
230
+ }
231
+ /** `DeepSeekHashV1`, allocation-bounded. */
232
+ export function deepSeekHashV1(input) {
233
+ return sha3_256Uint32WithRoundCount(input, DEEPSEEK_HASH_ROUNDS);
234
+ }
235
+ function parseDigestWords(digestHex) {
236
+ const words = new Uint32Array(OUTPUT_BYTES / 4);
237
+ for (let index = 0; index < OUTPUT_BYTES; index++) {
238
+ const byte = Number.parseInt(digestHex.slice(index * 2, index * 2 + 2), 16);
239
+ words[index >>> 2] |= byte << ((index & 3) * 8);
240
+ }
241
+ return words;
242
+ }
243
+ /**
244
+ * Finds the nonce, or -1 if the range does not contain one.
245
+ *
246
+ * The prefix is absorbed **once** and the state is copied per candidate, so a 250 000-wide
247
+ * search re-encodes nothing. Inputs are validated here as well as at the solver boundary, so
248
+ * a hostile challenge cannot coerce this into an unbounded loop or an oversized allocation.
249
+ */
250
+ export function findDeepSeekPowNonce(prefix, challenge, difficulty) {
251
+ if (typeof prefix !== 'string')
252
+ throw new TypeError('DeepSeek PoW prefix must be a string');
253
+ if (!/^[a-f0-9]{64}$/i.test(challenge)) {
254
+ throw new TypeError('DeepSeek PoW challenge must be a 64-character hex digest');
255
+ }
256
+ if (!Number.isSafeInteger(difficulty) || difficulty < 1 || difficulty > MAX_DEEPSEEK_POW_DIFFICULTY) {
257
+ throw new RangeError(`DeepSeek PoW difficulty must be an integer from 1 to ${MAX_DEEPSEEK_POW_DIFFICULTY}`);
258
+ }
259
+ const prefixBytes = new TextEncoder().encode(prefix);
260
+ const baseState = new Uint32Array(50);
261
+ const rhoPiState = new Uint32Array(50);
262
+ const columnParity = new Uint32Array(10);
263
+ const thetaMix = new Uint32Array(10);
264
+ let prefixOffset = 0;
265
+ while (prefixOffset + RATE_BYTES <= prefixBytes.length) {
266
+ absorbFullUint32Block(baseState, prefixBytes, prefixOffset, rhoPiState, columnParity, thetaMix, DEEPSEEK_HASH_ROUNDS);
267
+ prefixOffset += RATE_BYTES;
268
+ }
269
+ const tailLength = prefixBytes.length - prefixOffset;
270
+ const tailWords = new Uint32Array(Math.ceil(tailLength / 4) + 1);
271
+ for (let index = 0; index < tailLength; index++) {
272
+ tailWords[index >>> 2] ^= prefixBytes[prefixOffset + index] << ((index & 3) * 8);
273
+ }
274
+ const targetWords = parseDigestWords(challenge.toLowerCase());
275
+ const state = new Uint32Array(50);
276
+ nonceLoop: for (let nonce = 0; nonce < difficulty; nonce++) {
277
+ state.set(baseState);
278
+ for (let word = 0; word < tailWords.length; word++)
279
+ state[word] ^= tailWords[word];
280
+ let position = tailLength;
281
+ const nonceText = String(nonce);
282
+ for (let index = 0; index < nonceText.length; index++) {
283
+ state[position >>> 2] ^= nonceText.charCodeAt(index) << ((position & 3) * 8);
284
+ position += 1;
285
+ if (position === RATE_BYTES) {
286
+ keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, DEEPSEEK_HASH_ROUNDS);
287
+ position = 0;
288
+ }
289
+ }
290
+ state[position >>> 2] ^= DOMAIN_SUFFIX << ((position & 3) * 8);
291
+ state[(RATE_BYTES - 1) >>> 2] ^= 0x80 << 24;
292
+ keccakP1600Uint32(state, rhoPiState, columnParity, thetaMix, DEEPSEEK_HASH_ROUNDS);
293
+ for (let word = 0; word < targetWords.length; word++) {
294
+ if (state[word] !== targetWords[word])
295
+ continue nonceLoop;
296
+ }
297
+ return nonce;
298
+ }
299
+ return -1;
300
+ }
301
+ //# sourceMappingURL=deepseek-pow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepseek-pow.js","sourceRoot":"","sources":["../../src/adapters/deepseek-pow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;AACnC,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,qEAAqE;AACrE,MAAM,gBAAgB,GAAG;IACvB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;CAC7F,CAAC;AAEF,MAAM,eAAe,GAAG;IACtB,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB;IAClF,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB;IAClF,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB;IAClF,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB;IAClF,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB;IAClF,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB;CACnF,CAAC;AAEF,MAAM,oB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3
+ * DeepSeek Web, driven by a `userToken` from a signed-in chat.deepseek.com.
4
+ *
5
+ * **No browser is needed for a turn.** The web client is an HTTP API behind a session token,
6
+ * so unlike ChatGPT Web this is a normal fetch with a bearer credential. A browser is only
7
+ * involved in *getting* the token, which the gateway does in a visible sign-in window.
8
+ *
9
+ * That difference is why this provider exists as it does: the fragile parts of a web-session
10
+ * provider are all in obtaining the credential, and the request path is plain.
11
+ *
12
+ * Two things make the request path non-obvious, and both are load-bearing:
13
+ *
14
+ * - **The token is exchanged, not used.** `userToken` only authorises `users/current`,
15
+ * which hands back a short-lived `accessToken` for everything else. Sending the userToken
16
+ * at the completion endpoint gets a 401 that looks like an expired session.
17
+ * - **Every completion is gated by a proof of work** — see `deepseek-pow.ts`. It is a
18
+ * bounded search, not a wall, and the answer goes in `X-Ds-Pow-Response`.
19
+ */
20
+ export declare const deepseekWebProviderId: ProviderId;
21
+ export declare const DEEPSEEK_WEB: {
22
+ readonly origin: "https://chat.deepseek.com";
23
+ readonly apiBase: "https://chat.deepseek.com/api";
24
+ /** The localStorage key the web client keeps its session token under. */
25
+ readonly tokenStorageKey: "userToken";
26
+ readonly navigationTimeoutMs: 60000;
27
+ };
28
+ /** Every id, plus the spelling variants that normalise to the same model. */
29
+ export declare function allDeepSeekWebModels(): string[];
30
+ /**
31
+ * Reads the token out of whatever the user pasted.
32
+ *
33
+ * DeepSeek stores it as `{"value":"…"}`, so a copy out of localStorage is sometimes the
34
+ * wrapper and sometimes the bare string. Accepting both is the difference between "paste it"
35
+ * working and "paste it" working only if you know to unwrap it first.
36
+ */
37
+ export declare function parseDeepSeekUserToken(raw: string): string;
38
+ export declare function deepSeekWebCredential(raw: string): ProviderCredential;
39
+ export declare class DeepSeekWebAdapter implements ProviderAdapter {
40
+ readonly id: string;
41
+ readonly name = "DeepSeek Web";
42
+ /**
43
+ * Streaming is not claimed. The upstream answer is an SSE stream, but every artifact this
44
+ * provider was built against describes a completed turn, and presenting a whole answer as
45
+ * a stream would imply tokens arriving over time when none were observed doing so.
46
+ */
47
+ readonly capabilities: {
48
+ readonly chat: true;
49
+ readonly streaming: false;
50
+ readonly models: true;
51
+ };
52
+ private readonly now;
53
+ private readonly fetchImpl;
54
+ /** Keyed by userToken, because the access token is per-account and lasts about an hour. */
55
+ private readonly accessTokens;
56
+ constructor(options?: {
57
+ now?: () => number;
58
+ fetch?: typeof fetch;
59
+ });
60
+ listModels(): Promise<Model[]>;
61
+ validateCredential(credential: ProviderCredential | undefined): Promise<CredentialValidation>;
62
+ /**
63
+ * Exchanges the userToken for a short-lived access token.
64
+ *
65
+ * The userToken authorises this call and nothing else. Cached for an hour because it is
66
+ * the same value for every request in that window, and a turn otherwise spends two
67
+ * round trips before it sends anything.
68
+ */
69
+ private accessToken;
70
+ /**
71
+ * Solves a fresh proof of work for the completion endpoint.
72
+ *
73
+ * A challenge per completion, not per session: the answer is bound to the target path and
74
+ * carries the challenge's own expiry, so caching one would be reusing spent work.
75
+ */
76
+ private proofOfWork;
77
+ private createSession;
78
+ chat(request: ChatRequest, context?: ProviderRequestContext): Promise<ChatResponse>;
79
+ }
80
+ /**
81
+ * Flattens a message list into the single prompt the endpoint takes.
82
+ *
83
+ * Labelled rather than concatenated, because a bare join of `["You are terse.", "2+2?"]`
84
+ * loses which was which.
85
+ */
86
+ export declare function flattenToPrompt(messages: ReadonlyArray<{
87
+ role: string;
88
+ text: string;
89
+ }>): string;
90
+ /**
91
+ * Reads a completed answer out of DeepSeek's SSE body.
92
+ *
93
+ * Two frame shapes arrive and both matter:
94
+ *
95
+ * ```json
96
+ * {"v":{"response":{"thinking_enabled":true,"fragments":[{"type":"THINK","content":"…"}]}}}
97
+ * {"p":"response/fragments","o":"append","v":[{"type":"ANSWER","content":"working"}]}
98
+ * ```
99
+ *
100
+ * The first is a whole response with its fragments inline. The second appends more, and those
101
+ * fragments often arrive **without a type**, addressed relative to the current message —
102
+ * which is why `thinking_enabled` from the last whole response decides which side of the
103
+ * reasoning/content split a bare fragment belongs to. Dropping that state and treating every
104
+ * append as the answer is how a model that thinks first ends up answering with its
105
+ * reasoning.
106
+ */
107
+ export declare function decodeDeepSeekAnswer(body: string): {
108
+ content: string;
109
+ reasoning: string;
110
+ };
111
+ //# sourceMappingURL=deepseek-web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepseek-web.d.ts","sourceRoot":"","sources":["../../src/adapters/deepseek-web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,WAAW,EACX,YAAY,EACZ,oBAAoB,EAEpB,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAGrB;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,qBAAqB,EAAE,UAA2B,CAAC;AA+BhE,eAAO,MAAM,YAAY;;;IAGvB,yEAAyE;;;CAGjE,CAAC;AA0BX,6EAA6E;AAC7E,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAOD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAiB1D;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAErE;AA+BD,qBAAa,kBAAmB,YAAW,eAAe;IACxD,QAAQ,CAAC,EAAE,SAAyB;IACpC,QAAQ,CAAC,IAAI,kBAAkB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,YAAY;;;;MAA2D;IAEhF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,2FAA2F;IAC3F,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;gBAEnD,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;KAAO;IAKhE,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAI9B,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,GAAG,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAOnG;;;;;;OAMG;YACW,WAAW;IA2BzB;;;;;OAKG;YACW,WAAW;YAwCX,aAAa;IAarB,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,YAAY,CAAC;CAqE9F;AAcD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAY/F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAgDzF"}
@@ -0,0 +1,473 @@
1
+ import { ProviderError } from '../errors.js';
2
+ import { MAX_DEEPSEEK_POW_DIFFICULTY, findDeepSeekPowNonce } from './deepseek-pow.js';
3
+ /**
4
+ * DeepSeek Web, driven by a `userToken` from a signed-in chat.deepseek.com.
5
+ *
6
+ * **No browser is needed for a turn.** The web client is an HTTP API behind a session token,
7
+ * so unlike ChatGPT Web this is a normal fetch with a bearer credential. A browser is only
8
+ * involved in *getting* the token, which the gateway does in a visible sign-in window.
9
+ *
10
+ * That difference is why this provider exists as it does: the fragile parts of a web-session
11
+ * provider are all in obtaining the credential, and the request path is plain.
12
+ *
13
+ * Two things make the request path non-obvious, and both are load-bearing:
14
+ *
15
+ * - **The token is exchanged, not used.** `userToken` only authorises `users/current`,
16
+ * which hands back a short-lived `accessToken` for everything else. Sending the userToken
17
+ * at the completion endpoint gets a 401 that looks like an expired session.
18
+ * - **Every completion is gated by a proof of work** — see `deepseek-pow.ts`. It is a
19
+ * bounded search, not a wall, and the answer goes in `X-Ds-Pow-Response`.
20
+ */
21
+ export const deepseekWebProviderId = 'deepseek-web';
22
+ const WEB_ORIGIN = 'https://chat.deepseek.com';
23
+ const API_BASE = `${WEB_ORIGIN}/api`;
24
+ const COMPLETION_URL = `${API_BASE}/v0/chat/completion`;
25
+ /**
26
+ * The fingerprint the web client sends on every `/api/v0/*` call.
27
+ *
28
+ * The header set is a bot-detection signal in itself, not decoration: the 2.0.0 web build
29
+ * dropped `X-App-Version` and added `X-Client-Bundle-Id`, so sending the *stale* stamp is
30
+ * itself suspicious. These are the ones the current build sends.
31
+ *
32
+ * `x-hif-leim`, a signed client-attestation token from obfuscated JS, is deliberately
33
+ * omitted — reproducing it means porting that JS, and the completion endpoint does not
34
+ * currently require it. If it ever does, requests will fail with a 401 that says nothing
35
+ * about attestation, which is when to come back to it.
36
+ */
37
+ const FINGERPRINT_HEADERS = {
38
+ Accept: '*/*',
39
+ 'Accept-Language': 'en-US,en;q=0.9',
40
+ Origin: WEB_ORIGIN,
41
+ Referer: `${WEB_ORIGIN}/`,
42
+ 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36',
43
+ 'X-Client-Bundle-Id': 'com.deepseek.chat',
44
+ 'X-Client-Locale': 'en-US',
45
+ 'X-Client-Platform': 'web',
46
+ 'X-Client-Version': '2.0.0',
47
+ };
48
+ export const DEEPSEEK_WEB = {
49
+ origin: WEB_ORIGIN,
50
+ apiBase: API_BASE,
51
+ /** The localStorage key the web client keeps its session token under. */
52
+ tokenStorageKey: 'userToken',
53
+ navigationTimeoutMs: 60_000,
54
+ };
55
+ /**
56
+ * The models chat.deepseek.com serves.
57
+ *
58
+ * Two axes, and both are in the id rather than a separate parameter: `think` and `search`
59
+ * are model variants the page offers, not request options. A Pro model is `model_type:
60
+ * "expert"`; everything else is `"default"`.
61
+ */
62
+ const DEEPSEEK_WEB_MODELS = [
63
+ { id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro', expert: true, thinking: false, search: false },
64
+ { id: 'deepseek-v4-pro-think', name: 'DeepSeek V4 Pro Think', expert: true, thinking: true, search: false },
65
+ { id: 'deepseek-v4-pro-search', name: 'DeepSeek V4 Pro Search', expert: true, thinking: false, search: true },
66
+ { id: 'deepseek-v4-pro-think-search', name: 'DeepSeek V4 Pro Think+Search', expert: true, thinking: true, search: true },
67
+ { id: 'deepseek-v4-flash', name: 'DeepSeek V4 Flash', expert: false, thinking: false, search: false },
68
+ { id: 'deepseek-v4-flash-think', name: 'DeepSeek V4 Flash Think', expert: false, thinking: true, search: false },
69
+ { id: 'deepseek-v4-flash-search', name: 'DeepSeek V4 Flash Search', expert: false, thinking: false, search: true },
70
+ { id: 'deepseek-v4-flash-think-search', name: 'DeepSeek V4 Flash Think+Search', expert: false, thinking: true, search: true },
71
+ { id: 'deepseek-chat', name: 'DeepSeek Chat', expert: false, thinking: false, search: false },
72
+ { id: 'deepseek-reasoner', name: 'DeepSeek Reasoner', expert: false, thinking: true, search: false },
73
+ { id: 'DeepSeek-R1', name: 'DeepSeek R1', expert: false, thinking: true, search: false },
74
+ { id: 'DeepSeek-R1-Search', name: 'DeepSeek R1 Search', expert: false, thinking: true, search: true },
75
+ { id: 'DeepSeek-V3.2', name: 'DeepSeek V3.2', expert: false, thinking: false, search: false },
76
+ { id: 'DeepSeek-Search', name: 'DeepSeek Search', expert: false, thinking: false, search: true },
77
+ ];
78
+ /** Every id, plus the spelling variants that normalise to the same model. */
79
+ export function allDeepSeekWebModels() {
80
+ return DEEPSEEK_WEB_MODELS.map((model) => model.id);
81
+ }
82
+ function lookupModel(id) {
83
+ const wanted = id.trim().toLowerCase();
84
+ return DEEPSEEK_WEB_MODELS.find((model) => model.id.toLowerCase() === wanted);
85
+ }
86
+ /**
87
+ * Reads the token out of whatever the user pasted.
88
+ *
89
+ * DeepSeek stores it as `{"value":"…"}`, so a copy out of localStorage is sometimes the
90
+ * wrapper and sometimes the bare string. Accepting both is the difference between "paste it"
91
+ * working and "paste it" working only if you know to unwrap it first.
92
+ */
93
+ export function parseDeepSeekUserToken(raw) {
94
+ const trimmed = raw.trim();
95
+ if (!trimmed) {
96
+ throw new ProviderError('INVALID_REQUEST', 'Paste the userToken from chat.deepseek.com.', {
97
+ providerId: deepseekWebProviderId,
98
+ publicMessage: 'Paste the userToken from chat.deepseek.com.',
99
+ });
100
+ }
101
+ if (trimmed.startsWith('{')) {
102
+ try {
103
+ const parsed = JSON.parse(trimmed);
104
+ if (typeof parsed.value === 'string' && parsed.value.trim())
105
+ return parsed.value.trim();
106
+ }
107
+ catch {
108
+ // Not the wrapper after all; fall through to the raw value.
109
+ }
110
+ }
111
+ return trimmed;
112
+ }
113
+ export function deepSeekWebCredential(raw) {
114
+ return { type: 'api-key', value: parseDeepSeekUserToken(raw) };
115
+ }
116
+ function userTokenFromCredential(credential) {
117
+ if (!credential || credential.type !== 'api-key' || !credential.value.trim()) {
118
+ throw new ProviderError('AUTHENTICATION_FAILED', 'This DeepSeek Web connection has no userToken.', {
119
+ providerId: deepseekWebProviderId,
120
+ publicMessage: 'This DeepSeek Web connection has no userToken. Sign in again.',
121
+ });
122
+ }
123
+ return credential.value.trim();
124
+ }
125
+ /** One place to build a provider error, so every failure carries the id and the public message. */
126
+ function fail(code, message) {
127
+ return new ProviderError(code, message, { providerId: deepseekWebProviderId, publicMessage: message });
128
+ }
129
+ /** DeepSeek wraps every response in `{ code, msg, data: { biz_data } }` and `code !== 0` means trouble. */
130
+ function unwrap(json, what) {
131
+ const body = (json ?? {});
132
+ if (typeof body.code === 'number' && body.code !== 0) {
133
+ const message = typeof body.msg === 'string' && body.msg ? body.msg : (body.data?.biz_msg ?? `error code ${body.code}`);
134
+ throw fail('PROVIDER_REQUEST_FAILED', `DeepSeek rejected the ${what}: ${message}`);
135
+ }
136
+ const biz = body.data?.biz_data;
137
+ if (!biz || typeof biz !== 'object')
138
+ throw fail('PROVIDER_REQUEST_FAILED', `DeepSeek returned no data for the ${what}.`);
139
+ return biz;
140
+ }
141
+ export class DeepSeekWebAdapter {
142
+ id = deepseekWebProviderId;
143
+ name = 'DeepSeek Web';
144
+ /**
145
+ * Streaming is not claimed. The upstream answer is an SSE stream, but every artifact this
146
+ * provider was built against describes a completed turn, and presenting a whole answer as
147
+ * a stream would imply tokens arriving over time when none were observed doing so.
148
+ */
149
+ capabilities = { chat: true, streaming: false, models: true };
150
+ now;
151
+ fetchImpl;
152
+ /** Keyed by userToken, because the access token is per-account and lasts about an hour. */
153
+ accessTokens = new Map();
154
+ constructor(options = {}) {
155
+ this.now = options.now ?? (() => Date.now());
156
+ this.fetchImpl = options.fetch ?? fetch;
157
+ }
158
+ async listModels() {
159
+ return DEEPSEEK_WEB_MODELS.map((model) => ({ id: model.id, providerId: this.id, displayName: model.name }));
160
+ }
161
+ async validateCredential(credential) {
162
+ // A real call, because a token's only meaningful test is whether DeepSeek accepts it.
163
+ // Cheap: `users/current` is a single round trip and needs no proof of work.
164
+ await this.accessToken(userTokenFromCredential(credential), undefined);
165
+ return { status: 'valid', checkedAt: new Date(this.now()).toISOString() };
166
+ }
167
+ /**
168
+ * Exchanges the userToken for a short-lived access token.
169
+ *
170
+ * The userToken authorises this call and nothing else. Cached for an hour because it is
171
+ * the same value for every request in that window, and a turn otherwise spends two
172
+ * round trips before it sends anything.
173
+ */
174
+ async accessToken(userToken, signal) {
175
+ const cached = this.accessTokens.get(userToken);
176
+ if (cached && cached.expiresAt > this.now())
177
+ return cached.token;
178
+ const response = await this.fetchImpl(`${API_BASE}/v0/users/current`, {
179
+ method: 'GET',
180
+ headers: { ...FINGERPRINT_HEADERS, Authorization: `Bearer ${userToken}` },
181
+ ...(signal ? { signal } : {}),
182
+ });
183
+ if (response.status === 401 || response.status === 403) {
184
+ throw fail('AUTHENTICATION_FAILED', 'DeepSeek rejected that userToken. Sign in to chat.deepseek.com again and export a fresh one — a token from another account or a signed-out session looks exactly like this.');
185
+ }
186
+ if (!response.ok)
187
+ throw fail('PROVIDER_UNAVAILABLE', `chat.deepseek.com answered ${response.status} for the userToken.`);
188
+ const biz = unwrap(await response.json(), 'sign-in');
189
+ const token = biz.token;
190
+ if (typeof token !== 'string' || !token) {
191
+ throw fail('AUTHENTICATION_FAILED', 'DeepSeek accepted the request but returned no access token.');
192
+ }
193
+ // A minute of slack, so a token cannot expire between the check and the request.
194
+ this.accessTokens.set(userToken, { token, expiresAt: this.now() + 55 * 60_000 });
195
+ return token;
196
+ }
197
+ /**
198
+ * Solves a fresh proof of work for the completion endpoint.
199
+ *
200
+ * A challenge per completion, not per session: the answer is bound to the target path and
201
+ * carries the challenge's own expiry, so caching one would be reusing spent work.
202
+ */
203
+ async proofOfWork(accessToken, signal) {
204
+ const response = await this.fetchImpl(`${API_BASE}/v0/chat/create_pow_challenge`, {
205
+ method: 'POST',
206
+ headers: { ...FINGERPRINT_HEADERS, 'Content-Type': 'application/json', Authorization: `Bearer ${accessToken}` },
207
+ body: JSON.stringify({ target_path: '/api/v0/chat/completion' }),
208
+ ...(signal ? { signal } : {}),
209
+ });
210
+ if (!response.ok)
211
+ throw fail('PROVIDER_UNAVAILABLE', `DeepSeek would not issue a proof of work (${response.status}).`);
212
+ const challenge = unwrap(await response.json(), 'proof of work').challenge;
213
+ if (!challenge?.challenge || typeof challenge.salt !== 'string' || typeof challenge.difficulty !== 'number') {
214
+ throw fail('PROVIDER_REQUEST_FAILED', 'DeepSeek returned a proof-of-work challenge with no answer in it.');
215
+ }
216
+ if (challenge.algorithm !== undefined && challenge.algorithm !== 'DeepSeekHashV1') {
217
+ // A new hash would silently produce a wrong answer, which DeepSeek reports as a plain
218
+ // 401. Saying which algorithm arrived is the difference between a fixable error and a
219
+ // mystery.
220
+ throw fail('PROVIDER_REQUEST_FAILED', `DeepSeek changed its proof-of-work algorithm to ${challenge.algorithm}; this version solves DeepSeekHashV1.`);
221
+ }
222
+ const prefix = `${challenge.salt}_${challenge.expire_at ?? 0}_`;
223
+ const nonce = findDeepSeekPowNonce(prefix, challenge.challenge, Math.min(challenge.difficulty, MAX_DEEPSEEK_POW_DIFFICULTY));
224
+ if (nonce < 0) {
225
+ throw fail('PROVIDER_REQUEST_FAILED', `DeepSeek's proof of work had no answer within the range it announced (${challenge.difficulty}). The challenge may have expired before it was solved.`);
226
+ }
227
+ return Buffer.from(JSON.stringify({
228
+ algorithm: challenge.algorithm ?? 'DeepSeekHashV1',
229
+ challenge: challenge.challenge,
230
+ salt: challenge.salt,
231
+ answer: nonce,
232
+ signature: challenge.signature,
233
+ target_path: challenge.target_path ?? '/api/v2/chat/completion',
234
+ })).toString('base64');
235
+ }
236
+ async createSession(accessToken, signal) {
237
+ const response = await this.fetchImpl(`${API_BASE}/v0/chat_session/create`, {
238
+ method: 'POST',
239
+ headers: { ...FINGERPRINT_HEADERS, 'Content-Type': 'application/json', Authorization: `Bearer ${accessToken}` },
240
+ body: JSON.stringify({}),
241
+ ...(signal ? { signal } : {}),
242
+ });
243
+ if (!response.ok)
244
+ throw fail('PROVIDER_UNAVAILABLE', `DeepSeek would not start a chat session (${response.status}).`);
245
+ const session = unwrap(await response.json(), 'chat session').chat_session;
246
+ if (!session?.id)
247
+ throw fail('PROVIDER_REQUEST_FAILED', 'DeepSeek started no chat session.');
248
+ return session.id;
249
+ }
250
+ async chat(request, context = {}) {
251
+ const model = lookupModel(request.model);
252
+ if (!model) {
253
+ throw new ProviderError('NOT_SUPPORTED', `DeepSeek Web does not offer a model called ${request.model}.`, {
254
+ providerId: this.id,
255
+ publicMessage: `DeepSeek Web does not offer a model called ${request.model}. The models it serves are the ones on this page.`,
256
+ });
257
+ }
258
+ const userToken = userTokenFromCredential(context.credential);
259
+ const accessToken = await this.accessToken(userToken, context.signal);
260
+ const sessionId = await this.createSession(accessToken, context.signal);
261
+ const pow = await this.proofOfWork(accessToken, context.signal);
262
+ /**
263
+ * The endpoint takes one flat `prompt`, not a message array.
264
+ *
265
+ * History is flattened into it: a system turn is prefixed as an instruction and earlier
266
+ * turns are labelled, because there is nowhere else to put them. Dropping them silently
267
+ * would answer the last line and look like it had read the rest.
268
+ */
269
+ const prompt = flattenToPrompt(request.messages.map((message) => ({ role: message.role, text: messageText(message.content) })));
270
+ const response = await this.fetchImpl(COMPLETION_URL, {
271
+ method: 'POST',
272
+ headers: {
273
+ ...FINGERPRINT_HEADERS,
274
+ 'Content-Type': 'application/json',
275
+ Authorization: `Bearer ${accessToken}`,
276
+ 'X-Ds-Pow-Response': pow,
277
+ 'X-Client-Timezone-Offset': String(new Date().getTimezoneOffset() * -60),
278
+ },
279
+ body: JSON.stringify({
280
+ chat_session_id: sessionId,
281
+ parent_message_id: null,
282
+ model_type: model.expert ? 'expert' : 'default',
283
+ prompt,
284
+ ref_file_ids: [],
285
+ thinking_enabled: model.thinking,
286
+ search_enabled: model.search,
287
+ preempt: false,
288
+ }),
289
+ ...(context.signal ? { signal: context.signal } : {}),
290
+ });
291
+ if (response.status === 401 || response.status === 403) {
292
+ this.accessTokens.delete(userToken);
293
+ throw fail('AUTHENTICATION_FAILED', 'DeepSeek refused the request. The session may have ended — sign in again.');
294
+ }
295
+ if (!response.ok)
296
+ throw fail('PROVIDER_UNAVAILABLE', `DeepSeek answered ${response.status} for the completion.`);
297
+ const answer = decodeDeepSeekAnswer(await readBodyCapped(response, context.signal));
298
+ if (!answer.content) {
299
+ throw fail('PROVIDER_REQUEST_FAILED', 'DeepSeek answered, but the stream carried no text. Its response format may have changed.');
300
+ }
301
+ const message = {
302
+ role: 'assistant',
303
+ content: answer.content,
304
+ ...(answer.reasoning ? { reasoningContent: answer.reasoning } : {}),
305
+ };
306
+ return {
307
+ id: `chatcmpl-${Math.floor(this.now() / 1000)}-${Math.random().toString(36).slice(2, 8)}`,
308
+ providerId: this.id,
309
+ model: model.id,
310
+ createdAt: new Date(this.now()).toISOString(),
311
+ message,
312
+ finishReason: 'stop',
313
+ };
314
+ }
315
+ }
316
+ function messageText(content) {
317
+ if (typeof content === 'string')
318
+ return content;
319
+ if (!Array.isArray(content))
320
+ return '';
321
+ return content
322
+ .map((part) => {
323
+ if (typeof part === 'string')
324
+ return part;
325
+ if (part && typeof part === 'object' && 'text' in part)
326
+ return String(part.text ?? '');
327
+ return '';
328
+ })
329
+ .join('');
330
+ }
331
+ /**
332
+ * Flattens a message list into the single prompt the endpoint takes.
333
+ *
334
+ * Labelled rather than concatenated, because a bare join of `["You are terse.", "2+2?"]`
335
+ * loses which was which.
336
+ */
337
+ export function flattenToPrompt(messages) {
338
+ const kept = messages.filter((message) => message.text.trim());
339
+ const system = kept.filter((message) => message.role === 'system');
340
+ const rest = kept.filter((message) => message.role !== 'system');
341
+ const lines = [];
342
+ if (system.length > 0) {
343
+ lines.push('Follow these instructions:', ...system.map((message) => `- ${message.text.trim()}`), '');
344
+ }
345
+ for (const message of rest) {
346
+ lines.push(`${message.role === 'assistant' ? 'Assistant' : 'User'}: ${message.text.trim()}`);
347
+ }
348
+ return lines.join('\n').trim();
349
+ }
350
+ /**
351
+ * Reads a completed answer out of DeepSeek's SSE body.
352
+ *
353
+ * Two frame shapes arrive and both matter:
354
+ *
355
+ * ```json
356
+ * {"v":{"response":{"thinking_enabled":true,"fragments":[{"type":"THINK","content":"…"}]}}}
357
+ * {"p":"response/fragments","o":"append","v":[{"type":"ANSWER","content":"working"}]}
358
+ * ```
359
+ *
360
+ * The first is a whole response with its fragments inline. The second appends more, and those
361
+ * fragments often arrive **without a type**, addressed relative to the current message —
362
+ * which is why `thinking_enabled` from the last whole response decides which side of the
363
+ * reasoning/content split a bare fragment belongs to. Dropping that state and treating every
364
+ * append as the answer is how a model that thinks first ends up answering with its
365
+ * reasoning.
366
+ */
367
+ export function decodeDeepSeekAnswer(body) {
368
+ let content = '';
369
+ let reasoning = '';
370
+ // Which side an untyped append belongs to, from the last whole response that said so.
371
+ let currentPath = 'content';
372
+ const take = (fragment, typed) => {
373
+ if (!fragment || typeof fragment !== 'object')
374
+ return;
375
+ const record = fragment;
376
+ if (typeof record.content !== 'string' || record.content.length === 0)
377
+ return;
378
+ if (typed) {
379
+ const type = String(record.type ?? '').toUpperCase();
380
+ if (type === 'THINK')
381
+ currentPath = 'thinking';
382
+ else if (type === 'ANSWER' || type === 'RESPONSE')
383
+ currentPath = 'content';
384
+ }
385
+ if (currentPath === 'thinking')
386
+ reasoning += record.content;
387
+ else
388
+ content += record.content;
389
+ };
390
+ for (const rawLine of body.replace(/\r\n?/g, '\n').split('\n')) {
391
+ const line = rawLine.trim();
392
+ if (!line.startsWith('data:'))
393
+ continue;
394
+ const payload = line.slice(5).trim();
395
+ if (!payload || payload === '[DONE]')
396
+ continue;
397
+ let parsed;
398
+ try {
399
+ parsed = JSON.parse(payload);
400
+ }
401
+ catch {
402
+ continue;
403
+ }
404
+ if (typeof parsed !== 'object' || parsed === null)
405
+ continue;
406
+ const frame = parsed;
407
+ const value = frame.v;
408
+ // A whole response: it declares the path and carries its own fragments.
409
+ if (value && typeof value === 'object' && !Array.isArray(value) && 'response' in value) {
410
+ const response = value.response;
411
+ if (response.thinking_enabled === true)
412
+ currentPath = 'thinking';
413
+ else if (response.thinking_enabled === false)
414
+ currentPath = 'content';
415
+ if (Array.isArray(response.fragments))
416
+ for (const fragment of response.fragments)
417
+ take(fragment, true);
418
+ }
419
+ if (frame.p === 'response/fragments') {
420
+ if (Array.isArray(value))
421
+ for (const fragment of value)
422
+ take(fragment, true);
423
+ else
424
+ take(value, false);
425
+ }
426
+ }
427
+ return { content: content.trim(), reasoning: reasoning.trim() };
428
+ }
429
+ /**
430
+ * Reads the whole body, with a cap.
431
+ *
432
+ * The cap is not paranoia about a hostile server so much as about an endless one: a stream
433
+ * that never terminates will grow a buffer until the process is killed, and the failure then
434
+ * reads as an out-of-memory crash rather than as an upstream that never finished.
435
+ */
436
+ const MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
437
+ async function readBodyCapped(response, signal) {
438
+ const body = response.body;
439
+ if (!body)
440
+ return response.text();
441
+ const reader = body.getReader();
442
+ const decoder = new TextDecoder();
443
+ const chunks = [];
444
+ let total = 0;
445
+ try {
446
+ for (;;) {
447
+ if (signal?.aborted)
448
+ throw new DOMException('Aborted', 'AbortError');
449
+ const { done, value } = await reader.read();
450
+ if (done)
451
+ break;
452
+ if (!value)
453
+ continue;
454
+ total += value.byteLength;
455
+ if (total > MAX_RESPONSE_BYTES) {
456
+ await reader.cancel().catch(() => undefined);
457
+ throw fail('PROVIDER_REQUEST_FAILED', 'DeepSeek’s answer grew past 8 MB and was cut off.');
458
+ }
459
+ chunks.push(decoder.decode(value, { stream: true }));
460
+ }
461
+ chunks.push(decoder.decode());
462
+ }
463
+ finally {
464
+ try {
465
+ reader.releaseLock();
466
+ }
467
+ catch {
468
+ // Already released after a cancellation.
469
+ }
470
+ }
471
+ return chunks.join('');
472
+ }
473
+ //# sourceMappingURL=deepseek-web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepseek-web.js","sourceRoot":"","sources":["../../src/adapters/deepseek-web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAa7C,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEtF;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAe,cAAc,CAAC;AAEhE,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAC/C,MAAM,QAAQ,GAAG,GAAG,UAAU,MAAM,CAAC;AACrC,MAAM,cAAc,GAAG,GAAG,QAAQ,qBAAqB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,mBAAmB,GAAqC;IAC5D,MAAM,EAAE,KAAK;IACb,iBAAiB,EAAE,gBAAgB;IACnC,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,GAAG,UAAU,GAAG;IACzB,YAAY,EACV,uHAAuH;IACzH,oBAAoB,EAAE,mBAAmB;IACzC,iBAAiB,EAAE,OAAO;IAC1B,mBAAmB,EAAE,KAAK;IAC1B,kBAAkB,EAAE,OAAO;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,G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E,OAAO;gBAAE,MAAM,IAAI,YAAY,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;YACrE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,IAAI;gBAAE,MAAM;YAChB,IAAI,CAAC,KAAK;gBAAE,SAAS;YACrB,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC;YAC1B,IAAI,KAAK,GAAG,kBAAkB,EAAE,CAAC;gBAC/B,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;gBAC7C,MAAM,IAAI,CAAC,yBAAyB,EAAE,mDAAmD,CAAC,CAAC;YAC7F,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACvD,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAChC,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,yCAAyC;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -16,5 +16,7 @@ export * from './adapters/zen.js';
16
16
  export * from './adapters/opencode-console.js';
17
17
  export * from './adapters/kiro.js';
18
18
  export * from './adapters/chatgpt-web.js';
19
+ export * from './adapters/deepseek-pow.js';
20
+ export * from './adapters/deepseek-web.js';
19
21
  export * from './url.js';
20
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -16,5 +16,7 @@ export * from './adapters/zen.js';
16
16
  export * from './adapters/opencode-console.js';
17
17
  export * from './adapters/kiro.js';
18
18
  export * from './adapters/chatgpt-web.js';
19
+ export * from './adapters/deepseek-pow.js';
20
+ export * from './adapters/deepseek-web.js';
19
21
  export * from './url.js';
20
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hilbras/omnihilbras",
3
- "version": "1.7.0",
3
+ "version": "1.8.1",
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",