@monotykamary/dsh-client-ui-trajectory 0.1.0-rc.5
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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +17 -0
- package/README.zh.md +17 -0
- package/lib/client.js +7370 -0
- package/lib/index.js +6 -0
- package/lib/invariant.js +25 -0
- package/lib/types/client/TrajectoryCell.d.ts +10 -0
- package/lib/types/client/TrajectoryGroupHeader.d.ts +13 -0
- package/lib/types/client/TrajectoryTable.d.ts +100 -0
- package/lib/types/client/TrajectoryTimeline.d.ts +24 -0
- package/lib/types/client/TrajectoryToolbar.d.ts +34 -0
- package/lib/types/client/TrajectoryTurn.d.ts +14 -0
- package/lib/types/client/TrajectoryTurnHeader.d.ts +11 -0
- package/lib/types/client/TrajectoryView.d.ts +14 -0
- package/lib/types/client/duration-store.d.ts +7 -0
- package/lib/types/client/index.d.ts +14 -0
- package/lib/types/client/layout.d.ts +41 -0
- package/lib/types/client/locales.d.ts +16 -0
- package/lib/types/client/timeline.d.ts +50 -0
- package/lib/types/client/trajectory-assistant-definition.d.ts +8 -0
- package/lib/types/client/trajectory-compaction-definition.d.ts +8 -0
- package/lib/types/client/trajectory-contract.d.ts +64 -0
- package/lib/types/client/trajectory-definition-common.d.ts +12 -0
- package/lib/types/client/trajectory-message-definitions.d.ts +8 -0
- package/lib/types/client/trajectory-preview.d.ts +8 -0
- package/lib/types/client/trajectory-record.d.ts +105 -0
- package/lib/types/client/trajectory-request-header-definition.d.ts +8 -0
- package/lib/types/client/trajectory-search-index.d.ts +20 -0
- package/lib/types/client/trajectory-snapshot-builder.d.ts +29 -0
- package/lib/types/client/trajectory-tool-definition.d.ts +8 -0
- package/lib/types/client/trajectory-virtual-rows.d.ts +34 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +86 -0
package/lib/index.js
ADDED
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for `@monotykamary/dsh-client-ui-trajectory`.
|
|
4
|
+
* @module @monotykamary/dsh-client-ui-trajectory/invariant
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@monotykamary/dsh-client-ui-trajectory";
|
|
7
|
+
/** Cordis companion plugin name. */
|
|
8
|
+
const name = "client-ui-trajectory-invariant";
|
|
9
|
+
/** Service required before the companion can reserve package ownership. */
|
|
10
|
+
const inject = ["invariants"];
|
|
11
|
+
/**
|
|
12
|
+
* No runtime invariant: a pure-consumer plugin — it emits no cordis events
|
|
13
|
+
* and owns no mutable cross-plugin state; its view-slot registration is a
|
|
14
|
+
* plain effect whose disposal the slot ledger's own specs and this
|
|
15
|
+
* package's behavior specs observe directly.
|
|
16
|
+
*/
|
|
17
|
+
const install = () => {};
|
|
18
|
+
/**
|
|
19
|
+
* Register this package's invariant companion.
|
|
20
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
21
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
22
|
+
*/
|
|
23
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
24
|
+
//#endregion
|
|
25
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { formatElapsedSeconds, type TrajectoryCellProps } from './trajectory-record.ts';
|
|
2
|
+
export { formatElapsedSeconds };
|
|
3
|
+
export type { AssistantMetricDetail, TrajectoryCellKind, TrajectoryCellProps, } from './trajectory-record.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Render one trajectory step cell.
|
|
6
|
+
* @param props - index, kind, text, time, and optional Message metrics.
|
|
7
|
+
* @returns the cell element.
|
|
8
|
+
*/
|
|
9
|
+
export declare function TrajectoryCell({ index, kind, text, inputDetail: _inputDetail, promptDetail: _promptDetail, previousPromptDetail: _previousPromptDetail, outputDetail: _outputDetail, thinkingDetail: _thinkingDetail, sourceBlocks: _sourceBlocks, outputBlocks: _outputBlocks, schemaDetail: _schemaDetail, assistantMetrics: _assistantMetrics, result: _result, callId: _callId, isError: _isError, timeSeconds, startedAt: _startedAt, input, output, think, selected, className, ...rest }: TrajectoryCellProps): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=TrajectoryCell.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface TrajectoryGroupHeaderProps {
|
|
2
|
+
/** Group title (`Message`, `Step 1`, …). */
|
|
3
|
+
title: string;
|
|
4
|
+
/** Secondary summary (`49 s`, `2.2 s skill`, …). */
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Render a Message/Step group header inside a turn body.
|
|
9
|
+
* @param props - title and optional description.
|
|
10
|
+
* @returns the group header element.
|
|
11
|
+
*/
|
|
12
|
+
export declare function TrajectoryGroupHeader({ title, description }: TrajectoryGroupHeaderProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=TrajectoryGroupHeader.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** Turn-aware trajectory event ledger with a local record inspector. */
|
|
2
|
+
import type { AssistantRequestConfig } from '@monotykamary/dsh-client-runtime/client';
|
|
3
|
+
import type { TrajectoryCellProps } from './trajectory-record.ts';
|
|
4
|
+
import type { TrajectoryTurnModel } from './layout.ts';
|
|
5
|
+
/** Props for the trajectory ledger. */
|
|
6
|
+
export interface TrajectoryTableProps {
|
|
7
|
+
/** Session-global request numbers for the request groups visible in this context. */
|
|
8
|
+
requestNumbers?: readonly TrajectoryRequestNumber[];
|
|
9
|
+
/** Grouped records in display order. */
|
|
10
|
+
turns: readonly TrajectoryTurnModel[];
|
|
11
|
+
/** In-flight cells whose content replaces the matching structural record index. */
|
|
12
|
+
streamingCells?: readonly TrajectoryCellProps[];
|
|
13
|
+
/** Record indexes emphasized by the active timeline focus. */
|
|
14
|
+
timelineFocusIndexes?: ReadonlySet<number> | null;
|
|
15
|
+
/** Record indexes retained by the active live search, or null without a query. */
|
|
16
|
+
searchMatchIndexes?: ReadonlySet<number> | null;
|
|
17
|
+
/** Report the record currently selected in the local inspector. */
|
|
18
|
+
onSelectedIndexChange?: (index: number | null) => void;
|
|
19
|
+
/** Report a direct user selection from a ledger row. */
|
|
20
|
+
onRecordSelect?: (index: number) => void;
|
|
21
|
+
/** One externally requested record selection; a new object repeats the request. */
|
|
22
|
+
recordSelection?: {
|
|
23
|
+
readonly index: number;
|
|
24
|
+
} | null;
|
|
25
|
+
/** One externally requested record focus without changing inspector selection. */
|
|
26
|
+
recordFocus?: {
|
|
27
|
+
readonly index: number;
|
|
28
|
+
} | null;
|
|
29
|
+
/** Whether the initial history tail is still loading. */
|
|
30
|
+
historyLoading?: boolean;
|
|
31
|
+
/** Whether one older history page request is pending anywhere. */
|
|
32
|
+
olderHistoryLoading?: boolean;
|
|
33
|
+
/** First loaded raw event, used to preserve scroll position after prepending a page. */
|
|
34
|
+
historyStartSeq?: number | undefined;
|
|
35
|
+
/** Whether one older history page can be requested. */
|
|
36
|
+
hasOlderRecords?: boolean;
|
|
37
|
+
/** Load one older history page. */
|
|
38
|
+
onLoadOlder?: () => Promise<boolean>;
|
|
39
|
+
/** Clear selection state owned by the ledger host. */
|
|
40
|
+
onClearSelection?: () => void;
|
|
41
|
+
/** Turn ids whose rows after the first are folded into a summary. */
|
|
42
|
+
collapsedTurns: ReadonlySet<number>;
|
|
43
|
+
/** Toggle one turn between folded and expanded. */
|
|
44
|
+
onToggleTurn: (turn: number) => void;
|
|
45
|
+
/** Stable Assistant record ids whose tool calls are folded. */
|
|
46
|
+
collapsedAssistants: ReadonlySet<string>;
|
|
47
|
+
/** Toggle tool calls under one assistant record. */
|
|
48
|
+
onToggleAssistant: (id: string) => void;
|
|
49
|
+
/** One-shot cross-view inspect: open and scroll to this call's record. */
|
|
50
|
+
inspectCallId?: string | null;
|
|
51
|
+
/** Acknowledge a consumed (or unresolvable) inspect request. */
|
|
52
|
+
onInspectApplied?: (() => void) | undefined;
|
|
53
|
+
}
|
|
54
|
+
/** Request-inspector fields shared by ordinary generation and compaction. */
|
|
55
|
+
interface TrajectoryRequestNumberBase {
|
|
56
|
+
/** Request anchor event sequence; absent for the currently streaming ordinary request. */
|
|
57
|
+
seq?: number;
|
|
58
|
+
group: string;
|
|
59
|
+
number: number;
|
|
60
|
+
status?: 'complete' | 'running' | 'error';
|
|
61
|
+
startedAt?: number;
|
|
62
|
+
completedAt?: number | null;
|
|
63
|
+
error?: string;
|
|
64
|
+
retry?: number;
|
|
65
|
+
maxRetries?: number;
|
|
66
|
+
retryDelayMs?: number;
|
|
67
|
+
resultSeq?: number;
|
|
68
|
+
provider?: string;
|
|
69
|
+
model?: string;
|
|
70
|
+
requestConfig?: AssistantRequestConfig;
|
|
71
|
+
usage?: TrajectoryUsage;
|
|
72
|
+
cumulativeUsage?: TrajectoryUsage;
|
|
73
|
+
}
|
|
74
|
+
/** One purpose-discriminated request identity paired with its session-global number. */
|
|
75
|
+
export type TrajectoryRequestNumber = TrajectoryRequestNumberBase & ({
|
|
76
|
+
purpose?: 'assistant';
|
|
77
|
+
turn: number;
|
|
78
|
+
step: number;
|
|
79
|
+
} | {
|
|
80
|
+
purpose: 'compaction';
|
|
81
|
+
turn: number | null;
|
|
82
|
+
step: 0;
|
|
83
|
+
});
|
|
84
|
+
/** Disjoint provider token buckets for one request or a session prefix. */
|
|
85
|
+
export interface TrajectoryUsage {
|
|
86
|
+
input?: number;
|
|
87
|
+
cacheRead?: number;
|
|
88
|
+
cacheWrite?: number;
|
|
89
|
+
output?: number;
|
|
90
|
+
reasoning?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Render trajectory events as a dense ledger with turn and step separators.
|
|
94
|
+
* Clicking ledger whitespace clears the active record or request selection.
|
|
95
|
+
* @param props - Grouped trajectory data and whole-ledger fold state.
|
|
96
|
+
* @returns The ledger and an optional local record inspector.
|
|
97
|
+
*/
|
|
98
|
+
export declare function TrajectoryTable({ requestNumbers: sessionRequestNumbers, turns, streamingCells, timelineFocusIndexes, searchMatchIndexes, onSelectedIndexChange, onRecordSelect, recordSelection, recordFocus, historyLoading, olderHistoryLoading, historyStartSeq, hasOlderRecords, onLoadOlder, onClearSelection, collapsedTurns, onToggleTurn, collapsedAssistants, onToggleAssistant, inspectCallId, onInspectApplied, }: TrajectoryTableProps): import("react").JSX.Element;
|
|
99
|
+
export {};
|
|
100
|
+
//# sourceMappingURL=TrajectoryTable.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Chrome-Network-style overview timeline for focusing the trajectory ledger. */
|
|
2
|
+
import type { TrajectoryTurnModel } from './layout.ts';
|
|
3
|
+
import { type TrajectoryTimelineMode, type TrajectoryTimeRange } from './timeline.ts';
|
|
4
|
+
/** Props for the fixed full-domain overview above the trajectory ledger. */
|
|
5
|
+
export interface TrajectoryTimelineProps {
|
|
6
|
+
turns: readonly TrajectoryTurnModel[];
|
|
7
|
+
mode: TrajectoryTimelineMode;
|
|
8
|
+
range: TrajectoryTimeRange | null;
|
|
9
|
+
/** Whether the loaded timeline omits an earlier history prefix. */
|
|
10
|
+
hasEarlierRecords?: boolean;
|
|
11
|
+
/** Load one earlier history page from the truncation control. */
|
|
12
|
+
onLoadEarlier?: () => Promise<boolean>;
|
|
13
|
+
selectedIndex?: number | null;
|
|
14
|
+
/** Record indexes matching the active ledger search, or null without a query. */
|
|
15
|
+
searchMatchIndexes?: ReadonlySet<number> | null;
|
|
16
|
+
onRangeChange: (range: TrajectoryTimeRange | null) => void;
|
|
17
|
+
/** Select a directly clicked timeline block. */
|
|
18
|
+
onRecordSelect?: (index: number) => void;
|
|
19
|
+
/** Bring the nearest record into view after clicking timeline whitespace. */
|
|
20
|
+
onRecordFocus?: (index: number) => void;
|
|
21
|
+
}
|
|
22
|
+
/** Overview renderer with drag ranges, click-sized focus, and Escape reset. */
|
|
23
|
+
export declare const TrajectoryTimeline: import("react").MemoExoticComponent<({ turns, mode, range, hasEarlierRecords, onLoadEarlier, selectedIndex, searchMatchIndexes, onRangeChange, onRecordSelect, onRecordFocus, }: TrajectoryTimelineProps) => import("react").JSX.Element>;
|
|
24
|
+
//# sourceMappingURL=TrajectoryTimeline.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Trajectory toolbar: timeline and ledger fold controls. */
|
|
2
|
+
import type { TranslateNS } from '@monotykamary/dsh-client-ui-slots';
|
|
3
|
+
import type { NS } from './locales.ts';
|
|
4
|
+
export interface TrajectoryToolbarProps {
|
|
5
|
+
/** Whether timeline blocks use recorded durations instead of equal widths. */
|
|
6
|
+
actualDuration: boolean;
|
|
7
|
+
/** Select recorded-duration or equal-width blocks. */
|
|
8
|
+
onActualDurationChange: (actualDuration: boolean) => void;
|
|
9
|
+
/** Whether recorded timing retains idle gaps between operations. */
|
|
10
|
+
actualTime: boolean;
|
|
11
|
+
/** Select complete wall-clock timing or idle-compressed timing. */
|
|
12
|
+
onActualTimeChange: (actualTime: boolean) => void;
|
|
13
|
+
/** Whether every collapsible turn is currently folded. */
|
|
14
|
+
allTurnsCollapsed: boolean;
|
|
15
|
+
/** Fold or expand every collapsible turn. */
|
|
16
|
+
onToggleAllTurns: () => void;
|
|
17
|
+
/** Whether every collapsible assistant's tool calls are currently folded. */
|
|
18
|
+
allAssistantsCollapsed: boolean;
|
|
19
|
+
/** Fold or expand tool calls under every collapsible assistant. */
|
|
20
|
+
onToggleAllAssistants: () => void;
|
|
21
|
+
/** Current live ledger search query. */
|
|
22
|
+
searchQuery: string;
|
|
23
|
+
/** Update the live ledger search query. */
|
|
24
|
+
onSearchQueryChange: (query: string) => void;
|
|
25
|
+
/** Translate a toolbar dictionary key. */
|
|
26
|
+
t: TranslateNS<typeof NS>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Render the sticky trajectory toolbar.
|
|
30
|
+
* @param props - rendered counts and whole-list fold state.
|
|
31
|
+
* @returns the toolbar element.
|
|
32
|
+
*/
|
|
33
|
+
export declare function TrajectoryToolbar({ actualDuration, onActualDurationChange, actualTime, onActualTimeChange, allTurnsCollapsed, onToggleAllTurns, allAssistantsCollapsed, onToggleAllAssistants, searchQuery, onSearchQueryChange, t, }: TrajectoryToolbarProps): import("react").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=TrajectoryToolbar.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface TrajectoryTurnProps {
|
|
3
|
+
/** 1-based turn index for the sticky header. */
|
|
4
|
+
turn: number;
|
|
5
|
+
/** Message / Step headers and TrajectoryCell rows. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Render one turn section (sticky header + body).
|
|
10
|
+
* @param props - turn index and body children.
|
|
11
|
+
* @returns the turn section element.
|
|
12
|
+
*/
|
|
13
|
+
export declare function TrajectoryTurn({ turn, children }: TrajectoryTurnProps): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=TrajectoryTurn.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface TrajectoryTurnHeaderProps {
|
|
2
|
+
/** 1-based turn index shown as `Turn N`. */
|
|
3
|
+
turn: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Render the sticky turn header row.
|
|
7
|
+
* @param props.turn - turn index.
|
|
8
|
+
* @returns the sticky header element.
|
|
9
|
+
*/
|
|
10
|
+
export declare function TrajectoryTurnHeader({ turn }: TrajectoryTurnHeaderProps): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=TrajectoryTurnHeader.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Trajectory view: compact summary over a turn-aware event ledger. */
|
|
2
|
+
import type { ConvViewProps } from '@monotykamary/dsh-client-ui-conversation/client';
|
|
3
|
+
import type { InjectFace, PropsLocale } from '@monotykamary/dsh-client-ui-slots';
|
|
4
|
+
import type { SnapshotStore } from '@monotykamary/dsh-client-runtime/client';
|
|
5
|
+
/** Session-bound controls not already supplied by the conversation view slot. */
|
|
6
|
+
export interface TrajectoryViewInjected {
|
|
7
|
+
hooks: {
|
|
8
|
+
duration: SnapshotStore<boolean>;
|
|
9
|
+
};
|
|
10
|
+
loadOlder: () => Promise<boolean>;
|
|
11
|
+
setActualDuration: (actualDuration: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function TrajectoryView({ useSession, useDuration, loadOlder, setActualDuration, inspect, onInspectDone, t, }: ConvViewProps & InjectFace<TrajectoryViewInjected> & PropsLocale<'trajectory'>): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=TrajectoryView.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SnapshotStore } from '@monotykamary/dsh-client-runtime/client';
|
|
2
|
+
/**
|
|
3
|
+
* Create the browser-wide trajectory duration preference source.
|
|
4
|
+
* @returns a persisted source shared by every session view in one plugin lifecycle.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createTrajectoryDurationStore(): SnapshotStore<boolean>;
|
|
7
|
+
//# sourceMappingURL=duration-store.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser trajectory plugin contributing one entry to the conversation view
|
|
3
|
+
* slot without defining a service.
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@monotykamary/cordis';
|
|
6
|
+
/** Required services: the conversation slot, registries, ordinary Session paging, and the locale service. */
|
|
7
|
+
export declare const inject: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Client plugin body: register the trajectory view tab. The registration
|
|
10
|
+
* rides the slot service's effect wrapper, so plugin unload removes the tab.
|
|
11
|
+
* @param ctx - client root context.
|
|
12
|
+
*/
|
|
13
|
+
export declare function apply(ctx: Context): void;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trajectory list fold: expand assistant blocks, attach usage to Message,
|
|
3
|
+
* own-duration times, in-flight partial/runningCalls, and group descriptions.
|
|
4
|
+
*/
|
|
5
|
+
import type { ConversationLocation, ConversationSnapshot, RequestInspectionSnapshot, RequestView } from '@monotykamary/dsh-client-runtime/client';
|
|
6
|
+
import type { TrajectoryCellProps } from './trajectory-record.ts';
|
|
7
|
+
/** One Message or Step group inside a turn. */
|
|
8
|
+
export interface TrajectoryGroupModel {
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
cells: readonly TrajectoryCellProps[];
|
|
12
|
+
}
|
|
13
|
+
/** One sticky turn, or a standalone compaction section between turns. */
|
|
14
|
+
export interface TrajectoryTurnModel {
|
|
15
|
+
turn: number | null;
|
|
16
|
+
groups: readonly TrajectoryGroupModel[];
|
|
17
|
+
}
|
|
18
|
+
/** Snapshot slice the trajectory view folds. */
|
|
19
|
+
export interface TrajectoryLayoutInput {
|
|
20
|
+
nodes: ConversationSnapshot['nodes'];
|
|
21
|
+
eventLocations?: ReadonlyMap<number, ConversationLocation>;
|
|
22
|
+
partial: ConversationSnapshot['partial'];
|
|
23
|
+
runningCalls: ConversationSnapshot['runningCalls'];
|
|
24
|
+
requests?: readonly RequestView[];
|
|
25
|
+
callSchemas?: RequestInspectionSnapshot['callSchemas'];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fold a snapshot into turn → Message/Step groups with expanded cells.
|
|
29
|
+
* @param input - nodes plus in-flight partial/runningCalls.
|
|
30
|
+
* @returns turns ordered by first appearance.
|
|
31
|
+
*/
|
|
32
|
+
export declare function deriveTrajectoryLayout(input: TrajectoryLayoutInput): readonly TrajectoryTurnModel[];
|
|
33
|
+
/**
|
|
34
|
+
* Append the changing in-flight assistant cells to a stable finalized layout.
|
|
35
|
+
* @param turns - Finalized layout derived with an empty-block partial anchor.
|
|
36
|
+
* @param partial - Current in-flight assistant projection.
|
|
37
|
+
* @param lastIndex - Highest cell index in the finalized layout.
|
|
38
|
+
* @returns The original layout without a partial, otherwise a layout sharing every unaffected turn.
|
|
39
|
+
*/
|
|
40
|
+
export declare function appendTrajectoryPartialLayout(turns: readonly TrajectoryTurnModel[], partial: ConversationSnapshot['partial'], lastIndex: number): readonly TrajectoryTurnModel[];
|
|
41
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** `trajectory` namespace dictionaries (view tab label + toolbar strings). */
|
|
2
|
+
/** Dictionary namespace owned by this plugin. */
|
|
3
|
+
export declare const NS = "trajectory";
|
|
4
|
+
/** The trajectory dictionary key set (the source of truth for both locales). */
|
|
5
|
+
export type TrajectoryKey = 'view.trajectory' | 'toolbar.aria' | 'toolbar.duration' | 'toolbar.useActualDuration' | 'toolbar.useEqualWidth' | 'toolbar.actualTime' | 'toolbar.turns' | 'toolbar.expandTurns' | 'toolbar.collapseTurns' | 'toolbar.calls' | 'toolbar.expandCalls' | 'toolbar.collapseCalls' | 'toolbar.search' | 'toolbar.searchPlaceholder';
|
|
6
|
+
declare module '@monotykamary/dsh-client-ui-slots' {
|
|
7
|
+
interface LocaleNamespaceMap {
|
|
8
|
+
/** The trajectory view tab label and toolbar strings. */
|
|
9
|
+
'trajectory': TrajectoryKey;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
13
|
+
export declare const zh: Record<TrajectoryKey, string>;
|
|
14
|
+
/** English dictionary. */
|
|
15
|
+
export declare const en: Record<TrajectoryKey, string>;
|
|
16
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Operation-sequence and recorded-time projections for the trajectory overview. */
|
|
2
|
+
import type { TrajectoryTurnModel } from './layout.ts';
|
|
3
|
+
import type { TrajectoryCellKind } from './trajectory-record.ts';
|
|
4
|
+
/** Horizontal projection used by the trajectory timeline. */
|
|
5
|
+
export type TrajectoryTimelineMode = 'sequence' | 'duration' | 'time' | 'actual';
|
|
6
|
+
/** Inclusive selection in the active timeline projection's domain. */
|
|
7
|
+
export interface TrajectoryTimeRange {
|
|
8
|
+
start: number;
|
|
9
|
+
end: number;
|
|
10
|
+
}
|
|
11
|
+
/** One ledger record projected into the active timeline domain. */
|
|
12
|
+
export interface TrajectoryTimelineSpan extends TrajectoryTimeRange {
|
|
13
|
+
index: number;
|
|
14
|
+
isError: boolean;
|
|
15
|
+
kind: TrajectoryCellKind;
|
|
16
|
+
label: string;
|
|
17
|
+
lane: number;
|
|
18
|
+
}
|
|
19
|
+
/** One turn boundary in the active timeline domain. */
|
|
20
|
+
export interface TrajectoryTimelineTurnBoundary {
|
|
21
|
+
turn: number;
|
|
22
|
+
time: number;
|
|
23
|
+
}
|
|
24
|
+
/** Full-domain model used by the overview. */
|
|
25
|
+
export interface TrajectoryTimelineModel extends TrajectoryTimeRange {
|
|
26
|
+
spans: readonly TrajectoryTimelineSpan[];
|
|
27
|
+
turnBoundaries: readonly TrajectoryTimelineTurnBoundary[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Format a timeline duration as an integer-millisecond label.
|
|
31
|
+
* @param milliseconds - Non-negative duration in milliseconds.
|
|
32
|
+
* @returns Millisecond label with thousands separators.
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatTimelineOffset(milliseconds: number): string;
|
|
35
|
+
/**
|
|
36
|
+
* Project every visible record into a stable three-lane timeline.
|
|
37
|
+
* @param turns - Unfiltered trajectory layout.
|
|
38
|
+
* @param mode - Independent equal/recorded duration and compressed/complete time projection.
|
|
39
|
+
* @returns Timeline model, or `null` when no record is visible.
|
|
40
|
+
*/
|
|
41
|
+
export declare function deriveTrajectoryTimeline(turns: readonly TrajectoryTurnModel[], mode?: TrajectoryTimelineMode): TrajectoryTimelineModel | null;
|
|
42
|
+
/**
|
|
43
|
+
* Identify records active at any point inside an inclusive selected interval.
|
|
44
|
+
* @param turns - Unfiltered trajectory layout.
|
|
45
|
+
* @param range - Selected interval in the active projection.
|
|
46
|
+
* @param mode - Independent equal/recorded duration and compressed/complete time projection.
|
|
47
|
+
* @returns Record indexes inside the focus interval.
|
|
48
|
+
*/
|
|
49
|
+
export declare function trajectoryTimelineFocusIndexes(turns: readonly TrajectoryTurnModel[], range: TrajectoryTimeRange, mode?: TrajectoryTimelineMode): ReadonlySet<number>;
|
|
50
|
+
//# sourceMappingURL=timeline.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from '@monotykamary/cordis';
|
|
2
|
+
/**
|
|
3
|
+
* Register the Trajectory Assistant lifecycle.
|
|
4
|
+
*
|
|
5
|
+
* @param ctx - Plugin context receiving the Definitions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerTrajectoryAssistantDefinition(ctx: Context): void;
|
|
8
|
+
//# sourceMappingURL=trajectory-assistant-definition.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from '@monotykamary/cordis';
|
|
2
|
+
/**
|
|
3
|
+
* Register Trajectory compaction requests and session boundaries.
|
|
4
|
+
*
|
|
5
|
+
* @param ctx - Plugin context receiving the Definitions.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerTrajectoryCompactionDefinitions(ctx: Context): void;
|
|
8
|
+
//# sourceMappingURL=trajectory-compaction-definition.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { AssistantMessageNode, ConversationLocation, ConversationNode, ConversationPromptSnapshot, ConversationViewNode, PartialAssistant, RequestPromptChange, RequestView, RunningToolCall, ToolCallBlock } from '@monotykamary/dsh-client-runtime/client';
|
|
2
|
+
/** Request-header facts retained by the Trajectory target. */
|
|
3
|
+
export interface TrajectoryRequestHeaderState {
|
|
4
|
+
readonly seq: number;
|
|
5
|
+
readonly time: number;
|
|
6
|
+
readonly prompt: ConversationPromptSnapshot;
|
|
7
|
+
readonly change?: RequestPromptChange;
|
|
8
|
+
readonly location: ConversationLocation;
|
|
9
|
+
}
|
|
10
|
+
/** One independently assembled contribution to the legacy Trajectory ledger. */
|
|
11
|
+
export type TrajectoryContribution = {
|
|
12
|
+
readonly kind: 'node';
|
|
13
|
+
readonly node: ConversationNode;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'assistant';
|
|
16
|
+
readonly node?: AssistantMessageNode;
|
|
17
|
+
readonly partial: PartialAssistant | null;
|
|
18
|
+
readonly request?: Extract<RequestView, {
|
|
19
|
+
purpose: 'assistant';
|
|
20
|
+
}>;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'tool';
|
|
23
|
+
readonly root: ToolCallBlock;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: 'request-header';
|
|
26
|
+
readonly header: TrajectoryRequestHeaderState;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: 'compaction';
|
|
29
|
+
readonly request: Extract<RequestView, {
|
|
30
|
+
purpose: 'compaction';
|
|
31
|
+
}>;
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: 'session-end';
|
|
34
|
+
readonly seq: number;
|
|
35
|
+
readonly time: number;
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: 'turn-end';
|
|
38
|
+
readonly turn: number;
|
|
39
|
+
readonly time: number;
|
|
40
|
+
readonly error?: string;
|
|
41
|
+
};
|
|
42
|
+
/** Target envelope consumed by the Trajectory snapshot builder. */
|
|
43
|
+
export interface TrajectoryConversationViewNode extends ConversationViewNode {
|
|
44
|
+
readonly target: 'trajectory';
|
|
45
|
+
readonly anchorSeq: number;
|
|
46
|
+
readonly location: ConversationLocation;
|
|
47
|
+
readonly data: TrajectoryContribution;
|
|
48
|
+
}
|
|
49
|
+
/** Stage-oriented Trajectory data assembled from registered business Contexts. */
|
|
50
|
+
export interface TrajectorySnapshot {
|
|
51
|
+
readonly eventNodes: readonly ConversationNode[];
|
|
52
|
+
readonly eventLocations: ReadonlyMap<number, ConversationLocation>;
|
|
53
|
+
readonly requests: readonly RequestView[];
|
|
54
|
+
readonly callSchemas: ReadonlyMap<string, ConversationPromptSnapshot['tools'][number]>;
|
|
55
|
+
readonly partial: PartialAssistant | null;
|
|
56
|
+
readonly runningCalls: readonly RunningToolCall[];
|
|
57
|
+
}
|
|
58
|
+
declare module '@monotykamary/dsh-client-runtime/client' {
|
|
59
|
+
interface ConversationViewSnapshotMap {
|
|
60
|
+
/** Independently assembled data consumed by the Trajectory view. */
|
|
61
|
+
trajectory: TrajectorySnapshot;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=trajectory-contract.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ConversationNodeContext } from '@monotykamary/dsh-client-runtime/client';
|
|
2
|
+
import type { TrajectoryContribution, TrajectoryConversationViewNode } from './trajectory-contract.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Wrap one contribution in the Engine-owned target envelope.
|
|
5
|
+
*
|
|
6
|
+
* @param context - Context that owns the contribution identity.
|
|
7
|
+
* @param anchorSeq - Sequence used to order the contribution.
|
|
8
|
+
* @param data - Trajectory-specific contribution payload.
|
|
9
|
+
* @returns The contribution wrapped as a Trajectory view node.
|
|
10
|
+
*/
|
|
11
|
+
export declare function trajectoryNode(context: ConversationNodeContext, anchorSeq: number, data: TrajectoryContribution): TrajectoryConversationViewNode;
|
|
12
|
+
//# sourceMappingURL=trajectory-definition-common.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from '@monotykamary/cordis';
|
|
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,105 @@
|
|
|
1
|
+
/** Shared trajectory record data and formatting contracts. */
|
|
2
|
+
import type { HTMLAttributes } from 'react';
|
|
3
|
+
import type { ConversationPromptSnapshot } from '@monotykamary/dsh-client-runtime/client';
|
|
4
|
+
/** Closed set of trajectory record kinds. */
|
|
5
|
+
export type TrajectoryCellKind = 'system' | 'user' | 'context' | 'compacted' | 'message' | 'tool' | 'subtool';
|
|
6
|
+
/** Recorded inputs needed to derive assistant TTFT and decode throughput. */
|
|
7
|
+
export interface AssistantMetricDetail {
|
|
8
|
+
timingRecorded: boolean;
|
|
9
|
+
stepStartTime: number | null;
|
|
10
|
+
firstTokenTime: number | null;
|
|
11
|
+
completedTime: number | null;
|
|
12
|
+
usageProvided: boolean;
|
|
13
|
+
outputTokens: number | null;
|
|
14
|
+
}
|
|
15
|
+
/** One source content block preserved in model order for the details panel. */
|
|
16
|
+
export interface TrajectorySourceBlock {
|
|
17
|
+
type: string;
|
|
18
|
+
content: string;
|
|
19
|
+
imageSrc?: string;
|
|
20
|
+
imageAlt?: string;
|
|
21
|
+
callId?: string;
|
|
22
|
+
toolName?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Data and optional presentation attributes for one trajectory record. */
|
|
25
|
+
export interface TrajectoryCellProps extends HTMLAttributes<HTMLDivElement> {
|
|
26
|
+
/** 1-based record index shown as `#N`. */
|
|
27
|
+
index: number;
|
|
28
|
+
/** Projection-stable identity when no single source event owns the record lifecycle. */
|
|
29
|
+
recordId?: string;
|
|
30
|
+
kind: TrajectoryCellKind;
|
|
31
|
+
/** Non-Markdown summary or prefix; CSS ellipsis when it overflows. */
|
|
32
|
+
text: string;
|
|
33
|
+
/** Raw Markdown source converted into the single-line summary at its consumer. */
|
|
34
|
+
previewMarkdown?: string;
|
|
35
|
+
/** Whether this user record opens a new model turn. */
|
|
36
|
+
opensTurn?: boolean;
|
|
37
|
+
/** Source session-event seq for cross-record navigation. */
|
|
38
|
+
sourceSeq?: number;
|
|
39
|
+
/** Producer role and name from a user-role message or context injection. */
|
|
40
|
+
messageSource?: unknown;
|
|
41
|
+
/** Producer-owned model-hidden metadata carried beside the message source. */
|
|
42
|
+
/** A separator-only anchor for an auxiliary request with no visible record. */
|
|
43
|
+
requestOnly?: boolean;
|
|
44
|
+
/** Full request/message content for the details panel. */
|
|
45
|
+
inputDetail?: string;
|
|
46
|
+
/** Complete system-prompt/tool-catalog state introduced by a SYSTEM record. */
|
|
47
|
+
promptDetail?: ConversationPromptSnapshot;
|
|
48
|
+
/** System-prompt/tool-catalog state replaced by a SYSTEM update. */
|
|
49
|
+
previousPromptDetail?: ConversationPromptSnapshot;
|
|
50
|
+
/** Full assistant/tool result content for the details panel. */
|
|
51
|
+
outputDetail?: string;
|
|
52
|
+
/** Full assistant reasoning content for the details panel. */
|
|
53
|
+
thinkingDetail?: string;
|
|
54
|
+
/** Original message blocks in source order for the details panel. */
|
|
55
|
+
sourceBlocks?: readonly TrajectorySourceBlock[];
|
|
56
|
+
/** Original tool result blocks in source order for the details panel. */
|
|
57
|
+
outputBlocks?: readonly TrajectorySourceBlock[];
|
|
58
|
+
/** Call-time model-visible tool schema for the details panel. */
|
|
59
|
+
schemaDetail?: string;
|
|
60
|
+
/** Assistant-only timing and token facts for the details panel. */
|
|
61
|
+
assistantMetrics?: AssistantMetricDetail;
|
|
62
|
+
/** Tool-only result summary paired with the call in the same record. */
|
|
63
|
+
result?: string;
|
|
64
|
+
/** Raw Markdown source converted into the tool-result summary at its consumer. */
|
|
65
|
+
resultPreviewMarkdown?: string;
|
|
66
|
+
/** Tool call id used to link message source blocks to tool records. */
|
|
67
|
+
callId?: string;
|
|
68
|
+
/** Tool-only result failure state. */
|
|
69
|
+
isError?: boolean;
|
|
70
|
+
/** Own duration in seconds, or `null` when no duration is known. */
|
|
71
|
+
timeSeconds: number | null;
|
|
72
|
+
/** Unix epoch milliseconds when this operation actually started, when known. */
|
|
73
|
+
startedAt?: number | null;
|
|
74
|
+
/** Message-only prompt token count. */
|
|
75
|
+
input?: number;
|
|
76
|
+
/** Message-only input tokens served from a provider cache. */
|
|
77
|
+
cacheRead?: number;
|
|
78
|
+
/** Message-only input tokens written into a provider cache. */
|
|
79
|
+
cacheWrite?: number;
|
|
80
|
+
/** Message-only completion token count. */
|
|
81
|
+
output?: number;
|
|
82
|
+
/** Message-only reasoning token count. */
|
|
83
|
+
think?: number;
|
|
84
|
+
/** Whether the legacy standalone cell renders its selection treatment. */
|
|
85
|
+
selected?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolve the identity that survives prepending older projected records.
|
|
89
|
+
* @param cell - Projected trajectory record.
|
|
90
|
+
* @returns Stable identity from the owning event or tool call, with a fixture fallback.
|
|
91
|
+
*/
|
|
92
|
+
export declare function trajectoryRecordId(cell: TrajectoryCellProps): string;
|
|
93
|
+
/**
|
|
94
|
+
* Format a duration in milliseconds with thousands separators.
|
|
95
|
+
* @param milliseconds - Duration in milliseconds, or `null` when absent.
|
|
96
|
+
* @returns `—` when unknown, otherwise an integer-millisecond label.
|
|
97
|
+
*/
|
|
98
|
+
export declare function formatDurationMillis(milliseconds: number | null): string;
|
|
99
|
+
/**
|
|
100
|
+
* Format an elapsed duration given in seconds as a millisecond label.
|
|
101
|
+
* @param seconds - Duration seconds, or `null` when absent.
|
|
102
|
+
* @returns `—` when unknown, otherwise an integer-millisecond label.
|
|
103
|
+
*/
|
|
104
|
+
export declare function formatElapsedSeconds(seconds: number | null): string;
|
|
105
|
+
//# sourceMappingURL=trajectory-record.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from '@monotykamary/cordis';
|
|
2
|
+
/**
|
|
3
|
+
* Register Trajectory request-header facts.
|
|
4
|
+
*
|
|
5
|
+
* @param ctx - Plugin context receiving the Definition.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerTrajectoryRequestHeaderDefinition(ctx: Context): void;
|
|
8
|
+
//# sourceMappingURL=trajectory-request-header-definition.d.ts.map
|