@deepseek-ai/dsh-client-ui-chat 0.2.1-alpha.2 → 0.2.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.i18n.yaml +12 -12
  2. package/README.md +22 -10
  3. package/README.zh.md +22 -10
  4. package/lib/client.js +927 -1531
  5. package/lib/index.js +11 -1
  6. package/lib/types/chat-settings.d.ts +13 -0
  7. package/lib/types/client/chat/AssistantMarkdown.d.ts +3 -5
  8. package/lib/types/client/chat/AssistantNodeView.d.ts +2 -2
  9. package/lib/types/client/chat/ChatFlow.d.ts +1 -1
  10. package/lib/types/client/chat/ChatNodeSeat.d.ts +1 -1
  11. package/lib/types/client/chat/ChatView.d.ts +1 -1
  12. package/lib/types/client/chat/MessageItem.d.ts +10 -9
  13. package/lib/types/client/chat/TurnTailNodeView.d.ts +1 -1
  14. package/lib/types/client/chat/UserContent.d.ts +9 -0
  15. package/lib/types/client/chat/flow-motion.d.ts +49 -5
  16. package/lib/types/client/chat/use-chat-reading.d.ts +10 -0
  17. package/lib/types/client/chat/use-chat-scroll.d.ts +5 -1
  18. package/lib/types/client/chat/use-chat-viewport.d.ts +39 -4
  19. package/lib/types/client/contract/chat-nodes.d.ts +8 -0
  20. package/lib/types/client/contract/group-tree.d.ts +32 -0
  21. package/lib/types/client/contract/slots.d.ts +51 -19
  22. package/lib/types/client/contract/snapshot.d.ts +4 -1
  23. package/lib/types/client/contract/turn-process.d.ts +0 -2
  24. package/lib/types/client/conversation-nodes/common.d.ts +12 -1
  25. package/lib/types/client/conversation-nodes/group-tree-segments.d.ts +42 -0
  26. package/lib/types/client/index.d.ts +2 -1
  27. package/lib/types/client/locale.d.ts +4 -2
  28. package/lib/types/client/performance-usage.d.ts +2 -2
  29. package/lib/types/client/presentation-policy.d.ts +8 -11
  30. package/lib/types/client/settings/TranscriptViewRow.d.ts +3 -3
  31. package/lib/types/client/transcript-view.d.ts +3 -3
  32. package/lib/types/index.d.ts +5 -1
  33. package/locale/en.json +5 -0
  34. package/locale/zh.json +6 -0
  35. package/package.json +44 -44
package/lib/index.js CHANGED
@@ -5,6 +5,12 @@ import z from "@deepseek-ai/schemastery";
5
5
  const CHAT_SETTINGS_NAMESPACE = "ui-chat";
6
6
  /** Field carrying the work-details presentation mode. */
7
7
  const TRANSCRIPT_VIEW_FIELD = "transcriptView";
8
+ /** Field carrying the independent work-details collapse timing. */
9
+ const COLLAPSE_TIMING_FIELD = "collapseTiming";
10
+ /** Available points when a completed Turn returns to its historical presentation. */
11
+ const COLLAPSE_TIMINGS = ["completion", "next-input"];
12
+ /** Preserve completion-time folding when no timing preference is saved. */
13
+ const DEFAULT_COLLAPSE_TIMING = "completion";
8
14
  /** Work-details presentation modes a user can choose. */
