@locusgraph/loop 0.3.0 → 0.3.1

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 (52) hide show
  1. package/dist/agent/pulse/gradient-label.js +64 -12
  2. package/dist/agent/pulse/marks/bars-mark.js +39 -15
  3. package/dist/agent/pulse/marks/glyph-mark.js +56 -15
  4. package/dist/agent/pulse/marks/locus-mark.js +38 -12
  5. package/dist/agent/pulse/marks/orb-mark.js +21 -9
  6. package/dist/agent/pulse/use-loop-animation.js +35 -12
  7. package/dist/approval/inbox/inbox-row.js +303 -76
  8. package/dist/approval/inbox/inbox.js +192 -39
  9. package/dist/approval/inbox/virtual-inbox-list.js +104 -26
  10. package/dist/approval/memory/memory-review.js +172 -36
  11. package/dist/approval/memory/memory-row.js +187 -50
  12. package/dist/approval/plan/plan-review.js +225 -73
  13. package/dist/approval/plan/plan-step-row.js +182 -76
  14. package/dist/approval/plan/question-choices.js +132 -44
  15. package/dist/approval/plan/question.js +156 -38
  16. package/dist/approval/run/run-bar.js +125 -39
  17. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  18. package/dist/approval/spend/raise-cap-form.js +223 -48
  19. package/dist/approval/spend/spend-gate.js +157 -40
  20. package/dist/approval/tool/approval.js +196 -35
  21. package/dist/approval/tool/args/args-editor.js +206 -46
  22. package/dist/approval/tool/args/args-field.js +240 -55
  23. package/dist/approval/tool/deny-form.js +125 -36
  24. package/dist/approval/tool/tool-inputs.js +90 -23
  25. package/dist/chat/chat/use-stick-to-bottom.js +115 -60
  26. package/dist/chat/chat/virtual-chat-items.js +129 -34
  27. package/dist/chat/composer/composer-actions.d.ts +1 -2
  28. package/dist/chat/composer/composer-actions.js +132 -49
  29. package/dist/chat/composer/composer-status.d.ts +2 -0
  30. package/dist/chat/composer/composer-status.js +3 -0
  31. package/dist/chat/composer/composer.d.ts +1 -1
  32. package/dist/chat/composer/composer.js +2 -1
  33. package/dist/chat/composer/use-auto-grow.js +25 -8
  34. package/dist/chat/files/files.js +293 -66
  35. package/dist/chat/index.d.ts +1 -1
  36. package/dist/chat/index.js +1 -1
  37. package/dist/cost/model-picker.js +174 -42
  38. package/dist/memory/cite.js +181 -58
  39. package/dist/memory/memorized.js +196 -42
  40. package/dist/memory/recall.js +265 -68
  41. package/dist/memory/sources.js +232 -52
  42. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  43. package/dist/thread/actions/branch-switcher.js +97 -21
  44. package/dist/thread/canvas/version-switcher.js +128 -31
  45. package/dist/thread/code/copy-code-button.js +58 -24
  46. package/dist/thread/history/row/history-row.js +99 -18
  47. package/dist/thread/history/row/thread-item-menu.js +74 -19
  48. package/dist/thread/history/row/thread-title-editor.js +74 -29
  49. package/dist/thread/history/virtual-history-list.js +84 -46
  50. package/dist/thread/starters/starters.js +89 -27
  51. package/dist/thread/use-copied.js +40 -10
  52. package/package.json +1 -1
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { AiGenerate as SparkleIcon } from "@carbon/icons-react";
2
5
  import { cn } from "@locusgraph/components";
3
6
  import { useLoopAnimation } from "./use-loop-animation.js";
@@ -22,23 +25,72 @@ const toneText = {
22
25
  neutral: "bg-[linear-gradient(90deg,var(--color-muted-foreground),var(--color-foreground),var(--color-muted-foreground))]",
23
26
  brand: "bg-[linear-gradient(90deg,var(--color-sky-500),var(--color-violet-500),var(--color-pink-500),var(--color-sky-500))]"
24
27
  };
