@eddyskywalker/dsh-chatgpt-subscription 1.3.0 → 1.3.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.
Files changed (26) hide show
  1. package/lib/client.js +9 -9
  2. package/lib/client.js.map +1 -1
  3. package/lib/index.js +253 -87
  4. package/lib/{tool-result-pruner-Cd3sTkjl.js → tool-result-pruner-CuKHwU2R.js} +15 -6
  5. package/lib/tool-result-pruner.js +1 -1
  6. package/lib/types/client/providers/claude/locales.d.ts +3 -3
  7. package/lib/types/client/providers/claude-api/locales.d.ts +2 -2
  8. package/lib/types/client/providers/kimi-code/locales.d.ts +3 -3
  9. package/lib/types/compat.d.ts +1 -1
  10. package/lib/types/host/providers/chatgpt-api/model-catalog.d.ts.map +1 -1
  11. package/lib/types/host/providers/claude-api/model-catalog.d.ts.map +1 -1
  12. package/lib/types/host/providers/longcat/model-catalog.d.ts.map +1 -1
  13. package/lib/types/host/providers/qianwen-token-plan/adapter.d.ts.map +1 -1
  14. package/lib/types/host/providers/qoder/mapper.d.ts.map +1 -1
  15. package/lib/types/host/providers/qoder/model-catalog.d.ts.map +1 -1
  16. package/lib/types/host/runtime/compact-after-turn/index.d.ts +22 -2
  17. package/lib/types/host/runtime/compact-after-turn/index.d.ts.map +1 -1
  18. package/lib/types/host/runtime/compaction-gate.d.ts +21 -0
  19. package/lib/types/host/runtime/compaction-gate.d.ts.map +1 -1
  20. package/lib/types/host/runtime/deepseek-v41-flash/index.d.ts +2 -1
  21. package/lib/types/host/runtime/deepseek-v41-flash/index.d.ts.map +1 -1
  22. package/lib/types/host/runtime/deepseek-v41-flash/match.d.ts +7 -5
  23. package/lib/types/host/runtime/deepseek-v41-flash/match.d.ts.map +1 -1
  24. package/lib/types/host/runtime/deepseek-v41-flash/reasoning-seed.d.ts.map +1 -1
  25. package/lib/types/index.d.ts.map +1 -1
  26. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as resolveProgressUpdatesSettings, n as attachProgressSettings } from "./progress-updates-jiHnSAmz.js";
2
2
  import { h as resolvePlanModePipelineEnabled, l as attachPlanModePipelineSettings } from "./plan-mode-pipeline-DQ8TM6mP.js";
3
3
  import { a as ADVISOR_TOOL_TIMEOUT_MS, c as PLUGIN_MESSAGE_SOURCE_KIND, d as formatToolUpdateNotice, f as leadingSystemEndIndex, h as normalizeGenerateOptions, i as ADVISOR_STATE_PATH, l as extractSystemText, m as midConversationUpdateToUserMessage, n as installBundledPresets, o as CONSULT_ADVISOR_TOOL_NAME, p as midConversationSystemToUserMessage, r as resolvesFromHere, s as LlmError$1, u as formatMidConversationSystemReminder } from "./preset-sync-RBsYhDY3.js";
4
- import { A as isDeepSeekV41Flash, B as estimateCodexPayloadTokens, C as isOpenModelSessionPrefixCacheProtected, D as matchOpenModelScope, E as matchOpenModelProfile, F as checkpointFromMetadata, G as shouldCompactCodexPayload, H as latestCodexCompaction, I as checkpointFromOutputItems, K as withCodexCompactionTrigger, L as codexCompactionReplayMetadata, M as isDeepSeekV41FlashSession, N as readScopeRoute, O as matchOpenModelSession, P as readSessionRoute, R as codexRemoteCompactionEnabled, S as isOpenModelPrefixCacheProtected, T as isStepOpenModel, U as noteCodexRemoteCompactionFailure, V as isCompactionItem, W as projectFreshCodexCompaction, _ as isKimiOpenModel, b as isMinimaxOpenModel, d as OPEN_MODEL_PROFILES, f as bareOpenModelId, g as isKimiK31OpenModel, h as isGlm5OpenModel, j as isDeepSeekV41FlashScope, k as DEEPSEEK_OFFICIAL_PROVIDERS, l as resolveSkipProviders, m as isGlm54OpenModel, n as DEFAULT_SKIP_PROVIDERS, p as isDeepSeekV4NonV41Model, r as PRUNER_SERVICE_NAME, u as shouldSkipPruningForSession, v as isLongSparseOpenModel, w as isQwenOpenModel, x as isOpenModelCacheWarmupProtected, y as isMimoOpenModel, z as codexRemoteCompactionThreshold } from "./tool-result-pruner-Cd3sTkjl.js";
4
+ import { A as isDeepSeekV41Flash, B as estimateCodexPayloadTokens, C as isOpenModelSessionPrefixCacheProtected, D as matchOpenModelScope, E as matchOpenModelProfile, F as checkpointFromMetadata, G as shouldCompactCodexPayload, H as latestCodexCompaction, I as checkpointFromOutputItems, K as withCodexCompactionTrigger, L as codexCompactionReplayMetadata, M as isDeepSeekV41FlashSession, N as readScopeRoute, O as matchOpenModelSession, P as readSessionRoute, R as codexRemoteCompactionEnabled, S as isOpenModelPrefixCacheProtected, T as isStepOpenModel, U as noteCodexRemoteCompactionFailure, V as isCompactionItem, W as projectFreshCodexCompaction, _ as isKimiOpenModel, b as isMinimaxOpenModel, d as OPEN_MODEL_PROFILES, f as bareOpenModelId, g as isKimiK31OpenModel, h as isGlm5OpenModel, j as isDeepSeekV41FlashScope, k as DEEPSEEK_OFFICIAL_PROVIDERS, l as resolveSkipProviders, m as isGlm54OpenModel, n as DEFAULT_SKIP_PROVIDERS, p as isDeepSeekV4NonV41Model, r as PRUNER_SERVICE_NAME, u as shouldSkipPruningForSession, v as isLongSparseOpenModel, w as isQwenOpenModel, x as isOpenModelCacheWarmupProtected, y as isMimoOpenModel, z as codexRemoteCompactionThreshold } from "./tool-result-pruner-CuKHwU2R.js";
5
5
  import { C as isDelegatedCaller, S as installDispatchExecutionGuard, T as resolveDispatchExecutionGuardEnabled, _ as installPlanModeExitReminder, b as registeredPlanControllerActive, h as createPlanNotice, l as PLAN_PROJECTION_KEY, n as EXIT_PLAN_MODE, w as isDelegatedSession } from "./plan-mode-cY8pp0PZ.js";
