@leitwerk-dev/ui 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/ApiTokensPage-DCmYvZdE.js +1 -0
- package/dist/assets/ChronicleMarkdown-6T_LF-3B.js +1 -0
- package/dist/assets/FutureLaunchDetailPage-D5Gc8YmZ.js +1 -0
- package/dist/assets/GenericLauncher-4BQGl6fT.js +4 -0
- package/dist/assets/GenericLauncher-DRUMMTd7.css +1 -0
- package/dist/assets/HomePage-mb9RzXht.js +1 -0
- package/dist/assets/ProcessActionsMenu-CEzADnZT.js +1 -0
- package/dist/assets/ProcessDetailPage-0c-fMf4Y.js +14 -0
- package/dist/assets/ProcessDetailPage-km76G8wj.css +1 -0
- package/dist/assets/ProcessFlowDiagram-DI5KZ2Qj.js +1 -0
- package/dist/assets/ProcessFlowDiagram-NQ6oEZi7.css +1 -0
- package/dist/assets/ProcessesPage-CVvENTJg.js +1 -0
- package/dist/assets/ScheduleDateTimePicker-2eJ0jBQ-.css +1 -0
- package/dist/assets/ScheduleDateTimePicker-fg0Vau5Z.js +3 -0
- package/dist/assets/SettingsPage-BHSV4rl7.css +1 -0
- package/dist/assets/SettingsPage-CbNM5RWn.js +2 -0
- package/dist/assets/SkillsPage-rCSwSz89.js +2 -0
- package/dist/assets/WatchersPage-D-uT5vWk.js +1 -0
- package/dist/assets/WikiPage-BNdWnJ6L.js +1 -0
- package/dist/assets/WikiPage-Bvnhxl3m.css +1 -0
- package/dist/assets/http-client-Cvi3zOou.js +2 -0
- package/dist/assets/http-contracts-public-BXXSFKbw.js +1 -0
- package/dist/assets/index-DybyOt1_.css +1 -0
- package/dist/assets/{index-client-BYQviCtQ.js → index-client-BSAA7n1a.js} +2 -2
- package/dist/assets/index-gVt2yBO1.js +21 -0
- package/dist/assets/mermaid-render.worker-BN0bcvGc.js +6398 -0
- package/dist/assets/retry-config.svelte-HNNF65qc.js +1 -0
- package/dist/assets/settings-Dk5UoSQa.js +1 -0
- package/dist/index.html +4 -7
- package/package.json +10 -9
- package/src/App.svelte +9 -0
- package/src/chronicle/components/ChronicleActionSection.svelte +10 -2
- package/src/chronicle/components/ChronicleEntryHeader.svelte +4 -16
- package/src/chronicle/components/ChronicleFlow.svelte +24 -6
- package/src/chronicle/components/ChronicleLiveTail.svelte +52 -24
- package/src/chronicle/components/ChronicleProcessErrorSection.svelte +14 -0
- package/src/chronicle/components/ChronicleQuestionRequest.svelte +1 -1
- package/src/chronicle/components/ChronicleRecoverySection.svelte +14 -10
- package/src/chronicle/components/ChronicleStartupRecoverySection.svelte +14 -10
- package/src/chronicle/components/ChronicleThinkingSection.svelte +8 -2
- package/src/chronicle/components/ChronicleToolApproval.svelte +120 -17
- package/src/chronicle/components/ChronicleToolCallItem.svelte +32 -6
- package/src/chronicle/components/ChronicleTurnCluster.svelte +6 -6
- package/src/chronicle/components/ChronicleTurnProgress.svelte +10 -4
- package/src/chronicle/components/ChronicleTurnRail.svelte +1 -0
- package/src/chronicle/components/RecoveryModelControl.svelte +14 -13
- package/src/chronicle/lib/chronicle-projection.ts +74 -376
- package/src/chronicle/lib/chronicle-selectable-items.ts +23 -3
- package/src/chronicle/lib/recovery-model.ts +17 -0
- package/src/components/ConversationTreeDiagram.svelte +93 -30
- package/src/components/FormFieldRenderer.svelte +184 -27
- package/src/components/GenericLauncher.svelte +378 -166
- package/src/components/NamedSelectionList.svelte +77 -0
- package/src/components/ProcessSettings.svelte +110 -0
- package/src/components/ScheduleDateTimePicker.svelte +9 -4
- package/src/components/SettingsField.svelte +317 -0
- package/src/components/SettingsOverview.svelte +237 -0
- package/src/components/SkillSelector.svelte +15 -3
- package/src/components/launcher-form-copy.ts +2 -1
- package/src/components/launcher-model-config.ts +8 -7
- package/src/components/launcher-selections.ts +123 -0
- package/src/lib/api.ts +89 -43
- package/src/lib/http-client.ts +20 -1
- package/src/lib/instance-tree-layout.ts +41 -10
- package/src/lib/primary-path-detail.ts +56 -341
- package/src/lib/primary-path-replay.ts +8 -9
- package/src/lib/process-history.ts +57 -0
- package/src/lib/processes.svelte.ts +71 -79
- package/src/lib/reasoning-history.ts +31 -23
- package/src/lib/router-logic.ts +101 -51
- package/src/lib/router.svelte.ts +4 -4
- package/src/lib/settings.ts +114 -0
- package/src/lib/wiki.ts +34 -0
- package/src/pages/ProcessDetailPage.svelte +55 -344
- package/src/pages/ProcessFlowDiagram.svelte +39 -684
- package/src/pages/SettingsPage.svelte +265 -0
- package/src/pages/SkillsPage.svelte +26 -12
- package/src/pages/WikiPage.svelte +9 -0
- package/src/pages/process-detail/ProcessDetailChronicle.svelte +57 -13
- package/src/pages/process-detail/ProcessDetailHeader.svelte +9 -3
- package/src/pages/process-detail/TicketCreationComposer.svelte +49 -10
- package/src/pages/process-detail/inspector/ExecutionDetails.svelte +210 -0
- package/src/pages/process-detail/inspector/InspectionEvidence.svelte +48 -0
- package/src/pages/process-detail/inspector/InspectionMessage.svelte +71 -0
- package/src/pages/process-detail/inspector/ProcessInspector.svelte +144 -0
- package/src/pages/process-detail/inspector/ProcessModelEditor.svelte +161 -0
- package/src/pages/process-detail/inspector/ProcessReference.svelte +166 -0
- package/src/pages/process-detail/inspector/inspection-activity.ts +118 -0
- package/src/pages/process-detail/inspector/inspection-data.svelte.ts +107 -0
- package/src/pages/process-detail/inspector/inspection-tool-call.ts +30 -0
- package/src/pages/process-detail/inspector/inspector-navigation.ts +190 -0
- package/src/pages/process-detail/inspector/model-source-label.ts +17 -0
- package/src/pages/process-detail/process-detail-actions.svelte.ts +10 -0
- package/src/pages/process-detail/process-detail-chronicle-scroll.svelte.ts +18 -2
- package/src/pages/process-detail/process-detail-view-model.ts +2 -2
- package/src/shell/AppShell.svelte +5 -0
- package/src/shell/Sidebar.svelte +10 -0
- package/src/test-support/mount.ts +34 -0
- package/dist/assets/ApiTokensPage-ClJp9PYr.js +0 -1
- package/dist/assets/ChronicleMarkdown-lqwX9Ywa.js +0 -16
- package/dist/assets/FutureLaunchDetailPage-ygp-IdXC.js +0 -1
- package/dist/assets/GenericLauncher-CExW6wei.css +0 -1
- package/dist/assets/GenericLauncher-DOwsERpB.js +0 -1
- package/dist/assets/HomePage-D1J-Rmsw.js +0 -1
- package/dist/assets/PageHeader-DPuQInDo.css +0 -1
- package/dist/assets/PageHeader-sphJnWL1.js +0 -1
- package/dist/assets/ProcessActionsMenu-DV9zaxNS.js +0 -1
- package/dist/assets/ProcessDetailPage-BW1M2IH8.js +0 -14
- package/dist/assets/ProcessDetailPage-Cth6A0DN.css +0 -1
- package/dist/assets/ProcessFlowDiagram-Cz8wNicU.css +0 -1
- package/dist/assets/ProcessFlowDiagram-Dx2wheGN.js +0 -2
- package/dist/assets/ProcessesPage-CSPH5L7E.js +0 -1
- package/dist/assets/ScheduleDateTimePicker-DmojMRxN.js +0 -1
- package/dist/assets/ScheduleDateTimePicker-uacJAkIq.css +0 -1
- package/dist/assets/SkillsPage-KnLql0n1.js +0 -2
- package/dist/assets/WatchersPage-B4jf3Ywp.js +0 -1
- package/dist/assets/http-client-VpPXJwbR.js +0 -2
- package/dist/assets/index-DPCokDbS.js +0 -6
- package/dist/assets/index-DtEI5gsQ.css +0 -1
- package/dist/assets/mermaid-render.worker-QW2WZpEE.js +0 -6393
- package/dist/assets/process-terminal-display-BQRQwGod.js +0 -1
- package/dist/assets/router.svelte-EEldxHlO.js +0 -1
- package/src/chronicle/components/ChronicleReasoningDetailsOverlay.svelte +0 -855
- package/src/components/ProcessInfoOverlay.svelte +0 -1221
- package/src/lib/flow-layout.ts +0 -319
- package/src/pages/process-detail/OverlayFrame.svelte +0 -58
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
launchLauncher,
|
|
22
22
|
previewCronExpression,
|
|
23
23
|
updateScheduledLaunch,
|
|
24
|
+
validateLauncher,
|
|
24
25
|
} from "../lib/api.js";
|
|
25
26
|
import { getBrowserStorage } from "../lib/browser-storage.js";
|
|
26
27
|
import { formatLocalDateTime24Hour, formatUtcDateTime24Hour } from "../lib/format.js";
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
readLauncherRecentValues,
|
|
30
31
|
writeLauncherRecentValue,
|
|
31
32
|
} from "../lib/launcher-recent-values.js";
|
|
33
|
+
import { onSettingsChanged } from "../lib/settings.js";
|
|
32
34
|
import FormFieldRenderer from "./FormFieldRenderer.svelte";
|
|
33
35
|
import LaunchChecklist from "./LaunchChecklist.svelte";
|
|
34
36
|
import {
|
|
@@ -52,6 +54,13 @@ import {
|
|
|
52
54
|
localScheduleDateTimePartsToIso,
|
|
53
55
|
splitLauncherScheduleTimeString,
|
|
54
56
|
} from "./launcher-schedule.js";
|
|
57
|
+
import {
|
|
58
|
+
changeLauncherSelection,
|
|
59
|
+
initializeLauncherSelections,
|
|
60
|
+
type LauncherSelections,
|
|
61
|
+
reconcileLauncherSelections,
|
|
62
|
+
selectionValues,
|
|
63
|
+
} from "./launcher-selections.js";
|
|
55
64
|
import ScheduleDateTimePicker from "./ScheduleDateTimePicker.svelte";
|
|
56
65
|
import SkillSelector from "./SkillSelector.svelte";
|
|
57
66
|
|
|
@@ -87,6 +96,8 @@ let titleInputValue = $state("");
|
|
|
87
96
|
let selectedSkillIds = $state<string[]>([]);
|
|
88
97
|
let fieldInputValues = $state<Record<string, LauncherFieldInputValue>>({});
|
|
89
98
|
let fieldOptionsById = $state<Record<string, readonly LauncherFieldOptionDefinition[]>>({});
|
|
99
|
+
let knownFieldOptionsById = $state<Record<string, readonly LauncherFieldOptionDefinition[]>>({});
|
|
100
|
+
let launcherSelections: LauncherSelections = {};
|
|
90
101
|
let recentFieldValuesById = $state<Record<string, readonly string[]>>({});
|
|
91
102
|
let defaultModelProfileId = $state("");
|
|
92
103
|
let turnModelProfileIds = $state<Record<string, string>>({});
|
|
@@ -95,6 +106,7 @@ let turnModelProfileIdsBeforeEditing = $state<Record<string, string> | null>(nul
|
|
|
95
106
|
let loadingDefaults = $state(true);
|
|
96
107
|
let defaultsError = $state<string | null>(null);
|
|
97
108
|
let defaultsWarnings = $state<LauncherValidationError[]>([]);
|
|
109
|
+
let optionsLoading = $state(false);
|
|
98
110
|
let optionsError = $state<string | null>(null);
|
|
99
111
|
let modelConfigPreview = $state<LauncherModelConfigPreview | null>(null);
|
|
100
112
|
let recommendedDefaultModelPreview = $state<LauncherModelConfigPreview["defaultModel"] | null>(
|
|
@@ -108,6 +120,15 @@ let submitError = $state<string | null>(null);
|
|
|
108
120
|
let submitSuccess = $state<string | null>(null);
|
|
109
121
|
let formErrors = $state<string[]>([]);
|
|
110
122
|
let fieldErrors = $state<Record<string, string[]>>({});
|
|
123
|
+
let touchedFields = $state<Record<string, boolean>>({});
|
|
124
|
+
let revealedFields = $state<Record<string, boolean>>({});
|
|
125
|
+
let revealAllErrors = $state(false);
|
|
126
|
+
let validatedKey = $state<string | null>(null);
|
|
127
|
+
let validationLoading = $state(false);
|
|
128
|
+
let validationError = $state<string | null>(null);
|
|
129
|
+
let validationRevision = $state(0);
|
|
130
|
+
let settingsRevision = $state(0);
|
|
131
|
+
let validationDelay = 0;
|
|
111
132
|
let scheduleMode = $state<ScheduleConfigInput["mode"]>("now");
|
|
112
133
|
let scheduledRunOnDate = $state("");
|
|
113
134
|
let scheduledRunAtHour = $state("");
|
|
@@ -119,10 +140,21 @@ let cronPreviewBusy = $state(false);
|
|
|
119
140
|
let defaultsLoadToken = 0;
|
|
120
141
|
let optionsLoadToken = 0;
|
|
121
142
|
let modelConfigPreviewLoadToken = 0;
|
|
143
|
+
$effect(() =>
|
|
144
|
+
onSettingsChanged(() => {
|
|
145
|
+
settingsRevision += 1;
|
|
146
|
+
void loadModelConfigPreview(fieldInputValues, buildLaunchModelConfig());
|
|
147
|
+
}, true),
|
|
148
|
+
);
|
|
122
149
|
let cronPreviewToken = 0;
|
|
123
150
|
let deferredDependentRefreshValues: Record<string, LauncherFieldInputValue> | null = null;
|
|
124
151
|
|
|
125
152
|
const launcherSkills = $derived(launcher.skills ?? []);
|
|
153
|
+
const recentValueFields = $derived(
|
|
154
|
+
launcher.launchConfigSchema.fields.filter(
|
|
155
|
+
(field) => field.kind === "text" && field.rememberRecentValues === true,
|
|
156
|
+
),
|
|
157
|
+
);
|
|
126
158
|
const modelCustomizationState = $derived(
|
|
127
159
|
getLauncherModelCustomizationState({ defaultModelProfileId, turnModelProfileIds }),
|
|
128
160
|
);
|
|
@@ -160,6 +192,91 @@ const defaultsNotice = $derived(
|
|
|
160
192
|
const fieldErrorCount = $derived(
|
|
161
193
|
Object.values(fieldErrors).reduce((total, messages) => total + messages.length, 0),
|
|
162
194
|
);
|
|
195
|
+
const validationFields = $derived([
|
|
196
|
+
...launcher.launchConfigSchema.fields,
|
|
197
|
+
{ id: "process-title", label: "Title", kind: "text" as const },
|
|
198
|
+
{ id: "model-config", label: "Model setup", kind: "text" as const },
|
|
199
|
+
{ id: "skills", label: "Skills", kind: "text" as const },
|
|
200
|
+
{ id: "schedule-date", label: "Start at", kind: "text" as const },
|
|
201
|
+
{ id: "schedule-cron", label: "Cron expression", kind: "text" as const },
|
|
202
|
+
]);
|
|
203
|
+
const validationRequest = $derived({
|
|
204
|
+
...(editingFutureLaunch ? { futureExecutionId: editingFutureLaunch.id } : {}),
|
|
205
|
+
title: buildSubmittedTitle(),
|
|
206
|
+
launcherInput: buildLaunchInput(),
|
|
207
|
+
modelConfig: buildLaunchModelConfig(),
|
|
208
|
+
schedule: buildScheduleConfig(),
|
|
209
|
+
skillIds: [...selectedSkillIds],
|
|
210
|
+
});
|
|
211
|
+
const validationKey = $derived(
|
|
212
|
+
JSON.stringify({ launcherId: launcher.id, request: validationRequest, settingsRevision }),
|
|
213
|
+
);
|
|
214
|
+
const validationPending = $derived(
|
|
215
|
+
loadingDefaults || optionsLoading || validationLoading || validatedKey !== validationKey,
|
|
216
|
+
);
|
|
217
|
+
const submitDisabled = $derived(
|
|
218
|
+
submitBusy ||
|
|
219
|
+
activeLaunchRunId !== null ||
|
|
220
|
+
validationPending ||
|
|
221
|
+
validationError !== null ||
|
|
222
|
+
fieldErrorCount > 0 ||
|
|
223
|
+
formErrors.length > 0,
|
|
224
|
+
);
|
|
225
|
+
const invalidFieldLabels = $derived(
|
|
226
|
+
validationFields.filter((field) => fieldErrors[field.id]?.length).map((field) => field.label),
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
function touchField(fieldId: string, delay = 0) {
|
|
230
|
+
touchedFields = { ...touchedFields, [fieldId]: true };
|
|
231
|
+
validationDelay = delay;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function blurField(fieldId: string) {
|
|
235
|
+
touchField(fieldId);
|
|
236
|
+
flushDeferredDependentRefresh();
|
|
237
|
+
if (validatedKey !== validationKey) validationRevision += 1;
|
|
238
|
+
else revealedFields = { ...revealedFields, [fieldId]: true };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function retryValidation() {
|
|
242
|
+
validationDelay = 0;
|
|
243
|
+
validatedKey = null;
|
|
244
|
+
validationRevision += 1;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
$effect(() => {
|
|
248
|
+
const key = validationKey;
|
|
249
|
+
const request = validationRequest;
|
|
250
|
+
const launcherId = launcher.id;
|
|
251
|
+
validationRevision;
|
|
252
|
+
if (loadingDefaults || defaultsError || optionsLoading) return;
|
|
253
|
+
const controller = new AbortController();
|
|
254
|
+
validationLoading = true;
|
|
255
|
+
validationError = null;
|
|
256
|
+
async function validate() {
|
|
257
|
+
try {
|
|
258
|
+
const errors = await validateLauncher(launcherId, request, controller.signal);
|
|
259
|
+
if (controller.signal.aborted || key !== validationKey) return;
|
|
260
|
+
applyValidationErrors(errors);
|
|
261
|
+
} catch (error) {
|
|
262
|
+
if (controller.signal.aborted || key !== validationKey) return;
|
|
263
|
+
validationError =
|
|
264
|
+
error instanceof Error ? error.message : "Couldn't validate the launch values. Try again.";
|
|
265
|
+
} finally {
|
|
266
|
+
if (!controller.signal.aborted && key === validationKey) {
|
|
267
|
+
validatedKey = key;
|
|
268
|
+
validationLoading = false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const timer = validationDelay > 0 ? setTimeout(() => void validate(), validationDelay) : null;
|
|
273
|
+
if (timer === null) void validate();
|
|
274
|
+
return () => {
|
|
275
|
+
if (timer !== null) clearTimeout(timer);
|
|
276
|
+
controller.abort();
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
|
|
163
280
|
const cronExamples = [
|
|
164
281
|
{ expression: "0 9 * * 1-5", label: "Weekdays at 09:00 UTC" },
|
|
165
282
|
{ expression: "0 13 * * *", label: "Daily at 13:00 UTC" },
|
|
@@ -167,10 +284,11 @@ const cronExamples = [
|
|
|
167
284
|
{ expression: "30 8 * * 1", label: "Mondays at 08:30 UTC" },
|
|
168
285
|
] as const;
|
|
169
286
|
const MAX_PROCESS_TITLE_LENGTH = 80;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
287
|
+
const scheduleModes = [
|
|
288
|
+
{ mode: "now", label: "Start now" },
|
|
289
|
+
{ mode: "once", label: "Start later" },
|
|
290
|
+
{ mode: "cron", label: "Run on cron" },
|
|
291
|
+
] as const;
|
|
174
292
|
|
|
175
293
|
function buildFieldDomId(fieldId: string): string {
|
|
176
294
|
return `${launcher.launchConfigSchema.id}-${fieldId}`;
|
|
@@ -250,10 +368,7 @@ function loadRecentFieldValuesFromStorage(): Record<string, readonly string[]> {
|
|
|
250
368
|
return {};
|
|
251
369
|
}
|
|
252
370
|
const nextValues: Record<string, readonly string[]> = {};
|
|
253
|
-
for (const field of
|
|
254
|
-
if (field.kind !== "text" || field.rememberRecentValues !== true) {
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
371
|
+
for (const field of recentValueFields) {
|
|
257
372
|
nextValues[field.id] = readLauncherRecentValues(storage, launcher.id, field.id);
|
|
258
373
|
}
|
|
259
374
|
return nextValues;
|
|
@@ -263,10 +378,7 @@ function mergeRecentFieldValues(
|
|
|
263
378
|
...sources: readonly Record<string, readonly string[]>[]
|
|
264
379
|
): Record<string, readonly string[]> {
|
|
265
380
|
const nextValues: Record<string, readonly string[]> = {};
|
|
266
|
-
for (const field of
|
|
267
|
-
if (field.kind !== "text" || field.rememberRecentValues !== true) {
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
381
|
+
for (const field of recentValueFields) {
|
|
270
382
|
nextValues[field.id] = normalizeLauncherRecentValues(
|
|
271
383
|
sources.flatMap((source) => source[field.id] ?? []),
|
|
272
384
|
);
|
|
@@ -289,10 +401,7 @@ function rememberSuccessfulLauncherFieldValues(launcherInput: Record<string, unk
|
|
|
289
401
|
return;
|
|
290
402
|
}
|
|
291
403
|
const nextValues = { ...recentFieldValuesById };
|
|
292
|
-
for (const field of
|
|
293
|
-
if (field.kind !== "text" || field.rememberRecentValues !== true) {
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
404
|
+
for (const field of recentValueFields) {
|
|
296
405
|
nextValues[field.id] = writeLauncherRecentValue(
|
|
297
406
|
storage,
|
|
298
407
|
launcher.id,
|
|
@@ -416,8 +525,6 @@ function shouldAutoOpenAdvancedModelConfig(modelConfig: LauncherModelConfigDefau
|
|
|
416
525
|
function clearSubmissionState() {
|
|
417
526
|
submitError = null;
|
|
418
527
|
submitSuccess = null;
|
|
419
|
-
formErrors = [];
|
|
420
|
-
fieldErrors = {};
|
|
421
528
|
}
|
|
422
529
|
|
|
423
530
|
function getTurnModelPreview(turnId: string): LauncherTurnModelConfigPreview["effective"] | null {
|
|
@@ -489,6 +596,7 @@ async function loadOptions(values: Record<string, LauncherFieldInputValue>) {
|
|
|
489
596
|
}
|
|
490
597
|
|
|
491
598
|
const token = ++optionsLoadToken;
|
|
599
|
+
optionsLoading = true;
|
|
492
600
|
optionsError = null;
|
|
493
601
|
try {
|
|
494
602
|
const options = await fetchLauncherOptions(launcher.id, buildLaunchInputFromValues(values));
|
|
@@ -496,22 +604,37 @@ async function loadOptions(values: Record<string, LauncherFieldInputValue>) {
|
|
|
496
604
|
return;
|
|
497
605
|
}
|
|
498
606
|
fieldOptionsById = options;
|
|
607
|
+
for (const [id, choices] of Object.entries(options)) {
|
|
608
|
+
const known = new Map(
|
|
609
|
+
(knownFieldOptionsById[id] ?? []).map((option) => [option.value, option]),
|
|
610
|
+
);
|
|
611
|
+
for (const option of choices) known.set(option.value, option);
|
|
612
|
+
knownFieldOptionsById[id] = [...known.values()];
|
|
613
|
+
}
|
|
614
|
+
const reconciled = reconcileLauncherSelections(
|
|
615
|
+
launcher.launchConfigSchema.fields,
|
|
616
|
+
fieldInputValues,
|
|
617
|
+
options,
|
|
618
|
+
launcherSelections,
|
|
619
|
+
);
|
|
620
|
+
const changed = JSON.stringify(reconciled.values) !== JSON.stringify(fieldInputValues);
|
|
621
|
+
fieldInputValues = reconciled.values;
|
|
622
|
+
launcherSelections = reconciled.selections;
|
|
623
|
+
if (changed) void loadModelConfigPreview(fieldInputValues, buildLaunchModelConfig());
|
|
499
624
|
} catch (error) {
|
|
500
625
|
if (token !== optionsLoadToken) {
|
|
501
626
|
return;
|
|
502
627
|
}
|
|
503
628
|
optionsError =
|
|
504
629
|
error instanceof Error ? error.message : "We couldn't refresh the available options";
|
|
630
|
+
} finally {
|
|
631
|
+
if (token === optionsLoadToken) optionsLoading = false;
|
|
505
632
|
}
|
|
506
633
|
}
|
|
507
634
|
|
|
508
635
|
function refreshDependentLauncherState(values: Record<string, LauncherFieldInputValue>) {
|
|
509
|
-
const nextModelConfig = buildLaunchModelConfigFromValues({
|
|
510
|
-
defaultModelProfileId,
|
|
511
|
-
turnModelProfileIds,
|
|
512
|
-
});
|
|
513
636
|
void loadOptions(values);
|
|
514
|
-
void loadModelConfigPreview(values,
|
|
637
|
+
void loadModelConfigPreview(values, buildLaunchModelConfig());
|
|
515
638
|
}
|
|
516
639
|
|
|
517
640
|
function scheduleDependentLauncherRefresh(
|
|
@@ -530,6 +653,15 @@ async function loadDefaults() {
|
|
|
530
653
|
const token = ++defaultsLoadToken;
|
|
531
654
|
clearDeferredDependentRefresh();
|
|
532
655
|
loadingDefaults = true;
|
|
656
|
+
optionsLoading = false;
|
|
657
|
+
validatedKey = null;
|
|
658
|
+
validationError = null;
|
|
659
|
+
validationDelay = 0;
|
|
660
|
+
touchedFields = {};
|
|
661
|
+
revealedFields = {};
|
|
662
|
+
revealAllErrors = false;
|
|
663
|
+
formErrors = [];
|
|
664
|
+
fieldErrors = {};
|
|
533
665
|
defaultsError = null;
|
|
534
666
|
defaultsWarnings = [];
|
|
535
667
|
optionsError = null;
|
|
@@ -539,6 +671,8 @@ async function loadDefaults() {
|
|
|
539
671
|
selectedSkillIds = [];
|
|
540
672
|
fieldInputValues = createFieldInputValues({});
|
|
541
673
|
fieldOptionsById = {};
|
|
674
|
+
knownFieldOptionsById = {};
|
|
675
|
+
launcherSelections = {};
|
|
542
676
|
recentFieldValuesById = loadRecentFieldValuesFromStorage();
|
|
543
677
|
modelConfigPreview = null;
|
|
544
678
|
modelConfigPreviewLoading = false;
|
|
@@ -567,6 +701,10 @@ async function loadDefaults() {
|
|
|
567
701
|
const mergedModelConfig = relaunchDraft?.modelConfig ?? initialModelConfig ?? modelConfig;
|
|
568
702
|
defaultsWarnings = warnings ?? [];
|
|
569
703
|
const nextValues = createFieldInputValues(mergedDefaults);
|
|
704
|
+
launcherSelections = initializeLauncherSelections(
|
|
705
|
+
launcher.launchConfigSchema.fields,
|
|
706
|
+
draftValues ?? defaults,
|
|
707
|
+
);
|
|
570
708
|
const initialScheduleConfig = createInitialSchedule();
|
|
571
709
|
titleInputValue = mergedTitle;
|
|
572
710
|
selectedSkillIds = [...(relaunchDraft?.skillIds ?? initialSkillIds ?? [])];
|
|
@@ -597,8 +735,8 @@ async function loadDefaults() {
|
|
|
597
735
|
typeof initialScheduleConfig.cronExpression === "string"
|
|
598
736
|
? initialScheduleConfig.cronExpression
|
|
599
737
|
: "";
|
|
600
|
-
void loadOptions(nextValues);
|
|
601
738
|
void loadModelConfigPreview(nextValues, mergedModelConfig);
|
|
739
|
+
await loadOptions(nextValues);
|
|
602
740
|
} catch (error) {
|
|
603
741
|
if (token !== defaultsLoadToken) {
|
|
604
742
|
return;
|
|
@@ -635,22 +773,28 @@ function getStringValue(fieldId: string): string {
|
|
|
635
773
|
return typeof value === "string" ? value : "";
|
|
636
774
|
}
|
|
637
775
|
|
|
638
|
-
function getNumberValue(fieldId: string): string {
|
|
639
|
-
const value = fieldInputValues[fieldId];
|
|
640
|
-
return typeof value === "string" ? value : "";
|
|
641
|
-
}
|
|
642
|
-
|
|
643
776
|
function getBooleanValue(fieldId: string): boolean {
|
|
644
777
|
return fieldInputValues[fieldId] === true;
|
|
645
778
|
}
|
|
646
779
|
|
|
647
780
|
function getFieldErrors(fieldId: string): string[] {
|
|
648
|
-
return fieldErrors[fieldId] ?? [];
|
|
781
|
+
return revealAllErrors || revealedFields[fieldId] ? (fieldErrors[fieldId] ?? []) : [];
|
|
649
782
|
}
|
|
650
783
|
|
|
651
784
|
function getFieldOptions(field: LauncherFieldDefinition): readonly LauncherFieldOptionDefinition[] {
|
|
652
785
|
const baseOptions = fieldOptionsById[field.id] ?? field.options ?? [];
|
|
653
786
|
const currentValue = getStringValue(field.id).trim();
|
|
787
|
+
if (field.kind === "select" && field.multiple)
|
|
788
|
+
return [
|
|
789
|
+
...currentValue
|
|
790
|
+
.split("\n")
|
|
791
|
+
.filter((value) => value && !baseOptions.some((option) => option.value === value))
|
|
792
|
+
.map((value) => ({
|
|
793
|
+
value,
|
|
794
|
+
label: `${knownFieldOptionsById[field.id]?.find((option) => option.value === value)?.label ?? value} (unavailable)`,
|
|
795
|
+
})),
|
|
796
|
+
...baseOptions,
|
|
797
|
+
];
|
|
654
798
|
if (
|
|
655
799
|
field.kind !== "select" ||
|
|
656
800
|
currentValue === "" ||
|
|
@@ -661,6 +805,30 @@ function getFieldOptions(field: LauncherFieldDefinition): readonly LauncherField
|
|
|
661
805
|
return [{ value: currentValue, label: currentValue }, ...baseOptions];
|
|
662
806
|
}
|
|
663
807
|
|
|
808
|
+
function getSelectionDetails(field: LauncherFieldDefinition): Record<string, string> | undefined {
|
|
809
|
+
if (!field.presetsFrom) return undefined;
|
|
810
|
+
const selectedPresets = selectionValues(fieldInputValues[field.presetsFrom]);
|
|
811
|
+
const sourceField = launcher.launchConfigSchema.fields.find(
|
|
812
|
+
(source) => source.id === field.presetsFrom,
|
|
813
|
+
);
|
|
814
|
+
const presets = (knownFieldOptionsById[field.presetsFrom] ?? sourceField?.options ?? []).filter(
|
|
815
|
+
(option) => selectedPresets.includes(option.value),
|
|
816
|
+
);
|
|
817
|
+
const selected = selectionValues(fieldInputValues[field.id]);
|
|
818
|
+
return Object.fromEntries(
|
|
819
|
+
getFieldOptions(field).map((option) => {
|
|
820
|
+
const names = presets
|
|
821
|
+
.filter((preset) => preset.selectionValues?.includes(option.value))
|
|
822
|
+
.map((preset) => preset.label);
|
|
823
|
+
return [
|
|
824
|
+
option.value,
|
|
825
|
+
names.join(", ") ||
|
|
826
|
+
(selected.includes(option.value) ? "Added individually" : "Outside selected groups"),
|
|
827
|
+
];
|
|
828
|
+
}),
|
|
829
|
+
);
|
|
830
|
+
}
|
|
831
|
+
|
|
664
832
|
function getSelectedFieldOption(
|
|
665
833
|
field: LauncherFieldDefinition,
|
|
666
834
|
): LauncherFieldOptionDefinition | null {
|
|
@@ -674,64 +842,53 @@ function getSelectedFieldOption(
|
|
|
674
842
|
return getFieldOptions(field).find((option) => option.value === currentValue) ?? null;
|
|
675
843
|
}
|
|
676
844
|
|
|
677
|
-
function updateFieldErrorState(fieldId: string) {
|
|
678
|
-
if (!fieldErrors[fieldId]) {
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
const nextFieldErrors = { ...fieldErrors };
|
|
682
|
-
delete nextFieldErrors[fieldId];
|
|
683
|
-
fieldErrors = nextFieldErrors;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
845
|
function setFieldValue(
|
|
687
846
|
field: LauncherFieldDefinition,
|
|
688
847
|
value: LauncherFieldInputValue,
|
|
689
848
|
options: { dependentRefresh?: "immediate" | "deferred" } = {},
|
|
690
849
|
) {
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
850
|
+
const changed = changeLauncherSelection(
|
|
851
|
+
launcher.launchConfigSchema.fields,
|
|
852
|
+
fieldInputValues,
|
|
853
|
+
fieldOptionsById,
|
|
854
|
+
launcherSelections,
|
|
855
|
+
field.id,
|
|
856
|
+
value,
|
|
857
|
+
);
|
|
858
|
+
const nextValues = changed.values;
|
|
859
|
+
launcherSelections = changed.selections;
|
|
860
|
+
for (const id of changed.resetFields) {
|
|
861
|
+
delete fieldOptionsById[id];
|
|
862
|
+
delete knownFieldOptionsById[id];
|
|
863
|
+
touchField(id);
|
|
864
|
+
}
|
|
695
865
|
fieldInputValues = nextValues;
|
|
696
|
-
|
|
866
|
+
touchField(
|
|
867
|
+
field.id,
|
|
868
|
+
field.kind === "text" || field.kind === "textarea" || field.kind === "number" ? 300 : 0,
|
|
869
|
+
);
|
|
697
870
|
submitError = null;
|
|
698
|
-
formErrors = [];
|
|
699
871
|
scheduleDependentLauncherRefresh(
|
|
700
872
|
nextValues,
|
|
701
873
|
options.dependentRefresh ?? getFieldDependentRefreshMode(field),
|
|
702
874
|
);
|
|
703
875
|
}
|
|
704
876
|
|
|
705
|
-
function
|
|
706
|
-
|
|
877
|
+
function refreshEditedModelConfig() {
|
|
878
|
+
touchField("model-config");
|
|
707
879
|
submitError = null;
|
|
708
|
-
formErrors = [];
|
|
709
880
|
clearDeferredDependentRefresh();
|
|
710
|
-
void loadModelConfigPreview(
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
);
|
|
881
|
+
void loadModelConfigPreview(fieldInputValues, buildLaunchModelConfig());
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
function setDefaultModelProfileValue(value: string) {
|
|
885
|
+
defaultModelProfileId = value;
|
|
886
|
+
refreshEditedModelConfig();
|
|
717
887
|
}
|
|
718
888
|
|
|
719
889
|
function setTurnModelProfileValue(turnId: string, value: string) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
[turnId]: value,
|
|
723
|
-
};
|
|
724
|
-
turnModelProfileIds = nextTurnModelProfileIds;
|
|
725
|
-
submitError = null;
|
|
726
|
-
formErrors = [];
|
|
727
|
-
clearDeferredDependentRefresh();
|
|
728
|
-
void loadModelConfigPreview(
|
|
729
|
-
fieldInputValues,
|
|
730
|
-
buildLaunchModelConfigFromValues({
|
|
731
|
-
defaultModelProfileId,
|
|
732
|
-
turnModelProfileIds: nextTurnModelProfileIds,
|
|
733
|
-
}),
|
|
734
|
-
);
|
|
890
|
+
turnModelProfileIds = { ...turnModelProfileIds, [turnId]: value };
|
|
891
|
+
refreshEditedModelConfig();
|
|
735
892
|
}
|
|
736
893
|
|
|
737
894
|
function openModelConfigEditor() {
|
|
@@ -745,36 +902,14 @@ function closeModelConfigEditor() {
|
|
|
745
902
|
}
|
|
746
903
|
|
|
747
904
|
function cancelModelConfigEditing() {
|
|
748
|
-
|
|
749
|
-
turnModelProfileIds = nextTurnModelProfileIds;
|
|
750
|
-
submitError = null;
|
|
751
|
-
formErrors = [];
|
|
752
|
-
modelConfigPreviewError = null;
|
|
753
|
-
clearDeferredDependentRefresh();
|
|
905
|
+
turnModelProfileIds = turnModelProfileIdsBeforeEditing ?? { ...turnModelProfileIds };
|
|
754
906
|
closeModelConfigEditor();
|
|
755
|
-
|
|
756
|
-
fieldInputValues,
|
|
757
|
-
buildLaunchModelConfigFromValues({
|
|
758
|
-
defaultModelProfileId,
|
|
759
|
-
turnModelProfileIds: nextTurnModelProfileIds,
|
|
760
|
-
}),
|
|
761
|
-
);
|
|
907
|
+
refreshEditedModelConfig();
|
|
762
908
|
}
|
|
763
909
|
|
|
764
910
|
function resetModelConfigToRecommended() {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
submitError = null;
|
|
768
|
-
formErrors = [];
|
|
769
|
-
modelConfigPreviewError = null;
|
|
770
|
-
clearDeferredDependentRefresh();
|
|
771
|
-
void loadModelConfigPreview(
|
|
772
|
-
fieldInputValues,
|
|
773
|
-
buildLaunchModelConfigFromValues({
|
|
774
|
-
defaultModelProfileId,
|
|
775
|
-
turnModelProfileIds: nextTurnModelProfileIds,
|
|
776
|
-
}),
|
|
777
|
-
);
|
|
911
|
+
turnModelProfileIds = createTurnModelProfileIds({});
|
|
912
|
+
refreshEditedModelConfig();
|
|
778
913
|
}
|
|
779
914
|
|
|
780
915
|
function resetCronPreviewState(invalidatePending = false) {
|
|
@@ -786,11 +921,6 @@ function resetCronPreviewState(invalidatePending = false) {
|
|
|
786
921
|
cronPreviewBusy = false;
|
|
787
922
|
}
|
|
788
923
|
|
|
789
|
-
function clearScheduleSubmissionState() {
|
|
790
|
-
submitError = null;
|
|
791
|
-
submitSuccess = null;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
924
|
function prefillScheduledRunAtFromNowIfBlank() {
|
|
795
925
|
if (scheduledRunOnDate !== "" || scheduledRunAtHour !== "" || scheduledRunAtMinute !== "") {
|
|
796
926
|
return;
|
|
@@ -804,28 +934,32 @@ function prefillScheduledRunAtFromNowIfBlank() {
|
|
|
804
934
|
|
|
805
935
|
function setScheduleMode(value: ScheduleConfigInput["mode"]) {
|
|
806
936
|
scheduleMode = value;
|
|
937
|
+
touchField(value === "cron" ? "schedule-cron" : "schedule-date");
|
|
807
938
|
if (value === "once") {
|
|
808
939
|
prefillScheduledRunAtFromNowIfBlank();
|
|
809
940
|
}
|
|
810
|
-
|
|
941
|
+
clearSubmissionState();
|
|
811
942
|
if (value !== "cron") {
|
|
812
943
|
resetCronPreviewState(true);
|
|
813
944
|
}
|
|
814
945
|
}
|
|
815
946
|
|
|
816
947
|
function setScheduledRunDate(value: string) {
|
|
948
|
+
touchField("schedule-date");
|
|
817
949
|
scheduledRunOnDate = value;
|
|
818
|
-
|
|
950
|
+
clearSubmissionState();
|
|
819
951
|
}
|
|
820
952
|
|
|
821
953
|
function setScheduledRunHour(value: string) {
|
|
954
|
+
touchField("schedule-date");
|
|
822
955
|
scheduledRunAtHour = value;
|
|
823
|
-
|
|
956
|
+
clearSubmissionState();
|
|
824
957
|
}
|
|
825
958
|
|
|
826
959
|
function setScheduledRunMinute(value: string) {
|
|
960
|
+
touchField("schedule-date");
|
|
827
961
|
scheduledRunAtMinute = value;
|
|
828
|
-
|
|
962
|
+
clearSubmissionState();
|
|
829
963
|
}
|
|
830
964
|
|
|
831
965
|
function getScheduledRunTimeValue(): string {
|
|
@@ -859,6 +993,7 @@ function buildScheduleConfig(): ScheduleConfigInput {
|
|
|
859
993
|
}
|
|
860
994
|
|
|
861
995
|
function applyCronExample(expression: string) {
|
|
996
|
+
touchField("schedule-cron");
|
|
862
997
|
cronExpression = expression;
|
|
863
998
|
submitError = null;
|
|
864
999
|
submitSuccess = null;
|
|
@@ -905,11 +1040,32 @@ $effect(() => {
|
|
|
905
1040
|
}
|
|
906
1041
|
void refreshCronPreview(expression);
|
|
907
1042
|
});
|
|
908
|
-
function applyValidationErrors(errors: readonly LauncherValidationError[]) {
|
|
909
|
-
|
|
1043
|
+
function applyValidationErrors(errors: readonly LauncherValidationError[], focus = false) {
|
|
1044
|
+
// Reveal newly edited fields only when their current values have been checked.
|
|
1045
|
+
// Otherwise an empty field's initial error can flash while the user starts typing.
|
|
1046
|
+
revealedFields = { ...revealedFields, ...touchedFields };
|
|
1047
|
+
const normalized = normalizeLauncherValidationErrors(
|
|
1048
|
+
validationFields,
|
|
1049
|
+
errors.map((error) => ({
|
|
1050
|
+
...error,
|
|
1051
|
+
fieldId:
|
|
1052
|
+
error.fieldId ??
|
|
1053
|
+
(error.code === "invalid_schedule"
|
|
1054
|
+
? scheduleMode === "cron"
|
|
1055
|
+
? "schedule-cron"
|
|
1056
|
+
: "schedule-date"
|
|
1057
|
+
: error.code === "invalid_model_config"
|
|
1058
|
+
? "model-config"
|
|
1059
|
+
: error.code === "invalid_skill_selection"
|
|
1060
|
+
? "skills"
|
|
1061
|
+
: undefined),
|
|
1062
|
+
})),
|
|
1063
|
+
);
|
|
910
1064
|
fieldErrors = normalized.fieldErrors;
|
|
911
1065
|
formErrors = normalized.formErrors;
|
|
912
1066
|
|
|
1067
|
+
if (!focus) return;
|
|
1068
|
+
revealAllErrors = true;
|
|
913
1069
|
const firstInvalidFieldId = getFirstLauncherFieldIdWithErrors(
|
|
914
1070
|
launcher.launchConfigSchema.fields,
|
|
915
1071
|
normalized.fieldErrors,
|
|
@@ -954,6 +1110,14 @@ function submitButtonLabel(): string {
|
|
|
954
1110
|
|
|
955
1111
|
async function handleSubmit(event: SubmitEvent) {
|
|
956
1112
|
event.preventDefault();
|
|
1113
|
+
if (submitDisabled) {
|
|
1114
|
+
if (!validationPending) {
|
|
1115
|
+
revealAllErrors = true;
|
|
1116
|
+
const first = getFirstLauncherFieldIdWithErrors(validationFields, fieldErrors);
|
|
1117
|
+
if (first) focusLauncherField(first);
|
|
1118
|
+
}
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
957
1121
|
clearDeferredDependentRefresh();
|
|
958
1122
|
clearSubmissionState();
|
|
959
1123
|
submitBusy = true;
|
|
@@ -973,23 +1137,15 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
973
1137
|
const title = buildSubmittedTitle();
|
|
974
1138
|
const launcherInput = buildLaunchInput();
|
|
975
1139
|
const modelConfig = buildLaunchModelConfig();
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
: await launchLauncher(
|
|
986
|
-
launcher.id,
|
|
987
|
-
title,
|
|
988
|
-
launcherInput,
|
|
989
|
-
modelConfig,
|
|
990
|
-
schedule,
|
|
991
|
-
selectedSkillIds,
|
|
992
|
-
);
|
|
1140
|
+
const submit = editingFutureLaunch ? updateScheduledLaunch : launchLauncher;
|
|
1141
|
+
const result = await submit(
|
|
1142
|
+
editingFutureLaunch?.id ?? launcher.id,
|
|
1143
|
+
title,
|
|
1144
|
+
launcherInput,
|
|
1145
|
+
modelConfig,
|
|
1146
|
+
schedule,
|
|
1147
|
+
selectedSkillIds,
|
|
1148
|
+
);
|
|
993
1149
|
switch (result.kind) {
|
|
994
1150
|
case "launch_started":
|
|
995
1151
|
activeLaunchRunId = result.launchRunId;
|
|
@@ -1010,7 +1166,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1010
1166
|
: `Scheduled for ${formatLocalDateTime24Hour(result.futureExecution.nextRunAt)}.`;
|
|
1011
1167
|
return;
|
|
1012
1168
|
case "validation_error":
|
|
1013
|
-
applyValidationErrors(result.errors);
|
|
1169
|
+
applyValidationErrors(result.errors, true);
|
|
1014
1170
|
return;
|
|
1015
1171
|
case "failure":
|
|
1016
1172
|
submitError = result.error;
|
|
@@ -1024,6 +1180,14 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1024
1180
|
}
|
|
1025
1181
|
</script>
|
|
1026
1182
|
|
|
1183
|
+
{#snippet validationMessages(fieldId: string)}
|
|
1184
|
+
{#if getFieldErrors(fieldId).length > 0}
|
|
1185
|
+
<ul class="inline-validation-errors" id={fieldErrorsDomId(fieldId)} aria-live="polite">
|
|
1186
|
+
{#each getFieldErrors(fieldId) as message (message)}<li>{message}</li>{/each}
|
|
1187
|
+
</ul>
|
|
1188
|
+
{/if}
|
|
1189
|
+
{/snippet}
|
|
1190
|
+
|
|
1027
1191
|
<div class="launcher-form" data-launcher-id={launcher.id} aria-busy={submitBusy || loadingDefaults}>
|
|
1028
1192
|
{#if loadingDefaults}
|
|
1029
1193
|
<p class="state-msg">Loading the starter values for this process…</p>
|
|
@@ -1075,7 +1239,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1075
1239
|
</div>
|
|
1076
1240
|
{/if}
|
|
1077
1241
|
|
|
1078
|
-
{#if submitError || formErrors.length > 0 || fieldErrorCount > 0}
|
|
1242
|
+
{#if submitError || formErrors.length > 0 || (revealAllErrors && fieldErrorCount > 0)}
|
|
1079
1243
|
<div
|
|
1080
1244
|
class="form-error-banner"
|
|
1081
1245
|
data-section="launcher-form-error-banner"
|
|
@@ -1087,7 +1251,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1087
1251
|
{fieldErrorCount > 0 ? "Check the highlighted fields." : "We couldn't continue yet."}
|
|
1088
1252
|
</p>
|
|
1089
1253
|
{#if fieldErrorCount > 0}
|
|
1090
|
-
<p>
|
|
1254
|
+
<p>Review the highlighted details before continuing.</p>
|
|
1091
1255
|
{/if}
|
|
1092
1256
|
{#if submitError}
|
|
1093
1257
|
<p>{submitError}</p>
|
|
@@ -1113,9 +1277,12 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1113
1277
|
|
|
1114
1278
|
<form class="launcher-fields" novalidate onsubmit={handleSubmit}>
|
|
1115
1279
|
<div class="field-group title-field">
|
|
1116
|
-
<label class="field-label" for={
|
|
1280
|
+
<label class="field-label" for={buildFieldDomId("process-title")}>Title</label>
|
|
1117
1281
|
<input
|
|
1118
|
-
id={
|
|
1282
|
+
id={buildFieldDomId("process-title")}
|
|
1283
|
+
aria-invalid={getFieldErrors("process-title").length > 0}
|
|
1284
|
+
aria-describedby={getFieldErrors("process-title").length ? fieldErrorsDomId("process-title") : undefined}
|
|
1285
|
+
onblur={() => blurField("process-title")}
|
|
1119
1286
|
data-launcher-form-field
|
|
1120
1287
|
type="text"
|
|
1121
1288
|
value={titleInputValue}
|
|
@@ -1123,20 +1290,18 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1123
1290
|
maxlength={MAX_PROCESS_TITLE_LENGTH}
|
|
1124
1291
|
oninput={(event) => {
|
|
1125
1292
|
titleInputValue = (event.currentTarget as HTMLInputElement).value;
|
|
1293
|
+
touchField("process-title", 300);
|
|
1126
1294
|
clearSubmissionState();
|
|
1127
1295
|
}}
|
|
1128
1296
|
/>
|
|
1129
1297
|
<p class="field-description">Leave blank to generate a title later.</p>
|
|
1298
|
+
{@render validationMessages("process-title")}
|
|
1130
1299
|
</div>
|
|
1131
1300
|
{#each launcher.launchConfigSchema.fields as field (field.id)}
|
|
1132
1301
|
<FormFieldRenderer
|
|
1133
1302
|
{field}
|
|
1134
1303
|
id={buildFieldDomId(field.id)}
|
|
1135
|
-
value={field.kind === "boolean"
|
|
1136
|
-
? getBooleanValue(field.id)
|
|
1137
|
-
: field.kind === "number"
|
|
1138
|
-
? getNumberValue(field.id)
|
|
1139
|
-
: getStringValue(field.id)}
|
|
1304
|
+
value={field.kind === "boolean" ? getBooleanValue(field.id) : getStringValue(field.id)}
|
|
1140
1305
|
errors={getFieldErrors(field.id)}
|
|
1141
1306
|
descriptionId={fieldDescriptionDomId(field.id)}
|
|
1142
1307
|
errorId={fieldErrorsDomId(field.id)}
|
|
@@ -1144,23 +1309,36 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1144
1309
|
marker="launcher"
|
|
1145
1310
|
textareaRows={5}
|
|
1146
1311
|
options={getFieldOptions(field)}
|
|
1312
|
+
optionDetails={getSelectionDetails(field)}
|
|
1147
1313
|
selectedOptionDescription={getSelectedFieldOption(field)?.description ?? null}
|
|
1148
1314
|
selectedOptionDescriptionId={fieldOptionDescriptionDomId(field.id)}
|
|
1149
1315
|
recentValues={getRememberedRecentValues(field)}
|
|
1150
1316
|
layout="split"
|
|
1151
1317
|
onValueChange={(changedField, value) => setFieldValue(changedField, value)}
|
|
1152
|
-
onTextBlur={
|
|
1318
|
+
onTextBlur={() => blurField(field.id)}
|
|
1153
1319
|
onRecentValue={(changedField, value) =>
|
|
1154
1320
|
setFieldValue(changedField, value, { dependentRefresh: "immediate" })}
|
|
1155
1321
|
/>
|
|
1156
1322
|
{/each}
|
|
1157
1323
|
|
|
1158
1324
|
{#if launcherSkills.length > 0}
|
|
1159
|
-
<SkillSelector skills={launcherSkills} bind:selectedIds={selectedSkillIds}
|
|
1325
|
+
<SkillSelector skills={launcherSkills} bind:selectedIds={selectedSkillIds}
|
|
1326
|
+
id={buildFieldDomId("skills")}
|
|
1327
|
+
invalid={getFieldErrors("skills").length > 0}
|
|
1328
|
+
describedBy={getFieldErrors("skills").length ? fieldErrorsDomId("skills") : undefined}
|
|
1329
|
+
onSelectionChange={() => touchField("skills")} />
|
|
1330
|
+
{@render validationMessages("skills")}
|
|
1160
1331
|
{/if}
|
|
1161
1332
|
|
|
1162
1333
|
{#if hasModelConfigFields()}
|
|
1163
|
-
<section class="field-group model-config-group" data-section="launcher-model-config"
|
|
1334
|
+
<section class="field-group model-config-group" data-section="launcher-model-config"
|
|
1335
|
+
id={buildFieldDomId("model-config")} tabindex="-1" role="group" aria-label="Model setup"
|
|
1336
|
+
data-invalid={getFieldErrors("model-config").length > 0}
|
|
1337
|
+
aria-describedby={getFieldErrors("model-config").length ? fieldErrorsDomId("model-config") : undefined}>
|
|
1338
|
+
{@render validationMessages("model-config")}
|
|
1339
|
+
<a href={`/settings?scope=${encodeURIComponent(modelConfigPreview?.settingsSubjectId ?? "instance")}`}>Repository and instance defaults</a>
|
|
1340
|
+
{#each modelConfigPreview?.settingsExplanations ?? [] as explanation}<p>{explanation}</p>{/each}
|
|
1341
|
+
{#each modelConfigPreview?.turns ?? [] as turn}{#if turn.effective.error}<p role="alert">{turn.description}: {turn.effective.error}</p>{/if}{/each}
|
|
1164
1342
|
<div class="model-config-intro">
|
|
1165
1343
|
<p class="field-label">Model setup</p>
|
|
1166
1344
|
<p class="field-description">
|
|
@@ -1182,6 +1360,8 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1182
1360
|
<select
|
|
1183
1361
|
id={`${launcher.launchConfigSchema.id}-default-model-profile`}
|
|
1184
1362
|
class="model-config-default-select"
|
|
1363
|
+
aria-invalid={getFieldErrors("model-config").length > 0}
|
|
1364
|
+
aria-describedby={getFieldErrors("model-config").length ? fieldErrorsDomId("model-config") : undefined}
|
|
1185
1365
|
value={defaultModelProfileId}
|
|
1186
1366
|
onchange={(event) =>
|
|
1187
1367
|
setDefaultModelProfileValue((event.currentTarget as HTMLSelectElement).value)}
|
|
@@ -1287,6 +1467,8 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1287
1467
|
<select
|
|
1288
1468
|
id={`${launcher.launchConfigSchema.id}-${turn.turnId}-model-profile`}
|
|
1289
1469
|
class="model-config-summary-turn-select"
|
|
1470
|
+
aria-invalid={getFieldErrors("model-config").length > 0}
|
|
1471
|
+
aria-describedby={getFieldErrors("model-config").length ? fieldErrorsDomId("model-config") : undefined}
|
|
1290
1472
|
value={turnModelProfileIds[turn.turnId] ?? ""}
|
|
1291
1473
|
onchange={(event) =>
|
|
1292
1474
|
setTurnModelProfileValue(
|
|
@@ -1337,33 +1519,17 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1337
1519
|
</div>
|
|
1338
1520
|
|
|
1339
1521
|
<div class="schedule-mode-grid" role="radiogroup" aria-label="When to run">
|
|
1340
|
-
|
|
1341
|
-
<
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
type="radio"
|
|
1352
|
-
name={`${launcher.launchConfigSchema.id}-schedule-mode`}
|
|
1353
|
-
checked={scheduleMode === "once"}
|
|
1354
|
-
onchange={() => setScheduleMode("once")}
|
|
1355
|
-
/>
|
|
1356
|
-
<span>Start later</span>
|
|
1357
|
-
</label>
|
|
1358
|
-
<label class="schedule-choice" data-selected={scheduleMode === "cron"}>
|
|
1359
|
-
<input
|
|
1360
|
-
type="radio"
|
|
1361
|
-
name={`${launcher.launchConfigSchema.id}-schedule-mode`}
|
|
1362
|
-
checked={scheduleMode === "cron"}
|
|
1363
|
-
onchange={() => setScheduleMode("cron")}
|
|
1364
|
-
/>
|
|
1365
|
-
<span>Run on cron</span>
|
|
1366
|
-
</label>
|
|
1522
|
+
{#each scheduleModes as option (option.mode)}
|
|
1523
|
+
<label class="schedule-choice" data-selected={scheduleMode === option.mode}>
|
|
1524
|
+
<input
|
|
1525
|
+
type="radio"
|
|
1526
|
+
name={`${launcher.launchConfigSchema.id}-schedule-mode`}
|
|
1527
|
+
checked={scheduleMode === option.mode}
|
|
1528
|
+
onchange={() => setScheduleMode(option.mode)}
|
|
1529
|
+
/>
|
|
1530
|
+
<span>{option.label}</span>
|
|
1531
|
+
</label>
|
|
1532
|
+
{/each}
|
|
1367
1533
|
</div>
|
|
1368
1534
|
|
|
1369
1535
|
{#if scheduleMode === "once"}
|
|
@@ -1380,10 +1546,13 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1380
1546
|
hourValue={scheduledRunAtHour}
|
|
1381
1547
|
minuteValue={scheduledRunAtMinute}
|
|
1382
1548
|
dataSection="launcher-schedule-once-picker"
|
|
1549
|
+
invalid={getFieldErrors("schedule-date").length > 0}
|
|
1550
|
+
describedBy={getFieldErrors("schedule-date").length ? fieldErrorsDomId("schedule-date") : undefined}
|
|
1383
1551
|
onDateChange={setScheduledRunDate}
|
|
1384
1552
|
onHourChange={setScheduledRunHour}
|
|
1385
1553
|
onMinuteChange={setScheduledRunMinute}
|
|
1386
1554
|
/>
|
|
1555
|
+
{@render validationMessages("schedule-date")}
|
|
1387
1556
|
{#if scheduledRunAtIso}
|
|
1388
1557
|
<p class="field-description">
|
|
1389
1558
|
Runs at {formatLocalDateTime24Hour(scheduledRunAtIso)} · {formatUtcDateTime24Hour(scheduledRunAtIso)}
|
|
@@ -1398,15 +1567,20 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1398
1567
|
</label>
|
|
1399
1568
|
<input
|
|
1400
1569
|
id={`${launcher.launchConfigSchema.id}-schedule-cron`}
|
|
1570
|
+
aria-invalid={getFieldErrors("schedule-cron").length > 0}
|
|
1571
|
+
aria-describedby={getFieldErrors("schedule-cron").length ? fieldErrorsDomId("schedule-cron") : undefined}
|
|
1572
|
+
onblur={() => blurField("schedule-cron")}
|
|
1401
1573
|
type="text"
|
|
1402
1574
|
placeholder="0 9 * * 1-5"
|
|
1403
1575
|
value={cronExpression}
|
|
1404
1576
|
oninput={(event) => {
|
|
1405
1577
|
cronExpression = (event.currentTarget as HTMLInputElement).value;
|
|
1578
|
+
touchField("schedule-cron", 300);
|
|
1406
1579
|
submitError = null;
|
|
1407
1580
|
submitSuccess = null;
|
|
1408
1581
|
}}
|
|
1409
1582
|
/>
|
|
1583
|
+
{@render validationMessages("schedule-cron")}
|
|
1410
1584
|
<p class="field-description">Cron uses 5 fields and runs in UTC.</p>
|
|
1411
1585
|
<div class="cron-example-list" data-section="launcher-cron-examples">
|
|
1412
1586
|
{#each cronExamples as example (example.expression)}
|
|
@@ -1427,7 +1601,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1427
1601
|
<p class="field-description">
|
|
1428
1602
|
Next run: {formatLocalDateTime24Hour(cronPreviewAt)} · {formatUtcDateTime24Hour(cronPreviewAt)}
|
|
1429
1603
|
</p>
|
|
1430
|
-
{:else if cronPreviewError}
|
|
1604
|
+
{:else if cronPreviewError && getFieldErrors("schedule-cron").length === 0}
|
|
1431
1605
|
<p class="field-description schedule-error">{cronPreviewError}</p>
|
|
1432
1606
|
{/if}
|
|
1433
1607
|
</div>
|
|
@@ -1450,10 +1624,20 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1450
1624
|
/>
|
|
1451
1625
|
</div>
|
|
1452
1626
|
{:else}
|
|
1627
|
+
<div class="validation-status" id={`${launcher.launchConfigSchema.id}-validation-status`} role="status" aria-live="polite">
|
|
1628
|
+
{#if validationPending}Checking values…
|
|
1629
|
+
{:else if validationError}
|
|
1630
|
+
<span class="schedule-error">{validationError}</span>
|
|
1631
|
+
<button type="button" class="secondary-button" onclick={retryValidation}>Retry validation</button>
|
|
1632
|
+
{:else if invalidFieldLabels.length > 0}Check: {invalidFieldLabels.join(", ")}.
|
|
1633
|
+
{:else if formErrors.length > 0}Resolve the validation errors above to continue.
|
|
1634
|
+
{/if}
|
|
1635
|
+
</div>
|
|
1453
1636
|
<button
|
|
1454
1637
|
class="submit-button"
|
|
1455
1638
|
type="submit"
|
|
1456
|
-
disabled={
|
|
1639
|
+
disabled={submitDisabled}
|
|
1640
|
+
aria-describedby={`${launcher.launchConfigSchema.id}-validation-status`}
|
|
1457
1641
|
data-pressable="true"
|
|
1458
1642
|
>
|
|
1459
1643
|
{submitButtonLabel()}
|
|
@@ -1465,6 +1649,34 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1465
1649
|
</div>
|
|
1466
1650
|
|
|
1467
1651
|
<style>
|
|
1652
|
+
.inline-validation-errors {
|
|
1653
|
+
margin: 0;
|
|
1654
|
+
padding: 0;
|
|
1655
|
+
list-style: none;
|
|
1656
|
+
color: var(--chronicle-danger);
|
|
1657
|
+
font-size: 0.875rem;
|
|
1658
|
+
line-height: 1.5;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
.title-field .inline-validation-errors { grid-column: 2; }
|
|
1662
|
+
|
|
1663
|
+
.validation-status {
|
|
1664
|
+
color: var(--chronicle-text-muted);
|
|
1665
|
+
font-size: 0.875rem;
|
|
1666
|
+
line-height: 1.5;
|
|
1667
|
+
flex: 1;
|
|
1668
|
+
min-width: 0;
|
|
1669
|
+
overflow-wrap: anywhere;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
.validation-status:empty { display: none; }
|
|
1673
|
+
|
|
1674
|
+
.launcher-fields input[aria-invalid="true"],
|
|
1675
|
+
.launcher-fields select[aria-invalid="true"],
|
|
1676
|
+
.model-config-group[data-invalid="true"] {
|
|
1677
|
+
border-color: var(--chronicle-danger);
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1468
1680
|
.launcher-form {
|
|
1469
1681
|
container-type: inline-size;
|
|
1470
1682
|
display: flex;
|