@theia/ai-chat 1.67.0-next.59 → 1.67.0
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/frontend-chat-service.js +1 -1
- package/lib/browser/frontend-chat-service.js.map +1 -1
- package/lib/common/ai-chat-preferences.d.ts +1 -0
- package/lib/common/ai-chat-preferences.d.ts.map +1 -1
- package/lib/common/ai-chat-preferences.js +10 -3
- package/lib/common/ai-chat-preferences.js.map +1 -1
- package/lib/common/chat-agent-recommendation-service.d.ts +18 -0
- package/lib/common/chat-agent-recommendation-service.d.ts.map +1 -0
- package/lib/common/chat-agent-recommendation-service.js +20 -0
- package/lib/common/chat-agent-recommendation-service.js.map +1 -0
- package/lib/common/chat-agents.d.ts.map +1 -1
- package/lib/common/chat-agents.js +1 -1
- package/lib/common/chat-agents.js.map +1 -1
- package/lib/common/chat-auto-save.spec.js +5 -2
- package/lib/common/chat-auto-save.spec.js.map +1 -1
- package/lib/common/chat-content-deserializer.d.ts.map +1 -1
- package/lib/common/chat-content-deserializer.js +1 -1
- package/lib/common/chat-content-deserializer.js.map +1 -1
- package/lib/common/chat-model.d.ts +5 -1
- package/lib/common/chat-model.d.ts.map +1 -1
- package/lib/common/chat-model.js +8 -2
- package/lib/common/chat-model.js.map +1 -1
- package/lib/common/chat-service.d.ts.map +1 -1
- package/lib/common/chat-service.js +7 -11
- package/lib/common/chat-service.js.map +1 -1
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -0
- package/lib/common/index.js.map +1 -1
- package/package.json +10 -10
- package/src/browser/frontend-chat-service.ts +1 -1
- package/src/common/ai-chat-preferences.ts +10 -2
- package/src/common/chat-agent-recommendation-service.ts +35 -0
- package/src/common/chat-agents.ts +2 -1
- package/src/common/chat-auto-save.spec.ts +6 -3
- package/src/common/chat-content-deserializer.ts +2 -1
- package/src/common/chat-model.ts +12 -2
- package/src/common/chat-service.ts +7 -10
- package/src/common/index.ts +1 -0
package/src/common/chat-model.ts
CHANGED
|
@@ -408,6 +408,7 @@ export interface ToolCallContentData {
|
|
|
408
408
|
arguments?: string;
|
|
409
409
|
finished?: boolean;
|
|
410
410
|
result?: ToolCallResult;
|
|
411
|
+
data?: Record<string, string>;
|
|
411
412
|
}
|
|
412
413
|
|
|
413
414
|
export interface CommandContentData {
|
|
@@ -477,6 +478,7 @@ export interface ToolCallChatResponseContent extends Required<ChatResponseConten
|
|
|
477
478
|
finished: boolean;
|
|
478
479
|
result?: ToolCallResult;
|
|
479
480
|
confirmed: Promise<boolean>;
|
|
481
|
+
data?: Record<string, string>;
|
|
480
482
|
confirm(): void;
|
|
481
483
|
deny(): void;
|
|
482
484
|
cancelConfirmation(reason?: unknown): void;
|
|
@@ -1936,16 +1938,18 @@ export class ToolCallChatResponseContentImpl implements ToolCallChatResponseCont
|
|
|
1936
1938
|
protected _arguments?: string;
|
|
1937
1939
|
protected _finished?: boolean;
|
|
1938
1940
|
protected _result?: ToolCallResult;
|
|
1941
|
+
protected _data?: Record<string, string>;
|
|
1939
1942
|
protected _confirmed: Promise<boolean>;
|
|
1940
1943
|
protected _confirmationResolver?: (value: boolean) => void;
|
|
1941
1944
|
protected _confirmationRejecter?: (reason?: unknown) => void;
|
|
1942
1945
|
|
|
1943
|
-
constructor(id?: string, name?: string, arg_string?: string, finished?: boolean, result?: ToolCallResult) {
|
|
1946
|
+
constructor(id?: string, name?: string, arg_string?: string, finished?: boolean, result?: ToolCallResult, data?: Record<string, string>) {
|
|
1944
1947
|
this._id = id;
|
|
1945
1948
|
this._name = name;
|
|
1946
1949
|
this._arguments = arg_string;
|
|
1947
1950
|
this._finished = finished;
|
|
1948
1951
|
this._result = result;
|
|
1952
|
+
this._data = data;
|
|
1949
1953
|
// Initialize the confirmation promise immediately
|
|
1950
1954
|
this._confirmed = this.createConfirmationPromise();
|
|
1951
1955
|
}
|
|
@@ -1969,6 +1973,10 @@ export class ToolCallChatResponseContentImpl implements ToolCallChatResponseCont
|
|
|
1969
1973
|
return this._result;
|
|
1970
1974
|
}
|
|
1971
1975
|
|
|
1976
|
+
get data(): Record<string, string> | undefined {
|
|
1977
|
+
return this._data;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1972
1980
|
get confirmed(): Promise<boolean> {
|
|
1973
1981
|
return this._confirmed;
|
|
1974
1982
|
}
|
|
@@ -2030,6 +2038,7 @@ export class ToolCallChatResponseContentImpl implements ToolCallChatResponseCont
|
|
|
2030
2038
|
this._result = nextChatResponseContent.result;
|
|
2031
2039
|
const args = nextChatResponseContent.arguments;
|
|
2032
2040
|
this._arguments = (args && args.length > 0) ? args : this._arguments;
|
|
2041
|
+
this._data = { ...nextChatResponseContent.data, ...this._data };
|
|
2033
2042
|
// Don't merge confirmation promises - they should be managed separately
|
|
2034
2043
|
return true;
|
|
2035
2044
|
}
|
|
@@ -2049,7 +2058,8 @@ export class ToolCallChatResponseContentImpl implements ToolCallChatResponseCont
|
|
|
2049
2058
|
type: 'tool_use',
|
|
2050
2059
|
id: this.id ?? '',
|
|
2051
2060
|
input: this.arguments && this.arguments.length !== 0 ? JSON.parse(this.arguments) : {},
|
|
2052
|
-
name: this.name ?? ''
|
|
2061
|
+
name: this.name ?? '',
|
|
2062
|
+
data: this.data
|
|
2053
2063
|
}, {
|
|
2054
2064
|
actor: 'user',
|
|
2055
2065
|
type: 'tool_result',
|
|
@@ -283,7 +283,9 @@ export class ChatServiceImpl implements ChatService {
|
|
|
283
283
|
session.pinnedAgent = agent;
|
|
284
284
|
|
|
285
285
|
if (agent === undefined) {
|
|
286
|
-
const error = 'No
|
|
286
|
+
const error = 'No agent was found to handle this request. ' +
|
|
287
|
+
'Please ensure you have configured a default agent in the preferences and that the agent is enabled in the AI Configuration view. ' +
|
|
288
|
+
'Alternatively, mention a specific agent with @AgentName.';
|
|
287
289
|
this.logger.error(error);
|
|
288
290
|
const chatResponseModel = new ErrorChatResponseModel(generateUuid(), new Error(error));
|
|
289
291
|
return {
|
|
@@ -407,18 +409,13 @@ export class ChatServiceImpl implements ChatService {
|
|
|
407
409
|
if (agentPart) {
|
|
408
410
|
return this.chatAgentService.getAgent(agentPart.agentId);
|
|
409
411
|
}
|
|
410
|
-
let chatAgent = undefined;
|
|
411
412
|
if (this.defaultChatAgentId) {
|
|
412
|
-
|
|
413
|
+
return this.chatAgentService.getAgent(this.defaultChatAgentId.id);
|
|
413
414
|
}
|
|
414
|
-
if (
|
|
415
|
-
|
|
415
|
+
if (this.fallbackChatAgentId) {
|
|
416
|
+
return this.chatAgentService.getAgent(this.fallbackChatAgentId.id);
|
|
416
417
|
}
|
|
417
|
-
|
|
418
|
-
return chatAgent;
|
|
419
|
-
}
|
|
420
|
-
this.logger.warn('Neither the default chat agent nor the fallback chat agent are configured or available. Falling back to the first registered agent');
|
|
421
|
-
return this.chatAgentService.getAgents()[0] ?? undefined;
|
|
418
|
+
return undefined;
|
|
422
419
|
}
|
|
423
420
|
|
|
424
421
|
protected getMentionedAgent(parsedRequest: ParsedChatRequest): ParsedChatRequestAgentPart | undefined {
|
package/src/common/index.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
export * from './chat-agents';
|
|
17
17
|
export * from './chat-agent-service';
|
|
18
|
+
export * from './chat-agent-recommendation-service';
|
|
18
19
|
export * from './chat-model';
|
|
19
20
|
export * from './chat-model-serialization';
|
|
20
21
|
export * from './chat-content-deserializer';
|