@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.
Files changed (119) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +6 -5
  3. package/dist/agent/pulse/marks/bars-mark.js +1 -1
  4. package/dist/agent/pulse/marks/glyph-mark.js +2 -2
  5. package/dist/agent/pulse/marks/locus-mark.js +1 -1
  6. package/dist/agent/pulse/pulse.js +1 -1
  7. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  8. package/dist/agent/pulse/use-loop-animation.js +1 -3
  9. package/dist/agent/steps/step-icon.js +20 -13
  10. package/dist/agent/steps/steps.js +39 -37
  11. package/dist/agent/thinking/thinking.js +65 -62
  12. package/dist/agent/tool/json-block.js +10 -7
  13. package/dist/agent/tool/tool-status.d.ts +2 -0
  14. package/dist/agent/tool/tool-status.js +16 -13
  15. package/dist/agent/tool/tool.d.ts +8 -1
  16. package/dist/agent/tool/tool.js +238 -119
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  18. package/dist/approval/inbox/inbox-row.js +135 -200
  19. package/dist/approval/inbox/inbox.d.ts +3 -3
  20. package/dist/approval/inbox/inbox.js +180 -139
  21. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  22. package/dist/approval/inbox/virtual-inbox-list.js +20 -21
  23. package/dist/approval/memory/memory-review.js +155 -154
  24. package/dist/approval/memory/memory-row.js +86 -87
  25. package/dist/approval/plan/plan-review.js +110 -129
  26. package/dist/approval/plan/plan-step-row.js +7 -6
  27. package/dist/approval/plan/plan-steps.d.ts +1 -1
  28. package/dist/approval/plan/plan-steps.js +2 -2
  29. package/dist/approval/plan/question-choices.js +10 -7
  30. package/dist/approval/plan/question.js +116 -112
  31. package/dist/approval/run/run-bar.js +43 -40
  32. package/dist/approval/shared/approval-line.d.ts +27 -0
  33. package/dist/approval/shared/approval-line.js +85 -0
  34. package/dist/approval/shared/risk-badge.d.ts +3 -5
  35. package/dist/approval/shared/risk-badge.js +11 -19
  36. package/dist/approval/shared/time.d.ts +0 -1
  37. package/dist/approval/shared/time.js +0 -1
  38. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  39. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  40. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  41. package/dist/approval/spend/raise-cap-form.js +134 -126
  42. package/dist/approval/spend/spend-gate.js +133 -156
  43. package/dist/approval/spend/spend-math.d.ts +1 -0
  44. package/dist/approval/spend/spend-math.js +5 -2
  45. package/dist/approval/spend/spend-meter.js +5 -5
  46. package/dist/approval/tool/approval.js +114 -214
  47. package/dist/approval/tool/args/args-editor.js +147 -156
  48. package/dist/approval/tool/args/args-field.js +197 -109
  49. package/dist/approval/tool/deny-form.js +59 -66
  50. package/dist/approval/tool/tool-inputs.js +38 -45
  51. package/dist/chat/chat/chat.js +5 -4
  52. package/dist/chat/chat/use-stick-to-bottom.js +1 -3
  53. package/dist/chat/composer/composer-actions.js +4 -1
  54. package/dist/chat/composer/composer.js +4 -3
  55. package/dist/chat/composer/use-auto-grow.js +14 -10
  56. package/dist/chat/files/files.js +12 -10
  57. package/dist/chat/reply/fenced-code.js +1 -1
  58. package/dist/chat/reply/markdown-components.js +9 -116
  59. package/dist/chat/reply/reply.js +2 -2
  60. package/dist/chat/turn/group-parts.d.ts +1 -0
  61. package/dist/chat/turn/group-parts.js +6 -3
  62. package/dist/chat/turn/turn.js +13 -4
  63. package/dist/cost/context.js +3 -3
  64. package/dist/cost/cost-steps.js +31 -30
  65. package/dist/cost/cost.js +39 -39
  66. package/dist/cost/model-picker.js +5 -4
  67. package/dist/cost/shared/context-breakdown.js +10 -11
  68. package/dist/cost/shared/model-option-row.js +4 -3
  69. package/dist/cost/shared/step-cost-row.js +11 -12
  70. package/dist/cost/shared/usage-totals.d.ts +1 -0
  71. package/dist/cost/shared/usage-totals.js +19 -1
  72. package/dist/memory/cite.js +55 -47
  73. package/dist/memory/memorized.js +123 -108
  74. package/dist/memory/recall.js +136 -146
  75. package/dist/memory/shared/host-label.d.ts +1 -1
  76. package/dist/memory/shared/host-label.js +2 -2
  77. package/dist/memory/shared/source-mark.js +1 -1
  78. package/dist/memory/sources.d.ts +2 -1
  79. package/dist/memory/sources.js +135 -100
  80. package/dist/shared/decision-summary.js +2 -1
  81. package/dist/shared/line.d.ts +10 -0
  82. package/dist/shared/line.js +11 -0
  83. package/dist/shared/live-status.d.ts +3 -0
  84. package/dist/shared/live-status.js +11 -0
  85. package/dist/shared/reduced-motion.d.ts +1 -0
  86. package/dist/shared/reduced-motion.js +3 -0
  87. package/dist/thread/actions/action-button.js +1 -1
  88. package/dist/thread/actions/actions.d.ts +3 -1
  89. package/dist/thread/actions/actions.js +100 -81
  90. package/dist/thread/actions/branch-switcher.js +67 -37
  91. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  92. package/dist/thread/canvas/canvas-meta.js +35 -0
  93. package/dist/thread/canvas/canvas.d.ts +1 -1
  94. package/dist/thread/canvas/canvas.js +64 -74
  95. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  96. package/dist/thread/canvas/version-switcher.js +106 -87
  97. package/dist/thread/code/code.js +4 -6
  98. package/dist/thread/code/copy-code-button.d.ts +2 -1
  99. package/dist/thread/code/copy-code-button.js +56 -25
  100. package/dist/thread/history/history.d.ts +1 -1
  101. package/dist/thread/history/history.js +104 -104
  102. package/dist/thread/history/row/history-row.js +8 -5
  103. package/dist/thread/history/row/thread-item-menu.js +13 -4
  104. package/dist/thread/history/row/thread-title-editor.js +1 -1
  105. package/dist/thread/history/virtual-history-list.js +1 -2
  106. package/dist/thread/index.d.ts +1 -0
  107. package/dist/thread/index.js +1 -0
  108. package/dist/thread/starters/starters.js +5 -4
  109. package/package.json +6 -6
  110. package/dist/agent/shared/status-dot.d.ts +0 -1
  111. package/dist/agent/shared/status-dot.js +0 -1
  112. package/dist/approval/shared/decision-line.d.ts +0 -1
  113. package/dist/approval/shared/decision-line.js +0 -1
  114. package/dist/memory/shared/disclosure.d.ts +0 -6
  115. package/dist/memory/shared/disclosure.js +0 -6
  116. package/dist/shared/panel.d.ts +0 -19
  117. package/dist/shared/panel.js +0 -77
  118. package/dist/shared/status-dot.d.ts +0 -6
  119. package/dist/shared/status-dot.js +0 -20
