@locusgraph/loop 0.3.0 → 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 (130) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +70 -17
  3. package/dist/agent/pulse/marks/bars-mark.js +39 -15
  4. package/dist/agent/pulse/marks/glyph-mark.js +57 -16
  5. package/dist/agent/pulse/marks/locus-mark.js +39 -13
  6. package/dist/agent/pulse/marks/orb-mark.js +21 -9
  7. package/dist/agent/pulse/pulse.js +1 -1
  8. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  9. package/dist/agent/pulse/use-loop-animation.js +36 -15
  10. package/dist/agent/steps/step-icon.js +20 -13
  11. package/dist/agent/steps/steps.js +39 -37
  12. package/dist/agent/thinking/thinking.js +65 -62
  13. package/dist/agent/tool/json-block.js +10 -7
  14. package/dist/agent/tool/tool-status.d.ts +2 -0
  15. package/dist/agent/tool/tool-status.js +16 -13
  16. package/dist/agent/tool/tool.d.ts +8 -1
  17. package/dist/agent/tool/tool.js +238 -119
  18. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  19. package/dist/approval/inbox/inbox-row.js +248 -86
  20. package/dist/approval/inbox/inbox.d.ts +3 -3
  21. package/dist/approval/inbox/inbox.js +251 -57
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  23. package/dist/approval/inbox/virtual-inbox-list.js +107 -30
  24. package/dist/approval/memory/memory-review.js +228 -91
  25. package/dist/approval/memory/memory-row.js +192 -56
  26. package/dist/approval/plan/plan-review.js +241 -108
  27. package/dist/approval/plan/plan-step-row.js +184 -77
  28. package/dist/approval/plan/plan-steps.d.ts +1 -1
  29. package/dist/approval/plan/plan-steps.js +2 -2
  30. package/dist/approval/plan/question-choices.js +139 -48
  31. package/dist/approval/plan/question.js +189 -67
  32. package/dist/approval/run/run-bar.js +138 -49
  33. package/dist/approval/shared/approval-line.d.ts +27 -0
  34. package/dist/approval/shared/approval-line.js +85 -0
  35. package/dist/approval/shared/risk-badge.d.ts +3 -5
  36. package/dist/approval/shared/risk-badge.js +11 -19
  37. package/dist/approval/shared/time.d.ts +0 -1
  38. package/dist/approval/shared/time.js +0 -1
  39. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  40. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  41. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  42. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  43. package/dist/approval/spend/raise-cap-form.js +235 -52
  44. package/dist/approval/spend/spend-gate.js +200 -106
  45. package/dist/approval/spend/spend-math.d.ts +1 -0
  46. package/dist/approval/spend/spend-math.js +5 -2
  47. package/dist/approval/spend/spend-meter.js +5 -5
  48. package/dist/approval/tool/approval.js +157 -96
  49. package/dist/approval/tool/args/args-editor.js +232 -81
  50. package/dist/approval/tool/args/args-field.js +333 -60
  51. package/dist/approval/tool/deny-form.js +114 -32
  52. package/dist/approval/tool/tool-inputs.js +93 -33
  53. package/dist/chat/chat/chat.js +5 -4
  54. package/dist/chat/chat/use-stick-to-bottom.js +116 -63
  55. package/dist/chat/chat/virtual-chat-items.js +129 -34
  56. package/dist/chat/composer/composer-actions.d.ts +1 -2
  57. package/dist/chat/composer/composer-actions.js +136 -50
  58. package/dist/chat/composer/composer-status.d.ts +2 -0
  59. package/dist/chat/composer/composer-status.js +3 -0
  60. package/dist/chat/composer/composer.d.ts +1 -1
  61. package/dist/chat/composer/composer.js +6 -4
  62. package/dist/chat/composer/use-auto-grow.js +29 -8
  63. package/dist/chat/files/files.js +296 -67
  64. package/dist/chat/index.d.ts +1 -1
  65. package/dist/chat/index.js +1 -1
  66. package/dist/chat/reply/fenced-code.js +1 -1
  67. package/dist/chat/reply/markdown-components.js +9 -116
  68. package/dist/chat/reply/reply.js +2 -2
  69. package/dist/chat/turn/group-parts.d.ts +1 -0
  70. package/dist/chat/turn/group-parts.js +6 -3
  71. package/dist/chat/turn/turn.js +13 -4
  72. package/dist/cost/context.js +3 -3
  73. package/dist/cost/cost-steps.js +31 -30
  74. package/dist/cost/cost.js +39 -39
  75. package/dist/cost/model-picker.js +176 -43
  76. package/dist/cost/shared/context-breakdown.js +10 -11
  77. package/dist/cost/shared/model-option-row.js +4 -3
  78. package/dist/cost/shared/step-cost-row.js +11 -12
  79. package/dist/cost/shared/usage-totals.d.ts +1 -0
  80. package/dist/cost/shared/usage-totals.js +19 -1
  81. package/dist/memory/cite.js +190 -59
  82. package/dist/memory/memorized.js +231 -62
  83. package/dist/memory/recall.js +272 -85
  84. package/dist/memory/shared/host-label.d.ts +1 -1
  85. package/dist/memory/shared/host-label.js +2 -2
  86. package/dist/memory/shared/source-mark.js +1 -1
  87. package/dist/memory/sources.d.ts +2 -1
  88. package/dist/memory/sources.js +277 -62
  89. package/dist/shared/decision-summary.js +2 -1
  90. package/dist/shared/line.d.ts +10 -0
  91. package/dist/shared/line.js +11 -0
  92. package/dist/shared/live-status.d.ts +3 -0
  93. package/dist/shared/live-status.js +11 -0
  94. package/dist/shared/reduced-motion.d.ts +1 -0
  95. package/dist/shared/reduced-motion.js +3 -0
  96. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  97. package/dist/thread/actions/action-button.js +1 -1
  98. package/dist/thread/actions/actions.d.ts +3 -1
  99. package/dist/thread/actions/actions.js +100 -81
  100. package/dist/thread/actions/branch-switcher.js +129 -23
  101. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  102. package/dist/thread/canvas/canvas-meta.js +35 -0
  103. package/dist/thread/canvas/canvas.d.ts +1 -1
  104. package/dist/thread/canvas/canvas.js +64 -74
  105. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  106. package/dist/thread/canvas/version-switcher.js +161 -45
  107. package/dist/thread/code/code.js +4 -6
  108. package/dist/thread/code/copy-code-button.d.ts +2 -1
  109. package/dist/thread/code/copy-code-button.js +91 -26
  110. package/dist/thread/history/history.d.ts +1 -1
  111. package/dist/thread/history/history.js +104 -104
  112. package/dist/thread/history/row/history-row.js +106 -22
  113. package/dist/thread/history/row/thread-item-menu.js +84 -20
  114. package/dist/thread/history/row/thread-title-editor.js +74 -29
  115. package/dist/thread/history/virtual-history-list.js +83 -46
  116. package/dist/thread/index.d.ts +1 -0
  117. package/dist/thread/index.js +1 -0
  118. package/dist/thread/starters/starters.js +91 -28
  119. package/dist/thread/use-copied.js +40 -10
  120. package/package.json +6 -6
  121. package/dist/agent/shared/status-dot.d.ts +0 -1
  122. package/dist/agent/shared/status-dot.js +0 -1
  123. package/dist/approval/shared/decision-line.d.ts +0 -1
  124. package/dist/approval/shared/decision-line.js +0 -1
  125. package/dist/memory/shared/disclosure.d.ts +0 -6
  126. package/dist/memory/shared/disclosure.js +0 -6
  127. package/dist/shared/panel.d.ts +0 -19
  128. package/dist/shared/panel.js +0 -77
  129. package/dist/shared/status-dot.d.ts +0 -6
  130. package/dist/shared/status-dot.js +0 -20
