@qilin-agent/client-ui-trajectory 0.0.0-stage → 3.1.3

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 (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +55 -0
  3. package/README.md +116 -2
  4. package/README.zh.md +117 -0
  5. package/lib/client.js +11838 -0
  6. package/lib/index.js +6 -0
  7. package/lib/types/client/TrajectoryCell.d.ts +13 -0
  8. package/lib/types/client/TrajectoryGraphView.d.ts +37 -0
  9. package/lib/types/client/TrajectoryGroupHeader.d.ts +13 -0
  10. package/lib/types/client/TrajectoryTable.d.ts +111 -0
  11. package/lib/types/client/TrajectoryTimeline.d.ts +26 -0
  12. package/lib/types/client/TrajectoryToolbar.d.ts +34 -0
  13. package/lib/types/client/TrajectoryTurn.d.ts +17 -0
  14. package/lib/types/client/TrajectoryTurnHeader.d.ts +14 -0
  15. package/lib/types/client/TrajectoryView.d.ts +20 -0
  16. package/lib/types/client/code-program.d.ts +19 -0
  17. package/lib/types/client/copy-codes.d.ts +4 -0
  18. package/lib/types/client/duration-store.d.ts +7 -0
  19. package/lib/types/client/index.d.ts +20 -0
  20. package/lib/types/client/layout.d.ts +46 -0
  21. package/lib/types/client/locales.d.ts +293 -0
  22. package/lib/types/client/string-wrapping-store.d.ts +7 -0
  23. package/lib/types/client/timeline.d.ts +52 -0
  24. package/lib/types/client/trajectory-assistant-definition.d.ts +8 -0
  25. package/lib/types/client/trajectory-compaction-definition.d.ts +8 -0
  26. package/lib/types/client/trajectory-contract.d.ts +92 -0
  27. package/lib/types/client/trajectory-definition-common.d.ts +12 -0
  28. package/lib/types/client/trajectory-event-projection.d.ts +51 -0
  29. package/lib/types/client/trajectory-graph-canvas.d.ts +64 -0
  30. package/lib/types/client/trajectory-graph-inspector.d.ts +30 -0
  31. package/lib/types/client/trajectory-graph-layout.d.ts +98 -0
  32. package/lib/types/client/trajectory-graph-tab-definition.d.ts +19 -0
  33. package/lib/types/client/trajectory-graph.d.ts +239 -0
  34. package/lib/types/client/trajectory-message-definitions.d.ts +8 -0
  35. package/lib/types/client/trajectory-preview.d.ts +8 -0
  36. package/lib/types/client/trajectory-record.d.ts +114 -0
  37. package/lib/types/client/trajectory-request-header-definition.d.ts +18 -0
  38. package/lib/types/client/trajectory-search-index.d.ts +20 -0
  39. package/lib/types/client/trajectory-snapshot-builder.d.ts +29 -0
  40. package/lib/types/client/trajectory-tab-definition.d.ts +32 -0
  41. package/lib/types/client/trajectory-tool-definition.d.ts +8 -0
  42. package/lib/types/client/trajectory-virtual-rows.d.ts +34 -0
  43. package/lib/types/index.d.ts +4 -0
  44. package/package.json +81 -3
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Pure layout for the trajectory graph: ledger order becomes the vertical axis
3
+ * and the actor swimlane becomes the horizontal one, so the agent loop reads as
4
+ * the curve that leaves the tool lane and comes back to the model lane.
5
+ *
6
+ * Three lanes run top to bottom, time flowing downward:
7
+ *
8
+ * input (user, context) model (request, assistant) tool (calls, results)
9
+ *
10
+ * Every row holds exactly one record, and a turn boundary reserves a header
11
+ * band above its first row. The layout adapts to its canvas: lane centers
12
+ * stretch with the requested width while the chips grow at half that rate, so
13
+ * a wide pane spreads the swimlanes apart instead of stretching the chips
14
+ * across them. The module decides row heights, lane positions, nested-call
15
+ * offsets, band extents, and one cubic path per edge. It decides no
16
+ * copy and no colour, so it stays free of React and of the locale dictionaries
17
+ * and runs in a plain Node environment.
18
+ */
19
+ import type { TrajectoryGraph, TrajectoryGraphEdgeKind, TrajectoryGraphNode } from './trajectory-graph.ts';
20
+ /** Geometry overrides for one layout pass. */
21
+ export interface TrajectoryGraphLayoutOptions {
22
+ /** Virtual canvas width in SVG user units, clamped into `DEFAULTS.width`..`WIDTH_MAX`. */
23
+ width?: number;
24
+ /** Vertical pitch of one record row. */
25
+ rowHeight?: number;
26
+ /** Node height. */
27
+ nodeHeight?: number;
28
+ /** Vertical space one turn header reserves. */
29
+ bandHeight?: number;
30
+ /** Space above the first row and below the last. */
31
+ padding?: number;
32
+ }
33
+ /** One positioned record. */
34
+ export interface LaidOutGraphNode {
35
+ /** The record this node draws. */
36
+ readonly node: TrajectoryGraphNode;
37
+ /** The record's row, in ledger order — the replay cursor walks these. */
38
+ readonly index: number;
39
+ /** Left edge. */
40
+ readonly x: number;
41
+ /** Top edge. */
42
+ readonly y: number;
43
+ readonly w: number;
44
+ readonly h: number;
45
+ }
46
+ /** One routed edge. */
47
+ export interface LaidOutGraphEdge {
48
+ readonly id: string;
49
+ readonly kind: TrajectoryGraphEdgeKind;
50
+ /** Whether the edge still carries moving data, which drives its animation. */
51
+ readonly live: boolean;
52
+ readonly from: string;
53
+ readonly to: string;
54
+ /** SVG path data, also usable as the motion path of a flowing packet. */
55
+ readonly d: string;
56
+ }
57
+ /** One placed turn band. */
58
+ export interface LaidOutBand {
59
+ /** Turn number, or null for records outside every turn. */
60
+ readonly turn: number | null;
61
+ /** Top edge of the band, above its header when it has one. */
62
+ readonly y: number;
63
+ readonly height: number;
64
+ /** First record index inside the band. */
65
+ readonly from: number;
66
+ /** One past the last record index inside the band. */
67
+ readonly to: number;
68
+ }
69
+ /** The complete laid-out graph. */
70
+ export interface TrajectoryGraphLayout {
71
+ readonly width: number;
72
+ readonly height: number;
73
+ readonly nodes: readonly LaidOutGraphNode[];
74
+ readonly edges: readonly LaidOutGraphEdge[];
75
+ readonly bands: readonly LaidOutBand[];
76
+ /** Center x of each swimlane, in `input, model, tool` order. */
77
+ readonly laneCenters: readonly number[];
78
+ }
79
+ /**
80
+ * Cut a chip label to the width the chip can actually draw.
81
+ *
82
+ * SVG has no text overflow, and a text node wider than its chip bleeds into the
83
+ * neighbouring lane. Counting CJK glyphs as two latin columns keeps both
84
+ * scripts inside the box.
85
+ * @param text - the label.
86
+ * @param maxWidth - available width in user units.
87
+ * @param fontSize - the chip's font size.
88
+ * @returns The label, ellipsized when it does not fit.
89
+ */
90
+ export declare function ellipsize(text: string, maxWidth: number, fontSize: number): string;
91
+ /**
92
+ * Lay out one graph projection.
93
+ * @param graph - the projection to place, already windowed by the caller.
94
+ * @param options - geometry overrides.
95
+ * @returns Positioned nodes, routed edges, and placed turn bands.
96
+ */
97
+ export declare function layoutTrajectoryGraph(graph: TrajectoryGraph, options?: TrajectoryGraphLayoutOptions): TrajectoryGraphLayout;
98
+ //# sourceMappingURL=trajectory-graph-layout.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Stage one of the trajectory-graph tab type: what it IS in the right Sidebar.
3
+ *
4
+ * The type is a page, not a viewer: it claims no address. It opens by kind from
5
+ * the guide page's entry box, and it sits beside the ledger type it draws.
6
+ */
7
+ import type { TranslateNS } from '@qilin-agent/client-locale/client';
8
+ import type { SidebarRightTabDefinition } from '@qilin-agent/client-ui-sidebar-right/client';
9
+ /** The tab kind this package owns under the graph implementation; ctx.sidebarRight.openTab names it. */
10
+ export declare const TRAJECTORY_GRAPH_KIND = "trajectory-graph";
11
+ /** The graph implementation's identity in the tab system, and the key its body registers under. */
12
+ export declare const TRAJECTORY_GRAPH_ID = "@qilin-agent/client-ui-trajectory/graph";
13
+ /**
14
+ * The trajectory-graph type's registry definition.
15
+ * @param t - namespace-bound translate, read fresh on every label call.
16
+ * @returns The definition to register.
17
+ */
18
+ export declare function trajectoryGraphTabDefinition(t: TranslateNS<'trajectory'>): SidebarRightTabDefinition;
19
+ //# sourceMappingURL=trajectory-graph-tab-definition.d.ts.map
@@ -0,0 +1,239 @@
1
+ /**
2
+ * Pure projection from the Trajectory target snapshot to the trajectory graph:
3
+ * one node per ledger record, plus the links the ledger already records.
4
+ *
5
+ * Every edge is read back out of a durable fact, never invented:
6
+ * - `prompt` - the last unconsumed input record (user, steering, context,
7
+ * system prompt, or compaction checkpoint) before a request;
8
+ * - `result` - the record named by `request.resultSeq` (`replacementSeq`
9
+ * for a compaction checkpoint); a request still running reaches
10
+ * the streaming assistant prefix instead;
11
+ * - `dispatch` - an assistant `tool-call` block reaches the tool record its
12
+ * `callId` names;
13
+ * - `subcall` - a tool record reaches each child call it dispatched itself;
14
+ * - `loop` - a settling tool record reaches the next request, which is the
15
+ * agent loop turning back to the model.
16
+ *
17
+ * The module carries no React and no DOM, so it runs in a plain Node
18
+ * environment, and it takes the namespace-bound translate so every string it
19
+ * emits stays locale-owned. A ledger record kind this client does not know
20
+ * degrades to an `unknown` node instead of throwing.
21
+ */
22
+ import type { ImageMediaType } from '@qilin-agent/attachment';
23
+ import type { TrajectoryTranslate } from './locales.ts';
24
+ import type { TrajectorySnapshot } from './trajectory-contract.ts';
25
+ /** Ledger record kinds the graph draws. */
26
+ export type TrajectoryGraphNodeKind =
27
+ /** Loaded system-prompt state. */
28
+ 'system'
29
+ /** A finalized user message. */
30
+ | 'user'
31
+ /** A message admitted from the next-step inbox. */
32
+ | 'steering'
33
+ /** A context injection surfaced in the flow. */
34
+ | 'context'
35
+ /** A slash-command lifecycle. */
36
+ | 'command'
37
+ /** One ordinary model request (an agent-loop step). */
38
+ | 'request'
39
+ /** One compaction provider request. */
40
+ | 'compact-request'
41
+ /** A finalized assistant message. */
42
+ | 'assistant'
43
+ /** The in-flight streaming assistant prefix. */
44
+ | 'partial'
45
+ /** A settled tool result, possibly a sub-call. */
46
+ | 'tool'
47
+ /** A tool call whose result has not landed yet. */
48
+ | 'running-call'
49
+ /** A landed compaction checkpoint. */
50
+ | 'compaction'
51
+ /** A scheduled, started, or cancelled model retry. */
52
+ | 'retry'
53
+ /** A turn that ended in failure. */
54
+ | 'error'
55
+ /** A turn ended by the per-request output-token cap. */
56
+ | 'max-tokens'
57
+ /** A surface event this client does not know. */
58
+ | 'unknown';
59
+ /** The swimlane a node belongs to. */
60
+ export type TrajectoryLane = 'input' | 'model' | 'tool';
61
+ /** Node lifecycle as far as the graph presents it. */
62
+ export type TrajectoryGraphNodeStatus = 'idle' | 'running' | 'complete' | 'error' | 'interrupted';
63
+ /** Chain-of-data edge kinds. */
64
+ export type TrajectoryGraphEdgeKind = 'prompt' | 'result' | 'dispatch' | 'subcall' | 'loop';
65
+ /** Provider token buckets summed from one record's reported usage. */
66
+ export interface TrajectoryTokens {
67
+ input?: number;
68
+ cacheRead?: number;
69
+ cacheWrite?: number;
70
+ output?: number;
71
+ reasoning?: number;
72
+ }
73
+ /** One recorded attachment carried by a record's content or assistant blocks. */
74
+ export interface TrajectoryAttachment {
75
+ readonly kind: 'image' | 'file';
76
+ /** Opaque storage id; never a filesystem path. */
77
+ readonly attachmentId: string;
78
+ /** Recorded display name; images may be unnamed. */
79
+ readonly name?: string;
80
+ /** Exact encoded byte length, when the reference carries it. */
81
+ readonly bytes?: number;
82
+ /** Verified media type, when the reference carries one. */
83
+ readonly mediaType?: ImageMediaType;
84
+ /** Intrinsic pixel dimensions, for images that report them. */
85
+ readonly width?: number;
86
+ readonly height?: number;
87
+ /** An image-offload decision replaced the bytes with placeholder text. */
88
+ readonly offloaded?: boolean;
89
+ }
90
+ /** Structured tool-call facts the inspector renders for tool-lane records. */
91
+ export interface TrajectoryToolDetail {
92
+ readonly name: string;
93
+ /** Provider call id, when the record names one. */
94
+ readonly callId?: string;
95
+ /** Raw JSON arguments, when the call captured any. */
96
+ readonly argsRaw?: string;
97
+ /** Whether the call settled in error. */
98
+ readonly isError?: boolean;
99
+ /** Settled result text, verbatim; absent while the call is unsettled. */
100
+ readonly resultText?: string;
101
+ }
102
+ /** One graph node: one record of the ledger. */
103
+ export interface TrajectoryGraphNode {
104
+ /** Stable identity: `req:<startSeq>`, `ev:<kind>:<seq>`, or `call:<callId>`. */
105
+ readonly id: string;
106
+ readonly kind: TrajectoryGraphNodeKind;
107
+ readonly lane: TrajectoryLane;
108
+ readonly status: TrajectoryGraphNodeStatus;
109
+ /** Ledger order key, fractional for a record synthesized between two events. */
110
+ readonly seq: number;
111
+ /** Unix epoch ms, or 0 when the ledger recorded none. */
112
+ readonly time: number;
113
+ /** Owning turn, or null for a record outside every turn. */
114
+ readonly turn: number | null;
115
+ /** Agent-loop step inside the turn, or null when the ledger records none. */
116
+ readonly step: number | null;
117
+ /** Chip label: the record's own text, or the localized name of its kind. */
118
+ readonly label: string;
119
+ /** Optional chip badge (status, call-id tail, shadowed token count). */
120
+ readonly badge?: string;
121
+ /** Free-form inspector body that is neither arguments nor result. */
122
+ readonly detail?: string;
123
+ /** Ordered attachments carried by the record's content or assistant blocks. */
124
+ readonly attachments?: readonly TrajectoryAttachment[];
125
+ /** Structured tool-call facts, present on tool-lane records. */
126
+ readonly toolDetail?: TrajectoryToolDetail;
127
+ readonly tokens?: TrajectoryTokens;
128
+ /** Wall time between the record's start and completion, when both are recorded. */
129
+ readonly durationMs?: number;
130
+ /** Whether the record is still moving, which drives the flow animation. */
131
+ readonly live: boolean;
132
+ /** Whether the record opens a new turn, which the view marks. */
133
+ readonly opensTurn?: boolean;
134
+ }
135
+ /** One chain-of-data edge. */
136
+ export interface TrajectoryGraphEdge {
137
+ readonly id: string;
138
+ readonly from: string;
139
+ readonly to: string;
140
+ readonly kind: TrajectoryGraphEdgeKind;
141
+ /** Whether data is moving into a live record across this edge. */
142
+ readonly live: boolean;
143
+ }
144
+ /**
145
+ * One contiguous run of ledger records that share a turn, plus the records
146
+ * outside every turn that the run surrounds: a turn-less record never splits
147
+ * the stripe of the turn it sits inside.
148
+ */
149
+ export interface TrajectoryGraphBand {
150
+ /** Turn number, or null for records outside every turn. */
151
+ readonly turn: number | null;
152
+ /** Index of the band's first record. */
153
+ readonly from: number;
154
+ /** One past the index of the band's last record. */
155
+ readonly to: number;
156
+ }
157
+ /** One ledger step, with the edge that delivered the record. */
158
+ export interface TrajectoryTimelineStep {
159
+ readonly nodeId: string;
160
+ /** The incoming edge to animate, or null for a root record. */
161
+ readonly edgeId: string | null;
162
+ /** Unix epoch ms of the record, or 0 when the ledger recorded none. */
163
+ readonly at: number;
164
+ }
165
+ /** Session totals shown above the canvas. */
166
+ export interface TrajectoryGraphStats {
167
+ nodes: number;
168
+ edges: number;
169
+ /** Highest turn number seen, or 0 while no turn has opened. */
170
+ turns: number;
171
+ /** Tool records with an outcome: settled results and in-flight calls; the
172
+ * synthesized waiting placeholders stay uncounted. */
173
+ tools: number;
174
+ running: number;
175
+ errors: number;
176
+ /** Summed provider token buckets; an absent bucket is skipped. */
177
+ tokens: TrajectoryTokens;
178
+ }
179
+ /** The complete graph projection of one trajectory snapshot. */
180
+ export interface TrajectoryGraph {
181
+ /** Nodes in ledger order. */
182
+ readonly nodes: readonly TrajectoryGraphNode[];
183
+ readonly edges: readonly TrajectoryGraphEdge[];
184
+ /** Turn runs over the nodes, by node index. */
185
+ readonly bands: readonly TrajectoryGraphBand[];
186
+ /** Ledger order with the incoming edge per record. */
187
+ readonly timeline: readonly TrajectoryTimelineStep[];
188
+ readonly stats: TrajectoryGraphStats;
189
+ /** Whether any record is still moving. */
190
+ readonly live: boolean;
191
+ }
192
+ /** One windowed view of a projection, for the render cap. */
193
+ export interface TrajectoryGraphWindow {
194
+ graph: TrajectoryGraph;
195
+ /** How many leading records the window dropped. */
196
+ readonly hidden: number;
197
+ }
198
+ /**
199
+ * Project one Trajectory snapshot into the graph model.
200
+ * @param snapshot - the live Trajectory target snapshot, or null while none is assembled.
201
+ * @param t - namespace-bound translate for every string the nodes carry.
202
+ * @returns Nodes in ledger order with their edges, turn bands, timeline, and totals.
203
+ */
204
+ export declare function buildTrajectoryGraph(snapshot: TrajectorySnapshot | null | undefined, t: TrajectoryTranslate): TrajectoryGraph;
205
+ /**
206
+ * Keep only the most recent records, with the edges between them.
207
+ *
208
+ * A session's ledger is unbounded, so the view renders a tail window and
209
+ * reports how many leading records it dropped.
210
+ * @param graph - the full projection.
211
+ * @param limit - maximum records to keep; a non-positive limit keeps none.
212
+ * @returns The windowed graph and the number of dropped leading records.
213
+ */
214
+ export declare function windowTrajectoryGraph(graph: TrajectoryGraph, limit: number): TrajectoryGraphWindow;
215
+ /** One slowest-tools leader. */
216
+ export interface TrajectorySlowTool {
217
+ /** The leader's node id, so a caller can select it. */
218
+ readonly id: string;
219
+ /** The record's chip label (the tool name). */
220
+ readonly name: string;
221
+ /** Recorded wall time in milliseconds. */
222
+ readonly durationMs: number;
223
+ }
224
+ /**
225
+ * The slowest settled tool records, descending by recorded duration.
226
+ * @param graph - the (windowed) graph projection.
227
+ * @param limit - how many leaders to keep; a non-positive limit keeps none.
228
+ * @returns The leaders, longest first; empty when no tool record carries a duration.
229
+ */
230
+ export declare function slowestTools(graph: TrajectoryGraph, limit: number): readonly TrajectorySlowTool[];
231
+ /**
232
+ * Search the graph's records by a case-insensitive substring of the chip
233
+ * label, the node kind, the node id, or a tool record's call id.
234
+ * @param graph - the (windowed) graph projection.
235
+ * @param query - raw user text; a blank query matches nothing.
236
+ * @returns Matching node ids in ledger order, for the search box's cursor to cycle.
237
+ */
238
+ export declare function searchTrajectoryNodes(graph: TrajectoryGraph, query: string): readonly string[];
239
+ //# sourceMappingURL=trajectory-graph.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { Context } from '@qilin-agent/kylin';
2
+ /**
3
+ * Register Trajectory-owned inbox classification and message records.
4
+ *
5
+ * @param ctx - Plugin context receiving the Definitions.
6
+ */
7
+ export declare function registerTrajectoryMessageDefinitions(ctx: Context): void;
8
+ //# sourceMappingURL=trajectory-message-definitions.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** Bounded Markdown-to-text projection shared by trajectory consumers. */
2
+ /**
3
+ * Build a bounded one-line preview without parsing the complete Markdown document.
4
+ * @param text - Untrusted message, reasoning, payload, or result text.
5
+ * @returns A compact preview capped independently from the retained source.
6
+ */
7
+ export declare function trajectoryPreviewText(text: string): string;
8
+ //# sourceMappingURL=trajectory-preview.d.ts.map
@@ -0,0 +1,114 @@
1
+ /** Shared trajectory record data and formatting contracts. */
2
+ import type { HTMLAttributes } from 'react';
3
+ import type { FileAttachmentRef, ImageAttachmentRef } from '@qilin-agent/attachment';
4
+ import type { ConversationPromptSnapshot } from '@qilin-agent/client-ui-conversation/client';
5
+ import type { TrajectoryTranslate } from './locales.ts';
6
+ /** Closed set of trajectory record kinds. */
7
+ export type TrajectoryCellKind = 'system' | 'user' | 'context' | 'compacted' | 'message' | 'tool' | 'subtool';
8
+ /** Recorded inputs needed to derive assistant TTFT and decode throughput. */
9
+ export interface AssistantMetricDetail {
10
+ timingRecorded: boolean;
11
+ stepStartTime: number | null;
12
+ firstTokenTime: number | null;
13
+ completedTime: number | null;
14
+ usageProvided: boolean;
15
+ outputTokens: number | null;
16
+ }
17
+ /** One source content block preserved in model order for the details panel. */
18
+ export interface TrajectorySourceBlock {
19
+ type: string;
20
+ content: string;
21
+ attachment?: ImageAttachmentRef;
22
+ /** Ordinary file metadata; never passed to the image loader. */
23
+ file?: FileAttachmentRef;
24
+ callId?: string;
25
+ toolName?: string;
26
+ }
27
+ /** Data and optional presentation attributes for one trajectory record. */
28
+ export interface TrajectoryCellProps extends HTMLAttributes<HTMLDivElement> {
29
+ /** 1-based record index shown as `#N`. */
30
+ index: number;
31
+ /** Projection-stable identity when no single source event owns the record lifecycle. */
32
+ recordId?: string;
33
+ kind: TrajectoryCellKind;
34
+ /** Non-Markdown summary or prefix; CSS ellipsis when it overflows. */
35
+ text: string;
36
+ /** Raw Markdown source converted into the single-line summary at its consumer. */
37
+ previewMarkdown?: string;
38
+ /** Whether this user record opens a new model turn. */
39
+ opensTurn?: boolean;
40
+ /** Source session-event seq for cross-record navigation. */
41
+ sourceSeq?: number;
42
+ /** Producer role and name from a user-role message or context injection. */
43
+ messageSource?: unknown;
44
+ /** Producer-owned model-hidden metadata carried beside the message source. */
45
+ /** A separator-only anchor for an auxiliary request with no visible record. */
46
+ requestOnly?: boolean;
47
+ /** Full request/message content for the details panel. */
48
+ inputDetail?: string;
49
+ /** Complete system-prompt/tool-catalog state introduced by a SYSTEM record. */
50
+ promptDetail?: ConversationPromptSnapshot;
51
+ /** Known prompt text without a loaded request config or tool catalog. */
52
+ systemPromptDetail?: string;
53
+ /** System-prompt/tool-catalog state replaced by a SYSTEM update. */
54
+ previousPromptDetail?: ConversationPromptSnapshot;
55
+ /** Full assistant/tool result content for the details panel. */
56
+ outputDetail?: string;
57
+ /** Full assistant reasoning content for the details panel. */
58
+ thinkingDetail?: string;
59
+ /** Original message blocks in source order for the details panel. */
60
+ sourceBlocks?: readonly TrajectorySourceBlock[];
61
+ /** Original tool result blocks in source order for the details panel. */
62
+ outputBlocks?: readonly TrajectorySourceBlock[];
63
+ /** Call-time model-visible tool schema for the details panel. */
64
+ schemaDetail?: string;
65
+ /** Assistant-only timing and token facts for the details panel. */
66
+ assistantMetrics?: AssistantMetricDetail;
67
+ /** Tool-only result summary paired with the call in the same record. */
68
+ result?: string;
69
+ /** Raw Markdown source converted into the tool-result summary at its consumer. */
70
+ resultPreviewMarkdown?: string;
71
+ /** Tool call id used to link message source blocks to tool records. */
72
+ callId?: string;
73
+ /** Recorded tool name; independent of the display summary. */
74
+ toolName?: string;
75
+ /** Tool-only result failure state. */
76
+ isError?: boolean;
77
+ /** Own duration in seconds, or `null` when no duration is known. */
78
+ timeSeconds: number | null;
79
+ /** Unix epoch milliseconds when this operation actually started, when known. */
80
+ startedAt?: number | null;
81
+ /** Message-only prompt token count. */
82
+ input?: number;
83
+ /** Message-only input tokens served from a provider cache. */
84
+ cacheRead?: number;
85
+ /** Message-only input tokens written into a provider cache. */
86
+ cacheWrite?: number;
87
+ /** Message-only completion token count. */
88
+ output?: number;
89
+ /** Message-only reasoning token count. */
90
+ think?: number;
91
+ /** Whether the legacy standalone cell renders its selection treatment. */
92
+ selected?: boolean;
93
+ }
94
+ /**
95
+ * Resolve the identity that survives prepending older projected records.
96
+ * @param cell - Projected trajectory record.
97
+ * @returns Stable identity from the owning event or tool call, with a fixture fallback.
98
+ */
99
+ export declare function trajectoryRecordId(cell: TrajectoryCellProps): string;
100
+ /**
101
+ * Format a duration in milliseconds with thousands separators.
102
+ * @param milliseconds - Duration in milliseconds, or `null` when absent.
103
+ * @param t - Trajectory locale translator.
104
+ * @returns `—` when unknown, otherwise an integer-millisecond label.
105
+ */
106
+ export declare function formatDurationMillis(milliseconds: number | null, t: TrajectoryTranslate): string;
107
+ /**
108
+ * Format an elapsed duration given in seconds as a millisecond label.
109
+ * @param seconds - Duration seconds, or `null` when absent.
110
+ * @param t - Trajectory locale translator.
111
+ * @returns `—` when unknown, otherwise an integer-millisecond label.
112
+ */
113
+ export declare function formatElapsedSeconds(seconds: number | null, t: TrajectoryTranslate): string;
114
+ //# sourceMappingURL=trajectory-record.d.ts.map
@@ -0,0 +1,18 @@
1
+ import type { Context } from '@qilin-agent/kylin';
2
+ import type { SystemPromptState } from '@qilin-agent/client-ui-conversation/client';
3
+ import type { TrajectoryRequestHeaderState } from './trajectory-contract.ts';
4
+ /** Loaded system surface plus the latest request facts changed by an append or compaction. */
5
+ export interface TrajectorySystemMessageState extends SystemPromptState {
6
+ /**
7
+ * Latest synthetic header, retained across unrelated replacements. Only the
8
+ * Context whose start seq equals this header's seq contributes a view Node.
9
+ */
10
+ readonly header?: TrajectoryRequestHeaderState;
11
+ }
12
+ /**
13
+ * Register Trajectory system-prompt node and request-header facts.
14
+ *
15
+ * @param ctx - Plugin context receiving the Definitions.
16
+ */
17
+ export declare function registerTrajectoryRequestHeaderDefinition(ctx: Context): void;
18
+ //# sourceMappingURL=trajectory-request-header-definition.d.ts.map
@@ -0,0 +1,20 @@
1
+ /** Incremental full-text index for the trajectory ledger. */
2
+ import type { TrajectoryTurnModel } from './layout.ts';
3
+ /** Session-view-local index that reparses Markdown only when one record's source changes. */
4
+ export declare class TrajectorySearchIndex {
5
+ private readonly entries;
6
+ private layouts;
7
+ /**
8
+ * Incrementally synchronize one or more current trajectory layout slices.
9
+ * @param layouts - Finalized and optional streaming layouts from the same view.
10
+ * @returns Whether the indexed layout version changed.
11
+ */
12
+ update(layouts: readonly (readonly TrajectoryTurnModel[])[]): boolean;
13
+ /**
14
+ * Match a query against the latest committed index version.
15
+ * @param query - Space-separated case-insensitive search terms.
16
+ * @returns Matching stable record identities, or `null` without a query.
17
+ */
18
+ search(query: string): ReadonlySet<string> | null;
19
+ }
20
+ //# sourceMappingURL=trajectory-search-index.d.ts.map
@@ -0,0 +1,29 @@
1
+ import type { Context } from '@qilin-agent/kylin';
2
+ import type { ConversationViewBuilder, ConversationViewDefinition } from '@qilin-agent/client-ui-conversation/client';
3
+ import type { TrajectoryConversationViewNode, TrajectorySnapshot } from './trajectory-contract.ts';
4
+ /** Stable empty target used until a Session has assembled Trajectory records. */
5
+ export declare const EMPTY_TRAJECTORY_SNAPSHOT: TrajectorySnapshot;
6
+ /** Simple keyed adapter retaining the old Trajectory snapshot and stage layout. */
7
+ export declare class TrajectorySnapshotBuilder implements ConversationViewBuilder<TrajectoryConversationViewNode, TrajectorySnapshot> {
8
+ private readonly nodes;
9
+ private readonly positions;
10
+ private contributions;
11
+ readonly empty: TrajectorySnapshot;
12
+ replace(input: {
13
+ readonly nodes: readonly TrajectoryConversationViewNode[];
14
+ }): TrajectorySnapshot;
15
+ apply(input: {
16
+ readonly upserts: readonly TrajectoryConversationViewNode[];
17
+ }): TrajectorySnapshot;
18
+ private snapshot;
19
+ private rebuildContributions;
20
+ }
21
+ /** Trajectory target factory preserving the existing stage-oriented view model. */
22
+ export declare const trajectoryViewDefinition: ConversationViewDefinition<TrajectoryConversationViewNode, TrajectorySnapshot>;
23
+ /**
24
+ * Register the stage-oriented Trajectory target builder.
25
+ *
26
+ * @param ctx - Plugin context receiving the view Definition.
27
+ */
28
+ export declare function registerTrajectoryConversationView(ctx: Context): void;
29
+ //# sourceMappingURL=trajectory-snapshot-builder.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Stage one of the trajectory tab type: what it IS in the right Sidebar.
3
+ *
4
+ * The type is a page, not a viewer: it claims no address, and it offers no
5
+ * guide entry, so the Sidebar never lists the ledger beside the graph. It opens
6
+ * by kind from the two actions that ask for it: a Chat tool card's inspect
7
+ * action, which addresses the call to focus through `params.focus`, and the
8
+ * graph page's Ledger control.
9
+ */
10
+ import type { SidebarRightTabDefinition } from '@qilin-agent/client-ui-sidebar-right/client';
11
+ import type { TranslateNS } from '@qilin-agent/client-locale/client';
12
+ /** The tab kind this package owns; `ctx.sidebarRight.openTab` names it. */
13
+ export declare const TRAJECTORY_KIND = "trajectory";
14
+ /** This implementation's identity in the tab system, and the key its body registers under. */
15
+ export declare const TRAJECTORY_ID = "@qilin-agent/client-ui-trajectory/trajectory";
16
+ /** Navigation parameters the trajectory page accepts: the tool-call identity to focus. */
17
+ export interface TrajectoryTabParams {
18
+ readonly focus?: string;
19
+ }
20
+ declare module '@qilin-agent/client-ui-sidebar-right/client' {
21
+ interface SidebarRightTabParamsMap {
22
+ /** The trajectory page focuses the ledger on this call when opened from Chat. */
23
+ trajectory: TrajectoryTabParams;
24
+ }
25
+ }
26
+ /**
27
+ * The trajectory type's registry definition.
28
+ * @param t - namespace-bound translate, read fresh on every label call.
29
+ * @returns the definition to register.
30
+ */
31
+ export declare function trajectoryTabDefinition(t: TranslateNS<'trajectory'>): SidebarRightTabDefinition;
32
+ //# sourceMappingURL=trajectory-tab-definition.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { Context } from '@qilin-agent/kylin';
2
+ /**
3
+ * Register the Trajectory Tool lifecycle with raw native and PTC error details.
4
+ *
5
+ * @param ctx - Plugin context receiving the Definition.
6
+ */
7
+ export declare function registerTrajectoryToolDefinition(ctx: Context): void;
8
+ //# sourceMappingURL=trajectory-tool-definition.d.ts.map
@@ -0,0 +1,34 @@
1
+ /** Pure projection from trajectory records to measurable virtual ledger rows. */
2
+ import type { TrajectoryCellProps } from './trajectory-record.ts';
3
+ /** Minimal record shape required by the trajectory virtual-row projection. */
4
+ export interface VirtualizableTrajectoryRecord {
5
+ cell: TrajectoryCellProps;
6
+ collapsedSummaryKind?: 'turn' | 'assistant';
7
+ }
8
+ /** One logical record retained inside a measurable virtual row. */
9
+ export interface TrajectoryVirtualRowEntry<T extends VirtualizableTrajectoryRecord> {
10
+ logicalIndex: number;
11
+ record: T;
12
+ }
13
+ /** One virtualizer item, which may carry zero-height request boundaries. */
14
+ export interface TrajectoryVirtualRow<T extends VirtualizableTrajectoryRecord> {
15
+ entries: readonly TrajectoryVirtualRowEntry<T>[];
16
+ height: number;
17
+ key: string;
18
+ }
19
+ /**
20
+ * Derive the DOM-safe row identity shared by React, the virtualizer, and
21
+ * browser scroll contracts.
22
+ * @param record - Display record whose identity is required.
23
+ * @returns Stable record identity with a suffix for synthetic fold summaries.
24
+ */
25
+ export declare function trajectoryVirtualRecordKey(record: VirtualizableTrajectoryRecord): string;
26
+ /**
27
+ * Attach separator-only records to the next content row so the virtualizer
28
+ * never owns a zero-height item. A terminal separator retains its CSS-owned
29
+ * lower-marker clearance as a standalone item.
30
+ * @param records - Final search/fold projection in ledger order.
31
+ * @returns Measurable virtual rows with original logical positions retained.
32
+ */
33
+ export declare function groupTrajectoryVirtualRows<T extends VirtualizableTrajectoryRecord>(records: readonly T[]): readonly TrajectoryVirtualRow<T>[];
34
+ //# sourceMappingURL=trajectory-virtual-rows.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Host loader entry for the browser-only trajectory plugin. */
2
+ /** Provides no host-side behavior. */
3
+ export declare function apply(): void;
4
+ //# sourceMappingURL=index.d.ts.map