@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.
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/pulse/gradient-label.js +70 -17
- package/dist/agent/pulse/marks/bars-mark.js +39 -15
- package/dist/agent/pulse/marks/glyph-mark.js +57 -16
- package/dist/agent/pulse/marks/locus-mark.js +39 -13
- package/dist/agent/pulse/marks/orb-mark.js +21 -9
- package/dist/agent/pulse/pulse.js +1 -1
- package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
- package/dist/agent/pulse/use-loop-animation.js +36 -15
- package/dist/agent/steps/step-icon.js +20 -13
- package/dist/agent/steps/steps.js +39 -37
- package/dist/agent/thinking/thinking.js +65 -62
- package/dist/agent/tool/json-block.js +10 -7
- package/dist/agent/tool/tool-status.d.ts +2 -0
- package/dist/agent/tool/tool-status.js +16 -13
- package/dist/agent/tool/tool.d.ts +8 -1
- package/dist/agent/tool/tool.js +238 -119
- package/dist/approval/inbox/inbox-row.d.ts +3 -3
- package/dist/approval/inbox/inbox-row.js +248 -86
- package/dist/approval/inbox/inbox.d.ts +3 -3
- package/dist/approval/inbox/inbox.js +251 -57
- package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
- package/dist/approval/inbox/virtual-inbox-list.js +107 -30
- package/dist/approval/memory/memory-review.js +228 -91
- package/dist/approval/memory/memory-row.js +192 -56
- package/dist/approval/plan/plan-review.js +241 -108
- package/dist/approval/plan/plan-step-row.js +184 -77
- package/dist/approval/plan/plan-steps.d.ts +1 -1
- package/dist/approval/plan/plan-steps.js +2 -2
- package/dist/approval/plan/question-choices.js +139 -48
- package/dist/approval/plan/question.js +189 -67
- package/dist/approval/run/run-bar.js +138 -49
- package/dist/approval/shared/approval-line.d.ts +27 -0
- package/dist/approval/shared/approval-line.js +85 -0
- package/dist/approval/shared/risk-badge.d.ts +3 -5
- package/dist/approval/shared/risk-badge.js +11 -19
- package/dist/approval/shared/time.d.ts +0 -1
- package/dist/approval/shared/time.js +0 -1
- package/dist/approval/shared/use-focus-on-mount.js +23 -5
- package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
- package/dist/approval/shared/use-focus-when-settled.js +18 -0
- package/dist/approval/spend/raise-cap-form.d.ts +2 -2
- package/dist/approval/spend/raise-cap-form.js +235 -52
- package/dist/approval/spend/spend-gate.js +200 -106
- package/dist/approval/spend/spend-math.d.ts +1 -0
- package/dist/approval/spend/spend-math.js +5 -2
- package/dist/approval/spend/spend-meter.js +5 -5
- package/dist/approval/tool/approval.js +157 -96
- package/dist/approval/tool/args/args-editor.js +232 -81
- package/dist/approval/tool/args/args-field.js +333 -60
- package/dist/approval/tool/deny-form.js +114 -32
- package/dist/approval/tool/tool-inputs.js +93 -33
- package/dist/chat/chat/chat.js +5 -4
- package/dist/chat/chat/use-stick-to-bottom.js +116 -63
- 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 +136 -50
- 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 +6 -4
- package/dist/chat/composer/use-auto-grow.js +29 -8
- package/dist/chat/files/files.js +296 -67
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/chat/reply/fenced-code.js +1 -1
- package/dist/chat/reply/markdown-components.js +9 -116
- package/dist/chat/reply/reply.js +2 -2
- package/dist/chat/turn/group-parts.d.ts +1 -0
- package/dist/chat/turn/group-parts.js +6 -3
- package/dist/chat/turn/turn.js +13 -4
- package/dist/cost/context.js +3 -3
- package/dist/cost/cost-steps.js +31 -30
- package/dist/cost/cost.js +39 -39
- package/dist/cost/model-picker.js +176 -43
- package/dist/cost/shared/context-breakdown.js +10 -11
- package/dist/cost/shared/model-option-row.js +4 -3
- package/dist/cost/shared/step-cost-row.js +11 -12
- package/dist/cost/shared/usage-totals.d.ts +1 -0
- package/dist/cost/shared/usage-totals.js +19 -1
- package/dist/memory/cite.js +190 -59
- package/dist/memory/memorized.js +231 -62
- package/dist/memory/recall.js +272 -85
- package/dist/memory/shared/host-label.d.ts +1 -1
- package/dist/memory/shared/host-label.js +2 -2
- package/dist/memory/shared/source-mark.js +1 -1
- package/dist/memory/sources.d.ts +2 -1
- package/dist/memory/sources.js +277 -62
- package/dist/shared/decision-summary.js +2 -1
- package/dist/shared/line.d.ts +10 -0
- package/dist/shared/line.js +11 -0
- package/dist/shared/live-status.d.ts +3 -0
- package/dist/shared/live-status.js +11 -0
- package/dist/shared/reduced-motion.d.ts +1 -0
- package/dist/shared/reduced-motion.js +3 -0
- package/dist/shared/virtual/use-list-virtualizer.js +2 -0
- package/dist/thread/actions/action-button.js +1 -1
- package/dist/thread/actions/actions.d.ts +3 -1
- package/dist/thread/actions/actions.js +100 -81
- package/dist/thread/actions/branch-switcher.js +129 -23
- package/dist/thread/canvas/canvas-meta.d.ts +9 -0
- package/dist/thread/canvas/canvas-meta.js +35 -0
- package/dist/thread/canvas/canvas.d.ts +1 -1
- package/dist/thread/canvas/canvas.js +64 -74
- package/dist/thread/canvas/version-switcher.d.ts +1 -0
- package/dist/thread/canvas/version-switcher.js +161 -45
- package/dist/thread/code/code.js +4 -6
- package/dist/thread/code/copy-code-button.d.ts +2 -1
- package/dist/thread/code/copy-code-button.js +91 -26
- package/dist/thread/history/history.d.ts +1 -1
- package/dist/thread/history/history.js +104 -104
- package/dist/thread/history/row/history-row.js +106 -22
- package/dist/thread/history/row/thread-item-menu.js +84 -20
- package/dist/thread/history/row/thread-title-editor.js +74 -29
- package/dist/thread/history/virtual-history-list.js +83 -46
- package/dist/thread/index.d.ts +1 -0
- package/dist/thread/index.js +1 -0
- package/dist/thread/starters/starters.js +91 -28
- package/dist/thread/use-copied.js +40 -10
- package/package.json +6 -6
- package/dist/agent/shared/status-dot.d.ts +0 -1
- package/dist/agent/shared/status-dot.js +0 -1
- package/dist/approval/shared/decision-line.d.ts +0 -1
- package/dist/approval/shared/decision-line.js +0 -1
- package/dist/memory/shared/disclosure.d.ts +0 -6
- package/dist/memory/shared/disclosure.js +0 -6
- package/dist/shared/panel.d.ts +0 -19
- package/dist/shared/panel.js +0 -77
- package/dist/shared/status-dot.d.ts +0 -6
- package/dist/shared/status-dot.js +0 -20
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { cn } from "@locusgraph/components";
|
|
2
|
-
import {
|
|
5
|
+
import { useState } from "react";
|
|
3
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
7
|
function isPlainRecord(value) {
|
|
5
8
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -36,42 +39,99 @@ export function humanizeKey(key) {
|
|
|
36
39
|
function rawJson(input) {
|
|
37
40
|
return JSON.stringify(input, null, 2) ?? "undefined";
|
|
38
41
|
}
|
|
39
|
-
export function ToolInputs({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
export function ToolInputs(t0) {
|
|
43
|
+
const $ = _c(20);
|
|
44
|
+
const {
|
|
45
|
+
input,
|
|
46
|
+
muted: t1
|
|
47
|
+
} = t0;
|
|
48
|
+
const muted = t1 === undefined ? false : t1;
|
|
43
49
|
const [showRaw, setShowRaw] = useState(false);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
className: "
|
|
58
|
-
children:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
let entries;
|
|
51
|
+
let t2;
|
|
52
|
+
let t3;
|
|
53
|
+
let t4;
|
|
54
|
+
if ($[0] !== input || $[1] !== muted || $[2] !== showRaw) {
|
|
55
|
+
entries = isPlainRecord(input) ? Object.entries(input) : null;
|
|
56
|
+
t2 = "tool-inputs";
|
|
57
|
+
t3 = "flex flex-col gap-2";
|
|
58
|
+
t4 = entries && !showRaw && /*#__PURE__*/_jsxs("dl", {
|
|
59
|
+
className: cn("grid grid-cols-[6rem_minmax(0,1fr)] gap-x-4 sm:grid-cols-[8rem_minmax(0,1fr)] gap-y-2 text-sm", muted ? "text-faint" : "text-foreground"),
|
|
60
|
+
children: [entries.map(t5 => {
|
|
61
|
+
const [key, value] = t5;
|
|
62
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
63
|
+
className: "contents",
|
|
64
|
+
children: [/*#__PURE__*/_jsx("dt", {
|
|
65
|
+
className: "truncate text-muted-foreground",
|
|
66
|
+
children: humanizeKey(key)
|
|
67
|
+
}), /*#__PURE__*/_jsx("dd", {
|
|
68
|
+
className: cn("min-w-0 break-words", !muted && "font-medium"),
|
|
69
|
+
children: readableValue(value)
|
|
70
|
+
})]
|
|
71
|
+
}, key);
|
|
72
|
+
}), entries.length === 0 && /*#__PURE__*/_jsx("div", {
|
|
73
|
+
className: "col-span-2 text-muted-foreground",
|
|
62
74
|
children: "No inputs."
|
|
63
75
|
})]
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
});
|
|
77
|
+
$[0] = input;
|
|
78
|
+
$[1] = muted;
|
|
79
|
+
$[2] = showRaw;
|
|
80
|
+
$[3] = entries;
|
|
81
|
+
$[4] = t2;
|
|
82
|
+
$[5] = t3;
|
|
83
|
+
$[6] = t4;
|
|
84
|
+
} else {
|
|
85
|
+
entries = $[3];
|
|
86
|
+
t2 = $[4];
|
|
87
|
+
t3 = $[5];
|
|
88
|
+
t4 = $[6];
|
|
89
|
+
}
|
|
90
|
+
let t5;
|
|
91
|
+
if ($[7] !== entries || $[8] !== input || $[9] !== showRaw) {
|
|
92
|
+
t5 = (showRaw || !entries) && /*#__PURE__*/_jsx("pre", {
|
|
93
|
+
className: "overflow-x-auto font-mono text-xs text-muted-foreground",
|
|
67
94
|
children: rawJson(input)
|
|
68
|
-
})
|
|
95
|
+
});
|
|
96
|
+
$[7] = entries;
|
|
97
|
+
$[8] = input;
|
|
98
|
+
$[9] = showRaw;
|
|
99
|
+
$[10] = t5;
|
|
100
|
+
} else {
|
|
101
|
+
t5 = $[10];
|
|
102
|
+
}
|
|
103
|
+
let t6;
|
|
104
|
+
if ($[11] !== entries || $[12] !== showRaw) {
|
|
105
|
+
t6 = entries && /*#__PURE__*/_jsx("button", {
|
|
69
106
|
type: "button",
|
|
70
|
-
className: "
|
|
71
|
-
|
|
72
|
-
"aria-controls": showRaw ? rawId : undefined,
|
|
73
|
-
onClick: () => setShowRaw(current => !current),
|
|
107
|
+
className: "ml-28 self-start text-xs sm:ml-36 text-faint locus-focus-ring hover:text-interactive motion-safe:transition-colors",
|
|
108
|
+
onClick: () => setShowRaw(_temp),
|
|
74
109
|
children: showRaw ? "Show fields" : "Show raw"
|
|
75
|
-
})
|
|
76
|
-
|
|
110
|
+
});
|
|
111
|
+
$[11] = entries;
|
|
112
|
+
$[12] = showRaw;
|
|
113
|
+
$[13] = t6;
|
|
114
|
+
} else {
|
|
115
|
+
t6 = $[13];
|
|
116
|
+
}
|
|
117
|
+
let t7;
|
|
118
|
+
if ($[14] !== t2 || $[15] !== t3 || $[16] !== t4 || $[17] !== t5 || $[18] !== t6) {
|
|
119
|
+
t7 = /*#__PURE__*/_jsxs("div", {
|
|
120
|
+
"data-slot": t2,
|
|
121
|
+
className: t3,
|
|
122
|
+
children: [t4, t5, t6]
|
|
123
|
+
});
|
|
124
|
+
$[14] = t2;
|
|
125
|
+
$[15] = t3;
|
|
126
|
+
$[16] = t4;
|
|
127
|
+
$[17] = t5;
|
|
128
|
+
$[18] = t6;
|
|
129
|
+
$[19] = t7;
|
|
130
|
+
} else {
|
|
131
|
+
t7 = $[19];
|
|
132
|
+
}
|
|
133
|
+
return t7;
|
|
134
|
+
}
|
|
135
|
+
function _temp(current) {
|
|
136
|
+
return !current;
|
|
77
137
|
}
|
package/dist/chat/chat/chat.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { ArrowDown as ArrowDownIcon } from "@carbon/icons-react";
|
|
5
4
|
import { Button, cn } from "@locusgraph/components";
|
|
5
|
+
import { ArrowDown as ArrowDownIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { shouldVirtualize } from "../../shared/virtual/use-list-virtualizer.js";
|
|
8
8
|
import { useStickToBottom } from "./use-stick-to-bottom.js";
|
|
@@ -129,7 +129,7 @@ export function Chat(t0) {
|
|
|
129
129
|
"aria-busy": t8,
|
|
130
130
|
tabIndex: 0,
|
|
131
131
|
onScroll: handleScroll,
|
|
132
|
-
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain
|
|
132
|
+
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain locus-focus-ring-inset",
|
|
133
133
|
children: t10
|
|
134
134
|
});
|
|
135
135
|
$[25] = handleScroll;
|
|
@@ -146,11 +146,12 @@ export function Chat(t0) {
|
|
|
146
146
|
t12 = !isEmpty && !isAtBottom && /*#__PURE__*/_jsxs(Button, {
|
|
147
147
|
type: "button",
|
|
148
148
|
variant: "outline",
|
|
149
|
-
size: "
|
|
149
|
+
size: "xs",
|
|
150
150
|
"data-slot": "chat-jump",
|
|
151
151
|
onClick: scrollToLatest,
|
|
152
|
-
className: "absolute bottom-3 left-1/2
|
|
152
|
+
className: "absolute bottom-3 left-1/2 -translate-x-1/2 bg-card px-3 text-muted-foreground shadow-none hover:text-foreground motion-safe:animate-in motion-safe:fade-in-0 dark:bg-card",
|
|
153
153
|
children: [/*#__PURE__*/_jsx(ArrowDownIcon, {
|
|
154
|
+
weight: "bold",
|
|
154
155
|
"aria-hidden": "true",
|
|
155
156
|
className: "size-3.5"
|
|
156
157
|
}), jumpLabel]
|
|
@@ -1,80 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { c as _c } from "react/compiler-runtime";
|
|
1
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { prefersReducedMotion } from "../../shared/reduced-motion.js";
|
|
2
6
|
const bottomThresholdPx = 48;
|
|
3
7
|
function distanceFromBottom(element) {
|
|
4
8
|
return element.scrollHeight - element.scrollTop - element.clientHeight;
|
|
5
9
|
}
|
|
6
|
-
function prefersReducedMotion() {
|
|
7
|
-
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
8
|
-
}
|
|
9
10
|
function scrolledUpByReader(viewport, previous) {
|
|
10
11
|
return viewport.scrollTop < previous.top && viewport.scrollHeight === previous.height;
|
|
11
12
|
}
|
|
12
13
|
export function useStickToBottom() {
|
|
14
|
+
const $ = _c(8);
|
|
13
15
|
const viewportRef = useRef(null);
|
|
14
16
|
const contentRef = useRef(null);
|
|
15
17
|
const stuckRef = useRef(true);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
let t0;
|
|
19
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
20
|
+
t0 = {
|
|
21
|
+
top: 0,
|
|
22
|
+
height: 0
|
|
23
|
+
};
|
|
24
|
+
$[0] = t0;
|
|
25
|
+
} else {
|
|
26
|
+
t0 = $[0];
|
|
27
|
+
}
|
|
28
|
+
const lastScrollRef = useRef(t0);
|
|
20
29
|
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
viewport
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
32
|
+
t1 = () => {
|
|
33
|
+
const viewport = viewportRef.current;
|
|
34
|
+
if (viewport) {
|
|
35
|
+
viewport.scrollTop = viewport.scrollHeight;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
$[1] = t1;
|
|
39
|
+
} else {
|
|
40
|
+
t1 = $[1];
|
|
41
|
+
}
|
|
42
|
+
const pinToBottom = t1;
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
45
|
+
t2 = () => {
|
|
46
|
+
const viewport_0 = viewportRef.current;
|
|
47
|
+
if (!viewport_0) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const atBottom = distanceFromBottom(viewport_0) <= bottomThresholdPx;
|
|
51
|
+
const readerScrolledUp = scrolledUpByReader(viewport_0, lastScrollRef.current);
|
|
52
|
+
lastScrollRef.current = {
|
|
53
|
+
top: viewport_0.scrollTop,
|
|
54
|
+
height: viewport_0.scrollHeight
|
|
55
|
+
};
|
|
56
|
+
if (atBottom) {
|
|
57
|
+
stuckRef.current = true;
|
|
58
|
+
} else {
|
|
59
|
+
if (readerScrolledUp) {
|
|
60
|
+
stuckRef.current = false;
|
|
61
|
+
} else {
|
|
62
|
+
if (stuckRef.current) {
|
|
63
|
+
pinToBottom();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
setIsAtBottom(stuckRef.current);
|
|
37
68
|
};
|
|
38
|
-
|
|
69
|
+
$[2] = t2;
|
|
70
|
+
} else {
|
|
71
|
+
t2 = $[2];
|
|
72
|
+
}
|
|
73
|
+
const handleScroll = t2;
|
|
74
|
+
let t3;
|
|
75
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
76
|
+
t3 = () => {
|
|
77
|
+
const viewport_1 = viewportRef.current;
|
|
78
|
+
if (!viewport_1) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
39
81
|
stuckRef.current = true;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}, []);
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
const content = contentRef.current;
|
|
61
|
-
if (!content || typeof ResizeObserver === "undefined") {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
pinToBottom();
|
|
65
|
-
const observer = new ResizeObserver(() => {
|
|
66
|
-
if (stuckRef.current) {
|
|
67
|
-
pinToBottom();
|
|
82
|
+
setIsAtBottom(true);
|
|
83
|
+
viewport_1.scrollTo({
|
|
84
|
+
top: viewport_1.scrollHeight,
|
|
85
|
+
behavior: prefersReducedMotion() ? "auto" : "smooth"
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
$[3] = t3;
|
|
89
|
+
} else {
|
|
90
|
+
t3 = $[3];
|
|
91
|
+
}
|
|
92
|
+
const scrollToLatest = t3;
|
|
93
|
+
let t4;
|
|
94
|
+
let t5;
|
|
95
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
96
|
+
t4 = () => {
|
|
97
|
+
const content = contentRef.current;
|
|
98
|
+
if (!content || typeof ResizeObserver === "undefined") {
|
|
99
|
+
return;
|
|
68
100
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
101
|
+
pinToBottom();
|
|
102
|
+
const observer = new ResizeObserver(() => {
|
|
103
|
+
if (stuckRef.current) {
|
|
104
|
+
pinToBottom();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
observer.observe(content);
|
|
108
|
+
return () => observer.disconnect();
|
|
109
|
+
};
|
|
110
|
+
t5 = [pinToBottom];
|
|
111
|
+
$[4] = t4;
|
|
112
|
+
$[5] = t5;
|
|
113
|
+
} else {
|
|
114
|
+
t4 = $[4];
|
|
115
|
+
t5 = $[5];
|
|
116
|
+
}
|
|
117
|
+
useEffect(t4, t5);
|
|
118
|
+
let t6;
|
|
119
|
+
if ($[6] !== isAtBottom) {
|
|
120
|
+
t6 = {
|
|
121
|
+
viewportRef,
|
|
122
|
+
contentRef,
|
|
123
|
+
isAtBottom,
|
|
124
|
+
handleScroll,
|
|
125
|
+
scrollToLatest
|
|
126
|
+
};
|
|
127
|
+
$[6] = isAtBottom;
|
|
128
|
+
$[7] = t6;
|
|
129
|
+
} else {
|
|
130
|
+
t6 = $[7];
|
|
131
|
+
}
|
|
132
|
+
return t6;
|
|
80
133
|
}
|
|
@@ -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 { cloneElement, isValidElement, useEffect, useLayoutEffect } from "react";
|
|
3
6
|
import { rowOffsetStyle, useListVirtualizer, virtualRowClassName } from "../../shared/virtual/use-list-virtualizer.js";
|
|
@@ -16,45 +19,137 @@ function withSetPosition(item, index, count) {
|
|
|
16
19
|
"aria-setsize": count
|
|
17
20
|
});
|
|
18
21
|
}
|
|
19
|
-
export function VirtualChatItems({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export function VirtualChatItems(t0) {
|
|
23
|
+
const $ = _c(27);
|
|
24
|
+
const {
|
|
25
|
+
items,
|
|
26
|
+
viewportRef,
|
|
27
|
+
onScrollingChange
|
|
28
|
+
} = t0;
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[0] !== viewportRef) {
|
|
31
|
+
t1 = () => viewportRef.current;
|
|
32
|
+
$[0] = viewportRef;
|
|
33
|
+
$[1] = t1;
|
|
34
|
+
} else {
|
|
35
|
+
t1 = $[1];
|
|
36
|
+
}
|
|
37
|
+
let t2;
|
|
38
|
+
if ($[2] !== items) {
|
|
39
|
+
t2 = index => itemKey(items[index], index);
|
|
40
|
+
$[2] = items;
|
|
41
|
+
$[3] = t2;
|
|
42
|
+
} else {
|
|
43
|
+
t2 = $[3];
|
|
44
|
+
}
|
|
45
|
+
let t3;
|
|
46
|
+
if ($[4] !== items.length || $[5] !== t1 || $[6] !== t2) {
|
|
47
|
+
t3 = {
|
|
48
|
+
count: items.length,
|
|
49
|
+
getScrollElement: t1,
|
|
50
|
+
estimateSize: _temp,
|
|
51
|
+
getItemKey: t2,
|
|
52
|
+
anchorTo: "end"
|
|
53
|
+
};
|
|
54
|
+
$[4] = items.length;
|
|
55
|
+
$[5] = t1;
|
|
56
|
+
$[6] = t2;
|
|
57
|
+
$[7] = t3;
|
|
58
|
+
} else {
|
|
59
|
+
t3 = $[7];
|
|
60
|
+
}
|
|
24
61
|
const {
|
|
25
62
|
virtualizer,
|
|
26
63
|
rows,
|
|
27
64
|
totalSize,
|
|
28
65
|
isScrolling,
|
|
29
66
|
itemProps
|
|
30
|
-
} = useListVirtualizer(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
virtualizer
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
67
|
+
} = useListVirtualizer(t3);
|
|
68
|
+
let t4;
|
|
69
|
+
let t5;
|
|
70
|
+
if ($[8] !== virtualizer) {
|
|
71
|
+
t4 = () => {
|
|
72
|
+
virtualizer.scrollToEnd();
|
|
73
|
+
};
|
|
74
|
+
t5 = [virtualizer];
|
|
75
|
+
$[8] = virtualizer;
|
|
76
|
+
$[9] = t4;
|
|
77
|
+
$[10] = t5;
|
|
78
|
+
} else {
|
|
79
|
+
t4 = $[9];
|
|
80
|
+
t5 = $[10];
|
|
81
|
+
}
|
|
82
|
+
useLayoutEffect(t4, t5);
|
|
83
|
+
let t6;
|
|
84
|
+
let t7;
|
|
85
|
+
if ($[11] !== isScrolling || $[12] !== onScrollingChange) {
|
|
86
|
+
t6 = () => {
|
|
87
|
+
onScrollingChange(isScrolling);
|
|
88
|
+
};
|
|
89
|
+
t7 = [isScrolling, onScrollingChange];
|
|
90
|
+
$[11] = isScrolling;
|
|
91
|
+
$[12] = onScrollingChange;
|
|
92
|
+
$[13] = t6;
|
|
93
|
+
$[14] = t7;
|
|
94
|
+
} else {
|
|
95
|
+
t6 = $[13];
|
|
96
|
+
t7 = $[14];
|
|
97
|
+
}
|
|
98
|
+
useEffect(t6, t7);
|
|
99
|
+
let t8;
|
|
100
|
+
if ($[15] !== totalSize) {
|
|
101
|
+
t8 = {
|
|
47
102
|
height: totalSize
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
103
|
+
};
|
|
104
|
+
$[15] = totalSize;
|
|
105
|
+
$[16] = t8;
|
|
106
|
+
} else {
|
|
107
|
+
t8 = $[16];
|
|
108
|
+
}
|
|
109
|
+
let t9;
|
|
110
|
+
if ($[17] !== itemProps || $[18] !== items || $[19] !== rows) {
|
|
111
|
+
let t10;
|
|
112
|
+
if ($[21] !== itemProps || $[22] !== items) {
|
|
113
|
+
t10 = row => /*#__PURE__*/_jsx("div", {
|
|
114
|
+
"data-slot": "chat-item",
|
|
115
|
+
...itemProps(row.index),
|
|
116
|
+
className: cn(virtualRowClassName, "flex flex-col"),
|
|
117
|
+
style: {
|
|
118
|
+
...rowOffsetStyle(row.start),
|
|
119
|
+
paddingTop: gapBeforeItem(items, row.index)
|
|
120
|
+
},
|
|
121
|
+
children: withSetPosition(items[row.index], row.index, items.length)
|
|
122
|
+
}, row.key);
|
|
123
|
+
$[21] = itemProps;
|
|
124
|
+
$[22] = items;
|
|
125
|
+
$[23] = t10;
|
|
126
|
+
} else {
|
|
127
|
+
t10 = $[23];
|
|
128
|
+
}
|
|
129
|
+
t9 = rows.map(t10);
|
|
130
|
+
$[17] = itemProps;
|
|
131
|
+
$[18] = items;
|
|
132
|
+
$[19] = rows;
|
|
133
|
+
$[20] = t9;
|
|
134
|
+
} else {
|
|
135
|
+
t9 = $[20];
|
|
136
|
+
}
|
|
137
|
+
let t10;
|
|
138
|
+
if ($[24] !== t8 || $[25] !== t9) {
|
|
139
|
+
t10 = /*#__PURE__*/_jsx("div", {
|
|
140
|
+
"data-slot": "chat-virtual-list",
|
|
141
|
+
className: "relative w-full",
|
|
142
|
+
style: t8,
|
|
143
|
+
children: t9
|
|
144
|
+
});
|
|
145
|
+
$[24] = t8;
|
|
146
|
+
$[25] = t9;
|
|
147
|
+
$[26] = t10;
|
|
148
|
+
} else {
|
|
149
|
+
t10 = $[26];
|
|
150
|
+
}
|
|
151
|
+
return t10;
|
|
152
|
+
}
|
|
153
|
+
function _temp() {
|
|
154
|
+
return estimatedTurnHeightPx;
|
|
60
155
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function isComposerBusy(status: ComposerStatus): boolean;
|
|
1
|
+
import { type ComposerStatus } from "./composer-status.js";
|
|
3
2
|
type ComposerSubmitProps = {
|
|
4
3
|
status: ComposerStatus;
|
|
5
4
|
canSend: boolean;
|