@aleph-alpha/chat-kit 1.7.0 → 1.9.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/{CkInput.vue_vue_type_script_setup_true_lang-C5C09u0z.js → CkInput.vue_vue_type_script_setup_true_lang-CHPs-R5p.js} +1 -1
- package/dist/adapters/responses-api.d.ts +22 -0
- package/dist/adapters/responses-api.d.ts.map +1 -1
- package/dist/adapters/responses-api.js +9 -5
- package/dist/components/base/CkHistoryItem/activeIndicator.d.ts +2 -12
- package/dist/components/base/CkHistoryItem/activeIndicator.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/adapters/responses-api.spec.ts +51 -0
- package/src/adapters/responses-api.ts +36 -5
- package/src/components/base/CkHistoryItem/activeIndicator.ts +2 -13
- package/src/types.ts +8 -0
|
@@ -489,7 +489,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
const CkFeedbackButton = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-245705b8"]]);
|
|
492
|
-
const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS =
|
|
492
|
+
const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS = "ui-active-indicator";
|
|
493
493
|
const _hoisted_1$3 = ["data-active"];
|
|
494
494
|
const _hoisted_2$2 = { class: "min-w-0 flex-1" };
|
|
495
495
|
const _hoisted_3$1 = { class: "truncate body-14-regular text-content-on-surface-primary" };
|
|
@@ -93,6 +93,22 @@ export interface ResponseToolDescriptor {
|
|
|
93
93
|
* today; extend it as new tool kinds are introduced upstream.
|
|
94
94
|
*/
|
|
95
95
|
export type ResponseOutputToolType = 'mcp_list_tools' | 'mcp_call' | 'tool_call' | 'function_call' | 'web_search_call' | 'file_search_call' | 'code_interpreter_call' | 'image_generation_call' | 'local_shell_call';
|
|
96
|
+
/**
|
|
97
|
+
* Server-provided rendering hints for a tool invocation. The server emits a
|
|
98
|
+
* human-readable `text` (e.g. "Searching the web…") and a lucide.dev `icon`
|
|
99
|
+
* name to display alongside the tool, plus a `phase` describing the current
|
|
100
|
+
* lifecycle stage so the UI can swap labels/icons as the call progresses.
|
|
101
|
+
*
|
|
102
|
+
* Only `'done'` is received in a response today.
|
|
103
|
+
*/
|
|
104
|
+
export interface ResponseOutputToolDisplay {
|
|
105
|
+
/** Human-readable label to render for the tool (server-controlled). */
|
|
106
|
+
text: string;
|
|
107
|
+
/** Lucide.dev icon name to render next to the label. */
|
|
108
|
+
icon: string;
|
|
109
|
+
/** Lifecycle phase of the tool call. */
|
|
110
|
+
phase: 'done';
|
|
111
|
+
}
|
|
96
112
|
/**
|
|
97
113
|
* Tool-related output produced during a Responses-API turn. Covers tool
|
|
98
114
|
* discovery (`mcp_list_tools`), invocation (`mcp_call`, `function_call`,
|
|
@@ -116,6 +132,12 @@ export interface ResponseOutputTool {
|
|
|
116
132
|
call_id?: string;
|
|
117
133
|
/** Tool result payload (shape depends on the tool kind). */
|
|
118
134
|
output?: unknown;
|
|
135
|
+
/**
|
|
136
|
+
* Optional server-provided display hints (label, icon, phase). When
|
|
137
|
+
* present, `responsesToTree` forwards `text` and `icon` onto the
|
|
138
|
+
* resulting `MessageToolContent` so the UI can render them directly.
|
|
139
|
+
*/
|
|
140
|
+
display?: ResponseOutputToolDisplay;
|
|
119
141
|
[key: string]: unknown;
|
|
120
142
|
}
|
|
121
143
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses-api.d.ts","sourceRoot":"","sources":["../../src/adapters/responses-api.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,gBAAgB,EAIjB,MAAM,UAAU,CAAC;AAMlB;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,CAAC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AED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,EAAE,CAAC;CACxB;AAiKD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,gBAAgB,CAkE7E"}
|
|
@@ -20,6 +20,14 @@ function extractReasoningSummary(parts) {
|
|
|
20
20
|
function textPart(text, id) {
|
|
21
21
|
return { type: "text", id: id ?? generateId(), text, status: "completed" };
|
|
22
22
|
}
|
|
23
|
+
function toolPart(out) {
|
|
24
|
+
return {
|
|
25
|
+
type: "tool",
|
|
26
|
+
id: out.id,
|
|
27
|
+
name: out.name ?? out.type,
|
|
28
|
+
...out.display ? { text: out.display.text, icon: out.display.icon } : {}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
23
31
|
function toAssistantParts(resp) {
|
|
24
32
|
const parts = [];
|
|
25
33
|
for (const out of resp.output ?? []) {
|
|
@@ -47,11 +55,7 @@ function toAssistantParts(resp) {
|
|
|
47
55
|
case "mcp_call":
|
|
48
56
|
case "function_call":
|
|
49
57
|
case "tool_call": {
|
|
50
|
-
parts.push(
|
|
51
|
-
type: "tool",
|
|
52
|
-
id: out.id,
|
|
53
|
-
name: out.name ?? out.type
|
|
54
|
-
});
|
|
58
|
+
parts.push(toolPart(out));
|
|
55
59
|
break;
|
|
56
60
|
}
|
|
57
61
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* history row.
|
|
4
|
-
*
|
|
5
|
-
* The `::before` pseudo-element is always mounted so CSS has something to
|
|
6
|
-
* transition. At rest it's painted from `scale-x-0` + `opacity-0` with its
|
|
7
|
-
* transform anchored on the left edge (`origin-left`); when the row's
|
|
8
|
-
* `data-active="true"` flips on, the bar paints in from left to right while
|
|
9
|
-
* fading in, using a 200ms linear curve.
|
|
10
|
-
*
|
|
11
|
-
* Kept as a string constant (rather than generated via `cn`) so UnoCSS's
|
|
12
|
-
* static scanner picks up every utility class for atomic CSS generation.
|
|
2
|
+
* Uses the shared UI library active indicator preflight class.
|
|
13
3
|
*/
|
|
14
|
-
export declare const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS = "
|
|
4
|
+
export declare const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS = "ui-active-indicator";
|
|
15
5
|
//# sourceMappingURL=activeIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activeIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/activeIndicator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"activeIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkHistoryItem/activeIndicator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mCAAmC,wBAAwB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p } from "../CkInput.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p } from "../CkInput.vue_vue_type_script_setup_true_lang-CHPs-R5p.js";
|
|
2
2
|
export {
|
|
3
3
|
_ as CkAgentMessage,
|
|
4
4
|
a as CkConversation,
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { u } from "./useMessageHandler-ZRC-gIOJ.js";
|
|
2
2
|
import { C, d, p, u as u2, a } from "./useChatKitLabels-ftC52m7f.js";
|
|
3
3
|
import { S, c, d as d2, a as a2, u as u3, b, e, f } from "./index-BLq6_Lt2.js";
|
|
4
|
-
import { _, a as a3, b as b2, C as C2, c as c2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2 } from "./CkInput.vue_vue_type_script_setup_true_lang-
|
|
4
|
+
import { _, a as a3, b as b2, C as C2, c as c2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2 } from "./CkInput.vue_vue_type_script_setup_true_lang-CHPs-R5p.js";
|
|
5
5
|
export {
|
|
6
6
|
C as CHAT_KIT_LABELS,
|
|
7
7
|
_ as CkAgentMessage,
|
package/dist/types.d.ts
CHANGED
|
@@ -24,11 +24,19 @@ export interface MessageTextContent {
|
|
|
24
24
|
* Tool invocation triggered by the assistant during its turn. Only the tool
|
|
25
25
|
* name is rendered; arguments and results are intentionally outside the
|
|
26
26
|
* UI-facing model and should be tracked by the host application.
|
|
27
|
+
*
|
|
28
|
+
* `text` and `icon` are optional server-provided display hints (sourced from
|
|
29
|
+
* a `display` block on the wire payload, e.g.
|
|
30
|
+
* `ResponseOutputTool.display`). When present, the UI is expected to render
|
|
31
|
+
* the human-readable `text` and the lucide.dev `icon` instead of falling
|
|
32
|
+
* back to the raw tool `name`.
|
|
27
33
|
*/
|
|
28
34
|
export interface MessageToolContent {
|
|
29
35
|
type: 'tool';
|
|
30
36
|
id: string;
|
|
31
37
|
name: string;
|
|
38
|
+
text?: string;
|
|
39
|
+
icon?: string;
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* Chain-of-thought / reasoning segment produced by the assistant. `text` is
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,WAAW,GAAG,YAAY,CAAC;AAE9E;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE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AAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/chat-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "Chat kit package for building chat interfaces with Vue",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
"node": ">=20.19.0"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
|
-
"access": "public"
|
|
56
|
-
"registry": "https://npm.pkg.github.com"
|
|
55
|
+
"access": "public"
|
|
57
56
|
},
|
|
58
57
|
"repository": {
|
|
59
58
|
"type": "git",
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
"remark-parse": "^11.0.0",
|
|
73
72
|
"remark-rehype": "^11.1.2",
|
|
74
73
|
"unified": "^11.0.5",
|
|
75
|
-
"@aleph-alpha/ui-library": "2.
|
|
74
|
+
"@aleph-alpha/ui-library": "2.5.1"
|
|
76
75
|
},
|
|
77
76
|
"devDependencies": {
|
|
78
77
|
"@storybook/addon-a11y": "10.2.17",
|
|
@@ -271,6 +271,57 @@ describe('responsesToTree', () => {
|
|
|
271
271
|
expect(assistant.content[2].type).toBe('text');
|
|
272
272
|
});
|
|
273
273
|
|
|
274
|
+
it('forwards `display.text` and `display.icon` from a tool output onto the resulting tool content', () => {
|
|
275
|
+
const tree = responsesToTree([
|
|
276
|
+
makeResponse({
|
|
277
|
+
id: 'r1',
|
|
278
|
+
request_input: [userInput('Hello')],
|
|
279
|
+
output: [
|
|
280
|
+
toolOutput({
|
|
281
|
+
id: 'tool-1',
|
|
282
|
+
type: 'mcp_call',
|
|
283
|
+
name: 'firecrawl_scrape',
|
|
284
|
+
display: {
|
|
285
|
+
text: 'Searching the web',
|
|
286
|
+
icon: 'globe',
|
|
287
|
+
phase: 'done',
|
|
288
|
+
},
|
|
289
|
+
}),
|
|
290
|
+
assistantOutput('msg-a1', 'Done'),
|
|
291
|
+
],
|
|
292
|
+
}),
|
|
293
|
+
]);
|
|
294
|
+
|
|
295
|
+
const tool = tree.nodes['msg-a1']!.content[0];
|
|
296
|
+
expect(tool).toMatchObject({
|
|
297
|
+
type: 'tool',
|
|
298
|
+
id: 'tool-1',
|
|
299
|
+
name: 'firecrawl_scrape',
|
|
300
|
+
text: 'Searching the web',
|
|
301
|
+
icon: 'globe',
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('omits `text` / `icon` on tool content when the tool output has no `display` block', () => {
|
|
306
|
+
const tree = responsesToTree([
|
|
307
|
+
makeResponse({
|
|
308
|
+
id: 'r1',
|
|
309
|
+
request_input: [userInput('Hello')],
|
|
310
|
+
output: [
|
|
311
|
+
toolOutput({ id: 'tool-1', type: 'mcp_call', name: 'search' }),
|
|
312
|
+
assistantOutput('msg-a1', 'Done'),
|
|
313
|
+
],
|
|
314
|
+
}),
|
|
315
|
+
]);
|
|
316
|
+
|
|
317
|
+
const tool = tree.nodes['msg-a1']!.content[0];
|
|
318
|
+
expect(tool.type).toBe('tool');
|
|
319
|
+
if (tool.type === 'tool') {
|
|
320
|
+
expect(tool.text).toBeUndefined();
|
|
321
|
+
expect(tool.icon).toBeUndefined();
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
|
|
274
325
|
it('creates an assistant node from reasoning / tool outputs even when no message output is present', () => {
|
|
275
326
|
const tree = responsesToTree([
|
|
276
327
|
makeResponse({
|
|
@@ -142,6 +142,23 @@ export type ResponseOutputToolType =
|
|
|
142
142
|
| 'image_generation_call'
|
|
143
143
|
| 'local_shell_call';
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Server-provided rendering hints for a tool invocation. The server emits a
|
|
147
|
+
* human-readable `text` (e.g. "Searching the web…") and a lucide.dev `icon`
|
|
148
|
+
* name to display alongside the tool, plus a `phase` describing the current
|
|
149
|
+
* lifecycle stage so the UI can swap labels/icons as the call progresses.
|
|
150
|
+
*
|
|
151
|
+
* Only `'done'` is received in a response today.
|
|
152
|
+
*/
|
|
153
|
+
export interface ResponseOutputToolDisplay {
|
|
154
|
+
/** Human-readable label to render for the tool (server-controlled). */
|
|
155
|
+
text: string;
|
|
156
|
+
/** Lucide.dev icon name to render next to the label. */
|
|
157
|
+
icon: string;
|
|
158
|
+
/** Lifecycle phase of the tool call. */
|
|
159
|
+
phase: 'done';
|
|
160
|
+
}
|
|
161
|
+
|
|
145
162
|
/**
|
|
146
163
|
* Tool-related output produced during a Responses-API turn. Covers tool
|
|
147
164
|
* discovery (`mcp_list_tools`), invocation (`mcp_call`, `function_call`,
|
|
@@ -165,6 +182,12 @@ export interface ResponseOutputTool {
|
|
|
165
182
|
call_id?: string;
|
|
166
183
|
/** Tool result payload (shape depends on the tool kind). */
|
|
167
184
|
output?: unknown;
|
|
185
|
+
/**
|
|
186
|
+
* Optional server-provided display hints (label, icon, phase). When
|
|
187
|
+
* present, `responsesToTree` forwards `text` and `icon` onto the
|
|
188
|
+
* resulting `MessageToolContent` so the UI can render them directly.
|
|
189
|
+
*/
|
|
190
|
+
display?: ResponseOutputToolDisplay;
|
|
168
191
|
[key: string]: unknown;
|
|
169
192
|
}
|
|
170
193
|
|
|
@@ -260,6 +283,18 @@ function textPart(text: string, id?: string): MessageContent {
|
|
|
260
283
|
return { type: 'text', id: id ?? generateId(), text, status: 'completed' };
|
|
261
284
|
}
|
|
262
285
|
|
|
286
|
+
// Build a `MessageToolContent` for one tool invocation, forwarding the
|
|
287
|
+
// optional server-provided `display.text` / `display.icon` hints when
|
|
288
|
+
// present so the UI can render them directly.
|
|
289
|
+
function toolPart(out: ResponseOutputTool): MessageContent {
|
|
290
|
+
return {
|
|
291
|
+
type: 'tool',
|
|
292
|
+
id: out.id,
|
|
293
|
+
name: out.name ?? out.type,
|
|
294
|
+
...(out.display ? { text: out.display.text, icon: out.display.icon } : {}),
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
263
298
|
// Build the `content` array for one assistant turn from a Responses-API
|
|
264
299
|
// record. Reasoning trails, tool invocations, and visible text all belong to
|
|
265
300
|
// the same turn and are kept in their original wire order so the UI can
|
|
@@ -291,11 +326,7 @@ function toAssistantParts(resp: StoredResponse): MessageContent[] {
|
|
|
291
326
|
case 'mcp_call':
|
|
292
327
|
case 'function_call':
|
|
293
328
|
case 'tool_call': {
|
|
294
|
-
parts.push(
|
|
295
|
-
type: 'tool',
|
|
296
|
-
id: out.id,
|
|
297
|
-
name: out.name ?? out.type,
|
|
298
|
-
});
|
|
329
|
+
parts.push(toolPart(out));
|
|
299
330
|
break;
|
|
300
331
|
}
|
|
301
332
|
default:
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* history row.
|
|
4
|
-
*
|
|
5
|
-
* The `::before` pseudo-element is always mounted so CSS has something to
|
|
6
|
-
* transition. At rest it's painted from `scale-x-0` + `opacity-0` with its
|
|
7
|
-
* transform anchored on the left edge (`origin-left`); when the row's
|
|
8
|
-
* `data-active="true"` flips on, the bar paints in from left to right while
|
|
9
|
-
* fading in, using a 200ms linear curve.
|
|
10
|
-
*
|
|
11
|
-
* Kept as a string constant (rather than generated via `cn`) so UnoCSS's
|
|
12
|
-
* static scanner picks up every utility class for atomic CSS generation.
|
|
2
|
+
* Uses the shared UI library active indicator preflight class.
|
|
13
3
|
*/
|
|
14
|
-
export const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS =
|
|
15
|
-
'before:absolute before:z-10 before:top-1/2 before:left-0 before:h-1/2 before:w-0.5 before:-translate-y-1/2 before:origin-left before:scale-x-0 before:rounded-full before:bg-background-accent-default before:opacity-0 before:transition-[transform,opacity] before:duration-200 before:ease-linear before:content-[""] data-[active=true]:before:scale-x-100 data-[active=true]:before:opacity-100';
|
|
4
|
+
export const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS = 'ui-active-indicator';
|
package/src/types.ts
CHANGED
|
@@ -29,11 +29,19 @@ export interface MessageTextContent {
|
|
|
29
29
|
* Tool invocation triggered by the assistant during its turn. Only the tool
|
|
30
30
|
* name is rendered; arguments and results are intentionally outside the
|
|
31
31
|
* UI-facing model and should be tracked by the host application.
|
|
32
|
+
*
|
|
33
|
+
* `text` and `icon` are optional server-provided display hints (sourced from
|
|
34
|
+
* a `display` block on the wire payload, e.g.
|
|
35
|
+
* `ResponseOutputTool.display`). When present, the UI is expected to render
|
|
36
|
+
* the human-readable `text` and the lucide.dev `icon` instead of falling
|
|
37
|
+
* back to the raw tool `name`.
|
|
32
38
|
*/
|
|
33
39
|
export interface MessageToolContent {
|
|
34
40
|
type: 'tool';
|
|
35
41
|
id: string;
|
|
36
42
|
name: string;
|
|
43
|
+
text?: string;
|
|
44
|
+
icon?: string;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
/**
|