@theia/ai-core 1.58.3 → 1.59.0-next.62

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 (111) hide show
  1. package/lib/browser/ai-activation-service.d.ts +4 -4
  2. package/lib/browser/ai-activation-service.d.ts.map +1 -1
  3. package/lib/browser/ai-activation-service.js +10 -10
  4. package/lib/browser/ai-activation-service.js.map +1 -1
  5. package/lib/browser/ai-core-frontend-module.d.ts.map +1 -1
  6. package/lib/browser/ai-core-frontend-module.js +6 -32
  7. package/lib/browser/ai-core-frontend-module.js.map +1 -1
  8. package/lib/browser/ai-core-preferences.d.ts +3 -3
  9. package/lib/browser/ai-core-preferences.d.ts.map +1 -1
  10. package/lib/browser/ai-core-preferences.js +14 -13
  11. package/lib/browser/ai-core-preferences.js.map +1 -1
  12. package/lib/browser/ai-view-contribution.d.ts.map +1 -1
  13. package/lib/browser/ai-view-contribution.js +3 -3
  14. package/lib/browser/ai-view-contribution.js.map +1 -1
  15. package/lib/browser/file-variable-contribution.d.ts +17 -0
  16. package/lib/browser/file-variable-contribution.d.ts.map +1 -0
  17. package/lib/browser/file-variable-contribution.js +96 -0
  18. package/lib/browser/file-variable-contribution.js.map +1 -0
  19. package/lib/browser/frontend-variable-service.d.ts +21 -2
  20. package/lib/browser/frontend-variable-service.d.ts.map +1 -1
  21. package/lib/browser/frontend-variable-service.js +33 -5
  22. package/lib/browser/frontend-variable-service.js.map +1 -1
  23. package/lib/browser/index.d.ts +1 -0
  24. package/lib/browser/index.d.ts.map +1 -1
  25. package/lib/browser/index.js +1 -0
  26. package/lib/browser/index.js.map +1 -1
  27. package/lib/browser/prompttemplate-contribution.d.ts.map +1 -1
  28. package/lib/browser/prompttemplate-contribution.js +1 -1
  29. package/lib/browser/prompttemplate-contribution.js.map +1 -1
  30. package/lib/browser/theia-variable-contribution.d.ts +4 -0
  31. package/lib/browser/theia-variable-contribution.d.ts.map +1 -1
  32. package/lib/browser/theia-variable-contribution.js +15 -1
  33. package/lib/browser/theia-variable-contribution.js.map +1 -1
  34. package/lib/common/agents-variable-contribution.d.ts.map +1 -1
  35. package/lib/common/agents-variable-contribution.js +2 -1
  36. package/lib/common/agents-variable-contribution.js.map +1 -1
  37. package/lib/common/index.d.ts +1 -1
  38. package/lib/common/index.d.ts.map +1 -1
  39. package/lib/common/index.js +1 -1
  40. package/lib/common/index.js.map +1 -1
  41. package/lib/common/language-model-util.d.ts.map +1 -1
  42. package/lib/common/language-model-util.js +1 -18
  43. package/lib/common/language-model-util.js.map +1 -1
  44. package/lib/common/prompt-text.d.ts +7 -0
  45. package/lib/common/prompt-text.d.ts.map +1 -0
  46. package/lib/common/prompt-text.js +26 -0
  47. package/lib/common/prompt-text.js.map +1 -0
  48. package/lib/common/today-variable-contribution.d.ts.map +1 -1
  49. package/lib/common/today-variable-contribution.js +23 -3
  50. package/lib/common/today-variable-contribution.js.map +1 -1
  51. package/lib/common/variable-service.d.ts +64 -1
  52. package/lib/common/variable-service.d.ts.map +1 -1
  53. package/lib/common/variable-service.js +87 -2
  54. package/lib/common/variable-service.js.map +1 -1
  55. package/package.json +10 -10
  56. package/src/browser/ai-activation-service.ts +11 -11
  57. package/src/browser/ai-core-frontend-module.ts +11 -37
  58. package/src/browser/ai-core-preferences.ts +16 -13
  59. package/src/browser/ai-view-contribution.ts +4 -4
  60. package/src/browser/file-variable-contribution.ts +102 -0
  61. package/src/browser/frontend-variable-service.ts +48 -3
  62. package/src/browser/index.ts +1 -0
  63. package/src/browser/prompttemplate-contribution.ts +2 -2
  64. package/src/browser/theia-variable-contribution.ts +14 -1
  65. package/src/common/agents-variable-contribution.ts +2 -2
  66. package/src/common/index.ts +1 -1
  67. package/src/common/language-model-util.ts +1 -18
  68. package/src/common/prompt-text.ts +22 -0
  69. package/src/common/today-variable-contribution.ts +8 -4
  70. package/src/common/variable-service.ts +130 -2
  71. package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +0 -28
  72. package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +0 -1
  73. package/lib/browser/ai-configuration/agent-configuration-widget.js +0 -242
  74. package/lib/browser/ai-configuration/agent-configuration-widget.js.map +0 -1
  75. package/lib/browser/ai-configuration/ai-configuration-service.d.ts +0 -13
  76. package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +0 -1
  77. package/lib/browser/ai-configuration/ai-configuration-service.js +0 -44
  78. package/lib/browser/ai-configuration/ai-configuration-service.js.map +0 -1
  79. package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts +0 -12
  80. package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts.map +0 -1
  81. package/lib/browser/ai-configuration/ai-configuration-view-contribution.js +0 -41
  82. package/lib/browser/ai-configuration/ai-configuration-view-contribution.js.map +0 -1
  83. package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +0 -20
  84. package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +0 -1
  85. package/lib/browser/ai-configuration/ai-configuration-widget.js +0 -88
  86. package/lib/browser/ai-configuration/ai-configuration-widget.js.map +0 -1
  87. package/lib/browser/ai-configuration/language-model-renderer.d.ts +0 -13
  88. package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +0 -1
  89. package/lib/browser/ai-configuration/language-model-renderer.js +0 -104
  90. package/lib/browser/ai-configuration/language-model-renderer.js.map +0 -1
  91. package/lib/browser/ai-configuration/template-settings-renderer.d.ts +0 -13
  92. package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +0 -1
  93. package/lib/browser/ai-configuration/template-settings-renderer.js +0 -71
  94. package/lib/browser/ai-configuration/template-settings-renderer.js.map +0 -1
  95. package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +0 -20
  96. package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +0 -1
  97. package/lib/browser/ai-configuration/variable-configuration-widget.js +0 -99
  98. package/lib/browser/ai-configuration/variable-configuration-widget.js.map +0 -1
  99. package/lib/common/tomorrow-variable-contribution.d.ts +0 -17
  100. package/lib/common/tomorrow-variable-contribution.d.ts.map +0 -1
  101. package/lib/common/tomorrow-variable-contribution.js +0 -48
  102. package/lib/common/tomorrow-variable-contribution.js.map +0 -1
  103. package/src/browser/ai-configuration/agent-configuration-widget.tsx +0 -324
  104. package/src/browser/ai-configuration/ai-configuration-service.ts +0 -43
  105. package/src/browser/ai-configuration/ai-configuration-view-contribution.ts +0 -54
  106. package/src/browser/ai-configuration/ai-configuration-widget.tsx +0 -80
  107. package/src/browser/ai-configuration/language-model-renderer.tsx +0 -113
  108. package/src/browser/ai-configuration/template-settings-renderer.tsx +0 -128
  109. package/src/browser/ai-configuration/variable-configuration-widget.tsx +0 -110
  110. package/src/browser/style/index.css +0 -127
  111. package/src/common/tomorrow-variable-contribution.ts +0 -66
