@adecore/agents-react 0.46.3 → 0.48.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/agents/accounts.d.ts +9 -1
- package/dist/agents/accounts.js +31 -7
- package/dist/chat/account-choice.d.ts +5 -4
- package/dist/chat/account-choice.js +47 -39
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/index.js +1 -0
- package/dist/chat/logic/scrubber.js +12 -0
- package/dist/chat/logic/timeline-copy.js +2 -0
- package/dist/chat/logic/timeline.d.ts +6 -1
- package/dist/chat/logic/timeline.js +36 -10
- package/dist/chat/preferences.d.ts +2 -2
- package/dist/chat/preferences.js +11 -5
- package/dist/chat/ui/AccountPill.js +9 -6
- package/dist/chat/ui/ChatActivity.d.ts +2 -1
- package/dist/chat/ui/ChatActivity.js +295 -61
- package/dist/chat/ui/Composer.d.ts +2 -1
- package/dist/chat/ui/Composer.js +492 -486
- package/dist/chat/ui/LimitState.js +180 -172
- package/dist/chat/ui/PromptEditor.js +4 -1
- package/dist/chat/ui/ReferenceChip.d.ts +2 -1
- package/dist/chat/ui/ReferenceChip.js +135 -100
- package/dist/chat/ui/UnifiedDiff.js +22 -19
- package/dist/chat/ui/composer/ComposerControls.js +1 -1
- package/dist/chat/ui/composer/ComposerMenu.js +17 -11
- package/dist/chat/ui/composer/chips.d.ts +3 -0
- package/dist/chat/ui/composer/chips.js +14 -10
- package/dist/chat/ui/composer/use-chat-controls.js +70 -67
- package/dist/chat/ui/diff/EditorEditDiff.d.ts +3 -1
- package/dist/chat/ui/diff/EditorEditDiff.js +24 -18
- package/dist/chat/ui/diff/EditorPatchDiff.d.ts +3 -1
- package/dist/chat/ui/diff/EditorPatchDiff.js +4 -2
- package/dist/chat/ui/diff/diff-props.d.ts +2 -0
- package/dist/chat/ui/reference-icons.d.ts +3 -0
- package/dist/chat/ui/reference-icons.js +15 -2
- package/dist/chat/ui/rows/MessageRows.d.ts +6 -1
- package/dist/chat/ui/rows/MessageRows.js +166 -10
- package/dist/chat/ui/rows/RowContainer.js +21 -22
- package/dist/chat/ui/rows/Rows.js +37 -19
- package/dist/chat/ui/rows/WorkflowRow.d.ts +2 -1
- package/dist/chat/ui/rows/WorkflowRow.js +197 -191
- package/dist/chat/ui/rows/row-rhythm.d.ts +1 -0
- package/dist/chat/ui/rows/row-rhythm.js +12 -3
- package/dist/chat/workflow-list.d.ts +12 -0
- package/dist/chat/workflow-list.js +54 -0
- package/dist/host-hooks.d.ts +3 -0
- package/dist/host-hooks.js +8 -0
- package/dist/host.d.ts +11 -1
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +9 -0
- package/dist/locales/en/agent-chat.js +9 -0
- package/dist/locales/en/agent-providers.d.ts +5 -0
- package/dist/locales/en/agent-providers.js +8 -3
- package/dist/locales/nl/agent-chat.d.ts +9 -0
- package/dist/locales/nl/agent-chat.js +9 -0
- package/dist/locales/nl/agent-providers.d.ts +5 -0
- package/dist/locales/nl/agent-providers.js +8 -3
- package/dist/providers/AccountOrderList.d.ts +10 -0
- package/dist/providers/AccountOrderList.js +158 -0
- package/dist/providers/CliDetail.js +55 -61
- package/dist/providers/account-actions.d.ts +1 -0
- package/dist/providers/account-actions.js +39 -0
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/usage/limit-groups.js +6 -1
- package/package.json +8 -8
- package/src/agents/accounts.ts +42 -6
- package/src/chat/account-choice.ts +31 -10
- package/src/chat/index.ts +1 -0
- package/src/chat/logic/scrubber.ts +5 -0
- package/src/chat/logic/timeline-copy.ts +2 -0
- package/src/chat/logic/timeline.ts +33 -2
- package/src/chat/preferences.ts +33 -8
- package/src/chat/ui/AccountPill.tsx +3 -3
- package/src/chat/ui/ChatActivity.tsx +52 -6
- package/src/chat/ui/Composer.tsx +19 -3
- package/src/chat/ui/LimitState.tsx +4 -2
- package/src/chat/ui/PromptEditor.tsx +3 -1
- package/src/chat/ui/ReferenceChip.tsx +15 -5
- package/src/chat/ui/UnifiedDiff.tsx +12 -1
- package/src/chat/ui/composer/ComposerControls.tsx +1 -1
- package/src/chat/ui/composer/ComposerMenu.tsx +4 -2
- package/src/chat/ui/composer/chips.ts +15 -9
- package/src/chat/ui/composer/use-chat-controls.ts +4 -1
- package/src/chat/ui/diff/EditorEditDiff.tsx +9 -4
- package/src/chat/ui/diff/EditorPatchDiff.tsx +5 -1
- package/src/chat/ui/diff/diff-props.ts +3 -0
- package/src/chat/ui/reference-icons.ts +13 -1
- package/src/chat/ui/rows/MessageRows.tsx +35 -0
- package/src/chat/ui/rows/RowContainer.tsx +2 -2
- package/src/chat/ui/rows/Rows.tsx +3 -0
- package/src/chat/ui/rows/WorkflowRow.tsx +9 -4
- package/src/chat/ui/rows/row-rhythm.ts +12 -3
- package/src/chat/workflow-list.ts +65 -0
- package/src/host-hooks.ts +13 -0
- package/src/host.ts +23 -1
- package/src/index.ts +1 -0
- package/src/locales/en/agent-chat.ts +9 -0
- package/src/locales/en/agent-providers.ts +8 -3
- package/src/locales/nl/agent-chat.ts +9 -0
- package/src/locales/nl/agent-providers.ts +8 -3
- package/src/providers/AccountOrderList.tsx +124 -0
- package/src/providers/CliDetail.tsx +33 -28
- package/src/providers/account-actions.ts +30 -0
- package/src/providers/index.ts +11 -1
- package/src/usage/limit-groups.ts +8 -1
|
@@ -4,8 +4,9 @@ import clsx from 'clsx';
|
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { CircleOff } from 'lucide-react';
|
|
6
6
|
import { Icon } from '@adecore/ui';
|
|
7
|
+
import { useChatHost } from '../../host.js';
|
|
7
8
|
import { REFERENCE_GONE_TONE, REFERENCE_TONE, TOKEN_ICON, TOKEN_IN_MESSAGE } from './chips.js';
|
|
8
|
-
import {
|
|
9
|
+
import { referenceGlyph } from './reference-icons.js';
|
|
9
10
|
import { ReferenceLookupContext } from './reference-lookup.js';
|
|
10
11
|
/*
|
|
11
12
|
* One token in the transcript. One that opens is a span with a button's role rather than a button,
|
|
@@ -124,11 +125,15 @@ export function TokenChip(t0) {
|
|
|
124
125
|
}
|
|
125
126
|
return t9;
|
|
126
127
|
}
|
|
127
|
-
/*
|
|
128
|
+
/*
|
|
129
|
+
* A view, node or chat a message points at, under the name it has now. One that went says so, under
|
|
130
|
+
* `lastName` when the message knows what it was called.
|
|
131
|
+
*/
|
|
128
132
|
export function ReferenceChip(t0) {
|
|
129
|
-
const $ = _c(
|
|
133
|
+
const $ = _c(37);
|
|
130
134
|
const {
|
|
131
|
-
id
|
|
135
|
+
id,
|
|
136
|
+
lastName
|
|
132
137
|
} = t0;
|
|
133
138
|
const {
|
|
134
139
|
t
|
|
@@ -137,119 +142,149 @@ export function ReferenceChip(t0) {
|
|
|
137
142
|
items,
|
|
138
143
|
open
|
|
139
144
|
} = useContext(ReferenceLookupContext);
|
|
145
|
+
const {
|
|
146
|
+
ReferenceIcon
|
|
147
|
+
} = useChatHost();
|
|
148
|
+
let T0;
|
|
149
|
+
let item;
|
|
140
150
|
let t1;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
let t2;
|
|
152
|
+
let t3;
|
|
153
|
+
let t4;
|
|
154
|
+
let t5;
|
|
155
|
+
if ($[0] !== ReferenceIcon || $[1] !== id || $[2] !== items || $[3] !== lastName || $[4] !== t) {
|
|
156
|
+
t5 = Symbol.for("react.early_return_sentinel");
|
|
157
|
+
bb0: {
|
|
158
|
+
let t6;
|
|
159
|
+
if ($[12] !== id) {
|
|
160
|
+
t6 = candidate => candidate.id === id;
|
|
161
|
+
$[12] = id;
|
|
162
|
+
$[13] = t6;
|
|
163
|
+
} else {
|
|
164
|
+
t6 = $[13];
|
|
165
|
+
}
|
|
166
|
+
item = items.find(t6);
|
|
167
|
+
if (item === undefined) {
|
|
168
|
+
let t7;
|
|
169
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
170
|
+
t7 = /*#__PURE__*/_jsx(Icon, {
|
|
171
|
+
icon: CircleOff,
|
|
172
|
+
size: 14,
|
|
173
|
+
className: TOKEN_ICON
|
|
174
|
+
});
|
|
175
|
+
$[14] = t7;
|
|
176
|
+
} else {
|
|
177
|
+
t7 = $[14];
|
|
178
|
+
}
|
|
179
|
+
let t8;
|
|
180
|
+
if ($[15] !== lastName || $[16] !== t) {
|
|
181
|
+
t8 = lastName || t("references.gone");
|
|
182
|
+
$[15] = lastName;
|
|
183
|
+
$[16] = t;
|
|
184
|
+
$[17] = t8;
|
|
185
|
+
} else {
|
|
186
|
+
t8 = $[17];
|
|
187
|
+
}
|
|
188
|
+
let t9;
|
|
189
|
+
if ($[18] !== t8) {
|
|
190
|
+
t9 = /*#__PURE__*/_jsx(TokenChip, {
|
|
191
|
+
kind: "gone",
|
|
192
|
+
icon: t7,
|
|
193
|
+
label: t8,
|
|
194
|
+
tone: REFERENCE_GONE_TONE
|
|
195
|
+
});
|
|
196
|
+
$[18] = t8;
|
|
197
|
+
$[19] = t9;
|
|
198
|
+
} else {
|
|
199
|
+
t9 = $[19];
|
|
200
|
+
}
|
|
201
|
+
t5 = t9;
|
|
202
|
+
break bb0;
|
|
203
|
+
}
|
|
204
|
+
T0 = TokenChip;
|
|
205
|
+
t1 = "reference";
|
|
206
|
+
t2 = item.id;
|
|
207
|
+
t3 = "#";
|
|
208
|
+
t4 = referenceGlyph(ReferenceIcon, {
|
|
209
|
+
id: item.id,
|
|
210
|
+
kind: item.kind,
|
|
163
211
|
size: 14,
|
|
164
212
|
className: TOKEN_ICON
|
|
165
213
|
});
|
|
166
|
-
$[5] = t2;
|
|
167
|
-
} else {
|
|
168
|
-
t2 = $[5];
|
|
169
|
-
}
|
|
170
|
-
let t3;
|
|
171
|
-
if ($[6] !== t) {
|
|
172
|
-
t3 = t("references.gone");
|
|
173
|
-
$[6] = t;
|
|
174
|
-
$[7] = t3;
|
|
175
|
-
} else {
|
|
176
|
-
t3 = $[7];
|
|
177
|
-
}
|
|
178
|
-
let t4;
|
|
179
|
-
if ($[8] !== t3) {
|
|
180
|
-
t4 = /*#__PURE__*/_jsx(TokenChip, {
|
|
181
|
-
kind: "gone",
|
|
182
|
-
icon: t2,
|
|
183
|
-
label: t3,
|
|
184
|
-
tone: REFERENCE_GONE_TONE
|
|
185
|
-
});
|
|
186
|
-
$[8] = t3;
|
|
187
|
-
$[9] = t4;
|
|
188
|
-
} else {
|
|
189
|
-
t4 = $[9];
|
|
190
214
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
$[
|
|
203
|
-
$[11] = t4;
|
|
215
|
+
$[0] = ReferenceIcon;
|
|
216
|
+
$[1] = id;
|
|
217
|
+
$[2] = items;
|
|
218
|
+
$[3] = lastName;
|
|
219
|
+
$[4] = t;
|
|
220
|
+
$[5] = T0;
|
|
221
|
+
$[6] = item;
|
|
222
|
+
$[7] = t1;
|
|
223
|
+
$[8] = t2;
|
|
224
|
+
$[9] = t3;
|
|
225
|
+
$[10] = t4;
|
|
226
|
+
$[11] = t5;
|
|
204
227
|
} else {
|
|
205
|
-
|
|
228
|
+
T0 = $[5];
|
|
229
|
+
item = $[6];
|
|
230
|
+
t1 = $[7];
|
|
231
|
+
t2 = $[8];
|
|
232
|
+
t3 = $[9];
|
|
233
|
+
t4 = $[10];
|
|
234
|
+
t5 = $[11];
|
|
206
235
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
t5 = item.name || t("references.untitled");
|
|
210
|
-
$[12] = item.name;
|
|
211
|
-
$[13] = t;
|
|
212
|
-
$[14] = t5;
|
|
213
|
-
} else {
|
|
214
|
-
t5 = $[14];
|
|
236
|
+
if (t5 !== Symbol.for("react.early_return_sentinel")) {
|
|
237
|
+
return t5;
|
|
215
238
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
239
|
+
let t6;
|
|
240
|
+
if ($[20] !== item.name || $[21] !== t) {
|
|
241
|
+
t6 = item.name || t("references.untitled");
|
|
242
|
+
$[20] = item.name;
|
|
243
|
+
$[21] = t;
|
|
244
|
+
$[22] = t6;
|
|
222
245
|
} else {
|
|
223
|
-
|
|
246
|
+
t6 = $[22];
|
|
224
247
|
}
|
|
248
|
+
const t7 = open !== null && "hover:bg-text/12";
|
|
225
249
|
let t8;
|
|
226
|
-
if ($[
|
|
227
|
-
t8 =
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[19] = t8;
|
|
250
|
+
if ($[23] !== t7) {
|
|
251
|
+
t8 = clsx(REFERENCE_TONE, t7);
|
|
252
|
+
$[23] = t7;
|
|
253
|
+
$[24] = t8;
|
|
231
254
|
} else {
|
|
232
|
-
t8 = $[
|
|
255
|
+
t8 = $[24];
|
|
233
256
|
}
|
|
234
257
|
let t9;
|
|
235
|
-
if ($[
|
|
236
|
-
t9 =
|
|
237
|
-
|
|
258
|
+
if ($[25] !== item.id || $[26] !== open) {
|
|
259
|
+
t9 = open === null ? undefined : () => open(item.id);
|
|
260
|
+
$[25] = item.id;
|
|
261
|
+
$[26] = open;
|
|
262
|
+
$[27] = t9;
|
|
263
|
+
} else {
|
|
264
|
+
t9 = $[27];
|
|
265
|
+
}
|
|
266
|
+
let t10;
|
|
267
|
+
if ($[28] !== T0 || $[29] !== t1 || $[30] !== t2 || $[31] !== t3 || $[32] !== t4 || $[33] !== t6 || $[34] !== t8 || $[35] !== t9) {
|
|
268
|
+
t10 = /*#__PURE__*/_jsx(T0, {
|
|
269
|
+
kind: t1,
|
|
238
270
|
value: t2,
|
|
239
|
-
sigil:
|
|
271
|
+
sigil: t3,
|
|
240
272
|
icon: t4,
|
|
241
|
-
label:
|
|
242
|
-
tone:
|
|
243
|
-
onOpen:
|
|
273
|
+
label: t6,
|
|
274
|
+
tone: t8,
|
|
275
|
+
onOpen: t9
|
|
244
276
|
});
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
277
|
+
$[28] = T0;
|
|
278
|
+
$[29] = t1;
|
|
279
|
+
$[30] = t2;
|
|
280
|
+
$[31] = t3;
|
|
281
|
+
$[32] = t4;
|
|
282
|
+
$[33] = t6;
|
|
283
|
+
$[34] = t8;
|
|
284
|
+
$[35] = t9;
|
|
285
|
+
$[36] = t10;
|
|
251
286
|
} else {
|
|
252
|
-
|
|
287
|
+
t10 = $[36];
|
|
253
288
|
}
|
|
254
|
-
return
|
|
289
|
+
return t10;
|
|
255
290
|
}
|
|
@@ -14,7 +14,7 @@ const LegacyUnifiedDiff = lazyNamed(() => import('./diff/LegacyUnifiedDiff.js'),
|
|
|
14
14
|
});
|
|
15
15
|
const EditorPatchDiff = lazyNamed(() => import('./diff/EditorPatchDiff.js'), 'default');
|
|
16
16
|
export default function UnifiedDiff(props) {
|
|
17
|
-
const $ = _c(
|
|
17
|
+
const $ = _c(62);
|
|
18
18
|
const host = useChatHost();
|
|
19
19
|
const {
|
|
20
20
|
t
|
|
@@ -27,7 +27,8 @@ export default function UnifiedDiff(props) {
|
|
|
27
27
|
overflow: t2,
|
|
28
28
|
diffStyle: t3,
|
|
29
29
|
fill: t4,
|
|
30
|
-
maxHeight
|
|
30
|
+
maxHeight,
|
|
31
|
+
onSource
|
|
31
32
|
} = props;
|
|
32
33
|
const allowEditor = t0 === undefined ? true : t0;
|
|
33
34
|
const ignoreWhitespace = t1 === undefined ? false : t1;
|
|
@@ -190,7 +191,7 @@ export default function UnifiedDiff(props) {
|
|
|
190
191
|
}
|
|
191
192
|
const t15 = overflow === "wrap";
|
|
192
193
|
let t16;
|
|
193
|
-
if ($[44] !== change || $[45] !== contents || $[46] !== diffStyle || $[47] !== fill || $[48] !== ignoreWhitespace || $[49] !== loadEngine || $[50] !== maxHeight || $[51] !==
|
|
194
|
+
if ($[44] !== change || $[45] !== contents || $[46] !== diffStyle || $[47] !== fill || $[48] !== ignoreWhitespace || $[49] !== loadEngine || $[50] !== maxHeight || $[51] !== onSource || $[52] !== t15 || $[53] !== unavailable) {
|
|
194
195
|
t16 = /*#__PURE__*/_jsx(EditorPatchDiff, {
|
|
195
196
|
change: change,
|
|
196
197
|
sourceChecked: true,
|
|
@@ -201,7 +202,8 @@ export default function UnifiedDiff(props) {
|
|
|
201
202
|
maxHeight: maxHeight,
|
|
202
203
|
layout: diffStyle,
|
|
203
204
|
loadEngine: loadEngine,
|
|
204
|
-
fallback: unavailable
|
|
205
|
+
fallback: unavailable,
|
|
206
|
+
onSource: onSource
|
|
205
207
|
});
|
|
206
208
|
$[44] = change;
|
|
207
209
|
$[45] = contents;
|
|
@@ -210,37 +212,38 @@ export default function UnifiedDiff(props) {
|
|
|
210
212
|
$[48] = ignoreWhitespace;
|
|
211
213
|
$[49] = loadEngine;
|
|
212
214
|
$[50] = maxHeight;
|
|
213
|
-
$[51] =
|
|
214
|
-
$[52] =
|
|
215
|
-
$[53] =
|
|
215
|
+
$[51] = onSource;
|
|
216
|
+
$[52] = t15;
|
|
217
|
+
$[53] = unavailable;
|
|
218
|
+
$[54] = t16;
|
|
216
219
|
} else {
|
|
217
|
-
t16 = $[
|
|
220
|
+
t16 = $[54];
|
|
218
221
|
}
|
|
219
222
|
let t17;
|
|
220
|
-
if ($[
|
|
223
|
+
if ($[55] !== t14 || $[56] !== t16) {
|
|
221
224
|
t17 = /*#__PURE__*/_jsx(LazyBoundary, {
|
|
222
225
|
fallback: t14,
|
|
223
226
|
children: t16
|
|
224
227
|
});
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
+
$[55] = t14;
|
|
229
|
+
$[56] = t16;
|
|
230
|
+
$[57] = t17;
|
|
228
231
|
} else {
|
|
229
|
-
t17 = $[
|
|
232
|
+
t17 = $[57];
|
|
230
233
|
}
|
|
231
234
|
let t18;
|
|
232
|
-
if ($[
|
|
235
|
+
if ($[58] !== t12 || $[59] !== t17 || $[60] !== unavailable) {
|
|
233
236
|
t18 = /*#__PURE__*/_jsx(DiffFallbackBoundary, {
|
|
234
237
|
fallback: unavailable,
|
|
235
238
|
resetKeys: t12,
|
|
236
239
|
children: t17
|
|
237
240
|
});
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
241
|
+
$[58] = t12;
|
|
242
|
+
$[59] = t17;
|
|
243
|
+
$[60] = unavailable;
|
|
244
|
+
$[61] = t18;
|
|
242
245
|
} else {
|
|
243
|
-
t18 = $[
|
|
246
|
+
t18 = $[61];
|
|
244
247
|
}
|
|
245
248
|
return t18;
|
|
246
249
|
}
|
|
@@ -240,7 +240,7 @@ export function ComposerControls(t0) {
|
|
|
240
240
|
const scope = useChatScope();
|
|
241
241
|
const Slot = useChatHost().ComposerSlot;
|
|
242
242
|
const providers = useProviders(_temp);
|
|
243
|
-
const accountChoice = useAccountChoice(info.provider, info.account);
|
|
243
|
+
const accountChoice = useAccountChoice(info.provider, info.account, chatId);
|
|
244
244
|
const fileInputRef = useRef(null);
|
|
245
245
|
const busy = info.activeTurnId !== null;
|
|
246
246
|
let t1;
|
|
@@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { SquareSlash, Zap } from 'lucide-react';
|
|
5
5
|
import { FileIcon, Icon, Menu, MiddleTruncate } from '@adecore/ui';
|
|
6
|
-
import {
|
|
6
|
+
import { useChatHost } from '../../../host.js';
|
|
7
|
+
import { referenceGlyph } from '../reference-icons.js';
|
|
7
8
|
import { optionIdOf } from './menu-aria.js';
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
function splitPath(path) {
|
|
@@ -298,19 +299,22 @@ function MentionMenu(t0) {
|
|
|
298
299
|
}
|
|
299
300
|
/* The views, nodes and chats a `#` offers, what stands on this canvas first, each with its kind or what tells it apart. */
|
|
300
301
|
function ReferenceMenu(t0) {
|
|
301
|
-
const $ = _c(
|
|
302
|
+
const $ = _c(6);
|
|
302
303
|
const {
|
|
303
304
|
menus
|
|
304
305
|
} = t0;
|
|
305
306
|
const {
|
|
306
307
|
t
|
|
307
308
|
} = useTranslation("agent-chat");
|
|
309
|
+
const {
|
|
310
|
+
ReferenceIcon
|
|
311
|
+
} = useChatHost();
|
|
308
312
|
const {
|
|
309
313
|
listId,
|
|
310
314
|
referenceMatches
|
|
311
315
|
} = menus;
|
|
312
316
|
let t1;
|
|
313
|
-
if ($[0] !==
|
|
317
|
+
if ($[0] !== ReferenceIcon || $[1] !== listId || $[2] !== menus || $[3] !== referenceMatches || $[4] !== t) {
|
|
314
318
|
const groups = ["canvas", "views"].map(group => ({
|
|
315
319
|
group,
|
|
316
320
|
items: referenceMatches.filter(item => item.group === group)
|
|
@@ -339,8 +343,9 @@ function ReferenceMenu(t0) {
|
|
|
339
343
|
index: index,
|
|
340
344
|
className: "items-center",
|
|
341
345
|
onPick: () => menus.chooseReference(item_0),
|
|
342
|
-
children: [
|
|
343
|
-
|
|
346
|
+
children: [referenceGlyph(ReferenceIcon, {
|
|
347
|
+
id: item_0.id,
|
|
348
|
+
kind: item_0.kind,
|
|
344
349
|
size: 14,
|
|
345
350
|
className: "shrink-0 text-text-faint"
|
|
346
351
|
}), /*#__PURE__*/_jsx("span", {
|
|
@@ -359,13 +364,14 @@ function ReferenceMenu(t0) {
|
|
|
359
364
|
children: t("composer.references.noMatch")
|
|
360
365
|
})
|
|
361
366
|
});
|
|
362
|
-
$[0] =
|
|
363
|
-
$[1] =
|
|
364
|
-
$[2] =
|
|
365
|
-
$[3] =
|
|
366
|
-
$[4] =
|
|
367
|
+
$[0] = ReferenceIcon;
|
|
368
|
+
$[1] = listId;
|
|
369
|
+
$[2] = menus;
|
|
370
|
+
$[3] = referenceMatches;
|
|
371
|
+
$[4] = t;
|
|
372
|
+
$[5] = t1;
|
|
367
373
|
} else {
|
|
368
|
-
t1 = $[
|
|
374
|
+
t1 = $[5];
|
|
369
375
|
}
|
|
370
376
|
return t1;
|
|
371
377
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
1
2
|
import { type Extension } from '@codemirror/state';
|
|
3
|
+
import type { ReferenceIconProps } from '../../../host.js';
|
|
2
4
|
import type { ReferableKind } from '../../chat-references.js';
|
|
3
5
|
import { type ReferenceToken } from '../../mentions.js';
|
|
4
6
|
export interface ChipChoices {
|
|
@@ -7,5 +9,6 @@ export interface ChipChoices {
|
|
|
7
9
|
references?: ReadonlyArray<ReferenceToken & {
|
|
8
10
|
kind: ReferableKind | null;
|
|
9
11
|
}>;
|
|
12
|
+
referenceIcon?: ComponentType<ReferenceIconProps> | null;
|
|
10
13
|
}
|
|
11
14
|
export declare function chipDecorations(value: ChipChoices): Extension;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { createElement } from 'react';
|
|
2
1
|
import { createRoot } from 'react-dom/client';
|
|
3
2
|
import { syntaxTree } from '@codemirror/language';
|
|
4
3
|
import { Facet, StateField } from '@codemirror/state';
|
|
5
4
|
import { Decoration, EditorView, WidgetType } from '@codemirror/view';
|
|
6
|
-
import { Icon } from '@adecore/ui';
|
|
7
5
|
import { chipRanges } from '../../mentions.js';
|
|
8
6
|
import { CHIP_IN_EDITOR, MENTION_TONE, REFERENCE_TONE, SKILL_TONE, TOKEN_ICON_IN_EDITOR } from '../chips.js';
|
|
9
|
-
import {
|
|
7
|
+
import { referenceGlyph } from '../reference-icons.js';
|
|
10
8
|
import { codeRanges } from './editor.js';
|
|
11
9
|
const NO_CHOICES = {
|
|
12
10
|
mentions: [],
|
|
@@ -27,22 +25,27 @@ const referenceMark = Decoration.mark({
|
|
|
27
25
|
inclusiveStart: true
|
|
28
26
|
});
|
|
29
27
|
const roots = new WeakMap();
|
|
30
|
-
/* The
|
|
28
|
+
/* The reference's mark in place of the `#`, the way a sent message draws it. */
|
|
31
29
|
class ReferenceIcon extends WidgetType {
|
|
30
|
+
id;
|
|
32
31
|
kind;
|
|
33
|
-
|
|
32
|
+
hostIcon;
|
|
33
|
+
constructor(id, kind, hostIcon) {
|
|
34
34
|
super();
|
|
35
|
+
this.id = id;
|
|
35
36
|
this.kind = kind;
|
|
37
|
+
this.hostIcon = hostIcon;
|
|
36
38
|
}
|
|
37
39
|
eq(other) {
|
|
38
|
-
return other.kind === this.kind;
|
|
40
|
+
return other.id === this.id && other.kind === this.kind && other.hostIcon === this.hostIcon;
|
|
39
41
|
}
|
|
40
42
|
toDOM() {
|
|
41
43
|
const holder = document.createElement('span');
|
|
42
44
|
holder.className = TOKEN_ICON_IN_EDITOR;
|
|
43
45
|
const root = createRoot(holder);
|
|
44
|
-
root.render(
|
|
45
|
-
|
|
46
|
+
root.render(referenceGlyph(this.hostIcon, {
|
|
47
|
+
id: this.id,
|
|
48
|
+
kind: this.kind,
|
|
46
49
|
size: 12
|
|
47
50
|
}));
|
|
48
51
|
roots.set(holder, root);
|
|
@@ -59,7 +62,8 @@ function chipMarks(state) {
|
|
|
59
62
|
const {
|
|
60
63
|
mentions,
|
|
61
64
|
skills,
|
|
62
|
-
references = []
|
|
65
|
+
references = [],
|
|
66
|
+
referenceIcon = null
|
|
63
67
|
} = state.facet(choices);
|
|
64
68
|
const kinds = new Map(references.map(token => [token.id, token.kind]));
|
|
65
69
|
const marks = [];
|
|
@@ -73,7 +77,7 @@ function chipMarks(state) {
|
|
|
73
77
|
const kind = kinds.get(range.value);
|
|
74
78
|
if (kind !== undefined && kind !== null) {
|
|
75
79
|
marks.push(Decoration.replace({
|
|
76
|
-
widget: new ReferenceIcon(kind)
|
|
80
|
+
widget: new ReferenceIcon(range.value, kind, referenceIcon)
|
|
77
81
|
}).range(range.from, range.from + 1));
|
|
78
82
|
}
|
|
79
83
|
}
|