@burdenoff/microfe-labsofscience 2026.829.1 → 2026.1029.1

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.
@@ -3,56 +3,57 @@ import { useAiModelCatalog as t, useExperimentAiContext as n, useExperiments as
3
3
  import { titleCase as c } from "../../utils/formatters.js";
4
4
  import { JsonBlock as l } from "../shared/DetailComponents.js";
5
5
  import { AiErrorNotice as u } from "./AiErrorNotice.js";
6
- import { describeDecision as d, experimentIdOfRun as f, formatConfidence as p, readLastAiRecommendation as m } from "./aiReaders.js";
7
- import { useMemo as h, useState as g } from "react";
8
- import { ArrowRight as _, FileText as v, Sparkles as y } from "lucide-react";
9
- import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
10
- import { Button as C, Label as w, ResponsiveDialog as T, ResponsiveDialogContent as E, ResponsiveDialogDescription as D, ResponsiveDialogFooter as O, ResponsiveDialogHeader as k, ResponsiveDialogTitle as A, Select as j, SelectContent as M, SelectItem as N, SelectTrigger as P, SelectValue as F, Textarea as I } from "@burdenoff/fe-libs/ui";
6
+ import { AiTermsGate as d } from "./AiTermsGate.js";
7
+ import { describeDecision as f, experimentIdOfRun as p, formatConfidence as m, readLastAiRecommendation as h } from "./aiReaders.js";
8
+ import { useMemo as g, useState as _ } from "react";
9
+ import { ArrowRight as v, FileText as y, Sparkles as b } from "lucide-react";
10
+ import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
11
+ import { Button as w, Label as T, ResponsiveDialog as E, ResponsiveDialogContent as D, ResponsiveDialogDescription as O, ResponsiveDialogFooter as k, ResponsiveDialogHeader as A, ResponsiveDialogTitle as j, Select as M, SelectContent as N, SelectItem as P, SelectTrigger as F, SelectValue as I, Textarea as L } from "@burdenoff/fe-libs/ui";
11
12
  //#region src/labsofscience/pages/ai/AiDialogs.tsx
12
- var L = "WORKSPACE_DEFAULT", R = 100, z = [
13
+ var R = "WORKSPACE_DEFAULT", z = 100, B = [
13
14
  "REPLICATE",
14
15
  "ADJUST_PARAMETERS",
15
16
  "ESCALATE_REVIEW",
16
17
  "CONCLUDE"
17
18
  ];
18
- function B({ id: e, value: n, onChange: r }) {
19
- let i = t(), a = h(() => [...new Set((i.data ?? []).map((e) => e.provider))], [i.data]);
20
- return /* @__PURE__ */ S("div", {
19
+ function V({ id: e, value: n, onChange: r }) {
20
+ let i = t(), a = g(() => [...new Set((i.data ?? []).map((e) => e.provider))], [i.data]);
21
+ return /* @__PURE__ */ C("div", {
21
22
  className: "space-y-1.5",
22
23
  children: [
23
- /* @__PURE__ */ x(w, {
24
+ /* @__PURE__ */ S(T, {
24
25
  htmlFor: e,
25
26
  children: "Provider (optional)"
26
27
  }),
27
- /* @__PURE__ */ S(j, {
28
+ /* @__PURE__ */ C(M, {
28
29
  value: n,
29
30
  onValueChange: r,
30
- children: [/* @__PURE__ */ x(P, {
31
+ children: [/* @__PURE__ */ S(F, {
31
32
  id: e,
32
- children: /* @__PURE__ */ x(F, {})
33
- }), /* @__PURE__ */ S(M, { children: [/* @__PURE__ */ x(N, {
34
- value: L,
33
+ children: /* @__PURE__ */ S(I, {})
34
+ }), /* @__PURE__ */ C(N, { children: [/* @__PURE__ */ S(P, {
35
+ value: R,
35
36
  children: "Workspace default"
36
- }), a.map((e) => /* @__PURE__ */ x(N, {
37
+ }), a.map((e) => /* @__PURE__ */ S(P, {
37
38
  value: e,
38
39
  children: c(e)
39
40
  }, e))] })]
40
41
  }),
41
- /* @__PURE__ */ x("p", {
42
+ /* @__PURE__ */ S("p", {
42
43
  className: "text-xs text-text-tertiary",
43
44
  children: "A named provider is tried first. If it has no key configured or refuses the call, the remaining catalog providers are still tried before the attempt is recorded as failed."
44
45
  })
45
46
  ]
46
47
  });
47
48
  }
48
- function V({ onClose: t, onViewProtocol: n }) {
49
+ function H({ onClose: t, onViewProtocol: n }) {
49
50
  let i = s(), o = a({ pagination: {
50
- limit: R,
51
+ limit: z,
51
52
  offset: 0
52
53
  } }), c = r({ pagination: {
53
- limit: R,
54
+ limit: z,
54
55
  offset: 0
55
- } }), [l, d] = g("project"), [f, p] = g(""), [m, h] = g(""), [_, T] = g(""), [E, z] = g(L), [V, H] = g(null), [U, W] = g(null), G = l === "project" ? (o.data?.items ?? []).map((e) => ({
56
+ } }), [l, d] = _("project"), [f, p] = _(""), [m, h] = _(""), [g, v] = _(""), [E, D] = _(R), [B, H] = _(null), [U, W] = _(null), G = l === "project" ? (o.data?.items ?? []).map((e) => ({
56
57
  id: e.id,
57
58
  label: e.name
58
59
  })) : (c.data?.items ?? []).map((e) => ({
@@ -73,27 +74,27 @@ function V({ onClose: t, onViewProtocol: n }) {
73
74
  projectId: l === "project" ? f : void 0,
74
75
  experimentId: l === "experiment" ? f : void 0,
75
76
  objective: m.trim(),
76
- constraints: _.trim() || void 0,
77
- requestedProvider: E === L ? void 0 : E
77
+ constraints: g.trim() || void 0,
78
+ requestedProvider: E === R ? void 0 : E
78
79
  });
79
80
  W(e);
80
81
  } catch {}
81
82
  };
82
- return /* @__PURE__ */ S(b, { children: [
83
- /* @__PURE__ */ S(k, { children: [/* @__PURE__ */ x(A, { children: "Suggest a protocol" }), /* @__PURE__ */ x(D, { children: "The AI designs a reusable method and saves it as a draft protocol with ordered steps. You review and publish it — nothing is published for you." })] }),
84
- U ? /* @__PURE__ */ S("div", {
83
+ return /* @__PURE__ */ C(x, { children: [
84
+ /* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: "Suggest a protocol" }), /* @__PURE__ */ S(O, { children: "The AI designs a reusable method and saves it as a draft protocol with ordered steps. You review and publish it — nothing is published for you." })] }),
85
+ U ? /* @__PURE__ */ C("div", {
85
86
  className: "space-y-4 py-2",
86
87
  children: [
87
- /* @__PURE__ */ S("div", {
88
+ /* @__PURE__ */ C("div", {
88
89
  className: "rounded-lg border border-border-seam bg-bg-sunken p-4",
89
- children: [/* @__PURE__ */ S("div", {
90
+ children: [/* @__PURE__ */ C("div", {
90
91
  className: "flex items-start justify-between gap-3",
91
- children: [/* @__PURE__ */ S("div", {
92
+ children: [/* @__PURE__ */ C("div", {
92
93
  className: "min-w-0",
93
- children: [/* @__PURE__ */ x("p", {
94
+ children: [/* @__PURE__ */ S("p", {
94
95
  className: "truncate font-medium text-text-primary",
95
96
  children: U.protocol.name
96
- }), /* @__PURE__ */ S("p", {
97
+ }), /* @__PURE__ */ C("p", {
97
98
  className: "mt-0.5 text-xs text-text-tertiary",
98
99
  children: [
99
100
  "v",
@@ -104,29 +105,29 @@ function V({ onClose: t, onViewProtocol: n }) {
104
105
  U.stepCount === 1 ? "" : "s"
105
106
  ]
106
107
  })]
107
- }), /* @__PURE__ */ x(e, { status: U.protocol.status })]
108
- }), U.protocol.summary && /* @__PURE__ */ x("p", {
108
+ }), /* @__PURE__ */ S(e, { status: U.protocol.status })]
109
+ }), U.protocol.summary && /* @__PURE__ */ S("p", {
109
110
  className: "mt-2 text-sm text-text-secondary",
110
111
  children: U.protocol.summary
111
112
  })]
112
113
  }),
113
- /* @__PURE__ */ S("p", {
114
+ /* @__PURE__ */ C("p", {
114
115
  className: "text-sm text-text-secondary",
115
116
  children: [
116
117
  "This landed as a ",
117
- /* @__PURE__ */ x("strong", {
118
+ /* @__PURE__ */ S("strong", {
118
119
  className: "text-text-primary",
119
120
  children: "draft"
120
121
  }),
121
122
  ". It is not published, nothing at the bench has changed, and no experiment is using it. Open the draft to check the steps and safety notes, then publish it when you are satisfied."
122
123
  ]
123
124
  }),
124
- /* @__PURE__ */ S("p", {
125
+ /* @__PURE__ */ C("p", {
125
126
  className: "text-xs text-text-tertiary",
126
127
  children: [
127
128
  "Recorded in the decision feed as",
128
129
  " ",
129
- /* @__PURE__ */ x("span", {
130
+ /* @__PURE__ */ S("span", {
130
131
  className: "break-all font-mono",
131
132
  children: U.agentRunId
132
133
  }),
@@ -134,50 +135,50 @@ function V({ onClose: t, onViewProtocol: n }) {
134
135
  ]
135
136
  })
136
137
  ]
137
- }) : /* @__PURE__ */ S("div", {
138
+ }) : /* @__PURE__ */ C("div", {
138
139
  className: "space-y-4 py-2",
139
140
  children: [
140
- /* @__PURE__ */ S("div", {
141
+ /* @__PURE__ */ C("div", {
141
142
  className: "space-y-1.5",
142
- children: [/* @__PURE__ */ x(w, {
143
+ children: [/* @__PURE__ */ S(T, {
143
144
  htmlFor: "suggest-target-kind",
144
145
  children: "Design it for"
145
- }), /* @__PURE__ */ S(j, {
146
+ }), /* @__PURE__ */ C(M, {
146
147
  value: l,
147
148
  onValueChange: (e) => {
148
149
  d(e), p("");
149
150
  },
150
- children: [/* @__PURE__ */ x(P, {
151
+ children: [/* @__PURE__ */ S(F, {
151
152
  id: "suggest-target-kind",
152
- children: /* @__PURE__ */ x(F, {})
153
- }), /* @__PURE__ */ S(M, { children: [/* @__PURE__ */ x(N, {
153
+ children: /* @__PURE__ */ S(I, {})
154
+ }), /* @__PURE__ */ C(N, { children: [/* @__PURE__ */ S(P, {
154
155
  value: "project",
155
156
  children: "A project"
156
- }), /* @__PURE__ */ x(N, {
157
+ }), /* @__PURE__ */ S(P, {
157
158
  value: "experiment",
158
159
  children: "An experiment"
159
160
  })] })]
160
161
  })]
161
162
  }),
162
- /* @__PURE__ */ S("div", {
163
+ /* @__PURE__ */ C("div", {
163
164
  className: "space-y-1.5",
164
165
  children: [
165
- /* @__PURE__ */ x(w, {
166
+ /* @__PURE__ */ S(T, {
166
167
  htmlFor: "suggest-target",
167
168
  children: l === "project" ? "Project" : "Experiment"
168
169
  }),
169
- /* @__PURE__ */ S(j, {
170
+ /* @__PURE__ */ C(M, {
170
171
  value: f,
171
172
  onValueChange: p,
172
- children: [/* @__PURE__ */ x(P, {
173
+ children: [/* @__PURE__ */ S(F, {
173
174
  id: "suggest-target",
174
- children: /* @__PURE__ */ x(F, { placeholder: l === "project" ? "Select a project" : "Select an experiment" })
175
- }), /* @__PURE__ */ x(M, { children: G.map((e) => /* @__PURE__ */ x(N, {
175
+ children: /* @__PURE__ */ S(I, { placeholder: l === "project" ? "Select a project" : "Select an experiment" })
176
+ }), /* @__PURE__ */ S(N, { children: G.map((e) => /* @__PURE__ */ S(P, {
176
177
  value: e.id,
177
178
  children: e.label
178
179
  }, e.id)) })]
179
180
  }),
180
- G.length === 0 && /* @__PURE__ */ S("p", {
181
+ G.length === 0 && /* @__PURE__ */ C("p", {
181
182
  className: "text-xs text-text-tertiary",
182
183
  children: [
183
184
  "No ",
@@ -187,12 +188,12 @@ function V({ onClose: t, onViewProtocol: n }) {
187
188
  })
188
189
  ]
189
190
  }),
190
- /* @__PURE__ */ S("div", {
191
+ /* @__PURE__ */ C("div", {
191
192
  className: "space-y-1.5",
192
- children: [/* @__PURE__ */ x(w, {
193
+ children: [/* @__PURE__ */ S(T, {
193
194
  htmlFor: "suggest-objective",
194
195
  children: "Objective"
195
- }), /* @__PURE__ */ x(I, {
196
+ }), /* @__PURE__ */ S(L, {
196
197
  id: "suggest-objective",
197
198
  value: m,
198
199
  onChange: (e) => h(e.target.value),
@@ -200,220 +201,226 @@ function V({ onClose: t, onViewProtocol: n }) {
200
201
  rows: 3
201
202
  })]
202
203
  }),
203
- /* @__PURE__ */ S("div", {
204
+ /* @__PURE__ */ C("div", {
204
205
  className: "space-y-1.5",
205
- children: [/* @__PURE__ */ x(w, {
206
+ children: [/* @__PURE__ */ S(T, {
206
207
  htmlFor: "suggest-constraints",
207
208
  children: "Constraints (optional)"
208
- }), /* @__PURE__ */ x(I, {
209
+ }), /* @__PURE__ */ S(L, {
209
210
  id: "suggest-constraints",
210
- value: _,
211
- onChange: (e) => T(e.target.value),
211
+ value: g,
212
+ onChange: (e) => v(e.target.value),
212
213
  placeholder: "Bench instruments only, under 4 hours, no hazardous solvents.",
213
214
  rows: 2
214
215
  })]
215
216
  }),
216
- /* @__PURE__ */ x(B, {
217
+ /* @__PURE__ */ S(V, {
217
218
  id: "suggest-provider",
218
219
  value: E,
219
- onChange: z
220
+ onChange: D
220
221
  }),
221
- V && /* @__PURE__ */ x("p", {
222
+ B && /* @__PURE__ */ S("p", {
222
223
  className: "text-sm text-status-error-text",
223
- children: V
224
+ children: B
224
225
  }),
225
- /* @__PURE__ */ x(u, {
226
+ /* @__PURE__ */ S(u, {
226
227
  error: i.error,
227
228
  fallback: "Failed to design a protocol."
228
229
  })
229
230
  ]
230
231
  }),
231
- /* @__PURE__ */ x(O, { children: U ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
232
+ /* @__PURE__ */ S(k, { children: U ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(w, {
232
233
  variant: "outline",
233
234
  onClick: t,
234
235
  children: "Close"
235
- }), /* @__PURE__ */ S(C, {
236
+ }), /* @__PURE__ */ C(w, {
236
237
  onClick: () => {
237
238
  t(), n(U.protocol.id);
238
239
  },
239
- children: [/* @__PURE__ */ x(v, { className: "mr-2 h-4 w-4" }), "Open draft protocol"]
240
- })] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
240
+ children: [/* @__PURE__ */ S(y, { className: "mr-2 h-4 w-4" }), "Open draft protocol"]
241
+ })] }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(w, {
241
242
  variant: "outline",
242
243
  onClick: t,
243
244
  disabled: i.isPending,
244
245
  children: "Cancel"
245
- }), /* @__PURE__ */ S(C, {
246
+ }), /* @__PURE__ */ C(w, {
246
247
  onClick: () => void K(),
247
248
  disabled: i.isPending,
248
- children: [/* @__PURE__ */ x(y, { className: "mr-2 h-4 w-4" }), i.isPending ? "Designing…" : "Design draft"]
249
+ children: [/* @__PURE__ */ S(b, { className: "mr-2 h-4 w-4" }), i.isPending ? "Designing…" : "Design draft"]
249
250
  })] }) })
250
251
  ] });
251
252
  }
252
- function H({ open: e, onOpenChange: t, onViewProtocol: n }) {
253
- return /* @__PURE__ */ x(T, {
253
+ function U({ open: e, onOpenChange: t, onViewProtocol: n }) {
254
+ return /* @__PURE__ */ S(E, {
254
255
  open: e,
255
256
  onOpenChange: t,
256
- children: /* @__PURE__ */ x(E, {
257
+ children: /* @__PURE__ */ S(D, {
257
258
  className: "max-h-[90vh] max-w-lg overflow-y-auto",
258
- children: e && /* @__PURE__ */ x(V, {
259
- onClose: () => t(!1),
260
- onViewProtocol: n
259
+ children: e && /* @__PURE__ */ S(d, {
260
+ onCancel: () => t(!1),
261
+ children: /* @__PURE__ */ S(H, {
262
+ onClose: () => t(!1),
263
+ onViewProtocol: n
264
+ })
261
265
  })
262
266
  })
263
267
  });
264
268
  }
265
- function U({ initialExperimentId: t, onClose: n, onViewExperiment: i }) {
269
+ function W({ initialExperimentId: t, onClose: n, onViewExperiment: i }) {
266
270
  let a = o(), s = r({ pagination: {
267
- limit: R,
271
+ limit: z,
268
272
  offset: 0
269
- } }), [c, d] = g(t ?? ""), [f, m] = g(L), [h, v] = g(null), [T, E] = g(null), I = async () => {
273
+ } }), [c, d] = _(t ?? ""), [f, p] = _(R), [h, g] = _(null), [y, E] = _(null), D = async () => {
270
274
  if (!c) {
271
- v("Choose the experiment to assess.");
275
+ g("Choose the experiment to assess.");
272
276
  return;
273
277
  }
274
- v(null);
278
+ g(null);
275
279
  try {
276
280
  let e = await a.mutateAsync({
277
281
  experimentId: c,
278
- requestedProvider: f === L ? void 0 : f
282
+ requestedProvider: f === R ? void 0 : f
279
283
  });
280
284
  E(e);
281
285
  } catch {}
282
286
  };
283
- return /* @__PURE__ */ S(b, { children: [
284
- /* @__PURE__ */ S(k, { children: [/* @__PURE__ */ x(A, { children: "Recommend the next run" }), /* @__PURE__ */ x(D, { children: "The AI reads this experiment's recent runs and proposes what to do next. It starts no run and changes no experiment design." })] }),
285
- T ? /* @__PURE__ */ S("div", {
287
+ return /* @__PURE__ */ C(x, { children: [
288
+ /* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: "Recommend the next run" }), /* @__PURE__ */ S(O, { children: "The AI reads this experiment's recent runs and proposes what to do next. It starts no run and changes no experiment design." })] }),
289
+ y ? /* @__PURE__ */ C("div", {
286
290
  className: "space-y-4 py-2",
287
291
  children: [
288
- /* @__PURE__ */ S("div", {
292
+ /* @__PURE__ */ C("div", {
289
293
  className: "flex flex-wrap items-center gap-2",
290
- children: [/* @__PURE__ */ x(e, { status: T.recommendation }), /* @__PURE__ */ S("span", {
294
+ children: [/* @__PURE__ */ S(e, { status: y.recommendation }), /* @__PURE__ */ C("span", {
291
295
  className: "text-xs text-text-tertiary",
292
- children: ["Confidence ", p(T.confidence)]
296
+ children: ["Confidence ", m(y.confidence)]
293
297
  })]
294
298
  }),
295
- /* @__PURE__ */ x("p", {
299
+ /* @__PURE__ */ S("p", {
296
300
  className: "text-sm text-text-secondary",
297
- children: T.rationale
301
+ children: y.rationale
298
302
  }),
299
- T.flags.length > 0 && /* @__PURE__ */ x("div", {
303
+ y.flags.length > 0 && /* @__PURE__ */ S("div", {
300
304
  className: "flex flex-wrap gap-1.5",
301
- children: T.flags.map((e) => /* @__PURE__ */ x("span", {
305
+ children: y.flags.map((e) => /* @__PURE__ */ S("span", {
302
306
  className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
303
307
  children: e
304
308
  }, e))
305
309
  }),
306
- T.recommendation === "ADJUST_PARAMETERS" && /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
310
+ y.recommendation === "ADJUST_PARAMETERS" && /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("p", {
307
311
  className: "mb-1.5 text-xs font-medium uppercase tracking-wide text-text-tertiary",
308
312
  children: "Suggested parameters"
309
- }), /* @__PURE__ */ x(l, {
310
- value: T.suggestedParameters,
313
+ }), /* @__PURE__ */ S(l, {
314
+ value: y.suggestedParameters,
311
315
  emptyLabel: "No specific parameter values were proposed"
312
316
  })] }),
313
- /* @__PURE__ */ x("p", {
317
+ /* @__PURE__ */ S("p", {
314
318
  className: "text-sm text-text-secondary",
315
- children: T.appliedToExperiment ? "Recorded on the experiment as a proposal (status PROPOSED). Nothing is applied until a researcher resolves it." : "The recommendation was produced but could not be recorded on the experiment — it is still in the decision feed."
319
+ children: y.appliedToExperiment ? "Recorded on the experiment as a proposal (status PROPOSED). Nothing is applied until a researcher resolves it." : "The recommendation was produced but could not be recorded on the experiment — it is still in the decision feed."
316
320
  }),
317
- /* @__PURE__ */ S("p", {
321
+ /* @__PURE__ */ C("p", {
318
322
  className: "text-xs text-text-tertiary",
319
323
  children: [
320
324
  "Recorded in the decision feed as",
321
325
  " ",
322
- /* @__PURE__ */ x("span", {
326
+ /* @__PURE__ */ S("span", {
323
327
  className: "break-all font-mono",
324
- children: T.agentRunId
328
+ children: y.agentRunId
325
329
  }),
326
330
  "."
327
331
  ]
328
332
  })
329
333
  ]
330
- }) : /* @__PURE__ */ S("div", {
334
+ }) : /* @__PURE__ */ C("div", {
331
335
  className: "space-y-4 py-2",
332
336
  children: [
333
- /* @__PURE__ */ S("div", {
337
+ /* @__PURE__ */ C("div", {
334
338
  className: "space-y-1.5",
335
339
  children: [
336
- /* @__PURE__ */ x(w, {
340
+ /* @__PURE__ */ S(T, {
337
341
  htmlFor: "recommend-experiment",
338
342
  children: "Experiment"
339
343
  }),
340
- /* @__PURE__ */ S(j, {
344
+ /* @__PURE__ */ C(M, {
341
345
  value: c,
342
346
  onValueChange: d,
343
- children: [/* @__PURE__ */ x(P, {
347
+ children: [/* @__PURE__ */ S(F, {
344
348
  id: "recommend-experiment",
345
- children: /* @__PURE__ */ x(F, { placeholder: "Select an experiment" })
346
- }), /* @__PURE__ */ x(M, { children: (s.data?.items ?? []).map((e) => /* @__PURE__ */ x(N, {
349
+ children: /* @__PURE__ */ S(I, { placeholder: "Select an experiment" })
350
+ }), /* @__PURE__ */ S(N, { children: (s.data?.items ?? []).map((e) => /* @__PURE__ */ S(P, {
347
351
  value: e.id,
348
352
  children: e.title
349
353
  }, e.id)) })]
350
354
  }),
351
- /* @__PURE__ */ x("p", {
355
+ /* @__PURE__ */ S("p", {
352
356
  className: "text-xs text-text-tertiary",
353
357
  children: "The experiment needs at least one recorded run — there is nothing to reason over otherwise."
354
358
  })
355
359
  ]
356
360
  }),
357
- /* @__PURE__ */ x(B, {
361
+ /* @__PURE__ */ S(V, {
358
362
  id: "recommend-provider",
359
363
  value: f,
360
- onChange: m
364
+ onChange: p
361
365
  }),
362
- h && /* @__PURE__ */ x("p", {
366
+ h && /* @__PURE__ */ S("p", {
363
367
  className: "text-sm text-status-error-text",
364
368
  children: h
365
369
  }),
366
- /* @__PURE__ */ x(u, {
370
+ /* @__PURE__ */ S(u, {
367
371
  error: a.error,
368
372
  fallback: "Failed to produce a recommendation."
369
373
  })
370
374
  ]
371
375
  }),
372
- /* @__PURE__ */ x(O, { children: T ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
376
+ /* @__PURE__ */ S(k, { children: y ? /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(w, {
373
377
  variant: "outline",
374
378
  onClick: n,
375
379
  children: "Close"
376
- }), /* @__PURE__ */ S(C, {
380
+ }), /* @__PURE__ */ C(w, {
377
381
  onClick: () => {
378
- n(), i(T.experimentId);
382
+ n(), i(y.experimentId);
379
383
  },
380
- children: ["Open experiment", /* @__PURE__ */ x(_, { className: "ml-2 h-4 w-4" })]
381
- })] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
384
+ children: ["Open experiment", /* @__PURE__ */ S(v, { className: "ml-2 h-4 w-4" })]
385
+ })] }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(w, {
382
386
  variant: "outline",
383
387
  onClick: n,
384
388
  disabled: a.isPending,
385
389
  children: "Cancel"
386
- }), /* @__PURE__ */ S(C, {
387
- onClick: () => void I(),
390
+ }), /* @__PURE__ */ C(w, {
391
+ onClick: () => void D(),
388
392
  disabled: a.isPending,
389
- children: [/* @__PURE__ */ x(y, { className: "mr-2 h-4 w-4" }), a.isPending ? "Assessing…" : "Assess runs"]
393
+ children: [/* @__PURE__ */ S(b, { className: "mr-2 h-4 w-4" }), a.isPending ? "Assessing…" : "Assess runs"]
390
394
  })] }) })
391
395
  ] });
392
396
  }
393
- function W({ open: e, onOpenChange: t, initialExperimentId: n = null, onViewExperiment: r }) {
394
- return /* @__PURE__ */ x(T, {
397
+ function G({ open: e, onOpenChange: t, initialExperimentId: n = null, onViewExperiment: r }) {
398
+ return /* @__PURE__ */ S(E, {
395
399
  open: e,
396
400
  onOpenChange: t,
397
- children: /* @__PURE__ */ x(E, {
401
+ children: /* @__PURE__ */ S(D, {
398
402
  className: "max-h-[90vh] max-w-lg overflow-y-auto",
399
- children: e && /* @__PURE__ */ x(U, {
400
- initialExperimentId: n,
401
- onClose: () => t(!1),
402
- onViewExperiment: r
403
+ children: e && /* @__PURE__ */ S(d, {
404
+ onCancel: () => t(!1),
405
+ children: /* @__PURE__ */ S(W, {
406
+ initialExperimentId: n,
407
+ onClose: () => t(!1),
408
+ onViewExperiment: r
409
+ })
403
410
  })
404
411
  })
405
412
  });
406
413
  }
407
- function G({ run: t, onClose: a }) {
414
+ function K({ run: t, onClose: a }) {
408
415
  let o = i(), s = r({ pagination: {
409
- limit: R,
416
+ limit: z,
410
417
  offset: 0
411
- } }), l = d(t.decision), p = l.kind === "recommendation" || l.kind === "override" ? l.recommendation : null, h = f(t), _ = n(h ?? void 0), v = m(_.data?.context), [y, T] = g(h ?? ""), [E, L] = g(p ?? "REPLICATE"), [B, V] = g(""), [H, U] = g(null), [W, G] = g(!1), K = async () => {
418
+ } }), l = f(t.decision), d = l.kind === "recommendation" || l.kind === "override" ? l.recommendation : null, m = p(t), g = n(m ?? void 0), v = h(g.data?.context), [y, b] = _(m ?? ""), [E, D] = _(d ?? "REPLICATE"), [R, V] = _(""), [H, U] = _(null), [W, G] = _(!1), K = async () => {
412
419
  if (!y) {
413
420
  U("Choose the experiment this decision applies to.");
414
421
  return;
415
422
  }
416
- if (!B.trim()) {
423
+ if (!R.trim()) {
417
424
  U("Say why you are overriding — the note is the audit trail.");
418
425
  return;
419
426
  }
@@ -423,137 +430,137 @@ function G({ run: t, onClose: a }) {
423
430
  runId: t.id,
424
431
  experimentId: y,
425
432
  recommendation: E,
426
- note: B.trim()
433
+ note: R.trim()
427
434
  }), G(!0);
428
435
  } catch {}
429
436
  };
430
- return /* @__PURE__ */ S(b, { children: [
431
- /* @__PURE__ */ S(k, { children: [/* @__PURE__ */ x(A, { children: "Record your call" }), /* @__PURE__ */ x(D, { children: "Your decision is appended to the ledger as a new entry that supersedes this one. The original is never edited." })] }),
432
- W ? /* @__PURE__ */ x("div", {
437
+ return /* @__PURE__ */ C(x, { children: [
438
+ /* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: "Record your call" }), /* @__PURE__ */ S(O, { children: "Your decision is appended to the ledger as a new entry that supersedes this one. The original is never edited." })] }),
439
+ W ? /* @__PURE__ */ S("div", {
433
440
  className: "space-y-3 py-2",
434
- children: /* @__PURE__ */ x("p", {
441
+ children: /* @__PURE__ */ S("p", {
435
442
  className: "text-sm text-text-secondary",
436
443
  children: "Recorded. The experiment now carries your call (status OVERRIDDEN) alongside what the model proposed, so \"did the researcher agree?\" stays answerable."
437
444
  })
438
- }) : /* @__PURE__ */ S("div", {
445
+ }) : /* @__PURE__ */ C("div", {
439
446
  className: "space-y-4 py-2",
440
447
  children: [
441
- p && /* @__PURE__ */ S("div", {
448
+ d && /* @__PURE__ */ C("div", {
442
449
  className: "rounded-lg border border-border-seam bg-bg-sunken p-3",
443
- children: [/* @__PURE__ */ x("p", {
450
+ children: [/* @__PURE__ */ S("p", {
444
451
  className: "text-xs font-medium uppercase tracking-wide text-text-tertiary",
445
452
  children: "The model proposed"
446
- }), /* @__PURE__ */ x("div", {
453
+ }), /* @__PURE__ */ S("div", {
447
454
  className: "mt-1.5",
448
- children: /* @__PURE__ */ x(e, { status: p })
455
+ children: /* @__PURE__ */ S(e, { status: d })
449
456
  })]
450
457
  }),
451
- /* @__PURE__ */ S("div", {
458
+ /* @__PURE__ */ C("div", {
452
459
  className: "space-y-1.5",
453
460
  children: [
454
- /* @__PURE__ */ x(w, {
461
+ /* @__PURE__ */ S(T, {
455
462
  htmlFor: "override-experiment",
456
463
  children: "Experiment"
457
464
  }),
458
- h ? /* @__PURE__ */ S("div", {
465
+ m ? /* @__PURE__ */ C("div", {
459
466
  id: "override-experiment",
460
467
  className: "rounded-lg border border-border-seam bg-bg-sunken p-3",
461
- children: [/* @__PURE__ */ x("p", {
468
+ children: [/* @__PURE__ */ S("p", {
462
469
  className: "truncate text-sm font-medium text-text-primary",
463
- children: _.data?.title ?? h
464
- }), v ? /* @__PURE__ */ S("div", {
470
+ children: g.data?.title ?? m
471
+ }), v ? /* @__PURE__ */ C("div", {
465
472
  className: "mt-1.5 flex flex-wrap items-center gap-2",
466
473
  children: [
467
- /* @__PURE__ */ x("span", {
474
+ /* @__PURE__ */ S("span", {
468
475
  className: "text-xs text-text-tertiary",
469
476
  children: "Currently carries"
470
477
  }),
471
- v.recommendation && /* @__PURE__ */ x(e, { status: v.recommendation }),
472
- v.status && /* @__PURE__ */ x(e, { status: v.status })
478
+ v.recommendation && /* @__PURE__ */ S(e, { status: v.recommendation }),
479
+ v.status && /* @__PURE__ */ S(e, { status: v.status })
473
480
  ]
474
- }) : /* @__PURE__ */ x("p", {
481
+ }) : /* @__PURE__ */ S("p", {
475
482
  className: "mt-1 text-xs text-text-tertiary",
476
- children: _.isLoading ? "Checking what this experiment currently carries…" : "No AI read is recorded on this experiment yet."
483
+ children: g.isLoading ? "Checking what this experiment currently carries…" : "No AI read is recorded on this experiment yet."
477
484
  })]
478
- }) : /* @__PURE__ */ S(j, {
485
+ }) : /* @__PURE__ */ C(M, {
479
486
  value: y,
480
- onValueChange: T,
481
- children: [/* @__PURE__ */ x(P, {
487
+ onValueChange: b,
488
+ children: [/* @__PURE__ */ S(F, {
482
489
  id: "override-experiment",
483
- children: /* @__PURE__ */ x(F, { placeholder: "Select an experiment" })
484
- }), /* @__PURE__ */ x(M, { children: (s.data?.items ?? []).map((e) => /* @__PURE__ */ x(N, {
490
+ children: /* @__PURE__ */ S(I, { placeholder: "Select an experiment" })
491
+ }), /* @__PURE__ */ S(N, { children: (s.data?.items ?? []).map((e) => /* @__PURE__ */ S(P, {
485
492
  value: e.id,
486
493
  children: e.title
487
494
  }, e.id)) })]
488
495
  }),
489
- !h && /* @__PURE__ */ x("p", {
496
+ !m && /* @__PURE__ */ S("p", {
490
497
  className: "text-xs text-text-tertiary",
491
498
  children: "This entry does not name an experiment, so choose the one your call applies to."
492
499
  })
493
500
  ]
494
501
  }),
495
- /* @__PURE__ */ S("div", {
502
+ /* @__PURE__ */ C("div", {
496
503
  className: "space-y-1.5",
497
- children: [/* @__PURE__ */ x(w, {
504
+ children: [/* @__PURE__ */ S(T, {
498
505
  htmlFor: "override-recommendation",
499
506
  children: "Your call"
500
- }), /* @__PURE__ */ S(j, {
507
+ }), /* @__PURE__ */ C(M, {
501
508
  value: E,
502
- onValueChange: (e) => L(e),
503
- children: [/* @__PURE__ */ x(P, {
509
+ onValueChange: (e) => D(e),
510
+ children: [/* @__PURE__ */ S(F, {
504
511
  id: "override-recommendation",
505
- children: /* @__PURE__ */ x(F, {})
506
- }), /* @__PURE__ */ x(M, { children: z.map((e) => /* @__PURE__ */ x(N, {
512
+ children: /* @__PURE__ */ S(I, {})
513
+ }), /* @__PURE__ */ S(N, { children: B.map((e) => /* @__PURE__ */ S(P, {
507
514
  value: e,
508
515
  children: c(e)
509
516
  }, e)) })]
510
517
  })]
511
518
  }),
512
- /* @__PURE__ */ S("div", {
519
+ /* @__PURE__ */ C("div", {
513
520
  className: "space-y-1.5",
514
- children: [/* @__PURE__ */ x(w, {
521
+ children: [/* @__PURE__ */ S(T, {
515
522
  htmlFor: "override-note",
516
523
  children: "Note"
517
- }), /* @__PURE__ */ x(I, {
524
+ }), /* @__PURE__ */ S(L, {
518
525
  id: "override-note",
519
- value: B,
526
+ value: R,
520
527
  onChange: (e) => V(e.target.value),
521
528
  placeholder: "The replicate variance is instrument drift, not a real effect — recalibrate and repeat.",
522
529
  rows: 3
523
530
  })]
524
531
  }),
525
- H && /* @__PURE__ */ x("p", {
532
+ H && /* @__PURE__ */ S("p", {
526
533
  className: "text-sm text-status-error-text",
527
534
  children: H
528
535
  }),
529
- /* @__PURE__ */ x(u, {
536
+ /* @__PURE__ */ S(u, {
530
537
  error: o.error,
531
538
  fallback: "Failed to record the override."
532
539
  })
533
540
  ]
534
541
  }),
535
- /* @__PURE__ */ x(O, { children: W ? /* @__PURE__ */ x(C, {
542
+ /* @__PURE__ */ S(k, { children: W ? /* @__PURE__ */ S(w, {
536
543
  onClick: a,
537
544
  children: "Done"
538
- }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
545
+ }) : /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S(w, {
539
546
  variant: "outline",
540
547
  onClick: a,
541
548
  disabled: o.isPending,
542
549
  children: "Cancel"
543
- }), /* @__PURE__ */ x(C, {
550
+ }), /* @__PURE__ */ S(w, {
544
551
  onClick: () => void K(),
545
552
  disabled: o.isPending,
546
553
  children: o.isPending ? "Recording…" : "Record override"
547
554
  })] }) })
548
555
  ] });
549
556
  }
550
- function K({ run: e, onOpenChange: t }) {
551
- return /* @__PURE__ */ x(T, {
557
+ function q({ run: e, onOpenChange: t }) {
558
+ return /* @__PURE__ */ S(E, {
552
559
  open: e !== null,
553
560
  onOpenChange: t,
554
- children: /* @__PURE__ */ x(E, {
561
+ children: /* @__PURE__ */ S(D, {
555
562
  className: "max-h-[90vh] max-w-lg overflow-y-auto",
556
- children: e && /* @__PURE__ */ x(G, {
563
+ children: e && /* @__PURE__ */ S(K, {
557
564
  run: e,
558
565
  onClose: () => t(!1)
559
566
  }, e.id)
@@ -561,6 +568,6 @@ function K({ run: e, onOpenChange: t }) {
561
568
  });
562
569
  }
563
570
  //#endregion
564
- export { K as OverrideDecisionDialog, W as RecommendNextRunDialog, H as SuggestProtocolDialog };
571
+ export { q as OverrideDecisionDialog, G as RecommendNextRunDialog, U as SuggestProtocolDialog };
565
572
 
566
573
  //# sourceMappingURL=AiDialogs.js.map