@locusgraph/loop 0.3.1 → 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 +6 -5
- package/dist/agent/pulse/marks/bars-mark.js +1 -1
- package/dist/agent/pulse/marks/glyph-mark.js +2 -2
- package/dist/agent/pulse/marks/locus-mark.js +1 -1
- 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 +1 -3
- 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 +135 -200
- package/dist/approval/inbox/inbox.d.ts +3 -3
- package/dist/approval/inbox/inbox.js +180 -139
- package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
- package/dist/approval/inbox/virtual-inbox-list.js +20 -21
- package/dist/approval/memory/memory-review.js +155 -154
- package/dist/approval/memory/memory-row.js +86 -87
- package/dist/approval/plan/plan-review.js +110 -129
- package/dist/approval/plan/plan-step-row.js +7 -6
- 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 +10 -7
- package/dist/approval/plan/question.js +116 -112
- package/dist/approval/run/run-bar.js +43 -40
- 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-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 +134 -126
- package/dist/approval/spend/spend-gate.js +133 -156
- 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 +114 -214
- package/dist/approval/tool/args/args-editor.js +147 -156
- package/dist/approval/tool/args/args-field.js +197 -109
- package/dist/approval/tool/deny-form.js +59 -66
- package/dist/approval/tool/tool-inputs.js +38 -45
- package/dist/chat/chat/chat.js +5 -4
- package/dist/chat/chat/use-stick-to-bottom.js +1 -3
- package/dist/chat/composer/composer-actions.js +4 -1
- package/dist/chat/composer/composer.js +4 -3
- package/dist/chat/composer/use-auto-grow.js +14 -10
- package/dist/chat/files/files.js +12 -10
- 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 +5 -4
- 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 +55 -47
- package/dist/memory/memorized.js +123 -108
- package/dist/memory/recall.js +136 -146
- 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 +135 -100
- 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/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 +67 -37
- 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 +106 -87
- 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 +56 -25
- 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 +8 -5
- package/dist/thread/history/row/thread-item-menu.js +13 -4
- package/dist/thread/history/row/thread-title-editor.js +1 -1
- package/dist/thread/history/virtual-history-list.js +1 -2
- package/dist/thread/index.d.ts +1 -0
- package/dist/thread/index.js +1 -0
- package/dist/thread/starters/starters.js +5 -4
- 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { cn } from "@locusgraph/components";
|
|
5
|
-
import {
|
|
5
|
+
import { useState } from "react";
|
|
6
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
7
|
function isPlainRecord(value) {
|
|
8
8
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -40,14 +40,13 @@ function rawJson(input) {
|
|
|
40
40
|
return JSON.stringify(input, null, 2) ?? "undefined";
|
|
41
41
|
}
|
|
42
42
|
export function ToolInputs(t0) {
|
|
43
|
-
const $ = _c(
|
|
43
|
+
const $ = _c(20);
|
|
44
44
|
const {
|
|
45
45
|
input,
|
|
46
46
|
muted: t1
|
|
47
47
|
} = t0;
|
|
48
48
|
const muted = t1 === undefined ? false : t1;
|
|
49
49
|
const [showRaw, setShowRaw] = useState(false);
|
|
50
|
-
const rawId = useId();
|
|
51
50
|
let entries;
|
|
52
51
|
let t2;
|
|
53
52
|
let t3;
|
|
@@ -57,9 +56,21 @@ export function ToolInputs(t0) {
|
|
|
57
56
|
t2 = "tool-inputs";
|
|
58
57
|
t3 = "flex flex-col gap-2";
|
|
59
58
|
t4 = entries && !showRaw && /*#__PURE__*/_jsxs("dl", {
|
|
60
|
-
className: cn("-
|
|
61
|
-
children: [entries.map(
|
|
62
|
-
|
|
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",
|
|
63
74
|
children: "No inputs."
|
|
64
75
|
})]
|
|
65
76
|
});
|
|
@@ -77,68 +88,50 @@ export function ToolInputs(t0) {
|
|
|
77
88
|
t4 = $[6];
|
|
78
89
|
}
|
|
79
90
|
let t5;
|
|
80
|
-
if ($[7] !== entries || $[8] !== input || $[9] !==
|
|
91
|
+
if ($[7] !== entries || $[8] !== input || $[9] !== showRaw) {
|
|
81
92
|
t5 = (showRaw || !entries) && /*#__PURE__*/_jsx("pre", {
|
|
82
|
-
|
|
83
|
-
className: "overflow-x-auto bg-muted/40 p-3 font-mono text-xs",
|
|
93
|
+
className: "overflow-x-auto font-mono text-xs text-muted-foreground",
|
|
84
94
|
children: rawJson(input)
|
|
85
95
|
});
|
|
86
96
|
$[7] = entries;
|
|
87
97
|
$[8] = input;
|
|
88
|
-
$[9] =
|
|
89
|
-
$[10] =
|
|
90
|
-
$[11] = t5;
|
|
98
|
+
$[9] = showRaw;
|
|
99
|
+
$[10] = t5;
|
|
91
100
|
} else {
|
|
92
|
-
t5 = $[
|
|
101
|
+
t5 = $[10];
|
|
93
102
|
}
|
|
94
103
|
let t6;
|
|
95
|
-
if ($[
|
|
104
|
+
if ($[11] !== entries || $[12] !== showRaw) {
|
|
96
105
|
t6 = entries && /*#__PURE__*/_jsx("button", {
|
|
97
106
|
type: "button",
|
|
98
|
-
className: "
|
|
99
|
-
|
|
100
|
-
"aria-controls": showRaw ? rawId : undefined,
|
|
101
|
-
onClick: () => setShowRaw(_temp2),
|
|
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),
|
|
102
109
|
children: showRaw ? "Show fields" : "Show raw"
|
|
103
110
|
});
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[15] = t6;
|
|
111
|
+
$[11] = entries;
|
|
112
|
+
$[12] = showRaw;
|
|
113
|
+
$[13] = t6;
|
|
108
114
|
} else {
|
|
109
|
-
t6 = $[
|
|
115
|
+
t6 = $[13];
|
|
110
116
|
}
|
|
111
117
|
let t7;
|
|
112
|
-
if ($[
|
|
118
|
+
if ($[14] !== t2 || $[15] !== t3 || $[16] !== t4 || $[17] !== t5 || $[18] !== t6) {
|
|
113
119
|
t7 = /*#__PURE__*/_jsxs("div", {
|
|
114
120
|
"data-slot": t2,
|
|
115
121
|
className: t3,
|
|
116
122
|
children: [t4, t5, t6]
|
|
117
123
|
});
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
+
$[14] = t2;
|
|
125
|
+
$[15] = t3;
|
|
126
|
+
$[16] = t4;
|
|
127
|
+
$[17] = t5;
|
|
128
|
+
$[18] = t6;
|
|
129
|
+
$[19] = t7;
|
|
124
130
|
} else {
|
|
125
|
-
t7 = $[
|
|
131
|
+
t7 = $[19];
|
|
126
132
|
}
|
|
127
133
|
return t7;
|
|
128
134
|
}
|
|
129
|
-
function
|
|
135
|
+
function _temp(current) {
|
|
130
136
|
return !current;
|
|
131
137
|
}
|
|
132
|
-
function _temp(t0) {
|
|
133
|
-
const [key, value] = t0;
|
|
134
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
135
|
-
className: "grid grid-cols-[minmax(0,8.5rem)_minmax(0,1fr)] items-baseline gap-3 px-5 py-2.5",
|
|
136
|
-
children: [/*#__PURE__*/_jsx("dt", {
|
|
137
|
-
className: "text-xs text-muted-foreground",
|
|
138
|
-
children: humanizeKey(key)
|
|
139
|
-
}), /*#__PURE__*/_jsx("dd", {
|
|
140
|
-
className: "font-mono text-sm break-words",
|
|
141
|
-
children: readableValue(value)
|
|
142
|
-
})]
|
|
143
|
-
}, key);
|
|
144
|
-
}
|
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]
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { prefersReducedMotion } from "../../shared/reduced-motion.js";
|
|
5
6
|
const bottomThresholdPx = 48;
|
|
6
7
|
function distanceFromBottom(element) {
|
|
7
8
|
return element.scrollHeight - element.scrollTop - element.clientHeight;
|
|
8
9
|
}
|
|
9
|
-
function prefersReducedMotion() {
|
|
10
|
-
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
11
|
-
}
|
|
12
10
|
function scrolledUpByReader(viewport, previous) {
|
|
13
11
|
return viewport.scrollTop < previous.top && viewport.scrollHeight === previous.height;
|
|
14
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { ArrowUp as ArrowUpIcon, Attachment as PaperclipIcon, StopFilledAlt as SquareIcon } from "@carbon/icons-react";
|
|
5
4
|
import { Button } from "@locusgraph/components";
|
|
5
|
+
import { ArrowUp as ArrowUpIcon, Paperclip as PaperclipIcon, Stop as SquareIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { useRef } from "react";
|
|
7
7
|
import { isComposerBusy } from "./composer-status.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -18,6 +18,7 @@ export function ComposerSubmit(t0) {
|
|
|
18
18
|
let t2;
|
|
19
19
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
20
20
|
t2 = /*#__PURE__*/_jsx(SquareIcon, {
|
|
21
|
+
weight: "fill",
|
|
21
22
|
"aria-hidden": "true",
|
|
22
23
|
className: "size-2.5 fill-current"
|
|
23
24
|
});
|
|
@@ -49,6 +50,7 @@ export function ComposerSubmit(t0) {
|
|
|
49
50
|
let t2;
|
|
50
51
|
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
51
52
|
t2 = /*#__PURE__*/_jsx(ArrowUpIcon, {
|
|
53
|
+
weight: "bold",
|
|
52
54
|
"aria-hidden": "true"
|
|
53
55
|
});
|
|
54
56
|
$[4] = t2;
|
|
@@ -117,6 +119,7 @@ export function ComposerAttachButton(t0) {
|
|
|
117
119
|
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
118
120
|
t3 = () => inputRef.current?.click();
|
|
119
121
|
t4 = /*#__PURE__*/_jsx(PaperclipIcon, {
|
|
122
|
+
weight: "bold",
|
|
120
123
|
"aria-hidden": "true"
|
|
121
124
|
});
|
|
122
125
|
$[5] = t3;
|
|
@@ -158,7 +158,7 @@ export function Composer(t0) {
|
|
|
158
158
|
const t12 = isBusy || undefined;
|
|
159
159
|
let t13;
|
|
160
160
|
if ($[34] !== className) {
|
|
161
|
-
t13 = cn("flex flex-col bg-card text-card-foreground ring-1 ring-border transition-shadow focus-within:ring-
|
|
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);
|
|
162
162
|
$[34] = className;
|
|
163
163
|
$[35] = t13;
|
|
164
164
|
} else {
|
|
@@ -223,7 +223,7 @@ export function Composer(t0) {
|
|
|
223
223
|
rows: 1,
|
|
224
224
|
onChange: t18,
|
|
225
225
|
onKeyDown: t19,
|
|
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-
|
|
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"
|
|
227
227
|
});
|
|
228
228
|
$[44] = disabled;
|
|
229
229
|
$[45] = label;
|
|
@@ -271,7 +271,8 @@ export function Composer(t0) {
|
|
|
271
271
|
if ($[62] !== disabled || $[63] !== modelSlot) {
|
|
272
272
|
t23 = modelSlot && /*#__PURE__*/_jsx("div", {
|
|
273
273
|
"data-slot": "composer-model",
|
|
274
|
-
|
|
274
|
+
inert: disabled || undefined,
|
|
275
|
+
className: cn("min-w-0", disabled && "opacity-50"),
|
|
275
276
|
children: modelSlot
|
|
276
277
|
});
|
|
277
278
|
$[62] = disabled;
|
|
@@ -6,26 +6,30 @@ function supportsFieldSizing() {
|
|
|
6
6
|
return typeof CSS !== "undefined" && CSS.supports?.("field-sizing", "content") === true;
|
|
7
7
|
}
|
|
8
8
|
export function useAutoGrow(textareaRef, text) {
|
|
9
|
-
const $ = _c(
|
|
9
|
+
const $ = _c(5);
|
|
10
10
|
let t0;
|
|
11
|
-
|
|
12
|
-
if ($[0] !== text || $[1] !== textareaRef) {
|
|
11
|
+
if ($[0] !== textareaRef) {
|
|
13
12
|
t0 = () => {
|
|
14
13
|
const textarea = textareaRef.current;
|
|
15
|
-
if (!textarea || supportsFieldSizing()
|
|
14
|
+
if (!textarea || supportsFieldSizing()) {
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
17
|
textarea.style.height = "auto";
|
|
19
18
|
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
20
19
|
};
|
|
20
|
+
$[0] = textareaRef;
|
|
21
|
+
$[1] = t0;
|
|
22
|
+
} else {
|
|
23
|
+
t0 = $[1];
|
|
24
|
+
}
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[2] !== text || $[3] !== textareaRef) {
|
|
21
27
|
t1 = [textareaRef, text];
|
|
22
|
-
$[
|
|
23
|
-
$[
|
|
24
|
-
$[
|
|
25
|
-
$[3] = t1;
|
|
28
|
+
$[2] = text;
|
|
29
|
+
$[3] = textareaRef;
|
|
30
|
+
$[4] = t1;
|
|
26
31
|
} else {
|
|
27
|
-
|
|
28
|
-
t1 = $[3];
|
|
32
|
+
t1 = $[4];
|
|
29
33
|
}
|
|
30
34
|
useLayoutEffect(t0, t1);
|
|
31
35
|
}
|
package/dist/chat/files/files.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { Code as FileCodeIcon, DocumentBlank as FileIcon, DataTable as FileSpreadsheetIcon, Document as FileTextIcon, Close as XIcon } from "@carbon/icons-react";
|
|
5
4
|
import { cn } from "@locusgraph/components";
|
|
5
|
+
import { FileCode as FileCodeIcon, File as FileIcon, Table as FileSpreadsheetIcon, FileText as FileTextIcon, X as XIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { fileExtensionLabel, formatBytes, isImageFile } from "./file-meta.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const iconsByMediaType = [[/csv|spreadsheet|excel/, FileSpreadsheetIcon], [/json|javascript|typescript|xml|x-python/, FileCodeIcon], [/text|pdf|markdown|word/, FileTextIcon]];
|
|
@@ -30,10 +30,10 @@ function FilePreview(t0) {
|
|
|
30
30
|
t1 = $[1];
|
|
31
31
|
}
|
|
32
32
|
const Icon = t1;
|
|
33
|
-
const t2 = isGrid ? "aspect-[16/10] w-full" : "size-
|
|
33
|
+
const t2 = isGrid ? "aspect-[16/10] w-full" : "size-9";
|
|
34
34
|
let t3;
|
|
35
35
|
if ($[2] !== t2) {
|
|
36
|
-
t3 = cn("grid shrink-0 place-items-center overflow-hidden bg-muted text-
|
|
36
|
+
t3 = cn("grid shrink-0 place-items-center overflow-hidden bg-muted text-faint", t2);
|
|
37
37
|
$[2] = t2;
|
|
38
38
|
$[3] = t3;
|
|
39
39
|
} else {
|
|
@@ -47,6 +47,7 @@ function FilePreview(t0) {
|
|
|
47
47
|
loading: "lazy",
|
|
48
48
|
className: "size-full object-cover"
|
|
49
49
|
}) : /*#__PURE__*/_jsx(Icon, {
|
|
50
|
+
weight: "bold",
|
|
50
51
|
"aria-hidden": "true",
|
|
51
52
|
className: isGrid ? "size-6" : "size-4"
|
|
52
53
|
});
|
|
@@ -89,10 +90,10 @@ function RemoveButton(t0) {
|
|
|
89
90
|
} else {
|
|
90
91
|
t2 = $[2];
|
|
91
92
|
}
|
|
92
|
-
const t3 = isGrid && "absolute top-1 right-1 bg-
|
|
93
|
+
const t3 = isGrid && "absolute top-1 right-1 bg-background/80";
|
|
93
94
|
let t4;
|
|
94
95
|
if ($[3] !== t3) {
|
|
95
|
-
t4 = cn("grid size-
|
|
96
|
+
t4 = cn("grid size-control-xs shrink-0 place-items-center text-faint opacity-0 locus-focus-ring transition-[color,opacity] group-hover/file:opacity-100 hover:text-interactive focus-visible:opacity-100 [@media(hover:none)]:opacity-100 motion-reduce:transition-none", t3);
|
|
96
97
|
$[3] = t3;
|
|
97
98
|
$[4] = t4;
|
|
98
99
|
} else {
|
|
@@ -101,6 +102,7 @@ function RemoveButton(t0) {
|
|
|
101
102
|
let t5;
|
|
102
103
|
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
103
104
|
t5 = /*#__PURE__*/_jsx(XIcon, {
|
|
105
|
+
weight: "bold",
|
|
104
106
|
"aria-hidden": "true",
|
|
105
107
|
className: "size-3.5"
|
|
106
108
|
});
|
|
@@ -142,11 +144,11 @@ function FileChip(t0) {
|
|
|
142
144
|
t1 = $[1];
|
|
143
145
|
}
|
|
144
146
|
const description = t1;
|
|
145
|
-
const t2 = isGrid ? "flex-col" : "
|
|
147
|
+
const t2 = isGrid ? "flex-col" : "max-w-60 items-center gap-2.5 py-1.5 pr-1.5 pl-1.5";
|
|
146
148
|
const t3 = !isGrid && !onRemove && "pr-3";
|
|
147
149
|
let t4;
|
|
148
150
|
if ($[2] !== t2 || $[3] !== t3) {
|
|
149
|
-
t4 = cn("relative flex min-w-0 bg-
|
|
151
|
+
t4 = cn("group/file relative flex min-w-0 bg-muted/50 text-foreground", t2, t3);
|
|
150
152
|
$[2] = t2;
|
|
151
153
|
$[3] = t3;
|
|
152
154
|
$[4] = t4;
|
|
@@ -165,7 +167,7 @@ function FileChip(t0) {
|
|
|
165
167
|
} else {
|
|
166
168
|
t5 = $[7];
|
|
167
169
|
}
|
|
168
|
-
const t6 = isGrid && "px-
|
|
170
|
+
const t6 = isGrid && "px-3 py-2.5";
|
|
169
171
|
let t7;
|
|
170
172
|
if ($[8] !== t6) {
|
|
171
173
|
t7 = cn("flex min-w-0 flex-1 flex-col gap-0.5", t6);
|
|
@@ -178,7 +180,7 @@ function FileChip(t0) {
|
|
|
178
180
|
if ($[10] !== item.name) {
|
|
179
181
|
t8 = /*#__PURE__*/_jsx("span", {
|
|
180
182
|
title: item.name,
|
|
181
|
-
className: "truncate text-
|
|
183
|
+
className: "truncate text-sm leading-tight font-medium",
|
|
182
184
|
children: item.name
|
|
183
185
|
});
|
|
184
186
|
$[10] = item.name;
|
|
@@ -189,7 +191,7 @@ function FileChip(t0) {
|
|
|
189
191
|
let t9;
|
|
190
192
|
if ($[12] !== description) {
|
|
191
193
|
t9 = description && /*#__PURE__*/_jsx("span", {
|
|
192
|
-
className: "truncate
|
|
194
|
+
className: "truncate text-xs leading-tight text-faint tabular-nums",
|
|
193
195
|
children: description
|
|
194
196
|
});
|
|
195
197
|
$[12] = description;
|
|
@@ -1,142 +1,35 @@
|
|
|
1
|
-
import { cn } from "@locusgraph/components";
|
|
2
1
|
import { FencedCode, fencedCode } from "./fenced-code.js";
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
const blockGap = "mt-4 first:mt-0";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
3
|
export const markdownComponents = {
|
|
6
|
-
p: ({
|
|
7
|
-
node: _node,
|
|
8
|
-
className,
|
|
9
|
-
...props
|
|
10
|
-
}) => /*#__PURE__*/_jsx("p", {
|
|
11
|
-
className: cn("leading-relaxed text-pretty [&:not(:first-child)]:mt-3", className),
|
|
12
|
-
...props
|
|
13
|
-
}),
|
|
14
4
|
a: ({
|
|
15
5
|
node: _node,
|
|
16
|
-
|
|
6
|
+
children,
|
|
17
7
|
...props
|
|
18
|
-
}) => /*#__PURE__*/
|
|
8
|
+
}) => /*#__PURE__*/_jsxs("a", {
|
|
19
9
|
target: "_blank",
|
|
20
10
|
rel: "noopener noreferrer",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
className,
|
|
27
|
-
...props
|
|
28
|
-
}) => /*#__PURE__*/_jsx("h1", {
|
|
29
|
-
className: cn("mt-7 mb-2 text-base font-semibold tracking-tight first:mt-0", className),
|
|
30
|
-
...props
|
|
31
|
-
}),
|
|
32
|
-
h2: ({
|
|
33
|
-
node: _node,
|
|
34
|
-
className,
|
|
35
|
-
...props
|
|
36
|
-
}) => /*#__PURE__*/_jsx("h2", {
|
|
37
|
-
className: cn("mt-6 mb-2 text-base font-semibold tracking-tight first:mt-0", className),
|
|
38
|
-
...props
|
|
39
|
-
}),
|
|
40
|
-
h3: ({
|
|
41
|
-
node: _node,
|
|
42
|
-
className,
|
|
43
|
-
...props
|
|
44
|
-
}) => /*#__PURE__*/_jsx("h3", {
|
|
45
|
-
className: cn("mt-5 mb-1.5 text-sm font-semibold first:mt-0", className),
|
|
46
|
-
...props
|
|
47
|
-
}),
|
|
48
|
-
h4: ({
|
|
49
|
-
node: _node,
|
|
50
|
-
className,
|
|
51
|
-
...props
|
|
52
|
-
}) => /*#__PURE__*/_jsx("h4", {
|
|
53
|
-
className: cn("locus-eyebrow mt-5 mb-1.5 first:mt-0", className),
|
|
54
|
-
...props
|
|
55
|
-
}),
|
|
56
|
-
ul: ({
|
|
57
|
-
node: _node,
|
|
58
|
-
className,
|
|
59
|
-
...props
|
|
60
|
-
}) => /*#__PURE__*/_jsx("ul", {
|
|
61
|
-
className: cn("mt-3 list-disc space-y-1.5 pl-5 first:mt-0 [li_&]:mt-1.5", className),
|
|
62
|
-
...props
|
|
63
|
-
}),
|
|
64
|
-
ol: ({
|
|
65
|
-
node: _node,
|
|
66
|
-
className,
|
|
67
|
-
...props
|
|
68
|
-
}) => /*#__PURE__*/_jsx("ol", {
|
|
69
|
-
className: cn("mt-3 list-decimal space-y-1.5 pl-5 first:mt-0 marker:tabular-nums [li_&]:mt-1.5", className),
|
|
70
|
-
...props
|
|
71
|
-
}),
|
|
72
|
-
li: ({
|
|
73
|
-
node: _node,
|
|
74
|
-
className,
|
|
75
|
-
...props
|
|
76
|
-
}) => /*#__PURE__*/_jsx("li", {
|
|
77
|
-
className: cn("pl-1 leading-relaxed marker:text-muted-foreground [&>p]:mt-0", className),
|
|
78
|
-
...props
|
|
79
|
-
}),
|
|
80
|
-
blockquote: ({
|
|
81
|
-
node: _node,
|
|
82
|
-
className,
|
|
83
|
-
...props
|
|
84
|
-
}) => /*#__PURE__*/_jsx("blockquote", {
|
|
85
|
-
className: cn("border-l-2 border-border pl-4 text-muted-foreground", blockGap, className),
|
|
86
|
-
...props
|
|
87
|
-
}),
|
|
88
|
-
hr: ({
|
|
89
|
-
node: _node,
|
|
90
|
-
className,
|
|
91
|
-
...props
|
|
92
|
-
}) => /*#__PURE__*/_jsx("hr", {
|
|
93
|
-
className: cn("my-6 border-border", className),
|
|
94
|
-
...props
|
|
11
|
+
...props,
|
|
12
|
+
children: [children, /*#__PURE__*/_jsx("span", {
|
|
13
|
+
className: "sr-only",
|
|
14
|
+
children: ", opens in a new tab"
|
|
15
|
+
})]
|
|
95
16
|
}),
|
|
96
17
|
pre: ({
|
|
97
18
|
node,
|
|
98
|
-
className,
|
|
99
19
|
...props
|
|
100
20
|
}) => fencedCode(node) ? /*#__PURE__*/_jsx(FencedCode, {
|
|
101
21
|
node: node
|
|
102
22
|
}) : /*#__PURE__*/_jsx("pre", {
|
|
103
|
-
className: cn("overflow-x-auto bg-muted/40 p-3 font-mono text-xs leading-relaxed", blockGap, className),
|
|
104
|
-
...props
|
|
105
|
-
}),
|
|
106
|
-
code: ({
|
|
107
|
-
node: _node,
|
|
108
|
-
className,
|
|
109
|
-
...props
|
|
110
|
-
}) => /*#__PURE__*/_jsx("code", {
|
|
111
|
-
className: cn("bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground [pre_&]:bg-transparent [pre_&]:p-0", className),
|
|
112
23
|
...props
|
|
113
24
|
}),
|
|
114
25
|
table: ({
|
|
115
26
|
node: _node,
|
|
116
|
-
className,
|
|
117
27
|
...props
|
|
118
28
|
}) => /*#__PURE__*/_jsx("div", {
|
|
119
29
|
"data-slot": "reply-table",
|
|
120
|
-
className:
|
|
30
|
+
className: "typeset-scroll",
|
|
121
31
|
children: /*#__PURE__*/_jsx("table", {
|
|
122
|
-
className: cn("w-full border-collapse text-sm [&_td:not(:first-child)]:tabular-nums", className),
|
|
123
32
|
...props
|
|
124
33
|
})
|
|
125
|
-
}),
|
|
126
|
-
th: ({
|
|
127
|
-
node: _node,
|
|
128
|
-
className,
|
|
129
|
-
...props
|
|
130
|
-
}) => /*#__PURE__*/_jsx("th", {
|
|
131
|
-
className: cn("locus-eyebrow border-b bg-muted/30 px-3 py-2 text-left font-normal", className),
|
|
132
|
-
...props
|
|
133
|
-
}),
|
|
134
|
-
td: ({
|
|
135
|
-
node: _node,
|
|
136
|
-
className,
|
|
137
|
-
...props
|
|
138
|
-
}) => /*#__PURE__*/_jsx("td", {
|
|
139
|
-
className: cn("border-b px-3 py-2 align-top [tr:last-child_&]:border-b-0", className),
|
|
140
|
-
...props
|
|
141
34
|
})
|
|
142
35
|
};
|
package/dist/chat/reply/reply.js
CHANGED
|
@@ -31,8 +31,8 @@ export function Reply({
|
|
|
31
31
|
return /*#__PURE__*/_jsx("div", {
|
|
32
32
|
"data-slot": "reply",
|
|
33
33
|
"data-state": state,
|
|
34
|
-
"aria-
|
|
35
|
-
className: cn("
|
|
34
|
+
"aria-busy": isStreaming || undefined,
|
|
35
|
+
className: cn("typeset locus-typeset-chat min-w-0 text-pretty", streamingCaret, className),
|
|
36
36
|
...props,
|
|
37
37
|
children: /*#__PURE__*/_jsx(Markdown, {
|
|
38
38
|
markdown: markdown
|
|
@@ -19,6 +19,7 @@ export type PartSegment = {
|
|
|
19
19
|
kind: "sources";
|
|
20
20
|
key: string;
|
|
21
21
|
parts: SourceUrlPart[];
|
|
22
|
+
firstIndex: number;
|
|
22
23
|
};
|
|
23
24
|
export declare function isToolPart(part: MessagePart): part is ToolPart;
|
|
24
25
|
export declare function groupParts(parts: MessagePart[]): PartSegment[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function isToolPart(part) {
|
|
2
2
|
return part.type === "dynamic-tool" || part.type.startsWith("tool-");
|
|
3
3
|
}
|
|
4
|
-
function appendToRun(segments, kind, part, key) {
|
|
4
|
+
function appendToRun(segments, kind, part, key, firstIndex = 1) {
|
|
5
5
|
const previous = segments.at(-1);
|
|
6
6
|
if (previous?.kind === kind) {
|
|
7
7
|
previous.parts.push(part);
|
|
@@ -14,11 +14,13 @@ function appendToRun(segments, kind, part, key) {
|
|
|
14
14
|
} : {
|
|
15
15
|
kind,
|
|
16
16
|
key,
|
|
17
|
-
parts: [part]
|
|
17
|
+
parts: [part],
|
|
18
|
+
firstIndex
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
export function groupParts(parts) {
|
|
21
22
|
const segments = [];
|
|
23
|
+
let sourcesSeen = 0;
|
|
22
24
|
parts.forEach((part, index) => {
|
|
23
25
|
const key = `${part.type}:${index}`;
|
|
24
26
|
if (part.type === "text") {
|
|
@@ -36,7 +38,8 @@ export function groupParts(parts) {
|
|
|
36
38
|
} else if (part.type === "file") {
|
|
37
39
|
appendToRun(segments, "files", part, key);
|
|
38
40
|
} else if (part.type === "source-url") {
|
|
39
|
-
|
|
41
|
+
sourcesSeen += 1;
|
|
42
|
+
appendToRun(segments, "sources", part, key, sourcesSeen);
|
|
40
43
|
} else if (isToolPart(part)) {
|
|
41
44
|
segments.push({
|
|
42
45
|
kind: "tool",
|
package/dist/chat/turn/turn.js
CHANGED
|
@@ -26,10 +26,17 @@ function partClassName(role, kind) {
|
|
|
26
26
|
return "w-full items-end";
|
|
27
27
|
}
|
|
28
28
|
if (role === "system") {
|
|
29
|
-
return "
|
|
29
|
+
return "*:data-[slot=reply]:text-xs *:data-[slot=reply]:text-faint";
|
|
30
30
|
}
|
|
31
31
|
return cn(kind === "text" && "*:data-[slot=reply]:max-w-[68ch]");
|
|
32
32
|
}
|
|
33
|
+
const lineKinds = new Set(["reasoning", "tool", "sources"]);
|
|
34
|
+
function followsLine(segments, position) {
|
|
35
|
+
const previous = segments[position - 1];
|
|
36
|
+
const current = segments[position];
|
|
37
|
+
if (!previous || !current) return false;
|
|
38
|
+
return lineKinds.has(previous.kind) && lineKinds.has(current.kind);
|
|
39
|
+
}
|
|
33
40
|
function renderSegment(segment, isUser, renderers) {
|
|
34
41
|
switch (segment.kind) {
|
|
35
42
|
case "text":
|
|
@@ -51,7 +58,8 @@ function renderSegment(segment, isUser, renderers) {
|
|
|
51
58
|
});
|
|
52
59
|
case "sources":
|
|
53
60
|
return renderers.renderSources ? renderers.renderSources(segment.parts) : /*#__PURE__*/_jsx(Sources, {
|
|
54
|
-
sources: segment.parts
|
|
61
|
+
sources: segment.parts,
|
|
62
|
+
firstIndex: segment.firstIndex
|
|
55
63
|
});
|
|
56
64
|
case "files":
|
|
57
65
|
return /*#__PURE__*/_jsx(Files, {
|
|
@@ -88,10 +96,11 @@ export function Turn({
|
|
|
88
96
|
children: avatar
|
|
89
97
|
}), /*#__PURE__*/_jsxs(MessageContent, {
|
|
90
98
|
className: cn("gap-4", isUser && "items-end gap-2"),
|
|
91
|
-
children: [groupParts(message.parts).map(segment => /*#__PURE__*/_jsx("div", {
|
|
99
|
+
children: [groupParts(message.parts).map((segment, position, segments) => /*#__PURE__*/_jsx("div", {
|
|
92
100
|
"data-slot": "message-part",
|
|
93
101
|
"data-kind": segment.kind,
|
|
94
|
-
|
|
102
|
+
"data-follows-line": followsLine(segments, position) || undefined,
|
|
103
|
+
className: cn("flex min-w-0 flex-col data-follows-line:-mt-3", partClassName(message.role, segment.kind)),
|
|
95
104
|
children: renderSegment(segment, isUser, renderers)
|
|
96
105
|
}, segment.key)), footer && /*#__PURE__*/_jsx(MessageFooter, {
|
|
97
106
|
className: "px-0",
|