@locusgraph/loop 0.1.0 → 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 (115) hide show
  1. package/README.md +2 -0
  2. package/dist/agent/pulse/gradient-label.js +86 -15
  3. package/dist/agent/pulse/marks/bars-mark.js +46 -10
  4. package/dist/agent/pulse/marks/glyph-mark.js +56 -11
  5. package/dist/agent/pulse/marks/locus-mark.js +63 -28
  6. package/dist/agent/pulse/marks/orb-mark.js +31 -8
  7. package/dist/agent/pulse/marks/spinner-mark.js +29 -1
  8. package/dist/agent/pulse/pulse.js +150 -35
  9. package/dist/agent/pulse/use-loop-animation.js +36 -17
  10. package/dist/agent/steps/step-icon.js +110 -24
  11. package/dist/agent/steps/steps.js +235 -25
  12. package/dist/agent/thinking/thinking.js +203 -23
  13. package/dist/agent/thinking/thought-duration.js +7 -9
  14. package/dist/agent/tool/json-block.js +38 -11
  15. package/dist/agent/tool/tool-status.js +51 -18
  16. package/dist/agent/tool/tool.js +184 -6
  17. package/dist/approval/inbox/inbox-row.d.ts +3 -2
  18. package/dist/approval/inbox/inbox-row.js +321 -7
  19. package/dist/approval/inbox/inbox-selection.js +7 -13
  20. package/dist/approval/inbox/inbox.d.ts +2 -1
  21. package/dist/approval/inbox/inbox.js +250 -18
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +13 -0
  23. package/dist/approval/inbox/virtual-inbox-list.js +129 -0
  24. package/dist/approval/memory/memory-choices.js +27 -22
  25. package/dist/approval/memory/memory-review.js +242 -17
  26. package/dist/approval/memory/memory-row.js +215 -19
  27. package/dist/approval/plan/plan-review.js +279 -28
  28. package/dist/approval/plan/plan-step-row.js +194 -43
  29. package/dist/approval/plan/plan-steps.js +24 -23
  30. package/dist/approval/plan/question-choices.js +158 -39
  31. package/dist/approval/plan/question.d.ts +1 -1
  32. package/dist/approval/plan/question.js +223 -26
  33. package/dist/approval/run/run-bar.js +178 -22
  34. package/dist/approval/shared/decision-line.js +1 -1
  35. package/dist/approval/shared/risk-badge.js +47 -16
  36. package/dist/approval/shared/time.js +5 -8
  37. package/dist/approval/shared/use-focus-on-mount.js +23 -6
  38. package/dist/approval/spend/raise-cap-form.js +235 -17
  39. package/dist/approval/spend/spend-gate.js +239 -21
  40. package/dist/approval/spend/spend-math.js +7 -8
  41. package/dist/approval/spend/spend-meter.js +362 -34
  42. package/dist/approval/tool/approval.js +272 -27
  43. package/dist/approval/tool/args/args-editor.js +262 -26
  44. package/dist/approval/tool/args/args-field.js +259 -19
  45. package/dist/approval/tool/args/args-validation.js +38 -47
  46. package/dist/approval/tool/deny-form.js +130 -10
  47. package/dist/approval/tool/tool-inputs.js +127 -38
  48. package/dist/chat/chat/chat-item-spacing.d.ts +3 -0
  49. package/dist/chat/chat/chat-item-spacing.js +19 -0
  50. package/dist/chat/chat/chat.d.ts +2 -1
  51. package/dist/chat/chat/chat.js +181 -5
  52. package/dist/chat/chat/use-stick-to-bottom.js +123 -47
  53. package/dist/chat/chat/virtual-chat-items.d.ts +8 -0
  54. package/dist/chat/chat/virtual-chat-items.js +153 -0
  55. package/dist/chat/composer/composer-actions.js +151 -16
  56. package/dist/chat/composer/composer.js +330 -32
  57. package/dist/chat/composer/use-auto-grow.js +24 -9
  58. package/dist/chat/files/file-meta.js +19 -19
  59. package/dist/chat/files/files.js +316 -28
  60. package/dist/chat/reply/fenced-code.js +45 -21
  61. package/dist/chat/reply/markdown-components.js +137 -17
  62. package/dist/chat/reply/reply.js +105 -10
  63. package/dist/chat/turn/group-parts.js +43 -29
  64. package/dist/chat/turn/turn.js +238 -30
  65. package/dist/cost/context.js +321 -23
  66. package/dist/cost/cost-steps.js +220 -14
  67. package/dist/cost/cost.js +521 -27
  68. package/dist/cost/model-picker.js +181 -6
  69. package/dist/cost/shared/context-breakdown.js +299 -10
  70. package/dist/cost/shared/meter-marks.js +107 -9
  71. package/dist/cost/shared/model-option-row.js +178 -21
  72. package/dist/cost/shared/step-cost-row.js +248 -20
  73. package/dist/cost/shared/usage-totals.js +22 -18
  74. package/dist/memory/cite.js +182 -11
  75. package/dist/memory/memorized.js +217 -11
  76. package/dist/memory/recall.js +296 -17
  77. package/dist/memory/shared/host-label.js +19 -22
  78. package/dist/memory/shared/source-mark.js +39 -3
  79. package/dist/memory/sources.js +255 -13
  80. package/dist/shared/decision-summary.js +133 -14
  81. package/dist/shared/panel-empty.js +78 -3
  82. package/dist/shared/panel.js +243 -13
  83. package/dist/shared/status-dot.js +38 -8
  84. package/dist/shared/virtual/use-list-virtualizer.d.ts +24 -0
  85. package/dist/shared/virtual/use-list-virtualizer.js +68 -0
  86. package/dist/thread/actions/action-button.js +65 -3
  87. package/dist/thread/actions/actions.js +184 -13
  88. package/dist/thread/actions/branch-switcher.js +102 -5
  89. package/dist/thread/canvas/canvas.js +205 -5
  90. package/dist/thread/canvas/version-switcher.js +149 -8
  91. package/dist/thread/code/code.js +186 -24
  92. package/dist/thread/code/copy-code-button.js +61 -13
  93. package/dist/thread/code/highlight.js +30 -29
  94. package/dist/thread/history/history-rows.d.ts +16 -0
  95. package/dist/thread/history/history-rows.js +23 -0
  96. package/dist/thread/history/history.d.ts +3 -2
  97. package/dist/thread/history/history.js +174 -5
  98. package/dist/thread/history/{history-row.d.ts → row/history-row.d.ts} +3 -2
  99. package/dist/thread/history/row/history-row.js +137 -0
  100. package/dist/thread/history/row/thread-item-menu.js +84 -0
  101. package/dist/thread/history/row/thread-title-editor.js +81 -0
  102. package/dist/thread/history/thread-groups.d.ts +1 -1
  103. package/dist/thread/history/thread-groups.js +40 -34
  104. package/dist/thread/history/virtual-history-list.d.ts +11 -0
  105. package/dist/thread/history/virtual-history-list.js +107 -0
  106. package/dist/thread/index.d.ts +1 -1
  107. package/dist/thread/starters/starters.js +92 -7
  108. package/dist/thread/use-copied.js +45 -15
  109. package/dist/types.js +1 -1
  110. package/package.json +6 -4
  111. package/dist/thread/history/history-row.js +0 -17
  112. package/dist/thread/history/thread-item-menu.js +0 -6
  113. package/dist/thread/history/thread-title-editor.js +0 -25
  114. /package/dist/thread/history/{thread-item-menu.d.ts → row/thread-item-menu.d.ts} +0 -0
  115. /package/dist/thread/history/{thread-title-editor.d.ts → row/thread-title-editor.d.ts} +0 -0
