@locusgraph/loop 0.3.1 → 0.4.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.
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/pulse/gradient-label.js +6 -5
- package/dist/agent/pulse/marks/bars-mark.js +1 -1
- package/dist/agent/pulse/marks/glyph-mark.js +2 -2
- package/dist/agent/pulse/marks/locus-mark.js +1 -1
- package/dist/agent/pulse/pulse.js +1 -1
- package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
- package/dist/agent/pulse/use-loop-animation.js +1 -3
- package/dist/agent/steps/step-icon.js +20 -13
- package/dist/agent/steps/steps.js +39 -37
- package/dist/agent/thinking/thinking.js +65 -62
- package/dist/agent/tool/json-block.js +10 -7
- package/dist/agent/tool/tool-status.d.ts +2 -0
- package/dist/agent/tool/tool-status.js +16 -13
- package/dist/agent/tool/tool.d.ts +8 -1
- package/dist/agent/tool/tool.js +238 -119
- package/dist/approval/inbox/inbox-row.d.ts +3 -3
- package/dist/approval/inbox/inbox-row.js +135 -200
- package/dist/approval/inbox/inbox.d.ts +3 -3
- package/dist/approval/inbox/inbox.js +180 -139
- package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
- package/dist/approval/inbox/virtual-inbox-list.js +20 -21
- package/dist/approval/memory/memory-review.js +155 -154
- package/dist/approval/memory/memory-row.js +86 -87
- package/dist/approval/plan/plan-review.js +110 -129
- package/dist/approval/plan/plan-step-row.js +7 -6
- package/dist/approval/plan/plan-steps.d.ts +1 -1
- package/dist/approval/plan/plan-steps.js +2 -2
- package/dist/approval/plan/question-choices.js +10 -7
- package/dist/approval/plan/question.js +116 -112
- package/dist/approval/run/run-bar.js +43 -40
- package/dist/approval/shared/approval-line.d.ts +27 -0
- package/dist/approval/shared/approval-line.js +85 -0
- package/dist/approval/shared/risk-badge.d.ts +3 -5
- package/dist/approval/shared/risk-badge.js +11 -19
- package/dist/approval/shared/time.d.ts +0 -1
- package/dist/approval/shared/time.js +0 -1
- package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
- package/dist/approval/shared/use-focus-when-settled.js +18 -0
- package/dist/approval/spend/raise-cap-form.d.ts +2 -2
- package/dist/approval/spend/raise-cap-form.js +134 -126
- package/dist/approval/spend/spend-gate.js +133 -156
- package/dist/approval/spend/spend-math.d.ts +1 -0
- package/dist/approval/spend/spend-math.js +5 -2
- package/dist/approval/spend/spend-meter.js +5 -5
- package/dist/approval/tool/approval.js +114 -214
- package/dist/approval/tool/args/args-editor.js +147 -156
- package/dist/approval/tool/args/args-field.js +197 -109
- package/dist/approval/tool/deny-form.js +59 -66
- package/dist/approval/tool/tool-inputs.js +38 -45
- package/dist/chat/chat/chat.js +5 -4
- package/dist/chat/chat/use-stick-to-bottom.js +1 -3
- package/dist/chat/composer/composer-actions.js +4 -1
- package/dist/chat/composer/composer.js +4 -3
- package/dist/chat/composer/use-auto-grow.js +14 -10
- package/dist/chat/files/files.js +12 -10
- package/dist/chat/reply/fenced-code.js +1 -1
- package/dist/chat/reply/markdown-components.js +9 -116
- package/dist/chat/reply/reply.js +2 -2
- package/dist/chat/turn/group-parts.d.ts +1 -0
- package/dist/chat/turn/group-parts.js +6 -3
- package/dist/chat/turn/turn.js +13 -4
- package/dist/cost/context.js +3 -3
- package/dist/cost/cost-steps.js +31 -30
- package/dist/cost/cost.js +39 -39
- package/dist/cost/model-picker.js +5 -4
- package/dist/cost/shared/context-breakdown.js +10 -11
- package/dist/cost/shared/model-option-row.js +4 -3
- package/dist/cost/shared/step-cost-row.js +11 -12
- package/dist/cost/shared/usage-totals.d.ts +1 -0
- package/dist/cost/shared/usage-totals.js +19 -1
- package/dist/memory/cite.js +55 -47
- package/dist/memory/memorized.js +123 -108
- package/dist/memory/recall.js +136 -146
- package/dist/memory/shared/host-label.d.ts +1 -1
- package/dist/memory/shared/host-label.js +2 -2
- package/dist/memory/shared/source-mark.js +1 -1
- package/dist/memory/sources.d.ts +2 -1
- package/dist/memory/sources.js +135 -100
- package/dist/shared/decision-summary.js +2 -1
- package/dist/shared/line.d.ts +10 -0
- package/dist/shared/line.js +11 -0
- package/dist/shared/live-status.d.ts +3 -0
- package/dist/shared/live-status.js +11 -0
- package/dist/shared/reduced-motion.d.ts +1 -0
- package/dist/shared/reduced-motion.js +3 -0
- package/dist/thread/actions/action-button.js +1 -1
- package/dist/thread/actions/actions.d.ts +3 -1
- package/dist/thread/actions/actions.js +100 -81
- package/dist/thread/actions/branch-switcher.js +67 -37
- package/dist/thread/canvas/canvas-meta.d.ts +9 -0
- package/dist/thread/canvas/canvas-meta.js +35 -0
- package/dist/thread/canvas/canvas.d.ts +1 -1
- package/dist/thread/canvas/canvas.js +64 -74
- package/dist/thread/canvas/version-switcher.d.ts +1 -0
- package/dist/thread/canvas/version-switcher.js +106 -87
- package/dist/thread/code/code.js +4 -6
- package/dist/thread/code/copy-code-button.d.ts +2 -1
- package/dist/thread/code/copy-code-button.js +56 -25
- package/dist/thread/history/history.d.ts +1 -1
- package/dist/thread/history/history.js +104 -104
- package/dist/thread/history/row/history-row.js +8 -5
- package/dist/thread/history/row/thread-item-menu.js +13 -4
- package/dist/thread/history/row/thread-title-editor.js +1 -1
- package/dist/thread/history/virtual-history-list.js +1 -2
- package/dist/thread/index.d.ts +1 -0
- package/dist/thread/index.js +1 -0
- package/dist/thread/starters/starters.js +5 -4
- package/package.json +6 -6
- package/dist/agent/shared/status-dot.d.ts +0 -1
- package/dist/agent/shared/status-dot.js +0 -1
- package/dist/approval/shared/decision-line.d.ts +0 -1
- package/dist/approval/shared/decision-line.js +0 -1
- package/dist/memory/shared/disclosure.d.ts +0 -6
- package/dist/memory/shared/disclosure.js +0 -6
- package/dist/shared/panel.d.ts +0 -19
- package/dist/shared/panel.js +0 -77
- package/dist/shared/status-dot.d.ts +0 -6
- package/dist/shared/status-dot.js +0 -20
package/dist/memory/recall.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { ChevronRight as ChevronRightIcon, RecentlyViewed as HistoryIcon } from "@carbon/icons-react";
|
|
5
4
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
|
|
6
5
|
import { pluralize } from "@locusgraph/utils";
|
|
7
|
-
import {
|
|
6
|
+
import { CaretRight as ChevronRightIcon, ClockCounterClockwise as HistoryIcon } from "@phosphor-icons/react/ssr";
|
|
7
|
+
import { useId } from "react";
|
|
8
|
+
import { lineChevronClass, lineDetailClass, lineDetailLinkClass, lineDetailRowClass, lineMemoryIconClass, lineMemoryObjectClass, lineTriggerClass } from "../shared/line.js";
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
10
|
export function relevancePercent(relevance) {
|
|
10
11
|
return Math.round(Math.min(Math.max(relevance, 0), 1) * 100);
|
|
11
12
|
}
|
|
12
13
|
export function Recall(t0) {
|
|
13
|
-
const $ = _c(
|
|
14
|
+
const $ = _c(23);
|
|
14
15
|
const {
|
|
15
16
|
memories,
|
|
16
17
|
onOpenMemory,
|
|
@@ -23,7 +24,7 @@ export function Recall(t0) {
|
|
|
23
24
|
}
|
|
24
25
|
let t2;
|
|
25
26
|
if ($[0] !== className) {
|
|
26
|
-
t2 = cn("flex min-w-0 flex-col
|
|
27
|
+
t2 = cn("flex min-w-0 flex-col", className);
|
|
27
28
|
$[0] = className;
|
|
28
29
|
$[1] = t2;
|
|
29
30
|
} else {
|
|
@@ -31,8 +32,13 @@ export function Recall(t0) {
|
|
|
31
32
|
}
|
|
32
33
|
let t3;
|
|
33
34
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
34
|
-
t3 = /*#__PURE__*/_jsx(
|
|
35
|
-
"aria-hidden": true
|
|
35
|
+
t3 = /*#__PURE__*/_jsx("span", {
|
|
36
|
+
"aria-hidden": true,
|
|
37
|
+
className: lineMemoryIconClass,
|
|
38
|
+
children: /*#__PURE__*/_jsx(HistoryIcon, {
|
|
39
|
+
weight: "bold",
|
|
40
|
+
"aria-hidden": true
|
|
41
|
+
})
|
|
36
42
|
});
|
|
37
43
|
$[2] = t3;
|
|
38
44
|
} else {
|
|
@@ -47,79 +53,101 @@ export function Recall(t0) {
|
|
|
47
53
|
t4 = $[4];
|
|
48
54
|
}
|
|
49
55
|
let t5;
|
|
50
|
-
if ($[5]
|
|
51
|
-
t5 = /*#__PURE__*/
|
|
52
|
-
"
|
|
53
|
-
|
|
56
|
+
if ($[5] !== t4) {
|
|
57
|
+
t5 = /*#__PURE__*/_jsxs("span", {
|
|
58
|
+
className: "truncate",
|
|
59
|
+
children: ["Recalled", " ", /*#__PURE__*/_jsx("span", {
|
|
60
|
+
className: lineMemoryObjectClass,
|
|
61
|
+
children: t4
|
|
62
|
+
})]
|
|
54
63
|
});
|
|
55
|
-
$[5] =
|
|
64
|
+
$[5] = t4;
|
|
65
|
+
$[6] = t5;
|
|
56
66
|
} else {
|
|
57
|
-
t5 = $[
|
|
67
|
+
t5 = $[6];
|
|
58
68
|
}
|
|
59
69
|
let t6;
|
|
60
|
-
if ($[
|
|
61
|
-
t6 = /*#__PURE__*/
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
71
|
+
t6 = /*#__PURE__*/_jsx(ChevronRightIcon, {
|
|
72
|
+
weight: "bold",
|
|
73
|
+
"aria-hidden": true,
|
|
74
|
+
className: lineChevronClass
|
|
64
75
|
});
|
|
65
|
-
$[6] = t4;
|
|
66
76
|
$[7] = t6;
|
|
67
77
|
} else {
|
|
68
78
|
t6 = $[7];
|
|
69
79
|
}
|
|
70
80
|
let t7;
|
|
71
|
-
if ($[8] !==
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
if ($[8] !== t5) {
|
|
82
|
+
t7 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
|
|
83
|
+
className: lineTriggerClass,
|
|
84
|
+
children: [t3, t5, t6]
|
|
85
|
+
});
|
|
86
|
+
$[8] = t5;
|
|
87
|
+
$[9] = t7;
|
|
88
|
+
} else {
|
|
89
|
+
t7 = $[9];
|
|
90
|
+
}
|
|
91
|
+
let t8;
|
|
92
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
93
|
+
t8 = cn(lineDetailClass, "flex flex-col pb-2 text-muted-foreground");
|
|
94
|
+
$[10] = t8;
|
|
95
|
+
} else {
|
|
96
|
+
t8 = $[10];
|
|
97
|
+
}
|
|
98
|
+
let t9;
|
|
99
|
+
if ($[11] !== memories || $[12] !== onOpenMemory) {
|
|
100
|
+
let t10;
|
|
101
|
+
if ($[14] !== onOpenMemory) {
|
|
102
|
+
t10 = memory => /*#__PURE__*/_jsx(RecallRow, {
|
|
75
103
|
memory: memory,
|
|
76
104
|
onOpenMemory: onOpenMemory
|
|
77
105
|
}, memory.id);
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
106
|
+
$[14] = onOpenMemory;
|
|
107
|
+
$[15] = t10;
|
|
80
108
|
} else {
|
|
81
|
-
|
|
109
|
+
t10 = $[15];
|
|
82
110
|
}
|
|
83
|
-
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
111
|
+
t9 = memories.map(t10);
|
|
112
|
+
$[11] = memories;
|
|
113
|
+
$[12] = onOpenMemory;
|
|
114
|
+
$[13] = t9;
|
|
87
115
|
} else {
|
|
88
|
-
|
|
116
|
+
t9 = $[13];
|
|
89
117
|
}
|
|
90
|
-
let
|
|
91
|
-
if ($[
|
|
92
|
-
|
|
118
|
+
let t10;
|
|
119
|
+
if ($[16] !== t9) {
|
|
120
|
+
t10 = /*#__PURE__*/_jsx(CollapsibleContent, {
|
|
93
121
|
children: /*#__PURE__*/_jsx("ul", {
|
|
94
|
-
className:
|
|
95
|
-
children:
|
|
122
|
+
className: t8,
|
|
123
|
+
children: t9
|
|
96
124
|
})
|
|
97
125
|
});
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
126
|
+
$[16] = t9;
|
|
127
|
+
$[17] = t10;
|
|
100
128
|
} else {
|
|
101
|
-
|
|
129
|
+
t10 = $[17];
|
|
102
130
|
}
|
|
103
|
-
let
|
|
104
|
-
if ($[
|
|
105
|
-
|
|
131
|
+
let t11;
|
|
132
|
+
if ($[18] !== defaultOpen || $[19] !== t10 || $[20] !== t2 || $[21] !== t7) {
|
|
133
|
+
t11 = /*#__PURE__*/_jsxs(Collapsible, {
|
|
106
134
|
"data-slot": "recall",
|
|
107
135
|
defaultOpen: defaultOpen,
|
|
108
136
|
className: t2,
|
|
109
|
-
children: [
|
|
137
|
+
children: [t7, t10]
|
|
110
138
|
});
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
139
|
+
$[18] = defaultOpen;
|
|
140
|
+
$[19] = t10;
|
|
141
|
+
$[20] = t2;
|
|
142
|
+
$[21] = t7;
|
|
143
|
+
$[22] = t11;
|
|
116
144
|
} else {
|
|
117
|
-
|
|
145
|
+
t11 = $[22];
|
|
118
146
|
}
|
|
119
|
-
return
|
|
147
|
+
return t11;
|
|
120
148
|
}
|
|
121
|
-
function
|
|
122
|
-
const $ = _c(
|
|
149
|
+
function Relevance(t0) {
|
|
150
|
+
const $ = _c(6);
|
|
123
151
|
const {
|
|
124
152
|
memory
|
|
125
153
|
} = t0;
|
|
@@ -137,64 +165,30 @@ function RelevanceMeter(t0) {
|
|
|
137
165
|
const percent = t1;
|
|
138
166
|
const t2 = `Relevance of ${memory.label}`;
|
|
139
167
|
const t3 = `${percent}% relevant`;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
t5 = /*#__PURE__*/_jsx("span", {
|
|
144
|
-
className: "absolute inset-y-0 left-0 bg-foreground/60 transition-[width] duration-300 motion-reduce:transition-none",
|
|
145
|
-
style: {
|
|
146
|
-
width: t4
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
$[2] = t4;
|
|
150
|
-
$[3] = t5;
|
|
151
|
-
} else {
|
|
152
|
-
t5 = $[3];
|
|
153
|
-
}
|
|
154
|
-
let t6;
|
|
155
|
-
if ($[4] !== percent || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
|
|
156
|
-
t6 = /*#__PURE__*/_jsx("span", {
|
|
168
|
+
let t4;
|
|
169
|
+
if ($[2] !== percent || $[3] !== t2 || $[4] !== t3) {
|
|
170
|
+
t4 = /*#__PURE__*/_jsxs("span", {
|
|
157
171
|
role: "meter",
|
|
158
172
|
"aria-label": t2,
|
|
159
173
|
"aria-valuemin": 0,
|
|
160
174
|
"aria-valuemax": 100,
|
|
161
175
|
"aria-valuenow": percent,
|
|
162
176
|
"aria-valuetext": t3,
|
|
163
|
-
className: "
|
|
164
|
-
children: t5
|
|
165
|
-
});
|
|
166
|
-
$[4] = percent;
|
|
167
|
-
$[5] = t2;
|
|
168
|
-
$[6] = t3;
|
|
169
|
-
$[7] = t5;
|
|
170
|
-
$[8] = t6;
|
|
171
|
-
} else {
|
|
172
|
-
t6 = $[8];
|
|
173
|
-
}
|
|
174
|
-
let t7;
|
|
175
|
-
if ($[9] !== percent) {
|
|
176
|
-
t7 = /*#__PURE__*/_jsxs("span", {
|
|
177
|
-
className: "w-8 text-right font-mono text-xs text-muted-foreground tabular-nums",
|
|
177
|
+
className: "shrink-0 text-xs text-faint tabular-nums",
|
|
178
178
|
children: [percent, "%"]
|
|
179
179
|
});
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
let t8;
|
|
186
|
-
if ($[11] !== t6 || $[12] !== t7) {
|
|
187
|
-
t8 = /*#__PURE__*/_jsxs("span", {
|
|
188
|
-
className: "flex shrink-0 items-center gap-2",
|
|
189
|
-
children: [t6, t7]
|
|
190
|
-
});
|
|
191
|
-
$[11] = t6;
|
|
192
|
-
$[12] = t7;
|
|
193
|
-
$[13] = t8;
|
|
180
|
+
$[2] = percent;
|
|
181
|
+
$[3] = t2;
|
|
182
|
+
$[4] = t3;
|
|
183
|
+
$[5] = t4;
|
|
194
184
|
} else {
|
|
195
|
-
|
|
185
|
+
t4 = $[5];
|
|
196
186
|
}
|
|
197
|
-
return
|
|
187
|
+
return t4;
|
|
188
|
+
}
|
|
189
|
+
function openMemoryLabel(memory) {
|
|
190
|
+
const relevance = memory.relevance === undefined ? "" : `, ${relevancePercent(memory.relevance)}% relevant`;
|
|
191
|
+
return `Open memory ${memory.label}${relevance}`;
|
|
198
192
|
}
|
|
199
193
|
function RecallRow(t0) {
|
|
200
194
|
const $ = _c(21);
|
|
@@ -202,10 +196,12 @@ function RecallRow(t0) {
|
|
|
202
196
|
memory,
|
|
203
197
|
onOpenMemory
|
|
204
198
|
} = t0;
|
|
199
|
+
const detailId = useId();
|
|
200
|
+
const hasDetail = Boolean(memory.kind || memory.snippet);
|
|
205
201
|
let t1;
|
|
206
202
|
if ($[0] !== memory.label) {
|
|
207
203
|
t1 = /*#__PURE__*/_jsx("span", {
|
|
208
|
-
className: "min-w-0
|
|
204
|
+
className: "min-w-0 truncate",
|
|
209
205
|
children: memory.label
|
|
210
206
|
});
|
|
211
207
|
$[0] = memory.label;
|
|
@@ -215,7 +211,7 @@ function RecallRow(t0) {
|
|
|
215
211
|
}
|
|
216
212
|
let t2;
|
|
217
213
|
if ($[2] !== memory) {
|
|
218
|
-
t2 = /*#__PURE__*/_jsx(
|
|
214
|
+
t2 = /*#__PURE__*/_jsx(Relevance, {
|
|
219
215
|
memory: memory
|
|
220
216
|
});
|
|
221
217
|
$[2] = memory;
|
|
@@ -236,70 +232,64 @@ function RecallRow(t0) {
|
|
|
236
232
|
t3 = $[6];
|
|
237
233
|
}
|
|
238
234
|
let t4;
|
|
239
|
-
if ($[7] !== memory.kind || $[
|
|
240
|
-
t4 =
|
|
241
|
-
|
|
235
|
+
if ($[7] !== detailId || $[8] !== hasDetail || $[9] !== memory.kind || $[10] !== memory.snippet) {
|
|
236
|
+
t4 = hasDetail && /*#__PURE__*/_jsxs("span", {
|
|
237
|
+
id: detailId,
|
|
238
|
+
className: "line-clamp-2 w-full text-xs text-faint",
|
|
242
239
|
children: [memory.kind && /*#__PURE__*/_jsx("span", {
|
|
243
|
-
className: "
|
|
240
|
+
className: "whitespace-nowrap",
|
|
244
241
|
children: memory.kind
|
|
245
242
|
}), memory.kind && memory.snippet && /*#__PURE__*/_jsx("span", {
|
|
246
243
|
"aria-hidden": true,
|
|
247
|
-
children: "\xB7"
|
|
248
|
-
}), memory.snippet
|
|
249
|
-
className: "line-clamp-2 min-w-0",
|
|
250
|
-
children: memory.snippet
|
|
251
|
-
})]
|
|
244
|
+
children: " \xB7 "
|
|
245
|
+
}), memory.snippet]
|
|
252
246
|
});
|
|
253
|
-
$[7] =
|
|
254
|
-
$[8] =
|
|
255
|
-
$[9] =
|
|
247
|
+
$[7] = detailId;
|
|
248
|
+
$[8] = hasDetail;
|
|
249
|
+
$[9] = memory.kind;
|
|
250
|
+
$[10] = memory.snippet;
|
|
251
|
+
$[11] = t4;
|
|
256
252
|
} else {
|
|
257
|
-
t4 = $[
|
|
253
|
+
t4 = $[11];
|
|
258
254
|
}
|
|
259
255
|
let t5;
|
|
260
|
-
if ($[
|
|
256
|
+
if ($[12] !== t3 || $[13] !== t4) {
|
|
261
257
|
t5 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
262
258
|
children: [t3, t4]
|
|
263
259
|
});
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
260
|
+
$[12] = t3;
|
|
261
|
+
$[13] = t4;
|
|
262
|
+
$[14] = t5;
|
|
267
263
|
} else {
|
|
268
|
-
t5 = $[
|
|
264
|
+
t5 = $[14];
|
|
269
265
|
}
|
|
270
266
|
const content = t5;
|
|
271
267
|
let t6;
|
|
272
|
-
if ($[
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
"aria-label": `Open memory ${memory.label}`,
|
|
276
|
-
onClick: () => onOpenMemory(memory.id),
|
|
277
|
-
className: cn("flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left", interactiveRowClass),
|
|
278
|
-
children: content
|
|
279
|
-
}) : /*#__PURE__*/_jsx("div", {
|
|
280
|
-
className: "flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left",
|
|
281
|
-
children: content
|
|
282
|
-
});
|
|
283
|
-
$[13] = content;
|
|
284
|
-
$[14] = memory.id;
|
|
285
|
-
$[15] = memory.label;
|
|
286
|
-
$[16] = onOpenMemory;
|
|
287
|
-
$[17] = t6;
|
|
288
|
-
} else {
|
|
289
|
-
t6 = $[17];
|
|
290
|
-
}
|
|
291
|
-
let t7;
|
|
292
|
-
if ($[18] !== memory.id || $[19] !== t6) {
|
|
293
|
-
t7 = /*#__PURE__*/_jsx("li", {
|
|
268
|
+
if ($[15] !== content || $[16] !== detailId || $[17] !== hasDetail || $[18] !== memory || $[19] !== onOpenMemory) {
|
|
269
|
+
const rowClass = cn(lineDetailRowClass, "flex-col items-start gap-0.5");
|
|
270
|
+
t6 = /*#__PURE__*/_jsx("li", {
|
|
294
271
|
"data-slot": "recall-item",
|
|
295
272
|
"data-id": memory.id,
|
|
296
|
-
children:
|
|
273
|
+
children: onOpenMemory ? /*#__PURE__*/_jsx("button", {
|
|
274
|
+
type: "button",
|
|
275
|
+
"aria-label": openMemoryLabel(memory),
|
|
276
|
+
"aria-describedby": hasDetail ? detailId : undefined,
|
|
277
|
+
onClick: () => onOpenMemory(memory.id),
|
|
278
|
+
className: cn(rowClass, lineDetailLinkClass),
|
|
279
|
+
children: content
|
|
280
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
281
|
+
className: rowClass,
|
|
282
|
+
children: content
|
|
283
|
+
})
|
|
297
284
|
});
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
285
|
+
$[15] = content;
|
|
286
|
+
$[16] = detailId;
|
|
287
|
+
$[17] = hasDetail;
|
|
288
|
+
$[18] = memory;
|
|
289
|
+
$[19] = onOpenMemory;
|
|
290
|
+
$[20] = t6;
|
|
301
291
|
} else {
|
|
302
|
-
|
|
292
|
+
t6 = $[20];
|
|
303
293
|
}
|
|
304
|
-
return
|
|
294
|
+
return t6;
|
|
305
295
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Citation, SourceUrlPart } from "../../types.js";
|
|
2
2
|
export declare function hostLabel(url: string | undefined): string | undefined;
|
|
3
3
|
export type SourceItem = Citation | SourceUrlPart;
|
|
4
|
-
export declare function toCitation(item: SourceItem, position: number): Citation;
|
|
4
|
+
export declare function toCitation(item: SourceItem, position: number, firstIndex?: number): Citation;
|
|
5
5
|
export declare function sourceKey(item: SourceItem, position: number): string;
|
|
6
6
|
export declare function sourceInitial(citation: Citation): string;
|
|
@@ -9,10 +9,10 @@ export function hostLabel(url) {
|
|
|
9
9
|
function isSourceUrlPart(item) {
|
|
10
10
|
return "type" in item && item.type === "source-url";
|
|
11
11
|
}
|
|
12
|
-
export function toCitation(item, position) {
|
|
12
|
+
export function toCitation(item, position, firstIndex = 1) {
|
|
13
13
|
if (!isSourceUrlPart(item)) return item;
|
|
14
14
|
return {
|
|
15
|
-
index:
|
|
15
|
+
index: firstIndex + position,
|
|
16
16
|
title: item.title ?? hostLabel(item.url) ?? item.url,
|
|
17
17
|
url: item.url
|
|
18
18
|
};
|
|
@@ -8,7 +8,7 @@ export function SourceMark({
|
|
|
8
8
|
return /*#__PURE__*/_jsx("span", {
|
|
9
9
|
"aria-hidden": true,
|
|
10
10
|
"data-slot": "source-mark",
|
|
11
|
-
className: cn("flex size-4 shrink-0 items-center justify-center bg-muted
|
|
11
|
+
className: cn("flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-2xs leading-none font-medium text-muted-foreground uppercase", className),
|
|
12
12
|
children: sourceInitial(citation)
|
|
13
13
|
});
|
|
14
14
|
}
|
package/dist/memory/sources.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type SourcesProps = {
|
|
|
4
4
|
sources: SourceItem[];
|
|
5
5
|
onOpen?: (citation: Citation) => void;
|
|
6
6
|
defaultOpen?: boolean;
|
|
7
|
+
firstIndex?: number;
|
|
7
8
|
className?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare function Sources({ sources, onOpen, defaultOpen, className }: SourcesProps): import("react").JSX.Element | null;
|
|
10
|
+
export declare function Sources({ sources, onOpen, defaultOpen, firstIndex, className, }: SourcesProps): import("react").JSX.Element | null;
|