@locusgraph/loop 0.3.0 → 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 (130) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +70 -17
  3. package/dist/agent/pulse/marks/bars-mark.js +39 -15
  4. package/dist/agent/pulse/marks/glyph-mark.js +57 -16
  5. package/dist/agent/pulse/marks/locus-mark.js +39 -13
  6. package/dist/agent/pulse/marks/orb-mark.js +21 -9
  7. package/dist/agent/pulse/pulse.js +1 -1
  8. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  9. package/dist/agent/pulse/use-loop-animation.js +36 -15
  10. package/dist/agent/steps/step-icon.js +20 -13
  11. package/dist/agent/steps/steps.js +39 -37
  12. package/dist/agent/thinking/thinking.js +65 -62
  13. package/dist/agent/tool/json-block.js +10 -7
  14. package/dist/agent/tool/tool-status.d.ts +2 -0
  15. package/dist/agent/tool/tool-status.js +16 -13
  16. package/dist/agent/tool/tool.d.ts +8 -1
  17. package/dist/agent/tool/tool.js +238 -119
  18. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  19. package/dist/approval/inbox/inbox-row.js +248 -86
  20. package/dist/approval/inbox/inbox.d.ts +3 -3
  21. package/dist/approval/inbox/inbox.js +251 -57
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  23. package/dist/approval/inbox/virtual-inbox-list.js +107 -30
  24. package/dist/approval/memory/memory-review.js +228 -91
  25. package/dist/approval/memory/memory-row.js +192 -56
  26. package/dist/approval/plan/plan-review.js +241 -108
  27. package/dist/approval/plan/plan-step-row.js +184 -77
  28. package/dist/approval/plan/plan-steps.d.ts +1 -1
  29. package/dist/approval/plan/plan-steps.js +2 -2
  30. package/dist/approval/plan/question-choices.js +139 -48
  31. package/dist/approval/plan/question.js +189 -67
  32. package/dist/approval/run/run-bar.js +138 -49
  33. package/dist/approval/shared/approval-line.d.ts +27 -0
  34. package/dist/approval/shared/approval-line.js +85 -0
  35. package/dist/approval/shared/risk-badge.d.ts +3 -5
  36. package/dist/approval/shared/risk-badge.js +11 -19
  37. package/dist/approval/shared/time.d.ts +0 -1
  38. package/dist/approval/shared/time.js +0 -1
  39. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  40. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  41. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  42. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  43. package/dist/approval/spend/raise-cap-form.js +235 -52
  44. package/dist/approval/spend/spend-gate.js +200 -106
  45. package/dist/approval/spend/spend-math.d.ts +1 -0
  46. package/dist/approval/spend/spend-math.js +5 -2
  47. package/dist/approval/spend/spend-meter.js +5 -5
  48. package/dist/approval/tool/approval.js +157 -96
  49. package/dist/approval/tool/args/args-editor.js +232 -81
  50. package/dist/approval/tool/args/args-field.js +333 -60
  51. package/dist/approval/tool/deny-form.js +114 -32
  52. package/dist/approval/tool/tool-inputs.js +93 -33
  53. package/dist/chat/chat/chat.js +5 -4
  54. package/dist/chat/chat/use-stick-to-bottom.js +116 -63
  55. package/dist/chat/chat/virtual-chat-items.js +129 -34
  56. package/dist/chat/composer/composer-actions.d.ts +1 -2
  57. package/dist/chat/composer/composer-actions.js +136 -50
  58. package/dist/chat/composer/composer-status.d.ts +2 -0
  59. package/dist/chat/composer/composer-status.js +3 -0
  60. package/dist/chat/composer/composer.d.ts +1 -1
  61. package/dist/chat/composer/composer.js +6 -4
  62. package/dist/chat/composer/use-auto-grow.js +29 -8
  63. package/dist/chat/files/files.js +296 -67
  64. package/dist/chat/index.d.ts +1 -1
  65. package/dist/chat/index.js +1 -1
  66. package/dist/chat/reply/fenced-code.js +1 -1
  67. package/dist/chat/reply/markdown-components.js +9 -116
  68. package/dist/chat/reply/reply.js +2 -2
  69. package/dist/chat/turn/group-parts.d.ts +1 -0
  70. package/dist/chat/turn/group-parts.js +6 -3
  71. package/dist/chat/turn/turn.js +13 -4
  72. package/dist/cost/context.js +3 -3
  73. package/dist/cost/cost-steps.js +31 -30
  74. package/dist/cost/cost.js +39 -39
  75. package/dist/cost/model-picker.js +176 -43
  76. package/dist/cost/shared/context-breakdown.js +10 -11
  77. package/dist/cost/shared/model-option-row.js +4 -3
  78. package/dist/cost/shared/step-cost-row.js +11 -12
  79. package/dist/cost/shared/usage-totals.d.ts +1 -0
  80. package/dist/cost/shared/usage-totals.js +19 -1
  81. package/dist/memory/cite.js +190 -59
  82. package/dist/memory/memorized.js +231 -62
  83. package/dist/memory/recall.js +272 -85
  84. package/dist/memory/shared/host-label.d.ts +1 -1
  85. package/dist/memory/shared/host-label.js +2 -2
  86. package/dist/memory/shared/source-mark.js +1 -1
  87. package/dist/memory/sources.d.ts +2 -1
  88. package/dist/memory/sources.js +277 -62
  89. package/dist/shared/decision-summary.js +2 -1
  90. package/dist/shared/line.d.ts +10 -0
  91. package/dist/shared/line.js +11 -0
  92. package/dist/shared/live-status.d.ts +3 -0
  93. package/dist/shared/live-status.js +11 -0
  94. package/dist/shared/reduced-motion.d.ts +1 -0
  95. package/dist/shared/reduced-motion.js +3 -0
  96. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  97. package/dist/thread/actions/action-button.js +1 -1
  98. package/dist/thread/actions/actions.d.ts +3 -1
  99. package/dist/thread/actions/actions.js +100 -81
  100. package/dist/thread/actions/branch-switcher.js +129 -23
  101. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  102. package/dist/thread/canvas/canvas-meta.js +35 -0
  103. package/dist/thread/canvas/canvas.d.ts +1 -1
  104. package/dist/thread/canvas/canvas.js +64 -74
  105. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  106. package/dist/thread/canvas/version-switcher.js +161 -45
  107. package/dist/thread/code/code.js +4 -6
  108. package/dist/thread/code/copy-code-button.d.ts +2 -1
  109. package/dist/thread/code/copy-code-button.js +91 -26
  110. package/dist/thread/history/history.d.ts +1 -1
  111. package/dist/thread/history/history.js +104 -104
  112. package/dist/thread/history/row/history-row.js +106 -22
  113. package/dist/thread/history/row/thread-item-menu.js +84 -20
  114. package/dist/thread/history/row/thread-title-editor.js +74 -29
  115. package/dist/thread/history/virtual-history-list.js +83 -46
  116. package/dist/thread/index.d.ts +1 -0
  117. package/dist/thread/index.js +1 -0
  118. package/dist/thread/starters/starters.js +91 -28
  119. package/dist/thread/use-copied.js +40 -10
  120. package/package.json +6 -6
  121. package/dist/agent/shared/status-dot.d.ts +0 -1
  122. package/dist/agent/shared/status-dot.js +0 -1
  123. package/dist/approval/shared/decision-line.d.ts +0 -1
  124. package/dist/approval/shared/decision-line.js +0 -1
  125. package/dist/memory/shared/disclosure.d.ts +0 -6
  126. package/dist/memory/shared/disclosure.js +0 -6
  127. package/dist/shared/panel.d.ts +0 -19
  128. package/dist/shared/panel.js +0 -77
  129. package/dist/shared/status-dot.d.ts +0 -6
  130. package/dist/shared/status-dot.js +0 -20
