@adecore/agents-react 0.54.16 → 0.55.1
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/AgentModelLabel.d.ts +5 -0
- package/dist/agents/AgentModelLabel.js +32 -7
- package/dist/chat/account-choice.d.ts +1 -0
- package/dist/chat/account-choice.js +13 -4
- package/dist/chat/mentions.d.ts +24 -2
- package/dist/chat/mentions.js +84 -10
- package/dist/chat/subagent-list.d.ts +0 -1
- package/dist/chat/subagent-list.js +1 -9
- package/dist/chat/tag-suggestions.d.ts +22 -0
- package/dist/chat/tag-suggestions.js +71 -0
- package/dist/chat/ui/Composer.js +489 -447
- package/dist/chat/ui/ComposerInput.d.ts +1 -0
- package/dist/chat/ui/ComposerInput.js +9 -1
- package/dist/chat/ui/Markdown.js +41 -25
- package/dist/chat/ui/NamedChip.d.ts +5 -0
- package/dist/chat/ui/NamedChip.js +118 -0
- package/dist/chat/ui/Pickers.d.ts +0 -4
- package/dist/chat/ui/Pickers.js +1 -141
- package/dist/chat/ui/PromptEditor.js +2 -1
- package/dist/chat/ui/ReferenceChip.d.ts +3 -2
- package/dist/chat/ui/ReferenceChip.js +58 -36
- package/dist/chat/ui/RunSettings.d.ts +3 -2
- package/dist/chat/ui/RunSettings.js +386 -361
- package/dist/chat/ui/SubagentInfo.js +98 -114
- package/dist/chat/ui/SubagentTimeline.js +65 -43
- package/dist/chat/ui/Timeline.js +14 -8
- package/dist/chat/ui/chip-clipboard.js +10 -0
- package/dist/chat/ui/composer/ComposerControls.d.ts +6 -1
- package/dist/chat/ui/composer/ComposerControls.js +171 -158
- package/dist/chat/ui/composer/ComposerMenu.js +184 -55
- package/dist/chat/ui/composer/ComposerPlusMenu.d.ts +18 -0
- package/dist/chat/ui/composer/ComposerPlusMenu.js +400 -0
- package/dist/chat/ui/composer/ComposerStatusLine.d.ts +4 -0
- package/dist/chat/ui/composer/ComposerStatusLine.js +239 -0
- package/dist/chat/ui/composer/chips.d.ts +2 -0
- package/dist/chat/ui/composer/chips.js +66 -5
- package/dist/chat/ui/composer/insert.d.ts +1 -0
- package/dist/chat/ui/composer/insert.js +24 -0
- package/dist/chat/ui/composer/use-composer-menus.js +34 -17
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +10 -2
- package/dist/chat/ui/composer/use-prompt-menus.js +290 -202
- package/dist/chat/ui/covered-bottom.d.ts +1 -0
- package/dist/chat/ui/covered-bottom.js +6 -0
- package/dist/chat/ui/named-chip-look.d.ts +14 -0
- package/dist/chat/ui/named-chip-look.js +72 -0
- package/dist/chat/ui/rehype-chips.js +13 -2
- package/dist/host-hooks.d.ts +2 -1
- package/dist/host-hooks.js +6 -0
- package/dist/host.d.ts +17 -0
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +14 -2
- package/dist/locales/en/agent-chat.js +16 -4
- package/dist/locales/nl/agent-chat.d.ts +14 -2
- package/dist/locales/nl/agent-chat.js +16 -4
- package/dist/state/chats.d.ts +1 -0
- package/dist/state/chats.js +45 -0
- package/package.json +9 -9
- package/src/agents/AgentModelLabel.tsx +10 -1
- package/src/chat/account-choice.ts +8 -0
- package/src/chat/mentions.ts +110 -13
- package/src/chat/subagent-list.ts +1 -14
- package/src/chat/tag-suggestions.ts +121 -0
- package/src/chat/ui/Composer.tsx +24 -12
- package/src/chat/ui/ComposerInput.tsx +13 -1
- package/src/chat/ui/Markdown.tsx +5 -0
- package/src/chat/ui/NamedChip.tsx +34 -0
- package/src/chat/ui/Pickers.tsx +1 -51
- package/src/chat/ui/PromptEditor.tsx +7 -1
- package/src/chat/ui/ReferenceChip.tsx +15 -4
- package/src/chat/ui/RunSettings.tsx +51 -29
- package/src/chat/ui/SubagentInfo.tsx +17 -17
- package/src/chat/ui/SubagentTimeline.tsx +7 -2
- package/src/chat/ui/Timeline.tsx +11 -5
- package/src/chat/ui/chip-clipboard.ts +8 -1
- package/src/chat/ui/composer/ComposerControls.tsx +24 -17
- package/src/chat/ui/composer/ComposerMenu.tsx +82 -15
- package/src/chat/ui/composer/ComposerPlusMenu.tsx +158 -0
- package/src/chat/ui/composer/ComposerStatusLine.tsx +94 -0
- package/src/chat/ui/composer/chips.ts +78 -7
- package/src/chat/ui/composer/insert.ts +12 -0
- package/src/chat/ui/composer/use-composer-menus.ts +5 -2
- package/src/chat/ui/composer/use-prompt-menus.ts +55 -10
- package/src/chat/ui/covered-bottom.ts +7 -0
- package/src/chat/ui/named-chip-look.ts +64 -0
- package/src/chat/ui/rehype-chips.ts +17 -2
- package/src/host-hooks.ts +11 -1
- package/src/host.ts +29 -0
- package/src/index.ts +2 -0
- package/src/locales/en/agent-chat.ts +16 -4
- package/src/locales/nl/agent-chat.ts +16 -4
- package/src/state/chats.ts +26 -0
|
@@ -3,7 +3,9 @@ import { FileIcon, Icon, Menu, MiddleTruncate, ScrollArea } from '@adecore/ui';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { SquareSlash, Zap } from 'lucide-react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { CliMark } from '../../../agents/AgentModelLabel.js';
|
|
6
7
|
import { useChatHost } from '../../../host.js';
|
|
8
|
+
import { ModelMarks } from '../ModelMarks.js';
|
|
7
9
|
import { referenceGlyph } from '../reference-icons.js';
|
|
8
10
|
import { optionIdOf } from './menu-aria.js';
|
|
9
11
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -206,8 +208,65 @@ function SkillMenu(t0) {
|
|
|
206
208
|
}
|
|
207
209
|
return t4;
|
|
208
210
|
}
|
|
211
|
+
/* The CLI's mark of a model or account row, in the color of the account it runs on, as its chip wears it. */
|
|
212
|
+
function NamedMark(t0) {
|
|
213
|
+
const $ = _c(12);
|
|
214
|
+
const {
|
|
215
|
+
menus,
|
|
216
|
+
pick
|
|
217
|
+
} = t0;
|
|
218
|
+
let t1;
|
|
219
|
+
if ($[0] !== menus || $[1] !== pick.cli || $[2] !== pick.id || $[3] !== pick.kind) {
|
|
220
|
+
t1 = menus.namedLook(pick.kind, pick.cli, pick.id);
|
|
221
|
+
$[0] = menus;
|
|
222
|
+
$[1] = pick.cli;
|
|
223
|
+
$[2] = pick.id;
|
|
224
|
+
$[3] = pick.kind;
|
|
225
|
+
$[4] = t1;
|
|
226
|
+
} else {
|
|
227
|
+
t1 = $[4];
|
|
228
|
+
}
|
|
229
|
+
const {
|
|
230
|
+
color
|
|
231
|
+
} = t1;
|
|
232
|
+
let t2;
|
|
233
|
+
if ($[5] !== color) {
|
|
234
|
+
t2 = color === undefined ? undefined : {
|
|
235
|
+
color
|
|
236
|
+
};
|
|
237
|
+
$[5] = color;
|
|
238
|
+
$[6] = t2;
|
|
239
|
+
} else {
|
|
240
|
+
t2 = $[6];
|
|
241
|
+
}
|
|
242
|
+
let t3;
|
|
243
|
+
if ($[7] !== pick.cli) {
|
|
244
|
+
t3 = /*#__PURE__*/_jsx(CliMark, {
|
|
245
|
+
kind: pick.cli,
|
|
246
|
+
size: 14
|
|
247
|
+
});
|
|
248
|
+
$[7] = pick.cli;
|
|
249
|
+
$[8] = t3;
|
|
250
|
+
} else {
|
|
251
|
+
t3 = $[8];
|
|
252
|
+
}
|
|
253
|
+
let t4;
|
|
254
|
+
if ($[9] !== t2 || $[10] !== t3) {
|
|
255
|
+
t4 = /*#__PURE__*/_jsx("span", {
|
|
256
|
+
className: "flex shrink-0",
|
|
257
|
+
style: t2,
|
|
258
|
+
children: t3
|
|
259
|
+
});
|
|
260
|
+
$[9] = t2;
|
|
261
|
+
$[10] = t3;
|
|
262
|
+
$[11] = t4;
|
|
263
|
+
} else {
|
|
264
|
+
t4 = $[11];
|
|
265
|
+
}
|
|
266
|
+
return t4;
|
|
267
|
+
}
|
|
209
268
|
function MentionMenu(t0) {
|
|
210
|
-
const $ = _c(
|
|
269
|
+
const $ = _c(25);
|
|
211
270
|
const {
|
|
212
271
|
menus,
|
|
213
272
|
query
|
|
@@ -218,84 +277,154 @@ function MentionMenu(t0) {
|
|
|
218
277
|
const {
|
|
219
278
|
listId,
|
|
220
279
|
files,
|
|
280
|
+
modelMatches,
|
|
281
|
+
accountMatches,
|
|
221
282
|
mentionCount
|
|
222
283
|
} = menus;
|
|
223
284
|
const filesLabelId = `${listId}-files`;
|
|
224
|
-
const
|
|
285
|
+
const modelsLabelId = `${listId}-models`;
|
|
286
|
+
const accountsLabelId = `${listId}-accounts`;
|
|
287
|
+
const sectioned = modelMatches.length + accountMatches.length > 0;
|
|
225
288
|
let t1;
|
|
226
|
-
if ($[0] !==
|
|
227
|
-
t1 =
|
|
289
|
+
if ($[0] !== query || $[1] !== sectioned || $[2] !== t) {
|
|
290
|
+
t1 = query === "" ? t("composer.mentions.here") : sectioned ? t("composer.mentions.files") : null;
|
|
291
|
+
$[0] = query;
|
|
292
|
+
$[1] = sectioned;
|
|
293
|
+
$[2] = t;
|
|
294
|
+
$[3] = t1;
|
|
295
|
+
} else {
|
|
296
|
+
t1 = $[3];
|
|
297
|
+
}
|
|
298
|
+
const filesLabel = t1;
|
|
299
|
+
const accountsFrom = modelMatches.length;
|
|
300
|
+
const filesFrom = accountsFrom + accountMatches.length;
|
|
301
|
+
let t2;
|
|
302
|
+
if ($[4] !== accountMatches || $[5] !== accountsFrom || $[6] !== accountsLabelId || $[7] !== files || $[8] !== filesFrom || $[9] !== filesLabel || $[10] !== filesLabelId || $[11] !== listId || $[12] !== mentionCount || $[13] !== menus || $[14] !== modelMatches || $[15] !== modelsLabelId || $[16] !== t) {
|
|
303
|
+
t2 = mentionCount > 0 && /*#__PURE__*/_jsxs("div", {
|
|
228
304
|
id: listId,
|
|
229
305
|
role: "listbox",
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
"aria-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}), files.map((path, index) => {
|
|
239
|
-
const {
|
|
240
|
-
name,
|
|
241
|
-
dir
|
|
242
|
-
} = splitPath(path);
|
|
243
|
-
return /*#__PURE__*/_jsxs(MenuOption, {
|
|
306
|
+
"aria-label": t("composer.mentions.files"),
|
|
307
|
+
children: [modelMatches.length > 0 && /*#__PURE__*/_jsxs("div", {
|
|
308
|
+
role: "group",
|
|
309
|
+
"aria-labelledby": modelsLabelId,
|
|
310
|
+
children: [/*#__PURE__*/_jsx(Menu.Label, {
|
|
311
|
+
id: modelsLabelId,
|
|
312
|
+
children: t("composer.mentions.models")
|
|
313
|
+
}), modelMatches.map((match, index) => /*#__PURE__*/_jsxs(MenuOption, {
|
|
244
314
|
menus: menus,
|
|
245
315
|
index: index,
|
|
246
316
|
className: "items-center",
|
|
247
|
-
onPick: () => menus.
|
|
248
|
-
children: [/*#__PURE__*/_jsx(
|
|
249
|
-
|
|
250
|
-
|
|
317
|
+
onPick: () => menus.chooseNamed(match),
|
|
318
|
+
children: [/*#__PURE__*/_jsx(NamedMark, {
|
|
319
|
+
menus: menus,
|
|
320
|
+
pick: match
|
|
321
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
322
|
+
className: "truncate text-text",
|
|
323
|
+
children: match.model.name
|
|
324
|
+
}), /*#__PURE__*/_jsx(ModelMarks, {
|
|
325
|
+
model: match.model
|
|
326
|
+
})]
|
|
327
|
+
}, `${match.cli}/${match.id}`))]
|
|
328
|
+
}), accountMatches.length > 0 && /*#__PURE__*/_jsxs("div", {
|
|
329
|
+
role: "group",
|
|
330
|
+
"aria-labelledby": accountsLabelId,
|
|
331
|
+
children: [/*#__PURE__*/_jsx(Menu.Label, {
|
|
332
|
+
id: accountsLabelId,
|
|
333
|
+
children: t("composer.mentions.accounts")
|
|
334
|
+
}), accountMatches.map((match_0, index_0) => /*#__PURE__*/_jsxs(MenuOption, {
|
|
335
|
+
menus: menus,
|
|
336
|
+
index: accountsFrom + index_0,
|
|
337
|
+
className: "items-center",
|
|
338
|
+
onPick: () => menus.chooseNamed(match_0),
|
|
339
|
+
children: [/*#__PURE__*/_jsx(NamedMark, {
|
|
340
|
+
menus: menus,
|
|
341
|
+
pick: match_0
|
|
251
342
|
}), /*#__PURE__*/_jsx("span", {
|
|
252
|
-
className: "truncate
|
|
253
|
-
children: name
|
|
254
|
-
}),
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
className: "text-text-faint"
|
|
343
|
+
className: "truncate text-text",
|
|
344
|
+
children: match_0.name
|
|
345
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
346
|
+
className: "truncate text-text-faint",
|
|
347
|
+
children: match_0.provider.name
|
|
258
348
|
})]
|
|
259
|
-
},
|
|
349
|
+
}, `${match_0.cli}/${match_0.id}`))]
|
|
350
|
+
}), files.length > 0 && /*#__PURE__*/_jsxs("div", {
|
|
351
|
+
role: "group",
|
|
352
|
+
...(filesLabel === null ? {
|
|
353
|
+
"aria-label": t("composer.mentions.files")
|
|
354
|
+
} : {
|
|
355
|
+
"aria-labelledby": filesLabelId
|
|
356
|
+
}),
|
|
357
|
+
children: [filesLabel !== null && /*#__PURE__*/_jsx(Menu.Label, {
|
|
358
|
+
id: filesLabelId,
|
|
359
|
+
children: filesLabel
|
|
360
|
+
}), files.map((path, index_1) => {
|
|
361
|
+
const {
|
|
362
|
+
name,
|
|
363
|
+
dir
|
|
364
|
+
} = splitPath(path);
|
|
365
|
+
return /*#__PURE__*/_jsxs(MenuOption, {
|
|
366
|
+
menus: menus,
|
|
367
|
+
index: filesFrom + index_1,
|
|
368
|
+
className: "items-center",
|
|
369
|
+
onPick: () => menus.chooseMention(path),
|
|
370
|
+
children: [/*#__PURE__*/_jsx(FileIcon, {
|
|
371
|
+
path: path,
|
|
372
|
+
size: 14
|
|
373
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
374
|
+
className: "truncate font-mono text-text",
|
|
375
|
+
children: name
|
|
376
|
+
}), dir && /*#__PURE__*/_jsx(MiddleTruncate, {
|
|
377
|
+
text: dir,
|
|
378
|
+
tooltip: false,
|
|
379
|
+
className: "text-text-faint"
|
|
380
|
+
})]
|
|
381
|
+
}, path);
|
|
382
|
+
})]
|
|
260
383
|
})]
|
|
261
384
|
});
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
385
|
+
$[4] = accountMatches;
|
|
386
|
+
$[5] = accountsFrom;
|
|
387
|
+
$[6] = accountsLabelId;
|
|
388
|
+
$[7] = files;
|
|
389
|
+
$[8] = filesFrom;
|
|
390
|
+
$[9] = filesLabel;
|
|
391
|
+
$[10] = filesLabelId;
|
|
392
|
+
$[11] = listId;
|
|
393
|
+
$[12] = mentionCount;
|
|
394
|
+
$[13] = menus;
|
|
395
|
+
$[14] = modelMatches;
|
|
396
|
+
$[15] = modelsLabelId;
|
|
397
|
+
$[16] = t;
|
|
398
|
+
$[17] = t2;
|
|
270
399
|
} else {
|
|
271
|
-
|
|
400
|
+
t2 = $[17];
|
|
272
401
|
}
|
|
273
|
-
let
|
|
274
|
-
if ($[
|
|
275
|
-
|
|
402
|
+
let t3;
|
|
403
|
+
if ($[18] !== mentionCount || $[19] !== query || $[20] !== t) {
|
|
404
|
+
t3 = mentionCount === 0 && /*#__PURE__*/_jsx("div", {
|
|
276
405
|
className: "px-2 py-1 text-xs text-text-faint",
|
|
277
406
|
children: query ? t("composer.mentions.noMatch") : t("composer.mentions.empty")
|
|
278
407
|
});
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
408
|
+
$[18] = mentionCount;
|
|
409
|
+
$[19] = query;
|
|
410
|
+
$[20] = t;
|
|
411
|
+
$[21] = t3;
|
|
283
412
|
} else {
|
|
284
|
-
|
|
413
|
+
t3 = $[21];
|
|
285
414
|
}
|
|
286
|
-
let
|
|
287
|
-
if ($[
|
|
288
|
-
|
|
415
|
+
let t4;
|
|
416
|
+
if ($[22] !== t2 || $[23] !== t3) {
|
|
417
|
+
t4 = /*#__PURE__*/_jsxs("div", {
|
|
289
418
|
className: "border-b border-border px-1.5 py-1.5",
|
|
290
|
-
children: [
|
|
419
|
+
children: [t2, t3]
|
|
291
420
|
});
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
421
|
+
$[22] = t2;
|
|
422
|
+
$[23] = t3;
|
|
423
|
+
$[24] = t4;
|
|
295
424
|
} else {
|
|
296
|
-
|
|
425
|
+
t4 = $[24];
|
|
297
426
|
}
|
|
298
|
-
return
|
|
427
|
+
return t4;
|
|
299
428
|
}
|
|
300
429
|
/* The views, nodes and chats a `#` offers, what stands on this canvas first, each with its kind or what tells it apart. */
|
|
301
430
|
function ReferenceMenu(t0) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type StashedPrompt } from '../../stash.js';
|
|
2
|
+
export interface PlusMenuSigils {
|
|
3
|
+
mentionable: boolean;
|
|
4
|
+
referable: boolean;
|
|
5
|
+
hasSkills: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface ComposerPlusMenuProps {
|
|
8
|
+
writable: boolean;
|
|
9
|
+
attachable: boolean;
|
|
10
|
+
emptyDraft: boolean;
|
|
11
|
+
sigils: PlusMenuSigils;
|
|
12
|
+
onAttach(): void;
|
|
13
|
+
onRestore(prompt: StashedPrompt): void;
|
|
14
|
+
onStash(): void;
|
|
15
|
+
onSigil(sigil: string): void;
|
|
16
|
+
}
|
|
17
|
+
export declare function ComposerPlusMenu({ writable, attachable, emptyDraft, sigils, onAttach, onRestore, onStash, onSigil }: ComposerPlusMenuProps): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { Icon, Kbd, Menu, ScrollArea, Tooltip } from '@adecore/ui';
|
|
3
|
+
import { AtSign, Bookmark, BookmarkPlus, ChevronRight, Hash, Paperclip, Plus, SquareSlash, Trash2, Zap } from 'lucide-react';
|
|
4
|
+
import { useRef } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { forgetStashed, STASH_SHORTCUT, useStash } from '../../stash.js';
|
|
7
|
+
/*
|
|
8
|
+
* Prompts put aside with Mod+S, on a shelf the whole app shares, since a stashed prompt usually moves
|
|
9
|
+
* to another chat. A draft's files are named on the row but not kept: their bytes never go to storage.
|
|
10
|
+
*/
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
function StashedPrompts(t0) {
|
|
13
|
+
const $ = _c(13);
|
|
14
|
+
const {
|
|
15
|
+
prompts,
|
|
16
|
+
onRestore,
|
|
17
|
+
children
|
|
18
|
+
} = t0;
|
|
19
|
+
const {
|
|
20
|
+
t
|
|
21
|
+
} = useTranslation("agent-chat");
|
|
22
|
+
let t1;
|
|
23
|
+
if ($[0] !== onRestore || $[1] !== prompts || $[2] !== t) {
|
|
24
|
+
let t2;
|
|
25
|
+
if ($[4] !== onRestore || $[5] !== t) {
|
|
26
|
+
t2 = prompt => /*#__PURE__*/_jsxs(Menu.Row, {
|
|
27
|
+
className: "group/stash",
|
|
28
|
+
children: [/*#__PURE__*/_jsxs(Menu.Item, {
|
|
29
|
+
className: "flex-col items-start gap-0.5",
|
|
30
|
+
label: prompt.text,
|
|
31
|
+
onClick: () => onRestore(prompt),
|
|
32
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
33
|
+
className: "line-clamp-2 whitespace-pre-wrap",
|
|
34
|
+
children: prompt.text || prompt.quote?.text || t("pickers.stash.noText")
|
|
35
|
+
}), prompt.attachments.length > 0 && /*#__PURE__*/_jsx("span", {
|
|
36
|
+
className: "text-text-faint",
|
|
37
|
+
children: t("pickers.stash.files", {
|
|
38
|
+
count: prompt.attachments.length
|
|
39
|
+
})
|
|
40
|
+
}), prompt.chats.length > 0 && /*#__PURE__*/_jsx("span", {
|
|
41
|
+
className: "text-text-faint",
|
|
42
|
+
children: t("pickers.stash.chats", {
|
|
43
|
+
count: prompt.chats.length
|
|
44
|
+
})
|
|
45
|
+
})]
|
|
46
|
+
}), /*#__PURE__*/_jsx(Menu.RowAction, {
|
|
47
|
+
icon: Trash2,
|
|
48
|
+
label: t("common.action.delete"),
|
|
49
|
+
closeOnClick: false,
|
|
50
|
+
className: "opacity-0 group-hover/stash:opacity-100 data-[highlighted]:opacity-100",
|
|
51
|
+
onClick: () => forgetStashed(prompt.id)
|
|
52
|
+
})]
|
|
53
|
+
}, prompt.id);
|
|
54
|
+
$[4] = onRestore;
|
|
55
|
+
$[5] = t;
|
|
56
|
+
$[6] = t2;
|
|
57
|
+
} else {
|
|
58
|
+
t2 = $[6];
|
|
59
|
+
}
|
|
60
|
+
t1 = prompts.map(t2);
|
|
61
|
+
$[0] = onRestore;
|
|
62
|
+
$[1] = prompts;
|
|
63
|
+
$[2] = t;
|
|
64
|
+
$[3] = t1;
|
|
65
|
+
} else {
|
|
66
|
+
t1 = $[3];
|
|
67
|
+
}
|
|
68
|
+
let t2;
|
|
69
|
+
if ($[7] !== t1) {
|
|
70
|
+
t2 = /*#__PURE__*/_jsx(ScrollArea, {
|
|
71
|
+
className: "max-h-72",
|
|
72
|
+
children: t1
|
|
73
|
+
});
|
|
74
|
+
$[7] = t1;
|
|
75
|
+
$[8] = t2;
|
|
76
|
+
} else {
|
|
77
|
+
t2 = $[8];
|
|
78
|
+
}
|
|
79
|
+
let t3;
|
|
80
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
81
|
+
t3 = /*#__PURE__*/_jsx(Menu.Separator, {});
|
|
82
|
+
$[9] = t3;
|
|
83
|
+
} else {
|
|
84
|
+
t3 = $[9];
|
|
85
|
+
}
|
|
86
|
+
let t4;
|
|
87
|
+
if ($[10] !== children || $[11] !== t2) {
|
|
88
|
+
t4 = /*#__PURE__*/_jsxs(Menu.Popup, {
|
|
89
|
+
className: "w-80",
|
|
90
|
+
children: [t2, t3, children]
|
|
91
|
+
});
|
|
92
|
+
$[10] = children;
|
|
93
|
+
$[11] = t2;
|
|
94
|
+
$[12] = t4;
|
|
95
|
+
} else {
|
|
96
|
+
t4 = $[12];
|
|
97
|
+
}
|
|
98
|
+
return t4;
|
|
99
|
+
}
|
|
100
|
+
/* The + under the box: attach, the stash, and the sigils that open a picker, for a person who does not know the keys. */
|
|
101
|
+
export function ComposerPlusMenu(t0) {
|
|
102
|
+
const $ = _c(66);
|
|
103
|
+
const {
|
|
104
|
+
writable,
|
|
105
|
+
attachable,
|
|
106
|
+
emptyDraft,
|
|
107
|
+
sigils,
|
|
108
|
+
onAttach,
|
|
109
|
+
onRestore,
|
|
110
|
+
onStash,
|
|
111
|
+
onSigil
|
|
112
|
+
} = t0;
|
|
113
|
+
const {
|
|
114
|
+
t
|
|
115
|
+
} = useTranslation("agent-chat");
|
|
116
|
+
const prompts = useStash(_temp);
|
|
117
|
+
const handedOff = useRef(false);
|
|
118
|
+
let T0;
|
|
119
|
+
let T1;
|
|
120
|
+
let t1;
|
|
121
|
+
let t10;
|
|
122
|
+
let t2;
|
|
123
|
+
let t3;
|
|
124
|
+
let t4;
|
|
125
|
+
let t5;
|
|
126
|
+
let t6;
|
|
127
|
+
let t7;
|
|
128
|
+
let t8;
|
|
129
|
+
let t9;
|
|
130
|
+
if ($[0] !== attachable || $[1] !== emptyDraft || $[2] !== onAttach || $[3] !== onRestore || $[4] !== onSigil || $[5] !== onStash || $[6] !== prompts || $[7] !== sigils.hasSkills || $[8] !== sigils.mentionable || $[9] !== sigils.referable || $[10] !== t || $[11] !== writable) {
|
|
131
|
+
const pickSigil = sigil => {
|
|
132
|
+
handedOff.current = true;
|
|
133
|
+
onSigil(sigil);
|
|
134
|
+
};
|
|
135
|
+
let t11;
|
|
136
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
137
|
+
t11 = () => {
|
|
138
|
+
const back = !handedOff.current;
|
|
139
|
+
handedOff.current = false;
|
|
140
|
+
return back;
|
|
141
|
+
};
|
|
142
|
+
$[24] = t11;
|
|
143
|
+
} else {
|
|
144
|
+
t11 = $[24];
|
|
145
|
+
}
|
|
146
|
+
const finalFocus = t11;
|
|
147
|
+
let t12;
|
|
148
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
149
|
+
t12 = /*#__PURE__*/_jsx(Icon, {
|
|
150
|
+
icon: BookmarkPlus,
|
|
151
|
+
size: 14,
|
|
152
|
+
className: "text-text-faint"
|
|
153
|
+
});
|
|
154
|
+
$[25] = t12;
|
|
155
|
+
} else {
|
|
156
|
+
t12 = $[25];
|
|
157
|
+
}
|
|
158
|
+
let t13;
|
|
159
|
+
if ($[26] !== t) {
|
|
160
|
+
t13 = t("composer.plus.stash");
|
|
161
|
+
$[26] = t;
|
|
162
|
+
$[27] = t13;
|
|
163
|
+
} else {
|
|
164
|
+
t13 = $[27];
|
|
165
|
+
}
|
|
166
|
+
let t14;
|
|
167
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
168
|
+
t14 = /*#__PURE__*/_jsx(Kbd, {
|
|
169
|
+
shortcut: STASH_SHORTCUT
|
|
170
|
+
});
|
|
171
|
+
$[28] = t14;
|
|
172
|
+
} else {
|
|
173
|
+
t14 = $[28];
|
|
174
|
+
}
|
|
175
|
+
let t15;
|
|
176
|
+
if ($[29] !== emptyDraft || $[30] !== onStash || $[31] !== t13) {
|
|
177
|
+
t15 = /*#__PURE__*/_jsxs(Menu.Item, {
|
|
178
|
+
disabled: emptyDraft,
|
|
179
|
+
onClick: onStash,
|
|
180
|
+
children: [t12, t13, t14]
|
|
181
|
+
});
|
|
182
|
+
$[29] = emptyDraft;
|
|
183
|
+
$[30] = onStash;
|
|
184
|
+
$[31] = t13;
|
|
185
|
+
$[32] = t15;
|
|
186
|
+
} else {
|
|
187
|
+
t15 = $[32];
|
|
188
|
+
}
|
|
189
|
+
const stashItem = t15;
|
|
190
|
+
const rows = [...(sigils.mentionable ? [{
|
|
191
|
+
key: "@",
|
|
192
|
+
icon: AtSign,
|
|
193
|
+
label: t("composer.plus.mention"),
|
|
194
|
+
tone: "text-accent"
|
|
195
|
+
}] : []), ...(sigils.referable ? [{
|
|
196
|
+
key: "#",
|
|
197
|
+
icon: Hash,
|
|
198
|
+
label: t("composer.plus.reference")
|
|
199
|
+
}] : []), ...(sigils.hasSkills ? [{
|
|
200
|
+
key: "$",
|
|
201
|
+
icon: Zap,
|
|
202
|
+
label: t("composer.plus.skill"),
|
|
203
|
+
tone: "text-skill"
|
|
204
|
+
}] : []), {
|
|
205
|
+
key: "/",
|
|
206
|
+
icon: SquareSlash,
|
|
207
|
+
label: t("composer.plus.commands")
|
|
208
|
+
}];
|
|
209
|
+
T1 = Menu.Root;
|
|
210
|
+
let t16;
|
|
211
|
+
if ($[33] !== t) {
|
|
212
|
+
t16 = t("composer.plus.label");
|
|
213
|
+
$[33] = t;
|
|
214
|
+
$[34] = t16;
|
|
215
|
+
} else {
|
|
216
|
+
t16 = $[34];
|
|
217
|
+
}
|
|
218
|
+
const t17 = !writable;
|
|
219
|
+
let t18;
|
|
220
|
+
if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
|
|
221
|
+
t18 = /*#__PURE__*/_jsx(Icon, {
|
|
222
|
+
icon: Plus,
|
|
223
|
+
size: 16
|
|
224
|
+
});
|
|
225
|
+
$[35] = t18;
|
|
226
|
+
} else {
|
|
227
|
+
t18 = $[35];
|
|
228
|
+
}
|
|
229
|
+
let t19;
|
|
230
|
+
if ($[36] !== t17) {
|
|
231
|
+
t19 = /*#__PURE__*/_jsx(Menu.Trigger, {
|
|
232
|
+
disabled: t17,
|
|
233
|
+
className: "grid h-8 w-8 shrink-0 place-items-center rounded-full border border-border text-text-muted hover:bg-surface-hover-edged hover:text-text disabled:opacity-50 data-[popup-open]:bg-surface-hover data-[popup-open]:text-text",
|
|
234
|
+
children: t18
|
|
235
|
+
});
|
|
236
|
+
$[36] = t17;
|
|
237
|
+
$[37] = t19;
|
|
238
|
+
} else {
|
|
239
|
+
t19 = $[37];
|
|
240
|
+
}
|
|
241
|
+
if ($[38] !== t16 || $[39] !== t19) {
|
|
242
|
+
t10 = /*#__PURE__*/_jsx(Tooltip, {
|
|
243
|
+
label: t16,
|
|
244
|
+
name: true,
|
|
245
|
+
children: t19
|
|
246
|
+
});
|
|
247
|
+
$[38] = t16;
|
|
248
|
+
$[39] = t19;
|
|
249
|
+
$[40] = t10;
|
|
250
|
+
} else {
|
|
251
|
+
t10 = $[40];
|
|
252
|
+
}
|
|
253
|
+
T0 = Menu.Popup;
|
|
254
|
+
t1 = "top";
|
|
255
|
+
t2 = 8;
|
|
256
|
+
t3 = "start";
|
|
257
|
+
t4 = "w-64";
|
|
258
|
+
t5 = finalFocus;
|
|
259
|
+
if ($[41] !== attachable || $[42] !== onAttach || $[43] !== t) {
|
|
260
|
+
t6 = attachable && /*#__PURE__*/_jsxs(Menu.Item, {
|
|
261
|
+
onClick: onAttach,
|
|
262
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
263
|
+
icon: Paperclip,
|
|
264
|
+
size: 14,
|
|
265
|
+
className: "text-text-faint"
|
|
266
|
+
}), t("composer.plus.attach")]
|
|
267
|
+
});
|
|
268
|
+
$[41] = attachable;
|
|
269
|
+
$[42] = onAttach;
|
|
270
|
+
$[43] = t;
|
|
271
|
+
$[44] = t6;
|
|
272
|
+
} else {
|
|
273
|
+
t6 = $[44];
|
|
274
|
+
}
|
|
275
|
+
if ($[45] !== onRestore || $[46] !== prompts || $[47] !== stashItem || $[48] !== t) {
|
|
276
|
+
t7 = prompts.length === 0 ? stashItem : /*#__PURE__*/_jsxs(Menu.SubmenuRoot, {
|
|
277
|
+
children: [/*#__PURE__*/_jsxs(Menu.SubmenuTrigger, {
|
|
278
|
+
chevron: false,
|
|
279
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
280
|
+
icon: Bookmark,
|
|
281
|
+
size: 14,
|
|
282
|
+
className: "text-text-faint"
|
|
283
|
+
}), t("pickers.stash.title"), /*#__PURE__*/_jsx(Menu.Hint, {
|
|
284
|
+
className: "tabular-nums",
|
|
285
|
+
children: prompts.length
|
|
286
|
+
}), /*#__PURE__*/_jsx(Icon, {
|
|
287
|
+
icon: ChevronRight,
|
|
288
|
+
size: 14,
|
|
289
|
+
className: "-ml-1.5 text-text-faint"
|
|
290
|
+
})]
|
|
291
|
+
}), /*#__PURE__*/_jsx(StashedPrompts, {
|
|
292
|
+
prompts: prompts,
|
|
293
|
+
onRestore: onRestore,
|
|
294
|
+
children: stashItem
|
|
295
|
+
})]
|
|
296
|
+
});
|
|
297
|
+
$[45] = onRestore;
|
|
298
|
+
$[46] = prompts;
|
|
299
|
+
$[47] = stashItem;
|
|
300
|
+
$[48] = t;
|
|
301
|
+
$[49] = t7;
|
|
302
|
+
} else {
|
|
303
|
+
t7 = $[49];
|
|
304
|
+
}
|
|
305
|
+
if ($[50] === Symbol.for("react.memo_cache_sentinel")) {
|
|
306
|
+
t8 = /*#__PURE__*/_jsx(Menu.Separator, {});
|
|
307
|
+
$[50] = t8;
|
|
308
|
+
} else {
|
|
309
|
+
t8 = $[50];
|
|
310
|
+
}
|
|
311
|
+
t9 = rows.map(row => /*#__PURE__*/_jsxs(Menu.Item, {
|
|
312
|
+
disabled: row.key === "/" && !emptyDraft,
|
|
313
|
+
onClick: () => pickSigil(row.key),
|
|
314
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
315
|
+
icon: row.icon,
|
|
316
|
+
size: 14,
|
|
317
|
+
className: row.tone ?? "text-text-faint"
|
|
318
|
+
}), row.label, /*#__PURE__*/_jsx(Kbd, {
|
|
319
|
+
children: row.key
|
|
320
|
+
})]
|
|
321
|
+
}, row.key));
|
|
322
|
+
$[0] = attachable;
|
|
323
|
+
$[1] = emptyDraft;
|
|
324
|
+
$[2] = onAttach;
|
|
325
|
+
$[3] = onRestore;
|
|
326
|
+
$[4] = onSigil;
|
|
327
|
+
$[5] = onStash;
|
|
328
|
+
$[6] = prompts;
|
|
329
|
+
$[7] = sigils.hasSkills;
|
|
330
|
+
$[8] = sigils.mentionable;
|
|
331
|
+
$[9] = sigils.referable;
|
|
332
|
+
$[10] = t;
|
|
333
|
+
$[11] = writable;
|
|
334
|
+
$[12] = T0;
|
|
335
|
+
$[13] = T1;
|
|
336
|
+
$[14] = t1;
|
|
337
|
+
$[15] = t10;
|
|
338
|
+
$[16] = t2;
|
|
339
|
+
$[17] = t3;
|
|
340
|
+
$[18] = t4;
|
|
341
|
+
$[19] = t5;
|
|
342
|
+
$[20] = t6;
|
|
343
|
+
$[21] = t7;
|
|
344
|
+
$[22] = t8;
|
|
345
|
+
$[23] = t9;
|
|
346
|
+
} else {
|
|
347
|
+
T0 = $[12];
|
|
348
|
+
T1 = $[13];
|
|
349
|
+
t1 = $[14];
|
|
350
|
+
t10 = $[15];
|
|
351
|
+
t2 = $[16];
|
|
352
|
+
t3 = $[17];
|
|
353
|
+
t4 = $[18];
|
|
354
|
+
t5 = $[19];
|
|
355
|
+
t6 = $[20];
|
|
356
|
+
t7 = $[21];
|
|
357
|
+
t8 = $[22];
|
|
358
|
+
t9 = $[23];
|
|
359
|
+
}
|
|
360
|
+
let t11;
|
|
361
|
+
if ($[51] !== T0 || $[52] !== t1 || $[53] !== t2 || $[54] !== t3 || $[55] !== t4 || $[56] !== t5 || $[57] !== t6 || $[58] !== t7 || $[59] !== t8 || $[60] !== t9) {
|
|
362
|
+
t11 = /*#__PURE__*/_jsxs(T0, {
|
|
363
|
+
side: t1,
|
|
364
|
+
sideOffset: t2,
|
|
365
|
+
align: t3,
|
|
366
|
+
className: t4,
|
|
367
|
+
finalFocus: t5,
|
|
368
|
+
children: [t6, t7, t8, t9]
|
|
369
|
+
});
|
|
370
|
+
$[51] = T0;
|
|
371
|
+
$[52] = t1;
|
|
372
|
+
$[53] = t2;
|
|
373
|
+
$[54] = t3;
|
|
374
|
+
$[55] = t4;
|
|
375
|
+
$[56] = t5;
|
|
376
|
+
$[57] = t6;
|
|
377
|
+
$[58] = t7;
|
|
378
|
+
$[59] = t8;
|
|
379
|
+
$[60] = t9;
|
|
380
|
+
$[61] = t11;
|
|
381
|
+
} else {
|
|
382
|
+
t11 = $[61];
|
|
383
|
+
}
|
|
384
|
+
let t12;
|
|
385
|
+
if ($[62] !== T1 || $[63] !== t10 || $[64] !== t11) {
|
|
386
|
+
t12 = /*#__PURE__*/_jsxs(T1, {
|
|
387
|
+
children: [t10, t11]
|
|
388
|
+
});
|
|
389
|
+
$[62] = T1;
|
|
390
|
+
$[63] = t10;
|
|
391
|
+
$[64] = t11;
|
|
392
|
+
$[65] = t12;
|
|
393
|
+
} else {
|
|
394
|
+
t12 = $[65];
|
|
395
|
+
}
|
|
396
|
+
return t12;
|
|
397
|
+
}
|
|
398
|
+
function _temp(state) {
|
|
399
|
+
return state.prompts;
|
|
400
|
+
}
|