@theia/ai-history 1.54.0 → 1.55.0-next.25
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-history-contribution.d.ts +14 -3
- package/lib/browser/ai-history-contribution.d.ts.map +1 -1
- package/lib/browser/ai-history-contribution.js +108 -6
- package/lib/browser/ai-history-contribution.js.map +1 -1
- package/lib/browser/ai-history-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-history-frontend-module.js +2 -0
- package/lib/browser/ai-history-frontend-module.js.map +1 -1
- package/lib/browser/ai-history-widget.d.ts +18 -2
- package/lib/browser/ai-history-widget.d.ts.map +1 -1
- package/lib/browser/ai-history-widget.js +33 -1
- package/lib/browser/ai-history-widget.js.map +1 -1
- package/lib/common/communication-recording-service.d.ts +3 -0
- package/lib/common/communication-recording-service.d.ts.map +1 -1
- package/lib/common/communication-recording-service.js +6 -0
- package/lib/common/communication-recording-service.js.map +1 -1
- package/package.json +7 -7
- package/src/browser/ai-history-contribution.ts +97 -7
- package/src/browser/ai-history-frontend-module.ts +3 -0
- package/src/browser/ai-history-widget.tsx +48 -3
- package/src/common/communication-recording-service.ts +8 -0
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { FrontendApplication } from '@theia/core/lib/browser';
|
|
2
2
|
import { AIViewContribution } from '@theia/ai-core/lib/browser';
|
|
3
3
|
import { AIHistoryView } from './ai-history-widget';
|
|
4
|
-
import { Command, CommandRegistry } from '@theia/core';
|
|
4
|
+
import { Command, CommandRegistry, Emitter } from '@theia/core';
|
|
5
|
+
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
5
6
|
export declare const AI_HISTORY_TOGGLE_COMMAND_ID = "aiHistory:toggle";
|
|
6
7
|
export declare const OPEN_AI_HISTORY_VIEW: Command;
|
|
7
|
-
export declare
|
|
8
|
+
export declare const AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY: Command;
|
|
9
|
+
export declare const AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY: Command;
|
|
10
|
+
export declare const AI_HISTORY_VIEW_CLEAR: Command;
|
|
11
|
+
export declare class AIHistoryViewContribution extends AIViewContribution<AIHistoryView> implements TabBarToolbarContribution {
|
|
12
|
+
private recordingService;
|
|
8
13
|
constructor();
|
|
9
14
|
initializeLayout(_app: FrontendApplication): Promise<void>;
|
|
10
|
-
registerCommands(
|
|
15
|
+
registerCommands(registry: CommandRegistry): void;
|
|
16
|
+
clearHistory(): void;
|
|
17
|
+
protected withHistoryWidget(widget?: unknown, predicate?: (output: AIHistoryView) => boolean): boolean | false;
|
|
18
|
+
protected readonly onAIHistoryWidgetStateChangedEmitter: Emitter<void>;
|
|
19
|
+
protected readonly onAIHistoryWidgettStateChanged: import("@theia/core").Event<void>;
|
|
20
|
+
protected init(): void;
|
|
21
|
+
registerToolbarItems(registry: TabBarToolbarRegistry): void;
|
|
11
22
|
}
|
|
12
23
|
//# sourceMappingURL=ai-history-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-history-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/ai-history-contribution.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ai-history-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/ai-history-contribution.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAW,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAGjH,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,oBAAoB,SAG/B,CAAC;AAEH,eAAO,MAAM,oCAAoC,SAI/C,CAAC;AAEH,eAAO,MAAM,4CAA4C,SAIvD,CAAC;AAEH,eAAO,MAAM,qBAAqB,SAIhC,CAAC;AAEH,qBACa,yBAA0B,SAAQ,kBAAkB,CAAC,aAAa,CAAE,YAAW,yBAAyB;IAC1E,OAAO,CAAC,gBAAgB,CAAgC;;IAczF,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IA8BnD,YAAY,IAAI,IAAI;IAI3B,SAAS,CAAC,iBAAiB,CACvB,MAAM,GAAE,OAA6B,EACrC,SAAS,GAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAoB,GAC3D,OAAO,GAAG,KAAK;IAIlB,SAAS,CAAC,QAAQ,CAAC,oCAAoC,gBAAuB;IAC9E,SAAS,CAAC,QAAQ,CAAC,8BAA8B,oCAAmD;cAGjF,IAAI,IAAI,IAAI;IAO/B,oBAAoB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI;CAsB9D"}
|
|
@@ -1,17 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AIHistoryViewContribution = exports.OPEN_AI_HISTORY_VIEW = exports.AI_HISTORY_TOGGLE_COMMAND_ID = void 0;
|
|
3
|
+
exports.AIHistoryViewContribution = exports.AI_HISTORY_VIEW_CLEAR = exports.AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY = exports.AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY = exports.OPEN_AI_HISTORY_VIEW = exports.AI_HISTORY_TOGGLE_COMMAND_ID = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
|
|
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 browser_1 = require("@theia/core/lib/browser");
|
|
21
|
+
const browser_2 = require("@theia/ai-core/lib/browser");
|
|
6
22
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
7
23
|
const ai_history_widget_1 = require("./ai-history-widget");
|
|
8
24
|
const core_1 = require("@theia/core");
|
|
25
|
+
const ai_core_1 = require("@theia/ai-core");
|
|
9
26
|
exports.AI_HISTORY_TOGGLE_COMMAND_ID = 'aiHistory:toggle';
|
|
10
27
|
exports.OPEN_AI_HISTORY_VIEW = core_1.Command.toLocalizedCommand({
|
|
11
28
|
id: 'aiHistory:open',
|
|
12
29
|
label: 'Open AI History view',
|
|
13
30
|
});
|
|
14
|
-
|
|
31
|
+
exports.AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY = core_1.Command.toLocalizedCommand({
|
|
32
|
+
id: 'aiHistory:sortChronologically',
|
|
33
|
+
label: 'AI History: Sort chronologically',
|
|
34
|
+
iconClass: (0, browser_1.codicon)('arrow-down')
|
|
35
|
+
});
|
|
36
|
+
exports.AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY = core_1.Command.toLocalizedCommand({
|
|
37
|
+
id: 'aiHistory:sortReverseChronologically',
|
|
38
|
+
label: 'AI History: Sort reverse chronologically',
|
|
39
|
+
iconClass: (0, browser_1.codicon)('arrow-up')
|
|
40
|
+
});
|
|
41
|
+
exports.AI_HISTORY_VIEW_CLEAR = core_1.Command.toLocalizedCommand({
|
|
42
|
+
id: 'aiHistory:clear',
|
|
43
|
+
label: 'AI History: Clear History',
|
|
44
|
+
iconClass: (0, browser_1.codicon)('clear-all')
|
|
45
|
+
});
|
|
46
|
+
let AIHistoryViewContribution = class AIHistoryViewContribution extends browser_2.AIViewContribution {
|
|
15
47
|
constructor() {
|
|
16
48
|
super({
|
|
17
49
|
widgetId: ai_history_widget_1.AIHistoryView.ID,
|
|
@@ -22,18 +54,88 @@ let AIHistoryViewContribution = class AIHistoryViewContribution extends browser_
|
|
|
22
54
|
},
|
|
23
55
|
toggleCommandId: exports.AI_HISTORY_TOGGLE_COMMAND_ID,
|
|
24
56
|
});
|
|
57
|
+
this.onAIHistoryWidgetStateChangedEmitter = new core_1.Emitter();
|
|
58
|
+
this.onAIHistoryWidgettStateChanged = this.onAIHistoryWidgetStateChangedEmitter.event;
|
|
25
59
|
}
|
|
26
60
|
async initializeLayout(_app) {
|
|
27
61
|
await this.openView();
|
|
28
62
|
}
|
|
29
|
-
registerCommands(
|
|
30
|
-
super.registerCommands(
|
|
31
|
-
|
|
63
|
+
registerCommands(registry) {
|
|
64
|
+
super.registerCommands(registry);
|
|
65
|
+
registry.registerCommand(exports.OPEN_AI_HISTORY_VIEW, {
|
|
32
66
|
execute: () => this.openView({ activate: true }),
|
|
33
67
|
});
|
|
68
|
+
registry.registerCommand(exports.AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY, {
|
|
69
|
+
isEnabled: widget => this.withHistoryWidget(widget, historyView => !historyView.isChronological),
|
|
70
|
+
isVisible: widget => this.withHistoryWidget(widget, historyView => !historyView.isChronological),
|
|
71
|
+
execute: widget => this.withHistoryWidget(widget, historyView => {
|
|
72
|
+
historyView.sortHistory(true);
|
|
73
|
+
return true;
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
registry.registerCommand(exports.AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY, {
|
|
77
|
+
isEnabled: widget => this.withHistoryWidget(widget, historyView => historyView.isChronological),
|
|
78
|
+
isVisible: widget => this.withHistoryWidget(widget, historyView => historyView.isChronological),
|
|
79
|
+
execute: widget => this.withHistoryWidget(widget, historyView => {
|
|
80
|
+
historyView.sortHistory(false);
|
|
81
|
+
return true;
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
registry.registerCommand(exports.AI_HISTORY_VIEW_CLEAR, {
|
|
85
|
+
isEnabled: widget => this.withHistoryWidget(widget),
|
|
86
|
+
isVisible: widget => this.withHistoryWidget(widget),
|
|
87
|
+
execute: widget => this.withHistoryWidget(widget, () => {
|
|
88
|
+
this.clearHistory();
|
|
89
|
+
return true;
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
clearHistory() {
|
|
94
|
+
this.recordingService.clearHistory();
|
|
95
|
+
}
|
|
96
|
+
withHistoryWidget(widget = this.tryGetWidget(), predicate = () => true) {
|
|
97
|
+
return widget instanceof ai_history_widget_1.AIHistoryView ? predicate(widget) : false;
|
|
98
|
+
}
|
|
99
|
+
init() {
|
|
100
|
+
super.init();
|
|
101
|
+
this.widget.then(widget => {
|
|
102
|
+
widget.onStateChanged(() => this.onAIHistoryWidgetStateChangedEmitter.fire());
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
registerToolbarItems(registry) {
|
|
106
|
+
registry.registerItem({
|
|
107
|
+
id: exports.AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY.id,
|
|
108
|
+
command: exports.AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY.id,
|
|
109
|
+
tooltip: 'Sort chronologically',
|
|
110
|
+
isVisible: widget => this.withHistoryWidget(widget),
|
|
111
|
+
onDidChange: this.onAIHistoryWidgettStateChanged
|
|
112
|
+
});
|
|
113
|
+
registry.registerItem({
|
|
114
|
+
id: exports.AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY.id,
|
|
115
|
+
command: exports.AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY.id,
|
|
116
|
+
tooltip: 'Sort reverse chronologically',
|
|
117
|
+
isVisible: widget => this.withHistoryWidget(widget),
|
|
118
|
+
onDidChange: this.onAIHistoryWidgettStateChanged
|
|
119
|
+
});
|
|
120
|
+
registry.registerItem({
|
|
121
|
+
id: exports.AI_HISTORY_VIEW_CLEAR.id,
|
|
122
|
+
command: exports.AI_HISTORY_VIEW_CLEAR.id,
|
|
123
|
+
tooltip: 'Clear History of all agents',
|
|
124
|
+
isVisible: widget => this.withHistoryWidget(widget)
|
|
125
|
+
});
|
|
34
126
|
}
|
|
35
127
|
};
|
|
36
128
|
exports.AIHistoryViewContribution = AIHistoryViewContribution;
|
|
129
|
+
tslib_1.__decorate([
|
|
130
|
+
(0, inversify_1.inject)(ai_core_1.CommunicationRecordingService),
|
|
131
|
+
tslib_1.__metadata("design:type", Object)
|
|
132
|
+
], AIHistoryViewContribution.prototype, "recordingService", void 0);
|
|
133
|
+
tslib_1.__decorate([
|
|
134
|
+
(0, inversify_1.postConstruct)(),
|
|
135
|
+
tslib_1.__metadata("design:type", Function),
|
|
136
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
137
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
138
|
+
], AIHistoryViewContribution.prototype, "init", null);
|
|
37
139
|
exports.AIHistoryViewContribution = AIHistoryViewContribution = tslib_1.__decorate([
|
|
38
140
|
(0, inversify_1.injectable)(),
|
|
39
141
|
tslib_1.__metadata("design:paramtypes", [])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-history-contribution.js","sourceRoot":"","sources":["../../src/browser/ai-history-contribution.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ai-history-contribution.js","sourceRoot":"","sources":["../../src/browser/ai-history-contribution.ts"],"names":[],"mappings":";;;;AAAA,gF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AAoB,CAAC,QAA+B;QAChD,QAAQ,CAAC,YAAY,CAAC;YAClB,EAAE,EAAE,4CAAoC,CAAC,EAAE;YAC3C,OAAO,EAAE,4CAAoC,CAAC,EAAE;YAChD,OAAO,EAAE,sBAAsB;YAC/B,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;YACnD,WAAW,EAAE,IAAI,CAAC,8BAA8B;SACnD,CAAC,CAAC;QACH,QAAQ,CAAC,YAAY,CAAC;YAClB,EAAE,EAAE,oDAA4C,CAAC,EAAE;YACnD,OAAO,EAAE,oDAA4C,CAAC,EAAE;YACxD,OAAO,EAAE,8BAA8B;YACvC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;YACnD,WAAW,EAAE,IAAI,CAAC,8BAA8B;SACnD,CAAC,CAAC;QACH,QAAQ,CAAC,YAAY,CAAC;YAClB,EAAE,EAAE,6BAAqB,CAAC,EAAE;YAC5B,OAAO,EAAE,6BAAqB,CAAC,EAAE;YACjC,OAAO,EAAE,6BAA6B;YACtC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC;SACtD,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AA7FY,8DAAyB;AACa;IAA9C,IAAA,kBAAM,EAAC,uCAA6B,CAAC;;mEAAyD;AA+D5E;IADlB,IAAA,yBAAa,GAAE;;;;qDAMf;oCArEQ,yBAAyB;IADrC,IAAA,sBAAU,GAAE;;GACA,yBAAyB,CA6FrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-history-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-history-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAM/D,OAAO,wCAAwC,CAAC;;
|
|
1
|
+
{"version":3,"file":"ai-history-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-history-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAM/D,OAAO,wCAAwC,CAAC;;AAGhD,wBAkBG"}
|
|
@@ -23,6 +23,7 @@ const core_1 = require("@theia/core");
|
|
|
23
23
|
const ai_history_contribution_1 = require("./ai-history-contribution");
|
|
24
24
|
const ai_history_widget_1 = require("./ai-history-widget");
|
|
25
25
|
require("../../src/browser/style/ai-history.css");
|
|
26
|
+
const tab_bar_toolbar_1 = require("@theia/core/lib/browser/shell/tab-bar-toolbar");
|
|
26
27
|
exports.default = new inversify_1.ContainerModule(bind => {
|
|
27
28
|
bind(communication_recording_service_1.DefaultCommunicationRecordingService).toSelf().inSingletonScope();
|
|
28
29
|
bind(ai_core_1.CommunicationRecordingService).toService(communication_recording_service_1.DefaultCommunicationRecordingService);
|
|
@@ -36,5 +37,6 @@ exports.default = new inversify_1.ContainerModule(bind => {
|
|
|
36
37
|
id: ai_history_widget_1.AIHistoryView.ID,
|
|
37
38
|
createWidget: () => context.container.get(ai_history_widget_1.AIHistoryView)
|
|
38
39
|
})).inSingletonScope();
|
|
40
|
+
bind(tab_bar_toolbar_1.TabBarToolbarContribution).toService(ai_history_contribution_1.AIHistoryViewContribution);
|
|
39
41
|
});
|
|
40
42
|
//# sourceMappingURL=ai-history-frontend-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-history-frontend-module.js","sourceRoot":"","sources":["../../src/browser/ai-history-frontend-module.ts"],"names":[],"mappings":";;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,4CAA+D;AAC/D,4DAA+D;AAC/D,+FAAiG;AACjG,qDAA8E;AAC9E,sCAAsC;AACtC,uEAAsE;AACtE,2DAAoD;AACpD,kDAAgD;
|
|
1
|
+
{"version":3,"file":"ai-history-frontend-module.js","sourceRoot":"","sources":["../../src/browser/ai-history-frontend-module.ts"],"names":[],"mappings":";;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,4CAA+D;AAC/D,4DAA+D;AAC/D,+FAAiG;AACjG,qDAA8E;AAC9E,sCAAsC;AACtC,uEAAsE;AACtE,2DAAoD;AACpD,kDAAgD;AAChD,mFAA0F;AAE1F,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,sEAAoC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACvE,IAAI,CAAC,uCAA6B,CAAC,CAAC,SAAS,CAAC,sEAAoC,CAAC,CAAC;IAEpF,IAAI,CAAC,cAAO,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QAC/B,MAAM,YAAY,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAU,cAAO,CAAC,CAAC;QACzD,OAAO,YAAY,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC;IAEpE,IAAA,8BAAoB,EAAC,IAAI,EAAE,mDAAyB,CAAC,CAAC;IAEtD,IAAI,CAAC,iCAAa,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAChD,IAAI,CAAC,uBAAa,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC3C,EAAE,EAAE,iCAAa,CAAC,EAAE;QACpB,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAgB,iCAAa,CAAC;KAC1E,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACvB,IAAI,CAAC,2CAAyB,CAAC,CAAC,SAAS,CAAC,mDAAyB,CAAC,CAAC;AAEzE,CAAC,CAAC,CAAC"}
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Agent, AgentService, CommunicationRecordingService, CommunicationRequestEntry, CommunicationResponseEntry } from '@theia/ai-core';
|
|
3
|
-
import { ReactWidget } from '@theia/core/lib/browser';
|
|
3
|
+
import { ReactWidget, StatefulWidget } from '@theia/core/lib/browser';
|
|
4
4
|
import * as React from '@theia/core/shared/react';
|
|
5
|
-
|
|
5
|
+
import { Emitter } from '@theia/core';
|
|
6
|
+
declare namespace AIHistoryView {
|
|
7
|
+
interface State {
|
|
8
|
+
chronological: boolean;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare class AIHistoryView extends ReactWidget implements StatefulWidget {
|
|
6
12
|
protected recordingService: CommunicationRecordingService;
|
|
7
13
|
protected readonly agentService: AgentService;
|
|
8
14
|
static ID: string;
|
|
9
15
|
static LABEL: string;
|
|
10
16
|
protected selectedAgent?: Agent;
|
|
17
|
+
protected _state: AIHistoryView.State;
|
|
18
|
+
protected readonly onStateChangedEmitter: Emitter<AIHistoryView.State>;
|
|
19
|
+
readonly onStateChanged: import("@theia/core").Event<AIHistoryView.State>;
|
|
11
20
|
constructor();
|
|
21
|
+
protected get state(): AIHistoryView.State;
|
|
22
|
+
protected set state(state: AIHistoryView.State);
|
|
23
|
+
storeState(): object;
|
|
24
|
+
restoreState(oldState: object & Partial<AIHistoryView.State>): void;
|
|
12
25
|
protected init(): void;
|
|
13
26
|
protected selectAgent(agent: Agent | undefined): void;
|
|
14
27
|
protected historyContentUpdated(entry: CommunicationRequestEntry | CommunicationResponseEntry): void;
|
|
15
28
|
render(): React.ReactNode;
|
|
16
29
|
protected renderHistory(): React.ReactNode;
|
|
17
30
|
protected onClick(e: React.MouseEvent<HTMLDivElement>, agent: Agent): void;
|
|
31
|
+
sortHistory(chronological: boolean): void;
|
|
32
|
+
get isChronological(): boolean;
|
|
18
33
|
}
|
|
34
|
+
export {};
|
|
19
35
|
//# sourceMappingURL=ai-history-widget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-history-widget.d.ts","sourceRoot":"","sources":["../../src/browser/ai-history-widget.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC3I,OAAO,EAAW,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE/
|
|
1
|
+
{"version":3,"file":"ai-history-widget.d.ts","sourceRoot":"","sources":["../../src/browser/ai-history-widget.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC3I,OAAO,EAAW,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EAAa,OAAO,EAAE,MAAM,aAAa,CAAC;AAEjD,kBAAU,aAAa,CAAC;IACpB,UAAiB,KAAK;QAClB,aAAa,EAAE,OAAO,CAAC;KAC1B;CACJ;AAED,qBACa,aAAc,SAAQ,WAAY,YAAW,cAAc;IAEpE,SAAS,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IAE1D,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAE9C,OAAc,EAAE,SAAuB;IACvC,MAAM,CAAC,KAAK,SAAuC;IAEnD,SAAS,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC;IAEhC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAA4B;IACjE,SAAS,CAAC,QAAQ,CAAC,qBAAqB,+BAAsC;IAC9E,QAAQ,CAAC,cAAc,mDAAoC;;IAW3D,SAAS,KAAK,KAAK,IAAI,aAAa,CAAC,KAAK,CAEzC;IAED,SAAS,KAAK,KAAK,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,EAG7C;IAED,UAAU,IAAI,MAAM;IAIpB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI;IASnE,SAAS,CAAC,IAAI,IAAI,IAAI;IAStB,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI;IAKrD,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,yBAAyB,GAAG,0BAA0B,GAAG,IAAI;IAMpG,MAAM,IAAI,KAAK,CAAC,SAAS;IAkBzB,SAAS,CAAC,aAAa,IAAI,KAAK,CAAC,SAAS;IAc1C,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAKnE,WAAW,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI;IAIhD,IAAI,eAAe,IAAI,OAAO,CAE7B;CACJ"}
|
|
@@ -24,19 +24,42 @@ const inversify_1 = require("@theia/core/shared/inversify");
|
|
|
24
24
|
const React = require("@theia/core/shared/react");
|
|
25
25
|
const ai_history_communication_card_1 = require("./ai-history-communication-card");
|
|
26
26
|
const select_component_1 = require("@theia/core/lib/browser/widgets/select-component");
|
|
27
|
+
const core_1 = require("@theia/core");
|
|
27
28
|
let AIHistoryView = AIHistoryView_1 = class AIHistoryView extends browser_1.ReactWidget {
|
|
28
29
|
constructor() {
|
|
29
30
|
super();
|
|
31
|
+
this._state = { chronological: false };
|
|
32
|
+
this.onStateChangedEmitter = new core_1.Emitter();
|
|
33
|
+
this.onStateChanged = this.onStateChangedEmitter.event;
|
|
30
34
|
this.id = AIHistoryView_1.ID;
|
|
31
35
|
this.title.label = AIHistoryView_1.LABEL;
|
|
32
36
|
this.title.caption = AIHistoryView_1.LABEL;
|
|
33
37
|
this.title.closable = true;
|
|
34
38
|
this.title.iconClass = (0, browser_1.codicon)('history');
|
|
35
39
|
}
|
|
40
|
+
get state() {
|
|
41
|
+
return this._state;
|
|
42
|
+
}
|
|
43
|
+
set state(state) {
|
|
44
|
+
this._state = state;
|
|
45
|
+
this.onStateChangedEmitter.fire(this._state);
|
|
46
|
+
}
|
|
47
|
+
storeState() {
|
|
48
|
+
return this.state;
|
|
49
|
+
}
|
|
50
|
+
restoreState(oldState) {
|
|
51
|
+
const copy = (0, core_1.deepClone)(this.state);
|
|
52
|
+
if (oldState.chronological) {
|
|
53
|
+
copy.chronological = oldState.chronological;
|
|
54
|
+
}
|
|
55
|
+
this.state = copy;
|
|
56
|
+
}
|
|
36
57
|
init() {
|
|
37
58
|
this.update();
|
|
38
59
|
this.toDispose.push(this.recordingService.onDidRecordRequest(entry => this.historyContentUpdated(entry)));
|
|
39
60
|
this.toDispose.push(this.recordingService.onDidRecordResponse(entry => this.historyContentUpdated(entry)));
|
|
61
|
+
this.toDispose.push(this.recordingService.onStructuralChange(() => this.update()));
|
|
62
|
+
this.toDispose.push(this.onStateChanged(newState => this.update()));
|
|
40
63
|
this.selectAgent(this.agentService.getAllAgents()[0]);
|
|
41
64
|
}
|
|
42
65
|
selectAgent(agent) {
|
|
@@ -63,19 +86,28 @@ let AIHistoryView = AIHistoryView_1 = class AIHistoryView extends browser_1.Reac
|
|
|
63
86
|
if (!this.selectedAgent) {
|
|
64
87
|
return React.createElement("div", { className: 'theia-card no-content' }, "No agent selected.");
|
|
65
88
|
}
|
|
66
|
-
const history = this.recordingService.getHistory(this.selectedAgent.id);
|
|
89
|
+
const history = [...this.recordingService.getHistory(this.selectedAgent.id)];
|
|
67
90
|
if (history.length === 0) {
|
|
68
91
|
return React.createElement("div", { className: 'theia-card no-content' },
|
|
69
92
|
"No history available for the selected agent '",
|
|
70
93
|
this.selectedAgent.name,
|
|
71
94
|
"'.");
|
|
72
95
|
}
|
|
96
|
+
if (!this.state.chronological) {
|
|
97
|
+
history.reverse();
|
|
98
|
+
}
|
|
73
99
|
return history.map(entry => React.createElement(ai_history_communication_card_1.CommunicationCard, { key: entry.requestId, entry: entry }));
|
|
74
100
|
}
|
|
75
101
|
onClick(e, agent) {
|
|
76
102
|
e.stopPropagation();
|
|
77
103
|
this.selectAgent(agent);
|
|
78
104
|
}
|
|
105
|
+
sortHistory(chronological) {
|
|
106
|
+
this.state = { ...(0, core_1.deepClone)(this.state), chronological: chronological };
|
|
107
|
+
}
|
|
108
|
+
get isChronological() {
|
|
109
|
+
return this.state.chronological === true;
|
|
110
|
+
}
|
|
79
111
|
};
|
|
80
112
|
exports.AIHistoryView = AIHistoryView;
|
|
81
113
|
AIHistoryView.ID = 'ai-history-widget';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-history-widget.js","sourceRoot":"","sources":["../../src/browser/ai-history-widget.tsx"],"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,4CAA2I;AAC3I,qDAA+
|
|
1
|
+
{"version":3,"file":"ai-history-widget.js","sourceRoot":"","sources":["../../src/browser/ai-history-widget.tsx"],"names":[],"mappings":";;;;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E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EAAE,CAAC,oBAAC,iDAAiB,IAAC,GAAG,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC;IAC3F,CAAC;IAES,OAAO,CAAC,CAAmC,EAAE,KAAY;QAC/D,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAEM,WAAW,CAAC,aAAsB;QACrC,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,IAAA,gBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;IAC5E,CAAC;IAED,IAAI,eAAe;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IAC7C,CAAC;;AA7GQ,sCAAa;AAMR,gBAAE,GAAG,mBAAmB,AAAtB,CAAuB;AAChC,mBAAK,GAAG,mCAAmC,AAAtC,CAAuC;AALzC;IADT,IAAA,kBAAM,EAAC,uCAA6B,CAAC;;uDACoB;AAEvC;IADlB,IAAA,kBAAM,EAAC,sBAAY,CAAC;;mDACyB;AA0CpC;IADT,IAAA,yBAAa,GAAE;;;;yCAQf;wBArDQ,aAAa;IADzB,IAAA,sBAAU,GAAE;;GACA,aAAa,CA8GzB"}
|
|
@@ -6,9 +6,12 @@ export declare class DefaultCommunicationRecordingService implements Communicati
|
|
|
6
6
|
readonly onDidRecordRequest: Event<CommunicationRequestEntry>;
|
|
7
7
|
protected onDidRecordResponseEmitter: Emitter<CommunicationResponseEntry>;
|
|
8
8
|
readonly onDidRecordResponse: Event<CommunicationResponseEntry>;
|
|
9
|
+
protected onStructuralChangeEmitter: Emitter<void>;
|
|
10
|
+
readonly onStructuralChange: Event<void>;
|
|
9
11
|
protected history: Map<string, CommunicationHistory>;
|
|
10
12
|
getHistory(agentId: string): CommunicationHistory;
|
|
11
13
|
recordRequest(requestEntry: CommunicationHistoryEntry): void;
|
|
12
14
|
recordResponse(responseEntry: CommunicationHistoryEntry): void;
|
|
15
|
+
clearHistory(): void;
|
|
13
16
|
}
|
|
14
17
|
//# sourceMappingURL=communication-recording-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communication-recording-service.d.ts","sourceRoot":"","sources":["../../src/common/communication-recording-service.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AACvK,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtD,qBACa,oCAAqC,YAAW,6BAA6B;IAGtF,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAE1B,SAAS,CAAC,yBAAyB,qCAA4C;IAC/E,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAwC;IAErG,SAAS,CAAC,0BAA0B,sCAA6C;IACjF,QAAQ,CAAC,mBAAmB,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAyC;IAExG,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAa;IAEjE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB;IAIjD,aAAa,CAAC,YAAY,EAAE,yBAAyB,GAAG,IAAI;IAU5D,cAAc,CAAC,aAAa,EAAE,yBAAyB,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"communication-recording-service.d.ts","sourceRoot":"","sources":["../../src/common/communication-recording-service.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AACvK,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtD,qBACa,oCAAqC,YAAW,6BAA6B;IAGtF,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAE1B,SAAS,CAAC,yBAAyB,qCAA4C;IAC/E,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAwC;IAErG,SAAS,CAAC,0BAA0B,sCAA6C;IACjF,QAAQ,CAAC,mBAAmB,EAAE,KAAK,CAAC,0BAA0B,CAAC,CAAyC;IAExG,SAAS,CAAC,yBAAyB,gBAAuB;IAC1D,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAwC;IAEhF,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAa;IAEjE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB;IAIjD,aAAa,CAAC,YAAY,EAAE,yBAAyB,GAAG,IAAI;IAU5D,cAAc,CAAC,aAAa,EAAE,yBAAyB,GAAG,IAAI;IAgB9D,YAAY,IAAI,IAAI;CAIvB"}
|
|
@@ -10,6 +10,8 @@ let DefaultCommunicationRecordingService = class DefaultCommunicationRecordingSe
|
|
|
10
10
|
this.onDidRecordRequest = this.onDidRecordRequestEmitter.event;
|
|
11
11
|
this.onDidRecordResponseEmitter = new core_1.Emitter();
|
|
12
12
|
this.onDidRecordResponse = this.onDidRecordResponseEmitter.event;
|
|
13
|
+
this.onStructuralChangeEmitter = new core_1.Emitter();
|
|
14
|
+
this.onStructuralChange = this.onStructuralChangeEmitter.event;
|
|
13
15
|
this.history = new Map();
|
|
14
16
|
}
|
|
15
17
|
getHistory(agentId) {
|
|
@@ -41,6 +43,10 @@ let DefaultCommunicationRecordingService = class DefaultCommunicationRecordingSe
|
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
46
|
+
clearHistory() {
|
|
47
|
+
this.history.clear();
|
|
48
|
+
this.onStructuralChangeEmitter.fire(undefined);
|
|
49
|
+
}
|
|
44
50
|
};
|
|
45
51
|
exports.DefaultCommunicationRecordingService = DefaultCommunicationRecordingService;
|
|
46
52
|
tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communication-recording-service.js","sourceRoot":"","sources":["../../src/common/communication-recording-service.ts"],"names":[],"mappings":";;;;AAgBA,sCAAsD;AACtD,4DAAyE;AAGlE,IAAM,oCAAoC,GAA1C,MAAM,oCAAoC;IAA1C;QAKO,8BAAyB,GAAG,IAAI,cAAO,EAA6B,CAAC;QACtE,uBAAkB,GAAqC,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;QAE3F,+BAA0B,GAAG,IAAI,cAAO,EAA8B,CAAC;QACxE,wBAAmB,GAAsC,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC;QAE9F,YAAO,GAAsC,IAAI,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"communication-recording-service.js","sourceRoot":"","sources":["../../src/common/communication-recording-service.ts"],"names":[],"mappings":";;;;AAgBA,sCAAsD;AACtD,4DAAyE;AAGlE,IAAM,oCAAoC,GAA1C,MAAM,oCAAoC;IAA1C;QAKO,8BAAyB,GAAG,IAAI,cAAO,EAA6B,CAAC;QACtE,uBAAkB,GAAqC,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;QAE3F,+BAA0B,GAAG,IAAI,cAAO,EAA8B,CAAC;QACxE,wBAAmB,GAAsC,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC;QAE9F,8BAAyB,GAAG,IAAI,cAAO,EAAQ,CAAC;QACjD,uBAAkB,GAAgB,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;QAEtE,YAAO,GAAsC,IAAI,GAAG,EAAE,CAAC;IAoCrE,CAAC;IAlCG,UAAU,CAAC,OAAe;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC3C,CAAC;IAED,aAAa,CAAC,YAAuC;;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CA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AAY;QACR,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;CACJ,CAAA;AAlDY,oFAAoC;AAGnC;IADT,IAAA,kBAAM,EAAC,cAAO,CAAC;IAAE,IAAA,iBAAK,EAAC,4BAA4B,CAAC;;oEAC3B;+CAHjB,oCAAoC;IADhD,IAAA,sBAAU,GAAE;GACA,oCAAoC,CAkDhD"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-history",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.55.0-next.25+2be612f8a",
|
|
4
4
|
"description": "Theia - AI communication history",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/ai-core": "1.
|
|
7
|
-
"@theia/core": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
9
|
-
"@theia/output": "1.
|
|
10
|
-
"@theia/workspace": "1.
|
|
6
|
+
"@theia/ai-core": "1.55.0-next.25+2be612f8a",
|
|
7
|
+
"@theia/core": "1.55.0-next.25+2be612f8a",
|
|
8
|
+
"@theia/filesystem": "1.55.0-next.25+2be612f8a",
|
|
9
|
+
"@theia/output": "1.55.0-next.25+2be612f8a",
|
|
10
|
+
"@theia/workspace": "1.55.0-next.25+2be612f8a",
|
|
11
11
|
"minimatch": "^5.1.0",
|
|
12
12
|
"tslib": "^2.6.2"
|
|
13
13
|
},
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"nyc": {
|
|
51
51
|
"extends": "../../configs/nyc.json"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "2be612f8a7efb90c1183ba47f0897040925b304a"
|
|
54
54
|
}
|
|
@@ -13,11 +13,13 @@
|
|
|
13
13
|
//
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
|
-
import { FrontendApplication } from '@theia/core/lib/browser';
|
|
16
|
+
import { FrontendApplication, codicon } from '@theia/core/lib/browser';
|
|
17
17
|
import { AIViewContribution } from '@theia/ai-core/lib/browser';
|
|
18
|
-
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
19
|
import { AIHistoryView } from './ai-history-widget';
|
|
20
|
-
import { Command, CommandRegistry } from '@theia/core';
|
|
20
|
+
import { Command, CommandRegistry, Emitter } from '@theia/core';
|
|
21
|
+
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
22
|
+
import { CommunicationRecordingService } from '@theia/ai-core';
|
|
21
23
|
|
|
22
24
|
export const AI_HISTORY_TOGGLE_COMMAND_ID = 'aiHistory:toggle';
|
|
23
25
|
export const OPEN_AI_HISTORY_VIEW = Command.toLocalizedCommand({
|
|
@@ -25,8 +27,28 @@ export const OPEN_AI_HISTORY_VIEW = Command.toLocalizedCommand({
|
|
|
25
27
|
label: 'Open AI History view',
|
|
26
28
|
});
|
|
27
29
|
|
|
30
|
+
export const AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY = Command.toLocalizedCommand({
|
|
31
|
+
id: 'aiHistory:sortChronologically',
|
|
32
|
+
label: 'AI History: Sort chronologically',
|
|
33
|
+
iconClass: codicon('arrow-down')
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY = Command.toLocalizedCommand({
|
|
37
|
+
id: 'aiHistory:sortReverseChronologically',
|
|
38
|
+
label: 'AI History: Sort reverse chronologically',
|
|
39
|
+
iconClass: codicon('arrow-up')
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const AI_HISTORY_VIEW_CLEAR = Command.toLocalizedCommand({
|
|
43
|
+
id: 'aiHistory:clear',
|
|
44
|
+
label: 'AI History: Clear History',
|
|
45
|
+
iconClass: codicon('clear-all')
|
|
46
|
+
});
|
|
47
|
+
|
|
28
48
|
@injectable()
|
|
29
|
-
export class AIHistoryViewContribution extends AIViewContribution<AIHistoryView> {
|
|
49
|
+
export class AIHistoryViewContribution extends AIViewContribution<AIHistoryView> implements TabBarToolbarContribution {
|
|
50
|
+
@inject(CommunicationRecordingService) private recordingService: CommunicationRecordingService;
|
|
51
|
+
|
|
30
52
|
constructor() {
|
|
31
53
|
super({
|
|
32
54
|
widgetId: AIHistoryView.ID,
|
|
@@ -43,10 +65,78 @@ export class AIHistoryViewContribution extends AIViewContribution<AIHistoryView>
|
|
|
43
65
|
await this.openView();
|
|
44
66
|
}
|
|
45
67
|
|
|
46
|
-
override registerCommands(
|
|
47
|
-
super.registerCommands(
|
|
48
|
-
|
|
68
|
+
override registerCommands(registry: CommandRegistry): void {
|
|
69
|
+
super.registerCommands(registry);
|
|
70
|
+
registry.registerCommand(OPEN_AI_HISTORY_VIEW, {
|
|
49
71
|
execute: () => this.openView({ activate: true }),
|
|
50
72
|
});
|
|
73
|
+
registry.registerCommand(AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY, {
|
|
74
|
+
isEnabled: widget => this.withHistoryWidget(widget, historyView => !historyView.isChronological),
|
|
75
|
+
isVisible: widget => this.withHistoryWidget(widget, historyView => !historyView.isChronological),
|
|
76
|
+
execute: widget => this.withHistoryWidget(widget, historyView => {
|
|
77
|
+
historyView.sortHistory(true);
|
|
78
|
+
return true;
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
registry.registerCommand(AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY, {
|
|
82
|
+
isEnabled: widget => this.withHistoryWidget(widget, historyView => historyView.isChronological),
|
|
83
|
+
isVisible: widget => this.withHistoryWidget(widget, historyView => historyView.isChronological),
|
|
84
|
+
execute: widget => this.withHistoryWidget(widget, historyView => {
|
|
85
|
+
historyView.sortHistory(false);
|
|
86
|
+
return true;
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
registry.registerCommand(AI_HISTORY_VIEW_CLEAR, {
|
|
90
|
+
isEnabled: widget => this.withHistoryWidget(widget),
|
|
91
|
+
isVisible: widget => this.withHistoryWidget(widget),
|
|
92
|
+
execute: widget => this.withHistoryWidget(widget, () => {
|
|
93
|
+
this.clearHistory();
|
|
94
|
+
return true;
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
public clearHistory(): void {
|
|
99
|
+
this.recordingService.clearHistory();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
protected withHistoryWidget(
|
|
103
|
+
widget: unknown = this.tryGetWidget(),
|
|
104
|
+
predicate: (output: AIHistoryView) => boolean = () => true
|
|
105
|
+
): boolean | false {
|
|
106
|
+
return widget instanceof AIHistoryView ? predicate(widget) : false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
protected readonly onAIHistoryWidgetStateChangedEmitter = new Emitter<void>();
|
|
110
|
+
protected readonly onAIHistoryWidgettStateChanged = this.onAIHistoryWidgetStateChangedEmitter.event;
|
|
111
|
+
|
|
112
|
+
@postConstruct()
|
|
113
|
+
protected override init(): void {
|
|
114
|
+
super.init();
|
|
115
|
+
this.widget.then(widget => {
|
|
116
|
+
widget.onStateChanged(() => this.onAIHistoryWidgetStateChangedEmitter.fire());
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
registerToolbarItems(registry: TabBarToolbarRegistry): void {
|
|
121
|
+
registry.registerItem({
|
|
122
|
+
id: AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY.id,
|
|
123
|
+
command: AI_HISTORY_VIEW_SORT_CHRONOLOGICALLY.id,
|
|
124
|
+
tooltip: 'Sort chronologically',
|
|
125
|
+
isVisible: widget => this.withHistoryWidget(widget),
|
|
126
|
+
onDidChange: this.onAIHistoryWidgettStateChanged
|
|
127
|
+
});
|
|
128
|
+
registry.registerItem({
|
|
129
|
+
id: AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY.id,
|
|
130
|
+
command: AI_HISTORY_VIEW_SORT_REVERSE_CHRONOLOGICALLY.id,
|
|
131
|
+
tooltip: 'Sort reverse chronologically',
|
|
132
|
+
isVisible: widget => this.withHistoryWidget(widget),
|
|
133
|
+
onDidChange: this.onAIHistoryWidgettStateChanged
|
|
134
|
+
});
|
|
135
|
+
registry.registerItem({
|
|
136
|
+
id: AI_HISTORY_VIEW_CLEAR.id,
|
|
137
|
+
command: AI_HISTORY_VIEW_CLEAR.id,
|
|
138
|
+
tooltip: 'Clear History of all agents',
|
|
139
|
+
isVisible: widget => this.withHistoryWidget(widget)
|
|
140
|
+
});
|
|
51
141
|
}
|
|
52
142
|
}
|
|
@@ -21,6 +21,7 @@ import { ILogger } from '@theia/core';
|
|
|
21
21
|
import { AIHistoryViewContribution } from './ai-history-contribution';
|
|
22
22
|
import { AIHistoryView } from './ai-history-widget';
|
|
23
23
|
import '../../src/browser/style/ai-history.css';
|
|
24
|
+
import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
24
25
|
|
|
25
26
|
export default new ContainerModule(bind => {
|
|
26
27
|
bind(DefaultCommunicationRecordingService).toSelf().inSingletonScope();
|
|
@@ -38,4 +39,6 @@ export default new ContainerModule(bind => {
|
|
|
38
39
|
id: AIHistoryView.ID,
|
|
39
40
|
createWidget: () => context.container.get<AIHistoryView>(AIHistoryView)
|
|
40
41
|
})).inSingletonScope();
|
|
42
|
+
bind(TabBarToolbarContribution).toService(AIHistoryViewContribution);
|
|
43
|
+
|
|
41
44
|
});
|
|
@@ -14,14 +14,21 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
import { Agent, AgentService, CommunicationRecordingService, CommunicationRequestEntry, CommunicationResponseEntry } from '@theia/ai-core';
|
|
17
|
-
import { codicon, ReactWidget } from '@theia/core/lib/browser';
|
|
17
|
+
import { codicon, ReactWidget, StatefulWidget } from '@theia/core/lib/browser';
|
|
18
18
|
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
19
|
import * as React from '@theia/core/shared/react';
|
|
20
20
|
import { CommunicationCard } from './ai-history-communication-card';
|
|
21
21
|
import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component';
|
|
22
|
+
import { deepClone, Emitter } from '@theia/core';
|
|
23
|
+
|
|
24
|
+
namespace AIHistoryView {
|
|
25
|
+
export interface State {
|
|
26
|
+
chronological: boolean;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
22
29
|
|
|
23
30
|
@injectable()
|
|
24
|
-
export class AIHistoryView extends ReactWidget {
|
|
31
|
+
export class AIHistoryView extends ReactWidget implements StatefulWidget {
|
|
25
32
|
@inject(CommunicationRecordingService)
|
|
26
33
|
protected recordingService: CommunicationRecordingService;
|
|
27
34
|
@inject(AgentService)
|
|
@@ -32,6 +39,10 @@ export class AIHistoryView extends ReactWidget {
|
|
|
32
39
|
|
|
33
40
|
protected selectedAgent?: Agent;
|
|
34
41
|
|
|
42
|
+
protected _state: AIHistoryView.State = { chronological: false };
|
|
43
|
+
protected readonly onStateChangedEmitter = new Emitter<AIHistoryView.State>();
|
|
44
|
+
readonly onStateChanged = this.onStateChangedEmitter.event;
|
|
45
|
+
|
|
35
46
|
constructor() {
|
|
36
47
|
super();
|
|
37
48
|
this.id = AIHistoryView.ID;
|
|
@@ -41,11 +52,34 @@ export class AIHistoryView extends ReactWidget {
|
|
|
41
52
|
this.title.iconClass = codicon('history');
|
|
42
53
|
}
|
|
43
54
|
|
|
55
|
+
protected get state(): AIHistoryView.State {
|
|
56
|
+
return this._state;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
protected set state(state: AIHistoryView.State) {
|
|
60
|
+
this._state = state;
|
|
61
|
+
this.onStateChangedEmitter.fire(this._state);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
storeState(): object {
|
|
65
|
+
return this.state;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
restoreState(oldState: object & Partial<AIHistoryView.State>): void {
|
|
69
|
+
const copy = deepClone(this.state);
|
|
70
|
+
if (oldState.chronological) {
|
|
71
|
+
copy.chronological = oldState.chronological;
|
|
72
|
+
}
|
|
73
|
+
this.state = copy;
|
|
74
|
+
}
|
|
75
|
+
|
|
44
76
|
@postConstruct()
|
|
45
77
|
protected init(): void {
|
|
46
78
|
this.update();
|
|
47
79
|
this.toDispose.push(this.recordingService.onDidRecordRequest(entry => this.historyContentUpdated(entry)));
|
|
48
80
|
this.toDispose.push(this.recordingService.onDidRecordResponse(entry => this.historyContentUpdated(entry)));
|
|
81
|
+
this.toDispose.push(this.recordingService.onStructuralChange(() => this.update()));
|
|
82
|
+
this.toDispose.push(this.onStateChanged(newState => this.update()));
|
|
49
83
|
this.selectAgent(this.agentService.getAllAgents()[0]);
|
|
50
84
|
}
|
|
51
85
|
|
|
@@ -82,10 +116,13 @@ export class AIHistoryView extends ReactWidget {
|
|
|
82
116
|
if (!this.selectedAgent) {
|
|
83
117
|
return <div className='theia-card no-content'>No agent selected.</div>;
|
|
84
118
|
}
|
|
85
|
-
const history = this.recordingService.getHistory(this.selectedAgent.id);
|
|
119
|
+
const history = [...this.recordingService.getHistory(this.selectedAgent.id)];
|
|
86
120
|
if (history.length === 0) {
|
|
87
121
|
return <div className='theia-card no-content'>No history available for the selected agent '{this.selectedAgent.name}'.</div>;
|
|
88
122
|
}
|
|
123
|
+
if (!this.state.chronological) {
|
|
124
|
+
history.reverse();
|
|
125
|
+
}
|
|
89
126
|
return history.map(entry => <CommunicationCard key={entry.requestId} entry={entry} />);
|
|
90
127
|
}
|
|
91
128
|
|
|
@@ -93,4 +130,12 @@ export class AIHistoryView extends ReactWidget {
|
|
|
93
130
|
e.stopPropagation();
|
|
94
131
|
this.selectAgent(agent);
|
|
95
132
|
}
|
|
133
|
+
|
|
134
|
+
public sortHistory(chronological: boolean): void {
|
|
135
|
+
this.state = { ...deepClone(this.state), chronological: chronological };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
get isChronological(): boolean {
|
|
139
|
+
return this.state.chronological === true;
|
|
140
|
+
}
|
|
96
141
|
}
|
|
@@ -29,6 +29,9 @@ export class DefaultCommunicationRecordingService implements CommunicationRecord
|
|
|
29
29
|
protected onDidRecordResponseEmitter = new Emitter<CommunicationResponseEntry>();
|
|
30
30
|
readonly onDidRecordResponse: Event<CommunicationResponseEntry> = this.onDidRecordResponseEmitter.event;
|
|
31
31
|
|
|
32
|
+
protected onStructuralChangeEmitter = new Emitter<void>();
|
|
33
|
+
readonly onStructuralChange: Event<void> = this.onStructuralChangeEmitter.event;
|
|
34
|
+
|
|
32
35
|
protected history: Map<string, CommunicationHistory> = new Map();
|
|
33
36
|
|
|
34
37
|
getHistory(agentId: string): CommunicationHistory {
|
|
@@ -60,4 +63,9 @@ export class DefaultCommunicationRecordingService implements CommunicationRecord
|
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
}
|
|
66
|
+
|
|
67
|
+
clearHistory(): void {
|
|
68
|
+
this.history.clear();
|
|
69
|
+
this.onStructuralChangeEmitter.fire(undefined);
|
|
70
|
+
}
|
|
63
71
|
}
|