6
6
  import { createRequire } from "node:module";
7
7
  import * as LlmModule from "@deepseek-ai/dsh-llm";
@@ -891,7 +891,7 @@ const ROUTE_PREFIX$6 = "/api/dsh-chatgpt-subscription";
891
891
  * `test/responses-client.test.ts` asserts the two agree, so a release that
892
892
  * forgets this constant fails the suite instead of shipping quietly.
893
893
  */
894
- const PLUGIN_VERSION = "1.3.0";
894
+ const PLUGIN_VERSION = "1.3.1";
895
895
  const CODEX_CHATGPT_PROVIDER_ID = "codex-chatgpt";
896
896
  const CODEX_API_BASE = "https://chatgpt.com/backend-api/codex";
897
897
  const CODEX_RESPONSES_URL = `${CODEX_API_BASE}/responses`;
@@ -8943,15 +8943,15 @@ function belowThreshold(threshold, contextTokens) {
8943
8943
  return threshold > 0 && contextTokens !== void 0 && contextTokens < threshold;
8944
8944
  }
8945
8945
  /**
8946
- * 主会话「全部任务完成后压缩」的判定。
8947
- * @param facts - 观测到的事实。
8948
- * @returns 跳过原因,或 undefined(压缩)。
8946
+ * 一次性「本轮结束后压缩」的线路策略。
8947
+ * @param facts - 线路开关、任务与阈值事实;undefined 表示没有线路策略。
8948
+ * @returns normal 表示按一次性开关原本的规则压缩;hold 表示继续等待任务;
8949
+ * compact 表示现在压缩并关闭;skip 表示关闭开关但不压缩。
8949
8950
  */