@@ -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
+ }
@@ -1,30 +1,35 @@
1
1
  export function initialDrafts(memories) {
2
- return Object.fromEntries(memories.map((memory) => [
3
- memory.id,
4
- { choice: memory.sensitive ? "discard" : "keep", text: memory.text },
5
- ]));
2
+ return Object.fromEntries(memories.map(memory => [memory.id, {
3
+ choice: memory.sensitive ? "discard" : "keep",
4
+ text: memory.text
5
+ }]));
6
6
  }
7
7
  export function reviewResult(memories, drafts) {
8
- const result = { kept: [], edited: [], discarded: [] };
9
- for (const memory of memories) {
10
- const draft = drafts[memory.id] ?? { choice: "keep", text: memory.text };
11
- const text = draft.text.trim();
12
- if (draft.choice === "discard")
13
- result.discarded.push(memory);
14
- else if (draft.choice === "edit" && text !== "" && text !== memory.text) {
15
- result.edited.push({ ...memory, text });
16
- }
17
- else
18
- result.kept.push(memory);
19
- }
20
- return result;
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;
21
27
  }
22
28
  export function hasBlankEdit(drafts) {
23
- return Object.values(drafts).some((draft) => draft.choice === "edit" && draft.text.trim() === "");
29
+ return Object.values(drafts).some(draft => draft.choice === "edit" && draft.text.trim() === "");
24
30
  }
25
31
  export function submitLabel(result) {
26
- const saved = result.kept.length + result.edited.length;
27
- if (saved === 0)
28
- return "Discard all";
29
- return `Save ${saved} ${saved === 1 ? "memory" : "memories"}`;
32
+ const saved = result.kept.length + result.edited.length;
33
+ if (saved === 0) return "Discard all";
34
+ return `Save ${saved} ${saved === 1 ? "memory" : "memories"}`;
30
35
  }
