@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,256 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Idea as BrainIcon } from "@carbon/icons-react";
3
+ import { Button } from "@locusgraph/components";
4
+ import { pluralize } from "@locusgraph/utils";
5
+ import { useMemo, useState } from "react";
6
+ import { ApprovalPanel, LiveStatus, PanelBody, PanelFooter, PanelHeader, PanelTitle } from "../../shared/panel.js";
7
+ import { PanelEmpty } from "../../shared/panel-empty.js";
8
+ import { DecisionSummary } from "../shared/decision-line.js";
9
+ import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
10
+ import { hasBlankEdit, initialDrafts, reviewResult, submitLabel } from "./memory-choices.js";
11
+ import { MemoryRow } from "./memory-row.js";
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
+ function resultSummary(result) {
14
+ return `${result.kept.length} kept, ${result.edited.length} edited, ${result.discarded.length} discarded`;
15
+ }
16
+ function headerStatus(decision, empty) {
17
+ if (decision) return {
18
+ status: "Reviewed",
19
+ tone: "done"
20
+ };
21
+ if (empty) return {
22
+ status: "Nothing new",
23
+ tone: "idle"
24
+ };
25
+ return {
26
+ status: "Waiting for you",
27
+ tone: "waiting"
28
+ };
29
+ }
30
+ export function MemoryReview(t0) {
31
+ const $ = _c(46);
32
+ const {
33
+ memories,
34
+ title: t1,
35
+ description: t2,
36
+ decision,
37
+ onSubmit,
38
+ autoFocus: t3,
39
+ className
40
+ } = t0;
41
+ const title = t1 === undefined ? "Review new memories" : t1;
42
+ const description = t2 === undefined ? "The agent wants to remember these in LocusGraph. Keep, edit or discard each one." : t2;
43
+ const autoFocus = t3 === undefined ? true : t3;
44
+ let t4;
45
+ if ($[0] !== memories) {
46
+ t4 = () => initialDrafts(memories);
47
+ $[0] = memories;
48
+ $[1] = t4;
49
+ } else {
50
+ t4 = $[1];
51
+ }
52
+ const [drafts, setDrafts] = useState(t4);
53
+ let t5;
54
+ if ($[2] !== drafts || $[3] !== memories) {
55
+ t5 = reviewResult(memories, drafts);
56
+ $[2] = drafts;
57
+ $[3] = memories;
58
+ $[4] = t5;
59
+ } else {
60
+ t5 = $[4];
61
+ }
62
+ const result = t5;
63
+ let t6;
64
+ if ($[5] !== drafts) {
65
+ t6 = hasBlankEdit(drafts);
66
+ $[5] = drafts;
67
+ $[6] = t6;
68
+ } else {
69
+ t6 = $[6];
70
+ }
71
+ const blankEdit = t6;
72
+ const empty = memories.length === 0;
73
+ let t7;
74
+ if ($[7] !== memories) {
75
+ t7 = memories.filter(_temp);
76
+ $[7] = memories;
77
+ $[8] = t7;
78
+ } else {
79
+ t7 = $[8];
80
+ }
81
+ const sensitiveCount = t7.length;
82
+ const submitRef = useFocusOnMount(autoFocus && !decision && !empty);
83
+ let t8;
84
+ if ($[9] !== decision || $[10] !== empty) {
85
+ t8 = headerStatus(decision, empty);
86
+ $[9] = decision;
87
+ $[10] = empty;
88
+ $[11] = t8;
89
+ } else {
90
+ t8 = $[11];
91
+ }
92
+ const {
93
+ status,
94
+ tone
95
+ } = t8;
96
+ let t9;
97
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
98
+ t9 = /*#__PURE__*/_jsx(BrainIcon, {
99
+ "aria-hidden": true
100
+ });
101
+ $[12] = t9;
102
+ } else {
103
+ t9 = $[12];
104
+ }
105
+ let t10;
106
+ if ($[13] !== empty || $[14] !== memories.length) {
107
+ t10 = empty ? undefined : pluralize(memories.length, "proposed", "proposed");
108
+ $[13] = empty;
109
+ $[14] = memories.length;
110
+ $[15] = t10;
111
+ } else {
112
+ t10 = $[15];
113
+ }
114
+ let t11;
115
+ if ($[16] !== status || $[17] !== t10 || $[18] !== tone) {
116
+ t11 = /*#__PURE__*/_jsx(PanelHeader, {
117
+ icon: t9,
118
+ eyebrow: "Memory",
119
+ status: status,
120
+ tone: tone,
121
+ aside: t10
122
+ });
123
+ $[16] = status;
124
+ $[17] = t10;
125
+ $[18] = tone;
126
+ $[19] = t11;
127
+ } else {
128
+ t11 = $[19];
129
+ }
130
+ const t12 = decision ? "text-muted-foreground" : undefined;
131
+ let t13;
132
+ if ($[20] !== t12 || $[21] !== title) {
133
+ t13 = /*#__PURE__*/_jsx(PanelTitle, {
134
+ className: t12,
135
+ children: title
136
+ });
137
+ $[20] = t12;
138
+ $[21] = title;
139
+ $[22] = t13;
140
+ } else {
141
+ t13 = $[22];
142
+ }
143
+ let t14;
144
+ if ($[23] !== blankEdit || $[24] !== decision || $[25] !== description || $[26] !== drafts || $[27] !== empty || $[28] !== memories || $[29] !== onSubmit || $[30] !== result || $[31] !== sensitiveCount || $[32] !== submitRef) {
145
+ t14 = empty ? /*#__PURE__*/_jsx(PanelEmpty, {
146
+ icon: /*#__PURE__*/_jsx(BrainIcon, {
147
+ "aria-hidden": true
148
+ }),
149
+ title: "No new memories to review.",
150
+ description: "When an agent wants to remember something in LocusGraph, it shows up here."
151
+ }) : decision ? /*#__PURE__*/_jsx(PanelBody, {
152
+ children: /*#__PURE__*/_jsx(DecisionSummary, {
153
+ decision: decision,
154
+ approvedVerb: "Reviewed",
155
+ deniedVerb: "Discarded",
156
+ result: decision.approved ? "Memories reviewed" : "All memories discarded"
157
+ })
158
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
159
+ children: [/*#__PURE__*/_jsxs("p", {
160
+ className: "px-5 pt-1 text-sm text-muted-foreground",
161
+ children: [description, sensitiveCount > 0 && /*#__PURE__*/_jsxs("span", {
162
+ className: "text-warn",
163
+ children: [" ", pluralize(sensitiveCount, "memory", "memories"), " flagged as sensitive, set to discard."]
164
+ })]
165
+ }), /*#__PURE__*/_jsx(PanelBody, {
166
+ className: "pb-0",
167
+ children: /*#__PURE__*/_jsx("ul", {
168
+ className: "-mx-5 flex flex-col divide-y border-t",
169
+ children: memories.map(memory_0 => /*#__PURE__*/_jsx(MemoryRow, {
170
+ memory: memory_0,
171
+ draft: drafts[memory_0.id] ?? {
172
+ choice: "keep",
173
+ text: memory_0.text
174
+ },
175
+ onChange: draft => setDrafts(current => ({
176
+ ...current,
177
+ [memory_0.id]: draft
178
+ }))
179
+ }, memory_0.id))
180
+ })
181
+ }), /*#__PURE__*/_jsxs(PanelFooter, {
182
+ className: "justify-between",
183
+ children: [blankEdit ? /*#__PURE__*/_jsx("span", {
184
+ className: "text-xs text-destructive",
185
+ children: "An edited memory can't be empty."
186
+ }) : /*#__PURE__*/_jsxs("span", {
187
+ className: "hidden font-mono text-[11px] text-muted-foreground tabular-nums sm:inline",
188
+ children: [result.kept.length, " kept \xB7 ", result.edited.length, " edited \xB7", " ", result.discarded.length, " discarded"]
189
+ }), /*#__PURE__*/_jsx(Button, {
190
+ ref: submitRef,
191
+ type: "button",
192
+ size: "sm",
193
+ className: "ml-auto",
194
+ variant: result.kept.length + result.edited.length === 0 ? "destructive" : "default",
195
+ disabled: blankEdit,
196
+ onClick: () => onSubmit(result),
197
+ children: submitLabel(result)
198
+ })]
199
+ })]
200
+ });
201
+ $[23] = blankEdit;
202
+ $[24] = decision;
203
+ $[25] = description;
204
+ $[26] = drafts;
205
+ $[27] = empty;
206
+ $[28] = memories;
207
+ $[29] = onSubmit;
208
+ $[30] = result;
209
+ $[31] = sensitiveCount;
210
+ $[32] = submitRef;
211
+ $[33] = t14;
212
+ } else {
213
+ t14 = $[33];
214
+ }
215
+ let t15;
216
+ if ($[34] !== decision || $[35] !== result) {
217
+ t15 = decision ? "Memories reviewed" : resultSummary(result);
218
+ $[34] = decision;
219
+ $[35] = result;
220
+ $[36] = t15;
221
+ } else {
222
+ t15 = $[36];
223
+ }
224
+ let t16;
225
+ if ($[37] !== t15) {
226
+ t16 = /*#__PURE__*/_jsx(LiveStatus, {
227
+ message: t15
228
+ });
229
+ $[37] = t15;
230
+ $[38] = t16;
231
+ } else {
232
+ t16 = $[38];
233
+ }
234
+ let t17;
235
+ if ($[39] !== className || $[40] !== t11 || $[41] !== t13 || $[42] !== t14 || $[43] !== t16 || $[44] !== title) {
236
+ t17 = /*#__PURE__*/_jsxs(ApprovalPanel, {
237
+ "data-slot": "memory-review",
238
+ "aria-label": title,
239
+ className: className,
240
+ children: [t11, t13, t14, t16]
241
+ });
242
+ $[39] = className;
243
+ $[40] = t11;
244
+ $[41] = t13;
245
+ $[42] = t14;
246
+ $[43] = t16;
247
+ $[44] = title;
248
+ $[45] = t17;
249
+ } else {
250
+ t17 = $[45];
251
+ }
252
+ return t17;
253
+ }
254
+ function _temp(memory) {
255
+ return memory.sensitive;
256
+ }
@@ -0,0 +1,9 @@
1
+ import type { ProposedMemory } from "../types.js";
2
+ import type { MemoryDraft } from "./memory-choices.js";
3
+ type MemoryRowProps = {
4
+ memory: ProposedMemory;
5
+ draft: MemoryDraft;
6
+ onChange: (draft: MemoryDraft) => void;
7
+ };
8
+ export declare function MemoryRow({ memory, draft, onChange }: MemoryRowProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,226 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { ShieldAlert as ShieldAlertIcon } from "@carbon/icons-react";
3
+ import { cn, Textarea } from "@locusgraph/components";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ const choiceLabels = {
6
+ keep: "Keep",
7
+ edit: "Edit",
8
+ discard: "Discard"
9
+ };
10
+ const choices = ["keep", "edit", "discard"];
11
+ const selectedChoiceClass = {
12
+ keep: "text-foreground shadow-[inset_0_-2px_0_var(--color-primary)]",
13
+ edit: "text-foreground shadow-[inset_0_-2px_0_var(--color-primary)]",
14
+ discard: "text-destructive shadow-[inset_0_-2px_0_var(--color-destructive)]"
15
+ };
16
+ function ChoiceSegments(t0) {
17
+ const $ = _c(6);
18
+ const {
19
+ value,
20
+ onChange
21
+ } = t0;
22
+ let t1;
23
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24
+ t1 = /*#__PURE__*/_jsx("legend", {
25
+ className: "sr-only",
26
+ children: "What to do with this memory"
27
+ });
28
+ $[0] = t1;
29
+ } else {
30
+ t1 = $[0];
31
+ }
32
+ let t2;
33
+ if ($[1] !== onChange || $[2] !== value) {
34
+ t2 = choices.map(choice => {
35
+ const pressed = value === choice;
36
+ return /*#__PURE__*/_jsx("button", {
37
+ type: "button",
38
+ "aria-pressed": pressed,
39
+ onClick: () => onChange(choice),
40
+ className: cn("h-7 px-2 text-xs outline-none motion-safe:transition-colors focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-ring/70", pressed ? cn("font-medium", selectedChoiceClass[choice]) : "text-muted-foreground hover:text-foreground"),
41
+ children: choiceLabels[choice]
42
+ }, choice);
43
+ });
44
+ $[1] = onChange;
45
+ $[2] = value;
46
+ $[3] = t2;
47
+ } else {
48
+ t2 = $[3];
49
+ }
50
+ let t3;
51
+ if ($[4] !== t2) {
52
+ t3 = /*#__PURE__*/_jsxs("fieldset", {
53
+ className: "flex shrink-0 gap-1 self-start",
54
+ children: [t1, t2]
55
+ });
56
+ $[4] = t2;
57
+ $[5] = t3;
58
+ } else {
59
+ t3 = $[5];
60
+ }
61
+ return t3;
62
+ }
63
+ function SensitiveMarker() {
64
+ const $ = _c(1);
65
+ let t0;
66
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
67
+ t0 = /*#__PURE__*/_jsxs("span", {
68
+ className: "flex items-center gap-1 text-warn",
69
+ children: [/*#__PURE__*/_jsx(ShieldAlertIcon, {
70
+ "aria-hidden": true,
71
+ className: "size-3"
72
+ }), "Sensitive"]
73
+ });
74
+ $[0] = t0;
75
+ } else {
76
+ t0 = $[0];
77
+ }
78
+ return t0;
79
+ }
80
+ export function MemoryRow(t0) {
81
+ const $ = _c(35);
82
+ const {
83
+ memory,
84
+ draft,
85
+ onChange
86
+ } = t0;
87
+ const discarded = draft.choice === "discard";
88
+ const editing = draft.choice === "edit";
89
+ const t1 = draft.choice;
90
+ const t2 = memory.sensitive || undefined;
91
+ const t3 = editing ? "bg-accent/30" : "hover:bg-accent/30";
92
+ let t4;
93
+ if ($[0] !== t3) {
94
+ t4 = cn("flex flex-col gap-2 px-5 py-2.5 motion-safe:transition-colors", t3);
95
+ $[0] = t3;
96
+ $[1] = t4;
97
+ } else {
98
+ t4 = $[1];
99
+ }
100
+ let t5;
101
+ if ($[2] !== memory.kind || $[3] !== memory.sensitive) {
102
+ t5 = (memory.kind || memory.sensitive) && /*#__PURE__*/_jsxs("span", {
103
+ className: "eyebrow flex items-center gap-2",
104
+ children: [memory.kind && /*#__PURE__*/_jsx("span", {
105
+ children: memory.kind
106
+ }), memory.sensitive && /*#__PURE__*/_jsx(SensitiveMarker, {})]
107
+ });
108
+ $[2] = memory.kind;
109
+ $[3] = memory.sensitive;
110
+ $[4] = t5;
111
+ } else {
112
+ t5 = $[4];
113
+ }
114
+ let t6;
115
+ if ($[5] !== discarded || $[6] !== editing || $[7] !== memory.text) {
116
+ t6 = !editing && /*#__PURE__*/_jsx("p", {
117
+ className: cn("text-sm", discarded && "text-muted-foreground line-through decoration-muted-foreground/60"),
118
+ children: memory.text
119
+ });
120
+ $[5] = discarded;
121
+ $[6] = editing;
122
+ $[7] = memory.text;
123
+ $[8] = t6;
124
+ } else {
125
+ t6 = $[8];
126
+ }
127
+ let t7;
128
+ if ($[9] !== t5 || $[10] !== t6) {
129
+ t7 = /*#__PURE__*/_jsxs("div", {
130
+ className: "flex min-w-0 flex-1 flex-col gap-1",
131
+ children: [t5, t6]
132
+ });
133
+ $[9] = t5;
134
+ $[10] = t6;
135
+ $[11] = t7;
136
+ } else {
137
+ t7 = $[11];
138
+ }
139
+ let t8;
140
+ if ($[12] !== draft || $[13] !== onChange) {
141
+ t8 = choice => onChange({
142
+ ...draft,
143
+ choice
144
+ });
145
+ $[12] = draft;
146
+ $[13] = onChange;
147
+ $[14] = t8;
148
+ } else {
149
+ t8 = $[14];
150
+ }
151
+ let t9;
152
+ if ($[15] !== draft.choice || $[16] !== t8) {
153
+ t9 = /*#__PURE__*/_jsx(ChoiceSegments, {
154
+ value: draft.choice,
155
+ onChange: t8
156
+ });
157
+ $[15] = draft.choice;
158
+ $[16] = t8;
159
+ $[17] = t9;
160
+ } else {
161
+ t9 = $[17];
162
+ }
163
+ let t10;
164
+ if ($[18] !== t7 || $[19] !== t9) {
165
+ t10 = /*#__PURE__*/_jsxs("div", {
166
+ className: "flex items-start gap-3",
167
+ children: [t7, t9]
168
+ });
169
+ $[18] = t7;
170
+ $[19] = t9;
171
+ $[20] = t10;
172
+ } else {
173
+ t10 = $[20];
174
+ }
175
+ let t11;
176
+ if ($[21] !== draft || $[22] !== editing || $[23] !== onChange) {
177
+ t11 = editing && /*#__PURE__*/_jsx(Textarea, {
178
+ "aria-label": "Memory text",
179
+ value: draft.text,
180
+ "aria-invalid": draft.text.trim() === "" || undefined,
181
+ onChange: event => onChange({
182
+ ...draft,
183
+ text: event.target.value
184
+ }),
185
+ className: "min-h-16 text-sm"
186
+ });
187
+ $[21] = draft;
188
+ $[22] = editing;
189
+ $[23] = onChange;
190
+ $[24] = t11;
191
+ } else {
192
+ t11 = $[24];
193
+ }
194
+ let t12;
195
+ if ($[25] !== discarded || $[26] !== memory.sensitive) {
196
+ t12 = memory.sensitive && !discarded && /*#__PURE__*/_jsx("p", {
197
+ className: "text-xs text-warn",
198
+ children: "This looks like personal or secret data. Keep it only if the agent should remember it."
199
+ });
200
+ $[25] = discarded;
201
+ $[26] = memory.sensitive;
202
+ $[27] = t12;
203
+ } else {
204
+ t12 = $[27];
205
+ }
206
+ let t13;
207
+ if ($[28] !== draft.choice || $[29] !== t10 || $[30] !== t11 || $[31] !== t12 || $[32] !== t2 || $[33] !== t4) {
208
+ t13 = /*#__PURE__*/_jsxs("li", {
209
+ "data-slot": "memory-review-item",
210
+ "data-choice": t1,
211
+ "data-sensitive": t2,
212
+ className: t4,
213
+ children: [t10, t11, t12]
214
+ });
215
+ $[28] = draft.choice;
216
+ $[29] = t10;
217
+ $[30] = t11;
218
+ $[31] = t12;
219
+ $[32] = t2;
220
+ $[33] = t4;
221
+ $[34] = t13;
222
+ } else {
223
+ t13 = $[34];
224
+ }
225
+ return t13;
226
+ }
@@ -0,0 +1,13 @@
1
+ import type { ApprovalDecision, PlanStepDraft } from "../types.js";
2
+ export type PlanReviewProps = {
3
+ steps: PlanStepDraft[];
4
+ title?: string;
5
+ description?: string;
6
+ actionLabel?: string;
7
+ decision?: ApprovalDecision;
8
+ onApprove: (steps: PlanStepDraft[]) => void;
9
+ onCancel: () => void;
10
+ autoFocus?: boolean;
11
+ className?: string;
12
+ };
13
+ export declare function PlanReview({ steps: initialSteps, title, description, actionLabel, decision, onApprove, onCancel, autoFocus, className, }: PlanReviewProps): import("react").JSX.Element;