@theia/ai-chat 1.67.0-next.3 → 1.67.0-next.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +1 -0
  2. package/package.json +9 -9
  3. package/{lib/common/context-variables.js → src/browser/context-file-validation-service.ts} +19 -7
  4. package/lib/browser/agent-delegation-tool.d.ts +0 -25
  5. package/lib/browser/agent-delegation-tool.d.ts.map +0 -1
  6. package/lib/browser/agent-delegation-tool.js +0 -196
  7. package/lib/browser/agent-delegation-tool.js.map +0 -1
  8. package/lib/browser/ai-chat-frontend-contribution.d.ts +0 -11
  9. package/lib/browser/ai-chat-frontend-contribution.d.ts.map +0 -1
  10. package/lib/browser/ai-chat-frontend-contribution.js +0 -56
  11. package/lib/browser/ai-chat-frontend-contribution.js.map +0 -1
  12. package/lib/browser/ai-chat-frontend-module.d.ts +0 -4
  13. package/lib/browser/ai-chat-frontend-module.d.ts.map +0 -1
  14. package/lib/browser/ai-chat-frontend-module.js +0 -143
  15. package/lib/browser/ai-chat-frontend-module.js.map +0 -1
  16. package/lib/browser/change-set-decorator-service.d.ts +0 -24
  17. package/lib/browser/change-set-decorator-service.d.ts.map +0 -1
  18. package/lib/browser/change-set-decorator-service.js +0 -66
  19. package/lib/browser/change-set-decorator-service.js.map +0 -1
  20. package/lib/browser/change-set-file-element-deserializer.d.ts +0 -7
  21. package/lib/browser/change-set-file-element-deserializer.d.ts.map +0 -1
  22. package/lib/browser/change-set-file-element-deserializer.js +0 -61
  23. package/lib/browser/change-set-file-element-deserializer.js.map +0 -1
  24. package/lib/browser/change-set-file-element.d.ts +0 -122
  25. package/lib/browser/change-set-file-element.d.ts.map +0 -1
  26. package/lib/browser/change-set-file-element.js +0 -435
  27. package/lib/browser/change-set-file-element.js.map +0 -1
  28. package/lib/browser/change-set-file-resource.d.ts +0 -4
  29. package/lib/browser/change-set-file-resource.d.ts.map +0 -1
  30. package/lib/browser/change-set-file-resource.js +0 -24
  31. package/lib/browser/change-set-file-resource.js.map +0 -1
  32. package/lib/browser/change-set-file-service.d.ts +0 -32
  33. package/lib/browser/change-set-file-service.d.ts.map +0 -1
  34. package/lib/browser/change-set-file-service.js +0 -161
  35. package/lib/browser/change-set-file-service.js.map +0 -1
  36. package/lib/browser/change-set-variable.d.ts +0 -11
  37. package/lib/browser/change-set-variable.d.ts.map +0 -1
  38. package/lib/browser/change-set-variable.js +0 -64
  39. package/lib/browser/change-set-variable.js.map +0 -1
  40. package/lib/browser/chat-session-store-impl.d.ts +0 -36
  41. package/lib/browser/chat-session-store-impl.d.ts.map +0 -1
  42. package/lib/browser/chat-session-store-impl.js +0 -287
  43. package/lib/browser/chat-session-store-impl.js.map +0 -1
  44. package/lib/browser/chat-tool-preference-bindings.d.ts +0 -34
  45. package/lib/browser/chat-tool-preference-bindings.d.ts.map +0 -1
  46. package/lib/browser/chat-tool-preference-bindings.js +0 -122
  47. package/lib/browser/chat-tool-preference-bindings.js.map +0 -1
  48. package/lib/browser/chat-tool-request-service.d.ts +0 -21
  49. package/lib/browser/chat-tool-request-service.d.ts.map +0 -1
  50. package/lib/browser/chat-tool-request-service.js +0 -90
  51. package/lib/browser/chat-tool-request-service.js.map +0 -1
  52. package/lib/browser/context-file-variable-label-provider.d.ts +0 -14
  53. package/lib/browser/context-file-variable-label-provider.d.ts.map +0 -1
  54. package/lib/browser/context-file-variable-label-provider.js +0 -63
  55. package/lib/browser/context-file-variable-label-provider.js.map +0 -1
  56. package/lib/browser/context-variable-label-provider.d.ts +0 -9
  57. package/lib/browser/context-variable-label-provider.d.ts.map +0 -1
  58. package/lib/browser/context-variable-label-provider.js +0 -55
  59. package/lib/browser/context-variable-label-provider.js.map +0 -1
  60. package/lib/browser/custom-agent-factory.d.ts +0 -4
  61. package/lib/browser/custom-agent-factory.d.ts.map +0 -1
  62. package/lib/browser/custom-agent-factory.js +0 -20
  63. package/lib/browser/custom-agent-factory.js.map +0 -1
  64. package/lib/browser/custom-agent-frontend-application-contribution.d.ts +0 -13
  65. package/lib/browser/custom-agent-frontend-application-contribution.d.ts.map +0 -1
  66. package/lib/browser/custom-agent-frontend-application-contribution.js +0 -83
  67. package/lib/browser/custom-agent-frontend-application-contribution.js.map +0 -1
  68. package/lib/browser/delegation-response-content.d.ts +0 -20
  69. package/lib/browser/delegation-response-content.d.ts.map +0 -1
  70. package/lib/browser/delegation-response-content.js +0 -47
  71. package/lib/browser/delegation-response-content.js.map +0 -1
  72. package/lib/browser/file-chat-variable-contribution.d.ts +0 -32
  73. package/lib/browser/file-chat-variable-contribution.d.ts.map +0 -1
  74. package/lib/browser/file-chat-variable-contribution.js +0 -241
  75. package/lib/browser/file-chat-variable-contribution.js.map +0 -1
  76. package/lib/browser/frontend-chat-service.d.ts +0 -15
  77. package/lib/browser/frontend-chat-service.d.ts.map +0 -1
  78. package/lib/browser/frontend-chat-service.js +0 -72
  79. package/lib/browser/frontend-chat-service.js.map +0 -1
  80. package/lib/browser/image-context-variable-contribution.d.ts +0 -27
  81. package/lib/browser/image-context-variable-contribution.d.ts.map +0 -1
  82. package/lib/browser/image-context-variable-contribution.js +0 -149
  83. package/lib/browser/image-context-variable-contribution.js.map +0 -1
  84. package/lib/browser/task-context-service.d.ts +0 -46
  85. package/lib/browser/task-context-service.d.ts.map +0 -1
  86. package/lib/browser/task-context-service.js +0 -256
  87. package/lib/browser/task-context-service.js.map +0 -1
  88. package/lib/browser/task-context-storage-service.d.ts +0 -19
  89. package/lib/browser/task-context-storage-service.d.ts.map +0 -1
  90. package/lib/browser/task-context-storage-service.js +0 -80
  91. package/lib/browser/task-context-storage-service.js.map +0 -1
  92. package/lib/browser/task-context-variable-contribution.d.ts +0 -20
  93. package/lib/browser/task-context-variable-contribution.d.ts.map +0 -1
  94. package/lib/browser/task-context-variable-contribution.js +0 -101
  95. package/lib/browser/task-context-variable-contribution.js.map +0 -1
  96. package/lib/browser/task-context-variable-label-provider.d.ts +0 -21
  97. package/lib/browser/task-context-variable-label-provider.d.ts.map +0 -1
  98. package/lib/browser/task-context-variable-label-provider.js +0 -83
  99. package/lib/browser/task-context-variable-label-provider.js.map +0 -1
  100. package/lib/browser/task-context-variable.d.ts +0 -3
  101. package/lib/browser/task-context-variable.d.ts.map +0 -1
  102. package/lib/browser/task-context-variable.js +0 -33
  103. package/lib/browser/task-context-variable.js.map +0 -1
  104. package/lib/common/ai-chat-preferences.d.ts +0 -5
  105. package/lib/common/ai-chat-preferences.d.ts.map +0 -1
  106. package/lib/common/ai-chat-preferences.js +0 -40
  107. package/lib/common/ai-chat-preferences.js.map +0 -1
  108. package/lib/common/change-set-element-deserializer.d.ts +0 -30
  109. package/lib/common/change-set-element-deserializer.d.ts.map +0 -1
  110. package/lib/common/change-set-element-deserializer.js +0 -81
  111. package/lib/common/change-set-element-deserializer.js.map +0 -1
  112. package/lib/common/change-set.d.ts +0 -85
  113. package/lib/common/change-set.d.ts.map +0 -1
  114. package/lib/common/change-set.js +0 -133
  115. package/lib/common/change-set.js.map +0 -1
  116. package/lib/common/chat-agent-service.d.ts +0 -46
  117. package/lib/common/chat-agent-service.d.ts.map +0 -1
  118. package/lib/common/chat-agent-service.js +0 -79
  119. package/lib/common/chat-agent-service.js.map +0 -1
  120. package/lib/common/chat-agents-variable-contribution.d.ts +0 -17
  121. package/lib/common/chat-agents-variable-contribution.d.ts.map +0 -1
  122. package/lib/common/chat-agents-variable-contribution.js +0 -67
  123. package/lib/common/chat-agents-variable-contribution.js.map +0 -1
  124. package/lib/common/chat-agents.d.ts +0 -138
  125. package/lib/common/chat-agents.d.ts.map +0 -1
  126. package/lib/common/chat-agents.js +0 -428
  127. package/lib/common/chat-agents.js.map +0 -1
  128. package/lib/common/chat-auto-save.spec.d.ts +0 -2
  129. package/lib/common/chat-auto-save.spec.d.ts.map +0 -1
  130. package/lib/common/chat-auto-save.spec.js +0 -304
  131. package/lib/common/chat-auto-save.spec.js.map +0 -1
  132. package/lib/common/chat-content-deserializer.d.ts +0 -161
  133. package/lib/common/chat-content-deserializer.d.ts.map +0 -1
  134. package/lib/common/chat-content-deserializer.js +0 -166
  135. package/lib/common/chat-content-deserializer.js.map +0 -1
  136. package/lib/common/chat-content-deserializer.spec.d.ts +0 -2
  137. package/lib/common/chat-content-deserializer.spec.d.ts.map +0 -1
  138. package/lib/common/chat-content-deserializer.spec.js +0 -307
  139. package/lib/common/chat-content-deserializer.spec.js.map +0 -1
  140. package/lib/common/chat-model-serialization.d.ts +0 -110
  141. package/lib/common/chat-model-serialization.d.ts.map +0 -1
  142. package/lib/common/chat-model-serialization.js +0 -20
  143. package/lib/common/chat-model-serialization.js.map +0 -1
  144. package/lib/common/chat-model-serialization.spec.d.ts +0 -2
  145. package/lib/common/chat-model-serialization.spec.d.ts.map +0 -1
  146. package/lib/common/chat-model-serialization.spec.js +0 -278
  147. package/lib/common/chat-model-serialization.spec.js.map +0 -1
  148. package/lib/common/chat-model-util.d.ts +0 -7
  149. package/lib/common/chat-model-util.d.ts.map +0 -1
  150. package/lib/common/chat-model-util.js +0 -50
  151. package/lib/common/chat-model-util.js.map +0 -1
  152. package/lib/common/chat-model.d.ts +0 -923
  153. package/lib/common/chat-model.d.ts.map +0 -1
  154. package/lib/common/chat-model.js +0 -1791
  155. package/lib/common/chat-model.js.map +0 -1
  156. package/lib/common/chat-request-parser.d.ts +0 -38
  157. package/lib/common/chat-request-parser.d.ts.map +0 -1
  158. package/lib/common/chat-request-parser.js +0 -230
  159. package/lib/common/chat-request-parser.js.map +0 -1
  160. package/lib/common/chat-request-parser.spec.d.ts +0 -2
  161. package/lib/common/chat-request-parser.spec.d.ts.map +0 -1
  162. package/lib/common/chat-request-parser.spec.js +0 -235
  163. package/lib/common/chat-request-parser.spec.js.map +0 -1
  164. package/lib/common/chat-service-deletion.spec.d.ts +0 -2
  165. package/lib/common/chat-service-deletion.spec.d.ts.map +0 -1
  166. package/lib/common/chat-service-deletion.spec.js +0 -221
  167. package/lib/common/chat-service-deletion.spec.js.map +0 -1
  168. package/lib/common/chat-service.d.ts +0 -153
  169. package/lib/common/chat-service.d.ts.map +0 -1
  170. package/lib/common/chat-service.js +0 -474
  171. package/lib/common/chat-service.js.map +0 -1
  172. package/lib/common/chat-session-naming-prompt-template.d.ts +0 -3
  173. package/lib/common/chat-session-naming-prompt-template.d.ts.map +0 -1
  174. package/lib/common/chat-session-naming-prompt-template.js +0 -31
  175. package/lib/common/chat-session-naming-prompt-template.js.map +0 -1
  176. package/lib/common/chat-session-naming-service.d.ts +0 -26
  177. package/lib/common/chat-session-naming-service.d.ts.map +0 -1
  178. package/lib/common/chat-session-naming-service.js +0 -119
  179. package/lib/common/chat-session-naming-service.js.map +0 -1
  180. package/lib/common/chat-session-store.d.ts +0 -43
  181. package/lib/common/chat-session-store.d.ts.map +0 -1
  182. package/lib/common/chat-session-store.js +0 -20
  183. package/lib/common/chat-session-store.js.map +0 -1
  184. package/lib/common/chat-session-summary-agent-prompt.d.ts +0 -8
  185. package/lib/common/chat-session-summary-agent-prompt.d.ts.map +0 -1
  186. package/lib/common/chat-session-summary-agent-prompt.js +0 -33
  187. package/lib/common/chat-session-summary-agent-prompt.js.map +0 -1
  188. package/lib/common/chat-session-summary-agent.d.ts +0 -16
  189. package/lib/common/chat-session-summary-agent.d.ts.map +0 -1
  190. package/lib/common/chat-session-summary-agent.js +0 -48
  191. package/lib/common/chat-session-summary-agent.js.map +0 -1
  192. package/lib/common/chat-string-utils.d.ts +0 -3
  193. package/lib/common/chat-string-utils.d.ts.map +0 -1
  194. package/lib/common/chat-string-utils.js +0 -27
  195. package/lib/common/chat-string-utils.js.map +0 -1
  196. package/lib/common/chat-tool-preferences.d.ts +0 -23
  197. package/lib/common/chat-tool-preferences.d.ts.map +0 -1
  198. package/lib/common/chat-tool-preferences.js +0 -68
  199. package/lib/common/chat-tool-preferences.js.map +0 -1
  200. package/lib/common/chat-tool-request-service.d.ts +0 -18
  201. package/lib/common/chat-tool-request-service.d.ts.map +0 -1
  202. package/lib/common/chat-tool-request-service.js +0 -52
  203. package/lib/common/chat-tool-request-service.js.map +0 -1
  204. package/lib/common/context-details-variable.d.ts +0 -9
  205. package/lib/common/context-details-variable.d.ts.map +0 -1
  206. package/lib/common/context-details-variable.js +0 -57
  207. package/lib/common/context-details-variable.js.map +0 -1
  208. package/lib/common/context-summary-variable.d.ts +0 -9
  209. package/lib/common/context-summary-variable.d.ts.map +0 -1
  210. package/lib/common/context-summary-variable.js +0 -57
  211. package/lib/common/context-summary-variable.js.map +0 -1
  212. package/lib/common/context-variables.d.ts +0 -4
  213. package/lib/common/context-variables.d.ts.map +0 -1
  214. package/lib/common/context-variables.js.map +0 -1
  215. package/lib/common/custom-chat-agent.d.ts +0 -10
  216. package/lib/common/custom-chat-agent.d.ts.map +0 -1
  217. package/lib/common/custom-chat-agent.js +0 -40
  218. package/lib/common/custom-chat-agent.js.map +0 -1
  219. package/lib/common/image-context-variable.d.ts +0 -29
  220. package/lib/common/image-context-variable.d.ts.map +0 -1
  221. package/lib/common/image-context-variable.js +0 -114
  222. package/lib/common/image-context-variable.js.map +0 -1
  223. package/lib/common/index.d.ts +0 -13
  224. package/lib/common/index.d.ts.map +0 -1
  225. package/lib/common/index.js +0 -31
  226. package/lib/common/index.js.map +0 -1
  227. package/lib/common/parse-contents-with-incomplete-parts.spec.d.ts +0 -2
  228. package/lib/common/parse-contents-with-incomplete-parts.spec.d.ts.map +0 -1
  229. package/lib/common/parse-contents-with-incomplete-parts.spec.js +0 -103
  230. package/lib/common/parse-contents-with-incomplete-parts.spec.js.map +0 -1
  231. package/lib/common/parse-contents.d.ts +0 -12
  232. package/lib/common/parse-contents.d.ts.map +0 -1
  233. package/lib/common/parse-contents.js +0 -107
  234. package/lib/common/parse-contents.js.map +0 -1
  235. package/lib/common/parse-contents.spec.d.ts +0 -10
  236. package/lib/common/parse-contents.spec.d.ts.map +0 -1
  237. package/lib/common/parse-contents.spec.js +0 -146
  238. package/lib/common/parse-contents.spec.js.map +0 -1
  239. package/lib/common/parsed-chat-request.d.ts +0 -66
  240. package/lib/common/parsed-chat-request.d.ts.map +0 -1
  241. package/lib/common/parsed-chat-request.js +0 -83
  242. package/lib/common/parsed-chat-request.js.map +0 -1
  243. package/lib/common/response-content-matcher.d.ts +0 -69
  244. package/lib/common/response-content-matcher.d.ts.map +0 -1
  245. package/lib/common/response-content-matcher.js +0 -97
  246. package/lib/common/response-content-matcher.js.map +0 -1
  247. package/lib/node/ai-chat-backend-module.d.ts +0 -4
  248. package/lib/node/ai-chat-backend-module.d.ts.map +0 -1
  249. package/lib/node/ai-chat-backend-module.js +0 -26
  250. package/lib/node/ai-chat-backend-module.js.map +0 -1
