@olares/lares-mobile 0.15.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.
@@ -0,0 +1,386 @@
1
+ <template>
2
+ <ol ref="log" class="lares-log" aria-live="polite" @scroll.passive="onScroll">
3
+ <li v-if="loading && items.length === 0" class="lares-log__skeleton" role="status" :aria-label="t('chat.loading')">
4
+ <span class="lares-sk lares-sk--user" />
5
+ <span class="lares-sk lares-sk--line" />
6
+ <span class="lares-sk lares-sk--line lares-sk--w72" />
7
+ <span class="lares-sk lares-sk--line lares-sk--w40" />
8
+ <span class="lares-sk lares-sk--user" />
9
+ <span class="lares-sk lares-sk--line lares-sk--w88" />
10
+ <span class="lares-sk lares-sk--line lares-sk--w56" />
11
+ </li>
12
+ <li v-else-if="items.length === 0 && !running" class="lares-log__empty">{{ t("chat.empty") }}</li>
13
+ <li
14
+ v-for="(row, index) in items"
15
+ :key="index"
16
+ class="lares-log__item"
17
+ :data-type="row.type"
18
+ :data-pending="row.pending ? 'true' : 'false'"
19
+ >
20
+ <div v-if="row.type === 'user'" class="lares-msg" data-role="user">{{ row.text }}</div>
21
+ <LaresStageRow
22
+ v-else-if="row.type === 'context'"
23
+ kind="context"
24
+ :title="row.role === 'recall' ? stageCopy.contextRecall : stageCopy.contextInjection"
25
+ :summary="row.label || ''"
26
+ :body="row.text"
27
+ />
28
+ <LaresStageRow
29
+ v-else-if="row.type === 'reasoning'"
30
+ kind="think"
31
+ :title="stageCopy.think"
32
+ :summary="thinkSummary(row)"
33
+ :body="row.text"
34
+ />
35
+ <LaresQuestionCard
36
+ v-else-if="row.type === 'tool' && row.name === 'ask_user_question' && row.status === 'running'"
37
+ :questions="questionItems(row)"
38
+ :rpc-id="question?.rpcId || ''"
39
+ :busy="questionBusy"
40
+ :t="t"
41
+ @pick="$emit('answer', $event, row)"
42
+ />
43
+ <LaresStageRow
44
+ v-else-if="row.type === 'tool'"
45
+ kind="tool"
46
+ :variant="row.variant"
47
+ :title="row.title"
48
+ :summary="row.summary"
49
+ :body="row.body"
50
+ />
51
+ <LaresStageRow
52
+ v-else-if="row.type === 'retry'"
53
+ kind="retry"
54
+ :title="retryLabel(row)"
55
+ :body="retryBody(row)"
56
+ />
57
+ <div
58
+ v-else-if="row.type === 'assistant' && row.pending"
59
+ class="lares-md"
60
+ data-pending="true"
61
+ >{{ row.text }}</div>
62
+ <template v-else-if="row.type === 'assistant'">
63
+ <div class="lares-md" v-html="renderMarkdown(row.text)" />
64
+ <LaresMessageActions
65
+ :text="row.text"
66
+ :reaction="reactions[actionKey(index)] || ''"
67
+ :t="t"
68
+ @react="setReaction(index, $event)"
69
+ />
70
+ </template>
71
+ <LaresDeliverables
72
+ v-else-if="row.type === 'files'"
73
+ :group="fileGroup(row.paths)"
74
+ :media-url="mediaUrl"
75
+ :t="t"
76
+ @open="$emit('open', $event)"
77
+ @media="$emit('media')"
78
+ />
79
+ </li>
80
+ </ol>
81
+ </template>
82
+
83
+ <script>
84
+ import { partitionPreviews } from "@olares/lares-core/files/preview-groups";
85
+ import { parseAskUserQuestions } from "@olares/lares-core/larepass/questions";
86
+ import { STAGE_COPY } from "@olares/lares-core/larepass/stage-copy";
87
+ import { retryStatus as formatRetry, thinkSummary } from "./format.js";
88
+ import { renderMarkdown } from "./markdown.js";
89
+ import LaresDeliverables from "./Deliverables.vue";
90
+ import LaresQuestionCard from "./QuestionCard.vue";
91
+ import LaresMessageActions from "./MessageActions.vue";
92
+ import LaresStageRow from "./StageRow.vue";
93
+
94
+ export default {
95
+ name: "LaresTranscript",
96
+ components: { LaresDeliverables, LaresQuestionCard, LaresMessageActions, LaresStageRow },
97
+ props: {
98
+ items: { type: Array, default: () => [] },
99
+ running: { type: Boolean, default: false },
100
+ loading: { type: Boolean, default: false },
101
+ previews: { type: Object, default: () => ({}) },
102
+ mediaUrl: { type: Function, required: true },
103
+ scrollTop: { type: Function, required: true },
104
+ rememberScroll: { type: Function, required: true },
105
+ sticking: { type: Function, required: true },
106
+ sessionId: { type: String, default: "" },
107
+ question: { type: Object, default: null },
108
+ questionBusy: { type: Boolean, default: false },
109
+ t: { type: Function, required: true },
110
+ },
111
+ emits: ["open", "media", "answer"],
112
+ data() {
113
+ return {
114
+ applyingScroll: false,
115
+ logRo: null,
116
+ logPin: 0,
117
+ stageCopy: STAGE_COPY,
118
+ reactions: {},
119
+ };
120
+ },
121
+ watch: {
122
+ sessionId() {
123
+ this.reactions = {};
124
+ },
125
+ },
126
+ mounted() {
127
+ this.bindLog();
128
+ this.restoreLog();
129
+ },
130
+ beforeUnmount() {
131
+ this.captureLog();
132
+ this.unbindLog();
133
+ if (this.logPin) cancelAnimationFrame(this.logPin);
134
+ },
135
+ methods: {
136
+ renderMarkdown,
137
+ thinkSummary,
138
+ questionItems(row) {
139
+ if (this.question?.questions?.length) return this.question.questions;
140
+ return parseAskUserQuestions(row.argsRaw);
141
+ },
142
+ retryLabel(row) {
143
+ return formatRetry(row);
144
+ },
145
+ retryBody(row) {
146
+ const copy = STAGE_COPY.retry;
147
+ const lines = [];
148
+ if (row.delayMs != null) lines.push(`${copy.delay}${Math.round(row.delayMs)}ms`);
149
+ if (row.failure?.message) lines.push(`${copy.failure}${row.failure.message}`);
150
+ return lines.join("\n");
151
+ },
152
+ fileGroup(paths) {
153
+ return partitionPreviews(paths, new Map(Object.entries(this.previews)));
154
+ },
155
+ actionKey(index) {
156
+ let n = 0;
157
+ for (let i = 0; i <= index; i++) {
158
+ if (this.items[i]?.type === "assistant") n += 1;
159
+ }
160
+ return String(n);
161
+ },
162
+ setReaction(index, next) {
163
+ this.reactions = { ...this.reactions, [this.actionKey(index)]: next };
164
+ },
165
+ captureLog() {
166
+ if (this.applyingScroll) return;
167
+ const log = this.$refs.log;
168
+ if (!log) return;
169
+ this.rememberScroll(log.scrollTop, log.scrollHeight, log.clientHeight);
170
+ },
171
+ onScroll() {
172
+ this.captureLog();
173
+ },
174
+ bindLog() {
175
+ const log = this.$refs.log;
176
+ if (!log || this.logRo) return;
177
+ this.logRo = new ResizeObserver(() => this.applyLogScroll());
178
+ this.logRo.observe(log);
179
+ },
180
+ unbindLog() {
181
+ this.logRo?.disconnect();
182
+ this.logRo = null;
183
+ },
184
+ applyLogScroll() {
185
+ const log = this.$refs.log;
186
+ if (!log) return;
187
+ const top = this.scrollTop(log.scrollHeight, log.clientHeight);
188
+ if (top == null) return;
189
+ this.applyingScroll = true;
190
+ log.scrollTop = top;
191
+ requestAnimationFrame(() => {
192
+ this.applyingScroll = false;
193
+ });
194
+ },
195
+ restoreLog() {
196
+ this.$nextTick(() => {
197
+ this.bindLog();
198
+ this.applyLogScroll();
199
+ });
200
+ },
201
+ scheduleLogPin() {
202
+ if (!this.sticking() || this.logPin) return;
203
+ this.logPin = requestAnimationFrame(() => {
204
+ this.logPin = 0;
205
+ this.applyLogScroll();
206
+ });
207
+ },
208
+ },
209
+ };
210
+ </script>
211
+
212
+ <style scoped>
213
+ .lares-log {
214
+ display: flex;
215
+ flex-direction: column;
216
+ gap: 8px;
217
+ margin: 0;
218
+ padding: 8px 20px 12px;
219
+ min-height: 0;
220
+ flex: 1;
221
+ overflow-x: hidden;
222
+ overflow-y: auto;
223
+ list-style: none;
224
+ }
225
+
226
+ .lares-log__empty {
227
+ margin: 24px 0 0;
228
+ font-size: 13px;
229
+ color: var(--q-ink-3);
230
+ }
231
+
232
+ .lares-log__skeleton {
233
+ display: flex;
234
+ flex-direction: column;
235
+ gap: 10px;
236
+ margin-top: 8px;
237
+ }
238
+
239
+ .lares-sk {
240
+ display: block;
241
+ border-radius: 10px;
242
+ background: var(--q-background-3);
243
+ animation: lares-sk-pulse 1.2s ease-in-out infinite;
244
+ }
245
+
246
+ .lares-sk--user {
247
+ align-self: flex-end;
248
+ width: 42%;
249
+ height: 36px;
250
+ border-radius: 16px 16px 4px 16px;
251
+ background: var(--q-blue-alpha);
252
+ }
253
+
254
+ .lares-sk--line {
255
+ width: 100%;
256
+ height: 14px;
257
+ border-radius: 7px;
258
+ }
259
+
260
+ .lares-sk--w88 { width: 88%; }
261
+ .lares-sk--w72 { width: 72%; }
262
+ .lares-sk--w56 { width: 56%; }
263
+ .lares-sk--w40 { width: 40%; }
264
+
265
+ @keyframes lares-sk-pulse {
266
+ 50% { opacity: 0.45; }
267
+ }
268
+
269
+ @media (prefers-reduced-motion: reduce) {
270
+ .lares-sk {
271
+ animation: none;
272
+ }
273
+ }
274
+
275
+ .lares-log__item {
276
+ display: flex;
277
+ flex-direction: column;
278
+ gap: 8px;
279
+ min-width: 0;
280
+ max-width: 100%;
281
+ }
282
+
283
+ .lares-log__item[data-type="user"],
284
+ .lares-log__item[data-type="assistant"],
285
+ .lares-log__item[data-type="files"] {
286
+ margin-top: 8px;
287
+ }
288
+
289
+ .lares-msg[data-role="user"] {
290
+ align-self: flex-end;
291
+ max-width: 86%;
292
+ border-radius: 16px 16px 4px 16px;
293
+ padding: 8px 12px;
294
+ background: var(--q-blue-alpha);
295
+ white-space: pre-wrap;
296
+ word-break: break-word;
297
+ }
298
+
299
+ .lares-log__item[data-pending="true"] .lares-msg {
300
+ opacity: 0.72;
301
+ }
302
+
303
+ .lares-md {
304
+ align-self: stretch;
305
+ min-width: 0;
306
+ max-width: 100%;
307
+ overflow-x: hidden;
308
+ font-size: 15px;
309
+ line-height: 1.55;
310
+ word-break: break-word;
311
+ overflow-wrap: anywhere;
312
+ }
313
+
314
+ .lares-md[data-pending="true"] {
315
+ white-space: pre-wrap;
316
+ opacity: 0.92;
317
+ }
318
+
319
+ .lares-md :deep(p),
320
+ .lares-md :deep(pre) {
321
+ margin: 0 0 10px;
322
+ }
323
+
324
+ .lares-md :deep(ul),
325
+ .lares-md :deep(ol) {
326
+ margin: 4px 0 12px;
327
+ padding: 0 0 0 1.35em;
328
+ }
329
+
330
+ .lares-md :deep(ul) {
331
+ list-style: disc outside;
332
+ }
333
+
334
+ .lares-md :deep(ol) {
335
+ list-style: decimal outside;
336
+ }
337
+
338
+ .lares-md :deep(li + li) {
339
+ margin-top: 6px;
340
+ }
341
+
342
+ .lares-md :deep(p:last-child),
343
+ .lares-md :deep(ul:last-child),
344
+ .lares-md :deep(ol:last-child),
345
+ .lares-md :deep(pre:last-child) {
346
+ margin-bottom: 0;
347
+ }
348
+
349
+ .lares-md :deep(h1),
350
+ .lares-md :deep(h2),
351
+ .lares-md :deep(h3) {
352
+ margin: 0 0 8px;
353
+ font-size: 16px;
354
+ font-weight: 600;
355
+ }
356
+
357
+ .lares-md :deep(code) {
358
+ border-radius: 4px;
359
+ padding: 1px 4px;
360
+ background: var(--q-background-3);
361
+ font-size: 13px;
362
+ }
363
+
364
+ .lares-md :deep(pre) {
365
+ box-sizing: border-box;
366
+ max-width: 100%;
367
+ overflow-x: auto;
368
+ border-radius: 10px;
369
+ padding: 10px 12px;
370
+ background: var(--q-background-3);
371
+ }
372
+
373
+ .lares-md :deep(pre code) {
374
+ padding: 0;
375
+ background: transparent;
376
+ }
377
+
378
+ .lares-md :deep(img) {
379
+ max-width: 100%;
380
+ height: auto;
381
+ }
382
+
383
+ .lares-md :deep(a) {
384
+ color: var(--q-blue-default);
385
+ }
386
+ </style>
@@ -0,0 +1,69 @@
1
+ import { interpolate } from "@olares/lares-core/i18n/t";
2
+ import { STAGE_COPY } from "@olares/lares-core/larepass/stage-copy";
3
+
4
+ export function withPendingUser(items, pendingUser) {
5
+ if (!pendingUser) return items;
6
+ const last = [...items].reverse().find((row) => row.type === "user");
7
+ if (last?.text === pendingUser) return items;
8
+ return [...items, { type: "user", text: pendingUser, pending: true }];
9
+ }
10
+
11
+ export function lastIndexOfType(items, type) {
12
+ for (let i = (items?.length ?? 0) - 1; i >= 0; i--) {
13
+ if (items[i]?.type === type) return i;
14
+ }
15
+ return -1;
16
+ }
17
+
18
+ export function lastUserText(items) {
19
+ for (let i = (items?.length ?? 0) - 1; i >= 0; i--) {
20
+ const row = items[i];
21
+ if (row?.type === "user" && !row.pending) {
22
+ const text = String(row.text ?? "").trim();
23
+ if (text) return text;
24
+ }
25
+ }
26
+ return "";
27
+ }
28
+
29
+ export function firstLine(text) {
30
+ const value = String(text ?? "");
31
+ const newline = value.indexOf("\n");
32
+ return newline === -1 ? value : value.slice(0, newline);
33
+ }
34
+
35
+ export function latestLine(text) {
36
+ const visible = String(text ?? "").trimEnd();
37
+ const newline = visible.lastIndexOf("\n");
38
+ return newline === -1 ? visible : visible.slice(newline + 1);
39
+ }
40
+
41
+ export function thinkSummary(row) {
42
+ return row?.running ? latestLine(row.text) : firstLine(row.text);
43
+ }
44
+
45
+ export function failText(t, failed, error) {
46
+ if (failed === "unauthorized") return t("chat.unauthorized");
47
+ if (failed === "missing" || failed === "unreachable" || failed === "error") {
48
+ return t(`probe.${failed}`, { http: "", error: "" });
49
+ }
50
+ return t("chat.failed", { error: failed || error });
51
+ }
52
+
53
+ export function retryStatus(row) {
54
+ const copy = STAGE_COPY.retry;
55
+ const label = row.retryState === "started"
56
+ ? copy.started
57
+ : row.retryState === "cancelled"
58
+ ? copy.cancelled
59
+ : row.retryState === "active"
60
+ ? copy.active
61
+ : copy.scheduled;
62
+ const maximum = row.mode === "normal" ? row.maxRetries : (row.maxRetries ?? "∞");
63
+ return interpolate(copy.status, {
64
+ label,
65
+ retry: row.retry,
66
+ maximum,
67
+ seconds: row.seconds,
68
+ });
69
+ }
@@ -0,0 +1,16 @@
1
+ import MarkdownIt from "markdown-it";
2
+
3
+ const md = new MarkdownIt({ html: false, linkify: true, breaks: false });
4
+
5
+ const defaultLinkOpen = md.renderer.rules.link_open
6
+ || ((tokens, idx, options, env, self) => self.renderToken(tokens, idx, options));
7
+
8
+ md.renderer.rules.link_open = (tokens, idx, options, env, self) => {
9
+ tokens[idx].attrSet("rel", "noreferrer");
10
+ tokens[idx].attrSet("target", "_blank");
11
+ return defaultLinkOpen(tokens, idx, options, env, self);
12
+ };
13
+
14
+ export function renderMarkdown(source) {
15
+ return md.render(String(source ?? ""));
16
+ }
@@ -0,0 +1,117 @@
1
+ /** Glyphs match dsh-client-ui-primitives leading icons (14px in a 16px box). */
2
+
3
+ import { toolVariantIcon } from "@olares/lares-core/larepass/tool-row";
4
+
5
+ export const GLYPHS = {
6
+ "search": {
7
+ "viewBox": "0 0 16 16",
8
+ "size": 16,
9
+ "paths": [
10
+ {
11
+ "d": "M11.894845 6.647401C11.894845 3.725463 9.534486 1.356779 6.623219 1.35657C3.711786 1.35657 1.351635 3.725338 1.351635 6.647401C1.351843 9.569296 3.711911 11.938273 6.623219 11.938273C9.534361 11.938064 11.894637 9.569171 11.894845 6.647401ZM13.245462 6.647401C13.245254 10.317935 10.280401 13.293613 6.623219 13.293821C2.965871 13.293821 0.000204 10.31806 0 6.647401C0 2.976574 2.965746 0 6.623219 0C10.280526 0.000205 13.245462 2.9767 13.245462 6.647401Z"
12
+ },
13
+ {
14
+ "d": "M16.000417 15.041079L15.044449 16.000433L11.530434 12.473588L12.486298 11.514234L16.000417 15.041079Z"
15
+ }
16
+ ]
17
+ },
18
+ "think": {
19
+ "viewBox": "0 0 14 14",
20
+ "size": 14,
21
+ "paths": [
22
+ {
23
+ "d": "M7.06431 5.93342C7.68763 5.93342 8.19307 6.43904 8.19322 7.06233C8.19322 7.68573 7.68772 8.19123 7.06431 8.19123C6.44099 8.19113 5.9354 7.68567 5.9354 7.06233C5.93555 6.43911 6.44108 5.93353 7.06431 5.93342Z"
24
+ },
25
+ {
26
+ "d": "M8.6815 0.963693C10.1169 0.447019 11.6266 0.374829 12.5633 1.31135C13.5 2.24805 13.4277 3.75776 12.911 5.19319C12.7126 5.74431 12.4386 6.31796 12.0965 6.89729C12.4969 7.54638 12.8141 8.19018 13.036 8.80647C13.5527 10.2419 13.6251 11.7516 12.6883 12.6883C11.7516 13.625 10.242 13.5527 8.8065 13.036C8.19022 12.8141 7.54641 12.4969 6.89732 12.0965C6.31797 12.4386 5.74435 12.7125 5.19322 12.911C3.75777 13.4276 2.2481 13.5 1.31138 12.5633C0.374859 11.6266 0.447049 10.1168 0.963724 8.68147C1.17185 8.10338 1.46321 7.50063 1.82896 6.8924C1.52182 6.35711 1.27235 5.82825 1.08872 5.31819C0.572068 3.88278 0.499714 2.37306 1.43638 1.43635C2.37308 0.499655 3.8828 0.572044 5.31822 1.08869C5.82828 1.27232 6.35715 1.5218 6.89243 1.82893C7.50066 1.46318 8.10341 1.17181 8.6815 0.963693ZM11.3573 8.01154C10.9083 8.62253 10.3901 9.22873 9.80943 9.8094C9.22877 10.3901 8.62255 10.9083 8.01158 11.3572C8.4257 11.5841 8.8287 11.7688 9.21275 11.9071C10.5456 12.3868 11.4246 12.2547 11.8397 11.8397C12.2548 11.4246 12.3869 10.5456 11.9071 9.21272C11.7688 8.82866 11.5841 8.42568 11.3573 8.01154ZM2.56529 8.02912C2.37344 8.39322 2.21495 8.74796 2.09263 9.08772C1.61291 10.4204 1.74512 11.2995 2.16001 11.7147C2.57505 12.1297 3.45415 12.2618 4.78697 11.7821C5.11057 11.6656 5.44786 11.5164 5.7938 11.3367C5.249 10.9223 4.70922 10.4533 4.19029 9.9344C3.57578 9.31987 3.03169 8.67633 2.56529 8.02912ZM6.90708 3.2469C6.24065 3.70479 5.5646 4.26321 4.91392 4.91389C4.26325 5.56456 3.70482 6.24063 3.24693 6.90705C3.72674 7.63325 4.32777 8.37459 5.03892 9.08576C5.64943 9.69627 6.28183 10.2265 6.90806 10.6678C7.59368 10.2025 8.2908 9.63076 8.96079 8.96076C9.6308 8.29075 10.2025 7.59366 10.6678 6.90803C10.2265 6.2818 9.69631 5.6494 9.08579 5.03889C8.37462 4.32773 7.63328 3.72672 6.90708 3.2469ZM11.7147 2.15998C11.2996 1.74509 10.4204 1.61288 9.08775 2.0926C8.74835 2.21479 8.39382 2.37271 8.03013 2.56428C8.67728 3.03065 9.31995 3.5758 9.93443 4.19026C10.4534 4.7092 10.9223 5.24896 11.3368 5.79377C11.5164 5.44785 11.6656 5.11052 11.7821 4.78694C12.2618 3.45416 12.1297 2.57502 11.7147 2.15998ZM4.91197 2.2176C3.57922 1.73788 2.70004 1.86995 2.28501 2.28498C1.87001 2.70003 1.73791 3.5792 2.21763 4.91194C2.31709 5.18822 2.44112 5.47427 2.58677 5.7674C3.01931 5.1887 3.51474 4.6158 4.06529 4.06526C4.61584 3.5147 5.18872 3.01928 5.76743 2.58674C5.47431 2.4411 5.18824 2.31706 4.91197 2.2176Z",
27
+ "fillRule": "evenodd",
28
+ "clipRule": "evenodd"
29
+ }
30
+ ]
31
+ },
32
+ "browse": {
33
+ "viewBox": "0 0 16 16",
34
+ "size": 16,
35
+ "paths": [
36
+ {
37
+ "d": "M11.2426 4.80473V6.10551H4.75819V4.80473H11.2426Z"
38
+ },
39
+ {
40
+ "d": "M9.40858 7.84478V9.14557H4.75819V7.84478H9.40858Z"
41
+ },
42
+ {
43
+ "d": "M9.23438 0.546389C10.1941 0.546389 10.9683 0.544914 11.5859 0.611819C12.2161 0.680096 12.7634 0.825745 13.2393 1.17139C13.5172 1.3733 13.7619 1.61812 13.9639 1.896C14.3096 2.37183 14.4551 2.91922 14.5234 3.54932C14.5903 4.16686 14.5889 4.94133 14.5889 5.90088V10.0981C14.5889 11.0576 14.5903 11.8321 14.5234 12.4497C14.4552 13.0798 14.3094 13.6272 13.9639 14.103C13.7619 14.381 13.5172 14.6257 13.2393 14.8276C12.7633 15.1734 12.2163 15.3189 11.5859 15.3872C10.9683 15.4541 10.1942 15.4536 9.23438 15.4536H6.76563C5.80591 15.4536 5.03168 15.4541 4.41407 15.3872C3.78385 15.3189 3.23665 15.1734 2.76074 14.8276C2.48291 14.6257 2.23802 14.3809 2.03614 14.103C1.69066 13.6272 1.54483 13.0798 1.47657 12.4497C1.40973 11.8321 1.41114 11.0576 1.41114 10.0981V5.90088C1.41113 4.94132 1.40966 4.16686 1.47657 3.54932C1.54488 2.91921 1.69042 2.37184 2.03614 1.896C2.2381 1.61807 2.4828 1.37333 2.76074 1.17139C3.23665 0.825682 3.78386 0.680109 4.41407 0.611819C5.03168 0.544905 5.80591 0.546389 6.76563 0.546389H9.23438ZM6.76563 1.896C5.77586 1.896 5.0876 1.89738 4.55957 1.95459C4.0443 2.01043 3.76214 2.11349 3.55469 2.26416C3.39135 2.38284 3.24761 2.52662 3.12891 2.68994C2.97821 2.89736 2.8752 3.17967 2.81934 3.69483C2.76214 4.22279 2.76075 4.91131 2.76074 5.90088V10.0981C2.76074 11.0876 2.76221 11.7762 2.81934 12.3042C2.87516 12.8194 2.97829 13.1026 3.12891 13.3101C3.24754 13.4733 3.39147 13.6172 3.55469 13.7358C3.76213 13.8865 4.04438 13.9896 4.55957 14.0454C5.0876 14.1026 5.77586 14.103 6.76563 14.103H9.23438C10.2242 14.103 10.9124 14.1026 11.4404 14.0454C11.9556 13.9896 12.2379 13.8865 12.4453 13.7358C12.6086 13.6172 12.7525 13.4733 12.8711 13.3101C13.0217 13.1026 13.1248 12.8195 13.1807 12.3042C13.2378 11.7762 13.2393 11.0876 13.2393 10.0981V5.90088C13.2393 4.91131 13.2379 4.22279 13.1807 3.69483C13.1248 3.17969 13.0218 2.89736 12.8711 2.68994C12.7524 2.52667 12.6086 2.38281 12.4453 2.26416C12.2379 2.11355 11.9556 2.01041 11.4404 1.95459C10.9124 1.8974 10.2241 1.896 9.23438 1.896H6.76563Z"
44
+ }
45
+ ]
46
+ },
47
+ "edit": {
48
+ "viewBox": "0 0 16 16",
49
+ "size": 16,
50
+ "paths": [
51
+ {
52
+ "d": "M9.94076 1.34942C10.7047 0.90231 11.6503 0.902415 12.4143 1.34942C12.7061 1.52015 12.9688 1.79118 13.3104 2.13284C13.6521 2.47448 13.9231 2.73721 14.0939 3.02894C14.5408 3.79294 14.5409 4.73856 14.0939 5.50251C13.9231 5.79415 13.652 6.05704 13.3104 6.39861L6.65932 13.0497C6.28068 13.4284 6.00695 13.7108 5.66543 13.9097C5.32391 14.1085 4.94315 14.2074 4.42705 14.3498L3.24394 14.6761C2.77527 14.8054 2.34538 14.9262 2.00131 14.9684C1.65196 15.0112 1.17964 15.0013 0.810764 14.6325C0.441921 14.2637 0.432107 13.7913 0.47486 13.442C0.517035 13.0979 0.6379 12.668 0.767181 12.1993L1.09352 11.0162C1.23588 10.5001 1.33481 10.1193 1.5336 9.77784C1.7325 9.43632 2.0149 9.1626 2.39355 8.78395L9.04466 2.13284C9.38625 1.79126 9.64911 1.52016 9.94076 1.34942ZM15.5427 14.8398H7.55223L8.96707 13.425H15.5427V14.8398ZM3.39382 9.78422C2.965 10.213 2.84244 10.3436 2.75709 10.49C2.67183 10.6366 2.61862 10.8079 2.45733 11.3925L2.13099 12.5756C2.00183 13.0439 1.92194 13.3419 1.88863 13.5536C2.10041 13.5204 2.39872 13.4416 2.86764 13.3123L4.05075 12.9859C4.63544 12.8246 4.80669 12.7715 4.95323 12.6862C5.09968 12.6008 5.23022 12.4783 5.65905 12.0494L10.721 6.98644L8.45577 4.72121L3.39382 9.78422ZM11.7 2.57079C11.3774 2.38198 10.9777 2.38198 10.6551 2.57079C10.5602 2.62647 10.4487 2.72931 10.0449 3.13311L9.45604 3.72094L11.7213 5.98617L12.3102 5.39833C12.7139 4.99457 12.8168 4.88307 12.8725 4.78818C13.0613 4.46561 13.0612 4.06585 12.8725 3.74326C12.8169 3.64827 12.7146 3.53752 12.3102 3.13311C11.9057 2.72863 11.795 2.6264 11.7 2.57079Z"
53
+ }
54
+ ]
55
+ },
56
+ "code": {
57
+ "viewBox": "0 0 16 16",
58
+ "size": 16,
59
+ "paths": [
60
+ {
61
+ "d": "M12.3368 1.53569L11.931 4.43172H14.8086V5.79673H11.7404L11.1962 9.67859H14.2839V11.0436H11.0056L10.4994 14.6529L9.14873 14.4643L9.62731 11.0436H5.75876L5.25252 14.6529L3.90186 14.4643L4.38043 11.0436H1.69141V9.67859H4.57104L5.11417 5.79673H2.21609V4.43172H5.30581L5.73724 1.34713L7.08995 1.53569L6.68414 4.43172H10.5527L10.9841 1.34713L12.3368 1.53569ZM5.94937 9.67859H9.81791L10.361 5.79673H6.49353L5.94937 9.67859Z",
62
+ "fillRule": "evenodd",
63
+ "clipRule": "evenodd"
64
+ }
65
+ ]
66
+ },
67
+ "api": {
68
+ "viewBox": "0 0 14 14",
69
+ "size": 14,
70
+ "paths": [
71
+ {
72
+ "d": "M11.4818 5.57813C11.4818 4.45301 11.4807 3.66237 11.4075 3.05908C11.3359 2.46953 11.2024 2.13852 10.9939 1.89441C10.9247 1.81341 10.8493 1.73801 10.7683 1.66882C10.5242 1.46033 10.1932 1.32686 9.60364 1.25525C9.00034 1.18198 8.20974 1.18091 7.0846 1.18091L5.57813 1.18091C4.45301 1.18091 3.66238 1.18198 3.05908 1.25525C2.46953 1.32686 2.13852 1.46033 1.89441 1.66882C1.81341 1.73801 1.73801 1.81341 1.66882 1.89441C1.46033 2.13852 1.32686 2.46953 1.25525 3.05908C1.18198 3.66238 1.18091 4.45301 1.18091 5.57813L1.18091 6.2771C1.18091 7.40218 1.18197 8.19288 1.25525 8.79614C1.32687 9.38553 1.46036 9.71674 1.66882 9.96082C1.73797 10.0417 1.81347 10.1173 1.89441 10.1864C2.13851 10.3948 2.46965 10.5275 3.05908 10.5991C3.66238 10.6724 4.45298 10.6735 5.57813 10.6735L7.0846 10.6735C8.20977 10.6735 9.00033 10.6724 9.60364 10.5991C10.1931 10.5275 10.5242 10.3948 10.7683 10.1864C10.8493 10.1173 10.9247 10.0417 10.9939 9.96082C11.2024 9.71674 11.3358 9.38553 11.4075 8.79614C11.4808 8.19288 11.4818 7.40218 11.4818 6.2771L11.4818 5.57813ZM12.6627 6.2771C12.6627 7.37222 12.6637 8.247 12.5798 8.93799C12.4942 9.64284 12.3133 10.2359 11.8928 10.7282C11.7834 10.8562 11.6637 10.9751 11.5356 11.0845C11.0434 11.5049 10.4511 11.6867 9.74634 11.7723C9.05525 11.8563 8.17999 11.8552 7.0846 11.8552L5.57813 11.8552C4.48273 11.8552 3.60747 11.8563 2.91638 11.7723C2.21157 11.6867 1.61933 11.5049 1.12708 11.0845C0.99901 10.9751 0.879281 10.8562 0.769898 10.7282C0.349454 10.2359 0.168506 9.64284 0.0828864 8.93799C-0.00101964 8.247 4.88512e-07 7.37222 6.47206e-07 6.2771L6.47206e-07 5.57813C6.47206e-07 4.48273 -0.00106163 3.60747 0.0828864 2.91638C0.168502 2.21168 0.349594 1.61928 0.769898 1.12708C0.879302 0.998981 0.998981 0.879302 1.12708 0.769898C1.61928 0.349594 2.21168 0.168502 2.91638 0.0828864C3.60747 -0.00106163 4.48273 6.47206e-07 5.57813 6.47206e-07L7.0846 6.47206e-07C8.17999 6.47206e-07 9.05525 -0.00106163 9.74634 0.0828864C10.451 0.168505 11.0434 0.349587 11.5356 0.769898C11.6637 0.879302 11.7834 0.998981 11.8928 1.12708C12.3131 1.61928 12.4942 2.21169 12.5798 2.91638C12.6638 3.60747 12.6627 4.48273 12.6627 5.57813L12.6627 6.2771Z",
73
+ "transform": "translate(0.6689 1.073)"
74
+ },
75
+ {
76
+ "d": "M6.02607 5.50955L6.44306 5.9274L3.84284 8.52762L3.425 8.11063L3.00715 7.69278L4.77253 5.9274L3.00715 4.16202L3.84284 3.32633L6.02607 5.50955Z",
77
+ "transform": "translate(0.6689 1.073)"
78
+ },
79
+ {
80
+ "d": "M9.23789 7.35397L9.23789 8.53488L6.96238 8.53488L6.96238 7.35397L9.23789 7.35397Z",
81
+ "transform": "translate(0.6689 1.073)"
82
+ }
83
+ ]
84
+ },
85
+ "sparkle": {
86
+ "viewBox": "0 0 16 16",
87
+ "size": 16,
88
+ "paths": [
89
+ {
90
+ "d": "M6.1 3.1Q6.6 7.8 11.3 8.3Q6.6 8.8 6.1 13.5Q5.6 8.8 0.9 8.3Q5.6 7.8 6.1 3.1Z"
91
+ },
92
+ {
93
+ "d": "M11.9 1Q12.2 3.7 14.9 4Q12.2 4.3 11.9 7Q11.6 4.3 8.9 4Q11.6 3.7 11.9 1Z"
94
+ },
95
+ {
96
+ "d": "M12.5 9.4Q12.7 11.4 14.7 11.6Q12.7 11.8 12.5 13.8Q12.3 11.8 10.3 11.6Q12.3 11.4 12.5 9.4Z"
97
+ }
98
+ ]
99
+ },
100
+ "refresh": {
101
+ "viewBox": "0 0 14 14",
102
+ "size": 14,
103
+ "paths": [
104
+ {
105
+ "d": "M1.272 6.21348C1.70645 3.08888 4.59169 0.908064 7.71634 1.34239C8.95495 1.51469 10.0438 2.07331 10.8814 2.87755L11.9458 1.81407C12.1347 1.6255 12.4572 1.75911 12.4575 2.02598V5.08751C12.4574 5.25303 12.3233 5.38731 12.1577 5.38731H9.0972C8.82993 5.38731 8.69629 5.06361 8.88528 4.87462L10.0327 3.72618C9.3732 3.09994 8.52006 2.66569 7.5513 2.53087C5.08313 2.18779 2.80376 3.91044 2.46048 6.37852C2.11747 8.84665 3.84009 11.1261 6.30814 11.4693C8.77612 11.8121 11.0557 10.0896 11.399 7.62169L11.9937 7.70372L12.5874 7.78673C12.153 10.9112 9.26756 13.0919 6.1431 12.6578C3.01854 12.2234 0.837738 9.33809 1.272 6.21348Z"
106
+ }
107
+ ]
108
+ }
109
+ };
110
+
111
+ export function stageIconOf(kind, variant) {
112
+ if (kind === "think") return "think";
113
+ if (kind === "context") return "browse";
114
+ if (kind === "retry") return "refresh";
115
+ if (kind === "tool") return toolVariantIcon(variant);
116
+ return "sparkle";
117
+ }