@theia/ai-core 1.75.0-next.8 → 1.75.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.
Files changed (134) hide show
  1. package/lib/browser/agent-plugin-ui-bridge.d.ts +26 -0
  2. package/lib/browser/agent-plugin-ui-bridge.d.ts.map +1 -0
  3. package/lib/browser/agent-plugin-ui-bridge.js +20 -0
  4. package/lib/browser/agent-plugin-ui-bridge.js.map +1 -0
  5. package/lib/browser/ai-core-command-contribution.d.ts.map +1 -1
  6. package/lib/browser/ai-core-command-contribution.js +4 -1
  7. package/lib/browser/ai-core-command-contribution.js.map +1 -1
  8. package/lib/browser/ai-core-frontend-module.d.ts.map +1 -1
  9. package/lib/browser/ai-core-frontend-module.js +6 -0
  10. package/lib/browser/ai-core-frontend-module.js.map +1 -1
  11. package/lib/browser/ai-settings-service.js +1 -0
  12. package/lib/browser/ai-settings-service.js.map +1 -1
  13. package/lib/browser/frontend-language-model-alias-registry.js +1 -1
  14. package/lib/browser/frontend-language-model-registry.d.ts +2 -0
  15. package/lib/browser/frontend-language-model-registry.d.ts.map +1 -1
  16. package/lib/browser/frontend-language-model-registry.js +22 -1
  17. package/lib/browser/frontend-language-model-registry.js.map +1 -1
  18. package/lib/browser/generic-capabilities-variable-contribution.d.ts.map +1 -1
  19. package/lib/browser/generic-capabilities-variable-contribution.js +4 -1
  20. package/lib/browser/generic-capabilities-variable-contribution.js.map +1 -1
  21. package/lib/browser/hide-ai-preferences-contribution.d.ts +30 -0
  22. package/lib/browser/hide-ai-preferences-contribution.d.ts.map +1 -0
  23. package/lib/browser/hide-ai-preferences-contribution.js +90 -0
  24. package/lib/browser/hide-ai-preferences-contribution.js.map +1 -0
  25. package/lib/browser/hide-ai-preferences-contribution.spec.d.ts +2 -0
  26. package/lib/browser/hide-ai-preferences-contribution.spec.d.ts.map +1 -0
  27. package/lib/browser/hide-ai-preferences-contribution.spec.js +95 -0
  28. package/lib/browser/hide-ai-preferences-contribution.spec.js.map +1 -0
  29. package/lib/browser/index.d.ts +3 -0
  30. package/lib/browser/index.d.ts.map +1 -1
  31. package/lib/browser/index.js +3 -0
  32. package/lib/browser/index.js.map +1 -1
  33. package/lib/browser/prompt-variable-contribution.d.ts +1 -1
  34. package/lib/browser/prompt-variable-contribution.d.ts.map +1 -1
  35. package/lib/browser/prompt-variable-contribution.js +1 -0
  36. package/lib/browser/prompt-variable-contribution.js.map +1 -1
  37. package/lib/browser/skill-prompt-coordinator.d.ts +9 -1
  38. package/lib/browser/skill-prompt-coordinator.d.ts.map +1 -1
  39. package/lib/browser/skill-prompt-coordinator.js +29 -14
  40. package/lib/browser/skill-prompt-coordinator.js.map +1 -1
  41. package/lib/browser/skill-prompt-coordinator.spec.d.ts +2 -0
  42. package/lib/browser/skill-prompt-coordinator.spec.d.ts.map +1 -0
  43. package/lib/browser/skill-prompt-coordinator.spec.js +98 -0
  44. package/lib/browser/skill-prompt-coordinator.spec.js.map +1 -0
  45. package/lib/browser/skill-registry-ui-bridge.d.ts +25 -0
  46. package/lib/browser/skill-registry-ui-bridge.d.ts.map +1 -0
  47. package/lib/browser/skill-registry-ui-bridge.js +20 -0
  48. package/lib/browser/skill-registry-ui-bridge.js.map +1 -0
  49. package/lib/browser/skill-service.d.ts +33 -8
  50. package/lib/browser/skill-service.d.ts.map +1 -1
  51. package/lib/browser/skill-service.js +95 -39
  52. package/lib/browser/skill-service.js.map +1 -1
  53. package/lib/browser/skill-service.spec.js +181 -2
  54. package/lib/browser/skill-service.spec.js.map +1 -1
  55. package/lib/browser/skills-variable-contribution.d.ts +4 -0
  56. package/lib/browser/skills-variable-contribution.d.ts.map +1 -1
  57. package/lib/browser/skills-variable-contribution.js +10 -1
  58. package/lib/browser/skills-variable-contribution.js.map +1 -1
  59. package/lib/browser/skills-variable-contribution.spec.js +6 -0
  60. package/lib/browser/skills-variable-contribution.spec.js.map +1 -1
  61. package/lib/browser/theia-variable-contribution.js +6 -12
  62. package/lib/browser/theia-variable-contribution.js.map +1 -1
  63. package/lib/common/ai-core-preferences.d.ts +17 -0
  64. package/lib/common/ai-core-preferences.d.ts.map +1 -1
  65. package/lib/common/ai-core-preferences.js +9 -1
  66. package/lib/common/ai-core-preferences.js.map +1 -1
  67. package/lib/common/ai-variable-resource.d.ts +2 -1
  68. package/lib/common/ai-variable-resource.d.ts.map +1 -1
  69. package/lib/common/ai-variable-resource.js +6 -1
  70. package/lib/common/ai-variable-resource.js.map +1 -1
  71. package/lib/common/capability-variable-contribution.d.ts +1 -1
  72. package/lib/common/capability-variable-contribution.d.ts.map +1 -1
  73. package/lib/common/capability-variable-contribution.js +1 -0
  74. package/lib/common/capability-variable-contribution.js.map +1 -1
  75. package/lib/common/language-model.d.ts +16 -2
  76. package/lib/common/language-model.d.ts.map +1 -1
  77. package/lib/common/language-model.js +39 -3
  78. package/lib/common/language-model.js.map +1 -1
  79. package/lib/common/language-model.spec.js +75 -0
  80. package/lib/common/language-model.spec.js.map +1 -1
  81. package/lib/common/prompt-service.d.ts.map +1 -1
  82. package/lib/common/prompt-service.js +7 -4
  83. package/lib/common/prompt-service.js.map +1 -1
  84. package/lib/common/prompt-service.spec.js +36 -0
  85. package/lib/common/prompt-service.spec.js.map +1 -1
  86. package/lib/common/skill.d.ts +31 -7
  87. package/lib/common/skill.d.ts.map +1 -1
  88. package/lib/common/skill.js +37 -14
  89. package/lib/common/skill.js.map +1 -1
  90. package/lib/common/skill.spec.js +70 -0
  91. package/lib/common/skill.spec.js.map +1 -1
  92. package/lib/common/today-variable-contribution.d.ts.map +1 -1
  93. package/lib/common/today-variable-contribution.js +1 -1
  94. package/lib/common/today-variable-contribution.js.map +1 -1
  95. package/lib/common/tool-invocation-registry.d.ts +2 -1
  96. package/lib/common/tool-invocation-registry.d.ts.map +1 -1
  97. package/lib/common/tool-invocation-registry.js +6 -1
  98. package/lib/common/tool-invocation-registry.js.map +1 -1
  99. package/lib/node/language-model-frontend-delegate.d.ts +2 -2
  100. package/lib/node/language-model-frontend-delegate.d.ts.map +1 -1
  101. package/lib/node/language-model-frontend-delegate.js +1 -0
  102. package/lib/node/language-model-frontend-delegate.js.map +1 -1
  103. package/package.json +12 -12
  104. package/src/browser/agent-plugin-ui-bridge.ts +43 -0
  105. package/src/browser/ai-core-command-contribution.ts +7 -1
  106. package/src/browser/ai-core-frontend-module.ts +11 -2
  107. package/src/browser/ai-settings-service.ts +2 -2
  108. package/src/browser/frontend-language-model-alias-registry.ts +1 -1
  109. package/src/browser/frontend-language-model-registry.ts +6 -2
  110. package/src/browser/generic-capabilities-variable-contribution.ts +4 -1
  111. package/src/browser/hide-ai-preferences-contribution.spec.ts +117 -0
  112. package/src/browser/hide-ai-preferences-contribution.ts +88 -0
  113. package/src/browser/index.ts +3 -0
  114. package/src/browser/prompt-variable-contribution.ts +3 -3
  115. package/src/browser/skill-prompt-coordinator.spec.ts +114 -0
  116. package/src/browser/skill-prompt-coordinator.ts +29 -17
  117. package/src/browser/skill-registry-ui-bridge.ts +41 -0
  118. package/src/browser/skill-service.spec.ts +229 -4
  119. package/src/browser/skill-service.ts +120 -43
  120. package/src/browser/skills-variable-contribution.spec.ts +6 -0
  121. package/src/browser/skills-variable-contribution.ts +14 -4
  122. package/src/browser/theia-variable-contribution.ts +12 -12
  123. package/src/common/ai-core-preferences.ts +19 -0
  124. package/src/common/ai-variable-resource.ts +6 -3
  125. package/src/common/capability-variable-contribution.ts +3 -3
  126. package/src/common/language-model.spec.ts +83 -0
  127. package/src/common/language-model.ts +35 -5
  128. package/src/common/prompt-service.spec.ts +43 -0
  129. package/src/common/prompt-service.ts +8 -6
  130. package/src/common/skill.spec.ts +99 -0
  131. package/src/common/skill.ts +52 -17
  132. package/src/common/today-variable-contribution.ts +2 -1
  133. package/src/common/tool-invocation-registry.ts +5 -2
  134. package/src/node/language-model-frontend-delegate.ts +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"language-model-frontend-delegate.js","sourceRoot":"","sources":["../../src/node/language-model-frontend-delegate.ts"],"names":[],"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AAC;IACpB,CAAC;IAES,UAAU,CAAC,EAAU,EAAE,MAAsD,EAAE,iBAAqC;QAC1H,CAAC,KAAK,IAAI,EAAE;YACR,IAAI,CAAC;gBACD,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBAC/B,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;gBAChD,CAAC;YACL,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACT,IAAI,CAAC,iBAAiB,EAAE,uBAAuB,EAAE,CAAC;oBAC9C,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACL,CAAC;oBAAS,CAAC;gBACP,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;CACJ,CAAA;AAxEY,8EAAiC;AAGlC;IADP,IAAA,kBAAM,EAAC,8BAAqB,CAAC;;mEACU;AAGhC;IADP,IAAA,kBAAM,EAAC,cAAO,CAAC;;iEACQ;4CANf,iCAAiC;IAD7C,IAAA,sBAAU,GAAE;GACA,iCAAiC,CAwE7C"}
