@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.
Files changed (126) hide show
  1. package/dist/assets/ApiTokensPage-DCmYvZdE.js +1 -0
  2. package/dist/assets/ChronicleMarkdown-6T_LF-3B.js +1 -0
  3. package/dist/assets/FutureLaunchDetailPage-D5Gc8YmZ.js +1 -0
  4. package/dist/assets/GenericLauncher-4BQGl6fT.js +4 -0
  5. package/dist/assets/GenericLauncher-DRUMMTd7.css +1 -0
  6. package/dist/assets/HomePage-mb9RzXht.js +1 -0
  7. package/dist/assets/ProcessActionsMenu-CEzADnZT.js +1 -0
  8. package/dist/assets/ProcessDetailPage-0c-fMf4Y.js +14 -0
  9. package/dist/assets/ProcessDetailPage-km76G8wj.css +1 -0
  10. package/dist/assets/ProcessFlowDiagram-DI5KZ2Qj.js +1 -0
  11. package/dist/assets/ProcessFlowDiagram-NQ6oEZi7.css +1 -0
  12. package/dist/assets/ProcessesPage-CVvENTJg.js +1 -0
  13. package/dist/assets/ScheduleDateTimePicker-2eJ0jBQ-.css +1 -0
  14. package/dist/assets/ScheduleDateTimePicker-fg0Vau5Z.js +3 -0
  15. package/dist/assets/SettingsPage-BHSV4rl7.css +1 -0
  16. package/dist/assets/SettingsPage-CbNM5RWn.js +2 -0
  17. package/dist/assets/SkillsPage-rCSwSz89.js +2 -0
  18. package/dist/assets/WatchersPage-D-uT5vWk.js +1 -0
  19. package/dist/assets/WikiPage-BNdWnJ6L.js +1 -0
  20. package/dist/assets/WikiPage-Bvnhxl3m.css +1 -0
  21. package/dist/assets/http-client-Cvi3zOou.js +2 -0
  22. package/dist/assets/http-contracts-public-BXXSFKbw.js +1 -0
  23. package/dist/assets/index-DybyOt1_.css +1 -0
  24. package/dist/assets/{index-client-BYQviCtQ.js → index-client-BSAA7n1a.js} +2 -2
  25. package/dist/assets/index-gVt2yBO1.js +21 -0
  26. package/dist/assets/mermaid-render.worker-BN0bcvGc.js +6398 -0
  27. package/dist/assets/retry-config.svelte-HNNF65qc.js +1 -0
  28. package/dist/assets/settings-Dk5UoSQa.js +1 -0
  29. package/dist/index.html +4 -7
  30. package/package.json +10 -9
  31. package/src/App.svelte +9 -0
  32. package/src/chronicle/components/ChronicleActionSection.svelte +10 -2
  33. package/src/chronicle/components/ChronicleEntryHeader.svelte +4 -16
  34. package/src/chronicle/components/ChronicleFlow.svelte +24 -6
  35. package/src/chronicle/components/ChronicleLiveTail.svelte +52 -24
  36. package/src/chronicle/components/ChronicleProcessErrorSection.svelte +14 -0
  37. package/src/chronicle/components/ChronicleQuestionRequest.svelte +1 -1
  38. package/src/chronicle/components/ChronicleRecoverySection.svelte +14 -10
  39. package/src/chronicle/components/ChronicleStartupRecoverySection.svelte +14 -10
  40. package/src/chronicle/components/ChronicleThinkingSection.svelte +8 -2
  41. package/src/chronicle/components/ChronicleToolApproval.svelte +120 -17
  42. package/src/chronicle/components/ChronicleToolCallItem.svelte +32 -6
  43. package/src/chronicle/components/ChronicleTurnCluster.svelte +6 -6
  44. package/src/chronicle/components/ChronicleTurnProgress.svelte +10 -4
  45. package/src/chronicle/components/ChronicleTurnRail.svelte +1 -0
  46. package/src/chronicle/components/RecoveryModelControl.svelte +14 -13
  47. package/src/chronicle/lib/chronicle-projection.ts +74 -376
  48. package/src/chronicle/lib/chronicle-selectable-items.ts +23 -3
  49. package/src/chronicle/lib/recovery-model.ts +17 -0
  50. package/src/components/ConversationTreeDiagram.svelte +93 -30
  51. package/src/components/FormFieldRenderer.svelte +184 -27
  52. package/src/components/GenericLauncher.svelte +378 -166
  53. package/src/components/NamedSelectionList.svelte +77 -0
  54. package/src/components/ProcessSettings.svelte +110 -0
  55. package/src/components/ScheduleDateTimePicker.svelte +9 -4
  56. package/src/components/SettingsField.svelte +317 -0
  57. package/src/components/SettingsOverview.svelte +237 -0
  58. package/src/components/SkillSelector.svelte +15 -3
  59. package/src/components/launcher-form-copy.ts +2 -1
  60. package/src/components/launcher-model-config.ts +8 -7
  61. package/src/components/launcher-selections.ts +123 -0
  62. package/src/lib/api.ts +89 -43
  63. package/src/lib/http-client.ts +20 -1
  64. package/src/lib/instance-tree-layout.ts +41 -10
  65. package/src/lib/primary-path-detail.ts +56 -341
  66. package/src/lib/primary-path-replay.ts +8 -9
  67. package/src/lib/process-history.ts +57 -0
  68. package/src/lib/processes.svelte.ts +71 -79
  69. package/src/lib/reasoning-history.ts +31 -23
  70. package/src/lib/router-logic.ts +101 -51
  71. package/src/lib/router.svelte.ts +4 -4
  72. package/src/lib/settings.ts +114 -0
  73. package/src/lib/wiki.ts +34 -0
  74. package/src/pages/ProcessDetailPage.svelte +55 -344
  75. package/src/pages/ProcessFlowDiagram.svelte +39 -684
  76. package/src/pages/SettingsPage.svelte +265 -0
  77. package/src/pages/SkillsPage.svelte +26 -12
  78. package/src/pages/WikiPage.svelte +9 -0
  79. package/src/pages/process-detail/ProcessDetailChronicle.svelte +57 -13
  80. package/src/pages/process-detail/ProcessDetailHeader.svelte +9 -3
  81. package/src/pages/process-detail/TicketCreationComposer.svelte +49 -10
  82. package/src/pages/process-detail/inspector/ExecutionDetails.svelte +210 -0
  83. package/src/pages/process-detail/inspector/InspectionEvidence.svelte +48 -0
  84. package/src/pages/process-detail/inspector/InspectionMessage.svelte +71 -0
  85. package/src/pages/process-detail/inspector/ProcessInspector.svelte +144 -0
  86. package/src/pages/process-detail/inspector/ProcessModelEditor.svelte +161 -0
  87. package/src/pages/process-detail/inspector/ProcessReference.svelte +166 -0
  88. package/src/pages/process-detail/inspector/inspection-activity.ts +118 -0
  89. package/src/pages/process-detail/inspector/inspection-data.svelte.ts +107 -0
  90. package/src/pages/process-detail/inspector/inspection-tool-call.ts +30 -0
  91. package/src/pages/process-detail/inspector/inspector-navigation.ts +190 -0
  92. package/src/pages/process-detail/inspector/model-source-label.ts +17 -0
  93. package/src/pages/process-detail/process-detail-actions.svelte.ts +10 -0
  94. package/src/pages/process-detail/process-detail-chronicle-scroll.svelte.ts +18 -2
  95. package/src/pages/process-detail/process-detail-view-model.ts +2 -2
  96. package/src/shell/AppShell.svelte +5 -0
  97. package/src/shell/Sidebar.svelte +10 -0
  98. package/src/test-support/mount.ts +34 -0
  99. package/dist/assets/ApiTokensPage-ClJp9PYr.js +0 -1
  100. package/dist/assets/ChronicleMarkdown-lqwX9Ywa.js +0 -16
  101. package/dist/assets/FutureLaunchDetailPage-ygp-IdXC.js +0 -1
  102. package/dist/assets/GenericLauncher-CExW6wei.css +0 -1
  103. package/dist/assets/GenericLauncher-DOwsERpB.js +0 -1
  104. package/dist/assets/HomePage-D1J-Rmsw.js +0 -1
  105. package/dist/assets/PageHeader-DPuQInDo.css +0 -1
  106. package/dist/assets/PageHeader-sphJnWL1.js +0 -1
  107. package/dist/assets/ProcessActionsMenu-DV9zaxNS.js +0 -1
  108. package/dist/assets/ProcessDetailPage-BW1M2IH8.js +0 -14
  109. package/dist/assets/ProcessDetailPage-Cth6A0DN.css +0 -1
  110. package/dist/assets/ProcessFlowDiagram-Cz8wNicU.css +0 -1
  111. package/dist/assets/ProcessFlowDiagram-Dx2wheGN.js +0 -2
  112. package/dist/assets/ProcessesPage-CSPH5L7E.js +0 -1
  113. package/dist/assets/ScheduleDateTimePicker-DmojMRxN.js +0 -1
  114. package/dist/assets/ScheduleDateTimePicker-uacJAkIq.css +0 -1
  115. package/dist/assets/SkillsPage-KnLql0n1.js +0 -2
  116. package/dist/assets/WatchersPage-B4jf3Ywp.js +0 -1
  117. package/dist/assets/http-client-VpPXJwbR.js +0 -2
  118. package/dist/assets/index-DPCokDbS.js +0 -6
  119. package/dist/assets/index-DtEI5gsQ.css +0 -1
  120. package/dist/assets/mermaid-render.worker-QW2WZpEE.js +0 -6393
  121. package/dist/assets/process-terminal-display-BQRQwGod.js +0 -1
  122. package/dist/assets/router.svelte-EEldxHlO.js +0 -1
  123. package/src/chronicle/components/ChronicleReasoningDetailsOverlay.svelte +0 -855
  124. package/src/components/ProcessInfoOverlay.svelte +0 -1221
  125. package/src/lib/flow-layout.ts +0 -319
  126. package/src/pages/process-detail/OverlayFrame.svelte +0 -58
