@theia/ai-core 1.71.0-next.8 → 1.71.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/browser/ai-activation-service.d.ts +9 -0
- package/lib/browser/ai-activation-service.d.ts.map +1 -1
- package/lib/browser/ai-activation-service.js +5 -0
- package/lib/browser/ai-activation-service.js.map +1 -1
- package/lib/browser/ai-core-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-core-frontend-module.js +5 -1
- package/lib/browser/ai-core-frontend-module.js.map +1 -1
- package/lib/browser/ai-settings-service.d.ts +2 -0
- package/lib/browser/ai-settings-service.d.ts.map +1 -1
- package/lib/browser/ai-settings-service.js +8 -1
- package/lib/browser/ai-settings-service.js.map +1 -1
- package/lib/browser/frontend-language-model-alias-registry.d.ts +2 -0
- package/lib/browser/frontend-language-model-alias-registry.d.ts.map +1 -1
- package/lib/browser/frontend-language-model-alias-registry.js +18 -9
- package/lib/browser/frontend-language-model-alias-registry.js.map +1 -1
- package/lib/browser/frontend-language-model-service.d.ts +6 -4
- package/lib/browser/frontend-language-model-service.d.ts.map +1 -1
- package/lib/browser/frontend-language-model-service.js +34 -16
- package/lib/browser/frontend-language-model-service.js.map +1 -1
- package/lib/browser/frontend-prompt-customization-service.d.ts +7 -0
- package/lib/browser/frontend-prompt-customization-service.d.ts.map +1 -1
- package/lib/browser/frontend-prompt-customization-service.js +39 -13
- package/lib/browser/frontend-prompt-customization-service.js.map +1 -1
- package/lib/browser/product-name-variable-contribution.d.ts +9 -0
- package/lib/browser/product-name-variable-contribution.d.ts.map +1 -0
- package/lib/browser/product-name-variable-contribution.js +49 -0
- package/lib/browser/product-name-variable-contribution.js.map +1 -0
- package/lib/browser/product-name-variable-contribution.spec.d.ts +2 -0
- package/lib/browser/product-name-variable-contribution.spec.d.ts.map +1 -0
- package/lib/browser/product-name-variable-contribution.spec.js +50 -0
- package/lib/browser/product-name-variable-contribution.spec.js.map +1 -0
- package/lib/browser/skill-prompt-coordinator.d.ts +1 -1
- package/lib/browser/skill-prompt-coordinator.d.ts.map +1 -1
- package/lib/browser/skill-prompt-coordinator.js +3 -1
- package/lib/browser/skill-prompt-coordinator.js.map +1 -1
- package/lib/browser/skill-service.d.ts +5 -0
- package/lib/browser/skill-service.d.ts.map +1 -1
- package/lib/browser/skill-service.js +6 -0
- package/lib/browser/skill-service.js.map +1 -1
- package/lib/browser/skills-variable-contribution.spec.js +2 -1
- package/lib/browser/skills-variable-contribution.spec.js.map +1 -1
- package/lib/browser/trust-aware-preference-reader.d.ts +38 -0
- package/lib/browser/trust-aware-preference-reader.d.ts.map +1 -0
- package/lib/browser/trust-aware-preference-reader.js +114 -0
- package/lib/browser/trust-aware-preference-reader.js.map +1 -0
- package/lib/browser/trust-aware-preference-reader.spec.d.ts +2 -0
- package/lib/browser/trust-aware-preference-reader.spec.d.ts.map +1 -0
- package/lib/browser/trust-aware-preference-reader.spec.js +251 -0
- package/lib/browser/trust-aware-preference-reader.spec.js.map +1 -0
- package/lib/common/ai-core-preferences.d.ts +5 -7
- package/lib/common/ai-core-preferences.d.ts.map +1 -1
- package/lib/common/ai-core-preferences.js +34 -37
- package/lib/common/ai-core-preferences.js.map +1 -1
- package/lib/common/language-model.d.ts +25 -4
- package/lib/common/language-model.d.ts.map +1 -1
- package/lib/common/language-model.js.map +1 -1
- package/lib/common/settings-service.d.ts +7 -1
- package/lib/common/settings-service.d.ts.map +1 -1
- package/lib/node/backend-language-model-registry.d.ts.map +1 -1
- package/lib/node/backend-language-model-registry.js +1 -0
- package/lib/node/backend-language-model-registry.js.map +1 -1
- package/package.json +12 -12
- package/src/browser/ai-activation-service.ts +16 -0
- package/src/browser/ai-core-frontend-module.ts +6 -1
- package/src/browser/ai-settings-service.ts +10 -1
- package/src/browser/frontend-language-model-alias-registry.ts +17 -9
- package/src/browser/frontend-language-model-service.ts +36 -20
- package/src/browser/frontend-prompt-customization-service.ts +38 -15
- package/src/browser/product-name-variable-contribution.spec.ts +68 -0
- package/src/browser/product-name-variable-contribution.ts +47 -0
- package/src/browser/skill-prompt-coordinator.ts +4 -1
- package/src/browser/skill-service.ts +10 -0
- package/src/browser/skills-variable-contribution.spec.ts +2 -1
- package/src/browser/trust-aware-preference-reader.spec.ts +304 -0
- package/src/browser/trust-aware-preference-reader.ts +108 -0
- package/src/common/ai-core-preferences.ts +38 -41
- package/src/common/language-model.ts +28 -4
- package/src/common/settings-service.ts +7 -1
- package/src/node/backend-language-model-registry.ts +1 -0
|
@@ -24,12 +24,13 @@ import {
|
|
|
24
24
|
NOTIFICATION_TYPE_DESCRIPTIONS,
|
|
25
25
|
NotificationType
|
|
26
26
|
} from './notification-types';
|
|
27
|
+
import { ReasoningSettings } from './language-model';
|
|
27
28
|
import { PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema';
|
|
28
29
|
|
|
29
30
|
export const AI_CORE_PREFERENCES_TITLE = nls.localize('theia/ai-core/preferences/title', 'AI Features');
|
|
30
31
|
export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.promptTemplates.promptTemplatesFolder';
|
|
31
32
|
export const PREFERENCE_NAME_REQUEST_SETTINGS = 'ai-features.modelSettings.requestSettings';
|
|
32
|
-
export const
|
|
33
|
+
export const PREFERENCE_NAME_REASONING = 'ai-features.reasoning.defaults';
|
|
33
34
|
export const PREFERENCE_NAME_MAX_RETRIES = 'ai-features.modelSettings.maxRetries';
|
|
34
35
|
export const PREFERENCE_NAME_DEFAULT_NOTIFICATION_TYPE = 'ai-features.notifications.default';
|
|
35
36
|
export const PREFERENCE_NAME_SKILL_DIRECTORIES = 'ai-features.skills.skillDirectories';
|
|
@@ -149,19 +150,30 @@ export const aiCorePreferenceSchema: PreferenceSchema = {
|
|
|
149
150
|
},
|
|
150
151
|
default: []
|
|
151
152
|
},
|
|
152
|
-
[
|
|
153
|
-
title: nls.localize('theia/ai/core/
|
|
154
|
-
markdownDescription: nls.localize('theia/ai/core/
|
|
155
|
-
'
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
[PREFERENCE_NAME_REASONING]: {
|
|
154
|
+
title: nls.localize('theia/ai/core/reasoning/title', 'Reasoning Defaults'),
|
|
155
|
+
markdownDescription: nls.localize('theia/ai/core/reasoning/mdDescription',
|
|
156
|
+
'Default value for the chat input\'s reasoning selector, applied to models that support reasoning.\n\n'
|
|
157
|
+
+ 'This is a UI-level setting: the chosen level is translated to the provider\'s native API parameters'
|
|
158
|
+
+ ' at request time (e.g. Anthropic `thinking` / `output_config.effort`, OpenAI `reasoning.effort`,'
|
|
159
|
+
+ ' Gemini `thinkingConfig`) and takes precedence over any raw values supplied via'
|
|
160
|
+
+ ' `#ai-features.modelSettings.requestSettings#` for the same fields.\n\n'
|
|
161
|
+
+ 'Each entry consists of:\n'
|
|
162
|
+
+ '- `scope`: Defines when the setting applies (`modelId`, `providerId`, `agentId`).\n'
|
|
163
|
+
+ '- `reasoning.level`: One of `off`, `minimal`, `low`, `medium`, `high`, `auto`.\n\n'
|
|
164
|
+
+ 'Precedence at runtime (highest first): session override via the selector → this preference →'
|
|
165
|
+
+ ' the model\'s declared default. Whichever the selector displays is what gets sent. To override'
|
|
166
|
+
+ ' a provider\'s reasoning field manually via `#ai-features.modelSettings.requestSettings#`, set'
|
|
167
|
+
+ ' `reasoning.level` to `off` here so the level-based translation is disabled.\n\n'
|
|
168
|
+
+ 'Entries are matched based on scope specificity (agent: 100, model: 10, provider: 1 points).\n\n'
|
|
169
|
+
+ 'Example:\n'
|
|
170
|
+
+ '```json\n'
|
|
171
|
+
+ '[\n'
|
|
172
|
+
+ ' { "scope": { "providerId": "anthropic" }, "reasoning": { "level": "medium" } },\n'
|
|
173
|
+
+ ' { "scope": { "modelId": "openai/gpt-5" }, "reasoning": { "level": "high" } },\n'
|
|
174
|
+
+ ' { "scope": { "agentId": "Coder" }, "reasoning": { "level": "off" } }\n'
|
|
175
|
+
+ ']\n'
|
|
176
|
+
+ '```'),
|
|
165
177
|
type: 'array',
|
|
166
178
|
items: {
|
|
167
179
|
type: 'object',
|
|
@@ -169,37 +181,22 @@ export const aiCorePreferenceSchema: PreferenceSchema = {
|
|
|
169
181
|
scope: {
|
|
170
182
|
type: 'object',
|
|
171
183
|
properties: {
|
|
172
|
-
modelId: {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
providerId: {
|
|
177
|
-
type: 'string',
|
|
178
|
-
description: nls.localize('theia/ai/core/thinkingMode/scope/providerId/description', 'The (optional) provider id to apply the settings to.')
|
|
179
|
-
},
|
|
180
|
-
agentId: {
|
|
181
|
-
type: 'string',
|
|
182
|
-
description: nls.localize('theia/ai/core/thinkingMode/scope/agentId/description', 'The (optional) agent id to apply the settings to.')
|
|
183
|
-
}
|
|
184
|
+
modelId: { type: 'string' },
|
|
185
|
+
providerId: { type: 'string' },
|
|
186
|
+
agentId: { type: 'string' }
|
|
184
187
|
}
|
|
185
188
|
},
|
|
186
|
-
|
|
189
|
+
reasoning: {
|
|
187
190
|
type: 'object',
|
|
188
191
|
additionalProperties: false,
|
|
189
|
-
description: nls.localize('theia/ai/core/thinkingMode/thinkingMode/description', 'Thinking mode configuration.'),
|
|
190
192
|
properties: {
|
|
191
|
-
|
|
192
|
-
type: '
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
budgetTokens: {
|
|
197
|
-
type: 'number',
|
|
198
|
-
description: nls.localize('theia/ai/core/thinkingMode/thinkingMode/budgetTokens/description',
|
|
199
|
-
'Maximum tokens to use for thinking. Only applicable if the model supports thinking budget.')
|
|
193
|
+
level: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
enum: ['off', 'minimal', 'low', 'medium', 'high', 'auto'],
|
|
196
|
+
default: 'auto'
|
|
200
197
|
}
|
|
201
198
|
},
|
|
202
|
-
required: ['
|
|
199
|
+
required: ['level']
|
|
203
200
|
}
|
|
204
201
|
},
|
|
205
202
|
additionalProperties: false
|
|
@@ -236,7 +233,7 @@ export const aiCorePreferenceSchema: PreferenceSchema = {
|
|
|
236
233
|
export interface AICoreConfiguration {
|
|
237
234
|
[PREFERENCE_NAME_PROMPT_TEMPLATES]: string | undefined;
|
|
238
235
|
[PREFERENCE_NAME_REQUEST_SETTINGS]: Array<RequestSetting> | undefined;
|
|
239
|
-
[
|
|
236
|
+
[PREFERENCE_NAME_REASONING]: Array<ReasoningPreferenceEntry> | undefined;
|
|
240
237
|
[PREFERENCE_NAME_MAX_RETRIES]: number | undefined;
|
|
241
238
|
[PREFERENCE_NAME_DEFAULT_NOTIFICATION_TYPE]: NotificationType | undefined;
|
|
242
239
|
[PREFERENCE_NAME_SKILL_DIRECTORIES]: string[] | undefined;
|
|
@@ -254,9 +251,9 @@ export interface Scope {
|
|
|
254
251
|
agentId?: string;
|
|
255
252
|
}
|
|
256
253
|
|
|
257
|
-
export interface
|
|
254
|
+
export interface ReasoningPreferenceEntry {
|
|
258
255
|
scope?: Scope;
|
|
259
|
-
|
|
256
|
+
reasoning?: ReasoningSettings;
|
|
260
257
|
}
|
|
261
258
|
|
|
262
259
|
export const AICorePreferences = Symbol('AICorePreferences');
|
|
@@ -19,9 +19,27 @@ import { inject, injectable, named, postConstruct } from '@theia/core/shared/inv
|
|
|
19
19
|
|
|
20
20
|
export type MessageActor = 'user' | 'ai' | 'system';
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/** Provider-agnostic reasoning level; each provider maps this to its native API. */
|
|
23
|
+
export type ReasoningLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'auto';
|
|
24
|
+
|
|
25
|
+
export interface ReasoningSettings {
|
|
26
|
+
level: ReasoningLevel;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Shape of a model's reasoning parameter in its native API.
|
|
31
|
+
* - `'effort'`: discrete effort enum.
|
|
32
|
+
* - `'budget'`: numeric token budget.
|
|
33
|
+
*/
|
|
34
|
+
export type ReasoningApi = 'effort' | 'budget';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Declares a model's reasoning capabilities. When unset, the chat UI hides the
|
|
38
|
+
* reasoning selector and providers ignore the `reasoning` field on requests.
|
|
39
|
+
*/
|
|
40
|
+
export interface ReasoningSupport {
|
|
41
|
+
readonly supportedLevels: ReadonlyArray<ReasoningLevel>;
|
|
42
|
+
readonly defaultLevel?: ReasoningLevel;
|
|
25
43
|
}
|
|
26
44
|
|
|
27
45
|
export type LanguageModelMessage = TextMessage | ThinkingMessage | ToolUseMessage | ToolResultMessage | ImageMessage;
|
|
@@ -272,7 +290,8 @@ export interface LanguageModelRequest {
|
|
|
272
290
|
response_format?: { type: 'text' } | { type: 'json_object' } | ResponseFormatJsonSchema;
|
|
273
291
|
settings?: { [key: string]: unknown };
|
|
274
292
|
clientSettings?: { keepToolCalls: boolean; keepThinking: boolean };
|
|
275
|
-
|
|
293
|
+
/** Provider-agnostic reasoning configuration; providers translate it to their native API. */
|
|
294
|
+
reasoning?: ReasoningSettings;
|
|
276
295
|
}
|
|
277
296
|
export interface ResponseFormatJsonSchema {
|
|
278
297
|
type: 'json_schema';
|
|
@@ -323,6 +342,7 @@ export interface UserRequest extends LanguageModelRequest {
|
|
|
323
342
|
|
|
324
343
|
export interface LanguageModelTextResponse {
|
|
325
344
|
text: string;
|
|
345
|
+
usage?: UsageResponsePart;
|
|
326
346
|
}
|
|
327
347
|
export const isLanguageModelTextResponse = (obj: unknown): obj is LanguageModelTextResponse =>
|
|
328
348
|
!!(obj && typeof obj === 'object' && 'text' in obj && typeof (obj as { text: unknown }).text === 'string');
|
|
@@ -335,6 +355,8 @@ export const isLanguageModelStreamResponsePart = (part: unknown): part is Langua
|
|
|
335
355
|
export interface UsageResponsePart {
|
|
336
356
|
input_tokens: number;
|
|
337
357
|
output_tokens: number;
|
|
358
|
+
cache_creation_input_tokens?: number;
|
|
359
|
+
cache_read_input_tokens?: number;
|
|
338
360
|
}
|
|
339
361
|
export const isUsageResponsePart = (part: unknown): part is UsageResponsePart =>
|
|
340
362
|
!!(part && typeof part === 'object' &&
|
|
@@ -414,6 +436,7 @@ export const isLanguageModelStreamResponse = (obj: unknown): obj is LanguageMode
|
|
|
414
436
|
export interface LanguageModelParsedResponse {
|
|
415
437
|
parsed: unknown;
|
|
416
438
|
content: string;
|
|
439
|
+
usage?: UsageResponsePart;
|
|
417
440
|
}
|
|
418
441
|
export const isLanguageModelParsedResponse = (obj: unknown): obj is LanguageModelParsedResponse =>
|
|
419
442
|
!!(obj && typeof obj === 'object' && 'parsed' in obj && 'content' in obj);
|
|
@@ -437,6 +460,7 @@ export interface LanguageModelMetaData {
|
|
|
437
460
|
readonly maxInputTokens?: number;
|
|
438
461
|
readonly maxOutputTokens?: number;
|
|
439
462
|
readonly status: LanguageModelStatus;
|
|
463
|
+
readonly reasoningSupport?: ReasoningSupport;
|
|
440
464
|
}
|
|
441
465
|
|
|
442
466
|
export namespace LanguageModelMetaData {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
import { Event } from '@theia/core';
|
|
17
|
-
import { LanguageModelRequirement } from './language-model';
|
|
17
|
+
import { LanguageModelRequirement, ReasoningSettings } from './language-model';
|
|
18
18
|
import { NotificationType } from './notification-types';
|
|
19
19
|
import { GenericCapabilitySelections } from './capability-utils';
|
|
20
20
|
|
|
@@ -58,4 +58,10 @@ export interface AgentSettings {
|
|
|
58
58
|
* Stores selected IDs for each capability type.
|
|
59
59
|
*/
|
|
60
60
|
genericCapabilitySelections?: GenericCapabilitySelections;
|
|
61
|
+
/**
|
|
62
|
+
* Persisted reasoning selection for this agent. When set, the chat input's reasoning selector
|
|
63
|
+
* is initialized to this value at session start instead of falling back to the preference
|
|
64
|
+
* default or the model's declared default.
|
|
65
|
+
*/
|
|
66
|
+
reasoning?: ReasoningSettings;
|
|
61
67
|
}
|