@deepseek-ai/dsh-client-ui-chat 0.2.1-alpha.1 → 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 (44) hide show
  1. package/README.i18n.yaml +12 -12
  2. package/README.md +32 -10
  3. package/README.zh.md +32 -10
  4. package/lib/client.js +5764 -5695
  5. package/lib/index.js +11 -1
  6. package/lib/types/chat-settings.d.ts +13 -0
  7. package/lib/types/client/apply.d.ts +5 -0
  8. package/lib/types/client/chat/AssistantMarkdown.d.ts +7 -6
  9. package/lib/types/client/chat/AssistantNodeView.d.ts +3 -3
  10. package/lib/types/client/chat/ChatFlow.d.ts +4 -0
  11. package/lib/types/client/chat/ChatGroupSeat.d.ts +4 -3
  12. package/lib/types/client/chat/ChatNodeSeat.d.ts +11 -8
  13. package/lib/types/client/chat/ChatView.d.ts +1 -1
  14. package/lib/types/client/chat/MessageItem.d.ts +10 -9
  15. package/lib/types/client/chat/ReasoningContent.d.ts +16 -0
  16. package/lib/types/client/chat/ReasoningRow.d.ts +5 -3
  17. package/lib/types/client/chat/TurnTailNodeView.d.ts +1 -1
  18. package/lib/types/client/chat/UserContent.d.ts +9 -0
  19. package/lib/types/client/chat/flow-motion.d.ts +103 -0
  20. package/lib/types/client/chat/searchable-hidden.d.ts +10 -2
  21. package/lib/types/client/chat/turn-trigger.d.ts +1 -1
  22. package/lib/types/client/chat/use-chat-reading.d.ts +22 -4
  23. package/lib/types/client/chat/use-chat-scroll.d.ts +9 -1
  24. package/lib/types/client/chat/use-chat-viewport.d.ts +63 -4
  25. package/lib/types/client/chat/use-scroll-follow.d.ts +4 -3
  26. package/lib/types/client/contract/chat-nodes.d.ts +8 -0
  27. package/lib/types/client/contract/group-tree.d.ts +32 -0
  28. package/lib/types/client/contract/slots.d.ts +133 -20
  29. package/lib/types/client/contract/snapshot.d.ts +5 -0
  30. package/lib/types/client/contract/store.d.ts +3 -1
  31. package/lib/types/client/contract/turn-process.d.ts +0 -2
  32. package/lib/types/client/conversation-nodes/common.d.ts +12 -1
  33. package/lib/types/client/conversation-nodes/group-tree-segments.d.ts +42 -0
  34. package/lib/types/client/index.d.ts +2 -1
  35. package/lib/types/client/locale.d.ts +12 -2
  36. package/lib/types/client/performance-usage.d.ts +2 -2
  37. package/lib/types/client/presentation-policy.d.ts +14 -15
  38. package/lib/types/client/settings/TranscriptViewRow.d.ts +7 -2
  39. package/lib/types/client/stores.d.ts +11 -1
  40. package/lib/types/client/transcript-view.d.ts +9 -1
  41. package/lib/types/index.d.ts +5 -1
  42. package/locale/en.json +5 -0
  43. package/locale/zh.json +6 -0
  44. package/package.json +44 -44
@@ -1,14 +1,13 @@
1
- /**
2
- * Runtime vocabulary derived from the persisted work-details mode. Renderers
3
- * and seats select single fields of this policy; none of them compares the
4
- * mode enum, so adding a mode changes only the table below.
5
- */
1
+ /** Chat presentation derived from Host-backed detail and collapse timing. */
6
2
  import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
7
- import type { TranscriptViewMode } from '../chat-settings.ts';
3
+ import type { CollapseTiming, TranscriptViewMode } from '../chat-settings.ts';
4
+ export { COLLAPSE_TIMINGS, type CollapseTiming } from '../chat-settings.ts';
8
5
  /** Presentation capabilities that one work-details mode enables. */
