dsh-lcx-codex 0.6.0 → 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-compat.js +5 -5
- package/lib/dsh-responses.js +268 -44
- package/lib/grok-native-search.js +18 -1
- package/lib/index.js +704 -73
- 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 +40 -7
- package/lib/route.js +358 -38
- package/lib/search-usage.js +7 -5
- package/lib/tool-surface.js +41 -8
- package/lib/types/index.d.ts +8 -0
- package/package.json +40 -36
package/lib/tool-surface.js
CHANGED
|
@@ -50,6 +50,11 @@ export function planToolSurface(input) {
|
|
|
50
50
|
const fallback = (reason) => full(messages, tools, toolHistory, mode === "addition-only" ? reason : undefined, facts.toolUpdate === "addition-only" && reason !== COMPAT_OPT_OUT);
|
|
51
51
|
if (mode !== "addition-only")
|
|
52
52
|
return full(messages, tools, toolHistory);
|
|
53
|
+
if ((tools === undefined || tools.length === 0) &&
|
|
54
|
+
toolHistory === undefined &&
|
|
55
|
+
!messages.some((message) => message.role === "developer")) {
|
|
56
|
+
return full(messages, tools, toolHistory);
|
|
57
|
+
}
|
|
53
58
|
if (tools === undefined)
|
|
54
59
|
return fallback("no tools");
|
|
55
60
|
if (!facts.resolved)
|
|
@@ -63,6 +68,9 @@ export function planToolSurface(input) {
|
|
|
63
68
|
return fallback(compat?.supportsAdditionalTools === false || compat?.supportsToolSearch === false ? COMPAT_OPT_OUT : COMPAT_SILENT);
|
|
64
69
|
if (toolHistory === undefined)
|
|
65
70
|
return fallback("no DSH tool history");
|
|
71
|
+
const developerIds = new Set(messages.flatMap((message) => (message.role === "developer" && typeof message.id === "string" ? [message.id] : [])));
|
|
72
|
+
if (toolHistory.updates.some((update) => !developerIds.has(update.messageId)))
|
|
73
|
+
return fallback("tool history references missing developer updates");
|
|
66
74
|
const projected = projectToolUpdates(messages, tools, "addition-only", toolHistory);
|
|
67
75
|
const projectedTools = projected.tools;
|
|
68
76
|
if (projectedTools === undefined)
|
|
@@ -84,17 +92,42 @@ export function planToolSurface(input) {
|
|
|
84
92
|
if (tool.deferLoading === true)
|
|
85
93
|
deferred.add(tool.name);
|
|
86
94
|
}
|
|
87
|
-
// Without any deferred tool or retained addition the request equals the full list; use the ordinary path
|
|
88
|
-
// so the common no-change turn stays byte-identical with the 0.5.1 behaviour.
|
|
89
|
-
if (deferred.size === 0 && added.size === 0)
|
|
90
|
-
return full(messages, tools, toolHistory);
|
|
91
95
|
if (deferred.size !== added.size || [...deferred].some((name) => !added.has(name)))
|
|
92
96
|
return fallback("deferred tools and retained additions disagree");
|
|
93
|
-
// The declared surface must
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
// The declared surface must match the active normalized definitions (ignoring projection-owned
|
|
98
|
+
// `deferLoading`); a name or schema mismatch means history and live header diverged, where only
|
|
99
|
+
// the full active tool list is safe to send.
|
|
100
|
+
const canonicalJsonValue = (value) => {
|
|
101
|
+
if (Array.isArray(value))
|
|
102
|
+
return ["a", ...value.map(canonicalJsonValue)];
|
|
103
|
+
if (value !== null && typeof value === "object") {
|
|
104
|
+
const record = value;
|
|
105
|
+
const entries = [];
|
|
106
|
+
for (const key of Object.keys(record).sort()) {
|
|
107
|
+
if (!Object.hasOwn(record, key))
|
|
108
|
+
continue;
|
|
109
|
+
const child = record[key];
|
|
110
|
+
if (child !== undefined)
|
|
111
|
+
entries.push([key, canonicalJsonValue(child)]);
|
|
112
|
+
}
|
|
113
|
+
return ["o", entries];
|
|
114
|
+
}
|
|
115
|
+
return value;
|
|
116
|
+
};
|
|
117
|
+
const canonicalToolSignature = (tool) => {
|
|
118
|
+
const copy = { ...tool };
|
|
119
|
+
delete copy.deferLoading;
|
|
120
|
+
return JSON.stringify(canonicalJsonValue(copy));
|
|
121
|
+
};
|
|
122
|
+
const active = new Map(tools.map((tool) => [tool.name, canonicalToolSignature(tool)]));
|
|
123
|
+
if (active.size !== tools.length ||
|
|
124
|
+
active.size !== projectedTools.length ||
|
|
125
|
+
projectedTools.some((tool) => active.get(tool.name) !== canonicalToolSignature(tool)))
|
|
97
126
|
return fallback("declared tools differ from the active tools");
|
|
127
|
+
// Without any deferred tool or retained addition the verified request equals the full list; use the
|
|
128
|
+
// ordinary path so the common no-change turn stays byte-identical with the 0.5.1 behaviour.
|
|
129
|
+
if (deferred.size === 0 && added.size === 0)
|
|
130
|
+
return full(messages, tools, toolHistory);
|
|
98
131
|
return {
|
|
99
132
|
messages: projected.messages,
|
|
100
133
|
tools: projectedTools,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare const inject: string[];
|
|
|
8
8
|
type ConfigInput = {
|
|
9
9
|
supportsLongCacheRetention?: unknown;
|
|
10
10
|
supportsExplicitPromptCacheMode?: unknown;
|
|
11
|
+
promptCacheKeyMode?: unknown;
|
|
12
|
+
gatewayCompatibilityFallback?: unknown;
|
|
11
13
|
alphaCapabilityPath?: unknown;
|
|
12
14
|
alphaRefPath?: unknown;
|
|
13
15
|
alphaProfile?: unknown;
|
|
@@ -36,6 +38,8 @@ type LiveSettingsConfig = {
|
|
|
36
38
|
searchMediaPreview: Volatile<boolean>;
|
|
37
39
|
/** Defaults to true: addition-only tool updates on routes that support them. */
|
|
38
40
|
incrementalToolUpdates: Volatile<boolean>;
|
|
41
|
+
/** Defaults to false: opt-in gateway fallback to standard top-level tools and reasoning.effort. */
|
|
42
|
+
gatewayCompatibilityFallback: Volatile<boolean>;
|
|
39
43
|
};
|
|
40
44
|
type HostContext = Context;
|
|
41
45
|
export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
@@ -47,8 +51,10 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
47
51
|
grokNativeXSearch: z<boolean, boolean, "volatile-defined">;
|
|
48
52
|
searchMediaPreview: z<boolean, boolean, "volatile-defined">;
|
|
49
53
|
incrementalToolUpdates: z<boolean, boolean, "volatile-defined">;
|
|
54
|
+
gatewayCompatibilityFallback: z<boolean, boolean, "volatile-defined">;
|
|
50
55
|
supportsLongCacheRetention: z<boolean, boolean, "defined">;
|
|
51
56
|
supportsExplicitPromptCacheMode: z<boolean, boolean, "defined">;
|
|
57
|
+
promptCacheKeyMode: z<"auto" | "disabled" | "enabled", "auto" | "disabled" | "enabled", "defined">;
|
|
52
58
|
alphaCapabilityPath: z<string, string, "defined">;
|
|
53
59
|
alphaRefPath: z<string, string, "defined">;
|
|
54
60
|
alphaProfile: z<string, string, "defined">;
|
|
@@ -75,8 +81,10 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
75
81
|
grokNativeXSearch: z<boolean, boolean, "volatile-defined">;
|
|
76
82
|
searchMediaPreview: z<boolean, boolean, "volatile-defined">;
|
|
77
83
|
incrementalToolUpdates: z<boolean, boolean, "volatile-defined">;
|
|
84
|
+
gatewayCompatibilityFallback: z<boolean, boolean, "volatile-defined">;
|
|
78
85
|
supportsLongCacheRetention: z<boolean, boolean, "defined">;
|
|
79
86
|
supportsExplicitPromptCacheMode: z<boolean, boolean, "defined">;
|
|
87
|
+
promptCacheKeyMode: z<"auto" | "disabled" | "enabled", "auto" | "disabled" | "enabled", "defined">;
|
|
80
88
|
alphaCapabilityPath: z<string, string, "defined">;
|
|
81
89
|
alphaRefPath: z<string, string, "defined">;
|
|
82
90
|
alphaProfile: z<string, string, "defined">;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-lcx-codex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Model-scoped DSH plugin: GPT Responses lifecycle, Native V2 compaction and Hosted/Alpha Search; Grok native Web/X Search",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"keywords": [
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@deepseek-ai/dsh": "0.2.
|
|
70
|
-
"@earendil-works/pi-ai": "1.
|
|
71
|
-
"@deepseek-ai/schemastery": "~3.
|
|
69
|
+
"@deepseek-ai/dsh": "0.2.2-rc.5",
|
|
70
|
+
"@earendil-works/pi-ai": "1.6.0",
|
|
71
|
+
"@deepseek-ai/schemastery": "~3.19.0",
|
|
72
72
|
"@types/node": "^22.20.0",
|
|
73
73
|
"@types/react": "~18.3.1",
|
|
74
74
|
"esbuild": "^0.28.2",
|
|
@@ -76,33 +76,34 @@
|
|
|
76
76
|
"typescript": "7.0.2"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"@deepseek-ai/cordis": ">=4.0
|
|
80
|
-
"@deepseek-ai/cordis-plugin-loader": ">=1.0
|
|
81
|
-
"@deepseek-ai/dsh-agent": ">=0.2.
|
|
82
|
-
"@deepseek-ai/dsh-api-session-controller": ">=0.2.
|
|
83
|
-
"@deepseek-ai/dsh-attachment": ">=0.2.
|
|
84
|
-
"@deepseek-ai/dsh-client-locale": ">=0.2.
|
|
85
|
-
"@deepseek-ai/dsh-client-modules": ">=0.2.
|
|
86
|
-
"@deepseek-ai/dsh-client-store": ">=0.2.
|
|
87
|
-
"@deepseek-ai/dsh-client-ui-chat": ">=0.2.
|
|
88
|
-
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.
|
|
89
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.
|
|
90
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.
|
|
91
|
-
"@deepseek-ai/dsh-compaction": ">=0.2.
|
|
92
|
-
"@deepseek-ai/dsh-credentials": ">=0.2.
|
|
93
|
-
"@deepseek-ai/dsh-fs": ">=0.2.
|
|
94
|
-
"@deepseek-ai/dsh-llm": ">=0.2.
|
|
95
|
-
"@deepseek-ai/dsh-session": ">=0.2.
|
|
96
|
-
"@deepseek-ai/dsh-session-query": ">=0.2.
|
|
97
|
-
"@deepseek-ai/dsh-settings": ">=0.2.
|
|
98
|
-
"@deepseek-ai/dsh-tool-web": ">=0.2.
|
|
99
|
-
"@deepseek-ai/dsh-tools": ">=0.2.
|
|
100
|
-
"@deepseek-ai/dsh-web": ">=0.2.
|
|
101
|
-
"@deepseek-ai/schemastery": ">=3.
|
|
79
|
+
"@deepseek-ai/cordis": ">=4.1.0",
|
|
80
|
+
"@deepseek-ai/cordis-plugin-loader": ">=1.1.0",
|
|
81
|
+
"@deepseek-ai/dsh-agent": ">=0.2.2-rc.5 <0.2.3-0",
|
|
82
|
+
"@deepseek-ai/dsh-api-session-controller": ">=0.2.2-rc.5 <0.2.3-0",
|
|
83
|
+
"@deepseek-ai/dsh-attachment": ">=0.2.2-rc.5 <0.2.3-0",
|
|
84
|
+
"@deepseek-ai/dsh-client-locale": ">=0.2.2-rc.5 <0.2.3-0",
|
|
85
|
+
"@deepseek-ai/dsh-client-modules": ">=0.2.2-rc.5 <0.2.3-0",
|
|
86
|
+
"@deepseek-ai/dsh-client-store": ">=0.2.2-rc.5 <0.2.3-0",
|
|
87
|
+
"@deepseek-ai/dsh-client-ui-chat": ">=0.2.2-rc.5 <0.2.3-0",
|
|
88
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.2-rc.5 <0.2.3-0",
|
|
89
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.2-rc.5 <0.2.3-0",
|
|
90
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.2-rc.5 <0.2.3-0",
|
|
91
|
+
"@deepseek-ai/dsh-compaction": ">=0.2.2-rc.5 <0.2.3-0",
|
|
92
|
+
"@deepseek-ai/dsh-credentials": ">=0.2.2-rc.5 <0.2.3-0",
|
|
93
|
+
"@deepseek-ai/dsh-fs": ">=0.2.2-rc.5 <0.2.3-0",
|
|
94
|
+
"@deepseek-ai/dsh-llm": ">=0.2.2-rc.5 <0.2.3-0",
|
|
95
|
+
"@deepseek-ai/dsh-session": ">=0.2.2-rc.5 <0.2.3-0",
|
|
96
|
+
"@deepseek-ai/dsh-session-query": ">=0.2.2-rc.5 <0.2.3-0",
|
|
97
|
+
"@deepseek-ai/dsh-settings": ">=0.2.2-rc.5 <0.2.3-0",
|
|
98
|
+
"@deepseek-ai/dsh-tool-web": ">=0.2.2-rc.5 <0.2.3-0",
|
|
99
|
+
"@deepseek-ai/dsh-tools": ">=0.2.2-rc.5 <0.2.3-0",
|
|
100
|
+
"@deepseek-ai/dsh-web": ">=0.2.2-rc.5 <0.2.3-0",
|
|
101
|
+
"@deepseek-ai/schemastery": ">=3.19.0",
|
|
102
102
|
"react": "^18.2.0",
|
|
103
|
-
"@deepseek-ai/dsh-token-meter": ">=0.2.
|
|
104
|
-
"@deepseek-ai/dsh-session-projection": ">=0.2.
|
|
105
|
-
"zod": "^4.5.4"
|
|
103
|
+
"@deepseek-ai/dsh-token-meter": ">=0.2.2-rc.5 <0.2.3-0",
|
|
104
|
+
"@deepseek-ai/dsh-session-projection": ">=0.2.2-rc.5 <0.2.3-0",
|
|
105
|
+
"zod": "^4.5.4",
|
|
106
|
+
"@deepseek-ai/dsh-tool-executor-ptc": ">=0.2.2-rc.5 <0.2.3-0"
|
|
106
107
|
},
|
|
107
108
|
"peerDependenciesMeta": {
|
|
108
109
|
"@deepseek-ai/cordis-plugin-loader": {
|
|
@@ -167,6 +168,9 @@
|
|
|
167
168
|
},
|
|
168
169
|
"@deepseek-ai/dsh-web": {
|
|
169
170
|
"optional": true
|
|
171
|
+
},
|
|
172
|
+
"@deepseek-ai/dsh-tool-executor-ptc": {
|
|
173
|
+
"optional": true
|
|
170
174
|
}
|
|
171
175
|
},
|
|
172
176
|
"scripts": {
|
|
@@ -174,10 +178,10 @@
|
|
|
174
178
|
"build:host": "tsc -p tsconfig.json && node scripts/build-pi-runtime.mjs",
|
|
175
179
|
"build:client": "tsc -p tsconfig.client.json && node scripts/build-client.mjs",
|
|
176
180
|
"test": "node --test tests/*.test.mjs",
|
|
177
|
-
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.client.json --noEmit",
|
|
181
|
+
"typecheck": "tsc -p tsconfig.json --noEmit --noUnusedLocals --noUnusedParameters && tsc -p tsconfig.client.json --noEmit --noUnusedLocals --noUnusedParameters",
|
|
178
182
|
"probe:alpha": "node scripts/probe-alpha.mjs",
|
|
179
183
|
"probe:tool-updates": "node scripts/probe-tool-updates.mjs",
|
|
180
|
-
"pack:local": "
|
|
184
|
+
"pack:local": "node scripts/pack-local.mjs",
|
|
181
185
|
"test:schema": "node scripts/validate-dsh-schema.mjs"
|
|
182
186
|
},
|
|
183
187
|
"engines": {
|
|
@@ -188,9 +192,9 @@
|
|
|
188
192
|
},
|
|
189
193
|
"license": "MIT",
|
|
190
194
|
"lcxCompatibility": {
|
|
191
|
-
"dshInstallRange": ">=0.2.
|
|
192
|
-
"verifiedDsh": "0.2.
|
|
193
|
-
"verifiedHostPi": "1.
|
|
194
|
-
"verifiedPluginPi": "1.
|
|
195
|
+
"dshInstallRange": ">=0.2.2-rc.5 <0.2.3-0",
|
|
196
|
+
"verifiedDsh": "0.2.2-rc.5",
|
|
197
|
+
"verifiedHostPi": "1.6.0",
|
|
198
|
+
"verifiedPluginPi": "1.6.0"
|
|
195
199
|
}
|
|
196
200
|
}
|