@prettier-ai/dsh-client-ui-trajectory 0.1.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +98 -0
  4. package/README.zh.md +98 -0
  5. package/lib/client.js +8142 -0
  6. package/lib/index.js +6 -0
  7. package/lib/invariant.js +25 -0
  8. package/lib/types/client/TrajectoryCell.d.ts +13 -0
  9. package/lib/types/client/TrajectoryGroupHeader.d.ts +13 -0
  10. package/lib/types/client/TrajectoryTable.d.ts +108 -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 +15 -0
  16. package/lib/types/client/copy-codes.d.ts +4 -0
  17. package/lib/types/client/duration-store.d.ts +7 -0
  18. package/lib/types/client/index.d.ts +16 -0
  19. package/lib/types/client/layout.d.ts +45 -0
  20. package/lib/types/client/locales.d.ts +193 -0
  21. package/lib/types/client/timeline.d.ts +52 -0
  22. package/lib/types/client/trajectory-assistant-definition.d.ts +8 -0
  23. package/lib/types/client/trajectory-compaction-definition.d.ts +8 -0
  24. package/lib/types/client/trajectory-contract.d.ts +87 -0
  25. package/lib/types/client/trajectory-definition-common.d.ts +12 -0
  26. package/lib/types/client/trajectory-event-projection.d.ts +51 -0
  27. package/lib/types/client/trajectory-message-definitions.d.ts +8 -0
  28. package/lib/types/client/trajectory-preview.d.ts +8 -0
  29. package/lib/types/client/trajectory-record.d.ts +108 -0
  30. package/lib/types/client/trajectory-request-header-definition.d.ts +8 -0
  31. package/lib/types/client/trajectory-search-index.d.ts +20 -0
  32. package/lib/types/client/trajectory-snapshot-builder.d.ts +29 -0
  33. package/lib/types/client/trajectory-tool-definition.d.ts +8 -0
  34. package/lib/types/client/trajectory-virtual-rows.d.ts +34 -0
  35. package/lib/types/index.d.ts +4 -0
  36. package/lib/types/invariant.d.ts +16 -0
  37. package/package.json +98 -0
