@adecore/agents-react 0.67.1 → 0.69.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/AgentIcon.d.ts +7 -0
- package/dist/agents/AgentIcon.js +70 -31
- package/dist/chat/logic/timeline.d.ts +2 -0
- package/dist/chat/logic/timeline.js +47 -0
- package/dist/chat/subagent-list.d.ts +1 -2
- package/dist/chat/ui/Composer.js +491 -447
- package/dist/chat/ui/Markdown.d.ts +1 -1
- package/dist/chat/ui/Markdown.js +277 -203
- package/dist/chat/ui/PromptEditor.d.ts +3 -1
- package/dist/chat/ui/PromptEditor.js +4 -1
- package/dist/chat/ui/Timeline.js +5 -4
- package/dist/chat/ui/composer/ComposerMenu.js +22 -12
- package/dist/chat/ui/composer/chips.d.ts +2 -1
- package/dist/chat/ui/composer/chips.js +44 -1
- package/dist/chat/ui/composer/key-handler.d.ts +2 -0
- package/dist/chat/ui/composer/key-handler.js +12 -2
- package/dist/chat/ui/composer/placeholder.d.ts +2 -1
- package/dist/chat/ui/composer/placeholder.js +31 -10
- package/dist/chat/ui/composer/use-composer-menus.js +49 -39
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +10 -7
- package/dist/chat/ui/composer/use-prompt-menus.js +183 -157
- package/dist/chat/ui/composer/use-prompt-suggestion.d.ts +16 -0
- package/dist/chat/ui/composer/use-prompt-suggestion.js +55 -0
- package/dist/chat/ui/index.d.ts +1 -1
- package/dist/chat/ui/index.js +1 -1
- package/dist/chat/ui/markdown-cache.d.ts +4 -0
- package/dist/chat/ui/markdown-cache.js +47 -0
- package/dist/chat/ui/reference-lookup.d.ts +2 -1
- package/dist/chat/ui/reference-lookup.js +1 -1
- package/dist/chat/ui/rows/SubagentRow.js +26 -24
- package/dist/chat/ui/rows/TaskRow.d.ts +11 -1
- package/dist/chat/ui/rows/TaskRow.js +281 -197
- package/dist/chat/ui/thread-references.js +12 -9
- package/dist/chat-client.d.ts +3 -1
- package/dist/chat-client.js +82 -30
- package/dist/chat-sink.d.ts +1 -0
- package/dist/host/host-hooks.d.ts +4 -1
- package/dist/host/host-hooks.js +11 -0
- package/dist/host/host.d.ts +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +1 -0
- package/dist/locales/en/agent-chat.js +2 -1
- package/dist/locales/nl/agent-chat.d.ts +1 -0
- package/dist/locales/nl/agent-chat.js +2 -1
- package/dist/state/chats.d.ts +2 -0
- package/dist/state/chats.js +21 -5
- package/dist/theme.css +6 -0
- package/package.json +9 -9
- package/src/agents/AgentIcon.tsx +6 -2
- package/src/chat/logic/timeline.ts +63 -0
- package/src/chat/subagent-list.ts +1 -4
- package/src/chat/ui/Composer.tsx +15 -2
- package/src/chat/ui/Markdown.tsx +97 -55
- package/src/chat/ui/PromptEditor.tsx +7 -2
- package/src/chat/ui/Timeline.tsx +17 -14
- package/src/chat/ui/composer/ComposerMenu.tsx +14 -6
- package/src/chat/ui/composer/chips.ts +51 -2
- package/src/chat/ui/composer/key-handler.ts +17 -2
- package/src/chat/ui/composer/placeholder.ts +14 -3
- package/src/chat/ui/composer/use-composer-menus.ts +8 -3
- package/src/chat/ui/composer/use-prompt-menus.ts +33 -4
- package/src/chat/ui/composer/use-prompt-suggestion.ts +36 -0
- package/src/chat/ui/index.ts +1 -1
- package/src/chat/ui/markdown-cache.ts +60 -0
- package/src/chat/ui/reference-lookup.ts +4 -2
- package/src/chat/ui/rows/SubagentRow.tsx +1 -1
- package/src/chat/ui/rows/TaskRow.tsx +54 -9
- package/src/chat/ui/thread-references.ts +4 -2
- package/src/chat-client.ts +79 -22
- package/src/chat-sink.ts +6 -1
- package/src/host/host-hooks.ts +19 -1
- package/src/host/host.ts +41 -0
- package/src/index.ts +3 -0
- package/src/locales/en/agent-chat.ts +2 -1
- package/src/locales/nl/agent-chat.ts +2 -1
- package/src/state/chats.ts +22 -6
- package/src/theme.css +6 -0
|
@@ -21,6 +21,24 @@ const SEARCH_DEBOUNCE_MS = 80;
|
|
|
21
21
|
const MENTION_RESULTS = 8;
|
|
22
22
|
const REFERENCE_RESULTS = 20;
|
|
23
23
|
const NO_COMMANDS = [];
|
|
24
|
+
const NO_HOST_SKILLS = [];
|
|
25
|
+
const SKILL_RESULTS = 8;
|
|
26
|
+
/* The host's skills first, found by title or name, then the CLI's; a CLI skill under a host skill's name is the host's. */
|
|
27
|
+
function skillMatchesOf(query, skills, hostSkills) {
|
|
28
|
+
const wanted = query.toLowerCase();
|
|
29
|
+
const own = new Set(hostSkills.map(skill => skill.name));
|
|
30
|
+
const hosted = hostSkills.filter(skill => skill.title.toLowerCase().includes(wanted) || skill.name.toLowerCase().includes(wanted)).map(skill => ({
|
|
31
|
+
name: skill.name,
|
|
32
|
+
description: skill.description,
|
|
33
|
+
host: skill
|
|
34
|
+
}));
|
|
35
|
+
const cli = skills.filter(skill => !own.has(skill.name) && skill.name.toLowerCase().includes(wanted)).map(skill => ({
|
|
36
|
+
name: skill.name,
|
|
37
|
+
description: skill.description,
|
|
38
|
+
host: null
|
|
39
|
+
}));
|
|
40
|
+
return [...hosted, ...cli].slice(0, SKILL_RESULTS);
|
|
41
|
+
}
|
|
24
42
|
function sameQuery(left, right) {
|
|
25
43
|
return left?.start === right?.start && left?.query === right?.query;
|
|
26
44
|
}
|
|
@@ -30,30 +48,32 @@ function sameQuery(left, right) {
|
|
|
30
48
|
* follow that one.
|
|
31
49
|
*/
|
|
32
50
|
export function usePromptMenus(t0) {
|
|
33
|
-
const $ = _c(
|
|
51
|
+
const $ = _c(121);
|
|
34
52
|
const {
|
|
35
53
|
draft: t1,
|
|
36
54
|
inputRef,
|
|
37
55
|
cwd,
|
|
38
56
|
skills,
|
|
57
|
+
hostSkills: t2,
|
|
39
58
|
slashCommands,
|
|
40
|
-
localCommands:
|
|
59
|
+
localCommands: t3,
|
|
41
60
|
goals,
|
|
42
61
|
providerName,
|
|
43
62
|
referables,
|
|
44
63
|
ownId,
|
|
45
64
|
label,
|
|
46
|
-
accountRule:
|
|
47
|
-
home:
|
|
65
|
+
accountRule: t4,
|
|
66
|
+
home: t5
|
|
48
67
|
} = t0;
|
|
49
68
|
const {
|
|
50
69
|
draft,
|
|
51
70
|
setDraft,
|
|
52
71
|
setText
|
|
53
72
|
} = t1;
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
73
|
+
const hostSkills = t2 === undefined ? NO_HOST_SKILLS : t2;
|
|
74
|
+
const localCommands = t3 === undefined ? NO_COMMANDS : t3;
|
|
75
|
+
const accountRule = t4 === undefined ? null : t4;
|
|
76
|
+
const home = t5 === undefined ? null : t5;
|
|
57
77
|
const {
|
|
58
78
|
t
|
|
59
79
|
} = useTranslation("agent-chat");
|
|
@@ -71,10 +91,10 @@ export function usePromptMenus(t0) {
|
|
|
71
91
|
const reportedOf = useReportedModelsByProvider();
|
|
72
92
|
const namedLook = useNamedChipLookup(home);
|
|
73
93
|
const text = draft.text;
|
|
74
|
-
let t5;
|
|
75
94
|
let t6;
|
|
95
|
+
let t7;
|
|
76
96
|
if ($[0] !== cwd || $[1] !== mention || $[2] !== scope || $[3] !== searchFiles) {
|
|
77
|
-
|
|
97
|
+
t6 = () => {
|
|
78
98
|
if (mention === null || cwd === null) {
|
|
79
99
|
return;
|
|
80
100
|
}
|
|
@@ -105,36 +125,36 @@ export function usePromptMenus(t0) {
|
|
|
105
125
|
clearTimeout(timer);
|
|
106
126
|
};
|
|
107
127
|
};
|
|
108
|
-
|
|
128
|
+
t7 = [scope, cwd, mention, searchFiles];
|
|
109
129
|
$[0] = cwd;
|
|
110
130
|
$[1] = mention;
|
|
111
131
|
$[2] = scope;
|
|
112
132
|
$[3] = searchFiles;
|
|
113
|
-
$[4] =
|
|
114
|
-
$[5] =
|
|
133
|
+
$[4] = t6;
|
|
134
|
+
$[5] = t7;
|
|
115
135
|
} else {
|
|
116
|
-
|
|
117
|
-
|
|
136
|
+
t6 = $[4];
|
|
137
|
+
t7 = $[5];
|
|
118
138
|
}
|
|
119
|
-
useEffect(
|
|
139
|
+
useEffect(t6, t7);
|
|
120
140
|
const commandQuery = text.startsWith("/") && !text.includes("\n") ? text.slice(1).trim().toLowerCase() : null;
|
|
121
141
|
const expanding = useHostExpandingCommands();
|
|
122
|
-
let
|
|
142
|
+
let t8;
|
|
123
143
|
if ($[6] !== setText || $[7] !== text) {
|
|
124
|
-
|
|
144
|
+
t8 = command => {
|
|
125
145
|
const args = text.replace(/^\/\S*\s*/, "");
|
|
126
146
|
command.expand?.(args).then(expanded => setText(expanded));
|
|
127
147
|
};
|
|
128
148
|
$[6] = setText;
|
|
129
149
|
$[7] = text;
|
|
130
|
-
$[8] =
|
|
150
|
+
$[8] = t8;
|
|
131
151
|
} else {
|
|
132
|
-
|
|
152
|
+
t8 = $[8];
|
|
133
153
|
}
|
|
134
|
-
const expandInto =
|
|
135
|
-
let
|
|
154
|
+
const expandInto = t8;
|
|
155
|
+
let t9;
|
|
136
156
|
if ($[9] !== expanding || $[10] !== goals || $[11] !== localCommands || $[12] !== providerName || $[13] !== skills || $[14] !== slashCommands || $[15] !== t) {
|
|
137
|
-
|
|
157
|
+
t9 = query => {
|
|
138
158
|
const known = new Set(skills.map(_temp4));
|
|
139
159
|
const own = localCommands.map(name => ({
|
|
140
160
|
name,
|
|
@@ -166,33 +186,33 @@ export function usePromptMenus(t0) {
|
|
|
166
186
|
$[13] = skills;
|
|
167
187
|
$[14] = slashCommands;
|
|
168
188
|
$[15] = t;
|
|
169
|
-
$[16] =
|
|
189
|
+
$[16] = t9;
|
|
170
190
|
} else {
|
|
171
|
-
|
|
191
|
+
t9 = $[16];
|
|
172
192
|
}
|
|
173
|
-
const commandsOf =
|
|
193
|
+
const commandsOf = t9;
|
|
174
194
|
const commands = commandQuery === null ? [] : commandsOf(commandQuery);
|
|
175
|
-
const skillMatches = skillQuery === null ? [] :
|
|
195
|
+
const skillMatches = skillQuery === null ? [] : skillMatchesOf(skillQuery.query, skills, hostSkills);
|
|
176
196
|
const commandMenuOpen = commandQuery !== null && commands.length > 0;
|
|
177
197
|
const skillMenuOpen = !commandMenuOpen && skillQuery !== null && skillMatches.length > 0;
|
|
178
|
-
let
|
|
198
|
+
let t10;
|
|
179
199
|
if ($[17] !== cwd || $[18] !== mention || $[19] !== searched) {
|
|
180
|
-
|
|
200
|
+
t10 = mention === null || cwd === null ? [] : searched.files;
|
|
181
201
|
$[17] = cwd;
|
|
182
202
|
$[18] = mention;
|
|
183
203
|
$[19] = searched;
|
|
184
|
-
$[20] =
|
|
204
|
+
$[20] = t10;
|
|
185
205
|
} else {
|
|
186
|
-
|
|
206
|
+
t10 = $[20];
|
|
187
207
|
}
|
|
188
|
-
const files_0 =
|
|
208
|
+
const files_0 = t10;
|
|
189
209
|
let accountMatches;
|
|
190
210
|
let modelMatches;
|
|
191
|
-
let
|
|
211
|
+
let t11;
|
|
192
212
|
if ($[21] !== accountRule || $[22] !== accounts || $[23] !== mention || $[24] !== providers || $[25] !== reportedOf) {
|
|
193
213
|
modelMatches = mention === null ? [] : modelSuggestions(providers, accounts, mention.query, reportedOf);
|
|
194
214
|
accountMatches = mention === null ? [] : accountSuggestions(providers, accounts, accountRule, mention.query);
|
|
195
|
-
|
|
215
|
+
t11 = [...modelMatches, ...accountMatches];
|
|
196
216
|
$[21] = accountRule;
|
|
197
217
|
$[22] = accounts;
|
|
198
218
|
$[23] = mention;
|
|
@@ -200,28 +220,28 @@ export function usePromptMenus(t0) {
|
|
|
200
220
|
$[25] = reportedOf;
|
|
201
221
|
$[26] = accountMatches;
|
|
202
222
|
$[27] = modelMatches;
|
|
203
|
-
$[28] =
|
|
223
|
+
$[28] = t11;
|
|
204
224
|
} else {
|
|
205
225
|
accountMatches = $[26];
|
|
206
226
|
modelMatches = $[27];
|
|
207
|
-
|
|
227
|
+
t11 = $[28];
|
|
208
228
|
}
|
|
209
|
-
const named =
|
|
229
|
+
const named = t11;
|
|
210
230
|
const mentionMenuOpen = !commandMenuOpen && !skillMenuOpen && mention !== null && (cwd !== null || named.length > 0);
|
|
211
231
|
const mentionCount = files_0.length + named.length;
|
|
212
|
-
let
|
|
232
|
+
let t12;
|
|
213
233
|
if ($[29] !== referables.chatsOnly) {
|
|
214
|
-
|
|
234
|
+
t12 = item => !referables.chatsOnly || item.kind === "chat";
|
|
215
235
|
$[29] = referables.chatsOnly;
|
|
216
|
-
$[30] =
|
|
236
|
+
$[30] = t12;
|
|
217
237
|
} else {
|
|
218
|
-
|
|
238
|
+
t12 = $[30];
|
|
219
239
|
}
|
|
220
|
-
const offersReferences = referables.items.some(
|
|
240
|
+
const offersReferences = referables.items.some(t12);
|
|
221
241
|
const referenceMenuOpen = !commandMenuOpen && !skillMenuOpen && !mentionMenuOpen && referenceQuery !== null && offersReferences;
|
|
222
|
-
let
|
|
242
|
+
let t13;
|
|
223
243
|
if ($[31] !== referables.items) {
|
|
224
|
-
|
|
244
|
+
t13 = token => {
|
|
225
245
|
const item_0 = referables.items.find(candidate => candidate.id === token.id);
|
|
226
246
|
return {
|
|
227
247
|
...token,
|
|
@@ -230,11 +250,11 @@ export function usePromptMenus(t0) {
|
|
|
230
250
|
};
|
|
231
251
|
};
|
|
232
252
|
$[31] = referables.items;
|
|
233
|
-
$[32] =
|
|
253
|
+
$[32] = t13;
|
|
234
254
|
} else {
|
|
235
|
-
|
|
255
|
+
t13 = $[32];
|
|
236
256
|
}
|
|
237
|
-
const referenceChips = referenceTokens([...draft.chats, ...draft.references], referables.items, draft.referenceNames).map(
|
|
257
|
+
const referenceChips = referenceTokens([...draft.chats, ...draft.references], referables.items, draft.referenceNames).map(t13);
|
|
238
258
|
const picked = presentReferences(text, [...draft.chats, ...draft.references], referenceChips);
|
|
239
259
|
const excluded = ownId === undefined ? picked : [ownId, ...picked];
|
|
240
260
|
const referenceMatches = referenceMenuOpen ? referenceSuggestions(referables, referenceQuery.query, excluded, REFERENCE_RESULTS) : [];
|
|
@@ -249,15 +269,15 @@ export function usePromptMenus(t0) {
|
|
|
249
269
|
activeIndex,
|
|
250
270
|
count: menuCount
|
|
251
271
|
});
|
|
252
|
-
let
|
|
272
|
+
let t14;
|
|
253
273
|
if ($[33] !== draft.mentions || $[34] !== draft.skills || $[35] !== referenceChips) {
|
|
254
|
-
|
|
274
|
+
t14 = (value, selection, state) => {
|
|
255
275
|
const empty = selection.from === selection.to;
|
|
256
276
|
const tree = empty ? ensureSyntaxTree(state, selection.from, 50) ?? syntaxTree(state) : null;
|
|
257
277
|
const caret = tree !== null && !inCode(tree, value, selection.from) ? selection.from : null;
|
|
258
278
|
const chips = caret === null ? [] : withNamedChips(value, chipRanges(value, draft.mentions, draft.skills, [], referenceChips));
|
|
259
|
-
const
|
|
260
|
-
setSkillQuery(current => sameQuery(current,
|
|
279
|
+
const skill_0 = caret === null ? null : queryOutsideChips(findSkillQuery(value, caret), chips);
|
|
280
|
+
setSkillQuery(current => sameQuery(current, skill_0) ? current : skill_0);
|
|
261
281
|
const next = caret === null ? null : queryOutsideChips(findMentionQuery(value, caret), chips);
|
|
262
282
|
setMention(current_0 => sameQuery(current_0, next) ? current_0 : next);
|
|
263
283
|
const reference = caret === null ? null : queryOutsideChips(findReferenceQuery(value, caret), chips);
|
|
@@ -266,37 +286,37 @@ export function usePromptMenus(t0) {
|
|
|
266
286
|
$[33] = draft.mentions;
|
|
267
287
|
$[34] = draft.skills;
|
|
268
288
|
$[35] = referenceChips;
|
|
269
|
-
$[36] =
|
|
289
|
+
$[36] = t14;
|
|
270
290
|
} else {
|
|
271
|
-
|
|
291
|
+
t14 = $[36];
|
|
272
292
|
}
|
|
273
|
-
const trackTriggers =
|
|
274
|
-
let
|
|
293
|
+
const trackTriggers = t14;
|
|
294
|
+
let t15;
|
|
275
295
|
if ($[37] !== inputRef) {
|
|
276
|
-
|
|
296
|
+
t15 = caret_0 => {
|
|
277
297
|
requestAnimationFrame(() => inputRef.current?.setCaret(caret_0));
|
|
278
298
|
};
|
|
279
299
|
$[37] = inputRef;
|
|
280
|
-
$[38] =
|
|
300
|
+
$[38] = t15;
|
|
281
301
|
} else {
|
|
282
|
-
|
|
302
|
+
t15 = $[38];
|
|
283
303
|
}
|
|
284
|
-
const moveCaret =
|
|
285
|
-
let
|
|
304
|
+
const moveCaret = t15;
|
|
305
|
+
let t16;
|
|
286
306
|
if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
|
|
287
|
-
|
|
307
|
+
t16 = () => {
|
|
288
308
|
setMention(null);
|
|
289
309
|
setSkillQuery(null);
|
|
290
310
|
setReferenceQuery(null);
|
|
291
311
|
};
|
|
292
|
-
$[39] =
|
|
312
|
+
$[39] = t16;
|
|
293
313
|
} else {
|
|
294
|
-
|
|
314
|
+
t16 = $[39];
|
|
295
315
|
}
|
|
296
|
-
const close =
|
|
297
|
-
let
|
|
316
|
+
const close = t16;
|
|
317
|
+
let t17;
|
|
298
318
|
if ($[40] !== draft.mentions || $[41] !== mention || $[42] !== moveCaret || $[43] !== setText || $[44] !== text) {
|
|
299
|
-
|
|
319
|
+
t17 = path => {
|
|
300
320
|
if (!mention) {
|
|
301
321
|
return;
|
|
302
322
|
}
|
|
@@ -310,14 +330,14 @@ export function usePromptMenus(t0) {
|
|
|
310
330
|
$[42] = moveCaret;
|
|
311
331
|
$[43] = setText;
|
|
312
332
|
$[44] = text;
|
|
313
|
-
$[45] =
|
|
333
|
+
$[45] = t17;
|
|
314
334
|
} else {
|
|
315
|
-
|
|
335
|
+
t17 = $[45];
|
|
316
336
|
}
|
|
317
|
-
const chooseMention =
|
|
318
|
-
let
|
|
337
|
+
const chooseMention = t17;
|
|
338
|
+
let t18;
|
|
319
339
|
if ($[46] !== mention || $[47] !== moveCaret || $[48] !== setText || $[49] !== text) {
|
|
320
|
-
|
|
340
|
+
t18 = pick => {
|
|
321
341
|
if (!mention) {
|
|
322
342
|
return;
|
|
323
343
|
}
|
|
@@ -330,14 +350,14 @@ export function usePromptMenus(t0) {
|
|
|
330
350
|
$[47] = moveCaret;
|
|
331
351
|
$[48] = setText;
|
|
332
352
|
$[49] = text;
|
|
333
|
-
$[50] =
|
|
353
|
+
$[50] = t18;
|
|
334
354
|
} else {
|
|
335
|
-
|
|
355
|
+
t18 = $[50];
|
|
336
356
|
}
|
|
337
|
-
const chooseNamed =
|
|
338
|
-
let
|
|
357
|
+
const chooseNamed = t18;
|
|
358
|
+
let t19;
|
|
339
359
|
if ($[51] !== chooseMention || $[52] !== chooseNamed || $[53] !== files_0 || $[54] !== mention || $[55] !== named || $[56] !== searched) {
|
|
340
|
-
|
|
360
|
+
t19 = index => {
|
|
341
361
|
const pick_0 = mention === null ? null : mentionPick(index, {
|
|
342
362
|
query: searched.query,
|
|
343
363
|
files: files_0
|
|
@@ -357,14 +377,14 @@ export function usePromptMenus(t0) {
|
|
|
357
377
|
$[54] = mention;
|
|
358
378
|
$[55] = named;
|
|
359
379
|
$[56] = searched;
|
|
360
|
-
$[57] =
|
|
380
|
+
$[57] = t19;
|
|
361
381
|
} else {
|
|
362
|
-
|
|
382
|
+
t19 = $[57];
|
|
363
383
|
}
|
|
364
|
-
const chooseMentionAt =
|
|
365
|
-
let
|
|
384
|
+
const chooseMentionAt = t19;
|
|
385
|
+
let t20;
|
|
366
386
|
if ($[58] !== moveCaret || $[59] !== referenceQuery || $[60] !== setDraft || $[61] !== setText || $[62] !== text) {
|
|
367
|
-
|
|
387
|
+
t20 = item_1 => {
|
|
368
388
|
if (!referenceQuery) {
|
|
369
389
|
return;
|
|
370
390
|
}
|
|
@@ -394,14 +414,14 @@ export function usePromptMenus(t0) {
|
|
|
394
414
|
$[60] = setDraft;
|
|
395
415
|
$[61] = setText;
|
|
396
416
|
$[62] = text;
|
|
397
|
-
$[63] =
|
|
417
|
+
$[63] = t20;
|
|
398
418
|
} else {
|
|
399
|
-
|
|
419
|
+
t20 = $[63];
|
|
400
420
|
}
|
|
401
|
-
const chooseReference =
|
|
402
|
-
let
|
|
421
|
+
const chooseReference = t20;
|
|
422
|
+
let t21;
|
|
403
423
|
if ($[64] !== chooseReference || $[65] !== referenceMatches) {
|
|
404
|
-
|
|
424
|
+
t21 = index_0 => {
|
|
405
425
|
const item_2 = referenceMatches[index_0] ?? referenceMatches[0];
|
|
406
426
|
if (item_2 !== undefined) {
|
|
407
427
|
chooseReference(item_2);
|
|
@@ -409,14 +429,14 @@ export function usePromptMenus(t0) {
|
|
|
409
429
|
};
|
|
410
430
|
$[64] = chooseReference;
|
|
411
431
|
$[65] = referenceMatches;
|
|
412
|
-
$[66] =
|
|
432
|
+
$[66] = t21;
|
|
413
433
|
} else {
|
|
414
|
-
|
|
434
|
+
t21 = $[66];
|
|
415
435
|
}
|
|
416
|
-
const chooseReferenceAt =
|
|
417
|
-
let
|
|
436
|
+
const chooseReferenceAt = t21;
|
|
437
|
+
let t22;
|
|
418
438
|
if ($[67] !== draft.mentions || $[68] !== draft.skills || $[69] !== moveCaret || $[70] !== setText || $[71] !== skillQuery || $[72] !== text) {
|
|
419
|
-
|
|
439
|
+
t22 = name_2 => {
|
|
420
440
|
const result_2 = skillQuery ? insertSkill(text, skillQuery, name_2) : {
|
|
421
441
|
text: `$${name_2} `,
|
|
422
442
|
caret: name_2.length + 2
|
|
@@ -431,14 +451,14 @@ export function usePromptMenus(t0) {
|
|
|
431
451
|
$[70] = setText;
|
|
432
452
|
$[71] = skillQuery;
|
|
433
453
|
$[72] = text;
|
|
434
|
-
$[73] =
|
|
454
|
+
$[73] = t22;
|
|
435
455
|
} else {
|
|
436
|
-
|
|
456
|
+
t22 = $[73];
|
|
437
457
|
}
|
|
438
|
-
const chooseSkill =
|
|
439
|
-
let
|
|
458
|
+
const chooseSkill = t22;
|
|
459
|
+
let t23;
|
|
440
460
|
if ($[74] !== chooseSkill || $[75] !== expandInto || $[76] !== inputRef || $[77] !== setText) {
|
|
441
|
-
|
|
461
|
+
t23 = (command_2, index_1) => {
|
|
442
462
|
setMenuIndex(index_1);
|
|
443
463
|
if (command_2.expand !== undefined) {
|
|
444
464
|
expandInto(command_2);
|
|
@@ -455,14 +475,14 @@ export function usePromptMenus(t0) {
|
|
|
455
475
|
$[75] = expandInto;
|
|
456
476
|
$[76] = inputRef;
|
|
457
477
|
$[77] = setText;
|
|
458
|
-
$[78] =
|
|
478
|
+
$[78] = t23;
|
|
459
479
|
} else {
|
|
460
|
-
|
|
480
|
+
t23 = $[78];
|
|
461
481
|
}
|
|
462
|
-
const pickCommand =
|
|
463
|
-
let
|
|
482
|
+
const pickCommand = t23;
|
|
483
|
+
let t24;
|
|
464
484
|
if ($[79] !== chooseSkill || $[80] !== expandInto || $[81] !== setText) {
|
|
465
|
-
|
|
485
|
+
t24 = command_3 => {
|
|
466
486
|
if (command_3.expand !== undefined) {
|
|
467
487
|
expandInto(command_3);
|
|
468
488
|
return;
|
|
@@ -476,14 +496,14 @@ export function usePromptMenus(t0) {
|
|
|
476
496
|
$[79] = chooseSkill;
|
|
477
497
|
$[80] = expandInto;
|
|
478
498
|
$[81] = setText;
|
|
479
|
-
$[82] =
|
|
499
|
+
$[82] = t24;
|
|
480
500
|
} else {
|
|
481
|
-
|
|
501
|
+
t24 = $[82];
|
|
482
502
|
}
|
|
483
|
-
const completeCommand =
|
|
484
|
-
let
|
|
503
|
+
const completeCommand = t24;
|
|
504
|
+
let t25;
|
|
485
505
|
if ($[83] === Symbol.for("react.memo_cache_sentinel")) {
|
|
486
|
-
|
|
506
|
+
t25 = (key, count) => {
|
|
487
507
|
if (key === "ArrowDown") {
|
|
488
508
|
setMenuIndex(i => (i + 1) % count);
|
|
489
509
|
return true;
|
|
@@ -494,31 +514,33 @@ export function usePromptMenus(t0) {
|
|
|
494
514
|
}
|
|
495
515
|
return false;
|
|
496
516
|
};
|
|
497
|
-
$[83] =
|
|
517
|
+
$[83] = t25;
|
|
498
518
|
} else {
|
|
499
|
-
|
|
519
|
+
t25 = $[83];
|
|
500
520
|
}
|
|
501
|
-
const moveInMenu =
|
|
502
|
-
const
|
|
503
|
-
const
|
|
504
|
-
let
|
|
505
|
-
if ($[84] !== skills) {
|
|
506
|
-
|
|
507
|
-
$[84] =
|
|
508
|
-
$[85] =
|
|
521
|
+
const moveInMenu = t25;
|
|
522
|
+
const t26 = skills.length > 0 || hostSkills.length > 0;
|
|
523
|
+
const t27 = offersReferences && !referables.chatsOnly;
|
|
524
|
+
let t28;
|
|
525
|
+
if ($[84] !== hostSkills || $[85] !== skills) {
|
|
526
|
+
t28 = [...hostSkills.map(_temp6), ...skills.map(_temp7)];
|
|
527
|
+
$[84] = hostSkills;
|
|
528
|
+
$[85] = skills;
|
|
529
|
+
$[86] = t28;
|
|
509
530
|
} else {
|
|
510
|
-
|
|
531
|
+
t28 = $[86];
|
|
511
532
|
}
|
|
512
|
-
let
|
|
513
|
-
if ($[
|
|
514
|
-
|
|
533
|
+
let t29;
|
|
534
|
+
if ($[87] !== accountMatches || $[88] !== activeIndex || $[89] !== chooseMention || $[90] !== chooseMentionAt || $[91] !== chooseNamed || $[92] !== chooseReference || $[93] !== chooseReferenceAt || $[94] !== chooseSkill || $[95] !== commandMenuOpen || $[96] !== commandQuery || $[97] !== commands || $[98] !== completeCommand || $[99] !== files_0 || $[100] !== hostSkills || $[101] !== inputAria || $[102] !== listId || $[103] !== mention || $[104] !== mentionCount || $[105] !== mentionMenuOpen || $[106] !== menuOpen || $[107] !== modelMatches || $[108] !== namedLook || $[109] !== pickCommand || $[110] !== referables || $[111] !== referenceChips || $[112] !== referenceMatches || $[113] !== referenceMenuOpen || $[114] !== skillMatches || $[115] !== skillMenuOpen || $[116] !== t26 || $[117] !== t27 || $[118] !== t28 || $[119] !== trackTriggers) {
|
|
535
|
+
t29 = {
|
|
515
536
|
listId,
|
|
516
537
|
activeIndex,
|
|
517
538
|
inputAria,
|
|
518
539
|
menuOpen,
|
|
519
|
-
hasSkills:
|
|
520
|
-
offersViews:
|
|
521
|
-
skillNames:
|
|
540
|
+
hasSkills: t26,
|
|
541
|
+
offersViews: t27,
|
|
542
|
+
skillNames: t28,
|
|
543
|
+
hostSkills,
|
|
522
544
|
commandQuery,
|
|
523
545
|
commands,
|
|
524
546
|
commandMenuOpen,
|
|
@@ -548,47 +570,51 @@ export function usePromptMenus(t0) {
|
|
|
548
570
|
completeCommand,
|
|
549
571
|
moveInMenu
|
|
550
572
|
};
|
|
551
|
-
$[
|
|
552
|
-
$[
|
|
553
|
-
$[
|
|
554
|
-
$[
|
|
555
|
-
$[
|
|
556
|
-
$[
|
|
557
|
-
$[
|
|
558
|
-
$[
|
|
559
|
-
$[
|
|
560
|
-
$[
|
|
561
|
-
$[
|
|
562
|
-
$[
|
|
563
|
-
$[
|
|
564
|
-
$[
|
|
565
|
-
$[
|
|
566
|
-
$[
|
|
567
|
-
$[
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
570
|
-
$[
|
|
571
|
-
$[
|
|
572
|
-
$[
|
|
573
|
-
$[
|
|
574
|
-
$[
|
|
575
|
-
$[
|
|
576
|
-
$[
|
|
577
|
-
$[
|
|
578
|
-
$[
|
|
579
|
-
$[
|
|
580
|
-
$[
|
|
581
|
-
$[
|
|
582
|
-
$[117] = trackTriggers;
|
|
573
|
+
$[87] = accountMatches;
|
|
574
|
+
$[88] = activeIndex;
|
|
575
|
+
$[89] = chooseMention;
|
|
576
|
+
$[90] = chooseMentionAt;
|
|
577
|
+
$[91] = chooseNamed;
|
|
578
|
+
$[92] = chooseReference;
|
|
579
|
+
$[93] = chooseReferenceAt;
|
|
580
|
+
$[94] = chooseSkill;
|
|
581
|
+
$[95] = commandMenuOpen;
|
|
582
|
+
$[96] = commandQuery;
|
|
583
|
+
$[97] = commands;
|
|
584
|
+
$[98] = completeCommand;
|
|
585
|
+
$[99] = files_0;
|
|
586
|
+
$[100] = hostSkills;
|
|
587
|
+
$[101] = inputAria;
|
|
588
|
+
$[102] = listId;
|
|
589
|
+
$[103] = mention;
|
|
590
|
+
$[104] = mentionCount;
|
|
591
|
+
$[105] = mentionMenuOpen;
|
|
592
|
+
$[106] = menuOpen;
|
|
593
|
+
$[107] = modelMatches;
|
|
594
|
+
$[108] = namedLook;
|
|
595
|
+
$[109] = pickCommand;
|
|
596
|
+
$[110] = referables;
|
|
597
|
+
$[111] = referenceChips;
|
|
598
|
+
$[112] = referenceMatches;
|
|
599
|
+
$[113] = referenceMenuOpen;
|
|
600
|
+
$[114] = skillMatches;
|
|
601
|
+
$[115] = skillMenuOpen;
|
|
602
|
+
$[116] = t26;
|
|
603
|
+
$[117] = t27;
|
|
583
604
|
$[118] = t28;
|
|
605
|
+
$[119] = trackTriggers;
|
|
606
|
+
$[120] = t29;
|
|
584
607
|
} else {
|
|
585
|
-
|
|
608
|
+
t29 = $[120];
|
|
586
609
|
}
|
|
587
|
-
return
|
|
610
|
+
return t29;
|
|
588
611
|
}
|
|
589
|
-
function
|
|
612
|
+
function _temp7(skill_2) {
|
|
590
613
|
return skill_2.name;
|
|
591
614
|
}
|
|
615
|
+
function _temp6(skill_1) {
|
|
616
|
+
return skill_1.name;
|
|
617
|
+
}
|
|
592
618
|
function _temp5(command_0) {
|
|
593
619
|
return {
|
|
594
620
|
name: command_0.name,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ChatThreadInfo } from '../../../chat-sink.js';
|
|
2
|
+
export interface PromptSuggestion {
|
|
3
|
+
text: string;
|
|
4
|
+
accept(): void;
|
|
5
|
+
dismiss(): void;
|
|
6
|
+
}
|
|
7
|
+
interface SuggestionInput {
|
|
8
|
+
chatId: string;
|
|
9
|
+
info: Pick<ChatThreadInfo, 'activeTurnId'>;
|
|
10
|
+
empty: boolean;
|
|
11
|
+
writable: boolean;
|
|
12
|
+
asked: boolean;
|
|
13
|
+
fill(text: string): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function usePromptSuggestion({ chatId, info, empty, writable, asked, fill }: SuggestionInput): PromptSuggestion | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useChatRow } from '../../../state/chats.js';
|
|
4
|
+
/* The next prompt the CLI predicted, while the box is empty and nothing else asks for the person. */
|
|
5
|
+
export function usePromptSuggestion(t0) {
|
|
6
|
+
const $ = _c(9);
|
|
7
|
+
const {
|
|
8
|
+
chatId,
|
|
9
|
+
info,
|
|
10
|
+
empty,
|
|
11
|
+
writable,
|
|
12
|
+
asked,
|
|
13
|
+
fill
|
|
14
|
+
} = t0;
|
|
15
|
+
const suggestion = useChatRow(chatId, _temp);
|
|
16
|
+
const [dismissed, setDismissed] = useState(null);
|
|
17
|
+
if (suggestion === null || suggestion === dismissed || !empty || !writable || asked || info.activeTurnId !== null) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[0] !== fill || $[1] !== suggestion) {
|
|
22
|
+
t1 = () => fill(suggestion);
|
|
23
|
+
$[0] = fill;
|
|
24
|
+
$[1] = suggestion;
|
|
25
|
+
$[2] = t1;
|
|
26
|
+
} else {
|
|
27
|
+
t1 = $[2];
|
|
28
|
+
}
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[3] !== suggestion) {
|
|
31
|
+
t2 = () => setDismissed(suggestion);
|
|
32
|
+
$[3] = suggestion;
|
|
33
|
+
$[4] = t2;
|
|
34
|
+
} else {
|
|
35
|
+
t2 = $[4];
|
|
36
|
+
}
|
|
37
|
+
let t3;
|
|
38
|
+
if ($[5] !== suggestion || $[6] !== t1 || $[7] !== t2) {
|
|
39
|
+
t3 = {
|
|
40
|
+
text: suggestion,
|
|
41
|
+
accept: t1,
|
|
42
|
+
dismiss: t2
|
|
43
|
+
};
|
|
44
|
+
$[5] = suggestion;
|
|
45
|
+
$[6] = t1;
|
|
46
|
+
$[7] = t2;
|
|
47
|
+
$[8] = t3;
|
|
48
|
+
} else {
|
|
49
|
+
t3 = $[8];
|
|
50
|
+
}
|
|
51
|
+
return t3;
|
|
52
|
+
}
|
|
53
|
+
function _temp(row) {
|
|
54
|
+
return row?.suggestion ?? null;
|
|
55
|
+
}
|
package/dist/chat/ui/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export { uiTableColumns, type UiTableColumn } from './intelligent-ui/table-data.
|
|
|
39
39
|
export { ForksRow } from './rows/ForksRow.js';
|
|
40
40
|
export { GeneratedImageRow } from './rows/GeneratedImageRow.js';
|
|
41
41
|
export { ReportRow, NoteRow, AgentTurnRow, CompactionRow } from './rows/MessageRows.js';
|
|
42
|
-
export { TaskRow } from './rows/TaskRow.js';
|
|
42
|
+
export { TaskRow, TaskRowHead } from './rows/TaskRow.js';
|
|
43
43
|
export { WorkRow, WorkGroupRow, WorkingRow } from './rows/WorkRows.js';
|
|
44
44
|
export { WorkflowRow } from './rows/WorkflowRow.js';
|
|
45
45
|
export { WorkflowAgentLine } from './WorkflowAgentLine.js';
|