@adecore/agents-react 0.54.16 → 0.55.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.
Files changed (91) hide show
  1. package/dist/agents/AgentModelLabel.d.ts +5 -0
  2. package/dist/agents/AgentModelLabel.js +32 -7
  3. package/dist/chat/account-choice.d.ts +1 -0
  4. package/dist/chat/account-choice.js +13 -4
  5. package/dist/chat/mentions.d.ts +24 -2
  6. package/dist/chat/mentions.js +84 -10
  7. package/dist/chat/subagent-list.d.ts +0 -1
  8. package/dist/chat/subagent-list.js +1 -9
  9. package/dist/chat/tag-suggestions.d.ts +22 -0
  10. package/dist/chat/tag-suggestions.js +71 -0
  11. package/dist/chat/ui/Composer.js +489 -447
  12. package/dist/chat/ui/ComposerInput.d.ts +1 -0
  13. package/dist/chat/ui/ComposerInput.js +9 -1
  14. package/dist/chat/ui/Markdown.js +41 -25
  15. package/dist/chat/ui/NamedChip.d.ts +5 -0
  16. package/dist/chat/ui/NamedChip.js +118 -0
  17. package/dist/chat/ui/Pickers.d.ts +0 -4
  18. package/dist/chat/ui/Pickers.js +1 -141
  19. package/dist/chat/ui/PromptEditor.js +2 -1
  20. package/dist/chat/ui/ReferenceChip.d.ts +3 -2
  21. package/dist/chat/ui/ReferenceChip.js +58 -36
  22. package/dist/chat/ui/RunSettings.d.ts +3 -2
  23. package/dist/chat/ui/RunSettings.js +386 -361
  24. package/dist/chat/ui/SubagentInfo.js +98 -114
  25. package/dist/chat/ui/SubagentTimeline.js +65 -43
  26. package/dist/chat/ui/Timeline.js +14 -8
  27. package/dist/chat/ui/chip-clipboard.js +10 -0
  28. package/dist/chat/ui/composer/ComposerControls.d.ts +6 -1
  29. package/dist/chat/ui/composer/ComposerControls.js +171 -158
  30. package/dist/chat/ui/composer/ComposerMenu.js +187 -55
  31. package/dist/chat/ui/composer/ComposerPlusMenu.d.ts +18 -0
  32. package/dist/chat/ui/composer/ComposerPlusMenu.js +400 -0
  33. package/dist/chat/ui/composer/ComposerStatusLine.d.ts +4 -0
  34. package/dist/chat/ui/composer/ComposerStatusLine.js +239 -0
  35. package/dist/chat/ui/composer/chips.d.ts +2 -0
  36. package/dist/chat/ui/composer/chips.js +66 -5
  37. package/dist/chat/ui/composer/insert.d.ts +1 -0
  38. package/dist/chat/ui/composer/insert.js +24 -0
  39. package/dist/chat/ui/composer/use-composer-menus.js +34 -17
  40. package/dist/chat/ui/composer/use-prompt-menus.d.ts +10 -2
  41. package/dist/chat/ui/composer/use-prompt-menus.js +290 -202
  42. package/dist/chat/ui/covered-bottom.d.ts +1 -0
  43. package/dist/chat/ui/covered-bottom.js +6 -0
  44. package/dist/chat/ui/named-chip-look.d.ts +14 -0
  45. package/dist/chat/ui/named-chip-look.js +72 -0
  46. package/dist/chat/ui/rehype-chips.js +13 -2
  47. package/dist/host-hooks.d.ts +2 -1
  48. package/dist/host-hooks.js +6 -0
  49. package/dist/host.d.ts +17 -0
  50. package/dist/index.d.ts +1 -1
  51. package/dist/locales/en/agent-chat.d.ts +14 -2
  52. package/dist/locales/en/agent-chat.js +16 -4
  53. package/dist/locales/nl/agent-chat.d.ts +14 -2
  54. package/dist/locales/nl/agent-chat.js +16 -4
  55. package/dist/state/chats.d.ts +1 -0
  56. package/dist/state/chats.js +45 -0
  57. package/package.json +9 -9
  58. package/src/agents/AgentModelLabel.tsx +10 -1
  59. package/src/chat/account-choice.ts +8 -0
  60. package/src/chat/mentions.ts +110 -13
  61. package/src/chat/subagent-list.ts +1 -14
  62. package/src/chat/tag-suggestions.ts +121 -0
  63. package/src/chat/ui/Composer.tsx +24 -12
  64. package/src/chat/ui/ComposerInput.tsx +13 -1
  65. package/src/chat/ui/Markdown.tsx +5 -0
  66. package/src/chat/ui/NamedChip.tsx +34 -0
  67. package/src/chat/ui/Pickers.tsx +1 -51
  68. package/src/chat/ui/PromptEditor.tsx +7 -1
  69. package/src/chat/ui/ReferenceChip.tsx +15 -4
  70. package/src/chat/ui/RunSettings.tsx +51 -29
  71. package/src/chat/ui/SubagentInfo.tsx +17 -17
  72. package/src/chat/ui/SubagentTimeline.tsx +7 -2
  73. package/src/chat/ui/Timeline.tsx +11 -5
  74. package/src/chat/ui/chip-clipboard.ts +8 -1
  75. package/src/chat/ui/composer/ComposerControls.tsx +24 -17
  76. package/src/chat/ui/composer/ComposerMenu.tsx +83 -15
  77. package/src/chat/ui/composer/ComposerPlusMenu.tsx +158 -0
  78. package/src/chat/ui/composer/ComposerStatusLine.tsx +94 -0
  79. package/src/chat/ui/composer/chips.ts +78 -7
  80. package/src/chat/ui/composer/insert.ts +12 -0
  81. package/src/chat/ui/composer/use-composer-menus.ts +5 -2
  82. package/src/chat/ui/composer/use-prompt-menus.ts +55 -10
  83. package/src/chat/ui/covered-bottom.ts +7 -0
  84. package/src/chat/ui/named-chip-look.ts +64 -0
  85. package/src/chat/ui/rehype-chips.ts +17 -2
  86. package/src/host-hooks.ts +11 -1
  87. package/src/host.ts +29 -0
  88. package/src/index.ts +2 -0
  89. package/src/locales/en/agent-chat.ts +16 -4
  90. package/src/locales/nl/agent-chat.ts +16 -4
  91. 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(15);