1
+ {"version":3,"file":"language-model-frontend-delegate.js","sourceRoot":"","sources":["../../src/node/language-model-frontend-delegate.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAyE;AACzE,sCAAgG;AAChG,sCAamB;AACnB,uFAAqF;AAG9E,IAAM,yCAAyC,GAA/C,MAAM,yCAAyC;IAKlD,SAAS,CAAC,MAAmC;QAC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AE,CAAC;oBAC9C,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACL,CAAC;oBAAS,CAAC;gBACP,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;CACJ,CAAA;AAxEY,8EAAiC;AAGlC;IADP,IAAA,kBAAM,EAAC,8BAAqB,CAAC;;mEACU;AAGrB;IADlB,IAAA,kBAAM,EAAC,cAAO,CAAC;IAAE,IAAA,iBAAK,EAAC,2CAA2C,CAAC;;iEACjC;4CAN1B,iCAAiC;IAD7C,IAAA,sBAAU,GAAE;GACA,iCAAiC,CAwE7C"}
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@theia/ai-core",
3
- "version": "1.75.0-next.8+c4452ce29",
3
+ "version": "1.75.0",
4
4
  "description": "Theia - AI Core",
5
5
  "dependencies": {
6
- "@theia/core": "1.75.0-next.8+c4452ce29",
7
- "@theia/editor": "1.75.0-next.8+c4452ce29",
8
- "@theia/filesystem": "1.75.0-next.8+c4452ce29",
9
- "@theia/monaco": "1.75.0-next.8+c4452ce29",
6
+ "@theia/core": "1.75.0",
7
+ "@theia/editor": "1.75.0",
8
+ "@theia/filesystem": "1.75.0",
9
+ "@theia/monaco": "1.75.0",
10
10
  "@theia/monaco-editor-core": "1.108.201",
11
- "@theia/output": "1.75.0-next.8+c4452ce29",
12
- "@theia/variable-resolver": "1.75.0-next.8+c4452ce29",
13
- "@theia/workspace": "1.75.0-next.8+c4452ce29",
11
+ "@theia/output": "1.75.0",
12
+ "@theia/variable-resolver": "1.75.0",
13
+ "@theia/workspace": "1.75.0",
14
14
  "@types/js-yaml": "^4.0.9",
15
15
  "fast-deep-equal": "^3.1.3",
16
- "js-yaml": "^4.3.0",
16
+ "js-yaml": "^4.3.1",
17
17
  "tslib": "^2.8.1",
18
- "undici": "^7.28.0"
18
+ "undici": "^7.29.0"
19
19
  },
20
20
  "main": "lib/common",
21
21
  "publishConfig": {
@@ -53,10 +53,10 @@
53
53
  "watch": "theiaext watch"
54
54
  },
55
55
  "devDependencies": {
56
- "@theia/ext-scripts": "1.74.0"
56
+ "@theia/ext-scripts": "1.75.0"
57
57
  },
58
58
  "nyc": {
59
59
  "extends": "../../configs/nyc.json"
60
60
  },
61
- "gitHead": "c4452ce290653826389aa42dfddfabe461c1dcc8"
61
+ "gitHead": "6d8e911f05f0fd9a13d76797e79b21ee3f038bc2"
62
62
  }
