dsh-connect-trae 4.6.12 → 4.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -1373,6 +1373,16 @@ type TraeWebUsage = {
1373
1373
  /** A recognized-but-unserved region on this machine (issue #66). */
1374
1374
  unsupportedRegion?: TraeWebUnsupportedRegion;
1375
1375
  enabled?: boolean;
1376
+ /**
1377
+ * Whether the OPTIONAL sidebar row is switched on (`Config.sidebarPanel`).
1378
+ *
1379
+ * GLOBAL and present on BOTH shapes: the row belongs to the plugin, not to
1380
+ * a region or an account, and a signed-out card is still somewhere the user
1381
+ * may want the page it opens. Absent reads as OFF — the entry seeds its
1382
+ * registration from this answer, and the row claims a seat every bundle
1383
+ * shares, so a Host that cannot answer must never turn it on.
1384
+ */
1385
+ sidebarPanelEnabled?: boolean;
1376
1386
  } | {
1377
1387
  status: 'signed-in';
1378
1388
  accountId: string;
@@ -1389,6 +1399,8 @@ type TraeWebUsage = {
1389
1399
  region: TraeRegion;
1390
1400
  /** Whether this region's provider is currently offered to DSH. */
1391
1401
  enabled?: boolean;
1402
+ /** See the signed-out shape: GLOBAL, absent reads as OFF. */
1403
+ sidebarPanelEnabled?: boolean;
1392
1404
  accounts: readonly TraeWebAccount[];
1393
1405
  models: readonly TraeWebModel[];
1394
1406
  enabledModelIds: readonly string[];
@@ -1793,6 +1805,14 @@ declare function withContextAdaptation(api: ProviderStreams, generation: PiAiGen
1793
1805
  interface TraeAdapterOptions {
1794
1806
  shim: TraeShim;
1795
1807
  catalog: TraeCatalog;
1808
+ /**
1809
+ * The user's saved per-model level choices, region-scoped (model id -> level).
1810
+ *
1811
+ * Read lazily on every resolution so a settings save is picked up without
1812
+ * rebuilding the adapter. Absent means "no overrides", which still leaves the
1813
+ * upstream's own default in force — the feature is useful with zero choices.
1814
+ */
1815
+ defaultEfforts?: () => Readonly<Record<string, string | undefined>>;
1796
1816
  /** Provider route id this instance serves; defaults to the CN route. */
1797
1817
  provider?: string;
1798
1818
  /** pi-ai provider name and profile display name; defaults to the CN name. */
@@ -4408,6 +4428,22 @@ interface TraeUsageRouteOptions {
4408
4428
  * committed settings value rather than a local guess.
4409
4429
  */
4410
4430
  regionEnabled(panel: TraePanel): boolean;
4431
+ /**
4432
+ * Whether the OPTIONAL sidebar row is switched on, GLOBAL rather than
4433
+ * per-panel.
4434
+ *
4435
+ * Optional, and `=== true` at the reading site: the row is a property of the
4436
+ * whole plugin, not of one region, and an absent answer (an older Host, a
4437
+ * stack that failed to build) must read as OFF — the row claims a seat every
4438
+ * bundle shares, so a missing answer is never consent.
4439
+ *
4440
+ * It rides on the usage document because that is the read the browser entry
4441
+ * already makes at apply() time: the namespace's settings mirror is
4442
+ * documented as stale on the affected 0.1.7 deployments, so seeding the
4443
+ * switch from the Host's own answer is what keeps a stale `false` from
4444
+ * hiding a row the Host believes it is serving.
4445
+ */
4446
+ sidebarPanelEnabled?(): boolean;
4411
4447
  /** Re-read one region's live directory from the upstream. */
4412
4448
  discoverModels?(panel: TraePanel, signal?: AbortSignal): Promise<readonly TraeModelInfo[]>;
4413
4449
  /**
@@ -4608,6 +4644,21 @@ interface TraeRegionState {
4608
4644
  drawImageEnabled?: boolean;
4609
4645
  /** Local DSH context budget per model in this region. */
4610
4646
  contextBudgets?: Record<string, number>;
4647
+ /**
4648
+ * The user's own thinking-level choice per model, for this panel (model id ->
4649
+ * DSH level).
4650
+ *
4651
+ * OPT-IN by nature: a missing key means "use whatever this model's own
4652
+ * default is" (`reasoning.defaultEffort`, which Trae's directory publishes),
4653
+ * i.e. the behaviour the plugin had before this field existed. Choosing a
4654
+ * level here overrides that for good, and it is what the kernel materialises
4655
+ * into every request that names no level — see `src/default-effort.ts`.
4656
+ *
4657
+ * A key can go STALE: a directory refresh may withdraw a tier, and a level the
4658
+ * model no longer offers is then ignored rather than sent (sending it would be
4659
+ * rejected with `UNSUPPORTED_REASONING_EFFORT`).
4660
+ */
4661
+ thinkingEfforts?: Record<string, string>;
4611
4662
  /**
4612
4663
  * WHERE this region's credit readout sits (learned from dsh-connect-workbuddy
4613
4664
  * issue #62).
@@ -4673,6 +4724,22 @@ interface Config {
4673
4724
  * settings form can both read and write it.
4674
4725
  */
4675
4726
  showPointsInMainUi?: boolean;
4727
+ /**
4728
+ * Show this plugin's own row in the DSH sidebar (`sidebar.panellist`), which
4729
+ * opens the usage card as a full `main` page.
4730
+ *
4731
+ * OFF by default, for exactly the reason the sibling
4732
+ * `dsh-connect-workbuddy` row is off by default (its PR #188 /
4733
+ * `Config.sidebarPanel`): the sidebar's global rows are the host's own pages,
4734
+ * the row claims a seat every installed bundle shares, and the Plugins page
4735
+ * already reaches this same card. A row nobody asked for re-arranges a
4736
+ * surface the plugin does not own.
4737
+ *
4738
+ * The card's checkbox is the only writer (see `panel-switch.ts` on the
4739
+ * browser side, and `sidebarPanelEnabled` on the status document, which is
4740
+ * where the entry seeds the switch at page load).
4741
+ */
4742
+ sidebarPanel?: boolean;
4676
4743
  /**
4677
4744
  * Per-region model state, keyed `cn` | `ai`. The CN and international apps
4678
4745
  * expose different rosters, so each keeps its own directory and selection
@@ -4737,6 +4804,33 @@ declare function regionEnabled(config: Config, panel: TraePanel): boolean;
4737
4804
  * answer for this field, so the control cannot disagree with the readout.
4738
4805
  */
4739
4806
  declare function creditPosition(config: Config, region: TraeRegion): TraeCreditPosition;
4807
+ /**
4808
+ * The user's thinking-level choices for one panel (model id -> DSH level).
4809
+ *
4810
+ * Read through `regionStateOf` so the region split, the legacy CN fallback and
4811
+ * the volatile unwrap all apply exactly once, in one place. Values are filtered
4812
+ * to non-empty strings: an empty string is not a level, and passing one on would
4813
+ * make the model report a default the kernel cannot name.
4814
+ *
4815
+ * A saved level is NOT validated against the model's current tier list here —
4816
+ * that belongs where the tiers are known (`default-effort.ts`
4817
+ * `defaultEffortFor`), which is also where a withdrawn tier is dropped instead
4818
+ * of being sent.
4819
+ */
4820
+ declare function thinkingEffortsOf(config: Config, region: TraePanel): Record<string, string>;
4821
+ /**
4822
+ * Whether the OPTIONAL sidebar row is switched on (`Config.sidebarPanel`).
4823
+ *
4824
+ * `=== true` on purpose, exactly like the sibling workbuddy reader: the row
4825
+ * claims a GLOBAL sidebar seat every installed bundle shares, so an absent,
4826
+ * unreadable or hand-edited value must read as "the user did not ask for this",
4827
+ * never as consent. Only an explicit boolean `true` turns the row on.
4828
+ *
4829
+ * Read through `unwrapVolatile` because the field is volatile on 0.1.7: the
4830
+ * live `{get(): T}` reference would otherwise be a truthy non-boolean and every
4831
+ * config would look switched on.
4832
+ */
4833
+ declare function sidebarPanelEnabled(config: Config): boolean;
4740
4834
  /**
4741
4835
  * Mark a schema's field as volatile.
4742
4836
  *
@@ -4755,4 +4849,4 @@ declare function asVolatile<S>(schema: S): S;
4755
4849
  declare const Config: z<Config>;
4756
4850
  declare function apply(ctx: Context$1, config: Config): void;
4757
4851
  //#endregion
4758
- export { Config, FALLBACK_CONTEXT_WINDOW, 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_CHANNEL_PRIORITY, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_COMMON_FUNCTIONS, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_OFFICIAL_ROSTER_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 TraeModelGroup, type TraeModelInfo, type TraeModelProbeVerdict, type TraeModelView, type TraeModelsTestResponse, type TraeObservedModelConfig, type TraeOfficialChannel, type TraeOfficialFilterResult, type TraeOfficialRoster, TraeOfficialRosterClient, type TraeOfficialVerdict, type TraeOrderableModel, 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, applyOfficialRoster, 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, filterTraeModels, generationOf, groupTraeModels, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, isPromotableWireModel, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeToolSchema, normalizeTraeToolSchemas, normalizeTraeVersionCode, officialVerdictOf, orderTraeModels, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeOfficialRoster, 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, scopeTraeModels, servedContextWindow, settingsNamespaceOf, traeEndpoint, traeInputModalities, traeModelCallChannel, traeModelDisplayName, traeModelInView, traeModelMatchesQuery, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withChatCallableFunctions, withContextAdaptation, withTraeRegion };
4852
+ export { Config, FALLBACK_CONTEXT_WINDOW, 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_CHANNEL_PRIORITY, TRAE_CHECKIN_PATH, TRAE_CN_AGENT_TASK_PATH, TRAE_CN_TITLE_PATH, TRAE_COMMON_FUNCTIONS, TRAE_ENTERPRISE_PROVIDER, TRAE_MODELS_TEST_PATH, TRAE_MODEL_DETAIL_FUNCTIONS, TRAE_MODEL_DETAIL_PATH, TRAE_OFFICIAL_ROSTER_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 TraeModelGroup, type TraeModelInfo, type TraeModelProbeVerdict, type TraeModelView, type TraeModelsTestResponse, type TraeObservedModelConfig, type TraeOfficialChannel, type TraeOfficialFilterResult, type TraeOfficialRoster, TraeOfficialRosterClient, type TraeOfficialVerdict, type TraeOrderableModel, 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, applyOfficialRoster, 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, filterTraeModels, generationOf, groupTraeModels, hashTraeRawChatArg, identityHeaders, inject, isEnterpriseAccount, isPromotableWireModel, legacyTraeOwnAuthPath, maskUserPath, mergeTraeModelSources, name, nextRegionCreditPosition, nextRegionEnabled, nextRegionSlots, normalizeTraeCredential, normalizeTraeToolSchema, normalizeTraeToolSchemas, normalizeTraeVersionCode, officialVerdictOf, orderTraeModels, panelOfKey, panelOfProvider, parseObservedModelConfig, parseReasoningCapability, parseTraeAuthValue, parseTraeCachedModel, parseTraeModelExtraConfigLogLine, parseTraeOfficialRoster, 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, scopeTraeModels, servedContextWindow, settingsNamespaceOf, sidebarPanelEnabled, thinkingEffortsOf, traeEndpoint, traeInputModalities, traeModelCallChannel, traeModelDisplayName, traeModelInView, traeModelMatchesQuery, traeOwnAuthPath, traeRawChatExtraInfo, traeStateDatabaseCandidates, traeStorageCandidates, traeWebUsage, traeWindowsAppNames, unwrapVolatile, unwrapVolatileDeep, wireTargetsOf, withChatCallableFunctions, withContextAdaptation, withTraeRegion };