@truefoundry/trueforge-ui 0.3.0-rc.5 → 0.3.0-rc.7

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 (84) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/{AgentCodeSnippets-V5A56M7R.js → AgentCodeSnippets-T7PR6PDP.js} +7 -7
  3. package/dist/AgentMetricChart-J3RCSCAG.js +15 -0
  4. package/dist/{AgentOverview-NPC4P2EY.js → AgentOverview-WC7WMNMS.js} +11 -9
  5. package/dist/AgentOverview-WC7WMNMS.js.map +1 -0
  6. package/dist/{AgentSessionEventTimeline-UUXOJXTC.js → AgentSessionEventTimeline-SETKGGCI.js} +7 -7
  7. package/dist/{AgentSessionEventTimelineChart-FIAQCYJC.js → AgentSessionEventTimelineChart-4Y7PY5SJ.js} +7 -7
  8. package/dist/{AgentSessions-WHODEG2M.js → AgentSessions-YCAPM5GK.js} +8 -8
  9. package/dist/{ConnectorSettings-QTAI4TQX.js → ConnectorSettings-PXWRCFAL.js} +7 -7
  10. package/dist/{DockLayout-TATYU5SV.js → DockLayout-JRKCKAG2.js} +10 -10
  11. package/dist/{DrawerLayout-DXHNV33K.js → DrawerLayout-U7YPUZBR.js} +11 -11
  12. package/dist/{ModelSettings-UWTBHQRG.js → ModelSettings-VXYMJEMO.js} +7 -7
  13. package/dist/OpenUiFenceBlock-KPZFLUSC.js +9 -0
  14. package/dist/{SandboxSettings-BITQONS3.js → SandboxSettings-6DRUH72J.js} +7 -7
  15. package/dist/SchedulesPage-2G6F4XO6.js +15 -0
  16. package/dist/{SettingsBuilder-3OA4UCIM.js → SettingsBuilder-6FJVZLJT.js} +9 -9
  17. package/dist/{SettingsBuilder-3OA4UCIM.js.map → SettingsBuilder-6FJVZLJT.js.map} +1 -1
  18. package/dist/{ShellRouteSync-J74MV23Q.js → ShellRouteSync-SJXFKUAJ.js} +4 -4
  19. package/dist/{SidebarLayout-EQXQPYIU.js → SidebarLayout-EQ7EYCWR.js} +12 -12
  20. package/dist/{SkillSettings-KQ6GQ7JW.js → SkillSettings-IHVI7FDM.js} +7 -7
  21. package/dist/{TrueForgeUIWithRouter-R3UXQZRY.js → TrueForgeUIWithRouter-5OJFI3PF.js} +9 -9
  22. package/dist/{WidgetLayout-YWZTYFZL.js → WidgetLayout-PN5ZDOLM.js} +10 -10
  23. package/dist/{chunk-TAABBM7F.js → chunk-2GIZY3JJ.js} +3 -1
  24. package/dist/chunk-2GIZY3JJ.js.map +1 -0
  25. package/dist/{chunk-4MCIDE2C.js → chunk-2QTH6JHX.js} +3 -3
  26. package/dist/{chunk-ZZB3JIBQ.js → chunk-2UBSLCKB.js} +9 -9
  27. package/dist/{chunk-IIHJ32YH.js → chunk-3ZW74FHC.js} +3 -3
  28. package/dist/{chunk-CFGLAGWH.js → chunk-CG75X77Q.js} +2 -2
  29. package/dist/{chunk-TFFTZB26.js → chunk-E33DFTVN.js} +8 -8
  30. package/dist/chunk-E33DFTVN.js.map +1 -0
  31. package/dist/{chunk-ERIIJKJY.js → chunk-F7YRYFAF.js} +4 -4
  32. package/dist/chunk-JCL3Q7RW.js +587 -0
  33. package/dist/{chunk-OWDH67NY.js.map → chunk-JCL3Q7RW.js.map} +1 -1
  34. package/dist/{chunk-IVDIBAVH.js → chunk-L7HNKKS2.js} +2 -2
  35. package/dist/{chunk-INY3J2BV.js → chunk-OWXPMQ7N.js} +10 -10
  36. package/dist/{chunk-7NYDADYN.js → chunk-PX6MNNN3.js} +5 -5
  37. package/dist/{chunk-3QWUHGNL.js → chunk-T6QQV5LK.js} +55 -12
  38. package/dist/chunk-T6QQV5LK.js.map +1 -0
  39. package/dist/{chunk-DCVKW445.js → chunk-TMIILLHB.js} +478 -268
  40. package/dist/chunk-TMIILLHB.js.map +1 -0
  41. package/dist/{chunk-MMU55KCW.js → chunk-XANC4F2H.js} +318 -166
  42. package/dist/chunk-XANC4F2H.js.map +1 -0
  43. package/dist/index.d.ts +15 -11
  44. package/dist/index.js +12 -12
  45. package/dist/plugins/trueforge-agent-server-adapter/index.d.ts +2 -1
  46. package/dist/plugins/trueforge-agent-server-adapter/index.js +65 -14
  47. package/dist/plugins/trueforge-agent-server-adapter/index.js.map +1 -1
  48. package/dist/styles.css +1 -1
  49. package/package.json +3 -3
  50. package/dist/AgentMetricChart-GEADURES.js +0 -15
  51. package/dist/AgentOverview-NPC4P2EY.js.map +0 -1
  52. package/dist/OpenUiFenceBlock-FHEYXZEQ.js +0 -9
  53. package/dist/SchedulesPage-JIUWNYUH.js +0 -15
  54. package/dist/chunk-3QWUHGNL.js.map +0 -1
  55. package/dist/chunk-DCVKW445.js.map +0 -1
  56. package/dist/chunk-MMU55KCW.js.map +0 -1
  57. package/dist/chunk-OWDH67NY.js +0 -587
  58. package/dist/chunk-TAABBM7F.js.map +0 -1
  59. package/dist/chunk-TFFTZB26.js.map +0 -1
  60. /package/dist/{AgentCodeSnippets-V5A56M7R.js.map → AgentCodeSnippets-T7PR6PDP.js.map} +0 -0
  61. /package/dist/{AgentMetricChart-GEADURES.js.map → AgentMetricChart-J3RCSCAG.js.map} +0 -0
  62. /package/dist/{AgentSessionEventTimeline-UUXOJXTC.js.map → AgentSessionEventTimeline-SETKGGCI.js.map} +0 -0
  63. /package/dist/{AgentSessionEventTimelineChart-FIAQCYJC.js.map → AgentSessionEventTimelineChart-4Y7PY5SJ.js.map} +0 -0
  64. /package/dist/{AgentSessions-WHODEG2M.js.map → AgentSessions-YCAPM5GK.js.map} +0 -0
  65. /package/dist/{ConnectorSettings-QTAI4TQX.js.map → ConnectorSettings-PXWRCFAL.js.map} +0 -0
  66. /package/dist/{DockLayout-TATYU5SV.js.map → DockLayout-JRKCKAG2.js.map} +0 -0
  67. /package/dist/{DrawerLayout-DXHNV33K.js.map → DrawerLayout-U7YPUZBR.js.map} +0 -0
  68. /package/dist/{ModelSettings-UWTBHQRG.js.map → ModelSettings-VXYMJEMO.js.map} +0 -0
  69. /package/dist/{OpenUiFenceBlock-FHEYXZEQ.js.map → OpenUiFenceBlock-KPZFLUSC.js.map} +0 -0
  70. /package/dist/{SandboxSettings-BITQONS3.js.map → SandboxSettings-6DRUH72J.js.map} +0 -0
  71. /package/dist/{SchedulesPage-JIUWNYUH.js.map → SchedulesPage-2G6F4XO6.js.map} +0 -0
  72. /package/dist/{ShellRouteSync-J74MV23Q.js.map → ShellRouteSync-SJXFKUAJ.js.map} +0 -0
  73. /package/dist/{SidebarLayout-EQXQPYIU.js.map → SidebarLayout-EQ7EYCWR.js.map} +0 -0
  74. /package/dist/{SkillSettings-KQ6GQ7JW.js.map → SkillSettings-IHVI7FDM.js.map} +0 -0
  75. /package/dist/{TrueForgeUIWithRouter-R3UXQZRY.js.map → TrueForgeUIWithRouter-5OJFI3PF.js.map} +0 -0
  76. /package/dist/{WidgetLayout-YWZTYFZL.js.map → WidgetLayout-PN5ZDOLM.js.map} +0 -0
  77. /package/dist/{chunk-4MCIDE2C.js.map → chunk-2QTH6JHX.js.map} +0 -0
  78. /package/dist/{chunk-ZZB3JIBQ.js.map → chunk-2UBSLCKB.js.map} +0 -0
  79. /package/dist/{chunk-IIHJ32YH.js.map → chunk-3ZW74FHC.js.map} +0 -0
  80. /package/dist/{chunk-CFGLAGWH.js.map → chunk-CG75X77Q.js.map} +0 -0
  81. /package/dist/{chunk-ERIIJKJY.js.map → chunk-F7YRYFAF.js.map} +0 -0
  82. /package/dist/{chunk-IVDIBAVH.js.map → chunk-L7HNKKS2.js.map} +0 -0
  83. /package/dist/{chunk-INY3J2BV.js.map → chunk-OWXPMQ7N.js.map} +0 -0
  84. /package/dist/{chunk-7NYDADYN.js.map → chunk-PX6MNNN3.js.map} +0 -0
@@ -24,37 +24,266 @@ import {
24
24
  TableTokenPagination,
25
25
  Tooltip,
26
26
  auiInputClass,
27
+ auiSelectMenuClass,
28
+ auiSelectOptionClass,
29
+ auiSelectTriggerClass,
27
30
  hasCreatedBySubject,
28
31
  mountName,
32
+ themePortalRoot,
29
33
  useResourcePermissions,
30
34
  useSlot,
31
35
  useToasterOptional
32
- } from "./chunk-MMU55KCW.js";
36
+ } from "./chunk-XANC4F2H.js";
33
37
  import {
38
+ findLibraryAgent,
34
39
  readScheduleShareSearch,
35
40
  replaceScheduleShareSearch,
36
- searchAllAgents
37
- } from "./chunk-3QWUHGNL.js";
41
+ useSearchAgentsList
42
+ } from "./chunk-T6QQV5LK.js";
38
43
  import {
39
44
  DraftCatalogProvider,
40
45
  Icon,
41
46
  PageHeader,
42
47
  auiButtonClass,
43
48
  useDraftCatalog
44
- } from "./chunk-IIHJ32YH.js";
49
+ } from "./chunk-3ZW74FHC.js";
45
50
  import {
46
51
  libraryAgentId,
47
52
  useOptionalCatalogServer,
48
53
  useOptionalShellMode,
49
54
  useScheduleServer,
50
55
  useServer
51
- } from "./chunk-TAABBM7F.js";
56
+ } from "./chunk-2GIZY3JJ.js";
52
57
  import {
53
58
  cn
54
- } from "./chunk-OWDH67NY.js";
59
+ } from "./chunk-JCL3Q7RW.js";
55
60
 
56
61
  // src/atoms/schedules/SchedulesPage.tsx
