Sync settings descriptions with schema metadata
- Centralize settings copy in schema annotations - Reuse schema descriptions in the settings UI - Refresh generated server settings schema output
This commit is contained in:
1 parent
68ff6d8578
commit
8b9cf23ec7
8 files changed
+162
-94
No files matched your search
@@ -56,10 +56,7 @@
|
||||
"description": "Optional expression limiting when the shortcut is active."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"key",
|
||||
"command"
|
||||
],
|
||||
"required": ["key", "command"],
|
||||
"additionalProperties": false,
|
||||
"description": "Single keybinding rule entry in `keybindings.json`."
|
||||
},
|
||||
|
||||
@@ -18,23 +18,20 @@
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Whether server-driven assistant responses should stream incrementally to clients when the active provider supports it."
|
||||
"description": "Show token-by-token output while a response is in progress."
|
||||
},
|
||||
"defaultThreadEnvMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"local",
|
||||
"worktree"
|
||||
],
|
||||
"enum": ["local", "worktree"],
|
||||
"description": "Default execution environment to use when creating new threads."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Default execution environment to use when creating new threads."
|
||||
"description": "Pick the default workspace mode for newly created draft threads."
|
||||
},
|
||||
"textGenerationModelSelection": {
|
||||
"anyOf": [
|
||||
@@ -45,9 +42,7 @@
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"codex"
|
||||
],
|
||||
"enum": ["codex"],
|
||||
"description": "The provider used for text generation."
|
||||
},
|
||||
"model": {
|
||||
@@ -61,12 +56,7 @@
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"xhigh",
|
||||
"high",
|
||||
"medium",
|
||||
"low"
|
||||
]
|
||||
"enum": ["xhigh", "high", "medium", "low"]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -90,10 +80,7 @@
|
||||
"description": "Optional Codex-specific tuning knobs for the selected model."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"provider",
|
||||
"model"
|
||||
],
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false,
|
||||
"description": "Text generation model selection for the Codex provider."
|
||||
},
|
||||
@@ -102,9 +89,7 @@
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"claudeAgent"
|
||||
],
|
||||
"enum": ["claudeAgent"],
|
||||
"description": "The provider used for text generation."
|
||||
},
|
||||
"model": {
|
||||
@@ -129,13 +114,7 @@
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"max",
|
||||
"ultrathink"
|
||||
]
|
||||
"enum": ["low", "medium", "high", "max", "ultrathink"]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -170,10 +149,7 @@
|
||||
"description": "Optional Claude-specific tuning knobs for the selected model."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"provider",
|
||||
"model"
|
||||
],
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false,
|
||||
"description": "Text generation model selection for the Claude provider."
|
||||
}
|
||||
@@ -184,7 +160,7 @@
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Default provider and model to use for server-side text generation features."
|
||||
"description": "Configure the model used for generated commit messages, PR titles, and similar Git text."
|
||||
},
|
||||
"providers": {
|
||||
"anyOf": [
|
||||
@@ -217,7 +193,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Path to the Codex binary"
|
||||
},
|
||||
"homePath": {
|
||||
"anyOf": [
|
||||
@@ -228,7 +205,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Optional custom Codex home and config directory."
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
@@ -281,7 +259,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Path to the Claude binary"
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Whether server-driven assistant responses should stream incrementally to clients when the active provider supports it."
|
||||
"description": "Show token-by-token output while a response is in progress."
|
||||
},
|
||||
"defaultThreadEnvMode": {
|
||||
"anyOf": [
|
||||
@@ -31,7 +31,7 @@
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Default execution environment to use when creating new threads."
|
||||
"description": "Pick the default workspace mode for newly created draft threads."
|
||||
},
|
||||
"textGenerationModelSelection": {
|
||||
"anyOf": [
|
||||
@@ -160,7 +160,7 @@
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Default provider and model to use for server-side text generation features."
|
||||
"description": "Configure the model used for generated commit messages, PR titles, and similar Git text."
|
||||
},
|
||||
"providers": {
|
||||
"anyOf": [
|
||||
@@ -193,7 +193,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Path to the Codex binary"
|
||||
},
|
||||
"homePath": {
|
||||
"anyOf": [
|
||||
@@ -204,7 +205,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Optional custom Codex home and config directory."
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
@@ -257,7 +259,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Path to the Claude binary"
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
|
||||
@@ -12,14 +12,19 @@ import {
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
ClaudeSettings,
|
||||
ClientSettingsSchema,
|
||||
CodexSettings,
|
||||
PROVIDER_DISPLAY_NAMES,
|
||||
type ProviderKind,
|
||||
type ServerProvider,
|
||||
type ServerProviderModel,
|
||||
ServerSettings,
|
||||
ThreadId,
|
||||
} from "@t3tools/contracts";
|
||||
import { DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts/settings";
|
||||
import { normalizeModelSlug } from "@t3tools/shared/model";
|
||||
import { getSchemaDescription } from "@t3tools/shared/schemaJson";
|
||||
import { Equal } from "effect";
|
||||
import { APP_VERSION } from "../../branding";
|
||||
import {
|
||||
@@ -81,6 +86,51 @@ const TIMESTAMP_FORMAT_LABELS = {
|
||||
"24-hour": "24-hour",
|
||||
} as const;
|
||||
|
||||
function requireSchemaDescription(
|
||||
schema: Parameters<typeof getSchemaDescription>[0],
|
||||
label: string,
|
||||
) {
|
||||
const description = getSchemaDescription(schema);
|
||||
if (!description) {
|
||||
throw new Error(`Missing schema description for ${label}`);
|
||||
}
|
||||
return description;
|
||||
}
|
||||
|
||||
const SETTINGS_DESCRIPTIONS = {
|
||||
timestampFormat: requireSchemaDescription(
|
||||
ClientSettingsSchema.fields.timestampFormat,
|
||||
"ClientSettings.timestampFormat",
|
||||
),
|
||||
diffWordWrap: requireSchemaDescription(
|
||||
ClientSettingsSchema.fields.diffWordWrap,
|
||||
"ClientSettings.diffWordWrap",
|
||||
),
|
||||
confirmThreadArchive: requireSchemaDescription(
|
||||
ClientSettingsSchema.fields.confirmThreadArchive,
|
||||
"ClientSettings.confirmThreadArchive",
|
||||
),
|
||||
confirmThreadDelete: requireSchemaDescription(
|
||||
ClientSettingsSchema.fields.confirmThreadDelete,
|
||||
"ClientSettings.confirmThreadDelete",
|
||||
),
|
||||
enableAssistantStreaming: requireSchemaDescription(
|
||||
ServerSettings.fields.enableAssistantStreaming,
|
||||
"ServerSettings.enableAssistantStreaming",
|
||||
),
|
||||
defaultThreadEnvMode: requireSchemaDescription(
|
||||
ServerSettings.fields.defaultThreadEnvMode,
|
||||
"ServerSettings.defaultThreadEnvMode",
|
||||
),
|
||||
textGenerationModelSelection: requireSchemaDescription(
|
||||
ServerSettings.fields.textGenerationModelSelection,
|
||||
"ServerSettings.textGenerationModelSelection",
|
||||
),
|
||||
codexBinaryPath: requireSchemaDescription(CodexSettings.fields.binaryPath, "Codex.binaryPath"),
|
||||
codexHomePath: requireSchemaDescription(CodexSettings.fields.homePath, "Codex.homePath"),
|
||||
claudeBinaryPath: requireSchemaDescription(ClaudeSettings.fields.binaryPath, "Claude.binaryPath"),
|
||||
} as const;
|
||||
|
||||
const EMPTY_SERVER_PROVIDERS: ReadonlyArray<ServerProvider> = [];
|
||||
|
||||
type InstallProviderSettings = {
|
||||
@@ -98,16 +148,16 @@ const PROVIDER_SETTINGS: readonly InstallProviderSettings[] = [
|
||||
provider: "codex",
|
||||
title: "Codex",
|
||||
binaryPlaceholder: "Codex binary path",
|
||||
binaryDescription: "Path to the Codex binary",
|
||||
binaryDescription: SETTINGS_DESCRIPTIONS.codexBinaryPath,
|
||||
homePathKey: "codexHomePath",
|
||||
homePlaceholder: "CODEX_HOME",
|
||||
homeDescription: "Optional custom Codex home and config directory.",
|
||||
homeDescription: SETTINGS_DESCRIPTIONS.codexHomePath,
|
||||
},
|
||||
{
|
||||
provider: "claudeAgent",
|
||||
title: "Claude",
|
||||
binaryPlaceholder: "Claude binary path",
|
||||
binaryDescription: "Path to the Claude binary",
|
||||
binaryDescription: SETTINGS_DESCRIPTIONS.claudeBinaryPath,
|
||||
},
|
||||
] as const;
|
||||
|
||||
@@ -774,7 +824,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Time format"
|
||||
description="System default follows your browser or OS clock preference."
|
||||
description={SETTINGS_DESCRIPTIONS.timestampFormat}
|
||||
resetAction={
|
||||
settings.timestampFormat !== DEFAULT_UNIFIED_SETTINGS.timestampFormat ? (
|
||||
<SettingResetButton
|
||||
@@ -816,7 +866,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Diff line wrapping"
|
||||
description="Set the default wrap state when the diff panel opens."
|
||||
description={SETTINGS_DESCRIPTIONS.diffWordWrap}
|
||||
resetAction={
|
||||
settings.diffWordWrap !== DEFAULT_UNIFIED_SETTINGS.diffWordWrap ? (
|
||||
<SettingResetButton
|
||||
@@ -840,7 +890,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Assistant output"
|
||||
description="Show token-by-token output while a response is in progress."
|
||||
description={SETTINGS_DESCRIPTIONS.enableAssistantStreaming}
|
||||
resetAction={
|
||||
settings.enableAssistantStreaming !==
|
||||
DEFAULT_UNIFIED_SETTINGS.enableAssistantStreaming ? (
|
||||
@@ -867,7 +917,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="New threads"
|
||||
description="Pick the default workspace mode for newly created draft threads."
|
||||
description={SETTINGS_DESCRIPTIONS.defaultThreadEnvMode}
|
||||
resetAction={
|
||||
settings.defaultThreadEnvMode !== DEFAULT_UNIFIED_SETTINGS.defaultThreadEnvMode ? (
|
||||
<SettingResetButton
|
||||
@@ -908,7 +958,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Archive confirmation"
|
||||
description="Require a second click on the inline archive action before a thread is archived."
|
||||
description={SETTINGS_DESCRIPTIONS.confirmThreadArchive}
|
||||
resetAction={
|
||||
settings.confirmThreadArchive !== DEFAULT_UNIFIED_SETTINGS.confirmThreadArchive ? (
|
||||
<SettingResetButton
|
||||
@@ -934,7 +984,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Delete confirmation"
|
||||
description="Ask before deleting a thread and its chat history."
|
||||
description={SETTINGS_DESCRIPTIONS.confirmThreadDelete}
|
||||
resetAction={
|
||||
settings.confirmThreadDelete !== DEFAULT_UNIFIED_SETTINGS.confirmThreadDelete ? (
|
||||
<SettingResetButton
|
||||
@@ -960,7 +1010,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Text generation model"
|
||||
description="Configure the model used for generated commit messages, PR titles, and similar Git text."
|
||||
description={SETTINGS_DESCRIPTIONS.textGenerationModelSelection}
|
||||
resetAction={
|
||||
isGitWritingModelDirty ? (
|
||||
<SettingResetButton
|
||||
|
||||
@@ -23,17 +23,32 @@ export const SidebarThreadSortOrder = Schema.Literals(["updated_at", "created_at
|
||||
export type SidebarThreadSortOrder = typeof SidebarThreadSortOrder.Type;
|
||||
export const DEFAULT_SIDEBAR_THREAD_SORT_ORDER: SidebarThreadSortOrder = "updated_at";
|
||||
|
||||
const makeTrimmedStringSetting = (description: string) =>
|
||||
Schema.String.annotate({ description }).pipe(
|
||||
Schema.decodeTo(TrimmedString, SchemaTransformation.passthrough()),
|
||||
);
|
||||
|
||||
export const ClientSettingsSchema = Schema.Struct({
|
||||
confirmThreadArchive: Schema.Boolean.pipe(Schema.withDecodingDefault(() => false)),
|
||||
confirmThreadDelete: Schema.Boolean.pipe(Schema.withDecodingDefault(() => true)),
|
||||
diffWordWrap: Schema.Boolean.pipe(Schema.withDecodingDefault(() => false)),
|
||||
sidebarProjectSortOrder: SidebarProjectSortOrder.pipe(
|
||||
Schema.withDecodingDefault(() => DEFAULT_SIDEBAR_PROJECT_SORT_ORDER),
|
||||
),
|
||||
sidebarThreadSortOrder: SidebarThreadSortOrder.pipe(
|
||||
Schema.withDecodingDefault(() => DEFAULT_SIDEBAR_THREAD_SORT_ORDER),
|
||||
),
|
||||
timestampFormat: TimestampFormat.pipe(Schema.withDecodingDefault(() => DEFAULT_TIMESTAMP_FORMAT)),
|
||||
confirmThreadArchive: Schema.Boolean.annotate({
|
||||
description: "Require a second click on the inline archive action before a thread is archived.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false)),
|
||||
confirmThreadDelete: Schema.Boolean.annotate({
|
||||
description: "Ask before deleting a thread and its chat history.",
|
||||
}).pipe(Schema.withDecodingDefault(() => true)),
|
||||
diffWordWrap: Schema.Boolean.annotate({
|
||||
description: "Set the default wrap state when the diff panel opens.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false)),
|
||||
sidebarProjectSortOrder: SidebarProjectSortOrder.annotate({
|
||||
description: "Choose how projects are ordered in the sidebar.",
|
||||
}).pipe(Schema.withDecodingDefault(() => DEFAULT_SIDEBAR_PROJECT_SORT_ORDER)),
|
||||
sidebarThreadSortOrder: SidebarThreadSortOrder.annotate({
|
||||
description: "Choose how threads are ordered inside the selected project.",
|
||||
}).pipe(Schema.withDecodingDefault(() => DEFAULT_SIDEBAR_THREAD_SORT_ORDER)),
|
||||
timestampFormat: TimestampFormat.annotate({
|
||||
description: "System default follows your browser or OS clock preference.",
|
||||
}).pipe(Schema.withDecodingDefault(() => DEFAULT_TIMESTAMP_FORMAT)),
|
||||
}).annotate({
|
||||
description: "Client-only settings persisted locally in the browser.",
|
||||
});
|
||||
export type ClientSettings = typeof ClientSettingsSchema.Type;
|
||||
|
||||
@@ -42,13 +57,12 @@ export const DEFAULT_CLIENT_SETTINGS: ClientSettings = Schema.decodeSync(ClientS
|
||||
// ── Server Settings (server-authoritative) ────────────────────
|
||||
|
||||
export const ThreadEnvMode = Schema.Literals(["local", "worktree"]).annotate({
|
||||
description:
|
||||
"Default environment mode for new threads. 'local' runs in the current workspace, while 'worktree' runs in a managed git worktree.",
|
||||
description: "Pick the default workspace mode for newly created draft threads.",
|
||||
});
|
||||
export type ThreadEnvMode = typeof ThreadEnvMode.Type;
|
||||
|
||||
const makeBinaryPathSetting = (fallback: string) =>
|
||||
TrimmedString.pipe(
|
||||
const makeBinaryPathSetting = (fallback: string, description: string) =>
|
||||
makeTrimmedStringSetting(description).pipe(
|
||||
Schema.decodeTo(
|
||||
Schema.String,
|
||||
SchemaTransformation.transformOrFail({
|
||||
@@ -63,16 +77,10 @@ export const CodexSettings = Schema.Struct({
|
||||
enabled: Schema.Boolean.annotate({
|
||||
description: "Whether the Codex provider is enabled and available for selection.",
|
||||
}).pipe(Schema.withDecodingDefault(() => true)),
|
||||
binaryPath: makeBinaryPathSetting("codex").pipe(
|
||||
Schema.annotate({
|
||||
description:
|
||||
"Path to the Codex executable. Leave blank to resolve the `codex` executable from PATH.",
|
||||
}),
|
||||
binaryPath: makeBinaryPathSetting("codex", "Path to the Codex binary"),
|
||||
homePath: makeTrimmedStringSetting("Optional custom Codex home and config directory.").pipe(
|
||||
Schema.withDecodingDefault(() => ""),
|
||||
),
|
||||
homePath: TrimmedString.annotate({
|
||||
description:
|
||||
"Optional Codex home directory. Leave blank to use the default provider-managed location.",
|
||||
}).pipe(Schema.withDecodingDefault(() => "")),
|
||||
customModels: Schema.Array(Schema.String)
|
||||
.annotate({
|
||||
description:
|
||||
@@ -88,12 +96,7 @@ export const ClaudeSettings = Schema.Struct({
|
||||
enabled: Schema.Boolean.annotate({
|
||||
description: "Whether the Claude provider is enabled and available for selection.",
|
||||
}).pipe(Schema.withDecodingDefault(() => true)),
|
||||
binaryPath: makeBinaryPathSetting("claude").pipe(
|
||||
Schema.annotate({
|
||||
description:
|
||||
"Path to the Claude executable. Leave blank to resolve the `claude` executable from PATH.",
|
||||
}),
|
||||
),
|
||||
binaryPath: makeBinaryPathSetting("claude", "Path to the Claude binary"),
|
||||
customModels: Schema.Array(Schema.String)
|
||||
.annotate({
|
||||
description:
|
||||
@@ -107,14 +110,14 @@ export type ClaudeSettings = typeof ClaudeSettings.Type;
|
||||
|
||||
export const ServerSettings = Schema.Struct({
|
||||
enableAssistantStreaming: Schema.Boolean.annotate({
|
||||
description:
|
||||
"Whether server-driven assistant responses should stream incrementally to clients when the active provider supports it.",
|
||||
description: "Show token-by-token output while a response is in progress.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false)),
|
||||
defaultThreadEnvMode: ThreadEnvMode.annotate({
|
||||
description: "Default execution environment to use when creating new threads.",
|
||||
description: "Pick the default workspace mode for newly created draft threads.",
|
||||
}).pipe(Schema.withDecodingDefault(() => "local" as const satisfies ThreadEnvMode)),
|
||||
textGenerationModelSelection: ModelSelection.annotate({
|
||||
description: "Default provider and model to use for server-side text generation features.",
|
||||
description:
|
||||
"Configure the model used for generated commit messages, PR titles, and similar Git text.",
|
||||
}).pipe(
|
||||
Schema.withDecodingDefault(() => ({
|
||||
provider: "codex" as const,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect, Schema } from "effect";
|
||||
import { encodePrettyJsonEffect, toJsonSchemaObject } from "./schemaJson";
|
||||
import { encodePrettyJsonEffect, getSchemaDescription, toJsonSchemaObject } from "./schemaJson";
|
||||
|
||||
it.effect("encodePrettyJsonEffect writes indented JSON", () =>
|
||||
Effect.gen(function* () {
|
||||
@@ -55,3 +55,13 @@ it.effect("toJsonSchemaObject hoists descriptions from wrapper nodes", () =>
|
||||
assert.strictEqual(name.description, "Human-readable display name.");
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("getSchemaDescription reads hoisted descriptions from wrapped schemas", () =>
|
||||
Effect.sync(() => {
|
||||
const enabled = Schema.Boolean.annotate({
|
||||
description: "Whether the feature is enabled.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false));
|
||||
|
||||
assert.strictEqual(getSchemaDescription(enabled), "Whether the feature is enabled.");
|
||||
}),
|
||||
);
|
||||
@@ -36,6 +36,8 @@ export const decodeUnknownJsonResult = <S extends Schema.Codec<unknown, unknown,
|
||||
};
|
||||
};
|
||||
|
||||
const schemaDescriptionCache = new WeakMap<object, string | undefined>();
|
||||
|
||||
const PrettyJsonString = SchemaGetter.parseJson<string>().compose(
|
||||
SchemaGetter.stringifyJson({ space: 2 }),
|
||||
);
|
||||
@@ -100,6 +102,29 @@ export const toJsonSchemaObject = (schema: Schema.Top): unknown => {
|
||||
return hoistJsonSchemaDescriptions(document.schema);
|
||||
};
|
||||
|
||||
export const getSchemaDescription = (schema: Schema.Top): string | undefined => {
|
||||
if (schema && typeof schema === "object") {
|
||||
const cached = schemaDescriptionCache.get(schema);
|
||||
if (cached !== undefined || schemaDescriptionCache.has(schema)) {
|
||||
return cached;
|
||||
}
|
||||
}
|
||||
|
||||
const jsonSchema = toJsonSchemaObject(schema);
|
||||
const description =
|
||||
jsonSchema && typeof jsonSchema === "object" && !Array.isArray(jsonSchema)
|
||||
? typeof (jsonSchema as Record<string, unknown>).description === "string"
|
||||
? ((jsonSchema as Record<string, unknown>).description as string)
|
||||
: undefined
|
||||
: undefined;
|
||||
|
||||
if (schema && typeof schema === "object") {
|
||||
schemaDescriptionCache.set(schema, description);
|
||||
}
|
||||
|
||||
return description;
|
||||
};
|
||||
|
||||
/**
|
||||
* A `Getter` that parses a lenient JSON string (tolerating trailing commas
|
||||
* and JS-style comments) into an unknown value.
|
||||
|
||||
@@ -24,13 +24,14 @@ describe("buildServerSettingsJsonSchema", () => {
|
||||
type: "string",
|
||||
},
|
||||
enableAssistantStreaming: {
|
||||
description: expect.stringContaining("stream"),
|
||||
description: "Show token-by-token output while a response is in progress.",
|
||||
},
|
||||
defaultThreadEnvMode: {
|
||||
description: expect.stringContaining("environment"),
|
||||
description: "Pick the default workspace mode for newly created draft threads.",
|
||||
},
|
||||
textGenerationModelSelection: {
|
||||
description: expect.stringContaining("provider and model"),
|
||||
description:
|
||||
"Configure the model used for generated commit messages, PR titles, and similar Git text.",
|
||||
},
|
||||
providers: {
|
||||
description: expect.stringContaining("Provider-specific"),
|
||||
|
||||
Reference in new issue
Block a user