@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,258 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { MailAll as InboxIcon } from "@carbon/icons-react";
3
+ import { Button, Checkbox, Label } from "@locusgraph/components";
4
+ import { pluralize } from "@locusgraph/utils";
5
+ import { useId, useState } from "react";
6
+ import { ApprovalPanel, LiveStatus, PanelFooter, PanelHeader, PanelTitle } from "../../shared/panel.js";
7
+ import { PanelEmpty } from "../../shared/panel-empty.js";
8
+ import { shouldVirtualize } from "../../shared/virtual/use-list-virtualizer.js";
9
+ import { InboxRow } from "./inbox-row.js";
10
+ import { bulkApprovable, selectAllState, selectedIn, toggled } from "./inbox-selection.js";
11
+ import { VirtualInboxList } from "./virtual-inbox-list.js";
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ export function Inbox(t0) {
14
+ const $ = _c(53);
15
+ const {
16
+ items,
17
+ now: t1,
18
+ title: t2,
19
+ onApprove,
20
+ onDeny,
21
+ onApproveAll,
22
+ virtualize: t3,
23
+ className
24
+ } = t0;
25
+ let t4;
26
+ if ($[0] !== t1) {
27
+ t4 = t1 === undefined ? Date.now() : t1;
28
+ $[0] = t1;
29
+ $[1] = t4;
30
+ } else {
31
+ t4 = $[1];
32
+ }
33
+ const now = t4;
34
+ const title = t2 === undefined ? "Waiting for approval" : t2;
35
+ const virtualize = t3 === undefined ? true : t3;
36
+ const selectAllId = useId();
37
+ const [selected, setSelected] = useState(_temp);
38
+ let selectable;
39
+ let selectedIds;
40
+ let t5;
41
+ if ($[2] !== items || $[3] !== selected) {
42
+ selectable = bulkApprovable(items);
43
+ selectedIds = selectedIn(items, selected);
44
+ t5 = selectAllState(selectable.length, selectedIds.length);
45
+ $[2] = items;
46
+ $[3] = selected;
47
+ $[4] = selectable;
48
+ $[5] = selectedIds;
49
+ $[6] = t5;
50
+ } else {
51
+ selectable = $[4];
52
+ selectedIds = $[5];
53
+ t5 = $[6];
54
+ }
55
+ const allState = t5;
56
+ const hasDestructive = selectable.length < items.length;
57
+ const empty = items.length === 0;
58
+ let t6;
59
+ if ($[7] !== selected) {
60
+ t6 = id => selected.has(id);
61
+ $[7] = selected;
62
+ $[8] = t6;
63
+ } else {
64
+ t6 = $[8];
65
+ }
66
+ let t7;
67
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
68
+ t7 = (id_0, on) => setSelected(current => toggled(current, id_0, on));
69
+ $[9] = t7;
70
+ } else {
71
+ t7 = $[9];
72
+ }
73
+ let T0;
74
+ let t10;
75
+ let t11;
76
+ let t12;
77
+ let t13;
78
+ let t8;
79
+ let t9;
80
+ if ($[10] !== allState || $[11] !== className || $[12] !== empty || $[13] !== hasDestructive || $[14] !== items || $[15] !== now || $[16] !== onApprove || $[17] !== onApproveAll || $[18] !== onDeny || $[19] !== selectAllId || $[20] !== selectable || $[21] !== selectedIds || $[22] !== t6 || $[23] !== title || $[24] !== virtualize) {
81
+ const rowHandlers = {
82
+ isSelected: t6,
83
+ onSelect: t7,
84
+ onApprove,
85
+ onDeny
86
+ };
87
+ T0 = ApprovalPanel;
88
+ t8 = "inbox";
89
+ t9 = title;
90
+ t10 = className;
91
+ let t14;
92
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
93
+ t14 = /*#__PURE__*/_jsx(InboxIcon, {
94
+ "aria-hidden": true
95
+ });
96
+ $[32] = t14;
97
+ } else {
98
+ t14 = $[32];
99
+ }
100
+ const t15 = empty ? "All clear" : `${items.length} waiting`;
101
+ const t16 = empty ? "done" : "waiting";
102
+ if ($[33] !== t15 || $[34] !== t16) {
103
+ t11 = /*#__PURE__*/_jsx(PanelHeader, {
104
+ icon: t14,
105
+ eyebrow: "Approvals",
106
+ status: t15,
107
+ tone: t16
108
+ });
109
+ $[33] = t15;
110
+ $[34] = t16;
111
+ $[35] = t11;
112
+ } else {
113
+ t11 = $[35];
114
+ }
115
+ if ($[36] !== title) {
116
+ t12 = /*#__PURE__*/_jsx(PanelTitle, {
117
+ children: title
118
+ });
119
+ $[36] = title;
120
+ $[37] = t12;
121
+ } else {
122
+ t12 = $[37];
123
+ }
124
+ t13 = empty ? /*#__PURE__*/_jsx(PanelEmpty, {
125
+ "data-slot": "inbox-empty",
126
+ icon: /*#__PURE__*/_jsx(InboxIcon, {
127
+ "aria-hidden": true
128
+ }),
129
+ title: "Nothing waiting for you",
130
+ description: "When an agent needs approval to write, pay, send or delete, it shows up here."
131
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
132
+ children: [shouldVirtualize(items.length, virtualize) ? /*#__PURE__*/_jsx(VirtualInboxList, {
133
+ items: items,
134
+ now: now,
135
+ ...rowHandlers
136
+ }) : /*#__PURE__*/_jsx("ul", {
137
+ className: "mt-4 flex flex-col divide-y border-t",
138
+ children: items.map(item => /*#__PURE__*/_jsx(InboxRow, {
139
+ item: item,
140
+ now: now,
141
+ selected: rowHandlers.isSelected(item.id),
142
+ onSelect: on_0 => rowHandlers.onSelect(item.id, on_0),
143
+ onApprove: () => onApprove(item.id),
144
+ onDeny: () => onDeny(item.id)
145
+ }, item.id))
146
+ }), /*#__PURE__*/_jsxs(PanelFooter, {
147
+ className: "justify-between gap-3",
148
+ children: [/*#__PURE__*/_jsxs("span", {
149
+ className: "flex min-w-0 items-center gap-3",
150
+ children: [selectable.length > 0 && /*#__PURE__*/_jsx(Checkbox, {
151
+ id: selectAllId,
152
+ checked: allState,
153
+ onCheckedChange: checked => setSelected(checked === true ? new Set(selectable.map(_temp2)) : new Set())
154
+ }), /*#__PURE__*/_jsxs(Label, {
155
+ htmlFor: selectAllId,
156
+ className: "flex min-w-0 flex-col items-start gap-0 font-normal",
157
+ children: [/*#__PURE__*/_jsxs("span", {
158
+ className: "text-sm tabular-nums",
159
+ children: [/*#__PURE__*/_jsx("span", {
160
+ className: "sr-only",
161
+ children: "Select all that can be approved together. "
162
+ }), selectedIds.length > 0 ? `${selectedIds.length} selected` : "Select all"]
163
+ }), hasDestructive && /*#__PURE__*/_jsx("span", {
164
+ className: "text-xs text-muted-foreground",
165
+ children: "Destructive requests are approved one at a time."
166
+ })]
167
+ })]
168
+ }), /*#__PURE__*/_jsx(Button, {
169
+ type: "button",
170
+ size: "sm",
171
+ disabled: selectedIds.length === 0,
172
+ onClick: () => {
173
+ onApproveAll(selectedIds);
174
+ setSelected(new Set());
175
+ },
176
+ children: selectedIds.length > 0 ? `Approve ${selectedIds.length} selected` : "Approve selected"
177
+ })]
178
+ })]
179
+ });
180
+ $[10] = allState;
181
+ $[11] = className;
182
+ $[12] = empty;
183
+ $[13] = hasDestructive;
184
+ $[14] = items;
185
+ $[15] = now;
186
+ $[16] = onApprove;
187
+ $[17] = onApproveAll;
188
+ $[18] = onDeny;
189
+ $[19] = selectAllId;
190
+ $[20] = selectable;
191
+ $[21] = selectedIds;
192
+ $[22] = t6;
193
+ $[23] = title;
194
+ $[24] = virtualize;
195
+ $[25] = T0;
196
+ $[26] = t10;
197
+ $[27] = t11;
198
+ $[28] = t12;
199
+ $[29] = t13;
200
+ $[30] = t8;
201
+ $[31] = t9;
202
+ } else {
203
+ T0 = $[25];
204
+ t10 = $[26];
205
+ t11 = $[27];
206
+ t12 = $[28];
207
+ t13 = $[29];
208
+ t8 = $[30];
209
+ t9 = $[31];
210
+ }
211
+ let t14;
212
+ if ($[38] !== empty || $[39] !== items.length || $[40] !== selectedIds) {
213
+ t14 = empty ? "No approvals waiting" : `${pluralize(items.length, "approval")} waiting, ${selectedIds.length} selected`;
214
+ $[38] = empty;
215
+ $[39] = items.length;
216
+ $[40] = selectedIds;
217
+ $[41] = t14;
218
+ } else {
219
+ t14 = $[41];
220
+ }
221
+ let t15;
222
+ if ($[42] !== t14) {
223
+ t15 = /*#__PURE__*/_jsx(LiveStatus, {
224
+ message: t14
225
+ });
226
+ $[42] = t14;
227
+ $[43] = t15;
228
+ } else {
229
+ t15 = $[43];
230
+ }
231
+ let t16;
232
+ if ($[44] !== T0 || $[45] !== t10 || $[46] !== t11 || $[47] !== t12 || $[48] !== t13 || $[49] !== t15 || $[50] !== t8 || $[51] !== t9) {
233
+ t16 = /*#__PURE__*/_jsxs(T0, {
234
+ "data-slot": t8,
235
+ "aria-label": t9,
236
+ className: t10,
237
+ children: [t11, t12, t13, t15]
238
+ });
239
+ $[44] = T0;
240
+ $[45] = t10;
241
+ $[46] = t11;
242
+ $[47] = t12;
243
+ $[48] = t13;
244
+ $[49] = t15;
245
+ $[50] = t8;
246
+ $[51] = t9;
247
+ $[52] = t16;
248
+ } else {
249
+ t16 = $[52];
250
+ }
251
+ return t16;
252
+ }
253
+ function _temp2(item_0) {
254
+ return item_0.id;
255
+ }
256
+ function _temp() {
257
+ return new Set();
258
+ }
@@ -0,0 +1,13 @@
1
+ import type { PendingApproval } from "../types.js";
2
+ export type InboxRowHandlers = {
3
+ isSelected: (id: string) => boolean;
4
+ onSelect: (id: string, selected: boolean) => void;
5
+ onApprove: (id: string) => void;
6
+ onDeny: (id: string) => void;
7
+ };
8
+ type VirtualInboxListProps = InboxRowHandlers & {
9
+ items: PendingApproval[];
10
+ now: number;
11
+ };
12
+ export declare function VirtualInboxList({ items, now, isSelected, onSelect, onApprove, onDeny, }: VirtualInboxListProps): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,129 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { cn } from "@locusgraph/components";
3
+ import { useRef } from "react";
4
+ import { rowOffsetStyle, useListVirtualizer, virtualRowClassName } from "../../shared/virtual/use-list-virtualizer.js";
5
+ import { InboxRow } from "./inbox-row.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const estimatedRowHeightPx = 57;
8
+ export function VirtualInboxList(t0) {
9
+ const $ = _c(28);
10
+ const {
11
+ items,
12
+ now,
13
+ isSelected,
14
+ onSelect,
15
+ onApprove,
16
+ onDeny
17
+ } = t0;
18
+ const scrollRef = useRef(null);
19
+ let t1;
20
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
21
+ t1 = () => scrollRef.current;
22
+ $[0] = t1;
23
+ } else {
24
+ t1 = $[0];
25
+ }
26
+ let t2;
27
+ if ($[1] !== items) {
28
+ t2 = index => items[index].id;
29
+ $[1] = items;
30
+ $[2] = t2;
31
+ } else {
32
+ t2 = $[2];
33
+ }
34
+ let t3;
35
+ if ($[3] !== items.length || $[4] !== t2) {
36
+ t3 = {
37
+ count: items.length,
38
+ getScrollElement: t1,
39
+ estimateSize: _temp,
40
+ getItemKey: t2
41
+ };
42
+ $[3] = items.length;
43
+ $[4] = t2;
44
+ $[5] = t3;
45
+ } else {
46
+ t3 = $[5];
47
+ }
48
+ const {
49
+ rows,
50
+ totalSize,
51
+ itemProps
52
+ } = useListVirtualizer(t3);
53
+ let t4;
54
+ if ($[6] !== totalSize) {
55
+ t4 = {
56
+ height: totalSize
57
+ };
58
+ $[6] = totalSize;
59
+ $[7] = t4;
60
+ } else {
61
+ t4 = $[7];
62
+ }
63
+ let t5;
64
+ if ($[8] !== isSelected || $[9] !== itemProps || $[10] !== items || $[11] !== now || $[12] !== onApprove || $[13] !== onDeny || $[14] !== onSelect || $[15] !== rows) {
65
+ let t6;
66
+ if ($[17] !== isSelected || $[18] !== itemProps || $[19] !== items || $[20] !== now || $[21] !== onApprove || $[22] !== onDeny || $[23] !== onSelect) {
67
+ t6 = row => {
68
+ const item = items[row.index];
69
+ return /*#__PURE__*/_jsx(InboxRow, {
70
+ ...itemProps(row.index),
71
+ "aria-posinset": row.index + 1,
72
+ "aria-setsize": items.length,
73
+ className: cn(virtualRowClassName, "border-b"),
74
+ style: rowOffsetStyle(row.start),
75
+ item: item,
76
+ now: now,
77
+ selected: isSelected(item.id),
78
+ onSelect: on => onSelect(item.id, on),
79
+ onApprove: () => onApprove(item.id),
80
+ onDeny: () => onDeny(item.id)
81
+ }, row.key);
82
+ };
83
+ $[17] = isSelected;
84
+ $[18] = itemProps;
85
+ $[19] = items;
86
+ $[20] = now;
87
+ $[21] = onApprove;
88
+ $[22] = onDeny;
89
+ $[23] = onSelect;
90
+ $[24] = t6;
91
+ } else {
92
+ t6 = $[24];
93
+ }
94
+ t5 = rows.map(t6);
95
+ $[8] = isSelected;
96
+ $[9] = itemProps;
97
+ $[10] = items;
98
+ $[11] = now;
99
+ $[12] = onApprove;
100
+ $[13] = onDeny;
101
+ $[14] = onSelect;
102
+ $[15] = rows;
103
+ $[16] = t5;
104
+ } else {
105
+ t5 = $[16];
106
+ }
107
+ let t6;
108
+ if ($[25] !== t4 || $[26] !== t5) {
109
+ t6 = /*#__PURE__*/_jsx("div", {
110
+ ref: scrollRef,
111
+ "data-slot": "inbox-scroll",
112
+ className: "mt-4 max-h-[min(36rem,70vh)] overflow-y-auto overscroll-contain border-t",
113
+ children: /*#__PURE__*/_jsx("ul", {
114
+ className: "relative",
115
+ style: t4,
116
+ children: t5
117
+ })
118
+ });
119
+ $[25] = t4;
120
+ $[26] = t5;
121
+ $[27] = t6;
122
+ } else {
123
+ t6 = $[27];
124
+ }
125
+ return t6;
126
+ }
127
+ function _temp() {
128
+ return estimatedRowHeightPx;
129
+ }
@@ -0,0 +1,9 @@
1
+ export * from "./inbox/inbox.js";
2
+ export * from "./memory/memory-review.js";
3
+ export * from "./plan/plan-review.js";
4
+ export * from "./plan/question.js";
5
+ export * from "./run/run-bar.js";
6
+ export * from "./spend/spend-gate.js";
7
+ export * from "./tool/approval.js";
8
+ export * from "./tool/args/args-editor.js";
9
+ export type * from "./types.js";
@@ -0,0 +1,8 @@
1
+ export * from "./inbox/inbox.js";
2
+ export * from "./memory/memory-review.js";
3
+ export * from "./plan/plan-review.js";
4
+ export * from "./plan/question.js";
5
+ export * from "./run/run-bar.js";
6
+ export * from "./spend/spend-gate.js";
7
+ export * from "./tool/approval.js";
8
+ export * from "./tool/args/args-editor.js";
@@ -0,0 +1,10 @@
1
+ import type { MemoryReviewResult, ProposedMemory } from "../types.js";
2
+ export type MemoryChoice = "keep" | "edit" | "discard";
3
+ export type MemoryDraft = {
4
+ choice: MemoryChoice;
5
+ text: string;
6
+ };
7
+ export declare function initialDrafts(memories: ProposedMemory[]): Record<string, MemoryDraft>;
8
+ export declare function reviewResult(memories: ProposedMemory[], drafts: Record<string, MemoryDraft>): MemoryReviewResult;
9
+ export declare function hasBlankEdit(drafts: Record<string, MemoryDraft>): boolean;
10
+ export declare function submitLabel(result: MemoryReviewResult): string;
@@ -0,0 +1,35 @@
1
+ export function initialDrafts(memories) {
2
+ return Object.fromEntries(memories.map(memory => [memory.id, {
3
+ choice: memory.sensitive ? "discard" : "keep",
4
+ text: memory.text
5
+ }]));
6
+ }
7
+ export function reviewResult(memories, drafts) {
8
+ const result = {
9
+ kept: [],
10
+ edited: [],
11
+ discarded: []
12
+ };
13
+ for (const memory of memories) {
14
+ const draft = drafts[memory.id] ?? {
15
+ choice: "keep",
16
+ text: memory.text
17
+ };
18
+ const text = draft.text.trim();
19
+ if (draft.choice === "discard") result.discarded.push(memory);else if (draft.choice === "edit" && text !== "" && text !== memory.text) {
20
+ result.edited.push({
21
+ ...memory,
22
+ text
23
+ });
24
+ } else result.kept.push(memory);
25
+ }
26
+ return result;
27
+ }
28
+ export function hasBlankEdit(drafts) {
29
+ return Object.values(drafts).some(draft => draft.choice === "edit" && draft.text.trim() === "");
30
+ }
31
+ export function submitLabel(result) {
32
+ const saved = result.kept.length + result.edited.length;
33
+ if (saved === 0) return "Discard all";
34
+ return `Save ${saved} ${saved === 1 ? "memory" : "memories"}`;
35
+ }
@@ -0,0 +1,11 @@
1
+ import type { ApprovalDecision, MemoryReviewResult, ProposedMemory } from "../types.js";
2
+ export type MemoryReviewProps = {
3
+ memories: ProposedMemory[];
4
+ title?: string;
5
+ description?: string;
6
+ decision?: ApprovalDecision;
7
+ onSubmit: (result: MemoryReviewResult) => void;
8
+ autoFocus?: boolean;
9
+ className?: string;
10
+ };
11
+ export declare function MemoryReview({ memories, title, description, decision, onSubmit, autoFocus, className, }: MemoryReviewProps): import("react").JSX.Element;