@@ -21,37 +21,112 @@
21
21
 
22
22
  import { ContributionProvider, Disposable, Emitter, ILogger, MaybePromise, Prioritizeable, Event } from '@theia/core';
23
23
  import { inject, injectable, named } from '@theia/core/shared/inversify';
24
+ import * as monaco from '@theia/monaco-editor-core';
24
25
 
26
+ /**
27
+ * A variable is a short string that is used to reference a value that is resolved and replaced in the user prompt at request-time.
28
+ */
25
29
  export interface AIVariable {
26
30
  /** provider id */
27
31
  id: string;
28
- /** variable name */
32
+ /** variable name, used for referencing variables in the chat */
29
33
  name: string;
30
34
  /** variable description */
31
35
  description: string;
36
+ /** optional label, used for showing the variable in the UI. If not provided, the variable name is used */
37
+ label?: string;
38
+ /** optional icon classes, used for showing the variable in the UI. */
39
+ iconClasses?: string[];
40
+ /** specifies whether this variable contributes to the context -- @see ResolvedAIContextVariable */
41
+ isContextVariable?: boolean;
42
+ /** optional arguments for resolving the variable into a value */
32
43
  args?: AIVariableDescription[];
33
44
  }
34
45
 
46
+ export namespace AIVariable {
47
+ export function is(arg: unknown): arg is AIVariable {
48
+ return !!arg && typeof arg === 'object' &&
49
+ 'id' in arg &&
50
+ 'name' in arg &&
51
+ 'description' in arg;
52
+ }
53
+ }
54
+
55
+ export interface AIContextVariable extends AIVariable {
56
+ label: string;
57
+ isContextVariable: true;
58
+ }
59
+
60
+ export namespace AIContextVariable {
61
+ export function is(arg: unknown): arg is AIContextVariable {
62
+ return AIVariable.is(arg) && 'isContextVariable' in arg && arg.isContextVariable === true;
63
+ }
64
+ }
65
+
35
66
  export interface AIVariableDescription {
36
67
  name: string;
37
68
  description: string;
69
+ enum?: string[];
70
+ isOptional?: boolean;
38
71
  }
39
72
 
40
73
  export interface ResolvedAIVariable {
41
74
  variable: AIVariable;
75
+ arg?: string;
76
+ /** value that is inserted into the prompt at the position of the variable usage */
42
77
  value: string;
43
78
  }
44
79
 
80
+ export namespace ResolvedAIVariable {
81
+ export function is(arg: unknown): arg is ResolvedAIVariable {
82
+ return !!arg && typeof arg === 'object' &&
83
+ 'variable' in arg &&
84
+ 'value' in arg &&
85
+ typeof (arg as { variable: unknown }).variable === 'object' &&
86
+ typeof (arg as { value: unknown }).value === 'string';
87
+ }
88
+ }
89
+
90
+ /**
91
+ * A context variable is a variable that also contributes to the context of a chat request.
92
+ *
93
+ * In contrast to a plain variable, it can also be attached to a request and is resolved into a context value.
94
+ * The context value is put into the `ChatRequestModel.context`, available to the processing chat agent for further
95
+ * processing by the chat agent, or invoked tool functions.
96
+ */
97
+ export interface ResolvedAIContextVariable extends ResolvedAIVariable {
98
+ contextValue: string;
99
+ }
100
+
101
+ export namespace ResolvedAIContextVariable {
102
+ export function is(arg: unknown): arg is ResolvedAIContextVariable {
103
+ return ResolvedAIVariable.is(arg) &&
104
+ 'contextValue' in arg &&
105
+ typeof (arg as { contextValue: unknown }).contextValue === 'string';
106
+ }
107
+ }
108
+
45
109
  export interface AIVariableResolutionRequest {
46
110
  variable: AIVariable;
47
111
  arg?: string;
48
112
  }