@@ -0,0 +1,43 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 EclipseSource GmbH 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 { Event } from '@theia/core';
18
+
19
+ export interface InstalledAgentPluginInfo {
20
+ /** Registry identifier, e.g. `io.github.acme/bigquery-data-analytics`. */
21
+ pluginId: string;
22
+ /** From the plugin manifest, falling back to the identifier. */
23
+ name: string;
24
+ }
25
+
26
+ export const AgentPluginUiBridge = Symbol('AgentPluginUiBridge');
27
+ /**
28
+ * Optional integration point implemented by `@theia/ai-registry`, so that packages which must not
29
+ * depend on it can still label and reveal the Agent Plugin behind a skill or an MCP server: both
30
+ * carry only its identifier.
31
+ *
32
+ * Nothing is bound by default. Consumers inject it `@optional()` and, when it is absent, hide every
33
+ * Agent Plugin affordance - a product without `@theia/ai-registry` cannot install one anyway.
34
+ */
35
+ export interface AgentPluginUiBridge {
36
+ /** `undefined` means callers should render no provenance affordance, not a bare identifier. */
37
+ getPlugin(pluginId: string): InstalledAgentPluginInfo | undefined;
38
+ /** Resolves the qualifier a contributed skill root carries, which is not the plugin identifier. */
39
+ getPluginByQualifier(qualifier: string): InstalledAgentPluginInfo | undefined;
40
+ /** A no-op for an unknown identifier. */
41
+ revealPlugin(pluginId: string): void;
42
+ readonly onDidChange: Event<void>;
43
+ }
@@ -31,7 +31,13 @@ export class AiCoreCommandContribution implements CommandContribution {
31
31
 
32
32
  registerCommands(commands: CommandRegistry): void {
33
33
  commands.registerCommand(AI_SHOW_SETTINGS_COMMAND, this.handlerFactory({
34
- execute: () => commands.executeCommand(CommonCommands.OPEN_PREFERENCES.id, 'ai-features'),
34
+ // An explicit AI preference id opens the Settings UI focused on it; anything else (no argument, or
35
+ // the widget the chat toolbar passes) falls back to the whole AI section. `@theia/ai-ide` overrides
36
+ // this handler to open the AI Configuration view instead, forwarding the same argument.
37
+ execute: (target?: unknown) => commands.executeCommand(
38
+ CommonCommands.OPEN_PREFERENCES.id,
39
+ typeof target === 'string' && target.trim() ? target : 'ai-features'
40
+ ),
35
41
  }));
36
42
  }
37
43
  }
