@burdenoff/microfe-labsofscience 2026.801.1 → 2026.801.3

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 (53) hide show
  1. package/dist/generated/wspace-types.d.ts +68885 -33499
  2. package/dist/generated/wspace-types.d.ts.map +1 -1
  3. package/dist/labsofscience/LabsOfScienceRoot.d.ts.map +1 -1
  4. package/dist/labsofscience/LabsOfScienceRoot.js +57 -49
  5. package/dist/labsofscience/LabsOfScienceRoot.js.map +1 -1
  6. package/dist/labsofscience/LabsOfScienceRoutes.d.ts.map +1 -1
  7. package/dist/labsofscience/LabsOfScienceRoutes.js +10 -6
  8. package/dist/labsofscience/LabsOfScienceRoutes.js.map +1 -1
  9. package/dist/labsofscience/components/BottomNav.d.ts.map +1 -1
  10. package/dist/labsofscience/components/BottomNav.js +36 -30
  11. package/dist/labsofscience/components/BottomNav.js.map +1 -1
  12. package/dist/labsofscience/components/StatusBadge.d.ts.map +1 -1
  13. package/dist/labsofscience/components/StatusBadge.js +10 -1
  14. package/dist/labsofscience/components/StatusBadge.js.map +1 -1
  15. package/dist/labsofscience/hooks/index.d.ts +1 -1
  16. package/dist/labsofscience/hooks/index.d.ts.map +1 -1
  17. package/dist/labsofscience/hooks/useLabsOfScienceApi.d.ts +82 -1
  18. package/dist/labsofscience/hooks/useLabsOfScienceApi.d.ts.map +1 -1
  19. package/dist/labsofscience/hooks/useLabsOfScienceApi.js +326 -199
  20. package/dist/labsofscience/hooks/useLabsOfScienceApi.js.map +1 -1
  21. package/dist/labsofscience/pages/ai/AiDialogs.d.ts +20 -0
  22. package/dist/labsofscience/pages/ai/AiDialogs.d.ts.map +1 -0
  23. package/dist/labsofscience/pages/ai/AiDialogs.js +566 -0
  24. package/dist/labsofscience/pages/ai/AiDialogs.js.map +1 -0
  25. package/dist/labsofscience/pages/ai/AiErrorNotice.d.ts +20 -0
  26. package/dist/labsofscience/pages/ai/AiErrorNotice.d.ts.map +1 -0
  27. package/dist/labsofscience/pages/ai/AiErrorNotice.js +67 -0
  28. package/dist/labsofscience/pages/ai/AiErrorNotice.js.map +1 -0
  29. package/dist/labsofscience/pages/ai/AiOperationsPage.d.ts +29 -0
  30. package/dist/labsofscience/pages/ai/AiOperationsPage.d.ts.map +1 -0
  31. package/dist/labsofscience/pages/ai/AiOperationsPage.js +196 -0
  32. package/dist/labsofscience/pages/ai/AiOperationsPage.js.map +1 -0
  33. package/dist/labsofscience/pages/ai/DecisionCard.d.ts +9 -0
  34. package/dist/labsofscience/pages/ai/DecisionCard.d.ts.map +1 -0
  35. package/dist/labsofscience/pages/ai/DecisionCard.js +282 -0
  36. package/dist/labsofscience/pages/ai/DecisionCard.js.map +1 -0
  37. package/dist/labsofscience/pages/ai/ModelSettings.d.ts +20 -0
  38. package/dist/labsofscience/pages/ai/ModelSettings.d.ts.map +1 -0
  39. package/dist/labsofscience/pages/ai/ModelSettings.js +141 -0
  40. package/dist/labsofscience/pages/ai/ModelSettings.js.map +1 -0
  41. package/dist/labsofscience/pages/ai/aiReaders.d.ts +82 -0
  42. package/dist/labsofscience/pages/ai/aiReaders.d.ts.map +1 -0
  43. package/dist/labsofscience/pages/ai/aiReaders.js +86 -0
  44. package/dist/labsofscience/pages/ai/aiReaders.js.map +1 -0
  45. package/dist/labsofscience/pages/experiments/ExperimentDetailPage.js +18 -18
  46. package/dist/labsofscience/pages/experiments/ExperimentsListPage.js +6 -6
  47. package/dist/labsofscience/pages/instruments/InstrumentDetailPage.js +14 -14
  48. package/dist/labsofscience/pages/instruments/InstrumentsListPage.js +6 -6
  49. package/dist/labsofscience/pages/projects/ProjectDetailPage.js +16 -16
  50. package/dist/labsofscience/pages/projects/ProjectsListPage.js +6 -6
  51. package/dist/labsofscience/types/index.d.ts +133 -2
  52. package/dist/labsofscience/types/index.d.ts.map +1 -1
  53. package/package.json +1 -1
