dsh-connect-trae 4.2.0 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -331,7 +331,68 @@ interface TraeWireModel {
331
331
  * during the merge — the precedence `creditMultiplier` already follows.
332
332
  */
333
333
  activityDiscount?: TraeActivityDiscount;
334
+ /**
335
+ * Upstream's `usage` for this config — what the config is FOR.
336
+ *
337
+ * Read from `get_detail_param`'s top-level `usage` field (verified
338
+ * 2026-10-22 on a live CN credential): `chat_completion` for a real model,
339
+ * `custom_model` for a user's own custom model, and one value per built-in
340
+ * tool config (`summary`, `title_generation`, `fast_apply`,
341
+ * `input_optimization`, …).
342
+ *
343
+ * It is the discriminator that separates a MODEL from a TOOL, and
344
+ * {@link mergeTraeModelSources} needs it to decide which wire-only rows may
345
+ * be promoted into the catalog (issue #46). Absent means "upstream did not
346
+ * say" — never "assume it is a tool", and never "assume it is a model".
347
+ */
348
+ usage?: string;
349
+ /**
350
+ * Upstream's `config_source` for this config.
351
+ *
352
+ * `1` is a Trae preset; `3` is the account's own custom model (it carries a
353
+ * `custom_config` with the user's own base_url and key). The plugin does not
354
+ * serve a user's custom model, so a `3` row is never promoted (issue #46).
355
+ * Absent means "upstream did not say".
356
+ */
357
+ configSource?: number;
334
358
  }
359
+ /**
360
+ * Whether a wire row is a USER-FACING MODEL that the catalog may expose.
361
+ *
362
+ * Issue #46: the Remote directory is the catalog's SKELETON, but the wire
363
+ * roster knows models the skeleton does not — and the skeleton systematically
364
+ * omits one whole CLASS of them: the dated snapshot configs
365
+ * (`kimi-k2-0905`, `seed-code-pro-0430`, …). Measured 2026-10-22 on a live
366
+ * CN credential, the Remote skeleton carried **zero** dated config_names
367
+ * while the wire roster carried three, so every one of them was dropped by
368
+ * the join and the user could not reach the snapshot the IDE offered them.
369
+ *
370
+ * A row qualifies only when ALL of the following hold — each test is an
371
+ * upstream signal, none of them invented:
372
+ *
373
+ * - `usage === 'chat_completion'` — it is a model, not a tool config. The
374
+ * wire roster mixes models with the IDE's own helpers (`summary`,
375
+ * `title_generation`, `fast_apply`, `input_optimization`) and with the
376
+ * account's custom models (`usage: 'custom_model'`); none of those belong
377
+ * in a model picker. Measured: this one test removed 23 of 50 wire-only
378
+ * rows, and every row it removed was a tool or a custom model.
379
+ * - `config_source === 1` — a Trae preset, not the account's own custom
380
+ * model (source 3, which carries the user's own base_url and key). The
381
+ * plugin must not offer to bill a model it does not host.
382
+ * - a REAL display name — not empty, not the upstream placeholder `-`, not a
383
+ * bare config identifier (`search_agent_qwen_fast`,
384
+ * `computer_use_subagent`), and not the config's OWN id. A model with no
385
+ * name has nothing to show in the picker.
386
+ *
387
+ * The display-name-collision test lives in the merge itself (it needs the
388
+ * Remote rows to compare against); see {@link mergeTraeModelSources}.
389
+ *
390
+ * The survivors are exactly the models a user would recognise and the IDE
391
+ * offers but the plugin hid: `kimi-k2` / `kimi-k2-0905`, `glm-4.6`,
392
+ * `glm-4.7`, `glm-5-turbo`, `minimax-m2`, `minimax-m2.1`, `qwen3-coder`,
393
+ * `seed-code-pro-0430`.
394
+ */
395
+ declare function isPromotableWireModel(model: TraeWireModel): boolean;
335
396
  /**
336
397
  * Merge the two Trae model sources into one authoritative catalog.
337
398
  *
@@ -372,6 +433,20 @@ interface TraeWireModel {
372
433
  * models whose display id differs from the wire id across Trae versions.
373
434
  * When the matched wire `config_name` differs from the remote id it is recorded
374
435
  * as `wireConfigName`; otherwise it is left undefined (id is already the wire id).
436
+ *
437
+ * The DISPLAY NAME stays the Remote skeleton's (issue #46). The wire roster
438
+ * was measured as a name source and REJECTED: it disagrees with the Trae
439
+ * IDE's own roster on 32 of 81 ids, while the skeleton disagrees on 3 of 33.
440
+ * The wire roster is function-scoped — the same id carries a different
441
+ * `display_name` per function — and the plugin's wire client reads the CHAT
442
+ * functions, so it can land on a name the IDE's picker never shows. The wire
443
+ * keeps its own roles: the `config_name`, the function, the output cap, the
444
+ * multiplier and the promotion rule.
445
+ *
446
+ * Rows the Remote skeleton does not know but the wire roster does are
447
+ * PROMOTED (issue #46) — subject to {@link isPromotableWireModel}. The
448
+ * skeleton systematically omits the dated snapshot configs, so without
449
+ * promotion every snapshot the IDE offers is unreachable from the plugin.
375
450
  */
