@theia/ai-chat 1.66.0-next.67 → 1.66.0-next.80

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 (83) hide show
  1. package/lib/browser/agent-delegation-tool.d.ts.map +1 -1
  2. package/lib/browser/agent-delegation-tool.js +4 -2
  3. package/lib/browser/agent-delegation-tool.js.map +1 -1
  4. package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -1
  5. package/lib/browser/ai-chat-frontend-module.js +15 -0
  6. package/lib/browser/ai-chat-frontend-module.js.map +1 -1
  7. package/lib/browser/change-set-file-element-deserializer.d.ts +7 -0
  8. package/lib/browser/change-set-file-element-deserializer.d.ts.map +1 -0
  9. package/lib/browser/change-set-file-element-deserializer.js +61 -0
  10. package/lib/browser/change-set-file-element-deserializer.js.map +1 -0
  11. package/lib/browser/change-set-file-element.d.ts +2 -0
  12. package/lib/browser/change-set-file-element.d.ts.map +1 -1
  13. package/lib/browser/change-set-file-element.js +17 -0
  14. package/lib/browser/change-set-file-element.js.map +1 -1
  15. package/lib/browser/chat-session-store-impl.d.ts +36 -0
  16. package/lib/browser/chat-session-store-impl.d.ts.map +1 -0
  17. package/lib/browser/chat-session-store-impl.js +287 -0
  18. package/lib/browser/chat-session-store-impl.js.map +1 -0
  19. package/lib/common/change-set-element-deserializer.d.ts +30 -0
  20. package/lib/common/change-set-element-deserializer.d.ts.map +1 -0
  21. package/lib/common/change-set-element-deserializer.js +81 -0
  22. package/lib/common/change-set-element-deserializer.js.map +1 -0
  23. package/lib/common/change-set.d.ts +7 -0
  24. package/lib/common/change-set.d.ts.map +1 -1
  25. package/lib/common/change-set.js.map +1 -1
  26. package/lib/common/chat-auto-save.spec.d.ts +2 -0
  27. package/lib/common/chat-auto-save.spec.d.ts.map +1 -0
  28. package/lib/common/chat-auto-save.spec.js +304 -0
  29. package/lib/common/chat-auto-save.spec.js.map +1 -0
  30. package/lib/common/chat-content-deserializer.d.ts +161 -0
  31. package/lib/common/chat-content-deserializer.d.ts.map +1 -0
  32. package/lib/common/chat-content-deserializer.js +166 -0
  33. package/lib/common/chat-content-deserializer.js.map +1 -0
  34. package/lib/common/chat-content-deserializer.spec.d.ts +2 -0
  35. package/lib/common/chat-content-deserializer.spec.d.ts.map +1 -0
  36. package/lib/common/chat-content-deserializer.spec.js +307 -0
  37. package/lib/common/chat-content-deserializer.spec.js.map +1 -0
  38. package/lib/common/chat-model-serialization.d.ts +110 -0
  39. package/lib/common/chat-model-serialization.d.ts.map +1 -0
  40. package/lib/common/chat-model-serialization.js +20 -0
  41. package/lib/common/chat-model-serialization.js.map +1 -0
  42. package/lib/common/chat-model-serialization.spec.d.ts +2 -0
  43. package/lib/common/chat-model-serialization.spec.d.ts.map +1 -0
  44. package/lib/common/chat-model-serialization.spec.js +278 -0
  45. package/lib/common/chat-model-serialization.spec.js.map +1 -0
  46. package/lib/common/chat-model.d.ts +163 -14
  47. package/lib/common/chat-model.d.ts.map +1 -1
  48. package/lib/common/chat-model.js +444 -36
  49. package/lib/common/chat-model.js.map +1 -1
  50. package/lib/common/chat-service-deletion.spec.d.ts +2 -0
  51. package/lib/common/chat-service-deletion.spec.d.ts.map +1 -0
  52. package/lib/common/chat-service-deletion.spec.js +221 -0
  53. package/lib/common/chat-service-deletion.spec.js.map +1 -0
  54. package/lib/common/chat-service.d.ts +30 -2
  55. package/lib/common/chat-service.d.ts.map +1 -1
  56. package/lib/common/chat-service.js +182 -10
  57. package/lib/common/chat-service.js.map +1 -1
  58. package/lib/common/chat-session-store.d.ts +43 -0
  59. package/lib/common/chat-session-store.d.ts.map +1 -0
  60. package/lib/common/chat-session-store.js +20 -0
  61. package/lib/common/chat-session-store.js.map +1 -0
  62. package/lib/common/index.d.ts +3 -0
  63. package/lib/common/index.d.ts.map +1 -1
  64. package/lib/common/index.js +3 -0
  65. package/lib/common/index.js.map +1 -1
  66. package/package.json +9 -9
  67. package/src/browser/agent-delegation-tool.ts +4 -2
  68. package/src/browser/ai-chat-frontend-module.ts +27 -0
  69. package/src/browser/change-set-file-element-deserializer.ts +62 -0
  70. package/src/browser/change-set-file-element.ts +19 -0
  71. package/src/browser/chat-session-store-impl.ts +326 -0
  72. package/src/common/change-set-element-deserializer.ts +90 -0
  73. package/src/common/change-set.ts +8 -0
  74. package/src/common/chat-auto-save.spec.ts +372 -0
  75. package/src/common/chat-content-deserializer.spec.ts +375 -0
  76. package/src/common/chat-content-deserializer.ts +327 -0
  77. package/src/common/chat-model-serialization.spec.ts +343 -0
  78. package/src/common/chat-model-serialization.ts +133 -0
  79. package/src/common/chat-model.ts +644 -41
  80. package/src/common/chat-service-deletion.spec.ts +269 -0
  81. package/src/common/chat-service.ts +227 -10
  82. package/src/common/chat-session-store.ts +63 -0
  83. package/src/common/index.ts +3 -0
