@leitwerk-dev/ui 0.3.0 → 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 +25 -6
- package/src/chronicle/components/ChronicleLiveTail.svelte +54 -25
- 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 +9 -6
- package/src/chronicle/components/ChronicleTurnProgress.svelte +10 -4
- package/src/chronicle/components/ChronicleTurnRail.svelte +10 -2
- package/src/chronicle/components/RecoveryModelControl.svelte +14 -13
- package/src/chronicle/lib/chronicle-projection.ts +82 -383
- package/src/chronicle/lib/chronicle-rail-groups.ts +8 -1
- package/src/chronicle/lib/chronicle-selectable-items.ts +25 -3
- package/src/chronicle/lib/chronicle-view-model.ts +18 -1
- package/src/chronicle/lib/recovery-model.ts +17 -0
- package/src/chronicle/lib/retry-groups.ts +13 -5
- 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-CB7mNpYv.js +0 -1
- package/dist/assets/GenericLauncher-CExW6wei.css +0 -1
- package/dist/assets/GenericLauncher-DTyRwWVd.js +0 -1
- package/dist/assets/HomePage-D_OT6OWU.js +0 -1
- package/dist/assets/PageHeader-DPuQInDo.css +0 -1
- package/dist/assets/PageHeader-sphJnWL1.js +0 -1
- package/dist/assets/ProcessActionsMenu-IKG-csM4.js +0 -1
- package/dist/assets/ProcessDetailPage-CiI5T6pN.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-CdnLkrSk.js +0 -1
- package/dist/assets/ScheduleDateTimePicker-DmojMRxN.js +0 -1
- package/dist/assets/ScheduleDateTimePicker-uacJAkIq.css +0 -1
- package/dist/assets/SkillsPage-CmiSWLOW.js +0 -2
- package/dist/assets/WatchersPage-Bu1vfZQI.js +0 -1
- package/dist/assets/http-client-VpPXJwbR.js +0 -2
- package/dist/assets/index-BkfAI7to.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
|
@@ -11,6 +11,7 @@ interface Props {
|
|
|
11
11
|
previewTruncated?: boolean;
|
|
12
12
|
traceItemCount: number;
|
|
13
13
|
isLive?: boolean;
|
|
14
|
+
isThinking?: boolean;
|
|
14
15
|
questionRequests?: readonly ProcessQuestionRequest[];
|
|
15
16
|
}
|
|
16
17
|
let {
|
|
@@ -19,6 +20,7 @@ let {
|
|
|
19
20
|
previewTruncated = false,
|
|
20
21
|
traceItemCount,
|
|
21
22
|
isLive = false,
|
|
23
|
+
isThinking = false,
|
|
22
24
|
questionRequests = [],
|
|
23
25
|
}: Props = $props();
|
|
24
26
|
const previewLines = $derived(
|
|
@@ -29,7 +31,10 @@ const previewLines = $derived(
|
|
|
29
31
|
{#if (isLive && previewLines.length > 0) || questionRequests.length > 0}
|
|
30
32
|
<section class="thinking-section" class:is-live={isLive} data-section="thinking-preview" data-live={isLive ? "true" : "false"}>
|
|
31
33
|
{#if isLive && previewLines.length > 0}
|
|
32
|
-
<span class="reasoning-label">
|
|
34
|
+
<span class="reasoning-label">
|
|
35
|
+
{#if isThinking}<svg class="reasoning-activity" width="8" height="8" viewBox="0 0 8 8" aria-hidden="true"><circle cx="4" cy="4" r="3" fill="currentColor" /></svg>{/if}
|
|
36
|
+
Reasoning
|
|
37
|
+
</span>
|
|
33
38
|
<div class="thinking-preview-copy" data-line-count={previewLines.length} data-truncated={previewTruncated ? "true" : "false"} data-trace-item-count={traceItemCount} style:--thinking-preview-lines={THINKING_PREVIEW_LINE_COUNT}>
|
|
34
39
|
<ChronicleThinkingText text={previewLines.join("\n")} variant="preview" />
|
|
35
40
|
</div>
|
|
@@ -44,7 +49,8 @@ const previewLines = $derived(
|
|
|
44
49
|
|
|
45
50
|
<style>
|
|
46
51
|
.thinking-section { display: grid; gap: 8px; min-width: 0; }
|
|
47
|
-
.reasoning-label { color: var(--chronicle-text-muted); font-size: var(--type-body-sm); font-weight: 600; }
|
|
52
|
+
.reasoning-label { display: flex; align-items: center; gap: 7px; color: var(--chronicle-text-muted); font-size: var(--type-body-sm); font-weight: 600; }
|
|
53
|
+
.reasoning-activity { color: var(--chronicle-accent); flex-shrink: 0; }
|
|
48
54
|
.thinking-preview-copy { display: flex; flex-direction: column; justify-content: flex-end; max-height: calc(var(--thinking-preview-lines, 4) * 1lh); max-width: 72ch; overflow: clip; color: var(--chronicle-text-muted); font-size: var(--type-body-sm); line-height: 1.6; }
|
|
49
55
|
.thinking-preview-copy > :global(*) { flex: 0 0 auto; }
|
|
50
56
|
.reasoning-questions { display: grid; gap: var(--space-sm); }
|
|
@@ -1,40 +1,143 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
2
|
+
import { type ProcessToolApprovalRequest, resolveJsonPointer } from "@leitwerk-dev/domain";
|
|
3
|
+
import type { TicketCreationToolSummary } from "@leitwerk-dev/protocol";
|
|
4
|
+
import { tick } from "svelte";
|
|
5
|
+
import { fetchTicketCreationTools, resolveToolApproval } from "../../lib/api.js";
|
|
6
|
+
import ChronicleMarkdown from "./ChronicleMarkdown.svelte";
|
|
4
7
|
import ReadonlyJsonValue from "./ReadonlyJsonValue.svelte";
|
|
5
8
|
|
|
6
9
|
let { request }: { request: ProcessToolApprovalRequest } = $props();
|
|
7
10
|
let feedback = $state("");
|
|
8
|
-
let
|
|
11
|
+
let feedbackOpen = $state(false);
|
|
12
|
+
let feedbackInput: HTMLTextAreaElement | undefined = $state();
|
|
13
|
+
let pending = $state<"accept" | "feedback" | "decline" | null>(null);
|
|
9
14
|
let error = $state<string | null>(null);
|
|
15
|
+
let tool = $state<TicketCreationToolSummary | undefined>();
|
|
16
|
+
|
|
17
|
+
function textAt(pointer: string | undefined): string | null {
|
|
18
|
+
if (!pointer) return null;
|
|
19
|
+
const value = resolveJsonPointer(request.arguments, pointer);
|
|
20
|
+
return typeof value === "string" ? value : null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const title = $derived(textAt(tool?.titlePath));
|
|
24
|
+
const description = $derived(textAt(tool?.descriptionPath));
|
|
25
|
+
|
|
26
|
+
$effect(() => {
|
|
27
|
+
const name = request.toolName;
|
|
28
|
+
let cancelled = false;
|
|
29
|
+
void fetchTicketCreationTools()
|
|
30
|
+
.then((tools) => {
|
|
31
|
+
if (!cancelled) tool = tools.find((candidate) => candidate.name === name);
|
|
32
|
+
})
|
|
33
|
+
.catch(() => {});
|
|
34
|
+
return () => {
|
|
35
|
+
cancelled = true;
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
10
39
|
async function resolve(action: "accept" | "feedback" | "decline") {
|
|
11
|
-
pending
|
|
40
|
+
if (pending || request.status !== "open" || (action === "feedback" && !feedback.trim())) return;
|
|
41
|
+
pending = action;
|
|
12
42
|
error = null;
|
|
13
43
|
try {
|
|
14
44
|
await resolveToolApproval({
|
|
15
45
|
instanceId: request.instanceId,
|
|
16
46
|
requestId: request.id,
|
|
17
|
-
body: { action, ...(action === "feedback" ? { feedback } : {}) },
|
|
47
|
+
body: { action, ...(action === "feedback" ? { feedback: feedback.trim() } : {}) },
|
|
18
48
|
});
|
|
19
|
-
request = {
|
|
49
|
+
request = {
|
|
50
|
+
...request,
|
|
51
|
+
status: action === "accept" ? "accepted" : action === "decline" ? "declined" : "feedback",
|
|
52
|
+
};
|
|
20
53
|
} catch (reason) {
|
|
21
54
|
error = reason instanceof Error ? reason.message : String(reason);
|
|
22
55
|
} finally {
|
|
23
|
-
pending =
|
|
56
|
+
pending = null;
|
|
24
57
|
}
|
|
25
58
|
}
|
|
59
|
+
|
|
60
|
+
async function requestChanges() {
|
|
61
|
+
feedbackOpen = true;
|
|
62
|
+
await tick();
|
|
63
|
+
feedbackInput?.focus();
|
|
64
|
+
}
|
|
26
65
|
</script>
|
|
27
|
-
|
|
28
|
-
|
|
66
|
+
|
|
67
|
+
<section class="approval" aria-labelledby={`approval-${request.id}`} aria-busy={pending !== null} data-section="ticket-approval">
|
|
68
|
+
<header>
|
|
69
|
+
<h3 id={`approval-${request.id}`}>Review issue</h3>
|
|
70
|
+
<p>Check the draft and destination before creating the issue.</p>
|
|
71
|
+
</header>
|
|
29
72
|
{#if request.destination}
|
|
30
|
-
<div class="destination"
|
|
73
|
+
<div class="destination">
|
|
74
|
+
<span>{tool?.displayName ?? "Destination"}</span>
|
|
75
|
+
<strong>{request.destination.displayName}</strong>
|
|
76
|
+
{#if request.destination.group}<span>{request.destination.group}</span>{/if}
|
|
77
|
+
{#if request.destination.description}<span>{request.destination.description}</span>{/if}
|
|
78
|
+
</div>
|
|
79
|
+
{/if}
|
|
80
|
+
{#if title || description}
|
|
81
|
+
<div class="draft-preview">
|
|
82
|
+
{#if title}<h4>{title}</h4>{/if}
|
|
83
|
+
{#if description}
|
|
84
|
+
{#if tool?.descriptionFormat === "markdown"}<ChronicleMarkdown markdown={description} />
|
|
85
|
+
{:else}<p class="draft-description">{description}</p>{/if}
|
|
86
|
+
{/if}
|
|
87
|
+
</div>
|
|
88
|
+
<details class="ticket-fields"><summary>All issue fields</summary><dl><ReadonlyJsonValue value={request.arguments} /></dl></details>
|
|
89
|
+
{:else}
|
|
90
|
+
<div class="ticket-fields"><dl><ReadonlyJsonValue value={request.arguments} /></dl></div>
|
|
31
91
|
{/if}
|
|
32
|
-
<p>The ticket system will receive these exact read-only arguments.</p>
|
|
33
|
-
<dl><ReadonlyJsonValue value={request.arguments} /></dl>
|
|
34
92
|
{#if request.status === "open"}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
93
|
+
{#if feedbackOpen}
|
|
94
|
+
<form class="feedback" onsubmit={(event) => { event.preventDefault(); void resolve("feedback"); }}>
|
|
95
|
+
<label for={`ticket-feedback-${request.id}`}>What should change?</label>
|
|
96
|
+
<textarea id={`ticket-feedback-${request.id}`} bind:this={feedbackInput} bind:value={feedback} rows="4" placeholder="Describe the changes you’d like in the next draft." disabled={pending !== null} required></textarea>
|
|
97
|
+
<div class="actions">
|
|
98
|
+
<button type="submit" class="ui-button" data-variant="primary" disabled={pending !== null || !feedback.trim()}>{pending === "feedback" ? "Sending changes…" : "Send changes"}</button>
|
|
99
|
+
<button type="button" class="ui-button" disabled={pending !== null} onclick={() => (feedbackOpen = false)}>Back to review</button>
|
|
100
|
+
</div>
|
|
101
|
+
</form>
|
|
102
|
+
{:else}
|
|
103
|
+
<div class="actions">
|
|
104
|
+
<button type="button" class="ui-button" data-variant="primary" disabled={pending !== null} onclick={() => resolve("accept")}>{pending === "accept" ? "Creating issue…" : "Create issue"}</button>
|
|
105
|
+
<button type="button" class="ui-button" disabled={pending !== null} onclick={requestChanges}>Request changes</button>
|
|
106
|
+
<button type="button" class="ui-button discard" disabled={pending !== null} onclick={() => resolve("decline")}>{pending === "decline" ? "Discarding…" : "Discard draft"}</button>
|
|
107
|
+
</div>
|
|
108
|
+
{/if}
|
|
109
|
+
{:else}
|
|
110
|
+
<p role="status">{request.status === "accepted" ? "Approved. The issue is being created." : request.status === "feedback" ? "Changes requested. A revised draft will appear here." : "Draft discarded. No issue was created."}</p>
|
|
111
|
+
{/if}
|
|
112
|
+
{#if error}<p class="approval-error" role="alert">{error}</p>{/if}
|
|
39
113
|
</section>
|
|
40
|
-
|
|
114
|
+
|
|
115
|
+
<style>
|
|
116
|
+
.approval { display: grid; gap: var(--space-md); min-width: 0; padding: var(--space-lg); border: 1px solid var(--chronicle-border-strong); border-radius: var(--radius-md); background: var(--chronicle-card-surface); overflow-wrap: anywhere; }
|
|
117
|
+
header { display: grid; gap: var(--space-xs); }
|
|
118
|
+
h3, h4, p, dl { margin: 0; }
|
|
119
|
+
h3 { font-size: var(--type-title-sm); }
|
|
120
|
+
header p, .destination span { color: var(--chronicle-text-muted); font-size: var(--type-body-sm); }
|
|
121
|
+
.destination { display: grid; gap: var(--space-2xs); padding: var(--space-sm) 0; border-block: 1px solid var(--chronicle-border); }
|
|
122
|
+
.destination strong { font-weight: 650; }
|
|
123
|
+
.draft-preview { display: grid; gap: var(--space-sm); min-width: 0; }
|
|
124
|
+
h4 { font-size: var(--type-title-sm); line-height: 1.4; }
|
|
125
|
+
.draft-description { white-space: pre-wrap; line-height: 1.6; max-width: 72ch; }
|
|
126
|
+
.ticket-fields { min-width: 0; font-size: var(--type-body-sm); }
|
|
127
|
+
summary { display: list-item; cursor: pointer; padding: var(--space-sm) 0; color: var(--chronicle-text-muted); min-height: 44px; }
|
|
128
|
+
summary:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 2px; }
|
|
129
|
+
.feedback { display: grid; gap: var(--space-xs); }
|
|
130
|
+
.feedback label { font-weight: 600; }
|
|
131
|
+
textarea { width: 100%; padding: var(--space-sm); border: 1px solid var(--chronicle-border-strong); border-radius: var(--radius-sm); background: var(--chronicle-card-surface); color: var(--chronicle-text); font: inherit; line-height: 1.5; resize: vertical; }
|
|
132
|
+
textarea:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 2px; }
|
|
133
|
+
textarea::placeholder { color: var(--chronicle-text-muted); }
|
|
134
|
+
.actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); padding-top: var(--space-xs); }
|
|
135
|
+
.discard { margin-left: auto; }
|
|
136
|
+
.approval-error { padding: var(--space-sm); border-radius: var(--radius-sm); background: var(--chronicle-danger-surface-soft); color: var(--chronicle-danger-text-strong); }
|
|
137
|
+
@media (max-width: 540px) {
|
|
138
|
+
.approval { padding: var(--space-md); }
|
|
139
|
+
.actions .ui-button { flex: 1 1 auto; }
|
|
140
|
+
.discard { margin-left: 0; }
|
|
141
|
+
textarea { font-size: 16px; }
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
@@ -9,7 +9,11 @@ import { resolveToolRenderer, resolveToolRendererFields } from "../../lib/tool-c
|
|
|
9
9
|
import { formatStructuredValue, summarizeToolPayload } from "../lib/tool-call-summary.js";
|
|
10
10
|
import ChronicleMarkdown from "./ChronicleMarkdown.svelte";
|
|
11
11
|
|
|
12
|
-
type DisplayToolCallSnapshot =
|
|
12
|
+
type DisplayToolCallSnapshot =
|
|
13
|
+
| PrimaryPathToolCallSnapshot
|
|
14
|
+
| (Omit<TurnTraceToolCallSnapshot, "status"> & {
|
|
15
|
+
status: TurnTraceToolCallSnapshot["status"] | "unknown";
|
|
16
|
+
});
|
|
13
17
|
|
|
14
18
|
interface Props {
|
|
15
19
|
toolCall: DisplayToolCallSnapshot;
|
|
@@ -59,13 +63,14 @@ function parseTimestamp(value: string | null | undefined): number | null {
|
|
|
59
63
|
function formatStartAndDurationLabel(
|
|
60
64
|
startedAt: string | null | undefined,
|
|
61
65
|
completedAt: string | null | undefined,
|
|
66
|
+
status: DisplayToolCallSnapshot["status"],
|
|
62
67
|
): string {
|
|
63
68
|
const startedLabel =
|
|
64
69
|
typeof startedAt === "string" && startedAt.trim() !== "" ? startedAt : "Unknown";
|
|
65
70
|
const start = parseTimestamp(startedAt);
|
|
66
71
|
const end = parseTimestamp(completedAt);
|
|
67
72
|
if (start === null || end === null || end < start) {
|
|
68
|
-
return `Started ${startedLabel} · Duration ${
|
|
73
|
+
return `Started ${startedLabel} · Duration ${status === "running" ? "Running" : "Unknown"}`;
|
|
69
74
|
}
|
|
70
75
|
const totalSeconds = Math.max(0, Math.round((end - start) / 1000));
|
|
71
76
|
const durationLabel =
|
|
@@ -119,14 +124,34 @@ const resultText = $derived("resultText" in toolCall ? toolCall.resultText : nul
|
|
|
119
124
|
const isToolTruncated = $derived("truncated" in toolCall && toolCall.truncated);
|
|
120
125
|
const argumentSummary = $derived(primaryArgumentSummary(toolCall));
|
|
121
126
|
const runMetaLabel = $derived(
|
|
122
|
-
formatStartAndDurationLabel(toolCall.startedAt, toolCall.completedAt),
|
|
127
|
+
formatStartAndDurationLabel(toolCall.startedAt, toolCall.completedAt, toolCall.status),
|
|
123
128
|
);
|
|
124
129
|
const statusLabel = $derived(
|
|
125
|
-
toolCall.
|
|
130
|
+
toolCall.status === "unknown"
|
|
131
|
+
? "Outcome not recorded"
|
|
132
|
+
: toolCall.isError
|
|
133
|
+
? "Failed"
|
|
134
|
+
: toolCall.status === "running"
|
|
135
|
+
? "Running"
|
|
136
|
+
: "Completed",
|
|
137
|
+
);
|
|
138
|
+
const statusSymbol = $derived(
|
|
139
|
+
toolCall.status === "unknown"
|
|
140
|
+
? "?"
|
|
141
|
+
: toolCall.isError
|
|
142
|
+
? "✕"
|
|
143
|
+
: toolCall.status === "running"
|
|
144
|
+
? "…"
|
|
145
|
+
: "✓",
|
|
126
146
|
);
|
|
127
|
-
const statusSymbol = $derived(toolCall.isError ? "✕" : toolCall.status === "running" ? "…" : "✓");
|
|
128
147
|
const statusTone = $derived(
|
|
129
|
-
toolCall.
|
|
148
|
+
toolCall.status === "unknown"
|
|
149
|
+
? "unknown"
|
|
150
|
+
: toolCall.isError
|
|
151
|
+
? "error"
|
|
152
|
+
: toolCall.status === "running"
|
|
153
|
+
? "running"
|
|
154
|
+
: "success",
|
|
130
155
|
);
|
|
131
156
|
</script>
|
|
132
157
|
|
|
@@ -150,6 +175,7 @@ const statusTone = $derived(
|
|
|
150
175
|
{/snippet}
|
|
151
176
|
|
|
152
177
|
<details
|
|
178
|
+
data-disclosure-key={`tool:${toolCall.toolCallId}`}
|
|
153
179
|
class="tool-item tool-item-expandable"
|
|
154
180
|
open={isOpen}
|
|
155
181
|
data-section="reasoning-tool-marker"
|
|
@@ -5,6 +5,7 @@ import { formatTurnId } from "../../lib/format.js";
|
|
|
5
5
|
import { markdownToPlainText, truncateText } from "../../lib/markdown.js";
|
|
6
6
|
import type { ChronicleTurnClusterItem } from "../lib/chronicle-projection.js";
|
|
7
7
|
import type { ChronicleTicketArtifact } from "../lib/chronicle-ticket-artifact.js";
|
|
8
|
+
import { formatChronicleIterationProgress } from "../lib/chronicle-view-model.js";
|
|
8
9
|
import { formatChronicleCost, formatChronicleDuration } from "../lib/formatting.js";
|
|
9
10
|
import { presentTurnResult } from "../lib/result-presentation.js";
|
|
10
11
|
import ChronicleCreateIssueButton from "./ChronicleCreateIssueButton.svelte";
|
|
@@ -21,7 +22,7 @@ interface Props {
|
|
|
21
22
|
isFocused: boolean;
|
|
22
23
|
compressHistory?: boolean;
|
|
23
24
|
questionRequests?: readonly ProcessQuestionRequest[];
|
|
24
|
-
onOpenReasoningDetails: (turnRecordId: string) => void;
|
|
25
|
+
onOpenReasoningDetails: (turnRecordId: string, itemId?: string) => void;
|
|
25
26
|
onDraftTicket?: (artifact: ChronicleTicketArtifact) => void;
|
|
26
27
|
recoveryContent?: Snippet;
|
|
27
28
|
waitingContent?: Snippet;
|
|
@@ -72,6 +73,7 @@ const resultHeadings = $derived(
|
|
|
72
73
|
);
|
|
73
74
|
const metadata = $derived(
|
|
74
75
|
[
|
|
76
|
+
cluster.iteration ? formatChronicleIterationProgress(cluster.iteration) : null,
|
|
75
77
|
cluster.modelProfileId,
|
|
76
78
|
cluster.usage?.cost ? formatChronicleCost(cluster.usage.cost.total) : null,
|
|
77
79
|
]
|
|
@@ -105,6 +107,7 @@ function openDetails() {
|
|
|
105
107
|
data-turn-id={cluster.turnId}
|
|
106
108
|
data-turn-record-id={cluster.turnRecordId}
|
|
107
109
|
data-turn-kind={cluster.turnPresentation}
|
|
110
|
+
data-item-key={cluster.iteration?.itemKey}
|
|
108
111
|
>
|
|
109
112
|
<ChronicleEntryHeader title={cluster.title} {kind} failed={isFailed} metadata={metadata || null} timestamp={cluster.createdAt} duration={kind === "operator" || kind === "external" ? null : formatChronicleDuration(cluster.facts.startedAt, cluster.facts.endedAt)}>
|
|
110
113
|
{#snippet controls()}
|
|
@@ -177,22 +180,22 @@ function openDetails() {
|
|
|
177
180
|
{@render waitingContent?.()}
|
|
178
181
|
|
|
179
182
|
{#if prompt}
|
|
180
|
-
<button class="prompt-row" type="button" data-section="turn-prompt" aria-label={`View prompt for ${cluster.title}`} onclick={
|
|
183
|
+
<button class="prompt-row" type="button" data-section="turn-prompt" aria-label={`View prompt for ${cluster.title}`} onclick={() => onOpenReasoningDetails(cluster.turnRecordId, "input")}>
|
|
181
184
|
<span class="prompt-label">Prompt</span>
|
|
182
185
|
<span class="prompt-preview">{truncateText(markdownToPlainText(prompt), 240)}</span>
|
|
183
186
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" aria-hidden="true"><path d="m9 5 7 7-7 7" /></svg>
|
|
184
187
|
</button>
|
|
185
188
|
{/if}
|
|
186
189
|
|
|
187
|
-
{#if
|
|
190
|
+
{#if cluster.turnRecordId}
|
|
188
191
|
<div class="cluster-support" class:has-reasoning={hasReasoning}>
|
|
189
192
|
<div class="support-progress">{#if progress && isLlm}<ChronicleTurnProgress report={progress.report} attemptStatus={progress.attemptStatus} recordedAt={progress.recordedAt} compact />{/if}</div>
|
|
190
193
|
<div class="footer-actions">
|
|
191
194
|
{#if compactResult && onDraftTicket}<ChronicleCreateIssueButton {onDraftTicket} artifact={{ kind: "turn_result", turnRecordId: cluster.turnRecordId }} />{/if}
|
|
192
|
-
{#if
|
|
195
|
+
{#if cluster.turnRecordId}
|
|
193
196
|
<div class="turn-info-actions">
|
|
194
|
-
{#if hasReasoning}<ChronicleTurnDetailsButton kind="reasoning" title={cluster.title} onClick={
|
|
195
|
-
|
|
197
|
+
{#if hasReasoning}<ChronicleTurnDetailsButton kind="reasoning" title={cluster.title} onClick={() => onOpenReasoningDetails(cluster.turnRecordId, "reasoning")} />{/if}
|
|
198
|
+
<ChronicleTurnDetailsButton title={cluster.title} onClick={openDetails} />
|
|
196
199
|
</div>
|
|
197
200
|
{/if}
|
|
198
201
|
</div>
|
|
@@ -10,11 +10,13 @@ import type { ExternalResourceType } from "../../lib/external-links.js";
|
|
|
10
10
|
let {
|
|
11
11
|
report,
|
|
12
12
|
compact = false,
|
|
13
|
+
showSummary = true,
|
|
13
14
|
attemptStatus,
|
|
14
15
|
recordedAt,
|
|
15
16
|
}: {
|
|
16
17
|
report: TurnProgressReport;
|
|
17
18
|
compact?: boolean;
|
|
19
|
+
showSummary?: boolean;
|
|
18
20
|
attemptStatus?: string;
|
|
19
21
|
recordedAt?: string;
|
|
20
22
|
} = $props();
|
|
@@ -56,22 +58,24 @@ function resourceType(kind: TurnProgressLink["kind"]): ExternalResourceType {
|
|
|
56
58
|
{/if}
|
|
57
59
|
{/snippet}
|
|
58
60
|
|
|
59
|
-
{#if report.summary}<p>{report.summary}{#if recordedAt} <time datetime={recordedAt}>{new Date(recordedAt).toLocaleString()}</time>{/if}</p>{/if}
|
|
61
|
+
{#if showSummary && report.summary}<p data-section="turn-progress-summary">{report.summary}{#if recordedAt} <time datetime={recordedAt}>{new Date(recordedAt).toLocaleString()}</time>{/if}</p>{/if}
|
|
60
62
|
|
|
61
63
|
{#if succeeded}
|
|
62
64
|
<div class="progress-summary" data-section="turn-progress">
|
|
63
65
|
<details>
|
|
64
66
|
<summary>
|
|
65
|
-
<svg class="check" width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="10" cy="10" r="8" /><path d="m6 10 3 3 5-6" /></svg>
|
|
67
|
+
{#if !compact}<svg class="check" width="18" height="18" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><circle cx="10" cy="10" r="8" /><path d="m6 10 3 3 5-6" /></svg>{/if}
|
|
66
68
|
<span>{summary}</span>
|
|
67
|
-
<svg class="chevron" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg>
|
|
69
|
+
<svg class="chevron" class:leading={compact} width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" aria-hidden="true"><path d={compact ? "m9 6 6 6-6 6" : "m6 9 6 6 6-6"} /></svg>
|
|
68
70
|
</summary>
|
|
69
71
|
<div class="progress-details"><ProgressChecklistRows {steps} /></div>
|
|
70
72
|
</details>
|
|
71
73
|
{@render createdChanges()}
|
|
72
74
|
</div>
|
|
73
|
-
{:else}
|
|
75
|
+
{:else if steps.length}
|
|
74
76
|
<ProgressChecklist title={report.title} {steps} dataSection="turn-progress">{@render createdChanges()}</ProgressChecklist>
|
|
77
|
+
{:else}
|
|
78
|
+
{@render createdChanges()}
|
|
75
79
|
{/if}
|
|
76
80
|
{#if hasUnfinished}
|
|
77
81
|
<details><summary>Original progress report</summary><ProgressChecklistRows steps={report.steps.map((step) => ({ ...step, status: step.status === "in_progress" ? "incomplete" : step.status, detail: step.status === "in_progress" ? ["Recorded as in progress", step.detail].filter(Boolean).join(" · ") : step.detail }))} /></details>
|
|
@@ -85,7 +89,9 @@ function resourceType(kind: TurnProgressLink["kind"]): ExternalResourceType {
|
|
|
85
89
|
summary:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 2px; border-radius: 4px; }
|
|
86
90
|
.check { color: var(--chronicle-success); flex-shrink: 0; }
|
|
87
91
|
.chevron { color: var(--chronicle-text-faint); }
|
|
92
|
+
.chevron.leading { order: -1; }
|
|
88
93
|
details[open] .chevron { transform: rotate(180deg); }
|
|
94
|
+
details[open] .chevron.leading { transform: rotate(90deg); }
|
|
89
95
|
.progress-details { padding: 10px 0; }
|
|
90
96
|
h5 { margin: 0; color: var(--chronicle-text); font-size: var(--type-body-sm); font-weight: 600; }
|
|
91
97
|
.created-changes { display: grid; gap: 4px; margin-top: 6px; }
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
formatRailElapsed,
|
|
9
9
|
} from "../lib/chronicle-rail-groups.js";
|
|
10
10
|
import type { ChronicleSelectableItem } from "../lib/chronicle-selectable-items.js";
|
|
11
|
+
import { formatChronicleIterationProgress } from "../lib/chronicle-view-model.js";
|
|
11
12
|
import { groupRetryChains } from "../lib/retry-groups.js";
|
|
12
13
|
|
|
13
14
|
interface Props {
|
|
@@ -44,6 +45,7 @@ const retryMembership = $derived.by(() => {
|
|
|
44
45
|
turnId: record.turnId,
|
|
45
46
|
parentTurnRecordId: record.parentTurnRecordId,
|
|
46
47
|
failed: record.outcome === "failed",
|
|
48
|
+
itemKey: record.iteration?.itemKey,
|
|
47
49
|
}))) {
|
|
48
50
|
if (group.length > 1)
|
|
49
51
|
group.forEach((record, index) => {
|
|
@@ -166,7 +168,13 @@ function itemDetail(item: ChronicleSelectableItem): string | null {
|
|
|
166
168
|
: "Completed";
|
|
167
169
|
const label = state === "live" ? "In progress" : state === "failed" ? "Failed" : completedLabel;
|
|
168
170
|
const retry = retryMembership.get(item.turnRecordId);
|
|
169
|
-
return [
|
|
171
|
+
return [
|
|
172
|
+
item.iteration ? formatChronicleIterationProgress(item.iteration) : null,
|
|
173
|
+
retry ? `Attempt ${retry.index} of ${retry.total}` : null,
|
|
174
|
+
label,
|
|
175
|
+
elapsed,
|
|
176
|
+
item.detail,
|
|
177
|
+
]
|
|
170
178
|
.filter(Boolean)
|
|
171
179
|
.join(" · ");
|
|
172
180
|
}
|
|
@@ -266,7 +274,7 @@ function groupElapsed(group: ChronicleRepeatedTurns): string | null {
|
|
|
266
274
|
{#if upcomingTurn}
|
|
267
275
|
<div class="rail-item rail-upcoming" data-section="upcoming-turn" data-state="pending">
|
|
268
276
|
<span class="rail-marker" aria-hidden="true"></span>
|
|
269
|
-
<span class="rail-copy"><span class="rail-title">{upcomingTurn.description}</span><span class="rail-detail">Pending</span></span>
|
|
277
|
+
<span class="rail-copy"><span class="rail-title">{upcomingTurn.description}</span><span class="rail-detail">{upcomingTurn.iteration ? `${formatChronicleIterationProgress(upcomingTurn.iteration)} · Pending` : "Pending"}</span></span>
|
|
270
278
|
</div>
|
|
271
279
|
{/if}
|
|
272
280
|
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ModelProfileOptionSummary } from "@leitwerk-dev/protocol";
|
|
3
|
+
import { recoveryModelSelection } from "../lib/recovery-model.js";
|
|
3
4
|
import ModelProfileOptions from "./ModelProfileOptions.svelte";
|
|
4
5
|
import ProviderOptionsEditor from "./ProviderOptionsEditor.svelte";
|
|
5
6
|
|
|
@@ -7,12 +8,13 @@ interface Props {
|
|
|
7
8
|
instanceId: string;
|
|
8
9
|
modelProfiles: readonly ModelProfileOptionSummary[];
|
|
9
10
|
defaultModelProfileId: string | null;
|
|
11
|
+
inheritedModelProfileId?: string | null;
|
|
10
12
|
initialProviderOptions?: Readonly<Record<string, string>>;
|
|
11
13
|
disabled: boolean;
|
|
12
14
|
selectId: string;
|
|
13
15
|
selectLabel?: string;
|
|
14
16
|
selectDataField?: string;
|
|
15
|
-
onModelChange: (profileId: string | undefined, usable: boolean) => void;
|
|
17
|
+
onModelChange: (profileId: string | null | undefined, usable: boolean) => void;
|
|
16
18
|
onProviderOptionsChange: (values: Record<string, string> | undefined) => void;
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -20,6 +22,7 @@ let {
|
|
|
20
22
|
instanceId,
|
|
21
23
|
modelProfiles,
|
|
22
24
|
defaultModelProfileId,
|
|
25
|
+
inheritedModelProfileId = null,
|
|
23
26
|
initialProviderOptions = {},
|
|
24
27
|
disabled,
|
|
25
28
|
selectId,
|
|
@@ -29,19 +32,15 @@ let {
|
|
|
29
32
|
onProviderOptionsChange,
|
|
30
33
|
}: Props = $props();
|
|
31
34
|
|
|
32
|
-
let modelProfileDraft = $state(
|
|
35
|
+
let modelProfileDraft = $state("");
|
|
33
36
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
)
|
|
37
|
-
const selectedModelUsable = $derived(
|
|
38
|
-
selectedProfile === null ||
|
|
39
|
-
selectedProfile.availability === undefined ||
|
|
40
|
-
selectedProfile.availability === "available",
|
|
37
|
+
const draft = $derived(modelProfileDraft === "__inherit" ? null : modelProfileDraft || undefined);
|
|
38
|
+
const selection = $derived(
|
|
39
|
+
recoveryModelSelection(modelProfiles, draft, defaultModelProfileId, inheritedModelProfileId),
|
|
41
40
|
);
|
|
42
41
|
|
|
43
42
|
$effect(() => {
|
|
44
|
-
onModelChange(
|
|
43
|
+
onModelChange(draft, selection.usable);
|
|
45
44
|
});
|
|
46
45
|
</script>
|
|
47
46
|
|
|
@@ -54,15 +53,17 @@ $effect(() => {
|
|
|
54
53
|
bind:value={modelProfileDraft}
|
|
55
54
|
{disabled}
|
|
56
55
|
>
|
|
56
|
+
<option value="">Use current model policy{defaultModelProfileId ? ` (${defaultModelProfileId})` : ""}</option>
|
|
57
|
+
<option value="__inherit">Use inherited value{inheritedModelProfileId ? ` (${inheritedModelProfileId})` : ""}</option>
|
|
57
58
|
<ModelProfileOptions profiles={modelProfiles} />
|
|
58
59
|
</select>
|
|
59
|
-
{#if
|
|
60
|
-
<p class="model-reason">{
|
|
60
|
+
{#if selection.profile?.safeReason && !selection.usable}
|
|
61
|
+
<p class="model-reason">{selection.profile.safeReason}</p>
|
|
61
62
|
{/if}
|
|
62
63
|
{/if}
|
|
63
64
|
<ProviderOptionsEditor
|
|
64
65
|
{instanceId}
|
|
65
|
-
modelProfileId={
|
|
66
|
+
modelProfileId={selection.profileId}
|
|
66
67
|
initialValues={initialProviderOptions}
|
|
67
68
|
{disabled}
|
|
68
69
|
onChange={(values) => onProviderOptionsChange(values ? { ...values } : undefined)}
|