@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.
- package/dist/agent/pulse/gradient-label.js +64 -12
- package/dist/agent/pulse/marks/bars-mark.js +39 -15
- package/dist/agent/pulse/marks/glyph-mark.js +56 -15
- package/dist/agent/pulse/marks/locus-mark.js +38 -12
- package/dist/agent/pulse/marks/orb-mark.js +21 -9
- package/dist/agent/pulse/use-loop-animation.js +35 -12
- package/dist/approval/inbox/inbox-row.js +303 -76
- package/dist/approval/inbox/inbox.js +192 -39
- package/dist/approval/inbox/virtual-inbox-list.js +104 -26
- package/dist/approval/memory/memory-review.js +172 -36
- package/dist/approval/memory/memory-row.js +187 -50
- package/dist/approval/plan/plan-review.js +225 -73
- package/dist/approval/plan/plan-step-row.js +182 -76
- package/dist/approval/plan/question-choices.js +132 -44
- package/dist/approval/plan/question.js +156 -38
- package/dist/approval/run/run-bar.js +125 -39
- package/dist/approval/shared/use-focus-on-mount.js +23 -5
- package/dist/approval/spend/raise-cap-form.js +223 -48
- package/dist/approval/spend/spend-gate.js +157 -40
- package/dist/approval/tool/approval.js +196 -35
- package/dist/approval/tool/args/args-editor.js +206 -46
- package/dist/approval/tool/args/args-field.js +240 -55
- package/dist/approval/tool/deny-form.js +125 -36
- package/dist/approval/tool/tool-inputs.js +90 -23
- package/dist/chat/chat/use-stick-to-bottom.js +115 -60
- package/dist/chat/chat/virtual-chat-items.js +129 -34
- package/dist/chat/composer/composer-actions.d.ts +1 -2
- package/dist/chat/composer/composer-actions.js +132 -49
- package/dist/chat/composer/composer-status.d.ts +2 -0
- package/dist/chat/composer/composer-status.js +3 -0
- package/dist/chat/composer/composer.d.ts +1 -1
- package/dist/chat/composer/composer.js +2 -1
- package/dist/chat/composer/use-auto-grow.js +25 -8
- package/dist/chat/files/files.js +293 -66
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/cost/model-picker.js +174 -42
- package/dist/memory/cite.js +181 -58
- package/dist/memory/memorized.js +196 -42
- package/dist/memory/recall.js +265 -68
- package/dist/memory/sources.js +232 -52
- package/dist/shared/virtual/use-list-virtualizer.js +2 -0
- package/dist/thread/actions/branch-switcher.js +97 -21
- package/dist/thread/canvas/version-switcher.js +128 -31
- package/dist/thread/code/copy-code-button.js +58 -24
- package/dist/thread/history/row/history-row.js +99 -18
- package/dist/thread/history/row/thread-item-menu.js +74 -19
- package/dist/thread/history/row/thread-title-editor.js +74 -29
- package/dist/thread/history/virtual-history-list.js +84 -46
- package/dist/thread/starters/starters.js +89 -27
- package/dist/thread/use-copied.js +40 -10
- package/package.json +1 -1
|
@@ -1,38 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { Input } from "@locusgraph/components";
|
|
2
5
|
import { useState } from "react";
|
|
3
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
export function ThreadTitleEditor({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
export function ThreadTitleEditor(t0) {
|
|
8
|
+
const $ = _c(13);
|
|
9
|
+
const {
|
|
10
|
+
title,
|
|
11
|
+
onCommit,
|
|
12
|
+
onCancel
|
|
13
|
+
} = t0;
|
|
9
14
|
const [draft, setDraft] = useState(title);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== draft || $[1] !== onCancel || $[2] !== onCommit || $[3] !== title) {
|
|
17
|
+
t1 = () => {
|
|
18
|
+
const trimmed = draft.trim();
|
|
19
|
+
if (trimmed && trimmed !== title) {
|
|
20
|
+
onCommit(trimmed);
|
|
21
|
+
} else {
|
|
22
|
+
onCancel();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
$[0] = draft;
|
|
26
|
+
$[1] = onCancel;
|
|
27
|
+
$[2] = onCommit;
|
|
28
|
+
$[3] = title;
|
|
29
|
+
$[4] = t1;
|
|
30
|
+
} else {
|
|
31
|
+
t1 = $[4];
|
|
32
|
+
}
|
|
33
|
+
const commit = t1;
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
36
|
+
t2 = event => setDraft(event.target.value);
|
|
37
|
+
$[5] = t2;
|
|
38
|
+
} else {
|
|
39
|
+
t2 = $[5];
|
|
40
|
+
}
|
|
41
|
+
let t3;
|
|
42
|
+
if ($[6] !== commit || $[7] !== onCancel) {
|
|
43
|
+
t3 = event_1 => {
|
|
44
|
+
if (event_1.key === "Enter") {
|
|
45
|
+
event_1.preventDefault();
|
|
30
46
|
commit();
|
|
31
47
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
48
|
+
if (event_1.key === "Escape") {
|
|
49
|
+
event_1.preventDefault();
|
|
34
50
|
onCancel();
|
|
35
51
|
}
|
|
36
|
-
}
|
|
37
|
-
|
|
52
|
+
};
|
|
53
|
+
$[6] = commit;
|
|
54
|
+
$[7] = onCancel;
|
|
55
|
+
$[8] = t3;
|
|
56
|
+
} else {
|
|
57
|
+
t3 = $[8];
|
|
58
|
+
}
|
|
59
|
+
let t4;
|
|
60
|
+
if ($[9] !== commit || $[10] !== draft || $[11] !== t3) {
|
|
61
|
+
t4 = /*#__PURE__*/_jsx(Input, {
|
|
62
|
+
"data-slot": "thread-title-editor",
|
|
63
|
+
"aria-label": "Chat title",
|
|
64
|
+
autoFocus: true,
|
|
65
|
+
value: draft,
|
|
66
|
+
className: "h-7 text-sm",
|
|
67
|
+
onChange: t2,
|
|
68
|
+
onFocus: _temp,
|
|
69
|
+
onBlur: commit,
|
|
70
|
+
onKeyDown: t3
|
|
71
|
+
});
|
|
72
|
+
$[9] = commit;
|
|
73
|
+
$[10] = draft;
|
|
74
|
+
$[11] = t3;
|
|
75
|
+
$[12] = t4;
|
|
76
|
+
} else {
|
|
77
|
+
t4 = $[12];
|
|
78
|
+
}
|
|
79
|
+
return t4;
|
|
80
|
+
}
|
|
81
|
+
function _temp(event_0) {
|
|
82
|
+
return event_0.target.select();
|
|
38
83
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { cn } from "@locusgraph/components";
|
|
2
5
|
import { useRef } from "react";
|
|
3
6
|
import { rowOffsetStyle, useListVirtualizer, virtualRowClassName } from "../../shared/virtual/use-list-virtualizer.js";
|
|
@@ -7,14 +10,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
10
|
function scrollAreaViewportOf(element) {
|
|
8
11
|
return element?.closest("[data-slot=scroll-area-viewport]") ?? null;
|
|
9
12
|
}
|
|
10
|
-
export function VirtualHistoryList({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
export function VirtualHistoryList(t0) {
|
|
14
|
+
const $ = _c(12);
|
|
15
|
+
const {
|
|
16
|
+
groups,
|
|
17
|
+
label,
|
|
18
|
+
activeId,
|
|
19
|
+
onSelect,
|
|
20
|
+
onRename,
|
|
21
|
+
onArchive
|
|
22
|
+
} = t0;
|
|
18
23
|
const listRef = useRef(null);
|
|
19
24
|
const rows = historyListRows(groups);
|
|
20
25
|
const {
|
|
@@ -25,47 +30,80 @@ export function VirtualHistoryList({
|
|
|
25
30
|
count: rows.length,
|
|
26
31
|
getScrollElement: () => scrollAreaViewportOf(listRef.current),
|
|
27
32
|
estimateSize: index => estimatedRowHeight(rows[index], index),
|
|
28
|
-
getItemKey:
|
|
29
|
-
});
|
|
30
|
-
const threadRowProps = thread => ({
|
|
31
|
-
thread,
|
|
32
|
-
active: thread.id === activeId,
|
|
33
|
-
onSelect,
|
|
34
|
-
onRename,
|
|
35
|
-
onArchive
|
|
33
|
+
getItemKey: index_0 => rows[index_0].key
|
|
36
34
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
let t1;
|
|
36
|
+
if ($[0] !== activeId || $[1] !== onArchive || $[2] !== onRename || $[3] !== onSelect) {
|
|
37
|
+
t1 = thread => ({
|
|
38
|
+
thread,
|
|
39
|
+
active: thread.id === activeId,
|
|
40
|
+
onSelect,
|
|
41
|
+
onRename,
|
|
42
|
+
onArchive
|
|
43
|
+
});
|
|
44
|
+
$[0] = activeId;
|
|
45
|
+
$[1] = onArchive;
|
|
46
|
+
$[2] = onRename;
|
|
47
|
+
$[3] = onSelect;
|
|
48
|
+
$[4] = t1;
|
|
49
|
+
} else {
|
|
50
|
+
t1 = $[4];
|
|
51
|
+
}
|
|
52
|
+
const threadRowProps = t1;
|
|
53
|
+
const t2 = "history-list";
|
|
54
|
+
const t3 = "relative";
|
|
55
|
+
let t4;
|
|
56
|
+
if ($[5] !== totalSize) {
|
|
57
|
+
t4 = {
|
|
43
58
|
height: totalSize
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
className: "locus-eyebrow px-2 pb-1",
|
|
56
|
-
suppressHydrationWarning: true,
|
|
57
|
-
children: row.label
|
|
58
|
-
})
|
|
59
|
-
}, virtualRow.key);
|
|
60
|
-
}
|
|
61
|
-
return /*#__PURE__*/_jsx(HistoryRow, {
|
|
62
|
-
...threadRowProps(row.thread),
|
|
59
|
+
};
|
|
60
|
+
$[5] = totalSize;
|
|
61
|
+
$[6] = t4;
|
|
62
|
+
} else {
|
|
63
|
+
t4 = $[6];
|
|
64
|
+
}
|
|
65
|
+
const t5 = visibleRows.map(virtualRow => {
|
|
66
|
+
const row = rows[virtualRow.index];
|
|
67
|
+
if (row.kind === "group") {
|
|
68
|
+
return /*#__PURE__*/_jsx("li", {
|
|
69
|
+
role: "presentation",
|
|
63
70
|
...itemProps(virtualRow.index),
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
className: cn(virtualRowClassName, virtualRow.index > 0 && "pt-4"),
|
|
72
|
+
style: rowOffsetStyle(virtualRow.start),
|
|
73
|
+
children: /*#__PURE__*/_jsx("h3", {
|
|
74
|
+
id: `thread-group-${row.groupKey}`,
|
|
75
|
+
className: "locus-eyebrow px-2 pb-1",
|
|
76
|
+
suppressHydrationWarning: true,
|
|
77
|
+
children: row.label
|
|
78
|
+
})
|
|
68
79
|
}, virtualRow.key);
|
|
69
|
-
}
|
|
80
|
+
}
|
|
81
|
+
return /*#__PURE__*/_jsx(HistoryRow, {
|
|
82
|
+
...threadRowProps(row.thread),
|
|
83
|
+
...itemProps(virtualRow.index),
|
|
84
|
+
"aria-posinset": row.position,
|
|
85
|
+
"aria-setsize": row.groupSize,
|
|
86
|
+
className: virtualRowClassName,
|
|
87
|
+
style: rowOffsetStyle(virtualRow.start)
|
|
88
|
+
}, virtualRow.key);
|
|
70
89
|
});
|
|
90
|
+
let t6;
|
|
91
|
+
if ($[7] !== label || $[8] !== listRef || $[9] !== t4 || $[10] !== t5) {
|
|
92
|
+
t6 = /*#__PURE__*/_jsx("ul", {
|
|
93
|
+
ref: listRef,
|
|
94
|
+
"data-slot": t2,
|
|
95
|
+
"aria-label": label,
|
|
96
|
+
className: t3,
|
|
97
|
+
style: t4,
|
|
98
|
+
children: t5
|
|
99
|
+
});
|
|
100
|
+
$[7] = label;
|
|
101
|
+
$[8] = listRef;
|
|
102
|
+
$[9] = t4;
|
|
103
|
+
$[10] = t5;
|
|
104
|
+
$[11] = t6;
|
|
105
|
+
} else {
|
|
106
|
+
t6 = $[11];
|
|
107
|
+
}
|
|
108
|
+
return t6;
|
|
71
109
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { ArrowUpRight as ArrowUpRightIcon } from "@carbon/icons-react";
|
|
2
5
|
import { cn } from "@locusgraph/components";
|
|
3
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -7,34 +10,93 @@ function textOf(suggestion) {
|
|
|
7
10
|
function labelOf(suggestion) {
|
|
8
11
|
return typeof suggestion === "string" ? suggestion : suggestion.label ?? suggestion.text;
|
|
9
12
|
}
|
|
10
|
-
export function Starters({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export function Starters(t0) {
|
|
14
|
+
const $ = _c(19);
|
|
15
|
+
let className;
|
|
16
|
+
let onSelect;
|
|
17
|
+
let props;
|
|
18
|
+
let suggestions;
|
|
19
|
+
let t1;
|
|
20
|
+
if ($[0] !== t0) {
|
|
21
|
+
({
|
|
22
|
+
suggestions,
|
|
23
|
+
onSelect,
|
|
24
|
+
disabled: t1,
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
} = t0);
|
|
28
|
+
$[0] = t0;
|
|
29
|
+
$[1] = className;
|
|
30
|
+
$[2] = onSelect;
|
|
31
|
+
$[3] = props;
|
|
32
|
+
$[4] = suggestions;
|
|
33
|
+
$[5] = t1;
|
|
34
|
+
} else {
|
|
35
|
+
className = $[1];
|
|
36
|
+
onSelect = $[2];
|
|
37
|
+
props = $[3];
|
|
38
|
+
suggestions = $[4];
|
|
39
|
+
t1 = $[5];
|
|
40
|
+
}
|
|
41
|
+
const disabled = t1 === undefined ? false : t1;
|
|
17
42
|
if (suggestions.length === 0) {
|
|
18
43
|
return null;
|
|
19
44
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
className: "
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[6] !== className) {
|
|
47
|
+
t2 = cn("flex flex-col divide-y bg-card ring-1 ring-border", className);
|
|
48
|
+
$[6] = className;
|
|
49
|
+
$[7] = t2;
|
|
50
|
+
} else {
|
|
51
|
+
t2 = $[7];
|
|
52
|
+
}
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[8] !== disabled || $[9] !== onSelect || $[10] !== suggestions) {
|
|
55
|
+
let t4;
|
|
56
|
+
if ($[12] !== disabled || $[13] !== onSelect) {
|
|
57
|
+
t4 = suggestion => /*#__PURE__*/_jsxs("button", {
|
|
58
|
+
type: "button",
|
|
59
|
+
disabled: disabled,
|
|
60
|
+
onClick: () => onSelect(textOf(suggestion)),
|
|
61
|
+
className: "group flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm outline-none hover:bg-accent/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 motion-safe:transition-colors",
|
|
62
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
63
|
+
className: "min-w-0 flex-1 text-pretty",
|
|
64
|
+
children: labelOf(suggestion)
|
|
65
|
+
}), /*#__PURE__*/_jsx(ArrowUpRightIcon, {
|
|
66
|
+
"aria-hidden": true,
|
|
67
|
+
className: "size-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 motion-safe:transition-opacity"
|
|
68
|
+
})]
|
|
69
|
+
}, textOf(suggestion));
|
|
70
|
+
$[12] = disabled;
|
|
71
|
+
$[13] = onSelect;
|
|
72
|
+
$[14] = t4;
|
|
73
|
+
} else {
|
|
74
|
+
t4 = $[14];
|
|
75
|
+
}
|
|
76
|
+
t3 = suggestions.map(t4);
|
|
77
|
+
$[8] = disabled;
|
|
78
|
+
$[9] = onSelect;
|
|
79
|
+
$[10] = suggestions;
|
|
80
|
+
$[11] = t3;
|
|
81
|
+
} else {
|
|
82
|
+
t3 = $[11];
|
|
83
|
+
}
|
|
84
|
+
let t4;
|
|
85
|
+
if ($[15] !== props || $[16] !== t2 || $[17] !== t3) {
|
|
86
|
+
t4 = /*#__PURE__*/_jsx("div", {
|
|
87
|
+
"data-slot": "starters",
|
|
88
|
+
role: "group",
|
|
89
|
+
"aria-label": "Suggested prompts",
|
|
90
|
+
className: t2,
|
|
91
|
+
...props,
|
|
92
|
+
children: t3
|
|
93
|
+
});
|
|
94
|
+
$[15] = props;
|
|
95
|
+
$[16] = t2;
|
|
96
|
+
$[17] = t3;
|
|
97
|
+
$[18] = t4;
|
|
98
|
+
} else {
|
|
99
|
+
t4 = $[18];
|
|
100
|
+
}
|
|
101
|
+
return t4;
|
|
40
102
|
}
|
|
@@ -1,18 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { useEffect, useRef, useState } from "react";
|
|
2
5
|
const copiedDurationMs = 1500;
|
|
3
6
|
export function useCopied() {
|
|
7
|
+
const $ = _c(5);
|
|
4
8
|
const [copied, setCopied] = useState(false);
|
|
5
9
|
const timer = useRef(undefined);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
clearTimeout(timer.current);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
let t0;
|
|
11
|
+
let t1;
|
|
12
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
13
|
+
t0 = () => () => clearTimeout(timer.current);
|
|
14
|
+
t1 = [];
|
|
15
|
+
$[0] = t0;
|
|
16
|
+
$[1] = t1;
|
|
17
|
+
} else {
|
|
18
|
+
t0 = $[0];
|
|
19
|
+
t1 = $[1];
|
|
20
|
+
}
|
|
21
|
+
useEffect(t0, t1);
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
24
|
+
t2 = () => {
|
|
25
|
+
setCopied(true);
|
|
26
|
+
clearTimeout(timer.current);
|
|
27
|
+
timer.current = setTimeout(() => setCopied(false), copiedDurationMs);
|
|
28
|
+
};
|
|
29
|
+
$[2] = t2;
|
|
30
|
+
} else {
|
|
31
|
+
t2 = $[2];
|
|
32
|
+
}
|
|
33
|
+
const markCopied = t2;
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[3] !== copied) {
|
|
36
|
+
t3 = {
|
|
37
|
+
copied,
|
|
38
|
+
markCopied
|
|
39
|
+
};
|
|
40
|
+
$[3] = copied;
|
|
41
|
+
$[4] = t3;
|
|
42
|
+
} else {
|
|
43
|
+
t3 = $[4];
|
|
44
|
+
}
|
|
45
|
+
return t3;
|
|
16
46
|
}
|
|
17
47
|
export async function writeToClipboard(text) {
|
|
18
48
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locusgraph/loop",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Agent components for LocusGraph apps: chat, agent steps, human-in-the-loop approvals, memory and cost. Takes Vercel AI SDK UIMessage parts; never calls a model.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|