@@ -0,0 +1,133 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 EclipseSource GmbH.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ChatAgentLocation } from './chat-agents';
18
+
19
+ export interface SerializableChangeSetElement {
20
+ kind?: string;
21
+ uri: string;
22
+ name?: string;
23
+ icon?: string;
24
+ additionalInfo?: string;
25
+ state?: 'pending' | 'applied' | 'stale';
26
+ type?: 'add' | 'modify' | 'delete';
27
+ data?: { [key: string]: unknown };
28
+ }
29
+
30
+ export interface SerializableChangeSetFileElementData {
31
+ targetState?: string;
32
+ originalState?: string;
33
+ replacements?: Array<{
34
+ oldContent: string;
35
+ newContent: string;
36
+ multiple?: boolean;
37
+ }>;
38
+ }
39
+
40
+ export interface SerializableChatRequestData {
41
+ id: string;
42
+ text: string;
43
+ agentId?: string;
44
+ changeSet?: {
45
+ title: string;
46
+ elements: SerializableChangeSetElement[];
47
+ };
48
+ }
49
+
50
+ export interface SerializableChatResponseContentData<T = unknown> {
51
+ kind: string;
52
+ /**
53
+ * Fallback message used when the deserializer for this content type is not available.
54
+ */
55
+ fallbackMessage?: string;
56
+ data: T; // Content-specific serialization
57
+ }
58
+
59
+ export interface SerializableChatResponseData {
60
+ id: string;
61
+ requestId: string;
62
+ isComplete: boolean;
63
+ isError: boolean;
64
+ errorMessage?: string;
65
+ content: SerializableChatResponseContentData[];
66
+ }
67
+
68
+ /**
69
+ * Serialized representation of an item in a hierarchy branch.
70
+ * Each item represents a request and optionally links to the next branch.
71
+ */
72
+ export interface SerializableHierarchyBranchItem {
73
+ requestId: string;
74
+ nextBranchId?: string;
75
+ }
76
+
77
+ /**
78
+ * Serialized representation of a branch in the chat request hierarchy.
79
+ * A branch contains alternative requests (created by editing messages).
80
+ */
81
+ export interface SerializableHierarchyBranch {
82
+ /** Unique identifier for this branch */
83
+ id: string;
84
+ /** All items (alternative requests) in this branch */
85
+ items: SerializableHierarchyBranchItem[];
86
+ /** Index of the currently active item in this branch */
87
+ activeBranchIndex: number;
88
+ }
89
+
90
+ /**
91
+ * Serialized representation of the complete chat request hierarchy.
92
+ * The hierarchy is stored as a flat map of branches.
93
+ */
94
+ export interface SerializableHierarchy {
95
+ /** ID of the root branch where the hierarchy starts */
96
+ rootBranchId: string;
97
+ /** Map of branch ID to branch data for all branches in the hierarchy */
98
+ branches: { [branchId: string]: SerializableHierarchyBranch };
99
+ }
100
+
101
+ /**
102
+ * Serialized representation of ChatModel.
103
+ */
104
+ export interface SerializedChatModel {
105
+ sessionId: string;
106
+ location: ChatAgentLocation;
107
+ /**
108
+ * The complete hierarchy of requests including all alternatives (branches).
109
+ */
110
+ hierarchy: SerializableHierarchy;
111
+ /** All requests referenced by the hierarchy */
112
+ requests: SerializableChatRequestData[];
113
+ /** All responses for the requests */
114
+ responses: SerializableChatResponseData[];
115
+ }
116
+
117
+ /**
118
+ * Wrapper for persisted chat model data.
119
+ * Includes metadata (version, pinned agent, title) along with the chat model.
120
+ */
121
+ export interface SerializedChatData {
122
+ version: number;
123
+ pinnedAgentId?: string;
124
+ title?: string;
125
+ model: SerializedChatModel;
126
+ saveDate: number;
127
+ }
128
+
129
+ export interface SerializableChatsData {
130
+ [sessionId: string]: SerializedChatData;
131
+ }
132
+
133
+ export const CHAT_DATA_VERSION = 1;