@@ -1,49 +1,104 @@
1
- import { ArrowUp as ArrowUpIcon, Attachment as PaperclipIcon, StopFilledAlt as SquareIcon } from "@carbon/icons-react";
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
2
4
  import { Button } from "@locusgraph/components";
5
+ import { ArrowUp as ArrowUpIcon, Paperclip as PaperclipIcon, Stop as SquareIcon } from "@phosphor-icons/react/ssr";
3
6
  import { useRef } from "react";
7
+ import { isComposerBusy } from "./composer-status.js";
4
8
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
5
- export function isComposerBusy(status) {
6
- return status === "submitting" || status === "streaming";
7
- }
8
- export function ComposerSubmit({
9
- status,
10
- canSend,
11
- onStop
12
- }) {
9
+ export function ComposerSubmit(t0) {
10
+ const $ = _c(7);
11
+ const {
12
+ status,
13
+ canSend,
14
+ onStop
15
+ } = t0;
13
16
  if (isComposerBusy(status)) {
14
- return /*#__PURE__*/_jsxs(Button, {
15
- type: "button",
16
- size: "sm",
17
- variant: "outline",
18
- "data-slot": "composer-stop",
19
- "aria-label": "Stop",
20
- disabled: !onStop,
21
- onClick: onStop,
22
- children: [/*#__PURE__*/_jsx(SquareIcon, {
17
+ const t1 = !onStop;
18
+ let t2;
19
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
20
+ t2 = /*#__PURE__*/_jsx(SquareIcon, {
21
+ weight: "fill",
23
22
  "aria-hidden": "true",
24
23
  className: "size-2.5 fill-current"
25
- }), "Stop"]
26
- });
24
+ });
25
+ $[0] = t2;
26
+ } else {
27
+ t2 = $[0];
28
+ }
29
+ let t3;
30
+ if ($[1] !== onStop || $[2] !== t1) {
31
+ t3 = /*#__PURE__*/_jsxs(Button, {
32
+ type: "button",
33
+ size: "sm",
34
+ variant: "outline",
35
+ "data-slot": "composer-stop",
36
+ "aria-label": "Stop",
37
+ disabled: t1,
38
+ onClick: onStop,
39
+ children: [t2, "Stop"]
40
+ });
41
+ $[1] = onStop;
42
+ $[2] = t1;
43
+ $[3] = t3;
44
+ } else {
45
+ t3 = $[3];
46
+ }
47
+ return t3;
27
48
  }
28
- return /*#__PURE__*/_jsx(Button, {
29
- type: "submit",
30
- size: "icon-sm",
31
- "data-slot": "composer-send",
32
- "aria-label": "Send",
33
- disabled: !canSend,
34
- children: /*#__PURE__*/_jsx(ArrowUpIcon, {
49
+ const t1 = !canSend;
50
+ let t2;
51
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
52
+ t2 = /*#__PURE__*/_jsx(ArrowUpIcon, {
53
+ weight: "bold",
35
54
  "aria-hidden": "true"
36
- })
37
- });
55
+ });
56
+ $[4] = t2;
57
+ } else {
58
+ t2 = $[4];
59
+ }
60
+ let t3;
61
+ if ($[5] !== t1) {
62
+ t3 = /*#__PURE__*/_jsx(Button, {
63
+ type: "submit",
64
+ size: "icon-sm",
65
+ "data-slot": "composer-send",
66
+ "aria-label": "Send",
67
+ disabled: t1,
68
+ children: t2
69
+ });
70
+ $[5] = t1;
71
+ $[6] = t3;
72
+ } else {
73
+ t3 = $[6];
74
+ }
75
+ return t3;
38
76
  }
