@theia/ai-chat 1.63.0-next.0 → 1.63.0-next.52
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/lib/browser/agent-delegation-tool.d.ts +25 -0
- package/lib/browser/agent-delegation-tool.d.ts.map +1 -0
- package/lib/browser/agent-delegation-tool.js +171 -0
- package/lib/browser/agent-delegation-tool.js.map +1 -0
- package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-chat-frontend-module.js +15 -1
- package/lib/browser/ai-chat-frontend-module.js.map +1 -1
- package/lib/browser/change-set-file-element.d.ts +28 -7
- package/lib/browser/change-set-file-element.d.ts.map +1 -1
- package/lib/browser/change-set-file-element.js +86 -18
- package/lib/browser/change-set-file-element.js.map +1 -1
- package/lib/browser/change-set-variable.js +1 -2
- package/lib/browser/change-set-variable.js.map +1 -1
- package/lib/browser/chat-tool-preferences.d.ts +54 -0
- package/lib/browser/chat-tool-preferences.d.ts.map +1 -0
- package/lib/browser/chat-tool-preferences.js +170 -0
- package/lib/browser/chat-tool-preferences.js.map +1 -0
- package/lib/browser/chat-tool-request-service.d.ts +20 -0
- package/lib/browser/chat-tool-request-service.d.ts.map +1 -0
- package/lib/browser/chat-tool-request-service.js +89 -0
- package/lib/browser/chat-tool-request-service.js.map +1 -0
- package/lib/browser/delegation-response-content.d.ts +20 -0
- package/lib/browser/delegation-response-content.d.ts.map +1 -0
- package/lib/browser/delegation-response-content.js +51 -0
- package/lib/browser/delegation-response-content.js.map +1 -0
- package/lib/browser/file-chat-variable-contribution.d.ts +15 -1
- package/lib/browser/file-chat-variable-contribution.d.ts.map +1 -1
- package/lib/browser/file-chat-variable-contribution.js +111 -5
- package/lib/browser/file-chat-variable-contribution.js.map +1 -1
- package/lib/browser/frontend-chat-service.d.ts.map +1 -1
- package/lib/browser/frontend-chat-service.js +2 -6
- package/lib/browser/frontend-chat-service.js.map +1 -1
- package/lib/browser/image-context-variable-contribution.d.ts +27 -0
- package/lib/browser/image-context-variable-contribution.d.ts.map +1 -0
- package/lib/browser/image-context-variable-contribution.js +149 -0
- package/lib/browser/image-context-variable-contribution.js.map +1 -0
- package/lib/browser/task-context-service.d.ts +9 -3
- package/lib/browser/task-context-service.d.ts.map +1 -1
- package/lib/browser/task-context-service.js +111 -9
- package/lib/browser/task-context-service.js.map +1 -1
- package/lib/browser/task-context-storage-service.d.ts +1 -0
- package/lib/browser/task-context-storage-service.d.ts.map +1 -1
- package/lib/browser/task-context-storage-service.js +4 -1
- package/lib/browser/task-context-storage-service.js.map +1 -1
- package/lib/common/change-set.d.ts +78 -0
- package/lib/common/change-set.d.ts.map +1 -0
- package/lib/common/change-set.js +133 -0
- package/lib/common/change-set.js.map +1 -0
- package/lib/common/chat-agent-service.d.ts +1 -0
- package/lib/common/chat-agent-service.d.ts.map +1 -1
- package/lib/common/chat-agent-service.js +2 -1
- package/lib/common/chat-agent-service.js.map +1 -1
- package/lib/common/chat-agents.d.ts +2 -2
- package/lib/common/chat-agents.d.ts.map +1 -1
- package/lib/common/chat-agents.js +25 -6
- package/lib/common/chat-agents.js.map +1 -1
- package/lib/common/chat-model.d.ts +68 -80
- package/lib/common/chat-model.d.ts.map +1 -1
- package/lib/common/chat-model.js +224 -136
- package/lib/common/chat-model.js.map +1 -1
- package/lib/common/chat-request-parser.d.ts.map +1 -1
- package/lib/common/chat-request-parser.js +3 -0
- package/lib/common/chat-request-parser.js.map +1 -1
- package/lib/common/chat-service.d.ts +6 -5
- package/lib/common/chat-service.d.ts.map +1 -1
- package/lib/common/chat-service.js +9 -11
- package/lib/common/chat-service.js.map +1 -1
- package/lib/common/image-context-variable.d.ts +29 -0
- package/lib/common/image-context-variable.d.ts.map +1 -0
- package/lib/common/image-context-variable.js +99 -0
- package/lib/common/image-context-variable.js.map +1 -0
- package/package.json +10 -9
- package/src/browser/agent-delegation-tool.ts +207 -0
- package/src/browser/ai-chat-frontend-module.ts +28 -3
- package/src/browser/change-set-file-element.ts +97 -25
- package/src/browser/change-set-variable.ts +1 -1
- package/src/browser/chat-tool-preferences.ts +178 -0
- package/src/browser/chat-tool-request-service.ts +93 -0
- package/src/browser/delegation-response-content.ts +55 -0
- package/src/browser/file-chat-variable-contribution.ts +120 -6
- package/src/browser/frontend-chat-service.ts +3 -6
- package/src/browser/image-context-variable-contribution.ts +153 -0
- package/src/browser/task-context-service.ts +115 -9
- package/src/browser/task-context-storage-service.ts +5 -1
- package/src/common/change-set.ts +197 -0
- package/src/common/chat-agent-service.ts +1 -0
- package/src/common/chat-agents.ts +40 -19
- package/src/common/chat-model.ts +258 -208
- package/src/common/chat-request-parser.ts +3 -0
- package/src/common/chat-service.ts +11 -13
- package/src/common/image-context-variable.ts +116 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-set-variable.js","sourceRoot":"","sources":["../../src/browser/change-set-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,4DAAkE;AAElE,0DAAgE;AAChE,sCAA+E;AAElE,QAAA,2BAA2B,GAAe;IACnD,EAAE,EAAE,uCAA8B;IAClC,WAAW,EAAE,UAAG,CAAC,QAAQ,CAAC,oDAAoD,EAAE,qEAAqE,CAAC;IAEtJ,IAAI,EAAE,uCAA8B;CACvC,CAAC;AAGK,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAItC,iBAAiB,CAAC,OAA0B;QACxC,OAAO,CAAC,gBAAgB,CAAC,mCAA2B,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC;IAED,UAAU,CAAC,OAAoC,EAAE,OAA0B;QACvE,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,mC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AK,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC;YAChD,OAAO;gBACH,QAAQ,EAAE,mCAA2B;gBACrC,KAAK,EAAE,EAAE;aACZ,CAAC;QACN,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC7B,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,KAAK,EAAC,OAAO,EAAC,EAAE,CAAC,WAAW,MAAM,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,CAAC,KAAK,EAAE,CAAC,CACvK,CAAC;QACF,OAAO;YACH,QAAQ,EAAE,mCAA2B;YACrC,KAAK,EAAE;;EAEjB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;CACnB;SACQ,CAAC;IACN,CAAC;CACJ,CAAA;AA/BY,sEAA6B;AAEnB;IADlB,IAAA,kBAAM,EAAC,0BAAgB,CAAC;sCACY,0BAAgB;uEAAC;wCAF7C,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CA+BzC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { interfaces } from '@theia/core/shared/inversify';
|
|
2
|
+
import { PreferenceProxy, PreferenceService, PreferenceSchema } from '@theia/core/lib/browser/preferences';
|
|
3
|
+
/**
|
|
4
|
+
* Enum for tool confirmation modes
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ToolConfirmationMode {
|
|
7
|
+
ALWAYS_ALLOW = "always_allow",
|
|
8
|
+
CONFIRM = "confirm",
|
|
9
|
+
DISABLED = "disabled"
|
|
10
|
+
}
|
|
11
|
+
export declare const TOOL_CONFIRMATION_PREFERENCE = "ai-features.chat.toolConfirmation";
|
|
12
|
+
export declare const chatToolPreferences: PreferenceSchema;
|
|
13
|
+
export interface ChatToolConfiguration {
|
|
14
|
+
[TOOL_CONFIRMATION_PREFERENCE]: {
|
|
15
|
+
[toolId: string]: ToolConfirmationMode;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const ChatToolPreferenceContribution: unique symbol;
|
|
19
|
+
export declare const ChatToolPreferences: unique symbol;
|
|
20
|
+
export type ChatToolPreferences = PreferenceProxy<ChatToolConfiguration>;
|
|
21
|
+
export declare function createChatToolPreferences(preferences: PreferenceService, schema?: PreferenceSchema): ChatToolPreferences;
|
|
22
|
+
export declare function bindChatToolPreferences(bind: interfaces.Bind): void;
|
|
23
|
+
/**
|
|
24
|
+
* Utility class to manage tool confirmation settings
|
|
25
|
+
*/
|
|
26
|
+
export declare class ToolConfirmationManager {
|
|
27
|
+
protected readonly preferences: ChatToolPreferences;
|
|
28
|
+
protected readonly preferenceService: PreferenceService;
|
|
29
|
+
protected sessionOverrides: Map<string, Map<string, ToolConfirmationMode>>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the confirmation mode for a specific tool, considering session overrides first (per chat)
|
|
32
|
+
*/
|
|
33
|
+
getConfirmationMode(toolId: string, chatId: string): ToolConfirmationMode;
|
|
34
|
+
/**
|
|
35
|
+
* Set the confirmation mode for a specific tool (persisted)
|
|
36
|
+
*/
|
|
37
|
+
setConfirmationMode(toolId: string, mode: ToolConfirmationMode): void;
|
|
38
|
+
/**
|
|
39
|
+
* Set the confirmation mode for a specific tool for this session only (not persisted, per chat)
|
|
40
|
+
*/
|
|
41
|
+
setSessionConfirmationMode(toolId: string, mode: ToolConfirmationMode, chatId: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Clear all session overrides for a specific chat, or all if no chatId is given
|
|
44
|
+
*/
|
|
45
|
+
clearSessionOverrides(chatId?: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Get all tool confirmation settings
|
|
48
|
+
*/
|
|
49
|
+
getAllConfirmationSettings(): {
|
|
50
|
+
[toolId: string]: ToolConfirmationMode;
|
|
51
|
+
};
|
|
52
|
+
resetAllConfirmationModeSettings(): void;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=chat-tool-preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-tool-preferences.d.ts","sourceRoot":"","sources":["../../src/browser/chat-tool-preferences.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,UAAU,EAAsB,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAEH,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAEnB,MAAM,qCAAqC,CAAC;AAE7C;;GAEG;AACH,oBAAY,oBAAoB;IAC5B,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,QAAQ,aAAa;CACxB;AAED,eAAO,MAAM,4BAA4B,sCAAsC,CAAC;AAEhF,eAAO,MAAM,mBAAmB,EAAE,gBAqBjC,CAAC;AAEF,MAAM,WAAW,qBAAqB;IAClC,CAAC,4BAA4B,CAAC,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAC;CAC9E;AAED,eAAO,MAAM,8BAA8B,eAA2C,CAAC;AACvF,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AACjE,MAAM,MAAM,mBAAmB,GAAG,eAAe,CAAC,qBAAqB,CAAC,CAAC;AAEzE,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,iBAAiB,EAAE,MAAM,GAAE,gBAAsC,GAAG,mBAAmB,CAE7I;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,GAAG,IAAI,CAQnE;AAED;;GAEG;AACH,qBACa,uBAAuB;IAEhC,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAGpD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAa;IAEvF;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,oBAAoB;IAezE;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,GAAG,IAAI;IAqBrE;;OAEG;IACH,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAS5F;;OAEG;IACH,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ5C;;OAEG;IACH,0BAA0B,IAAI;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE;IAIxE,gCAAgC,IAAI,IAAI;CAQ3C"}
|
|
@@ -0,0 +1,170 @@
|
|
|
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.ToolConfirmationManager = exports.bindChatToolPreferences = exports.createChatToolPreferences = exports.ChatToolPreferences = exports.ChatToolPreferenceContribution = exports.chatToolPreferences = exports.TOOL_CONFIRMATION_PREFERENCE = exports.ToolConfirmationMode = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const ai_core_preferences_1 = require("@theia/ai-core/lib/browser/ai-core-preferences");
|
|
21
|
+
const core_1 = require("@theia/core");
|
|
22
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
23
|
+
const preferences_1 = require("@theia/core/lib/browser/preferences");
|
|
24
|
+
/**
|
|
25
|
+
* Enum for tool confirmation modes
|
|
26
|
+
*/
|
|
27
|
+
var ToolConfirmationMode;
|
|
28
|
+
(function (ToolConfirmationMode) {
|
|
29
|
+
ToolConfirmationMode["ALWAYS_ALLOW"] = "always_allow";
|
|
30
|
+
ToolConfirmationMode["CONFIRM"] = "confirm";
|
|
31
|
+
ToolConfirmationMode["DISABLED"] = "disabled";
|
|
32
|
+
})(ToolConfirmationMode || (exports.ToolConfirmationMode = ToolConfirmationMode = {}));
|
|
33
|
+
exports.TOOL_CONFIRMATION_PREFERENCE = 'ai-features.chat.toolConfirmation';
|
|
34
|
+
exports.chatToolPreferences = {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
[exports.TOOL_CONFIRMATION_PREFERENCE]: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
additionalProperties: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
enum: [ToolConfirmationMode.ALWAYS_ALLOW, ToolConfirmationMode.CONFIRM, ToolConfirmationMode.DISABLED],
|
|
42
|
+
enumDescriptions: [
|
|
43
|
+
core_1.nls.localize('theia/ai/chat/toolConfirmation/yolo/description', 'Execute tools automatically without confirmation'),
|
|
44
|
+
core_1.nls.localize('theia/ai/chat/toolConfirmation/confirm/description', 'Ask for confirmation before executing tools'),
|
|
45
|
+
core_1.nls.localize('theia/ai/chat/toolConfirmation/disabled/description', 'Disable tool execution')
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
default: {},
|
|
49
|
+
description: core_1.nls.localize('theia/ai/chat/toolConfirmation/description', 'Configure confirmation behavior for different tools. Key is the tool ID, value is the confirmation mode.' +
|
|
50
|
+
'Use "*" as the key to set a global default for all tools.'),
|
|
51
|
+
title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
exports.ChatToolPreferenceContribution = Symbol('ChatToolPreferenceContribution');
|
|
56
|
+
exports.ChatToolPreferences = Symbol('ChatToolPreferences');
|
|
57
|
+
function createChatToolPreferences(preferences, schema = exports.chatToolPreferences) {
|
|
58
|
+
return (0, preferences_1.createPreferenceProxy)(preferences, schema);
|
|
59
|
+
}
|
|
60
|
+
exports.createChatToolPreferences = createChatToolPreferences;
|
|
61
|
+
function bindChatToolPreferences(bind) {
|
|
62
|
+
bind(exports.ChatToolPreferences).toDynamicValue((ctx) => {
|
|
63
|
+
const preferences = ctx.container.get(preferences_1.PreferenceService);
|
|
64
|
+
const contribution = ctx.container.get(exports.ChatToolPreferenceContribution);
|
|
65
|
+
return createChatToolPreferences(preferences, contribution.schema);
|
|
66
|
+
}).inSingletonScope();
|
|
67
|
+
bind(exports.ChatToolPreferenceContribution).toConstantValue({ schema: exports.chatToolPreferences });
|
|
68
|
+
bind(preferences_1.PreferenceContribution).toService(exports.ChatToolPreferenceContribution);
|
|
69
|
+
}
|
|
70
|
+
exports.bindChatToolPreferences = bindChatToolPreferences;
|
|
71
|
+
/**
|
|
72
|
+
* Utility class to manage tool confirmation settings
|
|
73
|
+
*/
|
|
74
|
+
let ToolConfirmationManager = class ToolConfirmationManager {
|
|
75
|
+
constructor() {
|
|
76
|
+
// In-memory session overrides (not persisted), per chat
|
|
77
|
+
this.sessionOverrides = new Map();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the confirmation mode for a specific tool, considering session overrides first (per chat)
|
|
81
|
+
*/
|
|
82
|
+
getConfirmationMode(toolId, chatId) {
|
|
83
|
+
const chatMap = this.sessionOverrides.get(chatId);
|
|
84
|
+
if (chatMap && chatMap.has(toolId)) {
|
|
85
|
+
return chatMap.get(toolId);
|
|
86
|
+
}
|
|
87
|
+
const toolConfirmation = this.preferences[exports.TOOL_CONFIRMATION_PREFERENCE];
|
|
88
|
+
if (toolConfirmation[toolId]) {
|
|
89
|
+
return toolConfirmation[toolId];
|
|
90
|
+
}
|
|
91
|
+
if (toolConfirmation['*']) {
|
|
92
|
+
return toolConfirmation['*'];
|
|
93
|
+
}
|
|
94
|
+
return ToolConfirmationMode.ALWAYS_ALLOW; // Default to Always Allow
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Set the confirmation mode for a specific tool (persisted)
|
|
98
|
+
*/
|
|
99
|
+
setConfirmationMode(toolId, mode) {
|
|
100
|
+
const current = this.preferences[exports.TOOL_CONFIRMATION_PREFERENCE] || {};
|
|
101
|
+
// Determine the global default (star entry), or fallback to schema default
|
|
102
|
+
let starMode = current['*'];
|
|
103
|
+
if (starMode === undefined) {
|
|
104
|
+
starMode = ToolConfirmationMode.ALWAYS_ALLOW;
|
|
105
|
+
}
|
|
106
|
+
if (mode === starMode) {
|
|
107
|
+
// Remove the toolId entry if it exists
|
|
108
|
+
if (toolId in current) {
|
|
109
|
+
const { [toolId]: _, ...rest } = current;
|
|
110
|
+
this.preferenceService.updateValue(exports.TOOL_CONFIRMATION_PREFERENCE, rest);
|
|
111
|
+
}
|
|
112
|
+
// else, nothing to update
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
// Set or update the toolId entry
|
|
116
|
+
const updated = { ...current, [toolId]: mode };
|
|
117
|
+
this.preferenceService.updateValue(exports.TOOL_CONFIRMATION_PREFERENCE, updated);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Set the confirmation mode for a specific tool for this session only (not persisted, per chat)
|
|
122
|
+
*/
|
|
123
|
+
setSessionConfirmationMode(toolId, mode, chatId) {
|
|
124
|
+
let chatMap = this.sessionOverrides.get(chatId);
|
|
125
|
+
if (!chatMap) {
|
|
126
|
+
chatMap = new Map();
|
|
127
|
+
this.sessionOverrides.set(chatId, chatMap);
|
|
128
|
+
}
|
|
129
|
+
chatMap.set(toolId, mode);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Clear all session overrides for a specific chat, or all if no chatId is given
|
|
133
|
+
*/
|
|
134
|
+
clearSessionOverrides(chatId) {
|
|
135
|
+
if (chatId) {
|
|
136
|
+
this.sessionOverrides.delete(chatId);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
this.sessionOverrides.clear();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get all tool confirmation settings
|
|
144
|
+
*/
|
|
145
|
+
getAllConfirmationSettings() {
|
|
146
|
+
return this.preferences[exports.TOOL_CONFIRMATION_PREFERENCE] || {};
|
|
147
|
+
}
|
|
148
|
+
resetAllConfirmationModeSettings() {
|
|
149
|
+
const current = this.preferences[exports.TOOL_CONFIRMATION_PREFERENCE] || {};
|
|
150
|
+
if ('*' in current) {
|
|
151
|
+
this.preferenceService.updateValue(exports.TOOL_CONFIRMATION_PREFERENCE, { '*': current['*'] });
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
this.preferenceService.updateValue(exports.TOOL_CONFIRMATION_PREFERENCE, {});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
exports.ToolConfirmationManager = ToolConfirmationManager;
|
|
159
|
+
tslib_1.__decorate([
|
|
160
|
+
(0, inversify_1.inject)(exports.ChatToolPreferences),
|
|
161
|
+
tslib_1.__metadata("design:type", Object)
|
|
162
|
+
], ToolConfirmationManager.prototype, "preferences", void 0);
|
|
163
|
+
tslib_1.__decorate([
|
|
164
|
+
(0, inversify_1.inject)(preferences_1.PreferenceService),
|
|
165
|
+
tslib_1.__metadata("design:type", Object)
|
|
166
|
+
], ToolConfirmationManager.prototype, "preferenceService", void 0);
|
|
167
|
+
exports.ToolConfirmationManager = ToolConfirmationManager = tslib_1.__decorate([
|
|
168
|
+
(0, inversify_1.injectable)()
|
|
169
|
+
], ToolConfirmationManager);
|
|
170
|
+
//# sourceMappingURL=chat-tool-preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-tool-preferences.js","sourceRoot":"","sources":["../../src/browser/chat-tool-preferences.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,wFAA2F;AAC3F,sCAAkC;AAClC,4DAA8E;AAC9E,qEAM6C;AAE7C;;GAEG;AACH,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC5B,qDAA6B,CAAA;IAC7B,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;AACzB,CAAC,EAJW,oBAAoB,oCAApB,oBAAoB,QAI/B;AAEY,QAAA,4BAA4B,GAAG,mCAAmC,CAAC;AAEnE,QAAA,mBAAmB,GAAqB;IACjD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,CAAC,oCAA4B,CAAC,EAAE;YAC5B,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE;gBAClB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,oBAAoB,CAAC,YAAY,EAAE,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,CAAC,QAAQ,CAAC;gBACtG,gBAAgB,EAAE;oBACd,UAAG,CAAC,QAAQ,CAAC,iDAAiD,EAAE,kDAAkD,CAAC;oBACnH,UAAG,CAAC,QAAQ,CAAC,oDAAoD,EAAE,6CAA6C,CAAC;oBACjH,UAAG,CAAC,QAAQ,CAAC,qDAAqD,EAAE,wBAAwB,CAAC;iBAChG;aACJ;YACD,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,UAAG,CAAC,QAAQ,CAAC,4CAA4C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B;AAGjC;IADlB,IAAA,kBAAM,EAAC,+BAAiB,CAAC;;kEAC8B;kCAL/C,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CA0FnC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ToolRequest } from '@theia/ai-core';
|
|
2
|
+
import { ChatToolRequestService, ChatToolRequest } from '../common/chat-tool-request-service';
|
|
3
|
+
import { MutableChatRequestModel, ToolCallChatResponseContent } from '../common/chat-model';
|
|
4
|
+
import { ToolConfirmationManager, ChatToolPreferences } from './chat-tool-preferences';
|
|
5
|
+
/**
|
|
6
|
+
* Frontend-specific implementation of ChatToolRequestService that handles tool confirmation
|
|
7
|
+
*/
|
|
8
|
+
export declare class FrontendChatToolRequestService extends ChatToolRequestService {
|
|
9
|
+
protected readonly confirmationManager: ToolConfirmationManager;
|
|
10
|
+
protected readonly preferences: ChatToolPreferences;
|
|
11
|
+
protected toChatToolRequest(toolRequest: ToolRequest, request: MutableChatRequestModel): ChatToolRequest;
|
|
12
|
+
/**
|
|
13
|
+
* Find existing tool call content or create a new one for confirmation tracking
|
|
14
|
+
*
|
|
15
|
+
* Looks for ToolCallChatResponseContent nodes where the name field matches the toolRequest id.
|
|
16
|
+
* Starts from the back of the content array to find the most recent match.
|
|
17
|
+
*/
|
|
18
|
+
protected findToolCallContent(toolRequest: ToolRequest, arguments_: string, request: MutableChatRequestModel): ToolCallChatResponseContent;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=chat-tool-request-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-tool-request-service.d.ts","sourceRoot":"","sources":["../../src/browser/chat-tool-request-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,uBAAuB,EAAwB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE7G;;GAEG;AACH,qBACa,8BAA+B,SAAQ,sBAAsB;IAGtE,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;IAGhE,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;cAEjC,iBAAiB,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,GAAG,eAAe;IAgCjH;;;;;OAKG;IACH,SAAS,CAAC,mBAAmB,CACzB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,uBAAuB,GACjC,2BAA2B;CAgBjC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.FrontendChatToolRequestService = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const chat_tool_request_service_1 = require("../common/chat-tool-request-service");
|
|
22
|
+
const chat_model_1 = require("../common/chat-model");
|
|
23
|
+
const chat_tool_preferences_1 = require("./chat-tool-preferences");
|
|
24
|
+
/**
|
|
25
|
+
* Frontend-specific implementation of ChatToolRequestService that handles tool confirmation
|
|
26
|
+
*/
|
|
27
|
+
let FrontendChatToolRequestService = class FrontendChatToolRequestService extends chat_tool_request_service_1.ChatToolRequestService {
|
|
28
|
+
toChatToolRequest(toolRequest, request) {
|
|
29
|
+
const confirmationMode = this.confirmationManager.getConfirmationMode(toolRequest.id, request.session.id);
|
|
30
|
+
return {
|
|
31
|
+
...toolRequest,
|
|
32
|
+
handler: async (arg_string) => {
|
|
33
|
+
switch (confirmationMode) {
|
|
34
|
+
case chat_tool_preferences_1.ToolConfirmationMode.DISABLED:
|
|
35
|
+
return { denied: true, message: `Tool ${toolRequest.id} is disabled` };
|
|
36
|
+
case chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW:
|
|
37
|
+
// Execute immediately without confirmation
|
|
38
|
+
return toolRequest.handler(arg_string, request);
|
|
39
|
+
case chat_tool_preferences_1.ToolConfirmationMode.CONFIRM:
|
|
40
|
+
default:
|
|
41
|
+
// Create confirmation requirement
|
|
42
|
+
const toolCallContent = this.findToolCallContent(toolRequest, arg_string, request);
|
|
43
|
+
const confirmed = await toolCallContent.confirmed;
|
|
44
|
+
if (confirmed) {
|
|
45
|
+
return toolRequest.handler(arg_string, request);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Return an object indicating the user denied the tool execution
|
|
49
|
+
// instead of throwing an error
|
|
50
|
+
return { denied: true, message: `Tool execution denied by user: ${toolRequest.id}` };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Find existing tool call content or create a new one for confirmation tracking
|
|
58
|
+
*
|
|
59
|
+
* Looks for ToolCallChatResponseContent nodes where the name field matches the toolRequest id.
|
|
60
|
+
* Starts from the back of the content array to find the most recent match.
|
|
61
|
+
*/
|
|
62
|
+
findToolCallContent(toolRequest, arguments_, request) {
|
|
63
|
+
// Look for existing tool call content with matching ID
|
|
64
|
+
const response = request.response.response;
|
|
65
|
+
const contentArray = response.content;
|
|
66
|
+
// Start from the end of the array and find the first match
|
|
67
|
+
for (let i = contentArray.length - 1; i >= 0; i--) {
|
|
68
|
+
const content = contentArray[i];
|
|
69
|
+
if (chat_model_1.ToolCallChatResponseContent.is(content) &&
|
|
70
|
+
content.name === toolRequest.id) {
|
|
71
|
+
return content;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`Tool call content for tool ${toolRequest.id} not found in the response`);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
exports.FrontendChatToolRequestService = FrontendChatToolRequestService;
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, inversify_1.inject)(chat_tool_preferences_1.ToolConfirmationManager),
|
|
80
|
+
tslib_1.__metadata("design:type", chat_tool_preferences_1.ToolConfirmationManager)
|
|
81
|
+
], FrontendChatToolRequestService.prototype, "confirmationManager", void 0);
|
|
82
|
+
tslib_1.__decorate([
|
|
83
|
+
(0, inversify_1.inject)(chat_tool_preferences_1.ChatToolPreferences),
|
|
84
|
+
tslib_1.__metadata("design:type", Object)
|
|
85
|
+
], FrontendChatToolRequestService.prototype, "preferences", void 0);
|
|
86
|
+
exports.FrontendChatToolRequestService = FrontendChatToolRequestService = tslib_1.__decorate([
|
|
87
|
+
(0, inversify_1.injectable)()
|
|
88
|
+
], FrontendChatToolRequestService);
|
|
89
|
+
//# sourceMappingURL=chat-tool-request-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-tool-request-service.js","sourceRoot":"","sources":["../../src/browser/chat-tool-request-service.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,E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WAAW,CAAC,EAAE,EAAE,EAAE,CAAC;wBACzF,CAAC;gBACT,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACO,mBAAmB,CACzB,WAAwB,EACxB,UAAkB,EAClB,OAAgC;QAEhC,uDAAuD;QACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC3C,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC;QAEtC,2DAA2D;QAC3D,KAAK,IAAI,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAChD,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,wCAA2B,CAAC,EAAE,CAAC,OAAO,CAAC;gBACvC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,EAAE,EAAE,CAAC;gBAClC,OAAO,OAAO,CAAC;YACnB,CAAC;QACL,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,WAAW,CAAC,EAAE,4BAA4B,CAAC,CAAC;IAC9F,CAAC;CACJ,CAAA;AAlEY,wEAA8B;AAGpB;IADlB,IAAA,kBAAM,EAAC,+CAAuB,CAAC;sCACQ,+CAAuB;2EAAC;AAG7C;IADlB,IAAA,kBAAM,EAAC,2CAAmB,CAAC;;mEACwB;yCAN3C,8BAA8B;IAD1C,IAAA,sBAAU,GAAE;GACA,8BAA8B,CAkE1C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChatRequestInvocation, ChatResponseContent } from '../common';
|
|
2
|
+
/**
|
|
3
|
+
* Response Content created when an Agent delegates a prompt to another agent.
|
|
4
|
+
* Contains agent id, delegated prompt, and the response.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DelegationResponseContent implements ChatResponseContent {
|
|
7
|
+
agentId: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
response: ChatRequestInvocation;
|
|
10
|
+
kind: string;
|
|
11
|
+
/**
|
|
12
|
+
* @param agentId The id of the agent to whom the task was delegated
|
|
13
|
+
* @param prompt The prompt that was delegated
|
|
14
|
+
* @param response The response from the delegated agent
|
|
15
|
+
*/
|
|
16
|
+
constructor(agentId: string, prompt: string, response: ChatRequestInvocation);
|
|
17
|
+
asString(): string;
|
|
18
|
+
}
|
|
19
|
+
export declare function isDelegationResponseContent(value: unknown): value is DelegationResponseContent;
|
|
20
|
+
//# sourceMappingURL=delegation-response-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-response-content.d.ts","sourceRoot":"","sources":["../../src/browser/delegation-response-content.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEvE;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IAStD,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,qBAAqB;IAV1C,IAAI,SAAqB;IAEzB;;;;OAIG;gBAEQ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,qBAAqB;IAK1C,QAAQ,IAAI,MAAM;CAOrB;AAED,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,OAAO,GACf,KAAK,IAAI,yBAAyB,CAKpC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDelegationResponseContent = exports.DelegationResponseContent = void 0;
|
|
4
|
+
// *****************************************************************************
|
|
5
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
6
|
+
//
|
|
7
|
+
// This program and the accompanying materials are made available under the
|
|
8
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
//
|
|
11
|
+
// This Source Code may also be made available under the following Secondary
|
|
12
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
// with the GNU Classpath Exception which is available at
|
|
15
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
//
|
|
17
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
18
|
+
// *****************************************************************************
|
|
19
|
+
const core_1 = require("@theia/core");
|
|
20
|
+
/**
|
|
21
|
+
* Response Content created when an Agent delegates a prompt to another agent.
|
|
22
|
+
* Contains agent id, delegated prompt, and the response.
|
|
23
|
+
*/
|
|
24
|
+
class DelegationResponseContent {
|
|
25
|
+
/**
|
|
26
|
+
* @param agentId The id of the agent to whom the task was delegated
|
|
27
|
+
* @param prompt The prompt that was delegated
|
|
28
|
+
* @param response The response from the delegated agent
|
|
29
|
+
*/
|
|
30
|
+
constructor(agentId, prompt, response) {
|
|
31
|
+
this.agentId = agentId;
|
|
32
|
+
this.prompt = prompt;
|
|
33
|
+
this.response = response;
|
|
34
|
+
this.kind = 'AgentDelegation';
|
|
35
|
+
// Empty
|
|
36
|
+
}
|
|
37
|
+
asString() {
|
|
38
|
+
const json = {
|
|
39
|
+
agentId: this.agentId,
|
|
40
|
+
prompt: this.prompt
|
|
41
|
+
};
|
|
42
|
+
return JSON.stringify(json);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.DelegationResponseContent = DelegationResponseContent;
|
|
46
|
+
function isDelegationResponseContent(value) {
|
|
47
|
+
return ((0, core_1.isObject)(value) &&
|
|
48
|
+
value.kind === 'AgentDelegation');
|
|
49
|
+
}
|
|
50
|
+
exports.isDelegationResponseContent = isDelegationResponseContent;
|
|
51
|
+
//# sourceMappingURL=delegation-response-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation-response-content.js","sourceRoot":"","sources":["../../src/browser/delegation-response-content.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,sCAAuC;AAGvC;;;GAGG;AACH,MAAa,yBAAyB;IAGlC;;;;OAIG;IACH,YACW,OAAe,EACf,MAAc,EACd,QAA+B;QAF/B,YAAO,GAAP,OAAO,CAAQ;QACf,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAuB;QAV1C,SAAI,GAAG,iBAAiB,CAAC;QAYrB,QAAQ;IACZ,CAAC;IAED,QAAQ;QACJ,MAAM,IAAI,GAAG;YACT,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;SACtB,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACJ;AAvBD,8DAuBC;AAED,SAAgB,2BAA2B,CACvC,KAAc;IAEd,OAAO,CACH,IAAA,eAAQ,EAA4B,KAAK,CAAC;QAC1C,KAAK,CAAC,IAAI,KAAK,iBAAiB,CACnC,CAAC;AACN,CAAC;AAPD,kEAOC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AIVariableContext } from '@theia/ai-core';
|
|
2
2
|
import { AIVariableDropResult, FrontendVariableContribution, FrontendVariableService } from '@theia/ai-core/lib/browser';
|
|
3
|
-
import { QuickInputService } from '@theia/core';
|
|
3
|
+
import { ILogger, QuickInputService, URI } from '@theia/core';
|
|
4
4
|
import * as monaco from '@theia/monaco-editor-core';
|
|
5
5
|
import { QuickFileSelectService } from '@theia/file-search/lib/browser/quick-file-select-service';
|
|
6
6
|
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
@@ -10,9 +10,23 @@ export declare class FileChatVariableContribution implements FrontendVariableCon
|
|
|
10
10
|
protected readonly wsService: WorkspaceService;
|
|
11
11
|
protected readonly quickInputService: QuickInputService;
|
|
12
12
|
protected readonly quickFileSelectService: QuickFileSelectService;
|
|
13
|
+
protected readonly logger: ILogger;
|
|
13
14
|
registerVariables(service: FrontendVariableService): void;
|
|
14
15
|
protected triggerArgumentPicker(): Promise<string | undefined>;
|
|
16
|
+
protected imageArgumentPicker(): Promise<string | undefined>;
|
|
15
17
|
protected provideArgumentCompletionItems(model: monaco.editor.ITextModel, position: monaco.Position, matchString?: string): Promise<monaco.languages.CompletionItem[] | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a file is an image based on its extension.
|
|
20
|
+
*/
|
|
21
|
+
protected isImageFile(filePath: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Determines the MIME type based on file extension.
|
|
24
|
+
*/
|
|
25
|
+
protected getMimeTypeFromExtension(filePath: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Converts a file to base64 data URL.
|
|
28
|
+
*/
|
|
29
|
+
protected fileToBase64(uri: URI): Promise<string>;
|
|
16
30
|
protected handleDrop(event: DragEvent, _: AIVariableContext): Promise<AIVariableDropResult | undefined>;
|
|
17
31
|
}
|
|
18
32
|
//# sourceMappingURL=file-chat-variable-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-chat-variable-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/file-chat-variable-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAA2C,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAA+B,oBAAoB,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEtJ,OAAO,EAAqB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"file-chat-variable-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/file-chat-variable-contribution.ts"],"names":[],"mappings":"AAgBA,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