@@ -1,31 +1,256 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Idea as BrainIcon } from "@carbon/icons-react";
3
3
  import { Button } from "@locusgraph/components";
4
4
  import { pluralize } from "@locusgraph/utils";
5
5
  import { useMemo, useState } from "react";
6
- import { ApprovalPanel, LiveStatus, PanelBody, PanelFooter, PanelHeader, PanelTitle, } from "../../shared/panel.js";
6
+ import { ApprovalPanel, LiveStatus, PanelBody, PanelFooter, PanelHeader, PanelTitle } from "../../shared/panel.js";
7
7
  import { PanelEmpty } from "../../shared/panel-empty.js";
8
8
  import { DecisionSummary } from "../shared/decision-line.js";
9
9
  import { useFocusOnMount } from "../shared/use-focus-on-mount.js";
10
10
  import { hasBlankEdit, initialDrafts, reviewResult, submitLabel } from "./memory-choices.js";
11
11
  import { MemoryRow } from "./memory-row.js";
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
13
  function resultSummary(result) {
13
- return `${result.kept.length} kept, ${result.edited.length} edited, ${result.discarded.length} discarded`;
14
+ return `${result.kept.length} kept, ${result.edited.length} edited, ${result.discarded.length} discarded`;
14
15
  }
15
16
  function headerStatus(decision, empty) {
16
- if (decision)
17
- return { status: "Reviewed", tone: "done" };
18
- if (empty)
19
- return { status: "Nothing new", tone: "idle" };
20
- return { status: "Waiting for you", tone: "waiting" };
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
+ };
21
29
  }
22
- export function MemoryReview({ memories, title = "Review new memories", description = "The agent wants to remember these in LocusGraph. Keep, edit or discard each one.", decision, onSubmit, autoFocus = true, className, }) {
23
- const [drafts, setDrafts] = useState(() => initialDrafts(memories));
24
- const result = useMemo(() => reviewResult(memories, drafts), [memories, drafts]);
25
- const blankEdit = hasBlankEdit(drafts);
26
- const empty = memories.length === 0;
27
- const sensitiveCount = memories.filter((memory) => memory.sensitive).length;
28
- const submitRef = useFocusOnMount(autoFocus && !decision && !empty);
29
- const { status, tone } = headerStatus(decision, empty);
30
- return (_jsxs(ApprovalPanel, { "data-slot": "memory-review", "aria-label": title, className: className, children: [_jsx(PanelHeader, { icon: _jsx(BrainIcon, { "aria-hidden": true }), eyebrow: "Memory", status: status, tone: tone, aside: empty ? undefined : pluralize(memories.length, "proposed", "proposed") }), _jsx(PanelTitle, { className: decision ? "text-muted-foreground" : undefined, children: title }), empty ? (_jsx(PanelEmpty, { icon: _jsx(BrainIcon, { "aria-hidden": true }), title: "No new memories to review.", description: "When an agent wants to remember something in LocusGraph, it shows up here." })) : decision ? (_jsx(PanelBody, { children: _jsx(DecisionSummary, { decision: decision, approvedVerb: "Reviewed", deniedVerb: "Discarded", result: decision.approved ? "Memories reviewed" : "All memories discarded" }) })) : (_jsxs(_Fragment, { children: [_jsxs("p", { className: "px-5 pt-1 text-sm text-muted-foreground", children: [description, sensitiveCount > 0 && (_jsxs("span", { className: "text-warn", children: [" ", pluralize(sensitiveCount, "memory", "memories"), " flagged as sensitive, set to discard."] }))] }), _jsx(PanelBody, { className: "pb-0", children: _jsx("ul", { className: "-mx-5 flex flex-col divide-y border-t", children: memories.map((memory) => (_jsx(MemoryRow, { memory: memory, draft: drafts[memory.id] ?? { choice: "keep", text: memory.text }, onChange: (draft) => setDrafts((current) => ({ ...current, [memory.id]: draft })) }, memory.id))) }) }), _jsxs(PanelFooter, { className: "justify-between", children: [blankEdit ? (_jsx("span", { className: "text-xs text-destructive", children: "An edited memory can't be empty." })) : (_jsxs("span", { className: "hidden font-mono text-[11px] text-muted-foreground tabular-nums sm:inline", children: [result.kept.length, " kept \u00B7 ", result.edited.length, " edited \u00B7", " ", result.discarded.length, " discarded"] })), _jsx(Button, { ref: submitRef, type: "button", size: "sm", className: "ml-auto", variant: result.kept.length + result.edited.length === 0 ? "destructive" : "default", disabled: blankEdit, onClick: () => onSubmit(result), children: submitLabel(result) })] })] })), _jsx(LiveStatus, { message: decision ? "Memories reviewed" : resultSummary(result) })] }));
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;
31
256
  }