@leitwerk-dev/ui 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/ApiTokensPage-DCmYvZdE.js +1 -0
- package/dist/assets/ChronicleMarkdown-6T_LF-3B.js +1 -0
- package/dist/assets/FutureLaunchDetailPage-D5Gc8YmZ.js +1 -0
- package/dist/assets/GenericLauncher-4BQGl6fT.js +4 -0
- package/dist/assets/GenericLauncher-DRUMMTd7.css +1 -0
- package/dist/assets/HomePage-mb9RzXht.js +1 -0
- package/dist/assets/ProcessActionsMenu-CEzADnZT.js +1 -0
- package/dist/assets/ProcessDetailPage-0c-fMf4Y.js +14 -0
- package/dist/assets/ProcessDetailPage-km76G8wj.css +1 -0
- package/dist/assets/ProcessFlowDiagram-DI5KZ2Qj.js +1 -0
- package/dist/assets/ProcessFlowDiagram-NQ6oEZi7.css +1 -0
- package/dist/assets/ProcessesPage-CVvENTJg.js +1 -0
- package/dist/assets/ScheduleDateTimePicker-2eJ0jBQ-.css +1 -0
- package/dist/assets/ScheduleDateTimePicker-fg0Vau5Z.js +3 -0
- package/dist/assets/SettingsPage-BHSV4rl7.css +1 -0
- package/dist/assets/SettingsPage-CbNM5RWn.js +2 -0
- package/dist/assets/SkillsPage-rCSwSz89.js +2 -0
- package/dist/assets/WatchersPage-D-uT5vWk.js +1 -0
- package/dist/assets/WikiPage-BNdWnJ6L.js +1 -0
- package/dist/assets/WikiPage-Bvnhxl3m.css +1 -0
- package/dist/assets/http-client-Cvi3zOou.js +2 -0
- package/dist/assets/http-contracts-public-BXXSFKbw.js +1 -0
- package/dist/assets/index-DybyOt1_.css +1 -0
- package/dist/assets/{index-client-BYQviCtQ.js → index-client-BSAA7n1a.js} +2 -2
- package/dist/assets/index-gVt2yBO1.js +21 -0
- package/dist/assets/mermaid-render.worker-BN0bcvGc.js +6398 -0
- package/dist/assets/retry-config.svelte-HNNF65qc.js +1 -0
- package/dist/assets/settings-Dk5UoSQa.js +1 -0
- package/dist/index.html +4 -7
- package/package.json +10 -9
- package/src/App.svelte +9 -0
- package/src/chronicle/components/ChronicleActionSection.svelte +10 -2
- package/src/chronicle/components/ChronicleEntryHeader.svelte +4 -16
- package/src/chronicle/components/ChronicleFlow.svelte +24 -6
- package/src/chronicle/components/ChronicleLiveTail.svelte +52 -24
- package/src/chronicle/components/ChronicleProcessErrorSection.svelte +14 -0
- package/src/chronicle/components/ChronicleQuestionRequest.svelte +1 -1
- package/src/chronicle/components/ChronicleRecoverySection.svelte +14 -10
- package/src/chronicle/components/ChronicleStartupRecoverySection.svelte +14 -10
- package/src/chronicle/components/ChronicleThinkingSection.svelte +8 -2
- package/src/chronicle/components/ChronicleToolApproval.svelte +120 -17
- package/src/chronicle/components/ChronicleToolCallItem.svelte +32 -6
- package/src/chronicle/components/ChronicleTurnCluster.svelte +6 -6
- package/src/chronicle/components/ChronicleTurnProgress.svelte +10 -4
- package/src/chronicle/components/ChronicleTurnRail.svelte +1 -0
- package/src/chronicle/components/RecoveryModelControl.svelte +14 -13
- package/src/chronicle/lib/chronicle-projection.ts +74 -376
- package/src/chronicle/lib/chronicle-selectable-items.ts +23 -3
- package/src/chronicle/lib/recovery-model.ts +17 -0
- package/src/components/ConversationTreeDiagram.svelte +93 -30
- package/src/components/FormFieldRenderer.svelte +184 -27
- package/src/components/GenericLauncher.svelte +378 -166
- package/src/components/NamedSelectionList.svelte +77 -0
- package/src/components/ProcessSettings.svelte +110 -0
- package/src/components/ScheduleDateTimePicker.svelte +9 -4
- package/src/components/SettingsField.svelte +317 -0
- package/src/components/SettingsOverview.svelte +237 -0
- package/src/components/SkillSelector.svelte +15 -3
- package/src/components/launcher-form-copy.ts +2 -1
- package/src/components/launcher-model-config.ts +8 -7
- package/src/components/launcher-selections.ts +123 -0
- package/src/lib/api.ts +89 -43
- package/src/lib/http-client.ts +20 -1
- package/src/lib/instance-tree-layout.ts +41 -10
- package/src/lib/primary-path-detail.ts +56 -341
- package/src/lib/primary-path-replay.ts +8 -9
- package/src/lib/process-history.ts +57 -0
- package/src/lib/processes.svelte.ts +71 -79
- package/src/lib/reasoning-history.ts +31 -23
- package/src/lib/router-logic.ts +101 -51
- package/src/lib/router.svelte.ts +4 -4
- package/src/lib/settings.ts +114 -0
- package/src/lib/wiki.ts +34 -0
- package/src/pages/ProcessDetailPage.svelte +55 -344
- package/src/pages/ProcessFlowDiagram.svelte +39 -684
- package/src/pages/SettingsPage.svelte +265 -0
- package/src/pages/SkillsPage.svelte +26 -12
- package/src/pages/WikiPage.svelte +9 -0
- package/src/pages/process-detail/ProcessDetailChronicle.svelte +57 -13
- package/src/pages/process-detail/ProcessDetailHeader.svelte +9 -3
- package/src/pages/process-detail/TicketCreationComposer.svelte +49 -10
- package/src/pages/process-detail/inspector/ExecutionDetails.svelte +210 -0
- package/src/pages/process-detail/inspector/InspectionEvidence.svelte +48 -0
- package/src/pages/process-detail/inspector/InspectionMessage.svelte +71 -0
- package/src/pages/process-detail/inspector/ProcessInspector.svelte +144 -0
- package/src/pages/process-detail/inspector/ProcessModelEditor.svelte +161 -0
- package/src/pages/process-detail/inspector/ProcessReference.svelte +166 -0
- package/src/pages/process-detail/inspector/inspection-activity.ts +118 -0
- package/src/pages/process-detail/inspector/inspection-data.svelte.ts +107 -0
- package/src/pages/process-detail/inspector/inspection-tool-call.ts +30 -0
- package/src/pages/process-detail/inspector/inspector-navigation.ts +190 -0
- package/src/pages/process-detail/inspector/model-source-label.ts +17 -0
- package/src/pages/process-detail/process-detail-actions.svelte.ts +10 -0
- package/src/pages/process-detail/process-detail-chronicle-scroll.svelte.ts +18 -2
- package/src/pages/process-detail/process-detail-view-model.ts +2 -2
- package/src/shell/AppShell.svelte +5 -0
- package/src/shell/Sidebar.svelte +10 -0
- package/src/test-support/mount.ts +34 -0
- package/dist/assets/ApiTokensPage-ClJp9PYr.js +0 -1
- package/dist/assets/ChronicleMarkdown-lqwX9Ywa.js +0 -16
- package/dist/assets/FutureLaunchDetailPage-ygp-IdXC.js +0 -1
- package/dist/assets/GenericLauncher-CExW6wei.css +0 -1
- package/dist/assets/GenericLauncher-DOwsERpB.js +0 -1
- package/dist/assets/HomePage-D1J-Rmsw.js +0 -1
- package/dist/assets/PageHeader-DPuQInDo.css +0 -1
- package/dist/assets/PageHeader-sphJnWL1.js +0 -1
- package/dist/assets/ProcessActionsMenu-DV9zaxNS.js +0 -1
- package/dist/assets/ProcessDetailPage-BW1M2IH8.js +0 -14
- package/dist/assets/ProcessDetailPage-Cth6A0DN.css +0 -1
- package/dist/assets/ProcessFlowDiagram-Cz8wNicU.css +0 -1
- package/dist/assets/ProcessFlowDiagram-Dx2wheGN.js +0 -2
- package/dist/assets/ProcessesPage-CSPH5L7E.js +0 -1
- package/dist/assets/ScheduleDateTimePicker-DmojMRxN.js +0 -1
- package/dist/assets/ScheduleDateTimePicker-uacJAkIq.css +0 -1
- package/dist/assets/SkillsPage-KnLql0n1.js +0 -2
- package/dist/assets/WatchersPage-B4jf3Ywp.js +0 -1
- package/dist/assets/http-client-VpPXJwbR.js +0 -2
- package/dist/assets/index-DPCokDbS.js +0 -6
- package/dist/assets/index-DtEI5gsQ.css +0 -1
- package/dist/assets/mermaid-render.worker-QW2WZpEE.js +0 -6393
- package/dist/assets/process-terminal-display-BQRQwGod.js +0 -1
- package/dist/assets/router.svelte-EEldxHlO.js +0 -1
- package/src/chronicle/components/ChronicleReasoningDetailsOverlay.svelte +0 -855
- package/src/components/ProcessInfoOverlay.svelte +0 -1221
- package/src/lib/flow-layout.ts +0 -319
- package/src/pages/process-detail/OverlayFrame.svelte +0 -58
|
@@ -22,7 +22,6 @@ type ChronicleInput = Pick<
|
|
|
22
22
|
"id" | "sequence" | "source" | "kind" | "bodyMarkdown" | "receivedAt" | "consumedAt"
|
|
23
23
|
>;
|
|
24
24
|
|
|
25
|
-
import type { ProcessRunDetailsView } from "@leitwerk-dev/protocol/http-contracts";
|
|
26
25
|
import { formatDefinition } from "../../lib/format";
|
|
27
26
|
import { truncateText } from "../../lib/markdown";
|
|
28
27
|
import { hasDisplayableText } from "../../lib/pi-stream.js";
|
|
@@ -54,32 +53,11 @@ export interface ChronicleTerminalRailItem {
|
|
|
54
53
|
title: string;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
export interface ChronicleReasoningThinkingItem {
|
|
58
|
-
kind: "thinking_chunk";
|
|
59
|
-
text: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface ChronicleReasoningToolItem {
|
|
63
|
-
kind: "tool_call";
|
|
64
|
-
toolCall: TurnTraceSnapshot["toolCalls"][number];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface ChronicleReasoningOperationalEventItem {
|
|
68
|
-
kind: "operational_event";
|
|
69
|
-
event: Extract<TurnTraceSnapshot["traceItems"][number], { kind: "operational_event" }>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export type ChronicleReasoningTimelineItem =
|
|
73
|
-
| ChronicleReasoningThinkingItem
|
|
74
|
-
| ChronicleReasoningToolItem
|
|
75
|
-
| ChronicleReasoningOperationalEventItem;
|
|
76
|
-
|
|
77
56
|
export interface ChronicleThinkingSection {
|
|
78
57
|
kind: "thinking_preview";
|
|
79
58
|
text: string;
|
|
80
59
|
preview: string;
|
|
81
60
|
previewTruncated: boolean;
|
|
82
|
-
items: ChronicleReasoningTimelineItem[];
|
|
83
61
|
toolCallCount: number;
|
|
84
62
|
traceItemCount: number;
|
|
85
63
|
}
|
|
@@ -102,15 +80,9 @@ export interface ChroniclePiInputSummary {
|
|
|
102
80
|
userInput: string | null;
|
|
103
81
|
}
|
|
104
82
|
|
|
105
|
-
export type ChronicleTriggerSource = "external_event" | "user_action" | "unknown";
|
|
106
|
-
export type ChronicleRunMode = "scheduled" | "immediate" | "unknown";
|
|
107
|
-
|
|
108
83
|
export interface ChronicleTurnFacts {
|
|
109
84
|
startedAt: string | null;
|
|
110
85
|
endedAt: string | null;
|
|
111
|
-
triggerSource: ChronicleTriggerSource;
|
|
112
|
-
runMode: ChronicleRunMode;
|
|
113
|
-
activeToolNames: readonly string[];
|
|
114
86
|
}
|
|
115
87
|
|
|
116
88
|
export interface ChronicleOperatorDecisionSection {
|
|
@@ -229,6 +201,7 @@ export interface ChronicleLiveTailItem {
|
|
|
229
201
|
pathLabel: string | null;
|
|
230
202
|
state: "tool_running" | "thinking" | "streaming" | "waiting";
|
|
231
203
|
stateLabel: string;
|
|
204
|
+
activitySummary?: string;
|
|
232
205
|
copy: string;
|
|
233
206
|
assistantTextPreview: string;
|
|
234
207
|
reasoningSection: ChronicleThinkingSection | null;
|
|
@@ -266,27 +239,9 @@ export interface ChronicleProjection {
|
|
|
266
239
|
latestCompletedTurnTitle: string | null;
|
|
267
240
|
}
|
|
268
241
|
|
|
269
|
-
export interface ChronicleReasoningDetailEntry {
|
|
270
|
-
entryId: string;
|
|
271
|
-
turnRecordId: string;
|
|
272
|
-
turnId: string;
|
|
273
|
-
title: string;
|
|
274
|
-
turnLabel: string;
|
|
275
|
-
stateLabel: string | null;
|
|
276
|
-
isLive: boolean;
|
|
277
|
-
modelProfileId: string | null;
|
|
278
|
-
usage: TurnUsageSnapshot | null;
|
|
279
|
-
triggeringInput: ChronicleTriggeringInputSummary | null;
|
|
280
|
-
piInput: ChroniclePiInputSummary | null;
|
|
281
|
-
facts: ChronicleTurnFacts;
|
|
282
|
-
reasoningSection: ChronicleThinkingSection;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
242
|
export interface BuildChronicleProjectionInput {
|
|
286
243
|
turnRecords: readonly TurnRecordView[];
|
|
287
|
-
turnTraceIndex: Record<string, TurnTraceSnapshot | undefined>;
|
|
288
244
|
turnTracePreviewIndex?: Record<string, TurnTracePreview | undefined>;
|
|
289
|
-
runDetails?: ProcessRunDetailsView | null;
|
|
290
245
|
initialUserInputText?: string | null;
|
|
291
246
|
inputs: readonly ChronicleInput[];
|
|
292
247
|
leafOutcomeSnapshots: readonly ProcessLeafOutcomeSnapshot[];
|
|
@@ -327,76 +282,6 @@ function buildTerminalAnchorId(status: ProcessTerminalStatus): string {
|
|
|
327
282
|
return `chronicle-terminal-${sanitizeDomToken(status)}`;
|
|
328
283
|
}
|
|
329
284
|
|
|
330
|
-
function buildReasoningTimelineItems(
|
|
331
|
-
turnTrace: TurnTraceSnapshot | undefined,
|
|
332
|
-
): ChronicleReasoningTimelineItem[] {
|
|
333
|
-
const traceItems = turnTrace?.traceItems ?? [];
|
|
334
|
-
const toolCalls = turnTrace?.toolCalls ?? [];
|
|
335
|
-
const toolCallsById = new Map(toolCalls.map((toolCall) => [toolCall.toolCallId, toolCall]));
|
|
336
|
-
const resolvedItems: ChronicleReasoningTimelineItem[] = [];
|
|
337
|
-
const seenToolCallIds = new Set<string>();
|
|
338
|
-
|
|
339
|
-
for (const traceItem of traceItems) {
|
|
340
|
-
if (traceItem.kind === "thinking") {
|
|
341
|
-
if (!hasDisplayableText(traceItem.text)) {
|
|
342
|
-
continue;
|
|
343
|
-
}
|
|
344
|
-
resolvedItems.push({
|
|
345
|
-
kind: "thinking_chunk",
|
|
346
|
-
text: traceItem.text,
|
|
347
|
-
});
|
|
348
|
-
continue;
|
|
349
|
-
}
|
|
350
|
-
if (traceItem.kind === "operational_event") {
|
|
351
|
-
resolvedItems.push({
|
|
352
|
-
kind: "operational_event",
|
|
353
|
-
event: traceItem,
|
|
354
|
-
});
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
const toolCall = toolCallsById.get(traceItem.toolCallId);
|
|
358
|
-
if (!toolCall) {
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
|
-
seenToolCallIds.add(toolCall.toolCallId);
|
|
362
|
-
resolvedItems.push({
|
|
363
|
-
kind: "tool_call",
|
|
364
|
-
toolCall,
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
if (resolvedItems.length === 0) {
|
|
369
|
-
const thinkingText = turnTrace?.assistant.thinking ?? "";
|
|
370
|
-
if (hasDisplayableText(thinkingText)) {
|
|
371
|
-
resolvedItems.push({
|
|
372
|
-
kind: "thinking_chunk",
|
|
373
|
-
text: thinkingText,
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
for (const toolCall of toolCalls) {
|
|
377
|
-
resolvedItems.push({
|
|
378
|
-
kind: "tool_call",
|
|
379
|
-
toolCall,
|
|
380
|
-
});
|
|
381
|
-
seenToolCallIds.add(toolCall.toolCallId);
|
|
382
|
-
}
|
|
383
|
-
return resolvedItems;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
for (const toolCall of toolCalls) {
|
|
387
|
-
if (seenToolCallIds.has(toolCall.toolCallId)) {
|
|
388
|
-
continue;
|
|
389
|
-
}
|
|
390
|
-
resolvedItems.push({
|
|
391
|
-
kind: "tool_call",
|
|
392
|
-
toolCall,
|
|
393
|
-
});
|
|
394
|
-
seenToolCallIds.add(toolCall.toolCallId);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
return resolvedItems;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
285
|
interface TurnTraceProjectionSource {
|
|
401
286
|
trace: TurnTraceSnapshot | undefined;
|
|
402
287
|
preview: TurnTracePreview | undefined;
|
|
@@ -408,7 +293,6 @@ function buildEmptyReasoningSection(source: TurnTraceProjectionSource): Chronicl
|
|
|
408
293
|
text: "",
|
|
409
294
|
preview: "",
|
|
410
295
|
previewTruncated: source.preview?.thinkingPreviewTruncated ?? false,
|
|
411
|
-
items: [],
|
|
412
296
|
toolCallCount: source.trace?.toolCalls.length ?? source.preview?.toolCallCount ?? 0,
|
|
413
297
|
traceItemCount: source.trace?.traceItems.length ?? source.preview?.traceItemCount ?? 0,
|
|
414
298
|
};
|
|
@@ -416,10 +300,16 @@ function buildEmptyReasoningSection(source: TurnTraceProjectionSource): Chronicl
|
|
|
416
300
|
|
|
417
301
|
function buildReasoningSection(source: TurnTraceProjectionSource): ChronicleThinkingSection | null {
|
|
418
302
|
const thinkingText = source.trace?.assistant.thinking ?? source.preview?.thinkingPreview ?? "";
|
|
419
|
-
const
|
|
303
|
+
const hasTraceDetails =
|
|
304
|
+
Boolean(source.trace?.toolCalls.length) ||
|
|
305
|
+
source.trace?.traceItems.some(
|
|
306
|
+
(item) =>
|
|
307
|
+
item.kind === "operational_event" ||
|
|
308
|
+
(item.kind === "thinking" && hasDisplayableText(item.text)),
|
|
309
|
+
);
|
|
420
310
|
const hasPreviewDetails =
|
|
421
311
|
source.trace === undefined && source.preview?.hasReasoningDetails === true;
|
|
422
|
-
if (!hasDisplayableText(thinkingText) &&
|
|
312
|
+
if (!hasDisplayableText(thinkingText) && !hasTraceDetails && !hasPreviewDetails) {
|
|
423
313
|
return null;
|
|
424
314
|
}
|
|
425
315
|
const thinkingPreview = source.trace
|
|
@@ -436,7 +326,6 @@ function buildReasoningSection(source: TurnTraceProjectionSource): ChronicleThin
|
|
|
436
326
|
text: thinkingText,
|
|
437
327
|
preview: thinkingPreview.text,
|
|
438
328
|
previewTruncated: thinkingPreview.truncated,
|
|
439
|
-
items,
|
|
440
329
|
toolCallCount: source.trace?.toolCalls.length ?? source.preview?.toolCallCount ?? 0,
|
|
441
330
|
traceItemCount: source.trace?.traceItems.length ?? source.preview?.traceItemCount ?? 0,
|
|
442
331
|
};
|
|
@@ -455,93 +344,20 @@ function sourceLabel(source: ProcessInput["source"]): string {
|
|
|
455
344
|
}
|
|
456
345
|
}
|
|
457
346
|
|
|
458
|
-
type ChronicleActionSource = ProcessTimelineTurnSummary["actionSource"];
|
|
459
|
-
|
|
460
|
-
function uniqueNonEmptyToolNames(values: readonly string[]): string[] {
|
|
461
|
-
const names = new Set<string>();
|
|
462
|
-
for (const value of values) {
|
|
463
|
-
const toolName = value.trim();
|
|
464
|
-
if (toolName !== "") {
|
|
465
|
-
names.add(toolName);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return [...names];
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
function activeToolNamesForTurn(
|
|
472
|
-
runDetails: ProcessRunDetailsView | null | undefined,
|
|
473
|
-
turnId: string,
|
|
474
|
-
): readonly string[] {
|
|
475
|
-
const turn = runDetails?.turns.find((candidate) => candidate.turnId === turnId);
|
|
476
|
-
return uniqueNonEmptyToolNames([
|
|
477
|
-
...(turn?.activePiToolNames ?? []),
|
|
478
|
-
...(turn?.outcomeActions.map((action) => action.name) ?? []),
|
|
479
|
-
]);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
function triggerSourceFor(
|
|
483
|
-
triggeringInput: ChronicleTriggeringInputSummary | null,
|
|
484
|
-
actionSource: ChronicleActionSource | null,
|
|
485
|
-
): ChronicleTriggerSource {
|
|
486
|
-
if (actionSource === "ui") {
|
|
487
|
-
return "user_action";
|
|
488
|
-
}
|
|
489
|
-
if (actionSource === "external" || actionSource === "scheduled") {
|
|
490
|
-
return "external_event";
|
|
491
|
-
}
|
|
492
|
-
if (!triggeringInput) {
|
|
493
|
-
return "unknown";
|
|
494
|
-
}
|
|
495
|
-
switch (triggeringInput.source) {
|
|
496
|
-
case "external_comment":
|
|
497
|
-
case "watcher_event":
|
|
498
|
-
return "external_event";
|
|
499
|
-
case "app_steer":
|
|
500
|
-
case "action_prompt":
|
|
501
|
-
case "initial_prompt":
|
|
502
|
-
return "user_action";
|
|
503
|
-
default:
|
|
504
|
-
return "unknown";
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
function runModeFor(
|
|
509
|
-
triggeringInput: ChronicleTriggeringInputSummary | null,
|
|
510
|
-
actionSource: ChronicleActionSource | null,
|
|
511
|
-
): ChronicleRunMode {
|
|
512
|
-
if (actionSource === "scheduled") {
|
|
513
|
-
return "scheduled";
|
|
514
|
-
}
|
|
515
|
-
if (actionSource === "ui" || actionSource === "external") {
|
|
516
|
-
return "immediate";
|
|
517
|
-
}
|
|
518
|
-
if (
|
|
519
|
-
triggeringInput?.source === "initial_prompt" ||
|
|
520
|
-
triggeringInput?.source === "app_steer" ||
|
|
521
|
-
triggeringInput?.source === "external_comment" ||
|
|
522
|
-
triggeringInput?.source === "action_prompt" ||
|
|
523
|
-
triggeringInput?.source === "watcher_event"
|
|
524
|
-
) {
|
|
525
|
-
return "immediate";
|
|
526
|
-
}
|
|
527
|
-
return "unknown";
|
|
528
|
-
}
|
|
529
|
-
|
|
530
347
|
function toPiInputSummary(input: {
|
|
531
348
|
traceSource: TurnTraceProjectionSource;
|
|
532
349
|
triggeringInput: ChronicleTriggeringInputSummary | null;
|
|
533
350
|
initialUserInputText?: string | null;
|
|
534
351
|
}): ChroniclePiInputSummary | null {
|
|
535
|
-
const piInput = input.traceSource.trace?.piInput;
|
|
536
352
|
const previewInput = input.traceSource.preview?.piInput;
|
|
537
|
-
const fullPrompt =
|
|
353
|
+
const fullPrompt = previewInput?.userInputPreview ?? "";
|
|
538
354
|
if (fullPrompt.trim() === "") {
|
|
539
355
|
return null;
|
|
540
356
|
}
|
|
541
357
|
return {
|
|
542
|
-
parts:
|
|
358
|
+
parts: [],
|
|
543
359
|
fullPrompt,
|
|
544
|
-
createdAt:
|
|
360
|
+
createdAt: previewInput?.createdAt ?? "",
|
|
545
361
|
userInput:
|
|
546
362
|
promptOrNull(input.triggeringInput?.bodyMarkdown) ??
|
|
547
363
|
promptOrNull(input.initialUserInputText) ??
|
|
@@ -549,23 +365,6 @@ function toPiInputSummary(input: {
|
|
|
549
365
|
};
|
|
550
366
|
}
|
|
551
367
|
|
|
552
|
-
function buildTurnFacts(input: {
|
|
553
|
-
turnId: string;
|
|
554
|
-
durableTurnRecord: TurnRecordView | undefined;
|
|
555
|
-
activeTurn?: PrimaryPathActiveTurnSnapshot | CompactActiveTurnSnapshot | null;
|
|
556
|
-
triggeringInput: ChronicleTriggeringInputSummary | null;
|
|
557
|
-
actionSource: ChronicleActionSource | null;
|
|
558
|
-
runDetails?: ProcessRunDetailsView | null;
|
|
559
|
-
}): ChronicleTurnFacts {
|
|
560
|
-
return {
|
|
561
|
-
startedAt: input.durableTurnRecord?.startedAt ?? input.activeTurn?.startedAt ?? null,
|
|
562
|
-
endedAt: input.durableTurnRecord?.endedAt ?? null,
|
|
563
|
-
triggerSource: triggerSourceFor(input.triggeringInput, input.actionSource),
|
|
564
|
-
runMode: runModeFor(input.triggeringInput, input.actionSource),
|
|
565
|
-
activeToolNames: activeToolNamesForTurn(input.runDetails, input.turnId),
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
|
|
569
368
|
function hasChronicleInputBody(input: ChronicleInput): boolean {
|
|
570
369
|
return hasDisplayableText(input.bodyMarkdown);
|
|
571
370
|
}
|
|
@@ -607,25 +406,20 @@ function shouldExposeEmptyReasoningDetails(
|
|
|
607
406
|
): boolean {
|
|
608
407
|
return (
|
|
609
408
|
turnRecord.turnType === "llm" &&
|
|
610
|
-
(
|
|
611
|
-
traceSource.trace?.usage != null ||
|
|
612
|
-
traceSource.preview?.hasReasoningDetails === true ||
|
|
613
|
-
turnRecord.modelProfileId !== null)
|
|
409
|
+
(traceSource.preview?.hasReasoningDetails === true || turnRecord.modelProfileId !== null)
|
|
614
410
|
);
|
|
615
411
|
}
|
|
616
412
|
|
|
617
413
|
function buildTurnClusterItem(input: {
|
|
618
414
|
turnRecord: TurnRecordView;
|
|
619
|
-
turnTrace: TurnTraceSnapshot | undefined;
|
|
620
415
|
turnTracePreview: TurnTracePreview | undefined;
|
|
621
416
|
terminalStatus: "completed" | "aborted" | null;
|
|
622
417
|
hasRenderableLeafOutcome: boolean;
|
|
623
418
|
triggeringInput: ChronicleTriggeringInputSummary | null;
|
|
624
|
-
facts: ChronicleTurnFacts;
|
|
625
419
|
initialUserInputText?: string | null;
|
|
626
420
|
}): ChronicleTurnClusterItem {
|
|
627
|
-
const { turnRecord,
|
|
628
|
-
const traceSource = { trace:
|
|
421
|
+
const { turnRecord, turnTracePreview, triggeringInput } = input;
|
|
422
|
+
const traceSource = { trace: undefined, preview: turnTracePreview };
|
|
629
423
|
const sections: ChronicleTurnClusterSection[] = [];
|
|
630
424
|
const turnPresentation = getChronicleTurnPresentation(turnRecord);
|
|
631
425
|
const reasoningSection =
|
|
@@ -637,8 +431,7 @@ function buildTurnClusterItem(input: {
|
|
|
637
431
|
sections.push(reasoningSection);
|
|
638
432
|
}
|
|
639
433
|
|
|
640
|
-
const assistantText =
|
|
641
|
-
turnTrace?.assistant.text?.trim() ?? turnTracePreview?.assistantTextPreview.trim() ?? "";
|
|
434
|
+
const assistantText = turnTracePreview?.assistantTextPreview.trim() ?? "";
|
|
642
435
|
const fallbackText =
|
|
643
436
|
!hasDisplayableText(turnRecord.turnResultMarkdown) && hasDisplayableText(turnRecord.output)
|
|
644
437
|
? turnRecord.output.trim()
|
|
@@ -696,14 +489,14 @@ function buildTurnClusterItem(input: {
|
|
|
696
489
|
terminalStatus: input.terminalStatus,
|
|
697
490
|
sections,
|
|
698
491
|
modelProfileId: turnRecord.modelProfileId,
|
|
699
|
-
usage:
|
|
492
|
+
usage: turnTracePreview?.usage ?? null,
|
|
700
493
|
triggeringInput,
|
|
701
494
|
piInput: toPiInputSummary({
|
|
702
495
|
traceSource,
|
|
703
496
|
triggeringInput,
|
|
704
497
|
initialUserInputText: input.initialUserInputText,
|
|
705
498
|
}),
|
|
706
|
-
facts:
|
|
499
|
+
facts: { startedAt: turnRecord.startedAt, endedAt: turnRecord.endedAt },
|
|
707
500
|
failure:
|
|
708
501
|
turnRecord.outcome === "failed"
|
|
709
502
|
? { summary: turnRecord.output || turnRecord.summary || "This turn failed." }
|
|
@@ -916,66 +709,31 @@ function buildTriggeringInputIndex(
|
|
|
916
709
|
return index;
|
|
917
710
|
}
|
|
918
711
|
|
|
919
|
-
function mergeLiveToolCallsWithSessionDetails(
|
|
920
|
-
activeToolCalls: ReadonlyArray<PrimaryPathActiveTurnSnapshot["toolCalls"][number]>,
|
|
921
|
-
sessionToolCalls: ReadonlyArray<TurnTraceSnapshot["toolCalls"][number]> | undefined,
|
|
922
|
-
): TurnTraceSnapshot["toolCalls"] {
|
|
923
|
-
const sessionToolCallsById = new Map(
|
|
924
|
-
(sessionToolCalls ?? []).map((toolCall) => [toolCall.toolCallId, toolCall]),
|
|
925
|
-
);
|
|
926
|
-
const seenToolCallIds = new Set<string>();
|
|
927
|
-
const mergedToolCalls: TurnTraceSnapshot["toolCalls"] = activeToolCalls.map((toolCall) => {
|
|
928
|
-
seenToolCallIds.add(toolCall.toolCallId);
|
|
929
|
-
const sessionToolCall = sessionToolCallsById.get(toolCall.toolCallId);
|
|
930
|
-
if (!sessionToolCall) {
|
|
931
|
-
return toolCall;
|
|
932
|
-
}
|
|
933
|
-
return {
|
|
934
|
-
...toolCall,
|
|
935
|
-
arguments: toolCall.arguments ?? sessionToolCall.arguments,
|
|
936
|
-
resultText: sessionToolCall.resultText,
|
|
937
|
-
truncated: sessionToolCall.truncated,
|
|
938
|
-
};
|
|
939
|
-
});
|
|
940
|
-
for (const sessionToolCall of sessionToolCalls ?? []) {
|
|
941
|
-
if (!seenToolCallIds.has(sessionToolCall.toolCallId)) {
|
|
942
|
-
mergedToolCalls.push(sessionToolCall);
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
return mergedToolCalls;
|
|
946
|
-
}
|
|
947
|
-
|
|
948
712
|
function buildLiveTail(input: {
|
|
949
713
|
turnRecord: TurnRecordView | null;
|
|
950
714
|
activeTurn: PrimaryPathActiveTurnSnapshot | CompactActiveTurnSnapshot | null | undefined;
|
|
951
|
-
turnTrace: TurnTraceSnapshot | undefined;
|
|
952
715
|
turnTracePreview: TurnTracePreview | undefined;
|
|
953
716
|
triggeringInput: ChronicleTriggeringInputSummary | null;
|
|
954
|
-
facts: ChronicleTurnFacts | null;
|
|
955
|
-
runDetails?: ProcessRunDetailsView | null;
|
|
956
717
|
initialUserInputText?: string | null;
|
|
957
718
|
}): ChronicleLiveTailItem | null {
|
|
958
|
-
const { turnRecord, activeTurn,
|
|
719
|
+
const { turnRecord, activeTurn, turnTracePreview, triggeringInput } = input;
|
|
959
720
|
if (!turnRecord) {
|
|
960
721
|
return null;
|
|
961
722
|
}
|
|
962
723
|
const liveToolCalls = activeTurn
|
|
963
|
-
?
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
: [],
|
|
977
|
-
turnTrace?.toolCalls,
|
|
978
|
-
)
|
|
724
|
+
? "toolCalls" in activeTurn
|
|
725
|
+
? activeTurn.toolCalls
|
|
726
|
+
: activeTurn.currentTool
|
|
727
|
+
? [
|
|
728
|
+
{
|
|
729
|
+
...activeTurn.currentTool,
|
|
730
|
+
startedAt: activeTurn.startedAt,
|
|
731
|
+
completedAt: null,
|
|
732
|
+
arguments: null,
|
|
733
|
+
result: null,
|
|
734
|
+
},
|
|
735
|
+
]
|
|
736
|
+
: []
|
|
979
737
|
: [];
|
|
980
738
|
const runningToolCall = activeTurn
|
|
981
739
|
? (liveToolCalls.findLast((toolCall) => toolCall.status === "running") ?? null)
|
|
@@ -985,12 +743,12 @@ function buildLiveTail(input: {
|
|
|
985
743
|
const hasThinkingText = thinkingText.trim().length > 0;
|
|
986
744
|
const reasoningSection = activeTurn
|
|
987
745
|
? buildReasoningSection({
|
|
988
|
-
trace:
|
|
746
|
+
trace: {
|
|
989
747
|
assistant: activeTurn.assistant,
|
|
990
748
|
toolCalls: liveToolCalls,
|
|
991
749
|
traceItems: "traceItems" in activeTurn ? activeTurn.traceItems : [],
|
|
992
750
|
usage: activeTurn.usage,
|
|
993
|
-
piInput:
|
|
751
|
+
piInput: null,
|
|
994
752
|
},
|
|
995
753
|
preview: turnTracePreview,
|
|
996
754
|
})
|
|
@@ -1012,6 +770,25 @@ function buildLiveTail(input: {
|
|
|
1012
770
|
text: reasoningPreviewTail(thinkingText),
|
|
1013
771
|
truncated: thinkingText.length > THINKING_PREVIEW_MAX_LENGTH,
|
|
1014
772
|
};
|
|
773
|
+
const progressSummary = turnRecord.progress?.summary?.trim();
|
|
774
|
+
const preparationCompleted = Boolean(
|
|
775
|
+
turnRecord.progress?.steps.length &&
|
|
776
|
+
turnRecord.progress.steps.every((step) => step.status === "completed"),
|
|
777
|
+
);
|
|
778
|
+
const hasModelActivity = Boolean(
|
|
779
|
+
hasThinkingText ||
|
|
780
|
+
assistantText ||
|
|
781
|
+
liveToolCalls.length ||
|
|
782
|
+
reasoningSection?.traceItemCount ||
|
|
783
|
+
reasoningSection?.toolCallCount ||
|
|
784
|
+
activeTurn?.usage,
|
|
785
|
+
);
|
|
786
|
+
const activitySummary =
|
|
787
|
+
progressSummary &&
|
|
788
|
+
(turnRecord.turnType === "automatic" ||
|
|
789
|
+
(turnRecord.turnType === "llm" && !preparationCompleted && !hasModelActivity))
|
|
790
|
+
? progressSummary
|
|
791
|
+
: undefined;
|
|
1015
792
|
const copy =
|
|
1016
793
|
state === "tool_running"
|
|
1017
794
|
? `Running ${formatDefinition(runningToolCall?.toolName ?? "tool")}…`
|
|
@@ -1021,13 +798,16 @@ function buildLiveTail(input: {
|
|
|
1021
798
|
? truncateText(assistantText, 320)
|
|
1022
799
|
: getChronicleTurnPreview(turnRecord, 220) || "Waiting for more activity…";
|
|
1023
800
|
const stateLabel =
|
|
1024
|
-
|
|
801
|
+
activitySummary ??
|
|
802
|
+
(state === "tool_running"
|
|
1025
803
|
? "Running action"
|
|
1026
804
|
: state === "thinking"
|
|
1027
805
|
? "Reasoning"
|
|
1028
806
|
: state === "streaming"
|
|
1029
807
|
? "Writing response"
|
|
1030
|
-
:
|
|
808
|
+
: turnRecord.turnType === "automatic"
|
|
809
|
+
? "Running…"
|
|
810
|
+
: "Waiting for activity");
|
|
1031
811
|
|
|
1032
812
|
return {
|
|
1033
813
|
kind: "live_tail",
|
|
@@ -1044,6 +824,7 @@ function buildLiveTail(input: {
|
|
|
1044
824
|
pathLabel: activeTurn ? formatPiTreePathLabel(activeTurn) : formatPiTreePathLabel(turnRecord),
|
|
1045
825
|
state,
|
|
1046
826
|
stateLabel,
|
|
827
|
+
activitySummary,
|
|
1047
828
|
copy,
|
|
1048
829
|
assistantTextPreview: reasoningPreviewTail(assistantText),
|
|
1049
830
|
reasoningSection:
|
|
@@ -1058,20 +839,14 @@ function buildLiveTail(input: {
|
|
|
1058
839
|
modelProfileId: turnRecord.modelProfileId,
|
|
1059
840
|
triggeringInput,
|
|
1060
841
|
piInput: toPiInputSummary({
|
|
1061
|
-
traceSource: { trace:
|
|
842
|
+
traceSource: { trace: undefined, preview: turnTracePreview },
|
|
1062
843
|
triggeringInput,
|
|
1063
844
|
initialUserInputText: input.initialUserInputText,
|
|
1064
845
|
}),
|
|
1065
|
-
facts:
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
durableTurnRecord: undefined,
|
|
1070
|
-
activeTurn: activeTurn ?? null,
|
|
1071
|
-
triggeringInput,
|
|
1072
|
-
actionSource: null,
|
|
1073
|
-
runDetails: input.runDetails,
|
|
1074
|
-
}),
|
|
846
|
+
facts: {
|
|
847
|
+
startedAt: turnRecord.startedAt ?? activeTurn?.startedAt ?? null,
|
|
848
|
+
endedAt: turnRecord.endedAt,
|
|
849
|
+
},
|
|
1075
850
|
};
|
|
1076
851
|
}
|
|
1077
852
|
|
|
@@ -1161,73 +936,19 @@ function compareChronicleItems(left: ChronicleTimelineItem, right: ChronicleTime
|
|
|
1161
936
|
return chronicleItemOrder(left) - chronicleItemOrder(right);
|
|
1162
937
|
}
|
|
1163
938
|
|
|
1164
|
-
function
|
|
1165
|
-
sections: readonly ChronicleTurnClusterSection[],
|
|
1166
|
-
): ChronicleThinkingSection | null {
|
|
1167
|
-
for (const section of sections) {
|
|
1168
|
-
if (section.kind === "thinking_preview") {
|
|
1169
|
-
return section;
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
return null;
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
export function extractChronicleReasoningDetailEntries(
|
|
939
|
+
export function extractChronicleReasoningTurnRecordIds(
|
|
1176
940
|
projection: ChronicleProjection,
|
|
1177
941
|
questionRequests: readonly ProcessQuestionRequest[] = [],
|
|
1178
|
-
):
|
|
1179
|
-
const entries: ChronicleReasoningDetailEntry[] = [];
|
|
942
|
+
): string[] {
|
|
1180
943
|
const questionTurnRecordIds = new Set(questionRequests.map((request) => request.turnRecordId));
|
|
1181
|
-
|
|
1182
|
-
if (item.kind !== "turn_cluster" && item.kind !== "live_tail")
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
(questionTurnRecordIds.has(item.turnRecordId) ||
|
|
1190
|
-
(item.kind === "live_tail" && item.turnType === "llm")
|
|
1191
|
-
? buildEmptyReasoningSection({ trace: undefined, preview: undefined })
|
|
1192
|
-
: null);
|
|
1193
|
-
if (!reasoningSection) {
|
|
1194
|
-
continue;
|
|
1195
|
-
}
|
|
1196
|
-
if (item.kind === "turn_cluster") {
|
|
1197
|
-
entries.push({
|
|
1198
|
-
entryId: item.turnRecordId,
|
|
1199
|
-
turnRecordId: item.turnRecordId,
|
|
1200
|
-
turnId: item.turnId,
|
|
1201
|
-
title: item.title,
|
|
1202
|
-
turnLabel: item.turnLabel,
|
|
1203
|
-
stateLabel: null,
|
|
1204
|
-
isLive: false,
|
|
1205
|
-
modelProfileId: item.modelProfileId,
|
|
1206
|
-
usage: item.usage,
|
|
1207
|
-
triggeringInput: item.triggeringInput,
|
|
1208
|
-
piInput: item.piInput,
|
|
1209
|
-
facts: item.facts,
|
|
1210
|
-
reasoningSection,
|
|
1211
|
-
});
|
|
1212
|
-
continue;
|
|
1213
|
-
}
|
|
1214
|
-
entries.push({
|
|
1215
|
-
entryId: item.turnRecordId,
|
|
1216
|
-
turnRecordId: item.turnRecordId,
|
|
1217
|
-
turnId: item.turnId,
|
|
1218
|
-
title: item.title,
|
|
1219
|
-
turnLabel: item.turnLabel,
|
|
1220
|
-
stateLabel: item.stateLabel,
|
|
1221
|
-
isLive: true,
|
|
1222
|
-
modelProfileId: item.modelProfileId,
|
|
1223
|
-
usage: item.usage,
|
|
1224
|
-
triggeringInput: item.triggeringInput,
|
|
1225
|
-
piInput: item.piInput,
|
|
1226
|
-
facts: item.facts,
|
|
1227
|
-
reasoningSection,
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
return entries;
|
|
944
|
+
return projection.timelineItems.flatMap((item) => {
|
|
945
|
+
if (item.kind !== "turn_cluster" && item.kind !== "live_tail") return [];
|
|
946
|
+
const hasReasoning =
|
|
947
|
+
item.kind === "turn_cluster"
|
|
948
|
+
? item.sections.some((section) => section.kind === "thinking_preview")
|
|
949
|
+
: item.reasoningSection || item.turnType === "llm";
|
|
950
|
+
return hasReasoning || questionTurnRecordIds.has(item.turnRecordId) ? [item.turnRecordId] : [];
|
|
951
|
+
});
|
|
1231
952
|
}
|
|
1232
953
|
|
|
1233
954
|
export function buildChronicleProjection(
|
|
@@ -1243,9 +964,6 @@ export function buildChronicleProjection(
|
|
|
1243
964
|
? buildPromptItem(displayPromptText, input.promptCreatedAt)
|
|
1244
965
|
: null;
|
|
1245
966
|
const triggeringInputIndex = buildTriggeringInputIndex(input);
|
|
1246
|
-
const durableTurnRecordById = new Map(
|
|
1247
|
-
input.turnRecords.map((turnRecord) => [turnRecord.id, turnRecord]),
|
|
1248
|
-
);
|
|
1249
967
|
const completedTurnRecords = input.turnRecords.filter(
|
|
1250
968
|
(turnRecord) => turnRecord.status === "completed",
|
|
1251
969
|
);
|
|
@@ -1255,7 +973,6 @@ export function buildChronicleProjection(
|
|
|
1255
973
|
const triggeringInput = triggeringInputIndex.get(turnRecord.id) ?? null;
|
|
1256
974
|
return buildTurnClusterItem({
|
|
1257
975
|
turnRecord,
|
|
1258
|
-
turnTrace: input.turnTraceIndex[turnRecord.id],
|
|
1259
976
|
turnTracePreview: input.turnTracePreviewIndex?.[turnRecord.id],
|
|
1260
977
|
terminalStatus: isLast ? resolvedTerminalStatus : null,
|
|
1261
978
|
hasRenderableLeafOutcome: hasRenderableLeafOutcomeForTurn(
|
|
@@ -1263,13 +980,6 @@ export function buildChronicleProjection(
|
|
|
1263
980
|
input.leafOutcomeSnapshots,
|
|
1264
981
|
),
|
|
1265
982
|
triggeringInput,
|
|
1266
|
-
facts: buildTurnFacts({
|
|
1267
|
-
turnId: turnRecord.turnId,
|
|
1268
|
-
durableTurnRecord: durableTurnRecordById.get(turnRecord.id),
|
|
1269
|
-
triggeringInput,
|
|
1270
|
-
actionSource: turnRecord.actionSource,
|
|
1271
|
-
runDetails: input.runDetails,
|
|
1272
|
-
}),
|
|
1273
983
|
initialUserInputText: input.initialUserInputText,
|
|
1274
984
|
});
|
|
1275
985
|
});
|
|
@@ -1303,22 +1013,10 @@ export function buildChronicleProjection(
|
|
|
1303
1013
|
const liveTail = buildLiveTail({
|
|
1304
1014
|
turnRecord: activeTurnRecord,
|
|
1305
1015
|
activeTurn: input.activeTurn,
|
|
1306
|
-
turnTrace: activeTurnRecord ? input.turnTraceIndex[activeTurnRecord.id] : undefined,
|
|
1307
1016
|
turnTracePreview: activeTurnRecord
|
|
1308
1017
|
? input.turnTracePreviewIndex?.[activeTurnRecord.id]
|
|
1309
1018
|
: undefined,
|
|
1310
1019
|
triggeringInput: liveTailTriggeringInput,
|
|
1311
|
-
facts: activeTurnRecord
|
|
1312
|
-
? buildTurnFacts({
|
|
1313
|
-
turnId: activeTurnRecord.turnId,
|
|
1314
|
-
durableTurnRecord: durableTurnRecordById.get(activeTurnRecord.id),
|
|
1315
|
-
activeTurn: input.activeTurn ?? null,
|
|
1316
|
-
triggeringInput: liveTailTriggeringInput,
|
|
1317
|
-
actionSource: activeTurnRecord.actionSource,
|
|
1318
|
-
runDetails: input.runDetails,
|
|
1319
|
-
})
|
|
1320
|
-
: null,
|
|
1321
|
-
runDetails: input.runDetails,
|
|
1322
1020
|
initialUserInputText: input.initialUserInputText,
|
|
1323
1021
|
});
|
|
1324
1022
|
const terminalRailItem = buildTerminalRailItem(resolvedTerminalStatus);
|