@burdenoff/microfe-atheletebridge 2026.1124.1 → 2026.1128.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.
- package/dist/atheletebridge/admin/AdminDashboardPage.js +4 -0
- package/dist/atheletebridge/admin/AdminDashboardPage.js.map +1 -1
- package/dist/atheletebridge/components/AthleteSelect.js +23 -22
- package/dist/atheletebridge/components/AthleteSelect.js.map +1 -1
- package/dist/atheletebridge/components/EmptyState.d.ts +8 -0
- package/dist/atheletebridge/components/EmptyState.js +42 -29
- package/dist/atheletebridge/components/EmptyState.js.map +1 -1
- package/dist/atheletebridge/components/FilterSelect.js +10 -9
- package/dist/atheletebridge/components/FilterSelect.js.map +1 -1
- package/dist/atheletebridge/components/ai/AgentRunFeed.js.map +1 -1
- package/dist/atheletebridge/components/ai/AiModelPicker.js +49 -49
- package/dist/atheletebridge/components/ai/AiModelPicker.js.map +1 -1
- package/dist/atheletebridge/components/ai/DecisionCard.js +16 -16
- package/dist/atheletebridge/components/ai/DecisionCard.js.map +1 -1
- package/dist/atheletebridge/components/ai/RunDecisionPanel.js +42 -42
- package/dist/atheletebridge/components/ai/RunDecisionPanel.js.map +1 -1
- package/dist/atheletebridge/components/analytics/AiInsightsPanel.js +52 -52
- package/dist/atheletebridge/components/analytics/AiInsightsPanel.js.map +1 -1
- package/dist/atheletebridge/components/registration/RegistrationEntryFields.js +24 -23
- package/dist/atheletebridge/components/registration/RegistrationEntryFields.js.map +1 -1
- package/dist/atheletebridge/components/wearables/ConnectedDevicesPanel.js.map +1 -1
- package/dist/atheletebridge/pages/DashboardPage.js.map +1 -1
- package/dist/atheletebridge/pages/StandingsPage.js.map +1 -1
- package/dist/atheletebridge/pages/analytics/CoachAnalyticsPage.js.map +1 -1
- package/dist/atheletebridge/pages/athletes/AthleteProfilePage.js +1 -0
- package/dist/atheletebridge/pages/athletes/AthleteProfilePage.js.map +1 -1
- package/dist/atheletebridge/pages/audit/AuditLogPage.js +1 -0
- package/dist/atheletebridge/pages/audit/AuditLogPage.js.map +1 -1
- package/dist/atheletebridge/pages/fixtures/FixtureDetailPage.js.map +1 -1
- package/dist/atheletebridge/pages/fixtures/FixtureFormPage.js +56 -56
- package/dist/atheletebridge/pages/fixtures/FixtureFormPage.js.map +1 -1
- package/dist/atheletebridge/pages/fixtures/FixturesListPage.js +1 -0
- package/dist/atheletebridge/pages/fixtures/FixturesListPage.js.map +1 -1
- package/dist/atheletebridge/pages/marketplace/MarketplacePage.js +97 -97
- package/dist/atheletebridge/pages/marketplace/MarketplacePage.js.map +1 -1
- package/dist/atheletebridge/pages/onboarding/OnboardingPage.js +34 -34
- package/dist/atheletebridge/pages/onboarding/OnboardingPage.js.map +1 -1
- package/dist/atheletebridge/pages/performance/PerformancePage.js +182 -182
- package/dist/atheletebridge/pages/performance/PerformancePage.js.map +1 -1
- package/dist/atheletebridge/pages/programs/ProgramDetailPage.js +13 -13
- package/dist/atheletebridge/pages/programs/ProgramDetailPage.js.map +1 -1
- package/dist/atheletebridge/pages/programs/ProgramFormPage.js +61 -60
- package/dist/atheletebridge/pages/programs/ProgramFormPage.js.map +1 -1
- package/dist/atheletebridge/pages/programs/ProgramsListPage.js +1 -0
- package/dist/atheletebridge/pages/programs/ProgramsListPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.js +26 -21
- package/dist/atheletebridge/pages/registrations/MyRegistrationsPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegisterPage.js +1 -0
- package/dist/atheletebridge/pages/registrations/RegisterPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationFormBuilderPage.js +205 -204
- package/dist/atheletebridge/pages/registrations/RegistrationFormBuilderPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationFormDetailPage.js +121 -115
- package/dist/atheletebridge/pages/registrations/RegistrationFormDetailPage.js.map +1 -1
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js +59 -40
- package/dist/atheletebridge/pages/registrations/RegistrationSubmissionPage.js.map +1 -1
- package/dist/atheletebridge/pages/sessions/SessionFormPage.js +59 -59
- package/dist/atheletebridge/pages/sessions/SessionFormPage.js.map +1 -1
- package/dist/atheletebridge/pages/sessions/SessionsListPage.js +1 -0
- package/dist/atheletebridge/pages/sessions/SessionsListPage.js.map +1 -1
- package/dist/atheletebridge/pages/teams/TeamDetailPage.js +143 -143
- package/dist/atheletebridge/pages/teams/TeamDetailPage.js.map +1 -1
- package/dist/atheletebridge/pages/teams/TeamFormPage.js +72 -72
- package/dist/atheletebridge/pages/teams/TeamFormPage.js.map +1 -1
- package/dist/atheletebridge/pages/teams/TeamsListPage.js +1 -0
- package/dist/atheletebridge/pages/teams/TeamsListPage.js.map +1 -1
- package/dist/atheletebridge/pages/tournaments/TournamentBracketPage.js.map +1 -1
- package/package.json +3 -3
|
@@ -6,24 +6,24 @@ import { AiErrorNotice as c } from "./AiErrorNotice.js";
|
|
|
6
6
|
import { useMemo as l, useState as u } from "react";
|
|
7
7
|
import { Bot as d, Check as f, Cpu as p, Loader2 as m, Save as h } from "lucide-react";
|
|
8
8
|
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
9
|
-
import { Badge as y, GlassCard as b, Switch as x } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { Badge as y, GlassCard as b, Switch as x, ThemedSelect as S } from "@burdenoff/fe-libs/ui";
|
|
10
10
|
// src/atheletebridge/components/ai/AiModelPicker.tsx
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
let e =
|
|
15
|
-
return !e ||
|
|
11
|
+
var C = (e) => `${e.provider}::${e.model}`;
|
|
12
|
+
function w({ className: w }) {
|
|
13
|
+
let T = n(), E = a(), D = r(), O = i(), [k, A] = u(null), j = l(() => T.data ?? [], [T.data]), M = l(() => j.find((e) => e.isDefault) ?? null, [j]), N = E.data ? C(E.data) : M ? C(M) : "", P = l(() => {
|
|
14
|
+
let e = E.data;
|
|
15
|
+
return !e || j.some((t) => C(t) === C(e)) ? j : [{
|
|
16
16
|
provider: e.provider,
|
|
17
17
|
model: e.model,
|
|
18
18
|
label: "Retired model saved by this workspace",
|
|
19
19
|
isDefault: !1,
|
|
20
20
|
capabilities: [],
|
|
21
21
|
configured: !1
|
|
22
|
-
}, ...
|
|
23
|
-
}, [
|
|
22
|
+
}, ...j];
|
|
23
|
+
}, [j, E.data]), F = k ?? N, I = P.find((e) => C(e) === F) ?? null, L = !!k && k !== N, R = E.data?.autoPilotEnabled ?? !1, z = E.data?.autoPilotLastRunAt ?? null;
|
|
24
24
|
return /* @__PURE__ */ _(b, {
|
|
25
25
|
treatment: "insight",
|
|
26
|
-
className:
|
|
26
|
+
className: w,
|
|
27
27
|
children: /* @__PURE__ */ v("div", {
|
|
28
28
|
className: "p-6",
|
|
29
29
|
children: [
|
|
@@ -51,17 +51,17 @@ function C({ className: C }) {
|
|
|
51
51
|
children: [/* @__PURE__ */ _(e, {
|
|
52
52
|
label: "Provider and model",
|
|
53
53
|
htmlFor: "ai-model",
|
|
54
|
-
children: /* @__PURE__ */ v(
|
|
54
|
+
children: /* @__PURE__ */ v(S, {
|
|
55
55
|
id: "ai-model",
|
|
56
56
|
className: t,
|
|
57
|
-
value:
|
|
58
|
-
disabled:
|
|
59
|
-
onChange: (e) =>
|
|
60
|
-
children: [
|
|
57
|
+
value: F,
|
|
58
|
+
disabled: T.isLoading || P.length === 0,
|
|
59
|
+
onChange: (e) => A(e.target.value),
|
|
60
|
+
children: [P.length === 0 && /* @__PURE__ */ _("option", {
|
|
61
61
|
value: "",
|
|
62
62
|
children: "No models available"
|
|
63
|
-
}),
|
|
64
|
-
value:
|
|
63
|
+
}), P.map((e) => /* @__PURE__ */ v("option", {
|
|
64
|
+
value: C(e),
|
|
65
65
|
children: [
|
|
66
66
|
e.label,
|
|
67
67
|
" — ",
|
|
@@ -71,79 +71,79 @@ function C({ className: C }) {
|
|
|
71
71
|
e.isDefault ? " (default)" : "",
|
|
72
72
|
e.configured ? "" : " (not available on this deployment)"
|
|
73
73
|
]
|
|
74
|
-
},
|
|
74
|
+
}, C(e)))]
|
|
75
75
|
})
|
|
76
76
|
}), /* @__PURE__ */ v("button", {
|
|
77
77
|
type: "button",
|
|
78
78
|
onClick: () => {
|
|
79
|
-
|
|
80
|
-
provider:
|
|
81
|
-
model:
|
|
82
|
-
}, { onSuccess: () =>
|
|
79
|
+
I && D.mutate({
|
|
80
|
+
provider: I.provider,
|
|
81
|
+
model: I.model
|
|
82
|
+
}, { onSuccess: () => A(null) });
|
|
83
83
|
},
|
|
84
|
-
disabled: !
|
|
84
|
+
disabled: !L || !I || D.isPending,
|
|
85
85
|
className: "inline-flex h-[2.625rem] items-center justify-center gap-1.5 rounded-lg bg-action-primary-bg px-4 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:cursor-not-allowed disabled:opacity-60",
|
|
86
|
-
children: [
|
|
86
|
+
children: [D.isPending ? /* @__PURE__ */ _(m, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ _(h, { className: "h-4 w-4" }), "Save model"]
|
|
87
87
|
})]
|
|
88
88
|
}),
|
|
89
89
|
/* @__PURE__ */ v("div", {
|
|
90
90
|
className: "mt-3 flex flex-wrap items-center gap-2 text-sm text-text-secondary",
|
|
91
|
-
children: [
|
|
91
|
+
children: [E.isLoading ? /* @__PURE__ */ v("span", {
|
|
92
92
|
className: "inline-flex items-center gap-1.5",
|
|
93
93
|
children: [/* @__PURE__ */ _(m, { className: "h-3.5 w-3.5 animate-spin" }), " Loading workspace configuration…"]
|
|
94
|
-
}) :
|
|
94
|
+
}) : E.data ? /* @__PURE__ */ v(g, { children: [
|
|
95
95
|
/* @__PURE__ */ _("span", { children: "In use:" }),
|
|
96
96
|
/* @__PURE__ */ v(y, {
|
|
97
97
|
variant: "secondary",
|
|
98
98
|
children: [
|
|
99
|
-
|
|
99
|
+
E.data.provider,
|
|
100
100
|
"/",
|
|
101
|
-
|
|
101
|
+
E.data.model
|
|
102
102
|
]
|
|
103
103
|
}),
|
|
104
|
-
|
|
104
|
+
I?.isDefault && N === C(I) && /* @__PURE__ */ _(y, {
|
|
105
105
|
variant: "outline",
|
|
106
106
|
children: "Platform default"
|
|
107
107
|
}),
|
|
108
108
|
/* @__PURE__ */ v("span", {
|
|
109
109
|
className: "text-xs text-text-muted",
|
|
110
|
-
children: ["Saved ", s(
|
|
110
|
+
children: ["Saved ", s(E.data.updatedAt)]
|
|
111
111
|
})
|
|
112
112
|
] }) : /* @__PURE__ */ v("span", { children: [
|
|
113
113
|
"This workspace has not chosen a model, so decisions run on the platform default chain",
|
|
114
|
-
|
|
114
|
+
M ? ` (${M.provider}/${M.model})` : "",
|
|
115
115
|
"."
|
|
116
|
-
] }),
|
|
116
|
+
] }), D.isSuccess && !L && /* @__PURE__ */ v("span", {
|
|
117
117
|
className: "inline-flex items-center gap-1 text-xs text-status-success-text",
|
|
118
118
|
children: [/* @__PURE__ */ _(f, { className: "h-3.5 w-3.5" }), " Saved"]
|
|
119
119
|
})]
|
|
120
120
|
}),
|
|
121
|
-
|
|
121
|
+
I && !I.configured && /* @__PURE__ */ v("p", {
|
|
122
122
|
role: "status",
|
|
123
123
|
className: "mt-3 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text",
|
|
124
124
|
children: [
|
|
125
|
-
|
|
125
|
+
I.provider,
|
|
126
126
|
"/",
|
|
127
|
-
|
|
127
|
+
I.model,
|
|
128
128
|
" cannot be called on this deployment (no API key is configured for ",
|
|
129
|
-
|
|
129
|
+
I.provider,
|
|
130
130
|
"). Decisions will run on the next available provider, and the agent activity feed shows which model answered each one."
|
|
131
131
|
]
|
|
132
132
|
}),
|
|
133
|
-
|
|
133
|
+
I && I.capabilities.length > 0 && /* @__PURE__ */ _("div", {
|
|
134
134
|
className: "mt-2 flex flex-wrap gap-1.5",
|
|
135
|
-
children:
|
|
135
|
+
children: I.capabilities.map((e) => /* @__PURE__ */ _("span", {
|
|
136
136
|
className: "inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
|
|
137
137
|
children: e
|
|
138
138
|
}, e))
|
|
139
139
|
}),
|
|
140
|
-
|
|
140
|
+
T.isError && /* @__PURE__ */ _(c, {
|
|
141
141
|
className: "mt-4",
|
|
142
|
-
error:
|
|
142
|
+
error: T.error
|
|
143
143
|
}),
|
|
144
|
-
|
|
144
|
+
D.isError && /* @__PURE__ */ _(c, {
|
|
145
145
|
className: "mt-4",
|
|
146
|
-
error:
|
|
146
|
+
error: D.error
|
|
147
147
|
}),
|
|
148
148
|
/* @__PURE__ */ v("div", {
|
|
149
149
|
className: "mt-6 border-t border-border-seam pt-5",
|
|
@@ -188,22 +188,22 @@ function C({ className: C }) {
|
|
|
188
188
|
]
|
|
189
189
|
}), /* @__PURE__ */ v("div", {
|
|
190
190
|
className: "flex shrink-0 items-center gap-2 pt-1",
|
|
191
|
-
children: [
|
|
191
|
+
children: [O.isPending && /* @__PURE__ */ _(m, { className: "h-4 w-4 animate-spin text-text-secondary" }), /* @__PURE__ */ _(x, {
|
|
192
192
|
id: "ai-autopilot",
|
|
193
|
-
checked:
|
|
194
|
-
disabled:
|
|
195
|
-
onCheckedChange: (e) =>
|
|
193
|
+
checked: R,
|
|
194
|
+
disabled: E.isLoading || O.isPending,
|
|
195
|
+
onCheckedChange: (e) => O.mutate(e),
|
|
196
196
|
"aria-label": "Enable autopilot for this workspace"
|
|
197
197
|
})]
|
|
198
198
|
})]
|
|
199
199
|
}),
|
|
200
200
|
/* @__PURE__ */ _("p", {
|
|
201
201
|
className: "mt-3 text-xs text-text-muted",
|
|
202
|
-
children:
|
|
202
|
+
children: z ? `A scheduled tick last considered this workspace on ${o(z)} (${s(z)}).` : "No scheduled tick has considered this workspace yet."
|
|
203
203
|
}),
|
|
204
|
-
|
|
204
|
+
O.isError && /* @__PURE__ */ _(c, {
|
|
205
205
|
className: "mt-4",
|
|
206
|
-
error:
|
|
206
|
+
error: O.error
|
|
207
207
|
})
|
|
208
208
|
]
|
|
209
209
|
})
|
|
@@ -211,6 +211,6 @@ function C({ className: C }) {
|
|
|
211
211
|
})
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
|
-
export {
|
|
214
|
+
export { w as AiModelPicker };
|
|
215
215
|
|
|
216
216
|
//# sourceMappingURL=AiModelPicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiModelPicker.js","names":["_Fragment","optionKey","entry","AiModelPicker","catalog","useAiModelCatalog","config","useWorkspaceAiConfig","setModel","useSetWorkspaceAiModel","setAutoPilot","useSetWorkspaceAutoPilot","draftKey","setDraftKey","useState","catalogEntries","useMemo","defaultEntry","savedKey","entries","saved","selectedKey","selectedEntry","isDirty","autoPilotEnabled","lastRunAt","GlassCard","Cpu","FormField","fieldInputClass","event","Loader2","Save","Fragment","Badge","timeAgo","Check","capability","AiErrorNotice","Bot","Switch","checked","formatDate"],"sources":["../../../../src/atheletebridge/components/ai/AiModelPicker.tsx"],"sourcesContent":["/**\n * AI model picker + autopilot control\n * @module atheletebridge/components/ai\n *\n * The workspace's saved (provider, model) pair — read from\n * `athWorkspaceAiConfig`, chosen from `athAiModelCatalog`, saved with\n * `athSetWorkspaceAiModel` — plus the per-workspace autopilot opt-in\n * (`athSetWorkspaceAutoPilot`).\n *\n * The autopilot copy is deliberately unglamorous. The loop only ever records a\n * PROPOSED adjustment that a coach still has to accept, and it is additionally\n * gated by the `ATHELETEBRIDGE_AGENT_LOOP_ENABLED` deployment kill switch,\n * which is OFF in production. A toggle that implies \"the AI now coaches for\n * you\" would be a lie in both directions, so it says exactly what it does.\n */\n\nimport { useMemo, useState } from 'react';\nimport { Bot, Check, Cpu, Loader2, Save } from 'lucide-react';\nimport { Badge, GlassCard, Switch } from '@burdenoff/fe-libs/ui';\nimport { FormField, fieldInputClass } from '../form';\nimport {\n useAiModelCatalog,\n useSetWorkspaceAiModel,\n useSetWorkspaceAutoPilot,\n useWorkspaceAiConfig,\n} from '../../hooks/useAthleteBridgeApi';\nimport type { AthAiModelInfo } from '../../types';\nimport { formatDate } from '../../utils/formatters';\nimport { timeAgo } from '../../utils/timeAgo';\nimport { AiErrorNotice } from './AiErrorNotice';\n\n/** Stable option key. Model ids are provider-specific, so both parts matter. */\nconst optionKey = (entry: Pick<AthAiModelInfo, 'provider' | 'model'>): string =>\n `${entry.provider}::${entry.model}`;\n\nexport function AiModelPicker({ className }: { className?: string }) {\n const catalog = useAiModelCatalog();\n const config = useWorkspaceAiConfig();\n const setModel = useSetWorkspaceAiModel();\n const setAutoPilot = useSetWorkspaceAutoPilot();\n\n const [draftKey, setDraftKey] = useState<string | null>(null);\n\n const catalogEntries = useMemo(() => catalog.data ?? [], [catalog.data]);\n const defaultEntry = useMemo(\n () => catalogEntries.find((entry) => entry.isDefault) ?? null,\n [catalogEntries]\n );\n\n // The saved pair, or the catalog default when the workspace has never chosen\n // one (a null config means \"using the platform default chain\", not an error).\n const savedKey = config.data\n ? optionKey(config.data)\n : defaultEntry\n ? optionKey(defaultEntry)\n : '';\n\n // A saved pair that is no longer in the catalog still has to be selectable,\n // or the select silently displays a DIFFERENT model than the one in force.\n const entries = useMemo(() => {\n const saved = config.data;\n if (!saved || catalogEntries.some((entry) => optionKey(entry) === optionKey(saved))) {\n return catalogEntries;\n }\n return [\n {\n provider: saved.provider,\n model: saved.model,\n label: 'Retired model saved by this workspace',\n isDefault: false,\n capabilities: [],\n // The service no longer calls a pair that has left the catalog; it\n // uses the provider's default model instead.\n configured: false,\n },\n ...catalogEntries,\n ];\n }, [catalogEntries, config.data]);\n const selectedKey = draftKey ?? savedKey;\n const selectedEntry = entries.find((entry) => optionKey(entry) === selectedKey) ?? null;\n const isDirty = Boolean(draftKey) && draftKey !== savedKey;\n\n const autoPilotEnabled = config.data?.autoPilotEnabled ?? false;\n const lastRunAt = config.data?.autoPilotLastRunAt ?? null;\n\n const handleSave = () => {\n if (!selectedEntry) {\n return;\n }\n setModel.mutate(\n { provider: selectedEntry.provider, model: selectedEntry.model },\n { onSuccess: () => setDraftKey(null) }\n );\n };\n\n return (\n <GlassCard treatment=\"insight\" className={className}>\n <div className=\"p-6\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-text-primary\">\n <Cpu className=\"h-5 w-5\" aria-hidden=\"true\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Model</h2>\n <p className=\"mt-1 text-sm text-text-secondary\">\n The provider and model every AthleteBridge decision runs on. A named provider is a\n first preference, not a lock — the service still falls back through the rest of the\n chain if it cannot answer.\n </p>\n </div>\n </div>\n\n <div className=\"mt-5 grid grid-cols-1 gap-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end\">\n <FormField label=\"Provider and model\" htmlFor=\"ai-model\">\n <select\n id=\"ai-model\"\n className={fieldInputClass}\n value={selectedKey}\n disabled={catalog.isLoading || entries.length === 0}\n onChange={(event) => setDraftKey(event.target.value)}\n >\n {entries.length === 0 && <option value=\"\">No models available</option>}\n {entries.map((entry) => (\n <option key={optionKey(entry)} value={optionKey(entry)}>\n {entry.label} — {entry.provider}/{entry.model}\n {entry.isDefault ? ' (default)' : ''}\n {entry.configured ? '' : ' (not available on this deployment)'}\n </option>\n ))}\n </select>\n </FormField>\n <button\n type=\"button\"\n onClick={handleSave}\n disabled={!isDirty || !selectedEntry || setModel.isPending}\n className=\"inline-flex h-[2.625rem] items-center justify-center gap-1.5 rounded-lg bg-action-primary-bg px-4 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n {setModel.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Save className=\"h-4 w-4\" />\n )}\n Save model\n </button>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2 text-sm text-text-secondary\">\n {config.isLoading ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" /> Loading workspace configuration…\n </span>\n ) : config.data ? (\n <>\n <span>In use:</span>\n <Badge variant=\"secondary\">\n {config.data.provider}/{config.data.model}\n </Badge>\n {selectedEntry?.isDefault && savedKey === optionKey(selectedEntry) && (\n <Badge variant=\"outline\">Platform default</Badge>\n )}\n <span className=\"text-xs text-text-muted\">\n Saved {timeAgo(config.data.updatedAt)}\n </span>\n </>\n ) : (\n <span>\n This workspace has not chosen a model, so decisions run on the platform default chain\n {defaultEntry ? ` (${defaultEntry.provider}/${defaultEntry.model})` : ''}.\n </span>\n )}\n {setModel.isSuccess && !isDirty && (\n <span className=\"inline-flex items-center gap-1 text-xs text-status-success-text\">\n <Check className=\"h-3.5 w-3.5\" /> Saved\n </span>\n )}\n </div>\n\n {selectedEntry && !selectedEntry.configured && (\n <p\n role=\"status\"\n className=\"mt-3 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text\"\n >\n {selectedEntry.provider}/{selectedEntry.model} cannot be called on this deployment (no\n API key is configured for {selectedEntry.provider}). Decisions will run on the next\n available provider, and the agent activity feed shows which model answered each one.\n </p>\n )}\n\n {selectedEntry && selectedEntry.capabilities.length > 0 && (\n <div className=\"mt-2 flex flex-wrap gap-1.5\">\n {selectedEntry.capabilities.map((capability) => (\n <span\n key={capability}\n className=\"inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary\"\n >\n {capability}\n </span>\n ))}\n </div>\n )}\n\n {catalog.isError && <AiErrorNotice className=\"mt-4\" error={catalog.error} />}\n {setModel.isError && <AiErrorNotice className=\"mt-4\" error={setModel.error} />}\n\n {/* Autopilot */}\n <div className=\"mt-6 border-t border-border-seam pt-5\">\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"min-w-0\">\n <label\n htmlFor=\"ai-autopilot\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary\"\n >\n <Bot className=\"h-4 w-4\" aria-hidden=\"true\" />\n Autopilot\n </label>\n <p className=\"mt-1 text-sm text-text-secondary\">\n When on, a scheduled tick may assess athletes on this workspace's programs and\n record a <strong className=\"font-medium text-text-primary\">PROPOSED</strong>{' '}\n adjustment. It never changes prescribed training load — a coach still has to accept\n or override every proposal.\n </p>\n <p className=\"mt-1 text-xs text-text-muted\">\n The loop is also gated per deployment by{' '}\n <code className=\"rounded bg-bg-sunken px-1 py-0.5 font-mono\">\n ATHELETEBRIDGE_AGENT_LOOP_ENABLED\n </code>\n , which is off in production. Turning this on alone does not start anything.\n </p>\n </div>\n <div className=\"flex shrink-0 items-center gap-2 pt-1\">\n {setAutoPilot.isPending && (\n <Loader2 className=\"h-4 w-4 animate-spin text-text-secondary\" />\n )}\n <Switch\n id=\"ai-autopilot\"\n checked={autoPilotEnabled}\n disabled={config.isLoading || setAutoPilot.isPending}\n onCheckedChange={(checked) => setAutoPilot.mutate(checked)}\n aria-label=\"Enable autopilot for this workspace\"\n />\n </div>\n </div>\n <p className=\"mt-3 text-xs text-text-muted\">\n {lastRunAt\n ? `A scheduled tick last considered this workspace on ${formatDate(lastRunAt)} (${timeAgo(lastRunAt)}).`\n : 'No scheduled tick has considered this workspace yet.'}\n </p>\n {setAutoPilot.isError && <AiErrorNotice className=\"mt-4\" error={setAutoPilot.error} />}\n </div>\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;;;;;AAgCA,IAAMC,KAAa,MACjB,GAAGC,EAAM,SAAS,IAAIA,EAAM;AAE9B,SAAgBC,EAAc,EAAE,gBAAqC;CACnE,IAAMC,IAAUC,EAAkB,GAC5BC,IAASC,EAAqB,GAC9BC,IAAWC,EAAuB,GAClCC,IAAeC,EAAyB,GAExC,CAACC,GAAUC,KAAeC,EAAwB,IAAI,GAEtDC,IAAiBC,QAAcZ,EAAQ,QAAQ,CAAC,GAAG,CAACA,EAAQ,IAAI,CAAC,GACjEa,IAAeD,QACbD,EAAe,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A;WAAE;WAAI;UAGhF;;SACH,kBAAC,KAAD;UAAG,WAAU;UAAb,UAAA;WAA4C;WACD;WACzC,kBAAC,QAAD;YAAM,WAAU;YAA6C,UAAA;WAEvD,CAAA;WAAC;UAEN;;QACA;OACL,CAAA,GAAA,kBAAC,OAAD;QAAK,WAAU;QAAf,UAAA,CACG7B,EAAa,aACZ,kBAACqB,GAAD,EAAS,WAAU,2CAA4C,CAAA,GAEjE,kBAACS,GAAD;SACE,IAAG;SACH,SAAShB;SACT,UAAUlB,EAAO,aAAaI,EAAa;SAC3C,kBAAkB,MAAYA,EAAa,OAAO+B,CAAO;SACzD,cAAW;QACZ,CAAA,CACE;OACF,CAAA,CAAA;;MACL,kBAAC,KAAD;OAAG,WAAU;OACV,UAAAhB,IACG,sDAAsDiB,EAAWjB,CAAS,EAAE,IAAIU,EAAQV,CAAS,EAAE,MACnG;MACH,CAAA;MACFf,EAAa,WAAW,kBAAC4B,GAAD;OAAe,WAAU;OAAO,OAAO5B,EAAa;MAAQ,CAAA;KAClF;;GACF;;CACI,CAAA;AAEf"}
|
|
1
|
+
{"version":3,"file":"AiModelPicker.js","names":["_Fragment","optionKey","entry","AiModelPicker","catalog","useAiModelCatalog","config","useWorkspaceAiConfig","setModel","useSetWorkspaceAiModel","setAutoPilot","useSetWorkspaceAutoPilot","draftKey","setDraftKey","useState","catalogEntries","useMemo","defaultEntry","savedKey","entries","saved","selectedKey","selectedEntry","isDirty","autoPilotEnabled","lastRunAt","GlassCard","Cpu","FormField","ThemedSelect","fieldInputClass","event","Loader2","Save","Fragment","Badge","timeAgo","Check","capability","AiErrorNotice","Bot","Switch","checked","formatDate"],"sources":["../../../../src/atheletebridge/components/ai/AiModelPicker.tsx"],"sourcesContent":["/**\n * AI model picker + autopilot control\n * @module atheletebridge/components/ai\n *\n * The workspace's saved (provider, model) pair — read from\n * `athWorkspaceAiConfig`, chosen from `athAiModelCatalog`, saved with\n * `athSetWorkspaceAiModel` — plus the per-workspace autopilot opt-in\n * (`athSetWorkspaceAutoPilot`).\n *\n * The autopilot copy is deliberately unglamorous. The loop only ever records a\n * PROPOSED adjustment that a coach still has to accept, and it is additionally\n * gated by the `ATHELETEBRIDGE_AGENT_LOOP_ENABLED` deployment kill switch,\n * which is OFF in production. A toggle that implies \"the AI now coaches for\n * you\" would be a lie in both directions, so it says exactly what it does.\n */\n\nimport { useMemo, useState } from 'react';\nimport { Bot, Check, Cpu, Loader2, Save } from 'lucide-react';\nimport { Badge, GlassCard, Switch, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport { FormField, fieldInputClass } from '../form';\nimport {\n useAiModelCatalog,\n useSetWorkspaceAiModel,\n useSetWorkspaceAutoPilot,\n useWorkspaceAiConfig,\n} from '../../hooks/useAthleteBridgeApi';\nimport type { AthAiModelInfo } from '../../types';\nimport { formatDate } from '../../utils/formatters';\nimport { timeAgo } from '../../utils/timeAgo';\nimport { AiErrorNotice } from './AiErrorNotice';\n\n/** Stable option key. Model ids are provider-specific, so both parts matter. */\nconst optionKey = (entry: Pick<AthAiModelInfo, 'provider' | 'model'>): string =>\n `${entry.provider}::${entry.model}`;\n\nexport function AiModelPicker({ className }: { className?: string }) {\n const catalog = useAiModelCatalog();\n const config = useWorkspaceAiConfig();\n const setModel = useSetWorkspaceAiModel();\n const setAutoPilot = useSetWorkspaceAutoPilot();\n\n const [draftKey, setDraftKey] = useState<string | null>(null);\n\n const catalogEntries = useMemo(() => catalog.data ?? [], [catalog.data]);\n const defaultEntry = useMemo(\n () => catalogEntries.find((entry) => entry.isDefault) ?? null,\n [catalogEntries]\n );\n\n // The saved pair, or the catalog default when the workspace has never chosen\n // one (a null config means \"using the platform default chain\", not an error).\n const savedKey = config.data\n ? optionKey(config.data)\n : defaultEntry\n ? optionKey(defaultEntry)\n : '';\n\n // A saved pair that is no longer in the catalog still has to be selectable,\n // or the select silently displays a DIFFERENT model than the one in force.\n const entries = useMemo(() => {\n const saved = config.data;\n if (!saved || catalogEntries.some((entry) => optionKey(entry) === optionKey(saved))) {\n return catalogEntries;\n }\n return [\n {\n provider: saved.provider,\n model: saved.model,\n label: 'Retired model saved by this workspace',\n isDefault: false,\n capabilities: [],\n // The service no longer calls a pair that has left the catalog; it\n // uses the provider's default model instead.\n configured: false,\n },\n ...catalogEntries,\n ];\n }, [catalogEntries, config.data]);\n const selectedKey = draftKey ?? savedKey;\n const selectedEntry = entries.find((entry) => optionKey(entry) === selectedKey) ?? null;\n const isDirty = Boolean(draftKey) && draftKey !== savedKey;\n\n const autoPilotEnabled = config.data?.autoPilotEnabled ?? false;\n const lastRunAt = config.data?.autoPilotLastRunAt ?? null;\n\n const handleSave = () => {\n if (!selectedEntry) {\n return;\n }\n setModel.mutate(\n { provider: selectedEntry.provider, model: selectedEntry.model },\n { onSuccess: () => setDraftKey(null) }\n );\n };\n\n return (\n <GlassCard treatment=\"insight\" className={className}>\n <div className=\"p-6\">\n <div className=\"flex items-start gap-3\">\n <div className=\"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-text-primary\">\n <Cpu className=\"h-5 w-5\" aria-hidden=\"true\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <h2 className=\"text-lg font-semibold text-text-primary\">Model</h2>\n <p className=\"mt-1 text-sm text-text-secondary\">\n The provider and model every AthleteBridge decision runs on. A named provider is a\n first preference, not a lock — the service still falls back through the rest of the\n chain if it cannot answer.\n </p>\n </div>\n </div>\n\n <div className=\"mt-5 grid grid-cols-1 gap-4 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end\">\n <FormField label=\"Provider and model\" htmlFor=\"ai-model\">\n <ThemedSelect\n id=\"ai-model\"\n className={fieldInputClass}\n value={selectedKey}\n disabled={catalog.isLoading || entries.length === 0}\n onChange={(event) => setDraftKey(event.target.value)}\n >\n {entries.length === 0 && <option value=\"\">No models available</option>}\n {entries.map((entry) => (\n <option key={optionKey(entry)} value={optionKey(entry)}>\n {entry.label} — {entry.provider}/{entry.model}\n {entry.isDefault ? ' (default)' : ''}\n {entry.configured ? '' : ' (not available on this deployment)'}\n </option>\n ))}\n </ThemedSelect>\n </FormField>\n <button\n type=\"button\"\n onClick={handleSave}\n disabled={!isDirty || !selectedEntry || setModel.isPending}\n className=\"inline-flex h-[2.625rem] items-center justify-center gap-1.5 rounded-lg bg-action-primary-bg px-4 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n {setModel.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Save className=\"h-4 w-4\" />\n )}\n Save model\n </button>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2 text-sm text-text-secondary\">\n {config.isLoading ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" /> Loading workspace configuration…\n </span>\n ) : config.data ? (\n <>\n <span>In use:</span>\n <Badge variant=\"secondary\">\n {config.data.provider}/{config.data.model}\n </Badge>\n {selectedEntry?.isDefault && savedKey === optionKey(selectedEntry) && (\n <Badge variant=\"outline\">Platform default</Badge>\n )}\n <span className=\"text-xs text-text-muted\">\n Saved {timeAgo(config.data.updatedAt)}\n </span>\n </>\n ) : (\n <span>\n This workspace has not chosen a model, so decisions run on the platform default chain\n {defaultEntry ? ` (${defaultEntry.provider}/${defaultEntry.model})` : ''}.\n </span>\n )}\n {setModel.isSuccess && !isDirty && (\n <span className=\"inline-flex items-center gap-1 text-xs text-status-success-text\">\n <Check className=\"h-3.5 w-3.5\" /> Saved\n </span>\n )}\n </div>\n\n {selectedEntry && !selectedEntry.configured && (\n <p\n role=\"status\"\n className=\"mt-3 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text\"\n >\n {selectedEntry.provider}/{selectedEntry.model} cannot be called on this deployment (no\n API key is configured for {selectedEntry.provider}). Decisions will run on the next\n available provider, and the agent activity feed shows which model answered each one.\n </p>\n )}\n\n {selectedEntry && selectedEntry.capabilities.length > 0 && (\n <div className=\"mt-2 flex flex-wrap gap-1.5\">\n {selectedEntry.capabilities.map((capability) => (\n <span\n key={capability}\n className=\"inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary\"\n >\n {capability}\n </span>\n ))}\n </div>\n )}\n\n {catalog.isError && <AiErrorNotice className=\"mt-4\" error={catalog.error} />}\n {setModel.isError && <AiErrorNotice className=\"mt-4\" error={setModel.error} />}\n\n {/* Autopilot */}\n <div className=\"mt-6 border-t border-border-seam pt-5\">\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"min-w-0\">\n <label\n htmlFor=\"ai-autopilot\"\n className=\"flex items-center gap-2 text-sm font-medium text-text-primary\"\n >\n <Bot className=\"h-4 w-4\" aria-hidden=\"true\" />\n Autopilot\n </label>\n <p className=\"mt-1 text-sm text-text-secondary\">\n When on, a scheduled tick may assess athletes on this workspace's programs and\n record a <strong className=\"font-medium text-text-primary\">PROPOSED</strong>{' '}\n adjustment. It never changes prescribed training load — a coach still has to accept\n or override every proposal.\n </p>\n <p className=\"mt-1 text-xs text-text-muted\">\n The loop is also gated per deployment by{' '}\n <code className=\"rounded bg-bg-sunken px-1 py-0.5 font-mono\">\n ATHELETEBRIDGE_AGENT_LOOP_ENABLED\n </code>\n , which is off in production. Turning this on alone does not start anything.\n </p>\n </div>\n <div className=\"flex shrink-0 items-center gap-2 pt-1\">\n {setAutoPilot.isPending && (\n <Loader2 className=\"h-4 w-4 animate-spin text-text-secondary\" />\n )}\n <Switch\n id=\"ai-autopilot\"\n checked={autoPilotEnabled}\n disabled={config.isLoading || setAutoPilot.isPending}\n onCheckedChange={(checked) => setAutoPilot.mutate(checked)}\n aria-label=\"Enable autopilot for this workspace\"\n />\n </div>\n </div>\n <p className=\"mt-3 text-xs text-text-muted\">\n {lastRunAt\n ? `A scheduled tick last considered this workspace on ${formatDate(lastRunAt)} (${timeAgo(lastRunAt)}).`\n : 'No scheduled tick has considered this workspace yet.'}\n </p>\n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AC1EI,EAAS,WAAW,kBAAC+B,GAAD;KAAe,WAAU;KAAO,OAAO/B,EAAS;IAAQ,CAAA;IAG7E,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA;MACE,kBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,kBAAC,OAAD;QAAK,WAAU;QAAf,UAAA;SACE,kBAAC,SAAD;UACE,SAAQ;UACR,WAAU;UAFZ,UAAA,CAIE,kBAACgC,GAAD;WAAK,WAAU;WAAU,eAAY;UAAQ,CAAA,GAAC,WAEzC;;SACP,kBAAC,KAAD;UAAG,WAAU;UAAb,UAAA;WAAgD;WAErC,kBAAC,UAAD;YAAQ,WAAU;YAAgC,UAAA;WAAgB,CAAA;WAAE;WAAI;UAGhF;;SACH,kBAAC,KAAD;UAAG,WAAU;UAAb,UAAA;WAA4C;WACD;WACzC,kBAAC,QAAD;YAAM,WAAU;YAA6C,UAAA;WAEvD,CAAA;WAAC;UAEN;;QACA;OACL,CAAA,GAAA,kBAAC,OAAD;QAAK,WAAU;QAAf,UAAA,CACG9B,EAAa,aACZ,kBAACsB,GAAD,EAAS,WAAU,2CAA4C,CAAA,GAEjE,kBAACS,GAAD;SACE,IAAG;SACH,SAASjB;SACT,UAAUlB,EAAO,aAAaI,EAAa;SAC3C,kBAAkB,MAAYA,EAAa,OAAOgC,CAAO;SACzD,cAAW;QACZ,CAAA,CACE;OACF,CAAA,CAAA;;MACL,kBAAC,KAAD;OAAG,WAAU;OACV,UAAAjB,IACG,sDAAsDkB,EAAWlB,CAAS,EAAE,IAAIW,EAAQX,CAAS,EAAE,MACnG;MACH,CAAA;MACFf,EAAa,WAAW,kBAAC6B,GAAD;OAAe,WAAU;OAAO,OAAO7B,EAAa;MAAQ,CAAA;KAClF;;GACF;;CACI,CAAA;AAEf"}
|
|
@@ -10,9 +10,9 @@ import { AiErrorNotice as x } from "./AiErrorNotice.js";
|
|
|
10
10
|
import { useState as S } from "react";
|
|
11
11
|
import { AlertTriangle as C, Check as w, FileSearch as T, Gavel as E, Loader2 as D, Sparkles as O, X as k } from "lucide-react";
|
|
12
12
|
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
13
|
-
import { Badge as N, GlassCard as P } from "@burdenoff/fe-libs/ui";
|
|
13
|
+
import { Badge as N, GlassCard as P, ThemedSelect as F } from "@burdenoff/fe-libs/ui";
|
|
14
14
|
// src/atheletebridge/components/ai/DecisionCard.tsx
|
|
15
|
-
function
|
|
15
|
+
function I({ programId: e }) {
|
|
16
16
|
let t = i(e);
|
|
17
17
|
if (t.isLoading) return /* @__PURE__ */ M("p", {
|
|
18
18
|
className: "inline-flex items-center gap-1.5 text-xs text-text-muted",
|
|
@@ -49,7 +49,7 @@ function F({ programId: e }) {
|
|
|
49
49
|
]
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function L({ run: n, knownProgramId: i, initialAssessment: o = "MAINTAIN", onCancel: s, onSuccess: c }) {
|
|
53
53
|
let l = r(), u = a({ pagination: { limit: 100 } }), [d, f] = S(i ?? ""), [p, m] = S(o), [h, g] = S(""), [b, C] = S(null);
|
|
54
54
|
return /* @__PURE__ */ M("form", {
|
|
55
55
|
onSubmit: (e) => {
|
|
@@ -82,7 +82,7 @@ function I({ run: n, knownProgramId: i, initialAssessment: o = "MAINTAIN", onCan
|
|
|
82
82
|
htmlFor: `override-program-${n.id}`,
|
|
83
83
|
required: !0,
|
|
84
84
|
hint: "This run predates its program, so pick the one it produced. A program the run never touched is rejected.",
|
|
85
|
-
children: /* @__PURE__ */ M(
|
|
85
|
+
children: /* @__PURE__ */ M(F, {
|
|
86
86
|
id: `override-program-${n.id}`,
|
|
87
87
|
className: t,
|
|
88
88
|
value: d,
|
|
@@ -101,7 +101,7 @@ function I({ run: n, knownProgramId: i, initialAssessment: o = "MAINTAIN", onCan
|
|
|
101
101
|
htmlFor: `override-assessment-${n.id}`,
|
|
102
102
|
required: !0,
|
|
103
103
|
hint: _[p],
|
|
104
|
-
children: /* @__PURE__ */ j(
|
|
104
|
+
children: /* @__PURE__ */ j(F, {
|
|
105
105
|
id: `override-assessment-${n.id}`,
|
|
106
106
|
className: t,
|
|
107
107
|
value: p,
|
|
@@ -148,13 +148,13 @@ function I({ run: n, knownProgramId: i, initialAssessment: o = "MAINTAIN", onCan
|
|
|
148
148
|
]
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
var
|
|
151
|
+
var R = {
|
|
152
152
|
accepted: "A coach accepted this proposal.",
|
|
153
153
|
overridden: "A coach overrode this proposal.",
|
|
154
154
|
superseded: "A later decision has replaced this one on the program.",
|
|
155
155
|
unknown: null
|
|
156
156
|
};
|
|
157
|
-
function
|
|
157
|
+
function z({ run: e, programId: t, proposed: n, onOverride: a, onDone: o }) {
|
|
158
158
|
let s = i(t), c = r();
|
|
159
159
|
if (s.isLoading) return /* @__PURE__ */ M("p", {
|
|
160
160
|
className: "inline-flex items-center gap-1.5 text-xs text-text-muted",
|
|
@@ -162,7 +162,7 @@ function R({ run: e, programId: t, proposed: n, onOverride: a, onDone: o }) {
|
|
|
162
162
|
});
|
|
163
163
|
let l = p(e.id, s.data?.context);
|
|
164
164
|
if (l !== "pending") {
|
|
165
|
-
let e =
|
|
165
|
+
let e = R[l];
|
|
166
166
|
return e ? /* @__PURE__ */ M("p", {
|
|
167
167
|
className: "inline-flex items-center gap-1.5 text-sm text-text-secondary",
|
|
168
168
|
"data-testid": "ai-proposal-resolved",
|
|
@@ -234,8 +234,8 @@ function R({ run: e, programId: t, proposed: n, onOverride: a, onDone: o }) {
|
|
|
234
234
|
]
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
let [i, a] = S(!1), [d, p] = S(!1), _ = m(e.decision), x = h(e.inputRefs), D = f(e.inputRefs), O = l(_.confidence), k = u(_.recommendedWeeklyLoadChangePct), A = e.status === "FAILED",
|
|
237
|
+
function B({ run: e, isFocused: t = !1, className: r }) {
|
|
238
|
+
let [i, a] = S(!1), [d, p] = S(!1), _ = m(e.decision), x = h(e.inputRefs), D = f(e.inputRefs), O = l(_.confidence), k = u(_.recommendedWeeklyLoadChangePct), A = e.status === "FAILED", F = A || _.isFailure, R = !A && _.kind === "assessment", B = y.find((e) => e !== _.assessment) ?? "MAINTAIN";
|
|
239
239
|
return /* @__PURE__ */ M(P, {
|
|
240
240
|
treatment: "insight",
|
|
241
241
|
className: o("p-5", t && "ring-2 ring-[var(--color-focus-ring)]", r),
|
|
@@ -245,8 +245,8 @@ function z({ run: e, isFocused: t = !1, className: r }) {
|
|
|
245
245
|
children: [/* @__PURE__ */ M("div", {
|
|
246
246
|
className: "min-w-0",
|
|
247
247
|
children: [/* @__PURE__ */ M("h3", {
|
|
248
|
-
className: o("flex items-center gap-2 text-base font-semibold",
|
|
249
|
-
children: [
|
|
248
|
+
className: o("flex items-center gap-2 text-base font-semibold", F ? "text-status-error-text" : "text-text-primary"),
|
|
249
|
+
children: [F && /* @__PURE__ */ j(C, {
|
|
250
250
|
className: "h-4 w-4 shrink-0",
|
|
251
251
|
"aria-hidden": "true"
|
|
252
252
|
}), A ? "Decision not reached" : _.title]
|
|
@@ -387,7 +387,7 @@ function z({ run: e, isFocused: t = !1, className: r }) {
|
|
|
387
387
|
}),
|
|
388
388
|
D && /* @__PURE__ */ j("div", {
|
|
389
389
|
className: "mt-2",
|
|
390
|
-
children: /* @__PURE__ */ j(
|
|
390
|
+
children: /* @__PURE__ */ j(I, { programId: D })
|
|
391
391
|
})
|
|
392
392
|
]
|
|
393
393
|
}),
|
|
@@ -396,7 +396,7 @@ function z({ run: e, isFocused: t = !1, className: r }) {
|
|
|
396
396
|
children: d && !i ? /* @__PURE__ */ M("p", {
|
|
397
397
|
className: "inline-flex items-center gap-1.5 text-sm text-status-success-text",
|
|
398
398
|
children: [/* @__PURE__ */ j(w, { className: "h-4 w-4" }), " Your decision was recorded as a new ledger row."]
|
|
399
|
-
}) : i ? /* @__PURE__ */ j(
|
|
399
|
+
}) : i ? /* @__PURE__ */ j(L, {
|
|
400
400
|
run: e,
|
|
401
401
|
knownProgramId: D,
|
|
402
402
|
initialAssessment: B,
|
|
@@ -404,7 +404,7 @@ function z({ run: e, isFocused: t = !1, className: r }) {
|
|
|
404
404
|
onSuccess: () => {
|
|
405
405
|
a(!1), p(!0);
|
|
406
406
|
}
|
|
407
|
-
}) :
|
|
407
|
+
}) : R && D && _.assessment ? /* @__PURE__ */ j(z, {
|
|
408
408
|
run: e,
|
|
409
409
|
programId: D,
|
|
410
410
|
proposed: _.assessment,
|
|
@@ -424,6 +424,6 @@ function z({ run: e, isFocused: t = !1, className: r }) {
|
|
|
424
424
|
]
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
|
-
export {
|
|
427
|
+
export { B as DecisionCard };
|
|
428
428
|
|
|
429
429
|
//# sourceMappingURL=DecisionCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionCard.js","names":["_Fragment","ProgramAiState","program","useProgramAiState","programId","Loader2","context","adjustment","isRecord","status","agentRunId","StatusBadge","Fragment","ADJUSTMENT_STATUS_LABELS","OverrideForm","override","useOverrideAgentRun","programs","usePrograms","setProgramId","useState","knownProgramId","assessment","setAssessment","initialAssessment","note","setNote","validationError","setValidationError","event","run","onSuccess","FormField","fieldInputClass","ASSESSMENT_DESCRIPTIONS","ASSESSMENT_OPTIONS","option","ASSESSMENT_LABELS","AiErrorNotice","onCancel","Gavel","PROPOSAL_RESOLVED_COPY","ProposalReview","accept","state","proposalStateFor","copy","Check","Sparkles","proposed","onDone","onOverride","X","DecisionCard","overrideOpen","setOverrideOpen","overrideDone","setOverrideDone","summary","summarizeDecision","provenance","toProvenanceEntries","programIdFromInputRefs","confidence","formatConfidence","loadChange","formatLoadChange","runFailed","readsAsFailure","reviewable","overrideDefault","GlassCard","cn","isFocused","className","AlertTriangle","ASSESSMENT_VARIANT","Badge","formatDate","timeAgo","flag","entry","FileSearch"],"sources":["../../../../src/atheletebridge/components/ai/DecisionCard.tsx"],"sourcesContent":["/**\n * Decision card\n * @module atheletebridge/components/ai\n *\n * One AI decision, rendered from the ledger row it was written to: the\n * `decision` payload, the `inputRefs` provenance (the ids and aggregate stats\n * the model actually considered), and the coach's review action\n * (`athOverrideAgentRun`).\n *\n * Three rules:\n * - A run whose decision carries `parseError` renders as a FAILED decision.\n * The provider answered, the answer was unusable, and the card says so —\n * an empty card would read as a silent success.\n * - A FAILED run shows the recorded upstream error, not a blank space.\n * - Nothing in the payload is hidden: keys this build does not recognise are\n * still listed (see `utils/aiDecision`).\n */\n\nimport { useState } from 'react';\nimport { AlertTriangle, Check, FileSearch, Gavel, Loader2, Sparkles, X } from 'lucide-react';\nimport { Badge, GlassCard } from '@burdenoff/fe-libs/ui';\nimport { FormField, fieldInputClass } from '../form';\nimport { StatusBadge } from '../StatusBadge';\nimport {\n usePrograms,\n useProgramAiState,\n useOverrideAgentRun,\n} from '../../hooks/useAthleteBridgeApi';\nimport type { AthAgentRun, AthAiAssessment } from '../../types';\nimport type { ProposalState } from '../../utils/aiDecision';\nimport { cn } from '../../utils/cn';\nimport { formatDate } from '../../utils/formatters';\nimport { timeAgo } from '../../utils/timeAgo';\nimport {\n formatConfidence,\n formatLoadChange,\n isRecord,\n programIdFromInputRefs,\n proposalStateFor,\n summarizeDecision,\n toProvenanceEntries,\n} from '../../utils/aiDecision';\nimport {\n ADJUSTMENT_STATUS_LABELS,\n ASSESSMENT_DESCRIPTIONS,\n ASSESSMENT_LABELS,\n ASSESSMENT_OPTIONS,\n ASSESSMENT_VARIANT,\n} from './assessment';\nimport { AiErrorNotice } from './AiErrorNotice';\n\ninterface DecisionCardProps {\n run: AthAgentRun;\n /** Highlighted because it is the run selected in the activity feed. */\n isFocused?: boolean;\n className?: string;\n}\n\n/** The program's CURRENT AI state, so the card shows where the proposal landed. */\nfunction ProgramAiState({ programId }: { programId: string }) {\n const program = useProgramAiState(programId);\n\n if (program.isLoading) {\n return (\n <p className=\"inline-flex items-center gap-1.5 text-xs text-text-muted\">\n <Loader2 className=\"h-3 w-3 animate-spin\" /> Loading program state…\n </p>\n );\n }\n if (program.isError || !program.data) {\n // NOT_FOUND here is legitimate — the program may have been archived since.\n return <p className=\"text-xs text-text-muted\">Program {programId} is no longer readable.</p>;\n }\n\n const context = program.data.context;\n const adjustment = isRecord(context) ? context.lastAiAdjustment : null;\n const status =\n isRecord(adjustment) && typeof adjustment.status === 'string' ? adjustment.status : null;\n const agentRunId =\n isRecord(adjustment) && typeof adjustment.agentRunId === 'string'\n ? adjustment.agentRunId\n : null;\n\n return (\n <div className=\"flex flex-wrap items-center gap-2 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">{program.data.name}</span>\n <StatusBadge status={program.data.status} />\n {status ? (\n <>\n <span>·</span>\n <span>{ADJUSTMENT_STATUS_LABELS[status] ?? status}</span>\n {agentRunId && <span className=\"font-mono text-text-muted\">{agentRunId}</span>}\n </>\n ) : (\n <span className=\"text-text-muted\">· no AI adjustment recorded on this program</span>\n )}\n </div>\n );\n}\n\n/** Coach review — appended as a NEW ledger row, never an edit of the original. */\nfunction OverrideForm({\n run,\n knownProgramId,\n initialAssessment = 'MAINTAIN',\n onCancel,\n onSuccess,\n}: {\n run: AthAgentRun;\n knownProgramId: string | null;\n /** Pre-selected call — the first alternative to the AI's when overriding. */\n initialAssessment?: AthAiAssessment;\n onCancel: () => void;\n onSuccess: () => void;\n}) {\n const override = useOverrideAgentRun();\n // Only needed when the run itself does not name a program: `athGenerateProgram`\n // runs before its program exists, so the link is written the other way round\n // (onto the program's `context.agentRunId`) and the coach has to say which.\n const programs = usePrograms({ pagination: { limit: 100 } });\n\n const [programId, setProgramId] = useState(knownProgramId ?? '');\n const [assessment, setAssessment] = useState<AthAiAssessment>(initialAssessment);\n const [note, setNote] = useState('');\n const [validationError, setValidationError] = useState<string | null>(null);\n\n const handleSubmit = (event: React.FormEvent) => {\n event.preventDefault();\n setValidationError(null);\n if (!programId) {\n setValidationError('Choose the program this decision concerns.');\n return;\n }\n if (!note.trim()) {\n setValidationError('A note is required — it is the record of why you decided this.');\n return;\n }\n override.mutate(\n { runId: run.id, programId, assessment, note: note.trim() },\n {\n onSuccess: () => {\n setNote('');\n onSuccess();\n },\n }\n );\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"mt-4 space-y-4 border-t border-border-seam pt-4\">\n <p className=\"text-xs text-text-secondary\">\n Your decision is appended to the ledger as a new run that supersedes this one — the original\n is never edited. Filing the same call the AI made records it as accepted; a different one\n records it as overridden.\n </p>\n\n {knownProgramId ? (\n <FormField label=\"Program\" hint=\"Taken from this run's provenance.\">\n <input\n className={fieldInputClass}\n value={knownProgramId}\n readOnly\n aria-label=\"Program this decision concerns\"\n />\n </FormField>\n ) : (\n <FormField\n label=\"Program\"\n htmlFor={`override-program-${run.id}`}\n required\n hint=\"This run predates its program, so pick the one it produced. A program the run never touched is rejected.\"\n >\n <select\n id={`override-program-${run.id}`}\n className={fieldInputClass}\n value={programId}\n onChange={(event) => setProgramId(event.target.value)}\n >\n <option value=\"\">Select a program…</option>\n {(programs.data?.items ?? []).map((program) => (\n <option key={program.id} value={program.id}>\n {program.name}\n </option>\n ))}\n </select>\n </FormField>\n )}\n\n <FormField\n label=\"Your assessment\"\n htmlFor={`override-assessment-${run.id}`}\n required\n hint={ASSESSMENT_DESCRIPTIONS[assessment]}\n >\n <select\n id={`override-assessment-${run.id}`}\n className={fieldInputClass}\n value={assessment}\n onChange={(event) => setAssessment(event.target.value as AthAiAssessment)}\n >\n {ASSESSMENT_OPTIONS.map((option) => (\n <option key={option} value={option}>\n {ASSESSMENT_LABELS[option]}\n </option>\n ))}\n </select>\n </FormField>\n\n <FormField label=\"Note\" htmlFor={`override-note-${run.id}`} required>\n <textarea\n id={`override-note-${run.id}`}\n className={fieldInputClass}\n rows={3}\n value={note}\n maxLength={1000}\n onChange={(event) => setNote(event.target.value)}\n placeholder=\"Why this call — what you saw that the model did not.\"\n />\n </FormField>\n\n {validationError && <p className=\"text-sm text-status-error-text\">{validationError}</p>}\n {override.isError && <AiErrorNotice error={override.error} />}\n\n <div className=\"flex items-center justify-end gap-2\">\n <button\n type=\"button\"\n onClick={onCancel}\n className=\"rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={override.isPending}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-60\"\n >\n {override.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Gavel className=\"h-4 w-4\" />\n )}\n File decision\n </button>\n </div>\n </form>\n );\n}\n\nconst PROPOSAL_RESOLVED_COPY: Record<Exclude<ProposalState, 'pending'>, string | null> = {\n accepted: 'A coach accepted this proposal.',\n overridden: 'A coach overrode this proposal.',\n superseded: 'A later decision has replaced this one on the program.',\n unknown: null,\n};\n\n/**\n * \"AI proposes … [Accept] [Override]\" for an assessment that is still awaiting\n * a coach. Accepting files a coach review with the AI's own call (recorded as\n * ACCEPTED); overriding opens the review form pre-set to a different call.\n * Both append a new ledger row — the proposal itself is never edited.\n */\nfunction ProposalReview({\n run,\n programId,\n proposed,\n onOverride,\n onDone,\n}: {\n run: AthAgentRun;\n programId: string;\n proposed: AthAiAssessment;\n onOverride: () => void;\n onDone: () => void;\n}) {\n const program = useProgramAiState(programId);\n const accept = useOverrideAgentRun();\n\n if (program.isLoading) {\n return (\n <p className=\"inline-flex items-center gap-1.5 text-xs text-text-muted\">\n <Loader2 className=\"h-3 w-3 animate-spin\" /> Checking whether this proposal is still open…\n </p>\n );\n }\n\n const state = proposalStateFor(run.id, program.data?.context);\n if (state !== 'pending') {\n const copy = PROPOSAL_RESOLVED_COPY[state];\n return copy ? (\n <p\n className=\"inline-flex items-center gap-1.5 text-sm text-text-secondary\"\n data-testid=\"ai-proposal-resolved\"\n >\n <Check className=\"h-4 w-4 text-status-success-text\" aria-hidden=\"true\" /> {copy}\n </p>\n ) : null;\n }\n\n return (\n <div\n className=\"rounded-lg border border-border-seam bg-bg-sunken p-3\"\n data-testid=\"ai-proposal-review\"\n >\n <p className=\"flex flex-wrap items-center gap-2 text-sm text-text-primary\">\n <Sparkles className=\"h-4 w-4 text-text-secondary\" aria-hidden=\"true\" />\n <span>\n AI proposes <span className=\"font-semibold\">{ASSESSMENT_LABELS[proposed]}</span>\n </span>\n <span className=\"text-xs text-text-muted\">\n by {run.provider}/{run.model}\n </span>\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">{ASSESSMENT_DESCRIPTIONS[proposed]}</p>\n {accept.isError && <AiErrorNotice error={accept.error} className=\"mt-2\" />}\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n disabled={accept.isPending}\n onClick={() =>\n accept.mutate(\n {\n runId: run.id,\n programId,\n assessment: proposed,\n note: `Accepted the AI proposal (${ASSESSMENT_LABELS[proposed]}) from ${run.provider}/${run.model}.`,\n },\n { onSuccess: onDone }\n )\n }\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-60\"\n >\n {accept.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Check className=\"h-4 w-4\" />\n )}\n Accept\n </button>\n <button\n type=\"button\"\n disabled={accept.isPending}\n onClick={onOverride}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-elevated disabled:opacity-60\"\n >\n <X className=\"h-4 w-4\" /> Override\n </button>\n </div>\n </div>\n );\n}\n\nexport function DecisionCard({ run, isFocused = false, className }: DecisionCardProps) {\n const [overrideOpen, setOverrideOpen] = useState(false);\n const [overrideDone, setOverrideDone] = useState(false);\n\n const summary = summarizeDecision(run.decision);\n const provenance = toProvenanceEntries(run.inputRefs);\n const programId = programIdFromInputRefs(run.inputRefs);\n const confidence = formatConfidence(summary.confidence);\n const loadChange = formatLoadChange(summary.recommendedWeeklyLoadChangePct);\n const runFailed = run.status === 'FAILED';\n const readsAsFailure = runFailed || summary.isFailure;\n // Only a successful AI assessment tied to a program can be accepted as-is.\n const reviewable = !runFailed && summary.kind === 'assessment';\n const overrideDefault: AthAiAssessment =\n ASSESSMENT_OPTIONS.find((option) => option !== summary.assessment) ?? 'MAINTAIN';\n\n return (\n <GlassCard\n treatment=\"insight\"\n className={cn('p-5', isFocused && 'ring-2 ring-[var(--color-focus-ring)]', className)}\n >\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <h3\n className={cn(\n 'flex items-center gap-2 text-base font-semibold',\n readsAsFailure ? 'text-status-error-text' : 'text-text-primary'\n )}\n >\n {readsAsFailure && <AlertTriangle className=\"h-4 w-4 shrink-0\" aria-hidden=\"true\" />}\n {runFailed ? 'Decision not reached' : summary.title}\n </h3>\n <p className=\"mt-1 text-sm text-text-secondary\">{run.promptSummary}</p>\n </div>\n <div className=\"flex shrink-0 flex-wrap items-center gap-2\">\n {summary.assessment && (\n <StatusBadge\n status={ASSESSMENT_LABELS[summary.assessment]}\n variant={ASSESSMENT_VARIANT[summary.assessment]}\n />\n )}\n {summary.status && (\n <Badge variant=\"outline\">\n {ADJUSTMENT_STATUS_LABELS[summary.status] ?? summary.status}\n </Badge>\n )}\n </div>\n </div>\n\n <p className=\"mt-2 text-xs text-text-muted\" title={formatDate(run.createdAt)}>\n {run.provider}/{run.model} · {timeAgo(run.createdAt)} · run{' '}\n <code className=\"font-mono\">{run.id}</code>\n </p>\n\n {/* The decision itself */}\n <div className=\"mt-4\">\n {runFailed ? (\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle p-3\">\n <p className=\"text-sm font-medium text-status-error-text\">\n The provider chain could not answer, so no decision was produced.\n </p>\n {run.error && (\n <p className=\"mt-1.5 whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-status-error-text\">\n {run.error}\n </p>\n )}\n </div>\n ) : summary.kind === 'parse-failure' ? (\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle p-3\">\n <p className=\"text-sm font-medium text-status-error-text\">\n The model replied, but the reply could not be used.\n </p>\n <p className=\"mt-1.5 whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-status-error-text\">\n {summary.parseError}\n </p>\n <p className=\"mt-1.5 text-xs text-text-secondary\">\n Nothing was applied to any program. The row is kept so the failure is auditable.\n </p>\n </div>\n ) : summary.kind === 'none' ? (\n <p className=\"text-sm text-text-muted\">This run recorded no decision payload.</p>\n ) : (\n <div className=\"space-y-3\">\n {summary.rationale && (\n <p className=\"text-sm text-text-secondary\">{summary.rationale}</p>\n )}\n {summary.note && (\n <p className=\"rounded-lg bg-bg-sunken p-3 text-sm text-text-secondary\">\n <span className=\"font-medium text-text-primary\">Coach note: </span>\n {summary.note}\n </p>\n )}\n {(confidence || loadChange) && (\n <div className=\"flex flex-wrap gap-1.5\">\n {confidence && (\n <span className=\"inline-flex items-center rounded-md border border-border-seam bg-bg-sunken px-2 py-0.5 text-xs font-medium tabular-nums text-text-secondary\">\n Confidence {confidence}\n </span>\n )}\n {loadChange && (\n <span className=\"inline-flex items-center rounded-md border border-border-seam bg-bg-sunken px-2 py-0.5 text-xs font-medium tabular-nums text-text-secondary\">\n Weekly load {loadChange}\n </span>\n )}\n </div>\n )}\n {summary.flags.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\">\n {summary.flags.map((flag) => (\n <span\n key={flag}\n className=\"inline-flex items-center rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\"\n >\n {flag}\n </span>\n ))}\n </div>\n )}\n {summary.extra.length > 0 && (\n <dl className=\"grid grid-cols-1 gap-x-6 gap-y-1 text-xs sm:grid-cols-2\">\n {summary.extra.map((entry) => (\n <div key={entry.key} className=\"flex gap-1.5\">\n <dt className=\"shrink-0 font-medium text-text-primary\">{entry.label}:</dt>\n <dd className=\"min-w-0 break-words text-text-secondary\">{entry.value}</dd>\n </div>\n ))}\n </dl>\n )}\n </div>\n )}\n </div>\n\n {/* Provenance — what the model was actually given */}\n <div className=\"mt-4 border-t border-border-seam pt-3\">\n <h4 className=\"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-text-muted\">\n <FileSearch className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n Considered\n </h4>\n {provenance.length === 0 ? (\n <p className=\"mt-1.5 text-xs text-text-muted\">This run recorded no input references.</p>\n ) : (\n <dl className=\"mt-1.5 grid grid-cols-1 gap-x-6 gap-y-1 text-xs sm:grid-cols-2\">\n {provenance.map((entry) => (\n <div key={entry.key} className=\"flex gap-1.5\">\n <dt className=\"shrink-0 font-medium text-text-primary\">{entry.label}:</dt>\n <dd className=\"min-w-0 break-words text-text-secondary\">{entry.value}</dd>\n </div>\n ))}\n </dl>\n )}\n {programId && (\n <div className=\"mt-2\">\n <ProgramAiState programId={programId} />\n </div>\n )}\n </div>\n\n {/* Coach review */}\n <div className=\"mt-4\">\n {overrideDone && !overrideOpen ? (\n <p className=\"inline-flex items-center gap-1.5 text-sm text-status-success-text\">\n <Check className=\"h-4 w-4\" /> Your decision was recorded as a new ledger row.\n </p>\n ) : overrideOpen ? (\n <OverrideForm\n run={run}\n knownProgramId={programId}\n initialAssessment={overrideDefault}\n onCancel={() => setOverrideOpen(false)}\n onSuccess={() => {\n setOverrideOpen(false);\n setOverrideDone(true);\n }}\n />\n ) : reviewable && programId && summary.assessment ? (\n <ProposalReview\n run={run}\n programId={programId}\n proposed={summary.assessment}\n onOverride={() => {\n setOverrideDone(false);\n setOverrideOpen(true);\n }}\n onDone={() => setOverrideDone(true)}\n />\n ) : (\n <button\n type=\"button\"\n onClick={() => {\n setOverrideDone(false);\n setOverrideOpen(true);\n }}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover: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AwDqB,EAAM,OAAM,GAAK;OACzE,CAAA,GAAA,kBAAC,MAAD;QAAI,WAAU;QAA2C,UAAAA,EAAM;OAAU,CAAA,CACtE;MAHK,GAAAA,EAAM,GAGX,CACN;KACC,CAAA;KAEL7E,KACC,kBAAC,OAAD;MAAK,WAAU;MACb,UAAA,kBAACH,GAAD,EAA2B,aAAY,CAAA;KACpC,CAAA;IAEJ;;GAGL,kBAAC,OAAD;IAAK,WAAU;IACZ,UAAAuD,KAAgB,CAACF,IAChB,kBAAC,KAAD;KAAG,WAAU;KAAb,UAAA,CACE,kBAACP,GAAD,EAAO,WAAU,UAAW,CAAA,GAAC,kDAC5B;IACD,CAAA,IAAAO,IACF,kBAACxC,GAAD;KACO;KACL,gBAAgBV;KAChB,mBAAmBkE;KACnB,gBAAgBf,EAAgB,EAAK;KACrC,iBAAiB;MAEf,AADAA,EAAgB,EAAK,GACrBE,EAAgB,EAAI;KACtB;IACD,CAAA,IACCY,KAAcjE,KAAasD,EAAQ,aACrC,kBAAChB,GAAD;KACO;KACM;KACX,UAAUgB,EAAQ;KAClB,kBAAkB;MAEhB,AADAD,EAAgB,EAAK,GACrBF,EAAgB,EAAI;KACtB;KACA,cAAcE,EAAgB,EAAI;IACnC,CAAA,IAED,kBAAC,UAAD;KACE,MAAK;KACL,eAAe;MAEb,AADAA,EAAgB,EAAK,GACrBF,EAAgB,EAAI;KACtB;KACA,WAAU;KANZ,UAAA,CAQE,kBAACf,GAAD,EAAO,WAAU,UAAW,CAAA,GAAC,wBACvB;;GAEP,CAAA;EACI;;AAEf"}
|
|
1
|
+
{"version":3,"file":"DecisionCard.js","names":["_Fragment","ProgramAiState","program","useProgramAiState","programId","Loader2","context","adjustment","isRecord","status","agentRunId","StatusBadge","Fragment","ADJUSTMENT_STATUS_LABELS","OverrideForm","override","useOverrideAgentRun","programs","usePrograms","setProgramId","useState","knownProgramId","assessment","setAssessment","initialAssessment","note","setNote","validationError","setValidationError","event","run","onSuccess","FormField","fieldInputClass","ThemedSelect","ASSESSMENT_DESCRIPTIONS","ASSESSMENT_OPTIONS","option","ASSESSMENT_LABELS","AiErrorNotice","onCancel","Gavel","PROPOSAL_RESOLVED_COPY","ProposalReview","accept","state","proposalStateFor","copy","Check","Sparkles","proposed","onDone","onOverride","X","DecisionCard","overrideOpen","setOverrideOpen","overrideDone","setOverrideDone","summary","summarizeDecision","provenance","toProvenanceEntries","programIdFromInputRefs","confidence","formatConfidence","loadChange","formatLoadChange","runFailed","readsAsFailure","reviewable","overrideDefault","GlassCard","cn","isFocused","className","AlertTriangle","ASSESSMENT_VARIANT","Badge","formatDate","timeAgo","flag","entry","FileSearch"],"sources":["../../../../src/atheletebridge/components/ai/DecisionCard.tsx"],"sourcesContent":["/**\n * Decision card\n * @module atheletebridge/components/ai\n *\n * One AI decision, rendered from the ledger row it was written to: the\n * `decision` payload, the `inputRefs` provenance (the ids and aggregate stats\n * the model actually considered), and the coach's review action\n * (`athOverrideAgentRun`).\n *\n * Three rules:\n * - A run whose decision carries `parseError` renders as a FAILED decision.\n * The provider answered, the answer was unusable, and the card says so —\n * an empty card would read as a silent success.\n * - A FAILED run shows the recorded upstream error, not a blank space.\n * - Nothing in the payload is hidden: keys this build does not recognise are\n * still listed (see `utils/aiDecision`).\n */\n\nimport { useState } from 'react';\nimport { AlertTriangle, Check, FileSearch, Gavel, Loader2, Sparkles, X } from 'lucide-react';\nimport { Badge, GlassCard, ThemedSelect } from '@burdenoff/fe-libs/ui';\nimport { FormField, fieldInputClass } from '../form';\nimport { StatusBadge } from '../StatusBadge';\nimport {\n usePrograms,\n useProgramAiState,\n useOverrideAgentRun,\n} from '../../hooks/useAthleteBridgeApi';\nimport type { AthAgentRun, AthAiAssessment } from '../../types';\nimport type { ProposalState } from '../../utils/aiDecision';\nimport { cn } from '../../utils/cn';\nimport { formatDate } from '../../utils/formatters';\nimport { timeAgo } from '../../utils/timeAgo';\nimport {\n formatConfidence,\n formatLoadChange,\n isRecord,\n programIdFromInputRefs,\n proposalStateFor,\n summarizeDecision,\n toProvenanceEntries,\n} from '../../utils/aiDecision';\nimport {\n ADJUSTMENT_STATUS_LABELS,\n ASSESSMENT_DESCRIPTIONS,\n ASSESSMENT_LABELS,\n ASSESSMENT_OPTIONS,\n ASSESSMENT_VARIANT,\n} from './assessment';\nimport { AiErrorNotice } from './AiErrorNotice';\n\ninterface DecisionCardProps {\n run: AthAgentRun;\n /** Highlighted because it is the run selected in the activity feed. */\n isFocused?: boolean;\n className?: string;\n}\n\n/** The program's CURRENT AI state, so the card shows where the proposal landed. */\nfunction ProgramAiState({ programId }: { programId: string }) {\n const program = useProgramAiState(programId);\n\n if (program.isLoading) {\n return (\n <p className=\"inline-flex items-center gap-1.5 text-xs text-text-muted\">\n <Loader2 className=\"h-3 w-3 animate-spin\" /> Loading program state…\n </p>\n );\n }\n if (program.isError || !program.data) {\n // NOT_FOUND here is legitimate — the program may have been archived since.\n return <p className=\"text-xs text-text-muted\">Program {programId} is no longer readable.</p>;\n }\n\n const context = program.data.context;\n const adjustment = isRecord(context) ? context.lastAiAdjustment : null;\n const status =\n isRecord(adjustment) && typeof adjustment.status === 'string' ? adjustment.status : null;\n const agentRunId =\n isRecord(adjustment) && typeof adjustment.agentRunId === 'string'\n ? adjustment.agentRunId\n : null;\n\n return (\n <div className=\"flex flex-wrap items-center gap-2 text-xs text-text-secondary\">\n <span className=\"font-medium text-text-primary\">{program.data.name}</span>\n <StatusBadge status={program.data.status} />\n {status ? (\n <>\n <span>·</span>\n <span>{ADJUSTMENT_STATUS_LABELS[status] ?? status}</span>\n {agentRunId && <span className=\"font-mono text-text-muted\">{agentRunId}</span>}\n </>\n ) : (\n <span className=\"text-text-muted\">· no AI adjustment recorded on this program</span>\n )}\n </div>\n );\n}\n\n/** Coach review — appended as a NEW ledger row, never an edit of the original. */\nfunction OverrideForm({\n run,\n knownProgramId,\n initialAssessment = 'MAINTAIN',\n onCancel,\n onSuccess,\n}: {\n run: AthAgentRun;\n knownProgramId: string | null;\n /** Pre-selected call — the first alternative to the AI's when overriding. */\n initialAssessment?: AthAiAssessment;\n onCancel: () => void;\n onSuccess: () => void;\n}) {\n const override = useOverrideAgentRun();\n // Only needed when the run itself does not name a program: `athGenerateProgram`\n // runs before its program exists, so the link is written the other way round\n // (onto the program's `context.agentRunId`) and the coach has to say which.\n const programs = usePrograms({ pagination: { limit: 100 } });\n\n const [programId, setProgramId] = useState(knownProgramId ?? '');\n const [assessment, setAssessment] = useState<AthAiAssessment>(initialAssessment);\n const [note, setNote] = useState('');\n const [validationError, setValidationError] = useState<string | null>(null);\n\n const handleSubmit = (event: React.FormEvent) => {\n event.preventDefault();\n setValidationError(null);\n if (!programId) {\n setValidationError('Choose the program this decision concerns.');\n return;\n }\n if (!note.trim()) {\n setValidationError('A note is required — it is the record of why you decided this.');\n return;\n }\n override.mutate(\n { runId: run.id, programId, assessment, note: note.trim() },\n {\n onSuccess: () => {\n setNote('');\n onSuccess();\n },\n }\n );\n };\n\n return (\n <form onSubmit={handleSubmit} className=\"mt-4 space-y-4 border-t border-border-seam pt-4\">\n <p className=\"text-xs text-text-secondary\">\n Your decision is appended to the ledger as a new run that supersedes this one — the original\n is never edited. Filing the same call the AI made records it as accepted; a different one\n records it as overridden.\n </p>\n\n {knownProgramId ? (\n <FormField label=\"Program\" hint=\"Taken from this run's provenance.\">\n <input\n className={fieldInputClass}\n value={knownProgramId}\n readOnly\n aria-label=\"Program this decision concerns\"\n />\n </FormField>\n ) : (\n <FormField\n label=\"Program\"\n htmlFor={`override-program-${run.id}`}\n required\n hint=\"This run predates its program, so pick the one it produced. A program the run never touched is rejected.\"\n >\n <ThemedSelect\n id={`override-program-${run.id}`}\n className={fieldInputClass}\n value={programId}\n onChange={(event) => setProgramId(event.target.value)}\n >\n <option value=\"\">Select a program…</option>\n {(programs.data?.items ?? []).map((program) => (\n <option key={program.id} value={program.id}>\n {program.name}\n </option>\n ))}\n </ThemedSelect>\n </FormField>\n )}\n\n <FormField\n label=\"Your assessment\"\n htmlFor={`override-assessment-${run.id}`}\n required\n hint={ASSESSMENT_DESCRIPTIONS[assessment]}\n >\n <ThemedSelect\n id={`override-assessment-${run.id}`}\n className={fieldInputClass}\n value={assessment}\n onChange={(event) => setAssessment(event.target.value as AthAiAssessment)}\n >\n {ASSESSMENT_OPTIONS.map((option) => (\n <option key={option} value={option}>\n {ASSESSMENT_LABELS[option]}\n </option>\n ))}\n </ThemedSelect>\n </FormField>\n\n <FormField label=\"Note\" htmlFor={`override-note-${run.id}`} required>\n <textarea\n id={`override-note-${run.id}`}\n className={fieldInputClass}\n rows={3}\n value={note}\n maxLength={1000}\n onChange={(event) => setNote(event.target.value)}\n placeholder=\"Why this call — what you saw that the model did not.\"\n />\n </FormField>\n\n {validationError && <p className=\"text-sm text-status-error-text\">{validationError}</p>}\n {override.isError && <AiErrorNotice error={override.error} />}\n\n <div className=\"flex items-center justify-end gap-2\">\n <button\n type=\"button\"\n onClick={onCancel}\n className=\"rounded-lg border border-border-seam px-4 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={override.isPending}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-60\"\n >\n {override.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Gavel className=\"h-4 w-4\" />\n )}\n File decision\n </button>\n </div>\n </form>\n );\n}\n\nconst PROPOSAL_RESOLVED_COPY: Record<Exclude<ProposalState, 'pending'>, string | null> = {\n accepted: 'A coach accepted this proposal.',\n overridden: 'A coach overrode this proposal.',\n superseded: 'A later decision has replaced this one on the program.',\n unknown: null,\n};\n\n/**\n * \"AI proposes … [Accept] [Override]\" for an assessment that is still awaiting\n * a coach. Accepting files a coach review with the AI's own call (recorded as\n * ACCEPTED); overriding opens the review form pre-set to a different call.\n * Both append a new ledger row — the proposal itself is never edited.\n */\nfunction ProposalReview({\n run,\n programId,\n proposed,\n onOverride,\n onDone,\n}: {\n run: AthAgentRun;\n programId: string;\n proposed: AthAiAssessment;\n onOverride: () => void;\n onDone: () => void;\n}) {\n const program = useProgramAiState(programId);\n const accept = useOverrideAgentRun();\n\n if (program.isLoading) {\n return (\n <p className=\"inline-flex items-center gap-1.5 text-xs text-text-muted\">\n <Loader2 className=\"h-3 w-3 animate-spin\" /> Checking whether this proposal is still open…\n </p>\n );\n }\n\n const state = proposalStateFor(run.id, program.data?.context);\n if (state !== 'pending') {\n const copy = PROPOSAL_RESOLVED_COPY[state];\n return copy ? (\n <p\n className=\"inline-flex items-center gap-1.5 text-sm text-text-secondary\"\n data-testid=\"ai-proposal-resolved\"\n >\n <Check className=\"h-4 w-4 text-status-success-text\" aria-hidden=\"true\" /> {copy}\n </p>\n ) : null;\n }\n\n return (\n <div\n className=\"rounded-lg border border-border-seam bg-bg-sunken p-3\"\n data-testid=\"ai-proposal-review\"\n >\n <p className=\"flex flex-wrap items-center gap-2 text-sm text-text-primary\">\n <Sparkles className=\"h-4 w-4 text-text-secondary\" aria-hidden=\"true\" />\n <span>\n AI proposes <span className=\"font-semibold\">{ASSESSMENT_LABELS[proposed]}</span>\n </span>\n <span className=\"text-xs text-text-muted\">\n by {run.provider}/{run.model}\n </span>\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">{ASSESSMENT_DESCRIPTIONS[proposed]}</p>\n {accept.isError && <AiErrorNotice error={accept.error} className=\"mt-2\" />}\n <div className=\"mt-3 flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n disabled={accept.isPending}\n onClick={() =>\n accept.mutate(\n {\n runId: run.id,\n programId,\n assessment: proposed,\n note: `Accepted the AI proposal (${ASSESSMENT_LABELS[proposed]}) from ${run.provider}/${run.model}.`,\n },\n { onSuccess: onDone }\n )\n }\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-60\"\n >\n {accept.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Check className=\"h-4 w-4\" />\n )}\n Accept\n </button>\n <button\n type=\"button\"\n disabled={accept.isPending}\n onClick={onOverride}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-elevated disabled:opacity-60\"\n >\n <X className=\"h-4 w-4\" /> Override\n </button>\n </div>\n </div>\n );\n}\n\nexport function DecisionCard({ run, isFocused = false, className }: DecisionCardProps) {\n const [overrideOpen, setOverrideOpen] = useState(false);\n const [overrideDone, setOverrideDone] = useState(false);\n\n const summary = summarizeDecision(run.decision);\n const provenance = toProvenanceEntries(run.inputRefs);\n const programId = programIdFromInputRefs(run.inputRefs);\n const confidence = formatConfidence(summary.confidence);\n const loadChange = formatLoadChange(summary.recommendedWeeklyLoadChangePct);\n const runFailed = run.status === 'FAILED';\n const readsAsFailure = runFailed || summary.isFailure;\n // Only a successful AI assessment tied to a program can be accepted as-is.\n const reviewable = !runFailed && summary.kind === 'assessment';\n const overrideDefault: AthAiAssessment =\n ASSESSMENT_OPTIONS.find((option) => option !== summary.assessment) ?? 'MAINTAIN';\n\n return (\n <GlassCard\n treatment=\"insight\"\n className={cn('p-5', isFocused && 'ring-2 ring-[var(--color-focus-ring)]', className)}\n >\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <h3\n className={cn(\n 'flex items-center gap-2 text-base font-semibold',\n readsAsFailure ? 'text-status-error-text' : 'text-text-primary'\n )}\n >\n {readsAsFailure && <AlertTriangle className=\"h-4 w-4 shrink-0\" aria-hidden=\"true\" />}\n {runFailed ? 'Decision not reached' : summary.title}\n </h3>\n <p className=\"mt-1 text-sm text-text-secondary\">{run.promptSummary}</p>\n </div>\n <div className=\"flex shrink-0 flex-wrap items-center gap-2\">\n {summary.assessment && (\n <StatusBadge\n status={ASSESSMENT_LABELS[summary.assessment]}\n variant={ASSESSMENT_VARIANT[summary.assessment]}\n />\n )}\n {summary.status && (\n <Badge variant=\"outline\">\n {ADJUSTMENT_STATUS_LABELS[summary.status] ?? summary.status}\n </Badge>\n )}\n </div>\n </div>\n\n <p className=\"mt-2 text-xs text-text-muted\" title={formatDate(run.createdAt)}>\n {run.provider}/{run.model} · {timeAgo(run.createdAt)} · run{' '}\n <code className=\"font-mono\">{run.id}</code>\n </p>\n\n {/* The decision itself */}\n <div className=\"mt-4\">\n {runFailed ? (\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle p-3\">\n <p className=\"text-sm font-medium text-status-error-text\">\n The provider chain could not answer, so no decision was produced.\n </p>\n {run.error && (\n <p className=\"mt-1.5 whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-status-error-text\">\n {run.error}\n </p>\n )}\n </div>\n ) : summary.kind === 'parse-failure' ? (\n <div className=\"rounded-lg border border-status-error-border bg-status-error-bg-subtle p-3\">\n <p className=\"text-sm font-medium text-status-error-text\">\n The model replied, but the reply could not be used.\n </p>\n <p className=\"mt-1.5 whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-status-error-text\">\n {summary.parseError}\n </p>\n <p className=\"mt-1.5 text-xs text-text-secondary\">\n Nothing was applied to any program. The row is kept so the failure is auditable.\n </p>\n </div>\n ) : summary.kind === 'none' ? (\n <p className=\"text-sm text-text-muted\">This run recorded no decision payload.</p>\n ) : (\n <div className=\"space-y-3\">\n {summary.rationale && (\n <p className=\"text-sm text-text-secondary\">{summary.rationale}</p>\n )}\n {summary.note && (\n <p className=\"rounded-lg bg-bg-sunken p-3 text-sm text-text-secondary\">\n <span className=\"font-medium text-text-primary\">Coach note: </span>\n {summary.note}\n </p>\n )}\n {(confidence || loadChange) && (\n <div className=\"flex flex-wrap gap-1.5\">\n {confidence && (\n <span className=\"inline-flex items-center rounded-md border border-border-seam bg-bg-sunken px-2 py-0.5 text-xs font-medium tabular-nums text-text-secondary\">\n Confidence {confidence}\n </span>\n )}\n {loadChange && (\n <span className=\"inline-flex items-center rounded-md border border-border-seam bg-bg-sunken px-2 py-0.5 text-xs font-medium tabular-nums text-text-secondary\">\n Weekly load {loadChange}\n </span>\n )}\n </div>\n )}\n {summary.flags.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\">\n {summary.flags.map((flag) => (\n <span\n key={flag}\n className=\"inline-flex items-center rounded-full bg-status-warning-bg-subtle px-2 py-0.5 text-xs font-medium text-status-warning-text\"\n >\n {flag}\n </span>\n ))}\n </div>\n )}\n {summary.extra.length > 0 && (\n <dl className=\"grid grid-cols-1 gap-x-6 gap-y-1 text-xs sm:grid-cols-2\">\n {summary.extra.map((entry) => (\n <div key={entry.key} className=\"flex gap-1.5\">\n <dt className=\"shrink-0 font-medium text-text-primary\">{entry.label}:</dt>\n <dd className=\"min-w-0 break-words text-text-secondary\">{entry.value}</dd>\n </div>\n ))}\n </dl>\n )}\n </div>\n )}\n </div>\n\n {/* Provenance — what the model was actually given */}\n <div className=\"mt-4 border-t border-border-seam pt-3\">\n <h4 className=\"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-text-muted\">\n <FileSearch className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n Considered\n </h4>\n {provenance.length === 0 ? (\n <p className=\"mt-1.5 text-xs text-text-muted\">This run recorded no input references.</p>\n ) : (\n <dl className=\"mt-1.5 grid grid-cols-1 gap-x-6 gap-y-1 text-xs sm:grid-cols-2\">\n {provenance.map((entry) => (\n <div key={entry.key} className=\"flex gap-1.5\">\n <dt className=\"shrink-0 font-medium text-text-primary\">{entry.label}:</dt>\n <dd className=\"min-w-0 break-words text-text-secondary\">{entry.value}</dd>\n </div>\n ))}\n </dl>\n )}\n {programId && (\n <div className=\"mt-2\">\n <ProgramAiState programId={programId} />\n </div>\n )}\n </div>\n\n {/* Coach review */}\n <div className=\"mt-4\">\n {overrideDone && !overrideOpen ? (\n <p className=\"inline-flex items-center gap-1.5 text-sm text-status-success-text\">\n <Check className=\"h-4 w-4\" /> Your decision was recorded as a new ledger row.\n </p>\n ) : overrideOpen ? (\n <OverrideForm\n run={run}\n knownProgramId={programId}\n initialAssessment={overrideDefault}\n onCancel={() => setOverrideOpen(false)}\n onSuccess={() => {\n setOverrideOpen(false);\n setOverrideDone(true);\n }}\n />\n ) : reviewable && programId && summary.assessment ? (\n <ProposalReview\n run={run}\n programId={programId}\n proposed={summary.assessment}\n onOverride={() => {\n setOverrideDone(false);\n setOverrideOpen(true);\n }}\n onDone={() => setOverrideDone(true)}\n />\n ) : (\n <button\n type=\"button\"\n onClick={() => {\n setOverrideDone(false);\n setOverrideOpen(true);\n }}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n <Gavel className=\"h-4 w-4\" /> File a coach decision\n </button>\n )}\n </div>\n </GlassCard>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA2DA,SAASC,EAAe,EAAE,gBAAoC;CAC5D,IAAMC,IAAUC,EAAkBC,CAAS;CAE3C,IAAIF,EAAQ,WACV,OACE,kBAAC,KAAD;EAAG,WAAU;EAAb,UAAA,CACE,kBAACG,GAAD,EAAS,WAAU,uBAAwB,CAAA,GAAC,yBAC3C;;CAGP,IAAIH,EAAQ,WAAW,CAACA,EAAQ,MAE9B,OAAO,kBAAC,KAAD;EAAG,WAAU;EAAb,UAAA;GAAuC;GAASE;GAAU;EAA0B;;CAG7F,IAAME,IAAUJ,EAAQ,KAAK,SACvBK,IAAaC,EAASF,CAAO,IAAIA,EAAQ,mBAAmB,MAC5DG,IACJD,EAASD,CAAU,KAAK,OAAOA,EAAW,UAAW,WAAWA,EAAW,SAAS,MAChFG,IACJF,EAASD,CAAU,KAAK,OAAOA,EAAW,cAAe,WACrDA,EAAW,aACX;CAEN,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAAC,QAAD;IAAM,WAAU;IAAiC,UAAAL,EAAQ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