@@ -14,13 +14,14 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { bindRootContributionProvider, CommandContribution, CommandHandler, ResourceResolver } from '@theia/core';
17
+ import { bindRootContributionProvider, CommandContribution, CommandHandler, PreferenceContribution, ResourceResolver } from '@theia/core';
18
18
  import {
19
19
  RemoteConnectionProvider,
20
20
  ServiceConnectionProvider,
21
21
  } from '@theia/core/lib/browser/messaging/service-connection-provider';
22
22
  import { ContainerModule } from '@theia/core/shared/inversify';
23
23
  import { DefaultLanguageModelAliasRegistry } from './frontend-language-model-alias-registry';
24
+ import { HideAiPreferencesContribution, aiConfigurationOpenPlaceholderSchema } from './hide-ai-preferences-contribution';
24
25
  import { TrustAwarePreferenceReader } from './trust-aware-preference-reader';
25
26
  import { AiConfigurationServiceImpl } from './ai-configuration-service-impl';
26
27
  import { LanguageModelAliasRegistry } from '../common/language-model-alias';
@@ -73,7 +74,7 @@ import { AIActivationService, AIActivationServiceImpl } from './ai-activation-se
73
74
  import { AgentService, AgentServiceImpl } from '../common/agent-service';
74
75
  import { AICommandHandlerFactory } from './ai-command-handler-factory';
