@eddyskywalker/dsh-chatgpt-subscription 1.2.2 → 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 (40) hide show
  1. package/lib/client.js +27 -14
  2. package/lib/client.js.map +1 -1
  3. package/lib/codemode.js +138 -1
  4. package/lib/index.js +264 -96
  5. package/lib/reverse-board.js +121 -30
  6. package/lib/{tool-result-pruner-Cd3sTkjl.js → tool-result-pruner-CuKHwU2R.js} +15 -6
  7. package/lib/tool-result-pruner.js +1 -1
  8. package/lib/types/client/features/progress-updates/settings-section.d.ts.map +1 -1
  9. package/lib/types/client/providers/claude/locales.d.ts +3 -3
  10. package/lib/types/client/providers/claude-api/locales.d.ts +2 -2
  11. package/lib/types/client/providers/kimi-code/locales.d.ts +3 -3
  12. package/lib/types/compat.d.ts +1 -1
  13. package/lib/types/host/providers/chatgpt-api/model-catalog.d.ts.map +1 -1
  14. package/lib/types/host/providers/claude-api/model-catalog.d.ts.map +1 -1
  15. package/lib/types/host/providers/longcat/model-catalog.d.ts.map +1 -1
  16. package/lib/types/host/providers/qianwen-token-plan/adapter.d.ts.map +1 -1
  17. package/lib/types/host/providers/qoder/mapper.d.ts +7 -0
  18. package/lib/types/host/providers/qoder/mapper.d.ts.map +1 -1
  19. package/lib/types/host/providers/qoder/model-catalog.d.ts.map +1 -1
  20. package/lib/types/host/runtime/codemode/transport.d.ts.map +1 -1
  21. package/lib/types/host/runtime/compact-after-turn/index.d.ts +22 -2
  22. package/lib/types/host/runtime/compact-after-turn/index.d.ts.map +1 -1
  23. package/lib/types/host/runtime/compaction-gate.d.ts +21 -0
  24. package/lib/types/host/runtime/compaction-gate.d.ts.map +1 -1
  25. package/lib/types/host/runtime/deepseek-v41-flash/index.d.ts +2 -1
  26. package/lib/types/host/runtime/deepseek-v41-flash/index.d.ts.map +1 -1
  27. package/lib/types/host/runtime/deepseek-v41-flash/match.d.ts +7 -5
  28. package/lib/types/host/runtime/deepseek-v41-flash/match.d.ts.map +1 -1
  29. package/lib/types/host/runtime/deepseek-v41-flash/reasoning-seed.d.ts.map +1 -1
  30. package/lib/types/host/runtime/presets/reverse-persona.d.ts.map +1 -1
  31. package/lib/types/host/runtime/reverse/frontier.d.ts +4 -0
  32. package/lib/types/host/runtime/reverse/frontier.d.ts.map +1 -1
  33. package/lib/types/host/runtime/reverse/store.d.ts +17 -2
  34. package/lib/types/host/runtime/reverse/store.d.ts.map +1 -1
  35. package/lib/types/host/runtime/reverse/tool.d.ts +1 -1
  36. package/lib/types/host/runtime/reverse/tool.d.ts.map +1 -1
  37. package/lib/types/index.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/presets/reverse/README.md +2 -2
  40. package/presets/reverse/agent.cordis.yml +11 -19
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.2.2";
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 = [];
@@ -107039,11 +107155,12 @@ function qoderQueueExhaustedError(base, attempts, waitedMs) {
107039
107155
  /**
107040
107156
  * 上游是不是在说「额度用尽」。
107041
107157
  *
107042
- * 认两种凭据:业务码 112,以及 403 搭配的额度信号(`isQuotaExceeded` / 购买页)。
107158
+ * 认三种凭据:业务码 112 / 110,以及 403 搭配的额度信号(`isQuotaExceeded` / 购买页)。
107043
107159
  * 额度用尽不是「这个账号坏了」,所以它归 QUOTA 而不是 AUTH——它只能等周期重置或加购。
107044
107160
  */
107045
107161
  function isQoderQuotaExhausted(facts, status) {
107046
107162
  if (facts.codes.includes("112")) return true;
107163
+ if (facts.codes.includes("110")) return true;
107047
107164
  if (status !== void 0 && status !== 403) return false;
107048
107165
  return facts.quotaExceeded === true || facts.pricingUrl !== void 0;
107049
107166
  }
@@ -122197,8 +122314,8 @@ const REVERSE_PERSONA = [
122197
122314
  "## R-1 · Planes",
122198
122315
  "",
122199
122316
  "- Depth 0 = Steward: init, open/close/merge Cells, answer Questions, request handoff, run watchdog, settle finish, report/audit. Do not decompile or trace targets.",
122200
- "- Depth 1 = Cell: bind to one open Cell on first frontier call, then claim or delegate actions. A later attempt to bind another Cell is denied.",
122201
- "- Depth 2 = Worker: inherit the parent Cell, claim one action, execute, write evidence, then stop or hand off. May spawn one Subworker for a bounded slice.",
122317
+ "- Depth 1 = Cell: bind to one open Cell on first frontier call, then claim or delegate distinct unclaimed actions. A later attempt to bind another Cell is denied.",
122318
+ "- Depth 2 = Worker: inherit the parent Cell, claim one unclaimed action, execute, write evidence, then stop or hand off. Never contend for a sibling Worker's claim or wait for it. May spawn one Subworker for a bounded slice.",
122202
122319
  "- Depth 3 = Subworker: one bounded slice; never spawn another agent.",
122203
122320
  "",
122204
122321
  "## R-2 · Graph",
@@ -122209,11 +122326,12 @@ const REVERSE_PERSONA = [
122209
122326
  "",
122210
122327
  "## R-3 · Frontier and Claims",
122211
122328
  "",
122212
- "1. Call reverse_board {action:\"frontier\"}; your Cell is enforced by the host. Choose one action by score, evidence value and novelty.",
122213
- "2. Call {action:\"claim\", actionId, operation:\"acquire\"}. Keep the claimToken and fencing.",
122214
- "3. Renew before expiry with operation:\"renew\", or release with operation:\"release\". Expired or stale fencing cannot write; reacquire after expiry. Do not use another actor token.",
122215
- "4. record and evidence require the active claimToken. Cross-Cell nodes and paths outside scope are denied.",
122216
- "5. The producer of a Finding cannot claim its verify action; leave it for an independent verifier.",
122329
+ "1. Call reverse_board {action:\"frontier\"}; your Cell is enforced by the host. A new Cell exposes one plan action, so do not fan out Workers for a singleton frontier: run it in one actor or open another Cell.",
122330
+ "2. frontier hides actions with a live claim and reports status ready/blocked/empty, available and activeClaims. Size Worker count by available actions, not by Cells. empty is not completion.",
122331
+ "3. Prefer {action:\"claim\", operation:\"next\"}: the host selects and claims an unclaimed action atomically. Use actionId with operation:\"acquire\" only when you already have a specific action. Keep the claimToken and fencing. A CLAIM_CONFLICT or NO_ACTION is final for this attempt: hand off or stop. Never poll or wait for the TTL.",
122332
+ "4. Renew before expiry with operation:\"renew\", or release with operation:\"release\". Expired or stale fencing cannot write; reacquire after expiry. Do not use another actor token.",
122333
+ "5. record and evidence require the active claimToken. Cross-Cell nodes and paths outside scope are denied.",
122334
+ "6. The producer of a Finding cannot claim its verify action; leave it for an independent verifier.",
122217
122335
  "",
122218
122336
  "## R-4 · Route Islands",
122219
122337
  "",
@@ -122222,7 +122340,7 @@ const REVERSE_PERSONA = [
122222
122340
  "## R-5 · Evidence Gate",
122223
122341
  "",
122224
122342
  "A new Finding starts proposed/queued. evidence supplies tool, command, inputHash and outputHash or content; content is persisted under evidence/ with its actual SHA-256. Evidence moves the Finding to observed. After reproduction, record reproduced.",
122225
- "Only another actor can verify: the verifier claims verify, writes independent evidence with reproduction steps, then records verified. The host rejects self-verification and skipped states. The finish intent cites verified Finding ids only; later facts invalidate it. Steward settles after graph quiet and never self-accepts on behalf of a worker.",
122343
+ "Only another actor can verify: the verifier claims verify, writes independent evidence with reproduction steps, then records verified and releases the verify claim. The host rejects self-verification and skipped states. The finish intent cites verified Finding ids only; later facts invalidate it. Steward settles after graph quiet and never self-accepts on behalf of a worker.",
122226
122344
  "",
122227
122345
  "## R-6 · Locks, Handoff and Watchdog",
122228
122346
  "",
@@ -125059,8 +125177,9 @@ function installDeepSeekV41FlashProgressGovernor(ctx, options = {}) {
125059
125177
  * ## 绝对隔离保证
125060
125178
  *
125061
125179
  * 全部四个子能力均通过 {@link isDeepSeekV41Flash} 严格门控:任何其它线路与任何其它
125062
- * 模型(包括 `deepseek-v4-pro`、`deepseek-v4-flash`、Qoder `DeepSeek-Flash`、
125180
+ * 模型(包括 `deepseek-v4-pro`、`deepseek-v4-flash`、Qoder 的其它模型、
125063
125181
  * Claude、GPT、Kimi、MiniMax、GLM、Qwen 等)均 100% 旁路,零字节改动、零行为变化。
125182
+ * Qoder 的 `DeepSeek-Flash` 是同一 V4.1-1017,属于本总成的正常命中范围。
125064
125183
  *
125065
125184
  * @module @eddyskywalker/dsh-chatgpt-subscription/host/deepseek-v41-flash
125066
125185
  */
@@ -125234,7 +125353,8 @@ const ENVELOPE_PROVIDERS = /* @__PURE__ */ new Set([
125234
125353
  "tencent-tokenhub",
125235
125354
  "qianfan-token-plan",
125236
125355
  "alibaba-token-plan",
125237
- "qianwen-token-plan"
125356
+ "qianwen-token-plan",
125357
+ "qoder"
125238
125358
  ]);
125239
125359
  const MARKER_PROVIDERS = /* @__PURE__ */ new Set([
125240
125360
  "opencode-zen",
@@ -137182,6 +137302,13 @@ const RETRY_POLICY$3 = resolveRetryPolicy({
137182
137302
  const prefixRequests = new PrefixRequestCoordinator({ waitMs: 2500 });
137183
137303
  const activityStore = promptCacheActivityStore(PROVIDER_ID$6);
137184
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
+ }
137185
137312
  var QianwenTokenPlanAdapter = class extends LlmAdapter {
137186
137313
  store;
137187
137314
  settingsStore;
@@ -137215,7 +137342,7 @@ var QianwenTokenPlanAdapter = class extends LlmAdapter {
137215
137342
  provider: provider || PROVIDER_ID$6,
137216
137343
  id: model.id,
137217
137344
  name: model.name,
137218
- inputModalities: model.supportsImages ? ["text", "image"] : ["text"]
137345
+ inputModalities: qianwenInputModalities(model)
137219
137346
  }));
137220
137347
  }
137221
137348
  async resolveModel(provider, model, signal) {
@@ -137229,7 +137356,7 @@ var QianwenTokenPlanAdapter = class extends LlmAdapter {
137229
137356
  provider,
137230
137357
  id: model,
137231
137358
  name: entry.name,
137232
- inputModalities: entry.supportsImages ? ["text", "image"] : ["text"],
137359
+ inputModalities: qianwenInputModalities(entry),
137233
137360
  toolUpdate: "in-history",
137234
137361
  context: { contextWindow },
137235
137362
  ...outputReservation(contextWindow, entry.maxOutputTokens),
@@ -141004,9 +141131,27 @@ function templateFor(id, name) {
141004
141131
  known: false
141005
141132
  };
141006
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
+ }
141007
141152
  /** Facts for one model id: the caller's catalog first, then the shipped table, then a template. */
141008
141153
  function resolveClaudeApiModel(id, catalog) {
141009
- 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);
141010
141155
  }
141011
141156
  /** The shipped table as a fresh array; the cold-start placeholder before any live listing. */
141012
141157
  function claudeApiFallbackEntries() {
@@ -141016,7 +141161,7 @@ function isRecord$13(value) {
141016
141161
  return typeof value === "object" && value !== null && !Array.isArray(value);
141017
141162
  }
141018
141163
  function entryFor(id, displayName) {
141019
- const known = CLAUDE_API_MODELS.find((entry) => entry.id === id);
141164
+ const known = knownModelEntry(id);
141020
141165
  if (known !== void 0) return { ...known };
141021
141166
  return templateFor(id, displayName !== void 0 && displayName !== "" ? displayName : id);
141022
141167
  }
@@ -144235,6 +144380,8 @@ function chatGptApiUrl(baseUrl, path) {
144235
144380
  //#region src/host/providers/chatgpt-api/model-catalog.ts
144236
144381
  const FALLBACK_CONTEXT_WINDOW = 128e3;
144237
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;
144238
144385
  function isRecord$5(value) {
144239
144386
  return typeof value === "object" && value !== null && !Array.isArray(value);
144240
144387
  }
@@ -144250,7 +144397,7 @@ function chatGptApiFallbackEntries() {
144250
144397
  supportsImages: entry.inputModalities.includes("image"),
144251
144398
  supportsVerbosity: "supportsOutputVerbosity" in entry && entry.supportsOutputVerbosity === true
144252
144399
  }),
144253
- contextWindow: entry.contextWindow,
144400
+ contextWindow: entry.reasoningProfile === "gpt-6" || entry.reasoningProfile === "gpt-5.6" ? PUBLIC_API_GPT_CONTEXT_WINDOW : entry.contextWindow,
144254
144401
  maxOutputTokens: "maxTokens" in entry && entry.maxTokens !== void 0 ? entry.maxTokens : entry.reasoningProfile === "gpt-6" ? GPT_6_MAX_TOKENS : CODEX_DEFAULT_MAX_TOKENS,
144255
144402
  reasoningEfforts: reasoningEffortsForModel$1(entry.id).filter(isChatGptApiReasoningEffort),
144256
144403
  supportsImages: entry.inputModalities.includes("image"),
@@ -144281,7 +144428,7 @@ function defaultLiveEntry(id, name) {
144281
144428
  function isChatGptApiChatModel(id) {
144282
144429
  const normalized = id.trim().toLowerCase();
144283
144430
  if (normalized === "") return false;
144284
- 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;
144285
144432
  return /^(gpt|chatgpt|o\d|codex)/.test(normalized);
144286
144433
  }
144287
144434
  function parseLiveChatGptApiModelEntries(value) {
@@ -146107,15 +146254,36 @@ function apply(ctx, pluginConfig = {}) {
146107
146254
  if (provider === PROVIDER_ID$4) return (await claudeApiPreferences?.read())?.autoCompactSubagents === true && !belowThreshold(threshold, contextTokens);
146108
146255
  return false;
146109
146256
  }
146110
- if (provider === void 0 || !await autoCompactAfterTasksOf(provider)) return false;
146111
- 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 {
146112
146283
  enabled: true,
146113
- threshold,
146114
146284
  pendingWork: typeof sessionId === "string" && (cacheWaitPendingWork?.(sessionId) ?? false),
146115
- contextTokens,
146116
- writtenTtlMs: await mainTierMs(provider, typeof sessionId === "string" ? sessionId : void 0),
146117
- keepaliveTtlMs: keepaliveTierMs(provider)
146118
- }) === void 0;
146285
+ eligible: !belowThreshold(threshold, contextTokens)
146286
+ };
146119
146287
  },
146120
146288
  onController: (controller) => {
146121
146289
  requestTaskComplete = (sessionId) => controller.requestTaskComplete(sessionId);