New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@theia/ai-chat

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@theia/ai-chat - npm Package Compare versions

Comparing version

to
1.57.0-next.136

13

lib/browser/ai-chat-frontend-module.js

@@ -24,7 +24,4 @@ "use strict";

const chat_agents_variable_contribution_1 = require("../common/chat-agents-variable-contribution");
const command_chat_agents_1 = require("../common/command-chat-agents");
const custom_chat_agent_1 = require("../common/custom-chat-agent");
const orchestrator_chat_agent_1 = require("../common/orchestrator-chat-agent");
const response_content_matcher_1 = require("../common/response-content-matcher");
const universal_chat_agent_1 = require("../common/universal-chat-agent");
const ai_chat_preferences_1 = require("./ai-chat-preferences");

@@ -44,3 +41,2 @@ const change_set_file_element_1 = require("./change-set-file-element");

bind(common_2.ChatAgentService).toService(common_2.ChatAgentServiceImpl);
bind(common_2.DefaultChatAgentId).toConstantValue({ id: orchestrator_chat_agent_1.OrchestratorChatAgentId });
(0, core_1.bindContributionProvider)(bind, response_content_matcher_1.ResponseContentMatcherProvider);

@@ -55,11 +51,2 @@ bind(response_content_matcher_1.DefaultResponseContentMatcherProvider).toSelf().inSingletonScope();

bind(common_2.ChatService).toService(frontend_chat_service_1.FrontendChatServiceImpl);
bind(orchestrator_chat_agent_1.OrchestratorChatAgent).toSelf().inSingletonScope();
bind(common_1.Agent).toService(orchestrator_chat_agent_1.OrchestratorChatAgent);
bind(common_2.ChatAgent).toService(orchestrator_chat_agent_1.OrchestratorChatAgent);
bind(universal_chat_agent_1.UniversalChatAgent).toSelf().inSingletonScope();
bind(common_1.Agent).toService(universal_chat_agent_1.UniversalChatAgent);
bind(common_2.ChatAgent).toService(universal_chat_agent_1.UniversalChatAgent);
bind(command_chat_agents_1.CommandChatAgent).toSelf().inSingletonScope();
bind(common_1.Agent).toService(command_chat_agents_1.CommandChatAgent);
bind(common_2.ChatAgent).toService(command_chat_agents_1.CommandChatAgent);
bind(browser_1.PreferenceContribution).toConstantValue({ schema: ai_chat_preferences_1.aiChatPreferences });

@@ -66,0 +53,0 @@ bind(custom_chat_agent_1.CustomChatAgent).toSelf();

3

