@locusgraph/loop 0.0.0-stage → 0.2.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 (214) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -2
  3. package/dist/agent/index.d.ts +5 -0
  4. package/dist/agent/index.js +5 -0
  5. package/dist/agent/pulse/gradient-label.d.ts +7 -0
  6. package/dist/agent/pulse/gradient-label.js +94 -0
  7. package/dist/agent/pulse/marks/bars-mark.d.ts +1 -0
  8. package/dist/agent/pulse/marks/bars-mark.js +51 -0
  9. package/dist/agent/pulse/marks/glyph-mark.d.ts +4 -0
  10. package/dist/agent/pulse/marks/glyph-mark.js +62 -0
  11. package/dist/agent/pulse/marks/locus-mark.d.ts +1 -0
  12. package/dist/agent/pulse/marks/locus-mark.js +73 -0
  13. package/dist/agent/pulse/marks/orb-mark.d.ts +1 -0
  14. package/dist/agent/pulse/marks/orb-mark.js +34 -0
  15. package/dist/agent/pulse/marks/spinner-mark.d.ts +1 -0
  16. package/dist/agent/pulse/marks/spinner-mark.js +32 -0
  17. package/dist/agent/pulse/pulse-tone.d.ts +1 -0
  18. package/dist/agent/pulse/pulse-tone.js +1 -0
  19. package/dist/agent/pulse/pulse.d.ts +12 -0
  20. package/dist/agent/pulse/pulse.js +166 -0
  21. package/dist/agent/pulse/use-loop-animation.d.ts +2 -0
  22. package/dist/agent/pulse/use-loop-animation.js +40 -0
  23. package/dist/agent/shared/status-dot.d.ts +1 -0
  24. package/dist/agent/shared/status-dot.js +1 -0
  25. package/dist/agent/steps/step-icon.d.ts +8 -0
  26. package/dist/agent/steps/step-icon.js +117 -0
  27. package/dist/agent/steps/steps.d.ts +7 -0
  28. package/dist/agent/steps/steps.js +249 -0
  29. package/dist/agent/thinking/thinking.d.ts +6 -0
  30. package/dist/agent/thinking/thinking.js +211 -0
  31. package/dist/agent/thinking/thought-duration.d.ts +2 -0
  32. package/dist/agent/thinking/thought-duration.js +11 -0
  33. package/dist/agent/tool/json-block.d.ts +5 -0
  34. package/dist/agent/tool/json-block.js +42 -0
  35. package/dist/agent/tool/tool-status.d.ts +6 -0
  36. package/dist/agent/tool/tool-status.js +59 -0
  37. package/dist/agent/tool/tool.d.ts +7 -0
  38. package/dist/agent/tool/tool.js +192 -0
  39. package/dist/approval/inbox/inbox-row.d.ts +12 -0
  40. package/dist/approval/inbox/inbox-row.js +328 -0
  41. package/dist/approval/inbox/inbox-selection.d.ts +6 -0
  42. package/dist/approval/inbox/inbox-selection.js +15 -0
  43. package/dist/approval/inbox/inbox.d.ts +12 -0
  44. package/dist/approval/inbox/inbox.js +258 -0
  45. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  46. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  47. package/dist/approval/index.d.ts +9 -0
  48. package/dist/approval/index.js +8 -0
  49. package/dist/approval/memory/memory-choices.d.ts +10 -0
  50. package/dist/approval/memory/memory-choices.js +35 -0
  51. package/dist/approval/memory/memory-review.d.ts +11 -0
  52. package/dist/approval/memory/memory-review.js +256 -0
  53. package/dist/approval/memory/memory-row.d.ts +9 -0
  54. package/dist/approval/memory/memory-row.js +226 -0
  55. package/dist/approval/plan/plan-review.d.ts +13 -0
  56. package/dist/approval/plan/plan-review.js +289 -0
  57. package/dist/approval/plan/plan-step-row.d.ts +13 -0
  58. package/dist/approval/plan/plan-step-row.js +201 -0
  59. package/dist/approval/plan/plan-steps.d.ts +8 -0
  60. package/dist/approval/plan/plan-steps.js +30 -0
  61. package/dist/approval/plan/question-choices.d.ts +10 -0
  62. package/dist/approval/plan/question-choices.js +166 -0
  63. package/dist/approval/plan/question.d.ts +18 -0
  64. package/dist/approval/plan/question.js +232 -0
  65. package/dist/approval/run/run-bar.d.ts +13 -0
  66. package/dist/approval/run/run-bar.js +189 -0
  67. package/dist/approval/shared/decision-line.d.ts +1 -0
  68. package/dist/approval/shared/decision-line.js +1 -0
  69. package/dist/approval/shared/risk-badge.d.ts +10 -0
  70. package/dist/approval/shared/risk-badge.js +57 -0
  71. package/dist/approval/shared/time.d.ts +3 -0
  72. package/dist/approval/shared/time.js +12 -0
  73. package/dist/approval/shared/use-focus-on-mount.d.ts +2 -0
  74. package/dist/approval/shared/use-focus-on-mount.js +26 -0
  75. package/dist/approval/spend/raise-cap-form.d.ts +8 -0
  76. package/dist/approval/spend/raise-cap-form.js +244 -0
  77. package/dist/approval/spend/spend-gate.d.ts +16 -0
  78. package/dist/approval/spend/spend-gate.js +250 -0
  79. package/dist/approval/spend/spend-math.d.ts +5 -0
  80. package/dist/approval/spend/spend-math.js +17 -0
  81. package/dist/approval/spend/spend-meter.d.ts +10 -0
  82. package/dist/approval/spend/spend-meter.js +377 -0
  83. package/dist/approval/tool/approval.d.ts +14 -0
  84. package/dist/approval/tool/approval.js +290 -0
  85. package/dist/approval/tool/args/args-editor.d.ts +16 -0
  86. package/dist/approval/tool/args/args-editor.js +273 -0
  87. package/dist/approval/tool/args/args-field.d.ts +11 -0
  88. package/dist/approval/tool/args/args-field.js +268 -0
  89. package/dist/approval/tool/args/args-validation.d.ts +8 -0
  90. package/dist/approval/tool/args/args-validation.js +50 -0
  91. package/dist/approval/tool/deny-form.d.ts +6 -0
  92. package/dist/approval/tool/deny-form.js +135 -0
  93. package/dist/approval/tool/tool-inputs.d.ts +6 -0
  94. package/dist/approval/tool/tool-inputs.js +142 -0
  95. package/dist/approval/types.d.ts +59 -0
  96. package/dist/approval/types.js +1 -0
  97. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  98. package/dist/chat/chat/chat-item-spacing.js +19 -0
  99. package/dist/chat/chat/chat.d.ts +8 -0
  100. package/dist/chat/chat/chat.js +187 -0
  101. package/dist/chat/chat/use-stick-to-bottom.d.ts +7 -0
  102. package/dist/chat/chat/use-stick-to-bottom.js +133 -0
  103. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  104. package/dist/chat/chat/virtual-chat-items.js +153 -0
  105. package/dist/chat/composer/composer-actions.d.ts +15 -0
  106. package/dist/chat/composer/composer-actions.js +158 -0
  107. package/dist/chat/composer/composer.d.ts +20 -0
  108. package/dist/chat/composer/composer.js +340 -0
  109. package/dist/chat/composer/use-auto-grow.d.ts +2 -0
  110. package/dist/chat/composer/use-auto-grow.js +29 -0
  111. package/dist/chat/files/file-meta.d.ts +13 -0
  112. package/dist/chat/files/file-meta.js +30 -0
  113. package/dist/chat/files/files.d.ts +9 -0
  114. package/dist/chat/files/files.js +327 -0
  115. package/dist/chat/index.d.ts +7 -0
  116. package/dist/chat/index.js +7 -0
  117. package/dist/chat/reply/fenced-code.d.ts +8 -0
  118. package/dist/chat/reply/fenced-code.js +53 -0
  119. package/dist/chat/reply/markdown-components.d.ts +2 -0
  120. package/dist/chat/reply/markdown-components.js +142 -0
  121. package/dist/chat/reply/reply.d.ts +8 -0
  122. package/dist/chat/reply/reply.js +116 -0
  123. package/dist/chat/turn/group-parts.d.ts +24 -0
  124. package/dist/chat/turn/group-parts.js +49 -0
  125. package/dist/chat/turn/turn.d.ts +11 -0
  126. package/dist/chat/turn/turn.js +253 -0
  127. package/dist/cost/context.d.ts +13 -0
  128. package/dist/cost/context.js +333 -0
  129. package/dist/cost/cost-steps.d.ts +17 -0
  130. package/dist/cost/cost-steps.js +230 -0
  131. package/dist/cost/cost.d.ts +8 -0
  132. package/dist/cost/cost.js +531 -0
  133. package/dist/cost/index.d.ts +4 -0
  134. package/dist/cost/index.js +4 -0
  135. package/dist/cost/model-picker.d.ts +11 -0
  136. package/dist/cost/model-picker.js +184 -0
  137. package/dist/cost/shared/context-breakdown.d.ts +15 -0
  138. package/dist/cost/shared/context-breakdown.js +306 -0
  139. package/dist/cost/shared/meter-marks.d.ts +9 -0
  140. package/dist/cost/shared/meter-marks.js +114 -0
  141. package/dist/cost/shared/model-option-row.d.ts +14 -0
  142. package/dist/cost/shared/model-option-row.js +189 -0
  143. package/dist/cost/shared/step-cost-row.d.ts +15 -0
  144. package/dist/cost/shared/step-cost-row.js +262 -0
  145. package/dist/cost/shared/usage-totals.d.ts +11 -0
  146. package/dist/cost/shared/usage-totals.js +30 -0
  147. package/dist/index.d.ts +7 -0
  148. package/dist/index.js +7 -0
  149. package/dist/memory/cite.d.ts +8 -0
  150. package/dist/memory/cite.js +190 -0
  151. package/dist/memory/index.d.ts +5 -0
  152. package/dist/memory/index.js +4 -0
  153. package/dist/memory/memorized.d.ts +14 -0
  154. package/dist/memory/memorized.js +225 -0
  155. package/dist/memory/recall.d.ts +9 -0
  156. package/dist/memory/recall.js +303 -0
  157. package/dist/memory/shared/disclosure.d.ts +6 -0
  158. package/dist/memory/shared/disclosure.js +6 -0
  159. package/dist/memory/shared/host-label.d.ts +6 -0
  160. package/dist/memory/shared/host-label.js +31 -0
  161. package/dist/memory/shared/source-mark.d.ts +5 -0
  162. package/dist/memory/shared/source-mark.js +42 -0
  163. package/dist/memory/sources.d.ts +9 -0
  164. package/dist/memory/sources.js +264 -0
  165. package/dist/shared/decision-summary.d.ts +18 -0
  166. package/dist/shared/decision-summary.js +144 -0
  167. package/dist/shared/panel-empty.d.ts +8 -0
  168. package/dist/shared/panel-empty.js +80 -0
  169. package/dist/shared/panel.d.ts +19 -0
  170. package/dist/shared/panel.js +251 -0
  171. package/dist/shared/status-dot.d.ts +6 -0
  172. package/dist/shared/status-dot.js +42 -0
  173. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  174. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  175. package/dist/sources.css +1 -0
  176. package/dist/thread/actions/action-button.d.ts +8 -0
  177. package/dist/thread/actions/action-button.js +67 -0
  178. package/dist/thread/actions/actions.d.ts +13 -0
  179. package/dist/thread/actions/actions.js +192 -0
  180. package/dist/thread/actions/branch-switcher.d.ts +10 -0
  181. package/dist/thread/actions/branch-switcher.js +104 -0
  182. package/dist/thread/canvas/canvas.d.ts +14 -0
  183. package/dist/thread/canvas/canvas.js +212 -0
  184. package/dist/thread/canvas/version-switcher.d.ts +12 -0
  185. package/dist/thread/canvas/version-switcher.js +152 -0
  186. package/dist/thread/code/code.d.ts +10 -0
  187. package/dist/thread/code/code.js +195 -0
  188. package/dist/thread/code/copy-code-button.d.ts +6 -0
  189. package/dist/thread/code/copy-code-button.js +66 -0
  190. package/dist/thread/code/highlight.d.ts +1 -0
  191. package/dist/thread/code/highlight.js +40 -0
  192. package/dist/thread/history/history-rows.d.ts +16 -0
  193. package/dist/thread/history/history-rows.js +23 -0
  194. package/dist/thread/history/history.d.ts +16 -0
  195. package/dist/thread/history/history.js +179 -0
  196. package/dist/thread/history/row/history-row.d.ts +15 -0
  197. package/dist/thread/history/row/history-row.js +137 -0
  198. package/dist/thread/history/row/thread-item-menu.d.ts +7 -0
  199. package/dist/thread/history/row/thread-item-menu.js +84 -0
  200. package/dist/thread/history/row/thread-title-editor.d.ts +7 -0
  201. package/dist/thread/history/row/thread-title-editor.js +81 -0
  202. package/dist/thread/history/thread-groups.d.ts +8 -0
  203. package/dist/thread/history/thread-groups.js +52 -0
  204. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  205. package/dist/thread/history/virtual-history-list.js +107 -0
  206. package/dist/thread/index.d.ts +8 -0
  207. package/dist/thread/index.js +5 -0
  208. package/dist/thread/starters/starters.d.ts +12 -0
  209. package/dist/thread/starters/starters.js +100 -0
  210. package/dist/thread/use-copied.d.ts +5 -0
  211. package/dist/thread/use-copied.js +52 -0
  212. package/dist/types.d.ts +70 -0
  213. package/dist/types.js +3 -0
  214. package/package.json +59 -3
