@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,166 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { cn } from "@locusgraph/components";
3
+ import { useEffect, useRef } from "react";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ const nextIndexByKey = {
6
+ ArrowRight: (index, count) => (index + 1) % count,
7
+ ArrowDown: (index, count) => (index + 1) % count,
8
+ ArrowLeft: (index, count) => (index - 1 + count) % count,
9
+ ArrowUp: (index, count) => (index - 1 + count) % count,
10
+ Home: () => 0,
11
+ End: (_index, count) => count - 1
12
+ };
13
+ function indexFromDigitKey(key, count) {
14
+ const digit = Number(key);
15
+ return Number.isInteger(digit) && digit >= 1 && digit <= count ? digit - 1 : undefined;
16
+ }
17
+ export function QuestionChoices(t0) {
18
+ const $ = _c(25);
19
+ const {
20
+ label,
21
+ options,
22
+ selectedId,
23
+ onSelect,
24
+ autoFocus: t1
25
+ } = t0;
26
+ const autoFocus = t1 === undefined ? false : t1;
27
+ let t2;
28
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
29
+ t2 = [];
30
+ $[0] = t2;
31
+ } else {
32
+ t2 = $[0];
33
+ }
34
+ const buttons = useRef(t2);
35
+ let t3;
36
+ let t4;
37
+ if ($[1] !== autoFocus) {
38
+ t3 = () => {
39
+ if (autoFocus) {
40
+ buttons.current[0]?.focus({
41
+ preventScroll: true
42
+ });
43
+ }
44
+ };
45
+ t4 = [autoFocus];
46
+ $[1] = autoFocus;
47
+ $[2] = t3;
48
+ $[3] = t4;
49
+ } else {
50
+ t3 = $[2];
51
+ t4 = $[3];
52
+ }
53
+ useEffect(t3, t4);
54
+ let t5;
55
+ if ($[4] !== options || $[5] !== selectedId) {
56
+ let t6;
57
+ if ($[7] !== selectedId) {
58
+ t6 = option => option.id === selectedId;
59
+ $[7] = selectedId;
60
+ $[8] = t6;
61
+ } else {
62
+ t6 = $[8];
63
+ }
64
+ t5 = options.findIndex(t6);
65
+ $[4] = options;
66
+ $[5] = selectedId;
67
+ $[6] = t5;
68
+ } else {
69
+ t5 = $[6];
70
+ }
71
+ const selectedIndex = t5;
72
+ const tabStop = selectedIndex === -1 ? 0 : selectedIndex;
73
+ let t10;
74
+ let t6;
75
+ let t7;
76
+ let t8;
77
+ let t9;
78
+ if ($[9] !== label || $[10] !== onSelect || $[11] !== options || $[12] !== selectedId || $[13] !== tabStop) {
79
+ const selectIndex = function selectIndex(next) {
80
+ const option_0 = options[next];
81
+ if (!option_0) {
82
+ return;
83
+ }
84
+ onSelect(option_0.id);
85
+ buttons.current[next]?.focus();
86
+ };
87
+ const handleKeyDown = function handleKeyDown(event, index) {
88
+ const byDigit = indexFromDigitKey(event.key, options.length);
89
+ const move = nextIndexByKey[event.key];
90
+ if (byDigit === undefined && !move) {
91
+ return;
92
+ }
93
+ event.preventDefault();
94
+ selectIndex(byDigit ?? move?.(index, options.length) ?? index);
95
+ };
96
+ t6 = "radiogroup";
97
+ t7 = label;
98
+ t8 = "question-choices";
99
+ t9 = "-mx-5 flex flex-col divide-y border-y";
100
+ t10 = options.map((option_1, index_0) => {
101
+ const checked = option_1.id === selectedId;
102
+ return /*#__PURE__*/_jsxs("button", {
103
+ ref: element => {
104
+ buttons.current[index_0] = element;
105
+ },
106
+ type: "button",
107
+ role: "radio",
108
+ "aria-checked": checked,
109
+ tabIndex: index_0 === tabStop ? 0 : -1,
110
+ "data-state": checked ? "checked" : "unchecked",
111
+ onClick: () => onSelect(option_1.id),
112
+ onKeyDown: event_0 => handleKeyDown(event_0, index_0),
113
+ className: cn("group relative flex items-center gap-3 px-5 py-2.5 text-left text-sm outline-none motion-safe:transition-colors focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset", checked ? "bg-accent" : "hover:bg-accent/50"),
114
+ children: [/*#__PURE__*/_jsx("span", {
115
+ "aria-hidden": true,
116
+ className: cn("flex size-5 shrink-0 items-center justify-center font-mono text-[11px] ring-1", checked ? "bg-primary text-primary-foreground ring-primary" : "text-muted-foreground ring-input"),
117
+ children: index_0 + 1
118
+ }), /*#__PURE__*/_jsxs("span", {
119
+ className: "flex min-w-0 flex-1 flex-col",
120
+ children: [/*#__PURE__*/_jsx("span", {
121
+ className: "font-medium",
122
+ children: option_1.label
123
+ }), option_1.description && /*#__PURE__*/_jsx("span", {
124
+ className: "text-xs text-muted-foreground",
125
+ children: option_1.description
126
+ })]
127
+ })]
128
+ }, option_1.id);
129
+ });
130
+ $[9] = label;
131
+ $[10] = onSelect;
132
+ $[11] = options;
133
+ $[12] = selectedId;
134
+ $[13] = tabStop;
135
+ $[14] = t10;
136
+ $[15] = t6;
137
+ $[16] = t7;
138
+ $[17] = t8;
139
+ $[18] = t9;
140
+ } else {
141
+ t10 = $[14];
142
+ t6 = $[15];
143
+ t7 = $[16];
144
+ t8 = $[17];
145
+ t9 = $[18];
146
+ }
147
+ let t11;
148
+ if ($[19] !== t10 || $[20] !== t6 || $[21] !== t7 || $[22] !== t8 || $[23] !== t9) {
149
+ t11 = /*#__PURE__*/_jsx("div", {
150
+ role: t6,
151
+ "aria-label": t7,
152
+ "data-slot": t8,
153
+ className: t9,
154
+ children: t10
155
+ });
156
+ $[19] = t10;
157
+ $[20] = t6;
158
+ $[21] = t7;
159
+ $[22] = t8;
160
+ $[23] = t9;
161
+ $[24] = t11;
162
+ } else {
163
+ t11 = $[24];
164
+ }
165
+ return t11;
166
+ }
@@ -0,0 +1,18 @@
1
+ import type { DecidedAt, QuestionAnswer, QuestionOption } from "../types.js";
2
+ export type AnsweredQuestion = QuestionAnswer & {
3
+ by?: string;
4
+ at?: DecidedAt;
5
+ };
6
+ export type QuestionProps = {
7
+ question: string;
8
+ options?: QuestionOption[];
9
+ allowText?: boolean;
10
+ textLabel?: string;
11
+ textPlaceholder?: string;
12
+ submitLabel?: string;
13
+ answer?: AnsweredQuestion;
14
+ onAnswer: (answer: QuestionAnswer) => void;
15
+ autoFocus?: boolean;
16
+ className?: string;
17
+ };
18
+ export declare function Question({ question, options, allowText: allowTextProp, textLabel: textLabelProp, textPlaceholder: textPlaceholderProp, submitLabel, answer, onAnswer, autoFocus, className, }: QuestionProps): import("react").JSX.Element;
@@ -0,0 +1,232 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ArrowRight as ArrowRightIcon, Help as MessageCircleQuestionIcon } from "@carbon/icons-react";
3
+ import { Button, Input, Textarea } from "@locusgraph/components";
4
+ import { useId, useState } from "react";
5
+ import { ApprovalPanel, LiveStatus, PanelBody, PanelFooter, PanelHeader, PanelTitle } from "../../shared/panel.js";
6
+ import { DecisionSummary } from "../shared/decision-line.js";
7
+ import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
8
+ import { QuestionChoices } from "./question-choices.js";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ function answerText(answer, options) {
11
+ const option = options.find(item => item.id === answer.optionId);
12
+ return [option?.label, answer.text].filter(Boolean).join(" · ");
13
+ }
14
+ export function Question(t0) {
15
+ const $ = _c(42);
16
+ const {
17
+ question,
18
+ options: t1,
19
+ allowText: allowTextProp,
20
+ textLabel: textLabelProp,
21
+ textPlaceholder: textPlaceholderProp,
22
+ submitLabel: t2,
23
+ answer,
24
+ onAnswer,
25
+ autoFocus: t3,
26
+ className
27
+ } = t0;
28
+ let t4;
29
+ if ($[0] !== t1) {
30
+ t4 = t1 === undefined ? [] : t1;
31
+ $[0] = t1;
32
+ $[1] = t4;
33
+ } else {
34
+ t4 = $[1];
35
+ }
36
+ const options = t4;
37
+ const submitLabel = t2 === undefined ? "Send answer" : t2;
38
+ const autoFocus = t3 === undefined ? true : t3;
39
+ const hasOptions = options.length > 0;
40
+ const allowText = allowTextProp ?? !hasOptions;
41
+ const textLabel = textLabelProp ?? (hasOptions ? "Something else" : "Your answer");
42
+ const textPlaceholder = textPlaceholderProp ?? (hasOptions ? "Something else\u2026" : "Type an answer for the agent");
43
+ const textId = useId();
44
+ const [optionId, setOptionId] = useState();
45
+ const [text, setText] = useState("");
46
+ let t5;
47
+ if ($[2] !== text) {
48
+ t5 = text.trim();
49
+ $[2] = text;
50
+ $[3] = t5;
51
+ } else {
52
+ t5 = $[3];
53
+ }
54
+ const trimmed = t5;
55
+ const canSubmit = optionId !== undefined || trimmed !== "";
56
+ const textOnly = options.length === 0;
57
+ const textRef = useFocusOnMount(autoFocus && !answer && textOnly);
58
+ let t6;
59
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
60
+ t6 = value => {
61
+ setText(value);
62
+ if (value.trim() !== "") {
63
+ setOptionId(undefined);
64
+ }
65
+ };
66
+ $[4] = t6;
67
+ } else {
68
+ t6 = $[4];
69
+ }
70
+ const changeText = t6;
71
+ const t7 = answer ? true : undefined;
72
+ let t8;
73
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
74
+ t8 = /*#__PURE__*/_jsx(MessageCircleQuestionIcon, {
75
+ "aria-hidden": true
76
+ });
77
+ $[5] = t8;
78
+ } else {
79
+ t8 = $[5];
80
+ }
81
+ const t9 = answer ? "Answered" : "Waiting for you";
82
+ const t10 = answer ? "done" : "waiting";
83
+ let t11;
84
+ if ($[6] !== t10 || $[7] !== t9) {
85
+ t11 = /*#__PURE__*/_jsx(PanelHeader, {
86
+ icon: t8,
87
+ eyebrow: "Agent question",
88
+ status: t9,
89
+ tone: t10
90
+ });
91
+ $[6] = t10;
92
+ $[7] = t9;
93
+ $[8] = t11;
94
+ } else {
95
+ t11 = $[8];
96
+ }
97
+ const t12 = answer ? "text-muted-foreground" : undefined;
98
+ let t13;
99
+ if ($[9] !== question || $[10] !== t12) {
100
+ t13 = /*#__PURE__*/_jsx(PanelTitle, {
101
+ className: t12,
102
+ children: question
103
+ });
104
+ $[9] = question;
105
+ $[10] = t12;
106
+ $[11] = t13;
107
+ } else {
108
+ t13 = $[11];
109
+ }
110
+ let t14;
111
+ if ($[12] !== allowText || $[13] !== answer || $[14] !== autoFocus || $[15] !== canSubmit || $[16] !== onAnswer || $[17] !== optionId || $[18] !== options || $[19] !== question || $[20] !== submitLabel || $[21] !== text || $[22] !== textId || $[23] !== textLabel || $[24] !== textOnly || $[25] !== textPlaceholder || $[26] !== textRef || $[27] !== trimmed) {
112
+ t14 = answer ? /*#__PURE__*/_jsx(PanelBody, {
113
+ children: /*#__PURE__*/_jsx(DecisionSummary, {
114
+ decision: {
115
+ approved: true,
116
+ by: answer.by,
117
+ at: answer.at
118
+ },
119
+ approvedVerb: "Answered",
120
+ result: answerText(answer, options) || "No answer"
121
+ })
122
+ }) : /*#__PURE__*/_jsxs("form", {
123
+ onSubmit: event => {
124
+ event.preventDefault();
125
+ if (!canSubmit) {
126
+ return;
127
+ }
128
+ onAnswer({
129
+ optionId,
130
+ text: trimmed === "" ? undefined : trimmed
131
+ });
132
+ },
133
+ children: [/*#__PURE__*/_jsxs(PanelBody, {
134
+ className: "gap-3",
135
+ children: [!textOnly && /*#__PURE__*/_jsx(QuestionChoices, {
136
+ label: question,
137
+ options: options,
138
+ selectedId: optionId,
139
+ onSelect: id => {
140
+ setOptionId(id);
141
+ setText("");
142
+ },
143
+ autoFocus: autoFocus
144
+ }), allowText && !textOnly && /*#__PURE__*/_jsx(Input, {
145
+ id: textId,
146
+ "aria-label": textLabel,
147
+ value: text,
148
+ placeholder: textPlaceholder,
149
+ onChange: event_0 => changeText(event_0.target.value)
150
+ }), textOnly && /*#__PURE__*/_jsx(Textarea, {
151
+ id: textId,
152
+ ref: textRef,
153
+ "aria-label": textLabel,
154
+ value: text,
155
+ placeholder: textPlaceholder,
156
+ onChange: event_1 => changeText(event_1.target.value)
157
+ })]
158
+ }), /*#__PURE__*/_jsxs(PanelFooter, {
159
+ className: "justify-between",
160
+ children: [/*#__PURE__*/_jsx("span", {
161
+ className: "hidden font-mono text-[11px] text-muted-foreground sm:inline",
162
+ children: textOnly ? "The run is paused" : `Press 1–${options.length} to pick`
163
+ }), /*#__PURE__*/_jsxs(Button, {
164
+ type: "submit",
165
+ size: "sm",
166
+ disabled: !canSubmit,
167
+ children: [submitLabel, /*#__PURE__*/_jsx(ArrowRightIcon, {
168
+ "aria-hidden": true
169
+ })]
170
+ })]
171
+ })]
172
+ });
173
+ $[12] = allowText;
174
+ $[13] = answer;
175
+ $[14] = autoFocus;
176
+ $[15] = canSubmit;
177
+ $[16] = onAnswer;
178
+ $[17] = optionId;
179
+ $[18] = options;
180
+ $[19] = question;
181
+ $[20] = submitLabel;
182
+ $[21] = text;
183
+ $[22] = textId;
184
+ $[23] = textLabel;
185
+ $[24] = textOnly;
186
+ $[25] = textPlaceholder;
187
+ $[26] = textRef;
188
+ $[27] = trimmed;
189
+ $[28] = t14;
190
+ } else {
191
+ t14 = $[28];
192
+ }
193
+ let t15;
194
+ if ($[29] !== answer || $[30] !== options || $[31] !== question) {
195
+ t15 = answer ? `Answered: ${answerText(answer, options)}` : `The agent asks: ${question}`;
196
+ $[29] = answer;
197
+ $[30] = options;
198
+ $[31] = question;
199
+ $[32] = t15;
200
+ } else {
201
+ t15 = $[32];
202
+ }
203
+ let t16;
204
+ if ($[33] !== t15) {
205
+ t16 = /*#__PURE__*/_jsx(LiveStatus, {
206
+ message: t15
207
+ });
208
+ $[33] = t15;
209
+ $[34] = t16;
210
+ } else {
211
+ t16 = $[34];
212
+ }
213
+ let t17;
214
+ if ($[35] !== className || $[36] !== t11 || $[37] !== t13 || $[38] !== t14 || $[39] !== t16 || $[40] !== t7) {
215
+ t17 = /*#__PURE__*/_jsxs(ApprovalPanel, {
216
+ "data-slot": "question",
217
+ "data-answered": t7,
218
+ className: className,
219
+ children: [t11, t13, t14, t16]
220
+ });
221
+ $[35] = className;
222
+ $[36] = t11;
223
+ $[37] = t13;
224
+ $[38] = t14;
225
+ $[39] = t16;
226
+ $[40] = t7;
227
+ $[41] = t17;
228
+ } else {
229
+ t17 = $[41];
230
+ }
231
+ return t17;
232
+ }
@@ -0,0 +1,13 @@
1
+ import type { RunBarStatus } from "../types.js";
2
+ export type RunBarProps = {
3
+ status: RunBarStatus;
4
+ runName?: string;
5
+ elapsedMs?: number;
6
+ onPause: () => void;
7
+ onResume: () => void;
8
+ onStop: () => void;
9
+ onStep?: () => void;
10
+ pending?: boolean;
11
+ className?: string;
12
+ };
13
+ export declare function RunBar({ status, runName, elapsedMs, onPause, onResume, onStop, onStep, pending, className, }: RunBarProps): import("react").JSX.Element;
@@ -0,0 +1,189 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Pause as PauseIcon, Play as PlayIcon, SkipForward as SkipForwardIcon, StopFilledAlt as SquareIcon } from "@carbon/icons-react";
3
+ import { Button, cn } from "@locusgraph/components";
4
+ import { StatusDot } from "../../shared/status-dot.js";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const statusLabels = {
7
+ running: "Running",
8
+ paused: "Paused",
9
+ stopped: "Stopped",
10
+ done: "Done"
11
+ };
12
+ const statusTone = {
13
+ running: "running",
14
+ paused: "waiting",
15
+ stopped: "danger",
16
+ done: "done"
17
+ };
18
+ function twoDigits(value) {
19
+ return String(value).padStart(2, "0");
20
+ }
21
+ function formatElapsed(elapsedMs) {
22
+ const totalSeconds = Math.max(0, Math.floor(elapsedMs / 1000));
23
+ const hours = Math.floor(totalSeconds / 3600);
24
+ const minutes = Math.floor(totalSeconds % 3600 / 60);
25
+ const seconds = totalSeconds % 60;
26
+ if (hours > 0) return `${hours}:${twoDigits(minutes)}:${twoDigits(seconds)}`;
27
+ return `${minutes}:${twoDigits(seconds)}`;
28
+ }
29
+ export function RunBar(t0) {
30
+ const $ = _c(29);
31
+ const {
32
+ status,
33
+ runName,
34
+ elapsedMs,
35
+ onPause,
36
+ onResume,
37
+ onStop,
38
+ onStep,
39
+ pending: t1,
40
+ className
41
+ } = t0;
42
+ const pending = t1 === undefined ? false : t1;
43
+ const live = status === "running" || status === "paused";
44
+ const paused = status === "paused";
45
+ const t2 = runName ? `Controls for ${runName}` : "Run controls";
46
+ let t3;
47
+ if ($[0] !== className) {
48
+ t3 = cn("flex min-h-10 min-w-0 flex-wrap items-center gap-x-3 gap-y-2 bg-card py-2 pr-2 pl-3 text-card-foreground ring-1 ring-border", className);
49
+ $[0] = className;
50
+ $[1] = t3;
51
+ } else {
52
+ t3 = $[1];
53
+ }
54
+ const t4 = statusTone[status];
55
+ let t5;
56
+ if ($[2] !== t4) {
57
+ t5 = /*#__PURE__*/_jsx(StatusDot, {
58
+ tone: t4,
59
+ className: "size-2"
60
+ });
61
+ $[2] = t4;
62
+ $[3] = t5;
63
+ } else {
64
+ t5 = $[3];
65
+ }
66
+ let t6;
67
+ if ($[4] !== runName) {
68
+ t6 = runName && /*#__PURE__*/_jsx("span", {
69
+ className: "truncate font-medium",
70
+ children: runName
71
+ });
72
+ $[4] = runName;
73
+ $[5] = t6;
74
+ } else {
75
+ t6 = $[5];
76
+ }
77
+ const t7 = statusLabels[status];
78
+ let t8;
79
+ if ($[6] !== t7) {
80
+ t8 = /*#__PURE__*/_jsx("span", {
81
+ role: "status",
82
+ "aria-live": "polite",
83
+ className: "eyebrow shrink-0",
84
+ children: t7
85
+ });
86
+ $[6] = t7;
87
+ $[7] = t8;
88
+ } else {
89
+ t8 = $[7];
90
+ }
91
+ let t9;
92
+ if ($[8] !== elapsedMs) {
93
+ t9 = elapsedMs !== undefined && /*#__PURE__*/_jsxs("span", {
94
+ className: "shrink-0 font-mono text-xs text-muted-foreground tabular-nums",
95
+ children: [/*#__PURE__*/_jsx("span", {
96
+ className: "sr-only",
97
+ children: "Elapsed "
98
+ }), formatElapsed(elapsedMs)]
99
+ });
100
+ $[8] = elapsedMs;
101
+ $[9] = t9;
102
+ } else {
103
+ t9 = $[9];
104
+ }
105
+ let t10;
106
+ if ($[10] !== t5 || $[11] !== t6 || $[12] !== t8 || $[13] !== t9) {
107
+ t10 = /*#__PURE__*/_jsxs("span", {
108
+ className: "flex min-w-0 flex-1 items-center gap-2.5 text-sm",
109
+ children: [t5, t6, t8, t9]
110
+ });
111
+ $[10] = t5;
112
+ $[11] = t6;
113
+ $[12] = t8;
114
+ $[13] = t9;
115
+ $[14] = t10;
116
+ } else {
117
+ t10 = $[14];
118
+ }
119
+ let t11;
120
+ if ($[15] !== live || $[16] !== onPause || $[17] !== onResume || $[18] !== onStep || $[19] !== onStop || $[20] !== paused || $[21] !== pending) {
121
+ t11 = live && /*#__PURE__*/_jsxs("span", {
122
+ className: "ml-auto flex shrink-0 items-center gap-1",
123
+ children: [/*#__PURE__*/_jsxs(Button, {
124
+ type: "button",
125
+ size: "xs",
126
+ variant: paused ? "default" : "outline",
127
+ disabled: pending,
128
+ onClick: paused ? onResume : onPause,
129
+ children: [paused ? /*#__PURE__*/_jsx(PlayIcon, {
130
+ "aria-hidden": true
131
+ }) : /*#__PURE__*/_jsx(PauseIcon, {
132
+ "aria-hidden": true
133
+ }), paused ? "Resume" : "Pause"]
134
+ }), onStep && /*#__PURE__*/_jsxs(Button, {
135
+ type: "button",
136
+ size: "xs",
137
+ variant: "ghost",
138
+ "aria-label": "Run one step",
139
+ title: "Run one step",
140
+ disabled: !paused || pending,
141
+ onClick: onStep,
142
+ children: [/*#__PURE__*/_jsx(SkipForwardIcon, {
143
+ "aria-hidden": true
144
+ }), "Step"]
145
+ }), /*#__PURE__*/_jsxs(Button, {
146
+ type: "button",
147
+ size: "xs",
148
+ variant: "ghost",
149
+ className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive dark:hover:bg-destructive/15",
150
+ disabled: pending,
151
+ onClick: onStop,
152
+ children: [/*#__PURE__*/_jsx(SquareIcon, {
153
+ "aria-hidden": true,
154
+ className: "size-2.5 fill-current"
155
+ }), "Stop"]
156
+ })]
157
+ });
158
+ $[15] = live;
159
+ $[16] = onPause;
160
+ $[17] = onResume;
161
+ $[18] = onStep;
162
+ $[19] = onStop;
163
+ $[20] = paused;
164
+ $[21] = pending;
165
+ $[22] = t11;
166
+ } else {
167
+ t11 = $[22];
168
+ }
169
+ let t12;
170
+ if ($[23] !== status || $[24] !== t10 || $[25] !== t11 || $[26] !== t2 || $[27] !== t3) {
171
+ t12 = /*#__PURE__*/_jsxs("div", {
172
+ role: "toolbar",
173
+ "aria-label": t2,
174
+ "data-slot": "run-bar",
175
+ "data-status": status,
176
+ className: t3,
177
+ children: [t10, t11]
178
+ });
179
+ $[23] = status;
180
+ $[24] = t10;
181
+ $[25] = t11;
182
+ $[26] = t2;
183
+ $[27] = t3;
184
+ $[28] = t12;
185
+ } else {
186
+ t12 = $[28];
187
+ }
188
+ return t12;
189
+ }
@@ -0,0 +1 @@
1
+ export { DecisionSummary, type DecisionSummaryProps, } from "../../shared/decision-summary.js";
@@ -0,0 +1 @@
1
+ export { DecisionSummary } from "../../shared/decision-summary.js";
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ import type { PanelTone } from "../../shared/panel.js";
3
+ import type { RiskLevel } from "../../types.js";
4
+ export declare const riskLabels: Record<RiskLevel, string>;
5
+ export declare const riskRing: Record<RiskLevel, string>;
6
+ export declare const riskTone: Record<RiskLevel, PanelTone>;
7
+ export declare const riskCopy: Record<RiskLevel, (tool: string) => ReactNode>;
8
+ export declare function RiskBadge({ risk }: {
9
+ risk: RiskLevel;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,57 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Badge } from "@locusgraph/components";
3
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
4
+ export const riskLabels = {
5
+ read: "Read only",
6
+ write: "Writes data",
7
+ destructive: "Destructive"
8
+ };
9
+ export const riskRing = {
10
+ read: "ring-border",
11
+ write: "ring-border",
12
+ destructive: "ring-destructive/60"
13
+ };
14
+ export const riskTone = {
15
+ read: "idle",
16
+ write: "waiting",
17
+ destructive: "danger"
18
+ };
19
+ export const riskCopy = {
20
+ read: tool => `${tool} only reads data. Nothing changes if you approve.`,
21
+ write: tool => `${tool} wants to make a change. Check the inputs before you approve.`,
22
+ destructive: tool => /*#__PURE__*/_jsxs(_Fragment, {
23
+ children: [tool, " will permanently delete or overwrite data.", " ", /*#__PURE__*/_jsx("span", {
24
+ className: "font-medium text-destructive",
25
+ children: "This can't be undone."
26
+ })]
27
+ })
28
+ };
29
+ const riskVariant = {
30
+ read: "outline",
31
+ write: "secondary",
32
+ destructive: "destructive"
33
+ };
34
+ export function RiskBadge(t0) {
35
+ const $ = _c(4);
36
+ const {
37
+ risk
38
+ } = t0;
39
+ const t1 = riskVariant[risk];
40
+ const t2 = riskLabels[risk];
41
+ let t3;
42
+ if ($[0] !== risk || $[1] !== t1 || $[2] !== t2) {
43
+ t3 = /*#__PURE__*/_jsx(Badge, {
44
+ "data-slot": "risk-badge",
45
+ "data-risk": risk,
46
+ variant: t1,
47
+ children: t2
48
+ });
49
+ $[0] = risk;
50
+ $[1] = t1;
51
+ $[2] = t2;
52
+ $[3] = t3;
53
+ } else {
54
+ t3 = $[3];
55
+ }
56
+ return t3;
57
+ }
@@ -0,0 +1,3 @@
1
+ import type { DecidedAt } from "../types.js";
2
+ export { formatDecidedAt, isoOf, toDate } from "../../shared/decision-summary.js";
3
+ export declare function formatWaiting(since: DecidedAt, now: number): string;