9
6
  export interface ChatPresentationPolicy {
10
- /** Mode this policy was derived from; for diagnostics, never for branching in renderers. */
7
+ /** Preference identity for layout resets and diagnostics; renderers select the capabilities below. */
11
8
  readonly mode: TranscriptViewMode;
9
+ /** Saved collapse timing; completion retains the default immediate folding and scrolling. */
10
+ readonly collapseTiming: CollapseTiming;
12
11
  /** Whether a normally completed Turn folds its process rows behind the whole-Turn control. */
13
12
  readonly foldCompletedTurns: boolean;
14
13
  /** Collapsible group headers for all Turns, historical Turns only, or no Turns. */
@@ -19,17 +18,17 @@ export interface ChatPresentationPolicy {
19
18
  readonly settledReasoningPreview: boolean;
20
19
  }
21
20
  /**
22
- * Resolve the policy constant for one mode. The same mode always yields the
23
- * same object, so selectors over a policy see stable identities.
21
+ * Resolve a stable policy for one detail mode and collapse timing.
24
22
  * @param mode - persisted work-details mode.
25
- * @returns the mode's presentation policy.
23
+ * @param collapseTiming - persisted timing; defaults to immediate completion folding.
24
+ * @returns the same policy object for the same pair of choices.
26
25
  */
27
- export declare function presentationPolicyFor(mode: TranscriptViewMode): ChatPresentationPolicy;
26
+ export declare function presentationPolicyFor(mode: TranscriptViewMode, collapseTiming?: CollapseTiming): ChatPresentationPolicy;
28
27
  /**
29
- * Derive a policy observable from the mode observable without a subscription of
30
- * its own: reads are a table lookup and change notifications are the mode's.
28
+ * Combine Host-backed detail and persisted timing without owning subscriptions.
31
29
  * @param mode - live work-details mode.
32
- * @returns observable policy that changes exactly when the mode changes.
30
+ * @param collapseTiming - live Host-backed collapse timing.
31
+ * @returns observable policy whose subscriptions follow both preferences.
33
32
  */
34
- export declare function derivePresentationPolicy(mode: ObservableSnapshot<TranscriptViewMode>): ObservableSnapshot<ChatPresentationPolicy>;
33
+ export declare function derivePresentationPolicy(mode: ObservableSnapshot<TranscriptViewMode>, collapseTiming: ObservableSnapshot<CollapseTiming>): ObservableSnapshot<ChatPresentationPolicy>;
35
34
  //# sourceMappingURL=presentation-policy.d.ts.map
@@ -2,21 +2,26 @@
2
2
  import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
3
3
  import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
4
4
  import { type TranscriptViewMode } from '../../chat-settings.ts';
5
+ import { type CollapseTiming } from '../presentation-policy.ts';
5
6
  /** Registration-side work-details preference face. */
6
7
  export interface TranscriptViewRowInjected {
7
8
  hooks: {
8
9
  /** Persisted work-details preference bound as useTranscriptView. */
9
10
  transcriptView: SnapshotStore<TranscriptViewMode>;
11
+ /** Persisted collapse timing bound as useCollapseTiming. */
12
+ collapseTiming: SnapshotStore<CollapseTiming>;
10
13
  };
11
14
  /** Change the work-details presentation. */
12
15
  setTranscriptView: (mode: TranscriptViewMode) => void;
16
+ /** Persist collapse timing independently of the work-details mode. */
17
+ setCollapseTiming: (timing: CollapseTiming) => void;
13
18
  }
14
19
  /** Full Settings-row props. */
15
20
  export type TranscriptViewRowProps = PropsRuntime<'settings.general.item'> & PropsLocale<'chat'> & InjectFace<TranscriptViewRowInjected>;
16
21
  /**
17
- * Render the work-details mode selector.
22
+ * Render the independent, Host-backed work-details and collapse-timing selectors.
18
23
  * @param props - composed Settings slot props.
19
24
  * @returns the preference row.
20
25
  */
21
- export declare function TranscriptViewRow({ useTranscriptView, setTranscriptView, t }: TranscriptViewRowProps): import("react").JSX.Element;
26
+ export declare function TranscriptViewRow({ useTranscriptView, setTranscriptView, useCollapseTiming, setCollapseTiming, t, }: TranscriptViewRowProps): import("react").JSX.Element;
22
27
  //# sourceMappingURL=TranscriptViewRow.d.ts.map
@@ -1,16 +1,26 @@
1
1
  /** Per-Session Chat view store. */
2
2
  import { type EngineStoreHandle } from '@deepseek-ai/dsh-client-store';
3
3
  import type { ChatStoreState, TurnProcessViewEntry } from './contract/store.ts';
4
+ import type { TurnProcessSpec } from './contract/turn-process.ts';
4
5
  type ChatActions = {
5
6
  setTurnProcessOpen: (draft: ChatStoreState, turn: number, answerStep: number, open: boolean) => void;
6
7
  };
7
8
  /**
8
- * Resolve the manually expanded answer for one Turn.
9
+ * Resolve the manual disclosure choice for one Turn.
9
10
  * @param state - Chat store snapshot.
10
11
  * @param turn - owning Turn.
11
12
  * @returns the Turn's stored entry, when present.
12
13
  */
13
14
  export declare function storedTurnProcessEntry(state: Readonly<ChatStoreState>, turn: number): Readonly<TurnProcessViewEntry> | undefined;
15
+ /**
16
+ * Whether a foldable Turn's process is open: the reader's choice for the current answer generation
17
+ * wins; otherwise the latest completed Turn stays open until the next input, and older Turns fold.
18
+ * @param state - Chat store snapshot.
19
+ * @param spec - the Turn's process specification.
20
+ * @param defaultOpen - whether this Turn is exempt from automatic folding.
21
+ * @returns the effective open state.
22
+ */
23
+ export declare function turnProcessOpen(state: Readonly<ChatStoreState>, spec: Pick<TurnProcessSpec, 'turn' | 'answerStep'>, defaultOpen: boolean): boolean;
14
24
  /**
15
25
  * Create the Chat view store handle.
16
26
  * @returns a handle instantiated once per rendered Session scope.
@@ -1,6 +1,7 @@
1
- /** Host-backed work-details presentation policy. */
1
+ /** Independent work-details preferences backed by the same Host configuration form. */
2
2
  import { type SnapshotStore } from '@deepseek-ai/dsh-client-store';
3
3
  import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
4
+ import type { CollapseTiming } from './presentation-policy.ts';
4
5
  import { type ChatSettings, type TranscriptViewMode } from '../chat-settings.ts';
5
6
  /** Live work-details preference consumed by Chat and its Settings row. */
6
7
  export declare class TranscriptViewPolicy {
@@ -9,6 +10,8 @@ export declare class TranscriptViewPolicy {
9
10
  private readonly unsubscribe;
10
11
  /** Reactive current mode, including the client default before Host settings arrive. */
11
12
  readonly mode: SnapshotStore<TranscriptViewMode>;
13
+ /** Reactive collapse timing, defaulting to completion until Host settings arrive. */
14
+ readonly collapseTiming: SnapshotStore<CollapseTiming>;
12
15
  /**
13
16
  * @param host - durable Chat settings scope.
14
17
  * @param defaultMode - presentation used without an explicit saved mode.
@@ -21,6 +24,11 @@ export declare class TranscriptViewPolicy {
21
24
  * @param mode - Compact, Standard, Detailed, or Verbose work details.
22
25
  */
23
26
  setMode(mode: TranscriptViewMode): void;
27
+ /**
28
+ * Publish and persist collapse timing without changing the work-details mode.
29
+ * @param timing - immediate completion folding or deferred folding at the next input.
30
+ */
31
+ setCollapseTiming(timing: CollapseTiming): void;
24
32
  /** Adopt the latest accepted Host section without writing it back. */
25
33
  private adopt;
26
34
  }
@@ -1,11 +1,13 @@
1
1
  import type { Volatile, Context } from '@deepseek-ai/cordis';
2
- import type { ChatSettings, LinkOpening, PerformanceUsageMode } from './chat-settings.ts';
2
+ import type { ChatSettings, CollapseTiming, LinkOpening, PerformanceUsageMode } from './chat-settings.ts';
3
3
  import z from '@deepseek-ai/schemastery';
4
4
  export { CHAT_SETTINGS_NAMESPACE, DEFAULT_TRANSCRIPT_VIEW_MODE, LEGACY_TRANSCRIPT_VIEW_MODE, LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE, TRANSCRIPT_VIEW_FIELD, TRANSCRIPT_VIEW_MODES, type ChatSettings, type TranscriptViewMode, } from './chat-settings.ts';
5
5
  /** Runtime preferences projected to the browser. */
6
6
  export interface Config {
7
7
  /** Completed turn transcript presentation. */
8
8
  transcriptView: Volatile<ChatSettings['transcriptView']>;
9
+ /** When completed work details return to their historical presentation. */
10
+ collapseTiming: Volatile<CollapseTiming>;
9
11
  /** Performance and usage detail level. */
10
12
  performanceUsage: Volatile<PerformanceUsageMode>;
11
13
  /** Default destination for Chat HTTP(S) links. */
@@ -14,10 +16,12 @@ export interface Config {
14
16
  /** Live preferences projected to the browser. */
15
17
  export declare const Config: z<Schemastery.ObjectS<NoInfer<{
16
18
  transcriptView: z<"compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "volatile">;
19
+ collapseTiming: z<"completion" | "next-input", "completion" | "next-input", "volatile-defined">;
17
20
  performanceUsage: z<"compact" | "detailed", "compact" | "detailed", "volatile-defined">;
18
21
  linkOpening: z<"sidebar" | "new-tab", "sidebar" | "new-tab", "volatile-defined">;
19
22
  }>>, Schemastery.ObjectT<NoInfer<{
20
23
  transcriptView: z<"compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "volatile">;
24
+ collapseTiming: z<"completion" | "next-input", "completion" | "next-input", "volatile-defined">;
21
25
  performanceUsage: z<"compact" | "detailed", "compact" | "detailed", "volatile-defined">;
22
26
  linkOpening: z<"sidebar" | "new-tab", "sidebar" | "new-tab", "volatile-defined">;
23
27
  }>>, "plain">;
package/locale/en.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "meta": {
3
+ "title": "ui-chat"
4
+ }
5
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "聊天内容展示",
4
+ "description": "渲染聊天消息、工具内容和相关详情。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-client-ui-chat",
3
3
  "description": "Chat Conversation target, node definitions, renderers, and details surface",
4
- "version": "0.2.1-alpha.1",
4
+ "version": "0.2.1-alpha.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -23,7 +23,8 @@
23
23
  "default": "./lib/client.js"
24
24
  },
25
25
  "./src/*": "./src/*",
26
- "./package.json": "./package.json"
26
+ "./package.json": "./package.json",
27
+ "./locale/*.json": "./locale/*.json"
27
28
  },
28
29
  "dsh": {
29
30
  "client": {
@@ -45,56 +46,55 @@
45
46
  },
46
47
  "license": "MIT",
47
48
  "peerDependencies": {
48
- "@deepseek-ai/cordis": "~4.0.5-alpha.1"
49
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2"
49
50
  },
50
51
  "devDependencies": {
51
- "@tanstack/react-virtual": "^3.14.9",
52
- "@types/react": "~18.3.1",
53
- "@types/react-dom": "~18.3.0",
52
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
53
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
54
+ "@deepseek-ai/dsh-api-remotes": "0.2.1-alpha.3",
55
+ "@deepseek-ai/dsh-api-session-controller": "0.2.1-alpha.3",
56
+ "@deepseek-ai/dsh-api-workspace-controller": "0.2.1-alpha.3",
57
+ "@deepseek-ai/dsh-api-workspace-files": "0.2.1-alpha.3",
58
+ "@deepseek-ai/dsh-attachment": "0.2.1-alpha.3",
59
+ "@deepseek-ai/dsh-brand": "0.2.1-alpha.3",
60
+ "@deepseek-ai/dsh-client-locale": "0.2.1-alpha.3",
61
+ "@deepseek-ai/dsh-client-store": "0.2.1-alpha.3",
62
+ "@deepseek-ai/dsh-client-ui-approval": "0.2.1-alpha.3",
63
+ "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-alpha.3",
64
+ "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.1-alpha.3",
65
+ "@deepseek-ai/dsh-client-ui-layout": "0.2.1-alpha.3",
66
+ "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-alpha.3",
67
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.3",
68
+ "@deepseek-ai/dsh-client-ui-session": "0.2.1-alpha.3",
69
+ "@deepseek-ai/dsh-client-ui-settings": "0.2.1-alpha.3",
70
+ "@deepseek-ai/dsh-client-ui-sidebar-browser": "0.2.1-alpha.3",
71
+ "@deepseek-ai/dsh-client-ui-sidebar-documentpreview": "0.2.1-alpha.3",
72
+ "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-alpha.3",
73
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.3",
74
+ "@deepseek-ai/dsh-client-ui-workspace": "0.2.1-alpha.3",
75
+ "@deepseek-ai/dsh-commands": "0.2.1-alpha.3",
76
+ "@deepseek-ai/dsh-compaction": "0.2.1-alpha.3",
77
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
78
+ "@deepseek-ai/dsh-llm-retry": "0.2.1-alpha.3",
79
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
80
+ "@deepseek-ai/dsh-session-stats": "0.2.1-alpha.3",
81
+ "@deepseek-ai/dsh-session-turn-outline": "0.2.1-alpha.3",
82
+ "@deepseek-ai/dsh-subagent": "0.2.1-alpha.3",
83
+ "@deepseek-ai/dsh-token-meter": "0.2.1-alpha.3",
84
+ "@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
85
+ "@deepseek-ai/dsh-util-workspace-path": "0.2.1-alpha.3",
86
+ "@deepseek-ai/dsh-util-values": "0.2.1-alpha.3",
87
+ "@tanstack/react-virtual": "3.14.10",
54
88
  "react": "^18.2.0",
55
89
  "react-dom": "^18.2.0",
56
- "@deepseek-ai/cordis": "~4.0.5-alpha.1",
57
- "@deepseek-ai/dsh-agent": "0.2.1-alpha.1",
58
- "@deepseek-ai/dsh-api-remotes": "0.2.1-alpha.1",
59
- "@deepseek-ai/dsh-api-session-controller": "0.2.1-alpha.1",
60
- "@deepseek-ai/dsh-api-workspace-controller": "0.2.1-alpha.1",
61
- "@deepseek-ai/dsh-api-workspace-files": "0.2.1-alpha.1",
62
- "@deepseek-ai/dsh-attachment": "0.2.1-alpha.1",
63
- "@deepseek-ai/dsh-brand": "0.2.1-alpha.1",
64
- "@deepseek-ai/dsh-client-locale": "0.2.1-alpha.1",
65
- "@deepseek-ai/dsh-client-store": "0.2.1-alpha.1",
66
- "@deepseek-ai/dsh-client-ui-approval": "0.2.1-alpha.1",
67
- "@deepseek-ai/dsh-client-ui-conversation": "0.2.1-alpha.1",
68
- "@deepseek-ai/dsh-client-ui-input-trigger": "0.2.1-alpha.1",
69
- "@deepseek-ai/dsh-client-ui-layout": "0.2.1-alpha.1",
70
- "@deepseek-ai/dsh-client-ui-primitives": "0.2.1-alpha.1",
71
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-alpha.1",
72
- "@deepseek-ai/dsh-client-ui-session": "0.2.1-alpha.1",
73
- "@deepseek-ai/dsh-client-ui-settings": "0.2.1-alpha.1",
74
- "@deepseek-ai/dsh-client-ui-sidebar-browser": "0.2.1-alpha.1",
75
- "@deepseek-ai/dsh-client-ui-sidebar-documentpreview": "0.2.1-alpha.1",
76
- "@deepseek-ai/dsh-client-ui-workspace": "0.2.1-alpha.1",
77
- "@deepseek-ai/dsh-commands": "0.2.1-alpha.1",
78
- "@deepseek-ai/dsh-compaction": "0.2.1-alpha.1",
79
- "@deepseek-ai/dsh-llm": "0.2.1-alpha.1",
80
- "@deepseek-ai/dsh-llm-retry": "0.2.1-alpha.1",
81
- "@deepseek-ai/dsh-session": "0.2.1-alpha.1",
82
- "@deepseek-ai/dsh-session-stats": "0.2.1-alpha.1",
83
- "@deepseek-ai/dsh-session-turn-outline": "0.2.1-alpha.1",
84
- "@deepseek-ai/dsh-token-meter": "0.2.1-alpha.1",
85
- "@deepseek-ai/dsh-tools": "0.2.1-alpha.1",
86
- "@deepseek-ai/dsh-subagent": "0.2.1-alpha.1",
87
- "@deepseek-ai/dsh-util-workspace-path": "0.2.1-alpha.1",
88
- "@deepseek-ai/dsh-util-values": "0.2.1-alpha.1",
89
- "@deepseek-ai/dsh-settings": "0.2.1-alpha.1",
90
- "@deepseek-ai/dsh-client-product-analytics": "0.2.1-alpha.1",
91
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-alpha.1",
92
- "@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.1-alpha.1"
90
+ "@deepseek-ai/dsh-settings": "0.2.1-alpha.3",
91
+ "@deepseek-ai/dsh-client-product-analytics": "0.2.1-alpha.3"
93
92
  },
94
93
  "dependencies": {
95
- "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
94
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.2"
96
95
  },
97
96
  "files": [
97
+ "locale/*.json",
98
98
  "lib/index.js",
99
99
  "lib/client.js",
100
100
  "lib/types/**/*.d.ts"