@eddyskywalker/dsh-chatgpt-subscription 0.95.3 → 0.97.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.
Files changed (32) hide show
  1. package/lib/client.js +109 -26
  2. package/lib/client.js.map +1 -1
  3. package/lib/index.js +335 -59
  4. package/lib/types/client/features/progress-updates/locales.d.ts +8 -2
  5. package/lib/types/client/features/progress-updates/locales.d.ts.map +1 -1
  6. package/lib/types/client/features/progress-updates/settings-binding.d.ts +8 -1
  7. package/lib/types/client/features/progress-updates/settings-binding.d.ts.map +1 -1
  8. package/lib/types/client/features/progress-updates/settings-section.d.ts.map +1 -1
  9. package/lib/types/client/locales-ru/command-code.d.ts.map +1 -1
  10. package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
  11. package/lib/types/client/providers/command-code/CommandCodeSection.d.ts.map +1 -1
  12. package/lib/types/client/providers/command-code/locales.d.ts +11 -2
  13. package/lib/types/client/providers/command-code/locales.d.ts.map +1 -1
  14. package/lib/types/compat.d.ts +1 -1
  15. package/lib/types/host/common/reasoning-seed-replay.d.ts +25 -0
  16. package/lib/types/host/common/reasoning-seed-replay.d.ts.map +1 -0
  17. package/lib/types/host/providers/command-code/adapter.d.ts +6 -3
  18. package/lib/types/host/providers/command-code/adapter.d.ts.map +1 -1
  19. package/lib/types/host/providers/command-code/mapper.d.ts.map +1 -1
  20. package/lib/types/host/providers/command-code/routes.d.ts.map +1 -1
  21. package/lib/types/host/providers/command-code/token-store.d.ts +4 -0
  22. package/lib/types/host/providers/command-code/token-store.d.ts.map +1 -1
  23. package/lib/types/host/providers/opencode-go/mapper.d.ts.map +1 -1
  24. package/lib/types/host/providers/opencode-zen/mapper.d.ts.map +1 -1
  25. package/lib/types/host/providers/relayone/mapper-openai.d.ts.map +1 -1
  26. package/lib/types/host/runtime/deepseek-v41-flash/reasoning-seed.d.ts +113 -0
  27. package/lib/types/host/runtime/deepseek-v41-flash/reasoning-seed.d.ts.map +1 -0
  28. package/lib/types/index.d.ts +7 -0
  29. package/lib/types/index.d.ts.map +1 -1
  30. package/lib/types/shared/command-code-contracts.d.ts +2 -0
  31. package/lib/types/shared/command-code-contracts.d.ts.map +1 -1
  32. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -885,7 +885,7 @@ const ROUTE_PREFIX$6 = "/api/dsh-chatgpt-subscription";
885
885
  * `test/responses-client.test.ts` asserts the two agree, so a release that
886
886
  * forgets this constant fails the suite instead of shipping quietly.
887
887
  */
888
- const PLUGIN_VERSION = "0.95.3";
888
+ const PLUGIN_VERSION = "0.97.0";
889
889
  const CODEX_CHATGPT_PROVIDER_ID = "codex-chatgpt";
890
890
  const CODEX_API_BASE = "https://chatgpt.com/backend-api/codex";
891
891
  const CODEX_RESPONSES_URL = `${CODEX_API_BASE}/responses`;
@@ -4670,7 +4670,7 @@ var OAuthService = class {
4670
4670
  throw new OAuthServiceError("oauth-token-exchange-failed", `The ChatGPT device code could not be issued (${response.status}${detail === null ? "" : `, ${detail}`}).`, response.status);
4671
4671
  }
4672
4672
  const payload = await response.json().catch(() => null);
4673
- const record = isRecord$121(payload) ? payload : {};
4673
+ const record = isRecord$122(payload) ? payload : {};
4674
4674
  const authId = nonEmptyString$12(record.device_auth_id);
4675
4675
  const userCode = nonEmptyString$12(record.user_code) ?? nonEmptyString$12(record.usercode);
4676
4676
  if (authId === void 0 || userCode === void 0) throw new OAuthServiceError("oauth-token-exchange-failed", "ChatGPT returned no device code.");
@@ -4737,7 +4737,7 @@ var OAuthService = class {
4737
4737
  const detail = deviceErrorIdentifier(payload);
4738
4738
  throw new OAuthServiceError("oauth-token-exchange-failed", `The ChatGPT device confirmation was refused (${response.status}${detail === void 0 ? "" : `, ${detail}`}).`, response.status);
4739
4739
  }
4740
- const record = isRecord$121(payload) ? payload : {};
4740
+ const record = isRecord$122(payload) ? payload : {};
4741
4741
  const authorizationCode = nonEmptyString$12(record.authorization_code);
4742
4742
  const codeVerifier = nonEmptyString$12(record.code_verifier);
4743
4743
  if (authorizationCode === void 0 || codeVerifier === void 0) throw new OAuthServiceError("oauth-token-exchange-failed", "ChatGPT confirmed the device code but returned no authorization code.");