376
451
  declare function mergeTraeModelSources(remote: readonly TraeDiscoveredModel[], wire: readonly TraeWireModel[]): TraeModelInfo[];
377
452
  /** Local DSH context budget per model; a value may only select an advertised window. */
@@ -2795,6 +2870,19 @@ interface TraeSoloModel {
2795
2870
  activityDiscount?: TraeActivityDiscount;
2796
2871
  /** The directory function that listed this config (replayed when calling it). */
2797
2872
  function?: string;
2873
+ /**
2874
+ * Upstream's `usage` for this config — `chat_completion` for a model,
2875
+ * `custom_model` for the account's own custom model, and one value per
2876
+ * built-in tool config. Absent means upstream did not say.
2877
+ *
2878
+ * The merge layer needs it to tell a MODEL from a TOOL (issue #46).
2879
+ */
2880
+ usage?: string;
2881
+ /**
2882
+ * Upstream's `config_source` — 1 for a Trae preset, 3 for the account's own
2883
+ * custom model. Absent means upstream did not say.
2884
+ */
2885
+ configSource?: number;
2798
2886
  }
2799
2887
  interface TraeSoloClientOptions {
2800
2888
  credential(): Promise<TraeCredential>;
@@ -3909,4 +3997,4 @@ declare function asVolatile<S>(schema: S): S;
3909
3997
  declare const Config: z<Config>;
3910
3998
  declare function apply(ctx: Context$1, config: Config): void;
3911
3999
  //#endregion
3912
- export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, MAX_PROBE_INPUT_TOKENS, type PiAiGeneration, type PiAiRuntimeInfo, REGION_GATEWAYS, type RawChatDelta, type RawChatMessage, type RawChatTool, SseDecoder, type SseEvent, TRAE_ACCOUNT_STATUS_PATH, TRAE_AI_PROVIDER, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PANELS, TRAE_PAY_BASE, TRAE_PROBE_TIMEOUT_MS, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, TRAE_PROVIDER_IDS, TRAE_PROVIDER_ID_DISPLAY_NAMES, TRAE_PROVIDER_ROUTES, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, TRAE_REGIONS, TRAE_REGION_PARAM, TRAE_SETTINGS_NS, TRAE_SOLO_CHAT_PATH, TRAE_SOLO_FUNCTION, TRAE_SOLO_MODELS_PATH, TRAE_SOLO_REMOTE_BASE, TRAE_STATE_DB_FILENAME, TRAE_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, type TraeActivityRule, type TraeAdapter, type TraeCachedModelConfig, TraeCatalog, type TraeChatResult, type TraeCheckinClaim, type TraeCheckinStatus, type TraeContextBudget, type TraeCredential, TraeCredentialStore, TraeDelegatingUpstreamClient, type TraeDiscoveredModel, type TraeDiscoveredReasoning, type TraeEdition, type TraeFailure, TraeFallbackUpstreamClient, type TraeFallbackUpstreamOptions, type TraeFusionRawChatEnvelope, TraeGatedUpstreamClient, type TraeGatedUpstreamOptions, type TraeIdentity, type TraeInputModality, type TraeModelDetailRequest, type TraeModelInfo, type TraeModelProbeVerdict, type TraeModelsTestResponse, type TraeObservedModelConfig, type TraePanel, type TraeProbeResult, type TraeProbeVerdict, type TraeProviderRoute, TraeRawCapabilityController, type TraeRawCapabilityControllerOptions, type TraeRawCapabilitySnapshot, TraeRawCapabilityState, type TraeRawChatBehaviorConfig, type TraeRawChatCapability, type TraeRawChatClientOptions, type TraeRawChatConfig, type TraeRawChatFailureReason, type TraeRawChatRuntimeConfig, TraeRawChatUpstreamClient, type TraeRawDiagnostic, type TraeRawDiagnosticState, type TraeRawGateway, type TraeRawGatewayOptions, type TraeRawResolverResult, type TraeReasoningCapability, type TraeReasoningEffort, type TraeRefreshDevice, type TraeRegion, type TraeRegionGateways, TraeRegionState, type TraeShim, TraeSoloBridge, type TraeSoloClientOptions, TraeSoloRemoteCatalogClient, type TraeSoloRemoteCatalogOptions, TraeSoloUpstreamClient, type TraeStorageCandidate, type TraeStreamEvent, type TraeUpstreamClient, TraeUsageClient, type TraeUsageOptions, type TraeUsagePack, type TraeUsageRouteOptions, type TraeUsageSnapshot, type TraeUsageSummary, type TraeUsageView, type TraeWebAccountState, type TraeWebActivity, type TraeWebCheckin, type TraeWebCheckinClaim, type TraeWebCredits, type TraeWebUsage, type TraeWireModel, type TraeWireTarget, UnconfiguredTraeUpstreamClient, adaptLegacyPiAiContext, adaptModernPiAiContext, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, asVolatile, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyProbeError, classifyProbeResult, classifyTraeRawChatFailure, configuredAccountsOf, createTraeAdapter, createTraeRawGateway, createTraeShim, creditPosition, decidePiAiGeneration, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, describeIdShape, describeNameShape, describeTraeFailure, discoveredCatalog, displayNameOfTraeProvider, fallbackModelsFor, generationOf, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeVersionCode, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, piAiRuntimeInfo, pickTraeStorageIdentity, prepareSoloBody, probeBody, probeModelsSequentially, probeOneModel, probeTraeRawChatCapability, providerOfPanel, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionCreditPositionOf, regionEnabled, regionEnabledOf, regionOfCredential, regionOfEdition, regionOfHost, regionOfPanel, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, routeOfTraeProvider, sanitizeCatalog, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withContextAdaptation, withTraeRegion };
4000
+ export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, MAX_PROBE_INPUT_TOKENS, type PiAiGeneration, type PiAiRuntimeInfo, REGION_GATEWAYS, type RawChatDelta, type RawChatMessage, type RawChatTool, SseDecoder, type SseEvent, TRAE_ACCOUNT_STATUS_PATH, TRAE_AI_PROVIDER, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PANELS, TRAE_PAY_BASE, TRAE_PROBE_TIMEOUT_MS, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, TRAE_PROVIDER_IDS, TRAE_PROVIDER_ID_DISPLAY_NAMES, TRAE_PROVIDER_ROUTES, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, TRAE_REGIONS, TRAE_REGION_PARAM, TRAE_SETTINGS_NS, TRAE_SOLO_CHAT_PATH, TRAE_SOLO_FUNCTION, TRAE_SOLO_MODELS_PATH, TRAE_SOLO_REMOTE_BASE, TRAE_STATE_DB_FILENAME, TRAE_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, type TraeActivityRule, type TraeAdapter, type TraeCachedModelConfig, TraeCatalog, type TraeChatResult, type TraeCheckinClaim, type TraeCheckinStatus, type TraeContextBudget, type TraeCredential, TraeCredentialStore, TraeDelegatingUpstreamClient, type TraeDiscoveredModel, type TraeDiscoveredReasoning, type TraeEdition, type TraeFailure, TraeFallbackUpstreamClient, type TraeFallbackUpstreamOptions, type TraeFusionRawChatEnvelope, TraeGatedUpstreamClient, type TraeGatedUpstreamOptions, type TraeIdentity, type TraeInputModality, type TraeModelDetailRequest, type TraeModelInfo, type TraeModelProbeVerdict, type TraeModelsTestResponse, type TraeObservedModelConfig, type TraePanel, type TraeProbeResult, type TraeProbeVerdict, type TraeProviderRoute, TraeRawCapabilityController, type TraeRawCapabilityControllerOptions, type TraeRawCapabilitySnapshot, TraeRawCapabilityState, type TraeRawChatBehaviorConfig, type TraeRawChatCapability, type TraeRawChatClientOptions, type TraeRawChatConfig, type TraeRawChatFailureReason, type TraeRawChatRuntimeConfig, TraeRawChatUpstreamClient, type TraeRawDiagnostic, type TraeRawDiagnosticState, type TraeRawGateway, type TraeRawGatewayOptions, type TraeRawResolverResult, type TraeReasoningCapability, type TraeReasoningEffort, type TraeRefreshDevice, type TraeRegion, type TraeRegionGateways, TraeRegionState, type TraeShim, TraeSoloBridge, type TraeSoloClientOptions, TraeSoloRemoteCatalogClient, type TraeSoloRemoteCatalogOptions, TraeSoloUpstreamClient, type TraeStorageCandidate, type TraeStreamEvent, type TraeUpstreamClient, TraeUsageClient, type TraeUsageOptions, type TraeUsagePack, type TraeUsageRouteOptions, type TraeUsageSnapshot, type TraeUsageSummary, type TraeUsageView, type TraeWebAccountState, type TraeWebActivity, type TraeWebCheckin, type TraeWebCheckinClaim, type TraeWebCredits, type TraeWebUsage, type TraeWireModel, type TraeWireTarget, UnconfiguredTraeUpstreamClient, adaptLegacyPiAiContext, adaptModernPiAiContext, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, asVolatile, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyProbeError, classifyProbeResult, classifyTraeRawChatFailure, configuredAccountsOf, createTraeAdapter, createTraeRawGateway, createTraeShim, creditPosition, decidePiAiGeneration, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, describeIdShape, describeNameShape, describeTraeFailure, discoveredCatalog, displayNameOfTraeProvider, fallbackModelsFor, generationOf, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, isPromotableWireModel, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeVersionCode, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, piAiRuntimeInfo, pickTraeStorageIdentity, prepareSoloBody, probeBody, probeModelsSequentially, probeOneModel, probeTraeRawChatCapability, providerOfPanel, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionCreditPositionOf, regionEnabled, regionEnabledOf, regionOfCredential, regionOfEdition, regionOfHost, regionOfPanel, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, routeOfTraeProvider, sanitizeCatalog, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withContextAdaptation, withTraeRegion };
package/lib/index.js CHANGED
@@ -181,6 +181,51 @@ function applyImageSelection(models, selected) {
181
181
  input: traeModelAcceptsImage(model, selected) ? ["text", "image"] : ["text"]
182
182
  }));