lib/browser/frontend-chat-service.d.ts
import { ChatAgent, ChatServiceImpl, ParsedChatRequest } from '../common';
import { PreferenceService } from '@theia/core/lib/browser';
/**
* Customizes the ChatServiceImpl to consider preference based default chat agent
*/
export declare class FrontendChatServiceImpl extends ChatServiceImpl {

@@ -4,0 +7,0 @@ protected preferenceService: PreferenceService;

@@ -24,27 +24,15 @@ "use strict";

const ai_chat_preferences_1 = require("./ai-chat-preferences");
/**
* Customizes the ChatServiceImpl to consider preference based default chat agent
*/
let FrontendChatServiceImpl = class FrontendChatServiceImpl extends common_1.ChatServiceImpl {
getAgent(parsedRequest) {
var _a;
const agentPart = this.getMentionedAgent(parsedRequest);
if (agentPart) {
return this.chatAgentService.getAgent(agentPart.agentId);
}
const configuredDefaultChatAgent = this.getConfiguredDefaultChatAgent();
if (configuredDefaultChatAgent) {
return configuredDefaultChatAgent;
}
if (this.defaultChatAgentId) {
const defaultAgent = this.chatAgentService.getAgent(this.defaultChatAgentId.id);
// the default agent could be disabled
if (defaultAgent) {
return defaultAgent;
if (!agentPart) {
const configuredDefaultChatAgent = this.getConfiguredDefaultChatAgent();
if (configuredDefaultChatAgent) {
return configuredDefaultChatAgent;
}
}
// check whether "Universal" is available
const universalAgent = this.chatAgentService.getAgent('Universal');
if (universalAgent) {
return universalAgent;
}
this.logger.warn('No default chat agent is configured or available and the "Universal" Chat Agent is unavailable too. Falling back to first registered agent.');
return (_a = this.chatAgentService.getAgents()[0]) !== null && _a !== void 0 ? _a : undefined;
return super.getAgent(parsedRequest);
}

@@ -51,0 +39,0 @@ getConfiguredDefaultChatAgent() {

@@ -36,2 +36,5 @@ import { ChatModel, ChatModelImpl, ChatRequest, ChatRequestModel, ChatResponseModel } from './chat-model';

}
/**
* The default chat agent to invoke
*/
export declare const DefaultChatAgentId: unique symbol;

@@ -41,2 +44,9 @@ export interface DefaultChatAgentId {

}
/**
* In case no fitting chat agent is available, this one will be used (if it is itself available)
*/
export declare const FallbackChatAgentId: unique symbol;
export interface FallbackChatAgentId {
id: string;
}
export declare const ChatService: unique symbol;

@@ -63,2 +73,3 @@ export interface ChatService {

protected defaultChatAgentId: DefaultChatAgentId | undefined;
protected fallbackChatAgentId: FallbackChatAgentId | undefined;
protected chatRequestParser: ChatRequestParser;

@@ -65,0 +76,0 @@ protected variableService: AIVariableService;

@@ -23,3 +23,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ChatServiceImpl = exports.ChatService = exports.DefaultChatAgentId = void 0;
exports.ChatServiceImpl = exports.ChatService = exports.FallbackChatAgentId = exports.DefaultChatAgentId = void 0;
const tslib_1 = require("tslib");

@@ -34,3 +34,10 @@ const inversify_1 = require("@theia/core/shared/inversify");

const ai_core_1 = require("@theia/ai-core");
/**
* The default chat agent to invoke
*/
exports.DefaultChatAgentId = Symbol('DefaultChatAgentId');
/**
* In case no fitting chat agent is available, this one will be used (if it is itself available)
*/
exports.FallbackChatAgentId = Symbol('FallbackChatAgentId');
exports.ChatService = Symbol('ChatService');

@@ -142,5 +149,13 @@ let ChatServiceImpl = class ChatServiceImpl {

}
let chatAgent = undefined;
if (this.defaultChatAgentId) {
return this.chatAgentService.getAgent(this.defaultChatAgentId.id);
chatAgent = this.chatAgentService.getAgent(this.defaultChatAgentId.id);
}
if (!chatAgent && this.fallbackChatAgentId) {
chatAgent = this.chatAgentService.getAgent(this.fallbackChatAgentId.id);
}
if (chatAgent) {
return chatAgent;
}
this.logger.warn('Neither the default chat agent nor the fallback chat agent are configured or available. Falling back to the first registered agent');
return (_a = this.chatAgentService.getAgents()[0]) !== null && _a !== void 0 ? _a : undefined;

@@ -171,2 +186,7 @@ }

tslib_1.__decorate([
(0, inversify_1.inject)(exports.FallbackChatAgentId),
(0, inversify_1.optional)(),
tslib_1.__metadata("design:type", Object)
], ChatServiceImpl.prototype, "fallbackChatAgentId", void 0);
tslib_1.__decorate([
(0, inversify_1.inject)(chat_request_parser_1.ChatRequestParser),

@@ -173,0 +193,0 @@ tslib_1.__metadata("design:type", Object)

@@ -7,7 +7,4 @@ export * from './chat-agents';

export * from './chat-service';
export * from './command-chat-agents';
export * from './custom-chat-agent';
export * from './parsed-chat-request';
export * from './orchestrator-chat-agent';
export * from './universal-chat-agent';
//# sourceMappingURL=index.d.ts.map

@@ -25,7 +25,4 @@ "use strict";

tslib_1.__exportStar(require("./chat-service"), exports);
tslib_1.__exportStar(require("./command-chat-agents"), exports);
tslib_1.__exportStar(require("./custom-chat-agent"), exports);
tslib_1.__exportStar(require("./parsed-chat-request"), exports);
tslib_1.__exportStar(require("./orchestrator-chat-agent"), exports);
tslib_1.__exportStar(require("./universal-chat-agent"), exports);
//# sourceMappingURL=index.js.map
{
"name": "@theia/ai-chat",
"version": "1.57.0-next.112+f4778c273",
"version": "1.57.0-next.136+9a2072774",
"description": "Theia - AI Chat Extension",
"dependencies": {
"@theia/ai-core": "1.57.0-next.112+f4778c273",
"@theia/ai-history": "1.57.0-next.112+f4778c273",
"@theia/core": "1.57.0-next.112+f4778c273",
"@theia/editor": "1.57.0-next.112+f4778c273",
"@theia/filesystem": "1.57.0-next.112+f4778c273",
"@theia/monaco": "1.57.0-next.112+f4778c273",
"@theia/workspace": "1.57.0-next.112+f4778c273",
"@theia/ai-core": "1.57.0-next.136+9a2072774",
"@theia/ai-history": "1.57.0-next.136+9a2072774",
"@theia/core": "1.57.0-next.136+9a2072774",
"@theia/editor": "1.57.0-next.136+9a2072774",
"@theia/filesystem": "1.57.0-next.136+9a2072774",
"@theia/monaco": "1.57.0-next.136+9a2072774",
"@theia/workspace": "1.57.0-next.136+9a2072774",
"minimatch": "^5.1.0",

@@ -55,3 +55,3 @@ "tslib": "^2.6.2"

},
"gitHead": "f4778c2737bb75613f0e1f99da8996bad91f6e17"
"gitHead": "9a20727743172a4efa46334f4136a1242b160848"
}

@@ -28,10 +28,6 @@ // *****************************************************************************

ChatService,
DefaultChatAgentId
} from '../common';
import { ChatAgentsVariableContribution } from '../common/chat-agents-variable-contribution';
import { CommandChatAgent } from '../common/command-chat-agents';
import { CustomChatAgent } from '../common/custom-chat-agent';
import { OrchestratorChatAgent, OrchestratorChatAgentId } from '../common/orchestrator-chat-agent';
import { DefaultResponseContentFactory, DefaultResponseContentMatcherProvider, ResponseContentMatcherProvider } from '../common/response-content-matcher';
import { UniversalChatAgent } from '../common/universal-chat-agent';
import { aiChatPreferences } from './ai-chat-preferences';

@@ -54,3 +50,2 @@ import { ChangeSetElementArgs, ChangeSetFileElement, ChangeSetFileElementFactory } from './change-set-file-element';

bind(ChatAgentService).toService(ChatAgentServiceImpl);
bind(DefaultChatAgentId).toConstantValue({ id: OrchestratorChatAgentId });

@@ -70,14 +65,2 @@ bindContributionProvider(bind, ResponseContentMatcherProvider);

bind(OrchestratorChatAgent).toSelf().inSingletonScope();
bind(Agent).toService(OrchestratorChatAgent);
bind(ChatAgent).toService(OrchestratorChatAgent);
bind(UniversalChatAgent).toSelf().inSingletonScope();
bind(Agent).toService(UniversalChatAgent);
bind(ChatAgent).toService(UniversalChatAgent);
bind(CommandChatAgent).toSelf().inSingletonScope();
bind(Agent).toService(CommandChatAgent);
bind(ChatAgent).toService(CommandChatAgent);
bind(PreferenceContribution).toConstantValue({ schema: aiChatPreferences });

@@ -84,0 +67,0 @@

@@ -22,2 +22,5 @@ // *****************************************************************************

/**
* Customizes the ChatServiceImpl to consider preference based default chat agent
*/
@injectable()

@@ -31,28 +34,9 @@ export class FrontendChatServiceImpl extends ChatServiceImpl {

const agentPart = this.getMentionedAgent(parsedRequest);
if (agentPart) {
return this.chatAgentService.getAgent(agentPart.agentId);
}
const configuredDefaultChatAgent = this.getConfiguredDefaultChatAgent();
if (configuredDefaultChatAgent) {
return configuredDefaultChatAgent;
}
if (this.defaultChatAgentId) {
const defaultAgent = this.chatAgentService.getAgent(this.defaultChatAgentId.id);
// the default agent could be disabled
if (defaultAgent) {
return defaultAgent;
if (!agentPart) {
const configuredDefaultChatAgent = this.getConfiguredDefaultChatAgent();
if (configuredDefaultChatAgent) {
return configuredDefaultChatAgent;
}
}
// check whether "Universal" is available
const universalAgent = this.chatAgentService.getAgent('Universal');
if (universalAgent) {
return universalAgent;
}
this.logger.warn('No default chat agent is configured or available and the "Universal" Chat Agent is unavailable too. Falling back to first registered agent.');
return this.chatAgentService.getAgents()[0] ?? undefined;
return super.getAgent(parsedRequest);
}

@@ -59,0 +43,0 @@

@@ -70,2 +70,5 @@ // *****************************************************************************

/**
* The default chat agent to invoke
*/
export const DefaultChatAgentId = Symbol('DefaultChatAgentId');

@@ -76,2 +79,10 @@ export interface DefaultChatAgentId {

/**
* In case no fitting chat agent is available, this one will be used (if it is itself available)
*/
export const FallbackChatAgentId = Symbol('FallbackChatAgentId');
export interface FallbackChatAgentId {
id: string;
}
export const ChatService = Symbol('ChatService');

@@ -113,2 +124,5 @@ export interface ChatService {

@inject(FallbackChatAgentId) @optional()
protected fallbackChatAgentId: FallbackChatAgentId | undefined;
@inject(ChatRequestParser)

@@ -239,5 +253,13 @@ protected chatRequestParser: ChatRequestParser;

}
let chatAgent = undefined;
if (this.defaultChatAgentId) {
return this.chatAgentService.getAgent(this.defaultChatAgentId.id);
chatAgent = this.chatAgentService.getAgent(this.defaultChatAgentId.id);
}
if (!chatAgent && this.fallbackChatAgentId) {
chatAgent = this.chatAgentService.getAgent(this.fallbackChatAgentId.id);
}
if (chatAgent) {
return chatAgent;
}
this.logger.warn('Neither the default chat agent nor the fallback chat agent are configured or available. Falling back to the first registered agent');
return this.chatAgentService.getAgents()[0] ?? undefined;

@@ -244,0 +266,0 @@ }

@@ -22,6 +22,3 @@ // *****************************************************************************

export * from './chat-service';
export * from './command-chat-agents';
export * from './custom-chat-agent';
export * from './parsed-chat-request';
export * from './orchestrator-chat-agent';
export * from './universal-chat-agent';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet