@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.
Files changed (119) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +6 -5
  3. package/dist/agent/pulse/marks/bars-mark.js +1 -1
  4. package/dist/agent/pulse/marks/glyph-mark.js +2 -2
  5. package/dist/agent/pulse/marks/locus-mark.js +1 -1
  6. package/dist/agent/pulse/pulse.js +1 -1
  7. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  8. package/dist/agent/pulse/use-loop-animation.js +1 -3
  9. package/dist/agent/steps/step-icon.js +20 -13
  10. package/dist/agent/steps/steps.js +39 -37
  11. package/dist/agent/thinking/thinking.js +65 -62
  12. package/dist/agent/tool/json-block.js +10 -7
  13. package/dist/agent/tool/tool-status.d.ts +2 -0
  14. package/dist/agent/tool/tool-status.js +16 -13
  15. package/dist/agent/tool/tool.d.ts +8 -1
  16. package/dist/agent/tool/tool.js +238 -119
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  18. package/dist/approval/inbox/inbox-row.js +135 -200
  19. package/dist/approval/inbox/inbox.d.ts +3 -3
  20. package/dist/approval/inbox/inbox.js +180 -139
  21. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  22. package/dist/approval/inbox/virtual-inbox-list.js +20 -21
  23. package/dist/approval/memory/memory-review.js +155 -154
  24. package/dist/approval/memory/memory-row.js +86 -87
  25. package/dist/approval/plan/plan-review.js +110 -129
  26. package/dist/approval/plan/plan-step-row.js +7 -6
  27. package/dist/approval/plan/plan-steps.d.ts +1 -1
  28. package/dist/approval/plan/plan-steps.js +2 -2
  29. package/dist/approval/plan/question-choices.js +10 -7
  30. package/dist/approval/plan/question.js +116 -112
  31. package/dist/approval/run/run-bar.js +43 -40
  32. package/dist/approval/shared/approval-line.d.ts +27 -0
  33. package/dist/approval/shared/approval-line.js +85 -0
  34. package/dist/approval/shared/risk-badge.d.ts +3 -5
  35. package/dist/approval/shared/risk-badge.js +11 -19
  36. package/dist/approval/shared/time.d.ts +0 -1
  37. package/dist/approval/shared/time.js +0 -1
  38. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  39. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  40. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  41. package/dist/approval/spend/raise-cap-form.js +134 -126
  42. package/dist/approval/spend/spend-gate.js +133 -156
  43. package/dist/approval/spend/spend-math.d.ts +1 -0
  44. package/dist/approval/spend/spend-math.js +5 -2
  45. package/dist/approval/spend/spend-meter.js +5 -5
  46. package/dist/approval/tool/approval.js +114 -214
  47. package/dist/approval/tool/args/args-editor.js +147 -156
  48. package/dist/approval/tool/args/args-field.js +197 -109
  49. package/dist/approval/tool/deny-form.js +59 -66
  50. package/dist/approval/tool/tool-inputs.js +38 -45
  51. package/dist/chat/chat/chat.js +5 -4
  52. package/dist/chat/chat/use-stick-to-bottom.js +1 -3
  53. package/dist/chat/composer/composer-actions.js +4 -1
  54. package/dist/chat/composer/composer.js +4 -3
  55. package/dist/chat/composer/use-auto-grow.js +14 -10
  56. package/dist/chat/files/files.js +12 -10
  57. package/dist/chat/reply/fenced-code.js +1 -1
  58. package/dist/chat/reply/markdown-components.js +9 -116
  59. package/dist/chat/reply/reply.js +2 -2
  60. package/dist/chat/turn/group-parts.d.ts +1 -0
  61. package/dist/chat/turn/group-parts.js +6 -3
  62. package/dist/chat/turn/turn.js +13 -4
  63. package/dist/cost/context.js +3 -3
  64. package/dist/cost/cost-steps.js +31 -30
  65. package/dist/cost/cost.js +39 -39
  66. package/dist/cost/model-picker.js +5 -4
  67. package/dist/cost/shared/context-breakdown.js +10 -11
  68. package/dist/cost/shared/model-option-row.js +4 -3
  69. package/dist/cost/shared/step-cost-row.js +11 -12
  70. package/dist/cost/shared/usage-totals.d.ts +1 -0
  71. package/dist/cost/shared/usage-totals.js +19 -1
  72. package/dist/memory/cite.js +55 -47
  73. package/dist/memory/memorized.js +123 -108
  74. package/dist/memory/recall.js +136 -146
  75. package/dist/memory/shared/host-label.d.ts +1 -1
  76. package/dist/memory/shared/host-label.js +2 -2
  77. package/dist/memory/shared/source-mark.js +1 -1
  78. package/dist/memory/sources.d.ts +2 -1
  79. package/dist/memory/sources.js +135 -100
  80. package/dist/shared/decision-summary.js +2 -1
  81. package/dist/shared/line.d.ts +10 -0
  82. package/dist/shared/line.js +11 -0
  83. package/dist/shared/live-status.d.ts +3 -0
  84. package/dist/shared/live-status.js +11 -0
  85. package/dist/shared/reduced-motion.d.ts +1 -0
  86. package/dist/shared/reduced-motion.js +3 -0
  87. package/dist/thread/actions/action-button.js +1 -1
  88. package/dist/thread/actions/actions.d.ts +3 -1
  89. package/dist/thread/actions/actions.js +100 -81
  90. package/dist/thread/actions/branch-switcher.js +67 -37
  91. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  92. package/dist/thread/canvas/canvas-meta.js +35 -0
  93. package/dist/thread/canvas/canvas.d.ts +1 -1
  94. package/dist/thread/canvas/canvas.js +64 -74
  95. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  96. package/dist/thread/canvas/version-switcher.js +106 -87
  97. package/dist/thread/code/code.js +4 -6
  98. package/dist/thread/code/copy-code-button.d.ts +2 -1
  99. package/dist/thread/code/copy-code-button.js +56 -25
  100. package/dist/thread/history/history.d.ts +1 -1
  101. package/dist/thread/history/history.js +104 -104
  102. package/dist/thread/history/row/history-row.js +8 -5
  103. package/dist/thread/history/row/thread-item-menu.js +13 -4
  104. package/dist/thread/history/row/thread-title-editor.js +1 -1
  105. package/dist/thread/history/virtual-history-list.js +1 -2
  106. package/dist/thread/index.d.ts +1 -0
  107. package/dist/thread/index.js +1 -0
  108. package/dist/thread/starters/starters.js +5 -4
  109. package/package.json +6 -6
  110. package/dist/agent/shared/status-dot.d.ts +0 -1
  111. package/dist/agent/shared/status-dot.js +0 -1
  112. package/dist/approval/shared/decision-line.d.ts +0 -1
  113. package/dist/approval/shared/decision-line.js +0 -1
  114. package/dist/memory/shared/disclosure.d.ts +0 -6
  115. package/dist/memory/shared/disclosure.js +0 -6
  116. package/dist/shared/panel.d.ts +0 -19
  117. package/dist/shared/panel.js +0 -77
  118. package/dist/shared/status-dot.d.ts +0 -6
  119. package/dist/shared/status-dot.js +0 -20