9
15
  const TRANSCRIPT_VIEW_MODES = [
10
16
  "compact",
@@ -31,9 +37,12 @@ const DEFAULT_TRANSCRIPT_VIEW_MODE = "detailed";
31
37
  const PERFORMANCE_USAGE_MODES = ["compact", "detailed"];
32
38
  /** Preserve detailed accounting for users without an explicit preference. */
33
39
  const DEFAULT_PERFORMANCE_USAGE = "detailed";
40
+ /** Preserve the built-in browser for users without an explicit preference. */
41
+ const DEFAULT_LINK_OPENING = "sidebar";
34
42
  /** Durable Chat schema; also the wire envelope the browser scope validates against. */
35
43
  const ChatSettingsFields = {
36
- linkOpening: z.union(["sidebar", "new-tab"]).default("sidebar"),
44
+ [COLLAPSE_TIMING_FIELD]: z.union([...COLLAPSE_TIMINGS]).default(DEFAULT_COLLAPSE_TIMING),
45
+ linkOpening: z.union(["sidebar", "new-tab"]).default(DEFAULT_LINK_OPENING),
37
46
  performanceUsage: z.union([...PERFORMANCE_USAGE_MODES]).default(DEFAULT_PERFORMANCE_USAGE),
38
47
  [TRANSCRIPT_VIEW_FIELD]: z.union([...TRANSCRIPT_VIEW_SETTING_VALUES]).loose()
39
48
  };
@@ -43,6 +52,7 @@ z.object(ChatSettingsFields);
43
52
  /** Live preferences projected to the browser. */
44
53
  const Config = z.object({
45
54
  [TRANSCRIPT_VIEW_FIELD]: ChatSettingsFields[TRANSCRIPT_VIEW_FIELD].volatile(),
55
+ collapseTiming: ChatSettingsFields.collapseTiming.volatile(),
46
56
  performanceUsage: ChatSettingsFields["performanceUsage"].volatile(),
47
57
  linkOpening: ChatSettingsFields.linkOpening.volatile()
48
58
  });
@@ -4,6 +4,14 @@ import z from '@deepseek-ai/schemastery';
4
4
  export declare const CHAT_SETTINGS_NAMESPACE = "ui-chat";
5
5
  /** Field carrying the work-details presentation mode. */
6
6
  export declare const TRANSCRIPT_VIEW_FIELD = "transcriptView";
7
+ /** Field carrying the independent work-details collapse timing. */
8
+ export declare const COLLAPSE_TIMING_FIELD = "collapseTiming";
9
+ /** Available points when a completed Turn returns to its historical presentation. */
10
+ export declare const COLLAPSE_TIMINGS: readonly ["completion", "next-input"];
11
+ /** When a completed Turn returns to its historical presentation. */
12
+ export type CollapseTiming = typeof COLLAPSE_TIMINGS[number];
13
+ /** Preserve completion-time folding when no timing preference is saved. */
14
+ export declare const DEFAULT_COLLAPSE_TIMING: CollapseTiming;
7
15
  /** Work-details presentation modes a user can choose. */
8
16
  export declare const TRANSCRIPT_VIEW_MODES: readonly ["compact", "standard", "detailed", "verbose"];
9
17
  /** Work-details presentation mode. */
@@ -31,6 +39,8 @@ export declare const DEFAULT_LINK_OPENING: LinkOpening;
31
39
  export interface ChatSettings {
32
40
  /** Work-details preference; absence uses the client default, and legacy saved values remain accepted. */
33
41
  transcriptView?: TranscriptViewMode | typeof LEGACY_TRANSCRIPT_VIEW_MODE | typeof LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE | null;
42
+ /** Independent collapse timing; absence preserves completion-time folding. */
43
+ collapseTiming?: CollapseTiming;
34
44
  /** Detail level for composer statistics and completed-Turn usage. */
35
45
  performanceUsage: PerformanceUsageMode;
36
46
  /** Default destination for Chat HTTP(S) links. */
@@ -38,16 +48,19 @@ export interface ChatSettings {
38
48
  }
39
49
  /** Durable Chat schema; also the wire envelope the browser scope validates against. */
40
50
  export declare const ChatSettingsFields: {
51
+ collapseTiming: z<"completion" | "next-input", "completion" | "next-input", "defined">;
41
52
  linkOpening: z<"sidebar" | "new-tab", "sidebar" | "new-tab", "defined">;
42
53
  performanceUsage: z<"compact" | "detailed", "compact" | "detailed", "defined">;
43
54
  transcriptView: z<"compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "plain">;
44
55
  };
45
56
  /** Schema for shared configuration values. */
46
57
  export declare const ChatSettingsSchema: z<Schemastery.ObjectS<NoInfer<{
58
+ collapseTiming: z<"completion" | "next-input", "completion" | "next-input", "defined">;
47
59
  linkOpening: z<"sidebar" | "new-tab", "sidebar" | "new-tab", "defined">;
48
60
  performanceUsage: z<"compact" | "detailed", "compact" | "detailed", "defined">;
49
61
  transcriptView: z<"compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "plain">;
50
62
  }>>, Schemastery.ObjectT<NoInfer<{
63
+ collapseTiming: z<"completion" | "next-input", "completion" | "next-input", "defined">;
51
64
  linkOpening: z<"sidebar" | "new-tab", "sidebar" | "new-tab", "defined">;
52
65
  performanceUsage: z<"compact" | "detailed", "compact" | "detailed", "defined">;
53
66
  transcriptView: z<"compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "plain">;
@@ -13,7 +13,7 @@ import type { AssistantBlock } from '../contract/snapshot.ts';
13
13
  * protocols and non-local paths.
14
14
  */
15
15
  export declare function localPathMediaUrl(base: string, value: string): string | undefined;
16
- export interface AssistantMarkdownProps extends Pick<PropsRenderSlots<'conversation.chat.reasoning.body'>, 'renderSlot'> {
16
+ export interface AssistantMarkdownProps extends Pick<PropsRenderSlots<'conversation.chat.reasoning.body' | 'conversation.chat.message.images'>, 'renderSlot'>, Pick<ChatNodeOwnerProps, 'loadImage'> {
17
17
  /** Render only the requested business portion, preserving original block indexes. */
18
18
  groupPart?: string | undefined;
19
19
  /** Stable Hook forwarded to each independently expandable reasoning block. */
@@ -22,8 +22,6 @@ export interface AssistantMarkdownProps extends Pick<PropsRenderSlots<'conversat
22
22
  streaming: boolean;
23
23
  /** Frozen partial of an aborted turn: rendered with a stopped marker. */
24
24
  interrupted?: boolean | undefined;
25
- /** Render consecutive image blocks through the attachment slot. */
26
- renderMessageImages: ChatNodeOwnerProps['renderMessageImages'];
27
25
  /** Hide reasoning that belongs to the Turn-level process disclosure. */
28
26
  reasoningHidden?: boolean | undefined;
29
27
  /** Process hiding bound by the node slot to its current viewport. */
@@ -37,6 +35,6 @@ export interface AssistantMarkdownProps extends Pick<PropsRenderSlots<'conversat
37
35
  /** The owning view's locale seat, passed down as a plain prop. */
38
36
  t: ChatViewSlotProps['t'];
39
37
  }
40
- /** Reasoning block as the Think variant summary row (figma 39:28304). */
41
- export declare const AssistantMarkdown: import("react").MemoExoticComponent<({ blocks, streaming, interrupted, renderMessageImages, groupPart, useDisclosure, reasoningHidden, usePresentation, revealProcess, mentions, renderSlot, useGroupAction, t, }: AssistantMarkdownProps) => import("react").JSX.Element | null>;
38
+ /** Renders non-blank reasoning blocks as independent disclosures alongside the response. */
39
+ export declare const AssistantMarkdown: import("react").MemoExoticComponent<({ blocks, streaming, interrupted, loadImage, groupPart, useDisclosure, reasoningHidden, usePresentation, revealProcess, mentions, renderSlot, useGroupAction, t, }: AssistantMarkdownProps) => import("react").JSX.Element | null>;
42
40
  //# sourceMappingURL=AssistantMarkdown.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { InjectFace, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots';
2
2
  import type { ChatNodeViewProps, PresentationInjected } from '../contract/slots.ts';
3
- type AssistantNodeViewProps = ChatNodeViewProps<'assistant-step'> & InjectFace<PresentationInjected> & PropsRenderSlots<'conversation.chat.reasoning.body'>;
3
+ type AssistantNodeViewProps = ChatNodeViewProps<'assistant-step'> & InjectFace<PresentationInjected> & PropsRenderSlots<'conversation.chat.reasoning.body' | 'conversation.chat.message.images'>;
4
4
  /** Streaming, settled, and interrupted Assistant states share one keyed renderer instance. */
5
- export declare const AssistantNodeView: import("react").MemoExoticComponent<({ node, groupPart, useDisclosure, useGroupAction, useTurnData, turnProcess, openFile, renderMessageImages, fileMentions, usePresentation, renderSlot, t, }: AssistantNodeViewProps) => import("react").JSX.Element>;
5
+ export declare const AssistantNodeView: import("react").MemoExoticComponent<({ node, groupPart, useDisclosure, useGroupAction, useTurnData, turnProcess, openFile, loadImage, fileMentions, usePresentation, renderSlot, t, }: AssistantNodeViewProps) => import("react").JSX.Element>;
6
6
  export {};
7
7
  //# sourceMappingURL=AssistantNodeView.d.ts.map
@@ -1,4 +1,4 @@
1
1
  import type { ChatFlowSlotProps } from '../contract/slots.ts';
2
2
  /** Render the flow without adding a DOM parent or changing keyed row positions. */
3
- export declare const ChatFlow: import("react").MemoExoticComponent<({ entries, pendingInputs, lastInputTurn, deferCollapse, useSession, useChat, useChatNode, useChatNodeBottom, useChatNodeProcess, useChatGroup, usePresentation, useStore, actions, renderSlot, t, useGroupAction, useGroupHeaderAction, cwd, openFile, openSkill, inspectCall, forkAt, loadImage, fileMentions, }: ChatFlowSlotProps) => import("react").JSX.Element[]>;
3
+ export declare const ChatFlow: import("react").MemoExoticComponent<({ entries, pendingInputs, lastInputTurn, deferCollapse, useSession, useChat, useChatNode, useChatNodeBottom, useChatNodeProcess, useChatGroup, usePresentation, useStore, actions, renderSlot, renderFactorySlot, t, useGroupAction, useGroupHeaderAction, cwd, openFile, inspectCall, forkAt, loadImage, fileMentions, }: ChatFlowSlotProps) => import("react").JSX.Element[]>;
4
4
  //# sourceMappingURL=ChatFlow.d.ts.map
@@ -20,6 +20,6 @@ interface ChatNodeSeatProps extends ChatNodeOwnerProps {
20
20
  * Policy reads select this seat's own conclusion, so a mode change re-renders
21
21
  * only seats whose visibility actually changes.
22
22
  */
23
- export declare const ChatNodeSeat: import("react").MemoExoticComponent<({ nodeKey, groupPart, useChatNode, useChatNodeProcess, usePresentation, cwd, openFile, openSkill, inspectCall, forkAt, loadImage, renderMessageImages, fileMentions, useStore, actions, renderSlot, t, useChatNodeBottom, deferCollapse, useGroupAction, }: ChatNodeSeatProps) => import("react").JSX.Element | null>;
23
+ export declare const ChatNodeSeat: import("react").MemoExoticComponent<({ nodeKey, groupPart, useChatNode, useChatNodeProcess, usePresentation, cwd, openFile, inspectCall, forkAt, loadImage, fileMentions, useStore, actions, renderSlot, t, useChatNodeBottom, deferCollapse, useGroupAction, }: ChatNodeSeatProps) => import("react").JSX.Element | null>;
24
24
  export {};
25
25
  //# 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, useConversation, useSessions, renderSlot, sessionId, openFile, openSkill, openExternalLink, loadOlder, loadThrough, loadImage, inspectCall, chatScroll, forkAt, fileMentions, usePresentation, useProjection, t, }: ChatViewSlotProps): import("react").JSX.Element;
6
+ export declare function ChatView({ useSession, useChat, useConversation, useSessions, renderSlot, sessionId, openFile, openExternalLink, loadOlder, loadThrough, loadImage, inspectCall, chatScroll, forkAt, fileMentions, usePresentation, useProjection, t, }: ChatViewSlotProps): import("react").JSX.Element;
7
7
  //# sourceMappingURL=ChatView.d.ts.map
@@ -1,32 +1,33 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client';
3
+ import type { PropsRenderFactories } from '@deepseek-ai/dsh-client-ui-slots';
3
4
  import type { ChatNodeOwnerProps, ChatNodeViewProps, ChatViewSlotProps } from '../contract/slots.ts';
4
5
  /**
5
6
  * Render one Host-authoritative pending steering item with the same visual
6
7
  * language as its eventual durable transcript node.
7
- * @param props - Pending message content and conversation translator.
8
+ * @param props - pending content, authorized image loader, and Factory/locale seats.
8
9
  * @returns the pending steering bubble.
9
10
  */
10
- export declare function PendingSteeringBubble({ content, renderMessageImages, t }: {
11
+ export declare function PendingSteeringBubble({ content, loadImage, renderFactorySlot, t }: {
11
12
  content: readonly unknown[];
12
- renderMessageImages: ChatNodeOwnerProps['renderMessageImages'];
13
+ renderFactorySlot: PropsRenderFactories['renderFactorySlot'];
13
14
  t: ChatViewSlotProps['t'];
14
- }): ReactNode;
15
+ } & Pick<ChatNodeOwnerProps, 'loadImage'>): ReactNode;
15
16
  /**
16
17
  * Render one local transcript or steering submission echo with the same
17
18
  * visual language and surface marker as the Host occurrence that replaces
18
19
  * it: draft text plus object-URL previews, visible from the submit click
19
20
  * until the durable `user/message` or steering occurrence renders.
20
- * @param props - the session snapshot's pending submission and render seats.
21
+ * @param props - the pending submission, authorized image loader, and render seats.
21
22
  * @returns the echoed user bubble.
22
23
  */
23
- export declare function PendingSubmissionBubble({ submission, renderMessageImages, t }: {
24
+ export declare function PendingSubmissionBubble({ submission, loadImage, renderFactorySlot, t }: {
24
25
  submission: PendingSubmission;
25
- renderMessageImages: ChatNodeOwnerProps['renderMessageImages'];
26
+ renderFactorySlot: PropsRenderFactories['renderFactorySlot'];
26
27
  t: ChatViewSlotProps['t'];
27
- }): ReactNode;
28
+ } & Pick<ChatNodeOwnerProps, 'loadImage'>): ReactNode;
28
29
  /** User and admitted-steering keyed Chat renderer. */
29
- export declare const UserMessageNodeView: import("react").MemoExoticComponent<({ node, renderMessageImages, openFile, openSkill, t, }: ChatNodeViewProps<"user" | "steering">) => import("react").JSX.Element>;
30
+ export declare const UserMessageNodeView: import("react").MemoExoticComponent<({ node, renderFactorySlot, loadImage, t, }: ChatNodeViewProps<"user" | "steering">) => import("react").JSX.Element>;
30
31
  /** Injected-context keyed Chat renderer. */
31
32
  export declare const ContextMessageNodeView: import("react").MemoExoticComponent<({ node, t }: ChatNodeViewProps<"context">) => import("react").JSX.Element>;
32
33
  /** Automatic compaction keyed Chat renderer. */
@@ -2,6 +2,6 @@ import type { InjectFace, PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-sl
2
2
  import type { ChatNodeViewProps, PerformanceUsageInjected } from '../contract/slots.ts';
3
3
  type TurnTailNodeViewProps = ChatNodeViewProps<'turn-tail'> & PropsRenderSlots<'conversation.chat.turnTail' | 'conversation.chat.assistant-actions'> & InjectFace<PerformanceUsageInjected>;
4
4
  /** Turn-local actions and feature tail over the Location index, independent of Assistant placement. */
5
- export declare const TurnTailNodeView: import("react").MemoExoticComponent<({ node, openFile, forkAt, renderSlot, t, useChat, usePerformanceUsage, }: TurnTailNodeViewProps) => import("react").JSX.Element | null>;
5
+ export declare const TurnTailNodeView: import("react").MemoExoticComponent<({ node, openFile, forkAt, renderSlot, t, useAccess, useChat, usePerformanceUsage, }: TurnTailNodeViewProps) => import("react").JSX.Element | null>;
6
6
  export {};
7
7
  //# sourceMappingURL=TurnTailNodeView.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type { FactoryComponentPropsOf } from '@deepseek-ai/dsh-client-ui-slots';
2
+ /**
3
+ * Render prepared text, ordered attachments, and references without message chrome.
4
+ * The caller owns row identity, pending/echo state, time, and message actions.
5
+ * @param props - prepared content, facts, authorized image loader, and framework Factory/locale seats.
6
+ * @returns the content stack using the existing user-message layout.
7
+ */
8
+ export declare function UserContent({ content, loadImage, facts, interactive, ellipsis, renderSlot, renderFactorySlot, t }: FactoryComponentPropsOf<'conversation.chat.user.content'>): import("react").JSX.Element;
9
+ //# sourceMappingURL=UserContent.d.ts.map
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Fade-then-close transitions owned by one Chat viewport. Rows fade before their boxes close;
3
- * the owner reserves removed height and holds scrolling until that viewport's folds finish.
4
- * Motion is opt-in under `[data-chat-motion]`, respects reduced motion, and clears temporary styles.
2
+ * Fold transitions owned by one Chat viewport. Every batch containing a closing row moves its boxes and
3
+ * the scrollport on one frame clock; a batch that only reveals rows, or a viewport without a reading
4
+ * policy, uses CSS transitions. Motion is opt-in under `[data-chat-motion]`, respects reduced motion,
5
+ * and clears temporary styles.
5
6
  */
6
7
  import { type RefObject } from 'react';
7
8
  /** Row-local operations supplied by the containing viewport. */
@@ -13,12 +14,55 @@ export interface FlowMotionRows {
13
14
  /** @param element - row whose active transition should be cancelled without hiding it. */
14
15
  cancelMotion(element: HTMLElement): void;
15
16
  }
17
+ /** Geometry captured before one fold batch changes its boxes. */
18
+ export interface InputFoldBox {
19
+ readonly element: HTMLElement;
20
+ readonly height: number;
21
+ readonly marginTop: number;
22
+ readonly closing: boolean;
23
+ }
24
+ /** The viewport moves on the same progress that changes the folded boxes. */
25
+ export interface InputFoldDriver {
26
+ /**
27
+ * Capture geometry and choose the landing before the frame clock changes the boxes.
28
+ * @param boxes - non-nested boxes whose layout changes on this clock.
29
+ * @returns closing boxes that scroll with the content and stay opaque; the rest fade in place. The driver
30
+ * may add boxes while the batch runs, when a newer tail request takes it over.
31
+ */
32
+ begin(boxes: readonly InputFoldBox[]): ReadonlySet<HTMLElement>;
33
+ /**
34
+ * Reserve scroll range before box writes.
35
+ * @param progress - shared eased progress from zero to one.
36
+ * @param cancelled - a reading gesture stopped a tail landing's automatic target; a landing that keeps
37
+ * the reader's content still continues and includes the reader's own movement.
38
+ */
39
+ prepare(progress: number, cancelled: boolean): void;
40
+ /**
41
+ * Apply viewport geometry after box writes.
42
+ * @param progress - shared eased progress from zero to one.
43
+ * @param cancelled - a reading gesture stopped a tail landing's automatic target.
44
+ * @returns actual scrollTop displacement from the batch start, for closing-content visual compensation.
45
+ */
46
+ frame(progress: number, cancelled: boolean): number;
47
+ /**
48
+ * Install the final geometry after the last frame or cancellation.
49
+ * @param cancelled - a reading gesture stopped the automatic target, every closing row reopened, or the
50
+ * viewport detached; the driver commits no obsolete landing.
51
+ */
52
+ finish(cancelled: boolean): void;
53
+ }
16
54
  /** Animation lifetime and fold coordination for one viewport. */
17
55
  export interface FlowMotion extends FlowMotionRows {
18
56
  /** @returns whether a row owned by this viewport is closing. */
19
57
  foldActive(): boolean;
20
58
  /** @param listener - callback after the last fold. @returns cancellation for a pending callback. */
21
59
  onFoldIdle(listener: () => void): () => void;
60
+ /** Stop the running batch's automatic target while letting its boxes finish. */
61
+ cancelInput(): void;
62
+ /** Restore the running batch's automatic target after a newer request takes it over. */
63
+ resumeInput(): void;
64
+ /** @returns whether a fold batch runs, or one is scheduled for this commit's closing rows. */
65
+ inputActive(): boolean;
22
66
  /** Cancel owned animations and pending work when the viewport detaches. */
23
67
  clear(): void;
24
68
  }
@@ -36,11 +80,11 @@ export declare function motionEnabled(element: HTMLElement): boolean;
36
80
  export declare function hiddenOrCollapsing(element: HTMLElement): boolean;
37
81
  /**
38
82
  * Create animation coordination without cross-viewport broadcasts.
39
- * @param reserve - reserve the deduplicated removed height in this viewport.
83
+ * @param driver - the viewport's driver for the next batch; null while detached.
40
84
  * @param foldingChanged - disable or restore this viewport's native scroll anchoring.
41
85
  * @returns stable callbacks and cleanup for this viewport's animations.
42
86
  */
43
- export declare function createFlowMotion(reserve: (px: number) => void, foldingChanged: (active: boolean) => void): FlowMotion;
87
+ export declare function createFlowMotion(driver: () => InputFoldDriver | null, foldingChanged: (active: boolean) => void): FlowMotion;
44
88
  /**
45
89
  * Apply searchable hiding with the containing Chat viewport's optional fold animation.
46
90
  * @param hidden - desired visibility.
@@ -55,6 +55,16 @@ export declare class ChatReading {
55
55
  * @param behavior - immediate positioning, or one native animation when the reader's own input moved the tail.
56
56
  */
57
57
  followTail(behavior?: 'instant' | 'smooth'): void;
58
+ /**
59
+ * Follow the tail on the active fold's animation clock.
60
+ * @returns whether a fold batch owns the tail movement instead of a separate scroll animation.
61
+ */
62
+ followInputFold(): boolean;
63
+ /**
64
+ * Let fold batches read follow intent and commit their tail landings.
65
+ * @returns a disposer that disconnects this reading policy from the viewport.
66
+ */
67
+ bindFolds(): () => void;
58
68
  /** Stop a native follow animation where it is; the next sampled position decides follow intent. */
59
69
  interruptFollow(): void;
60
70
  /** Restore the Session's semantic position, or follow the tail when none is saved. */
@@ -1,5 +1,6 @@
1
1
  /** Composes viewport operations, reading policy, and history navigation for Chat. */
2
2
  import { type RefObject } from 'react';
3
+ import type { TranscriptViewMode } from '../../chat-settings.ts';
3
4
  import type { ChatSnapshot } from '../contract/snapshot.ts';
4
5
  import type { ChatViewSlotProps } from '../contract/slots.ts';
5
6
  import { type ChatNavigation, type ChatNavigationInput } from './use-chat-navigation.ts';
@@ -17,6 +18,8 @@ export interface ChatScrollInput extends ChatNavigationInput {
17
18
  readonly running: boolean;
18
19
  /** Enable the browser-local delayed-fold experiment and its input reveal animation. */
19
20
  readonly deferCompletedTurns: boolean;
21
+ /** A changed work-details preference resets fold reservations after the layout settles. */
22
+ readonly transcriptView: TranscriptViewMode;
20
23
  readonly loadedTurns: ReturnType<ChatSnapshot['navigation']['items']>;
21
24
  }
22
25
  interface ChatScrollState extends ChatReadingState {
@@ -29,7 +32,8 @@ interface ChatScrollState extends ChatReadingState {
29
32
  readonly motion: FlowMotionRows;
30
33
  }
31
34
  /**
32
- * Coordinate scroll policy after Chat content commits.
35
+ * Coordinate scroll policy after Chat content commits. Initial history must be ready
36
+ * before automatic scroll or resize handling can initialize reading state and fold motion.
33
37
  * New submitted input supersedes pending reader sampling.
34
38
  * @param input - current Chat content, scroll memory, and history operations.
35
39
  * @returns element refs, visible reading state, and navigation callbacks.
@@ -23,6 +23,15 @@ interface ViewportEvents {
23
23
  /** Any reading gesture, before paging ownership is consulted. */
24
24
  intent?: () => void;
25
25
  }
26
+ /** Reading policy that fold batches consult and report tail landings to. */
27
+ export interface FoldReader {
28
+ /** Follow intent at batch start selects the tail landing; tail landings commit it. */
29
+ readonly follow: ScrollFollow;
30
+ /** @param landing - the actual geometry after a batch landed at the tail. */
31
+ readonly landedAtTail: (landing: ViewportLanding) => void;
32
+ /** @returns whether reader movement awaits sampling; until then follow intent is undecided. */
33
+ readonly pending: () => boolean;
34
+ }
26
35
  /** Owns one Chat scrollport's DOM operations, event listeners, and size observer. */
27
36
  export declare class ChatViewport {
28
37
  private elements;
@@ -31,6 +40,11 @@ export declare class ChatViewport {
31
40
  private turns;
32
41
  private observation;
33
42
  private paging;
43
+ private reader;
44
+ /** The pending or running fold batch lands at the tail. */
45
+ private tailRequested;
46
+ /** Switches the running batch to a tail landing; null while no batch runs. */
47
+ private retarget;
34
48
  /** Transition state and row callbacks owned by this viewport's attachment. */
35
49
  readonly motion: import("./flow-motion.ts").FlowMotion;
36
50
  /**
@@ -62,11 +76,32 @@ export declare class ChatViewport {
62
76
  private spacerHeight;
63
77
  private setSpacer;
64
78
  /**
65
- * Add room below the flow before rows above the reader close, so the scrollport never clamps:
66
- * the closing gap pulls the content below it upward while everything above stays put.
67
- * @param px - height about to leave the flow.
79
+ * Connect the reading policy that fold batches consult.
80
+ * @param reader - follow intent and the tail-landing commit.
81
+ * @returns a disposer that disconnects only this reader.
82
+ */
83
+ bindReader(reader: FoldReader): () => void;
84
+ /**
85
+ * Land the pending or running fold batch at the tail instead of starting a separate scroll.
86
+ * @param follow - follow controller whose native animation yields to the batch.
87
+ * @returns whether a fold owns the tail movement.
88
+ */
89
+ followInputFold(follow: ScrollFollow): boolean;
90
+ /**
91
+ * Drive one fold batch on its frame clock. A tail landing ends at the floor, never above the reader's
92
+ * compensated position; a reader landing keeps the visible content still. Both install only the room
93
+ * the landing lacks.
94
+ * @returns the batch driver, or null while detached or without a reading policy.
95
+ */
96
+ private foldDriver;
97
+ /**
98
+ * Find the first visible top-level row at or below the scrollport top that holds no batch box.
99
+ * Binary search over the ordered top-level rows reads O(log n) boxes.
100
+ * @returns the reference row, or null when every visible row folds.
68
101
  */
69
- reserveBelow(px: number): void;
102
+ private readingReference;
103
+ /** Clear fold reservations after a display-mode change, allowing the scroll range to shrink. */
104
+ resetBelow(): void;
70
105
  /**
71
106
  * Give reserved room back after acknowledged scrolling or content growth without clamping the reader.
72
107
  * Holds still during folds and unsampled movement; following includes the room that remains.
@@ -1,10 +1,18 @@
1
1
  import type { AssistantBlock, AssistantMessageNode, CommandNode, CompactionSummaryNode, ConversationLocation, ConversationViewNode, ModelRetryNode, RunningToolCall, ToolCallBlock } from '@deepseek-ai/dsh-client-ui-conversation/client';
2
+ import type { ChatGroupTree } from './group-tree.ts';
2
3
  /** Final Chat render unit produced by a Chat business Definition. */
3
4
  export interface ChatConversationViewNode extends ConversationViewNode {
4
5
  readonly target: 'chat';
5
6
  readonly anchorSeq: number;
6
7
  readonly location: ConversationLocation;
7
8
  readonly visibility: 'visible' | 'hidden';
9
+ /**
10
+ * Group-tree position, visible or hidden; absence joins the surrounding step
11
+ * run. An `exchange` Node's Turn and every later Turn before the next opening
12
+ * Turn form one exchange; the latest loaded exchange starts at the last loaded
13
+ * opening Turn, or at the first loaded Turn when none is loaded.
14
+ */
15
+ readonly groupTree?: ChatGroupTree | undefined;
8
16
  }
9
17
  /** Merge-extensible payload registry keyed by final Chat renderer kind. */
10
18
  export interface ChatNodeDataMap {
@@ -0,0 +1,32 @@
1
+ import type { ChatConversationViewNode } from './chat-nodes.ts';
2
+ /**
3
+ * Chat group-tree positions from the outermost inward; a Node at a position
4
+ * also has the effect of every inner position.
5
+ * - `exchange`: the Node's Turn opens an exchange, the run of Turns that lasts
6
+ * until the next opening Turn.
7
+ * - `input`: the Node is an input of its Turn. An input before the Turn's
8
+ * process is the Turn's opening input; a later one is interleaved and keeps
9
+ * the whole Turn open.
10
+ * - `turn`: the Node stays in its Turn outside the Turn's process disclosure.
11
+ * - `process`: the Node stays in the process disclosure outside step runs.
12
+ * - absent: the Node joins the step run around it.
13
+ *
14
+ * The Definition that builds a Node chooses its position, and step runs, the
15
+ * process disclosure, and Turn inputs are selected by position. An
16
+ * `assistant-step` Node places its rows without one: its reasoning row joins
17
+ * the step run and its reply row stands outside it.
18
+ *
19
+ * Whole-Turn folding also exempts the finalized answer's reply. That exemption
20
+ * comes from the Turn's process specification (`answerAnchorSeq` and
21
+ * `answerStep`), not from a position, because which step answers changes as
22
+ * later steps arrive.
23
+ */
24
+ export type ChatGroupTree = 'exchange' | 'input' | 'turn' | 'process';
25
+ /**
26
+ * Test whether a Node stands at a group-tree position or outside it.
27
+ * @param node - Chat Node.
28
+ * @param position - group-tree position to compare against.
29
+ * @returns whether the Node's position is `position` or an outer one.
30
+ */
31
+ export declare function isAtOrOutside(node: Pick<ChatConversationViewNode, 'groupTree'>, position: ChatGroupTree): boolean;
32
+ //# sourceMappingURL=group-tree.d.ts.map
@@ -3,9 +3,10 @@ import type { RefObject } from 'react';
3
3
  import type { MessageId } from '@deepseek-ai/dsh-llm/brand';
4
4
  import type { SessionId, SessionSeq } from '@deepseek-ai/dsh-session/types';
5
5
  import type { PendingSubmission } from '@deepseek-ai/dsh-api-session-controller/client';
6
+ import type { FileAttachmentRef } from '@deepseek-ai/dsh-attachment';
6
7
  import type { InboxState } from '@deepseek-ai/dsh-agent/types';
7
- import type { CommandNode, CompactionSummaryNode, ConversationLocationDataStore, ConversationTurnDataMap, ConversationGroupData, GroupSnapshot, MessageImageLoader, MessageImagesOwnerProps, RenderEntry, RenderMessageImages, TurnLocation } from '@deepseek-ai/dsh-client-ui-conversation/client';
8
- import type { HostObservable, InjectFace, KeyedSnapshotSelectorHook, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore, SlotHookFactory, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
8
+ import type { CommandNode, CompactionSummaryNode, ConversationLocationDataStore, ConversationTurnDataMap, ConversationGroupData, GroupSnapshot, MessageImageLoader, MessageImageSource, MessageImagesOwnerProps, RenderEntry, TurnLocation, UserTextFacts, UserTextInput } from '@deepseek-ai/dsh-client-ui-conversation/client';
9
+ import type { HostObservable, InjectFace, KeyedSnapshotSelectorHook, PropsLocale, PropsRenderSlots, PropsRuntime, PropsRenderFactories, PropsStore, SlotHookFactory, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots';
9
10
  import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
10
11
  import type { MarkdownFileMentions, MarkdownLabels } from '@deepseek-ai/dsh-client-ui-primitives';
11
12
  import type { createChatStore } from '../stores.ts';
@@ -168,23 +169,38 @@ export interface ChatNodeOwnerProps {
168
169
  /** Renderer-owned Node portion selected by the grouping Definition. */
169
170
  groupPart?: string;
170
171
  cwd?: string | undefined;
171
- /** Open the current source file of a skill referenced by a sent message. */
172
- openSkill: (name: string) => void;
173
172
  openFile: (path: string, options?: OpenFileOptions) => void;
174
173
  inspectCall: ((callId: ToolCallId) => void) | undefined;
175
174
  forkAt: (seq: number) => void;
176
- /**
177
- * Session-authorized image loader, down-threaded from the Chat view so a
178
- * chat-node renderer can render the attachment presentation slot directly
179
- * with only the durable references plus this loader, instead of receiving a
180
- * rendering closure.
181
- */
175
+ /** Session-authorized image loader supplied by the Chat view. */
182
176
  loadImage: MessageImageLoader;
183
- renderMessageImages: RenderMessageImages;
184
177
  fileMentions: (owner: TurnTailOwnerProps) => MarkdownFileMentions | undefined;
185
178
  /** Turn-process state when this Node belongs to a projected Turn. */
186
179
  turnProcess?: TurnProcessOwnerProps | undefined;
187
180
  }
181
+ /** One attachment in the original user-message display order. */
182
+ export type UserContentAttachment = {
183
+ readonly type: 'image';
184
+ readonly image: MessageImageSource;
185
+ } | {
186
+ readonly type: 'file';
187
+ readonly file: FileAttachmentRef;
188
+ };
189
+ /** Prepared user contents without row identity, admission state, time, or actions. */
190
+ export interface UserContentData {
191
+ readonly text: string;
192
+ readonly attachments: readonly UserContentAttachment[];
193
+ /** Blocks not represented by text or attachment presentation. */
194
+ readonly extraBlocks: readonly unknown[];
195
+ /** Labels displayed in the caller-provided reference summary. */
196
+ readonly referenceLabels?: readonly string[];
197
+ }
198
+ /** Public content rendering input; reference renderers own their injected actions. */
199
+ export interface UserContentInput extends Pick<ChatNodeOwnerProps, 'loadImage'>, Pick<UserTextInput, 'interactive' | 'ellipsis'> {
200
+ readonly content: UserContentData;
201
+ /** Transform inputs passed unchanged to UserText, separate from summary and rendering props. */
202
+ readonly facts: Readonly<Partial<UserTextFacts>>;
203
+ }
188
204
  /** Shared presentation state for one Turn-process answer generation. */
189
205
  export interface TurnProcessOwnerProps {
190
206
  /** Process content eligible to share one Turn-level disclosure. */
@@ -202,7 +218,7 @@ export interface PresentationInjected {
202
218
  };
203
219
  }
204
220
  /** Full props of one keyed Chat renderer. */
205
- export type ChatNodeViewProps<Kind extends ChatNodeKind = ChatNodeKind> = PropsRuntime<'conversation.chat.node', Kind> & PropsLocale<'chat'>;
221
+ export type ChatNodeViewProps<Kind extends ChatNodeKind = ChatNodeKind> = PropsRuntime<'conversation.chat.node', Kind> & PropsLocale<'chat'> & PropsRenderFactories;
206
222
  /** Command-row owner share. */
207
223
  export interface CommandRowOwnerProps {
208
224
  node: CommandNode;
@@ -241,8 +257,6 @@ export interface ChatViewInjected {
241
257
  /** Resolve one optional group without subscribing the root View to its data. */
242
258
  chatGroup: (key: string) => ObservableSnapshot<GroupSnapshot<ConversationGroupData<'chat'>> | undefined> | undefined;
243
259
  };
244
- /** Open the current source file of a skill referenced by a sent message. */
245
- openSkill: (name: string) => void;
246
260
  /** Open one HTTP(S) message link at the selected destination, using an external tab if Sidebar Browser is unavailable. */
247
261
  openExternalLink: (url: string) => void;
248
262
  openFile: (path: string, options?: OpenFileOptions) => Promise<void>;
@@ -260,18 +274,18 @@ export interface ChatViewInjected {
260
274
  /** Existing Session-owned node sources shared by the view and its flow renderer. */
261
275
  export type ChatFlowDataInjected = Pick<ChatViewInjected, 'hooks' | 'keyedHooks'>;
262
276
  /** Ordered rows and reconciled local echoes rendered inside one Chat viewport. */
263
- export interface ChatFlowOwnerProps extends Pick<ChatNodeOwnerProps, 'cwd' | 'openSkill' | 'openFile' | 'inspectCall' | 'forkAt' | 'loadImage' | 'fileMentions'> {
277
+ export interface ChatFlowOwnerProps extends Pick<ChatNodeOwnerProps, 'cwd' | 'openFile' | 'inspectCall' | 'forkAt' | 'loadImage' | 'fileMentions'> {
264
278
  readonly entries: readonly RenderEntry[];
265
279
  readonly pendingInputs: readonly (PendingSubmission | InboxState['next-step'][number])[];
266
280
  readonly lastInputTurn: number | undefined;
267
281
  readonly deferCollapse: boolean;
268
282
  }
269
283
  /** Full props of the Chat-owned flow renderer. */
270
- export type ChatFlowSlotProps = PropsRuntime<'conversation.chat.flow'> & PropsRenderSlots<'conversation.chat.node' | 'conversation.message.images'> & PropsStore<ChatStore> & InjectFace<ChatFlowDataInjected> & PropsLocale<'chat'>;
284
+ export type ChatFlowSlotProps = PropsRuntime<'conversation.chat.flow'> & PropsRenderSlots<'conversation.chat.node'> & PropsRenderFactories & PropsStore<ChatStore> & InjectFace<ChatFlowDataInjected> & PropsLocale<'chat'>;
271
285
  /** Full Chat view props. */
272
286
  export type ChatViewSlotProps = PropsRuntime<'conversation.view'> & PropsRenderSlots<'conversation.chat.flow'> & PropsStore<ChatStore> & InjectFace<ChatViewInjected> & PropsLocale<'chat'>;
273
- /** Full props of the durable-message image renderer. */
274
- export type MessageImagesProps = PropsRuntime<'conversation.message.images'> & PropsLocale<'conversation'>;
287
+ /** Full props shared by the user and output image entries. */
288
+ export type MessageImagesProps = PropsRuntime<'conversation.chat.user.images' | 'conversation.chat.message.images'> & PropsRenderFactories;
275
289
  declare module '@deepseek-ai/dsh-client-ui-slots' {
276
290
  interface SessionStandardProps {
277
291
  /** Selector hook over the current Conversation binding's Chat target. */
@@ -282,6 +296,18 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
282
296
  chat: import('../locale.ts').ChatKey;
283
297
  }
284
298
  interface SlotFactoryMap {
299
+ /** Prepared user text, attachments, and references inside a caller-owned message row. */
300
+ 'conversation.chat.user.content': {
301
+ scope: 'session';
302
+ props: UserContentInput;
303
+ locale: 'chat';
304
+ children: {
305
+ 'conversation.chat.user.images': {
306
+ kind: 'single';
307
+ scope: 'session';
308
+ };
309
+ };
310
+ };
285
311
  /** Session-independent reasoning Markdown with Chat labels and compact typography. */
286
312
  'conversation.chat.reasoning.content': {
287
313
  scope: 'root';
@@ -320,7 +346,13 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
320
346
  * supplies image references, an authorized loader, and alignment. A
321
347
  * registration replaces the shipped gallery; without one, images are omitted.
322
348
  */
323
- 'conversation.message.images': {
349
+ 'conversation.chat.message.images': {
350
+ kind: 'single';
351
+ scope: 'session';
352
+ owner: MessageImagesOwnerProps;
353
+ };
354
+ /** User-message images, including pending and local-echo previews, independently replaceable from output images. */
355
+ 'conversation.chat.user.images': {
324
356
  kind: 'single';
325
357
  scope: 'session';
326
358
  owner: MessageImagesOwnerProps;
@@ -23,7 +23,10 @@ export interface ChatNodeStore {
23
23
  get(key: string): ChatConversationViewNode | undefined;
24
24
  /** @param key - stable Conversation Context key. @returns its identity-stable observable source. */
25
25
  source(key: string): ChatNodeSource;
26
- /** @param key - Chat Node identity. @returns whether the visible Node belongs to the last Turn in the loaded timeline. */
26
+ /**
27
+ * @param key - Chat Node identity.
28
+ * @returns whether the visible Node belongs to the latest loaded exchange (see `ChatConversationViewNode.groupTree`).
29
+ */
27
30
  bottomSource(key: string): ObservableSnapshot<boolean>;
28
31
  /**
29
32
  * Observe one Turn's data for a single Node kind, including hidden Nodes, in anchor order.
@@ -15,8 +15,6 @@ export interface TurnProcessSpec {
15
15
  /** Tool calls whose configured name identifies a subagent delegation. */
16
16
  readonly subagentCount: number;
17
17
  }
18
- /** Chat Node kinds that remain independent of a Turn's process disclosure. */
19
- export declare const TURN_PROCESS_INDEPENDENT_KINDS: ReadonlySet<string>;
20
18
  /**
21
19
  * Compare immutable Turn-process specifications by their published fields.
22
20
  * @param left - previous specification.