@adecore/agents-react 0.50.6 → 0.50.7

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.
@@ -22,6 +22,7 @@ export interface Referable {
22
22
  group: 'canvas' | 'views';
23
23
  trail?: readonly ReferenceStep[];
24
24
  section?: ReferenceSection;
25
+ read?(): Promise<string>;
25
26
  }
26
27
  export interface Referables {
27
28
  items: readonly Referable[];
@@ -455,7 +455,7 @@ function Diagram(t0) {
455
455
  return t4;
456
456
  }
457
457
  function MarkdownCode(t0) {
458
- const $ = _c(11);
458
+ const $ = _c(7);
459
459
  const {
460
460
  className,
461
461
  children,
@@ -463,61 +463,42 @@ function MarkdownCode(t0) {
463
463
  } = t0;
464
464
  const plain = t1 === undefined ? false : t1;
465
465
  const block = useContext(BlockCodeContext);
466
+ const {
467
+ renderCodeFence
468
+ } = useChatHost();
466
469
  const text = String(children ?? "");
467
470
  if (block) {
468
471
  let t2;
469
- if ($[0] !== className) {
470
- t2 = languageOf(className);
471
- $[0] = className;
472
- $[1] = t2;
473
- } else {
474
- t2 = $[1];
475
- }
476
- const lang = t2;
477
- let t3;
478
- if ($[2] !== text) {
479
- let t4;
480
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
481
- t4 = /\n$/;
482
- $[4] = t4;
483
- } else {
484
- t4 = $[4];
485
- }
486
- t3 = text.replace(t4, "");
487
- $[2] = text;
488
- $[3] = t3;
489
- } else {
490
- t3 = $[3];
491
- }
492
- const code = t3;
493
- let t4;
494
- if ($[5] !== code || $[6] !== lang) {
495
- t4 = lang === "mermaid" ? /*#__PURE__*/_jsx(Diagram, {
472
+ if ($[0] !== className || $[1] !== renderCodeFence || $[2] !== text) {
473
+ const lang = languageOf(className);
474
+ const code = text.replace(/\n$/, "");
475
+ t2 = renderCodeFence?.(lang, code) ?? (lang === "mermaid" ? /*#__PURE__*/_jsx(Diagram, {
496
476
  code: code
497
477
  }) : /*#__PURE__*/_jsx(CodeBlock, {
498
478
  code: code,
499
479
  lang: lang
500
- });
501
- $[5] = code;
502
- $[6] = lang;
503
- $[7] = t4;
480
+ }));
481
+ $[0] = className;
482
+ $[1] = renderCodeFence;
483
+ $[2] = text;
484
+ $[3] = t2;
504
485
  } else {
505
- t4 = $[7];
486
+ t2 = $[3];
506
487
  }
507
- return t4;
488
+ return t2;
508
489
  }
509
490
  let t2;
510
- if ($[8] !== plain || $[9] !== text) {
491
+ if ($[4] !== plain || $[5] !== text) {
511
492
  t2 = plain ? /*#__PURE__*/_jsx(PlainCode, {
512
493
  text: text
513
494
  }) : /*#__PURE__*/_jsx(InlineCode, {
514
495
  text: text
515
496
  });
516
- $[8] = plain;
517
- $[9] = text;
518
- $[10] = t2;
497
+ $[4] = plain;
498
+ $[5] = text;
499
+ $[6] = t2;
519
500
  } else {
520
- t2 = $[10];
501
+ t2 = $[6];
521
502
  }
522
503
  return t2;
523
504
  }
@@ -18,7 +18,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
18
  const COPIED_MS = 1500;
19
19
  /* Hidden actions keep their height, so hovering never forces the virtualizer to remeasure. */
20
20
  export function MessageActions(t0) {
21
- const $ = _c(59);
21
+ const $ = _c(66);
22
22
  const {
23
23
  chatId,
24
24
  row
@@ -189,81 +189,99 @@ export function MessageActions(t0) {
189
189
  t12 = $[38];
190
190
  }
191
191
  let t13;
192
- if ($[39] !== row.item.createdAt) {
193
- t13 = formatDateTime(row.item.createdAt, TIMESTAMP_FORMAT);
194
- $[39] = row.item.createdAt;
195
- $[40] = t13;
192
+ if ($[39] !== chatId || $[40] !== host || $[41] !== row.id || $[42] !== row.item.text || $[43] !== row.kind) {
193
+ t13 = host.renderMessageActions?.({
194
+ chatId,
195
+ id: row.id,
196
+ kind: row.kind,
197
+ text: row.item.text
198
+ });
199
+ $[39] = chatId;
200
+ $[40] = host;
201
+ $[41] = row.id;
202
+ $[42] = row.item.text;
203
+ $[43] = row.kind;
204
+ $[44] = t13;
196
205
  } else {
197
- t13 = $[40];
206
+ t13 = $[44];
198
207
  }
199
208
  let t14;
200
- if ($[41] !== row.item.createdAt) {
201
- t14 = new Date(row.item.createdAt).toISOString();
202
- $[41] = row.item.createdAt;
203
- $[42] = t14;
209
+ if ($[45] !== row.item.createdAt) {
210
+ t14 = formatDateTime(row.item.createdAt, TIMESTAMP_FORMAT);
211
+ $[45] = row.item.createdAt;
212
+ $[46] = t14;
204
213
  } else {
205
- t14 = $[42];
214
+ t14 = $[46];
206
215
  }
207
- const t15 = row.kind === "assistant" && "order-first";
208
- let t16;
209
- if ($[43] !== t15) {
210
- t16 = clsx("shrink-0 text-xs text-text-faint tabular-nums select-none", t15);
211
- $[43] = t15;
212
- $[44] = t16;
216
+ let t15;
217
+ if ($[47] !== row.item.createdAt) {
218
+ t15 = new Date(row.item.createdAt).toISOString();
219
+ $[47] = row.item.createdAt;
220
+ $[48] = t15;
213
221
  } else {
214
- t16 = $[44];
222
+ t15 = $[48];
215
223
  }
224
+ const t16 = row.kind === "assistant" && "order-first";
216
225
  let t17;
217
- if ($[45] !== row.item.createdAt) {
218
- t17 = formatClock(row.item.createdAt);
219
- $[45] = row.item.createdAt;
220
- $[46] = t17;
226
+ if ($[49] !== t16) {
227
+ t17 = clsx("shrink-0 text-xs text-text-faint tabular-nums select-none", t16);
228
+ $[49] = t16;
229
+ $[50] = t17;
221
230
  } else {
222
- t17 = $[46];
231
+ t17 = $[50];
223
232
  }
224
233
  let t18;
225
- if ($[47] !== t14 || $[48] !== t16 || $[49] !== t17) {
226
- t18 = /*#__PURE__*/_jsx("time", {
227
- dateTime: t14,
228
- className: t16,
229
- children: t17
230
- });
231
- $[47] = t14;
232
- $[48] = t16;
233
- $[49] = t17;
234
- $[50] = t18;
234
+ if ($[51] !== row.item.createdAt) {
235
+ t18 = formatClock(row.item.createdAt);
236
+ $[51] = row.item.createdAt;
237
+ $[52] = t18;
235
238
  } else {
236
- t18 = $[50];
239
+ t18 = $[52];
237
240
  }
238
241
  let t19;
239
- if ($[51] !== t13 || $[52] !== t18) {
240
- t19 = /*#__PURE__*/_jsx(Tooltip, {
241
- label: t13,
242
+ if ($[53] !== t15 || $[54] !== t17 || $[55] !== t18) {
243
+ t19 = /*#__PURE__*/_jsx("time", {
244
+ dateTime: t15,
245
+ className: t17,
242
246
  children: t18
243
247
  });
244
- $[51] = t13;
245
- $[52] = t18;
246
- $[53] = t19;
248
+ $[53] = t15;
249
+ $[54] = t17;
250
+ $[55] = t18;
251
+ $[56] = t19;
247
252
  } else {
248
- t19 = $[53];
253
+ t19 = $[56];
249
254
  }
250
255
  let t20;
251
- if ($[54] !== t11 || $[55] !== t12 || $[56] !== t19 || $[57] !== t9) {
252
- t20 = /*#__PURE__*/_jsxs("div", {
256
+ if ($[57] !== t14 || $[58] !== t19) {
257
+ t20 = /*#__PURE__*/_jsx(Tooltip, {
258
+ label: t14,
259
+ children: t19
260
+ });
261
+ $[57] = t14;
262
+ $[58] = t19;
263
+ $[59] = t20;
264
+ } else {
265
+ t20 = $[59];
266
+ }
267
+ let t21;
268
+ if ($[60] !== t11 || $[61] !== t12 || $[62] !== t13 || $[63] !== t20 || $[64] !== t9) {
269
+ t21 = /*#__PURE__*/_jsxs("div", {
253
270
  role: "toolbar",
254
271
  "aria-label": t9,
255
272
  className: t11,
256
- children: [t12, t19]
273
+ children: [t12, t13, t20]
257
274
  });
258
- $[54] = t11;
259
- $[55] = t12;
260
- $[56] = t19;
261
- $[57] = t9;
262
- $[58] = t20;
275
+ $[60] = t11;
276
+ $[61] = t12;
277
+ $[62] = t13;
278
+ $[63] = t20;
279
+ $[64] = t9;
280
+ $[65] = t21;
263
281
  } else {
264
- t20 = $[58];
282
+ t21 = $[65];
265
283
  }
266
- return t20;
284
+ return t21;
267
285
  }
268
286
  function _temp2(chat_0) {
269
287
  return chat_0?.info ?? null;
@@ -55,10 +55,13 @@ function showRowAtTop(virtualizer, followRef, index) {
55
55
  * and the folder it works in, so a first question can lean on all three.
56
56
  */
57
57
  function EmptyThread(t0) {
58
- const $ = _c(20);
58
+ const $ = _c(24);
59
59
  const {
60
60
  chatId
61
61
  } = t0;
62
+ const {
63
+ renderEmptyThread
64
+ } = useChatHost();
62
65
  const {
63
66
  t
64
67
  } = useTranslation("agent-chat");
@@ -102,8 +105,17 @@ function EmptyThread(t0) {
102
105
  t3 = $[8];
103
106
  }
104
107
  let t4;
105
- if ($[9] !== sources || $[10] !== t) {
106
- t4 = sources.length > 0 && /*#__PURE__*/_jsxs("div", {
108
+ if ($[9] !== chatId || $[10] !== renderEmptyThread) {
109
+ t4 = renderEmptyThread?.(chatId);
110
+ $[9] = chatId;
111
+ $[10] = renderEmptyThread;
112
+ $[11] = t4;
113
+ } else {
114
+ t4 = $[11];
115
+ }
116
+ let t5;
117
+ if ($[12] !== sources || $[13] !== t) {
118
+ t5 = sources.length > 0 && /*#__PURE__*/_jsxs("div", {
107
119
  className: "flex max-w-full flex-col items-center gap-1",
108
120
  children: [/*#__PURE__*/_jsx(SectionLabel, {
109
121
  children: t("timeline.empty.canRead")
@@ -112,15 +124,15 @@ function EmptyThread(t0) {
112
124
  children: sources.map(_temp2).join(", ")
113
125
  })]
114
126
  });
115
- $[9] = sources;
116
- $[10] = t;
117
- $[11] = t4;
127
+ $[12] = sources;
128
+ $[13] = t;
129
+ $[14] = t5;
118
130
  } else {
119
- t4 = $[11];
131
+ t5 = $[14];
120
132
  }
121
- let t5;
122
- if ($[12] !== hidesFolder || $[13] !== info || $[14] !== t) {
123
- t5 = info?.cwd && !hidesFolder && /*#__PURE__*/_jsxs("div", {
133
+ let t6;
134
+ if ($[15] !== hidesFolder || $[16] !== info || $[17] !== t) {
135
+ t6 = info?.cwd && !hidesFolder && /*#__PURE__*/_jsxs("div", {
124
136
  className: "flex max-w-full flex-col items-center gap-1",
125
137
  children: [/*#__PURE__*/_jsx(SectionLabel, {
126
138
  children: t("timeline.empty.worksIn")
@@ -129,30 +141,31 @@ function EmptyThread(t0) {
129
141
  children: info.cwd
130
142
  })]
131
143
  });
132
- $[12] = hidesFolder;
133
- $[13] = info;
134
- $[14] = t;
135
- $[15] = t5;
144
+ $[15] = hidesFolder;
145
+ $[16] = info;
146
+ $[17] = t;
147
+ $[18] = t6;
136
148
  } else {
137
- t5 = $[15];
149
+ t6 = $[18];
138
150
  }
139
- let t6;
140
- if ($[16] !== t3 || $[17] !== t4 || $[18] !== t5) {
141
- t6 = /*#__PURE__*/_jsx("div", {
151
+ let t7;
152
+ if ($[19] !== t3 || $[20] !== t4 || $[21] !== t5 || $[22] !== t6) {
153
+ t7 = /*#__PURE__*/_jsx("div", {
142
154
  className: "flex grow items-center justify-center",
143
155
  children: /*#__PURE__*/_jsxs("div", {
144
156
  className: "flex max-w-sm flex-col items-center gap-3 px-6 py-8 text-center",
145
- children: [t3, t4, t5]
157
+ children: [t3, t4, t5, t6]
146
158
  })
147
159
  });
148
- $[16] = t3;
149
- $[17] = t4;
150
- $[18] = t5;
151
- $[19] = t6;
160
+ $[19] = t3;
161
+ $[20] = t4;
162
+ $[21] = t5;
163
+ $[22] = t6;
164
+ $[23] = t7;
152
165
  } else {
153
- t6 = $[19];
166
+ t7 = $[23];
154
167
  }
155
- return t6;
168
+ return t7;
156
169
  }
157
170
  /*
158
171
  * A row of the thread behind the chapter line of its bookmark. A message, the only row that takes a
@@ -15,6 +15,7 @@ export interface ComposerCommand {
15
15
  name: string;
16
16
  hint: string;
17
17
  local: boolean;
18
+ expand?(args: string): Promise<string>;
18
19
  skill: boolean;
19
20
  }
20
21
  export interface PromptMenusInput<D extends PromptDraft> {