Theia API Documentation v1.75.0
    Preparing search index...

    Thin, injectable wrapper around AiConfigurationService and MarkdownRenderer used by the presentational AiSettingsRow component, which must not itself depend on the DI container. Owning renderers/widgets inject this service and pass it down to the row.

    All preference reads and writes are routed through AiConfigurationService — the AI configuration seam — rather than the raw PreferenceService, so reads are workspace-trust-aware and the whole view stays insulated from how AI preferences are stored (see AiConfigurationService). Schema introspection still uses PreferenceSchemaService directly, as it inspects the registered schema shape rather than stored values.

    Index

    Constructors

    Properties

    aiConfigurationService: AiConfigurationService
    changed: undefined | Event<void>
    commandService: CommandService
    contextMenuRenderer: ContextMenuRenderer
    markdownRenderer: MarkdownRenderer

    Accessors

    Methods

    • Infers a sensible AiSettingsControl for a preference from its schema type (a select when it declares an enum, a masked text input for secrets/API keys). An array of strings gets the inline list editor; more complex values — an object or an array of objects/other types — cannot be edited meaningfully inline, so they resolve to a json control that defers to the settings.json file. Falls back to a text input for unknown types.

      Parameters

      • preferenceId: string

      Returns AiSettingsControl

    • Reads the label and (already-localized) markdown description a preference declares in its registered schema, so settings rows do not have to re-author those strings. Returns undefined fields when the preference is unknown.

      Most AI preferences share the group title ("AI Features") to be grouped together in the Settings UI, which also ignores it and derives each setting's name from its id. We mirror that: a genuinely specific title is used as-is, but the shared group title falls back to the humanized preference id (e.g. ai-features.google.apiKey → "Api Key") so rows show their own name rather than "AI Features".

      Parameters

      • preferenceId: string

      Returns { description?: string; label?: string }

    • Opens the underlying settings.json file focused on a preference, mirroring the Settings view's "Edit in settings.json" link. Used for json controls, i.e. complex object/array values that cannot be edited meaningfully through an inline control.

      Parameters

      • preferenceId: string

      Returns void

    • Human-readable name for a preference derived from its id. The ai-features root and the area segment (chat, google, …) are dropped — the category/section already conveys them — and the remaining segments are humanized (camelCase split, first letter upper-cased) and joined with ": ", e.g. ai-features.chat.tokenUsageIndicator.enabled → "Token Usage Indicator: Enabled", ai-features.google.apiKey → "Api Key".

      Parameters

      • preferenceId: string

      Returns string

    • Whether a preference is meant to be surfaced as an editable settings row in the AI Configuration view. Excludes only value-less placeholders (type: 'null'), such as the redirect entries that only link to this view. The Settings-UI hidden flag is intentionally ignored: the AI Configuration view is the dedicated editor for AI preferences, which are hidden from the Settings UI once the cutover (#316) is in effect but must still be editable here.

      Parameters

      • preferenceId: string

      Returns boolean

    • Whether a preference declares itself part of a language-model provider block, i.e. carries the aiModelProvider MODEL_PROVIDER_TYPE_DETAIL typeDetail (in any form). The Models page uses this positive marker to discover provider blocks, so feature areas that never claim to be a provider are never mistaken for one.

      Parameters

      • preferenceId: string

      Returns boolean

    • Whether a preference holds a secret (an API key, token or password) that should be masked. There is no schema flag for this, so it is inferred from the id's leaf segment, matching how every AI provider names its key preference (e.g. ai-features.anthropic.apiKey).

      Parameters

      • preferenceId: string

      Returns boolean

    • The human-readable language-model provider name a preference declares in its schema typeDetails (as { [MODEL_PROVIDER_TYPE_DETAIL]: { label } }, see ModelProviderTypeDetail), or undefined when none is declared. The Models page uses this to label a provider block without hard-coding provider names.

      Parameters

      • preferenceId: string

      Returns undefined | string

    • Strips the common leading indentation from a markdown description before rendering.

      Preference markdownDescriptions are commonly authored as indented, multi-line JavaScript string literals, which leaves every continuation line prefixed with the source indentation. That accidental indentation makes markdown-it collapse bullet lists and paragraphs into a single dense block, so the description reads as an unstructured run-on. Removing the shared indentation (ignoring the first line, which starts right after the opening quote) restores the intended paragraph and list structure while preserving relative indentation, so nested lists stay nested.

      Parameters

      • markdown: string

      Returns string

    • Opens the gear menu for a row backed by non-preference data (e.g. a per-agent setting): the same "Reset Setting" affordance as a preference row, but reset runs the given callback. Copy entries are hidden (no preference id). Lets these rows reuse the shared gear menu instead of a bespoke button.

      Parameters

      • gear: HTMLElement
      • reset: () => void

      Returns void

    • Opens the gear context menu (Reset Setting / Copy Setting ID / Copy Setting as JSON) anchored below the gear. Uses this view's own AI_CONFIGURATION_SETTING_CONTEXT_MENU commands, backed by AiConfigurationService and acting in the row's own scope — rather than the Settings UI's RESET_PREFERENCE command, which is bound to the Preferences editor widget and misbehaves when invoked from here (it resets in the Preferences widget's scope and disturbs focus in this view).

      Parameters

      • gear: HTMLElement
      • preferenceId: string
      • value: unknown
      • scope: AiConfigurationScope
      • OptionalresourceUri: string

      Returns void