@@ -0,0 +1,303 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ChevronRight as ChevronRightIcon, RecentlyViewed as HistoryIcon } from "@carbon/icons-react";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
4
+ import { pluralize } from "@locusgraph/utils";
5
+ import { chevronClass, collapsibleTriggerClass, interactiveRowClass, ruledListClass } from "./shared/disclosure.js";
6
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
7
+ export function relevancePercent(relevance) {
8
+ return Math.round(Math.min(Math.max(relevance, 0), 1) * 100);
9
+ }
10
+ export function Recall(t0) {
11
+ const $ = _c(20);
12
+ const {
13
+ memories,
14
+ onOpenMemory,
15
+ defaultOpen: t1,
16
+ className
17
+ } = t0;
18
+ const defaultOpen = t1 === undefined ? false : t1;
19
+ if (memories.length === 0) {
20
+ return null;
21
+ }
22
+ let t2;
23
+ if ($[0] !== className) {
24
+ t2 = cn("flex min-w-0 flex-col gap-2", className);
25
+ $[0] = className;
26
+ $[1] = t2;
27
+ } else {
28
+ t2 = $[1];
29
+ }
30
+ let t3;
31
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
32
+ t3 = /*#__PURE__*/_jsx(HistoryIcon, {
33
+ "aria-hidden": true
34
+ });
35
+ $[2] = t3;
36
+ } else {
37
+ t3 = $[2];
38
+ }
39
+ let t4;
40
+ if ($[3] !== memories.length) {
41
+ t4 = pluralize(memories.length, "memory", "memories");
42
+ $[3] = memories.length;
43
+ $[4] = t4;
44
+ } else {
45
+ t4 = $[4];
46
+ }
47
+ let t5;
48
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
49
+ t5 = /*#__PURE__*/_jsx(ChevronRightIcon, {
50
+ "aria-hidden": true,
51
+ className: chevronClass
52
+ });
53
+ $[5] = t5;
54
+ } else {
55
+ t5 = $[5];
56
+ }
57
+ let t6;
58
+ if ($[6] !== t4) {
59
+ t6 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
60
+ className: collapsibleTriggerClass,
61
+ children: [t3, "Recalled ", t4, t5]
62
+ });
63
+ $[6] = t4;
64
+ $[7] = t6;
65
+ } else {
66
+ t6 = $[7];
67
+ }
68
+ let t7;
69
+ if ($[8] !== memories || $[9] !== onOpenMemory) {
70
+ let t8;
71
+ if ($[11] !== onOpenMemory) {
72
+ t8 = memory => /*#__PURE__*/_jsx(RecallRow, {
73
+ memory: memory,
74
+ onOpenMemory: onOpenMemory
75
+ }, memory.id);
76
+ $[11] = onOpenMemory;
77
+ $[12] = t8;
78
+ } else {
79
+ t8 = $[12];
80
+ }
81
+ t7 = memories.map(t8);
82
+ $[8] = memories;
83
+ $[9] = onOpenMemory;
84
+ $[10] = t7;
85
+ } else {
86
+ t7 = $[10];
87
+ }
88
+ let t8;
89
+ if ($[13] !== t7) {
90
+ t8 = /*#__PURE__*/_jsx(CollapsibleContent, {
91
+ children: /*#__PURE__*/_jsx("ul", {
92
+ className: ruledListClass,
93
+ children: t7
94
+ })
95
+ });
96
+ $[13] = t7;
97
+ $[14] = t8;
98
+ } else {
99
+ t8 = $[14];
100
+ }
101
+ let t9;
102
+ if ($[15] !== defaultOpen || $[16] !== t2 || $[17] !== t6 || $[18] !== t8) {
103
+ t9 = /*#__PURE__*/_jsxs(Collapsible, {
104
+ "data-slot": "recall",
105
+ defaultOpen: defaultOpen,
106
+ className: t2,
107
+ children: [t6, t8]
108
+ });
109
+ $[15] = defaultOpen;
110
+ $[16] = t2;
111
+ $[17] = t6;
112
+ $[18] = t8;
113
+ $[19] = t9;
114
+ } else {
115
+ t9 = $[19];
116
+ }
117
+ return t9;
118
+ }
119
+ function RelevanceMeter(t0) {
120
+ const $ = _c(14);
121
+ const {
122
+ memory
123
+ } = t0;
124
+ if (memory.relevance === undefined) {
125
+ return null;
126
+ }
127
+ let t1;
128
+ if ($[0] !== memory.relevance) {
129
+ t1 = relevancePercent(memory.relevance);
130
+ $[0] = memory.relevance;
131
+ $[1] = t1;
132
+ } else {
133
+ t1 = $[1];
134
+ }
135
+ const percent = t1;
136
+ const t2 = `Relevance of ${memory.label}`;
137
+ const t3 = `${percent}% relevant`;
138
+ const t4 = `${percent}%`;
139
+ let t5;
140
+ if ($[2] !== t4) {
141
+ t5 = /*#__PURE__*/_jsx("span", {
142
+ className: "absolute inset-y-0 left-0 bg-foreground/60 transition-[width] duration-300 motion-reduce:transition-none",
143
+ style: {
144
+ width: t4
145
+ }
146
+ });
147
+ $[2] = t4;
148
+ $[3] = t5;
149
+ } else {
150
+ t5 = $[3];
151
+ }
152
+ let t6;
153
+ if ($[4] !== percent || $[5] !== t2 || $[6] !== t3 || $[7] !== t5) {
154
+ t6 = /*#__PURE__*/_jsx("span", {
155
+ role: "meter",
156
+ "aria-label": t2,
157
+ "aria-valuemin": 0,
158
+ "aria-valuemax": 100,
159
+ "aria-valuenow": percent,
160
+ "aria-valuetext": t3,
161
+ className: "relative h-[3px] w-10 overflow-hidden bg-muted",
162
+ children: t5
163
+ });
164
+ $[4] = percent;
165
+ $[5] = t2;
166
+ $[6] = t3;
167
+ $[7] = t5;
168
+ $[8] = t6;
169
+ } else {
170
+ t6 = $[8];
171
+ }
172
+ let t7;
173
+ if ($[9] !== percent) {
174
+ t7 = /*#__PURE__*/_jsxs("span", {
175
+ className: "w-8 text-right font-mono text-xs text-muted-foreground tabular-nums",
176
+ children: [percent, "%"]
177
+ });
178
+ $[9] = percent;
179
+ $[10] = t7;
180
+ } else {
181
+ t7 = $[10];
182
+ }
183
+ let t8;
184
+ if ($[11] !== t6 || $[12] !== t7) {
185
+ t8 = /*#__PURE__*/_jsxs("span", {
186
+ className: "flex shrink-0 items-center gap-2",
187
+ children: [t6, t7]
188
+ });
189
+ $[11] = t6;
190
+ $[12] = t7;
191
+ $[13] = t8;
192
+ } else {
193
+ t8 = $[13];
194
+ }
195
+ return t8;
196
+ }
197
+ function RecallRow(t0) {
198
+ const $ = _c(21);
199
+ const {
200
+ memory,
201
+ onOpenMemory
202
+ } = t0;
203
+ let t1;
204
+ if ($[0] !== memory.label) {
205
+ t1 = /*#__PURE__*/_jsx("span", {
206
+ className: "min-w-0 flex-1 truncate text-sm font-medium",
207
+ children: memory.label
208
+ });
209
+ $[0] = memory.label;
210
+ $[1] = t1;
211
+ } else {
212
+ t1 = $[1];
213
+ }
214
+ let t2;
215
+ if ($[2] !== memory) {
216
+ t2 = /*#__PURE__*/_jsx(RelevanceMeter, {
217
+ memory: memory
218
+ });
219
+ $[2] = memory;
220
+ $[3] = t2;
221
+ } else {
222
+ t2 = $[3];
223
+ }
224
+ let t3;
225
+ if ($[4] !== t1 || $[5] !== t2) {
226
+ t3 = /*#__PURE__*/_jsxs("span", {
227
+ className: "flex w-full items-baseline gap-3",
228
+ children: [t1, t2]
229
+ });
230
+ $[4] = t1;
231
+ $[5] = t2;
232
+ $[6] = t3;
233
+ } else {
234
+ t3 = $[6];
235
+ }
236
+ let t4;
237
+ if ($[7] !== memory.kind || $[8] !== memory.snippet) {
238
+ t4 = (memory.kind || memory.snippet) && /*#__PURE__*/_jsxs("span", {
239
+ className: "flex w-full gap-2 text-xs text-muted-foreground",
240
+ children: [memory.kind && /*#__PURE__*/_jsx("span", {
241
+ className: "shrink-0 font-mono",
242
+ children: memory.kind
243
+ }), memory.kind && memory.snippet && /*#__PURE__*/_jsx("span", {
244
+ "aria-hidden": true,
245
+ children: "\xB7"
246
+ }), memory.snippet && /*#__PURE__*/_jsx("span", {
247
+ className: "line-clamp-2 min-w-0",
248
+ children: memory.snippet
249
+ })]
250
+ });
251
+ $[7] = memory.kind;
252
+ $[8] = memory.snippet;
253
+ $[9] = t4;
254
+ } else {
255
+ t4 = $[9];
256
+ }
257
+ let t5;
258
+ if ($[10] !== t3 || $[11] !== t4) {
259
+ t5 = /*#__PURE__*/_jsxs(_Fragment, {
260
+ children: [t3, t4]
261
+ });
262
+ $[10] = t3;
263
+ $[11] = t4;
264
+ $[12] = t5;
265
+ } else {
266
+ t5 = $[12];
267
+ }
268
+ const content = t5;
269
+ let t6;
270
+ if ($[13] !== content || $[14] !== memory.id || $[15] !== memory.label || $[16] !== onOpenMemory) {
271
+ t6 = onOpenMemory ? /*#__PURE__*/_jsx("button", {
272
+ type: "button",
273
+ "aria-label": `Open memory ${memory.label}`,
274
+ onClick: () => onOpenMemory(memory.id),
275
+ className: cn("flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left", interactiveRowClass),
276
+ children: content
277
+ }) : /*#__PURE__*/_jsx("div", {
278
+ className: "flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left",
279
+ children: content
280
+ });
281
+ $[13] = content;
282
+ $[14] = memory.id;
283
+ $[15] = memory.label;
284
+ $[16] = onOpenMemory;
285
+ $[17] = t6;
286
+ } else {
287
+ t6 = $[17];
288
+ }
289
+ let t7;
290
+ if ($[18] !== memory.id || $[19] !== t6) {
291
+ t7 = /*#__PURE__*/_jsx("li", {
292
+ "data-slot": "recall-item",
293
+ "data-id": memory.id,
294
+ children: t6
295
+ });
296
+ $[18] = memory.id;
297
+ $[19] = t6;
298
+ $[20] = t7;
299
+ } else {
300
+ t7 = $[20];
301
+ }
302
+ return t7;
303
+ }
@@ -0,0 +1,6 @@
1
+ export declare const eyebrowClass = "eyebrow [&_svg]:size-3.5 [&_svg]:shrink-0";
2
+ export declare const collapsibleTriggerClass = "group inline-flex w-fit items-center gap-2 py-1 outline-none transition-colors duration-150 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/70 motion-reduce:transition-none eyebrow [&_svg]:size-3.5 [&_svg]:shrink-0";
3
+ export declare const chevronClass = "opacity-70 transition-transform duration-150 group-data-[state=open]:rotate-90 motion-reduce:transition-none";
4
+ export declare const ruledRowClass = "flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm";
5
+ export declare const ruledListClass = "flex flex-col divide-y divide-border bg-card ring-1 ring-border";
6
+ export declare const interactiveRowClass = "outline-none transition-colors duration-150 hover:bg-accent/50 focus-visible:bg-accent motion-reduce:transition-none";
@@ -0,0 +1,6 @@
1
+ export const eyebrowClass = "eyebrow [&_svg]:size-3.5 [&_svg]:shrink-0";
2
+ export const collapsibleTriggerClass = `group inline-flex w-fit items-center gap-2 py-1 outline-none transition-colors duration-150 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/70 motion-reduce:transition-none ${eyebrowClass}`;
3
+ export const chevronClass = "opacity-70 transition-transform duration-150 group-data-[state=open]:rotate-90 motion-reduce:transition-none";
4
+ export const ruledRowClass = "flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm";
5
+ export const ruledListClass = "flex flex-col divide-y divide-border bg-card ring-1 ring-border";
6
+ export const interactiveRowClass = "outline-none transition-colors duration-150 hover:bg-accent/50 focus-visible:bg-accent motion-reduce:transition-none";
@@ -0,0 +1,6 @@
1
+ import type { Citation, SourceUrlPart } from "../../types.js";
2
+ export declare function hostLabel(url: string | undefined): string | undefined;
3
+ export type SourceItem = Citation | SourceUrlPart;
4
+ export declare function toCitation(item: SourceItem, position: number): Citation;
5
+ export declare function sourceKey(item: SourceItem, position: number): string;
6
+ export declare function sourceInitial(citation: Citation): string;
@@ -0,0 +1,31 @@
1
+ export function hostLabel(url) {
2
+ if (!url) return undefined;
3
+ try {
4
+ return new URL(url).host.replace(/^www\./, "");
5
+ } catch {
6
+ return url;
7
+ }
8
+ }
9
+ function isSourceUrlPart(item) {
10
+ return "type" in item && item.type === "source-url";
11
+ }
12
+ export function toCitation(item, position) {
13
+ if (!isSourceUrlPart(item)) return item;
14
+ return {
15
+ index: position + 1,
16
+ title: item.title ?? hostLabel(item.url) ?? item.url,
17
+ url: item.url
18
+ };
19
+ }
20
+ export function sourceKey(item, position) {
21
+ return isSourceUrlPart(item) ? item.sourceId : `${item.index}:${position}`;
22
+ }
23
+ function siteNameOf(host) {
24
+ const labels = host.split(".");
25
+ return labels.length > 2 ? labels.slice(-2).join(".") : host;
26
+ }
27
+ export function sourceInitial(citation) {
28
+ const host = hostLabel(citation.url);
29
+ const name = host ? siteNameOf(host) : citation.title;
30
+ return name.trim().charAt(0).toUpperCase() || "?";
31
+ }
@@ -0,0 +1,5 @@
1
+ import type { Citation } from "../../types.js";
2
+ export declare function SourceMark({ citation, className }: {
3
+ citation: Citation;
4
+ className?: string;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { cn } from "@locusgraph/components";
3
+ import { sourceInitial } from "./host-label.js";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export function SourceMark(t0) {
6
+ const $ = _c(7);
7
+ const {
8
+ citation,
9
+ className
10
+ } = t0;
11
+ let t1;
12
+ if ($[0] !== className) {
13
+ t1 = 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);
14
+ $[0] = className;
15
+ $[1] = t1;
16
+ } else {
17
+ t1 = $[1];
18
+ }
19
+ let t2;
20
+ if ($[2] !== citation) {
21
+ t2 = sourceInitial(citation);
22
+ $[2] = citation;
23
+ $[3] = t2;
24
+ } else {
25
+ t2 = $[3];
26
+ }
27
+ let t3;
28
+ if ($[4] !== t1 || $[5] !== t2) {
29
+ t3 = /*#__PURE__*/_jsx("span", {
30
+ "aria-hidden": true,
31
+ "data-slot": "source-mark",
32
+ className: t1,
33
+ children: t2
34
+ });
35
+ $[4] = t1;
36
+ $[5] = t2;
37
+ $[6] = t3;
38
+ } else {
39
+ t3 = $[6];
40
+ }
41
+ return t3;
42
+ }
@@ -0,0 +1,9 @@
1
+ import type { Citation } from "../types.js";
2
+ import { type SourceItem } from "./shared/host-label.js";
3
+ export type SourcesProps = {
4
+ sources: SourceItem[];
5
+ onOpen?: (citation: Citation) => void;
6
+ defaultOpen?: boolean;
7
+ className?: string;
8
+ };
9
+ export declare function Sources({ sources, onOpen, defaultOpen, className }: SourcesProps): import("react").JSX.Element | null;
@@ -0,0 +1,264 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
4
+ import { pluralize } from "@locusgraph/utils";
5
+ import { chevronClass, collapsibleTriggerClass, interactiveRowClass, ruledListClass, ruledRowClass } from "./shared/disclosure.js";
6
+ import { hostLabel, sourceKey, toCitation } from "./shared/host-label.js";
7
+ import { SourceMark } from "./shared/source-mark.js";
8
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
+ const stackedMarkLimit = 3;
10
+ export function Sources(t0) {
11
+ const $ = _c(35);
12
+ const {
13
+ sources,
14
+ onOpen,
15
+ defaultOpen: t1,
16
+ className
17
+ } = t0;
18
+ const defaultOpen = t1 === undefined ? false : t1;
19
+ if (sources.length === 0) {
20
+ return null;
21
+ }
22
+ let T0;
23
+ let T1;
24
+ let t2;
25
+ let t3;
26
+ let t4;
27
+ let t5;
28
+ let t6;
29
+ let t7;
30
+ if ($[0] !== className || $[1] !== defaultOpen || $[2] !== onOpen || $[3] !== sources) {
31
+ const citations = sources.map(toCitation);
32
+ T1 = Collapsible;
33
+ t4 = "sources";
34
+ t5 = defaultOpen;
35
+ if ($[12] !== className) {
36
+ t6 = cn("flex min-w-0 flex-col gap-2", className);
37
+ $[12] = className;
38
+ $[13] = t6;
39
+ } else {
40
+ t6 = $[13];
41
+ }
42
+ let t8;
43
+ if ($[14] !== sources) {
44
+ t8 = (citation, position) => /*#__PURE__*/_jsx(SourceMark, {
45
+ citation: citation,
46
+ className: "ring-card"
47
+ }, sourceKey(sources[position], position));
48
+ $[14] = sources;
49
+ $[15] = t8;
50
+ } else {
51
+ t8 = $[15];
52
+ }
53
+ let t9;
54
+ if ($[16] !== sources.length) {
55
+ t9 = pluralize(sources.length, "source");
56
+ $[16] = sources.length;
57
+ $[17] = t9;
58
+ } else {
59
+ t9 = $[17];
60
+ }
61
+ let t10;
62
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
63
+ t10 = /*#__PURE__*/_jsx(ChevronRightIcon, {
64
+ "aria-hidden": true,
65
+ className: chevronClass
66
+ });
67
+ $[18] = t10;
68
+ } else {
69
+ t10 = $[18];
70
+ }
71
+ t7 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
72
+ className: collapsibleTriggerClass,
73
+ children: [/*#__PURE__*/_jsx("span", {
74
+ "aria-hidden": true,
75
+ className: "flex -space-x-1",
76
+ children: citations.slice(0, stackedMarkLimit).map(t8)
77
+ }), "Used ", t9, t10]
78
+ });
79
+ T0 = CollapsibleContent;
80
+ t2 = ruledListClass;
81
+ let t11;
82
+ if ($[19] !== onOpen || $[20] !== sources) {
83
+ t11 = (citation_0, position_0) => /*#__PURE__*/_jsx(SourceRow, {
84
+ citation: citation_0,
85
+ onOpen: onOpen
86
+ }, sourceKey(sources[position_0], position_0));
87
+ $[19] = onOpen;
88
+ $[20] = sources;
89
+ $[21] = t11;
90
+ } else {
91
+ t11 = $[21];
92
+ }
93
+ t3 = citations.map(t11);
94
+ $[0] = className;
95
+ $[1] = defaultOpen;
96
+ $[2] = onOpen;
97
+ $[3] = sources;
98
+ $[4] = T0;
99
+ $[5] = T1;
100
+ $[6] = t2;
101
+ $[7] = t3;
102
+ $[8] = t4;
103
+ $[9] = t5;
104
+ $[10] = t6;
105
+ $[11] = t7;
106
+ } else {
107
+ T0 = $[4];
108
+ T1 = $[5];
109
+ t2 = $[6];
110
+ t3 = $[7];
111
+ t4 = $[8];
112
+ t5 = $[9];
113
+ t6 = $[10];
114
+ t7 = $[11];
115
+ }
116
+ let t8;
117
+ if ($[22] !== t2 || $[23] !== t3) {
118
+ t8 = /*#__PURE__*/_jsx("ol", {
119
+ className: t2,
120
+ children: t3
121
+ });
122
+ $[22] = t2;
123
+ $[23] = t3;
124
+ $[24] = t8;
125
+ } else {
126
+ t8 = $[24];
127
+ }
128
+ let t9;
129
+ if ($[25] !== T0 || $[26] !== t8) {
130
+ t9 = /*#__PURE__*/_jsx(T0, {
131
+ children: t8
132
+ });
133
+ $[25] = T0;
134
+ $[26] = t8;
135
+ $[27] = t9;
136
+ } else {
137
+ t9 = $[27];
138
+ }
139
+ let t10;
140
+ if ($[28] !== T1 || $[29] !== t4 || $[30] !== t5 || $[31] !== t6 || $[32] !== t7 || $[33] !== t9) {
141
+ t10 = /*#__PURE__*/_jsxs(T1, {
142
+ "data-slot": t4,
143
+ defaultOpen: t5,
144
+ className: t6,
145
+ children: [t7, t9]
146
+ });
147
+ $[28] = T1;
148
+ $[29] = t4;
149
+ $[30] = t5;
150
+ $[31] = t6;
151
+ $[32] = t7;
152
+ $[33] = t9;
153
+ $[34] = t10;
154
+ } else {
155
+ t10 = $[34];
156
+ }
157
+ return t10;
158
+ }
159
+ function SourceRow(t0) {
160
+ const $ = _c(21);
161
+ const {
162
+ citation,
163
+ onOpen
164
+ } = t0;
165
+ let t1;
166
+ if ($[0] !== citation.url) {
167
+ t1 = hostLabel(citation.url);
168
+ $[0] = citation.url;
169
+ $[1] = t1;
170
+ } else {
171
+ t1 = $[1];
172
+ }
173
+ const host = t1;
174
+ const showHost = host !== undefined && host !== citation.title;
175
+ let t2;
176
+ if ($[2] !== citation.index) {
177
+ t2 = /*#__PURE__*/_jsx("span", {
178
+ className: "w-4 shrink-0 font-mono text-xs text-muted-foreground tabular-nums",
179
+ children: citation.index
180
+ });
181
+ $[2] = citation.index;
182
+ $[3] = t2;
183
+ } else {
184
+ t2 = $[3];
185
+ }
186
+ let t3;
187
+ if ($[4] !== citation.title) {
188
+ t3 = /*#__PURE__*/_jsx("span", {
189
+ className: "min-w-0 flex-1 truncate",
190
+ children: citation.title
191
+ });
192
+ $[4] = citation.title;
193
+ $[5] = t3;
194
+ } else {
195
+ t3 = $[5];
196
+ }
197
+ let t4;
198
+ if ($[6] !== host || $[7] !== showHost) {
199
+ t4 = showHost && /*#__PURE__*/_jsx("span", {
200
+ className: "max-w-[40%] shrink-0 truncate text-xs text-muted-foreground",
201
+ children: host
202
+ });
203
+ $[6] = host;
204
+ $[7] = showHost;
205
+ $[8] = t4;
206
+ } else {
207
+ t4 = $[8];
208
+ }
209
+ let t5;
210
+ if ($[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
211
+ t5 = /*#__PURE__*/_jsxs(_Fragment, {
212
+ children: [t2, t3, t4]
213
+ });
214
+ $[9] = t2;
215
+ $[10] = t3;
216
+ $[11] = t4;
217
+ $[12] = t5;
218
+ } else {
219
+ t5 = $[12];
220
+ }
221
+ const content = t5;
222
+ const label = `Open source ${citation.index}: ${citation.title}`;
223
+ let t6;
224
+ if ($[13] !== citation || $[14] !== content || $[15] !== label || $[16] !== onOpen) {
225
+ t6 = onOpen ? /*#__PURE__*/_jsx("button", {
226
+ type: "button",
227
+ "aria-label": label,
228
+ onClick: () => onOpen(citation),
229
+ className: cn(ruledRowClass, interactiveRowClass),
230
+ children: content
231
+ }) : citation.url ? /*#__PURE__*/_jsx("a", {
232
+ href: citation.url,
233
+ target: "_blank",
234
+ rel: "noreferrer",
235
+ "aria-label": label,
236
+ className: cn(ruledRowClass, interactiveRowClass),
237
+ children: content
238
+ }) : /*#__PURE__*/_jsx("div", {
239
+ className: ruledRowClass,
240
+ children: content
241
+ });
242
+ $[13] = citation;
243
+ $[14] = content;
244
+ $[15] = label;
245
+ $[16] = onOpen;
246
+ $[17] = t6;
247
+ } else {
248
+ t6 = $[17];
249
+ }
250
+ let t7;
251
+ if ($[18] !== citation.index || $[19] !== t6) {
252
+ t7 = /*#__PURE__*/_jsx("li", {
253
+ "data-slot": "sources-item",
254
+ "data-index": citation.index,
255
+ children: t6
256
+ });
257
+ $[18] = citation.index;
258
+ $[19] = t6;
259
+ $[20] = t7;
260
+ } else {
261
+ t7 = $[20];
262
+ }
263
+ return t7;
264
+ }
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from "react";
2
+ import type { DecidedAt } from "../approval/types.js";
3
+ export declare function toDate(value: DecidedAt): Date;
4
+ export declare function isoOf(value: DecidedAt): string | undefined;
5
+ export declare function formatDecidedAt(value: DecidedAt): string;
6
+ export type DecisionOutcome = {
7
+ approved: boolean;
8
+ by?: string;
9
+ at?: DecidedAt;
10
+ reason?: string;
11
+ };
12
+ export type DecisionSummaryProps = {
13
+ decision: DecisionOutcome;
14
+ result: ReactNode;
15
+ approvedVerb?: string;
16
+ deniedVerb?: string;
17
+ };
18
+ export declare function DecisionSummary({ decision, result, approvedVerb, deniedVerb, }: DecisionSummaryProps): import("react").JSX.Element;