@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
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
SettingChoice,
|
|
4
|
+
SettingsOverviewResponse,
|
|
5
|
+
SettingsScopeOverview,
|
|
6
|
+
SettingsScopesResponse,
|
|
7
|
+
} from "@leitwerk-dev/protocol/http-contracts";
|
|
8
|
+
import { onMount, type Snippet, tick } from "svelte";
|
|
9
|
+
import { locationStore, navigate } from "../lib/router.svelte.js";
|
|
10
|
+
import { fetchSettingsOverview, onSettingsChanged } from "../lib/settings.js";
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
scopeType,
|
|
14
|
+
overview,
|
|
15
|
+
label,
|
|
16
|
+
subjects,
|
|
17
|
+
selected,
|
|
18
|
+
panelOpen,
|
|
19
|
+
refreshVersion = 0,
|
|
20
|
+
onSelect,
|
|
21
|
+
onClose,
|
|
22
|
+
children,
|
|
23
|
+
refresh,
|
|
24
|
+
}: {
|
|
25
|
+
scopeType: string;
|
|
26
|
+
overview?: SettingsScopeOverview;
|
|
27
|
+
label: string;
|
|
28
|
+
subjects: SettingsScopesResponse["subjects"];
|
|
29
|
+
selected: string;
|
|
30
|
+
panelOpen: boolean;
|
|
31
|
+
refreshVersion?: number;
|
|
32
|
+
onSelect: (id: string) => void;
|
|
33
|
+
onClose: () => void;
|
|
34
|
+
children?: Snippet;
|
|
35
|
+
refresh?: Snippet;
|
|
36
|
+
} = $props();
|
|
37
|
+
let items = $state<SettingsOverviewResponse["items"]>([]);
|
|
38
|
+
let loading = $state(true);
|
|
39
|
+
let error = $state("");
|
|
40
|
+
let loadId = 0;
|
|
41
|
+
const params = $derived(new URL($locationStore, window.location.origin).searchParams);
|
|
42
|
+
const query = $derived(params.get("q") ?? "");
|
|
43
|
+
const filter = $derived(params.get("filter") ?? "all");
|
|
44
|
+
const project = $derived(params.get("project") ?? "");
|
|
45
|
+
const mapping = $derived(items.some((item) => item.mapping !== undefined));
|
|
46
|
+
const rows = $derived(
|
|
47
|
+
[...subjects]
|
|
48
|
+
.sort((a, b) => a.label.localeCompare(b.label) || a.id.localeCompare(b.id))
|
|
49
|
+
.map((subject) => ({
|
|
50
|
+
...subject,
|
|
51
|
+
summary: items.find((item) => item.subjectId === subject.id),
|
|
52
|
+
project:
|
|
53
|
+
overview?.parentLabel &&
|
|
54
|
+
overview.labelSeparator &&
|
|
55
|
+
subject.label.includes(overview.labelSeparator)
|
|
56
|
+
? subject.label.split(overview.labelSeparator)[0]
|
|
57
|
+
: "",
|
|
58
|
+
name: overview?.labelSeparator
|
|
59
|
+
? subject.label.split(overview.labelSeparator).slice(1).join(overview.labelSeparator) ||
|
|
60
|
+
subject.label
|
|
61
|
+
: subject.label,
|
|
62
|
+
})),
|
|
63
|
+
);
|
|
64
|
+
const projects = $derived([...new Set(rows.map((row) => row.project).filter(Boolean))].sort());
|
|
65
|
+
const projectRows = $derived(rows.filter((row) => !project || row.project === project));
|
|
66
|
+
function status(row: (typeof rows)[number]) {
|
|
67
|
+
if (!row.summary) return loading ? "loading" : "unavailable";
|
|
68
|
+
if (row.summary.errors.length) return "error";
|
|
69
|
+
if (mapping)
|
|
70
|
+
return row.summary.mapping === undefined
|
|
71
|
+
? "unavailable"
|
|
72
|
+
: row.summary.mapping.length
|
|
73
|
+
? "mapped"
|
|
74
|
+
: "unmapped";
|
|
75
|
+
return row.summary.customized.length ? "customized" : "defaults";
|
|
76
|
+
}
|
|
77
|
+
const filters = $derived(
|
|
78
|
+
mapping
|
|
79
|
+
? [
|
|
80
|
+
{ id: "all", label: "All" },
|
|
81
|
+
{ id: "mapped", label: "Mapped" },
|
|
82
|
+
{ id: "unmapped", label: "Unmapped" },
|
|
83
|
+
]
|
|
84
|
+
: [
|
|
85
|
+
{ id: "all", label: "All" },
|
|
86
|
+
{ id: "customized", label: "Customized" },
|
|
87
|
+
{ id: "defaults", label: "Using defaults" },
|
|
88
|
+
],
|
|
89
|
+
);
|
|
90
|
+
const visibleRows = $derived(
|
|
91
|
+
projectRows.filter(
|
|
92
|
+
(row) =>
|
|
93
|
+
(filter === "all" || status(row) === filter) &&
|
|
94
|
+
`${row.label} ${row.summary?.mapping?.map((choice) => choice.label).join(" ") ?? ""} ${row.summary?.customized.join(" ") ?? ""}`
|
|
95
|
+
.toLowerCase()
|
|
96
|
+
.includes(query.trim().toLowerCase()),
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
const nextUnmapped = $derived(
|
|
100
|
+
projectRows.find(
|
|
101
|
+
(row) =>
|
|
102
|
+
row.id !== selected &&
|
|
103
|
+
status(row) === "unmapped" &&
|
|
104
|
+
`${row.label} ${row.summary?.mapping?.map((c) => c.label).join(" ") ?? ""}`
|
|
105
|
+
.toLowerCase()
|
|
106
|
+
.includes(query.trim().toLowerCase()),
|
|
107
|
+
),
|
|
108
|
+
);
|
|
109
|
+
function update(key: string, value: string, replace = false) {
|
|
110
|
+
const url = new URL($locationStore, window.location.origin);
|
|
111
|
+
url.pathname = "/settings";
|
|
112
|
+
url.searchParams.set("scope", selected);
|
|
113
|
+
if (value && value !== "all") url.searchParams.set(key, value);
|
|
114
|
+
else url.searchParams.delete(key);
|
|
115
|
+
navigate(`${url.pathname}${url.search}`, { replace });
|
|
116
|
+
}
|
|
117
|
+
async function reload() {
|
|
118
|
+
const id = ++loadId;
|
|
119
|
+
error = "";
|
|
120
|
+
try {
|
|
121
|
+
const result = await fetchSettingsOverview(scopeType);
|
|
122
|
+
if (id === loadId) items = result.items;
|
|
123
|
+
} catch (caught) {
|
|
124
|
+
if (id === loadId)
|
|
125
|
+
error = caught instanceof Error ? caught.message : "Could not load settings overview";
|
|
126
|
+
} finally {
|
|
127
|
+
if (id === loadId) loading = false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
$effect(() => {
|
|
131
|
+
const type = scopeType;
|
|
132
|
+
void refreshVersion;
|
|
133
|
+
if (!type) return;
|
|
134
|
+
loading = true;
|
|
135
|
+
void reload();
|
|
136
|
+
});
|
|
137
|
+
onMount(() => {
|
|
138
|
+
const unsubscribe = onSettingsChanged(() => {
|
|
139
|
+
void reload();
|
|
140
|
+
});
|
|
141
|
+
return () => {
|
|
142
|
+
loadId++;
|
|
143
|
+
unsubscribe();
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
function repositoryLabel(label: string) {
|
|
147
|
+
return label.split(" · ")[0];
|
|
148
|
+
}
|
|
149
|
+
function repositoryHref(choice: SettingChoice): string | undefined {
|
|
150
|
+
try {
|
|
151
|
+
const value = JSON.parse(choice.value);
|
|
152
|
+
if (typeof value.origin !== "string" || typeof value.projectId !== "number") return;
|
|
153
|
+
const url = new URL(value.origin);
|
|
154
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password) return;
|
|
155
|
+
url.pathname = `/projects/${value.projectId}`;
|
|
156
|
+
url.search = "";
|
|
157
|
+
url.hash = "";
|
|
158
|
+
return url.toString();
|
|
159
|
+
} catch {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async function close() {
|
|
164
|
+
onClose();
|
|
165
|
+
await tick();
|
|
166
|
+
(
|
|
167
|
+
document.getElementById(`settings-row-${selected}`) ??
|
|
168
|
+
document.getElementById("settings-search")
|
|
169
|
+
)?.focus();
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<div class="settings-overview" class:editing={panelOpen}>
|
|
174
|
+
<div class="overview-header"><div><h2>{label}</h2><p aria-live="polite">{#if loading}Loading overview…{:else if error}Overview unavailable{:else if mapping}{projectRows.filter((row) => status(row) === "mapped").length} of {projectRows.length} {overview?.itemLabelPlural.toLowerCase() ?? "entries"} mapped · {projectRows.filter((row) => status(row) === "unmapped").length} unmapped{:else}{projectRows.length} {label.toLowerCase()} · {projectRows.filter((row) => status(row) === "customized").length} customized{/if}{#if projectRows.some((row) => status(row) === "error")} · {projectRows.filter((row) => status(row) === "error").length} need attention{/if}</p></div>{@render refresh?.()}</div>
|
|
175
|
+
{#if error}<div class="overview-error" role="alert">{error} <button type="button" onclick={reload}>Retry overview</button></div>{/if}
|
|
176
|
+
<div class="toolbar"><div class="search"><label for="settings-search">Search {overview?.itemLabelPlural.toLowerCase() ?? "entries"}</label><input id="settings-search" type="search" placeholder={mapping ? "Search components or repositories…" : "Search repositories or settings…"} value={query} oninput={(event) => update("q", event.currentTarget.value, true)} /></div>{#if projects.length}<div class="project"><label for="settings-project">{overview?.parentLabel ?? "Group"}</label><select id="settings-project" value={project} onchange={(event) => update("project", event.currentTarget.value)}><option value="">All {(overview?.parentLabel ?? "group").toLowerCase()}s</option>{#each projects as name}<option value={name}>{name}</option>{/each}</select></div>{/if}</div>
|
|
177
|
+
<div class="filters" role="group" aria-label="Filter settings">{#each filters as option}<button type="button" aria-pressed={filter === option.id} onclick={() => update("filter", option.id)}>{option.label} <span>{option.id === "all" ? projectRows.length : projectRows.filter((row) => status(row) === option.id).length}</span></button>{/each}</div>
|
|
178
|
+
<div class="overview-layout" class:panel-open={panelOpen}>
|
|
179
|
+
<div class="inventory">
|
|
180
|
+
<table><caption class="sr-only">{label} settings overview</caption><thead><tr><th scope="col">{overview?.itemLabel ?? "Name"}</th><th scope="col">Status</th><th scope="col">{mapping ? "Repositories" : "Settings"}</th></tr></thead><tbody>
|
|
181
|
+
{#each visibleRows as row (row.id)}<tr class:selected={panelOpen && row.id === selected}><th scope="row"><button type="button" id={`settings-row-${row.id}`} aria-expanded={panelOpen && row.id === selected} aria-controls={panelOpen ? "settings-editor" : undefined} onclick={() => onSelect(row.id)}>{row.name}</button>{#if row.project}<small>{row.project}</small>{/if}{#if !row.active}<small>Inactive scope</small>{/if}</th><td><span class="status" class:mapped={status(row) === "mapped"} class:attention={status(row) === "error"}>{status(row) === "loading" ? "Loading…" : status(row) === "error" ? "Needs attention" : status(row) === "mapped" ? "Mapped" : status(row) === "unmapped" ? "Unmapped" : status(row) === "customized" ? "Customized" : status(row) === "unavailable" ? "Unavailable" : "Using defaults"}</span></td><td>{#if row.summary?.mapping?.length}{@const choice = row.summary.mapping[0]}{@const href = repositoryHref(choice)}{#if href}<a class="repository" {href} target="_blank" rel="noopener noreferrer" aria-label={`${repositoryLabel(choice.label)} (opens in a new tab)`} title={row.summary.mapping.map((entry) => entry.label).join("; ")}>{repositoryLabel(choice.label)}</a>{:else}<span class="repository">{repositoryLabel(choice.label)}</span>{/if}{#if row.summary.mapping.length > 1}<span class="more">+{row.summary.mapping.length - 1} more</span>{/if}{:else if row.summary?.errors.length}<span class="muted">Open to review</span>{:else if row.summary?.mapping !== undefined}<span class="muted">No repository selected</span>{:else if row.summary?.customized.length}<span>{row.summary.customized.join(", ")}</span>{:else}<span class="muted">{mapping ? "No repository selected" : "Inherited settings"}</span>{/if}</td></tr>{/each}
|
|
182
|
+
</tbody></table>
|
|
183
|
+
{#if !visibleRows.length && !loading}<div class="empty"><h3>{query || filter !== "all" || project ? "No matching entries" : "No entries yet"}</h3><p>{query || filter !== "all" || project ? "Change your search or filters to see more entries." : "Refresh sources to discover settings scopes."}</p></div>{/if}
|
|
184
|
+
</div>
|
|
185
|
+
{#if panelOpen}<aside id="settings-editor" aria-label="Settings editor"><div class="editor-heading"><div><h3 tabindex="-1" id="settings-editor-heading">{rows.find((row) => row.id === selected)?.name ?? "Settings"}</h3><p>{rows.find((row) => row.id === selected)?.project || label}</p></div><button type="button" onclick={close}>Close</button></div>{#if mapping && nextUnmapped}<button class="next" type="button" onclick={() => onSelect(nextUnmapped.id)}>Next unmapped {overview?.itemLabel.toLowerCase() ?? "entry"}</button>{/if}{@render children?.()}</aside>{/if}
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<style>
|
|
191
|
+
h2 { margin: 0; font-size: var(--type-title-sm); }
|
|
192
|
+
h3 { margin: 0; font-size: var(--type-body-lg); overflow-wrap: anywhere; }
|
|
193
|
+
p { margin: .5rem 0 0; color: var(--chronicle-text-muted); line-height: 1.5; }
|
|
194
|
+
.overview-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.75rem 0 1.25rem; }
|
|
195
|
+
.toolbar { display: flex; gap: 1rem; align-items: end; }
|
|
196
|
+
.search { flex: 1; }
|
|
197
|
+
.project { min-width: 140px; }
|
|
198
|
+
label { display: block; margin-bottom: .5rem; font-size: var(--type-body-sm); font-weight: 600; }
|
|
199
|
+
input, select, button { min-height: 44px; padding: .65rem .8rem; border: 1px solid var(--chronicle-border-strong); border-radius: var(--radius-sm); background: var(--chronicle-panel-surface); color: var(--chronicle-text); font: inherit; }
|
|
200
|
+
input, select { width: 100%; min-width: 0; }
|
|
201
|
+
button { cursor: pointer; }
|
|
202
|
+
button:hover { background: var(--chronicle-panel-muted); }
|
|
203
|
+
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 3px; }
|
|
204
|
+
.filters { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1rem 0; }
|
|
205
|
+
.filters button { border-color: transparent; background: transparent; font-size: var(--type-body-sm); }
|
|
206
|
+
.filters button[aria-pressed="true"] { background: var(--chronicle-accent-soft); color: var(--chronicle-accent); font-weight: 600; }
|
|
207
|
+
.filters span { margin-left: .5rem; font-variant-numeric: tabular-nums; }
|
|
208
|
+
.overview-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; border-top: 1px solid var(--chronicle-border); }
|
|
209
|
+
.overview-layout.panel-open { grid-template-columns: minmax(0, 1fr) minmax(320px, .85fr); }
|
|
210
|
+
.inventory { min-width: 0; }
|
|
211
|
+
table { width: 100%; border-collapse: collapse; text-align: left; table-layout: fixed; font-size: var(--type-body-sm); }
|
|
212
|
+
th, td { padding: .85rem .75rem; border-bottom: 1px solid var(--chronicle-border); vertical-align: top; overflow-wrap: anywhere; }
|
|
213
|
+
thead th { font-weight: 600; color: var(--chronicle-text-muted); background: var(--chronicle-panel-muted); }
|
|
214
|
+
th:first-child { width: 35%; }
|
|
215
|
+
th:nth-child(2) { width: 24%; }
|
|
216
|
+
tbody th { font-weight: 400; }
|
|
217
|
+
tbody th button { min-height: 44px; margin: -.5rem 0; padding: .5rem 0; border: 0; background: transparent; border-radius: 0; color: var(--chronicle-link); text-align: left; font-weight: 600; overflow-wrap: anywhere; }
|
|
218
|
+
tbody tr:hover { background: var(--chronicle-panel-muted); }
|
|
219
|
+
tr.selected { background: var(--chronicle-accent-soft); }
|
|
220
|
+
small { display: block; margin-top: .25rem; color: var(--chronicle-text-muted); }
|
|
221
|
+
.status { white-space: normal; color: var(--chronicle-text-muted); }
|
|
222
|
+
.status.mapped { color: var(--chronicle-success); }
|
|
223
|
+
.status.attention, .overview-error { color: var(--chronicle-danger); }
|
|
224
|
+
.repository { display: block; }
|
|
225
|
+
a.repository { color: var(--chronicle-link); text-underline-offset: .2em; }
|
|
226
|
+
a.repository:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 3px; }
|
|
227
|
+
.more, .muted { color: var(--chronicle-text-muted); }
|
|
228
|
+
.more { display: inline-block; margin-top: .25rem; }
|
|
229
|
+
aside { position: sticky; top: 1rem; min-width: 0; max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.25rem; border-left: 1px solid var(--chronicle-border); }
|
|
230
|
+
.editor-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
|
|
231
|
+
.editor-heading p { font-size: var(--type-caption); }
|
|
232
|
+
.next { margin-top: 1rem; width: 100%; }
|
|
233
|
+
.empty { padding: 2rem 1rem; }
|
|
234
|
+
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
235
|
+
@media (max-width: 1000px) { .panel-open th:first-child { width: 52%; } .panel-open th:nth-child(2) { width: 48%; } .panel-open th:nth-child(3), .panel-open td:nth-child(3) { display: none; } }
|
|
236
|
+
@media (max-width: 700px) { .editing .overview-header, .editing .toolbar, .editing .filters { display: none; } .toolbar { flex-direction: column; align-items: stretch; } .overview-header { align-items: start; } .overview-layout.panel-open { grid-template-columns: minmax(0, 1fr); } .panel-open .inventory { display: none; } aside { position: static; max-height: none; border-left: 0; padding: 1rem 0; } th:first-child { width: 46%; } th:nth-child(2) { width: 26%; } }
|
|
237
|
+
</style>
|
|
@@ -4,17 +4,28 @@ import type { SkillOptionSummary } from "@leitwerk-dev/protocol";
|
|
|
4
4
|
interface Props {
|
|
5
5
|
skills: readonly SkillOptionSummary[];
|
|
6
6
|
selectedIds?: string[];
|
|
7
|
+
id?: string;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
describedBy?: string;
|
|
10
|
+
onSelectionChange?: () => void;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
|
-
let {
|
|
13
|
+
let {
|
|
14
|
+
skills,
|
|
15
|
+
selectedIds = $bindable([]),
|
|
16
|
+
id = undefined,
|
|
17
|
+
invalid = false,
|
|
18
|
+
describedBy = undefined,
|
|
19
|
+
onSelectionChange = undefined,
|
|
20
|
+
}: Props = $props();
|
|
10
21
|
</script>
|
|
11
22
|
|
|
12
|
-
<fieldset class="skill-selector" data-section="launcher-skills">
|
|
23
|
+
<fieldset {id} tabindex="-1" data-invalid={invalid} aria-describedby={describedBy} class="skill-selector" data-section="launcher-skills">
|
|
13
24
|
<legend class="field-label">Skills</legend>
|
|
14
25
|
<p class="field-description">Make selected skills available to every AI step in this run.</p>
|
|
15
26
|
{#each skills as skill (skill.id)}
|
|
16
27
|
<label class="skill-option">
|
|
17
|
-
<input type="checkbox" value={skill.id} bind:group={selectedIds} />
|
|
28
|
+
<input type="checkbox" aria-invalid={invalid} aria-describedby={describedBy} value={skill.id} bind:group={selectedIds} onchange={onSelectionChange} />
|
|
18
29
|
<span>
|
|
19
30
|
<strong>{skill.label}</strong>
|
|
20
31
|
{#if skill.description}<small>{skill.description}</small>{/if}
|
|
@@ -24,6 +35,7 @@ let { skills, selectedIds = $bindable([]) }: Props = $props();
|
|
|
24
35
|
</fieldset>
|
|
25
36
|
|
|
26
37
|
<style>
|
|
38
|
+
.skill-selector[data-invalid="true"] { outline: 1px solid var(--chronicle-danger); outline-offset: 4px; }
|
|
27
39
|
.skill-selector {
|
|
28
40
|
border: 0;
|
|
29
41
|
padding: 0;
|
|
@@ -90,10 +90,11 @@ export function normalizeLauncherValidationErrors(
|
|
|
90
90
|
): LauncherValidationView {
|
|
91
91
|
const nextFieldErrors: Record<string, string[]> = {};
|
|
92
92
|
const nextFormErrors: string[] = [];
|
|
93
|
+
const knownFields = new Set(fields.map((field) => field.id));
|
|
93
94
|
|
|
94
95
|
for (const error of errors) {
|
|
95
96
|
const message = humanizeLauncherValidationMessage(fields, error);
|
|
96
|
-
if (typeof error.fieldId === "string" && error.fieldId.trim()
|
|
97
|
+
if (typeof error.fieldId === "string" && knownFields.has(error.fieldId.trim())) {
|
|
97
98
|
const fieldId = error.fieldId.trim();
|
|
98
99
|
nextFieldErrors[fieldId] = nextFieldErrors[fieldId] ?? [];
|
|
99
100
|
pushUnique(nextFieldErrors[fieldId], message);
|
|
@@ -104,15 +104,11 @@ export function getDefaultModelSelectableProfiles(input: {
|
|
|
104
104
|
availableProfiles: readonly ModelProfileOptionSummary[];
|
|
105
105
|
recommendedProfile: ModelProfileOptionSummary | null | undefined;
|
|
106
106
|
}): readonly ModelProfileOptionSummary[] {
|
|
107
|
-
|
|
108
|
-
if (recommendedProfileId === "") {
|
|
109
|
-
return input.availableProfiles;
|
|
110
|
-
}
|
|
111
|
-
return input.availableProfiles.filter((option) => option.id !== recommendedProfileId);
|
|
107
|
+
return input.availableProfiles;
|
|
112
108
|
}
|
|
113
109
|
|
|
114
110
|
export function getTurnModelBlankOptionLabel(): string {
|
|
115
|
-
return "Use
|
|
111
|
+
return "Use inherited value";
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
function getModelDisplayName(profile: ModelProfileOptionSummary | null | undefined): string | null {
|
|
@@ -132,7 +128,11 @@ function isTurnUsingProcessDefault(source: LauncherModelLineSource): boolean {
|
|
|
132
128
|
}
|
|
133
129
|
|
|
134
130
|
function isRecommendedTurnSource(source: LauncherModelLineSource): boolean {
|
|
135
|
-
return
|
|
131
|
+
return (
|
|
132
|
+
source === "process_config_turn" ||
|
|
133
|
+
source === "catalog_default" ||
|
|
134
|
+
source === "scoped_purpose_default"
|
|
135
|
+
);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export function formatLauncherModelSummaryStatus(mode: LauncherModelSummaryMode): string {
|
|
@@ -159,6 +159,7 @@ export function formatLauncherModelDisplayValue(line: LauncherModelDisplayLine):
|
|
|
159
159
|
case "instance_default":
|
|
160
160
|
case "process_config_default":
|
|
161
161
|
return "Use process default";
|
|
162
|
+
case "scoped_purpose_default":
|
|
162
163
|
case "process_config_turn":
|
|
163
164
|
case "catalog_default":
|
|
164
165
|
return `Recommended (${line.modelName ?? "unknown model"})`;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
LauncherFieldDefinition,
|
|
3
|
+
LauncherFieldOptionDefinition,
|
|
4
|
+
} from "@leitwerk-dev/protocol/launcher-contract";
|
|
5
|
+
|
|
6
|
+
type Values = Record<string, string | boolean>;
|
|
7
|
+
type Options = Record<string, readonly LauncherFieldOptionDefinition[]>;
|
|
8
|
+
|
|
9
|
+
interface SelectionOverride {
|
|
10
|
+
initialValue?: string;
|
|
11
|
+
included: string[];
|
|
12
|
+
excluded: string[];
|
|
13
|
+
/** Retain known membership if a selected preset becomes unavailable. */
|
|
14
|
+
members: Record<string, readonly string[]>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type LauncherSelections = Record<string, SelectionOverride>;
|
|
18
|
+
|
|
19
|
+
export const selectionValues = (value: unknown): string[] =>
|
|
20
|
+
typeof value === "string" ? [...new Set(value.split("\n").filter(Boolean))] : [];
|
|
21
|
+
|
|
22
|
+
export function initializeLauncherSelections(
|
|
23
|
+
fields: readonly LauncherFieldDefinition[],
|
|
24
|
+
input: Record<string, unknown>,
|
|
25
|
+
): LauncherSelections {
|
|
26
|
+
return Object.fromEntries(
|
|
27
|
+
fields
|
|
28
|
+
.filter((field) => field.multiple && field.presetsFrom)
|
|
29
|
+
.map((field) => [
|
|
30
|
+
field.id,
|
|
31
|
+
{
|
|
32
|
+
initialValue: typeof input[field.id] === "string" ? input[field.id] : undefined,
|
|
33
|
+
included: [],
|
|
34
|
+
excluded: [],
|
|
35
|
+
members: {},
|
|
36
|
+
},
|
|
37
|
+
]),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function reconcileLauncherSelections(
|
|
42
|
+
fields: readonly LauncherFieldDefinition[],
|
|
43
|
+
values: Values,
|
|
44
|
+
options: Options,
|
|
45
|
+
selections: LauncherSelections,
|
|
46
|
+
): { values: Values; selections: LauncherSelections } {
|
|
47
|
+
const nextValues = { ...values };
|
|
48
|
+
const nextSelections = { ...selections };
|
|
49
|
+
for (const field of fields) {
|
|
50
|
+
if (!field.presetsFrom || !field.multiple) continue;
|
|
51
|
+
const presetOptions =
|
|
52
|
+
options[field.presetsFrom] ??
|
|
53
|
+
fields.find((source) => source.id === field.presetsFrom)?.options;
|
|
54
|
+
if (!presetOptions) continue;
|
|
55
|
+
const previous = selections[field.id];
|
|
56
|
+
if (!previous) continue;
|
|
57
|
+
const members = { ...previous.members };
|
|
58
|
+
for (const option of presetOptions) members[option.value] = option.selectionValues ?? [];
|
|
59
|
+
const preset = new Set(
|
|
60
|
+
selectionValues(values[field.presetsFrom]).flatMap((id) => members[id] ?? []),
|
|
61
|
+
);
|
|
62
|
+
const initial =
|
|
63
|
+
previous.initialValue === undefined ? null : selectionValues(previous.initialValue);
|
|
64
|
+
const included = initial ? initial.filter((id) => !preset.has(id)) : previous.included;
|
|
65
|
+
const excluded = initial
|
|
66
|
+
? [...preset].filter((id) => !initial.includes(id))
|
|
67
|
+
: previous.excluded;
|
|
68
|
+
nextValues[field.id] = [...new Set([...preset, ...included])]
|
|
69
|
+
.filter((id) => !excluded.includes(id))
|
|
70
|
+
.join("\n");
|
|
71
|
+
nextSelections[field.id] = { included, excluded, members };
|
|
72
|
+
}
|
|
73
|
+
return { values: nextValues, selections: nextSelections };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function changeLauncherSelection(
|
|
77
|
+
fields: readonly LauncherFieldDefinition[],
|
|
78
|
+
values: Values,
|
|
79
|
+
options: Options,
|
|
80
|
+
selections: LauncherSelections,
|
|
81
|
+
fieldId: string,
|
|
82
|
+
value: string | boolean,
|
|
83
|
+
): { values: Values; selections: LauncherSelections; resetFields: string[] } {
|
|
84
|
+
const nextValues = { ...values, [fieldId]: value };
|
|
85
|
+
const nextSelections = { ...selections };
|
|
86
|
+
const previous = selections[fieldId];
|
|
87
|
+
if (previous) {
|
|
88
|
+
const before = selectionValues(values[fieldId]);
|
|
89
|
+
const after = selectionValues(value);
|
|
90
|
+
const added = after.filter((id) => !before.includes(id));
|
|
91
|
+
const removed = before.filter((id) => !after.includes(id));
|
|
92
|
+
nextSelections[fieldId] = {
|
|
93
|
+
...previous,
|
|
94
|
+
...(previous.initialValue === undefined ? {} : { initialValue: String(value) }),
|
|
95
|
+
included: [...new Set([...previous.included, ...added])].filter(
|
|
96
|
+
(id) => !removed.includes(id),
|
|
97
|
+
),
|
|
98
|
+
excluded: [...new Set([...previous.excluded, ...removed])].filter(
|
|
99
|
+
(id) => !added.includes(id),
|
|
100
|
+
),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const changed = new Set(values[fieldId] === value ? [] : [fieldId]);
|
|
104
|
+
const resetFields: string[] = [];
|
|
105
|
+
for (let size = -1; size !== changed.size; ) {
|
|
106
|
+
size = changed.size;
|
|
107
|
+
for (const field of fields) {
|
|
108
|
+
if (changed.has(field.id) || !field.resetOn?.some((id) => changed.has(id))) continue;
|
|
109
|
+
changed.add(field.id);
|
|
110
|
+
resetFields.push(field.id);
|
|
111
|
+
nextValues[field.id] = field.kind === "boolean" ? false : "";
|
|
112
|
+
if (nextSelections[field.id])
|
|
113
|
+
nextSelections[field.id] = { included: [], excluded: [], members: {} };
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const nextOptions = Object.fromEntries(
|
|
117
|
+
Object.entries(options).filter(([id]) => !resetFields.includes(id)),
|
|
118
|
+
);
|
|
119
|
+
return {
|
|
120
|
+
...reconcileLauncherSelections(fields, nextValues, nextOptions, nextSelections),
|
|
121
|
+
resetFields,
|
|
122
|
+
};
|
|
123
|
+
}
|
package/src/lib/api.ts
CHANGED
|
@@ -30,6 +30,7 @@ import type {
|
|
|
30
30
|
LauncherOptionsResponseBody,
|
|
31
31
|
LauncherRecentValuesResponseBody,
|
|
32
32
|
LaunchersResponseBody,
|
|
33
|
+
LauncherValidationResponseBody,
|
|
33
34
|
LaunchRunResponseBody,
|
|
34
35
|
ModelProviderOptionsResponseBody,
|
|
35
36
|
PrimaryPathSnapshotResponseBody,
|
|
@@ -41,6 +42,8 @@ import type {
|
|
|
41
42
|
ProcessDiagnosticsResponseBody,
|
|
42
43
|
ProcessesOverviewResponseBody,
|
|
43
44
|
ProcessLaunchRunsResponseBody,
|
|
45
|
+
ProcessModelConfigPatch,
|
|
46
|
+
ProcessModelConfigResponseBody,
|
|
44
47
|
ProcessOverviewItem,
|
|
45
48
|
ProcessRetryConfig,
|
|
46
49
|
ProcessRetryConfigResponseBody,
|
|
@@ -52,7 +55,6 @@ import type {
|
|
|
52
55
|
SkillCatalogDetailResponseBody,
|
|
53
56
|
SkillsCatalogResponseBody,
|
|
54
57
|
StartLaunchRunResponseBody,
|
|
55
|
-
TurnReasoningDetailResponseBody,
|
|
56
58
|
UiLauncherSummary,
|
|
57
59
|
WatcherSummary,
|
|
58
60
|
WatchersResponseBody,
|
|
@@ -64,6 +66,8 @@ import type {
|
|
|
64
66
|
import * as v from "valibot";
|
|
65
67
|
import { formatDefinition } from "./format.js";
|
|
66
68
|
import {
|
|
69
|
+
ApiResponseError,
|
|
70
|
+
apiResponseError,
|
|
67
71
|
jsonRequestInit,
|
|
68
72
|
readErrorMessage,
|
|
69
73
|
readJsonObject,
|
|
@@ -75,15 +79,7 @@ import {
|
|
|
75
79
|
} from "./http-client.js";
|
|
76
80
|
import { getFetchImpl, resolveApiUrl } from "./runtime-config";
|
|
77
81
|
|
|
78
|
-
export
|
|
79
|
-
readonly status: number;
|
|
80
|
-
|
|
81
|
-
constructor(message: string, status: number) {
|
|
82
|
-
super(message);
|
|
83
|
-
this.name = "ApiResponseError";
|
|
84
|
-
this.status = status;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
82
|
+
export { ApiResponseError } from "./http-client.js";
|
|
87
83
|
|
|
88
84
|
function requestStatusJson<T extends object>(
|
|
89
85
|
path: string,
|
|
@@ -99,11 +95,6 @@ function requestStatusJson<T extends object>(
|
|
|
99
95
|
});
|
|
100
96
|
}
|
|
101
97
|
|
|
102
|
-
function apiResponseError(message: string) {
|
|
103
|
-
return (response: Response, body: unknown) =>
|
|
104
|
-
new ApiResponseError(readErrorMessage(body) ?? message, response.status);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
98
|
export type ProcessDetailData = ProcessDetailUiSnapshotResponseBody;
|
|
108
99
|
export type FutureExecutionSummary = FutureExecutionOverviewItem;
|
|
109
100
|
export type FutureActionSummary = Extract<FutureExecutionOverviewItem, { kind: "action" }>;
|
|
@@ -138,9 +129,10 @@ export async function fetchTicketCreationTools(): Promise<TicketCreationToolSumm
|
|
|
138
129
|
export function launchTicketCreation(
|
|
139
130
|
instanceId: string,
|
|
140
131
|
body: LaunchTicketCreationRequestBody,
|
|
132
|
+
idempotencyKey = crypto.randomUUID(),
|
|
141
133
|
): Promise<LaunchTicketCreationResponseBody> {
|
|
142
134
|
const init = jsonRequestInit("POST", body);
|
|
143
|
-
init.headers = { ...init.headers, "idempotency-key":
|
|
135
|
+
init.headers = { ...init.headers, "idempotency-key": idempotencyKey };
|
|
144
136
|
return requestJson({
|
|
145
137
|
path: `/api/processes/${encodeURIComponent(instanceId)}/ticket-creation`,
|
|
146
138
|
init,
|
|
@@ -448,6 +440,38 @@ export async function fetchLauncherModelConfigPreview(
|
|
|
448
440
|
return body.preview;
|
|
449
441
|
}
|
|
450
442
|
|
|
443
|
+
export async function validateLauncher(
|
|
444
|
+
launcherId: string,
|
|
445
|
+
request: {
|
|
446
|
+
title: string | null;
|
|
447
|
+
launcherInput: Record<string, unknown>;
|
|
448
|
+
modelConfig: LauncherModelConfigDefaults;
|
|
449
|
+
schedule: ScheduleConfigInput;
|
|
450
|
+
skillIds: readonly string[];
|
|
451
|
+
futureExecutionId?: string;
|
|
452
|
+
},
|
|
453
|
+
signal?: AbortSignal,
|
|
454
|
+
): Promise<readonly LauncherValidationError[]> {
|
|
455
|
+
const { futureExecutionId, ...launchRequest } = request;
|
|
456
|
+
const query = futureExecutionId
|
|
457
|
+
? `?futureExecutionId=${encodeURIComponent(futureExecutionId)}`
|
|
458
|
+
: "";
|
|
459
|
+
const body = await requestJson<LauncherValidationResponseBody>({
|
|
460
|
+
path: `/api/launchers/${encodeURIComponent(launcherId)}/validate${query}`,
|
|
461
|
+
init: { ...jsonRequestInit("POST", launchRequest), signal },
|
|
462
|
+
malformed: "Malformed launcher validation response",
|
|
463
|
+
onError: (response, body) => {
|
|
464
|
+
const errors = readLauncherValidationErrors(body);
|
|
465
|
+
if (response.status === 400 && errors.length > 0) return { errors };
|
|
466
|
+
throw new Error(readErrorMessage(body) ?? "Couldn't validate the launch values. Try again.");
|
|
467
|
+
},
|
|
468
|
+
});
|
|
469
|
+
if (!Array.isArray(body.errors) || !body.errors.every(isLauncherValidationError)) {
|
|
470
|
+
throw new Error("Malformed launcher validation response");
|
|
471
|
+
}
|
|
472
|
+
return body.errors;
|
|
473
|
+
}
|
|
474
|
+
|
|
451
475
|
async function parseLauncherErrorResponse(
|
|
452
476
|
res: Response,
|
|
453
477
|
fallbackMessagePrefix: string,
|
|
@@ -564,39 +588,17 @@ export async function fetchPrimaryPathSnapshot(instanceId: string): Promise<Prim
|
|
|
564
588
|
);
|
|
565
589
|
}
|
|
566
590
|
|
|
567
|
-
export async function fetchProcessDetail(
|
|
591
|
+
export async function fetchProcessDetail(
|
|
592
|
+
instanceId: string,
|
|
593
|
+
beforeTurnRecordId?: string,
|
|
594
|
+
): Promise<ProcessDetailData> {
|
|
568
595
|
return requestStatusJson(
|
|
569
|
-
`/api/processes/${encodeURIComponent(instanceId)}/ui-snapshot`,
|
|
596
|
+
`/api/processes/${encodeURIComponent(instanceId)}/ui-snapshot${beforeTurnRecordId ? `?beforeTurnRecordId=${encodeURIComponent(beforeTurnRecordId)}` : ""}`,
|
|
570
597
|
"Couldn't load this process",
|
|
571
598
|
"Malformed process UI snapshot response",
|
|
572
599
|
);
|
|
573
600
|
}
|
|
574
601
|
|
|
575
|
-
export async function fetchTurnReasoningDetail(
|
|
576
|
-
instanceId: string,
|
|
577
|
-
turnRecordId: string,
|
|
578
|
-
sessionSignature: string | null,
|
|
579
|
-
signal?: AbortSignal,
|
|
580
|
-
): Promise<TurnReasoningDetailResponseBody> {
|
|
581
|
-
const params = new URLSearchParams(sessionSignature === null ? {} : { sessionSignature });
|
|
582
|
-
const res = await getFetchImpl()(
|
|
583
|
-
resolveApiUrl(
|
|
584
|
-
`/api/processes/${encodeURIComponent(instanceId)}/turn-records/${encodeURIComponent(turnRecordId)}/reasoning?${params.toString()}`,
|
|
585
|
-
),
|
|
586
|
-
{ signal },
|
|
587
|
-
);
|
|
588
|
-
if (res.status === 409) {
|
|
589
|
-
throw new Error(
|
|
590
|
-
"The process changed while reasoning details were loading. Retry with the latest snapshot.",
|
|
591
|
-
);
|
|
592
|
-
}
|
|
593
|
-
if (!res.ok) throw new Error(`Couldn't load reasoning details: ${res.status}`);
|
|
594
|
-
return readJsonObject<TurnReasoningDetailResponseBody>(
|
|
595
|
-
res,
|
|
596
|
-
"Malformed reasoning detail response",
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
602
|
export async function fetchFutureExecution(
|
|
601
603
|
futureExecutionId: string,
|
|
602
604
|
): Promise<FutureExecutionDetailResponseBody> {
|
|
@@ -840,3 +842,47 @@ export async function previewCronExpression(expression: string): Promise<string>
|
|
|
840
842
|
}
|
|
841
843
|
return body.nextRunAt;
|
|
842
844
|
}
|
|
845
|
+
|
|
846
|
+
export interface InspectionSections {
|
|
847
|
+
summary: import("@leitwerk-dev/protocol").ExecutionInspectionSummary;
|
|
848
|
+
trace: import("@leitwerk-dev/protocol").ExecutionInspectionTrace;
|
|
849
|
+
context: import("@leitwerk-dev/protocol").ExecutionInspectionContext;
|
|
850
|
+
configuration: import("@leitwerk-dev/protocol").ExecutionInspectionConfiguration;
|
|
851
|
+
}
|
|
852
|
+
export async function fetchExecutionInspection<S extends keyof InspectionSections>(
|
|
853
|
+
instanceId: string,
|
|
854
|
+
turnRecordId: string,
|
|
855
|
+
section: S,
|
|
856
|
+
target: { entryId?: string; itemId?: string; boundaryFor?: string } = {},
|
|
857
|
+
signal?: AbortSignal,
|
|
858
|
+
): Promise<InspectionSections[S]> {
|
|
859
|
+
const params = new URLSearchParams({ section });
|
|
860
|
+
for (const key of ["entryId", "itemId", "boundaryFor"] as const)
|
|
861
|
+
if (target[key]) params.set(key, target[key]);
|
|
862
|
+
const response = await getFetchImpl()(
|
|
863
|
+
resolveApiUrl(
|
|
864
|
+
`/api/processes/${encodeURIComponent(instanceId)}/turn-records/${encodeURIComponent(turnRecordId)}/inspection?${params}`,
|
|
865
|
+
),
|
|
866
|
+
{ signal },
|
|
867
|
+
);
|
|
868
|
+
if (!response.ok)
|
|
869
|
+
throw new Error(
|
|
870
|
+
response.status === 404
|
|
871
|
+
? "This execution is unavailable or does not belong to this process."
|
|
872
|
+
: `Couldn't load ${section}: ${response.status}`,
|
|
873
|
+
);
|
|
874
|
+
return readJsonObject<InspectionSections[S]>(response, "Malformed inspection response");
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
export async function updateProcessModelConfig(
|
|
878
|
+
instanceId: string,
|
|
879
|
+
patch: ProcessModelConfigPatch,
|
|
880
|
+
preview = false,
|
|
881
|
+
) {
|
|
882
|
+
return requestStatusJson<ProcessModelConfigResponseBody>(
|
|
883
|
+
`/api/processes/${encodeURIComponent(instanceId)}/model-config${preview ? "/preview" : ""}`,
|
|
884
|
+
preview ? "Couldn't preview model settings" : "Couldn't save model settings",
|
|
885
|
+
"Malformed model configuration response",
|
|
886
|
+
jsonRequestInit(preview ? "POST" : "PATCH", patch),
|
|
887
|
+
);
|
|
888
|
+
}
|