25
- export function GradientLabel({
26
- label,
27
- tone = "neutral"
28
- }) {
28
+ export function GradientLabel(t0) {
29
+ const $ = _c(14);
30
+ const {
31
+ label,
32
+ tone: t1
33
+ } = t0;
34
+ const tone = t1 === undefined ? "neutral" : t1;
29
35
  const text = useLoopAnimation(drift, 2600, 0, "linear");
30
36
  const icon = useLoopAnimation(turn, 2600);
31
- return /*#__PURE__*/_jsxs("span", {
32
- className: "inline-flex items-center gap-1.5",
33
- children: [/*#__PURE__*/_jsx(SparkleIcon, {
37
+ const t2 = toneIcon[tone];
38
+ let t3;
39
+ if ($[0] !== t2) {
40
+ t3 = cn("size-[1.05em]", t2);
41
+ $[0] = t2;
42
+ $[1] = t3;
43
+ } else {
44
+ t3 = $[1];
45
+ }
46
+ let t4;
47
+ if ($[2] !== icon || $[3] !== t3) {
48
+ t4 = /*#__PURE__*/_jsx(SparkleIcon, {
34
49
  ref: icon,
35
50
  "aria-hidden": true,
36
- className: cn("size-[1.05em]", toneIcon[tone])
37
- }), /*#__PURE__*/_jsx("span", {
51
+ className: t3
52
+ });
53
+ $[2] = icon;
54
+ $[3] = t3;
55
+ $[4] = t4;
56
+ } else {
57
+ t4 = $[4];
58
+ }
59
+ const t5 = toneText[tone];
60
+ let t6;
61
+ if ($[5] !== t5) {
62
+ t6 = cn("bg-[length:200%_100%] bg-clip-text font-medium text-transparent", t5);
63
+ $[5] = t5;
64
+ $[6] = t6;
65
+ } else {
66
+ t6 = $[6];
67
+ }
68
+ let t7;
69
+ if ($[7] !== label || $[8] !== t6 || $[9] !== text) {
70
+ t7 = /*#__PURE__*/_jsx("span", {
38
71
  ref: text,
39
72
  "data-slot": "pulse-gradient",
40
- className: cn("bg-[length:200%_100%] bg-clip-text font-medium text-transparent", toneText[tone]),
73
+ className: t6,
41
74
  children: label
42
- })]
43
- });
75
+ });
76
+ $[7] = label;
77
+ $[8] = t6;
78
+ $[9] = text;
79
+ $[10] = t7;
80
+ } else {
81
+ t7 = $[10];
82
+ }
83
+ let t8;
84
+ if ($[11] !== t4 || $[12] !== t7) {
85
+ t8 = /*#__PURE__*/_jsxs("span", {
86
+ className: "inline-flex items-center gap-1.5",
87
+ children: [t4, t7]
88
+ });
89
+ $[11] = t4;
90
+ $[12] = t7;
91
+ $[13] = t8;
92
+ } else {
93
+ t8 = $[13];
94
+ }
95
+ return t8;
44
96
  }
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { useLoopAnimation } from "../use-loop-animation.js";
2
5
  import { jsx as _jsx } from "react/jsx-runtime";
3
6
  const bounce = [{
@@ -8,22 +11,43 @@ const bounce = [{
8
11
  transform: "scaleY(0.35)"
9
12
  }];
10
13
  const barDelays = [0, 140, 280, 420];
11
- function Bar({
12
- delay
13
- }) {
14
+ function Bar(t0) {
15
+ const $ = _c(2);
16
+ const {
17
+ delay
18
+ } = t0;
14
19
  const ref = useLoopAnimation(bounce, 900, delay);
15
- return /*#__PURE__*/_jsx("span", {
16
- ref: ref,
17
- className: "h-full w-[0.16em] origin-center scale-y-[0.35] rounded-full bg-current"
18
- });
20
+ let t1;
21
+ if ($[0] !== ref) {
22
+ t1 = /*#__PURE__*/_jsx("span", {
23
+ ref: ref,
24
+ className: "h-full w-[0.16em] origin-center scale-y-[0.35] rounded-full bg-current"
25
+ });
26
+ $[0] = ref;
27
+ $[1] = t1;
28
+ } else {
29
+ t1 = $[1];
30
+ }
31
+ return t1;
19
32
  }
20
33
  export function BarsMark() {
21
- return /*#__PURE__*/_jsx("span", {
22
- "aria-hidden": true,
23
- "data-slot": "pulse-bars",
24
- className: "inline-flex h-[1em] items-center gap-[0.14em] text-foreground/70",
25
- children: barDelays.map(delay => /*#__PURE__*/_jsx(Bar, {
26
- delay: delay
27
- }, delay))
28
- });
34
+ const $ = _c(1);
35
+ let t0;
36
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
37
+ t0 = /*#__PURE__*/_jsx("span", {
38
+ "aria-hidden": true,
39
+ "data-slot": "pulse-bars",
40
+ className: "inline-flex h-[1em] items-center gap-[0.14em] text-foreground/70",
41
+ children: barDelays.map(_temp)
42
+ });
43
+ $[0] = t0;
44
+ } else {
45
+ t0 = $[0];
46
+ }
47
+ return t0;
48
+ }
49
+ function _temp(delay) {
50
+ return /*#__PURE__*/_jsx(Bar, {
51
+ delay: delay
52
+ }, delay);
29
53
  }
@@ -1,23 +1,64 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { cn } from "@locusgraph/components";
2
5
  import { useEffect, useState } from "react";
3
6
  import { prefersReducedMotion } from "../use-loop-animation.js";
4
7
  import { jsx as _jsx } from "react/jsx-runtime";
5
8
  const glyphs = ["·", "✢", "✳", "✶", "✻", "✽", "✻", "✶", "✳", "✢"];
6
9
  const restingGlyph = "✻";
7
- export function GlyphMark({
8
- tone = "neutral"
9
- }) {
10
+ export function GlyphMark(t0) {
11
+ const $ = _c(7);
12
+ const {
13
+ tone: t1
14
+ } = t0;
15
+ const tone = t1 === undefined ? "neutral" : t1;
10
16
  const [index, setIndex] = useState();
11
- useEffect(() => {
12
- if (prefersReducedMotion()) return;
13
- setIndex(0);
14
- const timer = window.setInterval(() => setIndex(current => ((current ?? 0) + 1) % glyphs.length), 120);
15
- return () => window.clearInterval(timer);
16
- }, []);
17
- return /*#__PURE__*/_jsx("span", {
18
- "aria-hidden": true,
19
- "data-slot": "pulse-glyph",
20
- className: cn("inline-flex w-[1.1em] justify-center font-mono text-[1.15em] leading-none", tone === "brand" ? "text-orange-500" : "text-foreground/70"),
21
- children: index === undefined ? restingGlyph : glyphs[index]
22
- });
17
+ let t2;
18
+ let t3;
19
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
20
+ t2 = () => {
21
+ if (prefersReducedMotion()) {
22
+ return;
23
+ }
24
+ setIndex(0);
25
+ const timer = window.setInterval(() => setIndex(_temp), 120);
26
+ return () => window.clearInterval(timer);
27
+ };
28
+ t3 = [];
29
+ $[0] = t2;
30
+ $[1] = t3;
31
+ } else {
32
+ t2 = $[0];
33
+ t3 = $[1];
34
+ }
35
+ useEffect(t2, t3);
36
+ const t4 = tone === "brand" ? "text-orange-500" : "text-foreground/70";
37
+ let t5;
38
+ if ($[2] !== t4) {
39
+ t5 = cn("inline-flex w-[1.1em] justify-center font-mono text-[1.15em] leading-none", t4);
40
+ $[2] = t4;
41
+ $[3] = t5;
42
+ } else {
43
+ t5 = $[3];
44
+ }
45
+ const t6 = index === undefined ? restingGlyph : glyphs[index];
46
+ let t7;
47
+ if ($[4] !== t5 || $[5] !== t6) {
48
+ t7 = /*#__PURE__*/_jsx("span", {
49
+ "aria-hidden": true,
50
+ "data-slot": "pulse-glyph",
51
+ className: t5,
52
+ children: t6
53
+ });
54
+ $[4] = t5;
55
+ $[5] = t6;
56
+ $[6] = t7;
57
+ } else {
58
+ t7 = $[6];
59
+ }
60
+ return t7;
61
+ }
62
+ function _temp(current) {
63
+ return ((current ?? 0) + 1) % glyphs.length;
23
64
  }
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { LocusGraphMark } from "@locusgraph/brand";
2
5
  import { useEffect, useRef } from "react";
3
6
  import { prefersReducedMotion } from "../use-loop-animation.js";
@@ -32,18 +35,41 @@ function animateRays(svg) {
32
35
  }));
33
36
  }
