@theia/ai-chat 1.73.0-next.39 → 1.73.0-next.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"ai-chat-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-chat-frontend-module.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA2D/D,wBA+HG"}
1
+ {"version":3,"file":"ai-chat-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-chat-frontend-module.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA2D/D,wBAkIG"}
@@ -93,12 +93,13 @@ exports.default = new inversify_1.ContainerModule(bind => {
93
93
  bind(chat_tool_preference_bindings_1.ToolConfirmationManager).toSelf().inSingletonScope();
94
94
  bind(pending_tool_confirmation_tracker_1.PendingToolConfirmationTracker).toSelf().inSingletonScope();
95
95
  bind(custom_chat_agent_1.CustomChatAgent).toSelf();
96
- bind(custom_agent_factory_1.CustomAgentFactory).toFactory(ctx => (id, name, description, prompt, defaultLLM, showInChat) => {
96
+ bind(custom_agent_factory_1.CustomAgentFactory).toFactory(ctx => (id, name, description, prompt, defaultLLM, showInChat, promptVariants) => {
97
97
  const agent = ctx.container.get(custom_chat_agent_1.CustomChatAgent);
98
98
  agent.id = id;
99
99
  agent.name = name;
100
100
  agent.description = description;
101
101
  agent.prompt = prompt;
102
+ agent.promptVariants = promptVariants;
102
103
  agent.languageModelRequirements = [{
103
104
  purpose: 'chat',
104
105
  identifier: defaultLLM,
@@ -116,7 +117,9 @@ exports.default = new inversify_1.ContainerModule(bind => {
116
117
  }
117
118
  return agent;
118
119
  });
119
- bind(browser_1.FrontendApplicationContribution).to(custom_agent_frontend_application_contribution_1.AICustomAgentsFrontendApplicationContribution).inSingletonScope();
120
+ bind(custom_agent_frontend_application_contribution_1.AICustomAgentsFrontendApplicationContribution).toSelf().inSingletonScope();
121
+ bind(browser_1.FrontendApplicationContribution).toService(custom_agent_frontend_application_contribution_1.AICustomAgentsFrontendApplicationContribution);
122
+ bind(core_1.CommandContribution).toService(custom_agent_frontend_application_contribution_1.AICustomAgentsFrontendApplicationContribution);
120
123
  bind(context_variable_label_provider_1.ContextVariableLabelProvider).toSelf().inSingletonScope();
121
124
  bind(browser_1.LabelProviderContribution).toService(context_variable_label_provider_1.ContextVariableLabelProvider);
122
125
  bind(context_file_variable_label_provider_1.ContextFileVariableLabelProvider).toSelf().inSingletonScope();
@@ -1 +1 @@
1
- {"version":3,"file":"ai-chat-frontend-module.js","sourceRoot":"","sources":["../../src/browser/ai-chat-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,sDAA6H;AAC7H,sCAAwG;AACxG,qDAAqG;AACrG,4DAA+D;AAC/D,sCAWmB;AACnB,mGAA6F;AAC7F,mEAA8D;AAC9D,iFAA0J;AAC1J,uEAAkE;AAClE,uEAAoH;AACpH,qHAAiH;AACjH,mEAAkE;AAClE,iEAA4D;AAC5D,mFAA6E;AAC7E,2EAA6E;AAC7E,uEAAiE;AACjE,uFAAiF;AACjF,iGAA0F;AAC1F,uFAAiF;AACjF,iFAAwF;AACxF,iFAAwF;AACxF,+DAAsE;AACtE,uFAAyG;AACzG,iFAA+F;AAC/F,qFAA+E;AAC/E,6FAAuF;AACvF,iGAA0F;AAC1F,iEAAuF;AACvF,iFAA4E;AAC5E,mFAA6E;AAC7E,+FAAyF;AACzF,qEAA6F;AAC7F,mEAA8D;AAC9D,mFAA0E;AAC1E,2EAA0E;AAC1E,2FAAqF;AACrF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ptVariant } from '@theia/ai-core';
1
2
  import { CustomChatAgent } from '../common';
2
3
  export declare const CustomAgentFactory: unique symbol;
3
- export type CustomAgentFactory = (id: string, name: string, description: string, prompt: string, defaultLLM: string, showInChat?: boolean) => CustomChatAgent;
4
+ export type CustomAgentFactory = (id: string, name: string, description: string, prompt: string, defaultLLM: string, showInChat?: boolean, promptVariants?: CustomAgentPromptVariant[]) => CustomChatAgent;
4
5
  //# sourceMappingURL=custom-agent-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-agent-factory.d.ts","sourceRoot":"","sources":["../../src/browser/custom-agent-factory.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,KAAK,eAAe,CAAC"}
1
+ {"version":3,"file":"custom-agent-factory.d.ts","sourceRoot":"","sources":["../../src/browser/custom-agent-factory.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,CAC7B,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,OAAO,EACpB,cAAc,CAAC,EAAE,wBAAwB,EAAE,KAC1C,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"custom-agent-factory.js","sourceRoot":"","sources":["../../src/browser/custom-agent-factory.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;;;AAInE,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"custom-agent-factory.js","sourceRoot":"","sources":["../../src/browser/custom-agent-factory.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;;;AAKnE,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
@@ -1,15 +1,19 @@
1
1
  import { PromptFragmentCustomizationService } from '@theia/ai-core';
2
+ import { Command, CommandContribution, CommandRegistry, ILogger, MessageService } from '@theia/core';
2
3
  import { FrontendApplicationContribution } from '@theia/core/lib/browser';
3
4
  import { CustomAgentFactory } from './custom-agent-factory';
4
- import { ILogger } from '@theia/core';
5
- export declare class AICustomAgentsFrontendApplicationContribution implements FrontendApplicationContribution {
5
+ export declare const RERUN_CUSTOM_AGENT_MIGRATION_COMMAND: Command;
6
+ export declare class AICustomAgentsFrontendApplicationContribution implements FrontendApplicationContribution, CommandContribution {
6
7
  protected readonly customAgentFactory: CustomAgentFactory;
7
8
  protected readonly customizationService: PromptFragmentCustomizationService;
8
9
  private readonly agentService;
9
10
  private readonly chatAgentService;
11
+ protected readonly messageService?: MessageService;
10
12
  protected readonly logger: ILogger;
11
13
  private knownCustomAgents;
14
+ registerCommands(commands: CommandRegistry): void;
12
15
  onStart(): void;
16
+ protected refreshCustomAgents(): Promise<void>;
13
17
  onStop(): void;
14
18
  }
15
19
  //# sourceMappingURL=custom-agent-frontend-application-contribution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-agent-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/custom-agent-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAwC,kCAAkC,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,qBACa,6CAA8C,YAAW,+BAA+B;IAEjG,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAG1D,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,kCAAkC,CAAC;IAG5E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAG5C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IAGpD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnC,OAAO,CAAC,iBAAiB,CAAkD;IAC3E,OAAO,IAAI,IAAI;IAiCf,MAAM,IAAI,IAAI;CAEjB"}
1
+ {"version":3,"file":"custom-agent-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/custom-agent-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAwC,kCAAkC,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAO,MAAM,aAAa,CAAC;AAC1G,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,eAAO,MAAM,oCAAoC,EAAE,OAQlD,CAAC;AAEF,qBACa,6CAA8C,YAAW,+BAA+B,EAAE,mBAAmB;IAEtH,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAG1D,SAAS,CAAC,QAAQ,CAAC,oBAAoB,EAAE,kCAAkC,CAAC;IAG5E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAG5C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IAGpD,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IAGnD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEnC,OAAO,CAAC,iBAAiB,CAAkD;IAE3E,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAoBjD,OAAO,IAAI,IAAI;cAKC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgCpD,MAAM,IAAI,IAAI;CAEjB"}
@@ -15,44 +15,69 @@
15
15
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
16
  // *****************************************************************************
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.AICustomAgentsFrontendApplicationContribution = void 0;
18
+ exports.AICustomAgentsFrontendApplicationContribution = exports.RERUN_CUSTOM_AGENT_MIGRATION_COMMAND = void 0;
19
19
  const tslib_1 = require("tslib");
20
20
  const ai_core_1 = require("@theia/ai-core");
21
+ const core_1 = require("@theia/core");
21
22
  const inversify_1 = require("@theia/core/shared/inversify");
22
23
  const common_1 = require("../common");
23
24
  const custom_agent_factory_1 = require("./custom-agent-factory");
24
- const core_1 = require("@theia/core");
25
+ exports.RERUN_CUSTOM_AGENT_MIGRATION_COMMAND = core_1.Command.toLocalizedCommand({
26
+ id: 'ai-chat.customAgents.rerunMigration',
27
+ label: 'Re-run custom-agent migration',
28
+ category: 'AI'
29
+ }, 'theia/ai/chat/customAgents/rerunMigration', 'theia/ai/chat/category');
25
30
  let AICustomAgentsFrontendApplicationContribution = class AICustomAgentsFrontendApplicationContribution {
26
31
  constructor() {
27
32
  this.knownCustomAgents = new Map();
28
33
  }
34
+ registerCommands(commands) {
35
+ commands.registerCommand(exports.RERUN_CUSTOM_AGENT_MIGRATION_COMMAND, {
36
+ isEnabled: () => !!this.customizationService,
37
+ execute: async () => {
38
+ if (!this.customizationService) {
39
+ return;
40
+ }
41
+ const reports = await this.customizationService.migrateCustomAgentsYaml();
42
+ const migrated = reports.reduce((sum, r) => sum + r.migrated, 0);
43
+ const failed = reports.reduce((sum, r) => sum + r.failed, 0);
44
+ const backedUp = reports.filter(r => r.yamlBackedUp).length;
45
+ const overrides = reports.reduce((sum, r) => sum + r.promptOverridesMigrated, 0);
46
+ const message = core_1.nls.localize('theia/ai/chat/customAgents/migrationResult', 'Custom-agent migration: {0} migrated, {1} failed, {2} legacy customAgents.yml backed up to .bak, {3} prompt overrides folded into agent.md.', migrated, failed, backedUp, overrides);
47
+ this.messageService?.info(message);
48
+ }
49
+ });
50
+ }
29
51
  onStart() {
30
- this.customizationService?.getCustomAgents().then(customAgents => {
31
- customAgents.forEach(agent => {
32
- this.customAgentFactory(agent.id, agent.name, agent.description, agent.prompt, agent.defaultLLM, agent.showInChat);
33
- this.knownCustomAgents.set(agent.id, agent);
34
- });
35
- }).catch(e => {
36
- this.logger.error('Failed to load custom agents', e);
52
+ this.customizationService?.onDidChangeCustomAgents(() => this.refreshCustomAgents());
53
+ this.refreshCustomAgents().catch(e => this.logger.error('Failed to load custom agents', e));
54
+ }
55
+ async refreshCustomAgents() {
56
+ if (!this.customizationService) {
57
+ return;
58
+ }
59
+ // Migration must run on the refresh path (not just at onStart) because the workspace's
60
+ // additional template directories are populated asynchronously by TemplatePreferenceContribution
61
+ // after preferences/workspace/trust are ready. Migration is idempotent: if a customAgents.yml has
62
+ // already been migrated (or never existed), the call is a no-op.
63
+ try {
64
+ await this.customizationService.migrateCustomAgentsYaml();
65
+ }
66
+ catch (e) {
67
+ this.logger.warn('Custom-agent auto-migration failed; continuing without migration', e);
68
+ }
69
+ const customAgents = await this.customizationService.getCustomAgents();
70
+ const customAgentsToAdd = customAgents.filter(agent => !this.knownCustomAgents.has(agent.id) || !ai_core_1.CustomAgentDescription.equals(this.knownCustomAgents.get(agent.id), agent));
71
+ const customAgentIdsToRemove = [...this.knownCustomAgents.values()].filter(agent => !customAgents.find(a => ai_core_1.CustomAgentDescription.equals(a, agent))).map(a => a.id);
72
+ // delete first so we don't have to deal with the case where we add and remove the same agentId
73
+ customAgentIdsToRemove.forEach(id => {
74
+ this.chatAgentService.unregisterChatAgent(id);
75
+ this.agentService.unregisterAgent(id);
76
+ this.knownCustomAgents.delete(id);
37
77
  });
38
- this.customizationService?.onDidChangeCustomAgents(() => {
39
- this.customizationService?.getCustomAgents().then(customAgents => {
40
- const customAgentsToAdd = customAgents.filter(agent => !this.knownCustomAgents.has(agent.id) || !ai_core_1.CustomAgentDescription.equals(this.knownCustomAgents.get(agent.id), agent));
41
- const customAgentIdsToRemove = [...this.knownCustomAgents.values()].filter(agent => !customAgents.find(a => ai_core_1.CustomAgentDescription.equals(a, agent))).map(a => a.id);
42
- // delete first so we don't have to deal with the case where we add and remove the same agentId
43
- customAgentIdsToRemove.forEach(id => {
44
- this.chatAgentService.unregisterChatAgent(id);
45
- this.agentService.unregisterAgent(id);
46
- this.knownCustomAgents.delete(id);
47
- });
48
- customAgentsToAdd
49
- .forEach(agent => {
50
- this.customAgentFactory(agent.id, agent.name, agent.description, agent.prompt, agent.defaultLLM, agent.showInChat);
51
- this.knownCustomAgents.set(agent.id, agent);
52
- });
53
- }).catch(e => {
54
- this.logger.error('Failed to load custom agents', e);
55
- });
78
+ customAgentsToAdd.forEach(agent => {
79
+ this.customAgentFactory(agent.id, agent.name, agent.description, agent.prompt, agent.defaultLLM, agent.showInChat, agent.promptVariants);
80
+ this.knownCustomAgents.set(agent.id, agent);
56
81
  });
57
82
  }
58
83
  onStop() {
@@ -76,6 +101,11 @@ tslib_1.__decorate([
76
101
  (0, inversify_1.inject)(common_1.ChatAgentService),
77
102
  tslib_1.__metadata("design:type", Object)
78
103
  ], AICustomAgentsFrontendApplicationContribution.prototype, "chatAgentService", void 0);
104
+ tslib_1.__decorate([
105
+ (0, inversify_1.inject)(core_1.MessageService),
106
+ (0, inversify_1.optional)(),
107
+ tslib_1.__metadata("design:type", core_1.MessageService)
108
+ ], AICustomAgentsFrontendApplicationContribution.prototype, "messageService", void 0);
79
109
  tslib_1.__decorate([
80
110
  (0, inversify_1.inject)(core_1.ILogger),
81
111
  (0, inversify_1.named)('ai-chat:AICustomAgentsFrontendApplicationContribution'),
@@ -1 +1 @@
1
- {"version":3,"file":"custom-agent-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/custom-agent-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;;;;AAEhF,4CAA0G;AAE1G,4DAAmF;AACnF,sCAA6C;AAC7C,iEAA4D;AAC5D,sCAAsC;AAG/B,IAAM,6CAA6C,GAAnD,MAAM,6CAA6C;IAAnD;QAgBK,sBAAiB,GAAwC,IAAI,GAAG,EAAE,CAAC;IAoC/E,CAAC;IAnCG,OAAO;QACH,IAAI,CAAC,oBAAoB,EAAE,eAAe,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;YAC7D,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACzB,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAA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CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBACtC,CAAC,CAAC,CAAC;gBACH,iBAAiB;qBACZ,OAAO,CAAC,KAAK,CAAC,EAAE;oBACb,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;oBACnH,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;gBAChD,CAAC,CAAC,CAAC;YACX,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;gBACT,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM;IACN,CAAC;CACJ,CAAA;AApDY,sGAA6C;AAEnC;IADlB,IAAA,kBAAM,EAAC,yCAAkB,CAAC;;yFAC+B;AAGvC;IADlB,IAAA,kBAAM,EAAC,4CAAkC,CAAC;IAAE,IAAA,oBAAQ,GAAE;;2FACqB;AAG3D;IADhB,IAAA,kBAAM,EAAC,sBAAY,CAAC;;mFACuB;AAG3B;IADhB,IAAA,kBAAM,EAAC,yBAAgB,CAAC;;uFAC2B;AAGjC;IADlB,IAAA,kBAAM,EAAC,cAAO,CAAC;IAAE,IAAA,iBAAK,EAAC,uDAAuD,CAAC;;6EAC7C;wDAd1B,6CAA6C;IADzD,IAAA,sBAAU,GAAE;GACA,6CAA6C,CAoDzD"}
1
+ {"version":3,"file":"custom-agent-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/custom-agent-frontend-application-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAA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,yCAAkB,CAAC;;yFAC+B;AAGvC;IADlB,IAAA,kBAAM,EAAC,4CAAkC,CAAC;IAAE,IAAA,oBAAQ,GAAE;;2FACqB;AAG3D;IADhB,IAAA,kBAAM,EAAC,sBAAY,CAAC;;mFACuB;AAG3B;IADhB,IAAA,kBAAM,EAAC,yBAAgB,CAAC;;uFAC2B;AAGjC;IADlB,IAAA,kBAAM,EAAC,qBAAc,CAAC;IAAE,IAAA,oBAAQ,GAAE;sCACC,qBAAc;qFAAC;AAGhC;IADlB,IAAA,kBAAM,EAAC,cAAO,CAAC;IAAE,IAAA,iBAAK,EAAC,uDAAuD,CAAC;;6EAC7C;wDAjB1B,6CAA6C;IADzD,IAAA,sBAAU,GAAE;GACA,6CAA6C,CAgFzD"}
@@ -1,4 +1,4 @@
1
- import { LanguageModelRequirement } from '@theia/ai-core';
1
+ import { CustomAgentPromptVariant, LanguageModelRequirement } from '@theia/ai-core';
2
2
  import { AbstractStreamParsingChatAgent } from './chat-agents';
3
3
  export declare class CustomChatAgent extends AbstractStreamParsingChatAgent {
4
4
  id: string;
@@ -6,5 +6,12 @@ export declare class CustomChatAgent extends AbstractStreamParsingChatAgent {
6
6
  languageModelRequirements: LanguageModelRequirement[];
7
7
  protected defaultLanguageModelPurpose: string;
8
8
  set prompt(prompt: string);
9
+ /**
10
+ * Replace the variants of this agent's prompt set with the given list. Must be called
11
+ * AFTER {@link prompt} has been set, since it mutates the most recently pushed prompt set.
12
+ * Each entry becomes an additional variant of the default prompt; the variant id is used
13
+ * verbatim as the fragment id.
14
+ */
15
+ set promptVariants(variants: CustomAgentPromptVariant[] | undefined);
9
16
  }
10
17
  //# sourceMappingURL=custom-chat-agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/custom-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAG/D,qBACa,eAAgB,SAAQ,8BAA8B;IAC/D,EAAE,EAAE,MAAM,CAAqB;IAC/B,IAAI,EAAE,MAAM,CAAqB;IACjC,yBAAyB,EAAE,wBAAwB,EAAE,CAAyB;IAC9E,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAU;IAEvD,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAIxB;CACJ"}
1
+ {"version":3,"file":"custom-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/custom-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAG/D,qBACa,eAAgB,SAAQ,8BAA8B;IAC/D,EAAE,EAAE,MAAM,CAAqB;IAC/B,IAAI,EAAE,MAAM,CAAqB;IACjC,yBAAyB,EAAE,wBAAwB,EAAE,CAAyB;IAC9E,SAAS,CAAC,2BAA2B,EAAE,MAAM,CAAU;IAEvD,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAIxB;IAED;;;;;OAKG;IACH,IAAI,cAAc,CAAC,QAAQ,EAAE,wBAAwB,EAAE,GAAG,SAAS,EASlE;CACJ"}
@@ -28,10 +28,26 @@ let CustomChatAgent = class CustomChatAgent extends chat_agents_1.AbstractStream
28
28
  this.defaultLanguageModelPurpose = 'chat';
29
29
  }
30
30
  set prompt(prompt) {
31
- // the name is dynamic, so we set the propmptId here
31
+ // the name is dynamic, so we set the promptId here
32
32
  this.systemPromptId = `${this.name}_prompt`;
33
33
  this.prompts.push({ id: this.systemPromptId, defaultVariant: { id: `${this.name}_prompt`, template: prompt } });
34
34
  }
35
+ /**
36
+ * Replace the variants of this agent's prompt set with the given list. Must be called
37
+ * AFTER {@link prompt} has been set, since it mutates the most recently pushed prompt set.
38
+ * Each entry becomes an additional variant of the default prompt; the variant id is used
39
+ * verbatim as the fragment id.
40
+ */
41
+ set promptVariants(variants) {
42
+ if (!variants || variants.length === 0) {
43
+ return;
44
+ }
45
+ const promptSet = this.prompts[this.prompts.length - 1];
46
+ if (!promptSet) {
47
+ return;
48
+ }
49
+ promptSet.variants = variants.map(v => ({ id: v.id, template: v.template }));
50
+ }
35
51
  };
36
52
  exports.CustomChatAgent = CustomChatAgent;
37
53
  exports.CustomChatAgent = CustomChatAgent = tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"custom-chat-agent.js","sourceRoot":"","sources":["../../src/common/custom-chat-agent.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,+CAA+D;AAC/D,4DAA0D;AAGnD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,4CAA8B;IAA5D;;QACH,OAAE,GAAW,iBAAiB,CAAC;QAC/B,SAAI,GAAW,iBAAiB,CAAC;QACjC,8BAAyB,GAA+B,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACpE,gCAA2B,GAAW,MAAM,CAAC;IAO3D,CAAC;IALG,IAAI,MAAM,CAAC,MAAc;QACrB,oDAAoD;QACpD,IAAI,CAAC,cAAc,GAAG,GAAG,IAAI,CAAC,IAAI,SAAS,CAAC;QAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACpH,CAAC;CACJ,CAAA;AAXY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAA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,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACjF,CAAC;CACJ,CAAA;AA5BY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CA4B3B"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@theia/ai-chat",
3
- "version": "1.73.0-next.39+b8afaa0a7",
3
+ "version": "1.73.0-next.43+39d328622",
4
4
  "description": "Theia - AI Chat Extension",
5
5
  "dependencies": {
6
- "@theia/ai-core": "1.73.0-next.39+b8afaa0a7",
7
- "@theia/core": "1.73.0-next.39+b8afaa0a7",
8
- "@theia/editor": "1.73.0-next.39+b8afaa0a7",
9
- "@theia/file-search": "1.73.0-next.39+b8afaa0a7",
10
- "@theia/filesystem": "1.73.0-next.39+b8afaa0a7",
11
- "@theia/monaco": "1.73.0-next.39+b8afaa0a7",
6
+ "@theia/ai-core": "1.73.0-next.43+39d328622",
7
+ "@theia/core": "1.73.0-next.43+39d328622",
8
+ "@theia/editor": "1.73.0-next.43+39d328622",
9
+ "@theia/file-search": "1.73.0-next.43+39d328622",
10
+ "@theia/filesystem": "1.73.0-next.43+39d328622",
11
+ "@theia/monaco": "1.73.0-next.43+39d328622",
12
12
  "@theia/monaco-editor-core": "1.108.201",
13
- "@theia/workspace": "1.73.0-next.39+b8afaa0a7",
13
+ "@theia/workspace": "1.73.0-next.43+39d328622",
14
14
  "js-yaml": "^4.2.0",
15
15
  "tslib": "^2.8.1"
16
16
  },
@@ -54,5 +54,5 @@
54
54
  "nyc": {
55
55
  "extends": "../../configs/nyc.json"
56
56
  },
57
- "gitHead": "b8afaa0a7ec19427b14ca23df2da2a81bddedbfc"
57
+ "gitHead": "39d328622a0c2226daec3d331dfc18dd5c3eebde"
58
58
  }
@@ -14,7 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { Agent, AgentService, AISettingsService, AIVariableContribution, bindToolProvider } from '@theia/ai-core/lib/common';
17
+ import { Agent, AgentService, AISettingsService, AIVariableContribution, bindToolProvider, CustomAgentPromptVariant } from '@theia/ai-core/lib/common';
18
18
  import { bindRootContributionProvider, CommandContribution, PreferenceContribution } from '@theia/core';
19
19
  import { FrontendApplicationContribution, LabelProviderContribution } from '@theia/core/lib/browser';
20
20
  import { ContainerModule } from '@theia/core/shared/inversify';
@@ -131,13 +131,14 @@ export default new ContainerModule(bind => {
131
131
  bind(PendingToolConfirmationTracker).toSelf().inSingletonScope();
132
132
 
133
133
  bind(CustomChatAgent).toSelf();
134
- bind(CustomAgentFactory).toFactory<CustomChatAgent, [string, string, string, string, string, boolean | undefined]>(
135
- ctx => (id: string, name: string, description: string, prompt: string, defaultLLM: string, showInChat?: boolean) => {
134
+ bind(CustomAgentFactory).toFactory<CustomChatAgent, [string, string, string, string, string, boolean | undefined, CustomAgentPromptVariant[] | undefined]>(
135
+ ctx => (id, name, description, prompt, defaultLLM, showInChat, promptVariants) => {
136
136
  const agent = ctx.container.get<CustomChatAgent>(CustomChatAgent);
137
137
  agent.id = id;
138
138
  agent.name = name;
139
139
  agent.description = description;
140
140
  agent.prompt = prompt;
141
+ agent.promptVariants = promptVariants;
141
142
  agent.languageModelRequirements = [{
142
143
  purpose: 'chat',
143
144
  identifier: defaultLLM,
@@ -157,7 +158,9 @@ export default new ContainerModule(bind => {
157
158
 
158
159
  return agent;
159
160
  });
160
- bind(FrontendApplicationContribution).to(AICustomAgentsFrontendApplicationContribution).inSingletonScope();
161
+ bind(AICustomAgentsFrontendApplicationContribution).toSelf().inSingletonScope();
162
+ bind(FrontendApplicationContribution).toService(AICustomAgentsFrontendApplicationContribution);
163
+ bind(CommandContribution).toService(AICustomAgentsFrontendApplicationContribution);
161
164
 
162
165
  bind(ContextVariableLabelProvider).toSelf().inSingletonScope();
163
166
  bind(LabelProviderContribution).toService(ContextVariableLabelProvider);
@@ -14,7 +14,16 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
+ import { CustomAgentPromptVariant } from '@theia/ai-core';
17
18
  import { CustomChatAgent } from '../common';
18
19
 
19
20
  export const CustomAgentFactory = Symbol('CustomAgentFactory');
20
- export type CustomAgentFactory = (id: string, name: string, description: string, prompt: string, defaultLLM: string, showInChat?: boolean) => CustomChatAgent;
21
+ export type CustomAgentFactory = (
22
+ id: string,
23
+ name: string,
24
+ description: string,
25
+ prompt: string,
26
+ defaultLLM: string,
27
+ showInChat?: boolean,
28
+ promptVariants?: CustomAgentPromptVariant[]
29
+ ) => CustomChatAgent;
@@ -15,14 +15,24 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { AgentService, CustomAgentDescription, PromptFragmentCustomizationService } from '@theia/ai-core';
18
+ import { Command, CommandContribution, CommandRegistry, ILogger, MessageService, nls } from '@theia/core';
18
19
  import { FrontendApplicationContribution } from '@theia/core/lib/browser';
19
20
  import { inject, injectable, optional, named } from '@theia/core/shared/inversify';
20
21
  import { ChatAgentService } from '../common';
21
22
  import { CustomAgentFactory } from './custom-agent-factory';
22
- import { ILogger } from '@theia/core';
23
+
24
+ export const RERUN_CUSTOM_AGENT_MIGRATION_COMMAND: Command = Command.toLocalizedCommand(
25
+ {
26
+ id: 'ai-chat.customAgents.rerunMigration',
27
+ label: 'Re-run custom-agent migration',
28
+ category: 'AI'
29
+ },
30
+ 'theia/ai/chat/customAgents/rerunMigration',
31
+ 'theia/ai/chat/category'
32
+ );
23
33
 
24
34
  @injectable()
25
- export class AICustomAgentsFrontendApplicationContribution implements FrontendApplicationContribution {
35
+ export class AICustomAgentsFrontendApplicationContribution implements FrontendApplicationContribution, CommandContribution {
26
36
  @inject(CustomAgentFactory)
27
37
  protected readonly customAgentFactory: CustomAgentFactory;
28
38
 
@@ -35,40 +45,68 @@ export class AICustomAgentsFrontendApplicationContribution implements FrontendAp
35
45
  @inject(ChatAgentService)
36
46
  private readonly chatAgentService: ChatAgentService;
37
47
 
48
+ @inject(MessageService) @optional()
49
+ protected readonly messageService?: MessageService;
50
+
38
51
  @inject(ILogger) @named('ai-chat:AICustomAgentsFrontendApplicationContribution')
39
52
  protected readonly logger: ILogger;
40
53
 
41
54
  private knownCustomAgents: Map<string, CustomAgentDescription> = new Map();
42
- onStart(): void {
43
- this.customizationService?.getCustomAgents().then(customAgents => {
44
- customAgents.forEach(agent => {
45
- this.customAgentFactory(agent.id, agent.name, agent.description, agent.prompt, agent.defaultLLM, agent.showInChat);
46
- this.knownCustomAgents.set(agent.id, agent);
47
- });
48
- }).catch(e => {
49
- this.logger.error('Failed to load custom agents', e);
55
+
56
+ registerCommands(commands: CommandRegistry): void {
57
+ commands.registerCommand(RERUN_CUSTOM_AGENT_MIGRATION_COMMAND, {
58
+ isEnabled: () => !!this.customizationService,
59
+ execute: async () => {
60
+ if (!this.customizationService) { return; }
61
+ const reports = await this.customizationService.migrateCustomAgentsYaml();
62
+ const migrated = reports.reduce((sum, r) => sum + r.migrated, 0);
63
+ const failed = reports.reduce((sum, r) => sum + r.failed, 0);
64
+ const backedUp = reports.filter(r => r.yamlBackedUp).length;
65
+ const overrides = reports.reduce((sum, r) => sum + r.promptOverridesMigrated, 0);
66
+ const message = nls.localize(
67
+ 'theia/ai/chat/customAgents/migrationResult',
68
+ 'Custom-agent migration: {0} migrated, {1} failed, {2} legacy customAgents.yml backed up to .bak, {3} prompt overrides folded into agent.md.',
69
+ migrated, failed, backedUp, overrides
70
+ );
71
+ this.messageService?.info(message);
72
+ }
50
73
  });
51
- this.customizationService?.onDidChangeCustomAgents(() => {
52
- this.customizationService?.getCustomAgents().then(customAgents => {
53
- const customAgentsToAdd = customAgents.filter(agent =>
54
- !this.knownCustomAgents.has(agent.id) || !CustomAgentDescription.equals(this.knownCustomAgents.get(agent.id)!, agent));
55
- const customAgentIdsToRemove = [...this.knownCustomAgents.values()].filter(agent =>
56
- !customAgents.find(a => CustomAgentDescription.equals(a, agent))).map(a => a.id);
74
+ }
57
75
 
58
- // delete first so we don't have to deal with the case where we add and remove the same agentId
59
- customAgentIdsToRemove.forEach(id => {
60
- this.chatAgentService.unregisterChatAgent(id);
61
- this.agentService.unregisterAgent(id);
62
- this.knownCustomAgents.delete(id);
63
- });
64
- customAgentsToAdd
65
- .forEach(agent => {
66
- this.customAgentFactory(agent.id, agent.name, agent.description, agent.prompt, agent.defaultLLM, agent.showInChat);
67
- this.knownCustomAgents.set(agent.id, agent);
68
- });
69
- }).catch(e => {
70
- this.logger.error('Failed to load custom agents', e);
71
- });
76
+ onStart(): void {
77
+ this.customizationService?.onDidChangeCustomAgents(() => this.refreshCustomAgents());
78
+ this.refreshCustomAgents().catch(e => this.logger.error('Failed to load custom agents', e));
79
+ }
80
+
81
+ protected async refreshCustomAgents(): Promise<void> {
82
+ if (!this.customizationService) {
83
+ return;
84
+ }
85
+ // Migration must run on the refresh path (not just at onStart) because the workspace's
86
+ // additional template directories are populated asynchronously by TemplatePreferenceContribution
87
+ // after preferences/workspace/trust are ready. Migration is idempotent: if a customAgents.yml has
88
+ // already been migrated (or never existed), the call is a no-op.
89
+ try {
90
+ await this.customizationService.migrateCustomAgentsYaml();
91
+ } catch (e) {
92
+ this.logger.warn('Custom-agent auto-migration failed; continuing without migration', e);
93
+ }
94
+
95
+ const customAgents = await this.customizationService.getCustomAgents();
96
+ const customAgentsToAdd = customAgents.filter(agent =>
97
+ !this.knownCustomAgents.has(agent.id) || !CustomAgentDescription.equals(this.knownCustomAgents.get(agent.id)!, agent));
98
+ const customAgentIdsToRemove = [...this.knownCustomAgents.values()].filter(agent =>
99
+ !customAgents.find(a => CustomAgentDescription.equals(a, agent))).map(a => a.id);
100
+
101
+ // delete first so we don't have to deal with the case where we add and remove the same agentId
102
+ customAgentIdsToRemove.forEach(id => {
103
+ this.chatAgentService.unregisterChatAgent(id);
104
+ this.agentService.unregisterAgent(id);
105
+ this.knownCustomAgents.delete(id);
106
+ });
107
+ customAgentsToAdd.forEach(agent => {
108
+ this.customAgentFactory(agent.id, agent.name, agent.description, agent.prompt, agent.defaultLLM, agent.showInChat, agent.promptVariants);
109
+ this.knownCustomAgents.set(agent.id, agent);
72
110
  });
73
111
  }
74
112
 
@@ -14,7 +14,7 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { LanguageModelRequirement } from '@theia/ai-core';
17
+ import { CustomAgentPromptVariant, LanguageModelRequirement } from '@theia/ai-core';
18
18
  import { AbstractStreamParsingChatAgent } from './chat-agents';
19
19
  import { injectable } from '@theia/core/shared/inversify';
20
20
 
@@ -26,8 +26,25 @@ export class CustomChatAgent extends AbstractStreamParsingChatAgent {
26
26
  protected defaultLanguageModelPurpose: string = 'chat';
27
27
 
28
28
  set prompt(prompt: string) {
29
- // the name is dynamic, so we set the propmptId here
29
+ // the name is dynamic, so we set the promptId here
30
30
  this.systemPromptId = `${this.name}_prompt`;
31
31
  this.prompts.push({ id: this.systemPromptId, defaultVariant: { id: `${this.name}_prompt`, template: prompt } });
32
32
  }
33
+
34
+ /**
35
+ * Replace the variants of this agent's prompt set with the given list. Must be called
36
+ * AFTER {@link prompt} has been set, since it mutates the most recently pushed prompt set.
37
+ * Each entry becomes an additional variant of the default prompt; the variant id is used
38
+ * verbatim as the fragment id.
39
+ */
40
+ set promptVariants(variants: CustomAgentPromptVariant[] | undefined) {
41
+ if (!variants || variants.length === 0) {
42
+ return;
43
+ }
44
+ const promptSet = this.prompts[this.prompts.length - 1];
45
+ if (!promptSet) {
46
+ return;
47
+ }
48
+ promptSet.variants = variants.map(v => ({ id: v.id, template: v.template }));
49
+ }
33
50
  }