dsh-lcx-codex 0.4.2 → 0.4.3-pre.13
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 +75 -224
- package/THIRD_PARTY_NOTICES.md +64 -0
- package/cordis.patch.yml +3 -20
- package/lib/auxiliary-usage.js +63 -0
- package/lib/client.js +1398 -167
- package/lib/compact-v2.js +218 -199
- package/lib/dsh-compat.js +294 -100
- package/lib/dsh-responses.js +512 -277
- package/lib/grok-native-search.js +391 -0
- package/lib/index.js +1066 -758
- package/lib/invocation-policy-scope.js +261 -0
- package/lib/json-store.js +57 -31
- package/lib/native-checkpoint.js +520 -194
- package/lib/pi-responses-runtime.js +1571 -0
- package/lib/responses-request.js +109 -121
- package/lib/responses-stream.js +1280 -447
- package/lib/route.js +425 -369
- package/lib/search-accounting.js +86 -0
- package/lib/search-usage.js +86 -0
- package/lib/service-mutex.js +73 -64
- package/lib/token-budget.js +176 -108
- package/lib/transport.js +308 -68
- package/lib/types/client/index.d.ts +18 -0
- package/lib/types/client/search-media.d.ts +16 -0
- package/lib/types/index.d.ts +83 -0
- package/lib/web-run-output.js +189 -18
- package/lib/web-search-alpha.js +1067 -163
- package/lib/web-search-capability.js +80 -65
- package/lib/web-search-hosted.js +321 -33
- package/lib/web-search-ref-store.js +145 -60
- package/package.json +112 -32
- package/ARCHITECTURE.md +0 -117
- package/CHANGELOG.md +0 -224
- package/README_EN.md +0 -277
- package/assets/dsh-lcx-codex-banner.jpg +0 -0
- package/lib/legacy-v3.js +0 -20
- package/lib/responses-replay.js +0 -68
- package/scripts/probe-alpha.mjs +0 -43
- package/scripts/validate-dsh-schema.mjs +0 -31
package/lib/transport.js
CHANGED
|
@@ -1,81 +1,321 @@
|
|
|
1
|
-
const DEFAULT_TIMEOUT_MS = 300_000
|
|
2
|
-
const DEFAULT_MAX_BYTES = 8 * 1024 * 1024
|
|
3
|
-
|
|
1
|
+
const DEFAULT_TIMEOUT_MS = 300_000;
|
|
2
|
+
const DEFAULT_MAX_BYTES = 8 * 1024 * 1024;
|
|
3
|
+
const MAX_ERROR_BYTES = 512 * 1024;
|
|
4
|
+
function errorFacts(value) {
|
|
5
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
6
|
+
}
|
|
4
7
|
export function abortIfNeeded(signal) {
|
|
5
|
-
|
|
8
|
+
if (signal?.aborted)
|
|
9
|
+
throw (signal.reason ??
|
|
10
|
+
Object.assign(new Error("request aborted"), { code: "LCX_ABORTED" }));
|
|
11
|
+
}
|
|
12
|
+
function makeError(message, code, extra = {}) {
|
|
13
|
+
const error = new Error(message);
|
|
14
|
+
error.code = code;
|
|
15
|
+
Object.assign(error, extra);
|
|
16
|
+
return error;
|
|
17
|
+
}
|
|
18
|
+
function retryableStatus(status) {
|
|
19
|
+
return (status === 408 ||
|
|
20
|
+
status === 409 ||
|
|
21
|
+
status === 425 ||
|
|
22
|
+
status === 429 ||
|
|
23
|
+
(status >= 500 && status <= 599));
|
|
24
|
+
}
|
|
25
|
+
// Retain only an allowlisted class, never upstream messages or account balances.
|
|
26
|
+
function isQuotaError(text) {
|
|
27
|
+
try {
|
|
28
|
+
const code = JSON.parse(text)?.error?.code;
|
|
29
|
+
return code === "insufficient_user_quota" || code === "insufficient_quota";
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
6
34
|
}
|
|
7
|
-
function makeError(message, code, extra = {}) { const error = new Error(message); error.code = code; Object.assign(error, extra); return error }
|
|
8
|
-
function retryableStatus(status) { return status === 408 || status === 409 || status === 425 || status === 429 || (status >= 500 && status <= 599) }
|
|
9
35
|
function retryAfterFromHeaders(headers) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
36
|
+
const rawMillis = headers?.get?.("retry-after-ms");
|
|
37
|
+
const millis = Number(rawMillis);
|
|
38
|
+
if (rawMillis !== null &&
|
|
39
|
+
rawMillis !== undefined &&
|
|
40
|
+
rawMillis !== "" &&
|
|
41
|
+
Number.isFinite(millis) &&
|
|
42
|
+
millis >= 0)
|
|
43
|
+
return Math.min(millis, 30_000);
|
|
44
|
+
const retryAfter = headers?.get?.("retry-after");
|
|
45
|
+
if (retryAfter) {
|
|
46
|
+
const seconds = Number(retryAfter);
|
|
47
|
+
if (Number.isFinite(seconds) && seconds >= 0)
|
|
48
|
+
return Math.min(seconds * 1000, 30_000);
|
|
49
|
+
const date = Date.parse(retryAfter);
|
|
50
|
+
if (!Number.isNaN(date))
|
|
51
|
+
return Math.min(Math.max(0, date - Date.now()), 30_000);
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
13
54
|
}
|
|
14
55
|
function delayFromHeaders(headers, attempt) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
56
|
+
const retryAfter = retryAfterFromHeaders(headers);
|
|
57
|
+
if (retryAfter !== undefined)
|
|
58
|
+
return retryAfter;
|
|
59
|
+
return Math.min(10_000, 500 * 2 ** Math.max(0, attempt - 1));
|
|
18
60
|
}
|
|
19
|
-
async function sleep(ms, signal) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
61
|
+
async function sleep(ms, signal) {
|
|
62
|
+
if (ms === undefined || ms <= 0)
|
|
63
|
+
return;
|
|
64
|
+
await new Promise((resolve, reject) => {
|
|
65
|
+
if (signal?.aborted)
|
|
66
|
+
return reject(signal.reason);
|
|
67
|
+
const onAbort = () => {
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
signal?.removeEventListener("abort", onAbort);
|
|
70
|
+
reject(signal?.reason);
|
|
71
|
+
};
|
|
72
|
+
const timer = setTimeout(() => {
|
|
73
|
+
signal?.removeEventListener("abort", onAbort);
|
|
74
|
+
resolve();
|
|
75
|
+
}, ms);
|
|
76
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function combinedSignal(signal, timeoutMs) {
|
|
80
|
+
if (!(typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0))
|
|
81
|
+
return signal;
|
|
82
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
83
|
+
return signal ? AbortSignal.any([signal, timeout]) : timeout;
|
|
84
|
+
}
|
|
85
|
+
async function readLimited(response, maxBytes = DEFAULT_MAX_BYTES) {
|
|
86
|
+
if (!response.body)
|
|
87
|
+
return "";
|
|
88
|
+
const reader = response.body.getReader();
|
|
89
|
+
const decoder = new TextDecoder();
|
|
90
|
+
let bytes = 0;
|
|
91
|
+
let text = "";
|
|
27
92
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
93
|
+
while (true) {
|
|
94
|
+
const { done, value } = await reader.read();
|
|
95
|
+
if (done)
|
|
96
|
+
return text + decoder.decode();
|
|
97
|
+
bytes += value.byteLength;
|
|
98
|
+
if (bytes > maxBytes)
|
|
99
|
+
throw makeError(`response exceeds ${maxBytes} bytes`, "LCX_RESPONSE_TOO_LARGE", { status: response.status });
|
|
100
|
+
text += decoder.decode(value, { stream: true });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
try {
|
|
105
|
+
await reader.cancel();
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// Cleanup must not replace the read/size error.
|
|
109
|
+
}
|
|
110
|
+
reader.releaseLock();
|
|
45
111
|
}
|
|
46
|
-
}
|
|
47
|
-
throw last ?? makeError('request failed', 'LCX_REQUEST_FAILED')
|
|
48
112
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
113
|
+
export async function fetchJsonWithRetry(url, body, headers = {}, signal, timeoutMs = DEFAULT_TIMEOUT_MS, options = {}) {
|
|
114
|
+
const maxAttempts = Math.max(1, Math.min(6, Number(options.maxAttempts ?? 3)));
|
|
115
|
+
const maxResponseBytes = options.maxResponseBytes ?? DEFAULT_MAX_BYTES;
|
|
116
|
+
let last;
|
|
117
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
118
|
+
abortIfNeeded(signal);
|
|
119
|
+
try {
|
|
120
|
+
const requestSignal = combinedSignal(signal, timeoutMs);
|
|
121
|
+
const response = await fetch(url, {
|
|
122
|
+
method: "POST",
|
|
123
|
+
headers: {
|
|
124
|
+
"content-type": "application/json",
|
|
125
|
+
accept: "application/json",
|
|
126
|
+
...headers,
|
|
127
|
+
},
|
|
128
|
+
body: JSON.stringify(body),
|
|
129
|
+
signal: requestSignal,
|
|
130
|
+
redirect: "error",
|
|
131
|
+
});
|
|
132
|
+
const text = await readLimited(response, response.ok ? maxResponseBytes : Math.min(maxResponseBytes, MAX_ERROR_BYTES));
|
|
133
|
+
if (!response.ok) {
|
|
134
|
+
const quota = isQuotaError(text);
|
|
135
|
+
const retryable = !quota && retryableStatus(response.status);
|
|
136
|
+
const providerRetryAfterMs = retryAfterFromHeaders(response.headers);
|
|
137
|
+
const error = makeError(`HTTP ${response.status}`, quota ? "LCX_INSUFFICIENT_QUOTA" : retryable ? "LCX_HTTP_RETRYABLE" : "LCX_HTTP_ERROR", {
|
|
138
|
+
status: response.status,
|
|
139
|
+
retryable,
|
|
140
|
+
requestId: response.headers.get("x-request-id") ??
|
|
141
|
+
response.headers.get("request-id") ??
|
|
142
|
+
undefined,
|
|
143
|
+
...(providerRetryAfterMs === undefined
|
|
144
|
+
? {}
|
|
145
|
+
: { providerRetryAfterMs }),
|
|
146
|
+
});
|
|
147
|
+
if (!error.retryable || attempt >= maxAttempts)
|
|
148
|
+
throw error;
|
|
149
|
+
last = error;
|
|
150
|
+
await sleep(delayFromHeaders(response.headers, attempt), signal);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
let parsed;
|
|
154
|
+
try {
|
|
155
|
+
parsed = text ? JSON.parse(text) : {};
|
|
156
|
+
}
|
|
157
|
+
catch (cause) {
|
|
158
|
+
throw makeError(`invalid JSON response from ${url}`, "LCX_INVALID_JSON", { status: response.status, cause });
|
|
159
|
+
}
|
|
160
|
+
return parsed;
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
if (signal?.aborted)
|
|
164
|
+
throw signal.reason ?? error;
|
|
165
|
+
const details = errorFacts(error);
|
|
166
|
+
const retryable = details.retryable === true ||
|
|
167
|
+
details.code === "LCX_HTTP_RETRYABLE" ||
|
|
168
|
+
error instanceof TypeError ||
|
|
169
|
+
[
|
|
170
|
+
"ECONNRESET",
|
|
171
|
+
"ECONNREFUSED",
|
|
172
|
+
"ETIMEDOUT",
|
|
173
|
+
"EAI_AGAIN",
|
|
174
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
175
|
+
].includes(details.code ?? "");
|
|
176
|
+
if (!retryable || attempt >= maxAttempts) {
|
|
177
|
+
if (attempt >= maxAttempts && retryable)
|
|
178
|
+
throw makeError(`request failed after ${maxAttempts} attempts`, "LCX_RETRY_EXHAUSTED", { cause: error, retryable: true });
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
last = error;
|
|
182
|
+
await sleep(Math.min(10_000, 500 * 2 ** (attempt - 1)), signal);
|
|
183
|
+
}
|
|
68
184
|
}
|
|
69
|
-
|
|
70
|
-
|
|
185
|
+
throw last ?? makeError("request failed", "LCX_REQUEST_FAILED");
|
|
186
|
+
}
|
|
187
|
+
export async function fetchSseWithRetry(url, body, headers = {}, signal, timeoutMs, options = {}) {
|
|
188
|
+
const requestTimeoutMs = timeoutMs ??
|
|
189
|
+
(options.applyDefaultTimeout === false ? undefined : DEFAULT_TIMEOUT_MS);
|
|
190
|
+
const maxAttempts = Math.max(1, Math.min(6, Number(options.maxAttempts ?? 3)));
|
|
191
|
+
let last;
|
|
192
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
193
|
+
abortIfNeeded(signal);
|
|
194
|
+
try {
|
|
195
|
+
const requestSignal = combinedSignal(signal, requestTimeoutMs);
|
|
196
|
+
const response = await fetch(url, {
|
|
197
|
+
method: "POST",
|
|
198
|
+
headers: {
|
|
199
|
+
"content-type": "application/json",
|
|
200
|
+
accept: "text/event-stream",
|
|
201
|
+
...headers,
|
|
202
|
+
},
|
|
203
|
+
body: JSON.stringify(body),
|
|
204
|
+
signal: requestSignal,
|
|
205
|
+
redirect: "error",
|
|
206
|
+
});
|
|
207
|
+
if (!response.ok) {
|
|
208
|
+
const text = await readLimited(response, Math.min(options.maxResponseBytes ?? DEFAULT_MAX_BYTES, MAX_ERROR_BYTES));
|
|
209
|
+
const quota = isQuotaError(text);
|
|
210
|
+
const retryable = !quota && retryableStatus(response.status);
|
|
211
|
+
const providerRetryAfterMs = retryAfterFromHeaders(response.headers);
|
|
212
|
+
const error = makeError(`HTTP ${response.status}`, quota ? "LCX_INSUFFICIENT_QUOTA" : retryable ? "LCX_HTTP_RETRYABLE" : "LCX_HTTP_ERROR", {
|
|
213
|
+
status: response.status,
|
|
214
|
+
retryable,
|
|
215
|
+
requestId: response.headers.get("x-request-id") ??
|
|
216
|
+
response.headers.get("request-id") ??
|
|
217
|
+
undefined,
|
|
218
|
+
...(providerRetryAfterMs === undefined
|
|
219
|
+
? {}
|
|
220
|
+
: { providerRetryAfterMs }),
|
|
221
|
+
});
|
|
222
|
+
if (!retryable || attempt >= maxAttempts)
|
|
223
|
+
throw error;
|
|
224
|
+
last = error;
|
|
225
|
+
await sleep(delayFromHeaders(response.headers, attempt), signal);
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
if (typeof options.consume === "function")
|
|
229
|
+
return await options.consume(response, { requestSignal });
|
|
230
|
+
return response;
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
if (signal?.aborted)
|
|
234
|
+
throw signal.reason ?? error;
|
|
235
|
+
const details = errorFacts(error);
|
|
236
|
+
const retryable = details.retryable === true ||
|
|
237
|
+
details.code === "LCX_HTTP_RETRYABLE" ||
|
|
238
|
+
error instanceof TypeError ||
|
|
239
|
+
[
|
|
240
|
+
"ECONNRESET",
|
|
241
|
+
"ECONNREFUSED",
|
|
242
|
+
"ETIMEDOUT",
|
|
243
|
+
"EAI_AGAIN",
|
|
244
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
245
|
+
].includes(details.code ?? "");
|
|
246
|
+
if (!retryable || attempt >= maxAttempts) {
|
|
247
|
+
if (attempt >= maxAttempts && retryable)
|
|
248
|
+
throw makeError(`request failed after ${maxAttempts} attempts`, "LCX_RETRY_EXHAUSTED", { cause: error, retryable: true });
|
|
249
|
+
throw error;
|
|
250
|
+
}
|
|
251
|
+
last = error;
|
|
252
|
+
await sleep(Math.min(10_000, 500 * 2 ** (attempt - 1)), signal);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
throw last ?? makeError("request failed", "LCX_REQUEST_FAILED");
|
|
71
256
|
}
|
|
72
|
-
|
|
73
257
|
export async function consumeSse(response, onEvent, options = {}) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
258
|
+
if (!response.body)
|
|
259
|
+
throw makeError("SSE response has no body", "LCX_INVALID_SSE");
|
|
260
|
+
const maxBytes = options.maxResponseBytes ?? DEFAULT_MAX_BYTES;
|
|
261
|
+
const reader = response.body.getReader();
|
|
262
|
+
const decoder = new TextDecoder();
|
|
263
|
+
let pending = "";
|
|
264
|
+
let dataLines = [];
|
|
265
|
+
let bytes = 0;
|
|
266
|
+
const dispatch = () => {
|
|
267
|
+
if (dataLines.length === 0)
|
|
268
|
+
return;
|
|
269
|
+
const data = dataLines.join("\n");
|
|
270
|
+
dataLines = [];
|
|
271
|
+
if (data === "[DONE]")
|
|
272
|
+
return;
|
|
273
|
+
let event;
|
|
274
|
+
try {
|
|
275
|
+
event = JSON.parse(data);
|
|
276
|
+
}
|
|
277
|
+
catch (cause) {
|
|
278
|
+
throw makeError("malformed SSE JSON", "LCX_INVALID_SSE", { cause });
|
|
279
|
+
}
|
|
280
|
+
onEvent(event);
|
|
281
|
+
};
|
|
282
|
+
try {
|
|
283
|
+
while (true) {
|
|
284
|
+
abortIfNeeded(options.signal);
|
|
285
|
+
const { done, value } = await reader.read();
|
|
286
|
+
if (done)
|
|
287
|
+
break;
|
|
288
|
+
bytes += value.byteLength;
|
|
289
|
+
if (bytes > maxBytes)
|
|
290
|
+
throw makeError(`SSE response exceeds ${maxBytes} bytes`, "LCX_RESPONSE_TOO_LARGE");
|
|
291
|
+
pending += decoder.decode(value, { stream: true });
|
|
292
|
+
let newline;
|
|
293
|
+
while ((newline = pending.indexOf("\n")) >= 0) {
|
|
294
|
+
const line = pending.slice(0, newline).replace(/\r$/u, "");
|
|
295
|
+
pending = pending.slice(newline + 1);
|
|
296
|
+
if (line === "")
|
|
297
|
+
dispatch();
|
|
298
|
+
else if (!line.startsWith(":") && line.startsWith("data:"))
|
|
299
|
+
dataLines.push(line.slice(5).replace(/^ /u, ""));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
pending += decoder.decode();
|
|
303
|
+
if (pending.startsWith("data:"))
|
|
304
|
+
dataLines.push(pending.slice(5).replace(/^ /u, ""));
|
|
305
|
+
dispatch();
|
|
306
|
+
}
|
|
307
|
+
finally {
|
|
308
|
+
try {
|
|
309
|
+
await reader.cancel();
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
// Cleanup must not replace the stream/parse/cancellation outcome.
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
reader.releaseLock();
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
// The acquired reader owns no further work after settlement.
|
|
319
|
+
}
|
|
320
|
+
}
|
|
81
321
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ClientModuleLoaderTarget } from "@deepseek-ai/dsh-client-modules/client";
|
|
2
|
+
import { type SearchMediaItem } from "./search-media.js";
|
|
3
|
+
type SearchMediaData = {
|
|
4
|
+
readonly items: readonly SearchMediaItem[];
|
|
5
|
+
readonly provider: string;
|
|
6
|
+
readonly model: string;
|
|
7
|
+
};
|
|
8
|
+
declare module "@deepseek-ai/dsh-client-ui-chat/client" {
|
|
9
|
+
interface ChatNodeDataMap {
|
|
10
|
+
"lcx-search-media": SearchMediaData;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
__ModuleLoader__: Pick<ClientModuleLoaderTarget, "load">;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type SearchMediaItem = {
|
|
2
|
+
readonly kind: "image" | "video" | "page";
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly poster?: string;
|
|
5
|
+
readonly previewUrl?: string;
|
|
6
|
+
readonly sourceUrl?: string;
|
|
7
|
+
readonly caption?: string;
|
|
8
|
+
readonly structured?: true;
|
|
9
|
+
};
|
|
10
|
+
export declare const SEARCH_MEDIA_LIMIT = 60;
|
|
11
|
+
export type StructuredMediaTool = "web_search" | "websearch_gpt_advanced";
|
|
12
|
+
/** Narrow LCX-owned tool-private media metadata without reading model-visible output. */
|
|
13
|
+
export declare function structuredSearchMedia(meta: unknown, expectedTool: StructuredMediaTool): readonly SearchMediaItem[];
|
|
14
|
+
export declare function mergeSearchMedia(structured: readonly SearchMediaItem[], fallback: readonly SearchMediaItem[]): readonly SearchMediaItem[];
|
|
15
|
+
/** Extract bounded remote media linked by visible assistant prose. */
|
|
16
|
+
export declare function extractSearchMedia(text: string): readonly SearchMediaItem[];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
import "@deepseek-ai/dsh-agent";
|
|
4
|
+
import "@deepseek-ai/dsh-tools";
|
|
5
|
+
import "@deepseek-ai/dsh-web";
|
|
6
|
+
export declare const name = "lcx-codex";
|
|
7
|
+
export declare const inject: string[];
|
|
8
|
+
type ConfigInput = {
|
|
9
|
+
supportsLongCacheRetention?: unknown;
|
|
10
|
+
supportsExplicitPromptCacheMode?: unknown;
|
|
11
|
+
alphaCapabilityPath?: unknown;
|
|
12
|
+
alphaRefPath?: unknown;
|
|
13
|
+
alphaProfile?: unknown;
|
|
14
|
+
alphaGroup?: unknown;
|
|
15
|
+
alphaMaxOutputTokens?: unknown;
|
|
16
|
+
webSearchProvider?: unknown;
|
|
17
|
+
webMaxResults?: unknown;
|
|
18
|
+
timeoutMs?: unknown;
|
|
19
|
+
maxResponseBytes?: unknown;
|
|
20
|
+
maxAttempts?: unknown;
|
|
21
|
+
maxRequestImageBytes?: unknown;
|
|
22
|
+
requestImagePixelBudget?: unknown;
|
|
23
|
+
requestImageMaxBytes?: unknown;
|
|
24
|
+
portableReplayMaxChars?: unknown;
|
|
25
|
+
nativeRetentionTokenBudget?: unknown;
|
|
26
|
+
assistantRetentionTokenReserve?: unknown;
|
|
27
|
+
assistantRetentionPerMessageTokenCap?: unknown;
|
|
28
|
+
};
|
|
29
|
+
type HostContext = Context;
|
|
30
|
+
export declare const Config: z<Schemastery.ObjectS<{
|
|
31
|
+
supportsLongCacheRetention: z<boolean, boolean>;
|
|
32
|
+
supportsExplicitPromptCacheMode: z<boolean, boolean>;
|
|
33
|
+
alphaCapabilityPath: z<string, string>;
|
|
34
|
+
alphaRefPath: z<string, string>;
|
|
35
|
+
alphaProfile: z<string, string>;
|
|
36
|
+
alphaGroup: z<string, string>;
|
|
37
|
+
alphaMaxOutputTokens: z<number, number>;
|
|
38
|
+
webSearchProvider: z<string, string>;
|
|
39
|
+
webMaxResults: z<number, number>;
|
|
40
|
+
timeoutMs: z<number, number>;
|
|
41
|
+
maxResponseBytes: z<number, number>;
|
|
42
|
+
maxAttempts: z<number, number>;
|
|
43
|
+
maxRequestImageBytes: z<number, number>;
|
|
44
|
+
requestImagePixelBudget: z<number, number>;
|
|
45
|
+
requestImageMaxBytes: z<number, number>;
|
|
46
|
+
portableReplayMaxChars: z<number, number>;
|
|
47
|
+
nativeRetentionTokenBudget: z<number, number>;
|
|
48
|
+
assistantRetentionTokenReserve: z<number, number>;
|
|
49
|
+
assistantRetentionPerMessageTokenCap: z<number, number>;
|
|
50
|
+
}>, Schemastery.ObjectT<{
|
|
51
|
+
supportsLongCacheRetention: z<boolean, boolean>;
|
|
52
|
+
supportsExplicitPromptCacheMode: z<boolean, boolean>;
|
|
53
|
+
alphaCapabilityPath: z<string, string>;
|
|
54
|
+
alphaRefPath: z<string, string>;
|
|
55
|
+
alphaProfile: z<string, string>;
|
|
56
|
+
alphaGroup: z<string, string>;
|
|
57
|
+
alphaMaxOutputTokens: z<number, number>;
|
|
58
|
+
webSearchProvider: z<string, string>;
|
|
59
|
+
webMaxResults: z<number, number>;
|
|
60
|
+
timeoutMs: z<number, number>;
|
|
61
|
+
maxResponseBytes: z<number, number>;
|
|
62
|
+
maxAttempts: z<number, number>;
|
|
63
|
+
maxRequestImageBytes: z<number, number>;
|
|
64
|
+
requestImagePixelBudget: z<number, number>;
|
|
65
|
+
requestImageMaxBytes: z<number, number>;
|
|
66
|
+
portableReplayMaxChars: z<number, number>;
|
|
67
|
+
nativeRetentionTokenBudget: z<number, number>;
|
|
68
|
+
assistantRetentionTokenReserve: z<number, number>;
|
|
69
|
+
assistantRetentionPerMessageTokenCap: z<number, number>;
|
|
70
|
+
}>>;
|
|
71
|
+
export declare function compactionPressureBand(totalTokens: number, contextWindow: number, policy: {
|
|
72
|
+
auto: number;
|
|
73
|
+
emergency: number;
|
|
74
|
+
}): {
|
|
75
|
+
ratioPercent: number;
|
|
76
|
+
band: string;
|
|
77
|
+
};
|
|
78
|
+
export declare function apply(ctx: HostContext, configInput?: ConfigInput): void;
|
|
79
|
+
export declare namespace apply {
|
|
80
|
+
export { inject };
|
|
81
|
+
export { Config };
|
|
82
|
+
}
|
|
83
|
+
export default apply;
|