@@ -0,0 +1,566 @@
1
+ import { StatusBadge as e } from "../../components/StatusBadge.js";
2
+ import { useAiModelCatalog as t, useExperimentAiContext as n, useExperiments as r, useOverrideAgentRun as i, useProjects as a, useRecommendNextRun as o, useSuggestProtocol as s } from "../../hooks/useLabsOfScienceApi.js";
3
+ import { titleCase as c } from "../../utils/formatters.js";
4
+ import { JsonBlock as l } from "../shared/DetailComponents.js";
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";
11
+ //#region src/labsofscience/pages/ai/AiDialogs.tsx
12
+ var L = "WORKSPACE_DEFAULT", R = 100, z = [
13
+ "REPLICATE",
14
+ "ADJUST_PARAMETERS",
15
+ "ESCALATE_REVIEW",
16
+ "CONCLUDE"
17
+ ];
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", {
21
+ className: "space-y-1.5",
22
+ children: [
23
+ /* @__PURE__ */ x(w, {
24
+ htmlFor: e,
25
+ children: "Provider (optional)"
26
+ }),
27
+ /* @__PURE__ */ S(j, {
28
+ value: n,
29
+ onValueChange: r,
30
+ children: [/* @__PURE__ */ x(P, {
31
+ id: e,
32
+ children: /* @__PURE__ */ x(F, {})
33
+ }), /* @__PURE__ */ S(M, { children: [/* @__PURE__ */ x(N, {
34
+ value: L,
35
+ children: "Workspace default"
36
+ }), a.map((e) => /* @__PURE__ */ x(N, {
37
+ value: e,
38
+ children: c(e)
39
+ }, e))] })]
40
+ }),
41
+ /* @__PURE__ */ x("p", {
42
+ className: "text-xs text-text-tertiary",
43
+ 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
+ ]
46
+ });
47
+ }
48
+ function V({ onClose: t, onViewProtocol: n }) {
49
+ let i = s(), o = a({ pagination: {
50
+ limit: R,
51
+ offset: 0
52
+ } }), c = r({ pagination: {
53
+ limit: R,
54
+ 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
+ id: e.id,
57
+ label: e.name
58
+ })) : (c.data?.items ?? []).map((e) => ({
59
+ id: e.id,
60
+ label: e.title
61
+ })), K = async () => {
62
+ if (!f) {
63
+ H(`Choose a ${l} to design the method for.`);
64
+ return;
65
+ }
66
+ if (!m.trim()) {
67
+ H("Describe what the method has to achieve.");
68
+ return;
69
+ }
70
+ H(null);
71
+ try {
72
+ let e = await i.mutateAsync({
73
+ projectId: l === "project" ? f : void 0,
74
+ experimentId: l === "experiment" ? f : void 0,
75
+ objective: m.trim(),
76
+ constraints: _.trim() || void 0,
77
+ requestedProvider: E === L ? void 0 : E
78
+ });
79
+ W(e);
80
+ } catch {}
81
+ };
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", {
85
+ className: "space-y-4 py-2",
86
+ children: [
87
+ /* @__PURE__ */ S("div", {
88
+ className: "rounded-lg border border-border-seam bg-bg-sunken p-4",
89
+ children: [/* @__PURE__ */ S("div", {
90
+ className: "flex items-start justify-between gap-3",
91
+ children: [/* @__PURE__ */ S("div", {
92
+ className: "min-w-0",
93
+ children: [/* @__PURE__ */ x("p", {
94
+ className: "truncate font-medium text-text-primary",
95
+ children: U.protocol.name
96
+ }), /* @__PURE__ */ S("p", {
97
+ className: "mt-0.5 text-xs text-text-tertiary",
98
+ children: [
99
+ "v",
100
+ U.protocol.version,
101
+ " · ",
102
+ U.stepCount,
103
+ " step",
104
+ U.stepCount === 1 ? "" : "s"
105
+ ]
106
+ })]
107
+ }), /* @__PURE__ */ x(e, { status: U.protocol.status })]
108
+ }), U.protocol.summary && /* @__PURE__ */ x("p", {
109
+ className: "mt-2 text-sm text-text-secondary",
110
+ children: U.protocol.summary
111
+ })]
112
+ }),
113
+ /* @__PURE__ */ S("p", {
114
+ className: "text-sm text-text-secondary",
115
+ children: [
116
+ "This landed as a ",
117
+ /* @__PURE__ */ x("strong", {
118
+ className: "text-text-primary",
119
+ children: "draft"
120
+ }),
121
+ ". 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
+ }),
124
+ /* @__PURE__ */ S("p", {
125
+ className: "text-xs text-text-tertiary",
126
+ children: [
127
+ "Recorded in the decision feed as",
128
+ " ",
129
+ /* @__PURE__ */ x("span", {
130
+ className: "break-all font-mono",
131
+ children: U.agentRunId
132
+ }),
133
+ "."
134
+ ]
135
+ })
136
+ ]
137
+ }) : /* @__PURE__ */ S("div", {
138
+ className: "space-y-4 py-2",
139
+ children: [
140
+ /* @__PURE__ */ S("div", {
141
+ className: "space-y-1.5",
142
+ children: [/* @__PURE__ */ x(w, {
143
+ htmlFor: "suggest-target-kind",
144
+ children: "Design it for"
145
+ }), /* @__PURE__ */ S(j, {
146
+ value: l,
147
+ onValueChange: (e) => {
148
+ d(e), p("");
149
+ },
150
+ children: [/* @__PURE__ */ x(P, {
151
+ id: "suggest-target-kind",
152
+ children: /* @__PURE__ */ x(F, {})
153
+ }), /* @__PURE__ */ S(M, { children: [/* @__PURE__ */ x(N, {
154
+ value: "project",
155
+ children: "A project"
156
+ }), /* @__PURE__ */ x(N, {
157
+ value: "experiment",
158
+ children: "An experiment"
159
+ })] })]
160
+ })]
161
+ }),
162
+ /* @__PURE__ */ S("div", {
163
+ className: "space-y-1.5",
164
+ children: [
165
+ /* @__PURE__ */ x(w, {
166
+ htmlFor: "suggest-target",
167
+ children: l === "project" ? "Project" : "Experiment"
168
+ }),
169
+ /* @__PURE__ */ S(j, {
170
+ value: f,
171
+ onValueChange: p,
172
+ children: [/* @__PURE__ */ x(P, {
173
+ 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, {
176
+ value: e.id,
177
+ children: e.label
178
+ }, e.id)) })]
179
+ }),
180
+ G.length === 0 && /* @__PURE__ */ S("p", {
181
+ className: "text-xs text-text-tertiary",
182
+ children: [
183
+ "No ",
184
+ l === "project" ? "projects" : "experiments",
185
+ " in this workspace yet."
186
+ ]
187
+ })
188
+ ]
189
+ }),
190
+ /* @__PURE__ */ S("div", {
191
+ className: "space-y-1.5",
192
+ children: [/* @__PURE__ */ x(w, {
193
+ htmlFor: "suggest-objective",
194
+ children: "Objective"
195
+ }), /* @__PURE__ */ x(I, {
196
+ id: "suggest-objective",
197
+ value: m,
198
+ onChange: (e) => h(e.target.value),
199
+ placeholder: "Quantify protein yield after a 24h induction, reproducibly across three replicates.",
200
+ rows: 3
201
+ })]
202
+ }),
203
+ /* @__PURE__ */ S("div", {
204
+ className: "space-y-1.5",
205
+ children: [/* @__PURE__ */ x(w, {
206
+ htmlFor: "suggest-constraints",
207
+ children: "Constraints (optional)"
208
+ }), /* @__PURE__ */ x(I, {
209
+ id: "suggest-constraints",
210
+ value: _,
211
+ onChange: (e) => T(e.target.value),
212
+ placeholder: "Bench instruments only, under 4 hours, no hazardous solvents.",
213
+ rows: 2
214
+ })]
215
+ }),
216
+ /* @__PURE__ */ x(B, {
217
+ id: "suggest-provider",
218
+ value: E,
219
+ onChange: z
220
+ }),
221
+ V && /* @__PURE__ */ x("p", {
222
+ className: "text-sm text-status-error-text",
223
+ children: V
224
+ }),
225
+ /* @__PURE__ */ x(u, {
226
+ error: i.error,
227
+ fallback: "Failed to design a protocol."
228
+ })
229
+ ]
230
+ }),
231
+ /* @__PURE__ */ x(O, { children: U ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
232
+ variant: "outline",
233
+ onClick: t,
234
+ children: "Close"
235
+ }), /* @__PURE__ */ S(C, {
236
+ onClick: () => {
237
+ t(), n(U.protocol.id);
238
+ },
239
+ children: [/* @__PURE__ */ x(v, { className: "mr-2 h-4 w-4" }), "Open draft protocol"]
240
+ })] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
241
+ variant: "outline",
242
+ onClick: t,
243
+ disabled: i.isPending,
244
+ children: "Cancel"
245
+ }), /* @__PURE__ */ S(C, {
246
+ onClick: () => void K(),
247
+ disabled: i.isPending,
248
+ children: [/* @__PURE__ */ x(y, { className: "mr-2 h-4 w-4" }), i.isPending ? "Designing…" : "Design draft"]
249
+ })] }) })
250
+ ] });
251
+ }
252
+ function H({ open: e, onOpenChange: t, onViewProtocol: n }) {
253
+ return /* @__PURE__ */ x(T, {
254
+ open: e,
255
+ onOpenChange: t,
256
+ children: /* @__PURE__ */ x(E, {
257
+ className: "max-h-[90vh] max-w-lg overflow-y-auto",
258
+ children: e && /* @__PURE__ */ x(V, {
259
+ onClose: () => t(!1),
260
+ onViewProtocol: n
261
+ })
262
+ })
263
+ });
264
+ }
265
+ function U({ initialExperimentId: t, onClose: n, onViewExperiment: i }) {
266
+ let a = o(), s = r({ pagination: {
267
+ limit: R,
268
+ offset: 0
269
+ } }), [c, d] = g(t ?? ""), [f, m] = g(L), [h, v] = g(null), [T, E] = g(null), I = async () => {
270
+ if (!c) {
271
+ v("Choose the experiment to assess.");
272
+ return;
273
+ }
274
+ v(null);
275
+ try {
276
+ let e = await a.mutateAsync({
277
+ experimentId: c,
278
+ requestedProvider: f === L ? void 0 : f
279
+ });
280
+ E(e);
281
+ } catch {}
282
+ };
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", {
286
+ className: "space-y-4 py-2",
287
+ children: [
288
+ /* @__PURE__ */ S("div", {
289
+ className: "flex flex-wrap items-center gap-2",
290
+ children: [/* @__PURE__ */ x(e, { status: T.recommendation }), /* @__PURE__ */ S("span", {
291
+ className: "text-xs text-text-tertiary",
292
+ children: ["Confidence ", p(T.confidence)]
293
+ })]
294
+ }),
295
+ /* @__PURE__ */ x("p", {
296
+ className: "text-sm text-text-secondary",
297
+ children: T.rationale
298
+ }),
299
+ T.flags.length > 0 && /* @__PURE__ */ x("div", {
300
+ className: "flex flex-wrap gap-1.5",
301
+ children: T.flags.map((e) => /* @__PURE__ */ x("span", {
302
+ className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
303
+ children: e
304
+ }, e))
305
+ }),
306
+ T.recommendation === "ADJUST_PARAMETERS" && /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("p", {
307
+ className: "mb-1.5 text-xs font-medium uppercase tracking-wide text-text-tertiary",
308
+ children: "Suggested parameters"
309
+ }), /* @__PURE__ */ x(l, {
310
+ value: T.suggestedParameters,
311
+ emptyLabel: "No specific parameter values were proposed"
312
+ })] }),
313
+ /* @__PURE__ */ x("p", {
314
+ 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."
316
+ }),
317
+ /* @__PURE__ */ S("p", {
318
+ className: "text-xs text-text-tertiary",
319
+ children: [
320
+ "Recorded in the decision feed as",
321
+ " ",
322
+ /* @__PURE__ */ x("span", {
323
+ className: "break-all font-mono",
324
+ children: T.agentRunId
325
+ }),
326
+ "."
327
+ ]
328
+ })
329
+ ]
330
+ }) : /* @__PURE__ */ S("div", {
331
+ className: "space-y-4 py-2",
332
+ children: [
333
+ /* @__PURE__ */ S("div", {
334
+ className: "space-y-1.5",
335
+ children: [
336
+ /* @__PURE__ */ x(w, {
337
+ htmlFor: "recommend-experiment",
338
+ children: "Experiment"
339
+ }),
340
+ /* @__PURE__ */ S(j, {
341
+ value: c,
342
+ onValueChange: d,
343
+ children: [/* @__PURE__ */ x(P, {
344
+ 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, {
347
+ value: e.id,
348
+ children: e.title
349
+ }, e.id)) })]
350
+ }),
351
+ /* @__PURE__ */ x("p", {
352
+ className: "text-xs text-text-tertiary",
353
+ children: "The experiment needs at least one recorded run — there is nothing to reason over otherwise."
354
+ })
355
+ ]
356
+ }),
357
+ /* @__PURE__ */ x(B, {
358
+ id: "recommend-provider",
359
+ value: f,
360
+ onChange: m
361
+ }),
362
+ h && /* @__PURE__ */ x("p", {
363
+ className: "text-sm text-status-error-text",
364
+ children: h
365
+ }),
366
+ /* @__PURE__ */ x(u, {
367
+ error: a.error,
368
+ fallback: "Failed to produce a recommendation."
369
+ })
370
+ ]
371
+ }),
372
+ /* @__PURE__ */ x(O, { children: T ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
373
+ variant: "outline",
374
+ onClick: n,
375
+ children: "Close"
376
+ }), /* @__PURE__ */ S(C, {
377
+ onClick: () => {
378
+ n(), i(T.experimentId);
379
+ },
380
+ children: ["Open experiment", /* @__PURE__ */ x(_, { className: "ml-2 h-4 w-4" })]
381
+ })] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
382
+ variant: "outline",
383
+ onClick: n,
384
+ disabled: a.isPending,
385
+ children: "Cancel"
386
+ }), /* @__PURE__ */ S(C, {
387
+ onClick: () => void I(),
388
+ disabled: a.isPending,
389
+ children: [/* @__PURE__ */ x(y, { className: "mr-2 h-4 w-4" }), a.isPending ? "Assessing…" : "Assess runs"]
390
+ })] }) })
391
+ ] });
392
+ }
393
+ function W({ open: e, onOpenChange: t, initialExperimentId: n = null, onViewExperiment: r }) {
394
+ return /* @__PURE__ */ x(T, {
395
+ open: e,
396
+ onOpenChange: t,
397
+ children: /* @__PURE__ */ x(E, {
398
+ 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
+ })
404
+ })
405
+ });
406
+ }
407
+ function G({ run: t, onClose: a }) {
408
+ let o = i(), s = r({ pagination: {
409
+ limit: R,
410
+ 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 () => {
412
+ if (!y) {
413
+ U("Choose the experiment this decision applies to.");
414
+ return;
415
+ }
416
+ if (!B.trim()) {
417
+ U("Say why you are overriding — the note is the audit trail.");
418
+ return;
419
+ }
420
+ U(null);
421
+ try {
422
+ await o.mutateAsync({
423
+ runId: t.id,
424
+ experimentId: y,
425
+ recommendation: E,
426
+ note: B.trim()
427
+ }), G(!0);
428
+ } catch {}
429
+ };
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", {
433
+ className: "space-y-3 py-2",
434
+ children: /* @__PURE__ */ x("p", {
435
+ className: "text-sm text-text-secondary",
436
+ children: "Recorded. The experiment now carries your call (status OVERRIDDEN) alongside what the model proposed, so \"did the researcher agree?\" stays answerable."
437
+ })
438
+ }) : /* @__PURE__ */ S("div", {
439
+ className: "space-y-4 py-2",
440
+ children: [
441
+ p && /* @__PURE__ */ S("div", {
442
+ className: "rounded-lg border border-border-seam bg-bg-sunken p-3",
443
+ children: [/* @__PURE__ */ x("p", {
444
+ className: "text-xs font-medium uppercase tracking-wide text-text-tertiary",
445
+ children: "The model proposed"
446
+ }), /* @__PURE__ */ x("div", {
447
+ className: "mt-1.5",
448
+ children: /* @__PURE__ */ x(e, { status: p })
449
+ })]
450
+ }),
451
+ /* @__PURE__ */ S("div", {
452
+ className: "space-y-1.5",
453
+ children: [
454
+ /* @__PURE__ */ x(w, {
455
+ htmlFor: "override-experiment",
456
+ children: "Experiment"
457
+ }),
458
+ h ? /* @__PURE__ */ S("div", {
459
+ id: "override-experiment",
460
+ className: "rounded-lg border border-border-seam bg-bg-sunken p-3",
461
+ children: [/* @__PURE__ */ x("p", {
462
+ className: "truncate text-sm font-medium text-text-primary",
463
+ children: _.data?.title ?? h
464
+ }), v ? /* @__PURE__ */ S("div", {
465
+ className: "mt-1.5 flex flex-wrap items-center gap-2",
466
+ children: [
467
+ /* @__PURE__ */ x("span", {
468
+ className: "text-xs text-text-tertiary",
469
+ children: "Currently carries"
470
+ }),
471
+ v.recommendation && /* @__PURE__ */ x(e, { status: v.recommendation }),
472
+ v.status && /* @__PURE__ */ x(e, { status: v.status })
473
+ ]
474
+ }) : /* @__PURE__ */ x("p", {
475
+ 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."
477
+ })]
478
+ }) : /* @__PURE__ */ S(j, {
479
+ value: y,
480
+ onValueChange: T,
481
+ children: [/* @__PURE__ */ x(P, {
482
+ 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, {
485
+ value: e.id,
486
+ children: e.title
487
+ }, e.id)) })]
488
+ }),
489
+ !h && /* @__PURE__ */ x("p", {
490
+ className: "text-xs text-text-tertiary",
491
+ children: "This entry does not name an experiment, so choose the one your call applies to."
492
+ })
493
+ ]
494
+ }),
495
+ /* @__PURE__ */ S("div", {
496
+ className: "space-y-1.5",
497
+ children: [/* @__PURE__ */ x(w, {
498
+ htmlFor: "override-recommendation",
499
+ children: "Your call"
500
+ }), /* @__PURE__ */ S(j, {
501
+ value: E,
502
+ onValueChange: (e) => L(e),
503
+ children: [/* @__PURE__ */ x(P, {
504
+ id: "override-recommendation",
505
+ children: /* @__PURE__ */ x(F, {})
506
+ }), /* @__PURE__ */ x(M, { children: z.map((e) => /* @__PURE__ */ x(N, {
507
+ value: e,
508
+ children: c(e)
509
+ }, e)) })]
510
+ })]
511
+ }),
512
+ /* @__PURE__ */ S("div", {
513
+ className: "space-y-1.5",
514
+ children: [/* @__PURE__ */ x(w, {
515
+ htmlFor: "override-note",
516
+ children: "Note"
517
+ }), /* @__PURE__ */ x(I, {
518
+ id: "override-note",
519
+ value: B,
520
+ onChange: (e) => V(e.target.value),
521
+ placeholder: "The replicate variance is instrument drift, not a real effect — recalibrate and repeat.",
522
+ rows: 3
523
+ })]
524
+ }),
525
+ H && /* @__PURE__ */ x("p", {
526
+ className: "text-sm text-status-error-text",
527
+ children: H
528
+ }),
529
+ /* @__PURE__ */ x(u, {
530
+ error: o.error,
531
+ fallback: "Failed to record the override."
532
+ })
533
+ ]
534
+ }),
535
+ /* @__PURE__ */ x(O, { children: W ? /* @__PURE__ */ x(C, {
536
+ onClick: a,
537
+ children: "Done"
538
+ }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
539
+ variant: "outline",
540
+ onClick: a,
541
+ disabled: o.isPending,
542
+ children: "Cancel"
543
+ }), /* @__PURE__ */ x(C, {
544
+ onClick: () => void K(),
545
+ disabled: o.isPending,
546
+ children: o.isPending ? "Recording…" : "Record override"
547
+ })] }) })
548
+ ] });
549
+ }
550
+ function K({ run: e, onOpenChange: t }) {
551
+ return /* @__PURE__ */ x(T, {
552
+ open: e !== null,
553
+ onOpenChange: t,
554
+ children: /* @__PURE__ */ x(E, {
555
+ className: "max-h-[90vh] max-w-lg overflow-y-auto",
556
+ children: e && /* @__PURE__ */ x(G, {
557
+ run: e,
558
+ onClose: () => t(!1)
559
+ }, e.id)
560
+ })
561
+ });
562
+ }
563
+ //#endregion
564
+ export { K as OverrideDecisionDialog, W as RecommendNextRunDialog, H as SuggestProtocolDialog };
565
+
566
+ //# sourceMappingURL=AiDialogs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AiDialogs.js","names":[],"sources":["../../../../src/labsofscience/pages/ai/AiDialogs.tsx"],"sourcesContent":["/**\n * AI decision dialogs — suggest a protocol, recommend a next run, override.\n * @module labsofscience/pages/ai\n *\n * Each dialog posts a REAL mutation from the `wspace-labsofscience-svc`\n * subgraph and then shows exactly what was written, in the vocabulary the\n * service actually uses:\n *\n * - `labSuggestProtocol` writes a **DRAFT** `LabProtocol` with ordered steps.\n * It is not published. The result panel says so and links to the draft\n * rather than implying the method is ready for the bench.\n * - `labRecommendNextRun` records a **proposal** on the experiment\n * (`context.lastAiRecommendation`, status PROPOSED). It starts no run and\n * changes no experiment design.\n * - `labOverrideAgentRun` appends a NEW ledger row; it never edits the row it\n * supersedes.\n *\n * Follows `pages/experiments/RunDialogs.tsx` for structure (a\n * `ResponsiveDialog`, inline mutation errors) with one deliberate difference:\n * the form body is a child component mounted only while the dialog is open, so\n * \"reset the form and the mutation on open\" is React's own mount semantics\n * rather than an effect whose dependency list has to be argued about.\n */\n\nimport { useMemo, useState } from 'react';\nimport { ArrowRight, FileText, Sparkles } from 'lucide-react';\nimport {\n Button,\n Label,\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogDescription,\n ResponsiveDialogFooter,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\nimport { StatusBadge } from '../../components/StatusBadge';\nimport {\n useAiModelCatalog,\n useExperimentAiContext,\n useExperiments,\n useOverrideAgentRun,\n useProjects,\n useRecommendNextRun,\n useSuggestProtocol,\n} from '../../hooks/useLabsOfScienceApi';\nimport type {\n LabAgentRun,\n LabRunRecommendation,\n LabRunRecommendationResult,\n LabSuggestedProtocolResult,\n} from '../../types';\nimport { titleCase } from '../../utils/formatters';\nimport { JsonBlock } from '../shared/DetailComponents';\nimport { AiErrorNotice } from './AiErrorNotice';\nimport {\n describeDecision,\n experimentIdOfRun,\n formatConfidence,\n readLastAiRecommendation,\n} from './aiReaders';\n\n/** Sentinel for \"let the workspace default decide\" in the provider Select. */\nconst PROVIDER_DEFAULT = 'WORKSPACE_DEFAULT';\n/** How many projects/experiments the pickers offer. */\nconst PICKER_LIMIT = 100;\n\nconst RECOMMENDATIONS: LabRunRecommendation[] = [\n 'REPLICATE',\n 'ADJUST_PARAMETERS',\n 'ESCALATE_REVIEW',\n 'CONCLUDE',\n];\n\n/**\n * Optional \"ask a specific provider\" control. The service keeps a named\n * provider as *first preference* and still falls back through the rest of the\n * catalog, so this narrows the first attempt rather than pinning the call.\n */\nfunction ProviderSelect({\n id,\n value,\n onChange,\n}: {\n id: string;\n value: string;\n onChange: (value: string) => void;\n}) {\n const catalog = useAiModelCatalog();\n const providers = useMemo(\n () => [...new Set((catalog.data ?? []).map((entry) => entry.provider))],\n [catalog.data]\n );\n\n return (\n <div className=\"space-y-1.5\">\n <Label htmlFor={id}>Provider (optional)</Label>\n <Select value={value} onValueChange={onChange}>\n <SelectTrigger id={id}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={PROVIDER_DEFAULT}>Workspace default</SelectItem>\n {providers.map((provider) => (\n <SelectItem key={provider} value={provider}>\n {titleCase(provider)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className=\"text-xs text-text-tertiary\">\n A named provider is tried first. If it has no key configured or refuses the call, the\n remaining catalog providers are still tried before the attempt is recorded as failed.\n </p>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Suggest a protocol\n// ---------------------------------------------------------------------------\n\ntype ProtocolTargetKind = 'project' | 'experiment';\n\nfunction SuggestProtocolForm({\n onClose,\n onViewProtocol,\n}: {\n onClose: () => void;\n onViewProtocol: (protocolId: string) => void;\n}) {\n const suggest = useSuggestProtocol();\n const projects = useProjects({ pagination: { limit: PICKER_LIMIT, offset: 0 } });\n const experiments = useExperiments({ pagination: { limit: PICKER_LIMIT, offset: 0 } });\n\n const [targetKind, setTargetKind] = useState<ProtocolTargetKind>('project');\n const [targetId, setTargetId] = useState('');\n const [objective, setObjective] = useState('');\n const [constraints, setConstraints] = useState('');\n const [provider, setProvider] = useState(PROVIDER_DEFAULT);\n const [validationError, setValidationError] = useState<string | null>(null);\n const [result, setResult] = useState<LabSuggestedProtocolResult | null>(null);\n\n const targets =\n targetKind === 'project'\n ? (projects.data?.items ?? []).map((project) => ({ id: project.id, label: project.name }))\n : (experiments.data?.items ?? []).map((experiment) => ({\n id: experiment.id,\n label: experiment.title,\n }));\n\n const handleSubmit = async () => {\n if (!targetId) {\n setValidationError(`Choose a ${targetKind} to design the method for.`);\n return;\n }\n if (!objective.trim()) {\n setValidationError('Describe what the method has to achieve.');\n return;\n }\n setValidationError(null);\n try {\n const suggestion = await suggest.mutateAsync({\n projectId: targetKind === 'project' ? targetId : undefined,\n experimentId: targetKind === 'experiment' ? targetId : undefined,\n objective: objective.trim(),\n constraints: constraints.trim() || undefined,\n requestedProvider: provider === PROVIDER_DEFAULT ? undefined : provider,\n });\n setResult(suggestion);\n } catch {\n // Rendered from `suggest.error` so the typed AI_PROVIDER_UNAVAILABLE code\n // and its agentRunId survive to the notice.\n }\n };\n\n return (\n <>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Suggest a protocol</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n The AI designs a reusable method and saves it as a draft protocol with ordered steps. You\n review and publish it — nothing is published for you.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n {result ? (\n <div className=\"space-y-4 py-2\">\n <div className=\"rounded-lg border border-border-seam bg-bg-sunken p-4\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <p className=\"truncate font-medium text-text-primary\">{result.protocol.name}</p>\n <p className=\"mt-0.5 text-xs text-text-tertiary\">\n v{result.protocol.version} · {result.stepCount} step\n {result.stepCount === 1 ? '' : 's'}\n </p>\n </div>\n <StatusBadge status={result.protocol.status} />\n </div>\n {result.protocol.summary && (\n <p className=\"mt-2 text-sm text-text-secondary\">{result.protocol.summary}</p>\n )}\n </div>\n <p className=\"text-sm text-text-secondary\">\n This landed as a <strong className=\"text-text-primary\">draft</strong>. It is not\n published, nothing at the bench has changed, and no experiment is using it. Open the\n draft to check the steps and safety notes, then publish it when you are satisfied.\n </p>\n <p className=\"text-xs text-text-tertiary\">\n Recorded in the decision feed as{' '}\n <span className=\"break-all font-mono\">{result.agentRunId}</span>.\n </p>\n </div>\n ) : (\n <div className=\"space-y-4 py-2\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"suggest-target-kind\">Design it for</Label>\n <Select\n value={targetKind}\n onValueChange={(value) => {\n setTargetKind(value as ProtocolTargetKind);\n setTargetId('');\n }}\n >\n <SelectTrigger id=\"suggest-target-kind\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"project\">A project</SelectItem>\n <SelectItem value=\"experiment\">An experiment</SelectItem>\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"suggest-target\">\n {targetKind === 'project' ? 'Project' : 'Experiment'}\n </Label>\n <Select value={targetId} onValueChange={setTargetId}>\n <SelectTrigger id=\"suggest-target\">\n <SelectValue\n placeholder={\n targetKind === 'project' ? 'Select a project' : 'Select an experiment'\n }\n />\n </SelectTrigger>\n <SelectContent>\n {targets.map((target) => (\n <SelectItem key={target.id} value={target.id}>\n {target.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n {targets.length === 0 && (\n <p className=\"text-xs text-text-tertiary\">\n No {targetKind === 'project' ? 'projects' : 'experiments'} in this workspace yet.\n </p>\n )}\n </div>\n\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"suggest-objective\">Objective</Label>\n <Textarea\n id=\"suggest-objective\"\n value={objective}\n onChange={(event) => setObjective(event.target.value)}\n placeholder=\"Quantify protein yield after a 24h induction, reproducibly across three replicates.\"\n rows={3}\n />\n </div>\n\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"suggest-constraints\">Constraints (optional)</Label>\n <Textarea\n id=\"suggest-constraints\"\n value={constraints}\n onChange={(event) => setConstraints(event.target.value)}\n placeholder=\"Bench instruments only, under 4 hours, no hazardous solvents.\"\n rows={2}\n />\n </div>\n\n <ProviderSelect id=\"suggest-provider\" value={provider} onChange={setProvider} />\n\n {validationError && <p className=\"text-sm text-status-error-text\">{validationError}</p>}\n <AiErrorNotice error={suggest.error} fallback=\"Failed to design a protocol.\" />\n </div>\n )}\n\n <ResponsiveDialogFooter>\n {result ? (\n <>\n <Button variant=\"outline\" onClick={onClose}>\n Close\n </Button>\n <Button\n onClick={() => {\n onClose();\n onViewProtocol(result.protocol.id);\n }}\n >\n <FileText className=\"mr-2 h-4 w-4\" />\n Open draft protocol\n </Button>\n </>\n ) : (\n <>\n <Button variant=\"outline\" onClick={onClose} disabled={suggest.isPending}>\n Cancel\n </Button>\n <Button onClick={() => void handleSubmit()} disabled={suggest.isPending}>\n <Sparkles className=\"mr-2 h-4 w-4\" />\n {suggest.isPending ? 'Designing…' : 'Design draft'}\n </Button>\n </>\n )}\n </ResponsiveDialogFooter>\n </>\n );\n}\n\nexport function SuggestProtocolDialog({\n open,\n onOpenChange,\n onViewProtocol,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n onViewProtocol: (protocolId: string) => void;\n}) {\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent className=\"max-h-[90vh] max-w-lg overflow-y-auto\">\n {open && (\n <SuggestProtocolForm\n onClose={() => onOpenChange(false)}\n onViewProtocol={onViewProtocol}\n />\n )}\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Recommend the next run\n// ---------------------------------------------------------------------------\n\nfunction RecommendNextRunForm({\n initialExperimentId,\n onClose,\n onViewExperiment,\n}: {\n initialExperimentId: string | null;\n onClose: () => void;\n onViewExperiment: (experimentId: string) => void;\n}) {\n const recommend = useRecommendNextRun();\n const experiments = useExperiments({ pagination: { limit: PICKER_LIMIT, offset: 0 } });\n\n const [experimentId, setExperimentId] = useState(initialExperimentId ?? '');\n const [provider, setProvider] = useState(PROVIDER_DEFAULT);\n const [validationError, setValidationError] = useState<string | null>(null);\n const [result, setResult] = useState<LabRunRecommendationResult | null>(null);\n\n const handleSubmit = async () => {\n if (!experimentId) {\n setValidationError('Choose the experiment to assess.');\n return;\n }\n setValidationError(null);\n try {\n const recommendation = await recommend.mutateAsync({\n experimentId,\n requestedProvider: provider === PROVIDER_DEFAULT ? undefined : provider,\n });\n setResult(recommendation);\n } catch {\n // Rendered from `recommend.error`.\n }\n };\n\n return (\n <>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Recommend the next run</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n The AI reads this experiment&apos;s recent runs and proposes what to do next. It starts no\n run and changes no experiment design.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n {result ? (\n <div className=\"space-y-4 py-2\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge status={result.recommendation} />\n <span className=\"text-xs text-text-tertiary\">\n Confidence {formatConfidence(result.confidence)}\n </span>\n </div>\n <p className=\"text-sm text-text-secondary\">{result.rationale}</p>\n {result.flags.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\">\n {result.flags.map((flag) => (\n <span\n key={flag}\n className=\"rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary\"\n >\n {flag}\n </span>\n ))}\n </div>\n )}\n {result.recommendation === 'ADJUST_PARAMETERS' && (\n <div>\n <p className=\"mb-1.5 text-xs font-medium uppercase tracking-wide text-text-tertiary\">\n Suggested parameters\n </p>\n <JsonBlock\n value={result.suggestedParameters}\n emptyLabel=\"No specific parameter values were proposed\"\n />\n </div>\n )}\n <p className=\"text-sm text-text-secondary\">\n {result.appliedToExperiment\n ? 'Recorded on the experiment as a proposal (status PROPOSED). Nothing is applied until a researcher resolves it.'\n : 'The recommendation was produced but could not be recorded on the experiment — it is still in the decision feed.'}\n </p>\n <p className=\"text-xs text-text-tertiary\">\n Recorded in the decision feed as{' '}\n <span className=\"break-all font-mono\">{result.agentRunId}</span>.\n </p>\n </div>\n ) : (\n <div className=\"space-y-4 py-2\">\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"recommend-experiment\">Experiment</Label>\n <Select value={experimentId} onValueChange={setExperimentId}>\n <SelectTrigger id=\"recommend-experiment\">\n <SelectValue placeholder=\"Select an experiment\" />\n </SelectTrigger>\n <SelectContent>\n {(experiments.data?.items ?? []).map((experiment) => (\n <SelectItem key={experiment.id} value={experiment.id}>\n {experiment.title}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className=\"text-xs text-text-tertiary\">\n The experiment needs at least one recorded run — there is nothing to reason over\n otherwise.\n </p>\n </div>\n\n <ProviderSelect id=\"recommend-provider\" value={provider} onChange={setProvider} />\n\n {validationError && <p className=\"text-sm text-status-error-text\">{validationError}</p>}\n <AiErrorNotice error={recommend.error} fallback=\"Failed to produce a recommendation.\" />\n </div>\n )}\n\n <ResponsiveDialogFooter>\n {result ? (\n <>\n <Button variant=\"outline\" onClick={onClose}>\n Close\n </Button>\n <Button\n onClick={() => {\n onClose();\n onViewExperiment(result.experimentId);\n }}\n >\n Open experiment\n <ArrowRight className=\"ml-2 h-4 w-4\" />\n </Button>\n </>\n ) : (\n <>\n <Button variant=\"outline\" onClick={onClose} disabled={recommend.isPending}>\n Cancel\n </Button>\n <Button onClick={() => void handleSubmit()} disabled={recommend.isPending}>\n <Sparkles className=\"mr-2 h-4 w-4\" />\n {recommend.isPending ? 'Assessing…' : 'Assess runs'}\n </Button>\n </>\n )}\n </ResponsiveDialogFooter>\n </>\n );\n}\n\nexport function RecommendNextRunDialog({\n open,\n onOpenChange,\n initialExperimentId = null,\n onViewExperiment,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Prefilled when opened from a decision card that names an experiment. */\n initialExperimentId?: string | null;\n onViewExperiment: (experimentId: string) => void;\n}) {\n return (\n <ResponsiveDialog open={open} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent className=\"max-h-[90vh] max-w-lg overflow-y-auto\">\n {open && (\n <RecommendNextRunForm\n initialExperimentId={initialExperimentId}\n onClose={() => onOpenChange(false)}\n onViewExperiment={onViewExperiment}\n />\n )}\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Researcher override\n// ---------------------------------------------------------------------------\n\nfunction OverrideDecisionForm({ run, onClose }: { run: LabAgentRun; onClose: () => void }) {\n const override = useOverrideAgentRun();\n const experiments = useExperiments({ pagination: { limit: PICKER_LIMIT, offset: 0 } });\n\n const decision = describeDecision(run.decision);\n const proposed =\n decision.kind === 'recommendation' || decision.kind === 'override'\n ? decision.recommendation\n : null;\n const inferredExperimentId = experimentIdOfRun(run);\n\n // What the experiment carries *right now*. A researcher overriding a decision\n // needs to know whether this row is still the live read (PROPOSED) or was\n // already resolved by someone else (OVERRIDDEN) — the ledger page alone\n // cannot answer that, because a later row supersedes an earlier one without\n // changing it.\n const experimentContext = useExperimentAiContext(inferredExperimentId ?? undefined);\n const currentRead = readLastAiRecommendation(experimentContext.data?.context);\n\n const [experimentId, setExperimentId] = useState(inferredExperimentId ?? '');\n const [recommendation, setRecommendation] = useState<LabRunRecommendation>(\n proposed ?? 'REPLICATE'\n );\n const [note, setNote] = useState('');\n const [validationError, setValidationError] = useState<string | null>(null);\n const [saved, setSaved] = useState(false);\n\n const handleSubmit = async () => {\n if (!experimentId) {\n setValidationError('Choose the experiment this decision applies to.');\n return;\n }\n if (!note.trim()) {\n setValidationError('Say why you are overriding — the note is the audit trail.');\n return;\n }\n setValidationError(null);\n try {\n await override.mutateAsync({\n runId: run.id,\n experimentId,\n recommendation,\n note: note.trim(),\n });\n setSaved(true);\n } catch {\n // Rendered from `override.error`.\n }\n };\n\n return (\n <>\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle>Record your call</ResponsiveDialogTitle>\n <ResponsiveDialogDescription>\n Your decision is appended to the ledger as a new entry that supersedes this one. The\n original is never edited.\n </ResponsiveDialogDescription>\n </ResponsiveDialogHeader>\n\n {saved ? (\n <div className=\"space-y-3 py-2\">\n <p className=\"text-sm text-text-secondary\">\n Recorded. The experiment now carries your call (status OVERRIDDEN) alongside what the\n model proposed, so &quot;did the researcher agree?&quot; stays answerable.\n </p>\n </div>\n ) : (\n <div className=\"space-y-4 py-2\">\n {proposed && (\n <div className=\"rounded-lg border border-border-seam bg-bg-sunken p-3\">\n <p className=\"text-xs font-medium uppercase tracking-wide text-text-tertiary\">\n The model proposed\n </p>\n <div className=\"mt-1.5\">\n <StatusBadge status={proposed} />\n </div>\n </div>\n )}\n\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"override-experiment\">Experiment</Label>\n {inferredExperimentId ? (\n <div\n id=\"override-experiment\"\n className=\"rounded-lg border border-border-seam bg-bg-sunken p-3\"\n >\n <p className=\"truncate text-sm font-medium text-text-primary\">\n {experimentContext.data?.title ?? inferredExperimentId}\n </p>\n {currentRead ? (\n <div className=\"mt-1.5 flex flex-wrap items-center gap-2\">\n <span className=\"text-xs text-text-tertiary\">Currently carries</span>\n {currentRead.recommendation && (\n <StatusBadge status={currentRead.recommendation} />\n )}\n {currentRead.status && <StatusBadge status={currentRead.status} />}\n </div>\n ) : (\n <p className=\"mt-1 text-xs text-text-tertiary\">\n {experimentContext.isLoading\n ? 'Checking what this experiment currently carries…'\n : 'No AI read is recorded on this experiment yet.'}\n </p>\n )}\n </div>\n ) : (\n <Select value={experimentId} onValueChange={setExperimentId}>\n <SelectTrigger id=\"override-experiment\">\n <SelectValue placeholder=\"Select an experiment\" />\n </SelectTrigger>\n <SelectContent>\n {(experiments.data?.items ?? []).map((experiment) => (\n <SelectItem key={experiment.id} value={experiment.id}>\n {experiment.title}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n {!inferredExperimentId && (\n <p className=\"text-xs text-text-tertiary\">\n This entry does not name an experiment, so choose the one your call applies to.\n </p>\n )}\n </div>\n\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"override-recommendation\">Your call</Label>\n <Select\n value={recommendation}\n onValueChange={(value) => setRecommendation(value as LabRunRecommendation)}\n >\n <SelectTrigger id=\"override-recommendation\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {RECOMMENDATIONS.map((option) => (\n <SelectItem key={option} value={option}>\n {titleCase(option)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"space-y-1.5\">\n <Label htmlFor=\"override-note\">Note</Label>\n <Textarea\n id=\"override-note\"\n value={note}\n onChange={(event) => setNote(event.target.value)}\n placeholder=\"The replicate variance is instrument drift, not a real effect — recalibrate and repeat.\"\n rows={3}\n />\n </div>\n\n {validationError && <p className=\"text-sm text-status-error-text\">{validationError}</p>}\n <AiErrorNotice error={override.error} fallback=\"Failed to record the override.\" />\n </div>\n )}\n\n <ResponsiveDialogFooter>\n {saved ? (\n <Button onClick={onClose}>Done</Button>\n ) : (\n <>\n <Button variant=\"outline\" onClick={onClose} disabled={override.isPending}>\n Cancel\n </Button>\n <Button onClick={() => void handleSubmit()} disabled={override.isPending}>\n {override.isPending ? 'Recording…' : 'Record override'}\n </Button>\n </>\n )}\n </ResponsiveDialogFooter>\n </>\n );\n}\n\nexport function OverrideDecisionDialog({\n run,\n onOpenChange,\n}: {\n /** The ledger row being reviewed; null closes the dialog. */\n run: LabAgentRun | null;\n onOpenChange: (open: boolean) => void;\n}) {\n return (\n <ResponsiveDialog open={run !== null} onOpenChange={onOpenChange}>\n <ResponsiveDialogContent className=\"max-h-[90vh] max-w-lg overflow-y-auto\">\n {/* Keyed on the row so reviewing a second decision starts from a clean form. */}\n {run && <OverrideDecisionForm key={run.id} run={run} onClose={() => onOpenChange(false)} />}\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;AAqEA,IAAM,IAAmB,qBAEnB,IAAe,KAEf,IAA0C;CAC9C;CACA;CACA;CACA;AACF;AAOA,SAAS,EAAe,EACtB,OACA,UACA,eAKC;CACD,IAAM,IAAU,EAAkB,GAC5B,IAAY,QACV,CAAC,GAAG,IAAI,KAAK,EAAQ,QAAQ,CAAC,EAAA,CAAG,KAAK,MAAU,EAAM,QAAQ,CAAC,CAAC,GACtE,CAAC,EAAQ,IAAI,CACf;CAEA,OACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,GAAD;IAAO,SAAS;cAAI;GAA0B,CAAA;GAC9C,kBAAC,GAAD;IAAe;IAAO,eAAe;cAArC,CACE,kBAAC,GAAD;KAAmB;eACjB,kBAAC,GAAD,CAAc,CAAA;IACD,CAAA,GACf,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAY,OAAO;eAAkB;IAA6B,CAAA,GACjE,EAAU,KAAK,MACd,kBAAC,GAAD;KAA2B,OAAO;eAC/B,EAAU,CAAQ;IACT,GAFK,CAEL,CACb,CACY,EAAA,CAAA,CACT;;GACR,kBAAC,KAAD;IAAG,WAAU;cAA6B;GAGvC,CAAA;EACA;;AAET;AAQA,SAAS,EAAoB,EAC3B,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