@theia/ai-chat 1.46.0-next.241

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 (122) hide show
  1. package/README.md +31 -0
  2. package/lib/browser/ai-chat-frontend-module.d.ts +4 -0
  3. package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -0
  4. package/lib/browser/ai-chat-frontend-module.js +79 -0
  5. package/lib/browser/ai-chat-frontend-module.js.map +1 -0
  6. package/lib/browser/ai-chat-preferences.d.ts +4 -0
  7. package/lib/browser/ai-chat-preferences.d.ts.map +1 -0
  8. package/lib/browser/ai-chat-preferences.js +32 -0
  9. package/lib/browser/ai-chat-preferences.js.map +1 -0
  10. package/lib/browser/custom-agent-factory.d.ts +4 -0
  11. package/lib/browser/custom-agent-factory.d.ts.map +1 -0
  12. package/lib/browser/custom-agent-factory.js +20 -0
  13. package/lib/browser/custom-agent-factory.js.map +1 -0
  14. package/lib/browser/custom-agent-frontend-application-contribution.d.ts +13 -0
  15. package/lib/browser/custom-agent-frontend-application-contribution.d.ts.map +1 -0
  16. package/lib/browser/custom-agent-frontend-application-contribution.js +82 -0
  17. package/lib/browser/custom-agent-frontend-application-contribution.js.map +1 -0
  18. package/lib/browser/frontend-chat-service.d.ts +8 -0
  19. package/lib/browser/frontend-chat-service.d.ts.map +1 -0
  20. package/lib/browser/frontend-chat-service.js +67 -0
  21. package/lib/browser/frontend-chat-service.js.map +1 -0
  22. package/lib/common/chat-agent-service.d.ts +45 -0
  23. package/lib/common/chat-agent-service.d.ts.map +1 -0
  24. package/lib/common/chat-agent-service.js +78 -0
  25. package/lib/common/chat-agent-service.js.map +1 -0
  26. package/lib/common/chat-agents-variable-contribution.d.ts +17 -0
  27. package/lib/common/chat-agents-variable-contribution.d.ts.map +1 -0
  28. package/lib/common/chat-agents-variable-contribution.js +51 -0
  29. package/lib/common/chat-agents-variable-contribution.js.map +1 -0
  30. package/lib/common/chat-agents.d.ts +108 -0
  31. package/lib/common/chat-agents.d.ts.map +1 -0
  32. package/lib/common/chat-agents.js +321 -0
  33. package/lib/common/chat-agents.js.map +1 -0
  34. package/lib/common/chat-history-entry.d.ts +7 -0
  35. package/lib/common/chat-history-entry.d.ts.map +1 -0
  36. package/lib/common/chat-history-entry.js +42 -0
  37. package/lib/common/chat-history-entry.js.map +1 -0
  38. package/lib/common/chat-model-util.d.ts +7 -0
  39. package/lib/common/chat-model-util.d.ts.map +1 -0
  40. package/lib/common/chat-model-util.js +50 -0
  41. package/lib/common/chat-model-util.js.map +1 -0
  42. package/lib/common/chat-model.d.ts +393 -0
  43. package/lib/common/chat-model.d.ts.map +1 -0
  44. package/lib/common/chat-model.js +612 -0
  45. package/lib/common/chat-model.js.map +1 -0
  46. package/lib/common/chat-request-parser.d.ts +20 -0
  47. package/lib/common/chat-request-parser.d.ts.map +1 -0
  48. package/lib/common/chat-request-parser.js +158 -0
  49. package/lib/common/chat-request-parser.js.map +1 -0
  50. package/lib/common/chat-request-parser.spec.d.ts +2 -0
  51. package/lib/common/chat-request-parser.spec.d.ts.map +1 -0
  52. package/lib/common/chat-request-parser.spec.js +108 -0
  53. package/lib/common/chat-request-parser.spec.js.map +1 -0
  54. package/lib/common/chat-service.d.ts +72 -0
  55. package/lib/common/chat-service.d.ts.map +1 -0
  56. package/lib/common/chat-service.js +170 -0
  57. package/lib/common/chat-service.js.map +1 -0
  58. package/lib/common/command-chat-agents.d.ts +33 -0
  59. package/lib/common/command-chat-agents.d.ts.map +1 -0
  60. package/lib/common/command-chat-agents.js +329 -0
  61. package/lib/common/command-chat-agents.js.map +1 -0
  62. package/lib/common/custom-chat-agent.d.ts +14 -0
  63. package/lib/common/custom-chat-agent.d.ts.map +1 -0
  64. package/lib/common/custom-chat-agent.js +43 -0
  65. package/lib/common/custom-chat-agent.js.map +1 -0
  66. package/lib/common/index.d.ts +12 -0
  67. package/lib/common/index.d.ts.map +1 -0
  68. package/lib/common/index.js +30 -0
  69. package/lib/common/index.js.map +1 -0
  70. package/lib/common/o1-chat-agent.d.ts +13 -0
  71. package/lib/common/o1-chat-agent.d.ts.map +1 -0
  72. package/lib/common/o1-chat-agent.js +45 -0
  73. package/lib/common/o1-chat-agent.js.map +1 -0
  74. package/lib/common/orchestrator-chat-agent.d.ts +22 -0
  75. package/lib/common/orchestrator-chat-agent.d.ts.map +1 -0
  76. package/lib/common/orchestrator-chat-agent.js +167 -0
  77. package/lib/common/orchestrator-chat-agent.js.map +1 -0
  78. package/lib/common/parse-contents.d.ts +11 -0
  79. package/lib/common/parse-contents.d.ts.map +1 -0
  80. package/lib/common/parse-contents.js +67 -0
  81. package/lib/common/parse-contents.js.map +1 -0
  82. package/lib/common/parse-contents.spec.d.ts +9 -0
  83. package/lib/common/parse-contents.spec.d.ts.map +1 -0
  84. package/lib/common/parse-contents.spec.js +134 -0
  85. package/lib/common/parse-contents.spec.js.map +1 -0
  86. package/lib/common/parsed-chat-request.d.ts +66 -0
  87. package/lib/common/parsed-chat-request.d.ts.map +1 -0
  88. package/lib/common/parsed-chat-request.js +83 -0
  89. package/lib/common/parsed-chat-request.js.map +1 -0
  90. package/lib/common/response-content-matcher.d.ts +63 -0
  91. package/lib/common/response-content-matcher.d.ts.map +1 -0
  92. package/lib/common/response-content-matcher.js +86 -0
  93. package/lib/common/response-content-matcher.js.map +1 -0
  94. package/lib/common/universal-chat-agent.d.ts +16 -0
  95. package/lib/common/universal-chat-agent.d.ts.map +1 -0
  96. package/lib/common/universal-chat-agent.js +109 -0
  97. package/lib/common/universal-chat-agent.js.map +1 -0
  98. package/package.json +54 -0
  99. package/src/browser/ai-chat-frontend-module.ts +98 -0
  100. package/src/browser/ai-chat-preferences.ts +32 -0
  101. package/src/browser/custom-agent-factory.ts +20 -0
  102. package/src/browser/custom-agent-frontend-application-contribution.ts +73 -0
  103. package/src/browser/frontend-chat-service.ts +66 -0
  104. package/src/common/chat-agent-service.ts +100 -0
  105. package/src/common/chat-agents-variable-contribution.ts +81 -0
  106. package/src/common/chat-agents.ts +392 -0
  107. package/src/common/chat-history-entry.ts +47 -0
  108. package/src/common/chat-model-util.ts +44 -0
  109. package/src/common/chat-model.ts +889 -0
  110. package/src/common/chat-request-parser.spec.ts +120 -0
  111. package/src/common/chat-request-parser.ts +220 -0
  112. package/src/common/chat-service.ts +236 -0
  113. package/src/common/command-chat-agents.ts +354 -0
  114. package/src/common/custom-chat-agent.ts +44 -0
  115. package/src/common/index.ts +26 -0
  116. package/src/common/o1-chat-agent.ts +51 -0
  117. package/src/common/orchestrator-chat-agent.ts +179 -0
  118. package/src/common/parse-contents.spec.ts +144 -0
  119. package/src/common/parse-contents.ts +93 -0
  120. package/src/common/parsed-chat-request.ts +112 -0
  121. package/src/common/response-content-matcher.ts +103 -0
  122. package/src/common/universal-chat-agent.ts +117 -0
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2024 EclipseSource GmbH.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.OrchestratorChatAgent = exports.OrchestratorChatAgentId = exports.orchestratorTemplate = 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 chat_agent_service_1 = require("./chat-agent-service");
23
+ const chat_agents_1 = require("./chat-agents");
24
+ const chat_model_1 = require("./chat-model");
25
+ const core_1 = require("@theia/core");
26
+ const chat_history_entry_1 = require("./chat-history-entry");
27
+ exports.orchestratorTemplate = {
28
+ id: 'orchestrator-system',
29
+ template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
30
+ https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
31
+ # Instructions
32
+
33
+ Your task is to identify which Chat Agent(s) should best reply a given user's message.
34
+ You consider all messages of the conversation to ensure consistency and avoid agent switches without a clear context change.
35
+ You should select the best Chat Agent based on the name and description of the agents, matching them to the user message.
36
+
37
+ ## Constraints
38
+
39
+ Your response must be a JSON array containing the id(s) of the selected Chat Agent(s).
40
+
41
+ * Do not use ids that are not provided in the list below.
42
+ * Do not include any additional information, explanations, or questions for the user.
43
+ * If there is no suitable choice, pick \`Universal\`.
44
+ * If there are multiple good choices, return all of them.
45
+
46
+ Unless there is a more specific agent available, select \`Universal\`, especially for general programming-related questions.
47
+ You must only use the \`id\` attribute of the agent, never the name.
48
+
49
+ ### Example Results
50
+
51
+ \`\`\`json
52
+ ["Universal"]
53
+ \`\`\`
54
+
55
+ \`\`\`json
56
+ ["AnotherChatAgent", "Universal"]
57
+ \`\`\`
58
+
59
+ ## List of Currently Available Chat Agents
60
+
61
+ {{chatAgents}}
62
+ `
63
+ };
64
+ exports.OrchestratorChatAgentId = 'Orchestrator';
65
+ const OrchestratorRequestIdKey = 'orchestatorRequestIdKey';
66
+ let OrchestratorChatAgent = class OrchestratorChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
67
+ constructor() {
68
+ super(exports.OrchestratorChatAgentId, [{
69
+ purpose: 'agent-selection',
70
+ identifier: 'openai/gpt-4o',
71
+ }], 'agent-selection', 'codicon codicon-symbol-boolean', undefined, undefined, false);
72
+ this.functions = [];
73
+ this.agentSpecificVariables = [];
74
+ this.name = exports.OrchestratorChatAgentId;
75
+ this.description = 'This agent analyzes the user request against the description of all available chat agents and selects the best fitting agent to answer the request \
76
+ (by using AI).The user\'s request will be directly delegated to the selected agent without further confirmation.';
77
+ this.variables = ['chatAgents'];
78
+ this.promptTemplates = [exports.orchestratorTemplate];
79
+ this.fallBackChatAgentId = 'Universal';
80
+ this.functions = [];
81
+ this.agentSpecificVariables = [];
82
+ }
83
+ async invoke(request) {
84
+ var _a;
85
+ request.response.addProgressMessage({ content: 'Determining the most appropriate agent', status: 'inProgress' });
86
+ // We generate a dedicated ID for recording the orchestrator request/response, as we will forward the original request to another agent
87
+ const orchestratorRequestId = (0, core_1.generateUuid)();
88
+ request.addData(OrchestratorRequestIdKey, orchestratorRequestId);
89
+ const messages = await this.getMessages(request.session);
90
+ const systemMessage = (_a = (await this.getSystemMessageDescription())) === null || _a === void 0 ? void 0 : _a.text;
91
+ this.recordingService.recordRequest(chat_history_entry_1.ChatHistoryEntry.fromRequest(this.id, request, {
92
+ requestId: orchestratorRequestId,
93
+ messages,
94
+ systemMessage
95
+ }));
96
+ return super.invoke(request);
97
+ }
98
+ async getSystemMessageDescription() {
99
+ const resolvedPrompt = await this.promptService.getPrompt(exports.orchestratorTemplate.id);
100
+ return resolvedPrompt ? chat_agents_1.SystemMessageDescription.fromResolvedPromptTemplate(resolvedPrompt) : undefined;
101
+ }
102
+ async addContentsToResponse(response, request) {
103
+ var _a;
104
+ let agentIds = [];
105
+ const responseText = await (0, ai_core_1.getTextOfResponse)(response);
106
+ // We use the previously generated, dedicated ID to log the orchestrator response before we forward the original request
107
+ const orchestratorRequestId = request.getDataByKey(OrchestratorRequestIdKey);
108
+ if (typeof orchestratorRequestId === 'string') {
109
+ this.recordingService.recordResponse({
110
+ agentId: this.id,
111
+ sessionId: request.session.id,
112
+ requestId: orchestratorRequestId,
113
+ response: responseText,
114
+ });
115
+ }
116
+ try {
117
+ const jsonResponse = await (0, ai_core_1.getJsonOfText)(responseText);
118
+ if (Array.isArray(jsonResponse)) {
119
+ agentIds = jsonResponse.filter((id) => id !== this.id);
120
+ }
121
+ }
122
+ catch (error) {
123
+ // The llm sometimes does not return a parseable result
124
+ this.logger.error('Failed to parse JSON response', error);
125
+ }
126
+ if (agentIds.length < 1) {
127
+ this.logger.error('No agent was selected, delegating to fallback chat agent');
128
+ request.response.progressMessages.forEach(progressMessage => request.response.updateProgressMessage({ ...progressMessage, status: 'failed' }));
129
+ agentIds = [this.fallBackChatAgentId];
130
+ }
131
+ // check if selected (or fallback) agent exists
132
+ if (!this.chatAgentService.getAgent(agentIds[0])) {
133
+ this.logger.error(`Chat agent ${agentIds[0]} not found. Falling back to first registered agent.`);
134
+ const firstRegisteredAgent = (_a = this.chatAgentService.getAgents().filter(a => a.id !== this.id)[0]) === null || _a === void 0 ? void 0 : _a.id;
135
+ if (firstRegisteredAgent) {
136
+ agentIds = [firstRegisteredAgent];
137
+ }
138
+ else {
139
+ throw new Error('No chat agent available to handle request. Please check your configuration whether any are enabled.');
140
+ }
141
+ }
142
+ // TODO support delegating to more than one agent
143
+ const delegatedToAgent = agentIds[0];
144
+ request.response.response.addContent(new chat_model_1.InformationalChatResponseContentImpl(`*Orchestrator*: Delegating to \`@${delegatedToAgent}\`
145
+
146
+ ---
147
+
148
+ `));
149
+ request.response.overrideAgentId(delegatedToAgent);
150
+ request.response.progressMessages.forEach(progressMessage => request.response.updateProgressMessage({ ...progressMessage, status: 'completed' }));
151
+ const agent = this.chatAgentService.getAgent(delegatedToAgent);
152
+ if (!agent) {
153
+ throw new Error(`Chat agent ${delegatedToAgent} not found.`);
154
+ }
155
+ await agent.invoke(request);
156
+ }
157
+ };
158
+ exports.OrchestratorChatAgent = OrchestratorChatAgent;
159
+ tslib_1.__decorate([
160
+ (0, inversify_1.inject)(chat_agent_service_1.ChatAgentService),
161
+ tslib_1.__metadata("design:type", Object)
162
+ ], OrchestratorChatAgent.prototype, "chatAgentService", void 0);
163
+ exports.OrchestratorChatAgent = OrchestratorChatAgent = tslib_1.__decorate([
164
+ (0, inversify_1.injectable)(),
165
+ tslib_1.__metadata("design:paramtypes", [])
166
+ ], OrchestratorChatAgent);
167
+ //# sourceMappingURL=orchestrator-chat-agent.js.map
@@ -0,0 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B;gCAzBpC,qBAAqB;IADjC,IAAA,sBAAU,GAAE;;GACA,qBAAqB,CA8GjC"}
@@ -0,0 +1,11 @@
1
+ import { ChatRequestModelImpl, ChatResponseContent } from './chat-model';
2
+ import { ResponseContentFactory, ResponseContentMatcher } from './response-content-matcher';
3
+ interface Match {
4
+ matcher: ResponseContentMatcher;
5
+ index: number;
6
+ content: string;
7
+ }
8
+ export declare function parseContents(text: string, request: ChatRequestModelImpl, contentMatchers?: ResponseContentMatcher[], defaultContentFactory?: ResponseContentFactory): ChatResponseContent[];
9
+ export declare function findFirstMatch(contentMatchers: ResponseContentMatcher[], text: string): Match | undefined;
10
+ export {};
11
+ //# sourceMappingURL=parse-contents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-contents.d.ts","sourceRoot":"","sources":["../../src/common/parse-contents.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAA8C,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAExI,UAAU,KAAK;IACX,OAAO,EAAE,sBAAsB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,aAAa,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,eAAe,GAAE,sBAAsB,EAAyB,EAChE,qBAAqB,GAAE,sBAA+C,GACvE,mBAAmB,EAAE,CA8BvB;AAED,wBAAgB,cAAc,CAAC,eAAe,EAAE,sBAAsB,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CA8BzG"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findFirstMatch = exports.parseContents = void 0;
4
+ const response_content_matcher_1 = require("./response-content-matcher");
5
+ function parseContents(text, request, contentMatchers = [response_content_matcher_1.CodeContentMatcher], defaultContentFactory = response_content_matcher_1.MarkdownContentFactory) {
6
+ const result = [];
7
+ let currentIndex = 0;
8
+ while (currentIndex < text.length) {
9
+ const remainingText = text.substring(currentIndex);
10
+ const match = findFirstMatch(contentMatchers, remainingText);
11
+ if (!match) {
12
+ // Add the remaining text as default content
13
+ if (remainingText.length > 0) {
14
+ result.push(defaultContentFactory(remainingText, request));
15
+ }
16
+ break;
17
+ }
18
+ // We have a match
19
+ // 1. Add preceding text as default content
20
+ if (match.index > 0) {
21
+ const precedingContent = remainingText.substring(0, match.index);
22
+ if (precedingContent.trim().length > 0) {
23
+ result.push(defaultContentFactory(precedingContent, request));
24
+ }
25
+ }
26
+ // 2. Add the matched content object
27
+ result.push(match.matcher.contentFactory(match.content, request));
28
+ // Update currentIndex to the end of the end of the match
29
+ // And continue with the search after the end of the match
30
+ currentIndex += match.index + match.content.length;
31
+ }
32
+ return result;
33
+ }
34
+ exports.parseContents = parseContents;
35
+ function findFirstMatch(contentMatchers, text) {
36
+ let firstMatch;
37
+ for (const matcher of contentMatchers) {
38
+ const startMatch = matcher.start.exec(text);
39
+ if (!startMatch) {
40
+ // No start match found, try next matcher.
41
+ continue;
42
+ }
43
+ const endOfStartMatch = startMatch.index + startMatch[0].length;
44
+ if (endOfStartMatch >= text.length) {
45
+ // There is no text after the start match.
46
+ // No need to search for the end match yet, try next matcher.
47
+ continue;
48
+ }
49
+ const remainingTextAfterStartMatch = text.substring(endOfStartMatch);
50
+ const endMatch = matcher.end.exec(remainingTextAfterStartMatch);
51
+ if (!endMatch) {
52
+ // No end match found, try next matcher.
53
+ continue;
54
+ }
55
+ // Found start and end match.
56
+ // Record the full match, if it is the earliest found so far.
57
+ const index = startMatch.index;
58
+ const contentEnd = index + startMatch[0].length + endMatch.index + endMatch[0].length;
59
+ const content = text.substring(index, contentEnd);
60
+ if (!firstMatch || index < firstMatch.index) {
61
+ firstMatch = { matcher, index, content };
62
+ }
63
+ }
64
+ return firstMatch;
65
+ }
66
+ exports.findFirstMatch = findFirstMatch;
67
+ //# sourceMappingURL=parse-contents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-contents.js","sourceRoot":"","sources":["../../src/common/parse-contents.ts"],"names":[],"mappings":";;;AAgBA,yEAAwI;AAQxI,SAAgB,aAAa,CACzB,IAAY,EACZ,OAA6B,EAC7B,kBAA4C,CAAC,6CAAkB,CAAC,EAChE,wBAAgD,iDAAsB;IAEtE,MAAM,MAAM,GAA0B,EAAE,CAAC;IAEzC,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,OAAO,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,cAAc,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,4CAA4C;YAC5C,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;YAC/D,CAAC;YACD,MAAM;QACV,CAAC;QACD,kBAAkB;QAClB,2CAA2C;QAC3C,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,gBAAgB,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YACjE,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;YAClE,CAAC;QACL,CAAC;QACD,oCAAoC;QACpC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,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EAAE,CAAC;YAC1C,UAAU,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QAC7C,CAAC;IACL,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC;AA9BD,wCA8BC"}
@@ -0,0 +1,9 @@
1
+ import { ChatResponseContent } from './chat-model';
2
+ import { ResponseContentMatcher } from './response-content-matcher';
3
+ export declare class CommandChatResponseContentImpl implements ChatResponseContent {
4
+ readonly command: string;
5
+ constructor(command: string);
6
+ kind: string;
7
+ }
8
+ export declare const CommandContentMatcher: ResponseContentMatcher;
9
+ //# sourceMappingURL=parse-contents.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-contents.spec.d.ts","sourceRoot":"","sources":["../../src/common/parse-contents.spec.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAwB,mBAAmB,EAAgE,MAAM,cAAc,CAAC;AAEvI,OAAO,EAAsB,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAExF,qBAAa,8BAA+B,YAAW,mBAAmB;aAC1C,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;IAC3C,IAAI,SAAa;CACpB;AAED,eAAO,MAAM,qBAAqB,EAAE,sBAOnC,CAAC"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2024 EclipseSource GmbH.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.CommandContentMatcher = exports.CommandChatResponseContentImpl = void 0;
19
+ const chai_1 = require("chai");
20
+ const chat_model_1 = require("./chat-model");
21
+ const parse_contents_1 = require("./parse-contents");
22
+ const response_content_matcher_1 = require("./response-content-matcher");
23
+ class CommandChatResponseContentImpl {
24
+ constructor(command) {
25
+ this.command = command;
26
+ this.kind = 'command';
27
+ }
28
+ }
29
+ exports.CommandChatResponseContentImpl = CommandChatResponseContentImpl;
30
+ exports.CommandContentMatcher = {
31
+ start: /^<command>$/m,
32
+ end: /^<\/command>$/m,
33
+ contentFactory: (content) => {
34
+ const code = content.replace(/^<command>\n|<\/command>$/g, '');
35
+ return new CommandChatResponseContentImpl(code.trim());
36
+ }
37
+ };
38
+ const fakeRequest = {};
39
+ describe('parseContents', () => {
40
+ it('should parse code content', () => {
41
+ const text = '```typescript\nconsole.log("Hello World");\n```';
42
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
43
+ (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript')]);
44
+ });
45
+ it('should parse markdown content', () => {
46
+ const text = 'Hello **World**';
47
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
48
+ (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('Hello **World**')]);
49
+ });
50
+ it('should parse multiple content blocks', () => {
51
+ const text = '```typescript\nconsole.log("Hello World");\n```\nHello **World**';
52
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
53
+ (0, chai_1.expect)(result).to.deep.equal([
54
+ new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
55
+ new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**')
56
+ ]);
57
+ });
58
+ it('should parse multiple content blocks with different languages', () => {
59
+ const text = '```typescript\nconsole.log("Hello World");\n```\n```python\nprint("Hello World")\n```';
60
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
61
+ (0, chai_1.expect)(result).to.deep.equal([
62
+ new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
63
+ new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python')
64
+ ]);
65
+ });
66
+ it('should parse multiple content blocks with different languages and markdown', () => {
67
+ const text = '```typescript\nconsole.log("Hello World");\n```\nHello **World**\n```python\nprint("Hello World")\n```';
68
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
69
+ (0, chai_1.expect)(result).to.deep.equal([
70
+ new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
71
+ new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
72
+ new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python')
73
+ ]);
74
+ });
75
+ it('should parse content blocks with empty content', () => {
76
+ const text = '```typescript\n```\nHello **World**\n```python\nprint("Hello World")\n```';
77
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
78
+ (0, chai_1.expect)(result).to.deep.equal([
79
+ new chat_model_1.CodeChatResponseContentImpl('', 'typescript'),
80
+ new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
81
+ new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python')
82
+ ]);
83
+ });
84
+ it('should parse content with markdown, code, and markdown', () => {
85
+ const text = 'Hello **World**\n```typescript\nconsole.log("Hello World");\n```\nGoodbye **World**';
86
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
87
+ (0, chai_1.expect)(result).to.deep.equal([
88
+ new chat_model_1.MarkdownChatResponseContentImpl('Hello **World**\n'),
89
+ new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
90
+ new chat_model_1.MarkdownChatResponseContentImpl('\nGoodbye **World**')
91
+ ]);
92
+ });
93
+ it('should handle text with no special content', () => {
94
+ const text = 'Just some plain text.';
95
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
96
+ (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('Just some plain text.')]);
97
+ });
98
+ it('should handle text with only start code block', () => {
99
+ const text = '```typescript\nconsole.log("Hello World");';
100
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
101
+ (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('```typescript\nconsole.log("Hello World");')]);
102
+ });
103
+ it('should handle text with only end code block', () => {
104
+ const text = 'console.log("Hello World");\n```';
105
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
106
+ (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('console.log("Hello World");\n```')]);
107
+ });
108
+ it('should handle text with unmatched code block', () => {
109
+ const text = '```typescript\nconsole.log("Hello World");\n```\n```python\nprint("Hello World")';
110
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
111
+ (0, chai_1.expect)(result).to.deep.equal([
112
+ new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
113
+ new chat_model_1.MarkdownChatResponseContentImpl('\n```python\nprint("Hello World")')
114
+ ]);
115
+ });
116
+ it('should parse code block without newline after language', () => {
117
+ const text = '```typescript console.log("Hello World");```';
118
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
119
+ (0, chai_1.expect)(result).to.deep.equal([
120
+ new chat_model_1.MarkdownChatResponseContentImpl('```typescript console.log("Hello World");```')
121
+ ]);
122
+ });
123
+ it('should parse with matches of multiple different matchers and default', () => {
124
+ const text = '<command>\nMY_SPECIAL_COMMAND\n</command>\nHello **World**\n```python\nprint("Hello World")\n```\n<command>\nMY_SPECIAL_COMMAND2\n</command>';
125
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [response_content_matcher_1.CodeContentMatcher, exports.CommandContentMatcher]);
126
+ (0, chai_1.expect)(result).to.deep.equal([
127
+ new CommandChatResponseContentImpl('MY_SPECIAL_COMMAND'),
128
+ new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
129
+ new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python'),
130
+ new CommandChatResponseContentImpl('MY_SPECIAL_COMMAND2'),
131
+ ]);
132
+ });
133
+ });
134
+ //# sourceMappingURL=parse-contents.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-contents.spec.js","sourceRoot":"","sources":["../../src/common/parse-contents.spec.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,+BAA8B;AAC9B,6CAAuI;AACvI,qDAAiD;AACjD,yEAAwF;AAExF,MAAa,8BAA8B;IACvC,YAA4B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAC3C,SAAI,GAAG,SAAS,CAAC;IAD8B,CAAC;CAEnD;AAHD,wEAGC;AAEY,QAAA,qBAAqB,GAA2B;IACzD,KAAK,EAAE,cAAc;IACrB,GAAG,EAAE,gBAAgB;IACrB,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE;QAChC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,4BAA4B,EAAE,EAAE,CAAC,CAAC;QAC/D,OAAO,IAAI,8BAA8B,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;CACJ,CAAC;AAEF,MAAM,WAAW,GAAG,EAA0B,CAAC;AAE/C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACjC,MAAM,IAAI,GAAG,iDAAiD,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAChD,IAAA,aAAM,EAAC,MAAM,CAA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BAA6B,EAAE,YAAY,CAAC;YAC5E,IAAI,4CAA+B,CAAC,mCAAmC,CAAC;SAC3E,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAC9D,MAAM,IAAI,GAAG,8CAA8C,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAChD,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,4CAA+B,CAAC,8CAA8C,CAAC;SACtF,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC5E,MAAM,IAAI,GAAG,8IAA8I,CAAC;QAC5J,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC,6CAAkB,EAAE,6BAAqB,CAAC,CAAC,CAAC;QAC7F,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,8BAA8B,CAAC,oBAAoB,CAAC;YACxD,IAAI,4CAA+B,CAAC,qBAAqB,CAAC;YAC1D,IAAI,wCAA2B,CAAC,sBAAsB,EAAE,QAAQ,CAAC;YACjE,IAAI,8BAA8B,CAAC,qBAAqB,CAAC;SAC5D,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { AIVariable, ResolvedAIVariable, ToolRequest } from '@theia/ai-core';
2
+ import { ChatRequest } from './chat-model';
3
+ export declare const chatVariableLeader = "#";
4
+ export declare const chatAgentLeader = "@";
5
+ export declare const chatFunctionLeader = "~";
6
+ export declare const chatSubcommandLeader = "/";
7
+ /**********************
8
+ * INTERFACES AND TYPE GUARDS
9
+ **********************/
10
+ export interface OffsetRange {
11
+ readonly start: number;
12
+ readonly endExclusive: number;
13
+ }
14
+ export interface ParsedChatRequest {
15
+ readonly request: ChatRequest;
16
+ readonly parts: ParsedChatRequestPart[];
17
+ readonly toolRequests: Map<string, ToolRequest>;
18
+ readonly variables: Map<string, AIVariable>;
19
+ }
20
+ export interface ParsedChatRequestPart {
21
+ readonly kind: string;
22
+ /**
23
+ * The text as represented in the ChatRequest
24
+ */
25
+ readonly text: string;
26
+ /**
27
+ * The text as will be sent to the LLM
28
+ */
29
+ readonly promptText: string;
30
+ readonly range: OffsetRange;
31
+ }
32
+ export declare class ParsedChatRequestTextPart implements ParsedChatRequestPart {
33
+ readonly range: OffsetRange;
34
+ readonly text: string;
35
+ readonly kind: 'text';
36
+ constructor(range: OffsetRange, text: string);
37
+ get promptText(): string;
38
+ }
39
+ export declare class ParsedChatRequestVariablePart implements ParsedChatRequestPart {
40
+ readonly range: OffsetRange;
41
+ readonly variableName: string;
42
+ readonly variableArg: string | undefined;
43
+ readonly kind: 'var';
44
+ resolution: ResolvedAIVariable;
45
+ constructor(range: OffsetRange, variableName: string, variableArg: string | undefined);
46
+ get text(): string;
47
+ get promptText(): string;
48
+ }
49
+ export declare class ParsedChatRequestFunctionPart implements ParsedChatRequestPart {
50
+ readonly range: OffsetRange;
51
+ readonly toolRequest: ToolRequest;
52
+ readonly kind: 'function';
53
+ constructor(range: OffsetRange, toolRequest: ToolRequest);
54
+ get text(): string;
55
+ get promptText(): string;
56
+ }
57
+ export declare class ParsedChatRequestAgentPart implements ParsedChatRequestPart {
58
+ readonly range: OffsetRange;
59
+ readonly agentId: string;
60
+ readonly agentName: string;
61
+ readonly kind: 'agent';
62
+ constructor(range: OffsetRange, agentId: string, agentName: string);
63
+ get text(): string;
64
+ get promptText(): string;
65
+ }
66
+ //# sourceMappingURL=parsed-chat-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsed-chat-request.d.ts","sourceRoot":"","sources":["../../src/common/parsed-chat-request.ts"],"names":[],"mappings":"AAsBA,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W;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;IAJhH,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAEd,UAAU,EAAE,kBAAkB,CAAC;gBAEjB,KAAK,EAAE,WAAW,EAAW,YAAY,EAAE,MAAM,EAAW,WAAW,EAAE,MAAM,GAAG,SAAS;IAEhH,IAAI,IAAI,IAAI,MAAM,CAGjB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;CACJ;AAED,qBAAa,6BAA8B,YAAW,qBAAqB;IAE3D,QAAQ,CAAC,KAAK,EAAE,WAAW;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW;IAD1E,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;gBACL,KAAK,EAAE,WAAW,EAAW,WAAW,EAAE,WAAW;IAE1E,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;CACJ;AAED,qBAAa,0BAA2B,YAAW,qBAAqB;IAExD,QAAQ,CAAC,KAAK,EAAE,WAAW;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM;IAD7F,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBACF,KAAK,EAAE,WAAW,EAAW,OAAO,EAAE,MAAM,EAAW,SAAS,EAAE,MAAM;IAE7F,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;CACJ"}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2024 EclipseSource GmbH.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19
+ * Licensed under the MIT License. See License.txt in the project root for license information.
20
+ *--------------------------------------------------------------------------------------------*/
21
+ // Partially copied from https://github.com/microsoft/vscode/blob/a2cab7255c0df424027be05d58e1b7b941f4ea60/src/vs/workbench/contrib/chat/common/chatParserTypes.ts
22
+ // Partially copied from https://github.com/microsoft/vscode/blob/a2cab7255c0df424027be05d58e1b7b941f4ea60/src/vs/editor/common/core/offsetRange.ts
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.ParsedChatRequestAgentPart = exports.ParsedChatRequestFunctionPart = exports.ParsedChatRequestVariablePart = exports.ParsedChatRequestTextPart = exports.chatSubcommandLeader = exports.chatFunctionLeader = exports.chatAgentLeader = exports.chatVariableLeader = void 0;
25
+ const ai_core_1 = require("@theia/ai-core");
26
+ exports.chatVariableLeader = '#';
27
+ exports.chatAgentLeader = '@';
28
+ exports.chatFunctionLeader = '~';
29
+ exports.chatSubcommandLeader = '/';
30
+ class ParsedChatRequestTextPart {
31
+ constructor(range, text) {
32
+ this.range = range;
33
+ this.text = text;
34
+ }
35
+ get promptText() {
36
+ return this.text;
37
+ }
38
+ }
39
+ exports.ParsedChatRequestTextPart = ParsedChatRequestTextPart;
40
+ class ParsedChatRequestVariablePart {
41
+ constructor(range, variableName, variableArg) {
42
+ this.range = range;
43
+ this.variableName = variableName;
44
+ this.variableArg = variableArg;
45
+ }
46
+ get text() {
47
+ const argPart = this.variableArg ? `:${this.variableArg}` : '';
48
+ return `${exports.chatVariableLeader}${this.variableName}${argPart}`;
49
+ }
50
+ get promptText() {
51
+ var _a, _b;
52
+ return (_b = (_a = this.resolution) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : this.text;
53
+ }
54
+ }
55
+ exports.ParsedChatRequestVariablePart = ParsedChatRequestVariablePart;
56
+ class ParsedChatRequestFunctionPart {
57
+ constructor(range, toolRequest) {
58
+ this.range = range;
59
+ this.toolRequest = toolRequest;
60
+ }
61
+ get text() {
62
+ return `${exports.chatFunctionLeader}${this.toolRequest.id}`;
63
+ }
64
+ get promptText() {
65
+ return (0, ai_core_1.toolRequestToPromptText)(this.toolRequest);
66
+ }
67
+ }
68
+ exports.ParsedChatRequestFunctionPart = ParsedChatRequestFunctionPart;
69
+ class ParsedChatRequestAgentPart {
70
+ constructor(range, agentId, agentName) {
71
+ this.range = range;
72
+ this.agentId = agentId;
73
+ this.agentName = agentName;
74
+ }
75
+ get text() {
76
+ return `${exports.chatAgentLeader}${this.agentName}`;
77
+ }
78
+ get promptText() {
79
+ return '';
80
+ }
81
+ }
82
+ exports.ParsedChatRequestAgentPart = ParsedChatRequestAgentPart;
83
+ //# sourceMappingURL=parsed-chat-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsed-chat-request.js","sourceRoot":"","sources":["../../src/common/parsed-chat-request.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;;;gGAGgG;AAChG,kKAAkK;AAClK,mJAAmJ;;;AAEnJ,4CAAsG;AAGzF,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,eAAe,GAAG,GAAG,CAAC;AACtB,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAgCxC,MAAa,yBAAyB;IAGlC,YAAqB,KAAkB,EAAW,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