@theia/ai-core 1.75.0-next.4 → 1.75.0-next.43
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-core-command-contribution.d.ts.map +1 -1
- package/lib/browser/ai-core-command-contribution.js +4 -1
- package/lib/browser/ai-core-command-contribution.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 -0
- package/lib/browser/ai-core-frontend-module.js.map +1 -1
- package/lib/browser/ai-settings-service.js +1 -0
- package/lib/browser/ai-settings-service.js.map +1 -1
- package/lib/browser/frontend-language-model-alias-registry.js +1 -1
- package/lib/browser/frontend-language-model-registry.d.ts +2 -0
- package/lib/browser/frontend-language-model-registry.d.ts.map +1 -1
- package/lib/browser/frontend-language-model-registry.js +22 -1
- package/lib/browser/frontend-language-model-registry.js.map +1 -1
- package/lib/browser/hide-ai-preferences-contribution.d.ts +30 -0
- package/lib/browser/hide-ai-preferences-contribution.d.ts.map +1 -0
- package/lib/browser/hide-ai-preferences-contribution.js +90 -0
- package/lib/browser/hide-ai-preferences-contribution.js.map +1 -0
- package/lib/browser/hide-ai-preferences-contribution.spec.d.ts +2 -0
- package/lib/browser/hide-ai-preferences-contribution.spec.d.ts.map +1 -0
- package/lib/browser/hide-ai-preferences-contribution.spec.js +95 -0
- package/lib/browser/hide-ai-preferences-contribution.spec.js.map +1 -0
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +1 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/prompt-variable-contribution.d.ts +1 -1
- package/lib/browser/prompt-variable-contribution.d.ts.map +1 -1
- package/lib/browser/prompt-variable-contribution.js +1 -0
- package/lib/browser/prompt-variable-contribution.js.map +1 -1
- package/lib/browser/skill-prompt-coordinator.d.ts +3 -1
- package/lib/browser/skill-prompt-coordinator.d.ts.map +1 -1
- package/lib/browser/skill-prompt-coordinator.js +13 -7
- package/lib/browser/skill-prompt-coordinator.js.map +1 -1
- package/lib/browser/skill-service.d.ts.map +1 -1
- package/lib/browser/skill-service.js +1 -1
- package/lib/browser/skill-service.js.map +1 -1
- package/lib/browser/skills-variable-contribution.js +1 -0
- package/lib/browser/skills-variable-contribution.js.map +1 -1
- package/lib/browser/theia-variable-contribution.js +6 -12
- package/lib/browser/theia-variable-contribution.js.map +1 -1
- package/lib/common/ai-core-preferences.d.ts +17 -0
- package/lib/common/ai-core-preferences.d.ts.map +1 -1
- package/lib/common/ai-core-preferences.js +9 -1
- package/lib/common/ai-core-preferences.js.map +1 -1
- package/lib/common/ai-variable-resource.d.ts +2 -1
- package/lib/common/ai-variable-resource.d.ts.map +1 -1
- package/lib/common/ai-variable-resource.js +6 -1
- package/lib/common/ai-variable-resource.js.map +1 -1
- package/lib/common/capability-variable-contribution.d.ts +1 -1
- package/lib/common/capability-variable-contribution.d.ts.map +1 -1
- package/lib/common/capability-variable-contribution.js +1 -0
- package/lib/common/capability-variable-contribution.js.map +1 -1
- package/lib/common/language-model.d.ts +1 -1
- package/lib/common/language-model.d.ts.map +1 -1
- package/lib/common/language-model.js +3 -2
- package/lib/common/language-model.js.map +1 -1
- package/lib/common/prompt-service.js +1 -0
- package/lib/common/prompt-service.js.map +1 -1
- package/lib/common/today-variable-contribution.d.ts.map +1 -1
- package/lib/common/today-variable-contribution.js +1 -1
- package/lib/common/today-variable-contribution.js.map +1 -1
- package/lib/common/tool-invocation-registry.d.ts +2 -1
- package/lib/common/tool-invocation-registry.d.ts.map +1 -1
- package/lib/common/tool-invocation-registry.js +6 -1
- package/lib/common/tool-invocation-registry.js.map +1 -1
- package/lib/node/language-model-frontend-delegate.d.ts +2 -2
- package/lib/node/language-model-frontend-delegate.d.ts.map +1 -1
- package/lib/node/language-model-frontend-delegate.js +1 -0
- package/lib/node/language-model-frontend-delegate.js.map +1 -1
- package/package.json +11 -11
- package/src/browser/ai-core-command-contribution.ts +7 -1
- package/src/browser/ai-core-frontend-module.ts +7 -1
- package/src/browser/ai-settings-service.ts +2 -2
- package/src/browser/frontend-language-model-alias-registry.ts +1 -1
- package/src/browser/frontend-language-model-registry.ts +6 -2
- package/src/browser/hide-ai-preferences-contribution.spec.ts +117 -0
- package/src/browser/hide-ai-preferences-contribution.ts +88 -0
- package/src/browser/index.ts +1 -0
- package/src/browser/prompt-variable-contribution.ts +3 -3
- package/src/browser/skill-prompt-coordinator.ts +12 -10
- package/src/browser/skill-service.ts +1 -2
- package/src/browser/skills-variable-contribution.ts +2 -2
- package/src/browser/theia-variable-contribution.ts +12 -12
- package/src/common/ai-core-preferences.ts +19 -0
- package/src/common/ai-variable-resource.ts +6 -3
- package/src/common/capability-variable-contribution.ts +3 -3
- package/src/common/language-model.ts +6 -4
- package/src/common/prompt-service.ts +2 -2
- package/src/common/today-variable-contribution.ts +2 -1
- package/src/common/tool-invocation-registry.ts +5 -2
- package/src/node/language-model-frontend-delegate.ts +3 -3
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { nls, PreferenceContribution, PreferenceSchema, PreferenceSchemaService } from '@theia/core';
|
|
19
|
+
import { AI_CORE_PREFERENCES_TITLE } from '../common/ai-core-preferences';
|
|
20
|
+
|
|
21
|
+
/** Prefix shared by all AI preferences. */
|
|
22
|
+
const AI_PREFERENCE_PREFIX = 'ai-features.';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Informational placeholder shown in the Settings UI where the AI preferences used to live. It is a
|
|
26
|
+
* `null`-type preference (no editable value) grouped under "AI Features"; `@theia/ai-ide` renders it
|
|
27
|
+
* with a button that opens the AI Configuration view. Excluded from the hiding pass below.
|
|
28
|
+
*/
|
|
29
|
+
export const AI_CONFIGURATION_OPEN_PREFERENCE_ID = 'ai-features.openConfiguration';
|
|
30
|
+
|
|
31
|
+
export const aiConfigurationOpenPlaceholderSchema: PreferenceSchema = {
|
|
32
|
+
properties: {
|
|
33
|
+
[AI_CONFIGURATION_OPEN_PREFERENCE_ID]: {
|
|
34
|
+
// eslint-disable-next-line no-null/no-null
|
|
35
|
+
type: 'null',
|
|
36
|
+
title: AI_CORE_PREFERENCES_TITLE,
|
|
37
|
+
markdownDescription: nls.localize('theia/ai-core/openConfiguration/description',
|
|
38
|
+
'AI settings have moved to the AI Configuration view. Open it to configure providers, models, agents, and more.')
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Hides all AI preferences (`ai-features.*`) from the Settings UI once the AI Configuration view
|
|
45
|
+
* covers them (eclipsesource/theia#316). The schemas stay registered so validation and typing are
|
|
46
|
+
* unaffected; only their Settings-UI visibility is turned off via `hidden: true`. Matching by prefix
|
|
47
|
+
* means any future AI preference is covered without per-schema maintenance.
|
|
48
|
+
*/
|
|
49
|
+
@injectable()
|
|
50
|
+
export class HideAiPreferencesContribution implements PreferenceContribution {
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Re-entrancy guard: {@link PreferenceSchemaService.updateSchemaProperty} fires `onDidChangeSchema`
|
|
54
|
+
* synchronously, so our own writes call {@link hideAiPreferences} back while it is still iterating
|
|
55
|
+
* the service's live property map.
|
|
56
|
+
*/
|
|
57
|
+
protected hiding = false;
|
|
58
|
+
|
|
59
|
+
async initSchema(service: PreferenceSchemaService): Promise<void> {
|
|
60
|
+
// Hide what is registered so far, then stay subscribed: schemas contributed after this point
|
|
61
|
+
// (a contribution whose own `initSchema` awaits, or any runtime `addSchema`) would otherwise
|
|
62
|
+
// remain visible in the Settings UI. Every addition fires `onDidChangeSchema`.
|
|
63
|
+
this.hideAiPreferences(service);
|
|
64
|
+
// Never disposed on purpose: this contribution lives as long as the application.
|
|
65
|
+
service.onDidChangeSchema(() => this.hideAiPreferences(service));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Turns on `hidden` for every `ai-features.*` property that is not already hidden. Idempotent, so it
|
|
70
|
+
* can run on every schema change. The `hidden` check and {@link hiding} each independently stop our own
|
|
71
|
+
* updates from looping; keep both, since dropping either leaves the pass one edit away from recursing.
|
|
72
|
+
*/
|
|
73
|
+
protected hideAiPreferences(service: PreferenceSchemaService): void {
|
|
74
|
+
if (this.hiding) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.hiding = true;
|
|
78
|
+
try {
|
|
79
|
+
for (const [key, property] of service.getSchemaProperties()) {
|
|
80
|
+
if (key.startsWith(AI_PREFERENCE_PREFIX) && key !== AI_CONFIGURATION_OPEN_PREFERENCE_ID && !property.hidden) {
|
|
81
|
+
service.updateSchemaProperty(key, { ...property, hidden: true });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} finally {
|
|
85
|
+
this.hiding = false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
package/src/browser/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from './ai-configuration-service-impl';
|
|
|
27
27
|
export * from './ai-view-contribution';
|
|
28
28
|
export * from './frontend-language-model-registry';
|
|
29
29
|
export * from './frontend-language-model-alias-registry';
|
|
30
|
+
export * from './hide-ai-preferences-contribution';
|
|
30
31
|
export * from './frontend-variable-service';
|
|
31
32
|
export * from './prompttemplate-contribution';
|
|
32
33
|
export * from './theia-variable-contribution';
|
|
@@ -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 { CommandService, ILogger, nls } from '@theia/core';
|
|
17
|
-
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
17
|
+
import { injectable, inject, named } from '@theia/core/shared/inversify';
|
|
18
18
|
import * as monaco from '@theia/monaco-editor-core';
|
|
19
19
|
import {
|
|
20
20
|
AIVariable,
|
|
@@ -47,8 +47,8 @@ export class PromptVariableContribution implements AIVariableContribution, AIVar
|
|
|
47
47
|
@inject(PromptService)
|
|
48
48
|
protected readonly promptService: PromptService;
|
|
49
49
|
|
|
50
|
-
@inject(ILogger)
|
|
51
|
-
protected logger: ILogger;
|
|
50
|
+
@inject(ILogger) @named('ai-core:PromptVariableContribution')
|
|
51
|
+
protected readonly logger: ILogger;
|
|
52
52
|
|
|
53
53
|
registerVariables(service: AIVariableService): void {
|
|
54
54
|
service.registerResolver(PROMPT_VARIABLE, this);
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
17
|
+
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ILogger } from '@theia/core';
|
|
18
19
|
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
19
20
|
import { SkillService } from './skill-service';
|
|
20
21
|
import { PromptService } from '../common/prompt-service';
|
|
@@ -28,18 +29,19 @@ export class SkillPromptCoordinator implements FrontendApplicationContribution {
|
|
|
28
29
|
@inject(PromptService)
|
|
29
30
|
protected readonly promptService: PromptService;
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
async onStart(): Promise<void> {
|
|
34
|
-
// Wait for skills to be loaded before registering commands
|
|
35
|
-
await this.skillService.ready;
|
|
32
|
+
@inject(ILogger) @named('ai-core:SkillPromptCoordinator')
|
|
33
|
+
protected readonly logger: ILogger;
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
this.updateSkillCommands();
|
|
35
|
+
protected registeredSkillCommands = new Set<string>();
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
this.skillService.
|
|
37
|
+
onStart(): void {
|
|
38
|
+
this.skillService.ready.then(() => {
|
|
39
|
+
this.skillService.onSkillsChanged(() => {
|
|
40
|
+
this.updateSkillCommands();
|
|
41
|
+
});
|
|
42
42
|
this.updateSkillCommands();
|
|
43
|
+
}).catch(error => {
|
|
44
|
+
this.logger.error('Failed to update skill commands', error);
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -58,8 +58,7 @@ export class DefaultSkillService implements SkillService {
|
|
|
58
58
|
@inject(FileService)
|
|
59
59
|
protected readonly fileService: FileService;
|
|
60
60
|
|
|
61
|
-
@inject(ILogger)
|
|
62
|
-
@named('SkillService')
|
|
61
|
+
@inject(ILogger) @named('ai-core:DefaultSkillService')
|
|
63
62
|
protected readonly logger: ILogger;
|
|
64
63
|
|
|
65
64
|
@inject(EnvVariablesServer)
|
|
@@ -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
|
|
|
17
|
-
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
17
|
+
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
18
18
|
import { ILogger, MaybePromise, nls, URI } from '@theia/core';
|
|
19
19
|
import {
|
|
20
20
|
AIVariable, AIVariableContext, AIVariableContribution, AIVariableResolutionRequest,
|
|
@@ -54,7 +54,7 @@ export class SkillsVariableContribution implements AIVariableContribution, AIVar
|
|
|
54
54
|
@inject(SkillService)
|
|
55
55
|
protected readonly skillService: SkillService;
|
|
56
56
|
|
|
57
|
-
@inject(ILogger)
|
|
57
|
+
@inject(ILogger) @named('ai-core:SkillsVariableContribution')
|
|
58
58
|
protected readonly logger: ILogger;
|
|
59
59
|
|
|
60
60
|
@inject(FileService)
|
|
@@ -51,40 +51,40 @@ export class TheiaVariableContribution implements AIVariableContribution, AIVari
|
|
|
51
51
|
['file', [
|
|
52
52
|
{
|
|
53
53
|
name: 'currentAbsoluteFilePath',
|
|
54
|
-
description: nls.localize('theia/ai/core/variable-contribution/currentAbsoluteFilePath',
|
|
55
|
-
|
|
54
|
+
description: nls.localize('theia/ai/core/variable-contribution/currentAbsoluteFilePath',
|
|
55
|
+
'The absolute path of the currently opened file.')
|
|
56
56
|
}
|
|
57
57
|
]],
|
|
58
58
|
['selectedText', [
|
|
59
59
|
{
|
|
60
|
-
description: nls.localize('theia/ai/core/variable-contribution/currentSelectedText',
|
|
61
|
-
|
|
60
|
+
description: nls.localize('theia/ai/core/variable-contribution/currentSelectedText',
|
|
61
|
+
'The plain text that is currently selected in the opened file. This excludes the information where the content is coming from.')
|
|
62
62
|
}
|
|
63
63
|
]],
|
|
64
64
|
['currentText', [
|
|
65
65
|
{
|
|
66
66
|
name: 'currentFileContent',
|
|
67
|
-
description: nls.localize('theia/ai/core/variable-contribution/currentFileContent',
|
|
68
|
-
|
|
67
|
+
description: nls.localize('theia/ai/core/variable-contribution/currentFileContent',
|
|
68
|
+
'The plain content of the currently opened file. This excludes the information where the content is coming from.')
|
|
69
69
|
}
|
|
70
70
|
]],
|
|
71
71
|
['relativeFile', [
|
|
72
72
|
{
|
|
73
73
|
name: 'currentRelativeFilePath',
|
|
74
|
-
description: nls.localize('theia/ai/core/variable-contribution/currentRelativeFilePath',
|
|
75
|
-
|
|
74
|
+
description: nls.localize('theia/ai/core/variable-contribution/currentRelativeFilePath',
|
|
75
|
+
'The workspace-relative path of the currently opened file (e.g., my-project/src/index.ts).')
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
name: '_f',
|
|
79
|
-
description: nls.localize('theia/ai/core/variable-contribution/dotRelativePath',
|
|
80
|
-
|
|
79
|
+
description: nls.localize('theia/ai/core/variable-contribution/dotRelativePath',
|
|
80
|
+
'Short reference to the workspace-relative path of the currently opened file (\'currentRelativeFilePath\').')
|
|
81
81
|
}
|
|
82
82
|
]],
|
|
83
83
|
['relativeFileDirname', [
|
|
84
84
|
{
|
|
85
85
|
name: 'currentRelativeDirPath',
|
|
86
|
-
description: nls.localize('theia/ai/core/variable-contribution/currentRelativeDirPath',
|
|
87
|
-
|
|
86
|
+
description: nls.localize('theia/ai/core/variable-contribution/currentRelativeDirPath',
|
|
87
|
+
'The workspace-relative path of the directory containing the currently opened file (e.g., my-project/src).')
|
|
88
88
|
}
|
|
89
89
|
]],
|
|
90
90
|
['lineNumber', [{}]],
|
|
@@ -28,6 +28,25 @@ import { ReasoningSettings, SERVER_SIDE_COMPACTION_TOKEN_THRESHOLD_MINIMUM } fro
|
|
|
28
28
|
import { PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema';
|
|
29
29
|
|
|
30
30
|
export const AI_CORE_PREFERENCES_TITLE = nls.localize('theia/ai-core/preferences/title', 'AI Features');
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Key under a preference's schema `typeDetails` where a language-model provider declares the
|
|
34
|
+
* human-readable name of its provider block. The AI Configuration view's Models page reads this to
|
|
35
|
+
* label the provider node (discovered from the `ai-features.<provider>.*` preferences) without
|
|
36
|
+
* having to hard-code provider names. Declare it on any one preference of the provider's block, e.g.
|
|
37
|
+
* `typeDetails: { [MODEL_PROVIDER_TYPE_DETAIL]: 'Anthropic' }`.
|
|
38
|
+
*/
|
|
39
|
+
export const MODEL_PROVIDER_TYPE_DETAIL = 'aiModelProvider';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Shape a language-model provider stores under a preference's `typeDetails[MODEL_PROVIDER_TYPE_DETAIL]`
|
|
43
|
+
* to describe its `ai-features.<provider>.*` block to the AI Configuration view's Models page. Declared
|
|
44
|
+
* on any one preference of the block, e.g. `typeDetails: { [MODEL_PROVIDER_TYPE_DETAIL]: { label: 'Anthropic' } }`.
|
|
45
|
+
*/
|
|
46
|
+
export interface ModelProviderTypeDetail {
|
|
47
|
+
/** Human-readable provider name shown as the provider node/card label. */
|
|
48
|
+
label: string;
|
|
49
|
+
}
|
|
31
50
|
export const PREFERENCE_NAME_PROMPT_TEMPLATES = 'ai-features.promptTemplates.promptTemplatesFolder';
|
|
32
51
|
export const PREFERENCE_NAME_REQUEST_SETTINGS = 'ai-features.modelSettings.requestSettings';
|
|
33
52
|
export const PREFERENCE_NAME_REASONING = 'ai-features.reasoning.defaults';
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import * as deepEqual from 'fast-deep-equal';
|
|
18
|
-
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
-
import { Resource, URI, generateUuid } from '@theia/core';
|
|
18
|
+
import { inject, injectable, postConstruct, named } from '@theia/core/shared/inversify';
|
|
19
|
+
import { Resource, URI, generateUuid, ILogger } from '@theia/core';
|
|
20
20
|
import { AIVariableContext, AIVariableResolutionRequest } from './variable-service';
|
|
21
21
|
import stableJsonStringify = require('fast-json-stable-stringify');
|
|
22
22
|
import { ConfigurableInMemoryResources, ConfigurableMutableReferenceResource } from './configurable-in-memory-resources';
|
|
@@ -28,6 +28,9 @@ export const NO_CONTEXT_AUTHORITY = 'context-free';
|
|
|
28
28
|
export class AIVariableResourceResolver {
|
|
29
29
|
@inject(ConfigurableInMemoryResources) protected readonly inMemoryResources: ConfigurableInMemoryResources;
|
|
30
30
|
|
|
31
|
+
@inject(ILogger) @named('ai-core:AIVariableResourceResolver')
|
|
32
|
+
protected readonly logger: ILogger;
|
|
33
|
+
|
|
31
34
|
@postConstruct()
|
|
32
35
|
protected init(): void {
|
|
33
36
|
this.inMemoryResources.onWillDispose(resource => this.cache.delete(resource.uri.toString()));
|
|
@@ -68,7 +71,7 @@ export class AIVariableResourceResolver {
|
|
|
68
71
|
}
|
|
69
72
|
} catch (err) {
|
|
70
73
|
// Mostly that deep equal could overflow the stack, but it should run into === or inequality before that.
|
|
71
|
-
|
|
74
|
+
this.logger.warn('Problem evaluating context in AIVariableResourceResolver', err);
|
|
72
75
|
}
|
|
73
76
|
return generateUuid();
|
|
74
77
|
}
|
|
@@ -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 { ILogger, nls } from '@theia/core';
|
|
17
|
-
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
17
|
+
import { injectable, inject, named } from '@theia/core/shared/inversify';
|
|
18
18
|
import * as monaco from '@theia/monaco-editor-core';
|
|
19
19
|
import {
|
|
20
20
|
AIVariable,
|
|
@@ -49,8 +49,8 @@ export class CapabilityVariableContribution implements AIVariableContribution, A
|
|
|
49
49
|
@inject(PromptService)
|
|
50
50
|
protected readonly promptService: PromptService;
|
|
51
51
|
|
|
52
|
-
@inject(ILogger)
|
|
53
|
-
protected logger: ILogger;
|
|
52
|
+
@inject(ILogger) @named('ai-core:CapabilityVariableContribution')
|
|
53
|
+
protected readonly logger: ILogger;
|
|
54
54
|
|
|
55
55
|
registerVariables(service: AIVariableService): void {
|
|
56
56
|
service.registerResolver(CAPABILITY_VARIABLE, this);
|
|
@@ -703,8 +703,10 @@ export interface FrontendLanguageModelRegistry extends LanguageModelRegistry {
|
|
|
703
703
|
|
|
704
704
|
@injectable()
|
|
705
705
|
export class DefaultLanguageModelRegistryImpl implements LanguageModelRegistry {
|
|
706
|
-
|
|
707
|
-
|
|
706
|
+
|
|
707
|
+
@inject(ILogger) @named('ai-core:DefaultLanguageModelRegistryImpl')
|
|
708
|
+
protected readonly logger: ILogger;
|
|
709
|
+
|
|
708
710
|
@inject(ContributionProvider) @named(LanguageModelProvider)
|
|
709
711
|
protected readonly languageModelContributions: ContributionProvider<LanguageModelProvider>;
|
|
710
712
|
|
|
@@ -735,7 +737,7 @@ export class DefaultLanguageModelRegistryImpl implements LanguageModelRegistry {
|
|
|
735
737
|
addLanguageModels(models: LanguageModel[]): void {
|
|
736
738
|
models.forEach(model => {
|
|
737
739
|
if (this.languageModels.find(lm => lm.id === model.id)) {
|
|
738
|
-
|
|
740
|
+
this.logger.warn(`Tried to add already existing language model with id ${model.id}. The new model will be ignored.`);
|
|
739
741
|
return;
|
|
740
742
|
}
|
|
741
743
|
this.languageModels.push(model);
|
|
@@ -762,7 +764,7 @@ export class DefaultLanguageModelRegistryImpl implements LanguageModelRegistry {
|
|
|
762
764
|
this.languageModels.splice(index, 1);
|
|
763
765
|
this.changeEmitter.fire({ models: this.languageModels });
|
|
764
766
|
} else {
|
|
765
|
-
|
|
767
|
+
this.logger.warn(`Language model with id ${id} was requested to be removed, however it does not exist`);
|
|
766
768
|
}
|
|
767
769
|
});
|
|
768
770
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { Event, Emitter, URI, ILogger, DisposableCollection } from '@theia/core';
|
|
18
|
-
import { inject, injectable, optional, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { inject, injectable, optional, postConstruct, named } from '@theia/core/shared/inversify';
|
|
19
19
|
import { AIVariableArg, AIVariableContext, AIVariableService, createAIResolveVariableCache, ResolvedAIVariable } from './variable-service';
|
|
20
20
|
import { ToolInvocationRegistry } from './tool-invocation-registry';
|
|
21
21
|
import { toolRequestToPromptText } from './language-model-util';
|
|
@@ -607,7 +607,7 @@ export interface PromptService {
|
|
|
607
607
|
|
|
608
608
|
@injectable()
|
|
609
609
|
export class PromptServiceImpl implements PromptService {
|
|
610
|
-
@inject(ILogger)
|
|
610
|
+
@inject(ILogger) @named('ai-core:PromptServiceImpl')
|
|
611
611
|
protected readonly logger: ILogger;
|
|
612
612
|
|
|
613
613
|
@inject(AISettingsService) @optional()
|
|
@@ -24,7 +24,8 @@ export namespace TodayVariableArgs {
|
|
|
24
24
|
|
|
25
25
|
export const TODAY_VARIABLE: AIVariable = {
|
|
26
26
|
id: 'today-provider',
|
|
27
|
-
description: nls.localize('theia/ai/core/todayVariable/
|
|
27
|
+
description: nls.localize('theia/ai/core/todayVariable/dateDescription',
|
|
28
|
+
'The current date. Resolves to a human-readable date string by default, or to ISO 8601 or Unix seconds via the format argument.'),
|
|
28
29
|
name: 'today',
|
|
29
30
|
args: [
|
|
30
31
|
{
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { inject, injectable, named, postConstruct, interfaces } from '@theia/core/shared/inversify';
|
|
18
18
|
import { ToolRequest } from './language-model';
|
|
19
|
-
import { ContributionProvider, Emitter, Event } from '@theia/core';
|
|
19
|
+
import { ContributionProvider, Emitter, Event, ILogger } from '@theia/core';
|
|
20
20
|
|
|
21
21
|
export const ToolInvocationRegistry = Symbol('ToolInvocationRegistry');
|
|
22
22
|
|
|
@@ -99,6 +99,9 @@ export class ToolInvocationRegistryImpl implements ToolInvocationRegistry {
|
|
|
99
99
|
@named(ToolProvider)
|
|
100
100
|
private providers: ContributionProvider<ToolProvider>;
|
|
101
101
|
|
|
102
|
+
@inject(ILogger) @named('ai-core:ToolInvocationRegistryImpl')
|
|
103
|
+
protected readonly logger: ILogger;
|
|
104
|
+
|
|
102
105
|
@postConstruct()
|
|
103
106
|
init(): void {
|
|
104
107
|
this.providers.getContributions().forEach(provider => {
|
|
@@ -135,7 +138,7 @@ export class ToolInvocationRegistryImpl implements ToolInvocationRegistry {
|
|
|
135
138
|
|
|
136
139
|
registerTool(tool: ToolRequest): void {
|
|
137
140
|
if (this.tools.has(tool.id)) {
|
|
138
|
-
|
|
141
|
+
this.logger.warn(`Function with id ${tool.id} is already registered.`);
|
|
139
142
|
} else {
|
|
140
143
|
this.tools.set(tool.id, tool);
|
|
141
144
|
this.onDidChangeEmitter.fire();
|
|
@@ -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
|
|
|
17
|
-
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
17
|
+
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
18
18
|
import { CancellationToken, CancellationTokenSource, ILogger, generateUuid } from '@theia/core';
|
|
19
19
|
import {
|
|
20
20
|
LanguageModelMetaData,
|
|
@@ -53,8 +53,8 @@ export class LanguageModelFrontendDelegateImpl implements LanguageModelFrontendD
|
|
|
53
53
|
@inject(LanguageModelRegistry)
|
|
54
54
|
private registry: LanguageModelRegistry;
|
|
55
55
|
|
|
56
|
-
@inject(ILogger)
|
|
57
|
-
|
|
56
|
+
@inject(ILogger) @named('ai-core:LanguageModelFrontendDelegateImpl')
|
|
57
|
+
protected readonly logger: ILogger;
|
|
58
58
|
|
|
59
59
|
private frontendDelegateClient: LanguageModelDelegateClient;
|
|
60
60
|
private requestCancellationTokenMap: Map<string, CancellationTokenSource> = new Map();
|