34
37
  export function LocusMark() {
38
+ const $ = _c(3);
35
39
  const ref = useRef(null);
36
- useEffect(() => {
37
- const svg = ref.current;
38
- if (!svg || prefersReducedMotion()) return;
39
- const animations = animateRays(svg);
40
- return () => {
41
- for (const animation of animations) animation.cancel();
40
+ let t0;
41
+ let t1;
42
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
43
+ t0 = () => {
44
+ const svg = ref.current;
45
+ if (!svg || prefersReducedMotion()) {
46
+ return;
47
+ }
48
+ const animations = animateRays(svg);
49
+ return () => {
50
+ for (const animation of animations) {
51
+ animation.cancel();
52
+ }
53
+ };
42
54
  };
43
- }, []);
44
- return /*#__PURE__*/_jsx(LocusGraphMark, {
45
- ref: ref,
46
- "data-slot": "pulse-locus",
47
- className: "h-[1.35em] w-auto text-foreground"
48
- });
55
+ t1 = [];
56
+ $[0] = t0;
57
+ $[1] = t1;
58
+ } else {
59
+ t0 = $[0];
60
+ t1 = $[1];
61
+ }
62
+ useEffect(t0, t1);
63
+ let t2;
64
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
65
+ t2 = /*#__PURE__*/_jsx(LocusGraphMark, {
66
+ ref: ref,
67
+ "data-slot": "pulse-locus",
68
+ className: "h-[1.35em] w-auto text-foreground"
69
+ });
70
+ $[2] = t2;
71
+ } else {
72
+ t2 = $[2];
73
+ }
74
+ return t2;
49
75
  }
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { useLoopAnimation } from "../use-loop-animation.js";
2
5
  import { jsx as _jsx } from "react/jsx-runtime";
