@locusgraph/loop 0.0.0-stage → 0.2.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 (214) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -2
  3. package/dist/agent/index.d.ts +5 -0
  4. package/dist/agent/index.js +5 -0
  5. package/dist/agent/pulse/gradient-label.d.ts +7 -0
  6. package/dist/agent/pulse/gradient-label.js +94 -0
  7. package/dist/agent/pulse/marks/bars-mark.d.ts +1 -0
  8. package/dist/agent/pulse/marks/bars-mark.js +51 -0
  9. package/dist/agent/pulse/marks/glyph-mark.d.ts +4 -0
  10. package/dist/agent/pulse/marks/glyph-mark.js +62 -0
  11. package/dist/agent/pulse/marks/locus-mark.d.ts +1 -0
  12. package/dist/agent/pulse/marks/locus-mark.js +73 -0
  13. package/dist/agent/pulse/marks/orb-mark.d.ts +1 -0
  14. package/dist/agent/pulse/marks/orb-mark.js +34 -0
  15. package/dist/agent/pulse/marks/spinner-mark.d.ts +1 -0
  16. package/dist/agent/pulse/marks/spinner-mark.js +32 -0
  17. package/dist/agent/pulse/pulse-tone.d.ts +1 -0
  18. package/dist/agent/pulse/pulse-tone.js +1 -0
  19. package/dist/agent/pulse/pulse.d.ts +12 -0
  20. package/dist/agent/pulse/pulse.js +166 -0
  21. package/dist/agent/pulse/use-loop-animation.d.ts +2 -0
  22. package/dist/agent/pulse/use-loop-animation.js +40 -0
  23. package/dist/agent/shared/status-dot.d.ts +1 -0
  24. package/dist/agent/shared/status-dot.js +1 -0
  25. package/dist/agent/steps/step-icon.d.ts +8 -0
  26. package/dist/agent/steps/step-icon.js +117 -0
  27. package/dist/agent/steps/steps.d.ts +7 -0
  28. package/dist/agent/steps/steps.js +249 -0
  29. package/dist/agent/thinking/thinking.d.ts +6 -0
  30. package/dist/agent/thinking/thinking.js +211 -0
  31. package/dist/agent/thinking/thought-duration.d.ts +2 -0
  32. package/dist/agent/thinking/thought-duration.js +11 -0
  33. package/dist/agent/tool/json-block.d.ts +5 -0
  34. package/dist/agent/tool/json-block.js +42 -0
  35. package/dist/agent/tool/tool-status.d.ts +6 -0
  36. package/dist/agent/tool/tool-status.js +59 -0
  37. package/dist/agent/tool/tool.d.ts +7 -0
  38. package/dist/agent/tool/tool.js +192 -0
  39. package/dist/approval/inbox/inbox-row.d.ts +12 -0
  40. package/dist/approval/inbox/inbox-row.js +328 -0
  41. package/dist/approval/inbox/inbox-selection.d.ts +6 -0
  42. package/dist/approval/inbox/inbox-selection.js +15 -0
  43. package/dist/approval/inbox/inbox.d.ts +12 -0
  44. package/dist/approval/inbox/inbox.js +258 -0
  45. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  46. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  47. package/dist/approval/index.d.ts +9 -0
  48. package/dist/approval/index.js +8 -0
  49. package/dist/approval/memory/memory-choices.d.ts +10 -0
  50. package/dist/approval/memory/memory-choices.js +35 -0
  51. package/dist/approval/memory/memory-review.d.ts +11 -0
  52. package/dist/approval/memory/memory-review.js +256 -0
  53. package/dist/approval/memory/memory-row.d.ts +9 -0
  54. package/dist/approval/memory/memory-row.js +226 -0
  55. package/dist/approval/plan/plan-review.d.ts +13 -0
  56. package/dist/approval/plan/plan-review.js +289 -0
  57. package/dist/approval/plan/plan-step-row.d.ts +13 -0
  58. package/dist/approval/plan/plan-step-row.js +201 -0
  59. package/dist/approval/plan/plan-steps.d.ts +8 -0
  60. package/dist/approval/plan/plan-steps.js +30 -0
  61. package/dist/approval/plan/question-choices.d.ts +10 -0
  62. package/dist/approval/plan/question-choices.js +166 -0
  63. package/dist/approval/plan/question.d.ts +18 -0
  64. package/dist/approval/plan/question.js +232 -0
  65. package/dist/approval/run/run-bar.d.ts +13 -0
  66. package/dist/approval/run/run-bar.js +189 -0
  67. package/dist/approval/shared/decision-line.d.ts +1 -0
  68. package/dist/approval/shared/decision-line.js +1 -0
  69. package/dist/approval/shared/risk-badge.d.ts +10 -0
  70. package/dist/approval/shared/risk-badge.js +57 -0
  71. package/dist/approval/shared/time.d.ts +3 -0
  72. package/dist/approval/shared/time.js +12 -0
  73. package/dist/approval/shared/use-focus-on-mount.d.ts +2 -0
  74. package/dist/approval/shared/use-focus-on-mount.js +26 -0
  75. package/dist/approval/spend/raise-cap-form.d.ts +8 -0
  76. package/dist/approval/spend/raise-cap-form.js +244 -0
  77. package/dist/approval/spend/spend-gate.d.ts +16 -0
  78. package/dist/approval/spend/spend-gate.js +250 -0
  79. package/dist/approval/spend/spend-math.d.ts +5 -0
  80. package/dist/approval/spend/spend-math.js +17 -0
  81. package/dist/approval/spend/spend-meter.d.ts +10 -0
  82. package/dist/approval/spend/spend-meter.js +377 -0
  83. package/dist/approval/tool/approval.d.ts +14 -0
  84. package/dist/approval/tool/approval.js +290 -0
  85. package/dist/approval/tool/args/args-editor.d.ts +16 -0
  86. package/dist/approval/tool/args/args-editor.js +273 -0
  87. package/dist/approval/tool/args/args-field.d.ts +11 -0
  88. package/dist/approval/tool/args/args-field.js +268 -0
  89. package/dist/approval/tool/args/args-validation.d.ts +8 -0
  90. package/dist/approval/tool/args/args-validation.js +50 -0
  91. package/dist/approval/tool/deny-form.d.ts +6 -0
  92. package/dist/approval/tool/deny-form.js +135 -0
  93. package/dist/approval/tool/tool-inputs.d.ts +6 -0
  94. package/dist/approval/tool/tool-inputs.js +142 -0
  95. package/dist/approval/types.d.ts +59 -0
  96. package/dist/approval/types.js +1 -0
  97. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  98. package/dist/chat/chat/chat-item-spacing.js +19 -0
  99. package/dist/chat/chat/chat.d.ts +8 -0
  100. package/dist/chat/chat/chat.js +187 -0
  101. package/dist/chat/chat/use-stick-to-bottom.d.ts +7 -0
  102. package/dist/chat/chat/use-stick-to-bottom.js +133 -0
  103. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  104. package/dist/chat/chat/virtual-chat-items.js +153 -0
  105. package/dist/chat/composer/composer-actions.d.ts +15 -0
  106. package/dist/chat/composer/composer-actions.js +158 -0
  107. package/dist/chat/composer/composer.d.ts +20 -0
  108. package/dist/chat/composer/composer.js +340 -0
  109. package/dist/chat/composer/use-auto-grow.d.ts +2 -0
  110. package/dist/chat/composer/use-auto-grow.js +29 -0
  111. package/dist/chat/files/file-meta.d.ts +13 -0
  112. package/dist/chat/files/file-meta.js +30 -0
  113. package/dist/chat/files/files.d.ts +9 -0
  114. package/dist/chat/files/files.js +327 -0
  115. package/dist/chat/index.d.ts +7 -0
  116. package/dist/chat/index.js +7 -0
  117. package/dist/chat/reply/fenced-code.d.ts +8 -0
  118. package/dist/chat/reply/fenced-code.js +53 -0
  119. package/dist/chat/reply/markdown-components.d.ts +2 -0
  120. package/dist/chat/reply/markdown-components.js +142 -0
  121. package/dist/chat/reply/reply.d.ts +8 -0
  122. package/dist/chat/reply/reply.js +116 -0
  123. package/dist/chat/turn/group-parts.d.ts +24 -0
  124. package/dist/chat/turn/group-parts.js +49 -0
  125. package/dist/chat/turn/turn.d.ts +11 -0
  126. package/dist/chat/turn/turn.js +253 -0
  127. package/dist/cost/context.d.ts +13 -0
  128. package/dist/cost/context.js +333 -0
  129. package/dist/cost/cost-steps.d.ts +17 -0
  130. package/dist/cost/cost-steps.js +230 -0
  131. package/dist/cost/cost.d.ts +8 -0
  132. package/dist/cost/cost.js +531 -0
  133. package/dist/cost/index.d.ts +4 -0
  134. package/dist/cost/index.js +4 -0
  135. package/dist/cost/model-picker.d.ts +11 -0
  136. package/dist/cost/model-picker.js +184 -0
  137. package/dist/cost/shared/context-breakdown.d.ts +15 -0
  138. package/dist/cost/shared/context-breakdown.js +306 -0
  139. package/dist/cost/shared/meter-marks.d.ts +9 -0
  140. package/dist/cost/shared/meter-marks.js +114 -0
  141. package/dist/cost/shared/model-option-row.d.ts +14 -0
  142. package/dist/cost/shared/model-option-row.js +189 -0
  143. package/dist/cost/shared/step-cost-row.d.ts +15 -0
  144. package/dist/cost/shared/step-cost-row.js +262 -0
  145. package/dist/cost/shared/usage-totals.d.ts +11 -0
  146. package/dist/cost/shared/usage-totals.js +30 -0
  147. package/dist/index.d.ts +7 -0
  148. package/dist/index.js +7 -0
  149. package/dist/memory/cite.d.ts +8 -0
  150. package/dist/memory/cite.js +190 -0
  151. package/dist/memory/index.d.ts +5 -0
  152. package/dist/memory/index.js +4 -0
  153. package/dist/memory/memorized.d.ts +14 -0
  154. package/dist/memory/memorized.js +225 -0
  155. package/dist/memory/recall.d.ts +9 -0
  156. package/dist/memory/recall.js +303 -0
  157. package/dist/memory/shared/disclosure.d.ts +6 -0
  158. package/dist/memory/shared/disclosure.js +6 -0
  159. package/dist/memory/shared/host-label.d.ts +6 -0
  160. package/dist/memory/shared/host-label.js +31 -0
  161. package/dist/memory/shared/source-mark.d.ts +5 -0
  162. package/dist/memory/shared/source-mark.js +42 -0
  163. package/dist/memory/sources.d.ts +9 -0
  164. package/dist/memory/sources.js +264 -0
  165. package/dist/shared/decision-summary.d.ts +18 -0
  166. package/dist/shared/decision-summary.js +144 -0
  167. package/dist/shared/panel-empty.d.ts +8 -0
  168. package/dist/shared/panel-empty.js +80 -0
  169. package/dist/shared/panel.d.ts +19 -0
  170. package/dist/shared/panel.js +251 -0
  171. package/dist/shared/status-dot.d.ts +6 -0
  172. package/dist/shared/status-dot.js +42 -0
  173. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  174. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  175. package/dist/sources.css +1 -0
  176. package/dist/thread/actions/action-button.d.ts +8 -0
  177. package/dist/thread/actions/action-button.js +67 -0
  178. package/dist/thread/actions/actions.d.ts +13 -0
  179. package/dist/thread/actions/actions.js +192 -0
  180. package/dist/thread/actions/branch-switcher.d.ts +10 -0
  181. package/dist/thread/actions/branch-switcher.js +104 -0
  182. package/dist/thread/canvas/canvas.d.ts +14 -0
  183. package/dist/thread/canvas/canvas.js +212 -0
  184. package/dist/thread/canvas/version-switcher.d.ts +12 -0
  185. package/dist/thread/canvas/version-switcher.js +152 -0
  186. package/dist/thread/code/code.d.ts +10 -0
  187. package/dist/thread/code/code.js +195 -0
  188. package/dist/thread/code/copy-code-button.d.ts +6 -0
  189. package/dist/thread/code/copy-code-button.js +66 -0
  190. package/dist/thread/code/highlight.d.ts +1 -0
  191. package/dist/thread/code/highlight.js +40 -0
  192. package/dist/thread/history/history-rows.d.ts +16 -0
  193. package/dist/thread/history/history-rows.js +23 -0
  194. package/dist/thread/history/history.d.ts +16 -0
  195. package/dist/thread/history/history.js +179 -0
  196. package/dist/thread/history/row/history-row.d.ts +15 -0
  197. package/dist/thread/history/row/history-row.js +137 -0
  198. package/dist/thread/history/row/thread-item-menu.d.ts +7 -0
  199. package/dist/thread/history/row/thread-item-menu.js +84 -0
  200. package/dist/thread/history/row/thread-title-editor.d.ts +7 -0
  201. package/dist/thread/history/row/thread-title-editor.js +81 -0
  202. package/dist/thread/history/thread-groups.d.ts +8 -0
  203. package/dist/thread/history/thread-groups.js +52 -0
  204. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  205. package/dist/thread/history/virtual-history-list.js +107 -0
  206. package/dist/thread/index.d.ts +8 -0
  207. package/dist/thread/index.js +5 -0
  208. package/dist/thread/starters/starters.d.ts +12 -0
  209. package/dist/thread/starters/starters.js +100 -0
  210. package/dist/thread/use-copied.d.ts +5 -0
  211. package/dist/thread/use-copied.js +52 -0
  212. package/dist/types.d.ts +70 -0
  213. package/dist/types.js +3 -0
  214. package/package.json +59 -3
