@theia/ai-ide 1.67.0-next.3 → 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.
- package/README.md +1 -0
- package/package.json +21 -21
- package/src/browser/ai-configuration/agent-configuration-widget.tsx +3 -3
- package/src/browser/context-file-validation-service-impl.spec.ts +405 -0
- package/src/browser/context-file-validation-service-impl.ts +120 -0
- package/src/browser/context-functions.spec.ts +155 -1
- package/src/browser/context-functions.ts +40 -6
- package/src/browser/file-changeset-functions.spec.ts +13 -13
- package/src/browser/file-changeset-functions.ts +9 -9
- package/src/browser/frontend-module.ts +12 -4
- package/src/browser/ide-chat-welcome-message-provider.tsx +64 -70
- package/src/browser/remember-command-contribution.ts +105 -0
- package/src/browser/workspace-functions.ts +68 -1
- package/src/common/ai-ide-preferences.ts +1 -1
- package/src/common/coder-replace-prompt-template.ts +8 -9
- package/src/common/command-prompt-template.ts +5 -5
- package/src/common/file-changeset-function-ids.ts +15 -1
- package/src/common/orchestrator-chat-agent.ts +2 -2
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts +0 -41
- package/lib/browser/ai-configuration/agent-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/agent-configuration-widget.js +0 -333
- package/lib/browser/ai-configuration/agent-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts +0 -18
- package/lib/browser/ai-configuration/ai-configuration-service.d.ts.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-service.js +0 -53
- package/lib/browser/ai-configuration/ai-configuration-service.js.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts +0 -14
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.d.ts.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js +0 -67
- package/lib/browser/ai-configuration/ai-configuration-view-contribution.js.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts +0 -29
- package/lib/browser/ai-configuration/ai-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/ai-configuration-widget.js +0 -118
- package/lib/browser/ai-configuration/ai-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/language-model-renderer.d.ts +0 -13
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +0 -1
- package/lib/browser/ai-configuration/language-model-renderer.js +0 -104
- package/lib/browser/ai-configuration/language-model-renderer.js.map +0 -1
- package/lib/browser/ai-configuration/mcp-configuration-widget.d.ts +0 -43
- package/lib/browser/ai-configuration/mcp-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/mcp-configuration-widget.js +0 -302
- package/lib/browser/ai-configuration/mcp-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts +0 -41
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.js +0 -226
- package/lib/browser/ai-configuration/model-aliases-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts +0 -141
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js +0 -508
- package/lib/browser/ai-configuration/prompt-fragments-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts +0 -10
- package/lib/browser/ai-configuration/template-settings-renderer.d.ts.map +0 -1
- package/lib/browser/ai-configuration/template-settings-renderer.js +0 -48
- package/lib/browser/ai-configuration/template-settings-renderer.js.map +0 -1
- package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts +0 -22
- package/lib/browser/ai-configuration/token-usage-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/token-usage-configuration-widget.js +0 -156
- package/lib/browser/ai-configuration/token-usage-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts +0 -30
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/tools-configuration-widget.js +0 -150
- package/lib/browser/ai-configuration/tools-configuration-widget.js.map +0 -1
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts +0 -19
- package/lib/browser/ai-configuration/variable-configuration-widget.d.ts.map +0 -1
- package/lib/browser/ai-configuration/variable-configuration-widget.js +0 -99
- package/lib/browser/ai-configuration/variable-configuration-widget.js.map +0 -1
- package/lib/browser/ai-ide-activation-service.d.ts +0 -18
- package/lib/browser/ai-ide-activation-service.d.ts.map +0 -1
- package/lib/browser/ai-ide-activation-service.js +0 -71
- package/lib/browser/ai-ide-activation-service.js.map +0 -1
- package/lib/browser/ai-terminal-functions.d.ts +0 -13
- package/lib/browser/ai-terminal-functions.d.ts.map +0 -1
- package/lib/browser/ai-terminal-functions.js +0 -114
- package/lib/browser/ai-terminal-functions.js.map +0 -1
- package/lib/browser/app-tester-chat-agent.d.ts +0 -35
- package/lib/browser/app-tester-chat-agent.d.ts.map +0 -1
- package/lib/browser/app-tester-chat-agent.js +0 -142
- package/lib/browser/app-tester-chat-agent.js.map +0 -1
- package/lib/browser/app-tester-chat-functions.d.ts +0 -25
- package/lib/browser/app-tester-chat-functions.d.ts.map +0 -1
- package/lib/browser/app-tester-chat-functions.js +0 -170
- package/lib/browser/app-tester-chat-functions.js.map +0 -1
- package/lib/browser/app-tester-prompt-template.d.ts +0 -6
- package/lib/browser/app-tester-prompt-template.d.ts.map +0 -1
- package/lib/browser/app-tester-prompt-template.js +0 -83
- package/lib/browser/app-tester-prompt-template.js.map +0 -1
- package/lib/browser/architect-agent.d.ts +0 -15
- package/lib/browser/architect-agent.d.ts.map +0 -1
- package/lib/browser/architect-agent.js +0 -68
- package/lib/browser/architect-agent.js.map +0 -1
- package/lib/browser/coder-agent.d.ts +0 -15
- package/lib/browser/coder-agent.d.ts.map +0 -1
- package/lib/browser/coder-agent.js +0 -81
- package/lib/browser/coder-agent.js.map +0 -1
- package/lib/browser/context-functions.d.ts +0 -14
- package/lib/browser/context-functions.d.ts.map +0 -1
- package/lib/browser/context-functions.js +0 -130
- package/lib/browser/context-functions.js.map +0 -1
- package/lib/browser/context-functions.spec.d.ts +0 -2
- package/lib/browser/context-functions.spec.d.ts.map +0 -1
- package/lib/browser/context-functions.spec.js +0 -93
- package/lib/browser/context-functions.spec.js.map +0 -1
- package/lib/browser/file-changeset-function.spec.d.ts +0 -2
- package/lib/browser/file-changeset-function.spec.d.ts.map +0 -1
- package/lib/browser/file-changeset-function.spec.js +0 -45
- package/lib/browser/file-changeset-function.spec.js.map +0 -1
- package/lib/browser/file-changeset-functions.d.ts +0 -87
- package/lib/browser/file-changeset-functions.d.ts.map +0 -1
- package/lib/browser/file-changeset-functions.js +0 -645
- package/lib/browser/file-changeset-functions.js.map +0 -1
- package/lib/browser/file-changeset-functions.spec.d.ts +0 -2
- package/lib/browser/file-changeset-functions.spec.d.ts.map +0 -1
- package/lib/browser/file-changeset-functions.spec.js +0 -179
- package/lib/browser/file-changeset-functions.spec.js.map +0 -1
- package/lib/browser/frontend-module.d.ts +0 -5
- package/lib/browser/frontend-module.d.ts.map +0 -1
- package/lib/browser/frontend-module.js +0 -214
- package/lib/browser/frontend-module.js.map +0 -1
- package/lib/browser/github-chat-agent.d.ts +0 -48
- package/lib/browser/github-chat-agent.d.ts.map +0 -1
- package/lib/browser/github-chat-agent.js +0 -222
- package/lib/browser/github-chat-agent.js.map +0 -1
- package/lib/browser/github-prompt-template.d.ts +0 -6
- package/lib/browser/github-prompt-template.d.ts.map +0 -1
- package/lib/browser/github-prompt-template.js +0 -53
- package/lib/browser/github-prompt-template.js.map +0 -1
- package/lib/browser/github-repo-variable-contribution.d.ts +0 -15
- package/lib/browser/github-repo-variable-contribution.d.ts.map +0 -1
- package/lib/browser/github-repo-variable-contribution.js +0 -82
- package/lib/browser/github-repo-variable-contribution.js.map +0 -1
- package/lib/browser/ide-chat-welcome-message-provider.d.ts +0 -11
- package/lib/browser/ide-chat-welcome-message-provider.d.ts.map +0 -1
- package/lib/browser/ide-chat-welcome-message-provider.js +0 -142
- package/lib/browser/ide-chat-welcome-message-provider.js.map +0 -1
- package/lib/browser/project-info-agent.d.ts +0 -13
- package/lib/browser/project-info-agent.d.ts.map +0 -1
- package/lib/browser/project-info-agent.js +0 -45
- package/lib/browser/project-info-agent.js.map +0 -1
- package/lib/browser/summarize-session-command-contribution.d.ts +0 -19
- package/lib/browser/summarize-session-command-contribution.d.ts.map +0 -1
- package/lib/browser/summarize-session-command-contribution.js +0 -118
- package/lib/browser/summarize-session-command-contribution.js.map +0 -1
- package/lib/browser/task-background-summary-variable.d.ts +0 -9
- package/lib/browser/task-background-summary-variable.d.ts.map +0 -1
- package/lib/browser/task-background-summary-variable.js +0 -60
- package/lib/browser/task-background-summary-variable.js.map +0 -1
- package/lib/browser/task-context-agent.d.ts +0 -13
- package/lib/browser/task-context-agent.d.ts.map +0 -1
- package/lib/browser/task-context-agent.js +0 -45
- package/lib/browser/task-context-agent.js.map +0 -1
- package/lib/browser/task-context-file-storage-service.d.ts +0 -40
- package/lib/browser/task-context-file-storage-service.d.ts.map +0 -1
- package/lib/browser/task-context-file-storage-service.js +0 -232
- package/lib/browser/task-context-file-storage-service.js.map +0 -1
- package/lib/browser/template-preference-contribution.d.ts +0 -17
- package/lib/browser/template-preference-contribution.d.ts.map +0 -1
- package/lib/browser/template-preference-contribution.js +0 -94
- package/lib/browser/template-preference-contribution.js.map +0 -1
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.d.ts +0 -2
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.d.ts.map +0 -1
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.js +0 -52
- package/lib/browser/test/tool-provider-cancellation-test-util.spec.js.map +0 -1
- package/lib/browser/workspace-functions.d.ts +0 -75
- package/lib/browser/workspace-functions.d.ts.map +0 -1
- package/lib/browser/workspace-functions.js +0 -641
- package/lib/browser/workspace-functions.js.map +0 -1
- package/lib/browser/workspace-functions.spec.d.ts +0 -2
- package/lib/browser/workspace-functions.spec.d.ts.map +0 -1
- package/lib/browser/workspace-functions.spec.js +0 -161
- package/lib/browser/workspace-functions.spec.js.map +0 -1
- package/lib/browser/workspace-launch-provider.d.ts +0 -24
- package/lib/browser/workspace-launch-provider.d.ts.map +0 -1
- package/lib/browser/workspace-launch-provider.js +0 -216
- package/lib/browser/workspace-launch-provider.js.map +0 -1
- package/lib/browser/workspace-launch-provider.spec.d.ts +0 -2
- package/lib/browser/workspace-launch-provider.spec.d.ts.map +0 -1
- package/lib/browser/workspace-launch-provider.spec.js +0 -245
- package/lib/browser/workspace-launch-provider.spec.js.map +0 -1
- package/lib/browser/workspace-search-provider.d.ts +0 -15
- package/lib/browser/workspace-search-provider.d.ts.map +0 -1
- package/lib/browser/workspace-search-provider.js +0 -204
- package/lib/browser/workspace-search-provider.js.map +0 -1
- package/lib/browser/workspace-search-provider.spec.d.ts +0 -2
- package/lib/browser/workspace-search-provider.spec.d.ts.map +0 -1
- package/lib/browser/workspace-search-provider.spec.js +0 -82
- package/lib/browser/workspace-search-provider.spec.js.map +0 -1
- package/lib/browser/workspace-task-provider.d.ts +0 -15
- package/lib/browser/workspace-task-provider.d.ts.map +0 -1
- package/lib/browser/workspace-task-provider.js +0 -138
- package/lib/browser/workspace-task-provider.js.map +0 -1
- package/lib/browser/workspace-task-provider.spec.d.ts +0 -2
- package/lib/browser/workspace-task-provider.spec.d.ts.map +0 -1
- package/lib/browser/workspace-task-provider.spec.js +0 -109
- package/lib/browser/workspace-task-provider.spec.js.map +0 -1
- package/lib/common/ai-configuration-preferences.d.ts +0 -8
- package/lib/common/ai-configuration-preferences.d.ts.map +0 -1
- package/lib/common/ai-configuration-preferences.js +0 -41
- package/lib/common/ai-configuration-preferences.js.map +0 -1
- package/lib/common/ai-ide-preferences.d.ts +0 -5
- package/lib/common/ai-ide-preferences.d.ts.map +0 -1
- package/lib/common/ai-ide-preferences.js +0 -53
- package/lib/common/ai-ide-preferences.js.map +0 -1
- package/lib/common/ai-terminal-functions.d.ts +0 -2
- package/lib/common/ai-terminal-functions.d.ts.map +0 -1
- package/lib/common/ai-terminal-functions.js +0 -20
- package/lib/common/ai-terminal-functions.js.map +0 -1
- package/lib/common/app-tester-chat-functions.d.ts +0 -5
- package/lib/common/app-tester-chat-functions.d.ts.map +0 -1
- package/lib/common/app-tester-chat-functions.js +0 -23
- package/lib/common/app-tester-chat-functions.js.map +0 -1
- package/lib/common/architect-prompt-template.d.ts +0 -3
- package/lib/common/architect-prompt-template.d.ts.map +0 -1
- package/lib/common/architect-prompt-template.js +0 -81
- package/lib/common/architect-prompt-template.js.map +0 -1
- package/lib/common/browser-automation-protocol.d.ts +0 -15
- package/lib/common/browser-automation-protocol.d.ts.map +0 -1
- package/lib/common/browser-automation-protocol.js +0 -22
- package/lib/common/browser-automation-protocol.js.map +0 -1
- package/lib/common/coder-replace-prompt-template.d.ts +0 -11
- package/lib/common/coder-replace-prompt-template.d.ts.map +0 -1
- package/lib/common/coder-replace-prompt-template.js +0 -295
- package/lib/common/coder-replace-prompt-template.js.map +0 -1
- package/lib/common/command-chat-agents.d.ts +0 -36
- package/lib/common/command-chat-agents.d.ts.map +0 -1
- package/lib/common/command-chat-agents.js +0 -122
- package/lib/common/command-chat-agents.js.map +0 -1
- package/lib/common/command-prompt-template.d.ts +0 -3
- package/lib/common/command-prompt-template.d.ts.map +0 -1
- package/lib/common/command-prompt-template.js +0 -226
- package/lib/common/command-prompt-template.js.map +0 -1
- package/lib/common/context-files-variable.d.ts +0 -9
- package/lib/common/context-files-variable.d.ts.map +0 -1
- package/lib/common/context-files-variable.js +0 -52
- package/lib/common/context-files-variable.js.map +0 -1
- package/lib/common/context-functions.d.ts +0 -4
- package/lib/common/context-functions.d.ts.map +0 -1
- package/lib/common/context-functions.js +0 -22
- package/lib/common/context-functions.js.map +0 -1
- package/lib/common/context-variables.d.ts +0 -3
- package/lib/common/context-variables.d.ts.map +0 -1
- package/lib/common/context-variables.js +0 -21
- package/lib/common/context-variables.js.map +0 -1
- package/lib/common/file-changeset-function-ids.d.ts +0 -8
- package/lib/common/file-changeset-function-ids.d.ts.map +0 -1
- package/lib/common/file-changeset-function-ids.js +0 -26
- package/lib/common/file-changeset-function-ids.js.map +0 -1
- package/lib/common/github-repo-protocol.d.ts +0 -15
- package/lib/common/github-repo-protocol.d.ts.map +0 -1
- package/lib/common/github-repo-protocol.js +0 -21
- package/lib/common/github-repo-protocol.js.map +0 -1
- package/lib/common/orchestrator-chat-agent.d.ts +0 -36
- package/lib/common/orchestrator-chat-agent.d.ts.map +0 -1
- package/lib/common/orchestrator-chat-agent.js +0 -167
- package/lib/common/orchestrator-chat-agent.js.map +0 -1
- package/lib/common/orchestrator-prompt-template.d.ts +0 -3
- package/lib/common/orchestrator-prompt-template.d.ts.map +0 -1
- package/lib/common/orchestrator-prompt-template.js +0 -55
- package/lib/common/orchestrator-prompt-template.js.map +0 -1
- package/lib/common/project-info-prompt-template.d.ts +0 -6
- package/lib/common/project-info-prompt-template.d.ts.map +0 -1
- package/lib/common/project-info-prompt-template.js +0 -145
- package/lib/common/project-info-prompt-template.js.map +0 -1
- package/lib/common/summarize-session-commands.d.ts +0 -4
- package/lib/common/summarize-session-commands.d.ts.map +0 -1
- package/lib/common/summarize-session-commands.js +0 -28
- package/lib/common/summarize-session-commands.js.map +0 -1
- package/lib/common/task-context-prompt-template.d.ts +0 -8
- package/lib/common/task-context-prompt-template.d.ts.map +0 -1
- package/lib/common/task-context-prompt-template.js +0 -217
- package/lib/common/task-context-prompt-template.js.map +0 -1
- package/lib/common/universal-chat-agent.d.ts +0 -17
- package/lib/common/universal-chat-agent.d.ts.map +0 -1
- package/lib/common/universal-chat-agent.js +0 -47
- package/lib/common/universal-chat-agent.js.map +0 -1
- package/lib/common/universal-prompt-template.d.ts +0 -4
- package/lib/common/universal-prompt-template.d.ts.map +0 -1
- package/lib/common/universal-prompt-template.js +0 -32
- package/lib/common/universal-prompt-template.js.map +0 -1
- package/lib/common/workspace-functions.d.ts +0 -12
- package/lib/common/workspace-functions.d.ts.map +0 -1
- package/lib/common/workspace-functions.js +0 -30
- package/lib/common/workspace-functions.js.map +0 -1
- package/lib/common/workspace-preferences.d.ts +0 -10
- package/lib/common/workspace-preferences.d.ts.map +0 -1
- package/lib/common/workspace-preferences.js +0 -89
- package/lib/common/workspace-preferences.js.map +0 -1
- package/lib/common/workspace-search-provider-util.d.ts +0 -17
- package/lib/common/workspace-search-provider-util.d.ts.map +0 -1
- package/lib/common/workspace-search-provider-util.js +0 -51
- package/lib/common/workspace-search-provider-util.js.map +0 -1
- package/lib/node/app-tester-agent/browser-automation-impl.d.ts +0 -18
- package/lib/node/app-tester-agent/browser-automation-impl.d.ts.map +0 -1
- package/lib/node/app-tester-agent/browser-automation-impl.js +0 -96
- package/lib/node/app-tester-agent/browser-automation-impl.js.map +0 -1
- package/lib/node/backend-module.d.ts +0 -4
- package/lib/node/backend-module.d.ts.map +0 -1
- package/lib/node/backend-module.js +0 -45
- package/lib/node/backend-module.js.map +0 -1
- package/lib/node/github-repo-service-impl.d.ts +0 -7
- package/lib/node/github-repo-service-impl.d.ts.map +0 -1
- package/lib/node/github-repo-service-impl.js +0 -86
- package/lib/node/github-repo-service-impl.js.map +0 -1
- package/lib/package.spec.d.ts +0 -1
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectInfoAgent = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
// *****************************************************************************
|
|
6
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
7
|
-
//
|
|
8
|
-
// This program and the accompanying materials are made available under the
|
|
9
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
-
//
|
|
12
|
-
// This Source Code may also be made available under the following Secondary
|
|
13
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
-
// with the GNU Classpath Exception which is available at
|
|
16
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
-
//
|
|
18
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
-
// *****************************************************************************
|
|
20
|
-
const ai_chat_1 = require("@theia/ai-chat");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
const project_info_prompt_template_1 = require("../common/project-info-prompt-template");
|
|
23
|
-
const core_1 = require("@theia/core");
|
|
24
|
-
let ProjectInfoAgent = class ProjectInfoAgent extends ai_chat_1.AbstractStreamParsingChatAgent {
|
|
25
|
-
constructor() {
|
|
26
|
-
super(...arguments);
|
|
27
|
-
this.name = 'ProjectInfo';
|
|
28
|
-
this.id = 'ProjectInfo';
|
|
29
|
-
this.languageModelRequirements = [{
|
|
30
|
-
purpose: 'chat',
|
|
31
|
-
identifier: 'default/code',
|
|
32
|
-
}];
|
|
33
|
-
this.defaultLanguageModelPurpose = 'chat';
|
|
34
|
-
this.description = core_1.nls.localize('theia/ai/workspace/projectInfoAgent/description', 'An AI assistant for managing project information templates. This agent helps create, update, and review the .prompts/project-info.prompttemplate file which provides ' +
|
|
35
|
-
'context about your project to other AI agents. It can analyze your workspace to suggest project information or update existing templates based on your requirements.');
|
|
36
|
-
this.tags = [...this.tags, 'Alpha'];
|
|
37
|
-
this.prompts = [project_info_prompt_template_1.projectInfoSystemVariants, project_info_prompt_template_1.projectInfoTemplateVariants];
|
|
38
|
-
this.systemPromptId = project_info_prompt_template_1.projectInfoSystemVariants.id;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
exports.ProjectInfoAgent = ProjectInfoAgent;
|
|
42
|
-
exports.ProjectInfoAgent = ProjectInfoAgent = tslib_1.__decorate([
|
|
43
|
-
(0, inversify_1.injectable)()
|
|
44
|
-
], ProjectInfoAgent);
|
|
45
|
-
//# sourceMappingURL=project-info-agent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-info-agent.js","sourceRoot":"","sources":["../../src/browser/project-info-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;AAChF,4CAAgE;AAEhE,4DAA0D;AAC1D,yFAAgH;AAChH,sCAAkC;AAG3B,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,wCAA8B;IAA7D;;QAEH,SAAI,GAAG,aAAa,CAAC;QACrB,OAAE,GAAG,aAAa,CAAC;QACnB,8BAAyB,GAA+B,CAAC;gBACrD,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,cAAc;aAC7B,CAAC,CAAC;QACO,gCAA2B,GAAW,MAAM,CAAC;QAE9C,gBAAW,GAAG,UAAG,CAAC,QAAQ,CAAC,iDAAiD,EACjF,uKAAuK;YACvK,sKAAsK,CAAC,CAAC;QAEnK,SAAI,GAAa,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEzC,YAAO,GAAG,CAAC,wDAAyB,EAAE,0DAA2B,CAAC,CAAC;QACzD,mBAAc,GAAuB,wDAAyB,CAAC,EAAE,CAAC;IAEzF,CAAC;CAAA,CAAA;AAnBY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CAmB5B"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ChatService } from '@theia/ai-chat/lib/common';
|
|
2
|
-
import { CommandContribution, CommandRegistry, CommandService } from '@theia/core';
|
|
3
|
-
import { TaskContextStorageService, TaskContextService } from '@theia/ai-chat/lib/browser/task-context-service';
|
|
4
|
-
import { CoderAgent } from './coder-agent';
|
|
5
|
-
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
6
|
-
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
7
|
-
import { AICommandHandlerFactory } from '@theia/ai-core/lib/browser';
|
|
8
|
-
export declare class SummarizeSessionCommandContribution implements CommandContribution {
|
|
9
|
-
protected readonly chatService: ChatService;
|
|
10
|
-
protected readonly taskContextService: TaskContextService;
|
|
11
|
-
protected readonly commandService: CommandService;
|
|
12
|
-
protected readonly coderAgent: CoderAgent;
|
|
13
|
-
protected readonly taskContextStorageService: TaskContextStorageService;
|
|
14
|
-
protected readonly fileService: FileService;
|
|
15
|
-
protected readonly wsService: WorkspaceService;
|
|
16
|
-
protected readonly commandHandlerFactory: AICommandHandlerFactory;
|
|
17
|
-
registerCommands(registry: CommandRegistry): void;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=summarize-session-command-contribution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summarize-session-command-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/summarize-session-command-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAqB,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAGhH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,qBACa,mCAAoC,YAAW,mBAAmB;IAE3E,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAG5C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAG1D,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAG1C,SAAS,CAAC,QAAQ,CAAC,yBAAyB,EAAE,yBAAyB,CAAC;IAGxE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAG5C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;IAG/C,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,uBAAuB,CAAC;IAElE,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;CAwDpD"}
|
|
@@ -1,118 +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.SummarizeSessionCommandContribution = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const common_1 = require("@theia/ai-chat/lib/common");
|
|
21
|
-
const core_1 = require("@theia/core");
|
|
22
|
-
const task_context_service_1 = require("@theia/ai-chat/lib/browser/task-context-service");
|
|
23
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
24
|
-
const summarize_session_commands_1 = require("../common/summarize-session-commands");
|
|
25
|
-
const coder_agent_1 = require("./coder-agent");
|
|
26
|
-
const task_context_variable_1 = require("@theia/ai-chat/lib/browser/task-context-variable");
|
|
27
|
-
const task_context_prompt_template_1 = require("../common/task-context-prompt-template");
|
|
28
|
-
const file_variable_contribution_1 = require("@theia/ai-core/lib/browser/file-variable-contribution");
|
|
29
|
-
const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
|
|
30
|
-
const browser_1 = require("@theia/workspace/lib/browser");
|
|
31
|
-
const browser_2 = require("@theia/ai-core/lib/browser");
|
|
32
|
-
let SummarizeSessionCommandContribution = class SummarizeSessionCommandContribution {
|
|
33
|
-
registerCommands(registry) {
|
|
34
|
-
registry.registerCommand(summarize_session_commands_1.AI_UPDATE_TASK_CONTEXT_COMMAND, this.commandHandlerFactory({
|
|
35
|
-
execute: async () => {
|
|
36
|
-
const activeSession = this.chatService.getActiveSession();
|
|
37
|
-
if (!activeSession) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// Check if there is an existing summary for this session
|
|
41
|
-
if (!this.taskContextService.hasSummary(activeSession)) {
|
|
42
|
-
// If no summary exists, create one first
|
|
43
|
-
await this.taskContextService.summarize(activeSession, task_context_prompt_template_1.TASK_CONTEXT_CREATE_PROMPT_ID);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
// Update existing summary
|
|
47
|
-
await this.taskContextService.update(activeSession, task_context_prompt_template_1.TASK_CONTEXT_UPDATE_PROMPT_ID);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}));
|
|
51
|
-
registry.registerCommand(summarize_session_commands_1.AI_SUMMARIZE_SESSION_AS_TASK_FOR_CODER, this.commandHandlerFactory({
|
|
52
|
-
execute: async () => {
|
|
53
|
-
const activeSession = this.chatService.getActiveSession();
|
|
54
|
-
if (!activeSession) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const summaryId = await this.taskContextService.summarize(activeSession, task_context_prompt_template_1.TASK_CONTEXT_CREATE_PROMPT_ID);
|
|
58
|
-
// Open the summary in a new editor
|
|
59
|
-
await this.taskContextStorageService.open(summaryId);
|
|
60
|
-
// Add the summary file to the context of the active Architect session
|
|
61
|
-
const summary = this.taskContextService.getAll().find(s => s.id === summaryId);
|
|
62
|
-
if (summary === null || summary === void 0 ? void 0 : summary.uri) {
|
|
63
|
-
if (await this.fileService.exists(summary === null || summary === void 0 ? void 0 : summary.uri)) {
|
|
64
|
-
const wsRelativePath = await this.wsService.getWorkspaceRelativePath(summary === null || summary === void 0 ? void 0 : summary.uri);
|
|
65
|
-
// Create a file variable for the summary
|
|
66
|
-
const fileVariable = {
|
|
67
|
-
variable: file_variable_contribution_1.FILE_VARIABLE,
|
|
68
|
-
arg: wsRelativePath
|
|
69
|
-
};
|
|
70
|
-
// Add the file to the active session's context
|
|
71
|
-
activeSession.model.context.addVariables(fileVariable);
|
|
72
|
-
}
|
|
73
|
-
// Create a new session with the coder agent
|
|
74
|
-
const newSession = this.chatService.createSession(common_1.ChatAgentLocation.Panel, { focus: true }, this.coderAgent);
|
|
75
|
-
const summaryVariable = { variable: task_context_variable_1.TASK_CONTEXT_VARIABLE, arg: summaryId };
|
|
76
|
-
newSession.model.context.addVariables(summaryVariable);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
exports.SummarizeSessionCommandContribution = SummarizeSessionCommandContribution;
|
|
83
|
-
tslib_1.__decorate([
|
|
84
|
-
(0, inversify_1.inject)(common_1.ChatService),
|
|
85
|
-
tslib_1.__metadata("design:type", Object)
|
|
86
|
-
], SummarizeSessionCommandContribution.prototype, "chatService", void 0);
|
|
87
|
-
tslib_1.__decorate([
|
|
88
|
-
(0, inversify_1.inject)(task_context_service_1.TaskContextService),
|
|
89
|
-
tslib_1.__metadata("design:type", task_context_service_1.TaskContextService)
|
|
90
|
-
], SummarizeSessionCommandContribution.prototype, "taskContextService", void 0);
|
|
91
|
-
tslib_1.__decorate([
|
|
92
|
-
(0, inversify_1.inject)(core_1.CommandService),
|
|
93
|
-
tslib_1.__metadata("design:type", Object)
|
|
94
|
-
], SummarizeSessionCommandContribution.prototype, "commandService", void 0);
|
|
95
|
-
tslib_1.__decorate([
|
|
96
|
-
(0, inversify_1.inject)(coder_agent_1.CoderAgent),
|
|
97
|
-
tslib_1.__metadata("design:type", coder_agent_1.CoderAgent)
|
|
98
|
-
], SummarizeSessionCommandContribution.prototype, "coderAgent", void 0);
|
|
99
|
-
tslib_1.__decorate([
|
|
100
|
-
(0, inversify_1.inject)(task_context_service_1.TaskContextStorageService),
|
|
101
|
-
tslib_1.__metadata("design:type", Object)
|
|
102
|
-
], SummarizeSessionCommandContribution.prototype, "taskContextStorageService", void 0);
|
|
103
|
-
tslib_1.__decorate([
|
|
104
|
-
(0, inversify_1.inject)(file_service_1.FileService),
|
|
105
|
-
tslib_1.__metadata("design:type", file_service_1.FileService)
|
|
106
|
-
], SummarizeSessionCommandContribution.prototype, "fileService", void 0);
|
|
107
|
-
tslib_1.__decorate([
|
|
108
|
-
(0, inversify_1.inject)(browser_1.WorkspaceService),
|
|
109
|
-
tslib_1.__metadata("design:type", browser_1.WorkspaceService)
|
|
110
|
-
], SummarizeSessionCommandContribution.prototype, "wsService", void 0);
|
|
111
|
-
tslib_1.__decorate([
|
|
112
|
-
(0, inversify_1.inject)(browser_2.AICommandHandlerFactory),
|
|
113
|
-
tslib_1.__metadata("design:type", Function)
|
|
114
|
-
], SummarizeSessionCommandContribution.prototype, "commandHandlerFactory", void 0);
|
|
115
|
-
exports.SummarizeSessionCommandContribution = SummarizeSessionCommandContribution = tslib_1.__decorate([
|
|
116
|
-
(0, inversify_1.injectable)()
|
|
117
|
-
], SummarizeSessionCommandContribution);
|
|
118
|
-
//# sourceMappingURL=summarize-session-command-contribution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summarize-session-command-contribution.js","sourceRoot":"","sources":["../../src/browser/summarize-session-command-contribution.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { MaybePromise } from '@theia/core';
|
|
2
|
-
import { AIVariable, ResolvedAIVariable, AIVariableContribution, AIVariableService, AIVariableResolutionRequest, AIVariableContext, AIVariableResolverWithVariableDependencies, AIVariableArg } from '@theia/ai-core';
|
|
3
|
-
export declare const TASK_CONTEXT_SUMMARY_VARIABLE: AIVariable;
|
|
4
|
-
export declare class TaskContextSummaryVariableContribution implements AIVariableContribution, AIVariableResolverWithVariableDependencies {
|
|
5
|
-
registerVariables(service: AIVariableService): void;
|
|
6
|
-
canResolve(request: AIVariableResolutionRequest, context: AIVariableContext): MaybePromise<number>;
|
|
7
|
-
resolve(request: AIVariableResolutionRequest, context: AIVariableContext, resolveDependency?: (variable: AIVariableArg) => Promise<ResolvedAIVariable | undefined>): Promise<ResolvedAIVariable | undefined>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=task-background-summary-variable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-background-summary-variable.d.ts","sourceRoot":"","sources":["../../src/browser/task-background-summary-variable.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAO,MAAM,aAAa,CAAC;AAEhD,OAAO,EACH,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EACjB,0CAA0C,EAC1C,aAAa,EAChB,MAAM,gBAAgB,CAAC;AAKxB,eAAO,MAAM,6BAA6B,EAAE,UAI3C,CAAC;AAEF,qBAIa,sCAAuC,YAAW,sBAAsB,EAAE,0CAA0C;IAC7H,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAInD,UAAU,CAAC,OAAO,EAAE,2BAA2B,EAAE,OAAO,EAAE,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC;IAI5F,OAAO,CACT,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,iBAAiB,EAC1B,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,GACzF,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;CAW7C"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2025 EclipseSource GmbH and others.
|
|
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.TaskContextSummaryVariableContribution = exports.TASK_CONTEXT_SUMMARY_VARIABLE = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const core_1 = require("@theia/core");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
const ai_chat_1 = require("@theia/ai-chat");
|
|
23
|
-
const task_context_variable_1 = require("@theia/ai-chat/lib/browser/task-context-variable");
|
|
24
|
-
const context_variables_1 = require("../common/context-variables");
|
|
25
|
-
exports.TASK_CONTEXT_SUMMARY_VARIABLE = {
|
|
26
|
-
id: context_variables_1.TASK_CONTEXT_SUMMARY_VARIABLE_ID,
|
|
27
|
-
description: core_1.nls.localize('theia/ai/core/taskContextSummary/description', 'Resolves all task context items present in the session context.'),
|
|
28
|
-
name: context_variables_1.TASK_CONTEXT_SUMMARY_VARIABLE_ID,
|
|
29
|
-
};
|
|
30
|
-
let TaskContextSummaryVariableContribution = class TaskContextSummaryVariableContribution {
|
|
31
|
-
registerVariables(service) {
|
|
32
|
-
service.registerResolver(exports.TASK_CONTEXT_SUMMARY_VARIABLE, this);
|
|
33
|
-
}
|
|
34
|
-
canResolve(request, context) {
|
|
35
|
-
return request.variable.name === exports.TASK_CONTEXT_SUMMARY_VARIABLE.name ? 50 : 0;
|
|
36
|
-
}
|
|
37
|
-
async resolve(request, context, resolveDependency) {
|
|
38
|
-
if (!resolveDependency || !ai_chat_1.ChatSessionContext.is(context) || request.variable.name !== exports.TASK_CONTEXT_SUMMARY_VARIABLE.name) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
const allSummaryRequests = context.model.context.getVariables().filter(candidate => candidate.variable.id === task_context_variable_1.TASK_CONTEXT_VARIABLE.id);
|
|
42
|
-
if (!allSummaryRequests.length) {
|
|
43
|
-
return { ...request, value: '' };
|
|
44
|
-
}
|
|
45
|
-
const allSummaries = await Promise.all(allSummaryRequests.map(summaryRequest => resolveDependency(summaryRequest).then(resolved => resolved === null || resolved === void 0 ? void 0 : resolved.value)));
|
|
46
|
-
const value = `# Current Task Context\n\n${allSummaries.map((content, index) => `## Task ${index + 1}\n\n${content}`).join('\n\n')}`;
|
|
47
|
-
return {
|
|
48
|
-
...request,
|
|
49
|
-
value
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
exports.TaskContextSummaryVariableContribution = TaskContextSummaryVariableContribution;
|
|
54
|
-
exports.TaskContextSummaryVariableContribution = TaskContextSummaryVariableContribution = tslib_1.__decorate([
|
|
55
|
-
(0, inversify_1.injectable)()
|
|
56
|
-
/**
|
|
57
|
-
* @class provides a summary of all TaskContextVariables in the context of a given session. Oriented towards use in prompts.
|
|
58
|
-
*/
|
|
59
|
-
], TaskContextSummaryVariableContribution);
|
|
60
|
-
//# sourceMappingURL=task-background-summary-variable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-background-summary-variable.js","sourceRoot":"","sources":["../../src/browser/task-background-summary-variable.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,sCAAgD;AAChD,4DAA0D;AAW1D,4CAAoD;AACpD,4FAAyF;AACzF,mEAA+E;AAElE,QAAA,6BAA6B,GAAe;IACrD,EAAE,EAAE,oDAAgC;IACpC,WAAW,EAAE,UAAG,CAAC,QAAQ,CAAC,8CAA8C,EAAE,iEAAiE,CAAC;IAC5I,IAAI,EAAE,oDAAgC;CACzC,CAAC;AAMK,IAAM,sCAAsC,GAA5C,MAAM,sCAAsC;IAC/C,iBAAiB,CAAC,OAA0B;QACxC,OAAO,CAAC,gBAAgB,CAAC,qCAA6B,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,UAAU,CAAC,OAAoC,EAAE,OAA0B;QACvE,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,qCAA6B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,KAAK,CAAC,OAAO,CACT,OAAoC,EACpC,OAA0B,EAC1B,iBAAwF;QAExF,IAAI,CAAC,iBAAiB,IAAI,CAAC,4BAAkB,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,qCAA6B,CAAC,IAAI,EAAE,CAAC;YAAC,OAAO,SAAS,CAAC;QAAC,CAAC;QAChJ,MAAM,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,KAAK,6CAAqB,CAAC,EAAE,CAAC,CAAC;QACxI,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;YAAC,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAAC,CAAC;QACrE,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACtJ,MAAM,KAAK,GAAG,6BAA6B,YAAY,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,KAAK,GAAG,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACrI,OAAO;YACH,GAAG,OAAO;YACV,KAAK;SACR,CAAC;IACN,CAAC;CACJ,CAAA;AAxBY,wFAAsC;iDAAtC,sCAAsC;IAJlD,IAAA,sBAAU,GAAE;IACb;;OAEG;GACU,sCAAsC,CAwBlD"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Agent, LanguageModelRequirement } from '@theia/ai-core';
|
|
2
|
-
export declare class TaskContextAgent implements Agent {
|
|
3
|
-
static ID: string;
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
variables: never[];
|
|
8
|
-
prompts: import("@theia/ai-core").PromptVariantSet[];
|
|
9
|
-
languageModelRequirements: LanguageModelRequirement[];
|
|
10
|
-
agentSpecificVariables: never[];
|
|
11
|
-
functions: never[];
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=task-context-agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-context-agent.d.ts","sourceRoot":"","sources":["../../src/browser/task-context-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAKjE,qBACa,gBAAiB,YAAW,KAAK;IAC1C,MAAM,CAAC,EAAE,SAAiB;IAE1B,EAAE,SAAuB;IACzB,IAAI,SAAiB;IACrB,WAAW,SAEoK;IAE/K,SAAS,UAAM;IACf,OAAO,8CAAuF;IAC9F,yBAAyB,EAAE,wBAAwB,EAAE,CAGlD;IACH,sBAAsB,UAAM;IAC5B,SAAS,UAAM;CAClB"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var TaskContextAgent_1;
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.TaskContextAgent = void 0;
|
|
20
|
-
const tslib_1 = require("tslib");
|
|
21
|
-
const core_1 = require("@theia/core");
|
|
22
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
23
|
-
const task_context_prompt_template_1 = require("../common/task-context-prompt-template");
|
|
24
|
-
let TaskContextAgent = TaskContextAgent_1 = class TaskContextAgent {
|
|
25
|
-
constructor() {
|
|
26
|
-
this.id = TaskContextAgent_1.ID;
|
|
27
|
-
this.name = 'TaskContext';
|
|
28
|
-
this.description = core_1.nls.localize('theia/ai/taskcontext/taskContextAgent/description', 'An AI assistant that analyzes chat sessions and creates structured task summaries for coding tasks. ' +
|
|
29
|
-
'This agent specializes in extracting key information from conversations and formatting them into comprehensive task context documents that can be used by other agents.');
|
|
30
|
-
this.variables = [];
|
|
31
|
-
this.prompts = [task_context_prompt_template_1.taskContextSystemVariants, task_context_prompt_template_1.taskContextTemplateVariants, task_context_prompt_template_1.taskContextUpdateVariants];
|
|
32
|
-
this.languageModelRequirements = [{
|
|
33
|
-
purpose: 'TaskContext Creation/Update',
|
|
34
|
-
identifier: 'default/code',
|
|
35
|
-
}];
|
|
36
|
-
this.agentSpecificVariables = [];
|
|
37
|
-
this.functions = [];
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.TaskContextAgent = TaskContextAgent;
|
|
41
|
-
TaskContextAgent.ID = 'TaskContext';
|
|
42
|
-
exports.TaskContextAgent = TaskContextAgent = TaskContextAgent_1 = tslib_1.__decorate([
|
|
43
|
-
(0, inversify_1.injectable)()
|
|
44
|
-
], TaskContextAgent);
|
|
45
|
-
//# sourceMappingURL=task-context-agent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-context-agent.js","sourceRoot":"","sources":["../../src/browser/task-context-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,sCAAkC;AAClC,4DAA0D;AAC1D,yFAA2I;AAGpI,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAAtB;QAGH,OAAE,GAAG,kBAAgB,CAAC,EAAE,CAAC;QACzB,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,UAAG,CAAC,QAAQ,CAAC,mDAAmD,EAC1E,sGAAsG;YACtG,yKAAyK,CAAC,CAAC;QAE/K,cAAS,GAAG,EAAE,CAAC;QACf,YAAO,GAAG,CAAC,wDAAyB,EAAE,0DAA2B,EAAE,wDAAyB,CAAC,CAAC;QAC9F,8BAAyB,GAA+B,CAAC;gBACrD,OAAO,EAAE,6BAA6B;gBACtC,UAAU,EAAE,cAAc;aAC7B,CAAC,CAAC;QACH,2BAAsB,GAAG,EAAE,CAAC;QAC5B,cAAS,GAAG,EAAE,CAAC;IACnB,CAAC;;AAjBY,4CAAgB;AAClB,mBAAE,GAAG,aAAa,AAAhB,CAAiB;2BADjB,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CAiB5B"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Summary, SummaryMetadata, TaskContextStorageService } from '@theia/ai-chat/lib/browser/task-context-service';
|
|
2
|
-
import { InMemoryTaskContextStorage } from '@theia/ai-chat/lib/browser/task-context-storage-service';
|
|
3
|
-
import { DisposableCollection, Emitter, ILogger, PreferenceService, URI } from '@theia/core';
|
|
4
|
-
import { OpenerService } from '@theia/core/lib/browser';
|
|
5
|
-
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
6
|
-
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
7
|
-
import { FileChange } from '@theia/filesystem/lib/common/files';
|
|
8
|
-
export declare class TaskContextFileStorageService implements TaskContextStorageService {
|
|
9
|
-
protected readonly inMemoryStorage: InMemoryTaskContextStorage;
|
|
10
|
-
protected readonly preferenceService: PreferenceService;
|
|
11
|
-
protected readonly workspaceService: WorkspaceService;
|
|
12
|
-
protected readonly fileService: FileService;
|
|
13
|
-
protected readonly openerService: OpenerService;
|
|
14
|
-
protected readonly logger: ILogger;
|
|
15
|
-
protected readonly onDidChangeEmitter: Emitter<void>;
|
|
16
|
-
readonly onDidChange: import("@theia/core").Event<void>;
|
|
17
|
-
protected sanitizeLabel(label: string): string;
|
|
18
|
-
protected getStorageLocation(): URI | undefined;
|
|
19
|
-
protected init(): void;
|
|
20
|
-
protected get ready(): Promise<void>;
|
|
21
|
-
protected doInit(): Promise<void>;
|
|
22
|
-
protected toDisposeOnStorageChange?: DisposableCollection;
|
|
23
|
-
protected watchStorage(): Promise<void>;
|
|
24
|
-
protected handleChanges(changes: FileChange[]): Promise<void>;
|
|
25
|
-
protected clearInMemoryStorage(): void;
|
|
26
|
-
protected deleteFileReference(uri: URI): boolean;
|
|
27
|
-
protected cacheNewTasks(storageLocation: URI): Promise<void>;
|
|
28
|
-
protected readFile(uri: URI): Promise<void>;
|
|
29
|
-
store(summary: Summary): Promise<void>;
|
|
30
|
-
getAll(): Summary[];
|
|
31
|
-
get(identifier: string): Summary | undefined;
|
|
32
|
-
delete(identifier: string): Promise<boolean>;
|
|
33
|
-
protected maybeReadFrontmatter(content: string): {
|
|
34
|
-
body: string;
|
|
35
|
-
frontmatter: SummaryMetadata | undefined;
|
|
36
|
-
};
|
|
37
|
-
protected hasLabel(candidate: unknown): candidate is SummaryMetadata;
|
|
38
|
-
open(identifier: string): Promise<void>;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=task-context-file-storage-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-context-file-storage-service.d.ts","sourceRoot":"","sources":["../../src/browser/task-context-file-storage-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AACtH,OAAO,EAAE,0BAA0B,EAAE,MAAM,yDAAyD,CAAC;AAErG,OAAO,EAAE,oBAAoB,EAAO,OAAO,EAAE,OAAO,EAAQ,iBAAiB,EAAE,GAAG,EAAe,MAAM,aAAa,CAAC;AACrH,OAAO,EAAE,aAAa,EAAQ,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAkB,MAAM,oCAAoC,CAAC;AAIhF,qBACa,6BAA8B,YAAW,yBAAyB;IACvC,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,0BAA0B,CAAC;IACxE,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IACzD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC3D,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAC1C,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACpD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,gBAAuB;IAC5D,QAAQ,CAAC,WAAW,oCAAiC;IAErD,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI9C,SAAS,CAAC,kBAAkB,IAAI,GAAG,GAAG,SAAS;IAU/C,SAAS,CAAC,IAAI,IAAI,IAAI;IAItB,SAAS,KAAK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAKnC;cAEe,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAUvC,SAAS,CAAC,wBAAwB,CAAC,EAAE,oBAAoB,CAAC;cAC1C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;cAgB7B,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAYnE,SAAS,CAAC,oBAAoB,IAAI,IAAI;IAItC,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO;cAYhC,aAAa,CAAC,eAAe,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;cAOlD,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB3C,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB5C,MAAM,IAAI,OAAO,EAAE;IAInB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAItC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYlD,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,eAAe,GAAG,SAAS,CAAA;KAAE;IAa3G,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,eAAe;IAI9D,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOhD"}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2025 EclipseSource GmbH and others.
|
|
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.TaskContextFileStorageService = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const task_context_storage_service_1 = require("@theia/ai-chat/lib/browser/task-context-storage-service");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
const core_1 = require("@theia/core");
|
|
23
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
24
|
-
const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
|
|
25
|
-
const browser_2 = require("@theia/workspace/lib/browser");
|
|
26
|
-
const yaml = require("js-yaml");
|
|
27
|
-
const workspace_preferences_1 = require("../common/workspace-preferences");
|
|
28
|
-
const buffer_1 = require("@theia/core/lib/common/buffer");
|
|
29
|
-
let TaskContextFileStorageService = class TaskContextFileStorageService {
|
|
30
|
-
constructor() {
|
|
31
|
-
this.onDidChangeEmitter = new core_1.Emitter();
|
|
32
|
-
this.onDidChange = this.onDidChangeEmitter.event;
|
|
33
|
-
}
|
|
34
|
-
sanitizeLabel(label) {
|
|
35
|
-
return label.replace(/^[^\p{L}\p{N}]+/vg, '');
|
|
36
|
-
}
|
|
37
|
-
getStorageLocation() {
|
|
38
|
-
var _a;
|
|
39
|
-
if (!this.workspaceService.opened) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const values = this.preferenceService.inspect(workspace_preferences_1.TASK_CONTEXT_STORAGE_DIRECTORY_PREF);
|
|
43
|
-
const configuredPath = (values === null || values === void 0 ? void 0 : values.globalValue) === undefined ? values === null || values === void 0 ? void 0 : values.defaultValue : values === null || values === void 0 ? void 0 : values.globalValue;
|
|
44
|
-
if (!configuredPath || typeof configuredPath !== 'string') {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const asPath = new core_1.Path(configuredPath);
|
|
48
|
-
return asPath.isAbsolute ? new core_1.URI(configuredPath) : (_a = this.workspaceService.tryGetRoots().at(0)) === null || _a === void 0 ? void 0 : _a.resource.resolve(configuredPath);
|
|
49
|
-
}
|
|
50
|
-
init() {
|
|
51
|
-
this.doInit();
|
|
52
|
-
}
|
|
53
|
-
get ready() {
|
|
54
|
-
return Promise.all([
|
|
55
|
-
this.workspaceService.ready,
|
|
56
|
-
this.preferenceService.ready,
|
|
57
|
-
]).then(() => undefined);
|
|
58
|
-
}
|
|
59
|
-
async doInit() {
|
|
60
|
-
await this.ready;
|
|
61
|
-
this.watchStorage();
|
|
62
|
-
this.preferenceService.onPreferenceChanged(e => {
|
|
63
|
-
if (e.preferenceName === workspace_preferences_1.TASK_CONTEXT_STORAGE_DIRECTORY_PREF) {
|
|
64
|
-
this.watchStorage().catch(error => this.logger.error(error));
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
async watchStorage() {
|
|
69
|
-
var _a;
|
|
70
|
-
const newStorage = await this.getStorageLocation();
|
|
71
|
-
(_a = this.toDisposeOnStorageChange) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
72
|
-
this.toDisposeOnStorageChange = undefined;
|
|
73
|
-
if (!newStorage) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
this.toDisposeOnStorageChange = new core_1.DisposableCollection(this.fileService.watch(newStorage, { recursive: true, excludes: [] }), this.fileService.onDidFilesChange(event => {
|
|
77
|
-
const relevantChanges = event.changes.filter(candidate => newStorage.isEqualOrParent(candidate.resource));
|
|
78
|
-
this.handleChanges(relevantChanges);
|
|
79
|
-
}), { dispose: () => this.clearInMemoryStorage() });
|
|
80
|
-
this.cacheNewTasks(newStorage).catch(this.logger.error.bind(this.logger));
|
|
81
|
-
}
|
|
82
|
-
async handleChanges(changes) {
|
|
83
|
-
await Promise.all(changes.map(change => {
|
|
84
|
-
switch (change.type) {
|
|
85
|
-
case 2 /* FileChangeType.DELETED */: return this.deleteFileReference(change.resource);
|
|
86
|
-
case 1 /* FileChangeType.ADDED */:
|
|
87
|
-
case 0 /* FileChangeType.UPDATED */:
|
|
88
|
-
return this.readFile(change.resource);
|
|
89
|
-
default: return (0, core_1.unreachable)(change.type);
|
|
90
|
-
}
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
clearInMemoryStorage() {
|
|
94
|
-
this.inMemoryStorage.clear();
|
|
95
|
-
}
|
|
96
|
-
deleteFileReference(uri) {
|
|
97
|
-
var _a;
|
|
98
|
-
if (this.inMemoryStorage.delete(uri.path.base)) {
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
for (const summary of this.inMemoryStorage.getAll()) {
|
|
102
|
-
if ((_a = summary.uri) === null || _a === void 0 ? void 0 : _a.isEqual(uri)) {
|
|
103
|
-
return this.inMemoryStorage.delete(summary.id);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
async cacheNewTasks(storageLocation) {
|
|
109
|
-
var _a;
|
|
110
|
-
const contents = await this.fileService.resolve(storageLocation).catch(() => undefined);
|
|
111
|
-
if (!((_a = contents === null || contents === void 0 ? void 0 : contents.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
await Promise.all(contents.children.map(child => this.readFile(child.resource)));
|
|
115
|
-
this.onDidChangeEmitter.fire();
|
|
116
|
-
}
|
|
117
|
-
async readFile(uri) {
|
|
118
|
-
const content = await this.fileService.read(uri).then(read => read.value).catch(() => undefined);
|
|
119
|
-
if (content === undefined) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const { frontmatter, body } = this.maybeReadFrontmatter(content);
|
|
123
|
-
const rawLabel = (frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.label) || uri.path.base.slice(0, (-1 * uri.path.ext.length) || uri.path.base.length);
|
|
124
|
-
const summary = {
|
|
125
|
-
...frontmatter,
|
|
126
|
-
summary: body,
|
|
127
|
-
label: this.sanitizeLabel(rawLabel),
|
|
128
|
-
uri,
|
|
129
|
-
id: (frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.sessionId) || uri.path.base
|
|
130
|
-
};
|
|
131
|
-
const existingSummary = summary.sessionId && this.getAll().find(candidate => candidate.sessionId === summary.sessionId);
|
|
132
|
-
if (existingSummary) {
|
|
133
|
-
summary.id = existingSummary.id;
|
|
134
|
-
}
|
|
135
|
-
this.inMemoryStorage.store(summary);
|
|
136
|
-
}
|
|
137
|
-
async store(summary) {
|
|
138
|
-
await this.ready;
|
|
139
|
-
const label = this.sanitizeLabel(summary.label);
|
|
140
|
-
const storageLocation = this.getStorageLocation();
|
|
141
|
-
if (storageLocation) {
|
|
142
|
-
const frontmatter = {
|
|
143
|
-
sessionId: summary.sessionId,
|
|
144
|
-
date: new Date().toISOString(),
|
|
145
|
-
label,
|
|
146
|
-
};
|
|
147
|
-
const derivedName = label.trim().replace(/[^\p{L}\p{N}]/vg, '-').replace(/^-+|-+$/g, '');
|
|
148
|
-
const filename = (derivedName.length > 32 ? derivedName.slice(0, derivedName.indexOf('-', 32)) : derivedName) + '.md';
|
|
149
|
-
const content = yaml.dump(frontmatter).trim() + `${core_1.EOL}---${core_1.EOL}` + summary.summary;
|
|
150
|
-
const uri = storageLocation.resolve(filename);
|
|
151
|
-
summary.uri = uri;
|
|
152
|
-
await this.fileService.writeFile(uri, buffer_1.BinaryBuffer.fromString(content));
|
|
153
|
-
}
|
|
154
|
-
this.inMemoryStorage.store({ ...summary, label });
|
|
155
|
-
this.onDidChangeEmitter.fire();
|
|
156
|
-
}
|
|
157
|
-
getAll() {
|
|
158
|
-
return this.inMemoryStorage.getAll();
|
|
159
|
-
}
|
|
160
|
-
get(identifier) {
|
|
161
|
-
return this.inMemoryStorage.get(identifier);
|
|
162
|
-
}
|
|
163
|
-
async delete(identifier) {
|
|
164
|
-
const summary = this.inMemoryStorage.get(identifier);
|
|
165
|
-
if (summary === null || summary === void 0 ? void 0 : summary.uri) {
|
|
166
|
-
await this.fileService.delete(summary.uri);
|
|
167
|
-
}
|
|
168
|
-
this.inMemoryStorage.delete(identifier);
|
|
169
|
-
if (summary) {
|
|
170
|
-
this.onDidChangeEmitter.fire();
|
|
171
|
-
}
|
|
172
|
-
return !!summary;
|
|
173
|
-
}
|
|
174
|
-
maybeReadFrontmatter(content) {
|
|
175
|
-
const frontmatterEnd = content.indexOf('---');
|
|
176
|
-
if (frontmatterEnd !== -1) {
|
|
177
|
-
try {
|
|
178
|
-
const frontmatter = yaml.load(content.slice(0, frontmatterEnd));
|
|
179
|
-
if (this.hasLabel(frontmatter)) {
|
|
180
|
-
return { frontmatter, body: content.slice(frontmatterEnd + 3).trim() };
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
catch { /* Probably not frontmatter, then. */ }
|
|
184
|
-
}
|
|
185
|
-
return { body: content, frontmatter: undefined };
|
|
186
|
-
}
|
|
187
|
-
hasLabel(candidate) {
|
|
188
|
-
return !!candidate && typeof candidate === 'object' && !Array.isArray(candidate) && 'label' in candidate && typeof candidate.label === 'string';
|
|
189
|
-
}
|
|
190
|
-
async open(identifier) {
|
|
191
|
-
const summary = this.get(identifier);
|
|
192
|
-
if (!summary) {
|
|
193
|
-
throw new Error('Unable to open requested task context: none found with specified identifier.');
|
|
194
|
-
}
|
|
195
|
-
await (summary.uri ? (0, browser_1.open)(this.openerService, summary.uri) : this.inMemoryStorage.open(identifier));
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
exports.TaskContextFileStorageService = TaskContextFileStorageService;
|
|
199
|
-
tslib_1.__decorate([
|
|
200
|
-
(0, inversify_1.inject)(task_context_storage_service_1.InMemoryTaskContextStorage),
|
|
201
|
-
tslib_1.__metadata("design:type", task_context_storage_service_1.InMemoryTaskContextStorage)
|
|
202
|
-
], TaskContextFileStorageService.prototype, "inMemoryStorage", void 0);
|
|
203
|
-
tslib_1.__decorate([
|
|
204
|
-
(0, inversify_1.inject)(core_1.PreferenceService),
|
|
205
|
-
tslib_1.__metadata("design:type", Object)
|
|
206
|
-
], TaskContextFileStorageService.prototype, "preferenceService", void 0);
|
|
207
|
-
tslib_1.__decorate([
|
|
208
|
-
(0, inversify_1.inject)(browser_2.WorkspaceService),
|
|
209
|
-
tslib_1.__metadata("design:type", browser_2.WorkspaceService)
|
|
210
|
-
], TaskContextFileStorageService.prototype, "workspaceService", void 0);
|
|
211
|
-
tslib_1.__decorate([
|
|
212
|
-
(0, inversify_1.inject)(file_service_1.FileService),
|
|
213
|
-
tslib_1.__metadata("design:type", file_service_1.FileService)
|
|
214
|
-
], TaskContextFileStorageService.prototype, "fileService", void 0);
|
|
215
|
-
tslib_1.__decorate([
|
|
216
|
-
(0, inversify_1.inject)(browser_1.OpenerService),
|
|
217
|
-
tslib_1.__metadata("design:type", Object)
|
|
218
|
-
], TaskContextFileStorageService.prototype, "openerService", void 0);
|
|
219
|
-
tslib_1.__decorate([
|
|
220
|
-
(0, inversify_1.inject)(core_1.ILogger),
|
|
221
|
-
tslib_1.__metadata("design:type", Object)
|
|
222
|
-
], TaskContextFileStorageService.prototype, "logger", void 0);
|
|
223
|
-
tslib_1.__decorate([
|
|
224
|
-
(0, inversify_1.postConstruct)(),
|
|
225
|
-
tslib_1.__metadata("design:type", Function),
|
|
226
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
227
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
228
|
-
], TaskContextFileStorageService.prototype, "init", null);
|
|
229
|
-
exports.TaskContextFileStorageService = TaskContextFileStorageService = tslib_1.__decorate([
|
|
230
|
-
(0, inversify_1.injectable)()
|
|
231
|
-
], TaskContextFileStorageService);
|
|
232
|
-
//# sourceMappingURL=task-context-file-storage-service.js.map
|