@@ -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 { chevronClass, collapsibleTriggerClass, interactiveRowClass, ruledListClass } from "./shared/disclosure.js";
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(20);
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 gap-2", className);
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(HistoryIcon, {
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] === Symbol.for("react.memo_cache_sentinel")) {
51
- t5 = /*#__PURE__*/_jsx(ChevronRightIcon, {
52
- "aria-hidden": true,
53
- className: chevronClass
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] = t5;
64
+ $[5] = t4;
65
+ $[6] = t5;
56
66
  } else {
57
- t5 = $[5];
67
+ t5 = $[6];
58
68
  }
59
69
  let t6;
60
- if ($[6] !== t4) {
61
- t6 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
62
- className: collapsibleTriggerClass,
63
- children: [t3, "Recalled ", t4, t5]
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] !== memories || $[9] !== onOpenMemory) {
72
- let t8;
73
- if ($[11] !== onOpenMemory) {
74
- t8 = memory => /*#__PURE__*/_jsx(RecallRow, {
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
- $[11] = onOpenMemory;
79
- $[12] = t8;
106
+ $[14] = onOpenMemory;
107
+ $[15] = t10;
80
108
  } else {
81
- t8 = $[12];
109
+ t10 = $[15];
82
110
  }
83
- t7 = memories.map(t8);
84
- $[8] = memories;
85
- $[9] = onOpenMemory;
86
- $[10] = t7;
111
+ t9 = memories.map(t10);
112
+ $[11] = memories;
113
+ $[12] = onOpenMemory;
114
+ $[13] = t9;
87
115
  } else {
88
- t7 = $[10];
116
+ t9 = $[13];
89
117
  }
90
- let t8;
91
- if ($[13] !== t7) {
92
- t8 = /*#__PURE__*/_jsx(CollapsibleContent, {
118
+ let t10;
119
+ if ($[16] !== t9) {
120
+ t10 = /*#__PURE__*/_jsx(CollapsibleContent, {
93
121
  children: /*#__PURE__*/_jsx("ul", {
94
- className: ruledListClass,
95
- children: t7
122
+ className: t8,
123
+ children: t9
96
124
  })
97
125
  });
98
- $[13] = t7;
99
- $[14] = t8;
126
+ $[16] = t9;
127
+ $[17] = t10;
100
128
  } else {
101
- t8 = $[14];
129
+ t10 = $[17];
102
130
  }
103
- let t9;
104
- if ($[15] !== defaultOpen || $[16] !== t2 || $[17] !== t6 || $[18] !== t8) {
105
- t9 = /*#__PURE__*/_jsxs(Collapsible, {
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: [t6, t8]
137
+ children: [t7, t10]
110
138
  });
111
- $[15] = defaultOpen;
112
- $[16] = t2;
113
- $[17] = t6;
114
- $[18] = t8;
115
- $[19] = t9;
139
+ $[18] = defaultOpen;
140
+ $[19] = t10;
141
+ $[20] = t2;
142
+ $[21] = t7;
143
+ $[22] = t11;
116
144
  } else {
117
- t9 = $[19];
145
+ t11 = $[22];
118
146
  }
119
- return t9;
147
+ return t11;
120
148
  }
121
- function RelevanceMeter(t0) {
122
- const $ = _c(14);
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
- const t4 = `${percent}%`;
141
- let t5;
142
- if ($[2] !== t4) {
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: "relative h-[3px] w-10 overflow-hidden bg-muted",
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
- $[9] = percent;
181
- $[10] = t7;
182
- } else {
183
- t7 = $[10];
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
- t8 = $[13];
185
+ t4 = $[5];
196
186
  }
197
- return t8;
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 flex-1 truncate text-sm font-medium",
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(RelevanceMeter, {
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 || $[8] !== memory.snippet) {
240
- t4 = (memory.kind || memory.snippet) && /*#__PURE__*/_jsxs("span", {
241
- className: "flex w-full gap-2 text-xs text-muted-foreground",
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: "shrink-0 font-mono",
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 && /*#__PURE__*/_jsx("span", {
249
- className: "line-clamp-2 min-w-0",
250
- children: memory.snippet
251
- })]
244
+ children: " \xB7 "
245
+ }), memory.snippet]
252
246
  });
253
- $[7] = memory.kind;
254
- $[8] = memory.snippet;
255
- $[9] = t4;
247
+ $[7] = detailId;
248
+ $[8] = hasDetail;
249
+ $[9] = memory.kind;
250
+ $[10] = memory.snippet;
251
+ $[11] = t4;
256
252
  } else {
257
- t4 = $[9];
253
+ t4 = $[11];
258
254
  }
259
255
  let t5;
260
- if ($[10] !== t3 || $[11] !== t4) {
256
+ if ($[12] !== t3 || $[13] !== t4) {
261
257
  t5 = /*#__PURE__*/_jsxs(_Fragment, {
262
258
  children: [t3, t4]
263
259
  });
264
- $[10] = t3;
265
- $[11] = t4;
266
- $[12] = t5;
260
+ $[12] = t3;
261
+ $[13] = t4;
262
+ $[14] = t5;
267
263
  } else {
268
- t5 = $[12];
264
+ t5 = $[14];
269
265
  }
270
266
  const content = t5;
271
267
  let t6;
272
- if ($[13] !== content || $[14] !== memory.id || $[15] !== memory.label || $[16] !== onOpenMemory) {
273
- t6 = onOpenMemory ? /*#__PURE__*/_jsx("button", {
274
- type: "button",
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: t6
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
- $[18] = memory.id;
299
- $[19] = t6;
300
- $[20] = t7;
285
+ $[15] = content;
286
+ $[16] = detailId;
287
+ $[17] = hasDetail;
288
+ $[18] = memory;
289
+ $[19] = onOpenMemory;
290
+ $[20] = t6;
301
291
  } else {
302
- t7 = $[20];
292
+ t6 = $[20];
303
293
  }
304
- return t7;
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: position + 1,
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 font-mono text-[11px] leading-none font-medium text-muted-foreground ring-1 ring-border", className),
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
  }
@@ -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;