183
183
  }
184
+ /**
185
+ * Whether a wire row is a USER-FACING MODEL that the catalog may expose.
186
+ *
187
+ * Issue #46: the Remote directory is the catalog's SKELETON, but the wire
188
+ * roster knows models the skeleton does not — and the skeleton systematically
189
+ * omits one whole CLASS of them: the dated snapshot configs
190
+ * (`kimi-k2-0905`, `seed-code-pro-0430`, …). Measured 2026-10-22 on a live
191
+ * CN credential, the Remote skeleton carried **zero** dated config_names
192
+ * while the wire roster carried three, so every one of them was dropped by
193
+ * the join and the user could not reach the snapshot the IDE offered them.
194
+ *
195
+ * A row qualifies only when ALL of the following hold — each test is an
196
+ * upstream signal, none of them invented:
197
+ *
198
+ * - `usage === 'chat_completion'` — it is a model, not a tool config. The
199
+ * wire roster mixes models with the IDE's own helpers (`summary`,
200
+ * `title_generation`, `fast_apply`, `input_optimization`) and with the
201
+ * account's custom models (`usage: 'custom_model'`); none of those belong
202
+ * in a model picker. Measured: this one test removed 23 of 50 wire-only
203
+ * rows, and every row it removed was a tool or a custom model.
204
+ * - `config_source === 1` — a Trae preset, not the account's own custom
205
+ * model (source 3, which carries the user's own base_url and key). The
206
+ * plugin must not offer to bill a model it does not host.
207
+ * - a REAL display name — not empty, not the upstream placeholder `-`, not a
208
+ * bare config identifier (`search_agent_qwen_fast`,
209
+ * `computer_use_subagent`), and not the config's OWN id. A model with no
210
+ * name has nothing to show in the picker.
211
+ *
212
+ * The display-name-collision test lives in the merge itself (it needs the
213
+ * Remote rows to compare against); see {@link mergeTraeModelSources}.
214
+ *
215
+ * The survivors are exactly the models a user would recognise and the IDE
216
+ * offers but the plugin hid: `kimi-k2` / `kimi-k2-0905`, `glm-4.6`,
217
+ * `glm-4.7`, `glm-5-turbo`, `minimax-m2`, `minimax-m2.1`, `qwen3-coder`,
218
+ * `seed-code-pro-0430`.
219
+ */
220
+ function isPromotableWireModel(model) {
221
+ if (model.usage !== "chat_completion") return false;
222
+ if (model.configSource !== 1) return false;
223
+ const name = model.name.trim();
224
+ if (name === "" || name === "-") return false;
225
+ if (name === model.id.trim()) return false;
226
+ if (!name.includes(" ") && name.includes("_")) return false;
227
+ return true;
228
+ }
184
229
  /** Normalise a display name for cross-source joining. */
