@locusgraph/loop 0.2.0 → 0.2.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 +12 -62
- package/dist/agent/pulse/marks/bars-mark.js +15 -37
- package/dist/agent/pulse/marks/glyph-mark.js +15 -54
- package/dist/agent/pulse/marks/locus-mark.js +12 -36
- package/dist/agent/pulse/marks/orb-mark.js +9 -19
- package/dist/agent/pulse/marks/spinner-mark.js +20 -29
- package/dist/agent/pulse/pulse.js +36 -123
- package/dist/agent/pulse/use-loop-animation.js +12 -33
- package/dist/agent/steps/step-icon.js +26 -96
- package/dist/agent/steps/steps.js +47 -210
- package/dist/agent/tool/json-block.js +11 -31
- package/dist/agent/tool/tool-status.js +12 -35
- package/dist/approval/inbox/inbox-row.js +76 -301
- package/dist/approval/inbox/inbox.js +39 -190
- package/dist/approval/inbox/virtual-inbox-list.js +26 -102
- package/dist/approval/memory/memory-review.js +36 -170
- package/dist/approval/memory/memory-row.js +50 -185
- package/dist/approval/plan/plan-review.js +73 -223
- package/dist/approval/plan/plan-step-row.js +76 -180
- package/dist/approval/plan/question-choices.js +44 -130
- package/dist/approval/plan/question.js +38 -154
- package/dist/approval/run/run-bar.js +39 -123
- package/dist/approval/shared/risk-badge.js +9 -24
- package/dist/approval/shared/use-focus-on-mount.js +5 -21
- package/dist/approval/spend/raise-cap-form.js +48 -221
- package/dist/approval/spend/spend-gate.js +40 -155
- package/dist/approval/spend/spend-meter.js +85 -312
- package/dist/approval/tool/approval.js +35 -194
- package/dist/approval/tool/args/args-editor.js +46 -204
- package/dist/approval/tool/args/args-field.js +55 -238
- package/dist/approval/tool/deny-form.js +36 -123
- package/dist/approval/tool/tool-inputs.js +23 -88
- package/dist/chat/chat/use-stick-to-bottom.js +60 -113
- package/dist/chat/chat/virtual-chat-items.js +34 -127
- package/dist/chat/composer/composer-actions.js +46 -129
- package/dist/chat/composer/use-auto-grow.js +8 -23
- package/dist/chat/files/files.js +66 -291
- package/dist/chat/reply/fenced-code.js +10 -32
- package/dist/chat/reply/reply.js +24 -99
- package/dist/chat/turn/turn.js +46 -197
- package/dist/cost/context.js +65 -282
- package/dist/cost/cost-steps.js +42 -195
- package/dist/cost/cost.js +108 -497
- package/dist/cost/model-picker.js +42 -172
- package/dist/cost/shared/context-breakdown.js +64 -280
- package/dist/cost/shared/meter-marks.js +34 -92
- package/dist/cost/shared/model-option-row.js +35 -158
- package/dist/cost/shared/step-cost-row.js +37 -222
- package/dist/memory/cite.js +58 -179
- package/dist/memory/memorized.js +42 -194
- package/dist/memory/recall.js +68 -263
- package/dist/memory/shared/source-mark.js +10 -38
- package/dist/memory/sources.js +52 -230
- package/dist/shared/decision-summary.js +35 -117
- package/dist/shared/panel-empty.js +15 -73
- package/dist/shared/panel.js +65 -239
- package/dist/shared/status-dot.js +10 -32
- package/dist/thread/actions/action-button.js +10 -53
- package/dist/thread/actions/branch-switcher.js +21 -95
- package/dist/thread/canvas/version-switcher.js +31 -126
- package/dist/thread/code/copy-code-button.js +24 -56
- package/dist/thread/history/row/history-row.js +18 -97
- package/dist/thread/history/row/thread-item-menu.js +19 -72
- package/dist/thread/history/row/thread-title-editor.js +29 -72
- package/dist/thread/history/virtual-history-list.js +46 -82
- package/dist/thread/starters/starters.js +27 -87
- package/dist/thread/use-copied.js +10 -38
- package/package.json +3 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { cn } from "@locusgraph/components";
|
|
3
2
|
import { useRef } from "react";
|
|
4
3
|
import { rowOffsetStyle, useListVirtualizer, virtualRowClassName } from "../../shared/virtual/use-list-virtualizer.js";
|
|
@@ -8,16 +7,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
8
7
|
function scrollAreaViewportOf(element) {
|
|
9
8
|
return element?.closest("[data-slot=scroll-area-viewport]") ?? null;
|
|
10
9
|
}
|
|
11
|
-
export function VirtualHistoryList(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onArchive
|
|
20
|
-
} = t0;
|
|
10
|
+
export function VirtualHistoryList({
|
|
11
|
+
groups,
|
|
12
|
+
label,
|
|
13
|
+
activeId,
|
|
14
|
+
onSelect,
|
|
15
|
+
onRename,
|
|
16
|
+
onArchive
|
|
17
|
+
}) {
|
|
21
18
|
const listRef = useRef(null);
|
|
22
19
|
const rows = historyListRows(groups);
|
|
23
20
|
const {
|
|
@@ -28,80 +25,47 @@ export function VirtualHistoryList(t0) {
|
|
|
28
25
|
count: rows.length,
|
|
29
26
|
getScrollElement: () => scrollAreaViewportOf(listRef.current),
|
|
30
27
|
estimateSize: index => estimatedRowHeight(rows[index], index),
|
|
31
|
-
getItemKey:
|
|
28
|
+
getItemKey: index => rows[index].key
|
|
29
|
+
});
|
|
30
|
+
const threadRowProps = thread => ({
|
|
31
|
+
thread,
|
|
32
|
+
active: thread.id === activeId,
|
|
33
|
+
onSelect,
|
|
34
|
+
onRename,
|
|
35
|
+
onArchive
|
|
32
36
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
onRename,
|
|
40
|
-
onArchive
|
|
41
|
-
});
|
|
42
|
-
$[0] = activeId;
|
|
43
|
-
$[1] = onArchive;
|
|
44
|
-
$[2] = onRename;
|
|
45
|
-
$[3] = onSelect;
|
|
46
|
-
$[4] = t1;
|
|
47
|
-
} else {
|
|
48
|
-
t1 = $[4];
|
|
49
|
-
}
|
|
50
|
-
const threadRowProps = t1;
|
|
51
|
-
const t2 = "history-list";
|
|
52
|
-
const t3 = "relative";
|
|
53
|
-
let t4;
|
|
54
|
-
if ($[5] !== totalSize) {
|
|
55
|
-
t4 = {
|
|
37
|
+
return /*#__PURE__*/_jsx("ul", {
|
|
38
|
+
ref: listRef,
|
|
39
|
+
"data-slot": "history-list",
|
|
40
|
+
"aria-label": label,
|
|
41
|
+
className: "relative",
|
|
42
|
+
style: {
|
|
56
43
|
height: totalSize
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
44
|
+
},
|
|
45
|
+
children: visibleRows.map(virtualRow => {
|
|
46
|
+
const row = rows[virtualRow.index];
|
|
47
|
+
if (row.kind === "group") {
|
|
48
|
+
return /*#__PURE__*/_jsx("li", {
|
|
49
|
+
role: "presentation",
|
|
50
|
+
...itemProps(virtualRow.index),
|
|
51
|
+
className: cn(virtualRowClassName, virtualRow.index > 0 && "pt-4"),
|
|
52
|
+
style: rowOffsetStyle(virtualRow.start),
|
|
53
|
+
children: /*#__PURE__*/_jsx("h3", {
|
|
54
|
+
id: `thread-group-${row.groupKey}`,
|
|
55
|
+
className: "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),
|
|
68
63
|
...itemProps(virtualRow.index),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
className: "eyebrow px-2 pb-1",
|
|
74
|
-
suppressHydrationWarning: true,
|
|
75
|
-
children: row.label
|
|
76
|
-
})
|
|
64
|
+
"aria-posinset": row.position,
|
|
65
|
+
"aria-setsize": row.groupSize,
|
|
66
|
+
className: virtualRowClassName,
|
|
67
|
+
style: rowOffsetStyle(virtualRow.start)
|
|
77
68
|
}, virtualRow.key);
|
|
78
|
-
}
|
|
79
|
-
return /*#__PURE__*/_jsx(HistoryRow, {
|
|
80
|
-
...threadRowProps(row.thread),
|
|
81
|
-
...itemProps(virtualRow.index),
|
|
82
|
-
"aria-posinset": row.position,
|
|
83
|
-
"aria-setsize": row.groupSize,
|
|
84
|
-
className: virtualRowClassName,
|
|
85
|
-
style: rowOffsetStyle(virtualRow.start)
|
|
86
|
-
}, virtualRow.key);
|
|
69
|
+
})
|
|
87
70
|
});
|
|
88
|
-
let t6;
|
|
89
|
-
if ($[7] !== label || $[8] !== listRef || $[9] !== t4 || $[10] !== t5) {
|
|
90
|
-
t6 = /*#__PURE__*/_jsx("ul", {
|
|
91
|
-
ref: listRef,
|
|
92
|
-
"data-slot": t2,
|
|
93
|
-
"aria-label": label,
|
|
94
|
-
className: t3,
|
|
95
|
-
style: t4,
|
|
96
|
-
children: t5
|
|
97
|
-
});
|
|
98
|
-
$[7] = label;
|
|
99
|
-
$[8] = listRef;
|
|
100
|
-
$[9] = t4;
|
|
101
|
-
$[10] = t5;
|
|
102
|
-
$[11] = t6;
|
|
103
|
-
} else {
|
|
104
|
-
t6 = $[11];
|
|
105
|
-
}
|
|
106
|
-
return t6;
|
|
107
71
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { ArrowUpRight as ArrowUpRightIcon } from "@carbon/icons-react";
|
|
3
2
|
import { cn } from "@locusgraph/components";
|
|
4
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -8,93 +7,34 @@ function textOf(suggestion) {
|
|
|
8
7
|
function labelOf(suggestion) {
|
|
9
8
|
return typeof suggestion === "string" ? suggestion : suggestion.label ?? suggestion.text;
|
|
10
9
|
}
|
|
11
|
-
export function Starters(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if ($[0] !== t0) {
|
|
19
|
-
({
|
|
20
|
-
suggestions,
|
|
21
|
-
onSelect,
|
|
22
|
-
disabled: t1,
|
|
23
|
-
className,
|
|
24
|
-
...props
|
|
25
|
-
} = t0);
|
|
26
|
-
$[0] = t0;
|
|
27
|
-
$[1] = className;
|
|
28
|
-
$[2] = onSelect;
|
|
29
|
-
$[3] = props;
|
|
30
|
-
$[4] = suggestions;
|
|
31
|
-
$[5] = t1;
|
|
32
|
-
} else {
|
|
33
|
-
className = $[1];
|
|
34
|
-
onSelect = $[2];
|
|
35
|
-
props = $[3];
|
|
36
|
-
suggestions = $[4];
|
|
37
|
-
t1 = $[5];
|
|
38
|
-
}
|
|
39
|
-
const disabled = t1 === undefined ? false : t1;
|
|
10
|
+
export function Starters({
|
|
11
|
+
suggestions,
|
|
12
|
+
onSelect,
|
|
13
|
+
disabled = false,
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
40
17
|
if (suggestions.length === 0) {
|
|
41
18
|
return null;
|
|
42
19
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
className: "
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}), /*#__PURE__*/_jsx(ArrowUpRightIcon, {
|
|
64
|
-
"aria-hidden": true,
|
|
65
|
-
className: "size-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 motion-safe:transition-opacity"
|
|
66
|
-
})]
|
|
67
|
-
}, textOf(suggestion));
|
|
68
|
-
$[12] = disabled;
|
|
69
|
-
$[13] = onSelect;
|
|
70
|
-
$[14] = t4;
|
|
71
|
-
} else {
|
|
72
|
-
t4 = $[14];
|
|
73
|
-
}
|
|
74
|
-
t3 = suggestions.map(t4);
|
|
75
|
-
$[8] = disabled;
|
|
76
|
-
$[9] = onSelect;
|
|
77
|
-
$[10] = suggestions;
|
|
78
|
-
$[11] = t3;
|
|
79
|
-
} else {
|
|
80
|
-
t3 = $[11];
|
|
81
|
-
}
|
|
82
|
-
let t4;
|
|
83
|
-
if ($[15] !== props || $[16] !== t2 || $[17] !== t3) {
|
|
84
|
-
t4 = /*#__PURE__*/_jsx("div", {
|
|
85
|
-
"data-slot": "starters",
|
|
86
|
-
role: "group",
|
|
87
|
-
"aria-label": "Suggested prompts",
|
|
88
|
-
className: t2,
|
|
89
|
-
...props,
|
|
90
|
-
children: t3
|
|
91
|
-
});
|
|
92
|
-
$[15] = props;
|
|
93
|
-
$[16] = t2;
|
|
94
|
-
$[17] = t3;
|
|
95
|
-
$[18] = t4;
|
|
96
|
-
} else {
|
|
97
|
-
t4 = $[18];
|
|
98
|
-
}
|
|
99
|
-
return t4;
|
|
20
|
+
return /*#__PURE__*/_jsx("div", {
|
|
21
|
+
"data-slot": "starters",
|
|
22
|
+
role: "group",
|
|
23
|
+
"aria-label": "Suggested prompts",
|
|
24
|
+
className: cn("flex flex-col divide-y bg-card ring-1 ring-border", className),
|
|
25
|
+
...props,
|
|
26
|
+
children: suggestions.map(suggestion => /*#__PURE__*/_jsxs("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
disabled: disabled,
|
|
29
|
+
onClick: () => onSelect(textOf(suggestion)),
|
|
30
|
+
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",
|
|
31
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
32
|
+
className: "min-w-0 flex-1 text-pretty",
|
|
33
|
+
children: labelOf(suggestion)
|
|
34
|
+
}), /*#__PURE__*/_jsx(ArrowUpRightIcon, {
|
|
35
|
+
"aria-hidden": true,
|
|
36
|
+
className: "size-3.5 shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100 motion-safe:transition-opacity"
|
|
37
|
+
})]
|
|
38
|
+
}, textOf(suggestion)))
|
|
39
|
+
});
|
|
100
40
|
}
|
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import { useEffect, useRef, useState } from "react";
|
|
3
2
|
const copiedDurationMs = 1500;
|
|
4
3
|
export function useCopied() {
|
|
5
|
-
const $ = _c(5);
|
|
6
4
|
const [copied, setCopied] = useState(false);
|
|
7
5
|
const timer = useRef(undefined);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
useEffect(t0, t1);
|
|
20
|
-
let t2;
|
|
21
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
22
|
-
t2 = () => {
|
|
23
|
-
setCopied(true);
|
|
24
|
-
clearTimeout(timer.current);
|
|
25
|
-
timer.current = setTimeout(() => setCopied(false), copiedDurationMs);
|
|
26
|
-
};
|
|
27
|
-
$[2] = t2;
|
|
28
|
-
} else {
|
|
29
|
-
t2 = $[2];
|
|
30
|
-
}
|
|
31
|
-
const markCopied = t2;
|
|
32
|
-
let t3;
|
|
33
|
-
if ($[3] !== copied) {
|
|
34
|
-
t3 = {
|
|
35
|
-
copied,
|
|
36
|
-
markCopied
|
|
37
|
-
};
|
|
38
|
-
$[3] = copied;
|
|
39
|
-
$[4] = t3;
|
|
40
|
-
} else {
|
|
41
|
-
t3 = $[4];
|
|
42
|
-
}
|
|
43
|
-
return t3;
|
|
6
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
7
|
+
const markCopied = () => {
|
|
8
|
+
setCopied(true);
|
|
9
|
+
clearTimeout(timer.current);
|
|
10
|
+
timer.current = setTimeout(() => setCopied(false), copiedDurationMs);
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
copied,
|
|
14
|
+
markCopied
|
|
15
|
+
};
|
|
44
16
|
}
|
|
45
17
|
export async function writeToClipboard(text) {
|
|
46
18
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locusgraph/loop",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.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": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"provenance": true
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@locusgraph/components": "^0.2.
|
|
32
|
+
"@locusgraph/components": "^0.2.2",
|
|
33
33
|
"react": "^19.2.0",
|
|
34
34
|
"react-dom": "^19.2.0"
|
|
35
35
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"shiki": "^4.5.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@locusgraph/components": "0.2.
|
|
46
|
+
"@locusgraph/components": "0.2.2",
|
|
47
47
|
"@locusgraph/config": "0.1.1",
|
|
48
48
|
"@types/node": "^22.0.0",
|
|
49
49
|
"@types/react": "^19.2.0",
|