39
- export function ComposerAttachButton({
40
- accept,
41
- disabled,
42
- onAttachFiles
43
- }) {
77
+ export function ComposerAttachButton(t0) {
78
+ const $ = _c(12);
79
+ const {
80
+ accept,
81
+ disabled,
82
+ onAttachFiles
83
+ } = t0;
44
84
  const inputRef = useRef(null);
45
- return /*#__PURE__*/_jsxs(_Fragment, {
46
- children: [/*#__PURE__*/_jsx("input", {
85
+ let t1;
86
+ if ($[0] !== onAttachFiles) {
87
+ t1 = event => {
88
+ const picked = Array.from(event.currentTarget.files ?? []);
89
+ event.currentTarget.value = "";
90
+ if (picked.length > 0) {
91
+ onAttachFiles(picked);
92
+ }
93
+ };
94
+ $[0] = onAttachFiles;
95
+ $[1] = t1;
96
+ } else {
97
+ t1 = $[1];
98
+ }
99
+ let t2;
100
+ if ($[2] !== accept || $[3] !== t1) {
101
+ t2 = /*#__PURE__*/_jsx("input", {
47
102
  ref: inputRef,
48
103
  type: "file",
49
104
  multiple: true,
@@ -51,14 +106,31 @@ export function ComposerAttachButton({
51
106
  accept: accept,
52
107
  tabIndex: -1,
53
108
  "aria-hidden": "true",
54
- onChange: event => {
55
- const picked = Array.from(event.currentTarget.files ?? []);
56
- event.currentTarget.value = "";
57
- if (picked.length > 0) {
58
- onAttachFiles(picked);
59
- }
60
- }
61
- }), /*#__PURE__*/_jsx(Button, {
109
+ onChange: t1
110
+ });
111
+ $[2] = accept;
112
+ $[3] = t1;
113
+ $[4] = t2;
114
+ } else {
115
+ t2 = $[4];
116
+ }
117
+ let t3;
118
+ let t4;
119
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
120
+ t3 = () => inputRef.current?.click();
121
+ t4 = /*#__PURE__*/_jsx(PaperclipIcon, {
122
+ weight: "bold",
123
+ "aria-hidden": "true"
124
+ });
125
+ $[5] = t3;
126
+ $[6] = t4;
127
+ } else {
128
+ t3 = $[5];
129
+ t4 = $[6];
130
+ }
131
+ let t5;
132
+ if ($[7] !== disabled) {
133
+ t5 = /*#__PURE__*/_jsx(Button, {
62
134
  type: "button",
63
135
  size: "icon-sm",
64
136
  variant: "ghost",
@@ -66,10 +138,24 @@ export function ComposerAttachButton({
66
138
  "aria-label": "Attach files",
67
139
  className: "text-muted-foreground hover:text-foreground",
68
140
  disabled: disabled,
69
- onClick: () => inputRef.current?.click(),
70
- children: /*#__PURE__*/_jsx(PaperclipIcon, {
71
- "aria-hidden": "true"
72
- })
73
- })]
74
- });
141
+ onClick: t3,
142
+ children: t4
143
+ });
144
+ $[7] = disabled;
145
+ $[8] = t5;
146
+ } else {
147
+ t5 = $[8];
148
+ }
149
+ let t6;
150
+ if ($[9] !== t2 || $[10] !== t5) {
151
+ t6 = /*#__PURE__*/_jsxs(_Fragment, {
152
+ children: [t2, t5]
153
+ });
154
+ $[9] = t2;
155
+ $[10] = t5;
156
+ $[11] = t6;
157
+ } else {
158
+ t6 = $[11];
159
+ }
160
+ return t6;
75
161
  }
@@ -0,0 +1,2 @@
1
+ export type ComposerStatus = "ready" | "submitting" | "streaming" | "error";
2
+ export declare function isComposerBusy(status: ComposerStatus): boolean;
@@ -0,0 +1,3 @@
1
+ export function isComposerBusy(status) {
2
+ return status === "submitting" || status === "streaming";
3
+ }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { type ComposerStatus } from "./composer-actions.js";
2
+ import { type ComposerStatus } from "./composer-status.js";
3
3
  export type ComposerProps = Omit<React.ComponentProps<"form">, "onSubmit" | "children"> & {
4
4
  onSubmit: (text: string, files: File[]) => void;
5
5
  onStop?: () => void;
@@ -3,7 +3,8 @@
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { cn, Textarea } from "@locusgraph/components";
5
5
  import * as React from "react";
6
- import { ComposerAttachButton, ComposerSubmit, isComposerBusy } from "./composer-actions.js";
6
+ import { ComposerAttachButton, ComposerSubmit } from "./composer-actions.js";
7
+ import { isComposerBusy } from "./composer-status.js";
7
8
  import { useAutoGrow } from "./use-auto-grow.js";
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const noFiles = [];
@@ -157,7 +158,7 @@ export function Composer(t0) {
157
158
  const t12 = isBusy || undefined;
158
159
  let t13;
159
160
  if ($[34] !== className) {
160
- t13 = cn("flex flex-col bg-card text-card-foreground ring-1 ring-border transition-shadow focus-within:ring-foreground/40 data-[status=error]:ring-destructive/60 data-disabled:opacity-60", className);
161
+ t13 = cn("flex flex-col bg-card text-card-foreground ring-1 ring-border transition-shadow focus-within:ring-ring data-[status=error]:ring-destructive data-disabled:opacity-60", className);
161
162
  $[34] = className;
162
163
  $[35] = t13;
163
164
  } else {
@@ -222,7 +223,7 @@ export function Composer(t0) {
222
223
  rows: 1,
223
224
  onChange: t18,
224
225
  onKeyDown: t19,
225
- className: "max-h-48 min-h-14 resize-none border-0 bg-transparent px-4 pt-3.5 pb-1 text-sm leading-relaxed shadow-none placeholder:text-muted-foreground/80 focus-visible:ring-0 dark:bg-transparent"
226
+ className: "max-h-48 min-h-14 resize-none border-0 bg-transparent px-4 pt-3.5 pb-1 text-sm leading-relaxed shadow-none placeholder:text-faint focus-visible:ring-0 dark:bg-transparent"
226
227
  });
227
228
  $[44] = disabled;
228
229
  $[45] = label;
@@ -270,7 +271,8 @@ export function Composer(t0) {
270
271
  if ($[62] !== disabled || $[63] !== modelSlot) {
271
272
  t23 = modelSlot && /*#__PURE__*/_jsx("div", {
272
273
  "data-slot": "composer-model",
273
- className: cn("min-w-0", disabled && "pointer-events-none opacity-50"),
274
+ inert: disabled || undefined,
275
+ className: cn("min-w-0", disabled && "opacity-50"),
274
276
  children: modelSlot
275
277
  });
276
278
  $[62] = disabled;
@@ -1,14 +1,35 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { useLayoutEffect } from "react";
2
5
  function supportsFieldSizing() {
3
6
  return typeof CSS !== "undefined" && CSS.supports?.("field-sizing", "content") === true;
4
7
  }
5
8
  export function useAutoGrow(textareaRef, text) {
6
- useLayoutEffect(() => {
7
- const textarea = textareaRef.current;
8
- if (!textarea || supportsFieldSizing() || text === undefined) {
9
- return;
10
- }
11
- textarea.style.height = "auto";
12
- textarea.style.height = `${textarea.scrollHeight}px`;
13
- }, [textareaRef, text]);
9
+ const $ = _c(5);
10
+ let t0;
11
+ if ($[0] !== textareaRef) {
12
+ t0 = () => {
13
+ const textarea = textareaRef.current;
14
+ if (!textarea || supportsFieldSizing()) {
15
+ return;
16
+ }
17
+ textarea.style.height = "auto";
18
+ textarea.style.height = `${textarea.scrollHeight}px`;
19
+ };
20
+ $[0] = textareaRef;
21
+ $[1] = t0;
22
+ } else {
23
+ t0 = $[1];
24
+ }
25
+ let t1;
26
+ if ($[2] !== text || $[3] !== textareaRef) {
27
+ t1 = [textareaRef, text];
28
+ $[2] = text;
29
+ $[3] = textareaRef;
30
+ $[4] = t1;
31
+ } else {
32
+ t1 = $[4];
33
+ }
34
+ useLayoutEffect(t0, t1);
14
35
  }