@leitwerk-dev/ui 0.1.9 → 0.2.1

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 (170) hide show
  1. package/dist/assets/ApiTokensPage-B15IzsLp.css +1 -0
  2. package/dist/assets/ApiTokensPage-ClJp9PYr.js +1 -0
  3. package/dist/assets/ChronicleMarkdown-lqwX9Ywa.js +16 -0
  4. package/dist/assets/ChronicleMarkdown-wsUF8Z75.css +1 -0
  5. package/dist/assets/FutureLaunchDetailPage-BOoZaG11.css +1 -0
  6. package/dist/assets/FutureLaunchDetailPage-CB7mNpYv.js +1 -0
  7. package/dist/assets/GenericLauncher-CExW6wei.css +1 -0
  8. package/dist/assets/GenericLauncher-DTyRwWVd.js +1 -0
  9. package/dist/assets/HomePage-D_OT6OWU.js +1 -0
  10. package/dist/assets/PageHeader-DPuQInDo.css +1 -0
  11. package/dist/assets/PageHeader-sphJnWL1.js +1 -0
  12. package/dist/assets/ProcessActionsMenu-IKG-csM4.js +1 -0
  13. package/dist/assets/ProcessActionsMenu-VKT7PE6z.css +1 -0
  14. package/dist/assets/ProcessDetailPage-CiI5T6pN.js +14 -0
  15. package/dist/assets/ProcessDetailPage-Cth6A0DN.css +1 -0
  16. package/dist/assets/ProcessFlowDiagram-Dx2wheGN.js +2 -0
  17. package/dist/assets/ProcessesPage-CdnLkrSk.js +1 -0
  18. package/dist/assets/ProcessesPage-yPjjrzjg.css +1 -0
  19. package/dist/assets/ScheduleDateTimePicker-DmojMRxN.js +1 -0
  20. package/dist/assets/{ScheduleDateTimePicker-CadXN9z7.css → ScheduleDateTimePicker-uacJAkIq.css} +1 -1
  21. package/dist/assets/SkillsPage-CJrtt8xU.css +1 -0
  22. package/dist/assets/SkillsPage-CmiSWLOW.js +2 -0
  23. package/dist/assets/WatchersPage-Bu1vfZQI.js +1 -0
  24. package/dist/assets/WatchersPage-cRBnmTAD.css +1 -0
  25. package/dist/assets/external-links-CX92-VRP.js +1 -0
  26. package/dist/assets/http-client-VpPXJwbR.js +2 -0
  27. package/dist/assets/index-BkfAI7to.js +6 -0
  28. package/dist/assets/index-DtEI5gsQ.css +1 -0
  29. package/dist/assets/index-client-BYQviCtQ.js +2 -0
  30. package/dist/assets/{mermaid-render.worker-DAVgiVRG.js → mermaid-render.worker-QW2WZpEE.js} +12 -12
  31. package/dist/assets/process-terminal-display-BQRQwGod.js +1 -0
  32. package/dist/assets/router.svelte-EEldxHlO.js +1 -0
  33. package/dist/index.html +8 -8
  34. package/package.json +8 -8
  35. package/src/App.svelte +36 -0
  36. package/src/chronicle/components/ChronicleActionSection.svelte +70 -143
  37. package/src/chronicle/components/ChronicleCreateIssueButton.svelte +22 -0
  38. package/src/chronicle/components/ChronicleEntryHeader.svelte +76 -0
  39. package/src/chronicle/components/ChronicleExpandButton.svelte +11 -34
  40. package/src/chronicle/components/ChronicleFailureMessage.svelte +41 -0
  41. package/src/chronicle/components/ChronicleFlow.svelte +133 -28
  42. package/src/chronicle/components/ChronicleLeafOutcomeRendererHost.svelte +1 -8
  43. package/src/chronicle/components/ChronicleLeafOutcomeSection.svelte +25 -52
  44. package/src/chronicle/components/ChronicleLiveChip.svelte +1 -35
  45. package/src/chronicle/components/ChronicleLiveTail.svelte +55 -154
  46. package/src/chronicle/components/ChronicleMarkdown.svelte +6 -6
  47. package/src/chronicle/components/ChronicleOperatorInputSection.svelte +5 -18
  48. package/src/chronicle/components/ChronicleProcessErrorSection.svelte +10 -107
  49. package/src/chronicle/components/ChroniclePromptSection.svelte +6 -26
  50. package/src/chronicle/components/ChronicleQuestionRequest.svelte +22 -5
  51. package/src/chronicle/components/ChronicleReasoningDetailsOverlay.svelte +71 -109
  52. package/src/chronicle/components/ChronicleRecoverySection.svelte +96 -264
  53. package/src/chronicle/components/ChronicleScheduledActionSection.svelte +1 -1
  54. package/src/chronicle/components/ChronicleSectionHeader.svelte +1 -4
  55. package/src/chronicle/components/ChronicleStartupHistory.svelte +63 -0
  56. package/src/chronicle/components/ChronicleStartupRecoverySection.svelte +10 -26
  57. package/src/chronicle/components/ChronicleThinkingSection.svelte +25 -165
  58. package/src/chronicle/components/ChronicleThinkingText.svelte +1 -0
  59. package/src/chronicle/components/ChronicleToolApproval.svelte +40 -0
  60. package/src/chronicle/components/ChronicleToolCallItem.svelte +1 -1
  61. package/src/chronicle/components/ChronicleTurnCluster.svelte +208 -284
  62. package/src/chronicle/components/ChronicleTurnDetailsButton.svelte +16 -0
  63. package/src/chronicle/components/ChronicleTurnProgress.svelte +77 -54
  64. package/src/chronicle/components/ChronicleTurnRail.svelte +327 -391
  65. package/src/chronicle/components/CompactActionComposer.svelte +36 -13
  66. package/src/chronicle/components/ReadonlyJsonValue.svelte +30 -0
  67. package/src/chronicle/lib/action-bindings.ts +1 -1
  68. package/src/chronicle/lib/action-model-display.ts +2 -2
  69. package/src/chronicle/lib/action-preview.ts +1 -1
  70. package/src/chronicle/lib/chronicle-projection.ts +125 -109
  71. package/src/chronicle/lib/chronicle-rail-groups.ts +158 -0
  72. package/src/chronicle/lib/chronicle-selectable-items.ts +16 -11
  73. package/src/chronicle/lib/chronicle-ticket-artifact.ts +7 -0
  74. package/src/chronicle/lib/formatting.ts +19 -0
  75. package/src/chronicle/lib/leaf-outcome-loader.ts +30 -111
  76. package/src/chronicle/lib/leaf-outcome-runtime.ts +3 -15
  77. package/src/chronicle/lib/result-presentation.ts +40 -0
  78. package/src/chronicle/lib/retry-groups.ts +24 -0
  79. package/src/chronicle/lib/scroll-sync.ts +1 -0
  80. package/src/chronicle/lib/tool-call-summary.ts +1 -9
  81. package/src/chronicle/ticket-selection.ts +23 -0
  82. package/src/components/ElapsedTime.svelte +31 -0
  83. package/src/components/ExternalLink.svelte +39 -0
  84. package/src/components/FormFieldRenderer.svelte +4 -1
  85. package/src/components/GenericLauncher.svelte +40 -15
  86. package/src/components/KeyboardShortcutsModal.svelte +2 -2
  87. package/src/components/LaunchChecklist.svelte +184 -0
  88. package/src/components/ModalShell.svelte +43 -32
  89. package/src/components/PageHeader.svelte +7 -33
  90. package/src/components/ProcessActionsMenu.svelte +217 -140
  91. package/src/components/ProcessInfoOverlay.svelte +13 -21
  92. package/src/components/ProgressChecklist.svelte +46 -0
  93. package/src/components/ProgressChecklistRows.svelte +80 -0
  94. package/src/components/launcher-form-copy.ts +4 -1
  95. package/src/components/launcher-model-config.ts +1 -1
  96. package/src/extension-ui-dev-server.ts +2 -5
  97. package/src/lib/api-tokens.ts +34 -0
  98. package/src/lib/api.ts +323 -455
  99. package/src/lib/elapsed-time.ts +19 -0
  100. package/src/lib/external-links.ts +81 -0
  101. package/src/lib/flow-layout.ts +1 -8
  102. package/src/lib/format.ts +3 -26
  103. package/src/lib/future-launch-detail.ts +1 -1
  104. package/src/lib/http-client.ts +79 -0
  105. package/src/lib/launch-updates.ts +17 -0
  106. package/src/lib/markdown.ts +8 -1
  107. package/src/lib/primary-path-detail.ts +97 -3
  108. package/src/lib/primary-path-replay.ts +13 -7
  109. package/src/lib/process-row-view.ts +1 -1
  110. package/src/lib/process-terminal-display.ts +4 -7
  111. package/src/lib/processes.svelte.ts +41 -9
  112. package/src/lib/reasoning-history.ts +95 -0
  113. package/src/lib/retry-config.svelte.ts +1 -1
  114. package/src/lib/rich-markdown-elements.ts +2 -2
  115. package/src/lib/router-logic.ts +3 -0
  116. package/src/lib/runtime-config.ts +1 -3
  117. package/src/lib/test-fixtures.ts +1 -1
  118. package/src/lib/tool-call-rendering.ts +4 -1
  119. package/src/lib/ui-extensions.svelte.ts +78 -127
  120. package/src/lib/ws-classifier.ts +8 -1
  121. package/src/pages/ApiTokensPage.svelte +213 -0
  122. package/src/pages/FutureLaunchDetailPage.svelte +7 -35
  123. package/src/pages/HomePage.svelte +7 -7
  124. package/src/pages/ProcessCard.svelte +1 -1
  125. package/src/pages/ProcessDetailPage.svelte +158 -62
  126. package/src/pages/ProcessGallery.svelte +1 -1
  127. package/src/pages/ProcessesPage.svelte +7 -42
  128. package/src/pages/SkillsPage.svelte +37 -26
  129. package/src/pages/WatchersPage.svelte +31 -53
  130. package/src/pages/process-detail/ProcessDetailChronicle.svelte +125 -28
  131. package/src/pages/process-detail/ProcessDetailHeader.svelte +24 -2
  132. package/src/pages/process-detail/ProcessSummary.svelte +35 -0
  133. package/src/pages/process-detail/TicketCreationComposer.svelte +219 -0
  134. package/src/pages/process-detail/process-detail-action-drafts.svelte.ts +5 -5
  135. package/src/pages/process-detail/process-detail-actions.svelte.ts +4 -2
  136. package/src/pages/process-detail/process-detail-chronicle-dom.ts +39 -14
  137. package/src/pages/process-detail/process-detail-chronicle-scroll.svelte.ts +68 -10
  138. package/src/pages/process-detail/process-detail-view-model.ts +10 -24
  139. package/src/shell/AppShell.svelte +4 -1
  140. package/src/shell/Sidebar.svelte +88 -125
  141. package/src/styles/controls.css +188 -0
  142. package/dist/assets/ChronicleMarkdown-B1hD4HFS.js +0 -16
  143. package/dist/assets/ChronicleMarkdown-D6hFzERy.css +0 -1
  144. package/dist/assets/FutureLaunchDetailPage-Dy3FlLih.js +0 -1
  145. package/dist/assets/FutureLaunchDetailPage-UFgp7Ju4.css +0 -1
  146. package/dist/assets/GenericLauncher-BPEQjJ1J.js +0 -1
  147. package/dist/assets/GenericLauncher-D_GMtsQ5.css +0 -1
  148. package/dist/assets/HomePage-E41Krxko.js +0 -1
  149. package/dist/assets/PageHeader-DDgWPeHS.js +0 -1
  150. package/dist/assets/PageHeader-vhyfX7xT.css +0 -1
  151. package/dist/assets/ProcessActionsMenu-BWlFe5c4.css +0 -1
  152. package/dist/assets/ProcessActionsMenu-cI0j2LWe.js +0 -1
  153. package/dist/assets/ProcessDetailPage-DVHldJgi.js +0 -12
  154. package/dist/assets/ProcessDetailPage-Oh6ld320.css +0 -1
  155. package/dist/assets/ProcessFlowDiagram-C6m6V_cB.js +0 -2
  156. package/dist/assets/ProcessesPage-B2QGyCZO.js +0 -1
  157. package/dist/assets/ProcessesPage-BcM38HMs.css +0 -1
  158. package/dist/assets/ScheduleDateTimePicker-aey_oMiH.js +0 -1
  159. package/dist/assets/SkillsPage-MPITMvhn.css +0 -1
  160. package/dist/assets/SkillsPage-iB4sbq7r.js +0 -2
  161. package/dist/assets/WatchersPage-BOSgjtw0.css +0 -1
  162. package/dist/assets/WatchersPage-l0rwv-Nx.js +0 -1
  163. package/dist/assets/api-CtKbU0lT.js +0 -1
  164. package/dist/assets/dist-eOPUi0B8.js +0 -2
  165. package/dist/assets/index-B4flHG_s.js +0 -7
  166. package/dist/assets/index-DunTIQSW.css +0 -1
  167. package/dist/assets/index-client-CnG8mWmF.js +0 -2
  168. package/dist/assets/retry-config.svelte-WukHimiy.js +0 -1
  169. package/dist/assets/router.svelte-2RvxUvs5.js +0 -1
  170. package/src/lib/process-initial-prompt.ts +0 -7
