@theia/ai-google 1.67.0-next.13 → 1.67.0-next.56

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 (39) hide show
  1. package/README.md +1 -0
  2. package/package.json +4 -4
  3. package/src/common/google-preferences.ts +1 -1
  4. package/lib/browser/google-frontend-application-contribution.d.ts +0 -16
  5. package/lib/browser/google-frontend-application-contribution.d.ts.map +0 -1
  6. package/lib/browser/google-frontend-application-contribution.js +0 -99
  7. package/lib/browser/google-frontend-application-contribution.js.map +0 -1
  8. package/lib/browser/google-frontend-module.d.ts +0 -4
  9. package/lib/browser/google-frontend-module.d.ts.map +0 -1
  10. package/lib/browser/google-frontend-module.js +0 -33
  11. package/lib/browser/google-frontend-module.js.map +0 -1
  12. package/lib/common/google-language-models-manager.d.ts +0 -34
  13. package/lib/common/google-language-models-manager.d.ts.map +0 -1
  14. package/lib/common/google-language-models-manager.js +0 -21
  15. package/lib/common/google-language-models-manager.js.map +0 -1
  16. package/lib/common/google-preferences.d.ts +0 -8
  17. package/lib/common/google-preferences.d.ts.map +0 -1
  18. package/lib/common/google-preferences.js +0 -68
  19. package/lib/common/google-preferences.js.map +0 -1
  20. package/lib/common/index.d.ts +0 -2
  21. package/lib/common/index.d.ts.map +0 -1
  22. package/lib/common/index.js +0 -20
  23. package/lib/common/index.js.map +0 -1
  24. package/lib/node/google-backend-module.d.ts +0 -4
  25. package/lib/node/google-backend-module.d.ts.map +0 -1
  26. package/lib/node/google-backend-module.js +0 -34
  27. package/lib/node/google-backend-module.js.map +0 -1
  28. package/lib/node/google-language-model.d.ts +0 -33
  29. package/lib/node/google-language-model.d.ts.map +0 -1
  30. package/lib/node/google-language-model.js +0 -412
  31. package/lib/node/google-language-model.js.map +0 -1
  32. package/lib/node/google-language-models-manager-impl.d.ts +0 -22
  33. package/lib/node/google-language-models-manager-impl.d.ts.map +0 -1
  34. package/lib/node/google-language-models-manager-impl.js +0 -108
  35. package/lib/node/google-language-models-manager-impl.js.map +0 -1
  36. package/lib/package.spec.d.ts +0 -1
  37. package/lib/package.spec.d.ts.map +0 -1
  38. package/lib/package.spec.js +0 -26
  39. package/lib/package.spec.js.map +0 -1
package/README.md CHANGED
@@ -18,6 +18,7 @@ Alternatively the API key can also be handed in via the `GOOGLE_API_KEY` environ
18
18
 
19
19
  ## Additional Information
20
20
 
