@contractspec/module.ai-chat 1.56.1 → 1.57.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/dist/ai-chat.feature.d.ts +2 -3
- package/dist/ai-chat.feature.d.ts.map +1 -1
- package/dist/ai-chat.operations.d.ts +66 -66
- package/dist/ai-chat.operations.d.ts.map +1 -1
- package/dist/context/context-builder.d.ts +0 -1
- package/dist/context/context-builder.d.ts.map +1 -1
- package/dist/context/file-operations.d.ts.map +1 -1
- package/dist/context/workspace-context.d.ts.map +1 -1
- package/dist/core/chat-service.d.ts +0 -1
- package/dist/core/chat-service.d.ts.map +1 -1
- package/dist/core/conversation-store.d.ts +0 -1
- package/dist/core/conversation-store.d.ts.map +1 -1
- package/dist/core/message-types.d.ts.map +1 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/presentation/components/ChatContainer.d.ts.map +1 -1
- package/dist/presentation/components/ChatInput.d.ts +2 -2
- package/dist/presentation/components/ChatInput.d.ts.map +1 -1
- package/dist/presentation/components/ChatInput.js +2 -2
- package/dist/presentation/components/ChatInput.js.map +1 -1
- package/dist/presentation/components/ChatMessage.d.ts +2 -2
- package/dist/presentation/components/ChatMessage.d.ts.map +1 -1
- package/dist/presentation/components/CodePreview.d.ts.map +1 -1
- package/dist/presentation/components/ContextIndicator.d.ts +2 -2
- package/dist/presentation/components/ContextIndicator.d.ts.map +1 -1
- package/dist/presentation/components/ModelPicker.d.ts +2 -2
- package/dist/presentation/components/ModelPicker.d.ts.map +1 -1
- package/dist/presentation/hooks/useChat.d.ts +0 -1
- package/dist/presentation/hooks/useChat.d.ts.map +1 -1
- package/dist/presentation/hooks/useChat.js +3 -3
- package/dist/presentation/hooks/useChat.js.map +1 -1
- package/dist/presentation/hooks/useProviders.d.ts +0 -1
- package/dist/presentation/hooks/useProviders.d.ts.map +1 -1
- package/dist/providers/chat-utilities.d.ts +0 -1
- package/dist/providers/chat-utilities.d.ts.map +1 -1
- package/dist/schema.d.ts +55 -55
- package/dist/schema.d.ts.map +1 -1
- package/package.json +15 -15
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
|
|
2
2
|
|
|
3
3
|
//#region src/ai-chat.feature.d.ts
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* AI Chat feature module that bundles conversational AI assistance
|
|
7
6
|
* for ContractSpec development across CLI, VSCode, and Studio.
|
|
8
7
|
*/
|
|
9
|
-
declare const AiChatFeature:
|
|
8
|
+
declare const AiChatFeature: _contractspec_lib_contracts0.FeatureModuleSpec;
|
|
10
9
|
//#endregion
|
|
11
10
|
export { AiChatFeature };
|
|
12
11
|
//# sourceMappingURL=ai-chat.feature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-chat.feature.d.ts","names":[],"sources":["../src/ai-chat.feature.ts"],"
|
|
1
|
+
{"version":3,"file":"ai-chat.feature.d.ts","names":[],"sources":["../src/ai-chat.feature.ts"],"mappings":";;;;;;AAWA;cAAa,aAAA,EA8CX,4BAAA,CA9CwB,iBAAA"}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
|
|
2
|
+
import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
|
|
3
3
|
|
|
4
4
|
//#region src/ai-chat.operations.d.ts
|
|
5
|
-
declare const SendMessageContract:
|
|
5
|
+
declare const SendMessageContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
|
|
6
6
|
conversationId: {
|
|
7
|
-
type:
|
|
7
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
8
8
|
isOptional: true;
|
|
9
9
|
};
|
|
10
10
|
content: {
|
|
11
|
-
type:
|
|
11
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
12
12
|
isOptional: false;
|
|
13
13
|
};
|
|
14
14
|
stream: {
|
|
15
|
-
type:
|
|
15
|
+
type: _contractspec_lib_schema0.FieldType<boolean, boolean>;
|
|
16
16
|
isOptional: true;
|
|
17
17
|
};
|
|
18
|
-
}>,
|
|
18
|
+
}>, _contractspec_lib_schema0.SchemaModel<{
|
|
19
19
|
message: {
|
|
20
|
-
type:
|
|
20
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
21
21
|
id: {
|
|
22
|
-
type:
|
|
22
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
23
23
|
isOptional: false;
|
|
24
24
|
};
|
|
25
25
|
role: {
|
|
26
|
-
type:
|
|
26
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
27
27
|
isOptional: false;
|
|
28
28
|
};
|
|
29
29
|
content: {
|
|
30
|
-
type:
|
|
30
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
31
31
|
isOptional: false;
|
|
32
32
|
};
|
|
33
33
|
status: {
|
|
34
|
-
type:
|
|
34
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
35
35
|
isOptional: false;
|
|
36
36
|
};
|
|
37
37
|
createdAt: {
|
|
38
|
-
type:
|
|
38
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
39
39
|
isOptional: false;
|
|
40
40
|
};
|
|
41
41
|
}>;
|
|
42
42
|
isOptional: false;
|
|
43
43
|
};
|
|
44
44
|
conversation: {
|
|
45
|
-
type:
|
|
45
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
46
46
|
id: {
|
|
47
|
-
type:
|
|
47
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
48
48
|
isOptional: false;
|
|
49
49
|
};
|
|
50
50
|
title: {
|
|
51
|
-
type:
|
|
51
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
52
52
|
isOptional: true;
|
|
53
53
|
};
|
|
54
54
|
status: {
|
|
55
|
-
type:
|
|
55
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
56
56
|
isOptional: false;
|
|
57
57
|
};
|
|
58
58
|
messages: {
|
|
59
|
-
type:
|
|
59
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
60
60
|
id: {
|
|
61
|
-
type:
|
|
61
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
62
62
|
isOptional: false;
|
|
63
63
|
};
|
|
64
64
|
role: {
|
|
65
|
-
type:
|
|
65
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
66
66
|
isOptional: false;
|
|
67
67
|
};
|
|
68
68
|
content: {
|
|
69
|
-
type:
|
|
69
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
70
70
|
isOptional: false;
|
|
71
71
|
};
|
|
72
72
|
status: {
|
|
73
|
-
type:
|
|
73
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
74
74
|
isOptional: false;
|
|
75
75
|
};
|
|
76
76
|
createdAt: {
|
|
77
|
-
type:
|
|
77
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
78
78
|
isOptional: false;
|
|
79
79
|
};
|
|
80
80
|
}>;
|
|
@@ -82,71 +82,71 @@ declare const SendMessageContract: _contractspec_lib_contracts5.OperationSpec<_c
|
|
|
82
82
|
isOptional: false;
|
|
83
83
|
};
|
|
84
84
|
provider: {
|
|
85
|
-
type:
|
|
85
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
86
86
|
isOptional: false;
|
|
87
87
|
};
|
|
88
88
|
model: {
|
|
89
|
-
type:
|
|
89
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
90
90
|
isOptional: false;
|
|
91
91
|
};
|
|
92
92
|
}>;
|
|
93
93
|
isOptional: false;
|
|
94
94
|
};
|
|
95
95
|
}>, undefined>;
|
|
96
|
-
declare const StreamMessageContract:
|
|
96
|
+
declare const StreamMessageContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
|
|
97
97
|
conversationId: {
|
|
98
|
-
type:
|
|
98
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
99
99
|
isOptional: true;
|
|
100
100
|
};
|
|
101
101
|
content: {
|
|
102
|
-
type:
|
|
102
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
103
103
|
isOptional: false;
|
|
104
104
|
};
|
|
105
105
|
stream: {
|
|
106
|
-
type:
|
|
106
|
+
type: _contractspec_lib_schema0.FieldType<boolean, boolean>;
|
|
107
107
|
isOptional: true;
|
|
108
108
|
};
|
|
109
|
-
}>,
|
|
109
|
+
}>, _contractspec_lib_schema0.SchemaModel<{
|
|
110
110
|
stream: {
|
|
111
|
-
type:
|
|
111
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
112
112
|
isOptional: false;
|
|
113
113
|
};
|
|
114
114
|
}>, undefined>;
|
|
115
|
-
declare const ListConversationsContract:
|
|
115
|
+
declare const ListConversationsContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{}>, _contractspec_lib_schema0.SchemaModel<{
|
|
116
116
|
conversations: {
|
|
117
|
-
type:
|
|
117
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
118
118
|
id: {
|
|
119
|
-
type:
|
|
119
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
120
120
|
isOptional: false;
|
|
121
121
|
};
|
|
122
122
|
title: {
|
|
123
|
-
type:
|
|
123
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
124
124
|
isOptional: true;
|
|
125
125
|
};
|
|
126
126
|
status: {
|
|
127
|
-
type:
|
|
127
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
128
128
|
isOptional: false;
|
|
129
129
|
};
|
|
130
130
|
messages: {
|
|
131
|
-
type:
|
|
131
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
132
132
|
id: {
|
|
133
|
-
type:
|
|
133
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
134
134
|
isOptional: false;
|
|
135
135
|
};
|
|
136
136
|
role: {
|
|
137
|
-
type:
|
|
137
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
138
138
|
isOptional: false;
|
|
139
139
|
};
|
|
140
140
|
content: {
|
|
141
|
-
type:
|
|
141
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
142
142
|
isOptional: false;
|
|
143
143
|
};
|
|
144
144
|
status: {
|
|
145
|
-
type:
|
|
145
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
146
146
|
isOptional: false;
|
|
147
147
|
};
|
|
148
148
|
createdAt: {
|
|
149
|
-
type:
|
|
149
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
150
150
|
isOptional: false;
|
|
151
151
|
};
|
|
152
152
|
}>;
|
|
@@ -154,11 +154,11 @@ declare const ListConversationsContract: _contractspec_lib_contracts5.OperationS
|
|
|
154
154
|
isOptional: false;
|
|
155
155
|
};
|
|
156
156
|
provider: {
|
|
157
|
-
type:
|
|
157
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
158
158
|
isOptional: false;
|
|
159
159
|
};
|
|
160
160
|
model: {
|
|
161
|
-
type:
|
|
161
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
162
162
|
isOptional: false;
|
|
163
163
|
};
|
|
164
164
|
}>;
|
|
@@ -166,44 +166,44 @@ declare const ListConversationsContract: _contractspec_lib_contracts5.OperationS
|
|
|
166
166
|
isOptional: false;
|
|
167
167
|
};
|
|
168
168
|
}>, undefined>;
|
|
169
|
-
declare const GetConversationContract:
|
|
169
|
+
declare const GetConversationContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
|
|
170
170
|
id: {
|
|
171
|
-
type:
|
|
171
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
172
172
|
isOptional: false;
|
|
173
173
|
};
|
|
174
|
-
}>,
|
|
174
|
+
}>, _contractspec_lib_schema0.SchemaModel<{
|
|
175
175
|
id: {
|
|
176
|
-
type:
|
|
176
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
177
177
|
isOptional: false;
|
|
178
178
|
};
|
|
179
179
|
title: {
|
|
180
|
-
type:
|
|
180
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
181
181
|
isOptional: true;
|
|
182
182
|
};
|
|
183
183
|
status: {
|
|
184
|
-
type:
|
|
184
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
185
185
|
isOptional: false;
|
|
186
186
|
};
|
|
187
187
|
messages: {
|
|
188
|
-
type:
|
|
188
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
189
189
|
id: {
|
|
190
|
-
type:
|
|
190
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
191
191
|
isOptional: false;
|
|
192
192
|
};
|
|
193
193
|
role: {
|
|
194
|
-
type:
|
|
194
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
195
195
|
isOptional: false;
|
|
196
196
|
};
|
|
197
197
|
content: {
|
|
198
|
-
type:
|
|
198
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
199
199
|
isOptional: false;
|
|
200
200
|
};
|
|
201
201
|
status: {
|
|
202
|
-
type:
|
|
202
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
203
203
|
isOptional: false;
|
|
204
204
|
};
|
|
205
205
|
createdAt: {
|
|
206
|
-
type:
|
|
206
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
207
207
|
isOptional: false;
|
|
208
208
|
};
|
|
209
209
|
}>;
|
|
@@ -211,33 +211,33 @@ declare const GetConversationContract: _contractspec_lib_contracts5.OperationSpe
|
|
|
211
211
|
isOptional: false;
|
|
212
212
|
};
|
|
213
213
|
provider: {
|
|
214
|
-
type:
|
|
214
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
215
215
|
isOptional: false;
|
|
216
216
|
};
|
|
217
217
|
model: {
|
|
218
|
-
type:
|
|
218
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
219
219
|
isOptional: false;
|
|
220
220
|
};
|
|
221
221
|
}>, undefined>;
|
|
222
|
-
declare const DeleteConversationContract:
|
|
222
|
+
declare const DeleteConversationContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
|
|
223
223
|
id: {
|
|
224
|
-
type:
|
|
224
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
225
225
|
isOptional: false;
|
|
226
226
|
};
|
|
227
|
-
}>,
|
|
228
|
-
declare const ListProvidersContract:
|
|
227
|
+
}>, _contractspec_lib_schema0.SchemaModel<{}>, undefined>;
|
|
228
|
+
declare const ListProvidersContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{}>, _contractspec_lib_schema0.SchemaModel<{
|
|
229
229
|
providers: {
|
|
230
|
-
type:
|
|
230
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
231
231
|
isArray: true;
|
|
232
232
|
isOptional: false;
|
|
233
233
|
};
|
|
234
234
|
}>, undefined>;
|
|
235
|
-
declare const ScanContextContract:
|
|
235
|
+
declare const ScanContextContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
|
|
236
236
|
path: {
|
|
237
|
-
type:
|
|
237
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
238
238
|
isOptional: false;
|
|
239
239
|
};
|
|
240
|
-
}>,
|
|
240
|
+
}>, _contractspec_lib_schema0.SchemaModel<{}>, undefined>;
|
|
241
241
|
//#endregion
|
|
242
242
|
export { DeleteConversationContract, GetConversationContract, ListConversationsContract, ListProvidersContract, ScanContextContract, SendMessageContract, StreamMessageContract };
|
|
243
243
|
//# sourceMappingURL=ai-chat.operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-chat.operations.d.ts","names":[],"sources":["../src/ai-chat.operations.ts"],"
|
|
1
|
+
{"version":3,"file":"ai-chat.operations.d.ts","names":[],"sources":["../src/ai-chat.operations.ts"],"mappings":";;;;cASa,mBAAA,+BAAmB,aAAA,2BAAA,WAAA;;UAa9B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;cAb8B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsBnB,qBAAA,+BAAqB,aAAA,2BAAA,WAAA;;UAahC,yBAAA,CAAA,SAAA;;;;;;;;;;;;;UAbgC,yBAAA,CAAA,SAAA;;;;cAerB,yBAAA,EAAyB,4BAAA,CAAA,aAAA,CAgBpC,yBAAA,CAhBoC,WAAA,gCAAA,WAAA;;;;cAAA,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBzB,uBAAA,+BAAuB,aAAA,2BAAA,WAAA;;UAqBlC,yBAAA,CAAA,SAAA;;;;;UArBkC,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuBvB,0BAAA,+BAA0B,aAAA,2BAAA,WAAA;;UAqBrC,yBAAA,CAAA,SAAA;;;IArBqC,yBAAA,CAAA,WAAA;AAAA,cAuB1B,qBAAA,EAAqB,4BAAA,CAAA,aAAA,CAyBhC,yBAAA,CAzBgC,WAAA,gCAAA,WAAA;;UAAA,yBAAA,CAAA,SAAA;;;;;cA2BrB,mBAAA,+BAAmB,aAAA,2BAAA,WAAA;;UAqB9B,yBAAA,CAAA,SAAA;;;IArB8B,yBAAA,CAAA,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-builder.d.ts","names":[],"sources":["../../src/context/context-builder.ts"],"
|
|
1
|
+
{"version":3,"file":"context-builder.d.ts","names":[],"sources":["../../src/context/context-builder.ts"],"mappings":";;;;;;UAUiB,YAAA;EACf,IAAA;EACA,IAAA;EACA,OAAA;EACA,OAAA;EACA,SAAA;AAAA;;;;UAMe,YAAA;EACf,OAAA,EAAS,YAAA;EACT,OAAA;EACA,mBAAA;AAAA;AAMF;;;AAAA,UAAiB,qBAAA;EAEf;EAAA,SAAA;EAIA;EAFA,KAAA;EAIY;EAFZ,YAAA;EAsEW;EApEX,YAAA;AAAA;;;;cAoEW,cAAA;EAAA,iBACM,OAAA;cAEL,OAAA,EAAS,gBAAA;;;;EAOrB,KAAA,CAAM,OAAA,GAAS,qBAAA,GAA6B,YAAA;EAA7B;;;EAAA,QAkGP,YAAA;AAAA;;AAsCV;;iBAAgB,oBAAA,CACd,OAAA,EAAS,gBAAA,GACR,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-operations.d.ts","names":[],"sources":["../../src/context/file-operations.ts"],"
|
|
1
|
+
{"version":3,"file":"file-operations.d.ts","names":[],"sources":["../../src/context/file-operations.ts"],"mappings":";;AASA;;;;;;;UAAiB,cAAA;EACf,OAAA;EACA,IAAA;EACA,OAAA;EACA,KAAA;AAAA;;;;UAMe,eAAA;EACf,OAAA;EACA,IAAA;EACA,KAAA;AAAA;;;;UAMe,aAAA;EACf,IAAA;EACA,IAAA;EACA,OAAA;AAAA;;;;UAMe,mBAAA;EACf,SAAA,EAAW,aAAA;EACX,OAAA;EACA,OAAA;EACA,KAAA;AAAA;;AAMF;;UAAiB,UAAA;EAIS;;;EAAxB,QAAA,CAAS,IAAA,WAAe,OAAA;EAuBrB;;;EAlBH,SAAA,CAAU,IAAA,UAAc,OAAA,WAAkB,OAAA;EALjC;;;EAUT,MAAA,CAAO,IAAA,WAAe,OAAA;EALE;;;EAUxB,UAAA,CAAW,IAAA,WAAe,OAAA;EALJ;;;EAUtB,SAAA,CACE,SAAA,UACA,OAAA;IAAY,SAAA;IAAqB,OAAA;EAAA,IAChC,OAAA;AAAA;;;;cAMQ,cAAA;EAAA,iBAEQ,EAAA;EAAA,iBACA,aAAA;EAAA,iBACA,WAAA;cAFA,EAAA,EAAI,UAAA,EACJ,aAAA,UACA,WAAA;EAMuB;;;EAApC,IAAA,CAAK,YAAA,WAAuB,OAAA,CAAQ,cAAA;EA4ChB;;;EA1BpB,KAAA,CAAM,YAAA,UAAsB,OAAA,WAAkB,OAAA,CAAQ,eAAA;EA0BT;;;EAA7C,OAAA,CAAQ,UAAA,EAAY,aAAA,KAAkB,OAAA,CAAQ,mBAAA;;;;UA+E5C,WAAA;AAAA;;;;iBAUM,wBAAA,CACd,aAAA,UACA,WAAA,aACC,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-context.d.ts","names":[],"sources":["../../src/context/workspace-context.ts"],"
|
|
1
|
+
{"version":3,"file":"workspace-context.d.ts","names":[],"sources":["../../src/context/workspace-context.ts"],"mappings":";;AAUA;;;;;;;;UAAiB,QAAA;EACf,IAAA;EACA,OAAA;EACA,IAAA;EACA,IAAA;EACA,WAAA;EACA,IAAA;AAAA;;;;UAMe,QAAA;EACf,IAAA;EACA,YAAA;EACA,IAAA;EACA,SAAA;EACA,IAAA;EACA,MAAA;AAAA;;;;UAMe,gBAAA;EACf,IAAA;EACA,IAAA;EACA,KAAA;IACE,KAAA;IACA,QAAA;IACA,OAAA;IACA,MAAA;IACA,aAAA;EAAA;EAEF,KAAA;IACE,KAAA;IACA,UAAA;IACA,SAAA;EAAA;AAAA;;;;UAOa,sBAAA;EAUf;EARA,aAAA;EAQW;EANX,eAAA;EAY2B;EAV3B,eAAA;EAkBoB;EAhBpB,WAAA;EAmCY;EAjCZ,WAAA;AAAA;;;;cAMW,gBAAA;EAAA,SACF,aAAA;EAAA,SACA,WAAA;EAAA,QAED,KAAA;EAAA,QACA,KAAA;EAAA,QACA,WAAA;cAEI,MAAA,EAAQ,sBAAA;EAFZ;;;EAUF,UAAA,CAAA,GAAc,OAAA;EAAd;;;EAWN,QAAA,CAAA,GAAY,QAAA;EAOZ;;;EAAA,QAAA,CAAA,GAAY,QAAA;EAOH;;;EAAT,QAAA,CAAS,KAAA,EAAO,QAAA;EAchB;;;EAPA,QAAA,CAAS,KAAA,EAAO,QAAA;EAqEN;;;EA9DV,UAAA,CAAA,GAAc,gBAAA;EA2EY;;;EA3C1B,iBAAA,CAAA;EAwD0C;;;EA1B1C,SAAA,CAAU,KAAA,WAAgB,QAAA;EA6BjB;;;EAhBT,SAAA,CAAU,KAAA,WAAgB,QAAA;AAAA;;;;iBAaN,sBAAA,CACpB,IAAA,UACA,OAAA,GAAU,OAAA,CAAQ,sBAAA,IACjB,OAAA,CAAQ,gBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-service.d.ts","names":[],"sources":["../../src/core/chat-service.ts"],"
|
|
1
|
+
{"version":3,"file":"chat-service.d.ts","names":[],"sources":["../../src/core/chat-service.ts"],"mappings":";;;;;;;;AAmBA;UAAiB,iBAAA;;EAEf,QAAA,EAAU,QAAA;EAEA;EAAV,OAAA,GAAU,gBAAA;EAEe;EAAzB,KAAA,GAAQ,iBAAA;EAJR;EAMA,YAAA;EAJA;EAMA,kBAAA;EAJA;EAMA,OAAA,IAAW,KAAA;IAAS,WAAA;IAAqB,YAAA;EAAA;AAAA;;;;cAwB9B,WAAA;EAAA,iBACM,QAAA;EAAA,iBACA,OAAA;EAAA,iBACA,KAAA;EAAA,iBACA,YAAA;EAAA,iBACA,kBAAA;EAAA,iBACA,OAAA;cAKL,MAAA,EAAQ,iBAAA;EAyFE;;;EA7EhB,IAAA,CAAK,OAAA,EAAS,kBAAA,GAAqB,OAAA,CAAQ,iBAAA;EAkL9C;;;EArGG,MAAA,CAAO,OAAA,EAAS,kBAAA,GAAqB,OAAA,CAAQ,mBAAA;EAyHM;;;EAtBnD,eAAA,CACJ,cAAA,WACC,OAAA,CAAQ,gBAAA;EAtMM;;;EA6MX,iBAAA,CAAkB,OAAA;IACtB,KAAA;IACA,MAAA;EAAA,IACE,OAAA,CAAQ,gBAAA;EA5LN;;;EAsMA,kBAAA,CAAmB,cAAA,WAAyB,OAAA;EAtMD;;;EAAA,QA6MzC,WAAA;AAAA;;;;iBA0CM,iBAAA,CAAkB,MAAA,EAAQ,iBAAA,GAAoB,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-store.d.ts","names":[],"sources":["../../src/core/conversation-store.ts"],"
|
|
1
|
+
{"version":3,"file":"conversation-store.d.ts","names":[],"sources":["../../src/core/conversation-store.ts"],"mappings":";;;;;;UAYiB,iBAAA;EAUM;;;EANrB,GAAA,CAAI,cAAA,WAAyB,OAAA,CAAQ,gBAAA;EAe5B;;;EAVT,MAAA,CACE,YAAA,EAAc,IAAA,CAAK,gBAAA,sCAClB,OAAA,CAAQ,gBAAA;EAUR;;;EALH,MAAA,CACE,cAAA,UACA,OAAA,EAAS,OAAA,CACP,IAAA,CAAK,gBAAA,kDAEN,OAAA,CAAQ,gBAAA;EAWR;;;EANH,aAAA,CACE,cAAA,UACA,OAAA,EAAS,IAAA,CACP,WAAA,yDAGD,OAAA,CAAQ,WAAA;EASR;;;EAJH,aAAA,CACE,cAAA,UACA,SAAA,UACA,OAAA,EAAS,OAAA,CAAQ,WAAA,IAChB,OAAA,CAAQ,WAAA;EAcP;;;EATJ,MAAA,CAAO,cAAA,WAAyB,OAAA;EAcc;;;EAT9C,IAAA,CAAK,OAAA;IACH,MAAA,GAAS,kBAAA;IACT,KAAA;IACA,MAAA;EAAA,IACE,OAAA,CAAQ,gBAAA;EA7CV;;;EAkDF,MAAA,CAAO,KAAA,UAAe,KAAA,YAAiB,OAAA,CAAQ,gBAAA;AAAA;;;;cAapC,yBAAA,YAAqC,iBAAA;EAAA,iBAC/B,aAAA;EAEX,GAAA,CAAI,cAAA,WAAyB,OAAA,CAAQ,gBAAA;EAIrC,MAAA,CACJ,YAAA,EAAc,IAAA,CAAK,gBAAA,sCAClB,OAAA,CAAQ,gBAAA;EAYL,MAAA,CACJ,cAAA,UACA,OAAA,EAAS,OAAA,CACP,IAAA,CAAK,gBAAA,kDAEN,OAAA,CAAQ,gBAAA;EAaL,aAAA,CACJ,cAAA,UACA,OAAA,EAAS,IAAA,CACP,WAAA,yDAGD,OAAA,CAAQ,WAAA;EAoBL,aAAA,CACJ,cAAA,UACA,SAAA,UACA,OAAA,EAAS,OAAA,CAAQ,WAAA,IAChB,OAAA,CAAQ,WAAA;EAsBL,MAAA,CAAO,cAAA,WAAyB,OAAA;EAIhC,IAAA,CAAK,OAAA;IACT,MAAA,GAAS,kBAAA;IACT,KAAA;IACA,MAAA;EAAA,IACE,OAAA,CAAQ,gBAAA;EAeN,MAAA,CAAO,KAAA,UAAe,KAAA,YAAa,OAAA,CAAQ,gBAAA;EAnJ9B;;;EA+KnB,KAAA,CAAA;AAAA;;;;iBAQc,+BAAA,CAAA,GAAmC,iBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-types.d.ts","names":[],"sources":["../../src/core/message-types.ts"],"
|
|
1
|
+
{"version":3,"file":"message-types.d.ts","names":[],"sources":["../../src/core/message-types.ts"],"mappings":";;AAOA;;;;;KAAY,QAAA;;;;KAKA,aAAA;AAKZ;;;AAAA,UAAiB,cAAA;EACf,EAAA;EACA,IAAA;EACA,IAAA;EACA,OAAA;EACA,QAAA;EACA,IAAA;EACA,IAAA;AAAA;;AAMF;;UAAiB,aAAA;EACf,EAAA;EACA,QAAA;EACA,IAAA;EACA,QAAA;EACA,SAAA;EACA,OAAA;AAAA;;;AAMF;UAAiB,YAAA;EACf,EAAA;EACA,IAAA;EACA,IAAA,EAAM,MAAA;EACN,MAAA;EACA,MAAA;EACA,KAAA;AAAA;;;;UAMe,UAAA;EACf,EAAA;EACA,KAAA;EACA,GAAA;EACA,OAAA;EACA,IAAA;AAAA;;;;UAMe,WAAA;EACf,EAAA;EACA,cAAA;EACA,IAAA,EAAM,QAAA;EACN,OAAA;EACA,MAAA,EAAQ,aAAA;EACR,SAAA,EAAW,IAAA;EACX,SAAA,EAAW,IAAA;EAGX,WAAA,GAAc,cAAA;EACd,UAAA,GAAa,aAAA;EACb,SAAA,GAAY,YAAA;EACZ,OAAA,GAAU,UAAA;EAGV,SAAA;EAGA,KAAA;IACE,WAAA;IACA,YAAA;EAAA;EAIF,KAAA;IACE,IAAA;IACA,OAAA;EAAA;EAIF,QAAA,GAAW,MAAA;AAAA;;;;KAMD,kBAAA;;;;UAKK,gBAAA;EACf,EAAA;EACA,KAAA;EACA,MAAA,EAAQ,kBAAA;EACR,SAAA,EAAW,IAAA;EACX,SAAA,EAAW,IAAA;EAGX,QAAA;EACA,KAAA;EAGA,aAAA;EACA,YAAA;EAGA,QAAA,EAAU,WAAA;EAGV,OAAA;EAGA,QAAA,GAAW,MAAA;AAAA;;;AA3Bb;UAiCiB,kBAAA;EACf,cAAA;EACA,OAAA;EACA,WAAA,GAAc,cAAA;EACd,YAAA;EACA,SAAA;EACA,WAAA;EACA,MAAA;AAAA;;;;UAMe,eAAA;EACf,IAAA;EACA,OAAA;EACA,QAAA,GAAW,YAAA;EACX,MAAA,GAAS,UAAA;EACT,KAAA;IAAU,IAAA;IAAc,OAAA;EAAA;EACxB,KAAA;IAAU,WAAA;IAAqB,YAAA;EAAA;AAAA;;;;UAMhB,iBAAA;EACf,OAAA,EAAS,WAAA;EACT,YAAA,EAAc,gBAAA;AAAA;AA3BhB;;;AAAA,UAiCiB,mBAAA;EACf,cAAA;EACA,SAAA;EACA,MAAA,EAAQ,aAAA,CAAc,eAAA;AAAA"}
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"
|
|
1
|
+
{"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"mappings":";;;;cAIa,gBAAA,EAAgB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAU3B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;cAEW,oBAAA,EAAoB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAU/B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;cAEW,wBAAA,EAAwB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAUnC,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,wBAAA,EAAwB,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAenC,yBAAA,CAAA,SAAA;;;;cAEW,cAAA,EAAc,4BAAA,CAAA,SAAA,2BAAA,WAAA;;UAgBzB,yBAAA,CAAA,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatContainer.d.ts","names":[],"sources":["../../../src/presentation/components/ChatContainer.tsx"],"
|
|
1
|
+
{"version":3,"file":"ChatContainer.d.ts","names":[],"sources":["../../../src/presentation/components/ChatContainer.tsx"],"mappings":";;;;UAMiB,kBAAA;EACf,QAAA,EAAU,KAAA,CAAM,SAAA;EAChB,SAAA;EAFe;EAIf,gBAAA;AAAA;;;;iBAMc,aAAA,CAAA;EACd,QAAA;EACA,SAAA;EACA;AAAA,GACC,kBAAA,GAAkB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChatAttachment } from "../../core/message-types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/presentation/components/ChatInput.d.ts
|
|
5
5
|
interface ChatInputProps {
|
|
@@ -29,7 +29,7 @@ declare function ChatInput({
|
|
|
29
29
|
className,
|
|
30
30
|
showAttachments,
|
|
31
31
|
maxAttachments
|
|
32
|
-
}: ChatInputProps):
|
|
32
|
+
}: ChatInputProps): react_jsx_runtime0.JSX.Element;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { ChatInput };
|
|
35
35
|
//# sourceMappingURL=ChatInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatInput.d.ts","names":[],"sources":["../../../src/presentation/components/ChatInput.tsx"],"
|
|
1
|
+
{"version":3,"file":"ChatInput.d.ts","names":[],"sources":["../../../src/presentation/components/ChatInput.tsx"],"mappings":";;;;UASiB,cAAA;;EAEf,MAAA,GAAS,OAAA,UAAiB,WAAA,GAAc,cAAA;EAFzB;EAIf,QAAA;;EAEA,SAAA;EAJA;EAMA,WAAA;EANwC;EAQxC,SAAA;EANA;EAQA,eAAA;EAJA;EAMA,cAAA;AAAA;;;;iBAMc,SAAA,CAAA;EACd,MAAA;EACA,QAAA;EACA,SAAA;EACA,WAAA;EACA,SAAA;EACA,eAAA;EACA;AAAA,GACC,cAAA,GAAc,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -43,7 +43,7 @@ function ChatInput({ onSend, disabled = false, isLoading = false, placeholder =
|
|
|
43
43
|
const newAttachments = [];
|
|
44
44
|
for (const file of Array.from(files)) {
|
|
45
45
|
if (attachments.length + newAttachments.length >= maxAttachments) break;
|
|
46
|
-
const content
|
|
46
|
+
const content = await file.text();
|
|
47
47
|
const extension = file.name.split(".").pop()?.toLowerCase() ?? "";
|
|
48
48
|
const isCode = [
|
|
49
49
|
"ts",
|
|
@@ -59,7 +59,7 @@ function ChatInput({ onSend, disabled = false, isLoading = false, placeholder =
|
|
|
59
59
|
id: `att_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
|
|
60
60
|
type: isCode ? "code" : "file",
|
|
61
61
|
name: file.name,
|
|
62
|
-
content
|
|
62
|
+
content,
|
|
63
63
|
mimeType: file.type,
|
|
64
64
|
size: file.size
|
|
65
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatInput.js","names":[
|
|
1
|
+
{"version":3,"file":"ChatInput.js","names":[],"sources":["../../../src/presentation/components/ChatInput.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '@contractspec/lib.ui-kit-web/ui/utils';\nimport { Textarea } from '@contractspec/lib.design-system';\nimport { Button } from '@contractspec/lib.design-system';\nimport { Send, Paperclip, X, Loader2, FileText, Code } from 'lucide-react';\nimport type { ChatAttachment } from '../../core/message-types';\n\nexport interface ChatInputProps {\n /** Called when a message is sent */\n onSend: (content: string, attachments?: ChatAttachment[]) => void;\n /** Whether input is disabled (e.g., during streaming) */\n disabled?: boolean;\n /** Whether currently loading/streaming */\n isLoading?: boolean;\n /** Placeholder text */\n placeholder?: string;\n /** Additional class name */\n className?: string;\n /** Show attachment button */\n showAttachments?: boolean;\n /** Max attachments allowed */\n maxAttachments?: number;\n}\n\n/**\n * Chat input component with attachment support\n */\nexport function ChatInput({\n onSend,\n disabled = false,\n isLoading = false,\n placeholder = 'Type a message...',\n className,\n showAttachments = true,\n maxAttachments = 5,\n}: ChatInputProps) {\n const [content, setContent] = React.useState('');\n const [attachments, setAttachments] = React.useState<ChatAttachment[]>([]);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const fileInputRef = React.useRef<HTMLInputElement>(null);\n\n const canSend = content.trim().length > 0 || attachments.length > 0;\n\n const handleSubmit = React.useCallback(\n (e?: React.FormEvent) => {\n e?.preventDefault();\n if (!canSend || disabled || isLoading) return;\n\n onSend(content.trim(), attachments.length > 0 ? attachments : undefined);\n setContent('');\n setAttachments([]);\n\n // Focus back on textarea\n textareaRef.current?.focus();\n },\n [canSend, content, attachments, disabled, isLoading, onSend]\n );\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n // Submit on Enter (without Shift)\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n handleSubmit();\n }\n },\n [handleSubmit]\n );\n\n const handleFileSelect = React.useCallback(\n async (e: React.ChangeEvent<HTMLInputElement>) => {\n const files = e.target.files;\n if (!files) return;\n\n const newAttachments: ChatAttachment[] = [];\n\n for (const file of Array.from(files)) {\n if (attachments.length + newAttachments.length >= maxAttachments) break;\n\n const content = await file.text();\n const extension = file.name.split('.').pop()?.toLowerCase() ?? '';\n const isCode = [\n 'ts',\n 'tsx',\n 'js',\n 'jsx',\n 'py',\n 'go',\n 'rs',\n 'java',\n ].includes(extension);\n\n newAttachments.push({\n id: `att_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,\n type: isCode ? 'code' : 'file',\n name: file.name,\n content,\n mimeType: file.type,\n size: file.size,\n });\n }\n\n setAttachments((prev) => [...prev, ...newAttachments]);\n\n // Reset file input\n e.target.value = '';\n },\n [attachments.length, maxAttachments]\n );\n\n const removeAttachment = React.useCallback((id: string) => {\n setAttachments((prev) => prev.filter((a) => a.id !== id));\n }, []);\n\n return (\n <div className={cn('flex flex-col gap-2', className)}>\n {/* Attachments preview */}\n {attachments.length > 0 && (\n <div className=\"flex flex-wrap gap-2\">\n {attachments.map((attachment) => (\n <div\n key={attachment.id}\n className={cn(\n 'flex items-center gap-1.5 rounded-md px-2 py-1',\n 'bg-muted text-muted-foreground text-sm'\n )}\n >\n {attachment.type === 'code' ? (\n <Code className=\"h-3.5 w-3.5\" />\n ) : (\n <FileText className=\"h-3.5 w-3.5\" />\n )}\n <span className=\"max-w-[150px] truncate\">{attachment.name}</span>\n <button\n type=\"button\"\n onClick={() => removeAttachment(attachment.id)}\n className=\"hover:text-foreground\"\n aria-label={`Remove ${attachment.name}`}\n >\n <X className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n ))}\n </div>\n )}\n\n {/* Input form */}\n <form onSubmit={handleSubmit} className=\"flex items-end gap-2\">\n {/* Attachment button */}\n {showAttachments && (\n <>\n <input\n ref={fileInputRef}\n type=\"file\"\n multiple\n accept=\".ts,.tsx,.js,.jsx,.json,.md,.txt,.py,.go,.rs,.java,.yaml,.yml\"\n onChange={handleFileSelect}\n className=\"hidden\"\n aria-label=\"Attach files\"\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onPress={() => fileInputRef.current?.click()}\n disabled={disabled || attachments.length >= maxAttachments}\n aria-label=\"Attach files\"\n >\n <Paperclip className=\"h-4 w-4\" />\n </Button>\n </>\n )}\n\n {/* Text input */}\n <div className=\"relative flex-1\">\n <Textarea\n value={content}\n onChange={(e) => setContent(e.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n disabled={disabled}\n className={cn(\n 'max-h-[200px] min-h-[44px] resize-none pr-12',\n 'focus-visible:ring-1'\n )}\n rows={1}\n aria-label=\"Chat message\"\n />\n </div>\n\n {/* Send button */}\n <Button\n type=\"submit\"\n disabled={!canSend || disabled || isLoading}\n size=\"sm\"\n aria-label={isLoading ? 'Sending...' : 'Send message'}\n >\n {isLoading ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Send className=\"h-4 w-4\" />\n )}\n </Button>\n </form>\n\n {/* Helper text */}\n <p className=\"text-muted-foreground text-xs\">\n Press Enter to send, Shift+Enter for new line\n </p>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAgB,UAAU,EACxB,QACA,WAAW,OACX,YAAY,OACZ,cAAc,qBACd,WACA,kBAAkB,MAClB,iBAAiB,KACA;CACjB,MAAM,CAAC,SAAS,cAAc,MAAM,SAAS,GAAG;CAChD,MAAM,CAAC,aAAa,kBAAkB,MAAM,SAA2B,EAAE,CAAC;CAC1E,MAAM,cAAc,MAAM,OAA4B,KAAK;CAC3D,MAAM,eAAe,MAAM,OAAyB,KAAK;CAEzD,MAAM,UAAU,QAAQ,MAAM,CAAC,SAAS,KAAK,YAAY,SAAS;CAElE,MAAM,eAAe,MAAM,aACxB,MAAwB;AACvB,KAAG,gBAAgB;AACnB,MAAI,CAAC,WAAW,YAAY,UAAW;AAEvC,SAAO,QAAQ,MAAM,EAAE,YAAY,SAAS,IAAI,cAAc,OAAU;AACxE,aAAW,GAAG;AACd,iBAAe,EAAE,CAAC;AAGlB,cAAY,SAAS,OAAO;IAE9B;EAAC;EAAS;EAAS;EAAa;EAAU;EAAW;EAAO,CAC7D;CAED,MAAM,gBAAgB,MAAM,aACz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tC,oBAAC;OAAK,WAAU;iBAA0B,WAAW;QAAY;MACjE,oBAAC;OACC,MAAK;OACL,eAAe,iBAAiB,WAAW,GAAG;OAC9C,WAAU;OACV,cAAY,UAAU,WAAW;iBAEjC,oBAAC,KAAE,WAAU,gBAAgB;QACtB;;OAnBJ,WAAW,GAoBZ,CACN;KACE;GAIR,qBAAC;IAAK,UAAU;IAAc,WAAU;;KAErC,mBACC,4CACE,oBAAC;MACC,KAAK;MACL,MAAK;MACL;MACA,QAAO;MACP,UAAU;MACV,WAAU;MACV,cAAW;OACX,EACF,oBAAC;MACC,MAAK;MACL,SAAQ;MACR,MAAK;MACL,eAAe,aAAa,SAAS,OAAO;MAC5C,UAAU,YAAY,YAAY,UAAU;MAC5C,cAAW;gBAEX,oBAAC,aAAU,WAAU,YAAY;OAC1B,IACR;KAIL,oBAAC;MAAI,WAAU;gBACb,oBAAC;OACC,OAAO;OACP,WAAW,MAAM,WAAW,EAAE,OAAO,MAAM;OAC3C,WAAW;OACE;OACH;OACV,WAAW,GACT,gDACA,uBACD;OACD,MAAM;OACN,cAAW;QACX;OACE;KAGN,oBAAC;MACC,MAAK;MACL,UAAU,CAAC,WAAW,YAAY;MAClC,MAAK;MACL,cAAY,YAAY,eAAe;gBAEtC,YACC,oBAAC,WAAQ,WAAU,yBAAyB,GAE5C,oBAAC,QAAK,WAAU,YAAY;OAEvB;;KACJ;GAGP,oBAAC;IAAE,WAAU;cAAgC;KAEzC;;GACA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChatMessage as ChatMessage$1 } from "../../core/message-types.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/presentation/components/ChatMessage.d.ts
|
|
5
5
|
interface ChatMessageProps {
|
|
@@ -18,7 +18,7 @@ declare function ChatMessage({
|
|
|
18
18
|
className,
|
|
19
19
|
showCopy,
|
|
20
20
|
showAvatar
|
|
21
|
-
}: ChatMessageProps):
|
|
21
|
+
}: ChatMessageProps): react_jsx_runtime0.JSX.Element;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { ChatMessage };
|
|
24
24
|
//# sourceMappingURL=ChatMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessage.d.ts","names":[],"sources":["../../../src/presentation/components/ChatMessage.tsx"],"
|
|
1
|
+
{"version":3,"file":"ChatMessage.d.ts","names":[],"sources":["../../../src/presentation/components/ChatMessage.tsx"],"mappings":";;;;UAWiB,gBAAA;EACf,OAAA,EAAS,aAAA;EACT,SAAA;EAFe;EAIf,QAAA;;EAEA,UAAA;AAAA;;;;iBAyEc,WAAA,CAAA;EACd,OAAA;EACA,SAAA;EACA,QAAA;EACA;AAAA,GACC,gBAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodePreview.d.ts","names":[],"sources":["../../../src/presentation/components/CodePreview.tsx"],"
|
|
1
|
+
{"version":3,"file":"CodePreview.d.ts","names":[],"sources":["../../../src/presentation/components/CodePreview.tsx"],"mappings":";;;UAOiB,gBAAA;;EAEf,IAAA;EAFe;EAIf,QAAA;;EAEA,QAAA;EAJA;EAMA,SAAA;EAFA;EAIA,QAAA;EAAA;EAEA,WAAA;EAEA;EAAA,SAAA,IAAa,IAAA;EAEb;EAAA,YAAA;EAES;EAAT,SAAA;AAAA;;;;iBA8Bc,WAAA,CAAA;EACd,IAAA;EACA,QAAA;EACA,QAAA;EACA,SAAA;EACA,QAAA;EACA,WAAA;EACA,SAAA;EACA,YAAA;EACA;AAAA,GACC,gBAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkspaceSummary } from "../../context/workspace-context.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/presentation/components/ContextIndicator.d.ts
|
|
5
5
|
interface ContextIndicatorProps {
|
|
@@ -20,7 +20,7 @@ declare function ContextIndicator({
|
|
|
20
20
|
active,
|
|
21
21
|
className,
|
|
22
22
|
showDetails
|
|
23
|
-
}: ContextIndicatorProps):
|
|
23
|
+
}: ContextIndicatorProps): react_jsx_runtime0.JSX.Element;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { ContextIndicator };
|
|
26
26
|
//# sourceMappingURL=ContextIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextIndicator.d.ts","names":[],"sources":["../../../src/presentation/components/ContextIndicator.tsx"],"
|
|
1
|
+
{"version":3,"file":"ContextIndicator.d.ts","names":[],"sources":["../../../src/presentation/components/ContextIndicator.tsx"],"mappings":";;;;UAciB,qBAAA;;EAEf,OAAA,GAAU,gBAAA;EAFK;EAIf,MAAA;;EAEA,SAAA;EAJA;EAMA,WAAA;AAAA;;;;iBAMc,gBAAA,CAAA;EACd,OAAA;EACA,MAAA;EACA,SAAA;EACA;AAAA,GACC,qBAAA,GAAqB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
2
2
|
import { ProviderMode, ProviderName } from "@contractspec/lib.ai-providers";
|
|
3
3
|
|
|
4
4
|
//#region src/presentation/components/ModelPicker.d.ts
|
|
@@ -33,7 +33,7 @@ declare function ModelPicker({
|
|
|
33
33
|
availableProviders,
|
|
34
34
|
className,
|
|
35
35
|
compact
|
|
36
|
-
}: ModelPickerProps):
|
|
36
|
+
}: ModelPickerProps): react_jsx_runtime0.JSX.Element;
|
|
37
37
|
//#endregion
|
|
38
38
|
export { ModelPicker };
|
|
39
39
|
//# sourceMappingURL=ModelPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelPicker.d.ts","names":[],"sources":["../../../src/presentation/components/ModelPicker.tsx"],"
|
|
1
|
+
{"version":3,"file":"ModelPicker.d.ts","names":[],"sources":["../../../src/presentation/components/ModelPicker.tsx"],"mappings":";;;;UAsBiB,cAAA;EACf,QAAA,EAAU,YAAA;EACV,KAAA;EACA,IAAA,EAAM,YAAA;AAAA;AAAA,UAGS,gBAAA;EAHG;EAKlB,KAAA,EAAO,cAAA;EAPG;EASV,QAAA,GAAW,KAAA,EAAO,cAAA;EAPlB;EASA,kBAAA;IACE,QAAA,EAAU,YAAA;IACV,SAAA;IACA,IAAA,EAAM,YAAA;IACN,MAAA;EAAA;EARK;EAWP,SAAA;EANY;EAQZ,OAAA;AAAA;;;;iBA+Bc,WAAA,CAAA;EACd,KAAA;EACA,QAAA;EACA,kBAAA;EACA,SAAA;EACA;AAAA,GACC,gBAAA,GAAgB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChat.d.ts","names":[],"sources":["../../../src/presentation/hooks/useChat.tsx"],"
|
|
1
|
+
{"version":3,"file":"useChat.d.ts","names":[],"sources":["../../../src/presentation/hooks/useChat.tsx"],"mappings":";;;;;;AAkBA;UAAiB,cAAA;;EAEf,QAAA,GAAW,YAAA;EAEJ;EAAP,IAAA,GAAO,YAAA;EAgBgB;EAdvB,KAAA;EAgBuB;EAdvB,MAAA;EANA;EAQA,QAAA;EANA;EAQA,cAAA;EANA;EAQA,YAAA;EAJA;EAMA,SAAA;EAFA;EAIA,MAAA,IAAU,OAAA,EAAS,WAAA;EAAnB;EAEA,UAAA,IAAc,OAAA,EAAS,WAAA;EAFb;EAIV,OAAA,IAAW,KAAA,EAAO,KAAA;EAFK;EAIvB,OAAA,IAAW,KAAA;IAAS,WAAA;IAAqB,YAAA;EAAA;AAAA;;;;UAM1B,aAAA;EANgD;EAQ/D,QAAA,EAAU,WAAA;EAFkB;EAI5B,YAAA,EAAc,gBAAA;EAFJ;EAIV,SAAA;EAEO;EAAP,KAAA,EAAO,KAAA;EAKF;EAHL,WAAA,GACE,OAAA,UACA,WAAA,GAAc,cAAA,OACX,OAAA;EAMoB;EAJzB,iBAAA;EAbA;EAeA,iBAAA,GAAoB,EAAA;EAbpB;EAeA,UAAA,QAAkB,OAAA;EAblB;EAeA,IAAA;AAAA;;;;iBAMc,OAAA,CAAQ,OAAA,GAAS,cAAA,GAAsB,aAAA"}
|
|
@@ -124,9 +124,9 @@ function useChat(options = {}) {
|
|
|
124
124
|
onResponse?.(result.message);
|
|
125
125
|
}
|
|
126
126
|
} catch (err) {
|
|
127
|
-
const error
|
|
128
|
-
setError(error
|
|
129
|
-
onError?.(error
|
|
127
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
128
|
+
setError(error);
|
|
129
|
+
onError?.(error);
|
|
130
130
|
} finally {
|
|
131
131
|
setIsLoading(false);
|
|
132
132
|
abortControllerRef.current = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChat.js","names":["error"],"sources":["../../../src/presentation/hooks/useChat.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type {\n ChatAttachment,\n ChatConversation,\n ChatMessage,\n} from '../../core/message-types';\nimport { ChatService } from '../../core/chat-service';\nimport {\n createProvider,\n type ProviderMode,\n type ProviderName,\n} from '@contractspec/lib.ai-providers';\n\n/**\n * Options for useChat hook\n */\nexport interface UseChatOptions {\n /** Provider to use */\n provider?: ProviderName;\n /** Provider mode */\n mode?: ProviderMode;\n /** Model to use */\n model?: string;\n /** API key for BYOK mode */\n apiKey?: string;\n /** API proxy URL for managed mode */\n proxyUrl?: string;\n /** Initial conversation ID to resume */\n conversationId?: string;\n /** System prompt override */\n systemPrompt?: string;\n /** Enable streaming */\n streaming?: boolean;\n /** Called when a message is sent */\n onSend?: (message: ChatMessage) => void;\n /** Called when a response is received */\n onResponse?: (message: ChatMessage) => void;\n /** Called on error */\n onError?: (error: Error) => void;\n /** Called when usage is recorded */\n onUsage?: (usage: { inputTokens: number; outputTokens: number }) => void;\n}\n\n/**\n * Return type for useChat hook\n */\nexport interface UseChatReturn {\n /** Current messages */\n messages: ChatMessage[];\n /** Current conversation */\n conversation: ChatConversation | null;\n /** Whether currently loading/streaming */\n isLoading: boolean;\n /** Current error */\n error: Error | null;\n /** Send a message */\n sendMessage: (\n content: string,\n attachments?: ChatAttachment[]\n ) => Promise<void>;\n /** Clear conversation and start fresh */\n clearConversation: () => void;\n /** Set conversation ID to resume */\n setConversationId: (id: string | null) => void;\n /** Regenerate last response */\n regenerate: () => Promise<void>;\n /** Stop current generation */\n stop: () => void;\n}\n\n/**\n * Hook for managing AI chat state\n */\nexport function useChat(options: UseChatOptions = {}): UseChatReturn {\n const {\n provider = 'openai',\n mode = 'byok',\n model,\n apiKey,\n proxyUrl,\n conversationId: initialConversationId,\n systemPrompt,\n streaming = true,\n onSend,\n onResponse,\n onError,\n onUsage,\n } = options;\n\n const [messages, setMessages] = React.useState<ChatMessage[]>([]);\n const [conversation, setConversation] =\n React.useState<ChatConversation | null>(null);\n const [isLoading, setIsLoading] = React.useState(false);\n const [error, setError] = React.useState<Error | null>(null);\n const [conversationId, setConversationId] = React.useState<string | null>(\n initialConversationId ?? null\n );\n\n const abortControllerRef = React.useRef<AbortController | null>(null);\n const chatServiceRef = React.useRef<ChatService | null>(null);\n\n // Initialize chat service\n React.useEffect(() => {\n const chatProvider = createProvider({\n provider,\n model,\n apiKey,\n proxyUrl,\n });\n\n chatServiceRef.current = new ChatService({\n provider: chatProvider,\n systemPrompt,\n onUsage,\n });\n }, [provider, mode, model, apiKey, proxyUrl, systemPrompt, onUsage]);\n\n // Load existing conversation\n React.useEffect(() => {\n if (!conversationId || !chatServiceRef.current) return;\n\n const loadConversation = async () => {\n if (!chatServiceRef.current) return;\n\n const conv = await chatServiceRef.current.getConversation(conversationId);\n if (conv) {\n setConversation(conv);\n setMessages(conv.messages);\n }\n };\n\n loadConversation().catch(console.error);\n }, [conversationId]);\n\n const sendMessage = React.useCallback(\n async (content: string, attachments?: ChatAttachment[]) => {\n if (!chatServiceRef.current) {\n throw new Error('Chat service not initialized');\n }\n\n setIsLoading(true);\n setError(null);\n\n // Create abort controller\n abortControllerRef.current = new AbortController();\n\n try {\n // Add user message immediately\n const userMessage: ChatMessage = {\n id: `msg_${Date.now()}`,\n conversationId: conversationId ?? '',\n role: 'user',\n content,\n status: 'completed',\n createdAt: new Date(),\n updatedAt: new Date(),\n attachments,\n };\n setMessages((prev) => [...prev, userMessage]);\n onSend?.(userMessage);\n\n if (streaming) {\n // Streaming mode\n const result = await chatServiceRef.current.stream({\n conversationId: conversationId ?? undefined,\n content,\n attachments,\n });\n\n // Update conversation ID if new\n if (!conversationId) {\n setConversationId(result.conversationId);\n }\n\n // Add placeholder for assistant message\n const assistantMessage: ChatMessage = {\n id: result.messageId,\n conversationId: result.conversationId,\n role: 'assistant',\n content: '',\n status: 'streaming',\n createdAt: new Date(),\n updatedAt: new Date(),\n };\n setMessages((prev) => [...prev, assistantMessage]);\n\n // Process stream\n let fullContent = '';\n for await (const chunk of result.stream) {\n if (chunk.type === 'text' && chunk.content) {\n fullContent += chunk.content;\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId ? { ...m, content: fullContent } : m\n )\n );\n } else if (chunk.type === 'done') {\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId\n ? {\n ...m,\n status: 'completed',\n usage: chunk.usage,\n updatedAt: new Date(),\n }\n : m\n )\n );\n onResponse?.(\n messages.find((m) => m.id === result.messageId) ??\n assistantMessage\n );\n } else if (chunk.type === 'error') {\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId\n ? {\n ...m,\n status: 'error',\n error: chunk.error,\n updatedAt: new Date(),\n }\n : m\n )\n );\n if (chunk.error) {\n const err = new Error(chunk.error.message);\n setError(err);\n onError?.(err);\n }\n }\n }\n } else {\n // Non-streaming mode\n const result = await chatServiceRef.current.send({\n conversationId: conversationId ?? undefined,\n content,\n attachments,\n });\n\n setConversation(result.conversation);\n setMessages(result.conversation.messages);\n\n if (!conversationId) {\n setConversationId(result.conversation.id);\n }\n\n onResponse?.(result.message);\n }\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n setError(error);\n onError?.(error);\n } finally {\n setIsLoading(false);\n abortControllerRef.current = null;\n }\n },\n [conversationId, streaming, onSend, onResponse, onError, messages]\n );\n\n const clearConversation = React.useCallback(() => {\n setMessages([]);\n setConversation(null);\n setConversationId(null);\n setError(null);\n }, []);\n\n const regenerate = React.useCallback(async () => {\n // Find the last user message\n const lastUserMessageIndex = messages.findLastIndex(\n (m) => m.role === 'user'\n );\n if (lastUserMessageIndex === -1) return;\n\n const lastUserMessage = messages[lastUserMessageIndex];\n if (!lastUserMessage) return;\n\n // Remove the last assistant message\n setMessages((prev) => prev.slice(0, lastUserMessageIndex + 1));\n\n // Resend\n await sendMessage(lastUserMessage.content, lastUserMessage.attachments);\n }, [messages, sendMessage]);\n\n const stop = React.useCallback(() => {\n abortControllerRef.current?.abort();\n setIsLoading(false);\n }, []);\n\n return {\n messages,\n conversation,\n isLoading,\n error,\n sendMessage,\n clearConversation,\n setConversationId,\n regenerate,\n stop,\n };\n}\n"],"mappings":";;;;;;;;;;AA2EA,SAAgB,QAAQ,UAA0B,EAAE,EAAiB;CACnE,MAAM,EACJ,WAAW,UACX,OAAO,QACP,OACA,QACA,UACA,gBAAgB,uBAChB,cACA,YAAY,MACZ,QACA,YACA,SACA,YACE;CAEJ,MAAM,CAAC,UAAU,eAAe,MAAM,SAAwB,EAAE,CAAC;CACjE,MAAM,CAAC,cAAc,mBACnB,MAAM,SAAkC,KAAK;CAC/C,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,MAAM;CACvD,MAAM,CAAC,OAAO,YAAY,MAAM,SAAuB,KAAK;CAC5D,MAAM,CAAC,gBAAgB,qBAAqB,MAAM,SAChD,yBAAyB,KAC1B;CAED,MAAM,qBAAqB,MAAM,OAA+B,KAAK;CACrE,M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Y;EAAS;EAAS,CACnE;AA+BD,QAAO;EACL;EACA;EACA;EACA;EACA;EACA,mBAnCwB,MAAM,kBAAkB;AAChD,eAAY,EAAE,CAAC;AACf,mBAAgB,KAAK;AACrB,qBAAkB,KAAK;AACvB,YAAS,KAAK;KACb,EAAE,CAAC;EA+BJ;EACA,YA9BiB,MAAM,YAAY,YAAY;GAE/C,MAAM,uBAAuB,SAAS,eACnC,MAAM,EAAE,SAAS,OACnB;AACD,OAAI,yBAAyB,GAAI;GAEjC,MAAM,kBAAkB,SAAS;AACjC,OAAI,CAAC,gBAAiB;AAGtB,gBAAa,SAAS,KAAK,MAAM,GAAG,uBAAuB,EAAE,CAAC;AAG9D,SAAM,YAAY,gBAAgB,SAAS,gBAAgB,YAAY;KACtE,CAAC,UAAU,YAAY,CAAC;EAgBzB,MAdW,MAAM,kBAAkB;AACnC,sBAAmB,SAAS,OAAO;AACnC,gBAAa,MAAM;KAClB,EAAE,CAAC;EAYL"}
|
|
1
|
+
{"version":3,"file":"useChat.js","names":[],"sources":["../../../src/presentation/hooks/useChat.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type {\n ChatAttachment,\n ChatConversation,\n ChatMessage,\n} from '../../core/message-types';\nimport { ChatService } from '../../core/chat-service';\nimport {\n createProvider,\n type ProviderMode,\n type ProviderName,\n} from '@contractspec/lib.ai-providers';\n\n/**\n * Options for useChat hook\n */\nexport interface UseChatOptions {\n /** Provider to use */\n provider?: ProviderName;\n /** Provider mode */\n mode?: ProviderMode;\n /** Model to use */\n model?: string;\n /** API key for BYOK mode */\n apiKey?: string;\n /** API proxy URL for managed mode */\n proxyUrl?: string;\n /** Initial conversation ID to resume */\n conversationId?: string;\n /** System prompt override */\n systemPrompt?: string;\n /** Enable streaming */\n streaming?: boolean;\n /** Called when a message is sent */\n onSend?: (message: ChatMessage) => void;\n /** Called when a response is received */\n onResponse?: (message: ChatMessage) => void;\n /** Called on error */\n onError?: (error: Error) => void;\n /** Called when usage is recorded */\n onUsage?: (usage: { inputTokens: number; outputTokens: number }) => void;\n}\n\n/**\n * Return type for useChat hook\n */\nexport interface UseChatReturn {\n /** Current messages */\n messages: ChatMessage[];\n /** Current conversation */\n conversation: ChatConversation | null;\n /** Whether currently loading/streaming */\n isLoading: boolean;\n /** Current error */\n error: Error | null;\n /** Send a message */\n sendMessage: (\n content: string,\n attachments?: ChatAttachment[]\n ) => Promise<void>;\n /** Clear conversation and start fresh */\n clearConversation: () => void;\n /** Set conversation ID to resume */\n setConversationId: (id: string | null) => void;\n /** Regenerate last response */\n regenerate: () => Promise<void>;\n /** Stop current generation */\n stop: () => void;\n}\n\n/**\n * Hook for managing AI chat state\n */\nexport function useChat(options: UseChatOptions = {}): UseChatReturn {\n const {\n provider = 'openai',\n mode = 'byok',\n model,\n apiKey,\n proxyUrl,\n conversationId: initialConversationId,\n systemPrompt,\n streaming = true,\n onSend,\n onResponse,\n onError,\n onUsage,\n } = options;\n\n const [messages, setMessages] = React.useState<ChatMessage[]>([]);\n const [conversation, setConversation] =\n React.useState<ChatConversation | null>(null);\n const [isLoading, setIsLoading] = React.useState(false);\n const [error, setError] = React.useState<Error | null>(null);\n const [conversationId, setConversationId] = React.useState<string | null>(\n initialConversationId ?? null\n );\n\n const abortControllerRef = React.useRef<AbortController | null>(null);\n const chatServiceRef = React.useRef<ChatService | null>(null);\n\n // Initialize chat service\n React.useEffect(() => {\n const chatProvider = createProvider({\n provider,\n model,\n apiKey,\n proxyUrl,\n });\n\n chatServiceRef.current = new ChatService({\n provider: chatProvider,\n systemPrompt,\n onUsage,\n });\n }, [provider, mode, model, apiKey, proxyUrl, systemPrompt, onUsage]);\n\n // Load existing conversation\n React.useEffect(() => {\n if (!conversationId || !chatServiceRef.current) return;\n\n const loadConversation = async () => {\n if (!chatServiceRef.current) return;\n\n const conv = await chatServiceRef.current.getConversation(conversationId);\n if (conv) {\n setConversation(conv);\n setMessages(conv.messages);\n }\n };\n\n loadConversation().catch(console.error);\n }, [conversationId]);\n\n const sendMessage = React.useCallback(\n async (content: string, attachments?: ChatAttachment[]) => {\n if (!chatServiceRef.current) {\n throw new Error('Chat service not initialized');\n }\n\n setIsLoading(true);\n setError(null);\n\n // Create abort controller\n abortControllerRef.current = new AbortController();\n\n try {\n // Add user message immediately\n const userMessage: ChatMessage = {\n id: `msg_${Date.now()}`,\n conversationId: conversationId ?? '',\n role: 'user',\n content,\n status: 'completed',\n createdAt: new Date(),\n updatedAt: new Date(),\n attachments,\n };\n setMessages((prev) => [...prev, userMessage]);\n onSend?.(userMessage);\n\n if (streaming) {\n // Streaming mode\n const result = await chatServiceRef.current.stream({\n conversationId: conversationId ?? undefined,\n content,\n attachments,\n });\n\n // Update conversation ID if new\n if (!conversationId) {\n setConversationId(result.conversationId);\n }\n\n // Add placeholder for assistant message\n const assistantMessage: ChatMessage = {\n id: result.messageId,\n conversationId: result.conversationId,\n role: 'assistant',\n content: '',\n status: 'streaming',\n createdAt: new Date(),\n updatedAt: new Date(),\n };\n setMessages((prev) => [...prev, assistantMessage]);\n\n // Process stream\n let fullContent = '';\n for await (const chunk of result.stream) {\n if (chunk.type === 'text' && chunk.content) {\n fullContent += chunk.content;\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId ? { ...m, content: fullContent } : m\n )\n );\n } else if (chunk.type === 'done') {\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId\n ? {\n ...m,\n status: 'completed',\n usage: chunk.usage,\n updatedAt: new Date(),\n }\n : m\n )\n );\n onResponse?.(\n messages.find((m) => m.id === result.messageId) ??\n assistantMessage\n );\n } else if (chunk.type === 'error') {\n setMessages((prev) =>\n prev.map((m) =>\n m.id === result.messageId\n ? {\n ...m,\n status: 'error',\n error: chunk.error,\n updatedAt: new Date(),\n }\n : m\n )\n );\n if (chunk.error) {\n const err = new Error(chunk.error.message);\n setError(err);\n onError?.(err);\n }\n }\n }\n } else {\n // Non-streaming mode\n const result = await chatServiceRef.current.send({\n conversationId: conversationId ?? undefined,\n content,\n attachments,\n });\n\n setConversation(result.conversation);\n setMessages(result.conversation.messages);\n\n if (!conversationId) {\n setConversationId(result.conversation.id);\n }\n\n onResponse?.(result.message);\n }\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n setError(error);\n onError?.(error);\n } finally {\n setIsLoading(false);\n abortControllerRef.current = null;\n }\n },\n [conversationId, streaming, onSend, onResponse, onError, messages]\n );\n\n const clearConversation = React.useCallback(() => {\n setMessages([]);\n setConversation(null);\n setConversationId(null);\n setError(null);\n }, []);\n\n const regenerate = React.useCallback(async () => {\n // Find the last user message\n const lastUserMessageIndex = messages.findLastIndex(\n (m) => m.role === 'user'\n );\n if (lastUserMessageIndex === -1) return;\n\n const lastUserMessage = messages[lastUserMessageIndex];\n if (!lastUserMessage) return;\n\n // Remove the last assistant message\n setMessages((prev) => prev.slice(0, lastUserMessageIndex + 1));\n\n // Resend\n await sendMessage(lastUserMessage.content, lastUserMessage.attachments);\n }, [messages, sendMessage]);\n\n const stop = React.useCallback(() => {\n abortControllerRef.current?.abort();\n setIsLoading(false);\n }, []);\n\n return {\n messages,\n conversation,\n isLoading,\n error,\n sendMessage,\n clearConversation,\n setConversationId,\n regenerate,\n stop,\n };\n}\n"],"mappings":";;;;;;;;;;AA2EA,SAAgB,QAAQ,UAA0B,EAAE,EAAiB;CACnE,MAAM,EACJ,WAAW,UACX,OAAO,QACP,OACA,QACA,UACA,gBAAgB,uBAChB,cACA,YAAY,MACZ,QACA,YACA,SACA,YACE;CAEJ,MAAM,CAAC,UAAU,eAAe,MAAM,SAAwB,EAAE,CAAC;CACjE,MAAM,CAAC,cAAc,mBACnB,MAAM,SAAkC,KAAK;CAC/C,MAAM,CAAC,WAAW,gBAAgB,MAAM,SAAS,MAAM;CACvD,MAAM,CAAC,OAAO,YAAY,MAAM,SAAuB,KAAK;CAC5D,MAAM,CAAC,gBAAgB,qBAAqB,MAAM,SAChD,yBAAyB,KAC1B;CAED,MAAM,qBAAqB,MAAM,OAA+B,KAAK;CACrE,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;EAAS;EAAS,CACnE;AA+BD,QAAO;EACL;EACA;EACA;EACA;EACA;EACA,mBAnCwB,MAAM,kBAAkB;AAChD,eAAY,EAAE,CAAC;AACf,mBAAgB,KAAK;AACrB,qBAAkB,KAAK;AACvB,YAAS,KAAK;KACb,EAAE,CAAC;EA+BJ;EACA,YA9BiB,MAAM,YAAY,YAAY;GAE/C,MAAM,uBAAuB,SAAS,eACnC,MAAM,EAAE,SAAS,OACnB;AACD,OAAI,yBAAyB,GAAI;GAEjC,MAAM,kBAAkB,SAAS;AACjC,OAAI,CAAC,gBAAiB;AAGtB,gBAAa,SAAS,KAAK,MAAM,GAAG,uBAAuB,EAAE,CAAC;AAG9D,SAAM,YAAY,gBAAgB,SAAS,gBAAgB,YAAY;KACtE,CAAC,UAAU,YAAY,CAAC;EAgBzB,MAdW,MAAM,kBAAkB;AACnC,sBAAmB,SAAS,OAAO;AACnC,gBAAa,MAAM;KAClB,EAAE,CAAC;EAYL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProviders.d.ts","names":[],"sources":["../../../src/presentation/hooks/useProviders.tsx"],"
|
|
1
|
+
{"version":3,"file":"useProviders.d.ts","names":[],"sources":["../../../src/presentation/hooks/useProviders.tsx"],"mappings":";;;;;AAcA;UAAiB,YAAA;EACf,QAAA,EAAU,YAAA;EACV,SAAA;EACA,IAAA,EAAM,YAAA;EACN,MAAA;EACA,MAAA,EAAQ,SAAA;AAAA;;;;UAMO,kBAAA;EART;EAUN,SAAA,EAAW,YAAA;EARX;EAUA,kBAAA,EAAoB,YAAA;EAVH;EAYjB,WAAA,GAAc,QAAA,EAAU,YAAA;EANT;EAQf,SAAA,GAAY,QAAA,EAAU,YAAA,KAAiB,SAAA;;EAEvC,SAAA;EANoB;EAQpB,OAAA,QAAe,OAAA;AAAA;;;;iBAMD,YAAA,CAAA,GAAgB,kBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-utilities.d.ts","names":[],"sources":["../../src/providers/chat-utilities.ts"],"
|
|
1
|
+
{"version":3,"file":"chat-utilities.d.ts","names":[],"sources":["../../src/providers/chat-utilities.ts"],"mappings":";;;;;;iBAQgB,iBAAA,CAAkB,QAAA,EAAU,YAAA;AAO5C;;;AAAA,iBAAgB,iBAAA,CAAkB,QAAA,EAAU,YAAA"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
|
|
2
2
|
|
|
3
3
|
//#region src/schema.d.ts
|
|
4
|
-
declare const ChatMessageModel:
|
|
4
|
+
declare const ChatMessageModel: _contractspec_lib_schema0.SchemaModel<{
|
|
5
5
|
id: {
|
|
6
|
-
type:
|
|
6
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
7
7
|
isOptional: false;
|
|
8
8
|
};
|
|
9
9
|
role: {
|
|
10
|
-
type:
|
|
10
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
11
11
|
isOptional: false;
|
|
12
12
|
};
|
|
13
13
|
content: {
|
|
14
|
-
type:
|
|
14
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
15
15
|
isOptional: false;
|
|
16
16
|
};
|
|
17
17
|
status: {
|
|
18
|
-
type:
|
|
18
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
19
19
|
isOptional: false;
|
|
20
20
|
};
|
|
21
21
|
createdAt: {
|
|
22
|
-
type:
|
|
22
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
23
23
|
isOptional: false;
|
|
24
24
|
};
|
|
25
25
|
}>;
|
|
26
|
-
declare const ChatConversationModel:
|
|
26
|
+
declare const ChatConversationModel: _contractspec_lib_schema0.SchemaModel<{
|
|
27
27
|
id: {
|
|
28
|
-
type:
|
|
28
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
29
29
|
isOptional: false;
|
|
30
30
|
};
|
|
31
31
|
title: {
|
|
32
|
-
type:
|
|
32
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
33
33
|
isOptional: true;
|
|
34
34
|
};
|
|
35
35
|
status: {
|
|
36
|
-
type:
|
|
36
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
37
37
|
isOptional: false;
|
|
38
38
|
};
|
|
39
39
|
messages: {
|
|
40
|
-
type:
|
|
40
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
41
41
|
id: {
|
|
42
|
-
type:
|
|
42
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
43
43
|
isOptional: false;
|
|
44
44
|
};
|
|
45
45
|
role: {
|
|
46
|
-
type:
|
|
46
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
47
47
|
isOptional: false;
|
|
48
48
|
};
|
|
49
49
|
content: {
|
|
50
|
-
type:
|
|
50
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
51
51
|
isOptional: false;
|
|
52
52
|
};
|
|
53
53
|
status: {
|
|
54
|
-
type:
|
|
54
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
55
55
|
isOptional: false;
|
|
56
56
|
};
|
|
57
57
|
createdAt: {
|
|
58
|
-
type:
|
|
58
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
59
59
|
isOptional: false;
|
|
60
60
|
};
|
|
61
61
|
}>;
|
|
@@ -63,88 +63,88 @@ declare const ChatConversationModel: _contractspec_lib_schema28.SchemaModel<{
|
|
|
63
63
|
isOptional: false;
|
|
64
64
|
};
|
|
65
65
|
provider: {
|
|
66
|
-
type:
|
|
66
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
67
67
|
isOptional: false;
|
|
68
68
|
};
|
|
69
69
|
model: {
|
|
70
|
-
type:
|
|
70
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
71
71
|
isOptional: false;
|
|
72
72
|
};
|
|
73
73
|
}>;
|
|
74
|
-
declare const SendMessageInputModel:
|
|
74
|
+
declare const SendMessageInputModel: _contractspec_lib_schema0.SchemaModel<{
|
|
75
75
|
conversationId: {
|
|
76
|
-
type:
|
|
76
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
77
77
|
isOptional: true;
|
|
78
78
|
};
|
|
79
79
|
content: {
|
|
80
|
-
type:
|
|
80
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
81
81
|
isOptional: false;
|
|
82
82
|
};
|
|
83
83
|
stream: {
|
|
84
|
-
type:
|
|
84
|
+
type: _contractspec_lib_schema0.FieldType<boolean, boolean>;
|
|
85
85
|
isOptional: true;
|
|
86
86
|
};
|
|
87
87
|
}>;
|
|
88
|
-
declare const SendMessageOutputModel:
|
|
88
|
+
declare const SendMessageOutputModel: _contractspec_lib_schema0.SchemaModel<{
|
|
89
89
|
message: {
|
|
90
|
-
type:
|
|
90
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
91
91
|
id: {
|
|
92
|
-
type:
|
|
92
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
93
93
|
isOptional: false;
|
|
94
94
|
};
|
|
95
95
|
role: {
|
|
96
|
-
type:
|
|
96
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
97
97
|
isOptional: false;
|
|
98
98
|
};
|
|
99
99
|
content: {
|
|
100
|
-
type:
|
|
100
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
101
101
|
isOptional: false;
|
|
102
102
|
};
|
|
103
103
|
status: {
|
|
104
|
-
type:
|
|
104
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
105
105
|
isOptional: false;
|
|
106
106
|
};
|
|
107
107
|
createdAt: {
|
|
108
|
-
type:
|
|
108
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
109
109
|
isOptional: false;
|
|
110
110
|
};
|
|
111
111
|
}>;
|
|
112
112
|
isOptional: false;
|
|
113
113
|
};
|
|
114
114
|
conversation: {
|
|
115
|
-
type:
|
|
115
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
116
116
|
id: {
|
|
117
|
-
type:
|
|
117
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
118
118
|
isOptional: false;
|
|
119
119
|
};
|
|
120
120
|
title: {
|
|
121
|
-
type:
|
|
121
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
122
122
|
isOptional: true;
|
|
123
123
|
};
|
|
124
124
|
status: {
|
|
125
|
-
type:
|
|
125
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
126
126
|
isOptional: false;
|
|
127
127
|
};
|
|
128
128
|
messages: {
|
|
129
|
-
type:
|
|
129
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
130
130
|
id: {
|
|
131
|
-
type:
|
|
131
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
132
132
|
isOptional: false;
|
|
133
133
|
};
|
|
134
134
|
role: {
|
|
135
|
-
type:
|
|
135
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
136
136
|
isOptional: false;
|
|
137
137
|
};
|
|
138
138
|
content: {
|
|
139
|
-
type:
|
|
139
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
140
140
|
isOptional: false;
|
|
141
141
|
};
|
|
142
142
|
status: {
|
|
143
|
-
type:
|
|
143
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
144
144
|
isOptional: false;
|
|
145
145
|
};
|
|
146
146
|
createdAt: {
|
|
147
|
-
type:
|
|
147
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
148
148
|
isOptional: false;
|
|
149
149
|
};
|
|
150
150
|
}>;
|
|
@@ -152,52 +152,52 @@ declare const SendMessageOutputModel: _contractspec_lib_schema28.SchemaModel<{
|
|
|
152
152
|
isOptional: false;
|
|
153
153
|
};
|
|
154
154
|
provider: {
|
|
155
|
-
type:
|
|
155
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
156
156
|
isOptional: false;
|
|
157
157
|
};
|
|
158
158
|
model: {
|
|
159
|
-
type:
|
|
159
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
160
160
|
isOptional: false;
|
|
161
161
|
};
|
|
162
162
|
}>;
|
|
163
163
|
isOptional: false;
|
|
164
164
|
};
|
|
165
165
|
}>;
|
|
166
|
-
declare const ListConversationsOutputModel:
|
|
166
|
+
declare const ListConversationsOutputModel: _contractspec_lib_schema0.SchemaModel<{
|
|
167
167
|
conversations: {
|
|
168
|
-
type:
|
|
168
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
169
169
|
id: {
|
|
170
|
-
type:
|
|
170
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
171
171
|
isOptional: false;
|
|
172
172
|
};
|
|
173
173
|
title: {
|
|
174
|
-
type:
|
|
174
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
175
175
|
isOptional: true;
|
|
176
176
|
};
|
|
177
177
|
status: {
|
|
178
|
-
type:
|
|
178
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
179
179
|
isOptional: false;
|
|
180
180
|
};
|
|
181
181
|
messages: {
|
|
182
|
-
type:
|
|
182
|
+
type: _contractspec_lib_schema0.SchemaModel<{
|
|
183
183
|
id: {
|
|
184
|
-
type:
|
|
184
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
185
185
|
isOptional: false;
|
|
186
186
|
};
|
|
187
187
|
role: {
|
|
188
|
-
type:
|
|
188
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
189
189
|
isOptional: false;
|
|
190
190
|
};
|
|
191
191
|
content: {
|
|
192
|
-
type:
|
|
192
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
193
193
|
isOptional: false;
|
|
194
194
|
};
|
|
195
195
|
status: {
|
|
196
|
-
type:
|
|
196
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
197
197
|
isOptional: false;
|
|
198
198
|
};
|
|
199
199
|
createdAt: {
|
|
200
|
-
type:
|
|
200
|
+
type: _contractspec_lib_schema0.FieldType<Date, string>;
|
|
201
201
|
isOptional: false;
|
|
202
202
|
};
|
|
203
203
|
}>;
|
|
@@ -205,11 +205,11 @@ declare const ListConversationsOutputModel: _contractspec_lib_schema28.SchemaMod
|
|
|
205
205
|
isOptional: false;
|
|
206
206
|
};
|
|
207
207
|
provider: {
|
|
208
|
-
type:
|
|
208
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
209
209
|
isOptional: false;
|
|
210
210
|
};
|
|
211
211
|
model: {
|
|
212
|
-
type:
|
|
212
|
+
type: _contractspec_lib_schema0.FieldType<string, string>;
|
|
213
213
|
isOptional: false;
|
|
214
214
|
};
|
|
215
215
|
}>;
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"mappings":";;;cAEa,gBAAA,4BAAgB,WAAA;;UAS3B,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;cAEW,qBAAA,4BAAqB,WAAA;;UAUhC,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,qBAAA,4BAAqB,WAAA;;UAUhC,yBAAA,CAAA,SAAA;;;;;;;;;;;;cAEW,sBAAA,4BAAsB,WAAA;;;;cAMjC,yBAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,4BAAA,4BAA4B,WAAA;;;;cASvC,yBAAA,CAAA,SAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/module.ai-chat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.57.0",
|
|
4
4
|
"description": "AI chat interface module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contractspec",
|
|
@@ -29,25 +29,25 @@
|
|
|
29
29
|
"test": "bun test"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@contractspec/lib.ai-agent": "1.
|
|
33
|
-
"@contractspec/lib.ai-providers": "1.
|
|
34
|
-
"@contractspec/lib.contracts": "1.
|
|
35
|
-
"@contractspec/lib.schema": "1.
|
|
36
|
-
"@contractspec/lib.metering": "1.
|
|
37
|
-
"@contractspec/lib.cost-tracking": "1.
|
|
38
|
-
"@contractspec/lib.design-system": "1.
|
|
39
|
-
"@contractspec/lib.ui-kit-web": "1.
|
|
40
|
-
"@ai-sdk/react": "3.0.
|
|
41
|
-
"ai": "6.0.
|
|
32
|
+
"@contractspec/lib.ai-agent": "1.57.0",
|
|
33
|
+
"@contractspec/lib.ai-providers": "1.57.0",
|
|
34
|
+
"@contractspec/lib.contracts": "1.57.0",
|
|
35
|
+
"@contractspec/lib.schema": "1.57.0",
|
|
36
|
+
"@contractspec/lib.metering": "1.57.0",
|
|
37
|
+
"@contractspec/lib.cost-tracking": "1.57.0",
|
|
38
|
+
"@contractspec/lib.design-system": "1.57.0",
|
|
39
|
+
"@contractspec/lib.ui-kit-web": "1.57.0",
|
|
40
|
+
"@ai-sdk/react": "3.0.75",
|
|
41
|
+
"ai": "6.0.73",
|
|
42
42
|
"lucide-react": "^0.563.0",
|
|
43
43
|
"react": "19.2.4",
|
|
44
44
|
"zod": "^4.3.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@contractspec/tool.tsdown": "1.
|
|
48
|
-
"@contractspec/tool.typescript": "1.
|
|
49
|
-
"@types/react": "^19.2.
|
|
50
|
-
"tsdown": "^0.
|
|
47
|
+
"@contractspec/tool.tsdown": "1.57.0",
|
|
48
|
+
"@contractspec/tool.typescript": "1.57.0",
|
|
49
|
+
"@types/react": "^19.2.13",
|
|
50
|
+
"tsdown": "^0.20.3",
|
|
51
51
|
"typescript": "^5.9.3"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|