@locusgraph/loop 0.3.1 → 0.4.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/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
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./pulse/pulse.js";
|
|
2
2
|
export * from "./steps/steps.js";
|
|
3
3
|
export * from "./thinking/thinking.js";
|
|
4
|
-
export { Tool, type ToolProps } from "./tool/tool.js";
|
|
4
|
+
export { Tool, type ToolProps, type ToolTone } from "./tool/tool.js";
|
|
5
5
|
export { toolStateLabels } from "./tool/tool-status.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { AiGenerate as SparkleIcon } from "@carbon/icons-react";
|
|
5
4
|
import { cn } from "@locusgraph/components";
|
|
5
|
+
import { StarFour as SparkleIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { useLoopAnimation } from "./use-loop-animation.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const drift = [{
|
|
@@ -18,12 +18,12 @@ const turn = [{
|
|
|
18
18
|
transform: "rotate(360deg) scale(1)"
|
|
19
19
|
}];
|
|
20
20
|
const toneIcon = {
|
|
21
|
-
neutral: "fill-foreground
|
|
22
|
-
brand: "fill-
|
|
21
|
+
neutral: "fill-muted-foreground text-muted-foreground",
|
|
22
|
+
brand: "fill-memory text-memory"
|
|
23
23
|
};
|
|
24
24
|
const toneText = {
|
|
25
|
-
neutral: "bg-[linear-gradient(90deg,var(--color-
|
|
26
|
-
brand: "bg-[linear-gradient(90deg,var(--color-
|
|
25
|
+
neutral: "bg-[linear-gradient(90deg,var(--color-faint)_25%,var(--color-foreground)_50%,var(--color-faint)_75%)]",
|
|
26
|
+
brand: "bg-[linear-gradient(90deg,var(--color-interactive),var(--color-memory),var(--locus-s5),var(--color-interactive))]"
|
|
27
27
|
};
|
|
28
28
|
export function GradientLabel(t0) {
|
|
29
29
|
const $ = _c(14);
|
|
@@ -46,6 +46,7 @@ export function GradientLabel(t0) {
|
|
|
46
46
|
let t4;
|
|
47
47
|
if ($[2] !== icon || $[3] !== t3) {
|
|
48
48
|
t4 = /*#__PURE__*/_jsx(SparkleIcon, {
|
|
49
|
+
weight: "fill",
|
|
49
50
|
ref: icon,
|
|
50
51
|
"aria-hidden": true,
|
|
51
52
|
className: t3
|
|
@@ -37,7 +37,7 @@ export function BarsMark() {
|
|
|
37
37
|
t0 = /*#__PURE__*/_jsx("span", {
|
|
38
38
|
"aria-hidden": true,
|
|
39
39
|
"data-slot": "pulse-bars",
|
|
40
|
-
className: "inline-flex h-[1em] items-center gap-[0.14em] text-foreground
|
|
40
|
+
className: "inline-flex h-[1em] items-center gap-[0.14em] text-muted-foreground",
|
|
41
41
|
children: barDelays.map(_temp)
|
|
42
42
|
});
|
|
43
43
|
$[0] = t0;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { cn } from "@locusgraph/components";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
|
-
import { prefersReducedMotion } from "
|
|
6
|
+
import { prefersReducedMotion } from "../../../shared/reduced-motion.js";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const glyphs = ["·", "✢", "✳", "✶", "✻", "✽", "✻", "✶", "✳", "✢"];
|
|
9
9
|
const restingGlyph = "✻";
|
|
@@ -33,7 +33,7 @@ export function GlyphMark(t0) {
|
|
|
33
33
|
t3 = $[1];
|
|
34
34
|
}
|
|
35
35
|
useEffect(t2, t3);
|
|
36
|
-
const t4 = tone === "brand" ? "text-
|
|
36
|
+
const t4 = tone === "brand" ? "text-[var(--locus-s2)]" : "text-muted-foreground";
|
|
37
37
|
let t5;
|
|
38
38
|
if ($[2] !== t4) {
|
|
39
39
|
t5 = cn("inline-flex w-[1.1em] justify-center font-mono text-[1.15em] leading-none", t4);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { LocusGraphMark } from "@locusgraph/brand";
|
|
5
5
|
import { useEffect, useRef } from "react";
|
|
6
|
-
import { prefersReducedMotion } from "
|
|
6
|
+
import { prefersReducedMotion } from "../../../shared/reduced-motion.js";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
const sweepMs = 1800;
|
|
9
9
|
const markCenter = {
|
|
@@ -13,7 +13,7 @@ function TypingDots() {
|
|
|
13
13
|
"aria-hidden": true,
|
|
14
14
|
className: "flex h-5 items-center gap-1",
|
|
15
15
|
children: dotDelays.map(delay => /*#__PURE__*/_jsx("span", {
|
|
16
|
-
className: cn("size-1.5 rounded-full bg-muted-foreground
|
|
16
|
+
className: cn("size-1.5 rounded-full bg-muted-foreground motion-safe:animate-pulse", delay)
|
|
17
17
|
}, delay))
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
|
-
|
|
6
|
-
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
7
|
-
}
|
|
5
|
+
import { prefersReducedMotion } from "../../shared/reduced-motion.js";
|
|
8
6
|
export function useLoopAnimation(keyframes, duration, t0, t1) {
|
|
9
7
|
const $ = _c(6);
|
|
10
8
|
const delay = t0 === undefined ? 0 : t0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Checkmark as CheckIcon, InProgress as LoaderCircleIcon, Subtract as MinusIcon, Close as XIcon } from "@carbon/icons-react";
|
|
2
1
|
import { cn } from "@locusgraph/components";
|
|
2
|
+
import { Check as CheckIcon, CircleNotch as LoaderCircleIcon, Minus as MinusIcon, X as XIcon } from "@phosphor-icons/react/ssr";
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export const stepStatusLabels = {
|
|
5
5
|
pending: "Pending",
|
|
@@ -8,29 +8,36 @@ export const stepStatusLabels = {
|
|
|
8
8
|
failed: "Failed",
|
|
9
9
|
skipped: "Skipped"
|
|
10
10
|
};
|
|
11
|
-
const
|
|
12
|
-
pending: "
|
|
13
|
-
running: "
|
|
14
|
-
done: "
|
|
15
|
-
failed: "
|
|
16
|
-
skipped: "
|
|
11
|
+
const stepIconTones = {
|
|
12
|
+
pending: "text-faint",
|
|
13
|
+
running: "text-warn",
|
|
14
|
+
done: "text-good",
|
|
15
|
+
failed: "text-destructive",
|
|
16
|
+
skipped: "text-faint"
|
|
17
17
|
};
|
|
18
18
|
function StepGlyph({
|
|
19
19
|
status
|
|
20
20
|
}) {
|
|
21
21
|
if (status === "running") return /*#__PURE__*/_jsx(LoaderCircleIcon, {
|
|
22
|
-
|
|
22
|
+
weight: "bold",
|
|
23
|
+
"aria-hidden": true,
|
|
24
|
+
className: "motion-safe:animate-spin"
|
|
23
25
|
});
|
|
24
26
|
if (status === "done") return /*#__PURE__*/_jsx(CheckIcon, {
|
|
25
|
-
|
|
27
|
+
weight: "bold",
|
|
28
|
+
"aria-hidden": true
|
|
26
29
|
});
|
|
27
30
|
if (status === "failed") return /*#__PURE__*/_jsx(XIcon, {
|
|
28
|
-
|
|
31
|
+
weight: "bold",
|
|
32
|
+
"aria-hidden": true
|
|
29
33
|
});
|
|
30
34
|
if (status === "skipped") return /*#__PURE__*/_jsx(MinusIcon, {
|
|
31
|
-
|
|
35
|
+
weight: "bold",
|
|
36
|
+
"aria-hidden": true
|
|
37
|
+
});
|
|
38
|
+
return /*#__PURE__*/_jsx("span", {
|
|
39
|
+
className: "size-1.5 rounded-full bg-current"
|
|
32
40
|
});
|
|
33
|
-
return null;
|
|
34
41
|
}
|
|
35
42
|
export function StepIcon({
|
|
36
43
|
status,
|
|
@@ -39,7 +46,7 @@ export function StepIcon({
|
|
|
39
46
|
return /*#__PURE__*/_jsx("span", {
|
|
40
47
|
"aria-hidden": true,
|
|
41
48
|
"data-slot": "step-icon",
|
|
42
|
-
className: cn("
|
|
49
|
+
className: cn("flex size-4 shrink-0 items-center justify-center [&_svg]:size-3.5", stepIconTones[status], current && status === "pending" && "text-foreground"),
|
|
43
50
|
children: /*#__PURE__*/_jsx(StepGlyph, {
|
|
44
51
|
status: status
|
|
45
52
|
})
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ListChecked as ListChecksIcon } from "@carbon/icons-react";
|
|
2
1
|
import { cn } from "@locusgraph/components";
|
|
3
|
-
import {
|
|
2
|
+
import { ListChecks as ListChecksIcon } from "@phosphor-icons/react/ssr";
|
|
3
|
+
import { lineIconClass, lineRowClass } from "../../shared/line.js";
|
|
4
4
|
import { StepIcon, stepStatusLabels } from "./step-icon.js";
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
const stepTitleTones = {
|
|
7
|
-
pending: "text-
|
|
8
|
-
running: "text-foreground
|
|
9
|
-
done: "text-foreground",
|
|
10
|
-
failed: "text-foreground
|
|
11
|
-
skipped: "text-
|
|
7
|
+
pending: "text-faint",
|
|
8
|
+
running: "font-medium text-foreground",
|
|
9
|
+
done: "text-muted-foreground",
|
|
10
|
+
failed: "font-medium text-foreground",
|
|
11
|
+
skipped: "text-faint line-through decoration-faint"
|
|
12
12
|
};
|
|
13
13
|
function currentStepId(steps) {
|
|
14
14
|
const running = steps.find(step => step.status === "running");
|
|
@@ -20,38 +20,31 @@ function progressLabel(steps) {
|
|
|
20
20
|
const done = steps.filter(step => step.status === "done").length;
|
|
21
21
|
return `${done} of ${steps.length} done`;
|
|
22
22
|
}
|
|
23
|
-
function progressTone(steps) {
|
|
24
|
-
if (steps.some(step => step.status === "failed")) return "danger";
|
|
25
|
-
if (steps.some(step => step.status === "running")) return "waiting";
|
|
26
|
-
const settled = steps.every(step => step.status === "done" || step.status === "skipped");
|
|
27
|
-
return steps.length > 0 && settled ? "done" : "idle";
|
|
28
|
-
}
|
|
29
23
|
function StepRow({
|
|
30
24
|
step,
|
|
31
|
-
current
|
|
32
|
-
last
|
|
25
|
+
current
|
|
33
26
|
}) {
|
|
34
27
|
return /*#__PURE__*/_jsxs("li", {
|
|
35
28
|
"data-slot": "step",
|
|
36
29
|
"data-status": step.status,
|
|
37
30
|
"aria-current": current ? "step" : undefined,
|
|
38
|
-
className: "
|
|
39
|
-
children: [
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
className: "flex gap-2 py-1",
|
|
32
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
33
|
+
className: "flex h-5 items-center",
|
|
34
|
+
children: /*#__PURE__*/_jsx(StepIcon, {
|
|
35
|
+
status: step.status,
|
|
36
|
+
current: current
|
|
37
|
+
})
|
|
45
38
|
}), /*#__PURE__*/_jsxs("div", {
|
|
46
39
|
className: "flex min-w-0 flex-col gap-0.5",
|
|
47
40
|
children: [/*#__PURE__*/_jsxs("span", {
|
|
48
|
-
className: cn("
|
|
41
|
+
className: cn("leading-5", stepTitleTones[step.status], current && step.status === "pending" && "text-foreground"),
|
|
49
42
|
children: [step.title, /*#__PURE__*/_jsxs("span", {
|
|
50
43
|
className: "sr-only",
|
|
51
44
|
children: [" (", stepStatusLabels[step.status], ")"]
|
|
52
45
|
})]
|
|
53
46
|
}), step.detail && /*#__PURE__*/_jsx("span", {
|
|
54
|
-
className: cn("
|
|
47
|
+
className: cn("text-xs text-faint", step.status === "failed" && "text-destructive"),
|
|
55
48
|
children: step.detail
|
|
56
49
|
})]
|
|
57
50
|
})]
|
|
@@ -63,23 +56,32 @@ export function Steps({
|
|
|
63
56
|
className
|
|
64
57
|
}) {
|
|
65
58
|
const currentId = currentStepId(steps);
|
|
66
|
-
return /*#__PURE__*/_jsxs(
|
|
59
|
+
return /*#__PURE__*/_jsxs("section", {
|
|
67
60
|
"data-slot": "steps",
|
|
68
61
|
"aria-label": title,
|
|
69
|
-
className: className,
|
|
70
|
-
children: [/*#__PURE__*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
className: cn("flex min-w-0 flex-col", className),
|
|
63
|
+
children: [/*#__PURE__*/_jsxs("header", {
|
|
64
|
+
className: lineRowClass,
|
|
65
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
66
|
+
"aria-hidden": true,
|
|
67
|
+
className: lineIconClass,
|
|
68
|
+
children: /*#__PURE__*/_jsx(ListChecksIcon, {
|
|
69
|
+
weight: "bold",
|
|
70
|
+
"aria-hidden": true
|
|
71
|
+
})
|
|
72
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
73
|
+
className: "truncate",
|
|
74
|
+
children: title
|
|
75
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
76
|
+
"aria-live": "polite",
|
|
77
|
+
className: "shrink-0 text-faint tabular-nums",
|
|
78
|
+
children: progressLabel(steps)
|
|
79
|
+
})]
|
|
77
80
|
}), /*#__PURE__*/_jsx("ol", {
|
|
78
|
-
className: "flex
|
|
79
|
-
children: steps.map(
|
|
81
|
+
className: "flex min-w-0 flex-col text-sm",
|
|
82
|
+
children: steps.map(step => /*#__PURE__*/_jsx(StepRow, {
|
|
80
83
|
step: step,
|
|
81
|
-
current: step.id === currentId
|
|
82
|
-
last: position === steps.length - 1
|
|
84
|
+
current: step.id === currentId
|
|
83
85
|
}, step.id))
|
|
84
86
|
})]
|
|
85
87
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { Idea as BrainIcon, ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
|
|
5
4
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
|
|
5
|
+
import { Lightbulb as BrainIcon, CaretRight as ChevronRightIcon } from "@phosphor-icons/react/ssr";
|
|
6
6
|
import { useEffect, useRef, useState } from "react";
|
|
7
|
+
import { lineChevronClass, lineDetailClass, lineIconClass, lineTriggerClass } from "../../shared/line.js";
|
|
7
8
|
import { firstLineOf, thoughtDurationLabel } from "./thought-duration.js";
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
function useThinkingOpen(streaming, defaultOpen) {
|
|
@@ -58,7 +59,7 @@ function useThinkingOpen(streaming, defaultOpen) {
|
|
|
58
59
|
return t3;
|
|
59
60
|
}
|
|
60
61
|
export function Thinking(t0) {
|
|
61
|
-
const $ = _c(
|
|
62
|
+
const $ = _c(30);
|
|
62
63
|
const {
|
|
63
64
|
text,
|
|
64
65
|
state,
|
|
@@ -80,7 +81,7 @@ export function Thinking(t0) {
|
|
|
80
81
|
const t2 = streaming ? "streaming" : "done";
|
|
81
82
|
let t3;
|
|
82
83
|
if ($[2] !== className) {
|
|
83
|
-
t3 = cn("flex min-w-0 flex-col
|
|
84
|
+
t3 = cn("flex min-w-0 flex-col", className);
|
|
84
85
|
$[2] = className;
|
|
85
86
|
$[3] = t3;
|
|
86
87
|
} else {
|
|
@@ -88,9 +89,13 @@ export function Thinking(t0) {
|
|
|
88
89
|
}
|
|
89
90
|
let t4;
|
|
90
91
|
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
91
|
-
t4 = /*#__PURE__*/_jsx(
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
t4 = /*#__PURE__*/_jsx("span", {
|
|
93
|
+
"aria-hidden": true,
|
|
94
|
+
className: lineIconClass,
|
|
95
|
+
children: /*#__PURE__*/_jsx(BrainIcon, {
|
|
96
|
+
weight: "bold",
|
|
97
|
+
"aria-hidden": true
|
|
98
|
+
})
|
|
94
99
|
});
|
|
95
100
|
$[4] = t4;
|
|
96
101
|
} else {
|
|
@@ -99,7 +104,7 @@ export function Thinking(t0) {
|
|
|
99
104
|
const t5 = streaming && "motion-safe:locus-shimmer";
|
|
100
105
|
let t6;
|
|
101
106
|
if ($[5] !== t5) {
|
|
102
|
-
t6 = cn(t5);
|
|
107
|
+
t6 = cn("shrink-0", t5);
|
|
103
108
|
$[5] = t5;
|
|
104
109
|
$[6] = t6;
|
|
105
110
|
} else {
|
|
@@ -127,85 +132,83 @@ export function Thinking(t0) {
|
|
|
127
132
|
} else {
|
|
128
133
|
t8 = $[12];
|
|
129
134
|
}
|
|
130
|
-
|
|
135
|
+
let t9;
|
|
136
|
+
if ($[13] !== open || $[14] !== summary) {
|
|
137
|
+
t9 = !open && summary && /*#__PURE__*/_jsxs("span", {
|
|
138
|
+
"data-slot": "thinking-summary",
|
|
139
|
+
className: "min-w-0 truncate text-faint",
|
|
140
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
141
|
+
className: "sr-only",
|
|
142
|
+
children: ": "
|
|
143
|
+
}), summary]
|
|
144
|
+
});
|
|
145
|
+
$[13] = open;
|
|
146
|
+
$[14] = summary;
|
|
147
|
+
$[15] = t9;
|
|
148
|
+
} else {
|
|
149
|
+
t9 = $[15];
|
|
150
|
+
}
|
|
131
151
|
let t10;
|
|
132
|
-
if ($[
|
|
133
|
-
t10 =
|
|
134
|
-
|
|
135
|
-
|
|
152
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
153
|
+
t10 = /*#__PURE__*/_jsx(ChevronRightIcon, {
|
|
154
|
+
weight: "bold",
|
|
155
|
+
"aria-hidden": true,
|
|
156
|
+
className: lineChevronClass
|
|
157
|
+
});
|
|
158
|
+
$[16] = t10;
|
|
136
159
|
} else {
|
|
137
|
-
t10 = $[
|
|
160
|
+
t10 = $[16];
|
|
138
161
|
}
|
|
139
162
|
let t11;
|
|
140
|
-
if ($[
|
|
141
|
-
t11 = /*#__PURE__*/
|
|
142
|
-
|
|
143
|
-
|
|
163
|
+
if ($[17] !== t8 || $[18] !== t9) {
|
|
164
|
+
t11 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
|
|
165
|
+
className: lineTriggerClass,
|
|
166
|
+
children: [t4, t8, t9, t10]
|
|
144
167
|
});
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
168
|
+
$[17] = t8;
|
|
169
|
+
$[18] = t9;
|
|
170
|
+
$[19] = t11;
|
|
147
171
|
} else {
|
|
148
|
-
t11 = $[
|
|
172
|
+
t11 = $[19];
|
|
149
173
|
}
|
|
150
174
|
let t12;
|
|
151
|
-
if ($[
|
|
152
|
-
t12 =
|
|
153
|
-
"aria-expanded": open,
|
|
154
|
-
className: "group locus-eyebrow flex w-fit items-center gap-2 py-1 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70",
|
|
155
|
-
children: [t4, t8, t11]
|
|
156
|
-
});
|
|
157
|
-
$[17] = open;
|
|
158
|
-
$[18] = t11;
|
|
159
|
-
$[19] = t8;
|
|
175
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
176
|
+
t12 = cn(lineDetailClass, "pb-2 leading-relaxed whitespace-pre-wrap text-muted-foreground");
|
|
160
177
|
$[20] = t12;
|
|
161
178
|
} else {
|
|
162
179
|
t12 = $[20];
|
|
163
180
|
}
|
|
164
181
|
let t13;
|
|
165
|
-
if ($[21] !==
|
|
166
|
-
t13 =
|
|
167
|
-
"data-slot": "thinking-summary",
|
|
168
|
-
className: "ml-[6.5px] truncate border-l border-border pl-4 text-muted-foreground/80",
|
|
169
|
-
children: summary
|
|
170
|
-
});
|
|
171
|
-
$[21] = open;
|
|
172
|
-
$[22] = summary;
|
|
173
|
-
$[23] = t13;
|
|
174
|
-
} else {
|
|
175
|
-
t13 = $[23];
|
|
176
|
-
}
|
|
177
|
-
let t14;
|
|
178
|
-
if ($[24] !== text) {
|
|
179
|
-
t14 = /*#__PURE__*/_jsx(CollapsibleContent, {
|
|
182
|
+
if ($[21] !== text) {
|
|
183
|
+
t13 = /*#__PURE__*/_jsx(CollapsibleContent, {
|
|
180
184
|
"data-slot": "thinking-content",
|
|
181
|
-
className:
|
|
185
|
+
className: t12,
|
|
182
186
|
children: text
|
|
183
187
|
});
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
188
|
+
$[21] = text;
|
|
189
|
+
$[22] = t13;
|
|
186
190
|
} else {
|
|
187
|
-
|
|
191
|
+
t13 = $[22];
|
|
188
192
|
}
|
|
189
|
-
let
|
|
190
|
-
if ($[
|
|
191
|
-
|
|
193
|
+
let t14;
|
|
194
|
+
if ($[23] !== open || $[24] !== setOpen || $[25] !== t11 || $[26] !== t13 || $[27] !== t2 || $[28] !== t3) {
|
|
195
|
+
t14 = /*#__PURE__*/_jsxs(Collapsible, {
|
|
192
196
|
"data-slot": "thinking",
|
|
193
197
|
"data-state": t2,
|
|
194
198
|
open: open,
|
|
195
199
|
onOpenChange: setOpen,
|
|
196
200
|
className: t3,
|
|
197
|
-
children: [
|
|
201
|
+
children: [t11, t13]
|
|
198
202
|
});
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
$[33] = t15;
|
|
203
|
+
$[23] = open;
|
|
204
|
+
$[24] = setOpen;
|
|
205
|
+
$[25] = t11;
|
|
206
|
+
$[26] = t13;
|
|
207
|
+
$[27] = t2;
|
|
208
|
+
$[28] = t3;
|
|
209
|
+
$[29] = t14;
|
|
207
210
|
} else {
|
|
208
|
-
|
|
211
|
+
t14 = $[29];
|
|
209
212
|
}
|
|
210
|
-
return
|
|
213
|
+
return t14;
|
|
211
214
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
export function prettyJson(value) {
|
|
4
3
|
if (typeof value === "string") return value;
|
|
5
4
|
try {
|
|
@@ -12,11 +11,15 @@ export function JsonBlock({
|
|
|
12
11
|
label,
|
|
13
12
|
value
|
|
14
13
|
}) {
|
|
15
|
-
return /*#__PURE__*/
|
|
14
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
16
15
|
"data-slot": "tool-json",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
className: "flex min-w-0 flex-col gap-1",
|
|
17
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
18
|
+
className: "text-xs text-faint",
|
|
19
|
+
children: label
|
|
20
|
+
}), /*#__PURE__*/_jsx("pre", {
|
|
21
|
+
className: "max-h-72 overflow-auto font-mono text-xs leading-relaxed text-muted-foreground",
|
|
22
|
+
children: prettyJson(value)
|
|
23
|
+
})]
|
|
21
24
|
});
|
|
22
25
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ToolState } from "../../types.js";
|
|
2
2
|
export declare const toolStateLabels: Record<ToolState, string>;
|
|
3
3
|
export declare function isToolBusy(state: ToolState): state is "input-available" | "input-streaming";
|
|
4
|
+
export declare function showsStateWord(state: ToolState): boolean;
|
|
5
|
+
export declare function humanToolName(name: string): string;
|
|
4
6
|
export declare function ToolStatus({ state }: {
|
|
5
7
|
state: ToolState;
|
|
6
8
|
}): import("react").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StatusDot } from "../../shared/status-dot.js";
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
export const toolStateLabels = {
|
|
4
3
|
"input-streaming": "Preparing",
|
|
@@ -9,28 +8,32 @@ export const toolStateLabels = {
|
|
|
9
8
|
"output-error": "Failed",
|
|
10
9
|
"output-denied": "Denied"
|
|
11
10
|
};
|
|
12
|
-
const
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"approval-responded": "done",
|
|
17
|
-
"output-available": "done",
|
|
18
|
-
"output-error": "danger",
|
|
19
|
-
"output-denied": "idle"
|
|
11
|
+
const visibleStateWordClasses = {
|
|
12
|
+
"approval-requested": "font-medium text-warn",
|
|
13
|
+
"output-error": "font-medium text-destructive",
|
|
14
|
+
"output-denied": "font-medium text-muted-foreground"
|
|
20
15
|
};
|
|
21
16
|
export function isToolBusy(state) {
|
|
22
17
|
return state === "input-streaming" || state === "input-available";
|
|
23
18
|
}
|
|
19
|
+
export function showsStateWord(state) {
|
|
20
|
+
return state in visibleStateWordClasses;
|
|
21
|
+
}
|
|
22
|
+
export function humanToolName(name) {
|
|
23
|
+
return name.replace(/[._-]+/g, " ").trim();
|
|
24
|
+
}
|
|
24
25
|
export function ToolStatus({
|
|
25
26
|
state
|
|
26
27
|
}) {
|
|
28
|
+
const visibleClass = visibleStateWordClasses[state];
|
|
27
29
|
return /*#__PURE__*/_jsxs("span", {
|
|
28
30
|
"data-slot": "tool-status",
|
|
29
31
|
"data-state": state,
|
|
30
32
|
"aria-live": "polite",
|
|
31
|
-
className:
|
|
32
|
-
children: [/*#__PURE__*/_jsx(
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
className: visibleClass ?? "sr-only",
|
|
34
|
+
children: [toolStateLabels[state], /*#__PURE__*/_jsx("span", {
|
|
35
|
+
className: "sr-only",
|
|
36
|
+
children: ": "
|
|
37
|
+
})]
|
|
35
38
|
});
|
|
36
39
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
import { type ToolPart } from "../../types.js";
|
|
3
|
+
export type ToolTone = "default" | "memory";
|
|
2
4
|
export type ToolProps = {
|
|
3
5
|
part: ToolPart;
|
|
6
|
+
tone?: ToolTone;
|
|
7
|
+
verb?: string;
|
|
8
|
+
activeVerb?: string;
|
|
9
|
+
target?: ReactNode;
|
|
10
|
+
icon?: ReactNode;
|
|
4
11
|
defaultOpen?: boolean;
|
|
5
12
|
className?: string;
|
|
6
13
|
};
|
|
7
|
-
export declare function Tool({ part, defaultOpen, className }: ToolProps): import("react").JSX.Element;
|
|
14
|
+
export declare function Tool({ part, tone, verb, activeVerb, target, icon, defaultOpen, className, }: ToolProps): import("react").JSX.Element;
|