@crazx/dsh-client-ui-conversation 0.1.5-alpha.1.zw.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.
- package/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +127 -0
- package/README.zh.md +127 -0
- package/lib/client.js +16935 -0
- package/lib/index.js +27 -0
- package/lib/types/client/apply.d.ts +25 -0
- package/lib/types/client/context-occupancy.d.ts +14 -0
- package/lib/types/client/contract/composer-blocks.d.ts +28 -0
- package/lib/types/client/contract/composer-submission.d.ts +8 -0
- package/lib/types/client/contract/context-provenance.d.ts +29 -0
- package/lib/types/client/contract/conversation.d.ts +256 -0
- package/lib/types/client/contract/input.d.ts +427 -0
- package/lib/types/client/contract/queue.d.ts +9 -0
- package/lib/types/client/contract/records.d.ts +272 -0
- package/lib/types/client/contract/request-inspection.d.ts +131 -0
- package/lib/types/client/contract/slots.d.ts +409 -0
- package/lib/types/client/contract/snapshot.d.ts +20 -0
- package/lib/types/client/contract/system-prompt.d.ts +35 -0
- package/lib/types/client/contract/views.d.ts +26 -0
- package/lib/types/client/conversation/assembler.d.ts +128 -0
- package/lib/types/client/conversation/assembly.d.ts +97 -0
- package/lib/types/client/conversation/definition-registry.d.ts +33 -0
- package/lib/types/client/conversation/event-registry.d.ts +24 -0
- package/lib/types/client/conversation/historical-images.d.ts +51 -0
- package/lib/types/client/conversation/location-index.d.ts +85 -0
- package/lib/types/client/conversation/view-registry.d.ts +12 -0
- package/lib/types/client/image-labels.d.ts +23 -0
- package/lib/types/client/index.d.ts +36 -0
- package/lib/types/client/input/blocks.d.ts +27 -0
- package/lib/types/client/input/decorations.d.ts +32 -0
- package/lib/types/client/input/editor/ComposerContentEditable.d.ts +16 -0
- package/lib/types/client/input/editor/DecoratorPortals.d.ts +14 -0
- package/lib/types/client/input/editor/ReferenceChip.d.ts +17 -0
- package/lib/types/client/input/editor/chip-node.d.ts +110 -0
- package/lib/types/client/input/editor/claim-decor.d.ts +23 -0
- package/lib/types/client/input/editor/keymap.d.ts +41 -0
- package/lib/types/client/input/editor/projection.d.ts +93 -0
- package/lib/types/client/input/editor/span-map.d.ts +38 -0
- package/lib/types/client/input/editor/text-ref.d.ts +60 -0
- package/lib/types/client/input/facade.d.ts +298 -0
- package/lib/types/client/input/hub.d.ts +88 -0
- package/lib/types/client/input/machine.d.ts +46 -0
- package/lib/types/client/input/queue-store.d.ts +20 -0
- package/lib/types/client/input/submission-policy.d.ts +52 -0
- package/lib/types/client/locales.d.ts +330 -0
- package/lib/types/client/queue/QueueDock.d.ts +26 -0
- package/lib/types/client/service.d.ts +185 -0
- package/lib/types/client/settings/EnterBehaviorRow.d.ts +21 -0
- package/lib/types/client/skeleton/ContextMeter.d.ts +14 -0
- package/lib/types/client/skeleton/ConversationRoot.d.ts +5 -0
- package/lib/types/client/skeleton/ConversationSession.d.ts +26 -0
- package/lib/types/client/skeleton/EmptyHero.d.ts +46 -0
- package/lib/types/client/skeleton/InputBar.d.ts +18 -0
- package/lib/types/client/skeleton/PermissionSelect.d.ts +11 -0
- package/lib/types/client/skeleton/TodoPanel.d.ts +21 -0
- package/lib/types/client/skeleton/safari.d.ts +18 -0
- package/lib/types/client/skeleton/toolbar-hosts.d.ts +17 -0
- package/lib/types/client/stores.d.ts +24 -0
- package/lib/types/client/view-selection.d.ts +9 -0
- package/lib/types/index.d.ts +9 -0
- package/lib/types/submission-settings.d.ts +20 -0
- package/package.json +103 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
/** Target-neutral Conversation slot declarations and composed component props. */
|
|
2
|
+
import type { ReactNode, RefObject } from 'react';
|
|
3
|
+
import type { FileAttachmentRef, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
4
|
+
import type { SessionSnapshot } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
5
|
+
import type { FileUploadReceiptId } from '@deepseek-ai/dsh-client-file-upload/client';
|
|
6
|
+
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client';
|
|
7
|
+
import type { MaybeSnapshotSelectorHook, ObservableSnapshot, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
|
|
8
|
+
import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
|
|
9
|
+
import type { SessionPendingInteraction } from '@deepseek-ai/dsh-client-ui-session/client';
|
|
10
|
+
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
11
|
+
import type { WorkspaceId } from '@deepseek-ai/dsh-workspace/types';
|
|
12
|
+
import type { ComposerBlock } from './composer-blocks.ts';
|
|
13
|
+
import type { ComposerKeyboard, DraftAttachmentId, EditSelection, InputActions, InputNotice, InputState } from './input.ts';
|
|
14
|
+
import type { createConversationStore } from '../stores.ts';
|
|
15
|
+
import type { BusyEnterBehavior } from './composer-submission.ts';
|
|
16
|
+
import type { ConversationSnapshot } from './snapshot.ts';
|
|
17
|
+
import type { ViewTab } from './views.ts';
|
|
18
|
+
/** Browser-owned draft attachment that has not crossed the durable Host boundary. */
|
|
19
|
+
export type ComposerAttachment = ComposerImageAttachment | ComposerFileAttachment;
|
|
20
|
+
/** Browser-owned image, base64-encoded into the prompt at send time. */
|
|
21
|
+
export interface ComposerImageAttachment {
|
|
22
|
+
kind: 'image';
|
|
23
|
+
id: DraftAttachmentId;
|
|
24
|
+
file: File;
|
|
25
|
+
previewUrl: string;
|
|
26
|
+
/** Intrinsic pixel width, filled asynchronously by the intake header probe. */
|
|
27
|
+
width?: number;
|
|
28
|
+
/** Intrinsic pixel height, filled asynchronously by the intake header probe. */
|
|
29
|
+
height?: number;
|
|
30
|
+
}
|
|
31
|
+
/** Browser-owned generic file whose bytes upload to the Host as soon as it is picked. */
|
|
32
|
+
export interface ComposerFileAttachment {
|
|
33
|
+
kind: 'file';
|
|
34
|
+
id: DraftAttachmentId;
|
|
35
|
+
file: File;
|
|
36
|
+
}
|
|
37
|
+
/** Upload lifecycle of one picked file draft (files upload on pick, not on send). */
|
|
38
|
+
export type DraftFileUpload = {
|
|
39
|
+
readonly status: 'uploading';
|
|
40
|
+
readonly loaded: number;
|
|
41
|
+
readonly total?: number;
|
|
42
|
+
} | {
|
|
43
|
+
readonly status: 'ready';
|
|
44
|
+
readonly receiptId: FileUploadReceiptId;
|
|
45
|
+
readonly file: FileAttachmentRef;
|
|
46
|
+
} | {
|
|
47
|
+
readonly status: 'error';
|
|
48
|
+
readonly message: string;
|
|
49
|
+
};
|
|
50
|
+
/** Per-draft upload states keyed by draft attachment id. */
|
|
51
|
+
export type DraftFileUploads = Readonly<Record<string, DraftFileUpload>>;
|
|
52
|
+
/** Input state handed to the optional attachment presentation plugin. */
|
|
53
|
+
export interface ComposerAttachmentsOwnerProps {
|
|
54
|
+
/** Browser-owned draft attachments in input order. */
|
|
55
|
+
attachments: readonly ComposerAttachment[];
|
|
56
|
+
/** Whether a document-level file drop may add attachments now. */
|
|
57
|
+
canAcceptDrop: boolean;
|
|
58
|
+
/** Add one dropped batch through the composer's validation path. */
|
|
59
|
+
onAddFiles: (files: readonly File[]) => void;
|
|
60
|
+
/** Remove one draft attachment through the Conversation service. */
|
|
61
|
+
onRemoveAttachment: (id: DraftAttachmentId) => void;
|
|
62
|
+
/** Current per-draft upload states for file-kind attachments. */
|
|
63
|
+
uploads: DraftFileUploads;
|
|
64
|
+
/** Restart one failed file upload. */
|
|
65
|
+
onRetryFile: (id: DraftAttachmentId) => void;
|
|
66
|
+
/** Display-ready limits for the drop invitation. */
|
|
67
|
+
dropLimits?: {
|
|
68
|
+
readonly count: number;
|
|
69
|
+
readonly size: string;
|
|
70
|
+
} | undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* One image inside a message record: a durable admitted reference, or the
|
|
74
|
+
* local preview of a submission echo whose admission is still in flight.
|
|
75
|
+
*/
|
|
76
|
+
export type MessageImageSource = {
|
|
77
|
+
readonly attachment: ImageAttachmentRef;
|
|
78
|
+
} | {
|
|
79
|
+
readonly preview: {
|
|
80
|
+
/** Browser-owned preview URL (lifecycle stays with the submitter). */
|
|
81
|
+
readonly url: string;
|
|
82
|
+
readonly name?: string;
|
|
83
|
+
/** Intrinsic pixel width, when the intake probe has resolved it. */
|
|
84
|
+
readonly width?: number;
|
|
85
|
+
/** Intrinsic pixel height, when the intake probe has resolved it. */
|
|
86
|
+
readonly height?: number;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/** Durable image loader with an optional synchronous cache read. */
|
|
90
|
+
export type MessageImageLoader = ((attachment: ImageAttachmentRef) => Promise<string>) & {
|
|
91
|
+
peek?: (attachment: ImageAttachmentRef) => string | undefined;
|
|
92
|
+
};
|
|
93
|
+
/** Message image group handed to the optional attachment presentation plugin. */
|
|
94
|
+
export interface MessageImagesOwnerProps {
|
|
95
|
+
/** Durable references or submission-echo previews in source order. */
|
|
96
|
+
images: readonly MessageImageSource[];
|
|
97
|
+
/** Session-authorized image URL loader for the durable arm. */
|
|
98
|
+
loadImage: MessageImageLoader;
|
|
99
|
+
/** Horizontal placement inside the owning record. */
|
|
100
|
+
align: 'start' | 'end';
|
|
101
|
+
/** Force every image into the compact message-attachment tile size. */
|
|
102
|
+
compact?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/** Slot-backed renderer used by Conversation targets without importing an attachment implementation. */
|
|
105
|
+
export type RenderMessageImages = (owner: Omit<MessageImagesOwnerProps, 'loadImage'>) => ReactNode;
|
|
106
|
+
/** Selector hook over the current Session's assembled Conversation. */
|
|
107
|
+
export type UseConversation = SnapshotSelectorHook<ConversationSnapshot>;
|
|
108
|
+
/** Selector hook over the registered Conversation View roster. */
|
|
109
|
+
export type UseConversationViews = SnapshotSelectorHook<readonly ViewTab[]>;
|
|
110
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
111
|
+
interface SlotMap {
|
|
112
|
+
/** Strict per-Session Conversation body. */
|
|
113
|
+
'conversation.session': {
|
|
114
|
+
kind: 'single';
|
|
115
|
+
scope: 'session';
|
|
116
|
+
};
|
|
117
|
+
/** Strict per-Session title, actions, and View navigation. */
|
|
118
|
+
'conversation.session.header': {
|
|
119
|
+
kind: 'single';
|
|
120
|
+
scope: 'session';
|
|
121
|
+
};
|
|
122
|
+
/** Optional replacement for one Session breadcrumb title. */
|
|
123
|
+
'conversation.session.header.lineage': {
|
|
124
|
+
kind: 'single';
|
|
125
|
+
scope: 'session';
|
|
126
|
+
owner: ConversationHeaderLineageOwnerProps;
|
|
127
|
+
};
|
|
128
|
+
/** Title-adjacent Session actions in ascending order. */
|
|
129
|
+
'conversation.session.header.actions': {
|
|
130
|
+
kind: 'list';
|
|
131
|
+
scope: 'session';
|
|
132
|
+
owner: ConversationHeaderActionOwnerProps;
|
|
133
|
+
};
|
|
134
|
+
/** Right-aligned Session utilities in ascending order. */
|
|
135
|
+
'conversation.session.header.utilities': {
|
|
136
|
+
kind: 'list';
|
|
137
|
+
scope: 'session';
|
|
138
|
+
owner: ConversationHeaderActionOwnerProps;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* The header's far-right corner, past the utilities' edge and into the
|
|
142
|
+
* header's own padding, for one control that must keep its place whether or
|
|
143
|
+
* not it currently shows anything. The corner reserves its width while an
|
|
144
|
+
* occupant is registered, so the utilities beside it never move; an
|
|
145
|
+
* occupant with nothing to show renders a same-size placeholder.
|
|
146
|
+
*/
|
|
147
|
+
'conversation.session.header.corner': {
|
|
148
|
+
kind: 'single';
|
|
149
|
+
scope: 'session';
|
|
150
|
+
owner: ConversationHeaderCornerOwnerProps;
|
|
151
|
+
};
|
|
152
|
+
/** Registered Conversation target Views, rendered one at a time. */
|
|
153
|
+
'conversation.view': {
|
|
154
|
+
kind: 'list';
|
|
155
|
+
scope: 'session';
|
|
156
|
+
owner: ConvViewOwnerProps;
|
|
157
|
+
};
|
|
158
|
+
/** Selector-routed replacements for the current Session's resident composer. */
|
|
159
|
+
'conversation.composer': {
|
|
160
|
+
kind: 'chain';
|
|
161
|
+
scope: 'session';
|
|
162
|
+
owner: ComposerChainProps;
|
|
163
|
+
};
|
|
164
|
+
/** Workspace picker shown by the blank-session Hero. */
|
|
165
|
+
'conversation.hero.workspace': {
|
|
166
|
+
kind: 'single';
|
|
167
|
+
scope: 'root';
|
|
168
|
+
owner: EmptyWorkspaceOwnerProps;
|
|
169
|
+
};
|
|
170
|
+
/** Brand mark shown before the blank-session headline. */
|
|
171
|
+
'conversation.hero.brand.mark': {
|
|
172
|
+
kind: 'single';
|
|
173
|
+
scope: 'root';
|
|
174
|
+
owner: HeroBrandMarkOwnerProps;
|
|
175
|
+
};
|
|
176
|
+
/** Agent-preset control staged for a New Session. */
|
|
177
|
+
'conversation.hero.agentPreset': {
|
|
178
|
+
kind: 'single';
|
|
179
|
+
scope: 'root';
|
|
180
|
+
owner: HeroAgentPresetOwnerProps;
|
|
181
|
+
};
|
|
182
|
+
/** Full-width entries above the composer card. */
|
|
183
|
+
'conversation.input.dock': {
|
|
184
|
+
kind: 'list';
|
|
185
|
+
scope: 'session';
|
|
186
|
+
owner: InputZone;
|
|
187
|
+
};
|
|
188
|
+
/** Floating entries rendered inside the resident composer card. */
|
|
189
|
+
'conversation.input.overlay': {
|
|
190
|
+
kind: 'list';
|
|
191
|
+
scope: 'session';
|
|
192
|
+
};
|
|
193
|
+
/** Ambient entries below the composer card. */
|
|
194
|
+
'conversation.composer.dock': {
|
|
195
|
+
kind: 'list';
|
|
196
|
+
scope: 'session';
|
|
197
|
+
};
|
|
198
|
+
/** Compact controls at the left of the composer tool row. */
|
|
199
|
+
'conversation.input.left': {
|
|
200
|
+
kind: 'list';
|
|
201
|
+
scope: 'session';
|
|
202
|
+
};
|
|
203
|
+
/** Compact controls before the composer submit action. */
|
|
204
|
+
'conversation.input.right': {
|
|
205
|
+
kind: 'list';
|
|
206
|
+
scope: 'session';
|
|
207
|
+
};
|
|
208
|
+
/** Resident composer body, including the no-Session inert state. */
|
|
209
|
+
'conversation.composer.bar': {
|
|
210
|
+
kind: 'single';
|
|
211
|
+
scope: 'session-maybe';
|
|
212
|
+
owner: ComposerBarOwnerProps;
|
|
213
|
+
};
|
|
214
|
+
/** Optional draft-attachment rail and drop target. */
|
|
215
|
+
'conversation.input.attachments': {
|
|
216
|
+
kind: 'single';
|
|
217
|
+
scope: 'session-maybe';
|
|
218
|
+
owner: ComposerAttachmentsOwnerProps;
|
|
219
|
+
};
|
|
220
|
+
/** Plan control inside the composer tool row. */
|
|
221
|
+
'conversation.input.plan': {
|
|
222
|
+
kind: 'single';
|
|
223
|
+
scope: 'session';
|
|
224
|
+
owner: InputControlOwnerProps;
|
|
225
|
+
};
|
|
226
|
+
/** Model selector inside the composer tool row. */
|
|
227
|
+
'conversation.input.model': {
|
|
228
|
+
kind: 'single';
|
|
229
|
+
scope: 'session';
|
|
230
|
+
owner: InputControlOwnerProps;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
interface GlobalStandardProps {
|
|
234
|
+
/** Workspace selector supplied by the independently loaded Workspace UI. */
|
|
235
|
+
useWorkspaces: SnapshotSelectorHook<WorkspaceSnapshot>;
|
|
236
|
+
}
|
|
237
|
+
interface SessionStandardProps {
|
|
238
|
+
/** Selector hook over target-neutral Conversation assembly. */
|
|
239
|
+
useConversation: UseConversation;
|
|
240
|
+
/** Selector hook over the Session input machine. */
|
|
241
|
+
useInput: SnapshotSelectorHook<InputState>;
|
|
242
|
+
/** Stable public input actions for this Session. */
|
|
243
|
+
inputActions: InputActions;
|
|
244
|
+
}
|
|
245
|
+
interface SessionMaybeStandardProps {
|
|
246
|
+
/** Selector hook whose values are absent without a current Session. */
|
|
247
|
+
useConversation: MaybeSnapshotSelectorHook<ConversationSnapshot>;
|
|
248
|
+
/** Input values are absent without a current Session. */
|
|
249
|
+
useInput: MaybeSnapshotSelectorHook<InputState>;
|
|
250
|
+
/** Input actions are absent without a current Session. */
|
|
251
|
+
inputActions: InputActions | undefined;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/** Owner share of the Hero agent-preset control. */
|
|
255
|
+
export interface HeroAgentPresetOwnerProps {
|
|
256
|
+
/** Marker field: the occupant owns its roster and staged selection. */
|
|
257
|
+
children?: never;
|
|
258
|
+
}
|
|
259
|
+
/** Header actions derive their state from standard Session props. */
|
|
260
|
+
export interface ConversationHeaderActionOwnerProps {
|
|
261
|
+
/** Marker field: entries receive no owner-specific values. */
|
|
262
|
+
children?: never;
|
|
263
|
+
}
|
|
264
|
+
/** The header corner's occupant derives its state from standard Session props. */
|
|
265
|
+
export interface ConversationHeaderCornerOwnerProps {
|
|
266
|
+
/** Marker field: the occupant receives no owner-specific values. */
|
|
267
|
+
children?: never;
|
|
268
|
+
}
|
|
269
|
+
/** Plain breadcrumb data handed to the optional lineage renderer. */
|
|
270
|
+
export interface ConversationHeaderLineageOwnerProps {
|
|
271
|
+
/** Session represented by this breadcrumb title. */
|
|
272
|
+
lineageSessionId: SessionId;
|
|
273
|
+
/** Display title available to a combined title/control renderer. */
|
|
274
|
+
displayTitle: string;
|
|
275
|
+
/** Navigate to an ancestor title when present. */
|
|
276
|
+
openTitle?: () => void;
|
|
277
|
+
}
|
|
278
|
+
/** Point-in-time owner values for composer extension entries. */
|
|
279
|
+
export interface InputZone {
|
|
280
|
+
readonly session: SessionSnapshot;
|
|
281
|
+
readonly input: InputState;
|
|
282
|
+
}
|
|
283
|
+
/** Conversation View entries obtain their data from registered standard hooks. */
|
|
284
|
+
export interface ConvViewOwnerProps {
|
|
285
|
+
/** Focus request addressed to the selected View. */
|
|
286
|
+
viewRequest: import('./views.ts').ConversationViewRequest | null;
|
|
287
|
+
/** Select a View and address one opaque focus identity to it. */
|
|
288
|
+
openView: (view: string, focus: string) => void;
|
|
289
|
+
/** Acknowledge the current one-shot focus request. */
|
|
290
|
+
completeViewRequest: () => void;
|
|
291
|
+
}
|
|
292
|
+
/** Base props of one target-owned Conversation View entry. */
|
|
293
|
+
export type ConvViewProps = PropsRuntime<'conversation.view'>;
|
|
294
|
+
/** Business callbacks injected into the resident Conversation shell. */
|
|
295
|
+
export interface ConversationInjected {
|
|
296
|
+
/** Connect and open a blank Session in the selected Workspace. */
|
|
297
|
+
selectWorkspace: (workspaceId: WorkspaceId) => Promise<void>;
|
|
298
|
+
/** Session-addressed composer block source, or the stable absent source. */
|
|
299
|
+
hooks: {
|
|
300
|
+
composerBlock: ObservableSnapshot<ComposerBlock | undefined>;
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
/** Business callbacks injected into the strict Session body. */
|
|
304
|
+
export interface ConversationSessionInjected {
|
|
305
|
+
/** Package-owned View roster source bound only for the Conversation body. */
|
|
306
|
+
readonly hooks: {
|
|
307
|
+
readonly conversationViews: ObservableSnapshot<readonly ViewTab[]>;
|
|
308
|
+
};
|
|
309
|
+
/** Bind input draft persistence to the Session-owned store instance. */
|
|
310
|
+
bindDraftMirror: (write: (text: string) => void) => () => void;
|
|
311
|
+
/** Select and activate one View while addressing an opaque focus request to it. */
|
|
312
|
+
openView: (view: string, focus: string) => void;
|
|
313
|
+
}
|
|
314
|
+
/** Business callbacks injected into the strict Session header. */
|
|
315
|
+
export interface ConversationSessionHeaderInjected {
|
|
316
|
+
/** Package-owned View roster source bound only for the Conversation header. */
|
|
317
|
+
readonly hooks: {
|
|
318
|
+
readonly conversationViews: ObservableSnapshot<readonly ViewTab[]>;
|
|
319
|
+
};
|
|
320
|
+
/** Select a Session through the Session Controller. */
|
|
321
|
+
open: (sessionId: SessionId) => void;
|
|
322
|
+
/** Select and activate one registered Conversation View. */
|
|
323
|
+
selectView: (view: string) => void;
|
|
324
|
+
}
|
|
325
|
+
/** Owner share of the resident composer bar. */
|
|
326
|
+
export interface ComposerBarOwnerProps {
|
|
327
|
+
/** Hero uses centered placement; composer uses the active bottom placement. */
|
|
328
|
+
variant: 'hero' | 'composer';
|
|
329
|
+
/** A feature-owned reason that makes message input inert while leaving model selection live. */
|
|
330
|
+
blocked?: {
|
|
331
|
+
readonly reason: string;
|
|
332
|
+
};
|
|
333
|
+
/** Lock all message actions while preserving the resident composer surface. */
|
|
334
|
+
disabled?: boolean;
|
|
335
|
+
/** Whether the shared Workspace picker is expanded. */
|
|
336
|
+
workspacePickerOpen?: boolean;
|
|
337
|
+
/** Open the Workspace picker from the inert composer surface. */
|
|
338
|
+
onRequestWorkspace?: () => void;
|
|
339
|
+
placeholder?: string;
|
|
340
|
+
/** Optional content rendered above the composer surface. */
|
|
341
|
+
accessory?: ReactNode;
|
|
342
|
+
}
|
|
343
|
+
/** Package-private operations injected into the resident composer bar. */
|
|
344
|
+
export interface ComposerBarInjected {
|
|
345
|
+
keyboard: ComposerKeyboard | undefined;
|
|
346
|
+
addFiles: ((files: readonly File[]) => string | null) | undefined;
|
|
347
|
+
removeAttachment: ((id: DraftAttachmentId) => void) | undefined;
|
|
348
|
+
resolveDraftAttachments: ((ids: readonly DraftAttachmentId[]) => readonly ComposerAttachment[]) | undefined;
|
|
349
|
+
/** Restart one failed file upload; absent without a session. */
|
|
350
|
+
retryFileUpload: ((id: DraftAttachmentId) => void) | undefined;
|
|
351
|
+
toggleCommandMenu: ((selection: EditSelection) => void) | undefined;
|
|
352
|
+
stop: (() => void) | undefined;
|
|
353
|
+
command: ((line: string) => Promise<boolean>) | undefined;
|
|
354
|
+
hooks: {
|
|
355
|
+
/**
|
|
356
|
+
* Live busy-state submission preference: the delivery mode plain Enter
|
|
357
|
+
* and the primary Send button use while the addressed agent is busy.
|
|
358
|
+
*/
|
|
359
|
+
busyEnter: ObservableSnapshot<BusyEnterBehavior>;
|
|
360
|
+
/** Live per-draft upload states for file-kind drafts. */
|
|
361
|
+
fileUploads: ObservableSnapshot<DraftFileUploads>;
|
|
362
|
+
notices: ObservableSnapshot<InputNotice | null>;
|
|
363
|
+
lexicon: ObservableSnapshot<ReadonlyMap<'/' | '@', readonly string[]>>;
|
|
364
|
+
menuLauncher: ObservableSnapshot<string | null>;
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
/** Owner share of the named plan and model controls. */
|
|
368
|
+
export interface InputControlOwnerProps {
|
|
369
|
+
/** Whether the composer currently refuses interaction. */
|
|
370
|
+
locked: boolean;
|
|
371
|
+
}
|
|
372
|
+
/** Full props of the resident composer bar. */
|
|
373
|
+
export type ComposerBarProps = PropsRuntime<'conversation.composer.bar'> & PropsRenderSlots<'conversation.input.attachments' | 'conversation.input.overlay' | 'conversation.input.left' | 'conversation.input.plan' | 'conversation.input.right' | 'conversation.input.model' | 'conversation.composer.dock'> & InjectFace<ComposerBarInjected> & PropsLocale<'conversation'>;
|
|
374
|
+
/** Owner values used to elect a composer takeover. */
|
|
375
|
+
export interface ComposerChainProps {
|
|
376
|
+
/** Current Session identity used by temporary business-owned entries. */
|
|
377
|
+
sessionId: SessionId | undefined;
|
|
378
|
+
/** Current Session lifecycle state, absent without a selected Session. */
|
|
379
|
+
session: SessionSnapshot | undefined;
|
|
380
|
+
/** Effective business-owned interaction awaiting the user in this Session. */
|
|
381
|
+
pendingInteraction: SessionPendingInteraction | undefined;
|
|
382
|
+
}
|
|
383
|
+
/** Presentation props supplied to the blank-session brand mark. */
|
|
384
|
+
export interface HeroBrandMarkOwnerProps {
|
|
385
|
+
/** Requested square edge in pixels. */
|
|
386
|
+
size: number;
|
|
387
|
+
/** Host class preserving the surrounding mark geometry. */
|
|
388
|
+
className?: string | undefined;
|
|
389
|
+
}
|
|
390
|
+
/** Full props of the resident optional-Session Conversation shell. */
|
|
391
|
+
export type ConversationSlotProps = PropsRuntime<'conversation'> & PropsRenderSlots<'conversation.session' | 'conversation.session.header' | 'conversation.composer' | 'conversation.composer.bar' | 'conversation.input.dock' | 'conversation.hero.brand.mark' | 'conversation.hero.workspace' | 'conversation.hero.agentPreset'> & InjectFace<ConversationInjected> & PropsLocale<'conversation'>;
|
|
392
|
+
/** Shared target-neutral Conversation store handle. */
|
|
393
|
+
export type ConversationStore = ReturnType<typeof createConversationStore>;
|
|
394
|
+
/** Full props of the strict Session body. */
|
|
395
|
+
export type ConversationSessionSlotProps = PropsRuntime<'conversation.session'> & PropsRenderSlots<'conversation.view'> & PropsStore<ConversationStore> & InjectFace<ConversationSessionInjected>;
|
|
396
|
+
/** Full props of the strict Session header. */
|
|
397
|
+
export type ConversationSessionHeaderSlotProps = PropsRuntime<'conversation.session.header'> & PropsRenderSlots<'conversation.session.header.lineage' | 'conversation.session.header.actions' | 'conversation.session.header.utilities' | 'conversation.session.header.corner'> & PropsStore<ConversationStore> & InjectFace<ConversationSessionHeaderInjected> & PropsLocale<'conversation'>;
|
|
398
|
+
/** Full props of the draft-attachment renderer. */
|
|
399
|
+
export type ComposerAttachmentsProps = PropsRuntime<'conversation.input.attachments'> & PropsLocale<'conversation'>;
|
|
400
|
+
/** Owner share common to blank-session Workspace pickers. */
|
|
401
|
+
export interface EmptyWorkspaceOwnerProps {
|
|
402
|
+
open: boolean;
|
|
403
|
+
anchorRef?: RefObject<HTMLElement>;
|
|
404
|
+
/** Currently selected Workspace, when available. */
|
|
405
|
+
selectedId?: WorkspaceId | undefined;
|
|
406
|
+
onPick: (workspaceId: WorkspaceId) => void;
|
|
407
|
+
onClose: () => void;
|
|
408
|
+
}
|
|
409
|
+
//# sourceMappingURL=slots.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Target-neutral Conversation state assembled from one Session event window. */
|
|
2
|
+
import type { SessionSnapshot } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
3
|
+
import type { ConversationViewSnapshotStore } from './conversation.ts';
|
|
4
|
+
/** Latest registered target snapshots and their shell-level activity. */
|
|
5
|
+
export interface ConversationSnapshot {
|
|
6
|
+
readonly views: ConversationViewSnapshotStore;
|
|
7
|
+
readonly activeTargets: ReadonlySet<string>;
|
|
8
|
+
}
|
|
9
|
+
/** Empty Conversation value used before a Session binding is available. */
|
|
10
|
+
export declare const EMPTY_CONVERSATION_SNAPSHOT: ConversationSnapshot;
|
|
11
|
+
/** Shell phase derived from Session lifecycle and registered target activity. */
|
|
12
|
+
export type ConversationPhase = 'blank' | 'engaging' | 'active';
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the shell phase without adding Conversation data to the Session snapshot.
|
|
15
|
+
* @param session - current Session lifecycle state.
|
|
16
|
+
* @param conversation - current target-neutral Conversation state.
|
|
17
|
+
* @returns the phase used by the header, View ring, and composer layout.
|
|
18
|
+
*/
|
|
19
|
+
export declare function conversationPhase(session: SessionSnapshot, conversation: ConversationSnapshot): ConversationPhase;
|
|
20
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Immutable system-only interpretation of the loaded Session surface. */
|
|
2
|
+
import type { SessionEvent } from '@deepseek-ai/dsh-session/types';
|
|
3
|
+
import type { SystemPromptNode } from './request-inspection.ts';
|
|
4
|
+
interface PositionedSystem {
|
|
5
|
+
readonly position: number;
|
|
6
|
+
readonly node: SystemPromptNode;
|
|
7
|
+
}
|
|
8
|
+
/** Prompt facts at one log prefix; earlier instances remain valid for historical cards. */
|
|
9
|
+
export interface SystemPromptState {
|
|
10
|
+
/** Earliest relevant loaded event; older unindexed endpoints have unknown surface positions. */
|
|
11
|
+
readonly firstSeq: number;
|
|
12
|
+
/** Missing endpoint order makes the prompt unavailable until prepend replay supplies it. */
|
|
13
|
+
readonly uncertain: boolean;
|
|
14
|
+
/** Loaded system nodes in surface order, including empty dormant nodes. */
|
|
15
|
+
readonly nodes: readonly PositionedSystem[];
|
|
16
|
+
/** Surviving replacement endpoints only, mapped to inherited surface positions. */
|
|
17
|
+
readonly replacements: ReadonlyMap<number, number>;
|
|
18
|
+
/** Effective prompt and its change origin; empty text records removal, undefined means unavailable. */
|
|
19
|
+
readonly effective: SystemPromptNode | undefined;
|
|
20
|
+
/** System event at this position, if any; only this node may own an update card. */
|
|
21
|
+
readonly introduced: SystemPromptNode | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** Pure interpretation supplied to target-owned Definitions through uiConversation. */
|
|
24
|
+
export type SystemPromptInspector = (previous: SystemPromptState | undefined, event: SessionEvent) => SystemPromptState;
|
|
25
|
+
/**
|
|
26
|
+
* Apply a system event or positional replacement without retaining ordinary messages.
|
|
27
|
+
* Replacement positions inherit their start endpoint, not their chronological seq.
|
|
28
|
+
* Unknown older endpoint order withholds the prompt until prepend replay resolves it.
|
|
29
|
+
* @param previous - Interpretation at the preceding relevant event in the loaded window.
|
|
30
|
+
* @param event - System message or surface replacement already admitted by Session.
|
|
31
|
+
* @returns Immutable surviving system facts and the effective nonempty prompt.
|
|
32
|
+
*/
|
|
33
|
+
export declare function inspectSystemPrompt(previous: SystemPromptState | undefined, event: SessionEvent): SystemPromptState;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=system-prompt.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Conversation view and session-local presentation state. */
|
|
2
|
+
/**
|
|
3
|
+
* One conversation view tab, projected from a 'conversation.view' slot
|
|
4
|
+
* entry's registration options (label falls back to the entry id).
|
|
5
|
+
*/
|
|
6
|
+
export interface ViewTab {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
/** One-shot focus request addressed to a Conversation View. */
|
|
11
|
+
export interface ConversationViewRequest {
|
|
12
|
+
/** Target `conversation.view` entry id. */
|
|
13
|
+
readonly view: string;
|
|
14
|
+
/** Target-owned opaque focus identity. */
|
|
15
|
+
readonly focus: string;
|
|
16
|
+
}
|
|
17
|
+
/** Per-session state owned by the target-neutral Conversation shell. */
|
|
18
|
+
export interface ConversationStoreState {
|
|
19
|
+
/** Composer draft (persisted; survives session switches and reloads). */
|
|
20
|
+
draft: string;
|
|
21
|
+
/** Preferred `conversation.view` entry id; null resolves to Chat when registered. */
|
|
22
|
+
view: string | null;
|
|
23
|
+
/** Focus request consumed and acknowledged by the addressed View. */
|
|
24
|
+
viewRequest: ConversationViewRequest | null;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=views.d.ts.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { SessionAssistantSettlementEntry, SessionEventLikeEntry } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
2
|
+
import type { LlmAttemptId } from '@deepseek-ai/dsh-llm/brand';
|
|
3
|
+
import type { ConversationNodeDefinition, ConversationPublication, ConversationViewDefinition, ConversationViewSnapshotMap, ConversationViewSnapshotStore } from '../contract/conversation.ts';
|
|
4
|
+
/** Event Registry subset consumed by a Session-owned Assembler. */
|
|
5
|
+
export interface ConversationEventDefinitions {
|
|
6
|
+
/** @returns ordinary Definitions in registration order. */
|
|
7
|
+
entries(): readonly ConversationNodeDefinition[];
|
|
8
|
+
/** @returns unmatched-event fallback, when registered. */
|
|
9
|
+
fallbackEntry(): ConversationNodeDefinition | undefined;
|
|
10
|
+
}
|
|
11
|
+
/** View Registry subset consumed by a Session-owned Assembler. */
|
|
12
|
+
export interface ConversationViewDefinitions {
|
|
13
|
+
/** @returns view builder factories in registration order. */
|
|
14
|
+
entries(): readonly ConversationViewDefinition[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Session-owned incremental engine that assembles business Contexts from a
|
|
18
|
+
* contiguous Event window and materializes registered view snapshots.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ConversationNodeAssembler implements ConversationViewSnapshotStore {
|
|
21
|
+
private readonly eventDefinitions;
|
|
22
|
+
private readonly viewDefinitions;
|
|
23
|
+
private readonly contexts;
|
|
24
|
+
private readonly contextsByKind;
|
|
25
|
+
private readonly contextsBySeq;
|
|
26
|
+
private readonly contextsByTarget;
|
|
27
|
+
private readonly inputs;
|
|
28
|
+
private readonly locationIndex;
|
|
29
|
+
private readonly dirty;
|
|
30
|
+
private readonly dirtyByTarget;
|
|
31
|
+
private readonly revised;
|
|
32
|
+
private readonly dependents;
|
|
33
|
+
private readonly views;
|
|
34
|
+
private readonly activeTargets;
|
|
35
|
+
private hasMore;
|
|
36
|
+
private replacePending;
|
|
37
|
+
private timelineDirty;
|
|
38
|
+
/**
|
|
39
|
+
* @param eventDefinitions - live Event Definition registry.
|
|
40
|
+
* @param viewDefinitions - live view builder registry.
|
|
41
|
+
*/
|
|
42
|
+
constructor(eventDefinitions: ConversationEventDefinitions, viewDefinitions: ConversationViewDefinitions);
|
|
43
|
+
/**
|
|
44
|
+
* Replace the complete loaded window after open, resync, or gap repair.
|
|
45
|
+
* @param entries - complete contiguous window.
|
|
46
|
+
* @param hasMore - whether older history remains outside the window.
|
|
47
|
+
* @returns immediate publication request.
|
|
48
|
+
*/
|
|
49
|
+
replaceWindow(entries: readonly SessionEventLikeEntry[], hasMore: boolean): ConversationPublication;
|
|
50
|
+
/**
|
|
51
|
+
* Add one contiguous live tail event without scanning existing Contexts.
|
|
52
|
+
* @param record - appended Session event entry.
|
|
53
|
+
* @returns highest requested publication cadence.
|
|
54
|
+
*/
|
|
55
|
+
append(record: SessionEventLikeEntry): ConversationPublication;
|
|
56
|
+
/**
|
|
57
|
+
* Retire one Assistant attempt's transient matches and apply its optional durable settlement.
|
|
58
|
+
* @param attemptId - process-local attempt whose transient presentation ended.
|
|
59
|
+
* @param entry - durable message or attempt event committed for the stream.
|
|
60
|
+
* @returns highest requested publication cadence.
|
|
61
|
+
*/
|
|
62
|
+
settleAssistant(attemptId: LlmAttemptId, entry?: SessionAssistantSettlementEntry): ConversationPublication;
|
|
63
|
+
/**
|
|
64
|
+
* Add an older page while preserving existing Context and view identities.
|
|
65
|
+
* @param entries - newly loaded older Events.
|
|
66
|
+
* @param hasMore - whether history still precedes the expanded window.
|
|
67
|
+
* @returns highest requested publication cadence.
|
|
68
|
+
*/
|
|
69
|
+
prepend(entries: readonly SessionEventLikeEntry[], hasMore: boolean): ConversationPublication;
|
|
70
|
+
/**
|
|
71
|
+
* Rebuild against the current Registry set after a low-frequency plugin change.
|
|
72
|
+
* @returns immediate publication request.
|
|
73
|
+
*/
|
|
74
|
+
rebuildRegistry(): ConversationPublication;
|
|
75
|
+
/**
|
|
76
|
+
* Materialize dirty Contexts and advance every active view builder.
|
|
77
|
+
* @returns whether any view snapshot was rebuilt or incrementally applied.
|
|
78
|
+
*/
|
|
79
|
+
flush(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Add one target to the monotonic active set and materialize its current snapshot.
|
|
82
|
+
* Pending Context work is flushed before the first complete replacement.
|
|
83
|
+
* @param target - registered or subsequently registered view target.
|
|
84
|
+
* @returns whether any active target snapshot changed.
|
|
85
|
+
*/
|
|
86
|
+
activateTarget(target: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Read the latest snapshot of a registered target.
|
|
89
|
+
* @param target - registered view target.
|
|
90
|
+
* @returns target snapshot, or undefined before registration or activation.
|
|
91
|
+
*/
|
|
92
|
+
snapshot(target: string): unknown;
|
|
93
|
+
get<Target extends Extract<keyof ConversationViewSnapshotMap, string>>(target: Target): ConversationViewSnapshotMap[Target] | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Read targets whose owners classify their latest snapshot as visible activity.
|
|
96
|
+
* @returns target ids contributing visible activity.
|
|
97
|
+
*/
|
|
98
|
+
activityTargets(): ReadonlySet<string>;
|
|
99
|
+
private sortedInputs;
|
|
100
|
+
private matchInput;
|
|
101
|
+
private collectInput;
|
|
102
|
+
private dispatchInput;
|
|
103
|
+
private createContext;
|
|
104
|
+
private acceptMatch;
|
|
105
|
+
private applyPendingMatches;
|
|
106
|
+
private replayContexts;
|
|
107
|
+
private replayContext;
|
|
108
|
+
private indexTargetContext;
|
|
109
|
+
private markDirty;
|
|
110
|
+
private replaceDependencies;
|
|
111
|
+
private replayRevisedDependents;
|
|
112
|
+
private readerFor;
|
|
113
|
+
private previousContext;
|
|
114
|
+
/** Insert one newly discovered start into its Definition's ordered predecessor index. */
|
|
115
|
+
private indexStartedContext;
|
|
116
|
+
private indexStartedContexts;
|
|
117
|
+
private replayDependencies;
|
|
118
|
+
private refreshMatchLocations;
|
|
119
|
+
private buildNode;
|
|
120
|
+
private replaceView;
|
|
121
|
+
private buildTargetNodes;
|
|
122
|
+
private buildTargetUpserts;
|
|
123
|
+
private buildLocationData;
|
|
124
|
+
private replaceLocationData;
|
|
125
|
+
private applyDirtyLocationData;
|
|
126
|
+
private resetViewBuilders;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=assembler.d.ts.map
|