package/lib/index.js ADDED
@@ -0,0 +1,6 @@
1
+ //#region lib/types/index.js
2
+ /** Host loader entry for the browser-only trajectory plugin. */
3
+ /** Provides no host-side behavior. */
4
+ function apply() {}
5
+ //#endregion
6
+ export { apply };
@@ -0,0 +1,25 @@
1
+ //#region lib/types/invariant.js
2
+ /**
3
+ * Package-owned invariant companion for `@prettier-ai/dsh-client-ui-trajectory`.
4
+ * @module @prettier-ai/dsh-client-ui-trajectory/invariant
5
+ */
6
+ const PACKAGE_NAME = "@prettier-ai/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,13 @@
1
+ import { formatElapsedSeconds, type TrajectoryCellProps } from './trajectory-record.ts';
2
+ import type { TrajectoryTranslate } from './locales.ts';
3
+ export { formatElapsedSeconds };
4
+ export type { AssistantMetricDetail, TrajectoryCellKind, TrajectoryCellProps, } from './trajectory-record.ts';
5
+ /**
6
+ * Render one trajectory step cell.
7
+ * @param props - index, kind, text, time, and optional Message metrics.
8
+ * @returns the cell element.
9
+ */
10
+ export declare function TrajectoryCell({ t, 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 & {
11
+ t: TrajectoryTranslate;
12
+ }): import("react").JSX.Element;
13
+ //# 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,108 @@
1
+ /** Turn-aware trajectory event ledger with a local record inspector. */
2
+ import type { AssistantRequestConfig, RenderMessageImages } from '@prettier-ai/dsh-client-ui-conversation/client';
3
+ import type { TrajectoryCellProps } from './trajectory-record.ts';
4
+ import type { TrajectoryTurnModel } from './layout.ts';
5
+ import type { TrajectoryTranslate } from './locales.ts';
6
+ /** Props for the trajectory ledger. */
7
+ export interface TrajectoryTableProps {
8
+ /** Trajectory locale seat. */
9
+ t: TrajectoryTranslate;
10
+ /** Slot-backed durable image renderer shared with the Chat gallery. */
11
+ renderImages: RenderMessageImages;
12
+ /** Session-global request numbers for the request groups visible in this context. */
13
+ requestNumbers?: readonly TrajectoryRequestNumber[];
14
+ /** Grouped records in display order. */
15
+ turns: readonly TrajectoryTurnModel[];
16
+ /** In-flight cells whose content replaces the matching structural record index. */
17
+ streamingCells?: readonly TrajectoryCellProps[];
18
+ /** Record indexes emphasized by the active timeline focus. */
19
+ timelineFocusIndexes?: ReadonlySet<number> | null;
20
+ /** Record indexes retained by the active live search, or null without a query. */
21
+ searchMatchIndexes?: ReadonlySet<number> | null;
22
+ /** Report the record currently selected in the local inspector. */
23
+ onSelectedIndexChange?: (index: number | null) => void;
24
+ /** Report a direct user selection from a ledger row. */
25
+ onRecordSelect?: (index: number) => void;
26
+ /** One externally requested record selection; a new object repeats the request. */
27
+ recordSelection?: {
28
+ readonly index: number;
29
+ } | null;
30
+ /** One externally requested record focus without changing inspector selection. */
31
+ recordFocus?: {
32
+ readonly index: number;
33
+ } | null;
34
+ /** Whether the initial history tail is still loading. */
35
+ historyLoading?: boolean;
36
+ /** Whether one older history page request is pending anywhere. */
37
+ olderHistoryLoading?: boolean;
38
+ /** First loaded raw event, used to preserve scroll position after prepending a page. */
39
+ historyStartSeq?: number | undefined;
40
+ /** Whether one older history page can be requested. */
41
+ hasOlderRecords?: boolean;
42
+ /** Load one older history page. */
43
+ onLoadOlder?: () => Promise<boolean>;
44
+ /** Clear selection state owned by the ledger host. */
45
+ onClearSelection?: () => void;
46
+ /** Turn ids whose rows after the first are folded into a summary. */
47
+ collapsedTurns: ReadonlySet<number>;
48
+ /** Toggle one turn between folded and expanded. */
49
+ onToggleTurn: (turn: number) => void;
50
+ /** Stable Assistant record ids whose tool calls are folded. */
51
+ collapsedAssistants: ReadonlySet<string>;
52
+ /** Toggle tool calls under one assistant record. */
53
+ onToggleAssistant: (id: string) => void;
54
+ /** One-shot cross-view inspect: open and scroll to this call's record. */
55
+ inspectCallId?: string | null;
56
+ /** Acknowledge a consumed (or unresolvable) inspect request. */
57
+ onInspectApplied?: (() => void) | undefined;
58
+ }
59
+ /** Request-inspector fields shared by ordinary generation and compaction. */
60
+ interface TrajectoryRequestNumberBase {
61
+ group: string;
62
+ number: number;
63
+ status?: 'complete' | 'running' | 'error';
64
+ startedAt?: number;
65
+ completedAt?: number | null;
66
+ error?: string;
67
+ errorCode?: string;
68
+ retry?: number;
69
+ maxRetries?: number;
70
+ retryDelayMs?: number;
71
+ resultSeq?: number;
72
+ provider?: string;
73
+ model?: string;
74
+ requestConfig?: AssistantRequestConfig;
75
+ usage?: TrajectoryUsage;
76
+ cumulativeUsage?: TrajectoryUsage;
77
+ }
78
+ /** One purpose-discriminated request identity paired with its session-global number. */
79
+ export type TrajectoryRequestNumber = TrajectoryRequestNumberBase & ({
80
+ purpose?: 'assistant';
81
+ /** Request anchor event sequence; absent for the currently streaming request. */
82
+ seq?: number;
83
+ turn: number;
84
+ step: number;
85
+ } | {
86
+ purpose: 'compaction';
87
+ /** Request anchor event sequence and stable compaction identity. */
88
+ seq: number;
89
+ turn: number | null;
90
+ step: 0;
91
+ });
92
+ /** Disjoint provider token buckets for one request or a session prefix. */
93
+ export interface TrajectoryUsage {
94
+ input?: number;
95
+ cacheRead?: number;
96
+ cacheWrite?: number;
97
+ output?: number;
98
+ reasoning?: number;
99
+ }
100
+ /**
101
+ * Render trajectory events as a dense ledger with turn and step separators.
102
+ * Clicking ledger whitespace clears the active record or request selection.
103
+ * @param props - Grouped trajectory data and whole-ledger fold state.
104
+ * @returns The ledger and an optional local record inspector.
105
+ */
106
+ export declare function TrajectoryTable({ t, renderImages, 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;
107
+ export {};
108
+ //# sourceMappingURL=TrajectoryTable.d.ts.map
@@ -0,0 +1,26 @@
1
+ /** Chrome-Network-style overview timeline for focusing the trajectory ledger. */
2
+ import type { TrajectoryTurnModel } from './layout.ts';
3
+ import type { TrajectoryTranslate } from './locales.ts';
4
+ import { type TrajectoryTimelineMode, type TrajectoryTimeRange } from './timeline.ts';
5
+ /** Props for the fixed full-domain overview above the trajectory ledger. */
6
+ export interface TrajectoryTimelineProps {
7
+ t: TrajectoryTranslate;
8
+ turns: readonly TrajectoryTurnModel[];
9
+ mode: TrajectoryTimelineMode;
10
+ range: TrajectoryTimeRange | null;
11
+ /** Whether the loaded timeline omits an earlier history prefix. */
12
+ hasEarlierRecords?: boolean;
13
+ /** Load one earlier history page from the truncation control. */
14
+ onLoadEarlier?: () => Promise<boolean>;
15
+ selectedIndex?: number | null;
16
+ /** Record indexes matching the active ledger search, or null without a query. */
17
+ searchMatchIndexes?: ReadonlySet<number> | null;
18
+ onRangeChange: (range: TrajectoryTimeRange | null) => void;
19
+ /** Select a directly clicked timeline block. */
20
+ onRecordSelect?: (index: number) => void;
21
+ /** Bring the nearest record into view after clicking timeline whitespace. */
22
+ onRecordFocus?: (index: number) => void;
23
+ }
24
+ /** Overview renderer with drag ranges, click-sized focus, and Escape reset. */
25
+ export declare const TrajectoryTimeline: import("react").MemoExoticComponent<({ t, turns, mode, range, hasEarlierRecords, onLoadEarlier, selectedIndex, searchMatchIndexes, onRangeChange, onRecordSelect, onRecordFocus, }: TrajectoryTimelineProps) => import("react").JSX.Element>;
26
+ //# sourceMappingURL=TrajectoryTimeline.d.ts.map
@@ -0,0 +1,34 @@
1
+ /** Trajectory toolbar: timeline and ledger fold controls. */
2
+ import type { TranslateNS } from '@prettier-ai/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,17 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { TrajectoryTranslate } from './locales.ts';
3
+ export interface TrajectoryTurnProps {
4
+ /** 1-based turn index for the sticky header. */
5
+ turn: number;
6
+ /** Message / Step headers and TrajectoryCell rows. */
7
+ children?: ReactNode;
8
+ /** Trajectory locale seat. */
9
+ t: TrajectoryTranslate;
10
+ }
11
+ /**
12
+ * Render one turn section (sticky header + body).
13
+ * @param props - turn index and body children.
14
+ * @returns the turn section element.
15
+ */
16
+ export declare function TrajectoryTurn({ turn, children, t }: TrajectoryTurnProps): import("react").JSX.Element;
17
+ //# sourceMappingURL=TrajectoryTurn.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { TrajectoryTranslate } from './locales.ts';
2
+ export interface TrajectoryTurnHeaderProps {
3
+ /** 1-based turn index shown as `Turn N`. */
4
+ turn: number;
5
+ /** Trajectory locale seat. */
6
+ t: TrajectoryTranslate;
7
+ }
8
+ /**
9
+ * Render the sticky turn header row.
10
+ * @param props.turn - turn index.
11
+ * @returns the sticky header element.
12
+ */
13
+ export declare function TrajectoryTurnHeader({ turn, t }: TrajectoryTurnHeaderProps): import("react").JSX.Element;
14
+ //# sourceMappingURL=TrajectoryTurnHeader.d.ts.map
@@ -0,0 +1,15 @@
1
+ /** Trajectory view: compact summary over a turn-aware event ledger. */
2
+ import type { ConvViewProps, MessageImageLoader } from '@prettier-ai/dsh-client-ui-conversation/client';
3
+ import type { InjectFace, PropsLocale, PropsRenderSlots } from '@prettier-ai/dsh-client-ui-slots';
4
+ import type { SnapshotStore } from '@prettier-ai/dsh-client-store';
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
+ loadImage: MessageImageLoader;
12
+ setActualDuration: (actualDuration: boolean) => void;
13
+ }
14
+ export declare function TrajectoryView({ useSession, useTrajectory, useDuration, loadOlder, loadImage, setActualDuration, viewRequest, completeViewRequest, renderSlot, t, }: ConvViewProps & PropsRenderSlots<'conversation.trajectory.images'> & InjectFace<TrajectoryViewInjected> & PropsLocale<'trajectory'>): import("react").JSX.Element;
15
+ //# sourceMappingURL=TrajectoryView.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Stable non-display markers for client-synthesized trajectory copy. */
2
+ /** Error marker localized only when the trajectory renders it. */
3
+ export declare const COMPACTION_INTERRUPTED_ERROR = "trajectory.compaction-interrupted";
4
+ //# sourceMappingURL=copy-codes.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { type SnapshotStore } from '@prettier-ai/dsh-client-store';
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,16 @@
1
+ /**
2
+ * Browser trajectory plugin contributing one entry to the conversation view
3
+ * slot without defining a service.
4
+ */
5
+ import type { Context } from '@prettier-ai/cordis';
6
+ export type { TrajectoryKey } from './locales.ts';
7
+ export type { TrajectoryContribution, TrajectoryConversationViewNode, TrajectoryRequestHeaderState, TrajectorySnapshot, UseTrajectory, } from './trajectory-contract.ts';
8
+ /** Required services: the conversation slot, registries, ordinary Session paging, and the locale service. */
9
+ export declare const inject: string[];
10
+ /**
11
+ * Client plugin body: register the trajectory view tab. The registration
12
+ * rides the slot service's effect wrapper, so plugin unload removes the tab.
13
+ * @param ctx - client root context.
14
+ */
15
+ export declare function apply(ctx: Context): void;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,45 @@
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, RequestInspectionSnapshot, RequestView } from '@prettier-ai/dsh-client-ui-conversation/client';
6
+ import type { TrajectoryCellProps } from './trajectory-record.ts';
7
+ import type { TrajectorySnapshot } from './trajectory-contract.ts';
8
+ import type { TrajectoryTranslate } from './locales.ts';
9
+ /** One Message or Step group inside a turn. */
10
+ export interface TrajectoryGroupModel {
11
+ title: string;
12
+ description?: string;
13
+ cells: readonly TrajectoryCellProps[];
14
+ }
15
+ /** One sticky turn, or a standalone compaction section between turns. */
16
+ export interface TrajectoryTurnModel {
17
+ turn: number | null;
18
+ groups: readonly TrajectoryGroupModel[];
19
+ }
20
+ /** Snapshot slice the trajectory view folds. */
21
+ export interface TrajectoryLayoutInput {
22
+ nodes: TrajectorySnapshot['eventNodes'];
23
+ eventLocations?: ReadonlyMap<number, ConversationLocation>;
24
+ partial: TrajectorySnapshot['partial'];
25
+ runningCalls: TrajectorySnapshot['runningCalls'];
26
+ requests?: readonly RequestView[];
27
+ callSchemas?: RequestInspectionSnapshot['callSchemas'];
28
+ }
29
+ /**
30
+ * Fold a snapshot into turn → Message/Step groups with expanded cells.
31
+ * @param input - nodes plus in-flight partial/runningCalls.
32
+ * @param t - Trajectory locale translator.
33
+ * @returns turns ordered by first appearance.
34
+ */
35
+ export declare function deriveTrajectoryLayout(input: TrajectoryLayoutInput, t: TrajectoryTranslate): readonly TrajectoryTurnModel[];
36
+ /**
37
+ * Append the changing in-flight assistant cells to a stable finalized layout.
38
+ * @param turns - Finalized layout derived with an empty-block partial anchor.
39
+ * @param partial - Current in-flight assistant projection.
40
+ * @param lastIndex - Highest cell index in the finalized layout.
41
+ * @param t - Trajectory locale translator.
42
+ * @returns The original layout without a partial, otherwise a layout sharing every unaffected turn.
43
+ */
44
+ export declare function appendTrajectoryPartialLayout(turns: readonly TrajectoryTurnModel[], partial: TrajectorySnapshot['partial'], lastIndex: number, t: TrajectoryTranslate): readonly TrajectoryTurnModel[];
45
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1,193 @@
1
+ /** `trajectory` namespace dictionaries for the complete trajectory surface. */
2
+ /** Dictionary namespace owned by this plugin. */
3
+ export declare const NS = "trajectory";
4
+ /** Simplified Chinese dictionary (the key-set source of truth). */
5
+ export declare const zh: {
6
+ readonly 'view.trajectory': "轨迹";
7
+ readonly 'toolbar.aria': "轨迹工具栏";
8
+ readonly 'toolbar.duration': "时长";
9
+ readonly 'toolbar.useActualDuration': "使用实际时长";
10
+ readonly 'toolbar.useEqualWidth': "使用等宽操作";
11
+ readonly 'toolbar.actualTime': "实际时间";
12
+ readonly 'toolbar.turns': "轮次";
13
+ readonly 'toolbar.expandTurns': "展开所有轮次";
14
+ readonly 'toolbar.collapseTurns': "收起所有轮次";
15
+ readonly 'toolbar.calls': "调用";
16
+ readonly 'toolbar.expandCalls': "展开所有调用";
17
+ readonly 'toolbar.collapseCalls': "收起所有调用";
18
+ readonly 'toolbar.search': "搜索轨迹";
19
+ readonly 'toolbar.searchPlaceholder': "搜索";
20
+ readonly 'kind.system': "系统";
21
+ readonly 'kind.user': "用户";
22
+ readonly 'kind.context': "上下文";
23
+ readonly 'kind.compacted': "已压缩";
24
+ readonly 'kind.message': "消息";
25
+ readonly 'kind.assistant': "助手";
26
+ readonly 'kind.tool': "工具";
27
+ readonly 'kind.subtool': "子工具";
28
+ readonly 'kind.sub': "子项";
29
+ readonly 'column.input': "输入";
30
+ readonly 'column.output': "输出";
31
+ readonly 'column.think': "思考";
32
+ readonly 'column.time': "时间";
33
+ readonly 'column.model': "模型";
34
+ readonly 'column.tools': "工具";
35
+ readonly 'turn.label': "第 {turn} 轮";
36
+ readonly 'section.betweenTurns': "轮次之间";
37
+ readonly 'group.message': "消息";
38
+ readonly 'group.step': "步骤 {step}";
39
+ readonly 'group.compaction': "压缩 {seq}";
40
+ readonly 'status.failed': "失败";
41
+ readonly 'status.pending': "等待中";
42
+ readonly 'status.completed': "已完成";
43
+ readonly 'timing.notAvailable': "不可用";
44
+ readonly 'timing.notRecorded': "未记录";
45
+ readonly 'timing.stepStartUnavailable': "步骤开始时间不可用";
46
+ readonly 'timing.firstTokenUnavailable': "首 token 时间不可用";
47
+ readonly 'timing.usageUnavailable': "用量不可用";
48
+ readonly 'timing.outputTokensUnavailable': "输出 token 数不可用";
49
+ readonly 'timing.durationTooShort': "时长过短";
50
+ readonly 'timing.showLocalTime': "显示本地时间";
51
+ readonly 'timing.showUnixTimestamp': "显示 Unix 时间戳";
52
+ readonly 'timing.started': "开始时间";
53
+ readonly 'timing.totalDuration': "总时长";
54
+ readonly 'timing.ttft': "首 token 延迟";
55
+ readonly 'timing.generation': "生成";
56
+ readonly 'timing.throughput': "吞吐量";
57
+ readonly 'timing.duration': "时长";
58
+ readonly 'timing.source': "计时来源";
59
+ readonly 'timing.sessionTimestamps': "会话时间戳";
60
+ readonly 'timing.sessionTimestampsRunning': "会话时间戳(运行中)";
61
+ readonly 'timing.request': "请求计时";
62
+ readonly 'unit.milliseconds': "{value} 毫秒";
63
+ readonly 'unit.seconds': "{value} 秒";
64
+ readonly 'unit.tokens': "{value} tok";
65
+ readonly 'unit.tokensPerSecond': "{value} tok/s";
66
+ readonly 'usage.tokens': "Token";
67
+ readonly 'usage.reasoning': "推理";
68
+ readonly 'usage.content': "内容";
69
+ readonly 'usage.notReported': "未报告用量";
70
+ readonly 'usage.input': "输入";
71
+ readonly 'usage.cached': "缓存读取";
72
+ readonly 'usage.cacheCreated': "缓存写入";
73
+ readonly 'usage.other': "其他";
74
+ readonly 'usage.output': "输出";
75
+ readonly 'usage.thisRequest': "本次请求";
76
+ readonly 'usage.sessionCumulative': "会话累计";
77
+ readonly 'options.notRecorded': "未记录选项";
78
+ readonly 'options.json': "请求选项 JSON";
79
+ readonly 'source.unknown': "未知";
80
+ readonly 'source.user': "用户";
81
+ readonly 'source.plugin': "插件";
82
+ readonly 'source.pluginNamed': "插件 · {plugin}";
83
+ readonly 'source.goal': "目标";
84
+ readonly 'source.goalRound': "目标 · Round {round}";
85
+ readonly 'source.notRecorded': "未记录来源";
86
+ readonly 'source.messageJson': "消息来源 JSON";
87
+ readonly 'tab.summary': "概述";
88
+ readonly 'tab.rawOutput': "原始输出";
89
+ readonly 'tab.preview': "预览";
90
+ readonly 'tab.raw': "原始内容";
91
+ readonly 'tab.source': "来源";
92
+ readonly 'tab.payload': "参数";
93
+ readonly 'tab.result': "结果";
94
+ readonly 'tab.schema': "Schema";
95
+ readonly 'tab.timing': "计时";
96
+ readonly 'tab.diff': "差异";
97
+ readonly 'tab.systemPrompt': "系统提示词";
98
+ readonly 'tab.tools': "工具";
99
+ readonly 'tab.options': "选项";
100
+ readonly 'tab.usage': "用量";
101
+ readonly 'record.toolCallOnly': "(仅工具调用)";
102
+ readonly 'record.noContent': "无内容";
103
+ readonly 'record.noPayload': "未捕获参数";
104
+ readonly 'record.noResult': "未捕获结果";
105
+ readonly 'record.noOutput': "无输出";
106
+ readonly 'record.schemaUnavailable': "Schema 不可用";
107
+ readonly 'record.parameters': "参数";
108
+ readonly 'record.resultJson': "结果 JSON";
109
+ readonly 'record.json': "JSON";
110
+ readonly 'record.parametersJson': "参数 JSON";
111
+ readonly 'record.namedParametersJson': "{name} 参数 JSON";
112
+ readonly 'record.payloadJson': "参数 JSON";
113
+ readonly 'record.outputJson': "结果 JSON";
114
+ readonly 'record.thinking': "思考";
115
+ readonly 'record.systemPromptMissing': "本次请求没有系统提示词";
116
+ readonly 'record.toolsMissing': "本次请求没有工具";
117
+ readonly 'record.systemPrompt': "系统提示词";
118
+ readonly 'record.tools': "工具";
119
+ readonly 'block.openSummary': "打开第 {index} 个块的工具调用概述";
120
+ readonly 'block.openSummaryTitle': "打开工具调用概述";
121
+ readonly 'block.label': "块 #{index} {type}";
122
+ readonly 'history.loadingTrajectory': "正在加载轨迹…";
123
+ readonly 'history.loadingEarlier': "正在加载更早的历史…";
124
+ readonly 'history.loadingEarlierAria': "正在加载更早的历史…";
125
+ readonly 'history.loadEarlier': "加载更早的历史";
126
+ readonly 'history.clickToLoadEarlier': "点击加载更早的历史";
127
+ readonly 'request.label': "请求 #{request}";
128
+ readonly 'request.labelCompaction': "请求 #{request} · 压缩";
129
+ readonly 'request.compaction': "压缩 · {section}";
130
+ readonly 'request.compactionPurpose': "压缩";
131
+ readonly 'request.retryProgress': "{retry}/{maximum}";
132
+ readonly 'request.collapsedSummary': "已收起的{kind}概述,{summary}";
133
+ readonly 'request.collapsedTurn': "轮次";
134
+ readonly 'request.collapsedAssistant': "助手";
135
+ readonly 'request.rowAria': "{request}{kind},{content}";
136
+ readonly 'request.rowPrefix': "请求 {request},";
137
+ readonly 'request.rowAriaCompaction': "请求 {request},压缩";
138
+ readonly 'request.noContent': "无内容";
139
+ readonly 'summary.toolCalls.one': "{count} 个工具调用";
140
+ readonly 'summary.toolCalls.other': "{count} 个工具调用";
141
+ readonly 'summary.steps.one': "{count} 个步骤";
142
+ readonly 'summary.steps.other': "{count} 个步骤";
143
+ readonly 'details.event': "事件详情";
144
+ readonly 'details.resize': "调整事件详情宽度";
145
+ readonly 'details.resizeTitle': "拖动调整大小;双击恢复默认值。";
146
+ readonly 'details.close': "关闭详情";
147
+ readonly 'details.status': "状态";
148
+ readonly 'details.purpose': "用途";
149
+ readonly 'details.provider': "提供方";
150
+ readonly 'details.model': "模型";
151
+ readonly 'details.toolCalls': "工具调用";
152
+ readonly 'details.subtoolCalls': "子工具调用";
153
+ readonly 'details.error': "错误";
154
+ readonly 'details.failure.auth': "API 密钥无效";
155
+ readonly 'details.retry': "重试";
156
+ readonly 'details.scheduled': "已计划";
157
+ readonly 'details.retryDelay': "重试延迟";
158
+ readonly 'details.result': "结果";
159
+ readonly 'details.compacted': "已压缩";
160
+ readonly 'details.assistantMessage': "助手消息";
161
+ readonly 'details.source': "来源";
162
+ readonly 'details.hierarchy': "层级";
163
+ readonly 'details.toolCall': "工具调用";
164
+ readonly 'timeline.aria': "轨迹时间线";
165
+ readonly 'timeline.overviewAria': "时间线概览;水平拖动可聚焦事件";
166
+ readonly 'timeline.noTimingData': "无计时数据";
167
+ readonly 'timeline.total': "总计 {duration}";
168
+ readonly 'timeline.started': "开始于 {time}";
169
+ readonly 'timeline.ttftDecoding': "首 token {ttft} · 解码 {decoding}";
170
+ readonly 'layout.compacting': "正在压缩上下文…";
171
+ readonly 'layout.compactionFailed': "上下文压缩失败";
172
+ readonly 'layout.compacted': "上下文已压缩";
173
+ readonly 'layout.toolCallOnly': "仅工具调用";
174
+ readonly 'layout.imageOnly': "图片 ×{count}";
175
+ readonly 'layout.initialSystemPrompt': "初始系统提示词";
176
+ readonly 'layout.systemPromptUpdated': "系统提示词已更新";
177
+ readonly 'layout.toolsUpdated': "工具已更新";
178
+ readonly 'layout.systemPromptAndToolsUpdated': "系统提示词和工具已更新";
179
+ readonly 'layout.compactionInterrupted': "上下文压缩在完成前被中断。";
180
+ };
181
+ /** The trajectory dictionary key union. */
182
+ export type TrajectoryKey = keyof typeof zh;
183
+ declare module '@prettier-ai/dsh-client-ui-slots' {
184
+ interface LocaleNamespaceMap {
185
+ /** The complete trajectory ledger, timeline, inspector, and toolbar copy. */
186
+ trajectory: TrajectoryKey;
187
+ }
188
+ }
189
+ /** Namespace-bound translator threaded through trajectory presentation code. */
190
+ export type TrajectoryTranslate = import('@prettier-ai/dsh-client-ui-slots').TranslateNS<typeof NS>;
191
+ /** English dictionary, checked complete against the Chinese source of truth. */
192
+ export declare const en: Record<TrajectoryKey, string>;
193
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1,52 @@
1
+ /** Operation-sequence and recorded-time projections for the trajectory overview. */
2
+ import type { TrajectoryTurnModel } from './layout.ts';
3
+ import type { TrajectoryTranslate } from './locales.ts';
4
+ import type { TrajectoryCellKind } from './trajectory-record.ts';
5
+ /** Horizontal projection used by the trajectory timeline. */
6
+ export type TrajectoryTimelineMode = 'sequence' | 'duration' | 'time' | 'actual';
7
+ /** Inclusive selection in the active timeline projection's domain. */
8
+ export interface TrajectoryTimeRange {
9
+ start: number;
10
+ end: number;
11
+ }
12
+ /** One ledger record projected into the active timeline domain. */
13
+ export interface TrajectoryTimelineSpan extends TrajectoryTimeRange {
14
+ index: number;
15
+ isError: boolean;
16
+ kind: TrajectoryCellKind;
17
+ label: string;
18
+ lane: number;
19
+ }
20
+ /** One turn boundary in the active timeline domain. */
21
+ export interface TrajectoryTimelineTurnBoundary {
22
+ turn: number;
23
+ time: number;
24
+ }
25
+ /** Full-domain model used by the overview. */
26
+ export interface TrajectoryTimelineModel extends TrajectoryTimeRange {
27
+ spans: readonly TrajectoryTimelineSpan[];
28
+ turnBoundaries: readonly TrajectoryTimelineTurnBoundary[];
29
+ }
30
+ /**
31
+ * Format a timeline duration as an integer-millisecond label.
32
+ * @param milliseconds - Non-negative duration in milliseconds.
33
+ * @param t - Trajectory locale translator.
34
+ * @returns Millisecond label with thousands separators.
35
+ */
36
+ export declare function formatTimelineOffset(milliseconds: number, t: TrajectoryTranslate): string;
37
+ /**
38
+ * Project every visible record into a stable three-lane timeline.
39
+ * @param turns - Unfiltered trajectory layout.
40
+ * @param mode - Independent equal/recorded duration and compressed/complete time projection.
41
+ * @returns Timeline model, or `null` when no record is visible.
42
+ */
43
+ export declare function deriveTrajectoryTimeline(turns: readonly TrajectoryTurnModel[], mode?: TrajectoryTimelineMode): TrajectoryTimelineModel | null;
44
+ /**
45
+ * Identify records active at any point inside an inclusive selected interval.
46
+ * @param turns - Unfiltered trajectory layout.
47
+ * @param range - Selected interval in the active projection.
48
+ * @param mode - Independent equal/recorded duration and compressed/complete time projection.
49
+ * @returns Record indexes inside the focus interval.
50
+ */
51
+ export declare function trajectoryTimelineFocusIndexes(turns: readonly TrajectoryTurnModel[], range: TrajectoryTimeRange, mode?: TrajectoryTimelineMode): ReadonlySet<number>;
52
+ //# sourceMappingURL=timeline.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { Context } from '@prettier-ai/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 '@prettier-ai/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