@@ -1,923 +0,0 @@
1
- /// <reference types="lodash" />
2
- import { AIVariableResolutionRequest, LanguageModelMessage, ResolvedAIContextVariable, TextMessage, ThinkingMessage, ToolCallResult, ToolResultMessage, ToolUseMessage } from '@theia/ai-core';
3
- import { CancellationToken, CancellationTokenSource, Command, Disposable, DisposableCollection, Emitter, Event, URI } from '@theia/core';
4
- import { MarkdownString, MarkdownStringImpl } from '@theia/core/lib/common/markdown-rendering';
5
- import { Position } from '@theia/core/shared/vscode-languageserver-protocol';
6
- import { ChangeSet, ChangeSetElement, ChangeSetImpl, ChatUpdateChangeSetEvent } from './change-set';
7
- import { ChatAgentLocation } from './chat-agents';
8
- import { SerializedChatModel, SerializableChatRequestData, SerializableChatResponseContentData, SerializableChatResponseData, SerializableHierarchy, SerializableHierarchyBranch } from './chat-model-serialization';
9
- import { ParsedChatRequest } from './parsed-chat-request';
10
- export { ChangeSet, ChangeSetElement, ChangeSetImpl };
11
- /**********************
12
- * INTERFACES AND TYPE GUARDS
13
- **********************/
14
- export type ChatChangeEvent = ChatAddRequestEvent | ChatAddResponseEvent | ChatAddVariableEvent | ChatRemoveVariableEvent | ChatSetVariablesEvent | ChatRemoveRequestEvent | ChatSuggestionsChangedEvent | ChatUpdateChangeSetEvent | ChatEditRequestEvent | ChatEditCancelEvent | ChatEditSubmitEvent | ChatResponseChangedEvent | ChatChangeHierarchyBranchEvent;
15
- export interface ChatAddRequestEvent {
16
- kind: 'addRequest';
17
- request: ChatRequestModel;
18
- }
19
- export interface ChatEditRequestEvent {
20
- kind: 'enableEdit';
21
- request: EditableChatRequestModel;
22
- branch: ChatHierarchyBranch<ChatRequestModel>;
23
- }
24
- export interface ChatEditCancelEvent {
25
- kind: 'cancelEdit';
26
- request: EditableChatRequestModel;
27
- branch: ChatHierarchyBranch<ChatRequestModel>;
28
- }
29
- export interface ChatEditSubmitEvent {
30
- kind: 'submitEdit';
31
- request: EditableChatRequestModel;
32
- branch: ChatHierarchyBranch<ChatRequestModel>;
33
- newRequest: ChatRequest;
34
- }
35
- export interface ChatChangeHierarchyBranchEvent {
36
- kind: 'changeHierarchyBranch';
37
- branch: ChatHierarchyBranch<ChatRequestModel>;
38
- }
39
- export interface ChatAddResponseEvent {
40
- kind: 'addResponse';
41
- response: ChatResponseModel;
42
- }
43
- export interface ChatAddVariableEvent {
44
- kind: 'addVariable';
45
- }
46
- export interface ChatRemoveVariableEvent {
47
- kind: 'removeVariable';
48
- }
49
- export interface ChatSetVariablesEvent {
50
- kind: 'setVariables';
51
- }
52
- export interface ChatSuggestionsChangedEvent {
53
- kind: 'suggestionsChanged';
54
- suggestions: ChatSuggestion[];
55
- }
56
- export interface ChatResponseChangedEvent {
57
- kind: 'responseChanged';
58
- }
59
- export declare namespace ChatChangeEvent {
60
- function isChangeSetEvent(event: ChatChangeEvent): event is ChatUpdateChangeSetEvent;
61
- }
62
- export type ChatRequestRemovalReason = 'removal' | 'resend' | 'adoption';
63
- export interface ChatRemoveRequestEvent {
64
- kind: 'removeRequest';
65
- requestId: string;
66
- responseId?: string;
67
- reason: ChatRequestRemovalReason;
68
- }
69
- /**
70
- * A model that contains information about a chat request that may branch off.
71
- *
72
- * The hierarchy of requests is represented by a tree structure.
73
- * - The root of the tree is the initial request
74
- * - Within each branch, the requests are stored in a list. Those requests are the alternatives to the original request.
75
- * Each of those items can have a next branch, which is the next request in the hierarchy.
76
- */
77
- export interface ChatRequestHierarchy<TRequest extends ChatRequestModel = ChatRequestModel> extends Disposable {
78
- readonly branch: ChatHierarchyBranch<TRequest>;
79
- onDidChange: Event<ChangeActiveBranchEvent<TRequest>>;
80
- append(request: TRequest): ChatHierarchyBranch<TRequest>;
81
- activeRequests(): TRequest[];
82
- activeBranches(): ChatHierarchyBranch<TRequest>[];
83
- findRequest(requestId: string): TRequest | undefined;
84
- findBranch(requestId: string): ChatHierarchyBranch<TRequest> | undefined;
85
- notifyChange(event: ChangeActiveBranchEvent<TRequest>): void;
86
- toSerializable(): SerializableHierarchy;
87
- }
88
- export interface ChangeActiveBranchEvent<TRequest extends ChatRequestModel = ChatRequestModel> {
89
- branch: ChatHierarchyBranch<TRequest>;
90
- item: ChatHierarchyBranchItem<TRequest>;
91
- }
92
- /**
93
- * A branch of the chat request hierarchy.
94
- * It contains a list of items, each representing a request.
95
- * Those items can have a next branch, which is the next request in the hierarchy.
96
- */
97
- export interface ChatHierarchyBranch<TRequest extends ChatRequestModel = ChatRequestModel> extends Disposable {
98
- readonly id: string;
99
- readonly hierarchy: ChatRequestHierarchy<TRequest>;
100
- readonly previous?: ChatHierarchyBranch<TRequest>;
101
- readonly items: ChatHierarchyBranchItem<TRequest>[];
102
- readonly activeBranchIndex: number;
103
- next(): ChatHierarchyBranch<TRequest> | undefined;
104
- get(): TRequest;
105
- add(request: TRequest): void;
106
- remove(request: TRequest | string): void;
107
- /**
108
- * Create a new branch by inserting it as the next branch of the active item.
109
- */
110
- continue(request: TRequest): ChatHierarchyBranch<TRequest>;
111
- enable(request: TRequest): ChatHierarchyBranchItem<TRequest>;
112
- enablePrevious(): ChatHierarchyBranchItem<TRequest>;
113
- enableNext(): ChatHierarchyBranchItem<TRequest>;
114
- succeedingBranches(): ChatHierarchyBranch<TRequest>[];
115
- }
116
- export interface ChatHierarchyBranchItem<TRequest extends ChatRequestModel = ChatRequestModel> {
117
- readonly element: TRequest;
118
- readonly next?: ChatHierarchyBranch<TRequest>;
119
- }
120
- export interface ChatModel {
121
- readonly onDidChange: Event<ChatChangeEvent>;
122
- readonly id: string;
123
- readonly location: ChatAgentLocation;
124
- readonly context: ChatContextManager;
125
- readonly suggestions: readonly ChatSuggestion[];
126
- readonly settings?: {
127
- [key: string]: unknown;
128
- };
129
- readonly changeSet: ChangeSet;
130
- getRequests(): ChatRequestModel[];
131
- getBranches(): ChatHierarchyBranch<ChatRequestModel>[];
132
- isEmpty(): boolean;
133
- toSerializable(): SerializedChatModel;
134
- }
135
- export interface ChatSuggestionCallback {
136
- kind: 'callback';
137
- callback: () => unknown;
138
- content: string | MarkdownString;
139
- }
140
- export declare namespace ChatSuggestionCallback {
141
- function is(candidate: ChatSuggestion): candidate is ChatSuggestionCallback;
142
- function containsCallbackLink(candidate: ChatSuggestion): candidate is ChatSuggestionCallback;
143
- }
144
- export type ChatSuggestion = string | MarkdownString | ChatSuggestionCallback;
145
- export interface ChatContextManager {
146
- onDidChange: Event<ChatAddVariableEvent | ChatRemoveVariableEvent | ChatSetVariablesEvent>;
147
- getVariables(): readonly AIVariableResolutionRequest[];
148
- addVariables(...variables: AIVariableResolutionRequest[]): void;
149
- deleteVariables(...indices: number[]): void;
150
- clear(): void;
151
- }
152
- export interface ChangeSetDecoration {
153
- readonly priority?: number;
154
- readonly additionalInfoSuffixIcon?: string[];
155
- }
156
- export interface ChatRequest {
157
- readonly text: string;
158
- readonly displayText?: string;
159
- /**
160
- * If the request has been triggered in the context of
161
- * an existing request, this id will be set to the id of the
162
- * referenced request.
163
- */
164
- readonly referencedRequestId?: string;
165
- readonly variables?: readonly AIVariableResolutionRequest[];
166
- readonly modeId?: string;
167
- }
168
- export interface ChatContext {
169
- variables: ResolvedAIContextVariable[];
170
- }
171
- export interface ChatRequestModel {
172
- readonly id: string;
173
- readonly session: ChatModel;
174
- readonly request: ChatRequest;
175
- readonly response: ChatResponseModel;
176
- readonly message: ParsedChatRequest;
177
- readonly context: ChatContext;
178
- readonly agentId?: string;
179
- readonly data?: {
180
- [key: string]: unknown;
181
- };
182
- toSerializable(): SerializableChatRequestData;
183
- }
184
- export declare namespace ChatRequestModel {
185
- function is(request: unknown): request is ChatRequestModel;
186
- function isInProgress(request: ChatRequestModel | undefined): boolean;
187
- }
188
- export interface EditableChatRequestModel extends ChatRequestModel {
189
- readonly isEditing: boolean;
190
- editContextManager: ChatContextManagerImpl;
191
- enableEdit(): void;
192
- cancelEdit(): void;
193
- submitEdit(newRequest: ChatRequest): void;
194
- }
195
- export declare namespace EditableChatRequestModel {
196
- function is(request: unknown): request is EditableChatRequestModel;
197
- function isEditing(request: unknown): request is EditableChatRequestModel;
198
- }
199
- export interface ChatProgressMessage {
200
- kind: 'progressMessage';
201
- id: string;
202
- status: 'inProgress' | 'completed' | 'failed';
203
- show: 'untilFirstContent' | 'whileIncomplete' | 'forever';
204
- content: string;
205
- }
206
- export interface ChatResponseContent {
207
- kind: string;
208
- /**
209
- * Represents the content as a string. Returns `undefined` if the content
210
- * is purely informational and/or visual and should not be included in the overall
211
- * representation of the response.
212
- */
213
- asString?(): string | undefined;
214
- asDisplayString?(): string | undefined;
215
- merge?(nextChatResponseContent: ChatResponseContent): boolean;
216
- toLanguageModelMessage?(): LanguageModelMessage | LanguageModelMessage[];
217
- toSerializable?(): SerializableChatResponseContentData;
218
- }
219
- export declare namespace ChatResponseContent {
220
- function is(obj: unknown): obj is ChatResponseContent;
221
- function hasAsString(obj: ChatResponseContent): obj is Required<Pick<ChatResponseContent, 'asString'>> & ChatResponseContent;
222
- function hasDisplayString(obj: ChatResponseContent): obj is Required<Pick<ChatResponseContent, 'asDisplayString'>> & ChatResponseContent;
223
- function hasMerge(obj: ChatResponseContent): obj is Required<Pick<ChatResponseContent, 'merge'>> & ChatResponseContent;
224
- function hasToLanguageModelMessage(obj: ChatResponseContent): obj is Required<Pick<ChatResponseContent, 'toLanguageModelMessage'>> & ChatResponseContent;
225
- }
226
- /**
227
- * Data interfaces for chat response content serialization.
228
- * These define the structure of the data property in SerializableChatResponseContentData.
229
- */
230
- export interface TextContentData {
231
- content: string;
232
- }
233
- export interface ThinkingContentData {
234
- content: string;
235
- signature: string;
236
- }
237
- export interface MarkdownContentData {
238
- content: string;
239
- }
240
- export interface InformationalContentData {
241
- content: string;
242
- }
243
- export interface CodeContentData {
244
- code: string;
245
- language?: string;
246
- location?: Location;
247
- }
248
- export interface ToolCallContentData {
249
- id?: string;
250
- name?: string;
251
- arguments?: string;
252
- finished?: boolean;
253
- result?: ToolCallResult;
254
- }
255
- export interface CommandContentData {
256
- commandId?: string;
257
- commandLabel?: string;
258
- arguments?: unknown[];
259
- }
260
- export interface HorizontalLayoutContentData {
261
- content: SerializableChatResponseContentData[];
262
- }
263
- export interface ProgressContentData {
264
- message: string;
265
- }
266
- export interface ErrorContentData {
267
- message: string;
268
- stack?: string;
269
- }
270
- /**
271
- * Restored questions display the question, options, and any previously selected answer,
272
- * but do not allow new selections.
273
- */
274
- export interface QuestionContentData {
275
- question: string;
276
- options: {
277
- text: string;
278
- value?: string;
279
- }[];
280
- selectedOption?: {
281
- text: string;
282
- value?: string;
283
- };
284
- }
285
- export interface TextChatResponseContent extends Required<ChatResponseContent> {
286
- kind: 'text';
287
- content: string;
288
- }
289
- export interface ErrorChatResponseContent extends ChatResponseContent {
290
- kind: 'error';
291
- error: Error;
292
- }
293
- export interface MarkdownChatResponseContent extends Required<ChatResponseContent> {
294
- kind: 'markdownContent';
295
- content: MarkdownString;
296
- }
297
- export interface CodeChatResponseContent extends ChatResponseContent {
298
- kind: 'code';
299
- code: string;
300
- language?: string;
301
- location?: Location;
302
- }
303
- export interface HorizontalLayoutChatResponseContent extends ChatResponseContent {
304
- kind: 'horizontal';
305
- content: ChatResponseContent[];
306
- }
307
- export interface ToolCallChatResponseContent extends Required<ChatResponseContent> {
308
- kind: 'toolCall';
309
- id?: string;
310
- name?: string;
311
- arguments?: string;
312
- finished: boolean;
313
- result?: ToolCallResult;
314
- confirmed: Promise<boolean>;
315
- confirm(): void;
316
- deny(): void;
317
- cancelConfirmation(reason?: unknown): void;
318
- }
319
- export interface ThinkingChatResponseContent extends Required<ChatResponseContent> {
320
- kind: 'thinking';
321
- content: string;
322
- signature: string;
323
- }
324
- export interface ProgressChatResponseContent extends Required<ChatResponseContent> {
325
- kind: 'progress';
326
- message: string;
327
- }
328
- export interface Location {
329
- uri: URI;
330
- position: Position;
331
- }
332
- export declare namespace Location {
333
- function is(obj: unknown): obj is Location;
334
- }
335
- export interface CustomCallback {
336
- label: string;
337
- callback: () => Promise<void>;
338
- }
339
- /**
340
- * A command chat response content represents a command that is offered to the user for execution.
341
- * It either refers to an already registered Theia command or provides a custom callback.
342
- * If both are given, the custom callback will be preferred.
343
- */
344
- export interface CommandChatResponseContent extends ChatResponseContent {
345
- kind: 'command';
346
- command?: Command;
347
- customCallback?: CustomCallback;
348
- arguments?: unknown[];
349
- }
350
- /**
351
- * An informational chat response content represents a message that is purely informational and should not be included in the overall representation of the response.
352
- */
353
- export interface InformationalChatResponseContent extends ChatResponseContent {
354
- kind: 'informational';
355
- content: MarkdownString;
356
- }
357
- export declare namespace TextChatResponseContent {
358
- function is(obj: unknown): obj is TextChatResponseContent;
359
- }
360
- export declare namespace MarkdownChatResponseContent {
361
- function is(obj: unknown): obj is MarkdownChatResponseContent;
362
- }
363
- export declare namespace InformationalChatResponseContent {
364
- function is(obj: unknown): obj is InformationalChatResponseContent;
365
- }
366
- export declare namespace CommandChatResponseContent {
367
- function is(obj: unknown): obj is CommandChatResponseContent;
368
- }
369
- export declare namespace CodeChatResponseContent {
370
- function is(obj: unknown): obj is CodeChatResponseContent;
371
- }
372
- export declare namespace HorizontalLayoutChatResponseContent {
373
- function is(obj: unknown): obj is HorizontalLayoutChatResponseContent;
374
- }
375
- export declare namespace ToolCallChatResponseContent {
376
- function is(obj: unknown): obj is ToolCallChatResponseContent;
377
- }
378
- export declare namespace ErrorChatResponseContent {
379
- function is(obj: unknown): obj is ErrorChatResponseContent;
380
- }
381
- export declare namespace ThinkingChatResponseContent {
382
- function is(obj: unknown): obj is ThinkingChatResponseContent;
383
- }
384
- export declare namespace ProgressChatResponseContent {
385
- function is(obj: unknown): obj is ProgressChatResponseContent;
386
- }
387
- export type QuestionResponseHandler = (selectedOption: {
388
- text: string;
389
- value?: string;
390
- }) => void;
391
- export interface QuestionResponseContent extends ChatResponseContent {
392
- kind: 'question';
393
- question: string;
394
- options: {
395
- text: string;
396
- value?: string;
397
- }[];
398
- selectedOption?: {
399
- text: string;
400
- value?: string;
401
- };
402
- handler?: QuestionResponseHandler;
403
- request?: MutableChatRequestModel;
404
- /**
405
- * Whether this question is read-only (restored from persistence without handler).
406
- * When true, the UI should disable option selection.
407
- */
408
- readonly isReadOnly: boolean;
409
- }
410
- export declare namespace QuestionResponseContent {
411
- function is(obj: unknown): obj is QuestionResponseContent;
412
- }
413
- export interface ChatResponse {
414
- readonly content: ChatResponseContent[];
415
- asString(): string;
416
- asDisplayString(): string;
417
- }
418
- /**
419
- * The ChatResponseModel wraps the actual ChatResponse with additional information like the current state, progress messages, a unique id etc.
420
- */
421
- export interface ChatResponseModel {
422
- /**
423
- * Use this to be notified for any change in the response model
424
- */
425
- readonly onDidChange: Event<void>;
426
- /**
427
- * The unique identifier of the response model
428
- */
429
- readonly id: string;
430
- /**
431
- * The unique identifier of the request model this response is associated with
432
- */
433
- readonly requestId: string;
434
- /**
435
- * In case there are progress messages, then they will be stored here
436
- */
437
- readonly progressMessages: ChatProgressMessage[];
438
- /**
439
- * The actual response content
440
- */
441
- readonly response: ChatResponse;
442
- /**
443
- * Indicates whether this response is complete. No further changes are expected if 'true'.
444
- */
445
- readonly isComplete: boolean;
446
- /**
447
- * Indicates whether this response is canceled. No further changes are expected if 'true'.
448
- */
449
- readonly isCanceled: boolean;
450
- /**
451
- * Some agents might need to wait for user input to continue. This flag indicates that.
452
- */
453
- readonly isWaitingForInput: boolean;
454
- /**
455
- * Indicates whether an error occurred when processing the response. No further changes are expected if 'true'.
456
- */
457
- readonly isError: boolean;
458
- /**
459
- * The agent who produced the response content, if there is one.
460
- */
461
- readonly agentId?: string;
462
- /**
463
- * An optional error object that caused the response to be in an error state.
464
- */
465
- readonly errorObject?: Error;
466
- /**
467
- * Some functionality might want to store some data associated with the response.
468
- * This can be used to store and retrieve such data.
469
- */
470
- readonly data: {
471
- [key: string]: unknown;
472
- };
473
- toSerializable(): SerializableChatResponseData;
474
- }
475
- /**********************
476
- * Implementations
477
- **********************/
478
- export declare class MutableChatModel implements ChatModel, Disposable {
479
- protected readonly _onDidChangeEmitter: Emitter<ChatChangeEvent>;
480
- onDidChange: Event<ChatChangeEvent>;
481
- protected readonly toDispose: DisposableCollection;
482
- protected _hierarchy: ChatRequestHierarchy<MutableChatRequestModel>;
483
- protected _id: string;
484
- protected _suggestions: readonly ChatSuggestion[];
485
- protected readonly _contextManager: ChatContextManagerImpl;
486
- protected _changeSet: ChatTreeChangeSet;
487
- protected _settings: {
488
- [key: string]: unknown;
489
- };
490
- protected _location: ChatAgentLocation;
491
- get location(): ChatAgentLocation;
492
- constructor(locationOrSerializedData?: ChatAgentLocation | SerializedChatModel);
493
- /**
494
- * Type guard to determine if we're receiving serialized data
495
- */
496
- protected isSerializedChatModel(data: ChatAgentLocation | SerializedChatModel): data is SerializedChatModel;
497
- /**
498
- * Restore this chat model from serialized data
499
- *
500
- * Does not restore response content or changesets.
501
- * This handled by the chat service using the deserializer registries.
502
- */
503
- protected restoreFromSerializedData(data: SerializedChatModel): void;
504
- get id(): string;
505
- get changeSet(): ChangeSet;
506
- getBranches(): ChatHierarchyBranch<ChatRequestModel>[];
507
- getBranch(requestId: string): ChatHierarchyBranch<ChatRequestModel> | undefined;
508
- getRequests(): MutableChatRequestModel[];
509
- getRequest(id: string): MutableChatRequestModel | undefined;
510
- get suggestions(): readonly ChatSuggestion[];
511
- get context(): ChatContextManager;
512
- get settings(): {
513
- [key: string]: unknown;
514
- };
515
- setSettings(settings: {
516
- [key: string]: unknown;
517
- }): void;
518
- addRequest(parsedChatRequest: ParsedChatRequest, agentId?: string, context?: ChatContext): MutableChatRequestModel;
519
- protected getTargetForRequestAddition(request: ParsedChatRequest): (addendum: MutableChatRequestModel) => void;
520
- setSuggestions(suggestions: ChatSuggestion[]): void;
521
- isEmpty(): boolean;
522
- toSerializable(): SerializedChatModel;
523
- /**
524
- * Get all requests from the hierarchy.
525
- * This is used for operations that need to process all requests, such as serialization.
526
- */
527
- getAllRequests(): MutableChatRequestModel[];
528
- dispose(): void;
529
- }
530
- export declare class ChatTreeChangeSet implements Omit<ChangeSet, 'onDidChange'> {
531
- protected readonly hierarchy: ChatRequestHierarchy<MutableChatRequestModel>;
532
- protected readonly onDidChangeEmitter: Emitter<ChatUpdateChangeSetEvent>;
533
- get onDidChange(): Event<ChatUpdateChangeSetEvent>;
534
- protected readonly toDispose: DisposableCollection;
535
- constructor(hierarchy: ChatRequestHierarchy<MutableChatRequestModel>);
536
- get title(): string;
537
- removeElements(...uris: URI[]): boolean;
538
- addElements(...elements: ChangeSetElement[]): boolean;
539
- setElements(...elements: ChangeSetElement[]): void;
540
- setTitle(title: string): void;
541
- getElementByURI(uri: URI): ChangeSetElement | undefined;
542
- protected currentElements: ChangeSetElement[];
543
- protected handleChangeSetChange: import("lodash").DebouncedFunc<any>;
544
- protected doHandleChangeSetChange(): void;
545
- getElements(): ChangeSetElement[];
546
- protected computeChangeSetElements(): ChangeSetElement[];
547
- protected handleElementChange(newElements: ChangeSetElement[]): void;
548
- protected toDisposeOnRequestAdded: DisposableCollection;
549
- registerRequest(request: MutableChatRequestModel): void;
550
- protected localChangeSet?: ChangeSetImpl;
551
- protected getMutableChangeSet(): ChangeSetImpl;
552
- protected getCurrentChangeSet(): ChangeSet | undefined;
553
- /** Returns the lowest node among active nodes that satisfies {@link criterion} */
554
- getBranchParent(criterion: (branch: ChatHierarchyBranch<MutableChatRequestModel>) => boolean): ChatHierarchyBranch<MutableChatRequestModel> | undefined;
555
- dispose(): void;
556
- }
557
- export declare class ChatRequestHierarchyImpl<TRequest extends ChatRequestModel = ChatRequestModel> implements ChatRequestHierarchy<TRequest> {
558
- protected readonly onDidChangeActiveBranchEmitter: Emitter<ChangeActiveBranchEvent<TRequest>>;
559
- readonly onDidChange: Event<ChangeActiveBranchEvent<TRequest>>;
560
- readonly branch: ChatHierarchyBranch<TRequest>;
561
- constructor(serializedHierarchy?: SerializableHierarchy, requestMap?: Map<string, TRequest>);
562
- /**
563
- * Restore the hierarchy from serialized data.
564
- */
565
- protected restoreFromSerialized(serializedHierarchy: SerializableHierarchy, requestMap: Map<string, TRequest>): void;
566
- append(request: TRequest): ChatHierarchyBranch<TRequest>;
567
- activeRequests(): TRequest[];
568
- activeBranches(): ChatHierarchyBranch<TRequest>[];
569
- protected iterateBranches(): Generator<ChatHierarchyBranch<TRequest>>;
570
- findRequest(requestId: string): TRequest | undefined;
571
- findBranch(requestId: string): ChatHierarchyBranch<TRequest> | undefined;
572
- protected findInBranch(branch: ChatHierarchyBranch<TRequest>, requestId: string): ChatHierarchyBranch<TRequest> | undefined;
573
- notifyChange(event: ChangeActiveBranchEvent<TRequest>): void;
574
- toSerializable(): SerializableHierarchy;
575
- protected serializeBranch(branch: ChatHierarchyBranch<TRequest>, branches: {
576
- [branchId: string]: SerializableHierarchyBranch;
577
- }): void;
578
- dispose(): void;
579
- }
580
- export declare class ChatRequestHierarchyBranchImpl<TRequest extends ChatRequestModel> implements ChatHierarchyBranch<TRequest> {
581
- readonly hierarchy: ChatRequestHierarchy<TRequest>;
582
- readonly previous?: ChatHierarchyBranch<TRequest> | undefined;
583
- readonly items: ChatHierarchyBranchItem<TRequest>[];
584
- protected _activeIndex: number;
585
- readonly id: string;
586
- constructor(hierarchy: ChatRequestHierarchy<TRequest>, previous?: ChatHierarchyBranch<TRequest> | undefined, items?: ChatHierarchyBranchItem<TRequest>[], _activeIndex?: number, id?: string);
587
- get activeBranchIndex(): number;
588
- protected set activeBranchIndex(value: number);
589
- next(): ChatHierarchyBranch<TRequest> | undefined;
590
- get(): TRequest;
591
- add(request: TRequest): void;
592
- remove(request: TRequest | string): void;
593
- continue(request: TRequest): ChatHierarchyBranch<TRequest>;
594
- enable(request: TRequest): ChatHierarchyBranchItem<TRequest>;
595
- enablePrevious(): ChatHierarchyBranchItem<TRequest>;
596
- enableNext(): ChatHierarchyBranchItem<TRequest>;
597
- succeedingBranches(): ChatHierarchyBranch<TRequest>[];
598
- dispose(): void;
599
- }
600
- export declare class ChatContextManagerImpl implements ChatContextManager {
601
- protected readonly variables: AIVariableResolutionRequest[];
602
- protected readonly onDidChangeEmitter: Emitter<ChatAddVariableEvent | ChatRemoveVariableEvent | ChatSetVariablesEvent>;
603
- get onDidChange(): Event<ChatAddVariableEvent | ChatRemoveVariableEvent | ChatSetVariablesEvent>;
604
- constructor(context?: ChatContext);
605
- getVariables(): readonly AIVariableResolutionRequest[];
606
- addVariables(...variables: AIVariableResolutionRequest[]): void;
607
- deleteVariables(...indices: number[]): void;
608
- setVariables(variables: AIVariableResolutionRequest[]): void;
609
- clear(): void;
610
- }
611
- export declare class MutableChatRequestModel implements ChatRequestModel, EditableChatRequestModel, Disposable {
612
- protected readonly _onDidChangeEmitter: Emitter<ChatChangeEvent>;
613
- onDidChange: Event<ChatChangeEvent>;
614
- protected _id: string;
615
- protected _session: MutableChatModel;
616
- protected _request: ChatRequest;
617
- protected _response: MutableChatResponseModel;
618
- protected _changeSet?: ChangeSetImpl;
619
- protected _context: ChatContext;
620
- protected _agentId?: string;
621
- protected _data: {
622
- [key: string]: unknown;
623
- };
624
- protected _isEditing: boolean;
625
- readonly message: ParsedChatRequest;
626
- protected readonly toDispose: DisposableCollection;
627
- readonly editContextManager: ChatContextManagerImpl;
628
- constructor(session: MutableChatModel, messageOrData: ParsedChatRequest | SerializableChatRequestData, agentIdOrResponseData?: string | SerializableChatResponseData, context?: ChatContext, data?: {
629
- [key: string]: unknown;
630
- });
631
- /**
632
- * Type guard to determine if we're receiving serialized data
633
- */
634
- protected isSerializedRequestData(data: ParsedChatRequest | SerializableChatRequestData): data is SerializableChatRequestData;
635
- /**
636
- * Restore this request model from serialized data
637
- */
638
- protected restoreFromSerializedData(reqData: SerializableChatRequestData, respData?: SerializableChatResponseData): void;
639
- get changeSet(): ChangeSetImpl | undefined;
640
- set changeSet(changeSet: ChangeSetImpl);
641
- get isEditing(): boolean;
642
- enableEdit(): void;
643
- get data(): {
644
- [key: string]: unknown;
645
- } | undefined;
646
- addData(key: string, value: unknown): void;
647
- getDataByKey<T = unknown>(key: string): T;
648
- removeData(key: string): void;
649
- get id(): string;
650
- get session(): MutableChatModel;
651
- get request(): ChatRequest;
652
- get response(): MutableChatResponseModel;
653
- get context(): ChatContext;
654
- get agentId(): string | undefined;
655
- cancelEdit(): void;
656
- submitEdit(newRequest: ChatRequest): void;
657
- cancel(): void;
658
- toSerializable(): SerializableChatRequestData;
659
- dispose(): void;
660
- protected clearEditContext(): void;
661
- protected emitEditRequest(request: MutableChatRequestModel): void;
662
- protected emitCancelEdit(request: MutableChatRequestModel): void;
663
- protected emitSubmitEdit(request: MutableChatRequestModel, newRequest: ChatRequest): void;
664
- }
665
- export declare class ErrorChatResponseContentImpl implements ErrorChatResponseContent {
666
- readonly kind = "error";
667
- protected _error: Error;
668
- constructor(error: Error);
669
- get error(): Error;
670
- asString(): string | undefined;
671
- toSerializable(): SerializableChatResponseContentData<ErrorContentData>;
672
- }
673
- export declare class TextChatResponseContentImpl implements TextChatResponseContent {
674
- readonly kind = "text";
675
- protected _content: string;
676
- constructor(content: string);
677
- get content(): string;
678
- asString(): string;
679
- asDisplayString(): string | undefined;
680
- merge(nextChatResponseContent: TextChatResponseContent): boolean;
681
- toLanguageModelMessage(): TextMessage;
682
- toSerializable(): SerializableChatResponseContentData<TextContentData>;
683
- }
684
- export declare class ThinkingChatResponseContentImpl implements ThinkingChatResponseContent {
685
- readonly kind = "thinking";
686
- protected _content: string;
687
- protected _signature: string;
688
- constructor(content: string, signature: string);
689
- get content(): string;
690
- get signature(): string;
691
- asString(): string;
692
- asDisplayString(): string | undefined;
693
- merge(nextChatResponseContent: ThinkingChatResponseContent): boolean;
694
- toLanguageModelMessage(): ThinkingMessage;
695
- toSerializable(): SerializableChatResponseContentData<ThinkingContentData>;
696
- }
697
- export declare class MarkdownChatResponseContentImpl implements MarkdownChatResponseContent {
698
- readonly kind = "markdownContent";
699
- protected _content: MarkdownStringImpl;
700
- constructor(content: string);
701
- get content(): MarkdownString;
702
- asString(): string;
703
- asDisplayString(): string | undefined;
704
- merge(nextChatResponseContent: MarkdownChatResponseContent): boolean;
705
- toLanguageModelMessage(): TextMessage;
706
- toSerializable(): SerializableChatResponseContentData<MarkdownContentData>;
707
- }
708
- export declare class InformationalChatResponseContentImpl implements InformationalChatResponseContent {
709
- readonly kind = "informational";
710
- protected _content: MarkdownStringImpl;
711
- constructor(content: string);
712
- get content(): MarkdownString;
713
- asString(): string | undefined;
714
- merge(nextChatResponseContent: InformationalChatResponseContent): boolean;
715
- toSerializable(): SerializableChatResponseContentData<InformationalContentData>;
716
- }
717
- export declare class CodeChatResponseContentImpl implements CodeChatResponseContent {
718
- readonly kind = "code";
719
- protected _code: string;
720
- protected _language?: string;
721
- protected _location?: Location;
722
- constructor(code: string, language?: string, location?: Location);
723
- get code(): string;
724
- get language(): string | undefined;
725
- get location(): Location | undefined;
726
- asString(): string;
727
- merge(nextChatResponseContent: CodeChatResponseContent): boolean;
728
- toSerializable(): SerializableChatResponseContentData<CodeContentData>;
729
- }
730
- export declare class ToolCallChatResponseContentImpl implements ToolCallChatResponseContent {
731
- readonly kind = "toolCall";
732
- protected _id?: string;
733
- protected _name?: string;
734
- protected _arguments?: string;
735
- protected _finished?: boolean;
736
- protected _result?: ToolCallResult;
737
- protected _confirmed: Promise<boolean>;
738
- protected _confirmationResolver?: (value: boolean) => void;
739
- protected _confirmationRejecter?: (reason?: unknown) => void;
740
- constructor(id?: string, name?: string, arg_string?: string, finished?: boolean, result?: ToolCallResult);
741
- get id(): string | undefined;
742
- get name(): string | undefined;
743
- get arguments(): string | undefined;
744
- get finished(): boolean;
745
- get result(): ToolCallResult | undefined;
746
- get confirmed(): Promise<boolean>;
747
- /**
748
- * Create a confirmation promise that can be resolved/rejected later
749
- */
750
- createConfirmationPromise(): Promise<boolean>;
751
- /**
752
- * Confirm the tool execution
753
- */
754
- confirm(): void;
755
- /**
756
- * Deny the tool execution
757
- */
758
- deny(): void;
759
- /**
760
- * Cancel the confirmation (reject the promise)
761
- */
762
- cancelConfirmation(reason?: unknown): void;
763
- asString(): string;
764
- asDisplayString(): string;
765
- merge(nextChatResponseContent: ToolCallChatResponseContent): boolean;
766
- toLanguageModelMessage(): [ToolUseMessage, ToolResultMessage];
767
- toSerializable(): SerializableChatResponseContentData<ToolCallContentData>;
768
- }
769
- export declare const COMMAND_CHAT_RESPONSE_COMMAND: Command;
770
- export declare class CommandChatResponseContentImpl implements CommandChatResponseContent {
771
- command?: Command | undefined;
772
- customCallback?: CustomCallback | undefined;
773
- protected args?: unknown[] | undefined;
774
- readonly kind = "command";
775
- constructor(command?: Command | undefined, customCallback?: CustomCallback | undefined, args?: unknown[] | undefined);
776
- get arguments(): unknown[];
777
- asString(): string;
778
- toSerializable(): SerializableChatResponseContentData<CommandContentData>;
779
- }
780
- export declare class HorizontalLayoutChatResponseContentImpl implements HorizontalLayoutChatResponseContent {
781
- readonly kind = "horizontal";
782
- protected _content: ChatResponseContent[];
783
- constructor(content?: ChatResponseContent[]);
784
- get content(): ChatResponseContent[];
785
- asString(): string;
786
- asDisplayString(): string | undefined;
787
- merge(nextChatResponseContent: ChatResponseContent): boolean;
788
- toSerializable(): SerializableChatResponseContentData<HorizontalLayoutContentData>;
789
- }
790
- /**
791
- * Default implementation for the QuestionResponseContent.
792
- * Can be created with or without handler/request for read-only (restored) mode.
793
- */
794
- export declare class QuestionResponseContentImpl implements QuestionResponseContent {
795
- question: string;
796
- options: {
797
- text: string;
798
- value?: string;
799
- }[];
800
- request: MutableChatRequestModel | undefined;
801
- handler: QuestionResponseHandler | undefined;
802
- readonly kind = "question";
803
- protected _selectedOption: {
804
- text: string;
805
- value?: string;
806
- } | undefined;
807
- constructor(question: string, options: {
808
- text: string;
809
- value?: string;
810
- }[], request: MutableChatRequestModel | undefined, handler: QuestionResponseHandler | undefined, selectedOption?: {
811
- text: string;
812
- value?: string;
813
- });
814
- get isReadOnly(): boolean;
815
- set selectedOption(option: {
816
- text: string;
817
- value?: string;
818
- } | undefined);
819
- get selectedOption(): {
820
- text: string;
821
- value?: string;
822
- } | undefined;
823
- asString?(): string | undefined;
824
- merge?(): boolean;
825
- toSerializable(): SerializableChatResponseContentData<QuestionContentData>;
826
- }
827
- declare class ChatResponseImpl implements ChatResponse {
828
- protected readonly _onDidChangeEmitter: Emitter<void>;
829
- onDidChange: Event<void>;
830
- protected _content: ChatResponseContent[];
831
- protected _responseRepresentation: string;
832
- protected _responseRepresentationForDisplay: string;
833
- constructor();
834
- get content(): ChatResponseContent[];
835
- clearContent(): void;
836
- addContents(contents: ChatResponseContent[]): void;
837
- addContent(nextContent: ChatResponseContent): void;
838
- protected doAddContent(nextContent: ChatResponseContent): void;
839
- responseContentChanged(): void;
840
- protected _updateResponseRepresentation(): void;
841
- protected responseRepresentationsToString(content: ChatResponseContent[], collect: 'asString' | 'asDisplayString'): string;
842
- asString(): string;
843
- asDisplayString(): string;
844
- }
845
- export declare class MutableChatResponseModel implements ChatResponseModel {
846
- protected readonly _onDidChangeEmitter: Emitter<void>;
847
- onDidChange: Event<void>;
848
- data: {};
849
- protected _id: string;
850
- protected _requestId: string;
851
- protected _progressMessages: ChatProgressMessage[];
852
- protected _response: ChatResponseImpl;
853
- protected _isComplete: boolean;
854
- protected _isWaitingForInput: boolean;
855
- protected _agentId?: string;
856
- protected _isError: boolean;
857
- protected _errorObject: Error | undefined;
858
- protected _cancellationToken: CancellationTokenSource;
859
- constructor(requestId: string, agentId?: string, serializedData?: SerializableChatResponseData);
860
- /**
861
- * Restore this response model from serialized data
862
- */
863
- protected restoreFromSerializedData(data: SerializableChatResponseData): void;
864
- get id(): string;
865
- get requestId(): string;
866
- get progressMessages(): ChatProgressMessage[];
867
- addProgressMessage(message: {
868
- content: string;
869
- } & Partial<Omit<ChatProgressMessage, 'kind'>>): ChatProgressMessage;
870
- getProgressMessage(id: string): ChatProgressMessage | undefined;
871
- updateProgressMessage(message: {
872
- id: string;
873
- } & Partial<Omit<ChatProgressMessage, 'kind'>>): void;
874
- get response(): ChatResponseImpl;
875
- get isComplete(): boolean;
876
- get isCanceled(): boolean;
877
- get isWaitingForInput(): boolean;
878
- get agentId(): string | undefined;
879
- overrideAgentId(agentId: string): void;
880
- complete(): void;
881
- cancel(): void;
882
- get cancellationToken(): CancellationToken;
883
- waitForInput(): void;
884
- stopWaitingForInput(): void;
885
- error(error: Error): void;
886
- get errorObject(): Error | undefined;
887
- get isError(): boolean;
888
- toSerializable(): SerializableChatResponseData;
889
- }
890
- export declare class ErrorChatResponseModel extends MutableChatResponseModel {
891
- constructor(requestId: string, error: Error, agentId?: string);
892
- }
893
- export declare class ProgressChatResponseContentImpl implements ProgressChatResponseContent {
894
- readonly kind = "progress";
895
- protected _message: string;
896
- constructor(message: string);
897
- get message(): string;
898
- asString(): string;
899
- asDisplayString(): string | undefined;
900
- merge(nextChatResponseContent: ProgressChatResponseContent): boolean;
901
- toLanguageModelMessage(): TextMessage;
902
- toSerializable(): SerializableChatResponseContentData<ProgressContentData>;
903
- }
904
- /**
905
- * Fallback content for unknown content types.
906
- * Used when a deserializer is not available (e.g., content from removed extension).
907
- */
908
- export interface UnknownChatResponseContent extends ChatResponseContent {
909
- kind: 'unknown';
910
- originalKind: string;
911
- fallbackMessage?: string;
912
- data: unknown;
913
- }
914
- export declare class UnknownChatResponseContentImpl implements UnknownChatResponseContent {
915
- readonly originalKind: string;
916
- readonly fallbackMessage: string | undefined;
917
- readonly data: unknown;
918
- readonly kind = "unknown";
919
- constructor(originalKind: string, fallbackMessage: string | undefined, data: unknown);
920
- asString(): string | undefined;
921
- toSerializable(): SerializableChatResponseContentData;
922
- }
923
- //# sourceMappingURL=chat-model.d.ts.map