@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,152 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ChevronDown as ChevronDownIcon } from "@carbon/icons-react";
3
+ import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "@locusgraph/components";
4
+ import { formatDate } from "@locusgraph/utils";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ export function VersionSwitcher(t0) {
7
+ const $ = _c(26);
8
+ const {
9
+ versions,
10
+ current,
11
+ onVersionChange
12
+ } = t0;
13
+ let t1;
14
+ if ($[0] !== current.label) {
15
+ t1 = /*#__PURE__*/_jsx("span", {
16
+ "data-slot": "canvas-current-version",
17
+ children: current.label
18
+ });
19
+ $[0] = current.label;
20
+ $[1] = t1;
21
+ } else {
22
+ t1 = $[1];
23
+ }
24
+ let t2;
25
+ if ($[2] !== versions.length) {
26
+ t2 = versions.length > 1 && /*#__PURE__*/_jsxs("span", {
27
+ className: "text-muted-foreground",
28
+ children: ["of ", versions.length]
29
+ });
30
+ $[2] = versions.length;
31
+ $[3] = t2;
32
+ } else {
33
+ t2 = $[3];
34
+ }
35
+ const t3 = current.createdAt;
36
+ let t4;
37
+ if ($[4] !== current.createdAt) {
38
+ t4 = formatDate(current.createdAt);
39
+ $[4] = current.createdAt;
40
+ $[5] = t4;
41
+ } else {
42
+ t4 = $[5];
43
+ }
44
+ let t5;
45
+ if ($[6] !== current.createdAt || $[7] !== t4) {
46
+ t5 = /*#__PURE__*/_jsx("time", {
47
+ dateTime: t3,
48
+ className: "text-muted-foreground",
49
+ children: t4
50
+ });
51
+ $[6] = current.createdAt;
52
+ $[7] = t4;
53
+ $[8] = t5;
54
+ } else {
55
+ t5 = $[8];
56
+ }
57
+ let t6;
58
+ if ($[9] !== t1 || $[10] !== t2 || $[11] !== t5) {
59
+ t6 = /*#__PURE__*/_jsxs("span", {
60
+ className: "flex items-center gap-2 font-mono text-[11px] tabular-nums",
61
+ children: [t1, t2, t5]
62
+ });
63
+ $[9] = t1;
64
+ $[10] = t2;
65
+ $[11] = t5;
66
+ $[12] = t6;
67
+ } else {
68
+ t6 = $[12];
69
+ }
70
+ const label = t6;
71
+ if (versions.length < 2 || !onVersionChange) {
72
+ return label;
73
+ }
74
+ const t7 = `Version ${current.label}, choose another version`;
75
+ let t8;
76
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
77
+ t8 = /*#__PURE__*/_jsx(ChevronDownIcon, {});
78
+ $[13] = t8;
79
+ } else {
80
+ t8 = $[13];
81
+ }
82
+ let t9;
83
+ if ($[14] !== label || $[15] !== t7) {
84
+ t9 = /*#__PURE__*/_jsx(DropdownMenuTrigger, {
85
+ asChild: true,
86
+ children: /*#__PURE__*/_jsxs(Button, {
87
+ type: "button",
88
+ variant: "ghost",
89
+ size: "xs",
90
+ className: "-ml-2 font-normal",
91
+ "aria-label": t7,
92
+ children: [label, t8]
93
+ })
94
+ });
95
+ $[14] = label;
96
+ $[15] = t7;
97
+ $[16] = t9;
98
+ } else {
99
+ t9 = $[16];
100
+ }
101
+ const t10 = current.id;
102
+ let t11;
103
+ if ($[17] !== versions) {
104
+ t11 = versions.map(_temp);
105
+ $[17] = versions;
106
+ $[18] = t11;
107
+ } else {
108
+ t11 = $[18];
109
+ }
110
+ let t12;
111
+ if ($[19] !== current.id || $[20] !== onVersionChange || $[21] !== t11) {
112
+ t12 = /*#__PURE__*/_jsx(DropdownMenuContent, {
113
+ align: "start",
114
+ sideOffset: 6,
115
+ children: /*#__PURE__*/_jsx(DropdownMenuRadioGroup, {
116
+ value: t10,
117
+ onValueChange: onVersionChange,
118
+ children: t11
119
+ })
120
+ });
121
+ $[19] = current.id;
122
+ $[20] = onVersionChange;
123
+ $[21] = t11;
124
+ $[22] = t12;
125
+ } else {
126
+ t12 = $[22];
127
+ }
128
+ let t13;
129
+ if ($[23] !== t12 || $[24] !== t9) {
130
+ t13 = /*#__PURE__*/_jsxs(DropdownMenu, {
131
+ children: [t9, t12]
132
+ });
133
+ $[23] = t12;
134
+ $[24] = t9;
135
+ $[25] = t13;
136
+ } else {
137
+ t13 = $[25];
138
+ }
139
+ return t13;
140
+ }
141
+ function _temp(version) {
142
+ return /*#__PURE__*/_jsxs(DropdownMenuRadioItem, {
143
+ value: version.id,
144
+ children: [/*#__PURE__*/_jsx("span", {
145
+ className: "font-mono text-xs",
146
+ children: version.label
147
+ }), /*#__PURE__*/_jsx("span", {
148
+ className: "ml-auto pl-4 text-xs text-muted-foreground",
149
+ children: formatDate(version.createdAt)
150
+ })]
151
+ }, version.id);
152
+ }
@@ -0,0 +1,10 @@
1
+ import { type ComponentProps } from "react";
2
+ type CodeProps = Omit<ComponentProps<"figure">, "children"> & {
3
+ code: string;
4
+ language?: string;
5
+ filename?: string;
6
+ showCopy?: boolean;
7
+ onCopy?: (code: string) => void;
8
+ };
9
+ export declare function Code({ code, language, filename, showCopy, onCopy, className, ...props }: CodeProps): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,195 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { cn } from "@locusgraph/components";
5
+ import { useEffect, useState } from "react";
6
+ import { CopyCodeButton } from "./copy-code-button.js";
7
+ import { highlightToHtml } from "./highlight.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const codeAreaClass = cn("overflow-x-auto bg-muted/40 px-4 py-3 font-mono text-xs leading-relaxed", "[&_pre]:bg-transparent! [&_pre]:outline-none", "[&_.shiki_span]:text-(--shiki-light) dark:[&_.shiki_span]:text-(--shiki-dark)");
10
+ function useHighlightedHtml(code, language) {
11
+ const $ = _c(4);
12
+ const [html, setHtml] = useState(null);
13
+ let t0;
14
+ let t1;
15
+ if ($[0] !== code || $[1] !== language) {
16
+ t0 = () => {
17
+ let current = true;
18
+ setHtml(null);
19
+ highlightToHtml(code, language).then(highlighted => {
20
+ if (current) {
21
+ setHtml(highlighted);
22
+ }
23
+ }).catch(() => {
24
+ if (current) {
25
+ setHtml(null);
26
+ }
27
+ });
28
+ return () => {
29
+ current = false;
30
+ };
31
+ };
32
+ t1 = [code, language];
33
+ $[0] = code;
34
+ $[1] = language;
35
+ $[2] = t0;
36
+ $[3] = t1;
37
+ } else {
38
+ t0 = $[2];
39
+ t1 = $[3];
40
+ }
41
+ useEffect(t0, t1);
42
+ return html;
43
+ }
44
+ export function Code(t0) {
45
+ const $ = _c(35);
46
+ let className;
47
+ let code;
48
+ let filename;
49
+ let onCopy;
50
+ let props;
51
+ let t1;
52
+ let t2;
53
+ if ($[0] !== t0) {
54
+ ({
55
+ code,
56
+ language: t1,
57
+ filename,
58
+ showCopy: t2,
59
+ onCopy,
60
+ className,
61
+ ...props
62
+ } = t0);
63
+ $[0] = t0;
64
+ $[1] = className;
65
+ $[2] = code;
66
+ $[3] = filename;
67
+ $[4] = onCopy;
68
+ $[5] = props;
69
+ $[6] = t1;
70
+ $[7] = t2;
71
+ } else {
72
+ className = $[1];
73
+ code = $[2];
74
+ filename = $[3];
75
+ onCopy = $[4];
76
+ props = $[5];
77
+ t1 = $[6];
78
+ t2 = $[7];
79
+ }
80
+ const language = t1 === undefined ? "text" : t1;
81
+ const showCopy = t2 === undefined ? true : t2;
82
+ const html = useHighlightedHtml(code, language);
83
+ let t3;
84
+ if ($[8] !== className) {
85
+ t3 = cn("min-w-0 bg-card text-card-foreground ring-1 ring-border", className);
86
+ $[8] = className;
87
+ $[9] = t3;
88
+ } else {
89
+ t3 = $[9];
90
+ }
91
+ let t4;
92
+ if ($[10] !== filename || $[11] !== language) {
93
+ t4 = filename ? /*#__PURE__*/_jsx("span", {
94
+ className: "min-w-0 truncate font-mono text-xs text-foreground",
95
+ children: filename
96
+ }) : /*#__PURE__*/_jsx("span", {
97
+ className: "eyebrow",
98
+ children: language
99
+ });
100
+ $[10] = filename;
101
+ $[11] = language;
102
+ $[12] = t4;
103
+ } else {
104
+ t4 = $[12];
105
+ }
106
+ let t5;
107
+ if ($[13] !== filename || $[14] !== language) {
108
+ t5 = filename && /*#__PURE__*/_jsx("span", {
109
+ className: "eyebrow",
110
+ children: language
111
+ });
112
+ $[13] = filename;
113
+ $[14] = language;
114
+ $[15] = t5;
115
+ } else {
116
+ t5 = $[15];
117
+ }
118
+ let t6;
119
+ if ($[16] !== code || $[17] !== onCopy || $[18] !== showCopy) {
120
+ t6 = showCopy && /*#__PURE__*/_jsx(CopyCodeButton, {
121
+ code: code,
122
+ onCopy: onCopy
123
+ });
124
+ $[16] = code;
125
+ $[17] = onCopy;
126
+ $[18] = showCopy;
127
+ $[19] = t6;
128
+ } else {
129
+ t6 = $[19];
130
+ }
131
+ let t7;
132
+ if ($[20] !== t5 || $[21] !== t6) {
133
+ t7 = /*#__PURE__*/_jsxs("span", {
134
+ className: "flex shrink-0 items-center gap-2",
135
+ children: [t5, t6]
136
+ });
137
+ $[20] = t5;
138
+ $[21] = t6;
139
+ $[22] = t7;
140
+ } else {
141
+ t7 = $[22];
142
+ }
143
+ let t8;
144
+ if ($[23] !== t4 || $[24] !== t7) {
145
+ t8 = /*#__PURE__*/_jsxs("figcaption", {
146
+ className: "flex h-8 items-center justify-between gap-2 border-b pr-1 pl-3",
147
+ children: [t4, t7]
148
+ });
149
+ $[23] = t4;
150
+ $[24] = t7;
151
+ $[25] = t8;
152
+ } else {
153
+ t8 = $[25];
154
+ }
155
+ let t9;
156
+ if ($[26] !== code || $[27] !== html) {
157
+ t9 = html ? /*#__PURE__*/_jsx("div", {
158
+ "data-slot": "code-area",
159
+ className: codeAreaClass,
160
+ dangerouslySetInnerHTML: {
161
+ __html: html
162
+ }
163
+ }) : /*#__PURE__*/_jsx("pre", {
164
+ "data-slot": "code-area",
165
+ className: codeAreaClass,
166
+ children: /*#__PURE__*/_jsx("code", {
167
+ children: code
168
+ })
169
+ });
170
+ $[26] = code;
171
+ $[27] = html;
172
+ $[28] = t9;
173
+ } else {
174
+ t9 = $[28];
175
+ }
176
+ let t10;
177
+ if ($[29] !== language || $[30] !== props || $[31] !== t3 || $[32] !== t8 || $[33] !== t9) {
178
+ t10 = /*#__PURE__*/_jsxs("figure", {
179
+ "data-slot": "code",
180
+ "data-language": language,
181
+ className: t3,
182
+ ...props,
183
+ children: [t8, t9]
184
+ });
185
+ $[29] = language;
186
+ $[30] = props;
187
+ $[31] = t3;
188
+ $[32] = t8;
189
+ $[33] = t9;
190
+ $[34] = t10;
191
+ } else {
192
+ t10 = $[34];
193
+ }
194
+ return t10;
195
+ }
@@ -0,0 +1,6 @@
1
+ type CopyCodeButtonProps = {
2
+ code: string;
3
+ onCopy?: (code: string) => void;
4
+ };
5
+ export declare function CopyCodeButton({ code, onCopy }: CopyCodeButtonProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,66 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Checkmark as CheckIcon, Copy as CopyIcon } from "@carbon/icons-react";
3
+ import { Button } from "@locusgraph/components";
4
+ import { useCopied, writeToClipboard } from "../use-copied.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export function CopyCodeButton(t0) {
7
+ const $ = _c(10);
8
+ const {
9
+ code,
10
+ onCopy
11
+ } = t0;
12
+ const {
13
+ copied,
14
+ markCopied
15
+ } = useCopied();
16
+ let t1;
17
+ if ($[0] !== code || $[1] !== markCopied || $[2] !== onCopy) {
18
+ t1 = async () => {
19
+ if (onCopy) {
20
+ onCopy(code);
21
+ markCopied();
22
+ return;
23
+ }
24
+ if (await writeToClipboard(code)) {
25
+ markCopied();
26
+ }
27
+ };
28
+ $[0] = code;
29
+ $[1] = markCopied;
30
+ $[2] = onCopy;
31
+ $[3] = t1;
32
+ } else {
33
+ t1 = $[3];
34
+ }
35
+ const copy = t1;
36
+ const t2 = copied ? "Copied" : "Copy code";
37
+ let t3;
38
+ if ($[4] !== copied) {
39
+ t3 = copied ? /*#__PURE__*/_jsx(CheckIcon, {
40
+ className: "text-good"
41
+ }) : /*#__PURE__*/_jsx(CopyIcon, {});
42
+ $[4] = copied;
43
+ $[5] = t3;
44
+ } else {
45
+ t3 = $[5];
46
+ }
47
+ let t4;
48
+ if ($[6] !== copy || $[7] !== t2 || $[8] !== t3) {
49
+ t4 = /*#__PURE__*/_jsx(Button, {
50
+ type: "button",
51
+ variant: "ghost",
52
+ size: "icon-xs",
53
+ "aria-label": t2,
54
+ className: "text-muted-foreground hover:text-foreground",
55
+ onClick: copy,
56
+ children: t3
57
+ });
58
+ $[6] = copy;
59
+ $[7] = t2;
60
+ $[8] = t3;
61
+ $[9] = t4;
62
+ } else {
63
+ t4 = $[9];
64
+ }
65
+ return t4;
66
+ }
@@ -0,0 +1 @@
1
+ export declare function highlightToHtml(code: string, language: string): Promise<string | null>;
@@ -0,0 +1,40 @@
1
+ const lightTheme = "github-light";
2
+ const darkTheme = "github-dark";
3
+ let highlighter;
4
+ function loadHighlighter() {
5
+ highlighter ??= Promise.all([import("shiki/core"), import("shiki/engine/javascript"), import("shiki/themes")]).then(([core, engine, themes]) => core.createHighlighterCore({
6
+ themes: [themes.bundledThemes[lightTheme](), themes.bundledThemes[darkTheme]()],
7
+ langs: [],
8
+ engine: engine.createJavaScriptRegexEngine()
9
+ }));
10
+ return highlighter;
11
+ }
12
+ async function loadLanguage(loaded, language) {
13
+ if (loaded.getLoadedLanguages().includes(language)) {
14
+ return true;
15
+ }
16
+ const {
17
+ bundledLanguages
18
+ } = await import("shiki/langs");
19
+ const loader = bundledLanguages[language];
20
+ if (!loader) {
21
+ return false;
22
+ }
23
+ await loaded.loadLanguage(loader());
24
+ return true;
25
+ }
26
+ export async function highlightToHtml(code, language) {
27
+ const normalized = language.toLowerCase();
28
+ const loaded = await loadHighlighter();
29
+ if (!(await loadLanguage(loaded, normalized))) {
30
+ return null;
31
+ }
32
+ return loaded.codeToHtml(code, {
33
+ lang: normalized,
34
+ themes: {
35
+ light: lightTheme,
36
+ dark: darkTheme
37
+ },
38
+ defaultColor: false
39
+ });
40
+ }
@@ -0,0 +1,16 @@
1
+ import type { HistoryItem } from "./row/history-row.js";
2
+ import type { ThreadGroup } from "./thread-groups.js";
3
+ export type HistoryListRow = {
4
+ kind: "group";
5
+ key: string;
6
+ groupKey: string;
7
+ label: string;
8
+ } | {
9
+ kind: "thread";
10
+ key: string;
11
+ thread: HistoryItem;
12
+ position: number;
13
+ groupSize: number;
14
+ };
15
+ export declare function historyListRows(groups: ThreadGroup[]): HistoryListRow[];
16
+ export declare function estimatedRowHeight(row: HistoryListRow, index: number): number;
@@ -0,0 +1,23 @@
1
+ export function historyListRows(groups) {
2
+ return groups.flatMap(group => [{
3
+ kind: "group",
4
+ key: `group:${group.key}`,
5
+ groupKey: group.key,
6
+ label: group.label
7
+ }, ...group.threads.map((thread, index) => ({
8
+ kind: "thread",
9
+ key: thread.id,
10
+ thread,
11
+ position: index + 1,
12
+ groupSize: group.threads.length
13
+ }))]);
14
+ }
15
+ const groupLabelHeightPx = 24;
16
+ const groupGapPx = 16;
17
+ const threadRowHeightPx = 32;
18
+ export function estimatedRowHeight(row, index) {
19
+ if (row.kind === "thread") {
20
+ return threadRowHeightPx;
21
+ }
22
+ return index === 0 ? groupLabelHeightPx : groupLabelHeightPx + groupGapPx;
23
+ }
@@ -0,0 +1,16 @@
1
+ import type { ComponentProps } from "react";
2
+ import { type HistoryItem } from "./row/history-row.js";
3
+ type HistoryProps = Omit<ComponentProps<"nav">, "onSelect"> & {
4
+ threads: HistoryItem[];
5
+ activeId?: string | null;
6
+ onSelect: (id: string) => void;
7
+ onNew?: () => void;
8
+ onRename?: (id: string, title: string) => void;
9
+ onArchive?: (id: string) => void;
10
+ label?: string;
11
+ emptyText?: string;
12
+ now?: Date | string;
13
+ virtualize?: boolean;
14
+ };
15
+ export declare function History({ threads, activeId, onSelect, onNew, onRename, onArchive, label, emptyText, now, virtualize, className, ...props }: HistoryProps): import("react").JSX.Element;
16
+ export {};