269
+ const $ = _c(25);
211
270
  const {
212
271
  menus,
213
272
  query
@@ -218,84 +277,157 @@ 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 filesLabelShown = query === "";
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] !== files || $[1] !== filesLabelId || $[2] !== filesLabelShown || $[3] !== listId || $[4] !== mentionCount || $[5] !== menus || $[6] !== t) {
227
- t1 = mentionCount > 0 && /*#__PURE__*/_jsxs("div", {
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
- ...(filesLabelShown ? {
231
- "aria-labelledby": filesLabelId
232
- } : {
233
- "aria-label": t("composer.mentions.files")
234
- }),
235
- children: [filesLabelShown && /*#__PURE__*/_jsx(Menu.Label, {
236
- id: filesLabelId,
237
- children: t("composer.mentions.here")
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.chooseMention(path),
248
- children: [/*#__PURE__*/_jsx(FileIcon, {
249
- path: path,
250
- size: 14
317
+ onPick: () => menus.chooseNamed(match),
318
+ children: [/*#__PURE__*/_jsx(NamedMark, {
319
+ menus: menus,
320
+ pick: match
251
321
  }), /*#__PURE__*/_jsx("span", {
252
- className: "truncate font-mono text-text",
253
- children: name
254
- }), dir && /*#__PURE__*/_jsx(MiddleTruncate, {
255
- text: dir,
256
- tooltip: false,
257
- className: "text-text-faint"
322
+ className: "truncate text-text",
323
+ children: match.model.name
324
+ }), /*#__PURE__*/_jsx("span", {
325
+ className: "truncate font-mono text-text-faint",
326
+ children: match.id
327
+ }), /*#__PURE__*/_jsx(ModelMarks, {
328
+ model: match.model
258
329
  })]
259
- }, path);
330
+ }, `${match.cli}/${match.id}`))]
331
+ }), accountMatches.length > 0 && /*#__PURE__*/_jsxs("div", {
332
+ role: "group",
333
+ "aria-labelledby": accountsLabelId,
334
+ children: [/*#__PURE__*/_jsx(Menu.Label, {
335
+ id: accountsLabelId,
336
+ children: t("composer.mentions.accounts")
337
+ }), accountMatches.map((match_0, index_0) => /*#__PURE__*/_jsxs(MenuOption, {
338
+ menus: menus,
339
+ index: accountsFrom + index_0,
340
+ className: "items-center",
341
+ onPick: () => menus.chooseNamed(match_0),
342
+ children: [/*#__PURE__*/_jsx(NamedMark, {
343
+ menus: menus,
344
+ pick: match_0
345
+ }), /*#__PURE__*/_jsx("span", {
346
+ className: "truncate text-text",
347
+ children: match_0.name
348
+ }), /*#__PURE__*/_jsx("span", {
349
+ className: "truncate text-text-faint",
350
+ children: match_0.provider.name
351
+ })]
352
+ }, `${match_0.cli}/${match_0.id}`))]
353
+ }), files.length > 0 && /*#__PURE__*/_jsxs("div", {
354
+ role: "group",
355
+ ...(filesLabel === null ? {
356
+ "aria-label": t("composer.mentions.files")
357
+ } : {
358
+ "aria-labelledby": filesLabelId
359
+ }),
360
+ children: [filesLabel !== null && /*#__PURE__*/_jsx(Menu.Label, {
361
+ id: filesLabelId,
362
+ children: filesLabel
363
+ }), files.map((path, index_1) => {
364
+ const {
365
+ name,
366
+ dir
367
+ } = splitPath(path);
368
+ return /*#__PURE__*/_jsxs(MenuOption, {
369
+ menus: menus,
370
+ index: filesFrom + index_1,
371
+ className: "items-center",
372
+ onPick: () => menus.chooseMention(path),
373
+ children: [/*#__PURE__*/_jsx(FileIcon, {
374
+ path: path,
375
+ size: 14
376
+ }), /*#__PURE__*/_jsx("span", {
377
+ className: "truncate font-mono text-text",
378
+ children: name
379
+ }), dir && /*#__PURE__*/_jsx(MiddleTruncate, {
380
+ text: dir,
381
+ tooltip: false,
382
+ className: "text-text-faint"
383
+ })]
384
+ }, path);
385
+ })]
260
386
  })]