@@ -5070,11 +5070,11 @@ const DEVICE_PENDING_STATUSES = /* @__PURE__ */ new Set([
5070
5070
  function isPendingDeviceAnswer(response, payload) {
5071
5071
  if (response.status === 403 || response.status === 404) return true;
5072
5072
  if (!response.ok && response.status !== 400) return false;
5073
- if (!isRecord$121(payload)) return false;
5073
+ if (!isRecord$122(payload)) return false;
5074
5074
  const status = payload.status;
5075
5075
  if (typeof status === "string" && DEVICE_PENDING_STATUSES.has(status.toLowerCase())) return true;
5076
5076
  const error = payload.error;
5077
- if (isRecord$121(error)) {
5077
+ if (isRecord$122(error)) {
5078
5078
  const code = error.code;
5079
5079
  if (typeof code === "string" && DEVICE_PENDING_STATUSES.has(code.toLowerCase())) return true;
5080
5080
  }
@@ -5088,18 +5088,18 @@ function isPendingDeviceAnswer(response, payload) {
5088
5088
  * wrong.
5089
5089
  */
5090
5090
  function deviceErrorIdentifier(payload) {
5091
- if (!isRecord$121(payload)) return void 0;
5091
+ if (!isRecord$122(payload)) return void 0;
5092
5092
  const candidates = [payload.code];
5093
5093
  const error = payload.error;
5094
5094
  if (typeof error === "string") candidates.push(error);
5095
- else if (isRecord$121(error)) candidates.push(error.code, error.type);
5095
+ else if (isRecord$122(error)) candidates.push(error.code, error.type);
5096
5096
  candidates.push(payload.status);
5097
5097
  for (const candidate of candidates) if (typeof candidate === "string" && /^[a-z0-9_.-]{1,64}$/i.test(candidate)) return candidate;
5098
5098
  }
5099
5099
  function nonEmptyString$12(value) {
5100
5100
  return typeof value === "string" && value !== "" ? value : void 0;
5101
5101
  }
5102
- function isRecord$121(value) {
5102
+ function isRecord$122(value) {
5103
5103
  return typeof value === "object" && value !== null && !Array.isArray(value);
5104
5104
  }
5105
5105
  async function oauthErrorIdentifier(response) {
@@ -5187,7 +5187,7 @@ const CODEX_CLI_CREDENTIAL_SOURCE = "codex";
5187
5187
  * here, and the import has to be repeated afterwards.
5188
5188
  */
5189
5189
  const ADOPTED_CODEX_CREDENTIAL_EXPIRED_HINT = "The sign-in imported from the Codex CLI has expired. Sign in again in the Codex CLI, then import it again from this settings card.";
5190
- function isRecord$120(value) {
5190
+ function isRecord$121(value) {
5191
5191
  return typeof value === "object" && value !== null && !Array.isArray(value);
5192
5192
  }
5193
5193
  /** A trimmed, non-empty string, or nothing. */
@@ -5289,7 +5289,7 @@ function decodeJwtClaims$1(token) {
5289
5289
  if (parts.length !== 3) return void 0;
5290
5290
  try {
5291
5291
  const value = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
5292
- return isRecord$120(value) ? value : void 0;
5292
+ return isRecord$121(value) ? value : void 0;
5293
5293
  } catch {
5294
5294
  return;
5295
5295
  }
@@ -5334,10 +5334,10 @@ function expiryFromAccessToken(accessToken) {
5334
5334
  * the file carries cannot reach the result.
5335
5335
  */
5336
5336
  function parseAdoptedCodexCredential(value, sourcePath) {
5337
- if (!isRecord$120(value)) return void 0;
5337
+ if (!isRecord$121(value)) return void 0;
5338
5338
  if (value.auth_mode !== "chatgpt") return void 0;
5339
5339
  const tokens = value[CODEX_CLI_TOKENS_KEY];
5340
- if (!isRecord$120(tokens)) return void 0;
5340
+ if (!isRecord$121(tokens)) return void 0;
5341
5341
  const accessToken = nonEmptyString$11(tokens.access_token);
5342
5342
  if (accessToken === void 0) return void 0;
5343
5343
  const refreshToken = nonEmptyString$11(tokens.refresh_token);
@@ -5356,7 +5356,7 @@ function parseAdoptedCodexCredential(value, sourcePath) {
5356
5356
  const email = claims === void 0 ? void 0 : nonEmptyString$11(claims.email);
5357
5357
  if (email !== void 0) credentials.email = email;
5358
5358
  const authClaims = claims === void 0 ? void 0 : claims[CODEX_AUTH_CLAIMS_KEY];
5359
- const planType = isRecord$120(authClaims) ? nonEmptyString$11(authClaims.chatgpt_plan_type) : void 0;
5359
+ const planType = isRecord$121(authClaims) ? nonEmptyString$11(authClaims.chatgpt_plan_type) : void 0;
5360
5360
  if (planType !== void 0) credentials.planType = planType;
5361
5361
  }
5362
5362
  const accountId = nonEmptyString$11(tokens.account_id);
@@ -8029,11 +8029,11 @@ function createControlledModelFetch(baseFetch, options) {
8029
8029
  * text and may opt into a hard handoff threshold; coordination tools are exempt
8030
8030
  * because they are expected to recur while real work continues.
8031
8031
  */
8032
- function isRecord$119(value) {
8032
+ function isRecord$120(value) {
8033
8033
  return typeof value === "object" && value !== null;
8034
8034
  }
8035
8035
  function isPlainRecord$2(value) {
8036
- if (!isRecord$119(value) || Array.isArray(value)) return false;
8036
+ if (!isRecord$120(value) || Array.isArray(value)) return false;
8037
8037
  const prototype = Object.getPrototypeOf(value);
8038
8038
  return prototype === Object.prototype || prototype === null;
8039
8039
  }
@@ -8180,15 +8180,15 @@ function nonEmptyString$10(value) {
8180
8180
  }
8181
8181
  /** 判断一次工具执行结果是否失败。 */
8182
8182
  function isToolErrorResult(result) {
8183
- return isRecord$119(result) && result["isError"] === true;
8183
+ return isRecord$120(result) && result["isError"] === true;
8184
8184
  }
8185
8185
  /** 读一次工具执行结果里的结构化错误码。 */
8186
8186
  function toolErrorCodeOf(result) {
8187
- if (!isRecord$119(result)) return void 0;
8187
+ if (!isRecord$120(result)) return void 0;
8188
8188
  const error = result["error"];
8189
- if (!isRecord$119(error)) return void 0;
8189
+ if (!isRecord$120(error)) return void 0;
8190
8190
  const info = error["info"];
8191
- if (isRecord$119(info)) {
8191
+ if (isRecord$120(info)) {
8192
8192
  const infoCode = nonEmptyString$10(info["code"]);
8193
8193
  if (infoCode !== void 0) return infoCode;
8194
8194
  }
@@ -8196,18 +8196,18 @@ function toolErrorCodeOf(result) {
8196
8196
  }
8197
8197
  /** 读一次工具执行结果里的全部文本块。 */
8198
8198
  function toolResultTextOf(result) {
8199
- if (!isRecord$119(result)) return "";
8199
+ if (!isRecord$120(result)) return "";
8200
8200
  const content = result["content"];
8201
8201
  if (!Array.isArray(content)) return "";
8202
8202
  const parts = [];
8203
- for (const block of content) if (isRecord$119(block) && block["type"] === "text") parts.push(nonEmptyString$10(block["text"]) ?? "");
8203
+ for (const block of content) if (isRecord$120(block) && block["type"] === "text") parts.push(nonEmptyString$10(block["text"]) ?? "");
8204
8204
  return parts.join("\n");
8205
8205
  }
8206
8206
  /** 读一次工具执行结果里的失败文本(无 `error.message` 且为错误结果时回退读取文本内容)。 */
8207
8207
  function toolErrorTextOf(result) {
8208
- if (isRecord$119(result)) {
8208
+ if (isRecord$120(result)) {
8209
8209
  const error = result["error"];
8210
- if (isRecord$119(error)) {
8210
+ if (isRecord$120(error)) {
8211
8211
  const msg = nonEmptyString$10(error["message"]);
8212
8212
  if (msg !== void 0) return msg;
8213
8213
  }
@@ -8660,12 +8660,12 @@ const BOOLEAN_KEYS = [
8660
8660
  "hint",
8661
8661
  "waitJobs"
8662
8662
  ];
8663
- function isRecord$118(value) {
8663
+ function isRecord$119(value) {
8664
8664
  return typeof value === "object" && value !== null && !Array.isArray(value);
8665
8665
  }
8666
8666
  /** Validate one provider override without silently dropping unknown keys. */
8667
8667
  function parsePromptCacheOverride(provider, value) {
8668
- if (!isRecord$118(value)) throw new Error(`prompt cache policy for "${provider}" must be an object`);
8668
+ if (!isRecord$119(value)) throw new Error(`prompt cache policy for "${provider}" must be an object`);
8669
8669
  const out = {};
8670
8670
  for (const [key, entry] of Object.entries(value)) {
8671
8671
  if (!OVERRIDE_KEYS.has(key)) throw new Error(`prompt cache policy for "${provider}" has unknown field "${key}"`);
@@ -8686,7 +8686,7 @@ function parsePromptCacheOverride(provider, value) {
8686
8686
  /** Validate a whole config-owned map. Undefined means no overrides. */
8687
8687
  function parsePromptCacheOverrides(value) {
8688
8688
  if (value === void 0) return {};
8689
- if (!isRecord$118(value)) throw new Error("promptCacheOverrides must be an object keyed by provider id");
8689
+ if (!isRecord$119(value)) throw new Error("promptCacheOverrides must be an object keyed by provider id");
8690
8690
  const out = {};
8691
8691
  for (const [provider, override] of Object.entries(value)) {
8692
8692
  if (!/^[a-z0-9][a-z0-9-]*$/.test(provider)) throw new Error(`invalid prompt cache provider id "${provider}"`);
@@ -10731,14 +10731,14 @@ async function fetchWithPrefixCoordination(fetchFn, coordinator, groupKey, warmT
10731
10731
  * Dynamic mid-conversation updates stay at their original history position;
10732
10732
  * only the initial harness bootstrap run is normalised ahead of the user task.
10733
10733
  */
10734
- function isRecord$117(value) {
10734
+ function isRecord$118(value) {
10735
10735
  return typeof value === "object" && value !== null && !Array.isArray(value);
10736
10736
  }
10737
10737
  function firstTextOf$1(content) {
10738
10738
  if (typeof content === "string") return content.trim() === "" ? void 0 : content;
10739
10739
  if (!Array.isArray(content)) return void 0;
10740
10740
  for (const block of content) {
10741
- if (!isRecord$117(block)) continue;
10741
+ if (!isRecord$118(block)) continue;
10742
10742
  if (block.type === "text" && typeof block.text === "string" && block.text !== "") return block.text;
10743
10743
  if (block.type === "tool-result") {
10744
10744
  const nested = firstTextOf$1(block.content);
@@ -10752,7 +10752,7 @@ function isToolResultMessage$9(message) {
10752
10752
  /** Stability tier for an initial bootstrap reminder; null means dynamic/history-bound. */
10753
10753
  function classifyBootstrapUserMessage$1(message) {
10754
10754
  if (message.role !== "user" || isToolResultMessage$9(message)) return null;
10755
- const source = isRecord$117(message.source) ? message.source : void 0;
10755
+ const source = isRecord$118(message.source) ? message.source : void 0;
10756
10756
  const kind = source !== void 0 && typeof source.kind === "string" ? source.kind : void 0;
10757
10757
  const text = firstTextOf$1(message.content)?.trimStart() ?? "";
10758
10758
  if (kind === "progress-updates-language" || text.startsWith("Progress update output language override:")) return 1;
@@ -10763,7 +10763,7 @@ function classifyBootstrapUserMessage$1(message) {
10763
10763
  }
10764
10764
  function isCompactCheckpointMessage(message) {
10765
10765
  if (message === void 0 || message.role !== "user" || isToolResultMessage$9(message)) return false;
10766
- const source = isRecord$117(message.source) ? message.source : void 0;
10766
+ const source = isRecord$118(message.source) ? message.source : void 0;
10767
10767
  if (source !== void 0 && source.kind === "compact-checkpoint") return true;
10768
10768
  return firstTextOf$1(message.content)?.trimStart().startsWith("This is an automatically generated checkpoint condensing") === true;
10769
10769
  }
@@ -10771,7 +10771,7 @@ function isCompactCheckpointMessage(message) {
10771
10771
  function normalizeAgentInstructionsMessage(message) {
10772
10772
  if (!Array.isArray(message.content) || message.content.length !== 1) return message;
10773
10773
  const first = message.content[0];
10774
- if (!isRecord$117(first) || first.type !== "text" || typeof first.text !== "string") return message;
10774
+ if (!isRecord$118(first) || first.type !== "text" || typeof first.text !== "string") return message;
10775
10775
  const raw = first.text;
10776
10776
  const firstIdx = raw.indexOf("\n\nInstructions from: ");
10777
10777
  if (firstIdx < 0) return message;
@@ -10884,7 +10884,7 @@ function allTextOf(content) {
10884
10884
  if (typeof content === "string") return content;
10885
10885
  if (!Array.isArray(content)) return "";
10886
10886
  return content.map((block) => {
10887
- if (!isRecord$117(block)) return "";
10887
+ if (!isRecord$118(block)) return "";
10888
10888
  if (block.type === "text" && typeof block.text === "string") return block.text;
10889
10889
  if (block.type === "tool-result") return allTextOf(block.content);
10890
10890
  return "";
@@ -13011,7 +13011,7 @@ var CodexCredentialImportError = class extends Error {
13011
13011
  this.name = "CodexCredentialImportError";
13012
13012
  }
13013
13013
  };
13014
- function isRecord$116(value) {
13014
+ function isRecord$117(value) {
13015
13015
  return typeof value === "object" && value !== null && !Array.isArray(value);
13016
13016
  }
13017
13017
  function text$7(value) {
@@ -13045,7 +13045,7 @@ function parseCredential(record) {
13045
13045
  accessToken,
13046
13046
  ...idToken === void 0 ? {} : { idToken }
13047
13047
  });
13048
- const live = isRecord$116(record.live_identity) ? record.live_identity : {};
13048
+ const live = isRecord$117(record.live_identity) ? record.live_identity : {};
13049
13049
  const credentials = {
13050
13050
  accessToken,
13051
13051
  refreshToken,
@@ -13059,13 +13059,13 @@ function parseCredential(record) {
13059
13059
  return credentials;
13060
13060
  }
13061
13061
  function parseSub2Api(value) {
13062
- if (!isRecord$116(value) || !Array.isArray(value.accounts)) throw new CodexCredentialImportError("The file is not a sub2api account export.");
13062
+ if (!isRecord$117(value) || !Array.isArray(value.accounts)) throw new CodexCredentialImportError("The file is not a sub2api account export.");
13063
13063
  if (!(value.type === void 0 && text$7(value.exported_at) !== void 0 && Array.isArray(value.proxies)) && value.type !== "sub2api-data" && value.type !== "sub2api-bundle") throw new CodexCredentialImportError("The file is not a sub2api account export.");
13064
13064
  if (value.accounts.length > MAX_JSON_ACCOUNTS) throw new CodexCredentialImportError(`The export exceeds the ${MAX_JSON_ACCOUNTS}-account import limit.`);
13065
13065
  const credentials = [];
13066
13066
  let skipped = 0;
13067
13067
  for (const account of value.accounts) {
13068
- const parsed = isRecord$116(account) && account.platform === "openai" && account.type === "oauth" && account.disabled !== true && isRecord$116(account.credentials) && (account.credentials.type === void 0 || account.credentials.type === "codex") ? parseCredential(account.credentials) : void 0;
13068
+ const parsed = isRecord$117(account) && account.platform === "openai" && account.type === "oauth" && account.disabled !== true && isRecord$117(account.credentials) && (account.credentials.type === void 0 || account.credentials.type === "codex") ? parseCredential(account.credentials) : void 0;
13069
13069
  if (parsed === void 0) skipped += 1;
13070
13070
  else credentials.push(parsed);
13071
13071
  }
@@ -13136,7 +13136,7 @@ function parseCpa(buffer) {
13136
13136
  let skipped = 0;
13137
13137
  for (const entry of entries) try {
13138
13138
  const value = JSON.parse(entry.toString("utf8"));
13139
- const parsed = isRecord$116(value) && value.type === "codex" ? parseCredential(value) : void 0;
13139
+ const parsed = isRecord$117(value) && value.type === "codex" ? parseCredential(value) : void 0;
13140
13140
  if (parsed === void 0) skipped += 1;
13141
13141
  else credentials.push(parsed);
13142
13142
  } catch {
@@ -13657,7 +13657,7 @@ function maskProxyUrl(value) {
13657
13657
  return null;
13658
13658
  }
13659
13659
  }
13660
- function isRecord$115(value) {
13660
+ function isRecord$116(value) {
13661
13661
  return typeof value === "object" && value !== null && !Array.isArray(value);
13662
13662
  }
13663
13663
  function readPreferencesUpdate(value, current) {
@@ -13715,7 +13715,7 @@ function readPreferencesUpdate(value, current) {
13715
13715
  patch.subagentAllowParentForkByMainModel = value.subagentAllowParentForkByMainModel;
13716
13716
  }
13717
13717
  if ("contextWindowOverrides" in value) {
13718
- if (!isRecord$115(value.contextWindowOverrides)) throw new PreferenceError("contextWindowOverrides must be an object.");
13718
+ if (!isRecord$116(value.contextWindowOverrides)) throw new PreferenceError("contextWindowOverrides must be an object.");
13719
13719
  const overrides = {};
13720
13720
  for (const [model, contextWindow] of Object.entries(value.contextWindowOverrides)) {
13721
13721
  if (!isCodexModelId(model)) throw new PreferenceError("Unknown Codex model for a context window override.");
@@ -19188,7 +19188,8 @@ function registerCommandCodePreferenceStore(settings, fallbackStore = new FileMo
19188
19188
  enabledModelIds: [...DEFAULT_ENABLED_MODEL_IDS$6],
19189
19189
  catalogModels: [],
19190
19190
  contextWindowOverrides: {},
19191
- defaultReasoningEffort: null
19191
+ defaultReasoningEffort: null,
19192
+ zeroDataRetention: true
19192
19193
  };
19193
19194
  fallbackStore.read().then((stored) => {
19194
19195
  snapshot = stored;
@@ -19205,7 +19206,8 @@ function registerCommandCodePreferenceStore(settings, fallbackStore = new FileMo
19205
19206
  enabled: z$1.boolean().default(true),
19206
19207
  enabledModelIds: z$1.array(z$1.string()).default([...DEFAULT_ENABLED_MODEL_IDS$6]),
19207
19208
  contextWindowOverrides: z$1.dict(z$1.number()).default({}),
19208
- defaultReasoningEffort: z$1.union([...COMMAND_CODE_REASONING_EFFORTS.map((effort) => z$1.const(effort)), z$1.const(null)]).default(null)
19209
+ defaultReasoningEffort: z$1.union([...COMMAND_CODE_REASONING_EFFORTS.map((effort) => z$1.const(effort)), z$1.const(null)]).default(null),
19210
+ zeroDataRetention: z$1.boolean().default(true)
19209
19211
  }));
19210
19212
  return {
19211
19213
  status: () => {
@@ -19215,7 +19217,8 @@ function registerCommandCodePreferenceStore(settings, fallbackStore = new FileMo
19215
19217
  enabledModelIds: value.enabledModelIds,
19216
19218
  catalogModels: [],
19217
19219
  contextWindowOverrides: value.contextWindowOverrides,
19218
- defaultReasoningEffort: value.defaultReasoningEffort
19220
+ defaultReasoningEffort: value.defaultReasoningEffort,
19221
+ zeroDataRetention: value.zeroDataRetention !== false
19219
19222
  };
19220
19223
  },
19221
19224
  update: async (patch) => {
@@ -19224,7 +19227,8 @@ function registerCommandCodePreferenceStore(settings, fallbackStore = new FileMo
19224
19227
  enabled: patch.enabled !== void 0 ? patch.enabled : current.enabled !== false,
19225
19228
  enabledModelIds: patch.enabledModelIds ?? current.enabledModelIds,
19226
19229
  contextWindowOverrides: patch.contextWindowOverrides ? mergeContextWindowOverrides(current.contextWindowOverrides, patch.contextWindowOverrides) : current.contextWindowOverrides,
19227
- defaultReasoningEffort: patch.defaultReasoningEffort !== void 0 ? patch.defaultReasoningEffort : current.defaultReasoningEffort
19230
+ defaultReasoningEffort: patch.defaultReasoningEffort !== void 0 ? patch.defaultReasoningEffort : current.defaultReasoningEffort,
19231
+ zeroDataRetention: patch.zeroDataRetention !== void 0 ? patch.zeroDataRetention : current.zeroDataRetention !== false
19228
19232
  };
19229
19233
  await scope.update(normalized);
19230
19234
  fallbackStore.updateSettings(patch).catch(() => void 0);
@@ -19383,7 +19387,8 @@ var FileModelSettingsStore$1 = class {
19383
19387
  enabledModelIds,
19384
19388
  catalogModels,
19385
19389
  contextWindowOverrides,
19386
- defaultReasoningEffort
19390
+ defaultReasoningEffort,
19391
+ zeroDataRetention: record.zeroDataRetention !== false
19387
19392
  };
19388
19393
  }
19389
19394
  } catch {}
@@ -19392,7 +19397,8 @@ var FileModelSettingsStore$1 = class {
19392
19397
  enabledModelIds: [...DEFAULT_ENABLED_MODEL_IDS$6],
19393
19398
  catalogModels: [],
19394
19399
  contextWindowOverrides: {},
19395
- defaultReasoningEffort: null
19400
+ defaultReasoningEffort: null,
19401
+ zeroDataRetention: true
19396
19402
  };
19397
19403
  }
19398
19404
  async write(settings) {
@@ -19408,7 +19414,8 @@ var FileModelSettingsStore$1 = class {
19408
19414
  ...patch.enabled !== void 0 ? { enabled: patch.enabled } : {},
19409
19415
  ...patch.enabledModelIds !== void 0 ? { enabledModelIds: patch.enabledModelIds } : {},
19410
19416
  ...patch.contextWindowOverrides !== void 0 ? { contextWindowOverrides: mergeContextWindowOverrides(current.contextWindowOverrides, patch.contextWindowOverrides) } : {},
19411
- ...patch.defaultReasoningEffort !== void 0 ? { defaultReasoningEffort: patch.defaultReasoningEffort } : {}
19417
+ ...patch.defaultReasoningEffort !== void 0 ? { defaultReasoningEffort: patch.defaultReasoningEffort } : {},
19418
+ ...patch.zeroDataRetention !== void 0 ? { zeroDataRetention: patch.zeroDataRetention } : {}
19412
19419
  };
19413
19420
  await this.write(next);
19414
19421
  return next;
@@ -19525,11 +19532,11 @@ function commandCodeHeaders(apiKey, extra = {}) {
19525
19532
  function timeoutSignal$5(signal, ms) {
19526
19533
  return signal ? AbortSignal.any([signal, AbortSignal.timeout(ms)]) : AbortSignal.timeout(ms);
19527
19534
  }
19528
- function isRecord$114(value) {
19535
+ function isRecord$115(value) {
19529
19536
  return typeof value === "object" && value !== null && !Array.isArray(value);
19530
19537
  }
19531
19538
  function asRecord$21(value) {
19532
- return isRecord$114(value) ? value : void 0;
19539
+ return isRecord$115(value) ? value : void 0;
19533
19540
  }
19534
19541
  function asString$41(value) {
19535
19542
  if (typeof value === "string" && value.trim() !== "") return value;
@@ -19573,7 +19580,7 @@ function deepValue(value, keys, depth = 0) {
19573
19580
  }
19574
19581
  return;
19575
19582
  }
19576
- if (!isRecord$114(value)) return void 0;
19583
+ if (!isRecord$115(value)) return void 0;
19577
19584
  for (const key of keys) if (value[key] !== void 0 && value[key] !== null) return value[key];
19578
19585
  for (const nested of Object.values(value)) {
19579
19586
  const hit = deepValue(nested, keys, depth + 1);
@@ -19587,7 +19594,7 @@ function collectRecords(value, keys, depth = 0, out = []) {
19587
19594
  for (const entry of value) collectRecords(entry, keys, depth + 1, out);
19588
19595
  return out;
19589
19596
  }
19590
- if (!isRecord$114(value)) return out;
19597
+ if (!isRecord$115(value)) return out;
19591
19598
  if (keys.some((key) => value[key] !== void 0)) out.push(value);
19592
19599
  for (const nested of Object.values(value)) collectRecords(nested, keys, depth + 1, out);
19593
19600
  return out;
@@ -20472,6 +20479,56 @@ function cleanOrphanedToolCalls(messages, refold) {
20472
20479
  return nonEmpty.length === 0 ? messages : refold(nonEmpty);
20473
20480
  }
20474
20481
  //#endregion
20482
+ //#region src/host/common/reasoning-seed-replay.ts
20483
+ /**
20484
+ * Which historical reasoning a chat-wire line sends back as `reasoning_content`.
20485
+ *
20486
+ * DeepSeek keeps every historical reasoning turn when tools are present, so a
20487
+ * line that drops it makes the model re-derive its plan each step. Only the same
20488
+ * line and model's own DeepSeek reasoning is replayed — another model's trace
20489
+ * would be adopted as the model's own style — plus the experimental reasoning seed.
20490
+ */
20491
+ /** `replayState.response.kind` stamped on seed assistant turns. */
20492
+ const REASONING_SEED_SOURCE_KIND = "reasoning-seed";
20493
+ function isRecord$114(value) {
20494
+ return typeof value === "object" && value !== null && !Array.isArray(value);
20495
+ }
20496
+ /**
20497
+ * The seed reasoning text of one assistant message, or null for every other message.
20498
+ * @param message - one request message in harness shape.
20499
+ * @returns joined reasoning text when the message is a seed turn.
20500
+ */
20501
+ function reasoningSeedReplayText(message) {
20502
+ if (!isRecord$114(message) || message.role !== "assistant") return null;
20503
+ const source = isRecord$114(message.source) ? message.source : void 0;
20504
+ const state = isRecord$114(source?.replayState) ? source.replayState : void 0;
20505
+ if ((isRecord$114(state?.response) ? state.response : void 0)?.kind !== "reasoning-seed") return null;
20506
+ const parts = [];
20507
+ for (const block of Array.isArray(message.content) ? message.content : []) if (isRecord$114(block) && block.type === "reasoning" && typeof block.text === "string" && block.text !== "") parts.push(block.text);
20508
+ return parts.length === 0 ? null : parts.join("");
20509
+ }
20510
+ function bareModel(model) {
20511
+ const trimmed = model.trim().toLowerCase();
20512
+ return trimmed.slice(trimmed.lastIndexOf("/") + 1);
20513
+ }
20514
+ /**
20515
+ * Reasoning to attach to one assistant message on a chat wire, or null.
20516
+ * @param message - one request message in harness shape.
20517
+ * @param provider - the line serializing the request.
20518
+ * @param model - the requested model id.
20519
+ * @returns seed reasoning, or the same line and DeepSeek model's own reasoning.
20520
+ */
20521
+ function chatReasoningReplayText(message, provider, model) {
20522
+ const seed = reasoningSeedReplayText(message);
20523
+ if (seed !== null) return seed;
20524
+ if (!isRecord$114(message) || message.role !== "assistant" || !bareModel(model).startsWith("deepseek")) return null;
20525
+ const source = isRecord$114(message.source) ? message.source : void 0;
20526
+ if (source?.kind !== "model" || source.provider !== provider || source.model !== model) return null;
20527
+ const parts = [];
20528
+ for (const block of Array.isArray(message.content) ? message.content : []) if (isRecord$114(block) && block.type === "reasoning" && typeof block.text === "string" && block.text !== "") parts.push(block.text);
20529
+ return parts.length === 0 ? null : parts.join("");
20530
+ }
20531
+ //#endregion
20475
20532
  //#region src/host/providers/command-code/mapper.ts
20476
20533
  /**
20477
20534
  * Provider-wire mapping for the two Command Code provider endpoints.
@@ -20926,6 +20983,8 @@ function buildOpenAIRequest$1(options, images = NO_RESOLVED_IMAGES$4) {
20926
20983
  content
20927
20984
  };
20928
20985
  if (toolCalls.length > 0) entry.tool_calls = toolCalls;
20986
+ const seedReasoning = chatReasoningReplayText(message, options.provider, options.model);
20987
+ if (seedReasoning !== null) entry.reasoning_content = seedReasoning;
20929
20988
  if (content !== "" || toolCalls.length > 0) messages.push(entry);
20930
20989
  continue;
20931
20990
  }
@@ -22315,13 +22374,19 @@ function resolveDefaultReasoningEffort$3(efforts, configuredEffort) {
22315
22374
  }
22316
22375
  /**
22317
22376
  * Resolves whether Zero Data Retention (ZDR) routing is active for Command Code.
22318
- * An explicit boolean on adapter options takes precedence over host environment variables.
22319
- * When not specified in options, DSH_COMMAND_CODE_ZDR is consulted first, then CMD_ZDR.
22377
+ * An explicit boolean on adapter options wins; then a set DSH_COMMAND_CODE_ZDR,
22378
+ * then a set CMD_ZDR (`1` = on, anything else = off); otherwise the settings-card
22379
+ * switch, which is on by default.
22320
22380
  */
22321
- function resolveZeroDataRetention(optionsZdr) {
22381
+ function resolveZeroDataRetention(optionsZdr, settingZdr) {
22322
22382
  if (optionsZdr !== void 0) return optionsZdr;
22323
22383
  if (process.env.DSH_COMMAND_CODE_ZDR !== void 0) return process.env.DSH_COMMAND_CODE_ZDR === "1";
22324
- return process.env.CMD_ZDR === "1";
22384
+ if (process.env.CMD_ZDR !== void 0) return process.env.CMD_ZDR === "1";
22385
+ return settingZdr !== false;
22386
+ }
22387
+ /** Whether host options or the environment fix ZDR, so the settings switch has no effect. */
22388
+ function isZeroDataRetentionLocked(optionsZdr) {
22389
+ return optionsZdr !== void 0 || process.env.DSH_COMMAND_CODE_ZDR !== void 0 || process.env.CMD_ZDR !== void 0;
22325
22390
  }
22326
22391
  /**
22327
22392
  * Classifies model-specific access or plan entitlement denials.
@@ -22500,7 +22565,7 @@ var CommandCodeAdapter = class extends LlmAdapter {
22500
22565
  const fetchFn = this.options.fetchFn ?? fetch;
22501
22566
  const catalogEntry = (await this.catalog()).find((entry) => entry.id === options.model);
22502
22567
  const wire = (catalogEntry === void 0 ? void 0 : wireForCatalogEntry$1(catalogEntry)) ?? wireForModel$2(options.model);
22503
- const isZdr = resolveZeroDataRetention(this.options.zeroDataRetention);
22568
+ const isZdr = resolveZeroDataRetention(this.options.zeroDataRetention, (await this.settings()).zeroDataRetention);
22504
22569
  if (isZdr) requireCapability({
22505
22570
  provider: PROVIDER_ID$25,
22506
22571
  wire,
@@ -23548,7 +23613,8 @@ async function getCommandCodeWebStatus(store, modelSettings, preferences, option
23548
23613
  lastFetchedAt: quota?.fetchedAt ?? null,
23549
23614
  catalogFetchedAt: getCachedCatalogFetchedAt(),
23550
23615
  catalogStale: isCatalogStale(),
23551
- ...resolveZeroDataRetention(options.zeroDataRetention) ? { zeroDataRetention: true } : options.zeroDataRetention !== void 0 ? { zeroDataRetention: false } : {},
23616
+ zeroDataRetention: resolveZeroDataRetention(options.zeroDataRetention, settings.zeroDataRetention),
23617
+ ...isZeroDataRetentionLocked(options.zeroDataRetention) ? { zeroDataRetentionLocked: true } : {},
23552
23618
  models,
23553
23619
  contextWindowOverrides: settings.contextWindowOverrides,
23554
23620
  defaultReasoningEffort: settings.defaultReasoningEffort,
@@ -23708,6 +23774,7 @@ function registerCommandCodeRoutes(ctx, store, modelSettings, preferences, optio
23708
23774
  const effort = body.defaultReasoningEffort;
23709
23775
  if (effort === null || isCommandCodeReasoningEffort(effort)) patch.defaultReasoningEffort = effort;
23710
23776
  }
23777
+ if (typeof body.zeroDataRetention === "boolean") patch.zeroDataRetention = body.zeroDataRetention;
23711
23778
  if (preferences) await preferences.update(patch);
23712
23779
  else await modelSettings.updateSettings(patch);
23713
23780
  if (patch.enabledModelIds !== void 0 || patch.enabled !== void 0) ctx.emit?.("llm/adapters-updated");
@@ -34098,10 +34165,12 @@ function buildOpenCodeGoChatRequest(options, images, entry, settings) {
34098
34165
  };
34099
34166
  });
34100
34167
  const content = chatContent$2(message, images, false);
34168
+ const seedReasoning = chatReasoningReplayText(message, options.provider, options.model);
34101
34169
  if (content !== "" || toolCalls.length > 0) messages.push({
34102
34170
  role: "assistant",
34103
34171
  content,
34104
- ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
34172
+ ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {},
34173
+ ...seedReasoning === null ? {} : { reasoning_content: seedReasoning }
34105
34174
  });
34106
34175
  continue;
34107
34176
  }
@@ -51434,10 +51503,12 @@ function buildOpenCodeZenChatRequest(options, images, entry, settings) {
51434
51503
  };
51435
51504
  });
51436
51505
  const content = chatContent$1(message, images, false);
51506
+ const seedReasoning = chatReasoningReplayText(message, options.provider, options.model);
51437
51507
  if (content !== "" || toolCalls.length > 0) messages.push({
51438
51508
  role: "assistant",
51439
51509
  content,
51440
- ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
51510
+ ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {},
51511
+ ...seedReasoning === null ? {} : { reasoning_content: seedReasoning }
51441
51512
  });
51442
51513
  continue;
51443
51514
  }
@@ -119186,6 +119257,204 @@ function installDeepSeekV41FlashOptimizations(ctx, options = {}) {
119186
119257
  } };
119187
119258
  }
119188
119259
  //#endregion
119260
+ //#region src/host/runtime/deepseek-v41-flash/reasoning-seed.ts
119261
+ /**
119262
+ * DeepSeek V4.1 Flash 实验性推理风格示范(默认关闭)。
119263
+ *
119264
+ * V4.1 Flash 在带工具的请求里保留全部历史思考,并会延续历史思考的写法。本模块在
119265
+ * 对话请求的最前面插入固定的示范对话,让模型把精简的笔记式思考当作自己的先例。
119266
+ * 示范只改本次请求、不写入会话;正文逐字节恒定,前缀缓存每步都能命中。
119267
+ *
119268
+ * @module @eddyskywalker/dsh-chatgpt-subscription/host/deepseek-v41-flash/reasoning-seed
119269
+ */
119270
+ /** 示范消息 id 前缀;用于识别已插入的示范,避免重复插入。 */
119271
+ const REASONING_SEED_ID_PREFIX = "dsh-reasoning-seed-";
119272
+ /** 固定示范正文。改动它会让所有已开启会话的前缀缓存失效一次。 */
119273
+ const REASONING_SEED_EXCHANGES = Object.freeze([{
119274
+ user: "Session warm-up, not a task; the real request follows. Note how you will work in this session, then reply with one word.",
119275
+ reasoning: [
119276
+ "Warm-up only, real task comes next. Plan for session: read request, locate exact files/symbols first. Batch independent reads in one program, return concise evidence.",
119277
+ "Checkable facts -> check via tools, not guess. Think in short notes, keep only decision-relevant points; no restating rules or user text.",
119278
+ "Before negative claim, run cheap check that could flip it. Before edit/rename/delete, find dependents. Evidence enough -> act, no repeated read loops. Same error twice -> switch approach.",
119279
+ "Final answer: full sentences, user language. Now reply one word."
119280
+ ].join("\n"),
119281
+ reply: "Ready."
119282
+ }, {
119283
+ user: "Warm-up 2, not a task: in one sentence, how would you approach tests failing right after a config key rename?",
119284
+ reasoning: [
119285
+ "Rename regression. Likely stale refs: code, tests, fixtures, schema defaults, docs. Grep old key whole repo incl json/yaml.",
119286
+ "Existing user configs still carry old key -> need migration or alias, else silent default. Then typecheck + affected tests; full suite if shared type. No weakening asserts.",
119287
+ "Answer one sentence."
119288
+ ].join("\n"),
119289
+ reply: "Search the old key across code, fixtures and docs, add a migration or alias for existing configs, then run the typecheck and the affected tests."
119290
+ }]);
119291
+ const NATIVE_PROVIDERS = /* @__PURE__ */ new Set([
119292
+ "deepseek-official",
119293
+ "deepseek-account",
119294
+ "deepseek",
119295
+ "cline-pass",
119296
+ "opendesign"
119297
+ ]);
119298
+ const ENVELOPE_PROVIDERS = /* @__PURE__ */ new Set([
119299
+ "volcengine-ark",
119300
+ "tencent-tokenhub",
119301
+ "qianfan-token-plan",
119302
+ "alibaba-token-plan",
119303
+ "qianwen-token-plan"
119304
+ ]);
119305
+ const MARKER_PROVIDERS = /* @__PURE__ */ new Set([
119306
+ "opencode-zen",
119307
+ "opencode-go",
119308
+ "relayone",
119309
+ "command-code"
119310
+ ]);
119311
+ /**
119312
+ * 读取一条线路的示范承载方式。
119313
+ * @param provider - 线路 id。
119314
+ * @returns 承载方式;线路无法承载时返回 undefined。
119315
+ */
119316
+ function reasoningSeedCarriage(provider) {
119317
+ if (typeof provider !== "string") return void 0;
119318
+ const id = provider.trim().toLowerCase();
119319
+ if (NATIVE_PROVIDERS.has(id)) return "native";
119320
+ if (ENVELOPE_PROVIDERS.has(id)) return "envelope";
119321
+ if (MARKER_PROVIDERS.has(id)) return "marker";
119322
+ }
119323
+ /**
119324
+ * 为指定线路与模型构造示范消息。
119325
+ * @param provider - 线路 id。
119326
+ * @param model - 本次请求的模型 id;信封线路据此判断是否回放。
119327
+ * @returns 交替排列的用户与助手示范消息;线路无法承载时为空数组。
119328
+ */
119329
+ function buildReasoningSeedMessages(provider, model) {
119330
+ const carriage = reasoningSeedCarriage(provider);
119331
+ if (carriage === void 0) return [];
119332
+ return REASONING_SEED_EXCHANGES.flatMap((exchange, index) => [{
119333
+ id: `${REASONING_SEED_ID_PREFIX}user-${index + 1}`,
119334
+ role: "user",
119335
+ content: [{
119336
+ type: "text",
119337
+ text: exchange.user
119338
+ }],
119339
+ source: { kind: REASONING_SEED_SOURCE_KIND }
119340
+ }, {
119341
+ id: `${REASONING_SEED_ID_PREFIX}assistant-${index + 1}`,
119342
+ role: "assistant",
119343
+ content: [{
119344
+ type: "reasoning",
119345
+ text: exchange.reasoning
119346
+ }, {
119347
+ type: "text",
119348
+ text: exchange.reply
119349
+ }],
119350
+ source: {
119351
+ kind: "model",
119352
+ provider,
119353
+ model,
119354
+ ...carriage === "envelope" ? { replayState: {
119355
+ response: {
119356
+ kind: REASONING_SEED_SOURCE_KIND,
119357
+ provider,
119358
+ model,
119359
+ form: "full"
119360
+ },
119361
+ blocks: [{ type: "reasoning" }, { type: "text" }]
119362
+ } } : carriage === "marker" ? { replayState: { response: { kind: REASONING_SEED_SOURCE_KIND } } } : {}
119363
+ }
119364
+ }]);
119365
+ }
119366
+ function isSeed(message) {
119367
+ return typeof message?.id === "string" && message.id.startsWith("dsh-reasoning-seed-");
119368
+ }
119369
+ /**
119370
+ * 把示范插到前导 system 消息之后、第一条用户消息之前。
119371
+ *
119372
+ * 前导段之后若不是用户消息(例如开头就有 developer 工具变更),按原样返回:
119373
+ * 这类请求的顺序约束因适配器而异,宁可不插也不改变既有语义。
119374
+ * @param messages - 本次请求的消息。
119375
+ * @param provider - 线路 id。
119376
+ * @param model - 模型 id。
119377
+ * @returns 插入示范后的新数组;不适用时返回原数组。
119378
+ */
119379
+ function insertReasoningSeed(messages, provider, model) {
119380
+ if (messages.some(isSeed)) return messages;
119381
+ let index = 0;
119382
+ while (index < messages.length && messages[index]?.role === "system") index += 1;
119383
+ if (messages[index]?.role !== "user") return messages;
119384
+ const seed = buildReasoningSeedMessages(provider, model);
119385
+ if (seed.length === 0) return messages;
119386
+ return [
119387
+ ...messages.slice(0, index),
119388
+ ...seed,
119389
+ ...messages.slice(index)
119390
+ ];
119391
+ }
119392
+ /** 读取实验开关(兼容 volatile 活引用与普通布尔值);默认关闭。 */
119393
+ function resolveDeepSeekV41FlashReasoningSeedEnabled(config) {
119394
+ const field = config?.deepseekV41FlashReasoningSeed;
119395
+ if (field !== null && typeof field === "object") try {
119396
+ return field.get() === true;
119397
+ } catch {
119398
+ return false;
119399
+ }
119400
+ return field === true;
119401
+ }
119402
+ const THINKING_OFF = /* @__PURE__ */ new Set([
119403
+ "off",
119404
+ "none",
119405
+ "disabled"
119406
+ ]);
119407
+ /**
119408
+ * 判断一次请求是否应插入示范。
119409
+ * @param options - `llm/stream` 请求。
119410
+ * @returns 应插入时返回 true。
119411
+ */
119412
+ function shouldSeedRequest(options, allowProvider) {
119413
+ if (options.purpose !== void 0) return false;
119414
+ if (!isDeepSeekV41Flash(options.model, options.provider)) return false;
119415
+ if (reasoningSeedCarriage(options.provider) === void 0) return false;
119416
+ if (allowProvider !== void 0 && !allowProvider(options.provider.trim().toLowerCase())) return false;
119417
+ if (options.tools === void 0 || options.tools.length === 0) return false;
119418
+ if (typeof options.reasoningEffort === "string" && THINKING_OFF.has(options.reasoningEffort.trim().toLowerCase())) return false;
119419
+ return true;
119420
+ }
119421
+ /**
119422
+ * 安装实验性推理风格示范监听器。
119423
+ * @param ctx - 结构化宿主上下文。
119424
+ * @param options - 开关。
119425
+ * @returns 释放函数。
119426
+ */
119427
+ function installDeepSeekV41FlashReasoningSeed(ctx, options = {}) {
119428
+ const host = ctx;
119429
+ const on = host?.on;
119430
+ if (typeof on !== "function") return () => {};
119431
+ const enabled = () => {
119432
+ try {
119433
+ return options.enabled?.() === true;
119434
+ } catch {
119435
+ return false;
119436
+ }
119437
+ };
119438
+ const allowProvider = (provider) => {
119439
+ try {
119440
+ return options.allowProvider === void 0 || options.allowProvider(provider);
119441
+ } catch {
119442
+ return false;
119443
+ }
119444
+ };
119445
+ const dispose = on.call(host, "llm/stream", async function* seedByStream(request, next) {
119446
+ if (!enabled() || !shouldSeedRequest(request, allowProvider) || Object.isFrozen(request)) return yield* next();
119447
+ const messages = request.messages;
119448
+ if (messages === void 0 || messages.length === 0) return yield* next();
119449
+ const seeded = insertReasoningSeed(messages, request.provider, request.model);
119450
+ if (seeded !== messages) request.messages = seeded;
119451
+ yield* next();
119452
+ }, { global: true });
119453
+ return () => {
119454
+ if (typeof dispose === "function") dispose();
119455
+ };
119456
+ }
119457
+ //#endregion
119189
119458
  //#region src/host/runtime/open-models/discipline.ts
119190
119459
  /**
119191
119460
  * 开源模型家族专属静态尾部纪律注入器。
@@ -132167,10 +132436,12 @@ function buildRelayOneChatRequest(options, images, entry, settings) {
132167
132436
  };
132168
132437
  });
132169
132438
  const content = chatContent(message, images, false);
132439
+ const seedReasoning = chatReasoningReplayText(message, options.provider, options.model);
132170
132440
  if (content !== "" || toolCalls.length > 0) messages.push({
132171
132441
  role: "assistant",
132172
132442
  content,
132173
- ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {}
132443
+ ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {},
132444
+ ...seedReasoning === null ? {} : { reasoning_content: seedReasoning }
132174
132445
  });
132175
132446
  continue;
132176
132447
  }
@@ -137263,6 +137534,7 @@ const Config = z$1.object({
137263
137534
  teamPolicyCacheGuard: z$1.boolean().default(true).volatile().description("保持 Agent Teams 系统提示稳定,切换团队开关时不重建前缀缓存。"),
137264
137535
  timelineCacheGuard: z$1.boolean().default(true).volatile().description("保持 Timeline 系统提示与工具描述稳定,避免中途变更使前缀缓存失效。"),
137265
137536
  deepseekV41FlashOptimization: z$1.boolean().default(true).volatile().description("启用 DeepSeek V4.1 Flash 的上下文稳定性与推理防坍塌优化。"),
137537
+ deepseekV41FlashReasoningSeed: z$1.boolean().default(false).volatile().description("实验性:让 DeepSeek V4.1 Flash 改用更精简的笔记式思考。部分线路不支持;在会话中途切换会让一次缓存失效。"),
137266
137538
  openModelsOptimization: z$1.boolean().default(true).volatile().description("启用开源模型家族的运行时稳定性与前缀缓存保护(不影响闭源模型)。"),
137267
137539
  cacheWarmup: z$1.boolean().default(true).volatile().description(CACHE_WARMUP_SETTING_DESCRIPTION),
137268
137540
  cacheWarmupProviders: z$1.array(z$1.string()).default(CONTROLLED_PROVIDERS).volatile().description("启用大结果预览投影的线路列表;留空数组表示全部关闭。"),
@@ -137384,6 +137656,10 @@ function apply(ctx, pluginConfig = {}) {
137384
137656
  });
137385
137657
  return () => handle.dispose();
137386
137658
  }, "dsh-chatgpt-subscription: DeepSeek V4.1 Flash optimizations");
137659
+ ctx.effect(() => installDeepSeekV41FlashReasoningSeed(ctx, {
137660
+ enabled: () => resolveDeepSeekV41FlashReasoningSeedEnabled(pluginConfig),
137661
+ allowProvider: (provider) => provider !== "command-code" || resolveZeroDataRetention(void 0, commandCodePreferences.status().zeroDataRetention)
137662
+ }), "dsh-chatgpt-subscription: DeepSeek V4.1 Flash reasoning seed");
137387
137663
  ctx.effect(() => {
137388
137664
  const handle = installOpenModelsOptimizations(ctx, {
137389
137665
  enabled: openModelsEnabled,