@theia/ai-ide 1.74.0-next.0 → 1.74.0-next.15
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/ai-allow-all-mode-chat-banner.d.ts +68 -0
- package/lib/browser/ai-allow-all-mode-chat-banner.d.ts.map +1 -0
- package/lib/browser/ai-allow-all-mode-chat-banner.js +184 -0
- package/lib/browser/ai-allow-all-mode-chat-banner.js.map +1 -0
- package/lib/browser/ai-allow-all-mode-chat-banner.spec.d.ts +2 -0
- package/lib/browser/ai-allow-all-mode-chat-banner.spec.d.ts.map +1 -0
- package/lib/browser/ai-allow-all-mode-chat-banner.spec.js +170 -0
- package/lib/browser/ai-allow-all-mode-chat-banner.spec.js.map +1 -0
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts +3 -4
- package/lib/browser/ai-configuration/tools-configuration-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/tools-configuration-widget.js +17 -10
- package/lib/browser/ai-configuration/tools-configuration-widget.js.map +1 -1
- package/lib/browser/chat-session-item.d.ts.map +1 -1
- package/lib/browser/chat-session-item.js +12 -12
- package/lib/browser/chat-session-item.js.map +1 -1
- package/lib/browser/chat-session-tooltip.d.ts +1 -1
- package/lib/browser/chat-session-tooltip.d.ts.map +1 -1
- package/lib/browser/chat-session-tooltip.js +14 -6
- package/lib/browser/chat-session-tooltip.js.map +1 -1
- package/lib/browser/chat-sessions-welcome-message-provider.d.ts.map +1 -1
- package/lib/browser/chat-sessions-welcome-message-provider.js +8 -12
- package/lib/browser/chat-sessions-welcome-message-provider.js.map +1 -1
- package/lib/browser/chat-sessions-welcome-message-provider.spec.js +6 -6
- package/lib/browser/chat-sessions-welcome-message-provider.spec.js.map +1 -1
- package/lib/browser/context-file-validation-service-impl.spec.js +2 -2
- package/lib/browser/context-file-validation-service-impl.spec.js.map +1 -1
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +3 -0
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/workspace-functions.d.ts +5 -6
- package/lib/browser/workspace-functions.d.ts.map +1 -1
- package/lib/browser/workspace-functions.js +24 -9
- package/lib/browser/workspace-functions.js.map +1 -1
- package/lib/browser/workspace-functions.spec.js +29 -29
- package/lib/browser/workspace-functions.spec.js.map +1 -1
- package/lib/browser/workspace-launch-provider.spec.js +3 -3
- package/lib/browser/workspace-launch-provider.spec.js.map +1 -1
- package/lib/browser/workspace-task-provider.spec.js +4 -4
- package/lib/browser/workspace-task-provider.spec.js.map +1 -1
- package/package.json +23 -23
- package/src/browser/ai-allow-all-mode-chat-banner.spec.ts +205 -0
- package/src/browser/ai-allow-all-mode-chat-banner.tsx +217 -0
- package/src/browser/ai-configuration/tools-configuration-widget.tsx +20 -13
- package/src/browser/chat-session-item.tsx +13 -13
- package/src/browser/chat-session-tooltip.ts +14 -7
- package/src/browser/chat-sessions-welcome-message-provider.spec.ts +8 -8
- package/src/browser/chat-sessions-welcome-message-provider.tsx +8 -12
- package/src/browser/context-file-validation-service-impl.spec.ts +3 -3
- package/src/browser/frontend-module.ts +3 -0
- package/src/browser/style/index.css +67 -0
- package/src/browser/workspace-functions.spec.ts +36 -37
- package/src/browser/workspace-functions.ts +8 -9
- package/src/browser/workspace-launch-provider.spec.ts +5 -5
- package/src/browser/workspace-task-provider.spec.ts +6 -7
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from '@theia/core/shared/react';
|
|
2
|
+
import { DisposableCollection, Emitter, Event } from '@theia/core';
|
|
3
|
+
import { PreferenceService } from '@theia/core/lib/common';
|
|
4
|
+
import { ChatBannerProvider } from '@theia/ai-chat-ui/lib/browser/chat-banner-provider';
|
|
5
|
+
interface AiSessionOverride {
|
|
6
|
+
/** Human-readable label, e.g. "Default tool confirmation: always_allow". */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Whether this override bypasses AI tool confirmations globally. */
|
|
9
|
+
bypass: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Persistent strip rendered above the chat content whenever an AI tool confirmation
|
|
13
|
+
* preference (`ai-features.chat.defaultToolConfirmation` or `ai-features.chat.toolConfirmation`)
|
|
14
|
+
* is active in the session scope (typically set via `--session-preference`). When the
|
|
15
|
+
* global default is forced to "Allow All" the strip is shown in error styling as the
|
|
16
|
+
* Theia AI Allow-All Mode banner; per-tool confirmation overrides use warning styling.
|
|
17
|
+
*
|
|
18
|
+
* Other AI-namespaced session overrides (e.g. forced-on AI features, default chat agent)
|
|
19
|
+
* are reported by the generic Session Preferences status bar item and intentionally not
|
|
20
|
+
* duplicated here.
|
|
21
|
+
*/
|
|
22
|
+
export declare class AiAllowAllModeChatBanner implements ChatBannerProvider {
|
|
23
|
+
readonly priority = 1000;
|
|
24
|
+
protected readonly preferenceService: PreferenceService;
|
|
25
|
+
protected readonly toDispose: DisposableCollection;
|
|
26
|
+
protected readonly onDidChangeEmitter: Emitter<void>;
|
|
27
|
+
readonly onDidChange: Event<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Only tool confirmation preferences are watched here. Other AI session overrides
|
|
30
|
+
* (enable AI, agent mode, default chat agent, etc.) are surfaced in the generic
|
|
31
|
+
* Session Preferences status bar item to keep the banner from duplicating the list.
|
|
32
|
+
*/
|
|
33
|
+
protected readonly watchedKeys: ReadonlyArray<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Process-lifetime dismissal flag. Reset on the next launch so the user is
|
|
36
|
+
* always reminded once per process. Also automatically cleared when the override
|
|
37
|
+
* set changes in any way after a dismissal (see {@link init}), so a previously
|
|
38
|
+
* dismissed strip cannot silently hide new or escalated overrides.
|
|
39
|
+
*/
|
|
40
|
+
protected dismissed: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Signature of the override set at the moment the user dismissed the strip.
|
|
43
|
+
* `undefined` while the strip is not dismissed.
|
|
44
|
+
*/
|
|
45
|
+
protected dismissedSignature: string | undefined;
|
|
46
|
+
protected init(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Stable snapshot of the watched preferences' current session values. Used to
|
|
49
|
+
* detect changes to the override set for the dismissal-reset logic; not for
|
|
50
|
+
* anything user-visible so the format is intentionally simple.
|
|
51
|
+
*/
|
|
52
|
+
protected overrideSignature(): string;
|
|
53
|
+
renderBanner(): React.ReactNode | undefined;
|
|
54
|
+
/** AI-relevant preferences currently coming from the session scope. */
|
|
55
|
+
protected collectOverrides(): AiSessionOverride[];
|
|
56
|
+
/**
|
|
57
|
+
* Returns `true` only when the global default is forced to Allow-All. Per-tool
|
|
58
|
+
* `always_allow` entries via `TOOL_CONFIRMATION_PREFERENCE` are scoped exceptions
|
|
59
|
+
* and remain in the banner as informational (warning) entries rather than escalating
|
|
60
|
+
* the whole strip to the red "Allow-All Mode" treatment.
|
|
61
|
+
*/
|
|
62
|
+
protected isBypassValue(key: string, value: unknown): boolean;
|
|
63
|
+
protected describe(key: string, value: unknown): string;
|
|
64
|
+
protected handleDismiss: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
65
|
+
dispose(): void;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=ai-allow-all-mode-chat-banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-allow-all-mode-chat-banner.d.ts","sourceRoot":"","sources":["../../src/browser/ai-allow-all-mode-chat-banner.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAOxF,UAAU,iBAAiB;IACvB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,qBACa,wBAAyB,YAAW,kBAAkB;IAE/D,QAAQ,CAAC,QAAQ,QAAQ;IAGzB,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAExD,SAAS,CAAC,QAAQ,CAAC,SAAS,uBAA8B;IAC1D,SAAS,CAAC,QAAQ,CAAC,kBAAkB,gBAAuB;IAC5D,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAiC;IAElE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,CAGnD;IAEF;;;;;OAKG;IACH,SAAS,CAAC,SAAS,UAAS;IAE5B;;;OAGG;IACH,SAAS,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAGjD,SAAS,CAAC,IAAI,IAAI,IAAI;IAiBtB;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,IAAI,MAAM;IAMrC,YAAY,IAAI,KAAK,CAAC,SAAS,GAAG,SAAS;IA0C3C,uEAAuE;IACvE,SAAS,CAAC,gBAAgB,IAAI,iBAAiB,EAAE;IAejD;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO;IAO7D,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM;IAqBvD,SAAS,CAAC,aAAa,GAAI,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,UAO/D;IAEF,OAAO,IAAI,IAAI;CAGlB"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource 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.AiAllowAllModeChatBanner = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const React = require("@theia/core/shared/react");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
23
|
+
const core_1 = require("@theia/core");
|
|
24
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
25
|
+
const common_1 = require("@theia/core/lib/common");
|
|
26
|
+
const chat_tool_preferences_1 = require("@theia/ai-chat/lib/common/chat-tool-preferences");
|
|
27
|
+
/**
|
|
28
|
+
* Persistent strip rendered above the chat content whenever an AI tool confirmation
|
|
29
|
+
* preference (`ai-features.chat.defaultToolConfirmation` or `ai-features.chat.toolConfirmation`)
|
|
30
|
+
* is active in the session scope (typically set via `--session-preference`). When the
|
|
31
|
+
* global default is forced to "Allow All" the strip is shown in error styling as the
|
|
32
|
+
* Theia AI Allow-All Mode banner; per-tool confirmation overrides use warning styling.
|
|
33
|
+
*
|
|
34
|
+
* Other AI-namespaced session overrides (e.g. forced-on AI features, default chat agent)
|
|
35
|
+
* are reported by the generic Session Preferences status bar item and intentionally not
|
|
36
|
+
* duplicated here.
|
|
37
|
+
*/
|
|
38
|
+
let AiAllowAllModeChatBanner = class AiAllowAllModeChatBanner {
|
|
39
|
+
constructor() {
|
|
40
|
+
this.priority = 1000;
|
|
41
|
+
this.toDispose = new core_1.DisposableCollection();
|
|
42
|
+
this.onDidChangeEmitter = new core_1.Emitter();
|
|
43
|
+
this.onDidChange = this.onDidChangeEmitter.event;
|
|
44
|
+
/**
|
|
45
|
+
* Only tool confirmation preferences are watched here. Other AI session overrides
|
|
46
|
+
* (enable AI, agent mode, default chat agent, etc.) are surfaced in the generic
|
|
47
|
+
* Session Preferences status bar item to keep the banner from duplicating the list.
|
|
48
|
+
*/
|
|
49
|
+
this.watchedKeys = [
|
|
50
|
+
chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE,
|
|
51
|
+
chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE
|
|
52
|
+
];
|
|
53
|
+
/**
|
|
54
|
+
* Process-lifetime dismissal flag. Reset on the next launch so the user is
|
|
55
|
+
* always reminded once per process. Also automatically cleared when the override
|
|
56
|
+
* set changes in any way after a dismissal (see {@link init}), so a previously
|
|
57
|
+
* dismissed strip cannot silently hide new or escalated overrides.
|
|
58
|
+
*/
|
|
59
|
+
this.dismissed = false;
|
|
60
|
+
this.handleDismiss = (e) => {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
this.dismissed = true;
|
|
63
|
+
// Snapshot the signature so a subsequent change to the override set is detected
|
|
64
|
+
// in the preference-change listener and un-dismisses the strip automatically.
|
|
65
|
+
this.dismissedSignature = this.overrideSignature();
|
|
66
|
+
this.onDidChangeEmitter.fire();
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
init() {
|
|
70
|
+
const watched = new Set(this.watchedKeys);
|
|
71
|
+
this.toDispose.push(this.preferenceService.onPreferenceChanged(e => {
|
|
72
|
+
if (!watched.has(e.preferenceName)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (this.dismissed && this.overrideSignature() !== this.dismissedSignature) {
|
|
76
|
+
// The override set has changed since the user dismissed the strip
|
|
77
|
+
// (new override added, existing value changed, escalation into a bypass, ...).
|
|
78
|
+
// Re-surface the strip so the change cannot hide behind the earlier dismissal.
|
|
79
|
+
this.dismissed = false;
|
|
80
|
+
this.dismissedSignature = undefined;
|
|
81
|
+
}
|
|
82
|
+
this.onDidChangeEmitter.fire();
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Stable snapshot of the watched preferences' current session values. Used to
|
|
87
|
+
* detect changes to the override set for the dismissal-reset logic; not for
|
|
88
|
+
* anything user-visible so the format is intentionally simple.
|
|
89
|
+
*/
|
|
90
|
+
overrideSignature() {
|
|
91
|
+
return this.watchedKeys
|
|
92
|
+
.map(key => `${key}=${JSON.stringify(this.preferenceService.inspect(key)?.sessionValue ?? undefined)}`)
|
|
93
|
+
.join('|');
|
|
94
|
+
}
|
|
95
|
+
renderBanner() {
|
|
96
|
+
if (this.dismissed) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const overrides = this.collectOverrides();
|
|
100
|
+
if (overrides.length === 0) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const isAllowAll = overrides.some(override => override.bypass);
|
|
104
|
+
const className = `theia-ai-allow-all-mode-strip ${isAllowAll ? 'is-allow-all' : 'is-overrides'}`;
|
|
105
|
+
const title = isAllowAll
|
|
106
|
+
? nls_1.nls.localize('theia/ai/ide/allowAllMode/title', 'Theia AI Allow-All Mode')
|
|
107
|
+
: nls_1.nls.localize('theia/ai/ide/toolConfirmationOverrides/title', 'AI Tool Confirmation Overrides');
|
|
108
|
+
const tooltipLines = [
|
|
109
|
+
isAllowAll
|
|
110
|
+
? nls_1.nls.localize('theia/ai/ide/allowAllMode/stripTooltip', 'AI tool calls run without confirmation in this session. Only enable in environments you trust.')
|
|
111
|
+
: nls_1.nls.localize('theia/ai/ide/toolConfirmationOverrides/stripTooltip', 'One or more AI tools are auto-approved for this session via command-line flags.'),
|
|
112
|
+
'',
|
|
113
|
+
...overrides.map(override => `• ${override.label}`),
|
|
114
|
+
'',
|
|
115
|
+
nls_1.nls.localize('theia/ai/ide/allowAllMode/stripTooltipFooter', 'Set via --session-preference. Restart without the flag to restore your saved settings.')
|
|
116
|
+
];
|
|
117
|
+
return React.createElement("div", { className: className, title: tooltipLines.join('\n'), role: 'status', "aria-live": 'polite' },
|
|
118
|
+
React.createElement("span", { className: `theia-ai-allow-all-mode-strip-icon ${(0, browser_1.codicon)('warning')}` }),
|
|
119
|
+
React.createElement("span", { className: 'theia-ai-allow-all-mode-strip-title' }, title),
|
|
120
|
+
React.createElement("button", { type: 'button', className: `theia-ai-allow-all-mode-strip-dismiss ${(0, browser_1.codicon)('close')}`, title: nls_1.nls.localize('theia/ai/ide/allowAllMode/dismiss', 'Hide for this session'), "aria-label": nls_1.nls.localize('theia/ai/ide/allowAllMode/dismiss', 'Hide for this session'), onClick: this.handleDismiss }));
|
|
121
|
+
}
|
|
122
|
+
/** AI-relevant preferences currently coming from the session scope. */
|
|
123
|
+
collectOverrides() {
|
|
124
|
+
const overrides = [];
|
|
125
|
+
for (const key of this.watchedKeys) {
|
|
126
|
+
const sessionValue = this.preferenceService.inspect(key)?.sessionValue;
|
|
127
|
+
if (sessionValue === undefined) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
overrides.push({
|
|
131
|
+
label: this.describe(key, sessionValue),
|
|
132
|
+
bypass: this.isBypassValue(key, sessionValue)
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return overrides;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns `true` only when the global default is forced to Allow-All. Per-tool
|
|
139
|
+
* `always_allow` entries via `TOOL_CONFIRMATION_PREFERENCE` are scoped exceptions
|
|
140
|
+
* and remain in the banner as informational (warning) entries rather than escalating
|
|
141
|
+
* the whole strip to the red "Allow-All Mode" treatment.
|
|
142
|
+
*/
|
|
143
|
+
isBypassValue(key, value) {
|
|
144
|
+
if (key === chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE) {
|
|
145
|
+
return value === chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW;
|
|
146
|
+
}
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
describe(key, value) {
|
|
150
|
+
switch (key) {
|
|
151
|
+
case chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE:
|
|
152
|
+
return nls_1.nls.localize('theia/ai/ide/sessionOverride/defaultToolConfirmation', 'Default tool confirmation: {0}', String(value));
|
|
153
|
+
case chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE: {
|
|
154
|
+
if (value && typeof value === 'object') {
|
|
155
|
+
const entries = Object.entries(value)
|
|
156
|
+
.map(([tool, mode]) => `${tool}=${mode}`)
|
|
157
|
+
.join(', ');
|
|
158
|
+
return nls_1.nls.localize('theia/ai/ide/sessionOverride/toolConfirmation', 'Per-tool confirmation overrides: {0}', entries);
|
|
159
|
+
}
|
|
160
|
+
return nls_1.nls.localize('theia/ai/ide/sessionOverride/toolConfirmationGeneric', 'Per-tool confirmation overrides set');
|
|
161
|
+
}
|
|
162
|
+
default:
|
|
163
|
+
return `${key} = ${JSON.stringify(value)}`;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
dispose() {
|
|
167
|
+
this.toDispose.dispose();
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
exports.AiAllowAllModeChatBanner = AiAllowAllModeChatBanner;
|
|
171
|
+
tslib_1.__decorate([
|
|
172
|
+
(0, inversify_1.inject)(common_1.PreferenceService),
|
|
173
|
+
tslib_1.__metadata("design:type", Object)
|
|
174
|
+
], AiAllowAllModeChatBanner.prototype, "preferenceService", void 0);
|
|
175
|
+
tslib_1.__decorate([
|
|
176
|
+
(0, inversify_1.postConstruct)(),
|
|
177
|
+
tslib_1.__metadata("design:type", Function),
|
|
178
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
179
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
180
|
+
], AiAllowAllModeChatBanner.prototype, "init", null);
|
|
181
|
+
exports.AiAllowAllModeChatBanner = AiAllowAllModeChatBanner = tslib_1.__decorate([
|
|
182
|
+
(0, inversify_1.injectable)()
|
|
183
|
+
], AiAllowAllModeChatBanner);
|
|
184
|
+
//# sourceMappingURL=ai-allow-all-mode-chat-banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-allow-all-mode-chat-banner.js","sourceRoot":"","sources":["../../src/browser/ai-allow-all-mode-chat-banner.tsx"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,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,kDAAkD;AAClD,4DAAiF;AACjF,qDAAkD;AAClD,sCAAmE;AACnE,oDAAiD;AACjD,mDAA2D;AAE3D,2FAIyD;AASzD;;;;;;;;;;GAUG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QAEM,aAAQ,GAAG,IAAI,CAAC;QAKN,cAAS,GAAG,IAAI,2BAAoB,EAAE,CAAC;QACvC,uBAAkB,GAAG,IAAI,cAAO,EAAQ,CAAC;QACnD,gBAAW,GAAgB,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;QAElE;;;;WAIG;QACgB,gBAAW,GAA0B;YACpD,4DAAoC;YACpC,oDAA4B;SAC/B,CAAC;QAEF;;;;;WAKG;QACO,cAAS,GAAG,KAAK,CAAC;QAiIlB,kBAAa,GAAG,CAAC,CAAsC,EAAE,EAAE;YACjE,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,gFAAgF;YAChF,8EAA8E;YAC9E,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACnD,IAAI,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AAC;yBACxC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAChB,OAAO,SAAG,CAAC,QAAQ,CAAC,+CAA+C,EAC/D,sCAAsC,EAAE,OAAO,CAAC,CAAC;gBACzD,CAAC;gBACD,OAAO,SAAG,CAAC,QAAQ,CAAC,sDAAsD,EACtE,qCAAqC,CAAC,CAAC;YAC/C,CAAC;YACD;gBACI,OAAO,GAAG,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACnD,CAAC;IACL,CAAC;IAWD,OAAO;QACH,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ,CAAA;AAxKY,4DAAwB;AAKd;IADlB,IAAA,kBAAM,EAAC,0BAAiB,CAAC;;mEAC8B;AA+B9C;IADT,IAAA,yBAAa,GAAE;;;;oDAgBf;mCAnDQ,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAwKpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-allow-all-mode-chat-banner.spec.d.ts","sourceRoot":"","sources":["../../src/browser/ai-allow-all-mode-chat-banner.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource 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
|
+
const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
|
|
19
|
+
let disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
20
|
+
const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
|
|
21
|
+
frontend_application_config_provider_1.FrontendApplicationConfigProvider.set({});
|
|
22
|
+
const chai_1 = require("chai");
|
|
23
|
+
const core_1 = require("@theia/core");
|
|
24
|
+
const chat_tool_preferences_1 = require("@theia/ai-chat/lib/common/chat-tool-preferences");
|
|
25
|
+
const ai_allow_all_mode_chat_banner_1 = require("./ai-allow-all-mode-chat-banner");
|
|
26
|
+
disableJSDOM();
|
|
27
|
+
/**
|
|
28
|
+
* Test double for the subset of `PreferenceService` the banner actually uses.
|
|
29
|
+
* A backing map keyed by preference name provides the session value seen by
|
|
30
|
+
* `inspect(...)`, and a public emitter drives the banner's change listener.
|
|
31
|
+
*/
|
|
32
|
+
class FakePreferenceService {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.sessionValues = new Map();
|
|
35
|
+
this.changeEmitter = new core_1.Emitter();
|
|
36
|
+
this.onPreferenceChanged = this.changeEmitter.event;
|
|
37
|
+
}
|
|
38
|
+
inspect(key) {
|
|
39
|
+
if (!this.sessionValues.has(key)) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return { sessionValue: this.sessionValues.get(key) };
|
|
43
|
+
}
|
|
44
|
+
setSession(key, value) {
|
|
45
|
+
if (value === undefined) {
|
|
46
|
+
this.sessionValues.delete(key);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
this.sessionValues.set(key, value);
|
|
50
|
+
}
|
|
51
|
+
// The banner only ever inspects `preferenceName`, so a minimal change payload is enough.
|
|
52
|
+
this.changeEmitter.fire({ preferenceName: key });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
describe('AiAllowAllModeChatBanner', () => {
|
|
56
|
+
before(() => {
|
|
57
|
+
disableJSDOM = (0, jsdom_1.enableJSDOM)();
|
|
58
|
+
});
|
|
59
|
+
after(() => {
|
|
60
|
+
disableJSDOM();
|
|
61
|
+
});
|
|
62
|
+
function createBanner(prefService) {
|
|
63
|
+
const prefs = prefService ?? new FakePreferenceService();
|
|
64
|
+
const banner = new ai_allow_all_mode_chat_banner_1.AiAllowAllModeChatBanner();
|
|
65
|
+
// Wire the fake preference service into the private inject site, then run the
|
|
66
|
+
// `@postConstruct` init manually. Doing this without a full DI container keeps the
|
|
67
|
+
// test focused on the banner's own logic.
|
|
68
|
+
banner.preferenceService = prefs;
|
|
69
|
+
banner.init();
|
|
70
|
+
return { banner, prefs };
|
|
71
|
+
}
|
|
72
|
+
describe('isBypassValue', () => {
|
|
73
|
+
it('flags Allow-All only when the global default is forced to ALWAYS_ALLOW', () => {
|
|
74
|
+
const { banner } = createBanner();
|
|
75
|
+
(0, chai_1.expect)(banner.isBypassValue(chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE, chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW)).to.be.true;
|
|
76
|
+
(0, chai_1.expect)(banner.isBypassValue(chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE, chat_tool_preferences_1.ToolConfirmationMode.CONFIRM)).to.be.false;
|
|
77
|
+
(0, chai_1.expect)(banner.isBypassValue(chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE, chat_tool_preferences_1.ToolConfirmationMode.DISABLED)).to.be.false;
|
|
78
|
+
});
|
|
79
|
+
it('does not flag Allow-All for per-tool ALWAYS_ALLOW entries', () => {
|
|
80
|
+
// Per-tool overrides are scoped exceptions and stay informational rather than
|
|
81
|
+
// escalating the strip to the red Allow-All treatment.
|
|
82
|
+
const { banner } = createBanner();
|
|
83
|
+
(0, chai_1.expect)(banner.isBypassValue(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, { shellExecute: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW })).to.be.false;
|
|
84
|
+
(0, chai_1.expect)(banner.isBypassValue(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, {
|
|
85
|
+
shellExecute: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW,
|
|
86
|
+
writeFile: chat_tool_preferences_1.ToolConfirmationMode.CONFIRM
|
|
87
|
+
})).to.be.false;
|
|
88
|
+
(0, chai_1.expect)(banner.isBypassValue(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, {})).to.be.false;
|
|
89
|
+
});
|
|
90
|
+
it('returns false for unrelated keys', () => {
|
|
91
|
+
const { banner } = createBanner();
|
|
92
|
+
(0, chai_1.expect)(banner.isBypassValue('ai-features.AiEnable.enableAI', true)).to.be.false;
|
|
93
|
+
(0, chai_1.expect)(banner.isBypassValue('ai-features.agentMode.enabled', true)).to.be.false;
|
|
94
|
+
(0, chai_1.expect)(banner.isBypassValue('ai-features.chat.defaultChatAgent', 'Coder')).to.be.false;
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
describe('collectOverrides', () => {
|
|
98
|
+
it('is empty when no watched preference has a session value', () => {
|
|
99
|
+
const { banner } = createBanner();
|
|
100
|
+
(0, chai_1.expect)(banner.collectOverrides()).to.deep.equal([]);
|
|
101
|
+
});
|
|
102
|
+
it('reports the default tool confirmation with bypass=true when forced to ALWAYS_ALLOW', () => {
|
|
103
|
+
const { banner, prefs } = createBanner();
|
|
104
|
+
prefs.setSession(chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE, chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW);
|
|
105
|
+
const overrides = banner.collectOverrides();
|
|
106
|
+
(0, chai_1.expect)(overrides).to.have.lengthOf(1);
|
|
107
|
+
(0, chai_1.expect)(overrides[0].bypass).to.be.true;
|
|
108
|
+
(0, chai_1.expect)(overrides[0].label).to.contain(chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW);
|
|
109
|
+
});
|
|
110
|
+
it('reports per-tool entries with bypass=false', () => {
|
|
111
|
+
const { banner, prefs } = createBanner();
|
|
112
|
+
prefs.setSession(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, { shellExecute: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW });
|
|
113
|
+
const overrides = banner.collectOverrides();
|
|
114
|
+
(0, chai_1.expect)(overrides).to.have.lengthOf(1);
|
|
115
|
+
(0, chai_1.expect)(overrides[0].bypass).to.be.false;
|
|
116
|
+
(0, chai_1.expect)(overrides[0].label).to.contain('shellExecute');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
describe('renderBanner', () => {
|
|
120
|
+
it('returns undefined when there are no overrides', () => {
|
|
121
|
+
const { banner } = createBanner();
|
|
122
|
+
(0, chai_1.expect)(banner.renderBanner()).to.equal(undefined);
|
|
123
|
+
});
|
|
124
|
+
it('returns undefined once the strip has been dismissed', () => {
|
|
125
|
+
const { banner, prefs } = createBanner();
|
|
126
|
+
prefs.setSession(chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE, chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW);
|
|
127
|
+
(0, chai_1.expect)(banner.renderBanner()).to.not.equal(undefined);
|
|
128
|
+
banner.dismissed = true;
|
|
129
|
+
(0, chai_1.expect)(banner.renderBanner()).to.equal(undefined);
|
|
130
|
+
});
|
|
131
|
+
it('returns a rendered node when at least one override is active', () => {
|
|
132
|
+
const { banner, prefs } = createBanner();
|
|
133
|
+
prefs.setSession(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, { shellExecute: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW });
|
|
134
|
+
(0, chai_1.expect)(banner.renderBanner()).to.not.equal(undefined);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
describe('dismissal reset', () => {
|
|
138
|
+
it('un-dismisses the strip when the override set escalates into a bypass state', () => {
|
|
139
|
+
const { banner, prefs } = createBanner();
|
|
140
|
+
prefs.setSession(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, { shellExecute: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW });
|
|
141
|
+
banner.dismissed = true;
|
|
142
|
+
banner.dismissedSignature = banner.overrideSignature();
|
|
143
|
+
prefs.setSession(chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE, chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW);
|
|
144
|
+
(0, chai_1.expect)(banner.dismissed).to.be.false;
|
|
145
|
+
(0, chai_1.expect)(banner.dismissedSignature).to.equal(undefined);
|
|
146
|
+
});
|
|
147
|
+
it('un-dismisses the strip when a new override is added while the strip was dismissed', () => {
|
|
148
|
+
const { banner, prefs } = createBanner();
|
|
149
|
+
prefs.setSession(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, { shellExecute: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW });
|
|
150
|
+
banner.dismissed = true;
|
|
151
|
+
banner.dismissedSignature = banner.overrideSignature();
|
|
152
|
+
// Broaden the per-tool override set. Same key, added tool entry; the signature must differ.
|
|
153
|
+
prefs.setSession(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, {
|
|
154
|
+
shellExecute: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW,
|
|
155
|
+
writeFile: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW
|
|
156
|
+
});
|
|
157
|
+
(0, chai_1.expect)(banner.dismissed).to.be.false;
|
|
158
|
+
});
|
|
159
|
+
it('leaves the dismissal alone when a change event fires with the same override set', () => {
|
|
160
|
+
const { banner, prefs } = createBanner();
|
|
161
|
+
prefs.setSession(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE, { shellExecute: chat_tool_preferences_1.ToolConfirmationMode.ALWAYS_ALLOW });
|
|
162
|
+
banner.dismissed = true;
|
|
163
|
+
banner.dismissedSignature = banner.overrideSignature();
|
|
164
|
+
// Fire a change event without actually changing the underlying value.
|
|
165
|
+
prefs.changeEmitter.fire({ preferenceName: chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE });
|
|
166
|
+
(0, chai_1.expect)(banner.dismissed).to.be.true;
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
//# sourceMappingURL=ai-allow-all-mode-chat-banner.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-allow-all-mode-chat-banner.spec.js","sourceRoot":"","sources":["../../src/browser/ai-allow-all-mode-chat-banner.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,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,8DAAiE;AACjE,IAAI,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AACjC,uHAAiH;AACjH,wEAAiC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC1C,+BAA8B;AAC9B,sCAAsC;AAEtC,2FAIyD;AACzD,mFAA2E;AAC3E,YAAY,EAAE,CAAC;AAEf;;;;GAIG;AACH,MAAM,qBAAqB;IAA3B;QACa,kBAAa,GAAG,IAAI,GAAG,EAAmB,CAAC;QAC3C,kBAAa,GAAG,IAAI,cAAO,EAAoB,CAAC;QAChD,wBAAmB,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IAkB5D,CAAC;IAhBG,OAAO,CAAC,GAAW;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GA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egistry, ToolRequest } from '@theia/ai-core';
|
|
3
|
-
import { PreferenceService } from '@theia/core';
|
|
2
|
+
import { AiConfigurationService, ToolInvocationRegistry, ToolRequest } from '@theia/ai-core';
|
|
4
3
|
import { ToolConfirmationManager } from '@theia/ai-chat/lib/browser/chat-tool-preference-bindings';
|
|
5
4
|
import { ShellCommandPermissionService } from '@theia/ai-terminal/lib/browser/shell-command-permission-service';
|
|
6
5
|
import { ToolConfirmationMode } from '@theia/ai-chat/lib/common/chat-tool-preferences';
|
|
@@ -12,7 +11,7 @@ export declare class AIToolsConfigurationWidget extends AITableConfigurationWidg
|
|
|
12
11
|
static readonly ID = "ai-tools-configuration-widget";
|
|
13
12
|
static readonly LABEL: string;
|
|
14
13
|
protected readonly confirmationManager: ToolConfirmationManager;
|
|
15
|
-
protected readonly
|
|
14
|
+
protected readonly aiConfigurationService: AiConfigurationService;
|
|
16
15
|
protected readonly toolInvocationRegistry: ToolInvocationRegistry;
|
|
17
16
|
protected readonly shellCommandPermissionService: ShellCommandPermissionService;
|
|
18
17
|
protected toolConfirmationModes: Record<string, ToolConfirmationMode>;
|
|
@@ -46,7 +45,7 @@ export declare class AIToolsConfigurationWidget extends AITableConfigurationWidg
|
|
|
46
45
|
protected handleRemoveAllowlistPattern(pattern: string): void;
|
|
47
46
|
protected handleAddDenylistPattern(): void;
|
|
48
47
|
protected handleRemoveDenylistPattern(pattern: string): void;
|
|
49
|
-
protected handleAddPatternToList(inputRef: React.RefObject<HTMLInputElement | null>, addFn: (pattern: string) => void
|
|
48
|
+
protected handleAddPatternToList(inputRef: React.RefObject<HTMLInputElement | null>, addFn: (pattern: string) => Promise<void>, getFn: () => string[], setPatterns: (patterns: string[]) => void, setError: (error: string | undefined) => void): void;
|
|
50
49
|
protected renderFooter(): React.ReactNode;
|
|
51
50
|
}
|
|
52
51
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools-configuration-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/tools-configuration-widget.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"tools-configuration-widget.d.ts","sourceRoot":"","sources":["../../../src/browser/ai-configuration/tools-configuration-widget.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAC;AACnG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iEAAiE,CAAC;AAChH,OAAO,EAGH,oBAAoB,EACvB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAQ/F,UAAU,QAAQ;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,qBACa,0BAA2B,SAAQ,0BAA0B,CAAC,QAAQ,CAAC;IAChF,MAAM,CAAC,QAAQ,CAAC,EAAE,mCAAmC;IACrD,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAkC;IAGvD,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;IAGhE,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAGlE,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,CAAC;IAGlE,SAAS,CAAC,QAAQ,CAAC,6BAA6B,EAAE,6BAA6B,CAAC;IAEhF,SAAS,CAAC,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAM;IAC3E,SAAS,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC7C,SAAS,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAM;IAC3C,SAAS,CAAC,iBAAiB,oCAAuC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6B,IAAI,WAAW;IAgCtD,SAAS,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB;IAcnE,SAAS,CAAC,UAAU,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE;cAgC5B,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM;IAM1D,SAAS,CAAC,yBAAyB,IAAI,IAAI;IAU3C,SAAS,CAAC,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK7D,SAAS,CAAC,wBAAwB,IAAI,IAAI;IAU1C,SAAS,CAAC,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK5D,SAAS,CAAC,sBAAsB,CAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAClD,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,EACzC,KAAK,EAAE,MAAM,MAAM,EAAE,EACrB,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,EACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,GAC9C,IAAI;cA2BY,YAAY,IAAI,KAAK,CAAC,SAAS;CAkHrD"}
|
|
@@ -75,18 +75,18 @@ let AIToolsConfigurationWidget = class AIToolsConfigurationWidget extends ai_tab
|
|
|
75
75
|
this.addClass('ai-configuration-widget');
|
|
76
76
|
this.loadData().then(() => this.update());
|
|
77
77
|
this.toDispose.pushAll([
|
|
78
|
-
this.
|
|
79
|
-
if (e.
|
|
80
|
-
|| e.
|
|
78
|
+
this.aiConfigurationService.onDidChange(async (e) => {
|
|
79
|
+
if (e.affectsPreference(chat_tool_preferences_1.TOOL_CONFIRMATION_PREFERENCE)
|
|
80
|
+
|| e.affectsPreference(chat_tool_preferences_1.DEFAULT_TOOL_CONFIRMATION_PREFERENCE)) {
|
|
81
81
|
this.defaultState = await this.loadDefaultConfirmation();
|
|
82
82
|
this.toolConfirmationModes = await this.loadToolConfigurationModes();
|
|
83
83
|
this.update();
|
|
84
84
|
}
|
|
85
|
-
if (e.
|
|
85
|
+
if (e.affectsPreference(shell_command_preferences_1.SHELL_COMMAND_ALLOWLIST_PREFERENCE)) {
|
|
86
86
|
this.allowlistPatterns = this.shellCommandPermissionService.getAllowlistPatterns();
|
|
87
87
|
this.update();
|
|
88
88
|
}
|
|
89
|
-
if (e.
|
|
89
|
+
if (e.affectsPreference(shell_command_preferences_1.SHELL_COMMAND_DENYLIST_PREFERENCE)) {
|
|
90
90
|
this.denylistPatterns = this.shellCommandPermissionService.getDenylistPatterns();
|
|
91
91
|
this.update();
|
|
92
92
|
}
|
|
@@ -98,6 +98,7 @@ let AIToolsConfigurationWidget = class AIToolsConfigurationWidget extends ai_tab
|
|
|
98
98
|
]);
|
|
99
99
|
}
|
|
100
100
|
async loadData() {
|
|
101
|
+
await this.aiConfigurationService.ready;
|
|
101
102
|
await this.loadItems();
|
|
102
103
|
this.defaultState = await this.loadDefaultConfirmation();
|
|
103
104
|
this.toolConfirmationModes = await this.loadToolConfigurationModes();
|
|
@@ -263,13 +264,15 @@ let AIToolsConfigurationWidget = class AIToolsConfigurationWidget extends ai_tab
|
|
|
263
264
|
this.handleAddPatternToList(this.allowlistInputRef, pattern => this.shellCommandPermissionService.addAllowlistPatterns(pattern), () => this.shellCommandPermissionService.getAllowlistPatterns(), patterns => { this.allowlistPatterns = patterns; }, error => { this.allowlistError = error; });
|
|
264
265
|
}
|
|
265
266
|
handleRemoveAllowlistPattern(pattern) {
|
|
266
|
-
this.shellCommandPermissionService.removeAllowlistPattern(pattern)
|
|
267
|
+
this.shellCommandPermissionService.removeAllowlistPattern(pattern)
|
|
268
|
+
.catch(error => console.error('Failed to remove allowlist pattern:', error));
|
|
267
269
|
}
|
|
268
270
|
handleAddDenylistPattern() {
|
|
269
271
|
this.handleAddPatternToList(this.denylistInputRef, pattern => this.shellCommandPermissionService.addDenylistPatterns(pattern), () => this.shellCommandPermissionService.getDenylistPatterns(), patterns => { this.denylistPatterns = patterns; }, error => { this.denylistError = error; });
|
|
270
272
|
}
|
|
271
273
|
handleRemoveDenylistPattern(pattern) {
|
|
272
|
-
this.shellCommandPermissionService.removeDenylistPattern(pattern)
|
|
274
|
+
this.shellCommandPermissionService.removeDenylistPattern(pattern)
|
|
275
|
+
.catch(error => console.error('Failed to remove denylist pattern:', error));
|
|
273
276
|
}
|
|
274
277
|
handleAddPatternToList(inputRef, addFn, getFn, setPatterns, setError) {
|
|
275
278
|
const input = inputRef.current;
|
|
@@ -281,7 +284,11 @@ let AIToolsConfigurationWidget = class AIToolsConfigurationWidget extends ai_tab
|
|
|
281
284
|
return;
|
|
282
285
|
}
|
|
283
286
|
try {
|
|
284
|
-
|
|
287
|
+
// Validation throws synchronously; a failed write rejects the returned promise.
|
|
288
|
+
addFn(trimmed).catch(error => {
|
|
289
|
+
setError(error instanceof Error ? error.message : 'Failed to save pattern');
|
|
290
|
+
this.update();
|
|
291
|
+
});
|
|
285
292
|
input.value = '';
|
|
286
293
|
setError(undefined);
|
|
287
294
|
setPatterns(getFn());
|
|
@@ -327,9 +334,9 @@ tslib_1.__decorate([
|
|
|
327
334
|
tslib_1.__metadata("design:type", chat_tool_preference_bindings_1.ToolConfirmationManager)
|
|
328
335
|
], AIToolsConfigurationWidget.prototype, "confirmationManager", void 0);
|
|
329
336
|
tslib_1.__decorate([
|
|
330
|
-
(0, inversify_1.inject)(
|
|
337
|
+
(0, inversify_1.inject)(ai_core_1.AiConfigurationService),
|
|
331
338
|
tslib_1.__metadata("design:type", Object)
|
|
332
|
-
], AIToolsConfigurationWidget.prototype, "
|
|
339
|
+
], AIToolsConfigurationWidget.prototype, "aiConfigurationService", void 0);
|
|
333
340
|
tslib_1.__decorate([
|
|
334
341
|
(0, inversify_1.inject)(ai_core_1.ToolInvocationRegistry),
|
|
335
342
|
tslib_1.__metadata("design:type", Object)
|