dsh-lcx-codex 0.5.1-pre.1 → 0.5.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.
package/lib/route.js CHANGED
@@ -169,34 +169,48 @@ const MODEL_THINKING_LEVELS = [
169
169
  function profileReasoning(value) {
170
170
  return MODEL_THINKING_LEVELS.find((level) => level === value);
171
171
  }
172
- function configuredModelControls(profile, modelId, base) {
173
- const configured = configuredModelProfile(profile, modelId);
174
- const efforts = configured?.reasoningEfforts;
172
+ /**
173
+ * The reasoning projection of a model whose profile entry declares `reasoningEfforts` (the mapping
174
+ * from DSH levels to wire spellings, or `false` for a non-reasoning model); undefined when the
175
+ * profile says nothing, so the caller falls back to the catalog or to what DSH resolved.
176
+ */
177
+ function declaredReasoningControls(profile, modelId) {
178
+ const efforts = configuredModelProfile(profile, modelId)?.reasoningEfforts;
175
179
  if (efforts === undefined)
176
- return {
177
- reasoning: base?.reasoning ?? false,
178
- ...(base?.thinkingLevelMap === undefined
179
- ? {}
180
- : { thinkingLevelMap: base.thinkingLevelMap }),
181
- };
180
+ return undefined;
182
181
  if (efforts === false)
183
182
  return { reasoning: false };
184
183
  if (!isRecord(efforts))
185
184
  return { reasoning: false };
186
185
  const thinkingLevelMap = {};
186
+ let offOmitsReasoning = false;
187
187
  for (const level of MODEL_THINKING_LEVELS) {
188
188
  const value = efforts[level];
189
189
  if (value === undefined)
190
190
  thinkingLevelMap[level] = null;
191
191
  else if (value === null) {
192
- // DSH permits only off:null: it means supported-off by omitting the wire option.
193
- if (level !== "off")
194
- thinkingLevelMap[level] = null;
192
+ // DSH permits only off:null: it means supported-off by omitting the wire option. Pi 1.1.0 would
193
+ // read an absent `off` as "send none", so the omission is made explicit here.
194
+ thinkingLevelMap[level] = null;
195
+ if (level === "off")
196
+ offOmitsReasoning = true;
195
197
  }
196
198
  else if (typeof value === "string")
197
199
  thinkingLevelMap[level] = value;
198
200
  }
199
- return { reasoning: true, thinkingLevelMap };
201
+ return {
202
+ reasoning: true,
203
+ thinkingLevelMap,
204
+ ...(offOmitsReasoning ? { offOmitsReasoning: true } : {}),
205
+ };
206
+ }
207
+ function configuredModelControls(profile, modelId, base) {
208
+ return (declaredReasoningControls(profile, modelId) ?? {
209
+ reasoning: base?.reasoning ?? false,
210
+ ...(base?.thinkingLevelMap === undefined
211
+ ? {}
212
+ : { thinkingLevelMap: base.thinkingLevelMap }),
213
+ });
200
214
  }
201
215
  function isLcxCapabilityRoute(provider, model) {
202
216
  return provider === "lcx" &&
@@ -241,6 +255,7 @@ export function resolveResponsesRouteConfig(ctx, options, policy) {
241
255
  const fallbackRetention = lcxCapabilityRoute ? policy.cacheRetention : undefined;
242
256
  const requestedRetention = configuredRetention === "none" || configuredRetention === "short" || configuredRetention === "long" ? configuredRetention : fallbackRetention === "none" || fallbackRetention === "short" || fallbackRetention === "long" ? fallbackRetention : undefined;
243
257
  const cacheRetention = requestedRetention === "long" && !supportsLongCacheRetention ? "short" : requestedRetention ?? (supportsLongCacheRetention ? "long" : "short");
258
+ const declaredControls = declaredReasoningControls(configured, model);
244
259
  return {
245
260
  provider,
246
261
  model,
@@ -251,6 +266,9 @@ export function resolveResponsesRouteConfig(ctx, options, policy) {
251
266
  cacheRetention,
252
267
  supportsLongCacheRetention,
253
268
  responsesCompat,
269
+ // Only a declared `reasoningEfforts` is projected here; an undeclared model follows the catalog
270
+ // and what DSH resolved for it (see `gptModelOverride`).
271
+ ...(declaredControls === undefined ? {} : { modelControls: declaredControls }),
254
272
  // These are explicitly LCX-owned transport and request-capability policies.
255
273
  timeoutMs: isPositiveInteger(configured.timeoutMs) ? configured.timeoutMs : policy.timeoutMs,
256
274
  maxAttempts: retryAttempts(configured.retryPolicy, policy.maxAttempts),
@@ -10,15 +10,22 @@ export const searchUsageProjection = {
10
10
  key: 'lcxSearchUsage', stateVersion: 3, stateSchema: schema.extend({ pending: z.record(z.string(), z.string()), headerKey: z.string().optional(), sampleHeaderKey: z.string().optional() }),
11
11
  init: () => ({ auxiliary: zeroBuckets(), aggregateContext: false, pending: {} }),
12
12
  apply(state, event) {
13
- if (event.type === 'request/header')
14
- return { ...state, headerKey: headerKey(event.data.header) };
13
+ // Unit state is checkpointed by the host's projection cache, which refuses any state that is not
14
+ // lossless plain JSON. An optional field is therefore omitted when absent, never set to `undefined`.
15
+ if (event.type === 'request/header') {
16
+ const { headerKey: _previous, ...rest } = state;
17
+ const key = headerKey(event.data.header);
18
+ return key === undefined ? rest : { ...rest, headerKey: key };
19
+ }
15
20
  // DSH measure anchors assistant/message only. Attempts must not transplant a
16
21
  // newer context sample onto an older successful measurement anchor.
17
22
  if (event.type === 'assistant/message' || event.type === 'assistant/attempt') {
18
23
  const contextDetails = event.type === 'assistant/message' ? providerContextOf(event) : undefined;
19
- return { ...state, aggregateContext: aggregateContextOf(event) ?? state.aggregateContext, contextDetails,
20
- contextProvenance: contextDetails ? 'provider-context-details' : undefined,
21
- sampleHeaderKey: contextDetails ? state.headerKey : undefined };
24
+ // The newest reply replaces the whole provider-context sample: drop the old keys, then add the new ones.
25
+ const { contextDetails: _details, contextProvenance: _provenance, sampleHeaderKey: _sample, ...rest } = state;
26
+ return { ...rest, aggregateContext: aggregateContextOf(event) ?? state.aggregateContext,
27
+ ...(contextDetails ? { contextDetails, contextProvenance: 'provider-context-details',
28
+ ...(state.headerKey === undefined ? {} : { sampleHeaderKey: state.headerKey }) } : {}) };
22
29
  }
23
30
  if (event.type === 'tool/call' && isSearchTool(event.data.name))
24
31
  return { ...state, pending: { ...state.pending, [event.data.callId]: event.data.name } };
package/lib/transport.js CHANGED
@@ -279,10 +279,17 @@ export async function consumeSse(response, onEvent, options = {}) {
279
279
  }
280
280
  onEvent(event);
281
281
  };
282
+ // An abort must interrupt a read that never settles, not only be noticed between reads. Cancelling
283
+ // the reader settles the pending read as done, so the abort is re-checked right after every read.
284
+ const onAbort = () => {
285
+ reader.cancel(options.signal?.reason).catch(() => { });
286
+ };
287
+ options.signal?.addEventListener("abort", onAbort, { once: true });
282
288
  try {
283
289
  while (true) {
284
290
  abortIfNeeded(options.signal);
285
291
  const { done, value } = await reader.read();
292
+ abortIfNeeded(options.signal);
286
293
  if (done)
287
294
  break;
288
295
  bytes += value.byteLength;
@@ -305,6 +312,7 @@ export async function consumeSse(response, onEvent, options = {}) {
305
312
  dispatch();
306
313
  }
307
314
  finally {
315
+ options.signal?.removeEventListener("abort", onAbort);
308
316
  try {
309
317
  await reader.cancel();
310
318
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-lcx-codex",
3
- "version": "0.5.1-pre.1",
3
+ "version": "0.5.1",
4
4
  "description": "Model-scoped DSH plugin: GPT Responses lifecycle, Native V2 compaction and Hosted/Alpha Search; Grok native Web/X Search",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -62,9 +62,9 @@
62
62
  }
63
63
  },
64
64
  "devDependencies": {
65
- "@deepseek-ai/dsh": "0.2.1-alpha.2",
65
+ "@deepseek-ai/dsh": "0.2.0-rc.2",
66
66
  "@earendil-works/pi-ai": "0.87.1",
67
- "@deepseek-ai/schemastery": "~3.18.5-alpha.1",
67
+ "@deepseek-ai/schemastery": "^3.18.2",
68
68
  "@types/node": "^22.20.0",
69
69
  "@types/react": "~18.3.1",
70
70
  "esbuild": "^0.28.2",
@@ -72,31 +72,31 @@
72
72
  "typescript": "7.0.2"
73
73
  },
74
74
  "peerDependencies": {
75
- "@deepseek-ai/cordis": ">=4.0.5-alpha.1",
76
- "@deepseek-ai/cordis-plugin-loader": ">=1.0.6-alpha.1",
77
- "@deepseek-ai/dsh-agent": ">=0.2.1-alpha.2",
78
- "@deepseek-ai/dsh-attachment": ">=0.2.1-alpha.2",
79
- "@deepseek-ai/dsh-client-locale": ">=0.2.1-alpha.2",
80
- "@deepseek-ai/dsh-client-modules": ">=0.2.1-alpha.2",
81
- "@deepseek-ai/dsh-client-store": ">=0.2.1-alpha.2",
82
- "@deepseek-ai/dsh-client-ui-chat": ">=0.2.1-alpha.2",
83
- "@deepseek-ai/dsh-client-ui-conversation": ">=0.2.1-alpha.2",
84
- "@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.1-alpha.2",
85
- "@deepseek-ai/dsh-client-ui-settings": ">=0.2.1-alpha.2",
86
- "@deepseek-ai/dsh-compaction": ">=0.2.1-alpha.2",
87
- "@deepseek-ai/dsh-credentials": ">=0.2.1-alpha.2",
88
- "@deepseek-ai/dsh-fs": ">=0.2.1-alpha.2",
89
- "@deepseek-ai/dsh-llm": ">=0.2.1-alpha.2",
90
- "@deepseek-ai/dsh-session": ">=0.2.1-alpha.2",
91
- "@deepseek-ai/dsh-session-query": ">=0.2.1-alpha.2",
92
- "@deepseek-ai/dsh-settings": ">=0.2.1-alpha.2",
93
- "@deepseek-ai/dsh-tool-web": ">=0.2.1-alpha.2",
94
- "@deepseek-ai/dsh-tools": ">=0.2.1-alpha.2",
95
- "@deepseek-ai/dsh-web": ">=0.2.1-alpha.2",
96
- "@deepseek-ai/schemastery": ">=3.18.5-alpha.1",
75
+ "@deepseek-ai/cordis": "^4.0.2",
76
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.5",
77
+ "@deepseek-ai/dsh-agent": ">=0.2.0-rc.2 <0.2.1",
78
+ "@deepseek-ai/dsh-attachment": ">=0.2.0-rc.2 <0.2.1",
79
+ "@deepseek-ai/dsh-client-locale": ">=0.2.0-rc.2 <0.2.1",
80
+ "@deepseek-ai/dsh-client-modules": ">=0.2.0-rc.2 <0.2.1",
81
+ "@deepseek-ai/dsh-client-store": ">=0.2.0-rc.2 <0.2.1",
82
+ "@deepseek-ai/dsh-client-ui-chat": ">=0.2.0-rc.2 <0.2.1",
83
+ "@deepseek-ai/dsh-client-ui-conversation": ">=0.2.0-rc.2 <0.2.1",
84
+ "@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.2.0-rc.2 <0.2.1",
85
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.2.0-rc.2 <0.2.1",
86
+ "@deepseek-ai/dsh-compaction": ">=0.2.0-rc.2 <0.2.1",
87
+ "@deepseek-ai/dsh-credentials": ">=0.2.0-rc.2 <0.2.1",
88
+ "@deepseek-ai/dsh-fs": ">=0.2.0-rc.2 <0.2.1",
89
+ "@deepseek-ai/dsh-llm": ">=0.2.0-rc.2 <0.2.1",
90
+ "@deepseek-ai/dsh-session": ">=0.2.0-rc.2 <0.2.1",
91
+ "@deepseek-ai/dsh-session-query": ">=0.2.0-rc.2 <0.2.1",
92
+ "@deepseek-ai/dsh-settings": ">=0.2.0-rc.2 <0.2.1",
93
+ "@deepseek-ai/dsh-tool-web": ">=0.2.0-rc.2 <0.2.1",
94
+ "@deepseek-ai/dsh-tools": ">=0.2.0-rc.2 <0.2.1",
95
+ "@deepseek-ai/dsh-web": ">=0.2.0-rc.2 <0.2.1",
96
+ "@deepseek-ai/schemastery": "^3.18.2",
97
97
  "react": "^18.2.0",
98
- "@deepseek-ai/dsh-token-meter": ">=0.2.1-alpha.2",
99
- "@deepseek-ai/dsh-session-projection": ">=0.2.1-alpha.2",
98
+ "@deepseek-ai/dsh-token-meter": ">=0.2.0-rc.2 <0.2.1",
99
+ "@deepseek-ai/dsh-session-projection": ">=0.2.0-rc.2 <0.2.1",
100
100
  "zod": "^4.5.4"
101
101
  },
102
102
  "peerDependenciesMeta": {
@@ -179,9 +179,9 @@
179
179
  },
180
180
  "license": "MIT",
181
181
  "lcxCompatibility": {
182
- "dshInstallRange": ">=0.2.1-alpha.2",
183
- "verifiedDsh": "0.2.1-alpha.2",
184
- "verifiedHostPi": "1.1.0",
182
+ "dshInstallRange": ">=0.2.0-rc.2 <0.2.1",
183
+ "verifiedDsh": "0.2.0-rc.2",
184
+ "verifiedHostPi": "0.87.1",
185
185
  "verifiedPluginPi": "0.87.1"
186
186
  }
187
187
  }