@@ -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/70 text-foreground/70",
22
- brand: "fill-violet-500 text-violet-500"
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-muted-foreground),var(--color-foreground),var(--color-muted-foreground))]",
26
- brand: "bg-[linear-gradient(90deg,var(--color-sky-500),var(--color-violet-500),var(--color-pink-500),var(--color-sky-500))]"
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/70",
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 "../use-loop-animation.js";
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-orange-500" : "text-foreground/70";
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 "../use-loop-animation.js";
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/70 motion-safe:animate-pulse", delay)
16
+ className: cn("size-1.5 rounded-full bg-muted-foreground motion-safe:animate-pulse", delay)
17
17
  }, delay))
18
18
  });
19
19
  }
@@ -1,2 +1 @@
1
- export declare function prefersReducedMotion(): boolean;
2
1
  export declare function useLoopAnimation<T extends Element>(keyframes: Keyframe[], duration: number, delay?: number, easing?: string): import("react").RefObject<T | null>;
@@ -2,9 +2,7 @@
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { useEffect, useRef } from "react";
5
- export function prefersReducedMotion() {
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 stepIconFrames = {
12
- pending: "bg-card ring-1 ring-muted-foreground/40 ring-inset",
13
- running: "bg-card text-warn",
14
- done: "bg-good text-white dark:text-background",
15
- failed: "bg-destructive text-white",
16
- skipped: "bg-muted text-muted-foreground"
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
- className: "size-4 motion-safe:animate-spin"
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
- className: "size-2.5"
27
+ weight: "bold",
28
+ "aria-hidden": true
26
29
  });
27
30
  if (status === "failed") return /*#__PURE__*/_jsx(XIcon, {
28
- className: "size-2.5"
31
+ weight: "bold",
32
+ "aria-hidden": true
29
33
  });
