@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,15 +1,16 @@
1
1
  "use client";
2
2
 
3
3
  import { c as _c } from "react/compiler-runtime";
4
- import { Add as PlusIcon } from "@carbon/icons-react";
5
4
  import { Button, cn, ScrollArea } from "@locusgraph/components";
5
+ import { Plus as PlusIcon } from "@phosphor-icons/react/ssr";
6
+ import { useId } from "react";
6
7
  import { shouldVirtualize } from "../../shared/virtual/use-list-virtualizer.js";
7
8
  import { HistoryRow } from "./row/history-row.js";
8
9
  import { groupThreadsByDay } from "./thread-groups.js";
9
10
  import { VirtualHistoryList } from "./virtual-history-list.js";
10
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
12
  export function History(t0) {
12
- const $ = _c(35);
13
+ const $ = _c(28);
13
14
  let className;
14
15
  let now;
15
16
  let onArchive;
@@ -68,112 +69,111 @@ export function History(t0) {
68
69
  const label = t2 === undefined ? "Conversations" : t2;
69
70
  const emptyText = t3 === undefined ? "No conversations yet." : t3;
70
71
  const virtualize = t4 === undefined ? true : t4;
71
- let t5;
72
- if ($[13] !== activeId || $[14] !== className || $[15] !== emptyText || $[16] !== label || $[17] !== now || $[18] !== onArchive || $[19] !== onNew || $[20] !== onRename || $[21] !== onSelect || $[22] !== props || $[23] !== threads || $[24] !== virtualize) {
73
- const groups = groupThreadsByDay(threads, now ?? new Date());
74
- let t6;
75
- if ($[26] !== className) {
76
- t6 = cn("flex min-h-0 flex-col gap-2", className);
77
- $[26] = className;
78
- $[27] = t6;
79
- } else {
80
- t6 = $[27];
81
- }
82
- let t7;
83
- if ($[28] !== label) {
84
- t7 = /*#__PURE__*/_jsx("span", {
85
- className: "text-sm font-medium text-foreground",
86
- children: label
87
- });
88
- $[28] = label;
89
- $[29] = t7;
90
- } else {
91
- t7 = $[29];
92
- }
93
- let t8;
94
- if ($[30] !== onNew) {
95
- t8 = onNew && /*#__PURE__*/_jsxs(Button, {
96
- type: "button",
97
- variant: "outline",
98
- size: "xs",
99
- onClick: onNew,
100
- children: [/*#__PURE__*/_jsx(PlusIcon, {}), "New chat"]
101
- });
102
- $[30] = onNew;
103
- $[31] = t8;
104
- } else {
105
- t8 = $[31];
106
- }
107
- let t9;
108
- if ($[32] !== t7 || $[33] !== t8) {
109
- t9 = /*#__PURE__*/_jsxs("div", {
110
- className: "flex h-7 items-center justify-between gap-2 px-2",
111
- children: [t7, t8]
112
- });
113
- $[32] = t7;
114
- $[33] = t8;
115
- $[34] = t9;
116
- } else {
117
- t9 = $[34];
118
- }
119
- t5 = /*#__PURE__*/_jsxs("nav", {
120
- "data-slot": "history",
121
- "aria-label": label,
122
- className: t6,
123
- ...props,
124
- children: [t9, threads.length === 0 ? /*#__PURE__*/_jsx("p", {
125
- className: "px-2 py-6 text-sm text-muted-foreground",
126
- children: emptyText
127
- }) : /*#__PURE__*/_jsx(ScrollArea, {
128
- className: "min-h-0 flex-1",
129
- children: shouldVirtualize(threads.length, virtualize) ? /*#__PURE__*/_jsx("div", {
130
- className: "pr-2.5 pb-2",
131
- children: /*#__PURE__*/_jsx(VirtualHistoryList, {
132
- groups: groups,
133
- label: label,
134
- activeId: activeId,
72
+ const groups = groupThreadsByDay(threads, now ?? new Date());
73
+ const groupIdPrefix = useId();
74
+ const t5 = "history";
75
+ let t6;
76
+ if ($[13] !== className) {
77
+ t6 = cn("flex min-h-0 flex-col gap-2", className);
78
+ $[13] = className;
79
+ $[14] = t6;
80
+ } else {
81
+ t6 = $[14];
82
+ }
83
+ let t7;
84
+ if ($[15] !== label) {
85
+ t7 = /*#__PURE__*/_jsx("span", {
86
+ className: "text-sm font-medium text-foreground",
87
+ children: label
88
+ });
89
+ $[15] = label;
90
+ $[16] = t7;
91
+ } else {
92
+ t7 = $[16];
93
+ }
94
+ let t8;
95
+ if ($[17] !== onNew) {
96
+ t8 = onNew && /*#__PURE__*/_jsxs(Button, {
97
+ type: "button",
98
+ variant: "ghost",
99
+ size: "xs",
100
+ onClick: onNew,
101
+ children: [/*#__PURE__*/_jsx(PlusIcon, {
102
+ weight: "bold",
103
+ "aria-hidden": true
104
+ }), "New chat"]
105
+ });
106
+ $[17] = onNew;
107
+ $[18] = t8;
108
+ } else {
109
+ t8 = $[18];
110
+ }
111
+ let t9;
112
+ if ($[19] !== t7 || $[20] !== t8) {
113
+ t9 = /*#__PURE__*/_jsxs("div", {
114
+ className: "flex h-control-sm items-center justify-between gap-2 px-2",
115
+ children: [t7, t8]
116
+ });
117
+ $[19] = t7;
118
+ $[20] = t8;
119
+ $[21] = t9;
120
+ } else {
121
+ t9 = $[21];
122
+ }
123
+ const t10 = threads.length === 0 ? /*#__PURE__*/_jsx("p", {
124
+ className: "px-2 py-6 text-sm text-muted-foreground",
125
+ children: emptyText
126
+ }) : /*#__PURE__*/_jsx(ScrollArea, {
127
+ className: "min-h-0 flex-1",
128
+ children: shouldVirtualize(threads.length, virtualize) ? /*#__PURE__*/_jsx("div", {
129
+ className: "pr-2.5 pb-2",
130
+ children: /*#__PURE__*/_jsx(VirtualHistoryList, {
131
+ groups: groups,
132
+ label: label,
133
+ activeId: activeId,
134
+ onSelect: onSelect,
135
+ onRename: onRename,
136
+ onArchive: onArchive
137
+ })
138
+ }) : /*#__PURE__*/_jsx("div", {
139
+ className: "flex flex-col gap-4 pr-2.5 pb-2",
140
+ children: groups.map(group => /*#__PURE__*/_jsxs("section", {
141
+ "aria-labelledby": `${groupIdPrefix}-${group.key}`,
142
+ children: [/*#__PURE__*/_jsx("h3", {
143
+ id: `${groupIdPrefix}-${group.key}`,
144
+ className: "px-2 pb-1 font-sans text-xs text-faint",
145
+ suppressHydrationWarning: true,
146
+ children: group.label
147
+ }), /*#__PURE__*/_jsx("ul", {
148
+ className: "flex flex-col",
149
+ children: group.threads.map(thread => /*#__PURE__*/_jsx(HistoryRow, {
150
+ thread: thread,
151
+ active: thread.id === activeId,
135
152
  onSelect: onSelect,
136
153
  onRename: onRename,
137
154
  onArchive: onArchive
138
- })
139
- }) : /*#__PURE__*/_jsx("div", {
140
- className: "flex flex-col gap-4 pr-2.5 pb-2",
141
- children: groups.map(group => /*#__PURE__*/_jsxs("section", {
142
- "aria-labelledby": `thread-group-${group.key}`,
143
- children: [/*#__PURE__*/_jsx("h3", {
144
- id: `thread-group-${group.key}`,
145
- className: "locus-eyebrow px-2 pb-1",
146
- suppressHydrationWarning: true,
147
- children: group.label
148
- }), /*#__PURE__*/_jsx("ul", {
149
- className: "flex flex-col",
150
- children: group.threads.map(thread => /*#__PURE__*/_jsx(HistoryRow, {
151
- thread: thread,
152
- active: thread.id === activeId,
153
- onSelect: onSelect,
154
- onRename: onRename,
155
- onArchive: onArchive
156
- }, thread.id))
157
- })]
158
- }, group.key))
159
- })
160
- })]
155
+ }, thread.id))
156
+ })]
157
+ }, group.key))
158
+ })
159
+ });
160
+ let t11;
161
+ if ($[22] !== label || $[23] !== props || $[24] !== t10 || $[25] !== t6 || $[26] !== t9) {
162
+ t11 = /*#__PURE__*/_jsxs("nav", {
163
+ "data-slot": t5,
164
+ "aria-label": label,
165
+ className: t6,
166
+ ...props,
167
+ children: [t9, t10]
161
168
  });
162
- $[13] = activeId;
163
- $[14] = className;
164
- $[15] = emptyText;
165
- $[16] = label;
166
- $[17] = now;
167
- $[18] = onArchive;
168
- $[19] = onNew;
169
- $[20] = onRename;
170
- $[21] = onSelect;
171
- $[22] = props;
172
- $[23] = threads;
173
- $[24] = virtualize;
174
- $[25] = t5;
169
+ $[22] = label;
170
+ $[23] = props;
171
+ $[24] = t10;
172
+ $[25] = t6;
173
+ $[26] = t9;
174
+ $[27] = t11;
175
175
  } else {
176
- t5 = $[25];
176
+ t11 = $[27];
177
177
  }
178
- return t5;
178
+ return t11;
179
179
  }
@@ -1,3 +1,6 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { cn } from "@locusgraph/components";
2
5
  import { useState } from "react";
3
6
  import { formatTimeOfDay } from "../thread-groups.js";
@@ -5,23 +8,58 @@ import { ThreadItemMenu } from "./thread-item-menu.js";
5
8
  import { ThreadTitleEditor } from "./thread-title-editor.js";
6
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
10
  const timeHiddenByMenuClass = "max-sm:hidden sm:group-focus-within:invisible sm:group-hover:invisible sm:group-has-[[data-state=open]]:invisible";
8
- export function HistoryRow({
9
- thread,
10
- active,
11
- onSelect,
12
- onRename,
13
- onArchive,
14
- className,
15
- ...props
16
- }) {
11
+ export function HistoryRow(t0) {
12
+ const $ = _c(33);
13
+ let active;
14
+ let className;
15
+ let onArchive;
16
+ let onRename;
17
+ let onSelect;
18
+ let props;
19
+ let thread;
20
+ if ($[0] !== t0) {
21
+ ({
22
+ thread,
23
+ active,
24
+ onSelect,
25
+ onRename,
26
+ onArchive,
27
+ className,
28
+ ...props
29
+ } = t0);
30
+ $[0] = t0;
31
+ $[1] = active;
32
+ $[2] = className;
33
+ $[3] = onArchive;
34
+ $[4] = onRename;
35
+ $[5] = onSelect;
36
+ $[6] = props;
37
+ $[7] = thread;
38
+ } else {
39
+ active = $[1];
40
+ className = $[2];
41
+ onArchive = $[3];
42
+ onRename = $[4];
43
+ onSelect = $[5];
44
+ props = $[6];
45
+ thread = $[7];
46
+ }
17
47
  const [editing, setEditing] = useState(false);
18
48
  const hasMenu = onRename !== undefined || onArchive !== undefined;
19
- return /*#__PURE__*/_jsxs("li", {
20
- "data-slot": "history-item",
21
- "data-active": active || undefined,
22
- className: cn("group relative flex items-center motion-safe:transition-colors", active ? "bg-accent text-accent-foreground before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-foreground" : "text-foreground/85 hover:bg-accent/40", className),
23
- ...props,
24
- children: [editing && onRename ? /*#__PURE__*/_jsx("div", {
49
+ const t1 = active || undefined;
50
+ const t2 = active ? "bg-muted text-foreground" : "text-muted-foreground hover:bg-muted/50 hover:text-foreground";
51
+ let t3;
52
+ if ($[8] !== className || $[9] !== t2) {
53
+ t3 = cn("group relative flex items-center motion-safe:transition-colors", t2, className);
54
+ $[8] = className;
55
+ $[9] = t2;
56
+ $[10] = t3;
57
+ } else {
58
+ t3 = $[10];
59
+ }
60
+ let t4;
61
+ if ($[11] !== active || $[12] !== editing || $[13] !== hasMenu || $[14] !== onRename || $[15] !== onSelect || $[16] !== thread.id || $[17] !== thread.title || $[18] !== thread.updatedAt) {
62
+ t4 = editing && onRename ? /*#__PURE__*/_jsx("div", {
25
63
  className: "flex-1 px-1 py-0.5",
26
64
  children: /*#__PURE__*/_jsx(ThreadTitleEditor, {
27
65
  title: thread.title,
@@ -36,23 +74,69 @@ export function HistoryRow({
36
74
  "aria-current": active ? "page" : undefined,
37
75
  onClick: () => onSelect(thread.id),
38
76
  onDoubleClick: onRename ? () => setEditing(true) : undefined,
39
- className: cn("flex min-w-0 flex-1 items-center gap-3 py-1.5 pl-2 text-left text-sm outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring", hasMenu ? "pr-8 sm:pr-2" : "pr-2", active && "font-medium"),
77
+ className: cn("flex min-w-0 flex-1 items-center gap-3 py-1.5 pl-2 text-left text-sm locus-focus-ring-inset", hasMenu ? "pr-8 sm:pr-2" : "pr-2", active && "font-medium"),
40
78
  children: [/*#__PURE__*/_jsx("span", {
41
79
  className: "min-w-0 flex-1 truncate",
42
80
  children: thread.title
43
- }), /*#__PURE__*/_jsx("time", {
81
+ }), /*#__PURE__*/_jsxs("time", {
44
82
  dateTime: thread.updatedAt,
45
83
  suppressHydrationWarning: true,
46
- className: cn("shrink-0 font-mono text-[11px] font-normal text-muted-foreground tabular-nums", hasMenu && timeHiddenByMenuClass),
47
- children: formatTimeOfDay(thread.updatedAt)
84
+ className: cn("shrink-0 text-xs font-normal text-faint tabular-nums", hasMenu && timeHiddenByMenuClass),
85
+ children: [/*#__PURE__*/_jsx("span", {
86
+ className: "sr-only",
87
+ children: ", "
88
+ }), formatTimeOfDay(thread.updatedAt)]
48
89
  })]
49
- }), hasMenu && !editing && /*#__PURE__*/_jsx("div", {
90
+ });
91
+ $[11] = active;
92
+ $[12] = editing;
93
+ $[13] = hasMenu;
94
+ $[14] = onRename;
95
+ $[15] = onSelect;
96
+ $[16] = thread.id;
97
+ $[17] = thread.title;
98
+ $[18] = thread.updatedAt;
99
+ $[19] = t4;
100
+ } else {
101
+ t4 = $[19];
102
+ }
103
+ let t5;
104
+ if ($[20] !== editing || $[21] !== hasMenu || $[22] !== onArchive || $[23] !== onRename || $[24] !== thread.id || $[25] !== thread.title) {
105
+ t5 = hasMenu && !editing && /*#__PURE__*/_jsx("div", {
50
106
  className: "absolute top-1/2 right-1 -translate-y-1/2",
51
107
  children: /*#__PURE__*/_jsx(ThreadItemMenu, {
52
108
  title: thread.title,
53
109
  onRename: onRename ? () => setEditing(true) : undefined,
54
110
  onArchive: onArchive ? () => onArchive(thread.id) : undefined
55
111
  })
56
- })]
57
- });
112
+ });
113
+ $[20] = editing;
114
+ $[21] = hasMenu;
115
+ $[22] = onArchive;
116
+ $[23] = onRename;
117
+ $[24] = thread.id;
118
+ $[25] = thread.title;
119
+ $[26] = t5;
120
+ } else {
121
+ t5 = $[26];
122
+ }
123
+ let t6;
124
+ if ($[27] !== props || $[28] !== t1 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5) {
125
+ t6 = /*#__PURE__*/_jsxs("li", {
126
+ "data-slot": "history-item",
127
+ "data-active": t1,
128
+ className: t3,
129
+ ...props,
130
+ children: [t4, t5]
131
+ });
132
+ $[27] = props;
133
+ $[28] = t1;
134
+ $[29] = t3;
135
+ $[30] = t4;
136
+ $[31] = t5;
137
+ $[32] = t6;
138
+ } else {
139
+ t6 = $[32];
140
+ }
141
+ return t6;
58
142
  }
@@ -1,31 +1,95 @@
1
- import { Archive as ArchiveIcon, OverflowMenuHorizontal as EllipsisIcon, Edit as PencilIcon } from "@carbon/icons-react";
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
2
4
  import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@locusgraph/components";
5
+ import { Archive as ArchiveIcon, DotsThree as EllipsisIcon, PencilSimple as PencilIcon } from "@phosphor-icons/react/ssr";
3
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- export function ThreadItemMenu({
5
- title,
6
- onRename,
7
- onArchive
8
- }) {
9
- return /*#__PURE__*/_jsxs(DropdownMenu, {
10
- children: [/*#__PURE__*/_jsx(DropdownMenuTrigger, {
7
+ export function ThreadItemMenu(t0) {
8
+ const $ = _c(13);
9
+ const {
10
+ title,
11
+ onRename,
12
+ onArchive
13
+ } = t0;
14
+ const t1 = `Options for ${title}`;
15
+ let t2;
16
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
17
+ t2 = /*#__PURE__*/_jsx(EllipsisIcon, {
18
+ weight: "bold",
19
+ "aria-hidden": true
20
+ });
21
+ $[0] = t2;
22
+ } else {
23
+ t2 = $[0];
24
+ }
25
+ let t3;
26
+ if ($[1] !== t1) {
27
+ t3 = /*#__PURE__*/_jsx(DropdownMenuTrigger, {
11
28
  asChild: true,
12
29
  children: /*#__PURE__*/_jsx(Button, {
13
30
  type: "button",
14
31
  variant: "ghost",
15
32
  size: "icon-xs",
16
- "aria-label": `Options for ${title}`,
33
+ "aria-label": t1,
17
34
  className: "shrink-0 text-muted-foreground sm:opacity-0 sm:group-focus-within:opacity-100 sm:group-hover:opacity-100 sm:data-[state=open]:opacity-100",
18
- children: /*#__PURE__*/_jsx(EllipsisIcon, {})
35
+ children: t2
19
36
  })
20
- }), /*#__PURE__*/_jsxs(DropdownMenuContent, {
37
+ });
38
+ $[1] = t1;
39
+ $[2] = t3;
40
+ } else {
41
+ t3 = $[2];
42
+ }
43
+ let t4;
44
+ if ($[3] !== onRename) {
45
+ t4 = onRename && /*#__PURE__*/_jsxs(DropdownMenuItem, {
46
+ onSelect: onRename,
47
+ children: [/*#__PURE__*/_jsx(PencilIcon, {
48
+ weight: "bold",
49
+ "aria-hidden": true
50
+ }), "Rename"]
51
+ });
52
+ $[3] = onRename;
53
+ $[4] = t4;
54
+ } else {
55
+ t4 = $[4];
56
+ }
57
+ let t5;
58
+ if ($[5] !== onArchive) {
59
+ t5 = onArchive && /*#__PURE__*/_jsxs(DropdownMenuItem, {
60
+ onSelect: onArchive,
61
+ children: [/*#__PURE__*/_jsx(ArchiveIcon, {
62
+ weight: "bold",
63
+ "aria-hidden": true
64
+ }), "Archive"]
65
+ });
66
+ $[5] = onArchive;
67
+ $[6] = t5;
68
+ } else {
69
+ t5 = $[6];
70
+ }
71
+ let t6;
72
+ if ($[7] !== t4 || $[8] !== t5) {
73
+ t6 = /*#__PURE__*/_jsxs(DropdownMenuContent, {
21
74
  align: "end",
22
- children: [onRename && /*#__PURE__*/_jsxs(DropdownMenuItem, {
23
- onSelect: onRename,
24
- children: [/*#__PURE__*/_jsx(PencilIcon, {}), "Rename"]
25
- }), onArchive && /*#__PURE__*/_jsxs(DropdownMenuItem, {
26
- onSelect: onArchive,
27
- children: [/*#__PURE__*/_jsx(ArchiveIcon, {}), "Archive"]
28
- })]
29
- })]
30
- });
75
+ children: [t4, t5]
76
+ });
77
+ $[7] = t4;
78
+ $[8] = t5;
79
+ $[9] = t6;
80
+ } else {
81
+ t6 = $[9];
82
+ }
83
+ let t7;
84
+ if ($[10] !== t3 || $[11] !== t6) {
85
+ t7 = /*#__PURE__*/_jsxs(DropdownMenu, {
86
+ children: [t3, t6]
87
+ });
88
+ $[10] = t3;
89
+ $[11] = t6;
90
+ $[12] = t7;
91
+ } else {
92
+ t7 = $[12];
93
+ }
94
+ return t7;
31
95
  }
@@ -1,38 +1,83 @@
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
1
4
  import { Input } from "@locusgraph/components";
2
5
  import { useState } from "react";
3
6
  import { jsx as _jsx } from "react/jsx-runtime";
4
- export function ThreadTitleEditor({
5
- title,
6
- onCommit,
7
- onCancel
8
- }) {
7
+ export function ThreadTitleEditor(t0) {
8
+ const $ = _c(13);
9
+ const {
10
+ title,
11
+ onCommit,
12
+ onCancel
13
+ } = t0;
9
14
  const [draft, setDraft] = useState(title);
10
- const commit = () => {
11
- const trimmed = draft.trim();
12
- if (trimmed && trimmed !== title) {
13
- onCommit(trimmed);
14
- } else {
15
- onCancel();
16
- }
17
- };
18
- return /*#__PURE__*/_jsx(Input, {
19
- "data-slot": "thread-title-editor",
20
- "aria-label": "Chat title",
21
- autoFocus: true,
22
- value: draft,
23
- className: "h-7 text-sm",
24
- onChange: event => setDraft(event.target.value),
25
- onFocus: event => event.target.select(),
26
- onBlur: commit,
27
- onKeyDown: event => {
28
- if (event.key === "Enter") {
29
- event.preventDefault();
15
+ let t1;
16
+ if ($[0] !== draft || $[1] !== onCancel || $[2] !== onCommit || $[3] !== title) {
17
+ t1 = () => {
18
+ const trimmed = draft.trim();
19
+ if (trimmed && trimmed !== title) {
20
+ onCommit(trimmed);
21
+ } else {
22
+ onCancel();
23
+ }
24
+ };
25
+ $[0] = draft;
26
+ $[1] = onCancel;
27
+ $[2] = onCommit;
28
+ $[3] = title;
29
+ $[4] = t1;
30
+ } else {
31
+ t1 = $[4];
32
+ }
33
+ const commit = t1;
34
+ let t2;
35
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
36
+ t2 = event => setDraft(event.target.value);
37
+ $[5] = t2;
38
+ } else {
39
+ t2 = $[5];
40
+ }
41
+ let t3;
42
+ if ($[6] !== commit || $[7] !== onCancel) {
43
+ t3 = event_1 => {
44
+ if (event_1.key === "Enter") {
45
+ event_1.preventDefault();
30
46
  commit();
31
47
  }
32
- if (event.key === "Escape") {
33
- event.preventDefault();
48
+ if (event_1.key === "Escape") {
49
+ event_1.preventDefault();
34
50
  onCancel();
35
51
  }
36
- }
37
- });
52
+ };
53
+ $[6] = commit;
54
+ $[7] = onCancel;
55
+ $[8] = t3;
56
+ } else {
57
+ t3 = $[8];
58
+ }
59
+ let t4;
60
+ if ($[9] !== commit || $[10] !== draft || $[11] !== t3) {
61
+ t4 = /*#__PURE__*/_jsx(Input, {
62
+ "data-slot": "thread-title-editor",
63
+ "aria-label": "Chat title",
64
+ autoFocus: true,
65
+ value: draft,
66
+ className: "h-control-sm text-sm",
67
+ onChange: t2,
68
+ onFocus: _temp,
69
+ onBlur: commit,
70
+ onKeyDown: t3
71
+ });
72
+ $[9] = commit;
73
+ $[10] = draft;
74
+ $[11] = t3;
75
+ $[12] = t4;
76
+ } else {
77
+ t4 = $[12];
78
+ }
79
+ return t4;
80
+ }
81
+ function _temp(event_0) {
82
+ return event_0.target.select();
38
83
  }