21
+ - [API documentation for `@theia/ai-google`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-google.html)
21
22
  - [Theia - GitHub](https://github.com/eclipse-theia/theia)
22
23
  - [Theia - Website](https://theia-ide.org/)
23
24
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@theia/ai-google",
3
- "version": "1.67.0-next.13+c409d5d18",
3
+ "version": "1.67.0-next.56+d8f18cc386c",
4
4
  "description": "Theia - Google AI Integration",
5
5
  "dependencies": {
6
6
  "@google/genai": "^1.16.0",
7
- "@theia/ai-core": "1.67.0-next.13+c409d5d18",
8
- "@theia/core": "1.67.0-next.13+c409d5d18"
7
+ "@theia/ai-core": "1.67.0-next.56+d8f18cc386c",
8
+ "@theia/core": "1.67.0-next.56+d8f18cc386c"
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public"
@@ -49,5 +49,5 @@
49
49
  "nyc": {
50
50
  "extends": "../../configs/nyc.json"
51
51
  },
52
- "gitHead": "c409d5d18d8c4f5a722f87b37ea9d6fd5af47ea8"
52
+ "gitHead": "d8f18cc386c45a736cd193d42eab02c8f64c6b10"
53
53
  }
@@ -36,7 +36,7 @@ export const GooglePreferencesSchema: PreferenceSchema = {
36
36
  type: 'array',
37
37
  description: nls.localize('theia/ai/google/models/description', 'Official Google Gemini models to use'),
38
38
  title: AI_CORE_PREFERENCES_TITLE,
39
- default: ['gemini-1.5-flash', 'gemini-1.5-pro', 'gemini-2.0-flash', 'gemini-2.0-flash-lite', 'gemini-2.5-flash-preview-05-20', 'gemini-2.5-pro-preview-05-06'],
39
+ default: ['gemini-3-pro-preview', 'gemini-2.5-pro', 'gemini-2.5-flash'],
40
40
  items: {
41
41
  type: 'string'
42
42
  }
@@ -1,16 +0,0 @@
1
- import { FrontendApplicationContribution } from '@theia/core/lib/browser';
2
- import { GoogleLanguageModelsManager, GoogleModelDescription } from '../common';
3
- import { PreferenceService } from '@theia/core';
4
- export declare class GoogleFrontendApplicationContribution implements FrontendApplicationContribution {
5
- protected preferenceService: PreferenceService;
6
- protected manager: GoogleLanguageModelsManager;
7
- protected prevModels: string[];
8
- onStart(): void;
9
- /**
10
- * Called when the API key changes. Updates all Google models on the manager to ensure the new key is used.
11
- */
12
- protected handleKeyChange(newApiKey: string | undefined): void;
13
- protected handleModelChanges(newModels: string[]): void;
14
- protected createGeminiModelDescription(modelId: string): GoogleModelDescription;
15
- }
16
- //# sourceMappingURL=google-frontend-application-contribution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/google-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIhD,qBACa,qCAAsC,YAAW,+BAA+B;IAGzF,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAG/C,SAAS,CAAC,OAAO,EAAE,2BAA2B,CAAC;IAE/C,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAM;IAEpC,OAAO,IAAI,IAAI;IA8Bf;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAM9D,SAAS,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;IAYvD,SAAS,CAAC,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB;CAYlF"}
@@ -1,99 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2025 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.GoogleFrontendApplicationContribution = void 0;
19
- const tslib_1 = require("tslib");
20
- const inversify_1 = require("@theia/core/shared/inversify");
21
- const common_1 = require("../common");
22
- const google_preferences_1 = require("../common/google-preferences");
23
- const core_1 = require("@theia/core");
24
- const GOOGLE_PROVIDER_ID = 'google';
25
- let GoogleFrontendApplicationContribution = class GoogleFrontendApplicationContribution {
26
- constructor() {
27
- this.prevModels = [];
28
- }
29
- onStart() {
30
- this.preferenceService.ready.then(() => {
31
- const apiKey = this.preferenceService.get(google_preferences_1.API_KEY_PREF, undefined);
32
- this.manager.setApiKey(apiKey);
33
- this.manager.setMaxRetriesOnErrors(this.preferenceService.get(google_preferences_1.MAX_RETRIES, 3));
34
- this.manager.setRetryDelayOnRateLimitError(this.preferenceService.get(google_preferences_1.RETRY_DELAY_RATE_LIMIT, 60));
35
- this.manager.setRetryDelayOnOtherErrors(this.preferenceService.get(google_preferences_1.RETRY_DELAY_OTHER_ERRORS, -1));
36
- const models = this.preferenceService.get(google_preferences_1.MODELS_PREF, []);
37
- this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createGeminiModelDescription(modelId)));
38
- this.prevModels = [...models];
39
- this.preferenceService.onPreferenceChanged(event => {
40
- if (event.preferenceName === google_preferences_1.API_KEY_PREF) {
41
- this.manager.setApiKey(event.newValue);
42
- this.handleKeyChange(event.newValue);
43
- }
44
- else if (event.preferenceName === google_preferences_1.MAX_RETRIES) {
45
- this.manager.setMaxRetriesOnErrors(event.newValue);
46
- }
47
- else if (event.preferenceName === google_preferences_1.RETRY_DELAY_RATE_LIMIT) {
48
- this.manager.setRetryDelayOnRateLimitError(event.newValue);
49
- }
50
- else if (event.preferenceName === google_preferences_1.RETRY_DELAY_OTHER_ERRORS) {
51
- this.manager.setRetryDelayOnOtherErrors(event.newValue);
52
- }
53
- else if (event.preferenceName === google_preferences_1.MODELS_PREF) {
54
- this.handleModelChanges(event.newValue);
55
- }
56
- });
57
- });
58
- }
59
- /**
60
- * Called when the API key changes. Updates all Google models on the manager to ensure the new key is used.
61
- */
62
- handleKeyChange(newApiKey) {
63
- if (this.prevModels && this.prevModels.length > 0) {
64
- this.manager.createOrUpdateLanguageModels(...this.prevModels.map(modelId => this.createGeminiModelDescription(modelId)));
65
- }
66
- }
67
- handleModelChanges(newModels) {
68
- const oldModels = new Set(this.prevModels);
69
- const updatedModels = new Set(newModels);
70
- const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model));
71
- const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model));
72
- this.manager.removeLanguageModels(...modelsToRemove.map(model => `${GOOGLE_PROVIDER_ID}/${model}`));
73
- this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(modelId => this.createGeminiModelDescription(modelId)));
74
- this.prevModels = newModels;
75
- }
76
- createGeminiModelDescription(modelId) {
77
- const id = `${GOOGLE_PROVIDER_ID}/${modelId}`;
78
- const description = {
79
- id: id,
80
- model: modelId,
81
- apiKey: true,
82
- enableStreaming: true
83
- };
84
- return description;
85
- }
86
- };
87
- exports.GoogleFrontendApplicationContribution = GoogleFrontendApplicationContribution;
88
- tslib_1.__decorate([
89
- (0, inversify_1.inject)(core_1.PreferenceService),
90
- tslib_1.__metadata("design:type", Object)
91
- ], GoogleFrontendApplicationContribution.prototype, "preferenceService", void 0);
92
- tslib_1.__decorate([
93
- (0, inversify_1.inject)(common_1.GoogleLanguageModelsManager),
94
- tslib_1.__metadata("design:type", Object)
95
- ], GoogleFrontendApplicationContribution.prototype, "manager", void 0);
96
- exports.GoogleFrontendApplicationContribution = GoogleFrontendApplicationContribution = tslib_1.__decorate([
97
- (0, inversify_1.injectable)()
98
- ], GoogleFrontendApplicationContribution);
99
- //# sourceMappingURL=google-frontend-application-contribution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/google-frontend-application-contribution.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;;;;AAGhF,4DAAkE;AAClE,sCAAgF;AAChF,qEAAwI;AACxI,sCAAgD;AAEhD,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAG7B,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAA3C;QAQO,eAAU,GAAa,EAAE,CAAC;IAiExC,CAAC;IA/DG,OAAO;QACH,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACnC,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAS,iCAAY,EAAE,SAAS,CAAC,CAAC;YAC3E,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAE/B,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAS,gCAAW,EAAE,CAAC,CAAC,CAAC,CAAC;YACvF,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,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O,CAAC,CAAC,CAAC,CAAC;QACrH,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAES,4BAA4B,CAAC,OAAe;QAClD,MAAM,EAAE,GAAG,GAAG,kBAAkB,IAAI,OAAO,EAAE,CAAC;QAE9C,MAAM,WAAW,GAA2B;YACxC,EAAE,EAAE,EAAE;YACN,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;SACxB,CAAC;QAEF,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ,CAAA;AAzEY,sFAAqC;AAGpC;IADT,IAAA,kBAAM,EAAC,wBAAiB,CAAC;;gFACqB;AAGrC;IADT,IAAA,kBAAM,EAAC,oCAA2B,CAAC;;sEACW;gDANtC,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CAyEjD"}
@@ -1,4 +0,0 @@
1
- import { ContainerModule } from '@theia/core/shared/inversify';
2
- declare const _default: ContainerModule;
3
- export default _default;
4
- //# sourceMappingURL=google-frontend-module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/google-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAO/D,wBAQG"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2025 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
- const inversify_1 = require("@theia/core/shared/inversify");
19
- const google_preferences_1 = require("../common/google-preferences");
20
- const browser_1 = require("@theia/core/lib/browser");
21
- const google_frontend_application_contribution_1 = require("./google-frontend-application-contribution");
22
- const common_1 = require("../common");
23
- const core_1 = require("@theia/core");
24
- exports.default = new inversify_1.ContainerModule(bind => {
25
- bind(core_1.PreferenceContribution).toConstantValue({ schema: google_preferences_1.GooglePreferencesSchema });
26
- bind(google_frontend_application_contribution_1.GoogleFrontendApplicationContribution).toSelf().inSingletonScope();
27
- bind(browser_1.FrontendApplicationContribution).toService(google_frontend_application_contribution_1.GoogleFrontendApplicationContribution);
28
- bind(common_1.GoogleLanguageModelsManager).toDynamicValue(ctx => {
29
- const provider = ctx.container.get(browser_1.RemoteConnectionProvider);
30
- return provider.createProxy(common_1.GOOGLE_LANGUAGE_MODELS_MANAGER_PATH);
31
- }).inSingletonScope();
32
- });
33
- //# sourceMappingURL=google-frontend-module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-frontend-module.js","sourceRoot":"","sources":["../../src/browser/google-frontend-module.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,4DAA+D;AAC/D,qEAAuE;AACvE,qDAA+H;AAC/H,yGAAmG;AACnG,sCAA6F;AAC7F,sCAAqD;AAErD,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,6BAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,4CAAuB,EAAE,CAAC,CAAC;IAClF,IAAI,CAAC,gFAAqC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACxE,IAAI,CAAC,yCAA+B,CAAC,CAAC,SAAS,CAAC,gFAAqC,CAAC,CAAC;IACvF,IAAI,CAAC,oCAA2B,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QACnD,MAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAA4B,kCAAwB,CAAC,CAAC;QACxF,OAAO,QAAQ,CAAC,WAAW,CAA8B,4CAAmC,CAAC,CAAC;IAClG,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -1,34 +0,0 @@
1
- export declare const GOOGLE_LANGUAGE_MODELS_MANAGER_PATH = "/services/google/language-model-manager";
2
- export declare const GoogleLanguageModelsManager: unique symbol;
3
- export interface GoogleModelDescription {
4
- /**
5
- * The identifier of the model which will be shown in the UI.
6
- */
7
- id: string;
8
- /**
9
- * The model ID as used by the Google Gemini API.
10
- */
11
- model: string;
12
- /**
13
- * The key for the model. If 'true' is provided the global Gemini API key will be used.
14
- */
15
- apiKey: string | true | undefined;
16
- /**
17
- * Indicate whether the streaming API shall be used.
18
- */
19
- enableStreaming: boolean;
20
- /**
21
- * Maximum number of tokens to generate. Default is 4096.
22
- */
23
- maxTokens?: number;
24
- }
25
- export interface GoogleLanguageModelsManager {
26
- apiKey: string | undefined;
27
- setApiKey(key: string | undefined): void;
28
- setMaxRetriesOnErrors(maxRetries: number): void;
29
- setRetryDelayOnRateLimitError(retryDelay: number): void;
30
- setRetryDelayOnOtherErrors(retryDelay: number): void;
31
- createOrUpdateLanguageModels(...models: GoogleModelDescription[]): Promise<void>;
32
- removeLanguageModels(...modelIds: string[]): void;
33
- }
34
- //# sourceMappingURL=google-language-models-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-language-models-manager.d.ts","sourceRoot":"","sources":["../../src/common/google-language-models-manager.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,mCAAmC,4CAA4C,CAAC;AAC7F,eAAO,MAAM,2BAA2B,eAAwC,CAAC;AACjF,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CAEtB;AAED,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACzC,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,6BAA6B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,4BAA4B,CAAC,GAAG,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjF,oBAAoB,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CACpD"}
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleLanguageModelsManager = exports.GOOGLE_LANGUAGE_MODELS_MANAGER_PATH = void 0;
4
- // *****************************************************************************
5
- // Copyright (C) 2025 EclipseSource GmbH.
6
- //
7
- // This program and the accompanying materials are made available under the
8
- // terms of the Eclipse Public License v. 2.0 which is available at
9
- // http://www.eclipse.org/legal/epl-2.0.
10
- //
11
- // This Source Code may also be made available under the following Secondary
12
- // Licenses when the conditions for such availability set forth in the Eclipse
13
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
- // with the GNU Classpath Exception which is available at
15
- // https://www.gnu.org/software/classpath/license.html.
16
- //
17
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
18
- // *****************************************************************************
19
- exports.GOOGLE_LANGUAGE_MODELS_MANAGER_PATH = '/services/google/language-model-manager';
20
- exports.GoogleLanguageModelsManager = Symbol('GoogleLanguageModelsManager');
21
- //# sourceMappingURL=google-language-models-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-language-models-manager.js","sourceRoot":"","sources":["../../src/common/google-language-models-manager.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;AACnE,QAAA,mCAAmC,GAAG,yCAAyC,CAAC;AAChF,QAAA,2BAA2B,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { PreferenceSchema } from '@theia/core';
2
- export declare const API_KEY_PREF = "ai-features.google.apiKey";
3
- export declare const MODELS_PREF = "ai-features.google.models";
4
- export declare const MAX_RETRIES = "ai-features.google.maxRetriesOnErrors";
5
- export declare const RETRY_DELAY_RATE_LIMIT = "ai-features.google.retryDelayOnRateLimitError";
6
- export declare const RETRY_DELAY_OTHER_ERRORS = "ai-features.google.retryDelayOnOtherErrors";
7
- export declare const GooglePreferencesSchema: PreferenceSchema;
8
- //# sourceMappingURL=google-preferences.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-preferences.d.ts","sourceRoot":"","sources":["../../src/common/google-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAO,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,YAAY,8BAA8B,CAAC;AACxD,eAAO,MAAM,WAAW,8BAA8B,CAAC;AACvD,eAAO,MAAM,WAAW,0CAA0C,CAAC;AACnE,eAAO,MAAM,sBAAsB,kDAAkD,CAAC;AACtF,eAAO,MAAM,wBAAwB,+CAA+C,CAAC;AAErF,eAAO,MAAM,uBAAuB,EAAE,gBA6CrC,CAAC"}
@@ -1,68 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2025 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.GooglePreferencesSchema = exports.RETRY_DELAY_OTHER_ERRORS = exports.RETRY_DELAY_RATE_LIMIT = exports.MAX_RETRIES = exports.MODELS_PREF = exports.API_KEY_PREF = void 0;
19
- const ai_core_preferences_1 = require("@theia/ai-core/lib/common/ai-core-preferences");
20
- const core_1 = require("@theia/core");
21
- exports.API_KEY_PREF = 'ai-features.google.apiKey';
22
- exports.MODELS_PREF = 'ai-features.google.models';
23
- exports.MAX_RETRIES = 'ai-features.google.maxRetriesOnErrors';
24
- exports.RETRY_DELAY_RATE_LIMIT = 'ai-features.google.retryDelayOnRateLimitError';
25
- exports.RETRY_DELAY_OTHER_ERRORS = 'ai-features.google.retryDelayOnOtherErrors';
26
- exports.GooglePreferencesSchema = {
27
- properties: {
28
- [exports.API_KEY_PREF]: {
29
- type: 'string',
30
- markdownDescription: core_1.nls.localize('theia/ai/google/apiKey/description', 'Enter an API Key of your official Google AI (Gemini) Account. **Please note:** By using this preference the GOOGLE AI API key will be stored in clear text\
31
- on the machine running Theia. Use the environment variable `GOOGLE_API_KEY` to set the key securely.'),
32
- title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
33
- },
34
- [exports.MODELS_PREF]: {
35
- type: 'array',
36
- description: core_1.nls.localize('theia/ai/google/models/description', 'Official Google Gemini models to use'),
37
- title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
38
- default: ['gemini-1.5-flash', 'gemini-1.5-pro', 'gemini-2.0-flash', 'gemini-2.0-flash-lite', 'gemini-2.5-flash-preview-05-20', 'gemini-2.5-pro-preview-05-06'],
39
- items: {
40
- type: 'string'
41
- }
42
- },
43
- [exports.MAX_RETRIES]: {
44
- type: 'integer',
45
- description: core_1.nls.localize('theia/ai/google/maxRetriesOnErrors/description', 'Maximum number of retries in case of errors. If smaller than 1, then the retry logic is disabled'),
46
- title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
47
- default: 3,
48
- minimum: 0
49
- },
50
- [exports.RETRY_DELAY_RATE_LIMIT]: {
51
- type: 'number',
52
- description: core_1.nls.localize('theia/ai/google/retryDelayOnRateLimitError/description', 'Delay in seconds between retries in case of rate limit errors. See https://ai.google.dev/gemini-api/docs/rate-limits'),
53
- title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
54
- default: 60,
55
- minimum: 0
56
- },
57
- [exports.RETRY_DELAY_OTHER_ERRORS]: {
58
- type: 'number',
59
- description: core_1.nls.localize('theia/ai/google/retryDelayOnOtherErrors/description', 'Delay in seconds between retries in case of other errors (sometimes the Google GenAI reports errors such as incomplete JSON syntax returned from the model \
60
- or 500 Internal Server Error). Setting this to -1 prevents retries in these cases. Otherwise a retry happens either immediately (if set to 0) or after \
61
- this delay in seconds (if set to a positive number).'),
62
- title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
63
- default: -1,
64
- minimum: -1
65
- }
66
- }
67
- };
68
- //# sourceMappingURL=google-preferences.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-preferences.js","sourceRoot":"","sources":["../../src/common/google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IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,UAAG,CAAC,QAAQ,CAAC,wDAAwD,EAC9E,sHAAsH,CAAC;YAC3H,KAAK,EAAE,+CAAyB;YAChC,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,CAAC;SACb;QACD,CAAC,gCAAwB,CAAC,EAAE;YACxB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,UAAG,CAAC,QAAQ,CAAC,qDAAqD,EAC3E;;qEAEqD,CAAC;YAC1D,KAAK,EAAE,+CAAyB;YAChC,OAAO,EAAE,CAAC,CAAC;YACX,OAAO,EAAE,CAAC,CAAC;SACd;KACJ;CACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './google-language-models-manager';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAeA,cAAc,kCAAkC,CAAC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- // *****************************************************************************
5
- // Copyright (C) 2025 EclipseSource GmbH.
6
- //
7
- // This program and the accompanying materials are made available under the
8
- // terms of the Eclipse Public License v. 2.0 which is available at
9
- // http://www.eclipse.org/legal/epl-2.0.
10
- //
11
- // This Source Code may also be made available under the following Secondary
12
- // Licenses when the conditions for such availability set forth in the Eclipse
13
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
- // with the GNU Classpath Exception which is available at
15
- // https://www.gnu.org/software/classpath/license.html.
16
- //
17
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
18
- // *****************************************************************************
19
- tslib_1.__exportStar(require("./google-language-models-manager"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.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;AAChF,2EAAiD"}
@@ -1,4 +0,0 @@
1
- import { ContainerModule } from '@theia/core/shared/inversify';
2
- declare const _default: ContainerModule;
3
- export default _default;
4
- //# sourceMappingURL=google-backend-module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/google-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAgB/D,wBAGG"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2025 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
- const inversify_1 = require("@theia/core/shared/inversify");
19
- const google_language_models_manager_1 = require("../common/google-language-models-manager");
20
- const core_1 = require("@theia/core");
21
- const google_language_models_manager_impl_1 = require("./google-language-models-manager-impl");
22
- const connection_container_module_1 = require("@theia/core/lib/node/messaging/connection-container-module");
23
- const google_preferences_1 = require("../common/google-preferences");
24
- // We use a connection module to handle AI services separately for each frontend.
25
- const geminiConnectionModule = connection_container_module_1.ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => {
26
- bind(google_language_models_manager_impl_1.GoogleLanguageModelsManagerImpl).toSelf().inSingletonScope();
27
- bind(google_language_models_manager_1.GoogleLanguageModelsManager).toService(google_language_models_manager_impl_1.GoogleLanguageModelsManagerImpl);
28
- bind(core_1.ConnectionHandler).toDynamicValue(ctx => new core_1.RpcConnectionHandler(google_language_models_manager_1.GOOGLE_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(google_language_models_manager_1.GoogleLanguageModelsManager))).inSingletonScope();
29
- });
30
- exports.default = new inversify_1.ContainerModule(bind => {
31
- bind(core_1.PreferenceContribution).toConstantValue({ schema: google_preferences_1.GooglePreferencesSchema });
32
- bind(connection_container_module_1.ConnectionContainerModule).toConstantValue(geminiConnectionModule);
33
- });
34
- //# sourceMappingURL=google-backend-module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-backend-module.js","sourceRoot":"","sources":["../../src/node/google-backend-module.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,4DAA+D;AAC/D,6FAA4H;AAC5H,sCAA8F;AAC9F,+FAAwF;AACxF,4GAAuG;AACvG,qEAAuE;AAEvE,iFAAiF;AACjF,MAAM,sBAAsB,GAAG,uDAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,EAAE,EAAE;IAClH,IAAI,CAAC,qEAA+B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAClE,IAAI,CAAC,4DAA2B,CAAC,CAAC,SAAS,CAAC,qEAA+B,CAAC,CAAC;IAC7E,IAAI,CAAC,wBAAiB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CACzC,IAAI,2BAAoB,CAAC,oEAAmC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,4DAA2B,CAAC,CAAC,CACtH,CAAC,gBAAgB,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,6BAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,4CAAuB,EAAE,CAAC,CAAC;IAClF,IAAI,CAAC,uDAAyB,CAAC,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC;AAC5E,CAAC,CAAC,CAAC"}
@@ -1,33 +0,0 @@
1
- import { LanguageModel, LanguageModelRequest, LanguageModelResponse, LanguageModelStreamResponse, LanguageModelTextResponse, TokenUsageService, UserRequest, ToolCallResult, LanguageModelStatus } from '@theia/ai-core';
2
- import { CancellationToken } from '@theia/core';
3
- import { GoogleGenAI, Content, FunctionResponse } from '@google/genai';
4
- import { GoogleLanguageModelRetrySettings } from './google-language-models-manager-impl';
5
- export declare const GoogleModelIdentifier: unique symbol;
6
- /**
7
- * Implements the Gemini language model integration for Theia
8
- */
9
- export declare class GoogleModel implements LanguageModel {
10
- readonly id: string;
11
- model: string;
12
- status: LanguageModelStatus;
13
- enableStreaming: boolean;
14
- apiKey: () => string | undefined;
15
- retrySettings: () => GoogleLanguageModelRetrySettings;
16
- protected readonly tokenUsageService?: TokenUsageService | undefined;
17
- constructor(id: string, model: string, status: LanguageModelStatus, enableStreaming: boolean, apiKey: () => string | undefined, retrySettings: () => GoogleLanguageModelRetrySettings, tokenUsageService?: TokenUsageService | undefined);
18
- protected getSettings(request: LanguageModelRequest): Readonly<Record<string, unknown>>;
19
- request(request: UserRequest, cancellationToken?: CancellationToken): Promise<LanguageModelResponse>;
20
- protected handleStreamingRequest(genAI: GoogleGenAI, request: UserRequest, cancellationToken?: CancellationToken, toolMessages?: Content[]): Promise<LanguageModelStreamResponse>;
21
- protected formatToolCallResult(result: ToolCallResult): FunctionResponse['response'];
22
- private createFunctionDeclarations;
23
- protected handleNonStreamingRequest(genAI: GoogleGenAI, request: UserRequest): Promise<LanguageModelTextResponse>;
24
- protected initializeGemini(): GoogleGenAI;
25
- /**
26
- * Implements a retry mechanism for the handle(non)Streaming request functions.
27
- * @param fn the wrapped function to which the retry logic should be applied.
28
- * @param retrySettings the configuration settings for the retry mechanism.
29
- * @returns the result of the wrapped function.
30
- */
31
- private withRetry;
32
- }
33
- //# sourceMappingURL=google-language-model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-language-model.d.ts","sourceRoot":"","sources":["../../src/node/google-language-model.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,aAAa,EACb,oBAAoB,EAEpB,qBAAqB,EACrB,2BAA2B,EAE3B,yBAAyB,EACzB,iBAAiB,EACjB,WAAW,EAEX,cAAc,EACd,mBAAmB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAkD,OAAO,EAA0B,gBAAgB,EAAc,MAAM,eAAe,CAAC;AAE3J,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAsEzF,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AAgBrE;;GAEG;AACH,qBAAa,WAAY,YAAW,aAAa;aAGzB,EAAE,EAAE,MAAM;IACnB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,mBAAmB;IAC3B,eAAe,EAAE,OAAO;IACxB,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS;IAChC,aAAa,EAAE,MAAM,gCAAgC;IAC5D,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC;gBANrB,EAAE,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,mBAAmB,EAC3B,eAAe,EAAE,OAAO,EACxB,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,EAChC,aAAa,EAAE,MAAM,gCAAgC,EACzC,iBAAiB,CAAC,+BAAmB;IAG5D,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAIjF,OAAO,CAAC,OAAO,EAAE,WAAW,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC;cAiB1F,sBAAsB,CAClC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,WAAW,EACpB,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,YAAY,CAAC,EAAE,OAAO,EAAE,GACzB,OAAO,CAAC,2BAA2B,CAAC;IA6LvC,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAAC,UAAU,CAAC;IAOpF,OAAO,CAAC,0BAA0B;cAYlB,yBAAyB,CACrC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,WAAW,GACrB,OAAO,CAAC,yBAAyB,CAAC;IA6CrC,SAAS,CAAC,gBAAgB,IAAI,WAAW;IAUzC;;;;;OAKG;YACW,SAAS;CAqC1B"}
@@ -1,412 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleModel = exports.GoogleModelIdentifier = void 0;
4
- // *****************************************************************************
5
- // Copyright (C) 2025 EclipseSource GmbH.
6
- //
7
- // This program and the accompanying materials are made available under the
8
- // terms of the Eclipse Public License v. 2.0 which is available at
9
- // http://www.eclipse.org/legal/epl-2.0.
10
- //
11
- // This Source Code may also be made available under the following Secondary
12
- // Licenses when the conditions for such availability set forth in the Eclipse
13
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
- // with the GNU Classpath Exception which is available at
15
- // https://www.gnu.org/software/classpath/license.html.
16
- //
17
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
18
- // *****************************************************************************
19
- const node_crypto_1 = require("node:crypto");
20
- const ai_core_1 = require("@theia/ai-core");
21
- const genai_1 = require("@google/genai");
22
- const promise_util_1 = require("@theia/core/lib/common/promise-util");
23
- const convertMessageToPart = (message) => {
24
- if (ai_core_1.LanguageModelMessage.isTextMessage(message) && message.text.length > 0) {
25
- return [{ text: message.text }];
26
- }
27
- else if (ai_core_1.LanguageModelMessage.isToolUseMessage(message)) {
28
- return [{
29
- functionCall: {
30
- id: message.id, name: message.name, args: message.input
31
- }
32
- }];
33
- }
34
- else if (ai_core_1.LanguageModelMessage.isToolResultMessage(message)) {
35
- return [{ functionResponse: { id: message.tool_use_id, name: message.name, response: { output: message.content } } }];
36
- }
37
- else if (ai_core_1.LanguageModelMessage.isThinkingMessage(message)) {
38
- return [{ thought: true }, { text: message.thinking }];
39
- }
40
- else if (ai_core_1.LanguageModelMessage.isImageMessage(message) && ai_core_1.ImageContent.isBase64(message.image)) {
41
- return [{ inlineData: { data: message.image.base64data, mimeType: message.image.mimeType } }];
42
- }
43
- };
44
- /**
45
- * Transforms Theia language model messages to Gemini API format
46
- * @param messages Array of LanguageModelRequestMessage to transform
47
- * @returns Object containing transformed messages and optional system message
48
- */
49
- function transformToGeminiMessages(messages) {
50
- var _a;
51
- // Extract the system message (if any), as it is a separate parameter in the Gemini API.
52
- const systemMessageObj = messages.find(message => message.actor === 'system');
53
- const systemMessage = systemMessageObj && ai_core_1.LanguageModelMessage.isTextMessage(systemMessageObj) && systemMessageObj.text || undefined;
54
- const contents = [];
55
- for (const message of messages) {
56
- if (message.actor === 'system') {
57
- continue; // Skip system messages as they're handled separately
58
- }
59
- const resultParts = convertMessageToPart(message);
60
- if (resultParts === undefined) {
61
- continue;
62
- }
63
- const role = toGoogleRole(message);
64
- const lastContent = contents.pop();
65
- if (!lastContent) {
66
- contents.push({ role, parts: resultParts });
67
- }
68
- else if (lastContent.role !== role) {
69
- contents.push(lastContent);
70
- contents.push({ role, parts: resultParts });
71
- }
72
- else {
73
- (_a = lastContent === null || lastContent === void 0 ? void 0 : lastContent.parts) === null || _a === void 0 ? void 0 : _a.push(...resultParts);
74
- contents.push(lastContent);
75
- }
76
- }
77
- return {
78
- contents: contents,
79
- systemMessage,
80
- };
81
- }
82
- exports.GoogleModelIdentifier = Symbol('GoogleModelIdentifier');
83
- /**
84
- * Converts Theia message actor to Gemini role
85
- * @param message The message to convert
86
- * @returns Gemini role ('user' or 'model')
87
- */
88
- function toGoogleRole(message) {
89
- switch (message.actor) {
90
- case 'ai':
91
- return 'model';
92
- default:
93
- return 'user';
94
- }
95
- }
96
- /**
97
- * Implements the Gemini language model integration for Theia
98
- */
99
- class GoogleModel {
100
- constructor(id, model, status, enableStreaming, apiKey, retrySettings, tokenUsageService) {
101
- this.id = id;
102
- this.model = model;
103
- this.status = status;
104
- this.enableStreaming = enableStreaming;
105
- this.apiKey = apiKey;
106
- this.retrySettings = retrySettings;
107
- this.tokenUsageService = tokenUsageService;
108
- }
109
- getSettings(request) {
110
- var _a;
111
- return (_a = request.settings) !== null && _a !== void 0 ? _a : {};
112
- }
113
- async request(request, cancellationToken) {
114
- var _a;
115
- if (!((_a = request.messages) === null || _a === void 0 ? void 0 : _a.length)) {
116
- throw new Error('Request must contain at least one message');
117
- }
118
- const genAI = this.initializeGemini();
119
- try {
120
- if (this.enableStreaming) {
121
- return this.handleStreamingRequest(genAI, request, cancellationToken);
122
- }
123
- return this.handleNonStreamingRequest(genAI, request);
124
- }
125
- catch (error) {
126
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
127
- throw new Error(`Gemini API request failed: ${errorMessage}`);
128
- }
129
- }
130
- async handleStreamingRequest(genAI, request, cancellationToken, toolMessages) {
131
- const settings = this.getSettings(request);
132
- const { contents: parts, systemMessage } = transformToGeminiMessages(request.messages);
133
- const functionDeclarations = this.createFunctionDeclarations(request);
134
- const toolConfig = {};
135
- if (functionDeclarations.length > 0) {
136
- toolConfig.functionCallingConfig = {
137
- mode: genai_1.FunctionCallingConfigMode.AUTO,
138
- };
139
- }
140
- // Wrap the API call in the retry mechanism
141
- const stream = await this.withRetry(async () => genAI.models.generateContentStream({
142
- model: this.model,
143
- config: {
144
- systemInstruction: systemMessage,
145
- toolConfig,
146
- responseModalities: [genai_1.Modality.TEXT],
147
- ...(functionDeclarations.length > 0 && {
148
- tools: [{
149
- functionDeclarations
150
- }]
151
- }),
152
- temperature: 1,
153
- ...settings
154
- },
155
- contents: [...parts, ...(toolMessages !== null && toolMessages !== void 0 ? toolMessages : [])]
156
- }));
157
- const that = this;
158
- const asyncIterator = {
159
- async *[Symbol.asyncIterator]() {
160
- var _a, _b, _c, _d;
161
- const toolCallMap = {};
162
- let currentContent = undefined;
163
- try {
164
- for await (const chunk of stream) {
165
- if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) {
166
- break;
167
- }
168
- const finishReason = (_a = chunk.candidates) === null || _a === void 0 ? void 0 : _a[0].finishReason;
169
- if (finishReason) {
170
- currentContent = (_b = chunk.candidates) === null || _b === void 0 ? void 0 : _b[0].content;
171
- switch (finishReason) {
172
- // 'STOP' is the only valid (non-error) finishReason
173
- // "Natural stop point of the model or provided stop sequence."
174
- case 'STOP':
175
- break;
176
- // All other reasons are error-cases. Throw an Error.
177
- // e.g. MALFORMED_FUNCTION_CALL, SAFETY, MAX_TOKENS, ...
178
- // https://ai.google.dev/api/generate-content#FinishReason
179
- default:
180
- throw new Error('Unexpected finish reason: ' + finishReason);
181
- }
182
- }
183
- // Handle text content
184
- if (chunk.text) {
185
- yield { content: chunk.text };
186
- }
187
- // Handle function calls from Gemini
188
- if (chunk.functionCalls && chunk.functionCalls.length > 0) {
189
- let functionIndex = 0;
190
- for (const functionCall of chunk.functionCalls) {
191
- const callId = (_c = functionCall.id) !== null && _c !== void 0 ? _c : node_crypto_1.webcrypto.randomUUID().replace(/-/g, '');
192
- let toolCall = toolCallMap[callId];
193
- if (toolCall === undefined) {
194
- toolCall = {
195
- name: (_d = functionCall.name) !== null && _d !== void 0 ? _d : '',
196
- args: functionCall.args ? JSON.stringify(functionCall.args) : '{}',
197
- id: callId,
198
- index: functionIndex++
199
- };
200
- toolCallMap[callId] = toolCall;
201
- yield {
202
- tool_calls: [{
203
- finished: false,
204
- id: toolCall.id,
205
- function: {
206
- name: toolCall.name,
207
- arguments: toolCall.args
208
- }
209
- }]
210
- };
211
- }
212
- else {
213
- // Update to existing tool call
214
- toolCall.args = functionCall.args ? JSON.stringify(functionCall.args) : '{}';
215
- yield {
216
- tool_calls: [{
217
- function: {
218
- arguments: toolCall.args
219
- }
220
- }]
221
- };
222
- }
223
- }
224
- }
225
- // Report token usage if available
226
- if (chunk.usageMetadata && that.tokenUsageService && that.id) {
227
- const promptTokens = chunk.usageMetadata.promptTokenCount;
228
- const completionTokens = chunk.usageMetadata.candidatesTokenCount;
229
- if (promptTokens && completionTokens) {
230
- that.tokenUsageService.recordTokenUsage(that.id, {
231
- inputTokens: promptTokens,
232
- outputTokens: completionTokens,
233
- requestId: request.requestId
234
- }).catch(error => console.error('Error recording token usage:', error));
235
- }
236
- }
237
- }
238
- // Mark tool call as finished if it exists
239
- const toolCalls = Object.values(toolCallMap);
240
- for (const toolCall of toolCalls) {
241
- yield { tool_calls: [{ finished: true, id: toolCall.id }] };
242
- }
243
- // Process tool calls if any exist
244
- if (toolCalls.length > 0) {
245
- // Collect tool results
246
- const toolResult = await Promise.all(toolCalls.map(async (tc) => {
247
- var _a;
248
- const tool = (_a = request.tools) === null || _a === void 0 ? void 0 : _a.find(t => t.name === tc.name);
249
- let result;
250
- try {
251
- result = await (tool === null || tool === void 0 ? void 0 : tool.handler(tc.args));
252
- }
253
- catch (e) {
254
- console.error(`Error executing tool ${tc.name}:`, e);
255
- result = { error: e.message || 'Tool execution failed' };
256
- }
257
- return {
258
- name: tc.name,
259
- result: result,
260
- id: tc.id,
261
- arguments: tc.args
262
- };
263
- }));
264
- // Generate tool call responses
265
- const calls = toolResult.map(tr => ({
266
- finished: true,
267
- id: tr.id,
268
- result: tr.result,
269
- function: { name: tr.name, arguments: tr.arguments }
270
- }));
271
- yield { tool_calls: calls };
272
- // Format tool responses for Gemini
273
- const toolResponses = toolResult.map(call => ({
274
- functionResponse: {
275
- id: call.id,
276
- name: call.name,
277
- response: that.formatToolCallResult(call.result)
278
- }
279
- }));
280
- const responseMessage = { role: 'user', parts: toolResponses };
281
- const messages = [...(toolMessages !== null && toolMessages !== void 0 ? toolMessages : [])];
282
- if (currentContent) {
283
- messages.push(currentContent);
284
- }
285
- messages.push(responseMessage);
286
- // Continue the conversation with tool results
287
- const continuedResponse = await that.handleStreamingRequest(genAI, request, cancellationToken, messages);
288
- // Stream the continued response
289
- for await (const nestedEvent of continuedResponse.stream) {
290
- yield nestedEvent;
291
- }
292
- }
293
- }
294
- catch (e) {
295
- console.error('Error in Gemini streaming:', e);
296
- throw e;
297
- }
298
- },
299
- };
300
- return { stream: asyncIterator };
301
- }
302
- formatToolCallResult(result) {
303
- // If "output" and "error" keys are not specified, then whole "response" is treated as function output.
304
- // There is no particular support for different types of output such as images so we use the structure provided by the tool call.
305
- // Using the format that is used for image messages does not seem to yield any different results.
306
- return { output: result };
307
- }
308
- createFunctionDeclarations(request) {
309
- if (!request.tools || request.tools.length === 0) {
310
- return [];
311
- }
312
- return request.tools.map(tool => ({
313
- name: tool.name,
314
- description: tool.description,
315
- parameters: (tool.parameters && Object.keys(tool.parameters.properties).length !== 0) ? tool.parameters : undefined
316
- }));
317
- }
318
- async handleNonStreamingRequest(genAI, request) {
319
- const settings = this.getSettings(request);
320
- const { contents: parts, systemMessage } = transformToGeminiMessages(request.messages);
321
- const functionDeclarations = this.createFunctionDeclarations(request);
322
- // Wrap the API call in the retry mechanism
323
- const model = await this.withRetry(async () => genAI.models.generateContent({
324
- model: this.model,
325
- config: {
326
- systemInstruction: systemMessage,
327
- toolConfig: {
328
- functionCallingConfig: {
329
- mode: genai_1.FunctionCallingConfigMode.AUTO,
330
- }
331
- },
332
- ...(functionDeclarations.length > 0 && {
333
- tools: [{ functionDeclarations }]
334
- }),
335
- ...settings
336
- },
337
- contents: parts
338
- }));
339
- try {
340
- const responseText = model.text;
341
- // Record token usage if available
342
- if (model.usageMetadata && this.tokenUsageService) {
343
- const promptTokens = model.usageMetadata.promptTokenCount;
344
- const completionTokens = model.usageMetadata.candidatesTokenCount;
345
- if (promptTokens && completionTokens) {
346
- await this.tokenUsageService.recordTokenUsage(this.id, {
347
- inputTokens: promptTokens,
348
- outputTokens: completionTokens,
349
- requestId: request.requestId
350
- });
351
- }
352
- }
353
- return { text: responseText !== null && responseText !== void 0 ? responseText : '' };
354
- }
355
- catch (error) {
356
- throw new Error(`Failed to get response from Gemini API: ${error instanceof Error ? error.message : 'Unknown error'}`);
357
- }
358
- }
359
- initializeGemini() {
360
- const apiKey = this.apiKey();
361
- if (!apiKey) {
362
- throw new Error('Please provide GOOGLE_API_KEY in preferences or via environment variable');
363
- }
364
- // TODO test vertexai
365
- return new genai_1.GoogleGenAI({ apiKey, vertexai: false });
366
- }
367
- /**
368
- * Implements a retry mechanism for the handle(non)Streaming request functions.
369
- * @param fn the wrapped function to which the retry logic should be applied.
370
- * @param retrySettings the configuration settings for the retry mechanism.
371
- * @returns the result of the wrapped function.
372
- */
373
- async withRetry(fn) {
374
- const { maxRetriesOnErrors, retryDelayOnRateLimitError, retryDelayOnOtherErrors } = this.retrySettings();
375
- for (let i = 0; i <= maxRetriesOnErrors; i++) {
376
- try {
377
- return await fn();
378
- }
379
- catch (error) {
380
- if (i === maxRetriesOnErrors) {
381
- // no retries left - throw the original error
382
- throw error;
383
- }
384
- const message = error.message;
385
- // Check for rate limit exhaustion (usually, there is a rate limit per minute, so we can retry after a delay...)
386
- if (message && message.includes('429 Too Many Requests')) {
387
- if (retryDelayOnRateLimitError < 0) {
388
- // rate limit error should not retried because of the setting
389
- throw error;
390
- }
391
- const delayMs = retryDelayOnRateLimitError * 1000;
392
- console.warn(`Received 429 (Too Many Requests). Retrying in ${retryDelayOnRateLimitError}s. Attempt ${i + 1} of ${maxRetriesOnErrors}.`);
393
- await (0, promise_util_1.wait)(delayMs);
394
- }
395
- else if (retryDelayOnOtherErrors < 0) {
396
- // Other errors should not retried because of the setting
397
- throw error;
398
- }
399
- else {
400
- const delayMs = retryDelayOnOtherErrors * 1000;
401
- console.warn(`Request failed: ${message}. Retrying in ${retryDelayOnOtherErrors}s. Attempt ${i + 1} of ${maxRetriesOnErrors}.`);
402
- await (0, promise_util_1.wait)(delayMs);
403
- }
404
- // -> reiterate the loop for the next attempt
405
- }
406
- }
407
- // This should not be reached
408
- throw new Error('Retry mechanism failed unexpectedly.');
409
- }
410
- }
411
- exports.GoogleModel = GoogleModel;
412
- //# sourceMappingURL=google-language-model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-language-model.js","sourceRoot":"","sources":["../../src/node/google-language-model.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;AAChF,6CAAkD;AAClD,4CAawB;AAExB,yCAA2J;AAC3J,sEAA2D;AAS3D,MAAM,oBAAoB,GAAG,CAAC,OAA6B,EAAsB,EAAE;IAC/E,IAAI,8BAAoB,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzE,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACpC,CAAC;SAAM,IAAI,8BAAoB,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;QACxD,OAAO,CAAC;gBACJ,YAAY,EAAE;oBACV,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAA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OAAO,GAAG,0BAA0B,GAAG,IAAI,CAAC;oBAClD,OAAO,CAAC,IAAI,CAAC,iDAAiD,0BAA0B,cAAc,CAAC,GAAG,CAAC,OAAO,kBAAkB,GAAG,CAAC,CAAC;oBACzI,MAAM,IAAA,mBAAI,EAAC,OAAO,CAAC,CAAC;gBACxB,CAAC;qBAAM,IAAI,uBAAuB,GAAG,CAAC,EAAE,CAAC;oBACrC,yDAAyD;oBACzD,MAAM,KAAK,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACJ,MAAM,OAAO,GAAG,uBAAuB,GAAG,IAAI,CAAC;oBAC/C,OAAO,CAAC,IAAI,CAAC,mBAAmB,OAAO,iBAAiB,uBAAuB,cAAc,CAAC,GAAG,CAAC,OAAO,kBAAkB,GAAG,CAAC,CAAC;oBAChI,MAAM,IAAA,mBAAI,EAAC,OAAO,CAAC,CAAC;gBACxB,CAAC;gBACD,6CAA6C;YACjD,CAAC;QACL,CAAC;QACD,6BAA6B;QAC7B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC5D,CAAC;CACJ;AA3VD,kCA2VC"}
@@ -1,22 +0,0 @@
1
- import { LanguageModelRegistry, LanguageModelStatus, TokenUsageService } from '@theia/ai-core';
2
- import { GoogleLanguageModelsManager, GoogleModelDescription } from '../common';
3
- export interface GoogleLanguageModelRetrySettings {
4
- maxRetriesOnErrors: number;
5
- retryDelayOnRateLimitError: number;
6
- retryDelayOnOtherErrors: number;
7
- }
8
- export declare class GoogleLanguageModelsManagerImpl implements GoogleLanguageModelsManager {
9
- protected _apiKey: string | undefined;
10
- protected retrySettings: GoogleLanguageModelRetrySettings;
11
- protected readonly languageModelRegistry: LanguageModelRegistry;
12
- protected readonly tokenUsageService: TokenUsageService;
13
- get apiKey(): string | undefined;
14
- protected calculateStatus(effectiveApiKey: string | undefined): LanguageModelStatus;
15
- createOrUpdateLanguageModels(...modelDescriptions: GoogleModelDescription[]): Promise<void>;
16
- removeLanguageModels(...modelIds: string[]): void;
17
- setApiKey(apiKey: string | undefined): void;
18
- setMaxRetriesOnErrors(maxRetries: number): void;
19
- setRetryDelayOnRateLimitError(retryDelay: number): void;
20
- setRetryDelayOnOtherErrors(retryDelay: number): void;
21
- }
22
- //# sourceMappingURL=google-language-models-manager-impl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-language-models-manager-impl.d.ts","sourceRoot":"","sources":["../../src/node/google-language-models-manager-impl.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAG/F,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEhF,MAAM,WAAW,gCAAgC;IAC7C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B,EAAE,MAAM,CAAC;IACnC,uBAAuB,EAAE,MAAM,CAAC;CACnC;AAED,qBACa,+BAAgC,YAAW,2BAA2B;IAC/E,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,aAAa,EAAE,gCAAgC,CAIvD;IAGF,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAGhE,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAExD,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED,SAAS,CAAC,eAAe,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB;IAM7E,4BAA4B,CAAC,GAAG,iBAAiB,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA6CjG,oBAAoB,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAIjD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAQ3C,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAI/C,6BAA6B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIvD,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;CAGvD"}
@@ -1,108 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2025 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.GoogleLanguageModelsManagerImpl = void 0;
19
- const tslib_1 = require("tslib");
20
- const ai_core_1 = require("@theia/ai-core");
21
- const inversify_1 = require("@theia/core/shared/inversify");
22
- const google_language_model_1 = require("./google-language-model");
23
- let GoogleLanguageModelsManagerImpl = class GoogleLanguageModelsManagerImpl {
24
- constructor() {
25
- this.retrySettings = {
26
- maxRetriesOnErrors: 3,
27
- retryDelayOnRateLimitError: 60,
28
- retryDelayOnOtherErrors: -1
29
- };
30
- }
31
- get apiKey() {
32
- var _a, _b;
33
- return (_b = (_a = this._apiKey) !== null && _a !== void 0 ? _a : process.env.GOOGLE_API_KEY) !== null && _b !== void 0 ? _b : process.env.GEMINI_API_KEY;
34
- }
35
- calculateStatus(effectiveApiKey) {
36
- return effectiveApiKey
37
- ? { status: 'ready' }
38
- : { status: 'unavailable', message: 'No Google API key set' };
39
- }
40
- async createOrUpdateLanguageModels(...modelDescriptions) {
41
- for (const modelDescription of modelDescriptions) {
42
- const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id);
43
- const apiKeyProvider = () => {
44
- if (modelDescription.apiKey === true) {
45
- return this.apiKey;
46
- }
47
- if (modelDescription.apiKey) {
48
- return modelDescription.apiKey;
49
- }
50
- return undefined;
51
- };
52
- const retrySettingsProvider = () => this.retrySettings;
53
- // Determine the effective API key for status
54
- const status = this.calculateStatus(apiKeyProvider());
55
- if (model) {
56
- if (!(model instanceof google_language_model_1.GoogleModel)) {
57
- console.warn(`Gemini: model ${modelDescription.id} is not a Gemini model`);
58
- continue;
59
- }
60
- await this.languageModelRegistry.patchLanguageModel(modelDescription.id, {
61
- model: modelDescription.model,
62
- enableStreaming: modelDescription.enableStreaming,
63
- apiKey: apiKeyProvider,
64
- retrySettings: retrySettingsProvider,
65
- status
66
- });
67
- }
68
- else {
69
- this.languageModelRegistry.addLanguageModels([
70
- new google_language_model_1.GoogleModel(modelDescription.id, modelDescription.model, status, modelDescription.enableStreaming, apiKeyProvider, retrySettingsProvider, this.tokenUsageService)
71
- ]);
72
- }
73
- }
74
- }
75
- removeLanguageModels(...modelIds) {
76
- this.languageModelRegistry.removeLanguageModels(modelIds);
77
- }
78
- setApiKey(apiKey) {
79
- if (apiKey) {
80
- this._apiKey = apiKey;
81
- }
82
- else {
83
- this._apiKey = undefined;
84
- }
85
- }
86
- setMaxRetriesOnErrors(maxRetries) {
87
- this.retrySettings.maxRetriesOnErrors = maxRetries;
88
- }
89
- setRetryDelayOnRateLimitError(retryDelay) {
90
- this.retrySettings.retryDelayOnRateLimitError = retryDelay;
91
- }
92
- setRetryDelayOnOtherErrors(retryDelay) {
93
- this.retrySettings.retryDelayOnOtherErrors = retryDelay;
94
- }
95
- };
96
- exports.GoogleLanguageModelsManagerImpl = GoogleLanguageModelsManagerImpl;
97
- tslib_1.__decorate([
98
- (0, inversify_1.inject)(ai_core_1.LanguageModelRegistry),
99
- tslib_1.__metadata("design:type", Object)
100
- ], GoogleLanguageModelsManagerImpl.prototype, "languageModelRegistry", void 0);
101
- tslib_1.__decorate([
102
- (0, inversify_1.inject)(ai_core_1.TokenUsageService),
103
- tslib_1.__metadata("design:type", Object)
104
- ], GoogleLanguageModelsManagerImpl.prototype, "tokenUsageService", void 0);
105
- exports.GoogleLanguageModelsManagerImpl = GoogleLanguageModelsManagerImpl = tslib_1.__decorate([
106
- (0, inversify_1.injectable)()
107
- ], GoogleLanguageModelsManagerImpl);
108
- //# sourceMappingURL=google-language-models-manager-impl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-language-models-manager-impl.js","sourceRoot":"","sources":["../../src/node/google-language-models-manager-impl.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,4CAA+F;AAC/F,4DAAkE;AAClE,mEAAsD;AAU/C,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;IAArC;QAEO,kBAAa,GAAqC;YACxD,kBAAkB,EAAE,CAAC;YACrB,0BAA0B,EAAE,EAAE;YAC9B,uBAAuB,EAAE,CAAC,CAAC;SAC9B,CAAC;IAsFN,CAAC;IA9EG,IAAI,MAAM;;QACN,OAAO,MAAA,MAAA,IAAI,CAAC,OAAO,mCAAI,OAAO,CAAC,GAAG,CAAC,cAAc,mCAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IACpF,CAAC;IAES,eAAe,CAAC,eAAmC;QACzD,OAAO,eAAe;YAClB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE;YACrB,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,4BAA4B,CAAC,GAAG,iBAA2C;QAC7E,KAAK,MAAM,gBAAgB,IAAI,iBAAiB,EAAE,CAAC;YAC/C,MAAM,KAAK,GAAG,MAAM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L,CAAC;IACL,CAAC;IAED,oBAAoB,CAAC,GAAG,QAAkB;QACtC,IAAI,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED,SAAS,CAAC,MAA0B;QAChC,IAAI,MAAM,EAAE,CAAC;YACT,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAC1B,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QAC7B,CAAC;IACL,CAAC;IAED,qBAAqB,CAAC,UAAkB;QACpC,IAAI,CAAC,aAAa,CAAC,kBAAkB,GAAG,UAAU,CAAC;IACvD,CAAC;IAED,6BAA6B,CAAC,UAAkB;QAC5C,IAAI,CAAC,aAAa,CAAC,0BAA0B,GAAG,UAAU,CAAC;IAC/D,CAAC;IAED,0BAA0B,CAAC,UAAkB;QACzC,IAAI,CAAC,aAAa,CAAC,uBAAuB,GAAG,UAAU,CAAC;IAC5D,CAAC;CACJ,CAAA;AA5FY,0EAA+B;AASrB;IADlB,IAAA,kBAAM,EAAC,+BAAqB,CAAC;;8EACkC;AAG7C;IADlB,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;0EAC8B;0CAZ/C,+BAA+B;IAD3C,IAAA,sBAAU,GAAE;GACA,+BAA+B,CA4F3C"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=package.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2025 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
- /* note: this bogus test file is required so that
17
- we are able to run mocha unit tests on this
18
- package, without having any actual unit tests in it.
19
- This way a coverage report will be generated,
20
- showing 0% coverage, instead of no report.
21
- This file can be removed once we have real unit
22
- tests in place. */
23
- describe('ai-google package', () => {
24
- it('support code coverage statistics', () => true);
25
- });
26
- //# sourceMappingURL=package.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oDAAoD;AACpD,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;;;;;;qBAMqB;AAErB,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAE/B,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}