@@ -1,6 +1,8 @@
1
- import { Pause as PauseIcon, Play as PlayIcon, SkipForward as SkipForwardIcon, StopFilledAlt as SquareIcon } from "@carbon/icons-react";
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
2
4
  import { Button, cn } from "@locusgraph/components";
3
- import { StatusDot } from "../../shared/status-dot.js";
5
+ import { Pause as PauseIcon, Play as PlayIcon, SkipForward as SkipForwardIcon, Stop as SquareIcon } from "@phosphor-icons/react/ssr";
4
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
7
  const statusLabels = {
6
8
  running: "Running",
@@ -9,11 +11,12 @@ const statusLabels = {
9
11
  done: "Done"
10
12
  };
11
13
  const statusTone = {
12
- running: "running",
13
- paused: "waiting",
14
- stopped: "danger",
15
- done: "done"
14
+ running: "text-muted-foreground motion-safe:locus-shimmer",
15
+ paused: "font-medium text-warn",
16
+ stopped: "font-medium text-destructive",
17
+ done: "font-medium text-good"
16
18
  };
19
+ const quietButtonClass = "text-faint hover:bg-transparent hover:text-interactive";
17
20
  function twoDigits(value) {
18
21
  return String(value).padStart(2, "0");
19
22
  }
@@ -25,56 +28,109 @@ function formatElapsed(elapsedMs) {
25
28
  if (hours > 0) return `${hours}:${twoDigits(minutes)}:${twoDigits(seconds)}`;
26
29
  return `${minutes}:${twoDigits(seconds)}`;
27
30
  }
28
- export function RunBar({
29
- status,
30
- runName,
31
- elapsedMs,
32
- onPause,
33
- onResume,
34
- onStop,
35
- onStep,
36
- pending = false,
37
- className
38
- }) {
31
+ export function RunBar(t0) {
32
+ const $ = _c(29);
33
+ const {
34
+ status,
35
+ runName,
36
+ elapsedMs,
37
+ onPause,
38
+ onResume,
39
+ onStop,
40
+ onStep,
41
+ pending: t1,
42
+ className
43
+ } = t0;
44
+ const pending = t1 === undefined ? false : t1;
39
45
  const live = status === "running" || status === "paused";
40
46
  const paused = status === "paused";
41
- return /*#__PURE__*/_jsxs("div", {
42
- role: "toolbar",
43
- "aria-label": runName ? `Controls for ${runName}` : "Run controls",
44
- "data-slot": "run-bar",
45
- "data-status": status,
46
- className: 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),
47
- children: [/*#__PURE__*/_jsxs("span", {
48
- className: "flex min-w-0 flex-1 items-center gap-2.5 text-sm",
49
- children: [/*#__PURE__*/_jsx(StatusDot, {
50
- tone: statusTone[status],
51
- className: "size-2"
52
- }), runName && /*#__PURE__*/_jsx("span", {
53
- className: "truncate font-medium",
54
- children: runName
55
- }), /*#__PURE__*/_jsx("span", {
56
- role: "status",
57
- "aria-live": "polite",
58
- className: "locus-eyebrow shrink-0",
59
- children: statusLabels[status]
60
- }), elapsedMs !== undefined && /*#__PURE__*/_jsxs("span", {
61
- className: "shrink-0 font-mono text-xs text-muted-foreground tabular-nums",
62
- children: [/*#__PURE__*/_jsx("span", {
63
- className: "sr-only",
64
- children: "Elapsed "
65
- }), formatElapsed(elapsedMs)]
66
- })]
67
- }), live && /*#__PURE__*/_jsxs("span", {
68
- className: "ml-auto flex shrink-0 items-center gap-1",
47
+ const t2 = runName ? `Controls for ${runName}` : "Run controls";
48
+ let t3;
49
+ if ($[0] !== className) {
50
+ t3 = cn("flex min-h-control-sm min-w-0 flex-wrap items-center gap-x-3 gap-y-1", className);
51
+ $[0] = className;
52
+ $[1] = t3;
53
+ } else {
54
+ t3 = $[1];
55
+ }
56
+ let t4;
57
+ if ($[2] !== runName) {
58
+ t4 = runName && /*#__PURE__*/_jsx("span", {
59
+ className: "truncate font-medium text-foreground",
60
+ children: runName
61
+ });
62
+ $[2] = runName;
63
+ $[3] = t4;
64
+ } else {
65
+ t4 = $[3];
66
+ }
67
+ const t5 = statusTone[status];
68
+ let t6;
69
+ if ($[4] !== t5) {
70
+ t6 = cn("shrink-0", t5);
71
+ $[4] = t5;
72
+ $[5] = t6;
73
+ } else {
74
+ t6 = $[5];
75
+ }
76
+ const t7 = statusLabels[status];
77
+ let t8;
78
+ if ($[6] !== t6 || $[7] !== t7) {
79
+ t8 = /*#__PURE__*/_jsx("span", {
80
+ role: "status",
81
+ "aria-live": "polite",
82
+ className: t6,
83
+ children: t7
84
+ });
85
+ $[6] = t6;
86
+ $[7] = t7;
87
+ $[8] = t8;
88
+ } else {
89
+ t8 = $[8];
90
+ }
91
+ let t9;
92
+ if ($[9] !== elapsedMs) {
93
+ t9 = elapsedMs !== undefined && /*#__PURE__*/_jsxs("span", {
94
+ className: "shrink-0 text-faint tabular-nums",
95
+ children: [/*#__PURE__*/_jsx("span", {
96
+ className: "sr-only",
97
+ children: "Elapsed "
98
+ }), formatElapsed(elapsedMs)]
99
+ });
100
+ $[9] = elapsedMs;
101
+ $[10] = t9;
102
+ } else {
103
+ t9 = $[10];
104
+ }
105
+ let t10;
106
+ if ($[11] !== t4 || $[12] !== t8 || $[13] !== t9) {
107
+ t10 = /*#__PURE__*/_jsxs("span", {
108
+ className: "flex min-w-0 flex-auto items-center gap-2.5 text-sm",
109
+ children: [t4, t8, t9]
110
+ });
111
+ $[11] = t4;
112
+ $[12] = t8;
113
+ $[13] = t9;
114
+ $[14] = t10;
115
+ } else {
116
+ t10 = $[14];
117
+ }
118
+ let t11;
119
+ if ($[15] !== live || $[16] !== onPause || $[17] !== onResume || $[18] !== onStep || $[19] !== onStop || $[20] !== paused || $[21] !== pending) {
120
+ t11 = live && /*#__PURE__*/_jsxs("span", {
121
+ className: "flex shrink-0 items-center gap-1",
69
122
  children: [/*#__PURE__*/_jsxs(Button, {
70
123
  type: "button",
71
124
  size: "xs",
72
- variant: paused ? "default" : "outline",
125
+ variant: paused ? "default" : "ghost",
126
+ className: paused ? undefined : quietButtonClass,
73
127
  disabled: pending,
74
128
  onClick: paused ? onResume : onPause,
75
129
  children: [paused ? /*#__PURE__*/_jsx(PlayIcon, {
130
+ weight: "bold",
76
131
  "aria-hidden": true
77
132
  }) : /*#__PURE__*/_jsx(PauseIcon, {
133
+ weight: "bold",
78
134
  "aria-hidden": true
79
135
  }), paused ? "Resume" : "Pause"]
80
136
  }), onStep && /*#__PURE__*/_jsxs(Button, {
@@ -83,23 +139,56 @@ export function RunBar({
83
139
  variant: "ghost",
84
140
  "aria-label": "Run one step",
85
141
  title: "Run one step",
142
+ className: quietButtonClass,
86
143
  disabled: !paused || pending,
87
144
  onClick: onStep,
88
145
  children: [/*#__PURE__*/_jsx(SkipForwardIcon, {
146
+ weight: "bold",
89
147
  "aria-hidden": true
90
148
  }), "Step"]
91
149
  }), /*#__PURE__*/_jsxs(Button, {
92
150
  type: "button",
93
151
  size: "xs",
94
152
  variant: "ghost",
95
- className: "text-muted-foreground hover:bg-destructive/10 hover:text-destructive dark:hover:bg-destructive/15",
153
+ className: "text-faint hover:bg-transparent hover:text-destructive",
96
154
  disabled: pending,
97
155
  onClick: onStop,
98
156
  children: [/*#__PURE__*/_jsx(SquareIcon, {
157
+ weight: "fill",
99
158
  "aria-hidden": true,
100
159
  className: "size-2.5 fill-current"
101
160
  }), "Stop"]
102
161
  })]
103
- })]
104
- });
162
+ });
163
+ $[15] = live;
164
+ $[16] = onPause;
165
+ $[17] = onResume;
166
+ $[18] = onStep;
167
+ $[19] = onStop;
168
+ $[20] = paused;
169
+ $[21] = pending;
170
+ $[22] = t11;
171
+ } else {
172
+ t11 = $[22];
173
+ }
174
+ let t12;
175
+ if ($[23] !== status || $[24] !== t10 || $[25] !== t11 || $[26] !== t2 || $[27] !== t3) {
176
+ t12 = /*#__PURE__*/_jsxs("div", {
177
+ role: "toolbar",
178
+ "aria-label": t2,
179
+ "data-slot": "run-bar",
180
+ "data-status": status,
181
+ className: t3,
182
+ children: [t10, t11]
183
+ });
184
+ $[23] = status;
185
+ $[24] = t10;
186
+ $[25] = t11;
187
+ $[26] = t2;
188
+ $[27] = t3;
189
+ $[28] = t12;
190
+ } else {
191
+ t12 = $[28];
192
+ }
193
+ return t12;
105
194
  }
@@ -0,0 +1,27 @@
1
+ import type { ReactNode } from "react";
2
+ import type { RiskLevel } from "../../types.js";
3
+ type PendingLineProps = {
4
+ icon: ReactNode;
5
+ status?: ReactNode;
6
+ tone?: "warn" | "destructive";
7
+ iconClassName?: string;
8
+ wrap?: boolean;
9
+ after?: ReactNode;
10
+ children: ReactNode;
11
+ };
12
+ export declare function PendingLine({ icon, status, tone, iconClassName, wrap, after, children, }: PendingLineProps): import("react").JSX.Element;
13
+ type ApprovalHeadlineProps = {
14
+ name: string;
15
+ risk?: RiskLevel;
16
+ action?: string;
17
+ icon?: ReactNode;
18
+ };
19
+ export declare function ApprovalHeadline({ name, risk, action, icon }: ApprovalHeadlineProps): import("react").JSX.Element;
20
+ type SettledLineProps = {
21
+ name: string;
22
+ verb?: string;
23
+ icon?: ReactNode;
24
+ children: ReactNode;
25
+ };
26
+ export declare function SettledLine({ name, verb, icon, children }: SettledLineProps): import("react").JSX.Element;
27
+ export {};
@@ -0,0 +1,85 @@
1
+ import { cn } from "@locusgraph/components";
2
+ import { ShieldWarning as ShieldAlertIcon, Wrench as WrenchIcon } from "@phosphor-icons/react/ssr";
3
+ import { lineIconClass, lineObjectClass, lineRowClass } from "../../shared/line.js";
4
+ import { RiskBadge } from "./risk-badge.js";
5
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
6
+ export function PendingLine({
7
+ icon,
8
+ status = "Waiting",
9
+ tone = "warn",
10
+ iconClassName,
11
+ wrap = false,
12
+ after,
13
+ children
14
+ }) {
15
+ return /*#__PURE__*/_jsxs("div", {
16
+ className: cn(lineRowClass, "w-full text-base", wrap && "items-start"),
17
+ children: [/*#__PURE__*/_jsx("span", {
18
+ "aria-hidden": true,
19
+ className: cn(lineIconClass, "size-5 [&_svg]:size-4", wrap && "mt-1.5", iconClassName),
20
+ children: icon
21
+ }), /*#__PURE__*/_jsxs("span", {
22
+ className: wrap ? "min-w-0 py-1" : "min-w-0 truncate",
23
+ children: [status && /*#__PURE__*/_jsxs(_Fragment, {
24
+ children: [/*#__PURE__*/_jsx("span", {
25
+ className: cn("font-medium", tone === "destructive" ? "text-destructive" : "text-warn"),
26
+ children: status
27
+ }), " "]
28
+ }), children]
29
+ }), after]
30
+ });
31
+ }
32
+ export function ApprovalHeadline({
33
+ name,
34
+ risk,
35
+ action = "to run",
36
+ icon
37
+ }) {
38
+ const destructive = risk === "destructive";
39
+ const RiskIcon = destructive ? ShieldAlertIcon : WrenchIcon;
40
+ return /*#__PURE__*/_jsxs(PendingLine, {
41
+ icon: icon ?? /*#__PURE__*/_jsx(RiskIcon, {
42
+ weight: "bold",
43
+ "aria-hidden": true
44
+ }),
45
+ iconClassName: destructive ? "text-destructive" : undefined,
46
+ after: risk && /*#__PURE__*/_jsx(RiskBadge, {
47
+ risk: risk,
48
+ className: "mt-1.5 ml-1"
49
+ }),
50
+ wrap: true,
51
+ children: [action, " ", /*#__PURE__*/_jsx("span", {
52
+ className: lineObjectClass,
53
+ children: name
54
+ })]
55
+ });
56
+ }
57
+ export function SettledLine({
58
+ name,
59
+ verb = "Asked to run",
60
+ icon,
61
+ children
62
+ }) {
63
+ return /*#__PURE__*/_jsxs("div", {
64
+ className: "flex min-w-0 flex-col gap-1",
65
+ children: [/*#__PURE__*/_jsxs("div", {
66
+ className: lineRowClass,
67
+ children: [/*#__PURE__*/_jsx("span", {
68
+ "aria-hidden": true,
69
+ className: lineIconClass,
70
+ children: icon ?? /*#__PURE__*/_jsx(WrenchIcon, {
71
+ weight: "bold",
72
+ "aria-hidden": true
73
+ })
74
+ }), /*#__PURE__*/_jsxs("span", {
75
+ className: "truncate",
76
+ children: [verb, " ", /*#__PURE__*/_jsx("span", {
77
+ className: lineObjectClass,
78
+ children: name
79
+ })]
80
+ })]
81
+ }), /*#__PURE__*/_jsx("div", {
82
+ children: children
83
+ })]
84
+ });
85
+ }
@@ -1,10 +1,8 @@
1
1
  import type { ReactNode } from "react";
2
- import type { PanelTone } from "../../shared/panel.js";
3
2
  import type { RiskLevel } from "../../types.js";
4
3
  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 }: {
4
+ export declare const riskCopy: Record<RiskLevel, () => ReactNode>;
5
+ export declare function RiskBadge({ risk, className }: {
9
6
  risk: RiskLevel;
7
+ className?: string;
10
8
  }): import("react").JSX.Element;
@@ -1,42 +1,34 @@
1
1
  import { Badge } from "@locusgraph/components";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  export const riskLabels = {
4
- read: "Read only",
4
+ read: "Read-only",
5
5
  write: "Writes data",
6
6
  destructive: "Destructive"
7
7
  };
8
- export const riskRing = {
9
- read: "ring-border",
10
- write: "ring-border",
11
- destructive: "ring-destructive/60"
12
- };
13
- export const riskTone = {
14
- read: "idle",
15
- write: "waiting",
16
- destructive: "danger"
17
- };
18
8
  export const riskCopy = {
19
- read: tool => `${tool} only reads data. Nothing changes if you approve.`,
20
- write: tool => `${tool} wants to make a change. Check the inputs before you approve.`,
21
- destructive: tool => /*#__PURE__*/_jsxs(_Fragment, {
22
- children: [tool, " will permanently delete or overwrite data.", " ", /*#__PURE__*/_jsx("span", {
9
+ read: () => "Only reads data. Nothing changes if you approve.",
10
+ write: () => "Makes a change. Check the inputs before you approve.",
11
+ destructive: () => /*#__PURE__*/_jsxs(_Fragment, {
12
+ children: ["Permanently deletes or overwrites data.", " ", /*#__PURE__*/_jsx("span", {
23
13
  className: "font-medium text-destructive",
24
14
  children: "This can't be undone."
25
15
  })]
26
16
  })
27
17
  };
28
18
  const riskVariant = {
29
- read: "outline",
30
- write: "secondary",
31
- destructive: "destructive"
19
+ read: "secondary",
20
+ write: "warning",
21
+ destructive: "destructive-soft"
32
22
  };
33
23
  export function RiskBadge({
34
- risk
24
+ risk,
25
+ className
35
26
  }) {
36
27
  return /*#__PURE__*/_jsx(Badge, {
37
28
  "data-slot": "risk-badge",
38
29
  "data-risk": risk,
39
30
  variant: riskVariant[risk],
31
+ className: className,
40
32
  children: riskLabels[risk]
41
33
  });
42
34
  }
@@ -1,3 +1,2 @@
1
1
  import type { DecidedAt } from "../types.js";
2
- export { formatDecidedAt, isoOf, toDate } from "../../shared/decision-summary.js";
3
2
  export declare function formatWaiting(since: DecidedAt, now: number): string;
@@ -1,5 +1,4 @@
1
1
  import { toDate } from "../../shared/decision-summary.js";
2
- export { formatDecidedAt, isoOf, toDate } from "../../shared/decision-summary.js";
3
2
  const minuteMs = 60_000;
4
3
  const hourMs = 60 * minuteMs;
5
4
  const dayMs = 24 * hourMs;
@@ -1,10 +1,28 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { useEffect, useRef } from "react";
2
5
  export function useFocusOnMount(enabled) {
6
+ const $ = _c(3);
3
7
  const ref = useRef(null);
4
- useEffect(() => {
5
- if (enabled) ref.current?.focus({
6
- preventScroll: true
7
- });
8
- }, [enabled]);
8
+ let t0;
9
+ let t1;
10
+ if ($[0] !== enabled) {
11
+ t0 = () => {
12
+ if (enabled) {
13
+ ref.current?.focus({
14
+ preventScroll: true
15
+ });
16
+ }
17
+ };
18
+ t1 = [enabled];
19
+ $[0] = enabled;
20
+ $[1] = t0;
21
+ $[2] = t1;
22
+ } else {
23
+ t0 = $[1];
24
+ t1 = $[2];
25
+ }
26
+ useEffect(t0, t1);
9
27
  return ref;
10
28
  }
@@ -0,0 +1,2 @@
1
+ import { type RefObject } from "react";
2
+ export declare function useFocusWhenSettled<Element extends HTMLElement>(waiting: boolean): RefObject<Element | null>;
@@ -0,0 +1,18 @@
1
+ import { useEffect, useRef } from "react";
2
+ function focusWasDropped() {
3
+ const active = document.activeElement;
4
+ return active === null || active === document.body;
5
+ }
6
+ export function useFocusWhenSettled(waiting) {
7
+ const ref = useRef(null);
8
+ const wasWaiting = useRef(waiting);
9
+ useEffect(() => {
10
+ if (wasWaiting.current && !waiting && focusWasDropped()) {
11
+ ref.current?.focus({
12
+ preventScroll: true
13
+ });
14
+ }
15
+ wasWaiting.current = waiting;
16
+ }, [waiting]);
17
+ return ref;
18
+ }
@@ -1,8 +1,8 @@
1
1
  type RaiseCapFormProps = {
2
- capMicroUsd: number;
2
+ minimumMicroUsd: number;
3
3
  suggestedMicroUsd: number;
4
4
  disabled?: boolean;
5
5
  onRaiseCap: (newCapMicroUsd: number) => void;
6
6
  };
7
- export declare function RaiseCapForm({ capMicroUsd, suggestedMicroUsd, disabled, onRaiseCap, }: RaiseCapFormProps): import("react").JSX.Element;
7
+ export declare function RaiseCapForm({ minimumMicroUsd, suggestedMicroUsd, disabled, onRaiseCap, }: RaiseCapFormProps): import("react").JSX.Element;
8
8
  export {};