@@ -1,45 +1,95 @@
1
1
  <script lang="ts">
2
- import { formatRelativeTime } from "../../lib/format";
2
+ import type { ProcessQuestionRequest } from "@leitwerk-dev/domain";
3
+ import type { Snippet } from "svelte";
4
+ import { formatTurnId } from "../../lib/format.js";
3
5
  import { markdownToPlainText, truncateText } from "../../lib/markdown.js";
4
- import type {
5
- ChronicleTurnClusterItem,
6
- ChronicleTurnClusterSection,
7
- } from "../lib/chronicle-projection.js";
6
+ import type { ChronicleTurnClusterItem } from "../lib/chronicle-projection.js";
7
+ import type { ChronicleTicketArtifact } from "../lib/chronicle-ticket-artifact.js";
8
+ import { formatChronicleCost, formatChronicleDuration } from "../lib/formatting.js";
9
+ import { presentTurnResult } from "../lib/result-presentation.js";
10
+ import ChronicleCreateIssueButton from "./ChronicleCreateIssueButton.svelte";
11
+ import ChronicleEntryHeader from "./ChronicleEntryHeader.svelte";
8
12
  import ChronicleExpandButton from "./ChronicleExpandButton.svelte";
13
+ import ChronicleFailureMessage from "./ChronicleFailureMessage.svelte";
9
14
  import ChronicleMarkdown from "./ChronicleMarkdown.svelte";
