@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,114 @@
|
|
|
1
|
+
import type { ScopedSettingsSnapshot, SettingsContext } from "@leitwerk-dev/domain";
|
|
2
|
+
import type {
|
|
3
|
+
SettingChoice,
|
|
4
|
+
SettingsOverviewResponse,
|
|
5
|
+
SettingsPreview,
|
|
6
|
+
SettingsScopesResponse,
|
|
7
|
+
} from "@leitwerk-dev/protocol/http-contracts";
|
|
8
|
+
import { on } from "svelte/events";
|
|
9
|
+
import { apiResponseError, jsonRequestInit, requestJson } from "./http-client.js";
|
|
10
|
+
|
|
11
|
+
export function onSettingsChanged(refresh: () => void, refreshOnFocus = false) {
|
|
12
|
+
const unsubscribe = on(window, "leitwerk:settings-changed", refresh);
|
|
13
|
+
const unfocus = refreshOnFocus ? on(window, "focus", refresh) : undefined;
|
|
14
|
+
return () => {
|
|
15
|
+
unsubscribe();
|
|
16
|
+
unfocus?.();
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { ApiResponseError as SettingsRequestError } from "./http-client.js";
|
|
21
|
+
|
|
22
|
+
// Fastify supplies a status title in error and the actionable detail in message.
|
|
23
|
+
const settingsError = (fallback: string) => apiResponseError(fallback, true);
|
|
24
|
+
|
|
25
|
+
export interface SettingsChange {
|
|
26
|
+
subjectId: string;
|
|
27
|
+
key: string;
|
|
28
|
+
value: unknown;
|
|
29
|
+
mode: "replace";
|
|
30
|
+
reset: boolean;
|
|
31
|
+
expectedRevision: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function fetchSettingsScopes(refresh = false) {
|
|
35
|
+
return requestJson<SettingsScopesResponse>({
|
|
36
|
+
path: `/api/settings/scopes${refresh ? "/refresh" : ""}`,
|
|
37
|
+
...(refresh ? { init: jsonRequestInit("POST", {}) } : {}),
|
|
38
|
+
malformed: "Could not read settings scopes",
|
|
39
|
+
error: settingsError("Could not load settings scopes"),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function fetchSettingsPreview(subjectId: string) {
|
|
43
|
+
return requestJson<SettingsPreview>({
|
|
44
|
+
path: `/api/settings/preview?subjectId=${encodeURIComponent(subjectId)}`,
|
|
45
|
+
malformed: "Could not read settings",
|
|
46
|
+
error: settingsError("Could not load settings"),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export function fetchSettingsOverview(scopeType: string) {
|
|
50
|
+
return requestJson<SettingsOverviewResponse>({
|
|
51
|
+
path: `/api/settings/overview?${new URLSearchParams({ scopeType })}`,
|
|
52
|
+
malformed: "Could not read settings overview",
|
|
53
|
+
error: settingsError("Could not load settings overview"),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export function fetchSettingsChoices(
|
|
57
|
+
subjectId: string,
|
|
58
|
+
key: string,
|
|
59
|
+
search = "",
|
|
60
|
+
signal?: AbortSignal,
|
|
61
|
+
) {
|
|
62
|
+
return requestJson<{ choices: SettingChoice[] }>({
|
|
63
|
+
path: `/api/settings/choices?${new URLSearchParams({ subjectId, key, search })}`,
|
|
64
|
+
init: { signal },
|
|
65
|
+
malformed: "Could not read options",
|
|
66
|
+
error: settingsError("Could not load options. Try again or refine your search."),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export function changeSettings(change: SettingsChange, preview = false) {
|
|
70
|
+
return requestJson<SettingsPreview>({
|
|
71
|
+
path: `/api/settings/${preview ? "preview" : "overrides"}`,
|
|
72
|
+
init: jsonRequestInit(preview ? "POST" : "PUT", change),
|
|
73
|
+
malformed: "Could not read settings",
|
|
74
|
+
error: settingsError(preview ? "Could not preview setting" : "Could not save setting"),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export interface ProcessSettingsView {
|
|
78
|
+
primaryRepositoryKey: string | null;
|
|
79
|
+
future: Array<{ turnId: string; settings: ScopedSettingsSnapshot | null; error: string | null }>;
|
|
80
|
+
context: SettingsContext;
|
|
81
|
+
explanations: string[];
|
|
82
|
+
repositories: Array<{ key: string; subjectId: string; label: string }>;
|
|
83
|
+
captured: Array<{
|
|
84
|
+
startRecordId: string;
|
|
85
|
+
turnId: string;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
state: string;
|
|
88
|
+
settings: ScopedSettingsSnapshot;
|
|
89
|
+
}>;
|
|
90
|
+
}
|
|
91
|
+
export function fetchProcessSettings(instanceId: string) {
|
|
92
|
+
return requestJson<ProcessSettingsView>({
|
|
93
|
+
path: `/api/settings/processes/${encodeURIComponent(instanceId)}`,
|
|
94
|
+
malformed: "Could not read process settings",
|
|
95
|
+
error: settingsError("Could not load process settings"),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function settingsPath(subjectId = "instance") {
|
|
100
|
+
return `/settings?scope=${encodeURIComponent(subjectId)}`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function bindPrimaryRepository(
|
|
104
|
+
instanceId: string,
|
|
105
|
+
primaryRepositoryKey: string | null,
|
|
106
|
+
expectedPrimaryRepositoryKey: string | null,
|
|
107
|
+
) {
|
|
108
|
+
return requestJson<{ primaryRepositoryKey: string | null }>({
|
|
109
|
+
path: `/api/settings/processes/${encodeURIComponent(instanceId)}/primary-repository`,
|
|
110
|
+
init: jsonRequestInit("PUT", { primaryRepositoryKey, expectedPrimaryRepositoryKey }),
|
|
111
|
+
malformed: "Could not read primary repository",
|
|
112
|
+
error: settingsError("Could not bind primary repository"),
|
|
113
|
+
});
|
|
114
|
+
}
|
package/src/lib/wiki.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createWikiClient, type WikiUiHost } from "@leitwerk-dev/wiki/ui";
|
|
2
|
+
import ExternalLink from "../components/ExternalLink.svelte";
|
|
3
|
+
import PageHeader from "../components/PageHeader.svelte";
|
|
4
|
+
import { ApiResponseError, apiResponseError, requestJson } from "./http-client.js";
|
|
5
|
+
import { renderMarkdownToHtml } from "./markdown.js";
|
|
6
|
+
import { followLink, navigate } from "./router.svelte.js";
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
export function notifyWikiUpdated(topicId: string): void {
|
|
10
|
+
window.dispatchEvent(new CustomEvent("leitwerk:wiki-updated", { detail: { topicId } }));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** @internal */
|
|
14
|
+
export function onWikiUpdated(listener: (topicId: string) => void): () => void {
|
|
15
|
+
const handler = (event: Event) =>
|
|
16
|
+
listener((event as CustomEvent<{ topicId: string }>).detail.topicId);
|
|
17
|
+
window.addEventListener("leitwerk:wiki-updated", handler);
|
|
18
|
+
return () => window.removeEventListener("leitwerk:wiki-updated", handler);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const client = createWikiClient((input) =>
|
|
22
|
+
requestJson({ ...input, error: apiResponseError(input.error) }),
|
|
23
|
+
);
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const wikiUiHost: WikiUiHost = {
|
|
26
|
+
client,
|
|
27
|
+
renderMarkdownToHtml,
|
|
28
|
+
followLink,
|
|
29
|
+
navigate,
|
|
30
|
+
onWikiUpdated,
|
|
31
|
+
PageHeader,
|
|
32
|
+
ExternalLink,
|
|
33
|
+
errorStatus: (error) => (error instanceof ApiResponseError ? error.status : undefined),
|
|
34
|
+
};
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
import {
|
|
3
3
|
buildActiveTimelineTurnSummary,
|
|
4
4
|
type ProcessTimelineTurnSummary,
|
|
5
|
-
type TurnTraceSnapshot,
|
|
6
5
|
} from "@leitwerk-dev/protocol";
|
|
7
|
-
import { onDestroy
|
|
8
|
-
|
|
9
|
-
import type { ChronicleReasoningDetailEntry } from "../chronicle/lib/chronicle-projection.js";
|
|
6
|
+
import { onDestroy } from "svelte";
|
|
7
|
+
|
|
10
8
|
import {
|
|
11
9
|
buildChronicleProjection,
|
|
12
|
-
|
|
10
|
+
extractChronicleReasoningTurnRecordIds,
|
|
13
11
|
} from "../chronicle/lib/chronicle-projection.js";
|
|
14
12
|
import {
|
|
15
13
|
buildChronicleSelectableItems,
|
|
16
14
|
CHRONICLE_ACTION_SECTION_ANCHOR_ID,
|
|
17
15
|
CHRONICLE_PROCESS_ERROR_SECTION_ANCHOR_ID,
|
|
18
16
|
} from "../chronicle/lib/chronicle-selectable-items.js";
|
|
19
|
-
|
|
20
|
-
import {
|
|
17
|
+
|
|
18
|
+
import type { ProcessDetailData } from "../lib/api.js";
|
|
21
19
|
import { getBrowserStorage } from "../lib/browser-storage.js";
|
|
22
20
|
import { shouldIgnorePlainShortcut } from "../lib/keyboard.js";
|
|
23
21
|
import { getPrimaryPathActiveTurnOutput } from "../lib/primary-path-detail.js";
|
|
@@ -26,23 +24,13 @@ import {
|
|
|
26
24
|
consumeProcessLaunchNotice,
|
|
27
25
|
} from "../lib/process-launch-notices.svelte";
|
|
28
26
|
import type { ProcessTerminalStatus } from "../lib/process-terminal-display.js";
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
subscribeReasoningFrames,
|
|
34
|
-
} from "../lib/processes.svelte";
|
|
35
|
-
import { ReasoningHistory } from "../lib/reasoning-history.js";
|
|
36
|
-
import {
|
|
37
|
-
buildProcessesPath,
|
|
38
|
-
buildProcessPath,
|
|
39
|
-
locationStore,
|
|
40
|
-
navigate,
|
|
41
|
-
readProcessDetailOverlay,
|
|
42
|
-
} from "../lib/router.svelte";
|
|
43
|
-
import { createToolRendererIndex } from "../lib/tool-call-rendering.js";
|
|
27
|
+
import { clearDetail, detailState, loadProcessDetail } from "../lib/processes.svelte";
|
|
28
|
+
|
|
29
|
+
import { buildProcessesPath, locationStore, navigate } from "../lib/router.svelte";
|
|
30
|
+
import { readInspectorTarget } from "../lib/router-logic.js";
|
|
44
31
|
import { wsStore } from "../lib/ws.svelte";
|
|
45
|
-
import
|
|
32
|
+
import { createInspectorNavigation } from "./process-detail/inspector/inspector-navigation.js";
|
|
33
|
+
import ProcessInspector from "./process-detail/inspector/ProcessInspector.svelte";
|
|
46
34
|
import ProcessDetailChronicle from "./process-detail/ProcessDetailChronicle.svelte";
|
|
47
35
|
import ProcessDetailHeader from "./process-detail/ProcessDetailHeader.svelte";
|
|
48
36
|
import ProcessSummary from "./process-detail/ProcessSummary.svelte";
|
|
@@ -108,24 +96,6 @@ let launchWarning = $state<string | null>(null);
|
|
|
108
96
|
let observedInstanceId: string | null = null;
|
|
109
97
|
let loadedInstanceId = $state<string | null>(null);
|
|
110
98
|
let observedReconnectCount = $state<number | null>(null);
|
|
111
|
-
let processInfoFocusRestoreElement: HTMLElement | null = null;
|
|
112
|
-
let reasoningTraceCache = $state.raw<Record<string, TurnTraceSnapshot>>({});
|
|
113
|
-
let activeReasoningRequest = $state.raw<{
|
|
114
|
-
key: string;
|
|
115
|
-
status: "loading" | "error";
|
|
116
|
-
error: string | null;
|
|
117
|
-
} | null>(null);
|
|
118
|
-
let reasoningHistory: ReasoningHistory | null = null;
|
|
119
|
-
let observedReasoningKey: string | null = null;
|
|
120
|
-
let retainedReasoningEntry = $state.raw<ChronicleReasoningDetailEntry | null>(null);
|
|
121
|
-
const unsubscribeReasoningFrames = subscribeReasoningFrames((frame) => {
|
|
122
|
-
if (!reasoningHistory) return;
|
|
123
|
-
const trace = reasoningHistory.push(frame);
|
|
124
|
-
if (trace) reasoningTraceCache = { [reasoningHistory.turnRecordId]: trace };
|
|
125
|
-
});
|
|
126
|
-
let reasoningRequestGeneration = 0;
|
|
127
|
-
let reasoningRequestAbortController: AbortController | null = null;
|
|
128
|
-
|
|
129
99
|
const processDetailTitleId = "process-detail-title";
|
|
130
100
|
const processTimelineHeadingId = "process-timeline-heading";
|
|
131
101
|
|
|
@@ -151,12 +121,6 @@ $effect(() => {
|
|
|
151
121
|
}
|
|
152
122
|
observedInstanceId = instanceId;
|
|
153
123
|
launchWarning = null;
|
|
154
|
-
processInfoFocusRestoreElement = null;
|
|
155
|
-
reasoningTraceCache = {};
|
|
156
|
-
activeReasoningRequest = null;
|
|
157
|
-
reasoningRequestGeneration += 1;
|
|
158
|
-
reasoningRequestAbortController?.abort();
|
|
159
|
-
reasoningRequestAbortController = null;
|
|
160
124
|
detailActions.reset();
|
|
161
125
|
clearDetail();
|
|
162
126
|
});
|
|
@@ -172,8 +136,6 @@ $effect(() => {
|
|
|
172
136
|
});
|
|
173
137
|
|
|
174
138
|
onDestroy(() => {
|
|
175
|
-
unsubscribeReasoningFrames();
|
|
176
|
-
reasoningRequestAbortController?.abort();
|
|
177
139
|
clearDetail();
|
|
178
140
|
});
|
|
179
141
|
|
|
@@ -232,8 +194,6 @@ const turnRecords = $derived.by(() => {
|
|
|
232
194
|
: turn.displayTurn,
|
|
233
195
|
}));
|
|
234
196
|
});
|
|
235
|
-
const turnTraceIndex = $derived(reasoningTraceCache);
|
|
236
|
-
const toolRendererIndex = $derived(createToolRendererIndex($detailState.data?.toolRenderers ?? []));
|
|
237
197
|
const chroniclePrompt = $derived({
|
|
238
198
|
text: $detailState.data?.timeline.prompt.text ?? null,
|
|
239
199
|
createdAt: $detailState.data?.timeline.prompt.createdAt ?? null,
|
|
@@ -241,9 +201,7 @@ const chroniclePrompt = $derived({
|
|
|
241
201
|
const chronicleProjection = $derived(
|
|
242
202
|
buildChronicleProjection({
|
|
243
203
|
turnRecords,
|
|
244
|
-
turnTraceIndex,
|
|
245
204
|
turnTracePreviewIndex: $detailState.data?.timeline.tracePreviewsByTurnRecordId ?? {},
|
|
246
|
-
runDetails: $detailState.data?.runDetails ?? null,
|
|
247
205
|
initialUserInputText: $detailState.data?.timeline.prompt.text ?? null,
|
|
248
206
|
inputs: $detailState.data?.timeline.inputs ?? [],
|
|
249
207
|
leafOutcomeSnapshots: $detailState.data?.leafOutcomeSnapshots ?? [],
|
|
@@ -256,127 +214,34 @@ const chronicleProjection = $derived(
|
|
|
256
214
|
promptCreatedAt: chroniclePrompt.createdAt,
|
|
257
215
|
}),
|
|
258
216
|
);
|
|
259
|
-
const
|
|
260
|
-
|
|
217
|
+
const reasoningTurnRecordIds = $derived(
|
|
218
|
+
extractChronicleReasoningTurnRecordIds(
|
|
261
219
|
chronicleProjection,
|
|
262
220
|
$detailState.data?.questionRequests ?? [],
|
|
263
221
|
),
|
|
264
222
|
);
|
|
265
|
-
const
|
|
266
|
-
const isProcessInfoOverlayOpen = $derived(
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
)
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
: null;
|
|
283
|
-
}
|
|
284
|
-
return reasoningDetailEntries[activeReasoningDetailIndex] ?? null;
|
|
223
|
+
const inspectorTarget = $derived(readInspectorTarget($locationStore));
|
|
224
|
+
const isProcessInfoOverlayOpen = $derived(inspectorTarget?.scope === "process");
|
|
225
|
+
const hasBlockingDetailOverlay = $derived(inspectorTarget !== null);
|
|
226
|
+
let chronicle: { reveal(target: { turnRecordId?: string; turnId?: string }): void } | undefined;
|
|
227
|
+
const inspectorNavigation = createInspectorNavigation({
|
|
228
|
+
get instanceId() {
|
|
229
|
+
return instanceId;
|
|
230
|
+
},
|
|
231
|
+
get route() {
|
|
232
|
+
return inspectorTarget;
|
|
233
|
+
},
|
|
234
|
+
get path() {
|
|
235
|
+
return $locationStore;
|
|
236
|
+
},
|
|
237
|
+
reveal(target) {
|
|
238
|
+
chronicle?.reveal(target);
|
|
239
|
+
},
|
|
285
240
|
});
|
|
286
|
-
const hasPreviousReasoningDetail = $derived(activeReasoningDetailIndex > 0);
|
|
287
|
-
const hasNextReasoningDetail = $derived(
|
|
288
|
-
activeReasoningDetailIndex >= 0 && activeReasoningDetailIndex < reasoningDetailEntries.length - 1,
|
|
289
|
-
);
|
|
290
|
-
const hasBlockingDetailOverlay = $derived(
|
|
291
|
-
isProcessInfoOverlayOpen || activeReasoningDetail !== null,
|
|
292
|
-
);
|
|
293
|
-
|
|
294
|
-
async function loadReasoningDetail(requestInstanceId: string, turnRecordId: string, key: string) {
|
|
295
|
-
reasoningRequestAbortController?.abort();
|
|
296
|
-
const controller = new AbortController();
|
|
297
|
-
reasoningRequestAbortController = controller;
|
|
298
|
-
const generation = ++reasoningRequestGeneration;
|
|
299
|
-
if (
|
|
300
|
-
reasoningHistory?.instanceId !== requestInstanceId ||
|
|
301
|
-
reasoningHistory.turnRecordId !== turnRecordId
|
|
302
|
-
) {
|
|
303
|
-
reasoningHistory = new ReasoningHistory(requestInstanceId, turnRecordId);
|
|
304
|
-
reasoningTraceCache = {};
|
|
305
|
-
}
|
|
306
|
-
const history = reasoningHistory;
|
|
307
|
-
history.beginRequest();
|
|
308
|
-
activeReasoningRequest = { key, status: "loading", error: null };
|
|
309
|
-
// Let a direct link render the shell and controls before starting independent detail I/O.
|
|
310
|
-
await tick();
|
|
311
|
-
if (controller.signal.aborted) return;
|
|
312
|
-
try {
|
|
313
|
-
const response = await fetchTurnReasoningDetail(
|
|
314
|
-
requestInstanceId,
|
|
315
|
-
turnRecordId,
|
|
316
|
-
null,
|
|
317
|
-
controller.signal,
|
|
318
|
-
);
|
|
319
|
-
if (
|
|
320
|
-
generation !== reasoningRequestGeneration ||
|
|
321
|
-
requestedReasoningDetailTurnRecordId !== turnRecordId ||
|
|
322
|
-
instanceId !== requestInstanceId
|
|
323
|
-
)
|
|
324
|
-
return;
|
|
325
|
-
reasoningTraceCache = { [turnRecordId]: history.accept(response) };
|
|
326
|
-
activeReasoningRequest = null;
|
|
327
|
-
} catch (error) {
|
|
328
|
-
if (generation !== reasoningRequestGeneration || controller.signal.aborted) return;
|
|
329
|
-
history.failedRequest();
|
|
330
|
-
activeReasoningRequest = {
|
|
331
|
-
key,
|
|
332
|
-
status: "error",
|
|
333
|
-
error: error instanceof Error ? error.message : "Couldn't load full reasoning details",
|
|
334
|
-
};
|
|
335
|
-
} finally {
|
|
336
|
-
if (reasoningRequestAbortController === controller) reasoningRequestAbortController = null;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
241
|
$effect(() => {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const reconnect = $wsStore.reconnectCount;
|
|
344
|
-
if (!detail || !turnRecordId) {
|
|
345
|
-
untrack(() => {
|
|
346
|
-
observedReasoningKey = null;
|
|
347
|
-
reasoningRequestGeneration++;
|
|
348
|
-
reasoningRequestAbortController?.abort();
|
|
349
|
-
reasoningHistory = null;
|
|
350
|
-
reasoningTraceCache = {};
|
|
351
|
-
activeReasoningRequest = null;
|
|
352
|
-
retainedReasoningEntry = null;
|
|
353
|
-
});
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
const entry = reasoningDetailEntries.find((entry) => entry.turnRecordId === turnRecordId);
|
|
357
|
-
if (entry) retainedReasoningEntry = entry;
|
|
358
|
-
const turn = detail.timeline.turns.find((turn) => turn.id === turnRecordId);
|
|
359
|
-
const state = turn?.status === "completed" ? "committed" : "live";
|
|
360
|
-
const key = JSON.stringify([
|
|
361
|
-
instanceId,
|
|
362
|
-
turnRecordId,
|
|
363
|
-
state,
|
|
364
|
-
reconnect,
|
|
365
|
-
state === "committed" ? detail.session.signature : null,
|
|
366
|
-
]);
|
|
367
|
-
if (observedReasoningKey === key) return;
|
|
368
|
-
observedReasoningKey = key;
|
|
369
|
-
untrack(() => {
|
|
370
|
-
void loadReasoningDetail(instanceId, turnRecordId, key);
|
|
371
|
-
});
|
|
242
|
+
$locationStore;
|
|
243
|
+
void inspectorNavigation.restoreRoute();
|
|
372
244
|
});
|
|
373
|
-
|
|
374
|
-
const activeReasoningRequestState = $derived(activeReasoningRequest);
|
|
375
|
-
function retryReasoningDetail() {
|
|
376
|
-
const turnRecordId = requestedReasoningDetailTurnRecordId;
|
|
377
|
-
if (turnRecordId && observedReasoningKey)
|
|
378
|
-
void loadReasoningDetail(instanceId, turnRecordId, observedReasoningKey);
|
|
379
|
-
}
|
|
380
245
|
const scheduledActionDetail = $derived($detailState.data?.scheduledAction ?? null);
|
|
381
246
|
const isTerminalProcess = $derived.by(() => {
|
|
382
247
|
const lifecycleStatus = $detailState.data?.process.lifecycleStatus ?? null;
|
|
@@ -431,27 +296,17 @@ const terminalSummaryStatus = $derived.by((): ProcessTerminalStatus | null => {
|
|
|
431
296
|
}
|
|
432
297
|
return null;
|
|
433
298
|
});
|
|
434
|
-
|
|
299
|
+
|
|
435
300
|
const persistedModelSelectionWarning = $derived(
|
|
436
301
|
$detailState.data?.persistedModelSelectionWarning ?? null,
|
|
437
302
|
);
|
|
438
303
|
|
|
439
304
|
function handlePageKeydown(event: KeyboardEvent) {
|
|
440
|
-
if (shouldIgnorePlainShortcut(event)
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if (event.key === "Escape" && isProcessInfoOverlayOpen) {
|
|
305
|
+
if (shouldIgnorePlainShortcut(event)) return;
|
|
306
|
+
if (event.key === "Escape" && inspectorTarget) {
|
|
445
307
|
event.preventDefault();
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
if (isProcessInfoOverlayOpen || activeReasoningDetail !== null) {
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
if (event.key === "i") {
|
|
308
|
+
inspectorNavigation.returnToProcess();
|
|
309
|
+
} else if (event.key === "i" && !inspectorTarget) {
|
|
455
310
|
event.preventDefault();
|
|
456
311
|
toggleProcessInfoOverlay();
|
|
457
312
|
}
|
|
@@ -462,100 +317,25 @@ function dismissLaunchWarning() {
|
|
|
462
317
|
clearProcessLaunchNotice(instanceId);
|
|
463
318
|
}
|
|
464
319
|
|
|
465
|
-
function navigateToProcessBase(options: { replace?: boolean } = { replace: true }) {
|
|
466
|
-
navigate(buildProcessPath(instanceId), options);
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
function rememberProcessInfoFocusRestoreTarget() {
|
|
470
|
-
processInfoFocusRestoreElement =
|
|
471
|
-
document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
function restoreProcessInfoFocus() {
|
|
475
|
-
const restoreTarget = processInfoFocusRestoreElement;
|
|
476
|
-
processInfoFocusRestoreElement = null;
|
|
477
|
-
if (!restoreTarget?.isConnected) {
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
void tick().then(() => {
|
|
481
|
-
if (restoreTarget.isConnected) {
|
|
482
|
-
restoreTarget.focus();
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
}
|
|
486
|
-
|
|
487
320
|
function toggleProcessInfoOverlay() {
|
|
488
|
-
if (
|
|
489
|
-
|
|
490
|
-
}
|
|
491
|
-
if (isProcessInfoOverlayOpen) {
|
|
492
|
-
closeProcessInfoOverlay();
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
rememberProcessInfoFocusRestoreTarget();
|
|
496
|
-
navigate(buildProcessPath(instanceId, { overlay: "process-info" }), { replace: true });
|
|
321
|
+
if (inspectorTarget) inspectorNavigation.returnToProcess();
|
|
322
|
+
else inspectorNavigation.visit({ scope: "process", section: "overview" });
|
|
497
323
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
if (processDetailOverlay.kind === "process-info") {
|
|
501
|
-
navigateToProcessBase(options);
|
|
502
|
-
restoreProcessInfoFocus();
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
function closeProcessDetailOverlay(options: { replace?: boolean } = { replace: true }) {
|
|
507
|
-
if (processDetailOverlay.kind !== "none") {
|
|
508
|
-
if (processDetailOverlay.kind === "process-info") {
|
|
509
|
-
restoreProcessInfoFocus();
|
|
510
|
-
}
|
|
511
|
-
navigateToProcessBase(options);
|
|
512
|
-
}
|
|
324
|
+
function closeProcessInfoOverlay() {
|
|
325
|
+
inspectorNavigation.returnToProcess();
|
|
513
326
|
}
|
|
514
|
-
|
|
515
327
|
function closeBlockingDetailOverlays() {
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
function openReasoningDetails(turnRecordId: string) {
|
|
520
|
-
navigate(buildProcessPath(instanceId, { overlay: "reasoning", turnRecordId }), { replace: true });
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
function closeReasoningDetails(options: { replace?: boolean } = { replace: true }) {
|
|
524
|
-
if (processDetailOverlay.kind === "reasoning") {
|
|
525
|
-
navigateToProcessBase(options);
|
|
526
|
-
}
|
|
328
|
+
if (inspectorTarget) inspectorNavigation.returnToProcess();
|
|
527
329
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
if (activeReasoningDetailIndex <= 0) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
const turnRecordId = reasoningDetailEntries[activeReasoningDetailIndex - 1]?.turnRecordId ?? null;
|
|
534
|
-
if (!turnRecordId) {
|
|
535
|
-
return;
|
|
536
|
-
}
|
|
537
|
-
openReasoningDetails(turnRecordId);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
function openNextReasoningDetails() {
|
|
541
|
-
if (
|
|
542
|
-
activeReasoningDetailIndex < 0 ||
|
|
543
|
-
activeReasoningDetailIndex >= reasoningDetailEntries.length - 1
|
|
544
|
-
) {
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
const turnRecordId = reasoningDetailEntries[activeReasoningDetailIndex + 1]?.turnRecordId ?? null;
|
|
548
|
-
if (!turnRecordId) {
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
openReasoningDetails(turnRecordId);
|
|
330
|
+
function openReasoningDetails(turnRecordId: string, itemId?: string) {
|
|
331
|
+
inspectorNavigation.visit({ scope: "execution", turnRecordId, section: "trace", itemId });
|
|
552
332
|
}
|
|
553
333
|
</script>
|
|
554
334
|
|
|
555
335
|
<svelte:window onkeydown={handlePageKeydown} onstorage={handleSummaryStorage} />
|
|
556
336
|
|
|
557
|
-
<div class="process-detail-page" data-page="process-detail">
|
|
558
|
-
<div class="page-shell" inert={hasBlockingDetailOverlay ? true : undefined}>
|
|
337
|
+
<div class="process-detail-page" data-page="process-detail" use:inspectorNavigation.observe>
|
|
338
|
+
<div class="page-shell" hidden={hasBlockingDetailOverlay} inert={hasBlockingDetailOverlay ? true : undefined}>
|
|
559
339
|
<ProcessDetailHeader
|
|
560
340
|
{instanceId}
|
|
561
341
|
titleId={processDetailTitleId}
|
|
@@ -571,6 +351,7 @@ function openNextReasoningDetails() {
|
|
|
571
351
|
{/if}
|
|
572
352
|
|
|
573
353
|
<ProcessDetailChronicle
|
|
354
|
+
bind:this={chronicle}
|
|
574
355
|
{instanceId}
|
|
575
356
|
detail={$detailState.data}
|
|
576
357
|
loading={$detailState.loading}
|
|
@@ -589,7 +370,7 @@ function openNextReasoningDetails() {
|
|
|
589
370
|
{startupRecovery}
|
|
590
371
|
processError={currentProcessError}
|
|
591
372
|
{scheduledActionDetail}
|
|
592
|
-
{
|
|
373
|
+
{reasoningTurnRecordIds}
|
|
593
374
|
{hasBlockingDetailOverlay}
|
|
594
375
|
{launchWarning}
|
|
595
376
|
{persistedModelSelectionWarning}
|
|
@@ -603,48 +384,12 @@ function openNextReasoningDetails() {
|
|
|
603
384
|
/>
|
|
604
385
|
</div>
|
|
605
386
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
<ProcessInfoOverlay
|
|
613
|
-
detail={$detailState.data}
|
|
614
|
-
{processUsageEstimate}
|
|
615
|
-
onClose={() => closeProcessInfoOverlay()}
|
|
616
|
-
railItems={chronicleSelectableItems}
|
|
617
|
-
onShowSummary={waitingReport && summaryDismissed ? showSummary : undefined}
|
|
618
|
-
/>
|
|
619
|
-
</OverlayFrame>
|
|
620
|
-
{:else if activeReasoningDetail}
|
|
621
|
-
<OverlayFrame
|
|
622
|
-
kind="reasoning"
|
|
623
|
-
closeLabel="Close reasoning details"
|
|
624
|
-
onClose={() => closeProcessDetailOverlay()}
|
|
625
|
-
>
|
|
626
|
-
{#if activeReasoningRequestState?.status === "error"}
|
|
627
|
-
<div class="reasoning-load-error" role="status" data-section="reasoning-load-error">
|
|
628
|
-
<span>{activeReasoningRequestState.error}</span>
|
|
629
|
-
<button type="button" onclick={retryReasoningDetail}>Retry</button>
|
|
630
|
-
</div>
|
|
631
|
-
{:else if activeReasoningRequestState?.status === "loading"}
|
|
632
|
-
<p class="reasoning-load-status" role="status">Loading reasoning…</p>
|
|
633
|
-
{/if}
|
|
634
|
-
<ChronicleReasoningDetailsOverlay
|
|
635
|
-
entry={activeReasoningDetail}
|
|
636
|
-
{toolRendererIndex}
|
|
637
|
-
questionRequests={$detailState.data?.questionRequests.filter(
|
|
638
|
-
(request) => request.turnRecordId === activeReasoningDetail.turnRecordId,
|
|
639
|
-
) ?? []}
|
|
640
|
-
hasPrevious={hasPreviousReasoningDetail}
|
|
641
|
-
hasNext={hasNextReasoningDetail}
|
|
642
|
-
onClose={() => closeReasoningDetails()}
|
|
643
|
-
onPrevious={() => openPreviousReasoningDetails()}
|
|
644
|
-
onNext={() => openNextReasoningDetails()}
|
|
645
|
-
/>
|
|
646
|
-
</OverlayFrame>
|
|
647
|
-
{/if}
|
|
387
|
+
{#if inspectorTarget}
|
|
388
|
+
<ProcessInspector {instanceId} target={inspectorTarget} detail={$detailState.data} error={$detailState.error}
|
|
389
|
+
onNavigate={inspectorNavigation.visit} onReturn={inspectorNavigation.returnToProcess} onChronicle={inspectorNavigation.showChronicle}
|
|
390
|
+
onReady={inspectorNavigation.restoreContent}
|
|
391
|
+
onShowSummary={waitingReport && summaryDismissed ? showSummary : undefined} />
|
|
392
|
+
{/if}
|
|
648
393
|
</div>
|
|
649
394
|
|
|
650
395
|
<style>
|
|
@@ -667,39 +412,5 @@ function openNextReasoningDetails() {
|
|
|
667
412
|
min-height: 0;
|
|
668
413
|
}
|
|
669
414
|
|
|
670
|
-
.
|
|
671
|
-
margin: 0;
|
|
672
|
-
padding: var(--space-sm) var(--space-md);
|
|
673
|
-
font-size: var(--type-body-sm);
|
|
674
|
-
color: var(--chronicle-text-muted);
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
.reasoning-load-error {
|
|
678
|
-
display: flex;
|
|
679
|
-
gap: var(--space-sm);
|
|
680
|
-
align-items: center;
|
|
681
|
-
justify-content: space-between;
|
|
682
|
-
padding: var(--space-sm) var(--space-md);
|
|
683
|
-
border-bottom: 1px solid var(--chronicle-border);
|
|
684
|
-
color: var(--chronicle-danger-text);
|
|
685
|
-
background: var(--chronicle-danger-surface-soft);
|
|
686
|
-
font-size: var(--type-body-sm);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
.reasoning-load-error button {
|
|
690
|
-
min-height: 36px;
|
|
691
|
-
padding: 0 var(--space-md);
|
|
692
|
-
border: 1px solid var(--chronicle-border-strong);
|
|
693
|
-
border-radius: 999px;
|
|
694
|
-
background: var(--chronicle-surface);
|
|
695
|
-
color: var(--chronicle-text);
|
|
696
|
-
font: inherit;
|
|
697
|
-
font-weight: 650;
|
|
698
|
-
cursor: pointer;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
.reasoning-load-error button:focus-visible {
|
|
702
|
-
outline: 2px solid var(--chronicle-accent);
|
|
703
|
-
outline-offset: 2px;
|
|
704
|
-
}
|
|
415
|
+
.page-shell[hidden] {display:none;}
|
|
705
416
|
</style>
|