261
387
  });
262
- $[0] = files;
263
- $[1] = filesLabelId;
264
- $[2] = filesLabelShown;
265
- $[3] = listId;
266
- $[4] = mentionCount;
267
- $[5] = menus;
268
- $[6] = t;
269
- $[7] = t1;
388
+ $[4] = accountMatches;
389
+ $[5] = accountsFrom;
390
+ $[6] = accountsLabelId;
391
+ $[7] = files;
392
+ $[8] = filesFrom;
393
+ $[9] = filesLabel;
394
+ $[10] = filesLabelId;
395
+ $[11] = listId;
396
+ $[12] = mentionCount;
397
+ $[13] = menus;
398
+ $[14] = modelMatches;
399
+ $[15] = modelsLabelId;
400
+ $[16] = t;
401
+ $[17] = t2;
270
402
  } else {
271
- t1 = $[7];
403
+ t2 = $[17];
272
404
  }
273
- let t2;
274
- if ($[8] !== mentionCount || $[9] !== query || $[10] !== t) {
275
- t2 = mentionCount === 0 && /*#__PURE__*/_jsx("div", {
405
+ let t3;
406
+ if ($[18] !== mentionCount || $[19] !== query || $[20] !== t) {
407
+ t3 = mentionCount === 0 && /*#__PURE__*/_jsx("div", {
276
408
  className: "px-2 py-1 text-xs text-text-faint",
277
409
  children: query ? t("composer.mentions.noMatch") : t("composer.mentions.empty")
278
410
  });
279
- $[8] = mentionCount;
280
- $[9] = query;
281
- $[10] = t;
282
- $[11] = t2;
411
+ $[18] = mentionCount;
412
+ $[19] = query;
413
+ $[20] = t;
414
+ $[21] = t3;
283
415
  } else {
284
- t2 = $[11];
416
+ t3 = $[21];
285
417
  }
286
- let t3;
287
- if ($[12] !== t1 || $[13] !== t2) {
288
- t3 = /*#__PURE__*/_jsxs("div", {
418
+ let t4;
419
+ if ($[22] !== t2 || $[23] !== t3) {
420
+ t4 = /*#__PURE__*/_jsxs("div", {
289
421
  className: "border-b border-border px-1.5 py-1.5",
290
- children: [t1, t2]
422
+ children: [t2, t3]
291
423
  });
292
- $[12] = t1;
293
- $[13] = t2;
294
- $[14] = t3;
424
+ $[22] = t2;
425
+ $[23] = t3;
426
+ $[24] = t4;
295
427
  } else {
296
- t3 = $[14];
428
+ t4 = $[24];
297
429
  }
298
- return t3;
430
+ return t4;
299
431
  }
300
432
  /* The views, nodes and chats a `#` offers, what stands on this canvas first, each with its kind or what tells it apart. */
301
433
  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
+ }