49
113
 
114
+ export namespace AIVariableResolutionRequest {
115
+ export function is(arg: unknown): arg is AIVariableResolutionRequest {
116
+ return !!arg && typeof arg === 'object' &&
117
+ 'variable' in arg &&
118
+ typeof (arg as { variable: { name: unknown } }).variable.name === 'string';
119
+ }
120
+ }
121
+
50
122
  export interface AIVariableContext {
51
123
  }
52
124
 
53
125
  export type AIVariableArg = string | { variable: string, arg?: string } | AIVariableResolutionRequest;
54
126
 
127
+ export type AIVariableArgPicker = (context: AIVariableContext) => MaybePromise<string | undefined>;
128
+ export type AIVariableArgCompletionProvider = (model: monaco.editor.ITextModel, position: monaco.Position) => MaybePromise<monaco.languages.CompletionItem[] | undefined>;
129
+
55
130
  export interface AIVariableResolver {
56
131
  canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise<number>,
57
132
  resolve(request: AIVariableResolutionRequest, context: AIVariableContext): Promise<ResolvedAIVariable | undefined>;
@@ -62,6 +137,7 @@ export interface AIVariableService {
62
137
  hasVariable(name: string): boolean;
63
138
  getVariable(name: string): Readonly<AIVariable> | undefined;
64
139
  getVariables(): Readonly<AIVariable>[];
140
+ getContextVariables(): Readonly<AIContextVariable>[];
65
141
  unregisterVariable(name: string): void;
66
142
  readonly onDidChangeVariables: Event<void>;
67
143
 
@@ -69,9 +145,18 @@ export interface AIVariableService {
69
145
  unregisterResolver(variable: AIVariable, resolver: AIVariableResolver): void;
70
146
  getResolver(name: string, arg: string | undefined, context: AIVariableContext): Promise<AIVariableResolver | undefined>;
71
147
 
148
+ registerArgumentPicker(variable: AIVariable, argPicker: AIVariableArgPicker): Disposable;
149
+ unregisterArgumentPicker(variable: AIVariable, argPicker: AIVariableArgPicker): void;
150
+ getArgumentPicker(name: string, context: AIVariableContext): Promise<AIVariableArgPicker | undefined>;
151
+
152
+ registerArgumentCompletionProvider(variable: AIVariable, argPicker: AIVariableArgCompletionProvider): Disposable;
153
+ unregisterArgumentCompletionProvider(variable: AIVariable, argPicker: AIVariableArgCompletionProvider): void;
154
+ getArgumentCompletionProvider(name: string): Promise<AIVariableArgCompletionProvider | undefined>;
155
+
72
156
  resolveVariable(variable: AIVariableArg, context: AIVariableContext): Promise<ResolvedAIVariable | undefined>;
73
157
  }
74
158
 
159
+ /** Contributions on the frontend can optionally implement `FrontendVariableContribution`. */
75
160
  export const AIVariableContribution = Symbol('AIVariableContribution');
76
161
  export interface AIVariableContribution {
77
162
  registerVariables(service: AIVariableService): void;
@@ -81,6 +166,8 @@ export interface AIVariableContribution {
81
166
  export class DefaultAIVariableService implements AIVariableService {
82
167
  protected variables = new Map<string, AIVariable>();
83
168
  protected resolvers = new Map<string, AIVariableResolver[]>();
169
+ protected argPickers = new Map<string, AIVariableArgPicker>();
170
+ protected argCompletionProviders = new Map<string, AIVariableArgCompletionProvider>();
84
171
 
85
172
  protected readonly onDidChangeVariablesEmitter = new Emitter<void>();
86
173
  readonly onDidChangeVariables: Event<void> = this.onDidChangeVariablesEmitter.event;
@@ -137,6 +224,10 @@ export class DefaultAIVariableService implements AIVariableService {
137
224
  return [...this.variables.values()];
138
225
  }
139
226
 
227
+ getContextVariables(): Readonly<AIContextVariable>[] {
228
+ return this.getVariables().filter(AIContextVariable.is);
229
+ }
230
+
140
231
  registerResolver(variable: AIVariable, resolver: AIVariableResolver): Disposable {
141
232
  const key = this.getKey(variable.name);
142
233
  if (!this.variables.get(key)) {
@@ -164,6 +255,42 @@ export class DefaultAIVariableService implements AIVariableService {
164
255
  this.onDidChangeVariablesEmitter.fire();
165
256
  }
166
257
 
258
+ registerArgumentPicker(variable: AIVariable, argPicker: AIVariableArgPicker): Disposable {
259
+ const key = this.getKey(variable.name);
260
+ this.argPickers.set(key, argPicker);
261
+ return Disposable.create(() => this.unregisterArgumentPicker(variable, argPicker));
262
+ }
263
+
264
+ unregisterArgumentPicker(variable: AIVariable, argPicker: AIVariableArgPicker): void {
265
+ const key = this.getKey(variable.name);
266
+ const registeredArgPicker = this.argPickers.get(key);
267
+ if (registeredArgPicker === argPicker) {
268
+ this.argPickers.delete(key);
269
+ }
270
+ }
271
+
272
+ async getArgumentPicker(name: string): Promise<AIVariableArgPicker | undefined> {
273
+ return this.argPickers.get(this.getKey(name)) ?? undefined;
274
+ }
275
+
276
+ registerArgumentCompletionProvider(variable: AIVariable, completionProvider: AIVariableArgCompletionProvider): Disposable {
277
+ const key = this.getKey(variable.name);
278
+ this.argCompletionProviders.set(key, completionProvider);
279
+ return Disposable.create(() => this.unregisterArgumentCompletionProvider(variable, completionProvider));
280
+ }
281
+
282
+ unregisterArgumentCompletionProvider(variable: AIVariable, completionProvider: AIVariableArgCompletionProvider): void {
283
+ const key = this.getKey(variable.name);
284
+ const registeredCompletionProvider = this.argCompletionProviders.get(key);
285
+ if (registeredCompletionProvider === completionProvider) {
286
+ this.argCompletionProviders.delete(key);
287
+ }
288
+ }
289
+
290
+ async getArgumentCompletionProvider(name: string): Promise<AIVariableArgCompletionProvider | undefined> {
291
+ return this.argCompletionProviders.get(this.getKey(name)) ?? undefined;
292
+ }
293
+
167
294
  async resolveVariable(request: AIVariableArg, context: AIVariableContext): Promise<ResolvedAIVariable | undefined> {
168
295
  const variableName = typeof request === 'string' ? request : typeof request.variable === 'string' ? request.variable : request.variable.name;
169
296
  const variable = this.getVariable(variableName);
@@ -172,6 +299,7 @@ export class DefaultAIVariableService implements AIVariableService {
172
299
  }
173
300
  const arg = typeof request === 'string' ? undefined : request.arg;
174
301
  const resolver = await this.getResolver(variableName, arg, context);
175
- return resolver?.resolve({ variable, arg }, context);
302
+ const resolved = await resolver?.resolve({ variable, arg }, context);
303
+ return resolved ? { ...resolved, arg } : undefined;
176
304
  }
177
305
  }
@@ -1,28 +0,0 @@
1
- /// <reference types="react" />
2
- import { ReactWidget } from '@theia/core/lib/browser';
3
- import * as React from '@theia/core/shared/react';
4
- import { Agent, AISettingsService, AIVariableService, LanguageModel, LanguageModelRegistry, PromptCustomizationService, PromptService } from '../../common';
5
- import { AIConfigurationSelectionService } from './ai-configuration-service';
6
- import { AgentService } from '../../common/agent-service';
7
- export declare class AIAgentConfigurationWidget extends ReactWidget {
8
- static readonly ID = "ai-agent-configuration-container-widget";
9
- static readonly LABEL = "Agents";
10
- protected readonly agentService: AgentService;
11
- protected readonly languageModelRegistry: LanguageModelRegistry;
12
- protected readonly promptCustomizationService: PromptCustomizationService;
13
- protected readonly aiSettingsService: AISettingsService;
14
- protected readonly aiConfigurationSelectionService: AIConfigurationSelectionService;
15
- protected readonly variableService: AIVariableService;
16
- protected promptService: PromptService;
17
- protected languageModels: LanguageModel[] | undefined;
18
- protected init(): void;
19
- protected render(): React.ReactNode;
20
- private renderAgentName;
21
- private renderAgentDetails;
22
- private parsePromptTemplatesForVariableAndFunction;
23
- protected showVariableConfigurationTab(): void;
24
- protected addCustomAgent(): void;
25
- protected setActiveAgent(agent: Agent): void;
26
- private toggleAgentEnabled;
27
- }
28
- //# sourceMappingURL=agent-configuration-widget.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-configuration-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/agent-configuration-widget.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAW,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EACH,KAAK,EACL,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EAGrB,0BAA0B,EAC1B,aAAa,EAChB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAQ1D,qBACa,0BAA2B,SAAQ,WAAW;IAEvD,MAAM,CAAC,QAAQ,CAAC,EAAE,6CAA6C;IAC/D,MAAM,CAAC,QAAQ,CAAC,KAAK,YAAY;IAGjC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAG9C,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAGhE,SAAS,CAAC,QAAQ,CAAC,0BAA0B,EAAE,0BAA0B,CAAC;IAG1E,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,+BAA+B,EAAE,+BAA+B,CAAC;IAGpF,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC;IAGtD,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAEvC,SAAS,CAAC,cAAc,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAGtD,SAAS,CAAC,IAAI,IAAI,IAAI;IAqBtB,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS;IAoBnC,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,kBAAkB;IA6E1B,OAAO,CAAC,0CAA0C;IA6BlD,SAAS,CAAC,4BAA4B,IAAI,IAAI;IAI9C,SAAS,CAAC,cAAc,IAAI,IAAI;IAIhC,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK5C,OAAO,CAAC,kBAAkB,CAYxB;CAEL"}
@@ -1,242 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2024 EclipseSource GmbH.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var AIAgentConfigurationWidget_1;
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.AIAgentConfigurationWidget = void 0;
20
- const tslib_1 = require("tslib");
21
- const browser_1 = require("@theia/core/lib/browser");
22
- const inversify_1 = require("@theia/core/shared/inversify");
23
- const React = require("@theia/core/shared/react");
24
- const common_1 = require("../../common");
25
- const language_model_renderer_1 = require("./language-model-renderer");
26
- const template_settings_renderer_1 = require("./template-settings-renderer");
27
- const ai_configuration_service_1 = require("./ai-configuration-service");
28
- const variable_configuration_widget_1 = require("./variable-configuration-widget");
29
- const agent_service_1 = require("../../common/agent-service");
30
- ;
31
- let AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = class AIAgentConfigurationWidget extends browser_1.ReactWidget {
32
- constructor() {
33
- super(...arguments);
34
- this.toggleAgentEnabled = () => {
35
- const agent = this.aiConfigurationSelectionService.getActiveAgent();
36
- if (!agent) {
37
- return false;
38
- }
39
- const enabled = this.agentService.isEnabled(agent.id);
40
- if (enabled) {
41
- this.agentService.disableAgent(agent.id);
42
- }
43
- else {
44
- this.agentService.enableAgent(agent.id);
45
- }
46
- this.update();
47
- };
48
- }
49
- init() {
50
- this.id = AIAgentConfigurationWidget_1.ID;
51
- this.title.label = AIAgentConfigurationWidget_1.LABEL;
52
- this.title.closable = false;
53
- this.languageModelRegistry.getLanguageModels().then(models => {
54
- this.languageModels = models !== null && models !== void 0 ? models : [];
55
- this.update();
56
- });
57
- this.toDispose.push(this.languageModelRegistry.onChange(({ models }) => {
58
- this.languageModels = models;
59
- this.update();
60
- }));
61
- this.toDispose.push(this.promptCustomizationService.onDidChangePrompt(() => this.update()));
62
- this.aiSettingsService.onDidChange(() => this.update());
63
- this.aiConfigurationSelectionService.onDidAgentChange(() => this.update());
64
- this.agentService.onDidChangeAgents(() => this.update());
65
- this.update();
66
- }
67
- render() {
68
- return React.createElement("div", { className: 'ai-agent-configuration-main' },
69
- React.createElement("div", { className: 'configuration-agents-list preferences-tree-widget theia-TreeContainer', style: { width: '25%' } },
70
- React.createElement("ul", null, this.agentService.getAllAgents().map(agent => React.createElement("li", { key: agent.id, className: 'theia-TreeNode theia-CompositeTreeNode theia-ExpandableTreeNode', onClick: () => this.setActiveAgent(agent) }, this.renderAgentName(agent)))),
71
- React.createElement("div", { className: 'configuration-agents-add' },
72
- React.createElement("button", { style: { marginLeft: 0 }, className: 'theia-button main', onClick: () => this.addCustomAgent() }, "Add Custom Agent"))),
73
- React.createElement("div", { className: 'configuration-agent-panel preferences-editor-widget' }, this.renderAgentDetails()));
74
- }
75
- renderAgentName(agent) {
76
- var _a;
77
- const tagsSuffix = ((_a = agent.tags) === null || _a === void 0 ? void 0 : _a.length) ? React.createElement("span", null, agent.tags.map(tag => React.createElement("span", { key: tag, className: 'agent-tag' }, tag))) : '';
78
- return React.createElement("span", null,
79
- agent.name,
80
- " ",
81
- tagsSuffix);
82
- }
83
- renderAgentDetails() {
84
- const agent = this.aiConfigurationSelectionService.getActiveAgent();
85
- if (!agent) {
86
- return React.createElement("div", null, "Please select an Agent first!");
87
- }
88
- const enabled = this.agentService.isEnabled(agent.id);
89
- const parsedPromptParts = this.parsePromptTemplatesForVariableAndFunction(agent);
90
- const globalVariables = Array.from(new Set([...parsedPromptParts.globalVariables, ...agent.variables]));
91
- const functions = Array.from(new Set([...parsedPromptParts.functions, ...agent.functions]));
92
- return React.createElement("div", { key: agent.id, style: { display: 'flex', flexDirection: 'column', alignItems: 'flex-start' } },
93
- React.createElement("div", { className: 'settings-section-title settings-section-category-title', style: { paddingLeft: 0, paddingBottom: 10 } }, this.renderAgentName(agent)),
94
- React.createElement("div", { style: { paddingBottom: 10 } }, agent.description),
95
- React.createElement("div", { style: { paddingBottom: 10 } },
96
- React.createElement("label", null,
97
- React.createElement("input", { type: "checkbox", checked: enabled, onChange: this.toggleAgentEnabled }),
98
- "Enable Agent")),
99
- React.createElement("div", { className: "settings-section-subcategory-title ai-settings-section-subcategory-title" }, "Prompt Templates"),
100
- React.createElement("div", { className: "ai-templates" }, (() => {
101
- var _a;
102
- const defaultTemplates = ((_a = agent.promptTemplates) === null || _a === void 0 ? void 0 : _a.filter(template => !template.variantOf)) || [];
103
- return defaultTemplates.length > 0 ? (defaultTemplates.map(template => (React.createElement("div", { key: agent.id + '.' + template.id },
104
- React.createElement(template_settings_renderer_1.TemplateRenderer, { key: agent.id + '.' + template.id, agentId: agent.id, template: template, promptService: this.promptService, aiSettingsService: this.aiSettingsService, promptCustomizationService: this.promptCustomizationService }))))) : (React.createElement("div", null, "No default template available"));
105
- })()),
106
- React.createElement("div", { className: 'ai-lm-requirements' },
107
- React.createElement(language_model_renderer_1.LanguageModelRenderer, { agent: agent, languageModels: this.languageModels, aiSettingsService: this.aiSettingsService, languageModelRegistry: this.languageModelRegistry })),
108
- React.createElement("div", null,
109
- React.createElement("span", null, "Used Global Variables:"),
110
- React.createElement("ul", { className: 'variable-references' },
111
- React.createElement(AgentGlobalVariables, { variables: globalVariables, showVariableConfigurationTab: this.showVariableConfigurationTab.bind(this) }))),
112
- React.createElement("div", null,
113
- React.createElement("span", null, "Used agent-specific Variables:"),
114
- React.createElement("ul", { className: 'variable-references' },
115
- React.createElement(AgentSpecificVariables, { promptVariables: parsedPromptParts.agentSpecificVariables, agent: agent }))),
116
- React.createElement("div", null,
117
- React.createElement("span", null, "Used Functions:"),
118
- React.createElement("ul", { className: 'function-references' },
119
- React.createElement(AgentFunctions, { functions: functions }))));
120
- }
121
- parsePromptTemplatesForVariableAndFunction(agent) {
122
- const promptTemplates = agent.promptTemplates;
123
- const result = { functions: [], globalVariables: [], agentSpecificVariables: [] };
124
- promptTemplates.forEach(template => {
125
- var _a;
126
- const storedPrompt = this.promptService.getUnresolvedPrompt(template.id);
127
- const prompt = (_a = storedPrompt === null || storedPrompt === void 0 ? void 0 : storedPrompt.template) !== null && _a !== void 0 ? _a : template.template;
128
- const variableMatches = (0, common_1.matchVariablesRegEx)(prompt);
129
- variableMatches.forEach(match => {
130
- const variableId = match[1];
131
- // if the variable is part of the variable service and not part of the agent specific variables then it is a global variable
132
- if (this.variableService.hasVariable(variableId) &&
133
- agent.agentSpecificVariables.find(v => v.name === variableId) === undefined) {
134
- result.globalVariables.push(variableId);
135
- }
136
- else {
137
- result.agentSpecificVariables.push(variableId);
138
- }
139
- });
140
- const functionMatches = [...prompt.matchAll(common_1.PROMPT_FUNCTION_REGEX)];
141
- functionMatches.forEach(match => {
142
- const functionId = match[1];
143
- result.functions.push(functionId);
144
- });
145
- });
146
- return result;
147
- }
148
- showVariableConfigurationTab() {
149
- this.aiConfigurationSelectionService.selectConfigurationTab(variable_configuration_widget_1.AIVariableConfigurationWidget.ID);
150
- }
151
- addCustomAgent() {
152
- this.promptCustomizationService.openCustomAgentYaml();
153
- }
154
- setActiveAgent(agent) {
155
- this.aiConfigurationSelectionService.setActiveAgent(agent);
156
- this.update();
157
- }
158
- };
159
- exports.AIAgentConfigurationWidget = AIAgentConfigurationWidget;
160
- AIAgentConfigurationWidget.ID = 'ai-agent-configuration-container-widget';
161
- AIAgentConfigurationWidget.LABEL = 'Agents';
162
- tslib_1.__decorate([
163
- (0, inversify_1.inject)(agent_service_1.AgentService),
164
- tslib_1.__metadata("design:type", Object)
165
- ], AIAgentConfigurationWidget.prototype, "agentService", void 0);
166
- tslib_1.__decorate([
167
- (0, inversify_1.inject)(common_1.LanguageModelRegistry),
168
- tslib_1.__metadata("design:type", Object)
169
- ], AIAgentConfigurationWidget.prototype, "languageModelRegistry", void 0);
170
- tslib_1.__decorate([
171
- (0, inversify_1.inject)(common_1.PromptCustomizationService),
172
- tslib_1.__metadata("design:type", Object)
173
- ], AIAgentConfigurationWidget.prototype, "promptCustomizationService", void 0);
174
- tslib_1.__decorate([
175
- (0, inversify_1.inject)(common_1.AISettingsService),
176
- tslib_1.__metadata("design:type", Object)
177
- ], AIAgentConfigurationWidget.prototype, "aiSettingsService", void 0);
178
- tslib_1.__decorate([
179
- (0, inversify_1.inject)(ai_configuration_service_1.AIConfigurationSelectionService),
180
- tslib_1.__metadata("design:type", ai_configuration_service_1.AIConfigurationSelectionService)
181
- ], AIAgentConfigurationWidget.prototype, "aiConfigurationSelectionService", void 0);
182
- tslib_1.__decorate([
183
- (0, inversify_1.inject)(common_1.AIVariableService),
184
- tslib_1.__metadata("design:type", Object)
185
- ], AIAgentConfigurationWidget.prototype, "variableService", void 0);
186
- tslib_1.__decorate([
187
- (0, inversify_1.inject)(common_1.PromptService),
188
- tslib_1.__metadata("design:type", Object)
189
- ], AIAgentConfigurationWidget.prototype, "promptService", void 0);
190
- tslib_1.__decorate([
191
- (0, inversify_1.postConstruct)(),
192
- tslib_1.__metadata("design:type", Function),
193
- tslib_1.__metadata("design:paramtypes", []),
194
- tslib_1.__metadata("design:returntype", void 0)
195
- ], AIAgentConfigurationWidget.prototype, "init", null);
196
- exports.AIAgentConfigurationWidget = AIAgentConfigurationWidget = AIAgentConfigurationWidget_1 = tslib_1.__decorate([
197
- (0, inversify_1.injectable)()
198
- ], AIAgentConfigurationWidget);
199
- const AgentGlobalVariables = ({ variables: globalVariables, showVariableConfigurationTab }) => {
200
- if (globalVariables.length === 0) {
201
- return React.createElement(React.Fragment, null, "None");
202
- }
203
- return React.createElement(React.Fragment, null, globalVariables.map(variableId => React.createElement("li", { key: variableId, className: 'theia-TreeNode theia-CompositeTreeNode theia-ExpandableTreeNode theia-mod-selected' },
204
- React.createElement("div", { key: variableId, onClick: () => { showVariableConfigurationTab(); }, className: 'variable-reference' },
205
- React.createElement("span", null, variableId),
206
- React.createElement("i", { className: (0, browser_1.codicon)('chevron-right') })))));
207
- };
208
- const AgentFunctions = ({ functions }) => {
209
- if (functions.length === 0) {
210
- return React.createElement(React.Fragment, null, "None");
211
- }
212
- return React.createElement(React.Fragment, null, functions.map(functionId => React.createElement("li", { key: functionId, className: 'variable-reference' },
213
- React.createElement("span", null, functionId))));
214
- };
215
- const AgentSpecificVariables = ({ promptVariables, agent }) => {
216
- const agentDefinedVariablesName = agent.agentSpecificVariables.map(v => v.name);
217
- const variables = Array.from(new Set([...promptVariables, ...agentDefinedVariablesName]));
218
- if (variables.length === 0) {
219
- return React.createElement(React.Fragment, null, "None");
220
- }
221
- return React.createElement(React.Fragment, null, variables.map(variableId => React.createElement(AgentSpecifcVariable, { key: variableId, variableId: variableId, agent: agent, promptVariables: promptVariables })));
222
- };
223
- const AgentSpecifcVariable = ({ variableId, agent, promptVariables }) => {
224
- const agentDefinedVariable = agent.agentSpecificVariables.find(v => v.name === variableId);
225
- const undeclared = agentDefinedVariable === undefined;
226
- const notUsed = !promptVariables.includes(variableId) && (agentDefinedVariable === null || agentDefinedVariable === void 0 ? void 0 : agentDefinedVariable.usedInPrompt) === true;
227
- return React.createElement("li", { key: variableId },
228
- React.createElement("div", null,
229
- React.createElement("span", null, "Name:"),
230
- " ",
231
- React.createElement("span", null, variableId)),
232
- undeclared ? React.createElement("div", null,
233
- React.createElement("span", null, "Undeclared")) :
234
- (React.createElement(React.Fragment, null,
235
- React.createElement("div", null,
236
- React.createElement("span", null, "Description:"),
237
- " ",
238
- React.createElement("span", null, agentDefinedVariable.description)),
239
- notUsed && React.createElement("div", null, "Not used in prompt"))),
240
- React.createElement("hr", null));
241
- };
242
- //# sourceMappingURL=agent-configuration-widget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-configuration-widget.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/agent-configuration-widget.tsx"],"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,qDAA+D;AAC/D,4DAAiF;AACjF,kDAAkD;AAClD,yCAUsB;AACtB,uEAAkE;AAClE,6EAAgE;AAChE,yEAA6E;AAC7E,mFAAgF;AAChF,8DAA0D;AAMzD,CAAC;AAGK,IAAM,0BAA0B,kCAAhC,MAAM,0BAA2B,SAAQ,qBAAW;IAApD;;QAkMK,uBAAkB,GAAG,GAAG,EAAE;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,+BAA+B,CAAC,cAAc,EAAE,CAAC;YACpE,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,OAAO,KAAK,CAAC;YACjB,CAAC;YACD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@@ -1,13 +0,0 @@
1
- import { Emitter } from '@theia/core';
2
- import { Agent } from '../../common';
3
- export declare class AIConfigurationSelectionService {
4
- protected activeAgent?: Agent;
5
- protected readonly onDidSelectConfigurationEmitter: Emitter<string>;
6
- onDidSelectConfiguration: import("@theia/core").Event<string>;
7
- protected readonly onDidAgentChangeEmitter: Emitter<Agent | undefined>;
8
- onDidAgentChange: import("@theia/core").Event<string>;
9
- getActiveAgent(): Agent | undefined;
10
- setActiveAgent(agent?: Agent): void;
11
- selectConfigurationTab(widgetId: string): void;
12
- }
13
- //# sourceMappingURL=ai-configuration-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-configuration-service.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,qBACa,+BAA+B;IACxC,SAAS,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAE9B,SAAS,CAAC,QAAQ,CAAC,+BAA+B,kBAAyB;IAC3E,wBAAwB,sCAA8C;IAEtE,SAAS,CAAC,QAAQ,CAAC,uBAAuB,6BAAoC;IAC9E,gBAAgB,sCAA8C;IAEvD,cAAc,IAAI,KAAK,GAAG,SAAS;IAInC,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI;IAKnC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAGxD"}
@@ -1,44 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2024 EclipseSource GmbH.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.AIConfigurationSelectionService = void 0;
19
- const tslib_1 = require("tslib");
20
- const core_1 = require("@theia/core");
21
- const inversify_1 = require("@theia/core/shared/inversify");
22
- let AIConfigurationSelectionService = class AIConfigurationSelectionService {
23
- constructor() {
24
- this.onDidSelectConfigurationEmitter = new core_1.Emitter();
25
- this.onDidSelectConfiguration = this.onDidSelectConfigurationEmitter.event;
26
- this.onDidAgentChangeEmitter = new core_1.Emitter();
27
- this.onDidAgentChange = this.onDidSelectConfigurationEmitter.event;
28
- }
29
- getActiveAgent() {
30
- return this.activeAgent;
31
- }
32
- setActiveAgent(agent) {
33
- this.activeAgent = agent;
34
- this.onDidAgentChangeEmitter.fire(agent);
35
- }
36
- selectConfigurationTab(widgetId) {
37
- this.onDidSelectConfigurationEmitter.fire(widgetId);
38
- }
39
- };
40
- exports.AIConfigurationSelectionService = AIConfigurationSelectionService;
41
- exports.AIConfigurationSelectionService = AIConfigurationSelectionService = tslib_1.__decorate([
42
- (0, inversify_1.injectable)()
43
- ], AIConfigurationSelectionService);
44
- //# sourceMappingURL=ai-configuration-service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-configuration-service.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-service.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,sCAAsC;AACtC,4DAA0D;AAInD,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAArC;QAGgB,oCAA+B,GAAG,IAAI,cAAO,EAAU,CAAC;QAC3E,6BAAwB,GAAG,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC;QAEnD,4BAAuB,GAAG,IAAI,cAAO,EAAqB,CAAC;QAC9E,qBAAgB,GAAG,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC;IAclE,CAAC;IAZU,cAAc;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAEM,cAAc,CAAC,KAAa;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;IAEM,sBAAsB,CAAC,QAAgB;QAC1C,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;CACJ,CAAA;AArBY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,sBAAU,GAAE;GACA,+BAA+B,CAqB3C"}
@@ -1,12 +0,0 @@
1
- import { FrontendApplication } from '@theia/core/lib/browser';
2
- import { AIViewContribution } from '../ai-view-contribution';
3
- import { AIConfigurationContainerWidget } from './ai-configuration-widget';
4
- import { Command, CommandRegistry } from '@theia/core';
5
- export declare const AI_CONFIGURATION_TOGGLE_COMMAND_ID = "aiConfiguration:toggle";
6
- export declare const OPEN_AI_CONFIG_VIEW: Command;
7
- export declare class AIAgentConfigurationViewContribution extends AIViewContribution<AIConfigurationContainerWidget> {
8
- constructor();
9
- initializeLayout(_app: FrontendApplication): Promise<void>;
10
- registerCommands(commands: CommandRegistry): void;
11
- }
12
- //# sourceMappingURL=ai-configuration-view-contribution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-configuration-view-contribution.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-view-contribution.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,kCAAkC,2BAA2B,CAAC;AAC3E,eAAO,MAAM,mBAAmB,SAG9B,CAAC;AAEH,qBACa,oCAAqC,SAAQ,kBAAkB,CAAC,8BAA8B,CAAC;;IAclG,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;CAM7D"}
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AIAgentConfigurationViewContribution = exports.OPEN_AI_CONFIG_VIEW = exports.AI_CONFIGURATION_TOGGLE_COMMAND_ID = void 0;
4
- const tslib_1 = require("tslib");
5
- const inversify_1 = require("@theia/core/shared/inversify");
6
- const ai_view_contribution_1 = require("../ai-view-contribution");
7
- const ai_configuration_widget_1 = require("./ai-configuration-widget");
8
- const core_1 = require("@theia/core");
9
- exports.AI_CONFIGURATION_TOGGLE_COMMAND_ID = 'aiConfiguration:toggle';
10
- exports.OPEN_AI_CONFIG_VIEW = core_1.Command.toLocalizedCommand({
11
- id: 'aiConfiguration:open',
12
- label: 'Open AI Configuration view',
13
- });
14
- let AIAgentConfigurationViewContribution = class AIAgentConfigurationViewContribution extends ai_view_contribution_1.AIViewContribution {
15
- constructor() {
16
- super({
17
- widgetId: ai_configuration_widget_1.AIConfigurationContainerWidget.ID,
18
- widgetName: ai_configuration_widget_1.AIConfigurationContainerWidget.LABEL,
19
- defaultWidgetOptions: {
20
- area: 'main',
21
- rank: 100
22
- },
23
- toggleCommandId: exports.AI_CONFIGURATION_TOGGLE_COMMAND_ID
24
- });
25
- }
26
- async initializeLayout(_app) {
27
- await this.openView();
28
- }
29
- registerCommands(commands) {
30
- super.registerCommands(commands);
31
- commands.registerCommand(exports.OPEN_AI_CONFIG_VIEW, {
32
- execute: () => this.openView({ activate: true }),
33
- });
34
- }
35
- };
36
- exports.AIAgentConfigurationViewContribution = AIAgentConfigurationViewContribution;
37
- exports.AIAgentConfigurationViewContribution = AIAgentConfigurationViewContribution = tslib_1.__decorate([
38
- (0, inversify_1.injectable)(),
39
- tslib_1.__metadata("design:paramtypes", [])
40
- ], AIAgentConfigurationViewContribution);
41
- //# sourceMappingURL=ai-configuration-view-contribution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-configuration-view-contribution.js","sourceRoot":"","sources":["../../../src/browser/ai-configuration/ai-configuration-view-contribution.ts"],"names":[],"mappings":";;;;AAgBA,4DAA0D;AAC1D,kEAA6D;AAC7D,uEAA2E;AAC3E,sCAAuD;AAE1C,QAAA,kCAAkC,GAAG,wBAAwB,CAAC;AAC9D,QAAA,mBAAmB,GAAG,cAAO,CAAC,kBAAkB,CAAC;IAC1D,EAAE,EAAE,sBAAsB;IAC1B,KAAK,EAAE,4BAA4B;CACtC,CAAC,CAAC;AAGI,IAAM,oCAAoC,GAA1C,MAAM,oCAAqC,SAAQ,yCAAkD;IAExG;QACI,KAAK,CAAC;YACF,QAAQ,EAAE,wDAA8B,CAAC,EAAE;YAC3C,UAAU,EAAE,wDAA8B,CAAC,KAAK;YAChD,oBAAoB,EAAE;gBAClB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,GAAG;aACZ;YACD,eAAe,EAAE,0CAAkC;SACtD,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,IAAyB;QAC5C,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAEQ,gBAAgB,CAAC,QAAyB;QAC/C,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACjC,QAAQ,CAAC,eAAe,CAAC,2BAAmB,EAAE;YAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SACnD,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAxBY,oFAAoC;+CAApC,oCAAoC;IADhD,IAAA,sBAAU,GAAE;;GACA,oCAAoC,CAwBhD"}