dsh-lcx-codex 0.7.0-pre.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -165
- package/THIRD_PARTY_NOTICES.md +5 -2
- package/lib/client.js +75 -3
- package/lib/compact-v2.js +8 -2
- package/lib/defaults.js +1 -0
- package/lib/dsh-responses.js +250 -35
- package/lib/grok-native-search.js +18 -1
- package/lib/index.js +692 -68
- package/lib/model-catalog.js +16 -3
- package/lib/native-checkpoint.js +13 -1
- package/lib/pi-responses-runtime.js +151 -21
- package/lib/responses-request.js +49 -15
- package/lib/responses-stream.js +26 -6
- package/lib/route.js +325 -38
- package/lib/tool-surface.js +41 -8
- package/lib/types/index.d.ts +8 -0
- package/package.json +36 -36
package/lib/model-catalog.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getCatalogModels } from "./pi-responses-runtime.js";
|
|
1
|
+
import { getCatalogModelMaxTokens, getCatalogModels } from "./pi-responses-runtime.js";
|
|
2
2
|
const providerDefaultsCache = new Map();
|
|
3
3
|
function sharedValue(values) {
|
|
4
4
|
const distinct = new Set(values);
|
|
@@ -27,13 +27,19 @@ export function resolveCatalogModel(provider, modelId, dshServes = false) {
|
|
|
27
27
|
const providerName = String(provider ?? "");
|
|
28
28
|
const id = String(modelId ?? "");
|
|
29
29
|
const exact = getCatalogModels(providerName).find((model) => model.id === id);
|
|
30
|
-
if (exact !== undefined)
|
|
30
|
+
if (exact !== undefined) {
|
|
31
|
+
const maxTokens = typeof exact.maxTokens === "number" && Number.isInteger(exact.maxTokens) && exact.maxTokens > 0
|
|
32
|
+
? exact.maxTokens
|
|
33
|
+
: undefined;
|
|
31
34
|
return {
|
|
32
35
|
source: "catalog-model",
|
|
33
36
|
api: exact.api,
|
|
34
37
|
baseUrl: exact.baseUrl,
|
|
35
38
|
descriptor: exact.api === "openai-responses" ? exact : undefined,
|
|
39
|
+
...(maxTokens === undefined ? {} : { maxTokens }),
|
|
36
40
|
};
|
|
41
|
+
}
|
|
42
|
+
const nonBundledMaxTokens = getCatalogModelMaxTokens(providerName, id);
|
|
37
43
|
const defaults = providerDefaults(providerName);
|
|
38
44
|
if (dshServes && defaults.api !== undefined)
|
|
39
45
|
return {
|
|
@@ -41,6 +47,13 @@ export function resolveCatalogModel(provider, modelId, dshServes = false) {
|
|
|
41
47
|
api: defaults.api,
|
|
42
48
|
baseUrl: defaults.baseUrl,
|
|
43
49
|
descriptor: undefined,
|
|
50
|
+
...(nonBundledMaxTokens === undefined ? {} : { maxTokens: nonBundledMaxTokens }),
|
|
44
51
|
};
|
|
45
|
-
return {
|
|
52
|
+
return {
|
|
53
|
+
source: "unknown",
|
|
54
|
+
api: undefined,
|
|
55
|
+
baseUrl: undefined,
|
|
56
|
+
descriptor: undefined,
|
|
57
|
+
...(nonBundledMaxTokens === undefined ? {} : { maxTokens: nonBundledMaxTokens }),
|
|
58
|
+
};
|
|
46
59
|
}
|
package/lib/native-checkpoint.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isCompactCheckpointSource } from "@deepseek-ai/dsh-compaction";
|
|
2
2
|
import { projectToolUpdates, } from "@deepseek-ai/dsh-llm";
|
|
3
|
-
import { baseURLFingerprint, routeCompatible } from "./route.js";
|
|
3
|
+
import { baseURLFingerprint, resolveRouteHeaderAuthorityFingerprint, routeCompatible } from "./route.js";
|
|
4
4
|
import { persistNativeImageReferences, responseInputItems } from "./dsh-responses.js";
|
|
5
5
|
import { estimateBudgetItem, modelVisibleBudgetView, portableBudgetError, portableTokenCeiling, } from "./token-budget.js";
|
|
6
6
|
import { isRecord } from "./util.js";
|
|
@@ -251,6 +251,10 @@ export async function createNativeCheckpointBlock({ ctx, session, route, result,
|
|
|
251
251
|
}
|
|
252
252
|
const retention = retainedConversationPlan(dropSupersededItems(input, ephemeralPreludeItemCount, supersededItemIndices), retentionOptions);
|
|
253
253
|
const nativeOutput = persistNativeImageReferences([...retention.items, structuredClone(result.compaction)], imageMap ?? new Map());
|
|
254
|
+
const headerAuthorityFingerprint = typeof route.headerAuthorityFingerprint === "string" &&
|
|
255
|
+
route.headerAuthorityFingerprint.length > 0
|
|
256
|
+
? route.headerAuthorityFingerprint
|
|
257
|
+
: await resolveRouteHeaderAuthorityFingerprint(ctx, route);
|
|
254
258
|
return {
|
|
255
259
|
type: NATIVE_BLOCK_TYPE,
|
|
256
260
|
version: NATIVE_BLOCK_VERSION,
|
|
@@ -260,6 +264,7 @@ export async function createNativeCheckpointBlock({ ctx, session, route, result,
|
|
|
260
264
|
model: route.model,
|
|
261
265
|
baseURLFingerprint: baseURLFingerprint(route.baseURL),
|
|
262
266
|
sourceSessionId: route.sessionId,
|
|
267
|
+
headerAuthorityFingerprint,
|
|
263
268
|
nativeOutput,
|
|
264
269
|
nativeCompaction: structuredClone(result.compaction),
|
|
265
270
|
retainedInputCount: retention.items.length,
|
|
@@ -344,6 +349,10 @@ export function stateFromSummaryEvent(event) {
|
|
|
344
349
|
typeof block.baseURLFingerprint !== "string" ||
|
|
345
350
|
typeof block.sourceSessionId !== "string")
|
|
346
351
|
return undefined;
|
|
352
|
+
if (block.headerAuthorityFingerprint !== undefined &&
|
|
353
|
+
(typeof block.headerAuthorityFingerprint !== "string" ||
|
|
354
|
+
block.headerAuthorityFingerprint.length === 0))
|
|
355
|
+
return undefined;
|
|
347
356
|
if (!validateCount(block.retainedInputCount) ||
|
|
348
357
|
!validateCount(block.retainedClientCount) ||
|
|
349
358
|
!validateCount(block.retainedAssistantCount))
|
|
@@ -384,6 +393,9 @@ export function stateFromSummaryEvent(event) {
|
|
|
384
393
|
model: block.model,
|
|
385
394
|
baseURLFingerprint: block.baseURLFingerprint,
|
|
386
395
|
sourceSessionId: block.sourceSessionId,
|
|
396
|
+
...(block.headerAuthorityFingerprint === undefined
|
|
397
|
+
? {}
|
|
398
|
+
: { headerAuthorityFingerprint: block.headerAuthorityFingerprint }),
|
|
387
399
|
nativeOutput: structuredClone(block.nativeOutput),
|
|
388
400
|
nativeCompaction: structuredClone(nativeCompaction),
|
|
389
401
|
...(block.retainedInputCount === undefined
|