3
6
  const breathe = [{
@@ -11,14 +14,23 @@ const breathe = [{
11
14
  opacity: 1
12
15
  }];
13
16
  export function OrbMark() {
17
+ const $ = _c(2);
14
18
  const ref = useLoopAnimation(breathe, 1500);
15
- return /*#__PURE__*/_jsx("span", {
16
- "aria-hidden": true,
17
- className: "inline-flex size-[1.25em] items-center justify-center",
18
- children: /*#__PURE__*/_jsx("span", {
19
- ref: ref,
20
- "data-slot": "pulse-orb",
21
- className: "size-[0.8em] rounded-full bg-foreground"
22
- })
23
- });
19
+ let t0;
20
+ if ($[0] !== ref) {
21
+ t0 = /*#__PURE__*/_jsx("span", {
22
+ "aria-hidden": true,
23
+ className: "inline-flex size-[1.25em] items-center justify-center",
24
+ children: /*#__PURE__*/_jsx("span", {
25
+ ref: ref,
26
+ "data-slot": "pulse-orb",
27
+ className: "size-[0.8em] rounded-full bg-foreground"
28
+ })
29
+ });
30
+ $[0] = ref;
31
+ $[1] = t0;
32
+ } else {
33
+ t0 = $[1];
34
+ }
35
+ return t0;
24
36
  }
@@ -1,19 +1,42 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { useEffect, useRef } from "react";
2
5
  export function prefersReducedMotion() {
3
6
  return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
4
7
  }
5
- export function useLoopAnimation(keyframes, duration, delay = 0, easing = "ease-in-out") {
8
+ export function useLoopAnimation(keyframes, duration, t0, t1) {
9
+ const $ = _c(6);
10
+ const delay = t0 === undefined ? 0 : t0;
11
+ const easing = t1 === undefined ? "ease-in-out" : t1;
6
12
  const ref = useRef(null);
7
- useEffect(() => {
8
- const element = ref.current;
9
- if (!element || typeof element.animate !== "function" || prefersReducedMotion()) return;
10
- const animation = element.animate(keyframes, {
11
- duration,
12
- delay,
13
- easing,
14
- iterations: Number.POSITIVE_INFINITY
15
- });
16
- return () => animation.cancel();
17
- }, [keyframes, duration, delay, easing]);
13
+ let t2;
14
+ let t3;
15
+ if ($[0] !== delay || $[1] !== duration || $[2] !== easing || $[3] !== keyframes) {
16
+ t2 = () => {
17
+ const element = ref.current;
18
+ if (!element || typeof element.animate !== "function" || prefersReducedMotion()) {
19
+ return;
20
+ }
21
+ const animation = element.animate(keyframes, {
22
+ duration,
23
+ delay,
24
+ easing,
25
+ iterations: Number.POSITIVE_INFINITY
26
+ });
27
+ return () => animation.cancel();
28
+ };
29
+ t3 = [keyframes, duration, delay, easing];
30
+ $[0] = delay;
31
+ $[1] = duration;
32
+ $[2] = easing;
33
+ $[3] = keyframes;
34
+ $[4] = t2;
35
+ $[5] = t3;
36
+ } else {
37
+ t2 = $[4];
38
+ t3 = $[5];
39
+ }
40
+ useEffect(t2, t3);
18
41
  return ref;
19
42
  }