75
76
  import { AISettingsService } from '../common/settings-service';
76
- import { DefaultSkillService, SkillService } from './skill-service';
77
+ import { DefaultSkillService, SkillDirectoryContribution, SkillService } from './skill-service';
77
78
  import { SkillPromptCoordinator } from './skill-prompt-coordinator';
78
79
  import { AiCoreCommandContribution } from './ai-core-command-contribution';
79
80
  import { PromptVariableContribution } from './prompt-variable-contribution';
@@ -138,6 +139,9 @@ export default new ContainerModule(bind => {
138
139
 
139
140
  bind(SkillPromptCoordinator).toSelf().inSingletonScope();
140
141
  bind(FrontendApplicationContribution).toService(SkillPromptCoordinator);
142
+
143
+ bindRootContributionProvider(bind, SkillDirectoryContribution);
144
+
141
145
  bindRootContributionProvider(bind, AIVariableContribution);
142
146
  bind(DefaultFrontendVariableService).toSelf().inSingletonScope();
143
147
  bind(FrontendVariableService).toService(DefaultFrontendVariableService);
@@ -198,6 +202,11 @@ export default new ContainerModule(bind => {
198
202
  bind(DefaultLanguageModelAliasRegistry).toSelf().inSingletonScope();
199
203
  bind(LanguageModelAliasRegistry).toService(DefaultLanguageModelAliasRegistry);
200
204
 
205
+ // Hide all AI preferences from the Settings UI; they are managed in the AI Configuration view (#316).
206
+ bind(PreferenceContribution).to(HideAiPreferencesContribution).inSingletonScope();
207
+ // ...and leave a single placeholder entry there that links to the AI Configuration view.
208
+ bind(PreferenceContribution).toConstantValue({ schema: aiConfigurationOpenPlaceholderSchema });
209
+
201
210
  // Internal implementation detail of AiConfigurationService; consumers inject AiConfigurationService.
202
211
  bind(TrustAwarePreferenceReader).toSelf().inSingletonScope();
203
212
 
@@ -14,13 +14,13 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
  import { DisposableCollection, Emitter, Event, ILogger, RecursiveReadonly } from '@theia/core';
17
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
17
+ import { inject, injectable, postConstruct, named } from '@theia/core/shared/inversify';
18
18
  import { AiConfigurationService, AISettings, AISettingsService, AgentSettings } from '../common';
19
19
 
20
20
  @injectable()
21
21
  export class AISettingsServiceImpl implements AISettingsService {
22
22
 
23
- @inject(ILogger)
23
+ @inject(ILogger) @named('ai-core:AISettingsServiceImpl')
24
24
  protected readonly logger: ILogger;
25
25
 
26
26
  @inject(AiConfigurationService)
@@ -67,7 +67,7 @@ export class DefaultLanguageModelAliasRegistry implements LanguageModelAliasRegi
67
67
  defaultModelIds: [
68
68
  'anthropic/claude-haiku-4-5',
69
69
  'openai/gpt-5.6-luna',
70
- 'google/gemini-3.6-flash'
70
+ 'google/gemini-3.7-flash'
71
71
  ],
72
72
  description: nls.localize('theia/ai/core/defaultModelAliases/fast/description',
73
73
  'Faster and cheaper models for simpler tasks like exploration or basic tool calling, where deep reasoning is not required.')
@@ -13,11 +13,12 @@
13
13
  //
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
- import { CancellationToken } from '@theia/core';
16
+ import { CancellationToken, ILogger } from '@theia/core';
17
17
  import {
18
18
  inject,
19
19
  injectable,
20
20
  postConstruct,
21
+ named,
21
22
  } from '@theia/core/shared/inversify';
22
23
  import {
23
24
  OutputChannel,
@@ -142,13 +143,16 @@ export class FrontendLanguageModelRegistryImpl
142
143
  @inject(AISettingsService)
143
144
  protected settingsService: AISettingsService;
144
145
 
146
+ @inject(ILogger) @named('ai-core:FrontendLanguageModelRegistryImpl')
147
+ protected override readonly logger: ILogger;
148
+
145
149
  private static requestCounter: number = 0;
146
150
 
147
151
  override addLanguageModels(models: LanguageModelMetaData[] | LanguageModel[]): void {
148
152
  let modelAdded = false;
149
153
  for (const model of models) {
150
154
  if (this.languageModels.find(m => m.id === model.id)) {
151
- console.warn(`Tried to add an existing model ${model.id}`);
155
+ this.logger.warn(`Tried to add an existing model ${model.id}`);
152
156
  continue;
153
157
  }
154
158
  if (LanguageModel.is(model)) {
@@ -162,9 +162,12 @@ export class GenericCapabilitiesVariableContribution implements AIVariableContri
162
162
  return { variable, value: '' };
163
163
  }
164
164
 
165
+ // Ids come from the capabilities panel, which lists qualified names; `getSkill` also accepts
166
+ // a plain one, so a selection stored before a skill gained a qualifier still resolves.
165
167
  const skills = skillIds
166
168
  .map(skillId => this.skillService!.getSkill(skillId))
167
- .filter((skill): skill is NonNullable<typeof skill> => skill !== undefined);
169
+ .filter((skill): skill is NonNullable<typeof skill> => skill !== undefined)
170
+ .map(skill => this.skillsContribution!.toSkillSummary(skill));
168
171
 
169
172
  return this.skillsContribution.resolveSkillsVariable(skills, variable);
170
173
  }
@@ -0,0 +1,117 @@
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 { expect } from 'chai';
18
+ import { Emitter } from '@theia/core';
19
+ import { PreferenceDataProperty, PreferenceSchemaService } from '@theia/core/lib/common/preferences/preference-schema';
20
+ import { HideAiPreferencesContribution, AI_CONFIGURATION_OPEN_PREFERENCE_ID } from './hide-ai-preferences-contribution';
21
+
22
+ interface TestService {
23
+ readonly service: PreferenceSchemaService;
24
+ /** Every key passed to `updateSchemaProperty`, in call order, so redundant writes are visible. */
25
+ readonly updates: string[];
26
+ /** Simulates a late `addSchema`: registers the property and fires `onDidChangeSchema` as the real service does. */
27
+ addProperty(key: string, property: PreferenceDataProperty): void;
28
+ isHidden(key: string): boolean | undefined;
29
+ }
30
+
31
+ /**
32
+ * Stub of the parts of {@link PreferenceSchemaService} the contribution touches, faithful in the two ways
33
+ * that matter here: `getSchemaProperties` hands out the live map, and `updateSchemaProperty` merges into it
34
+ * and fires `onDidChangeSchema` synchronously.
35
+ */
36
+ function createService(entries: [string, PreferenceDataProperty][]): TestService {
37
+ const properties = new Map<string, PreferenceDataProperty>(entries);
38
+ const schemaChanged = new Emitter<void>();
39
+ const updates: string[] = [];
40
+ const service: Partial<PreferenceSchemaService> = {
41
+ getSchemaProperties: () => properties,
42
+ updateSchemaProperty: (key, property) => {
43
+ updates.push(key);
44
+ properties.set(key, { ...properties.get(key), ...property });
45
+ schemaChanged.fire();
46
+ },
47
+ onDidChangeSchema: schemaChanged.event
48
+ };
49
+ return {
50
+ service: service as PreferenceSchemaService,
51
+ updates,
52
+ addProperty: (key, property) => {
53
+ properties.set(key, property);
54
+ schemaChanged.fire();
55
+ },
56
+ isHidden: key => properties.get(key)?.hidden
57
+ };
58
+ }
59
+
60
+ describe('HideAiPreferencesContribution', () => {
61
+
62
+ it('hides every ai-features.* preference from the Settings UI, keeping non-AI ones and leaving the AI Configuration view unaffected', async () => {
63
+ const test = createService([
64
+ ['ai-features.chat.tokenUsageIndicator.enabled', { type: 'boolean' }],
65
+ ['ai-features.anthropic.apiKey', { type: 'string' }],
66
+ // The redirect placeholder that links to the view stays visible in Settings.
67
+ [AI_CONFIGURATION_OPEN_PREFERENCE_ID, { type: 'null' }],
68
+ // Already hidden: left as-is (not re-updated).
69
+ ['ai-features.mcp.mcpServers', { type: 'object', hidden: true }],
70
+ // Non-AI preference: untouched.
71
+ ['editor.fontSize', { type: 'number' }]
72
+ ]);
73
+
74
+ await new HideAiPreferencesContribution().initSchema(test.service);
75
+
76
+ // Exactly the not-yet-hidden AI preferences are hidden — never the redirect placeholder or non-AI ones.
77
+ expect([...test.updates].sort()).to.deep.equal(['ai-features.anthropic.apiKey', 'ai-features.chat.tokenUsageIndicator.enabled']);
78
+ expect(test.isHidden('ai-features.anthropic.apiKey')).to.equal(true);
79
+ expect(test.isHidden('ai-features.chat.tokenUsageIndicator.enabled')).to.equal(true);
80
+ expect(test.isHidden(AI_CONFIGURATION_OPEN_PREFERENCE_ID)).to.equal(undefined);
81
+ expect(test.isHidden('editor.fontSize')).to.equal(undefined);
82
+ });
83
+
84
+ it('hides ai-features.* preferences registered after the initial pass', async () => {
85
+ const test = createService([['editor.fontSize', { type: 'number' }]]);
86
+ await new HideAiPreferencesContribution().initSchema(test.service);
87
+ expect(test.updates).to.be.empty;
88
+
89
+ // A schema contributed later, e.g. by a contribution whose own `initSchema` awaited first.
90
+ test.addProperty('ai-features.google.apiKey', { type: 'string' });
91
+
92
+ expect(test.isHidden('ai-features.google.apiKey')).to.equal(true);
93
+ });
94
+
95
+ it('leaves the redirect placeholder visible when later schema changes retrigger the pass', async () => {
96
+ const test = createService([[AI_CONFIGURATION_OPEN_PREFERENCE_ID, { type: 'null' }]]);
97
+ await new HideAiPreferencesContribution().initSchema(test.service);
98
+
99
+ test.addProperty('ai-features.openai.apiKey', { type: 'string' });
100
+
101
+ expect(test.isHidden(AI_CONFIGURATION_OPEN_PREFERENCE_ID)).to.equal(undefined);
102
+ });
103
+
104
+ it('writes each preference once even though every update fires a schema change', async () => {
105
+ const test = createService([
106
+ ['ai-features.a', { type: 'string' }],
107
+ ['ai-features.b', { type: 'string' }],
108
+ ['ai-features.c', { type: 'string' }]
109
+ ]);
110
+
111
+ await new HideAiPreferencesContribution().initSchema(test.service);
112
+
113
+ // Each write re-triggers the listener, so a non-idempotent pass would rewrite keys it already hid.
114
+ expect(test.updates).to.have.lengthOf(3);
115
+ expect([...test.updates].sort()).to.deep.equal(['ai-features.a', 'ai-features.b', 'ai-features.c']);
116
+ });
117
+ });
@@ -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
+ }
@@ -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';
@@ -34,6 +35,8 @@ export * from './open-editors-variable-contribution';
34
35
  export * from './skills-variable-contribution';
35
36
  export * from './skill-service';
36
37
  export * from './skill-prompt-coordinator';
38
+ export * from './agent-plugin-ui-bridge';
39
+ export * from './skill-registry-ui-bridge';
37
40
  export * from './frontend-variable-service';
38
41
  export * from './ai-core-command-contribution';
39
42
  export * from '../common/language-model-service';
@@ -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);
@@ -0,0 +1,114 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 EclipseSource GmbH 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 { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/frontend-application-config-provider';
18
+ import { enableJSDOM } from '@theia/core/lib/browser/test/jsdom';
19
+ // The skill service reaches browser-side modules at import time.
20
+ const disableJSDOM = enableJSDOM();
21
+ try {
22
+ FrontendApplicationConfigProvider.get();
23
+ } catch {
24
+ FrontendApplicationConfigProvider.set({});
25
+ }
26
+
27
+ import { expect } from 'chai';
28
+ import { Emitter } from '@theia/core';
29
+ import { CustomizedPromptFragment, PromptService } from '../common/prompt-service';
30
+ import { Skill } from '../common/skill';
31
+ import { SkillPromptCoordinator } from './skill-prompt-coordinator';
32
+ import { SkillService } from './skill-service';
33
+
34
+ after(() => disableJSDOM());
35
+
36
+ /** Records what the coordinator registers, which is all these tests are about. */
37
+ class FakePromptService {
38
+ readonly added: CustomizedPromptFragment[] = [];
39
+ readonly removed: string[] = [];
40
+ addBuiltInPromptFragment(fragment: CustomizedPromptFragment): void {
41
+ this.added.push(fragment);
42
+ }
43
+ removePromptFragment(id: string): void {
44
+ this.removed.push(id);
45
+ }
46
+ }
47
+
48
+ function skill(qualifiedName: string): Skill {
49
+ return {
50
+ name: qualifiedName.substring(qualifiedName.indexOf(':') + 1),
51
+ qualifiedName,
52
+ description: 'Does a thing.',
53
+ location: `/plugins/x/skills/${qualifiedName}`
54
+ };
55
+ }
56
+
57
+ function coordinator(skills: Skill[]): { instance: SkillPromptCoordinator; prompts: FakePromptService; changed: Emitter<void> } {
58
+ const prompts = new FakePromptService();
59
+ const changed = new Emitter<void>();
60
+ const instance = new SkillPromptCoordinator();
61
+ Object.assign(instance, {
62
+ promptService: prompts as unknown as PromptService,
63
+ skillService: {
64
+ ready: Promise.resolve(),
65
+ getSkills: () => skills,
66
+ onSkillsChanged: changed.event
67
+ } as unknown as SkillService
68
+ });
69
+ return { instance, prompts, changed };
70
+ }
71
+
72
+ describe('SkillPromptCoordinator', () => {
73
+
74
+ it('keeps the colon out of the fragment id, because the id becomes a customization file name', async () => {
75
+ // A colon is a reserved character in a Windows file name: `getTemplateURI` turns the fragment id
76
+ // straight into one, so a customization of this fragment would either fail to write or land in
77
+ // an alternate data stream that the directory scan never reads back.
78
+ const { instance, prompts } = coordinator([skill('io.github.acme_tools:query-builder')]);
79
+
80
+ await instance.onStart();
81
+
82
+ expect(prompts.added).to.have.lengthOf(1);
83
+ expect(prompts.added[0].id).to.equal('skill-command-io.github.acme_tools__query-builder');
84
+ expect(prompts.added[0].id).to.not.contain(':');
85
+ });
86
+
87
+ it('keeps the command name qualified, so the skill is still addressed as <qualifier>:<skill>', async () => {
88
+ const { instance, prompts } = coordinator([skill('io.github.acme_tools:query-builder')]);
89
+
90
+ await instance.onStart();
91
+
92
+ expect(prompts.added[0].commandName).to.equal('io.github.acme_tools:query-builder');
93
+ expect(prompts.added[0].isCommand).to.be.true;
94
+ });
95
+
96
+ it('removes a skill under the same id it registered it with', async () => {
97
+ const skills = [skill('io.github.acme_tools:query-builder')];
98
+ const { instance, prompts, changed } = coordinator(skills);
99
+ await instance.onStart();
100
+
101
+ skills.length = 0;
102
+ changed.fire();
103
+
104
+ expect(prompts.removed).to.deep.equal(['skill-command-io.github.acme_tools__query-builder']);
105
+ });
106
+
107
+ it('leaves the id of an unqualified skill unchanged', async () => {
108
+ const { instance, prompts } = coordinator([skill('deploy')]);
109
+
110
+ await instance.onStart();
111
+
112
+ expect(prompts.added[0].id).to.equal('skill-command-deploy');
113
+ });
114
+ });