@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,427 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frozen input-machine contract. Types
|
|
3
|
+
* only. Three-tier visibility: business packages see InputState via the
|
|
4
|
+
* InputZone currency; the scoped input events carry the mutation verbs; the
|
|
5
|
+
* conversation wiring layer alone sees the full SessionInput. The draft text
|
|
6
|
+
* and its reference chips live in the shell's Lexical editor; the machine
|
|
7
|
+
* here is the submit plane (phase, claim, attempt) alone.
|
|
8
|
+
*/
|
|
9
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
10
|
+
import type { ObservableSnapshot, SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
11
|
+
import type { Branded } from '@deepseek-ai/dsh-brand';
|
|
12
|
+
import type { LexicalEditor } from 'lexical';
|
|
13
|
+
import type { QueueRow } from './queue.ts';
|
|
14
|
+
import type { InputSubmitMode } from './composer-submission.ts';
|
|
15
|
+
/** Pick-time draft span guarded by the input revision. */
|
|
16
|
+
export interface TokenSpan {
|
|
17
|
+
readonly start: number;
|
|
18
|
+
readonly end: number;
|
|
19
|
+
readonly draftRev: number;
|
|
20
|
+
}
|
|
21
|
+
/** Attachment payload passed to a claimed command submission. */
|
|
22
|
+
export type SubmitAttachment = {
|
|
23
|
+
readonly type: 'image';
|
|
24
|
+
readonly mediaType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
|
|
25
|
+
readonly data: string;
|
|
26
|
+
readonly name?: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: 'file';
|
|
29
|
+
readonly receiptId: string;
|
|
30
|
+
};
|
|
31
|
+
/** Command serialization result for one ordered attachment draft. */
|
|
32
|
+
export interface DraftAttachmentSerializationResult {
|
|
33
|
+
readonly attachments: readonly SubmitAttachment[];
|
|
34
|
+
}
|
|
35
|
+
/** Settled result of a command or default composer submission. */
|
|
36
|
+
export interface SubmitOutcome {
|
|
37
|
+
readonly kind: 'success' | 'error';
|
|
38
|
+
readonly text?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Command-mode credential supplied by one input-trigger source. */
|
|
41
|
+
export interface CommandClaim {
|
|
42
|
+
readonly token: string;
|
|
43
|
+
readonly hint?: string;
|
|
44
|
+
readonly attachments?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Submit the claimed command.
|
|
47
|
+
* @param args - command text after the claimed token.
|
|
48
|
+
* @param actx - current Session scope.
|
|
49
|
+
* @param attachments - serialized draft attachments accepted by the claim.
|
|
50
|
+
* @returns command settlement.
|
|
51
|
+
*/
|
|
52
|
+
submit(args: string, actx: Context, attachments: readonly SubmitAttachment[]): Promise<SubmitOutcome>;
|
|
53
|
+
}
|
|
54
|
+
/** Structured reference inserted by an input-trigger source. */
|
|
55
|
+
export interface ReferenceInsert {
|
|
56
|
+
readonly source: string;
|
|
57
|
+
readonly ref: string;
|
|
58
|
+
readonly label: string;
|
|
59
|
+
readonly appearance?: 'session' | 'file' | 'folder';
|
|
60
|
+
readonly clipboardText: string;
|
|
61
|
+
}
|
|
62
|
+
/** Result of trigger-source adjudication. */
|
|
63
|
+
export type PickOutcome = {
|
|
64
|
+
readonly claim: CommandClaim;
|
|
65
|
+
} | {
|
|
66
|
+
readonly insert: ReferenceInsert;
|
|
67
|
+
} | {
|
|
68
|
+
readonly text: string;
|
|
69
|
+
readonly continue?: boolean;
|
|
70
|
+
} | 'handled' | undefined;
|
|
71
|
+
/** Keyboard keys intercepted by an open trigger menu. */
|
|
72
|
+
export type ArbitrateKey = 'up' | 'down' | 'enter' | 'escape' | 'tab';
|
|
73
|
+
/** Trigger-menu keyboard routing result. */
|
|
74
|
+
export type ArbitrateOutcome = 'consumed' | 'pick-highlighted' | 'pass';
|
|
75
|
+
/** Scoped request to enter command mode. */
|
|
76
|
+
export interface BeginCommandRequest {
|
|
77
|
+
readonly claim: CommandClaim;
|
|
78
|
+
readonly span: TokenSpan;
|
|
79
|
+
}
|
|
80
|
+
/** Scoped request to insert a structured reference. */
|
|
81
|
+
export interface InsertReferenceRequest {
|
|
82
|
+
readonly reference: ReferenceInsert;
|
|
83
|
+
readonly span: TokenSpan;
|
|
84
|
+
}
|
|
85
|
+
/** Scoped request to consume a command token after business settlement. */
|
|
86
|
+
export interface ConsumeTokenRequest {
|
|
87
|
+
readonly guard: {
|
|
88
|
+
readonly kind: 'span';
|
|
89
|
+
readonly span: TokenSpan;
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: 'bare-token';
|
|
92
|
+
readonly token: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Scoped request to insert ordinary completion text. */
|
|
96
|
+
export interface InsertTextRequest {
|
|
97
|
+
readonly text: string;
|
|
98
|
+
readonly span: TokenSpan;
|
|
99
|
+
readonly continue?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/** Trigger hit used to open one source programmatically. */
|
|
102
|
+
export interface InputTriggerHit {
|
|
103
|
+
readonly trigger: '/' | '@';
|
|
104
|
+
readonly query: string;
|
|
105
|
+
readonly quoted: boolean;
|
|
106
|
+
readonly position: 'leading' | 'inline';
|
|
107
|
+
readonly span: TokenSpan;
|
|
108
|
+
}
|
|
109
|
+
/** Structural per-Session trigger provider consumed by the input shell. */
|
|
110
|
+
export interface InputTriggerController {
|
|
111
|
+
readonly launcher: ObservableSnapshot<string | null>;
|
|
112
|
+
readonly lexicon: ObservableSnapshot<ReadonlyMap<'/' | '@', readonly string[]>>;
|
|
113
|
+
/** @param draft - current draft. @param caret - caret offset. @param guard - availability tier. @param draftRev - input revision. */
|
|
114
|
+
track(draft: string, caret: number, guard: {
|
|
115
|
+
readonly tier: 'plain' | 'claimed' | 'frozen';
|
|
116
|
+
}, draftRev: number): void;
|
|
117
|
+
/** @param key - intercepted key. @param composing - whether IME composition is active. @returns routing result. */
|
|
118
|
+
arbitrate(key: ArbitrateKey, composing: boolean): ArbitrateOutcome;
|
|
119
|
+
/** @returns whether Space applied a trigger result. */
|
|
120
|
+
onSpace(): boolean;
|
|
121
|
+
/** @param source - reference source. @param ref - source-local id. @param signal - submit cancellation. @returns model text. */
|
|
122
|
+
serializeReference(source: string, ref: string, signal: AbortSignal): Promise<string>;
|
|
123
|
+
/** @param line - trimmed draft. @param signal - submit cancellation. @param envelope - attachment count. @returns winning result. */
|
|
124
|
+
adjudicate(line: string, signal: AbortSignal, envelope: {
|
|
125
|
+
readonly attachments: number;
|
|
126
|
+
}): Promise<PickOutcome>;
|
|
127
|
+
/** @param source - source name. @param hit - synthetic trigger hit. */
|
|
128
|
+
toggleSource(source: string, hit: InputTriggerHit): void;
|
|
129
|
+
}
|
|
130
|
+
declare module '@deepseek-ai/cordis' {
|
|
131
|
+
interface Events {
|
|
132
|
+
/**
|
|
133
|
+
* Claim a command token for the scoped input machine.
|
|
134
|
+
* @param request - command claim and span.
|
|
135
|
+
* @mode bail
|
|
136
|
+
*/
|
|
137
|
+
'slash/input-begin-command'(request: BeginCommandRequest): true | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* Insert a structured reference into the scoped input machine.
|
|
140
|
+
* @param request - reference and span.
|
|
141
|
+
* @mode bail
|
|
142
|
+
*/
|
|
143
|
+
'slash/input-insert-reference'(request: InsertReferenceRequest): true | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Consume a trigger token without inserting replacement content.
|
|
146
|
+
* @param request - token guard.
|
|
147
|
+
* @mode bail
|
|
148
|
+
*/
|
|
149
|
+
'slash/input-consume-token'(request: ConsumeTokenRequest): true | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Insert plain text into the scoped input machine.
|
|
152
|
+
* @param request - plain text and span.
|
|
153
|
+
* @mode bail
|
|
154
|
+
*/
|
|
155
|
+
'slash/input-insert-text'(request: InsertTextRequest): true | undefined;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Browser-runtime identity of one unsent attachment draft. */
|
|
159
|
+
export type DraftAttachmentId = Branded<'DraftAttachmentId'>;
|
|
160
|
+
/**
|
|
161
|
+
* The scoped-event application verbs: the hub's bail listeners call these,
|
|
162
|
+
* and the boolean answer IS the event's bail value (true ⟺ the editor
|
|
163
|
+
* applied the edit after phase and span guards).
|
|
164
|
+
*/
|
|
165
|
+
export interface InputTarget {
|
|
166
|
+
/** Replace the trigger span with claim.token and enter claimed (span-CAS'd). */
|
|
167
|
+
beginCommand(claim: CommandClaim, span: TokenSpan): boolean;
|
|
168
|
+
/** Replace the trigger span with one reference chip (span-CAS'd). */
|
|
169
|
+
insertReference(ref: ReferenceInsert, span: TokenSpan): boolean;
|
|
170
|
+
}
|
|
171
|
+
/** Per-session input facade owned by the conversation wiring layer. */
|
|
172
|
+
export interface SessionInput extends InputTarget {
|
|
173
|
+
/** Replace the whole draft (persisted-draft seed and programmatic writes). */
|
|
174
|
+
setDraft(text: string): void;
|
|
175
|
+
/** Append ordered browser-owned attachment ids; busy admission phases refuse. */
|
|
176
|
+
addAttachments(ids: readonly DraftAttachmentId[]): boolean;
|
|
177
|
+
/** Remove one browser-owned attachment id; busy admission phases refuse. @returns whether the id was removed. */
|
|
178
|
+
removeAttachment(id: DraftAttachmentId): boolean;
|
|
179
|
+
/** Drop ids whose browser-owned objects no longer exist. */
|
|
180
|
+
pruneAttachments(ids: readonly DraftAttachmentId[]): void;
|
|
181
|
+
/**
|
|
182
|
+
* THE complexity sink: enter adjudication, submit transaction, and the default sink live inside.
|
|
183
|
+
* @param mode - delivery intent retained through asynchronous adjudication and serialization.
|
|
184
|
+
*/
|
|
185
|
+
submit(mode?: InputSubmitMode): void;
|
|
186
|
+
/**
|
|
187
|
+
* Surface a notice outside the machine's own effect stream: detached
|
|
188
|
+
* command results and business notifications render through here.
|
|
189
|
+
* Session-routed — resolving the facade via SessionInputResolver.for(actx) lands
|
|
190
|
+
* the notice on that session's composer, so a result arriving after a
|
|
191
|
+
* session switch still reaches its own session.
|
|
192
|
+
* @param level - severity tier.
|
|
193
|
+
* @param text - notice body.
|
|
194
|
+
*/
|
|
195
|
+
notify(level: 'info' | 'error', text: string): void;
|
|
196
|
+
/** Input state store (InputZone currency + decorations read here). */
|
|
197
|
+
readonly state: SnapshotStore<InputState>;
|
|
198
|
+
}
|
|
199
|
+
/** Session-addressed access to the per-session input facade. */
|
|
200
|
+
export interface SessionInputResolver {
|
|
201
|
+
/** Resolve the facade for one session-scope ctx. */
|
|
202
|
+
for(actx: Context): SessionInput;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The public input action face provided to every session-scope slot
|
|
206
|
+
* component: stable-identity void callbacks, mirroring the
|
|
207
|
+
* useStore+actions convention. Command-style handles (arbitrate/space/
|
|
208
|
+
* paste/…) stay InputBar-private and never ride this face.
|
|
209
|
+
*/
|
|
210
|
+
export interface InputActions {
|
|
211
|
+
/** Replace the whole draft (persisted-draft seed and programmatic writes). */
|
|
212
|
+
setDraft(text: string): void;
|
|
213
|
+
/** Append ordered browser-owned attachment ids; busy admission phases refuse. */
|
|
214
|
+
addAttachments(ids: readonly DraftAttachmentId[]): boolean;
|
|
215
|
+
/** Remove one browser-owned attachment id; busy admission phases refuse. */
|
|
216
|
+
removeAttachment(id: DraftAttachmentId): void;
|
|
217
|
+
/** Drop ids whose browser-owned objects no longer exist. */
|
|
218
|
+
pruneAttachments(ids: readonly DraftAttachmentId[]): void;
|
|
219
|
+
/** Enter submission (adjudication / claim transaction / default sink inside). */
|
|
220
|
+
submit(): void;
|
|
221
|
+
}
|
|
222
|
+
/** One surfaced notice (command results, adjudication failures). seq keys re-render of repeats. */
|
|
223
|
+
export interface InputNotice {
|
|
224
|
+
readonly level: 'info' | 'error';
|
|
225
|
+
readonly text: string;
|
|
226
|
+
readonly seq: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The InputBar-exclusive keyboard/DOM command face: synchronous
|
|
230
|
+
* returns and event-handler semantics that must not enter the public provide
|
|
231
|
+
* channel. Handed to the composer-bar entry through its own inject —
|
|
232
|
+
* package-internal, never across a plugin boundary. The session shell
|
|
233
|
+
* satisfies it structurally. Text editing itself rides the shell's Lexical
|
|
234
|
+
* editor (exposed here for the contenteditable binding); the members below
|
|
235
|
+
* are the submit-plane and trigger-pipeline verbs the editor does not own.
|
|
236
|
+
*/
|
|
237
|
+
export interface ComposerKeyboard {
|
|
238
|
+
/** Live machine state for event-handler reads (render reads go through useInput). */
|
|
239
|
+
readonly snapshot: InputState;
|
|
240
|
+
/** The shell-owned Lexical editor the composer binds its contenteditable to. */
|
|
241
|
+
readonly editor: LexicalEditor;
|
|
242
|
+
/** Submit with an explicit delivery mode resolved by the submission policy (Enter gestures and the primary Send button). */
|
|
243
|
+
submit(mode: InputSubmitMode): void;
|
|
244
|
+
/**
|
|
245
|
+
* Steer every still-pending queued message into the running turn (the
|
|
246
|
+
* empty-draft accelerated-Enter gesture; the queue dock's per-row steer
|
|
247
|
+
* button is the same operation applied to the whole queue).
|
|
248
|
+
*/
|
|
249
|
+
steerQueue(): void;
|
|
250
|
+
/** Insert pasted plain text over the current editor selection (reference-placeholder-sanitized). */
|
|
251
|
+
paste(text: string): void;
|
|
252
|
+
/**
|
|
253
|
+
* The live selection as a detect-coordinate span (menu-launcher synthetic
|
|
254
|
+
* hits replace it on pick); an absent selection answers a collapsed span at
|
|
255
|
+
* the document end.
|
|
256
|
+
*/
|
|
257
|
+
caretSpan(): EditSelection;
|
|
258
|
+
/** Keyboard arbitration while the menu is open ('pass' when no pipeline). */
|
|
259
|
+
arbitrate(key: ArbitrateKey, composing: boolean): ArbitrateOutcome;
|
|
260
|
+
/** Space adjudication; true = the input applied a claim — caller preventDefaults. */
|
|
261
|
+
space(): boolean;
|
|
262
|
+
/** Dismiss the popupSelect shell (any interaction outside the box). */
|
|
263
|
+
dismissPopup(): void;
|
|
264
|
+
}
|
|
265
|
+
/** One independently addressable row projected from the transient queue snapshot. */
|
|
266
|
+
export type QueuedMessage = QueueRow;
|
|
267
|
+
/** Guard union of the scoped consume-token event, checked by the shell. */
|
|
268
|
+
export type ConsumeTokenGuard = ConsumeTokenRequest['guard'];
|
|
269
|
+
/** Half-open [start, end) range/selection in detect-projection coordinates. */
|
|
270
|
+
export interface EditSelection {
|
|
271
|
+
readonly start: number;
|
|
272
|
+
readonly end: number;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* One reference occurrence projected from the editor's chip nodes, in
|
|
276
|
+
* clipboard-text coordinates. Identity is occurrenceId — a stable per-shell
|
|
277
|
+
* assignment per chip NodeKey, so same-named references stay independently
|
|
278
|
+
* addressable and survive undo. label/appearance/clipboardText are the
|
|
279
|
+
* owner's insert-time projections cached on the node (invalid flips instead
|
|
280
|
+
* of dropping the occurrence).
|
|
281
|
+
*/
|
|
282
|
+
export interface Occurrence {
|
|
283
|
+
/** Shell-assigned stable identity (monotonic per shell, keyed by NodeKey). */
|
|
284
|
+
readonly occurrenceId: number;
|
|
285
|
+
/** Owning source name (serializer routing key). */
|
|
286
|
+
readonly source: string;
|
|
287
|
+
/** Owner-scoped reference id. */
|
|
288
|
+
readonly ref: string;
|
|
289
|
+
/** Offset in the clipboard-text projection. */
|
|
290
|
+
readonly offset: number;
|
|
291
|
+
/** Length in the clipboard-text projection; the occurrence occupies exactly [offset, offset+length). */
|
|
292
|
+
readonly length: number;
|
|
293
|
+
/** Inline display label (insert-time cache). */
|
|
294
|
+
readonly label: string;
|
|
295
|
+
/** Optional domain glyph (insert-time cache). */
|
|
296
|
+
readonly appearance?: ReferenceInsert['appearance'];
|
|
297
|
+
/** Clipboard / persistence projection, e.g. `/name` (insert-time cache, never the model form). */
|
|
298
|
+
readonly clipboardText: string;
|
|
299
|
+
/** Owner-resolution failure flag: the chip renders the failure treatment. */
|
|
300
|
+
readonly invalid?: boolean;
|
|
301
|
+
}
|
|
302
|
+
/** Published input state (the currency; per-session). */
|
|
303
|
+
export interface InputState {
|
|
304
|
+
/** Clipboard-text projection of the editor document (chips expanded to their clipboard form). */
|
|
305
|
+
readonly draft: string;
|
|
306
|
+
/** Ordered runtime-only attachment ids; browser objects stay in ConversationController. */
|
|
307
|
+
readonly attachmentIds: readonly DraftAttachmentId[];
|
|
308
|
+
/** Monotonic editor revision (span CAS compares against this). */
|
|
309
|
+
readonly draftRev: number;
|
|
310
|
+
readonly phase: 'plain' | 'adjudicating' | 'claimed' | 'submitting';
|
|
311
|
+
/** Present exactly while claimed/submitting (claim snapshot during flight; submit closure withheld). */
|
|
312
|
+
readonly claim?: {
|
|
313
|
+
readonly token: string;
|
|
314
|
+
readonly hint?: string;
|
|
315
|
+
readonly attachments?: boolean;
|
|
316
|
+
};
|
|
317
|
+
/** Reference occurrence view of the editor's chips, sorted by offset. */
|
|
318
|
+
readonly occurrences: readonly Occurrence[];
|
|
319
|
+
/** Read-only transient inbox projection from Session control, including pending steering. */
|
|
320
|
+
readonly queue: readonly QueuedMessage[];
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* One in-flight submission attempt: the ONLY id concept in the submit plane.
|
|
324
|
+
* Created on enter; carried by adjudicated/submit-settled/sink-settled
|
|
325
|
+
* events; stale attempts are dropped (anti-backwash). Command attempts hold
|
|
326
|
+
* the single frozen in-flight slot; default-sink attempts run detached and
|
|
327
|
+
* concurrently. release/session teardown aborts them all, keeping every
|
|
328
|
+
* promise bounded.
|
|
329
|
+
*/
|
|
330
|
+
export interface SubmitAttempt {
|
|
331
|
+
readonly seq: number;
|
|
332
|
+
readonly signal: AbortSignal;
|
|
333
|
+
/** Clipboard-projection draft captured before an optimistic default-send commit. */
|
|
334
|
+
readonly draftSnapshot: string;
|
|
335
|
+
/** Default-message delivery intent retained while slash adjudication is pending. */
|
|
336
|
+
readonly mode: InputSubmitMode;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Submit-machine input events (the machine's single write path). Text
|
|
340
|
+
* mutation lives in the editor; the machine only observes the draft through
|
|
341
|
+
* event payloads (claim integrity, enter snapshots, settlement decisions).
|
|
342
|
+
*/
|
|
343
|
+
export type InputEvent =
|
|
344
|
+
/** Clipboard projection changed: the claimed integrity watch runs (zero effects). */
|
|
345
|
+
{
|
|
346
|
+
readonly type: 'draft-changed';
|
|
347
|
+
readonly draft: string;
|
|
348
|
+
}
|
|
349
|
+
/** The editor applied a claim-token replacement: enter claimed. */
|
|
350
|
+
| {
|
|
351
|
+
readonly type: 'claim';
|
|
352
|
+
readonly claim: CommandClaim;
|
|
353
|
+
}
|
|
354
|
+
/** Enter submission with the current clipboard projection. */
|
|
355
|
+
| {
|
|
356
|
+
readonly type: 'enter';
|
|
357
|
+
readonly mode: InputSubmitMode;
|
|
358
|
+
readonly draft: string;
|
|
359
|
+
} | {
|
|
360
|
+
readonly type: 'adjudicated';
|
|
361
|
+
readonly attempt: SubmitAttempt;
|
|
362
|
+
readonly outcome: PickOutcome;
|
|
363
|
+
} | {
|
|
364
|
+
readonly type: 'adjudication-failed';
|
|
365
|
+
readonly attempt: SubmitAttempt;
|
|
366
|
+
readonly message: string;
|
|
367
|
+
}
|
|
368
|
+
/** Settlement carries the live clipboard projection for suffix-retention and claim re-entry decisions. */
|
|
369
|
+
| {
|
|
370
|
+
readonly type: 'submit-settled';
|
|
371
|
+
readonly attempt: SubmitAttempt;
|
|
372
|
+
readonly ok: boolean;
|
|
373
|
+
readonly draft: string;
|
|
374
|
+
readonly outcome?: SubmitOutcome;
|
|
375
|
+
readonly message?: string;
|
|
376
|
+
}
|
|
377
|
+
/** Settlement of one optimistic default send, independent of the frozen command slot. */
|
|
378
|
+
| {
|
|
379
|
+
readonly type: 'sink-settled';
|
|
380
|
+
readonly attempt: SubmitAttempt;
|
|
381
|
+
readonly ok: boolean;
|
|
382
|
+
readonly outcome?: SubmitOutcome;
|
|
383
|
+
readonly message?: string;
|
|
384
|
+
}
|
|
385
|
+
/** Commit an attachment-only send whose empty draft did not need an attempt. */
|
|
386
|
+
| {
|
|
387
|
+
readonly type: 'send-committed';
|
|
388
|
+
} | {
|
|
389
|
+
readonly type: 'release';
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Submit-machine output effects (executed by the SessionInput shell; the
|
|
393
|
+
* machine stays pure).
|
|
394
|
+
*/
|
|
395
|
+
export type InputEffect = {
|
|
396
|
+
readonly type: 'adjudicate';
|
|
397
|
+
readonly attempt: SubmitAttempt;
|
|
398
|
+
readonly draft: string;
|
|
399
|
+
} | {
|
|
400
|
+
readonly type: 'begin-submit';
|
|
401
|
+
readonly attempt: SubmitAttempt;
|
|
402
|
+
readonly claim: CommandClaim;
|
|
403
|
+
readonly args: string;
|
|
404
|
+
}
|
|
405
|
+
/** Detached default send; the shell captures its editor projection before the following commit effect. */
|
|
406
|
+
| {
|
|
407
|
+
readonly type: 'default-sink';
|
|
408
|
+
readonly attempt: SubmitAttempt;
|
|
409
|
+
readonly draft: string;
|
|
410
|
+
readonly mode: InputSubmitMode;
|
|
411
|
+
} | {
|
|
412
|
+
readonly type: 'notice';
|
|
413
|
+
readonly level: 'info' | 'error';
|
|
414
|
+
readonly text: string;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Clear the committed draft in the editor and cut undo history. A string
|
|
418
|
+
* snapshot keeps a pure suffix typed during the Host round-trip (content
|
|
419
|
+
* appended after the sent snapshot survives; interleaved edits cannot be
|
|
420
|
+
* separated and clear whole); null clears unconditionally (attachment-only
|
|
421
|
+
* sends have no draft to retain).
|
|
422
|
+
*/
|
|
423
|
+
| {
|
|
424
|
+
readonly type: 'commit-draft';
|
|
425
|
+
readonly retainSuffixOf: string | null;
|
|
426
|
+
};
|
|
427
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Queue contracts derived from the Session Controller face. */
|
|
2
|
+
import type { SessionFace, SessionSnapshot } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
3
|
+
/** One address accepted by the Session Controller's queue mutation verb. */
|
|
4
|
+
export type QueueItemId = Parameters<SessionFace['updateQueue']>[0];
|
|
5
|
+
/** One mutation accepted by the Session Controller's queue mutation verb. */
|
|
6
|
+
export type QueueAction = Parameters<SessionFace['updateQueue']>[1];
|
|
7
|
+
/** One row projected by the authoritative Session queue snapshot. */
|
|
8
|
+
export type QueueRow = SessionSnapshot['queue'][number];
|
|
9
|
+
//# sourceMappingURL=queue.d.ts.map
|