@@ -0,0 +1 @@
1
+ export { StatusDot, type StatusTone, statusDotTones } from "../../shared/status-dot.js";
@@ -0,0 +1 @@
1
+ export { StatusDot, statusDotTones } from "../../shared/status-dot.js";
@@ -0,0 +1,8 @@
1
+ import type { StepStatus } from "../../types.js";
2
+ export declare const stepStatusLabels: Record<StepStatus, string>;
3
+ type StepIconProps = {
4
+ status: StepStatus;
5
+ current?: boolean;
6
+ };
7
+ export declare function StepIcon({ status, current }: StepIconProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,117 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Checkmark as CheckIcon, InProgress as LoaderCircleIcon, Subtract as MinusIcon, Close as XIcon } from "@carbon/icons-react";
3
+ import { cn } from "@locusgraph/components";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export const stepStatusLabels = {
6
+ pending: "Pending",
7
+ running: "Running",
8
+ done: "Done",
9
+ failed: "Failed",
10
+ skipped: "Skipped"
11
+ };
12
+ const stepIconFrames = {
13
+ pending: "bg-card ring-1 ring-muted-foreground/40 ring-inset",
14
+ running: "bg-card text-warn",
15
+ done: "bg-good text-white dark:text-background",
16
+ failed: "bg-destructive text-white",
17
+ skipped: "bg-muted text-muted-foreground"
18
+ };
19
+ function StepGlyph(t0) {
20
+ const $ = _c(4);
21
+ const {
22
+ status
23
+ } = t0;
24
+ if (status === "running") {
25
+ let t1;
26
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27
+ t1 = /*#__PURE__*/_jsx(LoaderCircleIcon, {
28
+ className: "size-4 motion-safe:animate-spin"
29
+ });
30
+ $[0] = t1;
31
+ } else {
32
+ t1 = $[0];
33
+ }
34
+ return t1;
35
+ }
36
+ if (status === "done") {
37
+ let t1;
38
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
39
+ t1 = /*#__PURE__*/_jsx(CheckIcon, {
40
+ className: "size-2.5"
41
+ });
42
+ $[1] = t1;
43
+ } else {
44
+ t1 = $[1];
45
+ }
46
+ return t1;
47
+ }
48
+ if (status === "failed") {
49
+ let t1;
50
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
51
+ t1 = /*#__PURE__*/_jsx(XIcon, {
52
+ className: "size-2.5"
53
+ });
54
+ $[2] = t1;
55
+ } else {
56
+ t1 = $[2];
57
+ }
58
+ return t1;
59
+ }
60
+ if (status === "skipped") {
61
+ let t1;
62
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
63
+ t1 = /*#__PURE__*/_jsx(MinusIcon, {
64
+ className: "size-2.5"
65
+ });
66
+ $[3] = t1;
67
+ } else {
68
+ t1 = $[3];
69
+ }
70
+ return t1;
71
+ }
72
+ return null;
73
+ }
74
+ export function StepIcon(t0) {
75
+ const $ = _c(8);
76
+ const {
77
+ status,
78
+ current: t1
79
+ } = t0;
80
+ const current = t1 === undefined ? false : t1;
81
+ const t2 = stepIconFrames[status];
82
+ const t3 = current && status === "pending" && "ring-foreground/60";
83
+ let t4;
84
+ if ($[0] !== t2 || $[1] !== t3) {
85
+ t4 = cn("relative z-10 mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full", t2, t3);
86
+ $[0] = t2;
87
+ $[1] = t3;
88
+ $[2] = t4;
89
+ } else {
90
+ t4 = $[2];
91
+ }
92
+ let t5;
93
+ if ($[3] !== status) {
94
+ t5 = /*#__PURE__*/_jsx(StepGlyph, {
95
+ status: status
96
+ });
97
+ $[3] = status;
98
+ $[4] = t5;
99
+ } else {
100
+ t5 = $[4];
101
+ }
102
+ let t6;
103
+ if ($[5] !== t4 || $[6] !== t5) {
104
+ t6 = /*#__PURE__*/_jsx("span", {
105
+ "aria-hidden": true,
106
+ "data-slot": "step-icon",
107
+ className: t4,
108
+ children: t5
109
+ });
110
+ $[5] = t4;
111
+ $[6] = t5;
112
+ $[7] = t6;
113
+ } else {
114
+ t6 = $[7];
115
+ }
116
+ return t6;
117
+ }
@@ -0,0 +1,7 @@
1
+ import type { AgentStep } from "../../types.js";
2
+ export type StepsProps = {
3
+ steps: AgentStep[];
4
+ title?: string;
5
+ className?: string;
6
+ };
7
+ export declare function Steps({ steps, title, className }: StepsProps): import("react").JSX.Element;
@@ -0,0 +1,249 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ListChecked as ListChecksIcon } from "@carbon/icons-react";
3
+ import { cn } from "@locusgraph/components";
4
+ import { ApprovalPanel, PanelHeader } from "../../shared/panel.js";
5
+ import { StepIcon, stepStatusLabels } from "./step-icon.js";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ const stepTitleTones = {
8
+ pending: "text-muted-foreground",
9
+ running: "text-foreground font-medium",
10
+ done: "text-foreground",
11
+ failed: "text-foreground font-medium",
12
+ skipped: "text-muted-foreground line-through"
13
+ };
14
+ function currentStepId(steps) {
15
+ const running = steps.find(step => step.status === "running");
16
+ if (running) return running.id;
17
+ if (steps.some(step => step.status === "failed")) return undefined;
18
+ return steps.find(step => step.status === "pending")?.id;
19
+ }
20
+ function progressLabel(steps) {
21
+ const done = steps.filter(step => step.status === "done").length;
22
+ return `${done} of ${steps.length} done`;
23
+ }
24
+ function progressTone(steps) {
25
+ if (steps.some(step => step.status === "failed")) return "danger";
26
+ if (steps.some(step => step.status === "running")) return "waiting";
27
+ const settled = steps.every(step => step.status === "done" || step.status === "skipped");
28
+ return steps.length > 0 && settled ? "done" : "idle";
29
+ }
30
+ function StepRow(t0) {
31
+ const $ = _c(26);
32
+ const {
33
+ step,
34
+ current,
35
+ last
36
+ } = t0;
37
+ const t1 = step.status;
38
+ const t2 = current ? "step" : undefined;
39
+ let t3;
40
+ if ($[0] !== last) {
41
+ t3 = !last && /*#__PURE__*/_jsx("span", {
42
+ "aria-hidden": true,
43
+ className: "absolute top-5 bottom-0.5 left-[7.5px] w-px bg-border"
44
+ });
45
+ $[0] = last;
46
+ $[1] = t3;
47
+ } else {
48
+ t3 = $[1];
49
+ }
50
+ let t4;
51
+ if ($[2] !== current || $[3] !== step.status) {
52
+ t4 = /*#__PURE__*/_jsx(StepIcon, {
53
+ status: step.status,
54
+ current: current
55
+ });
56
+ $[2] = current;
57
+ $[3] = step.status;
58
+ $[4] = t4;
59
+ } else {
60
+ t4 = $[4];
61
+ }
62
+ const t5 = stepTitleTones[step.status];
63
+ const t6 = current && step.status === "pending" && "text-foreground";
64
+ let t7;
65
+ if ($[5] !== t5 || $[6] !== t6) {
66
+ t7 = cn("text-sm leading-snug", t5, t6);
67
+ $[5] = t5;
68
+ $[6] = t6;
69
+ $[7] = t7;
70
+ } else {
71
+ t7 = $[7];
72
+ }
73
+ const t8 = stepStatusLabels[step.status];
74
+ let t9;
75
+ if ($[8] !== t8) {
76
+ t9 = /*#__PURE__*/_jsxs("span", {
77
+ className: "sr-only",
78
+ children: [" (", t8, ")"]
79
+ });
80
+ $[8] = t8;
81
+ $[9] = t9;
82
+ } else {
83
+ t9 = $[9];
84
+ }
85
+ let t10;
86
+ if ($[10] !== step.title || $[11] !== t7 || $[12] !== t9) {
87
+ t10 = /*#__PURE__*/_jsxs("span", {
88
+ className: t7,
89
+ children: [step.title, t9]
90
+ });
91
+ $[10] = step.title;
92
+ $[11] = t7;
93
+ $[12] = t9;
94
+ $[13] = t10;
95
+ } else {
96
+ t10 = $[13];
97
+ }
98
+ let t11;
99
+ if ($[14] !== step.detail || $[15] !== step.status) {
100
+ t11 = step.detail && /*#__PURE__*/_jsx("span", {
101
+ className: cn("font-mono text-xs text-muted-foreground", step.status === "failed" && "font-sans text-destructive"),
102
+ children: step.detail
103
+ });
104
+ $[14] = step.detail;
105
+ $[15] = step.status;
106
+ $[16] = t11;
107
+ } else {
108
+ t11 = $[16];
109
+ }
110
+ let t12;
111
+ if ($[17] !== t10 || $[18] !== t11) {
112
+ t12 = /*#__PURE__*/_jsxs("div", {
113
+ className: "flex min-w-0 flex-col gap-0.5",
114
+ children: [t10, t11]
115
+ });
116
+ $[17] = t10;
117
+ $[18] = t11;
118
+ $[19] = t12;
119
+ } else {
120
+ t12 = $[19];
121
+ }
122
+ let t13;
123
+ if ($[20] !== step.status || $[21] !== t12 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4) {
124
+ t13 = /*#__PURE__*/_jsxs("li", {
125
+ "data-slot": "step",
126
+ "data-status": t1,
127
+ "aria-current": t2,
128
+ className: "relative flex gap-3 pb-4 last:pb-0",
129
+ children: [t3, t4, t12]
130
+ });
131
+ $[20] = step.status;
132
+ $[21] = t12;
133
+ $[22] = t2;
134
+ $[23] = t3;
135
+ $[24] = t4;
136
+ $[25] = t13;
137
+ } else {
138
+ t13 = $[25];
139
+ }
140
+ return t13;
141
+ }
142
+ export function Steps(t0) {
143
+ const $ = _c(24);
144
+ const {
145
+ steps,
146
+ title: t1,
147
+ className
148
+ } = t0;
149
+ const title = t1 === undefined ? "Plan" : t1;
150
+ let t2;
151
+ if ($[0] !== steps) {
152
+ t2 = currentStepId(steps);
153
+ $[0] = steps;
154
+ $[1] = t2;
155
+ } else {
156
+ t2 = $[1];
157
+ }
158
+ const currentId = t2;
159
+ let t3;
160
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
161
+ t3 = /*#__PURE__*/_jsx(ListChecksIcon, {
162
+ "aria-hidden": true
163
+ });
164
+ $[2] = t3;
165
+ } else {
166
+ t3 = $[2];
167
+ }
168
+ let t4;
169
+ if ($[3] !== steps) {
170
+ t4 = progressLabel(steps);
171
+ $[3] = steps;
172
+ $[4] = t4;
173
+ } else {
174
+ t4 = $[4];
175
+ }
176
+ let t5;
177
+ if ($[5] !== steps) {
178
+ t5 = progressTone(steps);
179
+ $[5] = steps;
180
+ $[6] = t5;
181
+ } else {
182
+ t5 = $[6];
183
+ }
184
+ let t6;
185
+ if ($[7] !== t4 || $[8] !== t5 || $[9] !== title) {
186
+ t6 = /*#__PURE__*/_jsx(PanelHeader, {
187
+ icon: t3,
188
+ eyebrow: title,
189
+ status: t4,
190
+ tone: t5
191
+ });
192
+ $[7] = t4;
193
+ $[8] = t5;
194
+ $[9] = title;
195
+ $[10] = t6;
196
+ } else {
197
+ t6 = $[10];
198
+ }
199
+ let t7;
200
+ if ($[11] !== currentId || $[12] !== steps) {
201
+ let t8;
202
+ if ($[14] !== currentId || $[15] !== steps.length) {
203
+ t8 = (step, position) => /*#__PURE__*/_jsx(StepRow, {
204
+ step: step,
205
+ current: step.id === currentId,
206
+ last: position === steps.length - 1
207
+ }, step.id);
208
+ $[14] = currentId;
209
+ $[15] = steps.length;
210
+ $[16] = t8;
211
+ } else {
212
+ t8 = $[16];
213
+ }
214
+ t7 = steps.map(t8);
215
+ $[11] = currentId;
216
+ $[12] = steps;
217
+ $[13] = t7;
218
+ } else {
219
+ t7 = $[13];
220
+ }
221
+ let t8;
222
+ if ($[17] !== t7) {
223
+ t8 = /*#__PURE__*/_jsx("ol", {
224
+ className: "flex flex-col px-5 pt-4 pb-5",
225
+ children: t7
226
+ });
227
+ $[17] = t7;
228
+ $[18] = t8;
229
+ } else {
230
+ t8 = $[18];
231
+ }
232
+ let t9;
233
+ if ($[19] !== className || $[20] !== t6 || $[21] !== t8 || $[22] !== title) {
234
+ t9 = /*#__PURE__*/_jsxs(ApprovalPanel, {
235
+ "data-slot": "steps",
236
+ "aria-label": title,
237
+ className: className,
238
+ children: [t6, t8]
239
+ });
240
+ $[19] = className;
241
+ $[20] = t6;
242
+ $[21] = t8;
243
+ $[22] = title;
244
+ $[23] = t9;
245
+ } else {
246
+ t9 = $[23];
247
+ }
248
+ return t9;
249
+ }
@@ -0,0 +1,6 @@
1
+ import type { ReasoningPart } from "../../types.js";
2
+ export type ThinkingProps = Omit<ReasoningPart, "type"> & {
3
+ defaultOpen?: boolean;
4
+ className?: string;
5
+ };
6
+ export declare function Thinking({ text, state, durationMs, defaultOpen, className }: ThinkingProps): import("react").JSX.Element;
@@ -0,0 +1,211 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { Idea as BrainIcon, ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
5
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from "@locusgraph/components";
6
+ import { useEffect, useRef, useState } from "react";
7
+ import { firstLineOf, thoughtDurationLabel } from "./thought-duration.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ function useThinkingOpen(streaming, defaultOpen) {
10
+ const $ = _c(6);
11
+ const [open, setOpen] = useState(defaultOpen ?? streaming);
12
+ const openedByUser = useRef(false);
13
+ const wasStreaming = useRef(streaming);
14
+ let t0;
15
+ let t1;
16
+ if ($[0] !== streaming) {
17
+ t0 = () => {
18
+ if (wasStreaming.current === streaming) {
19
+ return;
20
+ }
21
+ wasStreaming.current = streaming;
22
+ if (streaming) {
23
+ setOpen(true);
24
+ } else {
25
+ if (!openedByUser.current) {
26
+ setOpen(false);
27
+ }
28
+ }
29
+ };
30
+ t1 = [streaming];
31
+ $[0] = streaming;
32
+ $[1] = t0;
33
+ $[2] = t1;
34
+ } else {
35
+ t0 = $[1];
36
+ t1 = $[2];
37
+ }
38
+ useEffect(t0, t1);
39
+ let t2;
40
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
41
+ t2 = function toggle(next) {
42
+ setOpen(next);
43
+ openedByUser.current = next;
44
+ };
45
+ $[3] = t2;
46
+ } else {
47
+ t2 = $[3];
48
+ }
49
+ const toggle = t2;
50
+ let t3;
51
+ if ($[4] !== open) {
52
+ t3 = [open, toggle];
53
+ $[4] = open;
54
+ $[5] = t3;
55
+ } else {
56
+ t3 = $[5];
57
+ }
58
+ return t3;
59
+ }
60
+ export function Thinking(t0) {
61
+ const $ = _c(34);
62
+ const {
63
+ text,
64
+ state,
65
+ durationMs,
66
+ defaultOpen,
67
+ className
68
+ } = t0;
69
+ const streaming = state === "streaming";
70
+ const [open, setOpen] = useThinkingOpen(streaming, defaultOpen);
71
+ let t1;
72
+ if ($[0] !== text) {
73
+ t1 = firstLineOf(text);
74
+ $[0] = text;
75
+ $[1] = t1;
76
+ } else {
77
+ t1 = $[1];
78
+ }
79
+ const summary = t1;
80
+ const t2 = streaming ? "streaming" : "done";
81
+ let t3;
82
+ if ($[2] !== className) {
83
+ t3 = cn("flex min-w-0 flex-col gap-2 text-sm text-muted-foreground", className);
84
+ $[2] = className;
85
+ $[3] = t3;
86
+ } else {
87
+ t3 = $[3];
88
+ }
89
+ let t4;
90
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
91
+ t4 = /*#__PURE__*/_jsx(BrainIcon, {
92
+ className: "size-3.5 shrink-0",
93
+ "aria-hidden": true
94
+ });
95
+ $[4] = t4;
96
+ } else {
97
+ t4 = $[4];
98
+ }
99
+ const t5 = streaming && "motion-safe:shimmer";
100
+ let t6;
101
+ if ($[5] !== t5) {
102
+ t6 = cn(t5);
103
+ $[5] = t5;
104
+ $[6] = t6;
105
+ } else {
106
+ t6 = $[6];
107
+ }
108
+ let t7;
109
+ if ($[7] !== durationMs || $[8] !== streaming) {
110
+ t7 = streaming ? "Thinking\u2026" : thoughtDurationLabel(durationMs);
111
+ $[7] = durationMs;
112
+ $[8] = streaming;
113
+ $[9] = t7;
114
+ } else {
115
+ t7 = $[9];
116
+ }
117
+ let t8;
118
+ if ($[10] !== t6 || $[11] !== t7) {
119
+ t8 = /*#__PURE__*/_jsx("span", {
120
+ "aria-live": "polite",
121
+ className: t6,
122
+ children: t7
123
+ });
124
+ $[10] = t6;
125
+ $[11] = t7;
126
+ $[12] = t8;
127
+ } else {
128
+ t8 = $[12];
129
+ }
130
+ const t9 = open && "rotate-90";
131
+ 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;
136
+ } else {
137
+ t10 = $[14];
138
+ }
139
+ let t11;
140
+ if ($[15] !== t10) {
141
+ t11 = /*#__PURE__*/_jsx(ChevronRightIcon, {
142
+ "aria-hidden": true,
143
+ className: t10
144
+ });
145
+ $[15] = t10;
146
+ $[16] = t11;
147
+ } else {
148
+ t11 = $[16];
149
+ }
150
+ let t12;
151
+ if ($[17] !== open || $[18] !== t11 || $[19] !== t8) {
152
+ t12 = /*#__PURE__*/_jsxs(CollapsibleTrigger, {
153
+ "aria-expanded": open,
154
+ className: "group 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;
160
+ $[20] = t12;
161
+ } else {
162
+ t12 = $[20];
163
+ }
164
+ 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, {
180
+ "data-slot": "thinking-content",
181
+ className: "ml-[6.5px] border-l border-border pl-4 leading-relaxed whitespace-pre-wrap",
182
+ children: text
183
+ });
184
+ $[24] = text;
185
+ $[25] = t14;
186
+ } else {
187
+ t14 = $[25];
188
+ }
189
+ let t15;
190
+ if ($[26] !== open || $[27] !== setOpen || $[28] !== t12 || $[29] !== t13 || $[30] !== t14 || $[31] !== t2 || $[32] !== t3) {
191
+ t15 = /*#__PURE__*/_jsxs(Collapsible, {
192
+ "data-slot": "thinking",
193
+ "data-state": t2,
194
+ open: open,
195
+ onOpenChange: setOpen,
196
+ className: t3,
197
+ children: [t12, t13, t14]
198
+ });
199
+ $[26] = open;
200
+ $[27] = setOpen;
201
+ $[28] = t12;
202
+ $[29] = t13;
203
+ $[30] = t14;
204
+ $[31] = t2;
205
+ $[32] = t3;
206
+ $[33] = t15;
207
+ } else {
208
+ t15 = $[33];
209
+ }
210
+ return t15;
211
+ }
@@ -0,0 +1,2 @@
1
+ export declare function thoughtDurationLabel(durationMs: number | undefined): string;
2
+ export declare function firstLineOf(text: string): string;
@@ -0,0 +1,11 @@
1
+ export function thoughtDurationLabel(durationMs) {
2
+ if (durationMs === undefined) return "Thought for a few seconds";
3
+ const totalSeconds = Math.max(1, Math.round(durationMs / 1000));
4
+ if (totalSeconds < 60) return `Thought for ${totalSeconds}s`;
5
+ const minutes = Math.floor(totalSeconds / 60);
6
+ const seconds = totalSeconds % 60;
7
+ return seconds === 0 ? `Thought for ${minutes}m` : `Thought for ${minutes}m ${seconds}s`;
8
+ }
9
+ export function firstLineOf(text) {
10
+ return text.trim().split("\n")[0]?.trim() ?? "";
11
+ }
@@ -0,0 +1,5 @@
1
+ export declare function prettyJson(value: unknown): string;
2
+ export declare function JsonBlock({ label, value }: {
3
+ label: string;
4
+ value: unknown;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Code } from "../../thread/code/code.js";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ export function prettyJson(value) {
5
+ if (typeof value === "string") return value;
6
+ try {
7
+ return JSON.stringify(value, null, 2) ?? String(value);
8
+ } catch {
9
+ return String(value);
10
+ }
11
+ }
12
+ export function JsonBlock(t0) {
13
+ const $ = _c(5);
14
+ const {
15
+ label,
16
+ value
17
+ } = t0;
18
+ let t1;
19
+ if ($[0] !== value) {
20
+ t1 = prettyJson(value);
21
+ $[0] = value;
22
+ $[1] = t1;
23
+ } else {
24
+ t1 = $[1];
25
+ }
26
+ let t2;
27
+ if ($[2] !== label || $[3] !== t1) {
28
+ t2 = /*#__PURE__*/_jsx(Code, {
29
+ "data-slot": "tool-json",
30
+ code: t1,
31
+ language: "json",
32
+ filename: label,
33
+ className: "[&_[data-slot=code-area]]:max-h-72 [&_[data-slot=code-area]]:overflow-auto"
34
+ });
35
+ $[2] = label;
36
+ $[3] = t1;
37
+ $[4] = t2;
38
+ } else {
39
+ t2 = $[4];
40
+ }
41
+ return t2;
42
+ }
@@ -0,0 +1,6 @@
1
+ import type { ToolState } from "../../types.js";
2
+ export declare const toolStateLabels: Record<ToolState, string>;
3
+ export declare function isToolBusy(state: ToolState): state is "input-available" | "input-streaming";
4
+ export declare function ToolStatus({ state }: {
5
+ state: ToolState;
6
+ }): import("react").JSX.Element;