@@ -1,855 +0,0 @@
1
- <script lang="ts">
2
- import type { ProcessQuestionRequest } from "@leitwerk-dev/domain";
3
- import type { ToolCallRendererDefinition } from "@leitwerk-dev/protocol/tool-renderer-contract";
4
- import { onDestroy, onMount, tick } from "svelte";
5
- import type {
6
- ChronicleReasoningDetailEntry,
7
- ChronicleRunMode,
8
- ChronicleTriggerSource,
9
- } from "../lib/chronicle-projection.js";
10
- import { normalizeChronicleText } from "../lib/formatting.js";
11
- import { buildPromptHighlightSegments } from "../lib/prompt-highlighting.js";
12
- import ChronicleLiveChip from "./ChronicleLiveChip.svelte";
13
- import ChronicleQuestionRequest from "./ChronicleQuestionRequest.svelte";
14
- import ChronicleThinkingText from "./ChronicleThinkingText.svelte";
15
- import ChronicleToolCallItem from "./ChronicleToolCallItem.svelte";
16
- import ChronicleUsageStats from "./ChronicleUsageStats.svelte";
17
-
18
- interface Props {
19
- entry: ChronicleReasoningDetailEntry;
20
- toolRendererIndex: Record<string, ToolCallRendererDefinition>;
21
- questionRequests?: readonly ProcessQuestionRequest[];
22
- hasPrevious: boolean;
23
- hasNext: boolean;
24
- onClose: () => void;
25
- onPrevious: () => void;
26
- onNext: () => void;
27
- }
28
-
29
- let {
30
- entry,
31
- toolRendererIndex,
32
- questionRequests = [],
33
- hasPrevious,
34
- hasNext,
35
- onClose,
36
- onPrevious,
37
- onNext,
38
- }: Props = $props();
39
- let closeButton: HTMLButtonElement | null = $state(null);
40
- let panelElement: HTMLDivElement | null = $state(null);
41
- let shouldFollowLiveTimeline = $state(true);
42
- let copyState = $state<"idle" | "copied" | "failed">("idle");
43
- let copyResetTimer: ReturnType<typeof setTimeout> | null = null;
44
- let copiedEntryId = $state<string | null>(null);
45
-
46
- function isNearPanelBottom(element: HTMLElement, thresholdPx = 32): boolean {
47
- return element.scrollHeight - element.clientHeight - element.scrollTop <= thresholdPx;
48
- }
49
-
50
- function handlePanelScroll() {
51
- if (!panelElement) {
52
- return;
53
- }
54
- shouldFollowLiveTimeline = isNearPanelBottom(panelElement);
55
- }
56
-
57
- async function copyText(value: string): Promise<void> {
58
- if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) {
59
- await navigator.clipboard.writeText(value);
60
- return;
61
- }
62
-
63
- if (typeof document === "undefined") {
64
- throw new Error("Clipboard unavailable");
65
- }
66
-
67
- const textArea = document.createElement("textarea");
68
- textArea.value = value;
69
- textArea.setAttribute("readonly", "true");
70
- textArea.style.position = "fixed";
71
- textArea.style.opacity = "0";
72
- textArea.style.pointerEvents = "none";
73
- document.body.appendChild(textArea);
74
- textArea.select();
75
- const copied = typeof document.execCommand === "function" && document.execCommand("copy");
76
- document.body.removeChild(textArea);
77
- if (!copied) {
78
- throw new Error("Clipboard unavailable");
79
- }
80
- }
81
-
82
- function copyablePiInputText(piInput: ChronicleReasoningDetailEntry["piInput"]): string {
83
- if (!piInput) {
84
- return "";
85
- }
86
- if (piInput.parts.length === 1) {
87
- return piInput.parts[0]?.text ?? "";
88
- }
89
- return piInput.fullPrompt;
90
- }
91
-
92
- function piInputPartLabel(
93
- part: NonNullable<ChronicleReasoningDetailEntry["piInput"]>["parts"][number],
94
- index: number,
95
- total: number,
96
- ): string {
97
- const baseLabel = part.role === "system" ? "Pi system message" : "Pi input message";
98
- return total > 1 ? `${baseLabel} ${index + 1}` : baseLabel;
99
- }
100
-
101
- async function handleCopyPrompt() {
102
- if (!entry.piInput) {
103
- return;
104
- }
105
- try {
106
- await copyText(copyablePiInputText(entry.piInput));
107
- copyState = "copied";
108
- copiedEntryId = entry.turnRecordId;
109
- } catch {
110
- copyState = "failed";
111
- copiedEntryId = entry.turnRecordId;
112
- }
113
- if (copyResetTimer) {
114
- clearTimeout(copyResetTimer);
115
- }
116
- copyResetTimer = setTimeout(() => {
117
- copyState = "idle";
118
- copyResetTimer = null;
119
- copiedEntryId = null;
120
- }, 1800);
121
- }
122
-
123
- function handleWindowKeydown(event: KeyboardEvent) {
124
- if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.altKey) {
125
- return;
126
- }
127
- if (event.key === "Escape") {
128
- event.preventDefault();
129
- onClose();
130
- return;
131
- }
132
- if (event.key === "ArrowLeft" && hasPrevious) {
133
- event.preventDefault();
134
- onPrevious();
135
- return;
136
- }
137
- if (event.key === "ArrowRight" && hasNext) {
138
- event.preventDefault();
139
- onNext();
140
- }
141
- }
142
-
143
- function parseTimestamp(value: string | null): number | null {
144
- if (!value) {
145
- return null;
146
- }
147
- const timestamp = Date.parse(value);
148
- return Number.isFinite(timestamp) ? timestamp : null;
149
- }
150
-
151
- function formatDurationLabel(startedAt: string | null, endedAt: string | null): string {
152
- const start = parseTimestamp(startedAt);
153
- const end = parseTimestamp(endedAt);
154
- if (start === null || end === null || end < start) {
155
- return "Unknown";
156
- }
157
- const totalSeconds = Math.max(0, Math.round((end - start) / 1000));
158
- if (totalSeconds < 1) {
159
- return "<1s";
160
- }
161
- const hours = Math.floor(totalSeconds / 3600);
162
- const minutes = Math.floor((totalSeconds % 3600) / 60);
163
- const seconds = totalSeconds % 60;
164
- const parts: string[] = [];
165
- if (hours > 0) {
166
- parts.push(`${hours}h`);
167
- }
168
- if (minutes > 0) {
169
- parts.push(`${minutes}m`);
170
- }
171
- if (seconds > 0 || parts.length === 0) {
172
- parts.push(`${seconds}s`);
173
- }
174
- return parts.join(" ");
175
- }
176
-
177
- function triggerSourceLabel(value: ChronicleTriggerSource): string {
178
- switch (value) {
179
- case "external_event":
180
- return "External event";
181
- case "user_action":
182
- return "User action";
183
- default:
184
- return "Unknown";
185
- }
186
- }
187
-
188
- function runModeLabel(value: ChronicleRunMode): string {
189
- switch (value) {
190
- case "scheduled":
191
- return "Scheduled";
192
- case "immediate":
193
- return "Run immediately";
194
- default:
195
- return "Unknown";
196
- }
197
- }
198
-
199
- function isQuietFactValue(value: string): boolean {
200
- return value === "Unknown" || value === "None";
201
- }
202
-
203
- function operationalSeverityLabel(severity: string): string {
204
- switch (severity) {
205
- case "success":
206
- return "Recovered";
207
- case "warning":
208
- return "Attention";
209
- case "error":
210
- return "Error";
211
- default:
212
- return "Info";
213
- }
214
- }
215
-
216
- const fullPrompt = $derived(entry.piInput?.fullPrompt ?? "");
217
- const promptParts = $derived.by(() => {
218
- const parts = entry.piInput?.parts ?? [];
219
- if (parts.length > 0) {
220
- return parts;
221
- }
222
- if (entry.piInput && fullPrompt.trim() !== "") {
223
- return [
224
- {
225
- entryId: `${entry.turnRecordId}:pi-input`,
226
- role: "unknown" as const,
227
- text: fullPrompt,
228
- createdAt: entry.piInput.createdAt,
229
- },
230
- ];
231
- }
232
- return [];
233
- });
234
- const hasPrompt = $derived(promptParts.some((part) => part.text.trim() !== ""));
235
- const promptHighlight = $derived.by(() =>
236
- buildPromptHighlightSegments({
237
- fullPrompt,
238
- userInput: entry.piInput?.userInput ?? null,
239
- }),
240
- );
241
- const promptDisplayParts = $derived.by(() =>
242
- promptParts.map((part, index) => ({
243
- part,
244
- label: piInputPartLabel(part, index, promptParts.length),
245
- highlight: buildPromptHighlightSegments({
246
- fullPrompt: part.text,
247
- userInput: entry.piInput?.userInput ?? null,
248
- }),
249
- })),
250
- );
251
- const showPromptMatchNote = $derived(hasPrompt && promptHighlight.matchState === "not_found");
252
- const normalizedReasoning = $derived(normalizeChronicleText(entry.reasoningSection.text));
253
- const liveStatusLabel = $derived(entry.isLive ? (entry.stateLabel ?? "Live") : null);
254
- const copyButtonLabel = $derived(
255
- copyState === "copied" && copiedEntryId === entry.turnRecordId
256
- ? "Copied"
257
- : copyState === "failed" && copiedEntryId === entry.turnRecordId
258
- ? "Copy failed"
259
- : "Copy prompt",
260
- );
261
- const modelLabel = $derived(entry.modelProfileId ?? "Unknown model");
262
- const durationLabel = $derived(formatDurationLabel(entry.facts.startedAt, entry.facts.endedAt));
263
- const triggerLabel = $derived(triggerSourceLabel(entry.facts.triggerSource));
264
- const runLabel = $derived(runModeLabel(entry.facts.runMode));
265
- const activeToolsLabel = $derived(
266
- entry.facts.activeToolNames.length > 0 ? entry.facts.activeToolNames.join(", ") : "None",
267
- );
268
- const unmatchedQuestionRequests = $derived(
269
- questionRequests.filter(
270
- (request) =>
271
- !entry.reasoningSection.items.some(
272
- (item) => item.kind === "tool_call" && item.toolCall.toolCallId === request.toolCallId,
273
- ),
274
- ),
275
- );
276
-
277
- function questionsForTool(toolCallId: string): readonly ProcessQuestionRequest[] {
278
- return questionRequests.filter((request) => request.toolCallId === toolCallId);
279
- }
280
-
281
- $effect(() => {
282
- if (!panelElement || !shouldFollowLiveTimeline) {
283
- return;
284
- }
285
-
286
- entry.reasoningSection.items.length;
287
- normalizedReasoning;
288
-
289
- void tick().then(() => {
290
- if (!panelElement || !shouldFollowLiveTimeline) {
291
- return;
292
- }
293
- panelElement.scrollTop = panelElement.scrollHeight;
294
- });
295
- });
296
-
297
- onMount(() => {
298
- void tick().then(() => closeButton?.focus({ preventScroll: true }));
299
- window.addEventListener("keydown", handleWindowKeydown);
300
- });
301
-
302
- onDestroy(() => {
303
- window.removeEventListener("keydown", handleWindowKeydown);
304
- if (copyResetTimer) {
305
- clearTimeout(copyResetTimer);
306
- }
307
- });
308
- </script>
309
-
310
- <div
311
- bind:this={panelElement}
312
- class="reasoning-details-overlay"
313
- data-section="reasoning-details-overlay"
314
- role="dialog"
315
- aria-modal="false"
316
- aria-labelledby={`reasoning-details-title-${entry.turnRecordId}`}
317
- onscroll={handlePanelScroll}
318
- >
319
- <header class="overlay-header">
320
- <div class="overlay-header-copy">
321
- <h2 id={`reasoning-details-title-${entry.turnRecordId}`}>Reasoning details</h2>
322
- <div class="overlay-title-row">
323
- <p class="overlay-turn-title">{entry.title}</p>
324
- {#if liveStatusLabel}
325
- <ChronicleLiveChip label={liveStatusLabel} size="md" />
326
- {/if}
327
- </div>
328
- </div>
329
-
330
- <div class="overlay-header-actions">
331
- <div class="nav-group" aria-label="Reasoning turn navigation">
332
- <button
333
- type="button"
334
- class="ui-button nav-button" data-size="icon"
335
- data-action="reasoning-overlay-prev"
336
- onclick={onPrevious}
337
- disabled={!hasPrevious}
338
- aria-label="Previous reasoning turn"
339
- >
340
- <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" aria-hidden="true"><path d="m12 4-6 6 6 6" /></svg>
341
- </button>
342
- <button
343
- type="button"
344
- class="ui-button nav-button" data-size="icon"
345
- data-action="reasoning-overlay-next"
346
- onclick={onNext}
347
- disabled={!hasNext}
348
- aria-label="Next reasoning turn"
349
- >
350
- <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.7" aria-hidden="true"><path d="m8 4 6 6-6 6" /></svg>
351
- </button>
352
- </div>
353
- <button
354
- bind:this={closeButton}
355
- type="button"
356
- class="ui-button close-button"
357
- data-action="close-reasoning-overlay"
358
- onclick={() => onClose()}
359
- aria-label="Close reasoning details"
360
- >
361
- Close
362
- </button>
363
- </div>
364
- </header>
365
-
366
- <div class="overlay-body">
367
- <div class="run-summary-line" data-section="reasoning-run-summary">
368
- <span class="model-name">{modelLabel}</span>
369
- {#if entry.usage}
370
- <ChronicleUsageStats usage={entry.usage} size="md" />
371
- {:else}
372
- <span class="summary-muted">Usage unavailable</span>
373
- {/if}
374
- </div>
375
-
376
- <dl class="turn-facts" data-section="reasoning-turn-facts">
377
- <div class="fact-row">
378
- <dt>Duration</dt>
379
- <dd class={["fact-value", isQuietFactValue(durationLabel) && "is-muted"]}>
380
- {durationLabel}
381
- </dd>
382
- </div>
383
- <div class="fact-row">
384
- <dt>Triggered by</dt>
385
- <dd class={["fact-value", isQuietFactValue(triggerLabel) && "is-muted"]}>
386
- {triggerLabel}
387
- </dd>
388
- </div>
389
- <div class="fact-row">
390
- <dt>Run mode</dt>
391
- <dd class={["fact-value", isQuietFactValue(runLabel) && "is-muted"]}>{runLabel}</dd>
392
- </div>
393
- <div class="fact-row">
394
- <dt>Active tools</dt>
395
- <dd class={["fact-value", isQuietFactValue(activeToolsLabel) && "is-muted"]}>
396
- {activeToolsLabel}
397
- </dd>
398
- </div>
399
- </dl>
400
-
401
- <section class="overlay-section prompt-section" data-section="reasoning-overlay-pi-input">
402
- <div class="section-header-row">
403
- <div class="section-heading">
404
- <p class="section-label">Pi input</p>
405
- <p class="section-caption">
406
- Actual input message entries recorded in Pi's session tree. User input is
407
- highlighted when matched.
408
- </p>
409
- </div>
410
- {#if hasPrompt}
411
- <button
412
- type="button"
413
- class="ui-button copy-button"
414
- data-action="copy-pi-input"
415
- onclick={handleCopyPrompt}
416
- >
417
- {copyButtonLabel}
418
- </button>
419
- {/if}
420
- </div>
421
-
422
- {#if hasPrompt}
423
- <div class="prompt-part-list" data-prompt-part-count={promptDisplayParts.length}>
424
- {#each promptDisplayParts as displayPart (displayPart.part.entryId)}
425
- <article
426
- class={["prompt-part", promptDisplayParts.length === 1 && "is-single"]}
427
- data-section="pi-input-message"
428
- >
429
- {#if promptDisplayParts.length > 1}
430
- <div class="prompt-part-header">
431
- <p class="prompt-part-label">{displayPart.label}</p>
432
- <p class="prompt-part-meta">{displayPart.part.createdAt}</p>
433
- </div>
434
- {/if}
435
- <pre class="prompt-copy" data-match-state={displayPart.highlight.matchState}>{#each displayPart.highlight.segments as segment (`${displayPart.part.entryId}-${segment.start}-${segment.end}-${segment.kind}`)}<span
436
- class="prompt-segment"
437
- data-kind={segment.kind}
438
- data-highlight={segment.kind === "user_input" ? "user-input" : undefined}
439
- >{segment.text}</span>{/each}</pre>
440
- </article>
441
- {/each}
442
- </div>
443
- {#if showPromptMatchNote}
444
- <p class="diagnostic-note" data-section="prompt-match-note">
445
- User input could not be matched inside the recorded Pi prompt.
446
- </p>
447
- {/if}
448
- {:else}
449
- <p class="empty-copy">No Pi input was recorded for this turn.</p>
450
- {/if}
451
- </section>
452
-
453
- <section class="overlay-section reasoning-section" data-section="reasoning-overlay-trace">
454
- <div class="section-heading">
455
- <p class="section-label">Reasoning details</p>
456
- <p class="section-caption">Thinking, tool calls, retries, errors, and compactions in execution order.</p>
457
- </div>
458
-
459
- <div class="reasoning-timeline" data-live={entry.isLive ? "true" : "false"}>
460
- {#if entry.reasoningSection.items.length > 0}
461
- {#each entry.reasoningSection.items as item, index (`reasoning-${entry.turnRecordId}-${index}`)}
462
- {#if item.kind === "thinking_chunk"}
463
- <ChronicleThinkingText text={item.text} />
464
- {:else if item.kind === "tool_call"}
465
- <ChronicleToolCallItem toolCall={item.toolCall} {toolRendererIndex} />
466
- {#each questionsForTool(item.toolCall.toolCallId) as request (request.id)}
467
- <div class="trace-question" data-tool-call-id={request.toolCallId}>
468
- <ChronicleQuestionRequest {request} mode="trace" />
469
- </div>
470
- {/each}
471
- {:else}
472
- <div
473
- class="operational-event"
474
- data-section="reasoning-operational-event"
475
- data-event-type={item.event.eventType}
476
- data-severity={item.event.severity}
477
- >
478
- <div class="operational-event-header">
479
- <span class="operational-event-severity">{operationalSeverityLabel(item.event.severity)}</span>
480
- <span class="operational-event-title">{item.event.title}</span>
481
- </div>
482
- <p>{item.event.message}</p>
483
- </div>
484
- {/if}
485
- {/each}
486
- {:else if normalizedReasoning}
487
- <ChronicleThinkingText text={normalizedReasoning} />
488
- {:else if unmatchedQuestionRequests.length === 0}
489
- <p class="empty-copy">No reasoning details were recorded for this turn.</p>
490
- {/if}
491
- {#each unmatchedQuestionRequests as request (request.id)}
492
- <div class="trace-question" data-tool-call-id={request.toolCallId}>
493
- <ChronicleQuestionRequest {request} mode="trace" />
494
- </div>
495
- {/each}
496
- </div>
497
- </section>
498
- </div>
499
- </div>
500
-
501
- <style>
502
- .reasoning-details-overlay {
503
- display: grid;
504
- height: 100%;
505
- min-height: 0;
506
- border-radius: var(--radius-lg);
507
- border: 1px solid color-mix(in srgb, var(--chronicle-border-strong) 72%, white 28%);
508
- background: color-mix(in srgb, var(--chronicle-card-surface) 98%, white 2%);
509
- box-shadow: 0 20px 56px rgba(15, 23, 42, 0.18);
510
- overflow-y: auto;
511
- overscroll-behavior: contain;
512
- scrollbar-gutter: stable;
513
- }
514
-
515
- .overlay-header {
516
- position: sticky;
517
- top: 0;
518
- z-index: 1;
519
- display: flex;
520
- justify-content: space-between;
521
- gap: 18px;
522
- align-items: start;
523
- padding: var(--space-lg);
524
- border-bottom: 1px solid color-mix(in srgb, var(--chronicle-border) 84%, white 16%);
525
- background: color-mix(in srgb, var(--chronicle-card-surface) 92%, white 8%);
526
- }
527
-
528
- .overlay-header-copy {
529
- display: grid;
530
- gap: 8px;
531
- min-width: 0;
532
- }
533
-
534
- .section-label,
535
- .section-caption,
536
- .turn-facts,
537
- .turn-facts dd {
538
- margin: 0;
539
- }
540
-
541
- .section-label {
542
- font-size: var(--type-label);
543
- font-weight: 700;
544
- letter-spacing: var(--tracking-label);
545
- text-transform: uppercase;
546
- color: var(--chronicle-text-muted);
547
- }
548
-
549
- .section-caption {
550
- font-size: var(--type-caption);
551
- line-height: 1.5;
552
- color: var(--chronicle-text-muted);
553
- }
554
-
555
- .overlay-title-row {
556
- display: flex;
557
- flex-wrap: wrap;
558
- align-items: center;
559
- gap: 12px;
560
- }
561
-
562
- .overlay-header-copy h2 { margin: 0; font-size: var(--type-title-md); line-height: 1.2; font-weight: 680; }
563
- .overlay-turn-title { margin: 0; font-size: var(--type-body-sm); line-height: 1.5; color: var(--chronicle-text-muted); }
564
-
565
- .overlay-header-actions,
566
- .nav-group,
567
- .section-header-row {
568
- display: flex;
569
- align-items: center;
570
- gap: 10px;
571
- }
572
-
573
- .overlay-header-actions {
574
- flex-shrink: 0;
575
- }
576
-
577
- .overlay-body {
578
- display: grid;
579
- min-width: 0;
580
- overflow-wrap: anywhere;
581
- gap: 24px;
582
- padding: 18px 28px 30px;
583
- }
584
-
585
- .run-summary-line {
586
- display: flex;
587
- flex-wrap: wrap;
588
- align-items: center;
589
- gap: 10px;
590
- padding-bottom: 14px;
591
- border-bottom: 1px solid color-mix(in srgb, var(--chronicle-border) 70%, transparent 30%);
592
- font-variant-numeric: tabular-nums;
593
- }
594
-
595
- .model-name {
596
- font-size: var(--type-body-sm);
597
- font-weight: 700;
598
- color: var(--chronicle-text);
599
- }
600
-
601
- .summary-muted {
602
- font-size: 12px;
603
- color: var(--chronicle-text-muted);
604
- }
605
-
606
- .turn-facts {
607
- display: grid;
608
- grid-template-columns: repeat(4, minmax(0, 1fr));
609
- gap: 14px 18px;
610
- padding-bottom: 4px;
611
- }
612
-
613
- .fact-row {
614
- display: grid;
615
- align-content: start;
616
- gap: 4px;
617
- min-width: 0;
618
- }
619
-
620
- .fact-row dt {
621
- font-size: 11px;
622
- font-weight: 700;
623
- letter-spacing: 0.04em;
624
- text-transform: uppercase;
625
- color: var(--chronicle-text-muted);
626
- }
627
-
628
- .fact-value {
629
- font-size: var(--type-body-sm);
630
- line-height: 1.4;
631
- font-weight: 620;
632
- color: var(--chronicle-text);
633
- word-break: break-word;
634
- }
635
-
636
- .fact-value.is-muted {
637
- font-weight: 520;
638
- color: var(--chronicle-text-muted);
639
- }
640
-
641
- .overlay-section {
642
- display: grid;
643
- grid-template-columns: minmax(0, 1fr);
644
- min-width: 0;
645
- gap: 12px;
646
- }
647
-
648
- .section-heading {
649
- display: grid;
650
- gap: 4px;
651
- }
652
-
653
- .section-header-row {
654
- justify-content: space-between;
655
- align-items: start;
656
- }
657
-
658
- .prompt-section {
659
- padding-top: 2px;
660
- }
661
-
662
- .prompt-copy,
663
- .empty-copy,
664
- .diagnostic-note {
665
- margin: 0;
666
- font-size: var(--type-body-sm);
667
- line-height: 1.72;
668
- }
669
-
670
- .prompt-part-list {
671
- display: grid;
672
- gap: 12px;
673
- }
674
-
675
- .prompt-part {
676
- display: grid;
677
- gap: 8px;
678
- }
679
-
680
- .prompt-part-header {
681
- display: flex;
682
- flex-wrap: wrap;
683
- align-items: baseline;
684
- justify-content: space-between;
685
- gap: 8px 14px;
686
- }
687
-
688
- .prompt-part-label,
689
- .prompt-part-meta {
690
- margin: 0;
691
- font-size: var(--type-caption);
692
- line-height: 1.4;
693
- }
694
-
695
- .prompt-part-label {
696
- font-weight: 700;
697
- color: var(--chronicle-text);
698
- }
699
-
700
- .prompt-part-meta {
701
- font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
702
- color: var(--chronicle-text-muted);
703
- }
704
-
705
- .prompt-copy {
706
- max-width: 100%;
707
- padding: 16px 18px;
708
- border-radius: 18px;
709
- border: 1px solid color-mix(in srgb, var(--chronicle-border) 84%, white 16%);
710
- background: color-mix(in srgb, var(--chronicle-panel-muted) 74%, white 26%);
711
- white-space: pre-wrap;
712
- overflow-wrap: anywhere;
713
- color: var(--chronicle-text-muted);
714
- font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
715
- font-size: 12px;
716
- }
717
-
718
- .prompt-segment[data-kind="context"] {
719
- color: var(--chronicle-text-muted);
720
- }
721
-
722
- .prompt-segment[data-kind="user_input"] {
723
- border-radius: 6px;
724
- padding: 1px 3px;
725
- background: color-mix(in srgb, var(--chronicle-accent-soft) 72%, white 28%);
726
- box-shadow: 0 0 0 1px color-mix(in srgb, var(--chronicle-accent) 24%, transparent 76%);
727
- color: var(--chronicle-text);
728
- font-weight: 650;
729
- }
730
-
731
- .empty-copy,
732
- .diagnostic-note {
733
- color: var(--chronicle-text-muted);
734
- }
735
-
736
- .diagnostic-note {
737
- font-size: var(--type-caption);
738
- }
739
-
740
- .reasoning-section {
741
- padding-top: 20px;
742
- border-top: 1px solid color-mix(in srgb, var(--chronicle-border) 78%, transparent 22%);
743
- }
744
-
745
- .reasoning-timeline {
746
- display: flex;
747
- flex-direction: column;
748
- gap: 12px;
749
- padding-right: 0;
750
- }
751
-
752
- .reasoning-timeline > :global(*) {
753
- flex: 0 0 auto;
754
- min-width: 0;
755
- }
756
-
757
- .trace-question {
758
- padding: 14px;
759
- border-radius: 14px;
760
- border: 1px solid color-mix(in srgb, var(--chronicle-accent) 22%, var(--chronicle-border) 78%);
761
- background: color-mix(in srgb, var(--chronicle-accent-soft) 18%, white 82%);
762
- }
763
-
764
- .operational-event {
765
- display: grid;
766
- gap: 8px;
767
- padding: 12px 14px;
768
- border-radius: 14px;
769
- border: 1px solid color-mix(in srgb, var(--chronicle-border) 84%, white 16%);
770
- background: color-mix(in srgb, var(--chronicle-panel-muted) 80%, white 20%);
771
- }
772
-
773
- .operational-event[data-severity="error"] {
774
- border-color: var(--chronicle-danger-border);
775
- background: var(--chronicle-danger-surface-soft);
776
- }
777
-
778
- .operational-event[data-severity="warning"] {
779
- border-color: color-mix(in srgb, var(--chronicle-attention) 38%, var(--chronicle-border));
780
- background: color-mix(in srgb, var(--chronicle-attention) 7%, var(--chronicle-card-surface));
781
- }
782
-
783
- .operational-event[data-severity="success"] {
784
- border-color: color-mix(in srgb, var(--chronicle-success) 38%, var(--chronicle-border));
785
- background: var(--chronicle-success-surface);
786
- }
787
-
788
- .operational-event-header {
789
- display: flex;
790
- align-items: center;
791
- gap: 8px;
792
- flex-wrap: wrap;
793
- }
794
-
795
- .operational-event-severity {
796
- padding: 3px 7px;
797
- border-radius: 999px;
798
- background: color-mix(in srgb, var(--chronicle-card-surface) 86%, white 14%);
799
- color: var(--chronicle-text-muted);
800
- font-size: var(--type-caption);
801
- font-weight: 800;
802
- letter-spacing: var(--tracking-label);
803
- text-transform: uppercase;
804
- }
805
-
806
- .operational-event-title {
807
- font-weight: 800;
808
- color: var(--chronicle-text-strong);
809
- }
810
-
811
- .operational-event p {
812
- margin: 0;
813
- white-space: pre-wrap;
814
- overflow-wrap: anywhere;
815
- color: var(--chronicle-text);
816
- font-size: var(--type-body-sm);
817
- line-height: 1.55;
818
- }
819
-
820
- @media (max-width: 980px) {
821
- .turn-facts {
822
- grid-template-columns: repeat(2, minmax(0, 1fr));
823
- }
824
- }
825
-
826
- @media (max-width: 900px) {
827
- .overlay-header,
828
- .overlay-body {
829
- padding-left: 18px;
830
- padding-right: 18px;
831
- }
832
- }
833
-
834
- @media (max-width: 720px) {
835
- .overlay-header,
836
- .section-header-row {
837
- flex-direction: column;
838
- align-items: stretch;
839
- }
840
-
841
- .overlay-header-actions {
842
- width: 100%;
843
- justify-content: space-between;
844
- }
845
-
846
- .turn-facts {
847
- grid-template-columns: minmax(0, 1fr);
848
- }
849
-
850
- .copy-button {
851
- width: 100%;
852
- }
853
- }
854
-
855
- </style>