57
- import { useCallback, useEffect as useEffect3, useMemo as useMemo2, useRef, useState as useState3 } from "react";
62
+ import { useCallback, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
63
+
64
+ // src/atoms/AgentSearchPicker.tsx
65
+ import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
66
+ import { createPortal } from "react-dom";
67
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
68
+ function AgentSearchPicker({
69
+ value,
70
+ selectedLabel,
71
+ onValueChange,
72
+ onAgentPicked,
73
+ disabled = false,
74
+ onBuildAgent,
75
+ allOption,
76
+ "aria-label": ariaLabel = "Agent",
77
+ placeholder = "Search agent",
78
+ className
79
+ }) {
80
+ const [open, setOpen] = useState(false);
81
+ const [query, setQuery] = useState("");
82
+ const [pos, setPos] = useState(null);
83
+ const rootRef = useRef(null);
84
+ const triggerRef = useRef(null);
85
+ const inputRef = useRef(null);
86
+ const menuRef = useRef(null);
87
+ const listboxId = useId();
88
+ const { agents, isInitialLoading, isSearching, loadingMore, hasMore, error, listRef, sentinelRef } = useSearchAgentsList({
89
+ enabled: open && !disabled,
90
+ query
91
+ });
92
+ useEffect(() => {
93
+ if (!open) setQuery("");
94
+ }, [open]);
95
+ useLayoutEffect(() => {
96
+ if (!open) {
97
+ setPos(null);
98
+ return;
99
+ }
100
+ const update = () => {
101
+ const el = triggerRef.current;
102
+ if (!el) return;
103
+ const rect = el.getBoundingClientRect();
104
+ setPos({
105
+ top: rect.bottom + 4,
106
+ left: rect.left,
107
+ width: rect.width
108
+ });
109
+ };
110
+ update();
111
+ window.addEventListener("scroll", update, true);
112
+ window.addEventListener("resize", update);
113
+ return () => {
114
+ window.removeEventListener("scroll", update, true);
115
+ window.removeEventListener("resize", update);
116
+ };
117
+ }, [open]);
118
+ useEffect(() => {
119
+ if (!open) return;
120
+ const handlePointerDown = (event) => {
121
+ if (!(event.target instanceof Node)) return;
122
+ if (rootRef.current?.contains(event.target)) return;
123
+ if (menuRef.current?.contains(event.target)) return;
124
+ setOpen(false);
125
+ };
126
+ document.addEventListener("mousedown", handlePointerDown);
127
+ return () => document.removeEventListener("mousedown", handlePointerDown);
128
+ }, [open]);
129
+ const close = () => {
130
+ setOpen(false);
131
+ setQuery("");
132
+ inputRef.current?.blur();
133
+ };
134
+ const pick = (agent) => {
135
+ const id = libraryAgentId(agent);
136
+ onValueChange(id);
137
+ onAgentPicked?.(agent);
138
+ close();
139
+ };
140
+ const pickAll = () => {
141
+ if (allOption == null) return;
142
+ onValueChange(allOption.value);
143
+ close();
144
+ };
145
+ const inputValue = open ? query : selectedLabel;
146
+ const queryTrimmed = query.trim();
147
+ const showError = !isInitialLoading && error != null;
148
+ const showEmptyCatalog = !isInitialLoading && error == null && agents.length === 0 && queryTrimmed === "";
149
+ const showNoMatch = !isInitialLoading && error == null && agents.length === 0 && queryTrimmed !== "";
150
+ const menu = open && pos != null && !disabled ? createPortal(
151
+ /* @__PURE__ */ jsxs(
152
+ "div",
153
+ {
154
+ ref: menuRef,
155
+ className: auiSelectMenuClass("fixed z-[200] flex max-h-64 flex-col overflow-hidden"),
156
+ style: {
157
+ top: pos.top,
158
+ left: pos.left,
159
+ width: pos.width
160
+ },
161
+ onMouseDown: (event) => event.stopPropagation(),
162
+ children: [
163
+ /* @__PURE__ */ jsxs(
164
+ "div",
165
+ {
166
+ ref: listRef,
167
+ id: listboxId,
168
+ role: "listbox",
169
+ "aria-label": ariaLabel,
170
+ className: "min-h-0 flex-1 overflow-y-auto p-1",
171
+ children: [
172
+ allOption != null && queryTrimmed === "" ? /* @__PURE__ */ jsxs(
173
+ "button",
174
+ {
175
+ type: "button",
176
+ role: "option",
177
+ "aria-selected": value === allOption.value,
178
+ className: auiSelectOptionClass(),
179
+ onClick: pickAll,
180
+ children: [
181
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: allOption.label }),
182
+ /* @__PURE__ */ jsx(
183
+ Icon,
184
+ {
185
+ name: "check",
186
+ className: cn("ml-auto size-4 shrink-0", value === allOption.value ? "opacity-100" : "opacity-0")
187
+ }
188
+ )
189
+ ]
190
+ }
191
+ ) : null,
192
+ isInitialLoading ? /* @__PURE__ */ jsx("p", { className: "text-text-secondary px-3 py-5 text-center text-sm", role: "status", children: "Loading\u2026" }) : showError ? /* @__PURE__ */ jsx("p", { className: "text-failure-bg px-3 py-5 text-center text-sm", role: "alert", children: error }) : showEmptyCatalog ? /* @__PURE__ */ jsx("p", { className: "text-text-secondary px-3 py-5 text-center text-sm", children: "No Agents created yet" }) : showNoMatch ? /* @__PURE__ */ jsxs("p", { className: "text-text-secondary px-3 py-5 text-center text-sm", role: "status", children: [
193
+ 'No agents match "',
194
+ queryTrimmed,
195
+ '".'
196
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
197
+ isSearching ? /* @__PURE__ */ jsx("p", { className: "sr-only", role: "status", children: "Searching\u2026" }) : null,
198
+ agents.map((agent) => {
199
+ const id = libraryAgentId(agent);
200
+ const selected = value === id;
201
+ return /* @__PURE__ */ jsxs(
202
+ "button",
203
+ {
204
+ type: "button",
205
+ role: "option",
206
+ "aria-selected": selected,
207
+ className: auiSelectOptionClass(),
208
+ onClick: () => pick(agent),
209
+ children: [
210
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: agent.name }),
211
+ /* @__PURE__ */ jsx(
212
+ Icon,
213
+ {
214
+ name: "check",
215
+ className: cn("ml-auto size-4 shrink-0", selected ? "opacity-100" : "opacity-0")
216
+ }
217
+ )
218
+ ]
219
+ },
220
+ id
221
+ );
222
+ }),
223
+ hasMore ? /* @__PURE__ */ jsx("div", { ref: sentinelRef, className: "flex h-6 shrink-0 items-center justify-center", "aria-hidden": true, children: loadingMore ? /* @__PURE__ */ jsx("span", { className: "text-text-secondary text-[11px]", role: "status", children: "Loading more\u2026" }) : null }) : null
224
+ ] })
225
+ ]
226
+ }
227
+ ),
228
+ showEmptyCatalog && onBuildAgent != null ? /* @__PURE__ */ jsx("div", { className: "flex justify-end border-t border-border px-2 pt-2", children: /* @__PURE__ */ jsxs(Button.Ghost, { type: "button", onClick: onBuildAgent, children: [
229
+ /* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-3.5" }),
230
+ "Build Agent"
231
+ ] }) }) : null
232
+ ]
233
+ }
234
+ ),
235
+ themePortalRoot(rootRef.current)
236
+ ) : null;
237
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: cn("relative", className), children: [
238
+ /* @__PURE__ */ jsxs(
239
+ "div",
240
+ {
241
+ ref: triggerRef,
242
+ className: auiSelectTriggerClass(disabled ? "cursor-not-allowed opacity-50" : "cursor-text"),
243
+ children: [
244
+ /* @__PURE__ */ jsx(
245
+ "input",
246
+ {
247
+ ref: inputRef,
248
+ type: "text",
249
+ role: "combobox",
250
+ "aria-label": ariaLabel,
251
+ "aria-expanded": open,
252
+ "aria-controls": open ? listboxId : void 0,
253
+ "aria-autocomplete": "list",
254
+ disabled,
255
+ placeholder,
256
+ value: inputValue,
257
+ className: "min-w-0 flex-1 bg-transparent outline-none placeholder:text-text-secondary/70 disabled:cursor-not-allowed",
258
+ onFocus: () => {
259
+ if (!disabled) setOpen(true);
260
+ },
261
+ onChange: (event) => {
262
+ if (disabled) return;
263
+ setQuery(event.target.value);
264
+ setOpen(true);
265
+ },
266
+ onKeyDown: (event) => {
267
+ if (event.key === "Escape") {
268
+ event.preventDefault();
269
+ setOpen(false);
270
+ inputRef.current?.blur();
271
+ return;
272
+ }
273
+ if (event.key === "ArrowDown" && !open && !disabled) {
274
+ event.preventDefault();
275
+ setOpen(true);
276
+ }
277
+ }
278
+ }
279
+ ),
280
+ /* @__PURE__ */ jsx(Icon, { name: "chevron-down", className: "size-4 shrink-0 text-text-secondary" })
281
+ ]
282
+ }
283
+ ),
284
+ menu
285
+ ] });
286
+ }
58
287
 
59
288
  // src/atoms/schedules/cadence.ts
60
289
  var TIMEZONE_OPTIONS = [
@@ -260,10 +489,10 @@ function formatRelativeTime(iso, nowMs = Date.now()) {
260
489
  }
261
490
 
262
491
  // src/atoms/schedules/ScheduleFormDrawer.tsx
263
- import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
492
+ import { useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3 } from "react";
264
493
 
265
494
  // src/atoms/schedules/ScheduleFormFields.tsx
266
- import { jsx, jsxs } from "react/jsx-runtime";
495
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
267
496
  var RECURRENCE_OPTIONS = [
268
497
  { value: "hourly", label: "Hourly" },
269
498
  { value: "daily", label: "Daily" },
@@ -281,9 +510,9 @@ function ScheduleFormFields({
281
510
  values,
282
511
  onChange,
283
512
  agentId,
513
+ agentLabel,
284
514
  onAgentIdChange,
285
- agentOptions,
286
- agentOptionsLoaded = true,
515
+ onAgentPicked,
287
516
  agentPickerDisabled = false,
288
517
  onBuildAgent
289
518
  }) {
@@ -298,29 +527,26 @@ function ScheduleFormFields({
298
527
  const weekdays = has ? values.weekdays.filter((d) => d !== day) : [...values.weekdays, day];
299
528
  onChange({ ...values, weekdays: weekdays.length > 0 ? weekdays : [day] });
300
529
  };
301
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 px-5 py-4", children: [
302
- /* @__PURE__ */ jsxs("div", { className: "block", children: [
303
- /* @__PURE__ */ jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Agent" }),
304
- /* @__PURE__ */ jsx(
305
- PopoverSelect,
530
+ return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-4 px-5 py-4", children: [
531
+ /* @__PURE__ */ jsxs2("div", { className: "block", children: [
532
+ /* @__PURE__ */ jsx2("span", { className: "mb-1.5 block text-sm font-medium", children: "Agent" }),
533
+ /* @__PURE__ */ jsx2(
534
+ AgentSearchPicker,
306
535
  {
307
536
  "aria-label": "Agent",
308
- placeholder: "Select an agent",
537
+ placeholder: "Search agent",
309
538
  value: agentId,
310
- options: agentOptions.map((agent) => ({ value: agent.agentId, label: agent.name })),
539
+ selectedLabel: agentLabel,
311
540
  onValueChange: (value) => onAgentIdChange?.(value),
541
+ onAgentPicked,
312
542
  disabled: agentPickerDisabled || onAgentIdChange == null,
313
- emptyContent: agentOptionsLoaded ? /* @__PURE__ */ jsx("p", { className: "text-text-secondary px-3 py-5 text-center text-sm", children: "No Agents created yet" }) : null,
314
- footer: agentOptionsLoaded && agentOptions.length === 0 && onBuildAgent != null ? /* @__PURE__ */ jsx("div", { className: "flex justify-end border-t border-border px-2 pt-2", children: /* @__PURE__ */ jsxs(Button.Ghost, { type: "button", onClick: onBuildAgent, children: [
315
- /* @__PURE__ */ jsx(Icon, { name: "plus", className: "size-3.5" }),
316
- "Build Agent"
317
- ] }) }) : null
543
+ onBuildAgent
318
544
  }
319
545
  )
320
546
  ] }),
321
- /* @__PURE__ */ jsxs("label", { className: "block", children: [
322
- /* @__PURE__ */ jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Name" }),
323
- /* @__PURE__ */ jsx(
547
+ /* @__PURE__ */ jsxs2("label", { className: "block", children: [
548
+ /* @__PURE__ */ jsx2("span", { className: "mb-1.5 block text-sm font-medium", children: "Name" }),
549
+ /* @__PURE__ */ jsx2(
324
550
  "input",
325
551
  {
326
552
  value: values.name,
@@ -331,9 +557,9 @@ function ScheduleFormFields({
331
557
  }
332
558
  )
333
559
  ] }),
334
- /* @__PURE__ */ jsxs("label", { className: "block", children: [
335
- /* @__PURE__ */ jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Task" }),
336
- /* @__PURE__ */ jsx(
560
+ /* @__PURE__ */ jsxs2("label", { className: "block", children: [
561
+ /* @__PURE__ */ jsx2("span", { className: "mb-1.5 block text-sm font-medium", children: "Task" }),
562
+ /* @__PURE__ */ jsx2(
337
563
  "textarea",
338
564
  {
339
565
  value: values.task,
@@ -345,12 +571,12 @@ function ScheduleFormFields({
345
571
  }
346
572
  )
347
573
  ] }),
348
- /* @__PURE__ */ jsxs("fieldset", { children: [
349
- /* @__PURE__ */ jsx("legend", { className: "mb-1.5 text-sm font-medium", children: "Frequency" }),
350
- /* @__PURE__ */ jsx("div", { className: "rounded-t-lg border border-border p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
351
- /* @__PURE__ */ jsx("div", { className: "grid grid-cols-3 gap-1 rounded-lg border border-border bg-primary-bg p-1", children: RECURRENCE_OPTIONS.map((opt) => {
574
+ /* @__PURE__ */ jsxs2("fieldset", { children: [
575
+ /* @__PURE__ */ jsx2("legend", { className: "mb-1.5 text-sm font-medium", children: "Frequency" }),
576
+ /* @__PURE__ */ jsx2("div", { className: "rounded-t-lg border border-border p-4", children: /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-4", children: [
577
+ /* @__PURE__ */ jsx2("div", { className: "grid grid-cols-3 gap-1 rounded-lg border border-border bg-primary-bg p-1", children: RECURRENCE_OPTIONS.map((opt) => {
352
578
  const selected = values.recurrence === opt.value;
353
- return /* @__PURE__ */ jsx(
579
+ return /* @__PURE__ */ jsx2(
354
580
  "button",
355
581
  {
356
582
  type: "button",
@@ -365,16 +591,16 @@ function ScheduleFormFields({
365
591
  opt.value
366
592
  );
367
593
  }) }),
368
- values.recurrence === "custom" ? /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border bg-secondary-bg/40 px-3 py-2", children: [
369
- /* @__PURE__ */ jsx("span", { className: "block text-xs text-text-secondary", children: "Existing custom schedule" }),
370
- /* @__PURE__ */ jsx("code", { className: "mt-1 block font-mono text-sm text-text-primary", children: values.customCron }),
371
- /* @__PURE__ */ jsx("span", { className: "mt-1 block text-xs text-text-secondary", children: "Select Hourly, Daily, or Weekly to replace this schedule." })
594
+ values.recurrence === "custom" ? /* @__PURE__ */ jsxs2("div", { className: "rounded-md border border-border bg-secondary-bg/40 px-3 py-2", children: [
595
+ /* @__PURE__ */ jsx2("span", { className: "block text-xs text-text-secondary", children: "Existing custom schedule" }),
596
+ /* @__PURE__ */ jsx2("code", { className: "mt-1 block font-mono text-sm text-text-primary", children: values.customCron }),
597
+ /* @__PURE__ */ jsx2("span", { className: "mt-1 block text-xs text-text-secondary", children: "Select Hourly, Daily, or Weekly to replace this schedule." })
372
598
  ] }) : null,
373
- values.recurrence === "weekly" ? /* @__PURE__ */ jsxs("fieldset", { children: [
374
- /* @__PURE__ */ jsx("legend", { className: "mb-2 text-sm font-medium", children: "Days" }),
375
- /* @__PURE__ */ jsx("div", { className: "flex gap-2", children: WEEKDAY_OPTIONS.map((day) => {
599
+ values.recurrence === "weekly" ? /* @__PURE__ */ jsxs2("fieldset", { children: [
600
+ /* @__PURE__ */ jsx2("legend", { className: "mb-2 text-sm font-medium", children: "Days" }),
601
+ /* @__PURE__ */ jsx2("div", { className: "flex gap-2", children: WEEKDAY_OPTIONS.map((day) => {
376
602
  const selected = values.weekdays.includes(day.value);
377
- return /* @__PURE__ */ jsx(
603
+ return /* @__PURE__ */ jsx2(
378
604
  "button",
379
605
  {
380
606
  type: "button",
@@ -390,10 +616,10 @@ function ScheduleFormFields({
390
616
  );
391
617
  }) })
392
618
  ] }) : null,
393
- /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
394
- values.recurrence === "daily" || values.recurrence === "weekly" ? /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
395
- /* @__PURE__ */ jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Hour" }),
396
- /* @__PURE__ */ jsx(
619
+ /* @__PURE__ */ jsxs2("div", { className: "flex gap-4", children: [
620
+ values.recurrence === "daily" || values.recurrence === "weekly" ? /* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
621
+ /* @__PURE__ */ jsx2("span", { className: "mb-1.5 block text-sm font-medium", children: "Hour" }),
622
+ /* @__PURE__ */ jsx2(
397
623
  PopoverSelect,
398
624
  {
399
625
  "aria-label": "Hour",
@@ -403,9 +629,9 @@ function ScheduleFormFields({
403
629
  }
404
630
  )
405
631
  ] }) : null,
406
- values.recurrence !== "custom" ? /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
407
- /* @__PURE__ */ jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Minute" }),
408
- /* @__PURE__ */ jsx(
632
+ values.recurrence !== "custom" ? /* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
633
+ /* @__PURE__ */ jsx2("span", { className: "mb-1.5 block text-sm font-medium", children: "Minute" }),
634
+ /* @__PURE__ */ jsx2(
409
635
  PopoverSelect,
410
636
  {
411
637
  "aria-label": "Minute",
@@ -415,9 +641,9 @@ function ScheduleFormFields({
415
641
  }
416
642
  )
417
643
  ] }) : null,
418
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
419
- /* @__PURE__ */ jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Timezone" }),
420
- /* @__PURE__ */ jsx(
644
+ /* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
645
+ /* @__PURE__ */ jsx2("span", { className: "mb-1.5 block text-sm font-medium", children: "Timezone" }),
646
+ /* @__PURE__ */ jsx2(
421
647
  PopoverSelect,
422
648
  {
423
649
  "aria-label": "Timezone",
@@ -430,18 +656,18 @@ function ScheduleFormFields({
430
656
  ] })
431
657
  ] })
432
658
  ] }) }),
433
- /* @__PURE__ */ jsx("div", { className: "rounded-b-lg border border-t-0 border-border bg-primary-button-bg/10 px-4 py-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
434
- /* @__PURE__ */ jsx(Icon, { name: "clock", className: "size-4 shrink-0 text-primary-button-bg" }),
435
- /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs font-medium text-text-secondary", children: "Schedule" }),
436
- /* @__PURE__ */ jsx("p", { className: "min-w-0 flex-1 truncate text-sm text-text-primary", children: cadence || "\u2014" }),
437
- /* @__PURE__ */ jsx("code", { className: "shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary", children: cron || "\u2014" })
659
+ /* @__PURE__ */ jsx2("div", { className: "rounded-b-lg border border-t-0 border-border bg-primary-button-bg/10 px-4 py-3", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
660
+ /* @__PURE__ */ jsx2(Icon, { name: "clock", className: "size-4 shrink-0 text-primary-button-bg" }),
661
+ /* @__PURE__ */ jsx2("span", { className: "shrink-0 text-xs font-medium text-text-secondary", children: "Schedule" }),
662
+ /* @__PURE__ */ jsx2("p", { className: "min-w-0 flex-1 truncate text-sm text-text-primary", children: cadence || "\u2014" }),
663
+ /* @__PURE__ */ jsx2("code", { className: "shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary", children: cron || "\u2014" })
438
664
  ] }) })
439
665
  ] })
440
666
  ] });
441
667
  }
442
668
 
443
669
  // src/atoms/schedules/TestScheduleScreen.tsx
444
- import { useEffect, useState } from "react";
670
+ import { useEffect as useEffect2, useState as useState2 } from "react";
445
671
 
446
672
  // src/atoms/schedules/scheduleRuns.ts
447
673
  function isManualRun(name) {
@@ -478,20 +704,20 @@ function formatScheduleRunInstant(iso) {
478
704
  }
479
705
 
480
706
  // src/atoms/schedules/ScheduleRunTooltip.tsx
481
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
707
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
482
708
  function ScheduleRunTooltip({ run }) {
483
- return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-1 text-left text-xs", children: [
484
- /* @__PURE__ */ jsx2("p", { className: "text-text-primary font-medium", children: runStatusLabel(run.status) }),
485
- /* @__PURE__ */ jsx2("p", { className: "text-text-secondary", children: runTypeLabel(run.name) }),
486
- /* @__PURE__ */ jsxs2("p", { className: "text-text-secondary", children: [
709
+ return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-1 text-left text-xs", children: [
710
+ /* @__PURE__ */ jsx3("p", { className: "text-text-primary font-medium", children: runStatusLabel(run.status) }),
711
+ /* @__PURE__ */ jsx3("p", { className: "text-text-secondary", children: runTypeLabel(run.name) }),
712
+ /* @__PURE__ */ jsxs3("p", { className: "text-text-secondary", children: [
487
713
  "Scheduled for: ",
488
714
  formatScheduleRunInstant(run.scheduledFor)
489
715
  ] }),
490
- run.triggeredAt != null ? /* @__PURE__ */ jsxs2("p", { className: "text-text-secondary", children: [
716
+ run.triggeredAt != null ? /* @__PURE__ */ jsxs3("p", { className: "text-text-secondary", children: [
491
717
  "Triggered at: ",
492
718
  formatScheduleRunInstant(run.triggeredAt)
493
719
  ] }) : null,
494
- /* @__PURE__ */ jsxs2("p", { className: "text-text-secondary", children: [
720
+ /* @__PURE__ */ jsxs3("p", { className: "text-text-secondary", children: [
495
721
  "Triggered by: ",
496
722
  run.triggeredBy
497
723
  ] })
@@ -499,7 +725,7 @@ function ScheduleRunTooltip({ run }) {
499
725
  }
500
726
 
501
727
  // src/atoms/schedules/ScheduleRunChip.tsx
502
- import { jsx as jsx3 } from "react/jsx-runtime";
728
+ import { jsx as jsx4 } from "react/jsx-runtime";
503
729
  var CHIP_STYLES = {
504
730
  success: "border-emerald-600/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300",
505
731
  failed: "border-red-600/30 bg-red-500/10 text-red-700 dark:border-red-400/35 dark:bg-red-500/15 dark:text-red-300"
@@ -507,21 +733,21 @@ var CHIP_STYLES = {
507
733
  function ScheduleRunChip({ run }) {
508
734
  const kind = runChipKind(run.status);
509
735
  const when = formatScheduleRunInstant(run.triggeredAt ?? run.scheduledFor);
510
- return /* @__PURE__ */ jsx3(Tooltip, { content: /* @__PURE__ */ jsx3(ScheduleRunTooltip, { run }), side: "top", children: /* @__PURE__ */ jsx3(
736
+ return /* @__PURE__ */ jsx4(Tooltip, { content: /* @__PURE__ */ jsx4(ScheduleRunTooltip, { run }), side: "top", children: /* @__PURE__ */ jsx4(
511
737
  "span",
512
738
  {
513
739
  className: cn("inline-flex size-6 shrink-0 items-center justify-center rounded-md border", CHIP_STYLES[kind]),
514
740
  "aria-label": `${runStatusLabel(run.status)} run at ${when}`,
515
- children: /* @__PURE__ */ jsx3(Icon, { name: kind === "failed" ? "triangle-exclamation" : "check", className: "size-3.5" })
741
+ children: /* @__PURE__ */ jsx4(Icon, { name: kind === "failed" ? "triangle-exclamation" : "check", className: "size-3.5" })
516
742
  }
517
743
  ) });
518
744
  }
519
745
 
520
746
  // src/atoms/schedules/ScheduleStatusBadge.tsx
521
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
747
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
522
748
  function ScheduleStatusBadge({ status }) {
523
749
  const active = status === "active";
524
- return /* @__PURE__ */ jsxs3(
750
+ return /* @__PURE__ */ jsxs4(
525
751
  "span",
526
752
  {
527
753
  className: cn(
@@ -529,7 +755,7 @@ function ScheduleStatusBadge({ status }) {
529
755
  active ? "border-emerald-600/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300" : "border-amber-600/30 bg-amber-500/10 text-amber-800 dark:border-amber-400/35 dark:bg-amber-500/15 dark:text-amber-300"
530
756
  ),
531
757
  children: [
532
- /* @__PURE__ */ jsx4(
758
+ /* @__PURE__ */ jsx5(
533
759
  "span",
534
760
  {
535
761
  className: cn(
@@ -546,7 +772,7 @@ function ScheduleStatusBadge({ status }) {
546
772
  }
547
773
 
548
774
  // src/atoms/schedules/TestScheduleScreen.tsx
549
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
775
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
550
776
  function mountConnector(connectors, name) {
551
777
  return connectors.find((connector) => connector.name === name || connector.id === name) ?? null;
552
778
  }
@@ -556,20 +782,20 @@ function ScheduleMcpConnect({
556
782
  }) {
557
783
  const catalog = useOptionalCatalogServer();
558
784
  if (catalog == null) return null;
559
- return /* @__PURE__ */ jsx5(ConnectorConnectButton, { connector, onConnected });
785
+ return /* @__PURE__ */ jsx6(ConnectorConnectButton, { connector, onConnected });
560
786
  }
561
787
  function DetailRow({ label, children }) {
562
- return /* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5 last:border-b-0", children: [
563
- /* @__PURE__ */ jsx5("span", { className: "text-text-secondary shrink-0 text-[10px] font-semibold tracking-wide uppercase", children: label }),
564
- /* @__PURE__ */ jsx5("div", { className: "min-w-0 text-right text-sm text-text-primary", children })
788
+ return /* @__PURE__ */ jsxs5("div", { className: "flex items-start justify-between gap-3 border-b border-border px-3 py-2.5 last:border-b-0", children: [
789
+ /* @__PURE__ */ jsx6("span", { className: "text-text-secondary shrink-0 text-[10px] font-semibold tracking-wide uppercase", children: label }),
790
+ /* @__PURE__ */ jsx6("div", { className: "min-w-0 text-right text-sm text-text-primary", children })
565
791
  ] });
566
792
  }
567
793
  function TestScheduleScreen({ schedule, agentName, mcpMounts, onEditConfiguration }) {
568
794
  const scheduleServer = useScheduleServer();
569
795
  const toaster = useToasterOptional();
570
796
  const { connectors, ensureLoaded, refreshConnectors, loading, error } = useDraftCatalog();
571
- const [running, setRunning] = useState(false);
572
- const [lastTestRun, setLastTestRun] = useState(null);
797
+ const [running, setRunning] = useState2(false);
798
+ const [lastTestRun, setLastTestRun] = useState2(null);
573
799
  const cadence = formatCadenceSummary({ cron: schedule.cron, timezone: schedule.timezone });
574
800
  const handleRunTest = async () => {
575
801
  setRunning(true);
@@ -583,35 +809,35 @@ function TestScheduleScreen({ schedule, agentName, mcpMounts, onEditConfiguratio
583
809
  setRunning(false);
584
810
  }
585
811
  };
586
- useEffect(() => {
812
+ useEffect2(() => {
587
813
  ensureLoaded();
588
814
  }, [ensureLoaded]);
589
- useEffect(() => {
815
+ useEffect2(() => {
590
816
  if (error != null) toaster?.showError(error);
591
817
  }, [error, toaster]);
592
- return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-4 px-5 py-4", children: [
593
- /* @__PURE__ */ jsxs4("section", { className: "overflow-hidden rounded-lg border border-border bg-card-bg", children: [
594
- /* @__PURE__ */ jsx5(DetailRow, { label: "Agent", children: agentName }),
595
- /* @__PURE__ */ jsx5(DetailRow, { label: "Name", children: schedule.name }),
596
- /* @__PURE__ */ jsx5(DetailRow, { label: "Status", children: /* @__PURE__ */ jsx5(ScheduleStatusBadge, { status: schedule.status }) }),
597
- /* @__PURE__ */ jsx5(DetailRow, { label: "Task", children: /* @__PURE__ */ jsx5("span", { className: "whitespace-pre-wrap break-words", children: schedule.task }) }),
598
- /* @__PURE__ */ jsx5(DetailRow, { label: "Frequency", children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-wrap items-center justify-end gap-1.5", children: [
599
- /* @__PURE__ */ jsx5("span", { children: cadence }),
600
- /* @__PURE__ */ jsx5("code", { className: "text-text-secondary font-mono text-xs", children: schedule.cron })
818
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-4 px-5 py-4", children: [
819
+ /* @__PURE__ */ jsxs5("section", { className: "overflow-hidden rounded-lg border border-border bg-card-bg", children: [
820
+ /* @__PURE__ */ jsx6(DetailRow, { label: "Agent", children: agentName }),
821
+ /* @__PURE__ */ jsx6(DetailRow, { label: "Name", children: schedule.name }),
822
+ /* @__PURE__ */ jsx6(DetailRow, { label: "Status", children: /* @__PURE__ */ jsx6(ScheduleStatusBadge, { status: schedule.status }) }),
823
+ /* @__PURE__ */ jsx6(DetailRow, { label: "Task", children: /* @__PURE__ */ jsx6("span", { className: "whitespace-pre-wrap break-words", children: schedule.task }) }),
824
+ /* @__PURE__ */ jsx6(DetailRow, { label: "Frequency", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center justify-end gap-1.5", children: [
825
+ /* @__PURE__ */ jsx6("span", { children: cadence }),
826
+ /* @__PURE__ */ jsx6("code", { className: "text-text-secondary font-mono text-xs", children: schedule.cron })
601
827
  ] }) }),
602
- /* @__PURE__ */ jsx5("div", { className: "flex justify-end px-3 py-2.5", children: /* @__PURE__ */ jsxs4(Button.Secondary, { type: "button", size: "small", onClick: onEditConfiguration, children: [
603
- /* @__PURE__ */ jsx5(Icon, { name: "pencil", className: "size-3.5" }),
828
+ /* @__PURE__ */ jsx6("div", { className: "flex justify-end px-3 py-2.5", children: /* @__PURE__ */ jsxs5(Button.Secondary, { type: "button", size: "small", onClick: onEditConfiguration, children: [
829
+ /* @__PURE__ */ jsx6(Icon, { name: "pencil", className: "size-3.5" }),
604
830
  "Edit Configuration"
605
831
  ] }) })
606
832
  ] }),
607
- /* @__PURE__ */ jsxs4("section", { className: "overflow-hidden rounded-lg border border-border bg-card-bg", children: [
608
- /* @__PURE__ */ jsx5("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ jsx5("h3", { className: "text-text-secondary text-[10px] font-semibold tracking-wide uppercase", children: "Tool Authorization" }) }),
609
- mcpMounts.length === 0 ? /* @__PURE__ */ jsx5("p", { className: "text-text-secondary px-3 py-3 text-sm", children: "No MCP connectors configured for this agent." }) : /* @__PURE__ */ jsx5("ul", { className: "divide-y divide-border", children: mcpMounts.map((mount) => {
833
+ /* @__PURE__ */ jsxs5("section", { className: "overflow-hidden rounded-lg border border-border bg-card-bg", children: [
834
+ /* @__PURE__ */ jsx6("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ jsx6("h3", { className: "text-text-secondary text-[10px] font-semibold tracking-wide uppercase", children: "Tool Authorization" }) }),
835
+ mcpMounts.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "text-text-secondary px-3 py-3 text-sm", children: "No MCP connectors configured for this agent." }) : /* @__PURE__ */ jsx6("ul", { className: "divide-y divide-border", children: mcpMounts.map((mount) => {
610
836
  const connector = mountConnector(connectors, mount.name);
611
837
  const authenticated = connector?.authenticated === true;
612
838
  const unavailable = connector == null && !loading;
613
- return /* @__PURE__ */ jsxs4("li", { className: "flex items-center gap-2 px-3 py-2.5", children: [
614
- /* @__PURE__ */ jsx5(
839
+ return /* @__PURE__ */ jsxs5("li", { className: "flex items-center gap-2 px-3 py-2.5", children: [
840
+ /* @__PURE__ */ jsx6(
615
841
  "span",
616
842
  {
617
843
  className: cn(
@@ -619,27 +845,27 @@ function TestScheduleScreen({ schedule, agentName, mcpMounts, onEditConfiguratio
619
845
  authenticated ? "border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300" : "border-border text-transparent"
620
846
  ),
621
847
  "aria-hidden": true,
622
- children: authenticated ? /* @__PURE__ */ jsx5(Icon, { name: "check", className: "size-3" }) : null
848
+ children: authenticated ? /* @__PURE__ */ jsx6(Icon, { name: "check", className: "size-3" }) : null
623
849
  }
624
850
  ),
625
- /* @__PURE__ */ jsx5("span", { className: "text-text-primary min-w-0 flex-1 truncate text-sm", children: mount.name }),
626
- authenticated ? /* @__PURE__ */ jsx5("span", { className: "text-success-bg text-xs font-medium", children: "Connected" }) : unavailable ? /* @__PURE__ */ jsx5("span", { className: "text-text-secondary text-xs", children: "Unavailable" }) : connector != null && connector.authenticated === false ? /* @__PURE__ */ jsx5(ScheduleMcpConnect, { connector, onConnected: refreshConnectors }) : loading ? /* @__PURE__ */ jsx5("span", { className: "text-text-secondary text-xs", children: "Loading\u2026" }) : null
851
+ /* @__PURE__ */ jsx6("span", { className: "text-text-primary min-w-0 flex-1 truncate text-sm", children: mount.name }),
852
+ authenticated ? /* @__PURE__ */ jsx6("span", { className: "text-success-bg text-xs font-medium", children: "Connected" }) : unavailable ? /* @__PURE__ */ jsx6("span", { className: "text-text-secondary text-xs", children: "Unavailable" }) : connector != null && connector.authenticated === false ? /* @__PURE__ */ jsx6(ScheduleMcpConnect, { connector, onConnected: refreshConnectors }) : loading ? /* @__PURE__ */ jsx6("span", { className: "text-text-secondary text-xs", children: "Loading\u2026" }) : null
627
853
  ] }, mount.name);
628
854
  }) })
629
855
  ] }),
630
- /* @__PURE__ */ jsxs4("section", { className: "overflow-hidden rounded-lg border border-border bg-card-bg", children: [
631
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [
632
- /* @__PURE__ */ jsx5("h3", { className: "text-text-secondary text-[10px] font-semibold tracking-wide uppercase", children: "Test Run" }),
633
- /* @__PURE__ */ jsxs4(Button.Primary, { type: "button", disabled: running, size: "small", onClick: () => void handleRunTest(), children: [
634
- /* @__PURE__ */ jsx5(Icon, { name: running ? "loader" : "play", className: cn("size-3.5", running && "animate-spin") }),
856
+ /* @__PURE__ */ jsxs5("section", { className: "overflow-hidden rounded-lg border border-border bg-card-bg", children: [
857
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [
858
+ /* @__PURE__ */ jsx6("h3", { className: "text-text-secondary text-[10px] font-semibold tracking-wide uppercase", children: "Test Run" }),
859
+ /* @__PURE__ */ jsxs5(Button.Primary, { type: "button", disabled: running, size: "small", onClick: () => void handleRunTest(), children: [
860
+ /* @__PURE__ */ jsx6(Icon, { name: running ? "loader" : "play", className: cn("size-3.5", running && "animate-spin") }),
635
861
  "Run Test"
636
862
  ] })
637
863
  ] }),
638
- lastTestRun == null ? /* @__PURE__ */ jsx5("p", { className: "text-text-secondary px-3 py-3 text-sm", children: "Run a one-off test using the schedule task. This does not change the cron pending run." }) : /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3 px-3 py-3", children: [
639
- /* @__PURE__ */ jsx5(ScheduleRunChip, { run: lastTestRun }),
640
- /* @__PURE__ */ jsxs4("div", { className: "min-w-0 text-sm", children: [
641
- /* @__PURE__ */ jsx5("p", { className: "text-text-primary font-medium", children: runTypeLabel(lastTestRun.name) }),
642
- /* @__PURE__ */ jsx5("p", { className: "text-text-secondary", children: formatRelativeTime(lastTestRun.triggeredAt ?? lastTestRun.scheduledFor) })
864
+ lastTestRun == null ? /* @__PURE__ */ jsx6("p", { className: "text-text-secondary px-3 py-3 text-sm", children: "Run a one-off test using the schedule task. This does not change the cron pending run." }) : /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3 px-3 py-3", children: [
865
+ /* @__PURE__ */ jsx6(ScheduleRunChip, { run: lastTestRun }),
866
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0 text-sm", children: [
867
+ /* @__PURE__ */ jsx6("p", { className: "text-text-primary font-medium", children: runTypeLabel(lastTestRun.name) }),
868
+ /* @__PURE__ */ jsx6("p", { className: "text-text-secondary", children: formatRelativeTime(lastTestRun.triggeredAt ?? lastTestRun.scheduledFor) })
643
869
  ] })
644
870
  ] })
645
871
  ] })
@@ -647,7 +873,7 @@ function TestScheduleScreen({ schedule, agentName, mcpMounts, onEditConfiguratio
647
873
  }
648
874
 
649
875
  // src/atoms/schedules/ScheduleFormDrawer.tsx
650
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
876
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
651
877
  function ScheduleFormDrawerBody({
652
878
  open,
653
879
  onOpenChange,
@@ -660,14 +886,15 @@ function ScheduleFormDrawerBody({
660
886
  const server = useServer();
661
887
  const shell = useOptionalShellMode();
662
888
  const toaster = useToasterOptional();
663
- const [form, setForm] = useState2(defaultScheduleFormValues);
664
- const [agentId, setAgentId] = useState2(initialAgentId);
665
- const [agents, setAgents] = useState2([]);
666
- const [agentsLoaded, setAgentsLoaded] = useState2(false);
667
- const [view, setView] = useState2({ kind: "form" });
668
- const [saving, setSaving] = useState2(false);
669
- const [activating, setActivating] = useState2(false);
670
- const [error, setError] = useState2(null);
889
+ const [form, setForm] = useState3(defaultScheduleFormValues);
890
+ const [agentId, setAgentId] = useState3(initialAgentId);
891
+ const [selectedAgent, setSelectedAgent] = useState3(null);
892
+ const [view, setView] = useState3({ kind: "form" });
893
+ const [saving, setSaving] = useState3(false);
894
+ const [activating, setActivating] = useState3(false);
895
+ const [error, setError] = useState3(null);
896
+ const agentIdRef = useRef2(agentId);
897
+ agentIdRef.current = agentId;
671
898
  const savedFromCreate = view.kind === "form" ? view.saved : view.schedule;
672
899
  const isExternalEdit = mode === "edit" && view.kind === "form" && view.saved == null && schedule != null;
673
900
  const isCreatedEdit = view.kind === "form" && view.saved != null;
@@ -676,23 +903,11 @@ function ScheduleFormDrawerBody({
676
903
  resourceType: "agent",
677
904
  resourceIds: agentId.length === 0 ? [] : [agentId]
678
905
  });
679
- useEffect2(() => {
680
- if (!open) return;
681
- let cancelled = false;
682
- setAgentsLoaded(false);
683
- void searchAllAgents(server).then((rows) => {
684
- if (cancelled) return;
685
- setAgents(rows);
686
- setAgentsLoaded(true);
687
- }).catch(() => void 0);
688
- return () => {
689
- cancelled = true;
690
- };
691
- }, [open, server]);
692
- useEffect2(() => {
906
+ useEffect3(() => {
693
907
  if (!open) {
694
908
  setForm(defaultScheduleFormValues());
695
909
  setAgentId(initialAgentId);
910
+ setSelectedAgent(null);
696
911
  setError(null);
697
912
  setView({ kind: "form" });
698
913
  setActivating(false);
@@ -708,22 +923,30 @@ function ScheduleFormDrawerBody({
708
923
  })
709
924
  );
710
925
  setAgentId(schedule.agentId);
926
+ setSelectedAgent(null);
711
927
  setView({ kind: "form" });
712
928
  return;
713
929
  }
714
930
  setForm(defaultScheduleFormValues());
715
931
  setAgentId(initialAgentId);
932
+ setSelectedAgent(null);
716
933
  setView({ kind: "form" });
717
934
  }, [open, mode, schedule, initialAgentId]);
718
- const agentOptions = useMemo(
719
- () => agents.map((agent) => ({ agentId: libraryAgentId(agent), name: agent.name })),
720
- [agents]
721
- );
722
- const selectedAgent = useMemo(
723
- () => agents.find((agent) => libraryAgentId(agent) === agentId) ?? null,
724
- [agents, agentId]
725
- );
726
- const agentLabel = selectedAgent?.name ?? savedFromCreate?.agentName ?? schedule?.agentName ?? agentOptions.find((option) => option.agentId === agentId)?.name ?? agentId;
935
+ useEffect3(() => {
936
+ if (!open || mode !== "create" || initialAgentId.length === 0) return;
937
+ let cancelled = false;
938
+ const requestedId = initialAgentId;
939
+ void findLibraryAgent({ server, agentKey: requestedId }).then((agent) => {
940
+ if (cancelled || agent == null) return;
941
+ if (agentIdRef.current !== requestedId) return;
942
+ setSelectedAgent(agent);
943
+ setAgentId(libraryAgentId(agent));
944
+ }).catch(() => void 0);
945
+ return () => {
946
+ cancelled = true;
947
+ };
948
+ }, [open, mode, initialAgentId, server]);
949
+ const agentLabel = selectedAgent?.name ?? savedFromCreate?.agentName ?? schedule?.agentName ?? (agentId.length > 0 ? agentId : "");
727
950
  const mcpMounts = useMemo(() => {
728
951
  const mounts = selectedAgent?.agentSpec?.mcpServers ?? [];
729
952
  return mounts.map(mountName).filter((name) => name != null).map((name) => ({ name }));
@@ -830,20 +1053,20 @@ function ScheduleFormDrawerBody({
830
1053
  const description = view.kind === "test" ? `Recurring unattended runs of ${agentLabel}.` : isExternalEdit || isCreatedEdit ? "Update cadence and task for this schedule." : "Create a recurring unattended run for an agent.";
831
1054
  let footer;
832
1055
  if (view.kind === "test") {
833
- footer = /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
834
- error != null ? /* @__PURE__ */ jsx6("p", { className: "text-failure-bg text-sm", children: error }) : null,
835
- /* @__PURE__ */ jsx6(Button.Secondary, { type: "button", className: "w-full", disabled: activating, onClick: () => void handleActivate(), children: "Activate Schedule" })
1056
+ footer = /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
1057
+ error != null ? /* @__PURE__ */ jsx7("p", { className: "text-failure-bg text-sm", children: error }) : null,
1058
+ /* @__PURE__ */ jsx7(Button.Secondary, { type: "button", className: "w-full", disabled: activating, onClick: () => void handleActivate(), children: "Activate Schedule" })
836
1059
  ] });
837
1060
  } else {
838
- footer = /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
839
- error != null ? /* @__PURE__ */ jsx6("p", { className: "text-failure-bg text-sm", children: error }) : null,
840
- /* @__PURE__ */ jsxs5("div", { className: "flex justify-end gap-2", children: [
841
- /* @__PURE__ */ jsx6(Button.Secondary, { type: "button", onClick: () => onOpenChange(false), disabled: saving, children: "Cancel" }),
842
- /* @__PURE__ */ jsx6(Button.Primary, { type: "submit", form: "schedule-form", disabled: !canSubmit || saving, children: "Save" })
1061
+ footer = /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-2", children: [
1062
+ error != null ? /* @__PURE__ */ jsx7("p", { className: "text-failure-bg text-sm", children: error }) : null,
1063
+ /* @__PURE__ */ jsxs6("div", { className: "flex justify-end gap-2", children: [
1064
+ /* @__PURE__ */ jsx7(Button.Secondary, { type: "button", onClick: () => onOpenChange(false), disabled: saving, children: "Cancel" }),
1065
+ /* @__PURE__ */ jsx7(Button.Primary, { type: "submit", form: "schedule-form", disabled: !canSubmit || saving, children: "Save" })
843
1066
  ] })
844
1067
  ] });
845
1068
  }
846
- return /* @__PURE__ */ jsx6(
1069
+ return /* @__PURE__ */ jsx7(
847
1070
  SideDrawer,
848
1071
  {
849
1072
  open,
@@ -852,7 +1075,7 @@ function ScheduleFormDrawerBody({
852
1075
  description,
853
1076
  anchor: "right",
854
1077
  size: "xl",
855
- headerIcon: /* @__PURE__ */ jsx6("span", { className: "text-primary-button-bg inline-flex size-8 items-center justify-center", children: /* @__PURE__ */ jsx6(
1078
+ headerIcon: /* @__PURE__ */ jsx7("span", { className: "text-primary-button-bg inline-flex size-8 items-center justify-center", children: /* @__PURE__ */ jsx7(
856
1079
  Icon,
857
1080
  {
858
1081
  name: view.kind === "test" || isExternalEdit || isCreatedEdit ? "calendar" : "calendar-plus",
@@ -860,7 +1083,7 @@ function ScheduleFormDrawerBody({
860
1083
  }
861
1084
  ) }),
862
1085
  footer,
863
- children: view.kind === "test" ? /* @__PURE__ */ jsx6(
1086
+ children: view.kind === "test" ? /* @__PURE__ */ jsx7(
864
1087
  TestScheduleScreen,
865
1088
  {
866
1089
  schedule: view.schedule,
@@ -871,15 +1094,18 @@ function ScheduleFormDrawerBody({
871
1094
  setView({ kind: "form", saved: view.schedule });
872
1095
  }
873
1096
  }
874
- ) : /* @__PURE__ */ jsx6("form", { id: "schedule-form", onSubmit: (event) => void handleSave(event), children: /* @__PURE__ */ jsx6(
1097
+ ) : /* @__PURE__ */ jsx7("form", { id: "schedule-form", onSubmit: (event) => void handleSave(event), children: /* @__PURE__ */ jsx7(
875
1098
  ScheduleFormFields,
876
1099
  {
877
1100
  values: form,
878
1101
  onChange: setForm,
879
1102
  agentId,
880
- onAgentIdChange: isExternalEdit || isCreatedEdit ? void 0 : setAgentId,
881
- agentOptions,
882
- agentOptionsLoaded: agentsLoaded,
1103
+ agentLabel,
1104
+ onAgentIdChange: isExternalEdit || isCreatedEdit ? void 0 : (nextId) => {
1105
+ setAgentId(nextId);
1106
+ if (nextId.length === 0) setSelectedAgent(null);
1107
+ },
1108
+ onAgentPicked: setSelectedAgent,
883
1109
  agentPickerDisabled: isExternalEdit || isCreatedEdit,
884
1110
  onBuildAgent: mode === "create" && shell?.isComposerEnabled === true ? () => {
885
1111
  onOpenChange(false);
@@ -891,21 +1117,21 @@ function ScheduleFormDrawerBody({
891
1117
  );
892
1118
  }
893
1119
  function ScheduleFormDrawer(props) {
894
- return /* @__PURE__ */ jsx6(DraftCatalogProvider, { children: /* @__PURE__ */ jsx6(ScheduleFormDrawerBody, { ...props }) });
1120
+ return /* @__PURE__ */ jsx7(DraftCatalogProvider, { children: /* @__PURE__ */ jsx7(ScheduleFormDrawerBody, { ...props }) });
895
1121
  }
896
1122
 
897
1123
  // src/atoms/schedules/ScheduleLastRunsCell.tsx
898
- import { jsx as jsx7 } from "react/jsx-runtime";
1124
+ import { jsx as jsx8 } from "react/jsx-runtime";
899
1125
  function ScheduleLastRunsCell({ runs }) {
900
1126
  const history = lastHistoricalRuns(runs);
901
1127
  if (history.length === 0) {
902
- return /* @__PURE__ */ jsx7("span", { className: "text-text-secondary text-sm", children: "\u2014" });
1128
+ return /* @__PURE__ */ jsx8("span", { className: "text-text-secondary text-sm", children: "\u2014" });
903
1129
  }
904
- return /* @__PURE__ */ jsx7("div", { className: "flex items-center gap-1", children: history.map((run) => /* @__PURE__ */ jsx7(ScheduleRunChip, { run }, run.id)) });
1130
+ return /* @__PURE__ */ jsx8("div", { className: "flex items-center gap-1", children: history.map((run) => /* @__PURE__ */ jsx8(ScheduleRunChip, { run }, run.id)) });
905
1131
  }
906
1132
 
907
1133
  // src/atoms/schedules/SchedulesPage.tsx
908
- import { Fragment, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1134
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
909
1135
  var STATUS_FILTER_OPTIONS = [
910
1136
  { value: "all", label: "All statuses" },
911
1137
  { value: "active", label: "Active" },
@@ -943,8 +1169,8 @@ function ScheduleRowActions({
943
1169
  onDelete
944
1170
  }) {
945
1171
  const PermissionGuard = useSlot("PermissionGuard");
946
- return /* @__PURE__ */ jsxs6("div", { className: "inline-flex items-center justify-end gap-1.5", children: [
947
- /* @__PURE__ */ jsx8(PermissionGuard, { allowed: canManage, children: /* @__PURE__ */ jsxs6(
1172
+ return /* @__PURE__ */ jsxs7("div", { className: "inline-flex items-center justify-end gap-1.5", children: [
1173
+ /* @__PURE__ */ jsx9(PermissionGuard, { allowed: canManage, children: /* @__PURE__ */ jsxs7(
948
1174
  Button.Secondary,
949
1175
  {
950
1176
  type: "button",
@@ -953,35 +1179,35 @@ function ScheduleRowActions({
953
1179
  size: "large",
954
1180
  onClick: onRunNow,
955
1181
  children: [
956
- /* @__PURE__ */ jsx8(Icon, { name: running ? "loader" : "play", className: cn("size-3.5", running && "animate-spin") }),
1182
+ /* @__PURE__ */ jsx9(Icon, { name: running ? "loader" : "play", className: cn("size-3.5", running && "animate-spin") }),
957
1183
  "Run now"
958
1184
  ]
959
1185
  }
960
1186
  ) }),
961
- /* @__PURE__ */ jsxs6(
1187
+ /* @__PURE__ */ jsxs7(
962
1188
  DropdownMenu,
963
1189
  {
964
1190
  align: "end",
965
- trigger: /* @__PURE__ */ jsx8(
1191
+ trigger: /* @__PURE__ */ jsx9(
966
1192
  "button",
967
1193
  {
968
1194
  type: "button",
969
1195
  className: auiButtonClass({ variant: "ghost", size: "icon" }),
970
1196
  "aria-label": `Actions for ${schedule.name}`,
971
- children: /* @__PURE__ */ jsx8(Icon, { name: "ellipsis" })
1197
+ children: /* @__PURE__ */ jsx9(Icon, { name: "ellipsis" })
972
1198
  }
973
1199
  ),
974
1200
  children: [
975
- /* @__PURE__ */ jsx8(PermissionGuard, { allowed: canManage, children: /* @__PURE__ */ jsxs6(DropdownMenuItem, { onClick: onEdit, children: [
976
- /* @__PURE__ */ jsx8(Icon, { name: "pencil", className: "size-3.5" }),
1201
+ /* @__PURE__ */ jsx9(PermissionGuard, { allowed: canManage, children: /* @__PURE__ */ jsxs7(DropdownMenuItem, { onClick: onEdit, children: [
1202
+ /* @__PURE__ */ jsx9(Icon, { name: "pencil", className: "size-3.5" }),
977
1203
  "Edit"
978
1204
  ] }) }),
979
- /* @__PURE__ */ jsx8(PermissionGuard, { allowed: canManage, children: /* @__PURE__ */ jsxs6(DropdownMenuItem, { onClick: onTogglePause, children: [
980
- /* @__PURE__ */ jsx8(Icon, { name: schedule.status === "active" ? "pause" : "play", className: "size-3.5" }),
1205
+ /* @__PURE__ */ jsx9(PermissionGuard, { allowed: canManage, children: /* @__PURE__ */ jsxs7(DropdownMenuItem, { onClick: onTogglePause, children: [
1206
+ /* @__PURE__ */ jsx9(Icon, { name: schedule.status === "active" ? "pause" : "play", className: "size-3.5" }),
981
1207
  schedule.status === "active" ? "Pause" : "Resume"
982
1208
  ] }) }),
983
- /* @__PURE__ */ jsx8(PermissionGuard, { allowed: canDelete, children: /* @__PURE__ */ jsxs6(DropdownMenuItem, { className: "text-failure-bg focus:text-failure-bg", onClick: onDelete, children: [
984
- /* @__PURE__ */ jsx8(Icon, { name: "trash", className: "size-3.5" }),
1209
+ /* @__PURE__ */ jsx9(PermissionGuard, { allowed: canDelete, children: /* @__PURE__ */ jsxs7(DropdownMenuItem, { className: "text-failure-bg focus:text-failure-bg", onClick: onDelete, children: [
1210
+ /* @__PURE__ */ jsx9(Icon, { name: "trash", className: "size-3.5" }),
985
1211
  "Delete"
986
1212
  ] }) })
987
1213
  ]
@@ -993,42 +1219,38 @@ function SchedulesPage({ agentId }) {
993
1219
  const scheduleServer = useScheduleServer();
994
1220
  const server = useServer();
995
1221
  const toaster = useToasterOptional();
996
- const [schedules, setSchedules] = useState3([]);
1222
+ const [schedules, setSchedules] = useState4([]);
997
1223
  const { allows } = useResourcePermissions({
998
1224
  resourceType: "schedule",
999
1225
  resourceIds: schedules.map((schedule) => schedule.id)
1000
1226
  });
1001
- const [runsByScheduleId, setRunsByScheduleId] = useState3({});
1002
- const [runsLoading, setRunsLoading] = useState3(false);
1003
- const [runningScheduleIds, setRunningScheduleIds] = useState3(() => /* @__PURE__ */ new Set());
1004
- const [agentOptions, setAgentOptions] = useState3([]);
1005
- const [loading, setLoading] = useState3(true);
1006
- const [error, setError] = useState3(null);
1007
- const [nameQuery, setNameQuery] = useState3(() => filtersFromSearch(window.location.search).nameQuery);
1008
- const [statusFilter, setStatusFilter] = useState3(
1227
+ const [runsByScheduleId, setRunsByScheduleId] = useState4({});
1228
+ const [runsLoading, setRunsLoading] = useState4(false);
1229
+ const [runningScheduleIds, setRunningScheduleIds] = useState4(() => /* @__PURE__ */ new Set());
1230
+ const [agentLabelById, setAgentLabelById] = useState4({});
1231
+ const [loading, setLoading] = useState4(true);
1232
+ const [error, setError] = useState4(null);
1233
+ const [nameQuery, setNameQuery] = useState4(() => filtersFromSearch(window.location.search).nameQuery);
1234
+ const [statusFilter, setStatusFilter] = useState4(
1009
1235
  () => filtersFromSearch(window.location.search).statusFilter
1010
1236
  );
1011
- const [agentFilter, setAgentFilter] = useState3(
1237
+ const [agentFilter, setAgentFilter] = useState4(
1012
1238
  () => agentId ?? filtersFromSearch(window.location.search).agentFilter
1013
1239
  );
1014
1240
  const permissionAgentId = agentId ?? (agentFilter === "all" ? null : agentFilter);
1015
- const permissionAgentIds = useMemo2(
1016
- () => permissionAgentId == null ? agentOptions.map((option) => option.agentId) : [permissionAgentId],
1017
- [agentOptions, permissionAgentId]
1018
- );
1019
1241
  const { allows: allowsAgent } = useResourcePermissions({
1020
1242
  resourceType: "agent",
1021
- resourceIds: permissionAgentIds
1243
+ resourceIds: permissionAgentId == null ? [] : [permissionAgentId]
1022
1244
  });
1023
- const canCreateSchedule = server.permissions == null || (permissionAgentId == null ? agentOptions.some((option) => allowsAgent(option.agentId, "USE")) : allowsAgent(permissionAgentId, "USE"));
1024
- const [drawer, setDrawer] = useState3(() => initialDrawerState(agentId));
1025
- const [pendingDelete, setPendingDelete] = useState3(null);
1026
- const [pageSize, setPageSize] = useState3(() => clampPageSize(DEFAULT_TABLE_PAGE_SIZE));
1027
- const [pageToken, setPageToken] = useState3(void 0);
1028
- const [nextPageToken, setNextPageToken] = useState3(void 0);
1029
- const [prevTokenStack, setPrevTokenStack] = useState3([]);
1030
- const loadGenRef = useRef(0);
1031
- const didConsumeIsNewRef = useRef(false);
1245
+ const canCreateSchedule = server.permissions == null || permissionAgentId == null || allowsAgent(permissionAgentId, "USE");
1246
+ const [drawer, setDrawer] = useState4(() => initialDrawerState(agentId));
1247
+ const [pendingDelete, setPendingDelete] = useState4(null);
1248
+ const [pageSize, setPageSize] = useState4(() => clampPageSize(DEFAULT_TABLE_PAGE_SIZE));
1249
+ const [pageToken, setPageToken] = useState4(void 0);
1250
+ const [nextPageToken, setNextPageToken] = useState4(void 0);
1251
+ const [prevTokenStack, setPrevTokenStack] = useState4([]);
1252
+ const loadGenRef = useRef3(0);
1253
+ const didConsumeIsNewRef = useRef3(false);
1032
1254
  const loadRunsForSchedules = useCallback(
1033
1255
  async ({ rows, gen }) => {
1034
1256
  if (rows.length === 0) {
@@ -1094,14 +1316,14 @@ function SchedulesPage({ agentId }) {
1094
1316
  },
1095
1317
  [agentFilter, loadSchedules, pageSize]
1096
1318
  );
1097
- useEffect3(() => {
1319
+ useEffect4(() => {
1098
1320
  replaceScheduleShareSearch({
1099
1321
  agent: agentId === void 0 && agentFilter !== "all" ? agentFilter : null,
1100
1322
  status: statusFilter === "all" ? null : statusFilter,
1101
1323
  q: nameQuery.trim().length === 0 ? null : nameQuery
1102
1324
  });
1103
1325
  }, [agentFilter, agentId, statusFilter, nameQuery]);
1104
- useEffect3(() => {
1326
+ useEffect4(() => {
1105
1327
  if (agentId === void 0) return;
1106
1328
  setAgentFilter((current) => {
1107
1329
  if (current === agentId) return current;
@@ -1110,14 +1332,14 @@ function SchedulesPage({ agentId }) {
1110
1332
  return agentId;
1111
1333
  });
1112
1334
  }, [agentId]);
1113
- useEffect3(() => {
1335
+ useEffect4(() => {
1114
1336
  if (didConsumeIsNewRef.current) return;
1115
1337
  const share = readScheduleShareSearch(window.location.search);
1116
1338
  if (!share.isNew) return;
1117
1339
  didConsumeIsNewRef.current = true;
1118
1340
  replaceScheduleShareSearch({ isNew: null });
1119
1341
  }, []);
1120
- useEffect3(() => {
1342
+ useEffect4(() => {
1121
1343
  const syncFromUrl = () => {
1122
1344
  const next = filtersFromSearch(window.location.search);
1123
1345
  setNameQuery(next.nameQuery);
@@ -1135,26 +1357,9 @@ function SchedulesPage({ agentId }) {
1135
1357
  window.removeEventListener("popstate", syncFromUrl);
1136
1358
  };
1137
1359
  }, [agentId]);
1138
- useEffect3(() => {
1360
+ useEffect4(() => {
1139
1361
  void loadSchedules({ token: pageToken, size: pageSize, agentId: agentFilter });
1140
1362
  }, [agentFilter, pageSize, pageToken, loadSchedules]);
1141
- useEffect3(() => {
1142
- let cancelled = false;
1143
- void searchAllAgents(server).then((rows) => {
1144
- if (cancelled) return;
1145
- setAgentOptions(rows.map((agent) => ({ agentId: libraryAgentId(agent), name: agent.name })));
1146
- }).catch(() => void 0);
1147
- return () => {
1148
- cancelled = true;
1149
- };
1150
- }, [server]);
1151
- const agentNameById = useMemo2(() => {
1152
- const map = /* @__PURE__ */ new Map();
1153
- for (const agent of agentOptions) {
1154
- map.set(agent.agentId, agent.name);
1155
- }
1156
- return map;
1157
- }, [agentOptions]);
1158
1363
  const filtered = useMemo2(() => {
1159
1364
  const q = nameQuery.trim().toLowerCase();
1160
1365
  return schedules.filter((schedule) => {
@@ -1215,14 +1420,14 @@ function SchedulesPage({ agentId }) {
1215
1420
  setPrevTokenStack(stack);
1216
1421
  setPageToken(prev === "" ? void 0 : prev);
1217
1422
  };
1218
- return /* @__PURE__ */ jsxs6("div", { className: "flex h-full min-h-0 flex-col bg-primary-bg", children: [
1219
- /* @__PURE__ */ jsx8(
1423
+ return /* @__PURE__ */ jsxs7("div", { className: "flex h-full min-h-0 flex-col bg-primary-bg", children: [
1424
+ /* @__PURE__ */ jsx9(
1220
1425
  PageHeader,
1221
1426
  {
1222
1427
  title: agentId === void 0 ? "Scheduled Agents" : void 0,
1223
- end: /* @__PURE__ */ jsxs6(Fragment, { children: [
1224
- /* @__PURE__ */ jsx8("div", { className: "w-full sm:w-56", children: /* @__PURE__ */ jsx8(SearchInput_default, { query: nameQuery, setQuery: setNameQuery, placeholder: "Search schedules by name" }) }),
1225
- /* @__PURE__ */ jsx8(
1428
+ end: /* @__PURE__ */ jsxs7(Fragment2, { children: [
1429
+ /* @__PURE__ */ jsx9("div", { className: "w-full sm:w-60", children: /* @__PURE__ */ jsx9(SearchInput_default, { query: nameQuery, setQuery: setNameQuery, placeholder: "Search schedules by name" }) }),
1430
+ /* @__PURE__ */ jsx9(
1226
1431
  PopoverSelect,
1227
1432
  {
1228
1433
  value: statusFilter,
@@ -1232,24 +1437,29 @@ function SchedulesPage({ agentId }) {
1232
1437
  "aria-label": "Filter by status"
1233
1438
  }
1234
1439
  ),
1235
- agentId === void 0 ? /* @__PURE__ */ jsx8(
1236
- PopoverSelect,
1440
+ agentId === void 0 ? /* @__PURE__ */ jsx9(
1441
+ AgentSearchPicker,
1237
1442
  {
1238
1443
  value: agentFilter,
1444
+ selectedLabel: agentFilter === "all" ? "All agents" : agentLabelById[agentFilter] ?? agentFilter,
1239
1445
  onValueChange: (value) => {
1240
1446
  setAgentFilter(value);
1241
1447
  setPageToken(void 0);
1242
1448
  setPrevTokenStack([]);
1243
1449
  },
1244
- options: [
1245
- { value: "all", label: "All agents" },
1246
- ...agentOptions.map((agent) => ({ value: agent.agentId, label: agent.name }))
1247
- ],
1248
- className: "sm:w-40",
1249
- "aria-label": "Filter by agent"
1450
+ onAgentPicked: (agent) => {
1451
+ setAgentLabelById((current) => ({
1452
+ ...current,
1453
+ [libraryAgentId(agent)]: agent.name
1454
+ }));
1455
+ },
1456
+ allOption: { value: "all", label: "All agents" },
1457
+ className: "sm:w-48",
1458
+ "aria-label": "Filter by agent",
1459
+ placeholder: "Search agent"
1250
1460
  }
1251
1461
  ) : null,
1252
- /* @__PURE__ */ jsxs6(
1462
+ /* @__PURE__ */ jsxs7(
1253
1463
  Button.Primary,
1254
1464
  {
1255
1465
  type: "button",
@@ -1259,7 +1469,7 @@ function SchedulesPage({ agentId }) {
1259
1469
  agentId: agentFilter !== "all" ? agentFilter : void 0
1260
1470
  }),
1261
1471
  children: [
1262
- /* @__PURE__ */ jsx8(Icon, { name: "plus", className: "size-3.5" }),
1472
+ /* @__PURE__ */ jsx9(Icon, { name: "plus", className: "size-3.5" }),
1263
1473
  "Create Schedule"
1264
1474
  ]
1265
1475
  }
@@ -1267,9 +1477,9 @@ function SchedulesPage({ agentId }) {
1267
1477
  ] })
1268
1478
  }
1269
1479
  ),
1270
- /* @__PURE__ */ jsx8("div", { className: "min-h-0 flex-1 overflow-auto px-4 py-4", children: loading ? /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-2", role: "status", "aria-label": "Loading schedules", children: Array.from({ length: 5 }, (_, i) => /* @__PURE__ */ jsx8(Skeleton, { className: "h-12 w-full rounded-md" }, i)) }) : error != null ? /* @__PURE__ */ jsx8("p", { className: "text-failure-bg px-3 py-8 text-center text-sm", children: error }) : schedules.length === 0 ? /* @__PURE__ */ jsx8(EmptyScreen, { title: "No Schedules Found", description: "Create one to get started.", className: "min-h-full" }) : filtered.length === 0 ? /* @__PURE__ */ jsxs6("div", { className: "flex min-h-full flex-col", children: [
1271
- /* @__PURE__ */ jsx8(EmptyScreen, { title: "No Schedules Found", description: "No schedules match your filters.", className: "flex-1" }),
1272
- hasPageNav ? /* @__PURE__ */ jsx8(
1480
+ /* @__PURE__ */ jsx9("div", { className: "min-h-0 flex-1 overflow-auto px-4 py-4", children: loading ? /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-2", role: "status", "aria-label": "Loading schedules", children: Array.from({ length: 5 }, (_, i) => /* @__PURE__ */ jsx9(Skeleton, { className: "h-12 w-full rounded-md" }, i)) }) : error != null ? /* @__PURE__ */ jsx9("p", { className: "text-failure-bg px-3 py-8 text-center text-sm", children: error }) : schedules.length === 0 ? /* @__PURE__ */ jsx9(EmptyScreen, { title: "No Schedules Found", description: "Create one to get started.", className: "min-h-full" }) : filtered.length === 0 ? /* @__PURE__ */ jsxs7("div", { className: "flex min-h-full flex-col", children: [
1481
+ /* @__PURE__ */ jsx9(EmptyScreen, { title: "No Schedules Found", description: "No schedules match your filters.", className: "flex-1" }),
1482
+ hasPageNav ? /* @__PURE__ */ jsx9(
1273
1483
  TableTokenPagination,
1274
1484
  {
1275
1485
  pageSize,
@@ -1287,28 +1497,28 @@ function SchedulesPage({ agentId }) {
1287
1497
  }
1288
1498
  }
1289
1499
  ) : null
1290
- ] }) : /* @__PURE__ */ jsxs6("div", { className: "overflow-hidden rounded-lg border border-border", children: [
1291
- /* @__PURE__ */ jsxs6(Table, { className: "min-w-[48rem]", children: [
1292
- /* @__PURE__ */ jsx8(TableHeader, { children: /* @__PURE__ */ jsxs6(TableRow, { className: "hover:bg-transparent", children: [
1293
- /* @__PURE__ */ jsx8(TableHead, { children: "Name" }),
1294
- /* @__PURE__ */ jsx8(TableHead, { children: "Agent" }),
1295
- showCreatedByColumn ? /* @__PURE__ */ jsx8(TableHead, { children: "Created by" }) : null,
1296
- /* @__PURE__ */ jsx8(TableHead, { children: "Frequency" }),
1297
- /* @__PURE__ */ jsx8(TableHead, { children: "Status" }),
1298
- /* @__PURE__ */ jsx8(TableHead, { children: "Last 5 runs" }),
1299
- /* @__PURE__ */ jsx8(TableHead, { children: /* @__PURE__ */ jsx8("span", { className: "sr-only", children: "Actions" }) })
1500
+ ] }) : /* @__PURE__ */ jsxs7("div", { className: "overflow-hidden rounded-lg border border-border", children: [
1501
+ /* @__PURE__ */ jsxs7(Table, { className: "min-w-[48rem]", children: [
1502
+ /* @__PURE__ */ jsx9(TableHeader, { children: /* @__PURE__ */ jsxs7(TableRow, { className: "hover:bg-transparent", children: [
1503
+ /* @__PURE__ */ jsx9(TableHead, { children: "Name" }),
1504
+ /* @__PURE__ */ jsx9(TableHead, { children: "Agent" }),
1505
+ showCreatedByColumn ? /* @__PURE__ */ jsx9(TableHead, { children: "Created by" }) : null,
1506
+ /* @__PURE__ */ jsx9(TableHead, { children: "Frequency" }),
1507
+ /* @__PURE__ */ jsx9(TableHead, { children: "Status" }),
1508
+ /* @__PURE__ */ jsx9(TableHead, { children: "Last 5 runs" }),
1509
+ /* @__PURE__ */ jsx9(TableHead, { children: /* @__PURE__ */ jsx9("span", { className: "sr-only", children: "Actions" }) })
1300
1510
  ] }) }),
1301
- /* @__PURE__ */ jsx8(TableBody, { children: filtered.map((schedule) => {
1511
+ /* @__PURE__ */ jsx9(TableBody, { children: filtered.map((schedule) => {
1302
1512
  const cadence = formatCadenceSummary({ cron: schedule.cron, timezone: schedule.timezone });
1303
- const agentLabel = schedule.agentName ?? agentNameById.get(schedule.agentId) ?? schedule.agentId;
1304
- return /* @__PURE__ */ jsxs6(TableRow, { children: [
1305
- /* @__PURE__ */ jsx8(TableCell, { className: "text-text-primary font-medium", children: /* @__PURE__ */ jsx8("span", { className: "text-left !no-underline", children: schedule.name }) }),
1306
- /* @__PURE__ */ jsx8(TableCell, { children: agentLabel }),
1307
- showCreatedByColumn ? /* @__PURE__ */ jsx8(TableCell, { children: /* @__PURE__ */ jsx8(CreatedByCell, { subject: schedule.createdBySubject }) }) : null,
1308
- /* @__PURE__ */ jsx8(TableCell, { children: cadence }),
1309
- /* @__PURE__ */ jsx8(TableCell, { children: /* @__PURE__ */ jsx8(ScheduleStatusBadge, { status: schedule.status }) }),
1310
- /* @__PURE__ */ jsx8(TableCell, { children: runsLoading ? /* @__PURE__ */ jsx8("span", { className: "text-text-secondary text-sm", children: "\u2026" }) : /* @__PURE__ */ jsx8(ScheduleLastRunsCell, { runs: runsByScheduleId[schedule.id] ?? [] }) }),
1311
- /* @__PURE__ */ jsx8(TableCell, { className: "text-right", children: /* @__PURE__ */ jsx8(
1513
+ const agentLabel = schedule.agentName ?? agentLabelById[schedule.agentId] ?? schedule.agentId;
1514
+ return /* @__PURE__ */ jsxs7(TableRow, { children: [
1515
+ /* @__PURE__ */ jsx9(TableCell, { className: "text-text-primary font-medium", children: /* @__PURE__ */ jsx9("span", { className: "text-left !no-underline", children: schedule.name }) }),
1516
+ /* @__PURE__ */ jsx9(TableCell, { children: agentLabel }),
1517
+ showCreatedByColumn ? /* @__PURE__ */ jsx9(TableCell, { children: /* @__PURE__ */ jsx9(CreatedByCell, { subject: schedule.createdBySubject }) }) : null,
1518
+ /* @__PURE__ */ jsx9(TableCell, { children: cadence }),
1519
+ /* @__PURE__ */ jsx9(TableCell, { children: /* @__PURE__ */ jsx9(ScheduleStatusBadge, { status: schedule.status }) }),
1520
+ /* @__PURE__ */ jsx9(TableCell, { children: runsLoading ? /* @__PURE__ */ jsx9("span", { className: "text-text-secondary text-sm", children: "\u2026" }) : /* @__PURE__ */ jsx9(ScheduleLastRunsCell, { runs: runsByScheduleId[schedule.id] ?? [] }) }),
1521
+ /* @__PURE__ */ jsx9(TableCell, { className: "text-right", children: /* @__PURE__ */ jsx9(
1312
1522
  ScheduleRowActions,
1313
1523
  {
1314
1524
  schedule,
@@ -1328,7 +1538,7 @@ function SchedulesPage({ agentId }) {
1328
1538
  ] }, schedule.id);
1329
1539
  }) })
1330
1540
  ] }),
1331
- (filtered.length > 0 || hasPageNav) && /* @__PURE__ */ jsx8(
1541
+ (filtered.length > 0 || hasPageNav) && /* @__PURE__ */ jsx9(
1332
1542
  TableTokenPagination,
1333
1543
  {
1334
1544
  pageSize,
@@ -1347,7 +1557,7 @@ function SchedulesPage({ agentId }) {
1347
1557
  }
1348
1558
  )
1349
1559
  ] }) }),
1350
- drawer.kind === "create" ? /* @__PURE__ */ jsx8(
1560
+ drawer.kind === "create" ? /* @__PURE__ */ jsx9(
1351
1561
  ScheduleFormDrawer,
1352
1562
  {
1353
1563
  open: true,
@@ -1359,7 +1569,7 @@ function SchedulesPage({ agentId }) {
1359
1569
  onSaved: () => resetToFirstPage()
1360
1570
  }
1361
1571
  ) : null,
1362
- drawer.kind === "edit" ? /* @__PURE__ */ jsx8(
1572
+ drawer.kind === "edit" ? /* @__PURE__ */ jsx9(
1363
1573
  ScheduleFormDrawer,
1364
1574
  {
1365
1575
  open: true,
@@ -1371,7 +1581,7 @@ function SchedulesPage({ agentId }) {
1371
1581
  onSaved: () => void loadSchedules({ token: pageToken, size: pageSize, agentId: agentFilter })
1372
1582
  }
1373
1583
  ) : null,
1374
- pendingDelete != null ? /* @__PURE__ */ jsxs6(
1584
+ pendingDelete != null ? /* @__PURE__ */ jsxs7(
1375
1585
  Dialog,
1376
1586
  {
1377
1587
  open: true,
@@ -1381,17 +1591,17 @@ function SchedulesPage({ agentId }) {
1381
1591
  "aria-label": "Delete schedule",
1382
1592
  className: "max-w-md",
1383
1593
  children: [
1384
- /* @__PURE__ */ jsx8(DialogContent, { children: /* @__PURE__ */ jsxs6(DialogHeader, { children: [
1385
- /* @__PURE__ */ jsx8(DialogTitle, { children: "Delete schedule" }),
1386
- /* @__PURE__ */ jsxs6("p", { className: "text-text-secondary text-sm", children: [
1594
+ /* @__PURE__ */ jsx9(DialogContent, { children: /* @__PURE__ */ jsxs7(DialogHeader, { children: [
1595
+ /* @__PURE__ */ jsx9(DialogTitle, { children: "Delete schedule" }),
1596
+ /* @__PURE__ */ jsxs7("p", { className: "text-text-secondary text-sm", children: [
1387
1597
  "\u201C",
1388
1598
  pendingDelete.name,
1389
1599
  "\u201D will stop running. This cannot be undone."
1390
1600
  ] })
1391
1601
  ] }) }),
1392
- /* @__PURE__ */ jsxs6(DialogFooter, { children: [
1393
- /* @__PURE__ */ jsx8(Button.Secondary, { type: "button", onClick: () => setPendingDelete(null), children: "Cancel" }),
1394
- /* @__PURE__ */ jsx8(
1602
+ /* @__PURE__ */ jsxs7(DialogFooter, { children: [
1603
+ /* @__PURE__ */ jsx9(Button.Secondary, { type: "button", onClick: () => setPendingDelete(null), children: "Cancel" }),
1604
+ /* @__PURE__ */ jsx9(
1395
1605
  Button.Destructive,
1396
1606
  {
1397
1607
  type: "button",
@@ -1416,4 +1626,4 @@ export {
1416
1626
  ScheduleLastRunsCell,
1417
1627
  SchedulesPage
1418
1628
  };
1419
- //# sourceMappingURL=chunk-DCVKW445.js.map
1629
+ //# sourceMappingURL=chunk-TMIILLHB.js.map