10
- import ChronicleSectionHeader from "./ChronicleSectionHeader.svelte";
11
15
  import ChronicleThinkingSection from "./ChronicleThinkingSection.svelte";
16
+ import ChronicleTurnDetailsButton from "./ChronicleTurnDetailsButton.svelte";
12
17
  import ChronicleTurnProgress from "./ChronicleTurnProgress.svelte";
13
- import ChronicleUsageStats from "./ChronicleUsageStats.svelte";
14
18
 
15
19
  interface Props {
16
20
  cluster: ChronicleTurnClusterItem;
17
21
  isFocused: boolean;
18
22
  compressHistory?: boolean;
23
+ questionRequests?: readonly ProcessQuestionRequest[];
19
24
  onOpenReasoningDetails: (turnRecordId: string) => void;
25
+ onDraftTicket?: (artifact: ChronicleTicketArtifact) => void;
26
+ recoveryContent?: Snippet;
27
+ waitingContent?: Snippet;
20
28
  }
21
29
 
22
- let { cluster, isFocused, compressHistory = false, onOpenReasoningDetails }: Props = $props();
23
- let expandedHistoryResult = $state(false);
24
-
25
- const shouldCompressResult = $derived(compressHistory && !expandedHistoryResult);
26
- const clusterMeta = $derived(
27
- cluster.pathLabel
28
- ? `${formatRelativeTime(cluster.createdAt)} · ${cluster.pathLabel}`
29
- : formatRelativeTime(cluster.createdAt),
30
+ let {
31
+ cluster,
32
+ isFocused,
33
+ compressHistory = false,
34
+ questionRequests = [],
35
+ onOpenReasoningDetails,
36
+ onDraftTicket,
37
+ recoveryContent,
38
+ waitingContent,
39
+ }: Props = $props();
40
+ let resultExpanded = $state<boolean | null>(null);
41
+ let failureExpanded = $state(true);
42
+ const isFailed = $derived(Boolean(cluster.failure || recoveryContent));
43
+ const isLlm = $derived(cluster.turnPresentation === "llm_turn");
44
+ const result = $derived(cluster.sections.find((section) => section.kind === "turn_result"));
45
+ const reasoning = $derived(cluster.sections.find((section) => section.kind === "thinking_preview"));
46
+ const hasReasoning = $derived(
47
+ Boolean(
48
+ reasoning &&
49
+ (reasoning.text.trim() ||
50
+ reasoning.preview.trim() ||
51
+ reasoning.toolCallCount ||
52
+ reasoning.traceItemCount),
53
+ ),
54
+ );
55
+ const progress = $derived(cluster.sections.find((section) => section.kind === "turn_progress"));
56
+ const prompt = $derived(isLlm ? cluster.piInput?.fullPrompt.trim() : null);
57
+ const compactResult = $derived(
58
+ Boolean(
59
+ result &&
60
+ compressHistory &&
61
+ !prompt &&
62
+ result.markdown.length <= 240 &&
63
+ !/[\n]|^\s*(?:#|[-*>]|\d+\.)/.test(result.markdown),
64
+ ),
65
+ );
66
+ const expanded = $derived(resultExpanded ?? !compressHistory);
67
+ const presentation = $derived(
68
+ result ? presentTurnResult(result.markdown, result.resultSummary) : null,
69
+ );
70
+ const resultHeadings = $derived(
71
+ presentation?.headings.filter((heading) => heading !== cluster.title) ?? [],
72
+ );
73
+ const metadata = $derived(
74
+ [
75
+ cluster.modelProfileId,
76
+ cluster.usage?.cost ? formatChronicleCost(cluster.usage.cost.total) : null,
77
+ ]
78
+ .filter(Boolean)
79
+ .join(" · "),
80
+ );
81
+ const kind = $derived(
82
+ isLlm
83
+ ? "llm"
84
+ : cluster.turnPresentation === "operator_decision"
85
+ ? "operator"
86
+ : cluster.turnPresentation === "external_trigger"
87
+ ? "external"
88
+ : "system",
30
89
  );
31
90
 
32
- function hasSections(sections: readonly ChronicleTurnClusterSection[]): boolean {
33
- return sections.length > 0;
34
- }
35
-
36
- function summarizeTurnResult(markdown: string): string {
37
- const plainText = markdownToPlainText(markdown);
38
- return plainText ? truncateText(plainText, 190) : "Result recorded.";
39
- }
40
-
41
- function expandHistoryResult() {
42
- expandedHistoryResult = true;
91
+ function openDetails() {
92
+ onOpenReasoningDetails(cluster.turnRecordId);
43
93
  }
44
94
  </script>
45
95
 
@@ -47,6 +97,8 @@ function expandHistoryResult() {
47
97
  id={cluster.anchorId}
48
98
  class="turn-cluster"
49
99
  class:is-focused={isFocused}
100
+ class:is-compact={!isLlm || compactResult}
101
+ class:is-failed={isFailed}
50
102
  data-anchor-id={cluster.anchorId}
51
103
  data-focused={isFocused ? "true" : "false"}
52
104
  data-section="chronicle-turn"
@@ -54,275 +106,147 @@ function expandHistoryResult() {
54
106
  data-turn-record-id={cluster.turnRecordId}
55
107
  data-turn-kind={cluster.turnPresentation}
56
108
  >
57
- <div class="cluster-header">
58
- <div class="cluster-heading-copy">
59
- <ChronicleSectionHeader
60
- label={cluster.turnKindLabel}
61
- secondary={cluster.modelProfileId}
62
- meta={clusterMeta}
63
- />
64
- <div class="cluster-heading-row">
65
- <h3>{cluster.title}</h3>
109
+ <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
+ {#snippet controls()}
111
+ {#if isFailed}
112
+ <button class="failure-toggle" type="button" data-action="toggle-failed-turn" aria-label={failureExpanded ? "Collapse failed turn" : "Expand failed turn"} aria-expanded={failureExpanded} aria-controls={`turn-body-${cluster.turnRecordId}`} onclick={() => failureExpanded = !failureExpanded}>
113
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d={failureExpanded ? "m6 15 6-6 6 6" : "m6 9 6 6 6-6"} /></svg>
114
+ </button>
115
+ {/if}
116
+ {/snippet}
117
+ </ChronicleEntryHeader>
118
+
119
+ {#if isFailed && !failureExpanded}<p class="collapsed-failure">Failed</p>{/if}
120
+ <div class="turn-body" id={`turn-body-${cluster.turnRecordId}`} hidden={isFailed && !failureExpanded}>
121
+ {#each cluster.resources ?? [] as link (link.id)}<a class="reviewed-result" href={link.url} target="_blank" rel="noreferrer">{link.label}</a>{/each}
122
+ {#if cluster.reviewedTurnRecordId}<a class="reviewed-result" href={`#chronicle-turn-${cluster.reviewedTurnRecordId}`}>Reviewed result</a>{/if}
123
+ {#if cluster.transition}<p>{cluster.transition.accepted ? "Started" : "Selected"} {formatTurnId(cluster.transition.selectedTurnId)}</p>{/if}
124
+
125
+ {#each cluster.sections as section, index (`${cluster.turnRecordId}-${index}`)}
126
+ {#if !isFailed && section.kind === "operator_decision" && section.text && section.text.trim() !== cluster.title.trim()}
127
+ <div class="decision-section" data-section="operator-decision">
128
+ <dl class="decision-fields">
129
+ {#each section.text.split('\n\n') as block, blockIndex (`${blockIndex}-${block}`)}
130
+ {@const parts = block.split(':\n')}
131
+ <div class="decision-field">
132
+ {#if parts.length === 2}<dt>{parts[0]}</dt><dd>{parts[1]}</dd>{:else}<dd>{block}</dd>{/if}
133
+ </div>
134
+ {/each}
135
+ </dl>
66
136
  </div>
67
- {#if cluster.usage}
68
- <div class="cluster-meta-row">
69
- <ChronicleUsageStats usage={cluster.usage} size="sm" showCacheIcons={false} />
137
+ {/if}
138
+ {/each}
139
+
140
+ {#if progress && !isLlm}<ChronicleTurnProgress report={progress.report} attemptStatus={progress.attemptStatus} recordedAt={progress.recordedAt} />{/if}
141
+
142
+ {#if result}
143
+ <section class="result-section" class:is-compact={compactResult} class:is-compressed={!expanded && !compactResult} data-section="turn-result" data-ticket-result-artifact={`turn_result:${cluster.turnRecordId}`} data-ticket-result-durable="true" data-compressed={!expanded && !compactResult ? "true" : undefined}>
144
+ {#if !compactResult}
145
+ <div class="result-header-row">
146
+ <h4>Result</h4>
147
+ <div class="result-actions">
148
+ {#if onDraftTicket}<ChronicleCreateIssueButton {onDraftTicket} artifact={{ kind: "turn_result", turnRecordId: cluster.turnRecordId }} />{/if}
149
+ <ChronicleExpandButton expanded={expanded} controls={`result-${cluster.turnRecordId}`} expandedLabel="Show summary" collapsedLabel="Read full result" onClick={() => resultExpanded = !expanded} />
150
+ </div>
70
151
  </div>
71
152
  {/if}
72
- </div>
73
- </div>
74
-
75
- {#if hasSections(cluster.sections)}
76
- <div class="cluster-body">
77
- {#each cluster.sections as section, index (`${cluster.turnRecordId}-${index}`)}
78
- {#if section.kind === "thinking_preview"}
79
- <ChronicleThinkingSection
80
- text={section.text}
81
- preview={section.preview}
82
- previewTruncated={section.previewTruncated}
83
- toolCallCount={section.toolCallCount}
84
- traceItemCount={section.traceItemCount}
85
- onOpenDetails={() => onOpenReasoningDetails(cluster.turnRecordId)}
86
- />
87
- {:else if section.kind === "operator_decision"}
88
- {#if section.text && section.text.trim() !== cluster.title.trim()}
89
- <section class="content-section decision-section" data-section="operator-decision">
90
- <dl class="decision-fields">
91
- {#each section.text.split('\n\n') as block, blockIndex (`${cluster.turnRecordId}-decision-${blockIndex}-${block}`)}
92
- {@const parts = block.split(':\n')}
93
- {#if parts.length === 2}
94
- <div class="decision-field">
95
- <dt>{parts[0]}</dt>
96
- <dd>{parts[1]}</dd>
97
- </div>
98
- {:else}
99
- <div class="decision-field">
100
- <dd>{block}</dd>
101
- </div>
102
- {/if}
103
- {/each}
104
- </dl>
105
- </section>
106
- {/if}
107
- {:else if section.kind === "turn_progress"}
108
- <ChronicleTurnProgress report={section.report} />
109
- {:else if section.kind === "turn_result"}
110
- <section
111
- class="content-section result-section"
112
- class:is-compressed={shouldCompressResult}
113
- data-section="turn-result"
114
- data-compressed={shouldCompressResult ? "true" : undefined}
115
- >
116
- <div class="result-header-row">
117
- <p class="section-label">Result</p>
118
- {#if shouldCompressResult}
119
- <ChronicleExpandButton
120
- expanded={false}
121
- collapsedLabel="Expand result"
122
- class="expand-result-button"
123
- dataPressable={true}
124
- onClick={expandHistoryResult}
125
- />
126
- {/if}
127
- </div>
128
- {#if shouldCompressResult}
129
- <p class="result-summary">{summarizeTurnResult(section.markdown)}</p>
130
- {:else}
131
- <ChronicleMarkdown markdown={section.markdown} className="turn-result-markdown" />
132
- {/if}
133
- </section>
153
+ <div id={`result-${cluster.turnRecordId}`}>
154
+ {#if expanded || compactResult}
155
+ {#if presentation?.separateSummary}<p class="result-summary">{presentation.separateSummary}</p>{/if}
156
+ <ChronicleMarkdown markdown={result.markdown} className="turn-result-markdown" />
157
+ {:else}
158
+ <p class="result-summary">{presentation?.preview}</p>
159
+ {#if resultHeadings.length}
160
+ <div class="result-outline"><span>In this result</span><ul>{#each resultHeadings as heading (heading)}<li>{heading}</li>{/each}</ul></div>
134
161
  {/if}
135
- {/each}
136
- </div>
162
+ {/if}
163
+ </div>
164
+ </section>
137
165
  {/if}
138
- </section>
139
-
140
- <style>
141
- .turn-cluster {
142
- display: flex;
143
- flex-direction: column;
144
- gap: var(--space-md);
145
- padding: var(--space-lg) 0 var(--space-xl);
146
- border-top: 1px solid color-mix(in srgb, var(--chronicle-border) 84%, white 16%);
147
- scroll-margin-top: var(--space-xl);
148
- }
149
-
150
- .turn-cluster.is-focused {
151
- border-top-color: color-mix(
152
- in srgb,
153
- var(--chronicle-accent) 24%,
154
- var(--chronicle-border) 76%
155
- );
156
- }
157
-
158
- .turn-cluster[data-turn-kind="operator_decision"],
159
- .turn-cluster[data-turn-kind="external_trigger"] {
160
- padding: var(--space-lg) 0 var(--space-xl);
161
- margin-inline-start: var(--chronicle-secondary-indent, clamp(var(--space-lg), 4vw, var(--space-2xl)));
162
- border-top: 1px solid color-mix(in srgb, var(--chronicle-accent) 34%, var(--chronicle-border) 66%);
163
- border-bottom: 1px solid color-mix(in srgb, var(--chronicle-accent) 12%, transparent 88%);
164
- background: transparent;
165
- }
166
-
167
- .turn-cluster[data-turn-kind="external_trigger"] {
168
- border-top-color: color-mix(in srgb, var(--chronicle-attention) 38%, var(--chronicle-border) 62%);
169
- border-bottom-color: color-mix(in srgb, var(--chronicle-attention) 14%, transparent 86%);
170
- }
171
-
172
- .turn-cluster[data-turn-kind="operator_decision"].is-focused,
173
- .turn-cluster[data-turn-kind="external_trigger"].is-focused {
174
- border-top-color: color-mix(in srgb, var(--chronicle-accent) 52%, var(--chronicle-border) 48%);
175
- }
176
-
177
- .cluster-header {
178
- display: block;
179
- }
180
-
181
- .cluster-heading-copy {
182
- display: flex;
183
- flex-direction: column;
184
- gap: var(--space-2xs);
185
- min-width: 0;
186
- }
187
-
188
- .section-label {
189
- margin: 0;
190
- font-size: var(--type-label);
191
- font-weight: 700;
192
- letter-spacing: var(--tracking-label);
193
- text-transform: uppercase;
194
- color: var(--chronicle-accent);
195
- }
196
-
197
- .cluster-heading-row {
198
- display: flex;
199
- align-items: center;
200
- gap: var(--space-xs);
201
- }
202
-
203
- .section-label {
204
- color: var(--chronicle-text-muted);
205
- }
206
-
207
- .cluster-header h3 {
208
- margin: 0;
209
- font-family: var(--font-display);
210
- font-size: var(--type-title-md);
211
- line-height: 1.18;
212
- letter-spacing: -0.01em;
213
- font-weight: 650;
214
- color: var(--chronicle-text);
215
- }
216
-
217
- .cluster-meta-row {
218
- display: flex;
219
- align-items: center;
220
- gap: var(--space-xs);
221
- flex-wrap: wrap;
222
- }
223
-
224
- .cluster-body {
225
- display: flex;
226
- flex-direction: column;
227
- gap: var(--space-sm);
228
- }
229
-
230
- .content-section {
231
- display: flex;
232
- flex-direction: column;
233
- gap: var(--space-xs);
234
- }
235
-
236
- .decision-section {
237
- padding: var(--space-sm) 0 0;
238
- border-top: 1px solid color-mix(in srgb, var(--chronicle-accent) 18%, var(--chronicle-border) 82%);
239
- background: transparent;
240
- }
241
-
242
- .turn-cluster[data-turn-kind="operator_decision"] .decision-section,
243
- .turn-cluster[data-turn-kind="external_trigger"] .decision-section {
244
- padding: 0;
245
- border: 0;
246
- background: transparent;
247
- }
248
-
249
- .decision-fields {
250
- margin: 0;
251
- display: grid;
252
- gap: var(--space-xs);
253
- }
254
-
255
- .decision-field {
256
- display: grid;
257
- gap: var(--space-2xs);
258
- }
259
-
260
- .decision-fields dt {
261
- margin: 0;
262
- font-size: var(--type-caption);
263
- font-weight: 600;
264
- color: var(--chronicle-text-muted);
265
- }
266
-
267
- .decision-fields dd {
268
- margin: 0;
269
- max-width: 66ch;
270
- font-size: var(--type-body);
271
- line-height: 1.6;
272
- white-space: pre-wrap;
273
- color: var(--chronicle-text);
274
- }
275
-
276
- .result-section {
277
- position: relative;
278
- gap: var(--space-sm);
279
- padding: var(--space-md) 0 0;
280
- border-top: 1px solid color-mix(in srgb, var(--chronicle-accent) 14%, var(--chronicle-border) 86%);
281
- background: transparent;
282
- }
283
-
284
- .result-section.is-compressed {
285
- gap: var(--space-xs);
286
- padding-top: var(--space-sm);
287
- border-top-color: color-mix(in srgb, var(--chronicle-border) 88%, white 12%);
288
- }
289
166
 
290
- .result-header-row {
291
- display: flex;
292
- align-items: center;
293
- justify-content: space-between;
294
- gap: var(--space-sm);
295
- }
167
+ {#if recoveryContent}
168
+ {@render recoveryContent()}
169
+ {:else if cluster.failure}
170
+ <ChronicleFailureMessage summary={cluster.failure.summary} />
171
+ {/if}
296
172
 
297
- .result-section .section-label {
298
- color: color-mix(in srgb, var(--chronicle-text-muted) 88%, var(--chronicle-text) 12%);
299
- }
173
+ {#if questionRequests.length}
174
+ <ChronicleThinkingSection text="" preview="" traceItemCount={0} {questionRequests} />
175
+ {/if}
300
176
 
301
- .turn-cluster.is-focused .result-section {
302
- border-top-color: color-mix(in srgb, var(--chronicle-accent) 34%, var(--chronicle-border) 66%);
303
- }
177
+ {@render waitingContent?.()}
304
178
 
305
- .result-summary {
306
- margin: 0;
307
- max-width: 66ch;
308
- font-size: var(--type-body-sm);
309
- line-height: 1.55;
310
- color: var(--chronicle-text-muted);
311
- }
179
+ {#if prompt}
180
+ <button class="prompt-row" type="button" data-section="turn-prompt" aria-label={`View prompt for ${cluster.title}`} onclick={openDetails}>
181
+ <span class="prompt-label">Prompt</span>
182
+ <span class="prompt-preview">{truncateText(markdownToPlainText(prompt), 240)}</span>
183
+ <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
+ </button>
185
+ {/if}
312
186
 
313
- :global(.chronicle-markdown.turn-result-markdown) {
314
- margin-top: 0;
315
- max-width: 70ch;
316
- }
187
+ {#if isLlm || hasReasoning || (compactResult && onDraftTicket)}
188
+ <div class="cluster-support" class:has-reasoning={hasReasoning}>
189
+ <div class="support-progress">{#if progress && isLlm}<ChronicleTurnProgress report={progress.report} attemptStatus={progress.attemptStatus} recordedAt={progress.recordedAt} compact />{/if}</div>
190
+ <div class="footer-actions">
191
+ {#if compactResult && onDraftTicket}<ChronicleCreateIssueButton {onDraftTicket} artifact={{ kind: "turn_result", turnRecordId: cluster.turnRecordId }} />{/if}
192
+ {#if isLlm || hasReasoning}
193
+ <div class="turn-info-actions">
194
+ {#if hasReasoning}<ChronicleTurnDetailsButton kind="reasoning" title={cluster.title} onClick={openDetails} />{/if}
195
+ {#if isLlm}<ChronicleTurnDetailsButton title={cluster.title} onClick={openDetails} />{/if}
196
+ </div>
197
+ {/if}
198
+ </div>
199
+ </div>
200
+ {/if}
317
201
 
318
- @media (max-width: 720px) {
319
- .turn-cluster[data-turn-kind="operator_decision"],
320
- .turn-cluster[data-turn-kind="external_trigger"] {
321
- margin-inline-start: 0;
322
- }
202
+ </div>
203
+ </section>
323
204
 
324
- .cluster-header {
325
- flex-direction: column;
326
- }
205
+ <style>
206
+ .reviewed-result { color: var(--chronicle-accent); font-size: var(--type-body-sm); text-underline-offset: 3px; }
207
+ .turn-cluster { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--chronicle-border); border-radius: 10px; background: var(--chronicle-card-surface); scroll-margin-top: var(--space-sm); }
208
+ .turn-cluster.is-focused { border-color: color-mix(in srgb, var(--chronicle-accent) 40%, var(--chronicle-border)); }
209
+ .turn-cluster.is-failed { border-color: color-mix(in srgb, var(--chronicle-danger) 50%, var(--chronicle-border)); background: color-mix(in srgb, var(--chronicle-danger) 2%, var(--chronicle-card-surface)); }
210
+ .turn-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
211
+ .turn-body[hidden], .turn-body:empty { display: none; }
212
+ .failure-toggle { display: grid; place-items: center; width: 100%; min-width: 0; height: 28px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--chronicle-text-muted); cursor: pointer; }
213
+ .failure-toggle:hover { background: var(--chronicle-panel-muted); }
214
+ .failure-toggle:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 2px; }
215
+ .collapsed-failure { margin: 0; padding-left: 42px; color: var(--chronicle-danger-text); font-size: var(--type-body-sm); }
216
+ .turn-cluster.is-compact { gap: 6px; }
217
+ .turn-cluster[data-turn-kind="operator_decision"], .turn-cluster[data-turn-kind="external_trigger"], .turn-cluster[data-turn-kind="automatic_turn"] { background: var(--chronicle-card-surface-strong); padding-block: 10px; }
218
+ .prompt-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 36px; padding: 7px 10px; border: 0; border-radius: 5px; background: var(--chronicle-panel-muted); text-align: left; color: var(--chronicle-text-muted); font: inherit; font-size: var(--type-body-sm); cursor: pointer; }
219
+ .prompt-row:hover { background: color-mix(in srgb, var(--chronicle-panel-muted) 90%, var(--chronicle-accent)); }
220
+ .prompt-row:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 2px; }
221
+ .prompt-label { font-weight: 600; }
222
+ .prompt-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
223
+ .result-section { display: grid; gap: 6px; padding: 10px 12px; border-radius: 6px; background: color-mix(in srgb, var(--chronicle-accent) 6%, var(--chronicle-card-surface)); }
224
+ .result-section.is-compact { padding: 0 0 0 42px; background: transparent; }
225
+ .result-header-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
226
+ .result-header-row h4 { margin: 0; font-size: var(--type-body); font-weight: 700; color: var(--chronicle-text); }
227
+ .result-summary { margin: 0; font-size: var(--type-body); line-height: 1.55; color: var(--chronicle-text); overflow-wrap: anywhere; }
228
+ .result-outline { margin-top: 8px; color: var(--chronicle-text-muted); font-size: var(--type-body-sm); line-height: 1.5; }
229
+ .result-outline > span { font-weight: 600; }
230
+ .result-outline ul { margin: 4px 0 0; padding-inline-start: 18px; }
231
+ .result-outline li { overflow-wrap: anywhere; }
232
+ .result-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
233
+ .cluster-support { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; min-width: 0; color: var(--chronicle-text-muted); }
234
+ .support-progress { min-width: 0; }
235
+ .footer-actions { display: flex; align-items: center; gap: 14px; }
236
+ .turn-info-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
237
+ .decision-section { padding-inline-start: 42px; color: var(--chronicle-text-muted); font-size: var(--type-body-sm); line-height: 1.5; }
238
+ .decision-fields { display: grid; gap: 6px; margin: 0; }
239
+ .decision-field { display: flex; flex-wrap: wrap; gap: 4px 8px; }
240
+ dt { font-weight: 600; }
241
+ dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
242
+ @media (max-width: 540px) {
243
+ .turn-cluster { padding: 10px; }
244
+ .result-section { padding: 8px 10px; }
245
+ .result-header-row, .result-actions { flex-wrap: wrap; }
246
+ .result-section.is-compact, .decision-section { padding-inline-start: 32px; }
247
+ .cluster-support.has-reasoning { grid-template-columns: minmax(0, 1fr); gap: 6px; }
248
+ .has-reasoning .footer-actions { grid-row: 1; justify-content: flex-end; flex-wrap: wrap; }
249
+ .has-reasoning .support-progress { grid-row: 2; }
250
+ .has-reasoning .support-progress:empty { display: none; }
327
251
  }
328
252
  </style>
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ let {
3
+ title,
4
+ onClick,
5
+ kind = "turn",
6
+ }: { title: string; onClick: () => void; kind?: "turn" | "reasoning" } = $props();
7
+ const label = $derived(kind === "reasoning" ? "Show reasoning" : "Turn details");
8
+ </script>
9
+
10
+ <button type="button" class="turn-details-button" data-action={kind === "reasoning" ? "open-reasoning-details" : "open-turn-details"} aria-label={kind === "reasoning" ? label : `${label} for ${title}`} onclick={onClick}>{label}</button>
11
+
12
+ <style>
13
+ .turn-details-button { min-height: 28px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--chronicle-text-muted); font: inherit; font-size: var(--type-caption); font-weight: 600; white-space: nowrap; cursor: pointer; }
14
+ .turn-details-button:hover { color: var(--chronicle-accent); text-decoration: underline; text-underline-offset: 3px; }
15
+ .turn-details-button:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 3px; }
16
+ </style>