@prettier-ai/dsh-client-ui-chat 0.1.2-alpha.2 → 0.1.2-alpha.4
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/README.i18n.yaml +2 -2
- package/README.md +13 -2
- package/README.zh.md +13 -2
- package/lib/client.js +848 -355
- package/lib/types/client/chat/ChatNodeSeat.d.ts +3 -2
- package/lib/types/client/chat/ChatView.d.ts +1 -1
- package/lib/types/client/chat/MessageItem.d.ts +5 -5
- package/lib/types/client/chat/TurnNavigator.d.ts +11 -6
- package/lib/types/client/chat/turn-rail-items.d.ts +37 -0
- package/lib/types/client/chat/use-turn-data.d.ts +9 -0
- package/lib/types/client/contract/slots.d.ts +18 -5
- package/lib/types/client/contract/snapshot.d.ts +27 -0
- package/lib/types/client/contract/store.d.ts +1 -2
- package/lib/types/client/contract/turn-process.d.ts +5 -20
- package/lib/types/client/conversation-nodes/inbox.d.ts +18 -9
- package/lib/types/client/conversation-nodes/turn-process-presentation.d.ts +30 -0
- package/lib/types/client/conversation-nodes/turn-process.d.ts +5 -3
- package/lib/types/client/index.d.ts +2 -2
- package/lib/types/client/locale.d.ts +2 -0
- package/lib/types/client/stores.d.ts +2 -3
- package/package.json +28 -33
- package/lib/invariant.js +0 -16
- package/lib/types/client/chat/use-throttled-visual-update.d.ts +0 -8
- package/lib/types/invariant.d.ts +0 -13
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { ChatNodeOwnerProps, ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
2
|
interface ChatNodeSeatProps extends ChatNodeOwnerProps {
|
|
3
3
|
readonly nodeKey: string;
|
|
4
|
+
readonly useChatNode: ChatViewSlotProps['useChatNode'];
|
|
5
|
+
readonly useChatNodeProcess: ChatViewSlotProps['useChatNodeProcess'];
|
|
4
6
|
readonly historyIncomplete: boolean;
|
|
5
7
|
readonly compactTranscript: boolean;
|
|
6
|
-
readonly useChat: ChatViewSlotProps['useChat'];
|
|
7
8
|
readonly useStore: ChatViewSlotProps['useStore'];
|
|
8
9
|
readonly actions: ChatViewSlotProps['actions'];
|
|
9
10
|
readonly renderSlot: ChatViewSlotProps['renderSlot'];
|
|
10
11
|
readonly t: ChatViewSlotProps['t'];
|
|
11
12
|
}
|
|
12
13
|
/** Subscribe, apply Turn-process visibility, and dispatch one stable Context key. */
|
|
13
|
-
export declare const ChatNodeSeat: import("react").MemoExoticComponent<({ nodeKey, historyIncomplete, compactTranscript, selectedCallId, cwd, openFile, inspectCall, forkAt, renderMessageImages, fileMentions,
|
|
14
|
+
export declare const ChatNodeSeat: import("react").MemoExoticComponent<({ nodeKey, useChatNode, useChatNodeProcess, historyIncomplete, compactTranscript, selectedCallId, cwd, openFile, inspectCall, forkAt, renderMessageImages, fileMentions, useStore, actions, renderSlot, t, }: ChatNodeSeatProps) => import("react").JSX.Element | null>;
|
|
14
15
|
export {};
|
|
15
16
|
//# sourceMappingURL=ChatNodeSeat.d.ts.map
|
|
@@ -3,5 +3,5 @@ import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
|
3
3
|
* The chat view slot entry: pure component over the composed props; each
|
|
4
4
|
* ordered business Node crosses the keyed renderer seat.
|
|
5
5
|
*/
|
|
6
|
-
export declare function ChatView({ useSession, useChat, useSessions, useStore, actions, renderSlot, sessionId, openFile, loadOlder, loadImage, openView, chatScroll, forkAt, fileMentions, useTranscriptView, t, }: ChatViewSlotProps): import("react").JSX.Element;
|
|
6
|
+
export declare function ChatView({ useSession, useChat, useChatNode, useChatNodeProcess, useSessions, useStore, actions, renderSlot, sessionId, openFile, loadOlder, loadThrough, loadImage, openView, chatScroll, forkAt, fileMentions, useTranscriptView, useProjection, t, }: ChatViewSlotProps): import("react").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=ChatView.d.ts.map
|
|
@@ -13,10 +13,10 @@ export declare function PendingSteeringBubble({ content, renderMessageImages, t
|
|
|
13
13
|
t: ChatViewSlotProps['t'];
|
|
14
14
|
}): ReactNode;
|
|
15
15
|
/**
|
|
16
|
-
* Render one local submission echo with the
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Render one local transcript or steering submission echo with the same
|
|
17
|
+
* visual language and surface marker as the Host occurrence that replaces
|
|
18
|
+
* it: draft text plus object-URL previews, visible from the submit click
|
|
19
|
+
* until the durable `user/message` or steering occurrence renders.
|
|
20
20
|
* @param props - the session snapshot's pending submission and render seats.
|
|
21
21
|
* @returns the echoed user bubble.
|
|
22
22
|
*/
|
|
@@ -26,7 +26,7 @@ export declare function PendingSubmissionBubble({ submission, renderMessageImage
|
|
|
26
26
|
t: ChatViewSlotProps['t'];
|
|
27
27
|
}): ReactNode;
|
|
28
28
|
/** User and admitted-steering keyed Chat renderer. */
|
|
29
|
-
export declare const UserMessageNodeView: import("react").MemoExoticComponent<({ node, renderMessageImages,
|
|
29
|
+
export declare const UserMessageNodeView: import("react").MemoExoticComponent<({ node, renderMessageImages, t, }: ChatNodeViewProps<"user" | "steering">) => import("react").JSX.Element>;
|
|
30
30
|
/** Injected-context keyed Chat renderer. */
|
|
31
31
|
export declare const ContextMessageNodeView: import("react").MemoExoticComponent<({ node, t }: ChatNodeViewProps<"context">) => import("react").JSX.Element>;
|
|
32
32
|
/** Automatic compaction keyed Chat renderer. */
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { ChatViewSlotProps } from '../contract/slots.ts';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TurnRailItem } from './turn-rail-items.ts';
|
|
3
3
|
interface TurnNavigatorProps {
|
|
4
|
-
readonly items: readonly
|
|
4
|
+
readonly items: readonly TurnRailItem[];
|
|
5
5
|
readonly activeTurn: number | null;
|
|
6
|
-
|
|
6
|
+
/** Turn whose jump is still paging history in; its mark pulses. */
|
|
7
|
+
readonly busyTurn: number | null;
|
|
8
|
+
readonly onNavigate: (item: TurnRailItem) => void;
|
|
7
9
|
readonly t: ChatViewSlotProps['t'];
|
|
8
10
|
}
|
|
9
|
-
declare function TurnNavigatorRail({ items, activeTurn, onNavigate, t }: TurnNavigatorProps): import("react").JSX.Element | null;
|
|
11
|
+
declare function TurnNavigatorRail({ items, activeTurn, busyTurn, onNavigate, t }: TurnNavigatorProps): import("react").JSX.Element | null;
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
13
|
+
* Fixed-pitch rail of every known Turn — loaded marks scroll, unloaded marks
|
|
14
|
+
* page history in first — with hover and focus previews. Overflow scrolls
|
|
15
|
+
* inside the frame, gradient fades marking each scrollable end, and the
|
|
16
|
+
* active mark keeps itself in view while the pointer is elsewhere.
|
|
12
17
|
*
|
|
13
|
-
* Memoized because it renders two host elements per
|
|
18
|
+
* Memoized because it renders two host elements per Turn while the
|
|
14
19
|
* enclosing view re-renders on every streaming delta: without the guard a long
|
|
15
20
|
* session rebuilds hundreds of marks per commit for a rail that only changes
|
|
16
21
|
* when a Turn is added, removed, or becomes active. Its props must therefore
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View-layer union of the host turn outline and the loaded rail items. The
|
|
3
|
+
* conversation snapshot never carries projection values, so this merge is the
|
|
4
|
+
* one place the rail's two sources meet: the `turnOutline` projection names
|
|
5
|
+
* every turn of the session, and the loaded window supplies anchors and
|
|
6
|
+
* richer previews for the turns it holds.
|
|
7
|
+
*/
|
|
8
|
+
import { SessionSeq } from '@prettier-ai/dsh-session/types';
|
|
9
|
+
import type { TurnNavigationItem } from '../contract/snapshot.ts';
|
|
10
|
+
/** One rail mark: a loaded Turn scrolls to its row; an unloaded one pages history through its seq first. */
|
|
11
|
+
export interface TurnRailItem {
|
|
12
|
+
readonly turn: number;
|
|
13
|
+
/** Bounded prompt preview (loaded window first, outline fallback). */
|
|
14
|
+
readonly prompt: string;
|
|
15
|
+
/** Bounded response preview (loaded window first, outline fallback). */
|
|
16
|
+
readonly response: string;
|
|
17
|
+
/** How the rail reaches the Turn. */
|
|
18
|
+
readonly anchor: {
|
|
19
|
+
readonly kind: 'loaded';
|
|
20
|
+
readonly key: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'unloaded';
|
|
23
|
+
readonly seq: SessionSeq;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Merge the host outline with the loaded rail items into the full ladder.
|
|
28
|
+
* A turn present in both sides keeps the loaded anchor, taking an outline
|
|
29
|
+
* preview only where the window's own is empty (a mid-Turn window head, or a
|
|
30
|
+
* turn whose loaded nodes carry no text); turns on one side only pass
|
|
31
|
+
* through. Result ascends by turn.
|
|
32
|
+
* @param loaded - loaded-window rail items (timeline order).
|
|
33
|
+
* @param outline - `turnOutline` projection value, treated as wire data.
|
|
34
|
+
* @returns every known turn, ascending; a stable empty array when none.
|
|
35
|
+
*/
|
|
36
|
+
export declare function mergeTurnRailItems(loaded: readonly TurnNavigationItem[], outline: unknown): readonly TurnRailItem[];
|
|
37
|
+
//# sourceMappingURL=turn-rail-items.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ConversationLocationDataStore, ConversationTurnDataMap } from '@prettier-ai/dsh-client-ui-conversation/client';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribe to one value from a Turn's keyed Location-data store.
|
|
4
|
+
* @param data - current Turn data store, or absence for a Node outside a Turn.
|
|
5
|
+
* @param key - declaration-merged business key.
|
|
6
|
+
* @returns the current value for that key.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useTurnDataValue<Key extends Extract<keyof ConversationTurnDataMap, string>>(data: ConversationLocationDataStore<ConversationTurnDataMap> | undefined, key: Key): Readonly<ConversationTurnDataMap[Key]> | undefined;
|
|
9
|
+
//# sourceMappingURL=use-turn-data.d.ts.map
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/** Chat-owned Slot declarations and composed component props. */
|
|
2
2
|
import type { MessageId } from '@prettier-ai/dsh-llm/brand';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { SessionSeq } from '@prettier-ai/dsh-session/types';
|
|
4
|
+
import type { ConversationLocationDataStore, ConversationTurnDataMap, MessageImageLoader, MessageImagesOwnerProps, RenderMessageImages, TurnLocation } from '@prettier-ai/dsh-client-ui-conversation/client';
|
|
5
|
+
import type { InjectFace, KeyedSnapshotSelectorHook, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore, SlotHookFactory, SnapshotSelectorHook } from '@prettier-ai/dsh-client-ui-slots';
|
|
5
6
|
import type { SnapshotStore } from '@prettier-ai/dsh-client-store';
|
|
6
7
|
import type { MarkdownFileMentions } from '@prettier-ai/dsh-client-ui-primitives';
|
|
7
8
|
import type { createChatStore } from '../stores.ts';
|
|
8
9
|
import type { ToolCallId, SelectionTarget } from './store.ts';
|
|
9
|
-
import type { ChatNode, ChatNodeKind } from './chat-nodes.ts';
|
|
10
|
-
import type { ChatSnapshot, CommandNode, CompactionSummaryNode, ToolCallBlock } from './snapshot.ts';
|
|
10
|
+
import type { ChatConversationViewNode, ChatNode, ChatNodeKind } from './chat-nodes.ts';
|
|
11
|
+
import type { ChatNodeProcessSource, ChatNodeSource, ChatSnapshot, ChatTurnProcessPresentation, CommandNode, CompactionSummaryNode, ToolCallBlock } from './snapshot.ts';
|
|
11
12
|
import type { TurnProcessSpec } from './turn-process.ts';
|
|
12
13
|
import type { TranscriptViewMode } from '../../chat-settings.ts';
|
|
13
14
|
/** Selector hook over the current Conversation binding's Chat target. */
|
|
14
15
|
export type UseChat = SnapshotSelectorHook<ChatSnapshot>;
|
|
16
|
+
/** Per-key selector hook over one Chat Node. */
|
|
17
|
+
export type UseChatNode = KeyedSnapshotSelectorHook<ChatConversationViewNode | undefined>;
|
|
18
|
+
/** Per-key selector hook over one Chat Node's Turn-process presentation. */
|
|
19
|
+
export type UseChatNodeProcess = KeyedSnapshotSelectorHook<ChatTurnProcessPresentation | undefined>;
|
|
15
20
|
/** Owner currency of the completed-Turn extension chain. */
|
|
16
21
|
export interface TurnTailOwnerProps {
|
|
17
22
|
turn: TurnLocation;
|
|
@@ -92,9 +97,17 @@ export interface ChatViewInjected {
|
|
|
92
97
|
/** Persisted completed-Turn transcript presentation. */
|
|
93
98
|
transcriptView: SnapshotStore<TranscriptViewMode>;
|
|
94
99
|
};
|
|
100
|
+
keyedHooks: {
|
|
101
|
+
/** Resolve the stable source for one Chat Node key. */
|
|
102
|
+
chatNode: (key: string) => ChatNodeSource;
|
|
103
|
+
/** Resolve the stable Turn-process source for one Chat Node key. */
|
|
104
|
+
chatNodeProcess: (key: string) => ChatNodeProcessSource;
|
|
105
|
+
};
|
|
95
106
|
openDetails: (target: SelectionTarget) => void;
|
|
96
107
|
openFile: (path: string) => Promise<void>;
|
|
97
108
|
loadOlder: () => void;
|
|
109
|
+
/** Jump loader: page history back through seq; resolves when the window covers it. */
|
|
110
|
+
loadThrough: (seq: SessionSeq) => Promise<void>;
|
|
98
111
|
loadImage: MessageImageLoader;
|
|
99
112
|
chatScroll: {
|
|
100
113
|
save: (position: ChatScrollPosition | null) => void;
|
|
@@ -137,7 +150,7 @@ declare module '@prettier-ai/dsh-client-ui-slots' {
|
|
|
137
150
|
node: ChatNode<Kind>;
|
|
138
151
|
};
|
|
139
152
|
};
|
|
140
|
-
hookContext:
|
|
153
|
+
hookContext: ConversationLocationDataStore<ConversationTurnDataMap> | undefined;
|
|
141
154
|
inject: ChatNodeTurnDataInjected;
|
|
142
155
|
};
|
|
143
156
|
/**
|
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
import type { ConversationNode, ConversationTimelineSnapshot, PartialAssistant, RunningToolCall } from '@prettier-ai/dsh-client-ui-conversation/client';
|
|
2
2
|
import type { ChatConversationViewNode } from './chat-nodes.ts';
|
|
3
|
+
import type { TurnProcessSpec } from './turn-process.ts';
|
|
3
4
|
export type { AssistantBlock, AssistantMessageNode, AssistantProvenanceView, AssistantRequestConfig, AssistantTiming, CommandNode, CompactionSummaryNode, ContextMessageNode, ConversationNode, ModelRetryNode, PartialAssistant, RunningToolCall, SteeringMessageNode, TodoItem, ToolCallBlock, ToolResultNode, TurnErrorNode, TurnMaxTokensNode, UnknownSurfaceNode, UserMessageNode, } from '@prettier-ai/dsh-client-ui-conversation/client';
|
|
5
|
+
/** Per-key observable used by one mounted Chat Node Seat. */
|
|
6
|
+
export interface ChatNodeSource {
|
|
7
|
+
/** @returns the current Node for this source's stable key. */
|
|
8
|
+
readonly getSnapshot: () => ChatConversationViewNode | undefined;
|
|
9
|
+
/** @param listener - callback for changes to this key. @returns the unsubscribe function. */
|
|
10
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
11
|
+
}
|
|
12
|
+
/** Per-key observable for the Turn-process presentation surrounding one Chat Node. */
|
|
13
|
+
export interface ChatNodeProcessSource {
|
|
14
|
+
/** @returns the current presentation, or absence outside a projected Turn process. */
|
|
15
|
+
readonly getSnapshot: () => ChatTurnProcessPresentation | undefined;
|
|
16
|
+
/** @param listener - callback for presentation changes. @returns the unsubscribe function. */
|
|
17
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
18
|
+
}
|
|
4
19
|
/** Stable live per-key reader for Chat nodes. */
|
|
5
20
|
export interface ChatNodeStore {
|
|
6
21
|
/** @param key - stable Conversation Context key. @returns current Node, when visible or hidden. */
|
|
7
22
|
get(key: string): ChatConversationViewNode | undefined;
|
|
23
|
+
/** @param key - stable Conversation Context key. @returns its identity-stable observable source. */
|
|
24
|
+
source(key: string): ChatNodeSource;
|
|
25
|
+
/** @param key - stable Conversation Context key. @returns its Turn-process presentation source. */
|
|
26
|
+
processSource(key: string): ChatNodeProcessSource;
|
|
8
27
|
/** @returns all currently materialized Nodes without imposing render order. */
|
|
9
28
|
values(): readonly ChatConversationViewNode[];
|
|
10
29
|
}
|
|
@@ -35,6 +54,14 @@ export interface ChatLocationNodeIndex {
|
|
|
35
54
|
/** @param turn - owning turn. @param step - owning step. @returns ordered Chat Node keys in the step. */
|
|
36
55
|
getStep(turn: number, step: number): readonly string[];
|
|
37
56
|
}
|
|
57
|
+
/** Cross-Node presentation facts derived for one Turn process. */
|
|
58
|
+
export interface ChatTurnProcessPresentation {
|
|
59
|
+
readonly turn: number;
|
|
60
|
+
readonly spec: TurnProcessSpec;
|
|
61
|
+
readonly turnClosed: boolean;
|
|
62
|
+
readonly hasExternalProcess: boolean;
|
|
63
|
+
readonly compactAnswer: boolean;
|
|
64
|
+
}
|
|
38
65
|
/** Compatibility projection backing StatsLine and the legacy top-level snapshot fields. */
|
|
39
66
|
export interface LegacyConversationSlice {
|
|
40
67
|
readonly nodes: readonly ConversationNode[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** Chat-owned selection state shared by the transcript and details panel. */
|
|
2
|
-
import type { TurnProcessGeneration } from './turn-process.ts';
|
|
3
2
|
/** Tool call identity as carried by Chat nodes. */
|
|
4
3
|
export type ToolCallId = string;
|
|
5
4
|
/** Selection target for the Chat details linkage channel. */
|
|
@@ -12,7 +11,7 @@ export interface SelectionTarget {
|
|
|
12
11
|
/** One manually expanded Turn answer generation. */
|
|
13
12
|
export interface TurnProcessViewEntry {
|
|
14
13
|
readonly turn: number;
|
|
15
|
-
readonly
|
|
14
|
+
readonly answerStep: number;
|
|
16
15
|
}
|
|
17
16
|
/** Per-Session state shared only by the Chat view and details surface. */
|
|
18
17
|
export interface ChatStoreState {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/** Turn-local process window encoded as a reference-stable Location-data scalar. */
|
|
2
|
-
export type TurnProcessSignature = string;
|
|
3
|
-
/** Stable identity of one finalized answer generation, independent of its exact ordering anchor. */
|
|
4
|
-
export type TurnProcessGeneration = string;
|
|
5
1
|
/** Current process range and finalized answer boundary derived from one Turn. */
|
|
6
2
|
export interface TurnProcessSpec {
|
|
7
3
|
readonly turn: number;
|
|
@@ -21,23 +17,12 @@ export interface TurnProcessSpec {
|
|
|
21
17
|
/** Chat Node kinds that remain independent of a Turn's process disclosure. */
|
|
22
18
|
export declare const TURN_PROCESS_INDEPENDENT_KINDS: ReadonlySet<string>;
|
|
23
19
|
/**
|
|
24
|
-
*
|
|
25
|
-
* @param
|
|
26
|
-
* @
|
|
20
|
+
* Compare immutable Turn-process specifications by their published fields.
|
|
21
|
+
* @param left - previous specification.
|
|
22
|
+
* @param right - next specification.
|
|
23
|
+
* @returns whether both values describe the same process presentation.
|
|
27
24
|
*/
|
|
28
|
-
export declare function
|
|
29
|
-
/**
|
|
30
|
-
* Encode one process specification as a primitive Location-data value.
|
|
31
|
-
* @param spec - current Turn process specification.
|
|
32
|
-
* @returns reference-stable scalar for equal specifications.
|
|
33
|
-
*/
|
|
34
|
-
export declare function encodeTurnProcess(spec: TurnProcessSpec): TurnProcessSignature;
|
|
35
|
-
/**
|
|
36
|
-
* Decode a same-process signature produced by {@link encodeTurnProcess}.
|
|
37
|
-
* @param signature - encoded Turn process value.
|
|
38
|
-
* @returns decoded process specification.
|
|
39
|
-
*/
|
|
40
|
-
export declare function decodeTurnProcess(signature: TurnProcessSignature): TurnProcessSpec;
|
|
25
|
+
export declare function sameTurnProcessSpec(left: TurnProcessSpec, right: TurnProcessSpec): boolean;
|
|
41
26
|
/**
|
|
42
27
|
* Recognize the shipped subagent delegation name and its configured variants.
|
|
43
28
|
* Control tools use distinct names such as `send_message` and `list_agents`.
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import type { Context } from '@prettier-ai/cordis';
|
|
2
2
|
import type { ConversationNodeDefinition } from '@prettier-ai/dsh-client-ui-conversation/client';
|
|
3
|
-
interface
|
|
4
|
-
readonly
|
|
3
|
+
interface PendingSnapshot {
|
|
4
|
+
readonly kind: 'snapshot';
|
|
5
|
+
readonly ids: readonly string[];
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
interface PendingSplice {
|
|
8
|
+
readonly kind: 'splice';
|
|
9
|
+
readonly previous: PendingState;
|
|
10
|
+
readonly start: number;
|
|
11
|
+
readonly removedCount: number;
|
|
12
|
+
readonly inserted: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
type PendingState = PendingSnapshot | PendingSplice;
|
|
15
|
+
/** Persistent next-step state after one durable Inbox splice. */
|
|
7
16
|
export interface InboxState {
|
|
8
|
-
|
|
9
|
-
readonly
|
|
17
|
+
/** Persistent splice chain materialized only when a next-step batch is claimed. */
|
|
18
|
+
readonly pending: PendingState;
|
|
19
|
+
/** Message ids in the current claim, shared until the next claim. */
|
|
20
|
+
readonly currentClaimed: ReadonlySet<string>;
|
|
10
21
|
}
|
|
11
|
-
/**
|
|
12
|
-
export declare const nextTurnInboxDefinition: ConversationNodeDefinition<InboxState>;
|
|
13
|
-
/** Cumulative next-step inbox splice Definition used to classify steering. */
|
|
22
|
+
/** Persistent next-step Inbox state used to classify the current claimed batch as steering. */
|
|
14
23
|
export declare const nextStepInboxDefinition: ConversationNodeDefinition<InboxState>;
|
|
15
24
|
/**
|
|
16
|
-
* Register the
|
|
25
|
+
* Register the next-step Inbox state used by Chat message classification.
|
|
17
26
|
* @param ctx - owning UI Conversation context.
|
|
18
27
|
*/
|
|
19
28
|
export declare function registerInboxConversationNodes(ctx: Context): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ChatNode } from '../contract/chat-nodes.ts';
|
|
2
|
+
import type { ChatLocationNodeIndex, ChatNodeStore, ChatTurnProcessPresentation } from '../contract/snapshot.ts';
|
|
3
|
+
/** Mutable projection of cross-Node process layout facts by Turn. */
|
|
4
|
+
export declare class ChatTurnProcessProjector {
|
|
5
|
+
private presentations;
|
|
6
|
+
/**
|
|
7
|
+
* Read the retained process presentation for a Node's Turn.
|
|
8
|
+
* @param node - Current Chat Node.
|
|
9
|
+
* @returns The Turn's process presentation, when present.
|
|
10
|
+
*/
|
|
11
|
+
get(node: ChatNode | undefined): ChatTurnProcessPresentation | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Replace every projected Turn.
|
|
14
|
+
* @param order - visible Chat Node order.
|
|
15
|
+
* @param locations - current Chat Location index.
|
|
16
|
+
* @param nodes - current Chat Node store.
|
|
17
|
+
* @returns Turns whose process presentation changed.
|
|
18
|
+
*/
|
|
19
|
+
replace(order: readonly string[], locations: ChatLocationNodeIndex, nodes: ChatNodeStore): ReadonlySet<number>;
|
|
20
|
+
/**
|
|
21
|
+
* Recompute selected Turns after incremental Node changes.
|
|
22
|
+
* @param turns - affected Turn numbers.
|
|
23
|
+
* @param locations - current Chat Location index.
|
|
24
|
+
* @param nodes - current Chat Node store.
|
|
25
|
+
* @returns Turns whose process presentation changed.
|
|
26
|
+
*/
|
|
27
|
+
update(turns: ReadonlySet<number>, locations: ChatLocationNodeIndex, nodes: ChatNodeStore): ReadonlySet<number>;
|
|
28
|
+
private set;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=turn-process-presentation.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from '@prettier-ai/cordis';
|
|
2
2
|
import type { ConversationNodeDefinition } from '@prettier-ai/dsh-client-ui-conversation/client';
|
|
3
|
-
import { type
|
|
3
|
+
import { type TurnProcessSpec } from '../contract/turn-process.ts';
|
|
4
4
|
declare module '../contract/chat-nodes.ts' {
|
|
5
5
|
interface ChatNodeDataMap {
|
|
6
6
|
/** Turn-level disclosure controlling process rows before the finalized answer. */
|
|
@@ -9,8 +9,8 @@ declare module '../contract/chat-nodes.ts' {
|
|
|
9
9
|
}
|
|
10
10
|
declare module '@prettier-ai/dsh-client-ui-conversation/client' {
|
|
11
11
|
interface ConversationTurnDataMap {
|
|
12
|
-
/**
|
|
13
|
-
'turn-process':
|
|
12
|
+
/** Process range and finalized answer boundary for this Turn. */
|
|
13
|
+
'turn-process': TurnProcessSpec;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
interface TurnProcessState {
|
|
@@ -18,6 +18,8 @@ interface TurnProcessState {
|
|
|
18
18
|
readonly assistantStartByStep: ReadonlyMap<number, number>;
|
|
19
19
|
readonly messageCountByStep: ReadonlyMap<number, number>;
|
|
20
20
|
readonly otherStartSeq?: number;
|
|
21
|
+
readonly controlAnchorSeq?: number;
|
|
22
|
+
readonly messageCount: number;
|
|
21
23
|
readonly toolCallCount: number;
|
|
22
24
|
readonly subagentCount: number;
|
|
23
25
|
}
|
|
@@ -12,13 +12,13 @@ export type {} from './conversation-nodes/turn-error.ts';
|
|
|
12
12
|
export type {} from './conversation-nodes/turn-max-tokens.ts';
|
|
13
13
|
export type {} from './conversation-nodes/turn-process.ts';
|
|
14
14
|
export type {} from './conversation-nodes/turn-tail.ts';
|
|
15
|
-
export type { AssistantBlock, AssistantMessageNode, AssistantProvenanceView, AssistantRequestConfig, AssistantTiming, ChatLocationNodeIndex, ChatNodeStore, ChatSnapshot, ChatTurnNavigationIndex, CommandNode, CompactionSummaryNode, ContextMessageNode, ConversationNode, LegacyConversationSlice, ModelRetryNode, PartialAssistant, RunningToolCall, SteeringMessageNode, ToolCallBlock, ToolResultNode, TurnErrorNode, TurnMaxTokensNode, TurnNavigationItem, UnknownSurfaceNode, UserMessageNode, } from './contract/snapshot.ts';
|
|
15
|
+
export type { AssistantBlock, AssistantMessageNode, AssistantProvenanceView, AssistantRequestConfig, AssistantTiming, ChatLocationNodeIndex, ChatNodeProcessSource, ChatNodeSource, ChatNodeStore, ChatSnapshot, ChatTurnNavigationIndex, ChatTurnProcessPresentation, CommandNode, CompactionSummaryNode, ContextMessageNode, ConversationNode, LegacyConversationSlice, ModelRetryNode, PartialAssistant, RunningToolCall, SteeringMessageNode, ToolCallBlock, ToolResultNode, TurnErrorNode, TurnMaxTokensNode, TurnNavigationItem, UnknownSurfaceNode, UserMessageNode, } from './contract/snapshot.ts';
|
|
16
16
|
export type { AssistantChatData, ChatConversationViewNode, ChatNode, ChatNodeKind, FinalAssistantChatData, ManualCompactionChatData, RetryChatData, ToolChatData, TurnProcessChatData, TurnTailChatData, } from './contract/chat-nodes.ts';
|
|
17
17
|
export type { ChatStoreState, SelectionTarget, ToolCallId, TurnProcessViewEntry } from './contract/store.ts';
|
|
18
18
|
export type { TranscriptViewRowInjected, TranscriptViewRowProps } from './settings/TranscriptViewRow.tsx';
|
|
19
19
|
export type { TranscriptViewMode } from '../chat-settings.ts';
|
|
20
20
|
export type { AssistantActionOwnerProps, ChatFileMentions, ChatNodeOwnerProps, ChatNodeTurnDataInjected, ChatNodeViewProps, ChatScrollPosition, ChatStore, ChatViewInjected, ChatViewSlotProps, CommandRowOwnerProps, CommandRowProps, DetailsInjected, DetailsSlotProps, DetailsToolOwnerProps, MessageImagesProps, TurnProcessOwnerProps, TurnTailOwnerProps, UseChat, UseChatNodeTurnData, } from './contract/slots.ts';
|
|
21
|
-
export type {
|
|
21
|
+
export type { TurnProcessSpec, } from './contract/turn-process.ts';
|
|
22
22
|
export type { ChatKey } from './locale.ts';
|
|
23
23
|
export type { ConversationContext, ConversationContextOriginKind } from './model/conversation-context.ts';
|
|
24
24
|
export type { ContextProvenanceView, ContextRole, KnownContextForm, } from '@prettier-ai/dsh-client-ui-conversation/client';
|
|
@@ -29,6 +29,7 @@ export declare const zh: {
|
|
|
29
29
|
'chat.deepDiving': string;
|
|
30
30
|
'chat.turnNavigation.label': string;
|
|
31
31
|
'chat.turnNavigation.jump': string;
|
|
32
|
+
'chat.turnNavigation.jumpLoad': string;
|
|
32
33
|
'chat.turnNavigation.turn': string;
|
|
33
34
|
'settings.transcript.title': string;
|
|
34
35
|
'settings.transcript.description': string;
|
|
@@ -143,6 +144,7 @@ export declare const en: {
|
|
|
143
144
|
'chat.deepDiving': string;
|
|
144
145
|
'chat.turnNavigation.label': string;
|
|
145
146
|
'chat.turnNavigation.jump': string;
|
|
147
|
+
'chat.turnNavigation.jumpLoad': string;
|
|
146
148
|
'chat.turnNavigation.turn': string;
|
|
147
149
|
'settings.transcript.title': string;
|
|
148
150
|
'settings.transcript.description': string;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/** Per-Session Chat selection store shared by the transcript and details panel. */
|
|
2
2
|
import { type EngineStoreHandle } from '@prettier-ai/dsh-client-store';
|
|
3
|
-
import type { TurnProcessGeneration } from './contract/turn-process.ts';
|
|
4
3
|
import type { ChatStoreState, SelectionTarget, TurnProcessViewEntry } from './contract/store.ts';
|
|
5
4
|
type ChatActions = {
|
|
6
5
|
select: (draft: ChatStoreState, target: SelectionTarget | null) => void;
|
|
7
|
-
setTurnProcessOpen: (draft: ChatStoreState, turn: number,
|
|
6
|
+
setTurnProcessOpen: (draft: ChatStoreState, turn: number, answerStep: number, open: boolean) => void;
|
|
8
7
|
};
|
|
9
8
|
/**
|
|
10
|
-
* Resolve
|
|
9
|
+
* Resolve the manually expanded answer for one Turn.
|
|
11
10
|
* @param state - Chat store snapshot.
|
|
12
11
|
* @param turn - owning Turn.
|
|
13
12
|
* @returns the Turn's stored entry, when present.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prettier-ai/dsh-client-ui-chat",
|
|
3
3
|
"description": "Chat Conversation target, node definitions, renderers, and details surface",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -18,10 +18,6 @@
|
|
|
18
18
|
"types": "./lib/types/index.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./invariant": {
|
|
22
|
-
"types": "./lib/types/invariant.d.ts",
|
|
23
|
-
"default": "./lib/invariant.js"
|
|
24
|
-
},
|
|
25
21
|
"./client": {
|
|
26
22
|
"types": "./lib/types/client/index.d.ts",
|
|
27
23
|
"default": "./lib/client.js"
|
|
@@ -55,40 +51,39 @@
|
|
|
55
51
|
"react": "^18.2.0",
|
|
56
52
|
"react-dom": "^18.2.0",
|
|
57
53
|
"@prettier-ai/cordis": "^4.0.2",
|
|
58
|
-
"@prettier-ai/dsh-agent": "^0.1.2-alpha.
|
|
59
|
-
"@prettier-ai/dsh-api-
|
|
60
|
-
"@prettier-ai/dsh-api-workspace-controller": "^0.1.2-alpha.
|
|
61
|
-
"@prettier-ai/dsh-api-
|
|
62
|
-
"@prettier-ai/dsh-attachment": "^0.1.2-alpha.
|
|
63
|
-
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.
|
|
64
|
-
"@prettier-ai/dsh-client-store": "^0.1.2-alpha.
|
|
65
|
-
"@prettier-ai/dsh-client-ui-
|
|
66
|
-
"@prettier-ai/dsh-client-ui-
|
|
67
|
-
"@prettier-ai/dsh-client-ui-layout": "^0.1.2-alpha.
|
|
68
|
-
"@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.
|
|
69
|
-
"@prettier-ai/dsh-client-ui-
|
|
70
|
-
"@prettier-ai/dsh-client-ui-
|
|
71
|
-
"@prettier-ai/dsh-client-ui-
|
|
72
|
-
"@prettier-ai/dsh-client-ui-
|
|
73
|
-
"@prettier-ai/dsh-
|
|
74
|
-
"@prettier-ai/dsh-
|
|
75
|
-
"@prettier-ai/dsh-
|
|
76
|
-
"@prettier-ai/dsh-llm": "^0.1.2-alpha.
|
|
77
|
-
"@prettier-ai/dsh-
|
|
78
|
-
"@prettier-ai/dsh-
|
|
79
|
-
"@prettier-ai/dsh-
|
|
80
|
-
"@prettier-ai/dsh-
|
|
81
|
-
"@prettier-ai/dsh-
|
|
82
|
-
"@prettier-ai/dsh-
|
|
83
|
-
"@prettier-ai/dsh-
|
|
84
|
-
"@prettier-ai/dsh-
|
|
54
|
+
"@prettier-ai/dsh-agent": "^0.1.2-alpha.4",
|
|
55
|
+
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.4",
|
|
56
|
+
"@prettier-ai/dsh-api-workspace-controller": "^0.1.2-alpha.4",
|
|
57
|
+
"@prettier-ai/dsh-api-remotes": "^0.1.2-alpha.4",
|
|
58
|
+
"@prettier-ai/dsh-attachment": "^0.1.2-alpha.4",
|
|
59
|
+
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.4",
|
|
60
|
+
"@prettier-ai/dsh-client-store": "^0.1.2-alpha.4",
|
|
61
|
+
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.4",
|
|
62
|
+
"@prettier-ai/dsh-client-ui-approval": "^0.1.2-alpha.4",
|
|
63
|
+
"@prettier-ai/dsh-client-ui-layout": "^0.1.2-alpha.4",
|
|
64
|
+
"@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.4",
|
|
65
|
+
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.4",
|
|
66
|
+
"@prettier-ai/dsh-client-ui-settings": "^0.1.2-alpha.4",
|
|
67
|
+
"@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.4",
|
|
68
|
+
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.4",
|
|
69
|
+
"@prettier-ai/dsh-client-ui-workspace": "^0.1.2-alpha.4",
|
|
70
|
+
"@prettier-ai/dsh-commands": "^0.1.2-alpha.4",
|
|
71
|
+
"@prettier-ai/dsh-llm-retry": "^0.1.2-alpha.4",
|
|
72
|
+
"@prettier-ai/dsh-llm": "^0.1.2-alpha.4",
|
|
73
|
+
"@prettier-ai/dsh-compaction": "^0.1.2-alpha.4",
|
|
74
|
+
"@prettier-ai/dsh-session": "^0.1.2-alpha.4",
|
|
75
|
+
"@prettier-ai/dsh-session-stats": "^0.1.2-alpha.4",
|
|
76
|
+
"@prettier-ai/dsh-session-turn-outline": "^0.1.2-alpha.4",
|
|
77
|
+
"@prettier-ai/dsh-tools": "^0.1.2-alpha.4",
|
|
78
|
+
"@prettier-ai/dsh-token-meter": "^0.1.2-alpha.4",
|
|
79
|
+
"@prettier-ai/dsh-util-workspace-path": "^0.1.2-alpha.4",
|
|
80
|
+
"@prettier-ai/dsh-settings": "^0.1.2-alpha.4"
|
|
85
81
|
},
|
|
86
82
|
"dependencies": {
|
|
87
83
|
"@prettier-ai/schemastery": "^3.18.2"
|
|
88
84
|
},
|
|
89
85
|
"files": [
|
|
90
86
|
"lib/index.js",
|
|
91
|
-
"lib/invariant.js",
|
|
92
87
|
"lib/client.js",
|
|
93
88
|
"lib/types/**/*.d.ts"
|
|
94
89
|
],
|
package/lib/invariant.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region lib/types/invariant.js
|
|
2
|
-
const PACKAGE_NAME = "@prettier-ai/dsh-client-ui-chat";
|
|
3
|
-
/** Cordis companion plugin name. */
|
|
4
|
-
const name = "client-ui-chat-invariant";
|
|
5
|
-
/** Service required before the companion reserves package ownership. */
|
|
6
|
-
const inject = ["invariants"];
|
|
7
|
-
/** No runtime invariant: Conversation and Slot registration enforce Chat target consistency. */
|
|
8
|
-
const install = () => {};
|
|
9
|
-
/**
|
|
10
|
-
* Register this package's invariant companion.
|
|
11
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
12
|
-
* @returns the installed registration's disposer.
|
|
13
|
-
*/
|
|
14
|
-
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
15
|
-
//#endregion
|
|
16
|
-
export { apply, inject, name };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return a stable scheduler that coalesces visual updates over a frame interval.
|
|
3
|
-
* @param update - DOM alignment to run after the throttle interval.
|
|
4
|
-
* @param intervalFrames - frames to wait before applying the latest alignment.
|
|
5
|
-
* @returns a stable function that schedules the latest update.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useThrottledVisualUpdate(update: () => void, intervalFrames?: number): () => void;
|
|
8
|
-
//# sourceMappingURL=use-throttled-visual-update.d.ts.map
|
package/lib/types/invariant.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Package-owned invariant companion for the Chat UI target. */
|
|
2
|
-
import type { Context } from '@prettier-ai/cordis';
|
|
3
|
-
/** Cordis companion plugin name. */
|
|
4
|
-
export declare const name = "client-ui-chat-invariant";
|
|
5
|
-
/** Service required before the companion reserves package ownership. */
|
|
6
|
-
export declare const inject: string[];
|
|
7
|
-
/**
|
|
8
|
-
* Register this package's invariant companion.
|
|
9
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
10
|
-
* @returns the installed registration's disposer.
|
|
11
|
-
*/
|
|
12
|
-
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
13
|
-
//# sourceMappingURL=invariant.d.ts.map
|