30
34
  if (status === "skipped") return /*#__PURE__*/_jsx(MinusIcon, {
31
- className: "size-2.5"
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("relative z-10 mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full", stepIconFrames[status], current && status === "pending" && "ring-foreground/60"),
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 { ApprovalPanel, PanelHeader } from "../../shared/panel.js";
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-muted-foreground",
8
- running: "text-foreground font-medium",
9
- done: "text-foreground",
10
- failed: "text-foreground font-medium",
11
- skipped: "text-muted-foreground line-through"
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: "relative flex gap-3 pb-4 last:pb-0",
39
- children: [!last && /*#__PURE__*/_jsx("span", {
40
- "aria-hidden": true,
41
- className: "absolute top-5 bottom-0.5 left-[7.5px] w-px bg-border"
42
- }), /*#__PURE__*/_jsx(StepIcon, {
43
- status: step.status,
44
- current: current
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("text-sm leading-snug", stepTitleTones[step.status], current && step.status === "pending" && "text-foreground"),
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("font-mono text-xs text-muted-foreground", step.status === "failed" && "font-sans text-destructive"),
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(ApprovalPanel, {
59
+ return /*#__PURE__*/_jsxs("section", {
67
60
  "data-slot": "steps",
68
61
  "aria-label": title,
69
- className: className,
70
- children: [/*#__PURE__*/_jsx(PanelHeader, {
71
- icon: /*#__PURE__*/_jsx(ListChecksIcon, {
72
- "aria-hidden": true
73
- }),
74
- eyebrow: title,
75
- status: progressLabel(steps),
76
- tone: progressTone(steps)
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 flex-col px-5 pt-4 pb-5",
79
- children: steps.map((step, position) => /*#__PURE__*/_jsx(StepRow, {
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(34);
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 gap-2 text-sm text-muted-foreground", className);
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(BrainIcon, {
92
- className: "size-3.5 shrink-0",
93
- "aria-hidden": true
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
- const t9 = open && "rotate-90";
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 ($[13] !== t9) {
133
- t10 = cn("size-3.5 shrink-0 opacity-70 motion-safe:transition-transform", t9);
134
- $[13] = t9;
135
- $[14] = t10;
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 = $[14];
160
+ t10 = $[16];
138
161
  }
139
162
  let t11;
140
- if ($[15] !== t10) {
141
- t11 = /*#__PURE__*/_jsx(ChevronRightIcon, {
142
- "aria-hidden": true,
143
- className: t10
163
+ if ($[17] !== t8 || $[18] !== t9) {
164
+ t11 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
165
+ className: lineTriggerClass,
166
+ children: [t4, t8, t9, t10]
144
167
  });
145
- $[15] = t10;
146
- $[16] = t11;
168
+ $[17] = t8;
169
+ $[18] = t9;
170
+ $[19] = t11;
147
171
  } else {
148
- t11 = $[16];
172
+ t11 = $[19];
149
173
  }
150
174
  let t12;
151
- if ($[17] !== open || $[18] !== t11 || $[19] !== t8) {
152
- t12 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
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] !== open || $[22] !== summary) {
166
- t13 = !open && summary && /*#__PURE__*/_jsx("p", {
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: "ml-[6.5px] border-l border-border pl-4 leading-relaxed whitespace-pre-wrap",
185
+ className: t12,
182
186
  children: text
183
187
  });
184
- $[24] = text;
185
- $[25] = t14;
188
+ $[21] = text;
189
+ $[22] = t13;
186
190
  } else {
187
- t14 = $[25];
191
+ t13 = $[22];
188
192
  }
189
- let t15;
190
- if ($[26] !== open || $[27] !== setOpen || $[28] !== t12 || $[29] !== t13 || $[30] !== t14 || $[31] !== t2 || $[32] !== t3) {
191
- t15 = /*#__PURE__*/_jsxs(Collapsible, {
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: [t12, t13, t14]
201
+ children: [t11, t13]
198
202
  });
199
- $[26] = open;
200
- $[27] = setOpen;
201
- $[28] = t12;
202
- $[29] = t13;
203
- $[30] = t14;
204
- $[31] = t2;
205
- $[32] = t3;
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
- t15 = $[33];
211
+ t14 = $[29];
209
212
  }
210
- return t15;
213
+ return t14;
211
214
  }
@@ -1,5 +1,4 @@
1
- import { Code } from "../../thread/code/code.js";
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__*/_jsx(Code, {
14
+ return /*#__PURE__*/_jsxs("div", {
16
15
  "data-slot": "tool-json",
17
- code: prettyJson(value),
18
- language: "json",
19
- filename: label,
20
- className: "[&_[data-slot=code-area]]:max-h-72 [&_[data-slot=code-area]]:overflow-auto"
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 toolStateTones = {
13
- "input-streaming": "waiting",
14
- "input-available": "waiting",
15
- "approval-requested": "waiting",
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: "locus-eyebrow flex shrink-0 items-center gap-1.5",
32
- children: [/*#__PURE__*/_jsx(StatusDot, {
33
- tone: toolStateTones[state]
34
- }), toolStateLabels[state]]
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;