185
230
  function displayKey(name) {
186
231
  return name.trim().toLowerCase();
@@ -225,6 +270,20 @@ function displayKey(name) {
225
270
  * models whose display id differs from the wire id across Trae versions.
226
271
  * When the matched wire `config_name` differs from the remote id it is recorded
227
272
  * as `wireConfigName`; otherwise it is left undefined (id is already the wire id).
273
+ *
274
+ * The DISPLAY NAME stays the Remote skeleton's (issue #46). The wire roster
275
+ * was measured as a name source and REJECTED: it disagrees with the Trae
276
+ * IDE's own roster on 32 of 81 ids, while the skeleton disagrees on 3 of 33.
277
+ * The wire roster is function-scoped — the same id carries a different
278
+ * `display_name` per function — and the plugin's wire client reads the CHAT
279
+ * functions, so it can land on a name the IDE's picker never shows. The wire
280
+ * keeps its own roles: the `config_name`, the function, the output cap, the
281
+ * multiplier and the promotion rule.
282
+ *
283
+ * Rows the Remote skeleton does not know but the wire roster does are
284
+ * PROMOTED (issue #46) — subject to {@link isPromotableWireModel}. The
285
+ * skeleton systematically omits the dated snapshot configs, so without
286
+ * promotion every snapshot the IDE offers is unreachable from the plugin.
228
287
  */
229
288
  function mergeTraeModelSources(remote, wire) {
230
289
  const wireByName = /* @__PURE__ */ new Map();
@@ -256,6 +315,32 @@ function mergeTraeModelSources(remote, wire) {
256
315
  ...wireFunction === void 0 ? {} : { wireFunction }
257
316
  });
258
317
  }
318
+ const remoteIds = new Set(remote.map((model) => displayKey(model.id)));
319
+ const remoteNames = new Set(remote.map((model) => displayKey(model.name)).filter((name) => name !== ""));
320
+ for (const wireModel of wire) {
321
+ if (remoteIds.has(displayKey(wireModel.id))) continue;
322
+ if (!isPromotableWireModel(wireModel)) continue;
323
+ if (remoteNames.has(displayKey(wireModel.name))) continue;
324
+ remoteNames.add(displayKey(wireModel.name));
325
+ result.push({
326
+ id: wireModel.id,
327
+ name: wireModel.name,
328
+ ...wireModel.contextWindow === void 0 ? {} : { contextWindow: wireModel.contextWindow },
329
+ ...wireModel.maxTokens === void 0 ? {} : { maxTokens: wireModel.maxTokens },
330
+ ...wireModel.creditMultiplier === void 0 ? {} : { creditMultiplier: wireModel.creditMultiplier },
331
+ ...wireModel.activityDiscount === void 0 ? {} : { activityDiscount: wireModel.activityDiscount },
332
+ input: ["text"],
333
+ reasoningSupported: wireModel.reasoning !== void 0,
334
+ ...wireModel.reasoning === void 0 ? {} : {
335
+ reasoning: {
336
+ supported: [...wireModel.reasoning.supported],
337
+ ...wireModel.reasoning.defaultEffort === void 0 ? {} : { defaultEffort: wireModel.reasoning.defaultEffort }
338
+ },
339
+ reasoningEfforts: Object.fromEntries(wireModel.reasoning.supported.map((effort) => [effort, effort === "low" ? "light" : effort === "xhigh" ? "extra_high" : "high"]))
340
+ },
341
+ ...wireModel.function === void 0 ? {} : { wireFunction: wireModel.function }
342
+ });
343
+ }
259
344
  return result;
260
345
  }
261
346
  /**
@@ -4136,6 +4221,7 @@ var TraeSoloUpstreamClient = class {
4136
4221
  const display = typeof config["display_config"] === "object" && config["display_config"] !== null ? config["display_config"] : {};
4137
4222
  const details = Array.isArray(config["model_detail_list"]) ? config["model_detail_list"] : [];
4138
4223
  const detail = typeof details[0] === "object" && details[0] !== null ? details[0] : {};
4224
+ const rawName = typeof display["display_name"] === "string" ? display["display_name"] : "";
4139
4225
  const contextTokens = typeof config["context_window_tokens"] === "object" && config["context_window_tokens"] !== null ? config["context_window_tokens"] : {};
4140
4226
  const promptMaxTokens = finitePositive$1(detail["prompt_max_tokens"]);
4141
4227
  const devTokens = finitePositive$1(contextTokens["dev"]);
@@ -4147,15 +4233,23 @@ var TraeSoloUpstreamClient = class {
4147
4233
  });
4148
4234
  const creditMultiplier = wireCreditMultiplier(config);
4149
4235
  const activityDiscount = wireActivityDiscount(config);
4150
- if (byId.has(id)) continue;
4236
+ const usage = typeof config["usage"] === "string" && config["usage"] !== "" ? config["usage"] : void 0;
4237
+ const configSource = typeof config["config_source"] === "number" && Number.isFinite(config["config_source"]) ? config["config_source"] : void 0;
4238
+ const existing = byId.get(id);
4239
+ if (existing !== void 0) {
4240
+ if (existing.name === id && rawName !== "" && rawName !== "-") existing.name = rawName;
4241
+ continue;
4242
+ }
4151
4243
  byId.set(id, {
4152
4244
  id,
4153
- name: typeof display["display_name"] === "string" && display["display_name"] !== "" ? display["display_name"] : id,
4245
+ name: rawName !== "" && rawName !== "-" ? rawName : id,
4154
4246
  ...contextWindow === void 0 ? {} : { contextWindow },
4155
4247
  ...maxTokens === void 0 ? {} : { maxTokens },
4156
4248
  ...reasoning === void 0 ? {} : { reasoning },
4157
4249
  ...creditMultiplier === void 0 ? {} : { creditMultiplier },
4158
4250
  ...activityDiscount === void 0 ? {} : { activityDiscount },
4251
+ ...usage === void 0 ? {} : { usage },
4252
+ ...configSource === void 0 ? {} : { configSource },
4159
4253
  function: directoryFunction
4160
4254
  });
4161
4255
  }
@@ -5038,6 +5132,27 @@ const TRAE_SOLO_REMOTE_BASE = "https://solo.trae.cn/api/remote/v1";
5038
5132
  * `builder_v3` is included for the same reason even though neither region's
5039
5133
  * current wire lists name it: its rows are real directory entries, and whether
5040
5134
  * a paying account can call one is not something this client can determine.
5135
+ *
5136
+ * The IDE's own function list is wider still, and issue #46 showed what the
5137
+ * gap costs. The Trae IDE asks for 22 functions (see TRAE_MODEL_DETAIL_FUNCTIONS
5138
+ * in model-detail.ts); the list below asked for 7, and the groups the plugin
5139
+ * did not ask about hid real models. Measured 2026-10-22 on a live CN
5140
+ * credential: asking the Remote directory for the IDE's list as well returned
5141
+ * **41** models instead of **33**, and the eight extra rows were real models
5142
+ * the plugin could not show — `kimi-k2` (the `Kimi-K2-0905` snapshot, which
5143
+ * lives under `inline_chat` ALONE), `doubao_1_8` (`Doubao-Seed-1.8`),
5144
+ * `deepseek-V3`, `deepseek-V3.1`, `doubao-2.0-mini`, `glm-4.7`,
5145
+ * `code-review-judge`, `multimodal_image_kimi-k2.5`.
5146
+ *
5147
+ * The five functions added here are the ones that carry a MODEL (as opposed to
5148
+ * a helper config): `chat`, `inline_chat`, `solo_agent_lite`,
5149
+ * `solo_design_lite`, `solo_design_remote`. The remaining IDE functions
5150
+ * (`ui_builder_v2`, `builder`, `solo_builder`, `git_ai`, `utils`,
5151
+ * `code_reviewer`, `code_review_summary`, `custom_agent_generation`,
5152
+ * `multimodal`, `system_diagnosis`) are asked too, for the same reason
5153
+ * `builder_v3` is: a row is a row, and the merge decides what to do with it.
5154
+ * Asking for a function the gateway does not serve is harmless — unknown
5155
+ * names are ignored rather than rejected.
5041
5156
  */
5042
5157
  const TRAE_REMOTE_DIRECTORY_FUNCTIONS = {
5043
5158
  cn: [
@@ -5047,7 +5162,12 @@ const TRAE_REMOTE_DIRECTORY_FUNCTIONS = {
5047
5162
  "solo_work_lite",
5048
5163
  "chat_v3",
5049
5164
  "solo_coder",
5050
- "builder_v3"
5165
+ "builder_v3",
5166
+ "chat",
5167
+ "inline_chat",
5168
+ "solo_agent_lite",
5169
+ "solo_design_lite",
5170
+ "solo_design_remote"
5051
5171
  ],
5052
5172
  ai: [
5053
5173
  "solo_agent",
@@ -5056,7 +5176,12 @@ const TRAE_REMOTE_DIRECTORY_FUNCTIONS = {
5056
5176
  "solo_work_lite",
5057
5177
  "chat_v3",
5058
5178
  "solo_coder",
5059
- "builder_v3"
5179
+ "builder_v3",
5180
+ "chat",
5181
+ "inline_chat",
5182
+ "solo_agent_lite",
5183
+ "solo_design_lite",
5184
+ "solo_design_remote"
5060
5185
  ]
5061
5186
  };
5062
5187
  /**
@@ -10062,4 +10187,4 @@ function apply(ctx, config) {
10062
10187
  });
10063
10188
  }
10064
10189
  //#endregion
10065
- export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, MAX_PROBE_INPUT_TOKENS, REGION_GATEWAYS, SseDecoder, TRAE_ACCOUNT_STATUS_PATH, TRAE_AI_PROVIDER, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PANELS, TRAE_PAY_BASE, TRAE_PROBE_TIMEOUT_MS, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, TRAE_PROVIDER_IDS, TRAE_PROVIDER_ID_DISPLAY_NAMES, TRAE_PROVIDER_ROUTES, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, TRAE_REGIONS, TRAE_REGION_PARAM, TRAE_SETTINGS_NS, TRAE_SOLO_CHAT_PATH, TRAE_SOLO_FUNCTION, TRAE_SOLO_MODELS_PATH, TRAE_SOLO_REMOTE_BASE, TRAE_STATE_DB_FILENAME, TRAE_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, TraeCatalog, TraeCredentialStore, TraeDelegatingUpstreamClient, TraeFallbackUpstreamClient, TraeGatedUpstreamClient, TraeRawCapabilityController, TraeRawCapabilityState, TraeRawChatUpstreamClient, TraeSoloBridge, TraeSoloRemoteCatalogClient, TraeSoloUpstreamClient, TraeUsageClient, UnconfiguredTraeUpstreamClient, adaptLegacyPiAiContext, adaptModernPiAiContext, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, asVolatile, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyProbeError, classifyProbeResult, classifyTraeRawChatFailure, configuredAccountsOf, createTraeAdapter, createTraeRawGateway, createTraeShim, creditPosition, decidePiAiGeneration, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, describeIdShape, describeNameShape, describeTraeFailure, discoveredCatalog, displayNameOfTraeProvider, fallbackModelsFor, generationOf, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeVersionCode, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, piAiRuntimeInfo, pickTraeStorageIdentity, prepareSoloBody, probeBody, probeModelsSequentially, probeOneModel, probeTraeRawChatCapability, providerOfPanel, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionCreditPositionOf, regionEnabled, regionEnabledOf, regionOfCredential, regionOfEdition, regionOfHost, regionOfPanel, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, routeOfTraeProvider, sanitizeCatalog, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withContextAdaptation, withTraeRegion };
10190
+ export { Config, FALLBACK_TRAE_MODELS, FALLBACK_TRAE_MODELS_AI, MAX_PROBE_INPUT_TOKENS, REGION_GATEWAYS, SseDecoder, TRAE_ACCOUNT_STATUS_PATH, TRAE_AI_PROVIDER, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_PANELS, TRAE_PAY_BASE, TRAE_PROBE_TIMEOUT_MS, TRAE_PROVIDER, TRAE_PROVIDERS, TRAE_PROVIDER_DISPLAY_NAMES, TRAE_PROVIDER_IDS, TRAE_PROVIDER_ID_DISPLAY_NAMES, TRAE_PROVIDER_ROUTES, TRAE_RAW_CHAT_V1_PATH, TRAE_RAW_CHAT_V2_PATH, TRAE_REASONING_EFFORTS, TRAE_REGIONS, TRAE_REGION_PARAM, TRAE_SETTINGS_NS, TRAE_SOLO_CHAT_PATH, TRAE_SOLO_FUNCTION, TRAE_SOLO_MODELS_PATH, TRAE_SOLO_REMOTE_BASE, TRAE_STATE_DB_FILENAME, TRAE_STREAM_IDLE_TIMEOUT_MS, TRAE_USAGE_PATH, TRAE_VERSION_CODE_FALLBACK, TraeCatalog, TraeCredentialStore, TraeDelegatingUpstreamClient, TraeFallbackUpstreamClient, TraeGatedUpstreamClient, TraeRawCapabilityController, TraeRawCapabilityState, TraeRawChatUpstreamClient, TraeSoloBridge, TraeSoloRemoteCatalogClient, TraeSoloUpstreamClient, TraeUsageClient, UnconfiguredTraeUpstreamClient, adaptLegacyPiAiContext, adaptModernPiAiContext, apply, applyContextBudgets, applyImageSelection, applyReasoningEffort, asVolatile, bridgeTraeSoloStream, buildTraeAgentTaskBody, buildTraeCnHeaders, buildTraeFusionRawChatEnvelope, buildTraeModelDetailRequest, buildTraeRawChatDraft, buildTraeRawChatRuntimeConfig, classifyProbeError, classifyProbeResult, classifyTraeRawChatFailure, configuredAccountsOf, createTraeAdapter, createTraeRawGateway, createTraeShim, creditPosition, decidePiAiGeneration, decodeRawChatChunk, decodeTraeEvent, decryptTraeStorageValue, deriveCatalog, describeIdShape, describeNameShape, describeTraeFailure, discoveredCatalog, displayNameOfTraeProvider, fallbackModelsFor, generationOf, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, isPromotableWireModel, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeVersionCode, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeRawChatBehaviorConfig, parseTraeRemoteModel, parseTraeStorageDocument, piAiRuntimeInfo, pickTraeStorageIdentity, prepareSoloBody, probeBody, probeModelsSequentially, probeOneModel, probeTraeRawChatCapability, providerOfPanel, rawCapabilityDiagnostic, rawCapabilityFingerprint, readTraeCachedModel, readTraeCliIdentity, readTraeIdentity, refreshTraeCredential, regionCreditPositionOf, regionEnabled, regionEnabledOf, regionOfCredential, regionOfEdition, regionOfHost, regionOfPanel, regionOfTraeProvider, regionOfTraeStatusUrl, regionOfUserRegion, regionStateOf, registerTraeUsageRoute, resolveTraeIdentity, resolveTraeRawRuntime, routeOfTraeProvider, sanitizeCatalog, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelDisplayName, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withContextAdaptation, withTraeRegion };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-connect-trae",
3
3
  "displayName": "DSH Connect Trae",
4
4
  "description": "把本机登录的 Trae 模型接入 DeepSeek Harness:国内版与国际版双供应商并行,提供用量/积分概览与每日签到领取。",
5
- "version": "4.2.0",
5
+ "version": "4.4.0",
6
6
  "author": "dingminhua",
7
7
  "copyright": "Copyright (c) 2026 LaoDing",
8
8
  "license": "MIT",
@@ -51,7 +51,8 @@
51
51
  "check": "pnpm run typecheck && pnpm run test && pnpm run build",
52
52
  "verify:release": "node scripts/verify-release.mjs",
53
53
  "card:shot": "vitest run --config vitest.card.config.ts",
54
- "promo:shot": "vitest run --config vitest.card.config.ts -t \"promo shot\""
54
+ "promo:shot": "vitest run --config vitest.card.config.ts -t \"promo shot\"",
55
+ "panels:shot": "vitest run --config vitest.card.config.ts -t \"panels shot\""
55
56
  },
56
57
  "dsh": {
57
58
  "bundle": {