8950
- function taskCompleteSkipReason(facts) {
8951
- if (!facts.enabled) return "off";
8952
- if (facts.pendingWork) return "keepalive-pending";
8953
- if (facts.writtenTtlMs !== void 0 && facts.keepaliveTtlMs !== void 0 && facts.writtenTtlMs !== facts.keepaliveTtlMs) return "other-tier";
8954
- if (belowThreshold(facts.threshold, facts.contextTokens)) return "below-threshold";
8951
+ function armedTaskDecision(facts) {
8952
+ if (facts === void 0 || !facts.enabled) return "normal";
8953
+ if (facts.pendingWork) return "hold";
8954
+ return facts.eligible ? "compact" : "skip";
8955
8955
  }
8956
8956
  //#endregion
8957
8957
  //#region src/host/common/provider-route.ts
@@ -14169,32 +14169,18 @@ var CompactAfterTurnController = class {
14169
14169
  }
14170
14170
  if (state === void 0) return;
14171
14171
  if (state.phase === "armed") {
14172
+ if (state.autoChecking) return;
14172
14173
  if (state.lastTurnEnd === null) return;
14173
14174
  if (state.lastTurnEnd === "aborted") {
14174
14175
  state.lastTurnEnd = null;
14175
14176
  return;
14176
14177
  }
14177
- const compactNow = this.deps.compactor(agent);
14178
- if (compactNow === void 0) {
14179
- state.phase = "off";
14180
- state.lastTurnEnd = null;
14181
- state.last = {
14182
- kind: "failed",
14183
- detail: "This session has no compaction engine.",
14184
- at: this.now()
14185
- };
14178
+ if (this.deps.taskPolicy === void 0) {
14179
+ state.pendingTaskComplete = false;
14180
+ this.startArmedCompaction(id, state, agent);
14186
14181
  return;
14187
14182
  }
14188
- state.phase = "compacting";
14189
- state.lastTurnEnd = null;
14190
- state.autoTurnEnd = null;
14191
- state.pendingTaskComplete = false;
14192
- state.contended = false;
14193
- const abort = new AbortController();
14194
- state.abort = abort;
14195
- this.defer(() => {
14196
- this.run(id, state, agent, compactNow, abort, false);
14197
- });
14183
+ this.scheduleArmedCheck(id, state, agent);
14198
14184
  return;
14199
14185
  }
14200
14186
  if (state.phase !== "off" || this.deps.autoCompact === void 0) return;
@@ -14223,19 +14209,37 @@ var CompactAfterTurnController = class {
14223
14209
  }
14224
14210
  /**
14225
14211
  * External trigger: every delegated child and background job of this session
14226
- * has settled, so the wait-time keepalive no longer applies. The session
14227
- * compacts once at its next idle, or straight away when it already is.
14212
+ * has settled, so the wait-time keepalive no longer applies. Automatic child
14213
+ * compaction runs at the next idle; a manually armed main session is
14214
+ * re-evaluated only after a turn has already ended.
14228
14215
  * @param sessionId - the session whose delegation batch just drained.
14229
14216
  */
14230
14217
  requestTaskComplete(sessionId) {
14231
- if (this.disposed || sessionId === "" || this.deps.autoCompact === void 0) return;
14218
+ if (this.disposed || sessionId === "" || this.deps.autoCompact === void 0 && this.deps.taskPolicy === void 0) return;
14232
14219
  const agent = this.agents.get(sessionId);
14233
14220
  if (agent === void 0) return;
14234
14221
  const state = this.ensure(sessionId);
14222
+ if (state.phase === "armed") {
14223
+ state.pendingTaskComplete = true;
14224
+ if (state.autoChecking || this.statusById.get(sessionId) !== "idle" || state.lastTurnEnd === null) return;
14225
+ if (state.lastTurnEnd === "aborted") {
14226
+ state.lastTurnEnd = null;
14227
+ state.pendingTaskComplete = false;
14228
+ return;
14229
+ }
14230
+ if (this.deps.taskPolicy === void 0) {
14231
+ state.pendingTaskComplete = false;
14232
+ this.startArmedCompaction(sessionId, state, agent);
14233
+ return;
14234
+ }
14235
+ this.scheduleArmedCheck(sessionId, state, agent);
14236
+ return;
14237
+ }
14235
14238
  if (state.phase !== "off" || state.autoChecking || this.statusById.get(sessionId) !== "idle") {
14236
14239
  state.pendingTaskComplete = true;
14237
14240
  return;
14238
14241
  }
14242
+ if (this.deps.autoCompact === void 0) return;
14239
14243
  state.autoChecking = true;
14240
14244
  const expectedEpoch = state.epoch;
14241
14245
  this.defer(() => {
@@ -14266,6 +14270,72 @@ var CompactAfterTurnController = class {
14266
14270
  this.agents.clear();
14267
14271
  this.statusById.clear();
14268
14272
  }
14273
+ /** Take the manual one-shot path immediately; shared by normal and held triggers. */
14274
+ startArmedCompaction(id, state, agent) {
14275
+ const compactNow = this.deps.compactor(agent);
14276
+ if (compactNow === void 0) {
14277
+ state.phase = "off";
14278
+ state.lastTurnEnd = null;
14279
+ state.last = {
14280
+ kind: "failed",
14281
+ detail: "This session has no compaction engine.",
14282
+ at: this.now()
14283
+ };
14284
+ return;
14285
+ }
14286
+ state.phase = "compacting";
14287
+ state.lastTurnEnd = null;
14288
+ state.autoTurnEnd = null;
14289
+ state.pendingTaskComplete = false;
14290
+ state.contended = false;
14291
+ const abort = new AbortController();
14292
+ state.abort = abort;
14293
+ this.defer(() => {
14294
+ this.run(id, state, agent, compactNow, abort, false);
14295
+ });
14296
+ }
14297
+ /** Defer the armed policy read out of the status listener. */
14298
+ scheduleArmedCheck(id, state, agent) {
14299
+ if (this.disposed || state.autoChecking) return;
14300
+ state.pendingTaskComplete = false;
14301
+ state.autoChecking = true;
14302
+ const expectedEpoch = state.epoch;
14303
+ this.defer(() => {
14304
+ this.runArmedPolicy(id, state, agent, expectedEpoch);
14305
+ });
14306
+ }
14307
+ /**
14308
+ * Ask the line policy whether the armed switch should wait, compact, or skip.
14309
+ * A request that arrives while this read is in flight sets pendingTaskComplete
14310
+ * and is picked up again in the finally block instead of being lost.
14311
+ */
14312
+ async runArmedPolicy(id, state, agent, expectedEpoch) {
14313
+ try {
14314
+ if (this.disposed || this.sessions.get(id) !== state || state.phase !== "armed" || state.epoch !== expectedEpoch || this.agents.get(id) !== agent) return;
14315
+ let facts;
14316
+ try {
14317
+ facts = await this.deps.taskPolicy?.(agent);
14318
+ } catch {
14319
+ facts = void 0;
14320
+ }
14321
+ if (this.disposed || this.sessions.get(id) !== state || state.phase !== "armed" || state.epoch !== expectedEpoch || this.agents.get(id) !== agent) return;
14322
+ const decision = armedTaskDecision(facts);
14323
+ if (decision === "hold") return;
14324
+ if (decision === "skip") {
14325
+ state.phase = "off";
14326
+ state.lastTurnEnd = null;
14327
+ state.autoTurnEnd = null;
14328
+ state.pendingTaskComplete = false;
14329
+ return;
14330
+ }
14331
+ this.startArmedCompaction(id, state, agent);
14332
+ } finally {
14333
+ state.autoChecking = false;
14334
+ const again = state.phase === "armed" && state.pendingTaskComplete && state.lastTurnEnd !== null && state.lastTurnEnd !== "aborted" && this.statusById.get(id) === "idle" && !this.disposed && this.sessions.get(id) === state;
14335
+ this.pruneIdleState(id, state);
14336
+ if (again) this.scheduleArmedCheck(id, state, agent);
14337
+ }
14338
+ }
14269
14339
  async runAuto(id, state, agent, expectedEpoch) {
14270
14340
  try {
14271
14341
  if (this.disposed || this.sessions.get(id) !== state || state.phase !== "off" || state.epoch !== expectedEpoch || this.agents.get(id) !== agent) return;
@@ -14401,6 +14471,7 @@ function installCompactAfterTurn(host, options = {}) {
14401
14471
  const controller = new CompactAfterTurnController({
14402
14472
  compactor: (agent) => compactorOf(host, options, agent),
14403
14473
  autoCompact: options.autoCompact,
14474
+ taskPolicy: options.taskPolicy,
14404
14475
  logger: host.logger
14405
14476
  });
14406
14477
  try {
@@ -47608,10 +47679,11 @@ function longcatHeaders(apiKey) {
47608
47679
  * live listing as its catalog and a small bundled table for the capabilities the
47609
47680
  * listing does not carry.
47610
47681
  *
47611
- * Capability source: models.dev's `longcat` provider (LongCat-2.5 sees text, image and
47612
- * video input; LongCat-2.0 sees text only; both declare reasoning and tool calls, and
47613
- * both publish a 1M context window). Everything else is a conservative local budget
47614
- * and is overridable per model in the settings card.
47682
+ * Capability source: models.dev's `longcat` provider (LongCat-2.5 lists text, image and
47683
+ * video input; LongCat-2.0 text only; both declare reasoning and tool calls, and both
47684
+ * publish a 1M context window). This line maps image input only, so it advertises
47685
+ * text+image until a video wire path is verified; everything else is a conservative
47686
+ * local budget and is overridable per model in the settings card.
47615
47687
  */
47616
47688
  function entry$1(input) {
47617
47689
  return {
@@ -56382,10 +56454,10 @@ const OPENCODE_ZEN_MODEL_CATALOG = [
56382
56454
  id: "deepseek-v4.1-flash-free",
56383
56455
  name: "DeepSeek V4.1 Flash Free",
56384
56456
  description: null,
56385
- canonicalId: null,
56457
+ canonicalId: "deepseek/deepseek-v4.1-flash-1017",
56386
56458
  contextWindow: 2e5,
56387
56459
  maxOutputTokens: 32e3,
56388
- reasoningEfforts: [],
56460
+ reasoningEfforts: ["low", "high"],
56389
56461
  supportsTools: true,
56390
56462
  supportsImages: true,
56391
56463
  free: true,
@@ -56395,10 +56467,10 @@ const OPENCODE_ZEN_MODEL_CATALOG = [
56395
56467
  id: "deepseek-v4.1-flash",
56396
56468
  name: "DeepSeek V4.1 Flash 1017",
56397
56469
  description: null,
56398
- canonicalId: null,
56470
+ canonicalId: "deepseek/deepseek-v4.1-flash-1017",
56399
56471
  contextWindow: 1e6,
56400
56472
  maxOutputTokens: 384e3,
56401
- reasoningEfforts: [],
56473
+ reasoningEfforts: ["low", "high"],
56402
56474
  supportsTools: true,
56403
56475
  supportsImages: true,
56404
56476
  free: false,
@@ -56408,10 +56480,10 @@ const OPENCODE_ZEN_MODEL_CATALOG = [
56408
56480
  id: "deepseek-v4-pro",
56409
56481
  name: "DeepSeek V4 Pro",
56410
56482
  description: null,
56411
- canonicalId: null,
56483
+ canonicalId: "deepseek/deepseek-v4-pro",
56412
56484
  contextWindow: 1e6,
56413
56485
  maxOutputTokens: 384e3,
56414
- reasoningEfforts: [],
56486
+ reasoningEfforts: ["high"],
56415
56487
  supportsTools: true,
56416
56488
  supportsImages: false,
56417
56489
  free: false,
@@ -56421,10 +56493,10 @@ const OPENCODE_ZEN_MODEL_CATALOG = [
56421
56493
  id: "glm-5.3",
56422
56494
  name: "GLM-5.3",
56423
56495
  description: null,
56424
- canonicalId: null,
56496
+ canonicalId: "zhipuai/glm-5.3",
56425
56497
  contextWindow: 1e6,
56426
56498
  maxOutputTokens: 131072,
56427
- reasoningEfforts: [],
56499
+ reasoningEfforts: ["low", "high"],
56428
56500
  supportsTools: true,
56429
56501
  supportsImages: false,
56430
56502
  free: false,
@@ -56434,10 +56506,10 @@ const OPENCODE_ZEN_MODEL_CATALOG = [
56434
56506
  id: "glm-5.3-flash",
56435
56507
  name: "GLM-5.3-Flash",
56436
56508
  description: null,
56437
- canonicalId: null,
56509
+ canonicalId: "zhipuai/glm-5.3-flash",
56438
56510
  contextWindow: 1e6,
56439
56511
  maxOutputTokens: 131072,
56440
- reasoningEfforts: [],
56512
+ reasoningEfforts: ["low", "high"],
56441
56513
  supportsTools: true,
56442
56514
  supportsImages: true,
56443
56515
  free: false,
@@ -104186,7 +104258,7 @@ const STATIC_GLOBAL_SEEDS = [
104186
104258
  id: "Auto",
104187
104259
  upstreamKey: "auto",
104188
104260
  name: "Auto",
104189
- reasoning: true,
104261
+ reasoning: false,
104190
104262
  supportsEffort: false,
104191
104263
  supportsImages: true
104192
104264
  },
@@ -104212,7 +104284,8 @@ const STATIC_GLOBAL_SEEDS = [
104212
104284
  name: "Efficient",
104213
104285
  reasoning: false,
104214
104286
  supportsEffort: false,
104215
- supportsImages: true
104287
+ supportsImages: true,
104288
+ contextWindow: 2e5
104216
104289
  },
104217
104290
  {
104218
104291
  id: "Lite",
@@ -104226,7 +104299,7 @@ const STATIC_GLOBAL_SEEDS = [
104226
104299
  id: "Qwen3.7Plus",
104227
104300
  upstreamKey: "qmodel",
104228
104301
  name: "Qwen3.7 Plus",
104229
- reasoning: false,
104302
+ reasoning: true,
104230
104303
  supportsEffort: false,
104231
104304
  supportsImages: true
104232
104305
  },
@@ -104236,7 +104309,12 @@ const STATIC_GLOBAL_SEEDS = [
104236
104309
  name: "Qwen4-Max",
104237
104310
  reasoning: true,
104238
104311
  supportsEffort: true,
104239
- supportsImages: true
104312
+ supportsImages: true,
104313
+ efforts: [
104314
+ "low",
104315
+ "high",
104316
+ "xhigh"
104317
+ ]
104240
104318
  },
104241
104319
  {
104242
104320
  id: "Qwen3.8-Max",
@@ -104244,7 +104322,12 @@ const STATIC_GLOBAL_SEEDS = [
104244
104322
  name: "Qwen3.8-Max",
104245
104323
  reasoning: true,
104246
104324
  supportsEffort: true,
104247
- supportsImages: true
104325
+ supportsImages: true,
104326
+ efforts: [
104327
+ "low",
104328
+ "medium",
104329
+ "xhigh"
104330
+ ]
104248
104331
  },
104249
104332
  {
104250
104333
  id: "GLM-5.4",
@@ -104252,7 +104335,12 @@ const STATIC_GLOBAL_SEEDS = [
104252
104335
  name: "GLM-5.4",
104253
104336
  reasoning: true,
104254
104337
  supportsEffort: true,
104255
- supportsImages: true
104338
+ supportsImages: true,
104339
+ efforts: [
104340
+ "low",
104341
+ "high",
104342
+ "max"
104343
+ ]
104256
104344
  },
104257
104345
  {
104258
104346
  id: "DeepSeek-V4-Pro",
@@ -104260,7 +104348,8 @@ const STATIC_GLOBAL_SEEDS = [
104260
104348
  name: "DeepSeek-V4-Pro",
104261
104349
  reasoning: true,
104262
104350
  supportsEffort: true,
104263
- supportsImages: true
104351
+ supportsImages: true,
104352
+ efforts: ["high", "max"]
104264
104353
  },
104265
104354
  {
104266
104355
  id: "DeepSeek-V4-Flash",
@@ -104268,30 +104357,44 @@ const STATIC_GLOBAL_SEEDS = [
104268
104357
  name: "DeepSeek-V4-Flash",
104269
104358
  reasoning: true,
104270
104359
  supportsEffort: true,
104271
- supportsImages: true
104360
+ supportsImages: true,
104361
+ efforts: [
104362
+ "low",
104363
+ "high",
104364
+ "max"
104365
+ ]
104272
104366
  },
104273
104367
  {
104274
- id: "Kimi-K2.7-Code",
104368
+ id: "Kimi-K2.8-Preview",
104275
104369
  upstreamKey: "kmodel",
104276
- name: "Kimi-K2.7-Code",
104277
- reasoning: false,
104278
- supportsEffort: false,
104370
+ name: "Kimi-K2.8-Preview",
104371
+ reasoning: true,
104372
+ supportsEffort: true,
104279
104373
  supportsImages: true,
104280
- contextWindow: 256e3
104374
+ efforts: [
104375
+ "low",
104376
+ "high",
104377
+ "max"
104378
+ ]
104281
104379
  },
104282
104380
  {
104283
- id: "Kimi-K3",
104381
+ id: "Kimi-K3.1-Pro",
104284
104382
  upstreamKey: "kmodel_latest",
104285
- name: "Kimi-K3",
104286
- reasoning: false,
104287
- supportsEffort: false,
104288
- supportsImages: true
104383
+ name: "Kimi-K3.1-Pro",
104384
+ reasoning: true,
104385
+ supportsEffort: true,
104386
+ supportsImages: true,
104387
+ efforts: [
104388
+ "low",
104389
+ "high",
104390
+ "max"
104391
+ ]
104289
104392
  },
104290
104393
  {
104291
104394
  id: "MiniMax-M3",
104292
104395
  upstreamKey: "mmodel",
104293
104396
  name: "MiniMax-M3",
104294
- reasoning: false,
104397
+ reasoning: true,
104295
104398
  supportsEffort: false,
104296
104399
  supportsImages: true
104297
104400
  }
@@ -104302,7 +104405,7 @@ const STATIC_CN_SEEDS = [
104302
104405
  id: "Auto",
104303
104406
  upstreamKey: "auto",
104304
104407
  name: "Auto",
104305
- reasoning: true,
104408
+ reasoning: false,
104306
104409
  supportsEffort: false,
104307
104410
  supportsImages: true,
104308
104411
  contextWindow: 2e5
@@ -104343,9 +104446,14 @@ const STATIC_CN_SEEDS = [
104343
104446
  id: "DeepSeek-V4-Flash",
104344
104447
  upstreamKey: "dfmodel",
104345
104448
  name: "DeepSeek-V4-Flash",
104346
- reasoning: false,
104347
- supportsEffort: false,
104348
- supportsImages: false
104449
+ reasoning: true,
104450
+ supportsEffort: true,
104451
+ supportsImages: true,
104452
+ efforts: [
104453
+ "low",
104454
+ "high",
104455
+ "max"
104456
+ ]
104349
104457
  },
104350
104458
  {
104351
104459
  id: "GLM-5.4",
@@ -104369,7 +104477,7 @@ const STATIC_CN_SEEDS = [
104369
104477
  id: "MiniMax-M2.7",
104370
104478
  upstreamKey: "mmodel",
104371
104479
  name: "MiniMax-M2.7",
104372
- reasoning: false,
104480
+ reasoning: true,
104373
104481
  supportsEffort: false,
104374
104482
  supportsImages: false,
104375
104483
  contextWindow: 2e5
@@ -104397,7 +104505,7 @@ function seedToEntry(seed, region) {
104397
104505
  source: "system",
104398
104506
  regions: [region],
104399
104507
  reasoning: seed.reasoning,
104400
- reasoningEfforts: seed.reasoning && seed.supportsEffort ? STATIC_EFFORT_LADDER : [],
104508
+ reasoningEfforts: seed.reasoning && seed.supportsEffort ? seed.efforts ?? STATIC_EFFORT_LADDER : [],
104401
104509
  thinkingDisableable: true,
104402
104510
  supportsImages: seed.supportsImages,
104403
104511
  defaultContextWindow: seed.contextWindow ?? QODER_DEFAULT_CONTEXT_WINDOW[region],
@@ -106128,6 +106236,14 @@ function createQoderReplayDiagnostics() {
106128
106236
  };
106129
106237
  }
106130
106238
  /**
106239
+ * Qoder 的 V4.1 Flash 在模型选择器里叫 `DeepSeek-Flash`,上行 key 是 `dfmodel`。
106240
+ * 自有回放标记按上行 key 生成,示范信封按可见 id 生成;两者必须视为同一模型,
106241
+ * 但仍只放行这一对已知别名,换到 Qwen/GLM/Kimi 时继续拒绝。
106242
+ */
106243
+ function qoderReplayModelMatches(responseModel, model) {
106244
+ return responseModel === model || responseModel === "DeepSeek-Flash" && model === "dfmodel" || responseModel === "dfmodel" && model === "DeepSeek-Flash";
106245
+ }
106246
+ /**
106131
106247
  * 把助手消息拆成上游要的三段,并决定**这条消息的推理能不能回放**。
106132
106248
  *
106133
106249
  * 回放的前提是 `message.source.replayState` 记着同一 provider、同一模型:Qoder 这条线路
@@ -106139,7 +106255,7 @@ function createQoderReplayDiagnostics() {
106139
106255
  function qoderAssistantContent(message, model, replay) {
106140
106256
  const state = isRecord$47(message.source?.replayState) ? message.source.replayState : void 0;
106141
106257
  const response = isRecord$47(state?.response) ? state.response : void 0;
106142
- const markedBlocks = response?.provider === PROVIDER_ID$8 && response.model === model && Array.isArray(state?.blocks) ? state.blocks : void 0;
106258
+ const markedBlocks = response?.provider === PROVIDER_ID$8 && qoderReplayModelMatches(response.model, model) && Array.isArray(state?.blocks) ? state.blocks : void 0;
106143
106259
  const textParts = [];
106144
106260
  const toolCalls = [];
106145
106261
  const reasoningParts = [];
@@ -125061,8 +125177,9 @@ function installDeepSeekV41FlashProgressGovernor(ctx, options = {}) {
125061
125177
  * ## 绝对隔离保证
125062
125178
  *
125063
125179
  * 全部四个子能力均通过 {@link isDeepSeekV41Flash} 严格门控:任何其它线路与任何其它
125064
- * 模型(包括 `deepseek-v4-pro`、`deepseek-v4-flash`、Qoder `DeepSeek-Flash`、
125180
+ * 模型(包括 `deepseek-v4-pro`、`deepseek-v4-flash`、Qoder 的其它模型、
125065
125181
  * Claude、GPT、Kimi、MiniMax、GLM、Qwen 等)均 100% 旁路,零字节改动、零行为变化。
125182
+ * Qoder 的 `DeepSeek-Flash` 是同一 V4.1-1017,属于本总成的正常命中范围。
125066
125183
  *
125067
125184
  * @module @eddyskywalker/dsh-chatgpt-subscription/host/deepseek-v41-flash
125068
125185
  */
@@ -125236,7 +125353,8 @@ const ENVELOPE_PROVIDERS = /* @__PURE__ */ new Set([
125236
125353
  "tencent-tokenhub",
125237
125354
  "qianfan-token-plan",
125238
125355
  "alibaba-token-plan",
125239
- "qianwen-token-plan"
125356
+ "qianwen-token-plan",
125357
+ "qoder"
125240
125358
  ]);
125241
125359
  const MARKER_PROVIDERS = /* @__PURE__ */ new Set([
125242
125360
  "opencode-zen",
@@ -137184,6 +137302,13 @@ const RETRY_POLICY$3 = resolveRetryPolicy({
137184
137302
  const prefixRequests = new PrefixRequestCoordinator({ waitMs: 2500 });
137185
137303
  const activityStore = promptCacheActivityStore(PROVIDER_ID$6);
137186
137304
  const ttlMs = (ttl) => ttl === "1h" ? 60 * 6e4 : 5 * 6e4;
137305
+ /** 目录的图片/视频布尔值必须完整投影到 DSH 的输入模态,否则视频附件会在准入层被拒。 */
137306
+ function qianwenInputModalities(entry) {
137307
+ const modalities = ["text"];
137308
+ if (entry.supportsImages) modalities.push("image");
137309
+ if (entry.supportsVideo) modalities.push("video");
137310
+ return modalities;
137311
+ }
137187
137312
  var QianwenTokenPlanAdapter = class extends LlmAdapter {
137188
137313
  store;
137189
137314
  settingsStore;
@@ -137217,7 +137342,7 @@ var QianwenTokenPlanAdapter = class extends LlmAdapter {
137217
137342
  provider: provider || PROVIDER_ID$6,
137218
137343
  id: model.id,
137219
137344
  name: model.name,
137220
- inputModalities: model.supportsImages ? ["text", "image"] : ["text"]
137345
+ inputModalities: qianwenInputModalities(model)
137221
137346
  }));
137222
137347
  }
137223
137348
  async resolveModel(provider, model, signal) {
@@ -137231,7 +137356,7 @@ var QianwenTokenPlanAdapter = class extends LlmAdapter {
137231
137356
  provider,
137232
137357
  id: model,
137233
137358
  name: entry.name,
137234
- inputModalities: entry.supportsImages ? ["text", "image"] : ["text"],
137359
+ inputModalities: qianwenInputModalities(entry),
137235
137360
  toolUpdate: "in-history",
137236
137361
  context: { contextWindow },
137237
137362
  ...outputReservation(contextWindow, entry.maxOutputTokens),
@@ -141006,9 +141131,27 @@ function templateFor(id, name) {
141006
141131
  known: false
141007
141132
  };
141008
141133
  }
141134
+ /** `[1m]` 是同一模型的 1M 上下文别名;能力必须继承基名行,不能套 CURRENT 模板。 */
141135
+ function longContextBaseId(id) {
141136
+ return id.endsWith("[1m]") ? id.slice(0, -4) : void 0;
141137
+ }
141138
+ function knownModelEntry(id, catalog) {
141139
+ const exact = catalog?.find((entry) => entry.id === id) ?? CLAUDE_API_MODELS.find((entry) => entry.id === id);
141140
+ if (exact !== void 0) return exact;
141141
+ const baseId = longContextBaseId(id);
141142
+ if (baseId === void 0) return void 0;
141143
+ const base = catalog?.find((entry) => entry.id === baseId) ?? CLAUDE_API_MODELS.find((entry) => entry.id === baseId);
141144
+ if (base === void 0) return void 0;
141145
+ return {
141146
+ ...base,
141147
+ id,
141148
+ name: base.name + " [1m]",
141149
+ contextWindow: Math.max(base.contextWindow, 1e6)
141150
+ };
141151
+ }
141009
141152
  /** Facts for one model id: the caller's catalog first, then the shipped table, then a template. */
141010
141153
  function resolveClaudeApiModel(id, catalog) {
141011
- return catalog?.find((entry) => entry.id === id) ?? CLAUDE_API_MODELS.find((entry) => entry.id === id) ?? templateFor(id, id);
141154
+ return knownModelEntry(id, catalog) ?? templateFor(id, id);
141012
141155
  }
141013
141156
  /** The shipped table as a fresh array; the cold-start placeholder before any live listing. */
141014
141157
  function claudeApiFallbackEntries() {
@@ -141018,7 +141161,7 @@ function isRecord$13(value) {
141018
141161
  return typeof value === "object" && value !== null && !Array.isArray(value);
141019
141162
  }
141020
141163
  function entryFor(id, displayName) {
141021
- const known = CLAUDE_API_MODELS.find((entry) => entry.id === id);
141164
+ const known = knownModelEntry(id);
141022
141165
  if (known !== void 0) return { ...known };
141023
141166
  return templateFor(id, displayName !== void 0 && displayName !== "" ? displayName : id);
141024
141167
  }
@@ -144237,6 +144380,8 @@ function chatGptApiUrl(baseUrl, path) {
144237
144380
  //#region src/host/providers/chatgpt-api/model-catalog.ts
144238
144381
  const FALLBACK_CONTEXT_WINDOW = 128e3;
144239
144382
  const FALLBACK_MAX_OUTPUT_TOKENS = 16384;
144383
+ /** Public API advertises 1.05M for the GPT-6 / GPT-5.6 families; Codex subscription rows carry smaller plan windows. */
144384
+ const PUBLIC_API_GPT_CONTEXT_WINDOW = 105e4;
144240
144385
  function isRecord$5(value) {
144241
144386
  return typeof value === "object" && value !== null && !Array.isArray(value);
144242
144387
  }
@@ -144252,7 +144397,7 @@ function chatGptApiFallbackEntries() {
144252
144397
  supportsImages: entry.inputModalities.includes("image"),
144253
144398
  supportsVerbosity: "supportsOutputVerbosity" in entry && entry.supportsOutputVerbosity === true
144254
144399
  }),
144255
- contextWindow: entry.contextWindow,
144400
+ contextWindow: entry.reasoningProfile === "gpt-6" || entry.reasoningProfile === "gpt-5.6" ? PUBLIC_API_GPT_CONTEXT_WINDOW : entry.contextWindow,
144256
144401
  maxOutputTokens: "maxTokens" in entry && entry.maxTokens !== void 0 ? entry.maxTokens : entry.reasoningProfile === "gpt-6" ? GPT_6_MAX_TOKENS : CODEX_DEFAULT_MAX_TOKENS,
144257
144402
  reasoningEfforts: reasoningEffortsForModel$1(entry.id).filter(isChatGptApiReasoningEffort),
144258
144403
  supportsImages: entry.inputModalities.includes("image"),
@@ -144283,7 +144428,7 @@ function defaultLiveEntry(id, name) {
144283
144428
  function isChatGptApiChatModel(id) {
144284
144429
  const normalized = id.trim().toLowerCase();
144285
144430
  if (normalized === "") return false;
144286
- if (/(embedding|whisper|tts|dall-e|moderation|transcribe|realtime|image-|audio-|sora|babbage|davinci)/.test(normalized)) return false;
144431
+ if (/(embedding|whisper|tts|dall-e|moderation|transcribe|realtime|image-|audio|sora|babbage|davinci)/.test(normalized)) return false;
144287
144432
  return /^(gpt|chatgpt|o\d|codex)/.test(normalized);
144288
144433
  }
144289
144434
  function parseLiveChatGptApiModelEntries(value) {
@@ -146109,15 +146254,36 @@ function apply(ctx, pluginConfig = {}) {
146109
146254
  if (provider === PROVIDER_ID$4) return (await claudeApiPreferences?.read())?.autoCompactSubagents === true && !belowThreshold(threshold, contextTokens);
146110
146255
  return false;
146111
146256
  }
146112
- if (provider === void 0 || !await autoCompactAfterTasksOf(provider)) return false;
146113
- return taskCompleteSkipReason({
146257
+ return false;
146258
+ },
146259
+ taskPolicy: async (agent) => {
146260
+ const sessionId = agent.session?.id;
146261
+ const provider = resolveCompactAgentProvider(agent);
146262
+ if (provider === void 0) return void 0;
146263
+ if (isDelegatedCaller(agent, ctx) || typeof sessionId === "string" && isDelegatedSession(sessionId, ctx)) return {
146264
+ enabled: false,
146265
+ pendingWork: false,
146266
+ eligible: true
146267
+ };
146268
+ if (!await autoCompactAfterTasksOf(provider)) return {
146269
+ enabled: false,
146270
+ pendingWork: false,
146271
+ eligible: true
146272
+ };
146273
+ const writtenTtlMs = await mainTierMs(provider, typeof sessionId === "string" ? sessionId : void 0);
146274
+ const keepaliveTtlMs = keepaliveTierMs(provider);
146275
+ if (writtenTtlMs !== void 0 && keepaliveTtlMs !== void 0 && writtenTtlMs !== keepaliveTtlMs) return {
146276
+ enabled: false,
146277
+ pendingWork: false,
146278
+ eligible: true
146279
+ };
146280
+ const threshold = resolveCompactThreshold(pluginConfig);
146281
+ const contextTokens = typeof sessionId === "string" ? sessionActivity(provider, sessionId).totalTokens : void 0;
146282
+ return {
146114
146283
  enabled: true,
146115
- threshold,
146116
146284
  pendingWork: typeof sessionId === "string" && (cacheWaitPendingWork?.(sessionId) ?? false),
146117
- contextTokens,
146118
- writtenTtlMs: await mainTierMs(provider, typeof sessionId === "string" ? sessionId : void 0),
146119
- keepaliveTtlMs: keepaliveTierMs(provider)
146120
- }) === void 0;
146285
+ eligible: !belowThreshold(threshold, contextTokens)
146286
+ };
146121
146287
  },
146122
146288
  onController: (controller) => {
146123
146289
  requestTaskComplete = (sessionId) => controller.requestTaskComplete(sessionId);