@kirkchinese/dsh-citeciter 0.9.0-alpha.3 → 0.9.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -139
- package/README.zh.md +70 -141
- package/lib/client.js +4020 -1830
- package/lib/index.js +16928 -16567
- package/lib/{typert-common-BQpqe5Ph.js → typert-common-g1lnIG8u.js} +3 -5
- package/lib/typert.host.js +2 -2
- package/lib/typert.remote-client.js +1 -1
- package/lib/types/actions.d.ts +22 -14
- package/lib/types/blackboard-tool.d.ts +6 -0
- package/lib/types/blocking-question-recovery.d.ts +16 -0
- package/lib/types/board.d.ts +0 -15
- package/lib/types/client/action-controller.d.ts +9 -2
- package/lib/types/client/action-executor.d.ts +5 -1
- package/lib/types/client/board-citation.d.ts +8 -0
- package/lib/types/client/citer-session-face.d.ts +3 -2
- package/lib/types/client/companion-controller.d.ts +18 -9
- package/lib/types/client/components/{WheelSettings.d.ts → ActionSettings.d.ts} +2 -2
- package/lib/types/client/components/ActionWheel.d.ts +4 -4
- package/lib/types/client/components/CiteCiterSettings.d.ts +1 -1
- package/lib/types/client/components/CiteLauncher.d.ts +7 -2
- package/lib/types/client/components/CitePanel.d.ts +4 -1
- package/lib/types/client/components/CiterPet.d.ts +10 -0
- package/lib/types/client/components/DocumentReader.d.ts +2 -4
- package/lib/types/client/components/LearningRoute.d.ts +3 -4
- package/lib/types/client/components/ModelChoice.d.ts +7 -3
- package/lib/types/client/components/QuestionCard.d.ts +8 -4
- package/lib/types/client/components/QuestionReplyBody.d.ts +5 -0
- package/lib/types/client/components/ReferenceAttachments.d.ts +6 -2
- package/lib/types/client/components/SelectionToolbar.d.ts +19 -0
- package/lib/types/client/components/ToolMessage.d.ts +1 -1
- package/lib/types/client/components/TopicActions.d.ts +15 -4
- package/lib/types/client/components/TopicComposer.d.ts +2 -1
- package/lib/types/client/components/TopicHeader.d.ts +8 -3
- package/lib/types/client/components/TopicNavigation.d.ts +4 -4
- package/lib/types/client/components/TopicQuestions.d.ts +10 -0
- package/lib/types/client/components/TopicTitle.d.ts +6 -2
- package/lib/types/client/components/UserMessageBody.d.ts +4 -1
- package/lib/types/client/conversation-dom.d.ts +0 -7
- package/lib/types/client/draft-controller.d.ts +3 -6
- package/lib/types/client/draft-merge.d.ts +8 -0
- package/lib/types/client/draft-references.d.ts +6 -0
- package/lib/types/client/host-dock.d.ts +1 -1
- package/lib/types/client/host-icons.d.ts +2 -13
- package/lib/types/client/host-image-preview.d.ts +2 -1
- package/lib/types/client/host-source-chat.d.ts +11 -0
- package/lib/types/client/host-ui-adapter.d.ts +2 -2
- package/lib/types/client/native-composer.d.ts +15 -0
- package/lib/types/client/prompt.d.ts +4 -4
- package/lib/types/client/question-draft-controller.d.ts +50 -0
- package/lib/types/client/question-interaction.d.ts +33 -0
- package/lib/types/client/request-guard.d.ts +3 -13
- package/lib/types/client/selection-toolbar.d.ts +36 -0
- package/lib/types/client/tool-presentation.d.ts +14 -0
- package/lib/types/client/topic-presentation.d.ts +0 -7
- package/lib/types/client/topic-question-controller.d.ts +80 -0
- package/lib/types/client/types.d.ts +3 -4
- package/lib/types/client/wheel-gesture.d.ts +6 -1
- package/lib/types/document-access.d.ts +7 -2
- package/lib/types/host-agent-modules.d.ts +16 -6
- package/lib/types/host-session-adapter.d.ts +7 -4
- package/lib/types/host-settings-adapter.d.ts +5 -5
- package/lib/types/index.d.ts +8 -8
- package/lib/types/learning-cards-tool.d.ts +5 -0
- package/lib/types/learning.d.ts +0 -4
- package/lib/types/legacy-migration.d.ts +16 -0
- package/lib/types/observer.d.ts +0 -7
- package/lib/types/question-draft-contract.d.ts +55 -0
- package/lib/types/question-draft-lifecycle.d.ts +8 -0
- package/lib/types/question-draft-store.d.ts +38 -0
- package/lib/types/question-reply.d.ts +23 -0
- package/lib/types/source-read-tool.d.ts +3 -4
- package/lib/types/tool-approval-projection.d.ts +10 -0
- package/lib/types/tool-events.d.ts +2 -0
- package/lib/types/tool-outcome-contract.d.ts +3 -0
- package/lib/types/topic-deletion-receipts.d.ts +40 -0
- package/lib/types/topic-index.d.ts +26 -30
- package/lib/types/topic-log.d.ts +41 -0
- package/lib/types/topic-prompts.d.ts +8 -1
- package/lib/types/topic-question-bridge.d.ts +10 -0
- package/lib/types/topic-questions.d.ts +53 -0
- package/lib/types/topic-runtime.d.ts +21 -317
- package/lib/types/topic.d.ts +219 -177
- package/lib/types/typert-codec.d.ts +2 -4
- package/lib/types/typert-common.d.ts +251 -1138
- package/lib/types/typert.host.d.ts +525 -2584
- package/lib/types/update.d.ts +0 -7
- package/lib/{update-CRD1jFLf.js → update-B_0nN1_f.js} +215 -121
- package/package.json +68 -79
- package/lib/types/client/components/TopicSettingsDialog.d.ts +0 -21
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { QuestionReply } from '../../question-reply.ts';
|
|
1
2
|
/** Read-only presentation of a committed user message. Attachments remain inspectable and formulas are rendered without mutating the durable prompt. */
|
|
2
|
-
export declare function UserMessageBody({ text }: {
|
|
3
|
+
export declare function UserMessageBody({ text, questionReply, sourceTitle }: {
|
|
3
4
|
readonly text: string;
|
|
5
|
+
readonly questionReply?: QuestionReply | undefined;
|
|
6
|
+
readonly sourceTitle?: ((sessionId: string) => string | undefined) | undefined;
|
|
4
7
|
}): import("react").JSX.Element;
|
|
@@ -56,13 +56,6 @@ export declare function dshRangeTouchesExcludedContent(range: Range, flow: HTMLE
|
|
|
56
56
|
* @returns whether a collapsed or expanded reasoning header anchors the selection.
|
|
57
57
|
*/
|
|
58
58
|
export declare function dshRangeHasReasoningHeaderEndpoint(range: Range, flow: HTMLElement): boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Find the current DSH assistant element for a persisted anchor key.
|
|
61
|
-
*
|
|
62
|
-
* @param anchorKey - stable anchor emitted by the DSH conversation renderer.
|
|
63
|
-
* @returns matching rendered assistant element, or null when it is not mounted.
|
|
64
|
-
*/
|
|
65
|
-
export declare function findDshAssistantAnchor(anchorKey: string): HTMLElement | null;
|
|
66
59
|
/**
|
|
67
60
|
* Determine whether a node is generated UI rather than committed citable text.
|
|
68
61
|
*
|
|
@@ -8,9 +8,7 @@ export interface DraftView {
|
|
|
8
8
|
readonly files: readonly ComposerAttachment[];
|
|
9
9
|
readonly missing: readonly DraftFile[];
|
|
10
10
|
readonly ready: boolean;
|
|
11
|
-
readonly saving: boolean;
|
|
12
11
|
readonly sending: boolean;
|
|
13
|
-
readonly conflict: boolean;
|
|
14
12
|
readonly pending: boolean;
|
|
15
13
|
readonly error: string | null;
|
|
16
14
|
}
|
|
@@ -18,7 +16,7 @@ export type DraftSnapshot = Readonly<Record<string, DraftView>>;
|
|
|
18
16
|
export declare const EMPTY_DRAFT_VIEW: DraftView;
|
|
19
17
|
type Request = (request: CiteCiterRequest) => Promise<CiteCiterResponse>;
|
|
20
18
|
/** Own draft persistence and attachment lifetimes independently of panel mounting and Topic navigation. */
|
|
21
|
-
export declare function createDraftController(request: Request, native: NativeComposer): {
|
|
19
|
+
export declare function createDraftController(request: Request, native: NativeComposer, isOperating: () => boolean): {
|
|
22
20
|
getSnapshot: () => Readonly<Record<string, DraftView>>;
|
|
23
21
|
subscribe: (listener: () => void) => () => void;
|
|
24
22
|
/** Pending receipts are already durable; only unflushed local edits need a navigation warning. */
|
|
@@ -26,6 +24,8 @@ export declare function createDraftController(request: Request, native: NativeCo
|
|
|
26
24
|
flushAll: () => Promise<PromiseSettledResult<void>[]>;
|
|
27
25
|
ensure: (id: string) => Promise<void>;
|
|
28
26
|
flush: (id: string) => Promise<void>;
|
|
27
|
+
/** Defer remote text reconciliation until the input method commits its candidate. */
|
|
28
|
+
setComposing: (id: string, composing: boolean) => void;
|
|
29
29
|
/** Publish ready-draft edits synchronously; the returned promise only waits for an initial load when needed. */
|
|
30
30
|
setText: (id: string, text: string) => Promise<void>;
|
|
31
31
|
append: (id: string, text: string, references: readonly DraftReference[]) => Promise<void>;
|
|
@@ -34,11 +34,8 @@ export declare function createDraftController(request: Request, native: NativeCo
|
|
|
34
34
|
removeFile: (id: string, fileId: string) => Promise<void>;
|
|
35
35
|
/** Persist the exact outgoing snapshot and identity before native submission begins. */
|
|
36
36
|
submit: (id: string, send: (content: DraftContent, files: readonly ComposerAttachment[], requestId: string) => Promise<boolean>, retry?: boolean) => Promise<boolean>;
|
|
37
|
-
reload: (id: string) => Promise<void>;
|
|
38
37
|
/** Check a lost send response without replacing edits made while the check is in flight. */
|
|
39
38
|
reconcile: (id: string) => Promise<void>;
|
|
40
|
-
/** Explicit conflict resolution: restore locally retained bytes removed by a peer, then CAS the latest revision. */
|
|
41
|
-
keepLocal: (id: string) => Promise<void>;
|
|
42
39
|
forget: (id: string) => void;
|
|
43
40
|
dispose: () => Promise<void>;
|
|
44
41
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DraftContent } from '../draft-contract.ts';
|
|
2
|
+
import type { QuestionDraftContent } from '../question-draft-contract.ts';
|
|
3
|
+
/** Three-way text merge. Independent edits survive; overlapping edits use the operating window. Unicode code points remain intact. */
|
|
4
|
+
export declare function mergeDraftText(base: string, local: string, remote: string, preferLocal: boolean): string;
|
|
5
|
+
/** Merge real attachment/reference identities; removal wins over an unchanged copy, never recreating a deleted reference. */
|
|
6
|
+
export declare function mergeDraftContent(base: DraftContent, local: DraftContent, remote: DraftContent, preferLocal: boolean): DraftContent;
|
|
7
|
+
/** Merge independent questions and text edits; changing the selection keeps the whole answer atomic so single-choice and custom answers cannot be combined. */
|
|
8
|
+
export declare function mergeQuestionDraft(base: QuestionDraftContent, local: QuestionDraftContent, remote: QuestionDraftContent, preferLocal: boolean): QuestionDraftContent;
|
|
@@ -8,6 +8,12 @@ export declare function mergeDraftReferences(current: readonly DraftReference[],
|
|
|
8
8
|
export declare function topicDraftReferences(topic: TopicSummary, documentTitle?: string): readonly DraftReference[];
|
|
9
9
|
/** Display a document filename while retaining the full title/path in its serialized content. Legacy ID-only references keep their generic label. */
|
|
10
10
|
export declare function draftReferenceName(reference: DraftReference): string;
|
|
11
|
+
/**
|
|
12
|
+
* Chip text that shows what a reference contains instead of its kind. Serialized labels
|
|
13
|
+
* are unchanged, so sent messages still parse.
|
|
14
|
+
* @param sourceTitle - resolves a source session's display title; the generic label is used when it is unknown.
|
|
15
|
+
*/
|
|
16
|
+
export declare function draftReferenceTitle(reference: DraftReference, sourceTitle?: (sessionId: string) => string | undefined): string;
|
|
11
17
|
/** Serialize the exact visible attachment collection only at manual submission. */
|
|
12
18
|
export declare function serializeDraftReferences(question: string, references: readonly DraftReference[]): string;
|
|
13
19
|
/** Present sent reference blocks as expandable attachments while retaining the exact serialized model input in the Session log. Unrecognized text is preserved. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Isolated, disposable layout adapter for DSH
|
|
1
|
+
/** Isolated, disposable layout adapter for the official DSH Web and Desktop frame. */
|
|
2
2
|
import { type RefObject } from 'react';
|
|
3
3
|
import { type DockGeometry } from './dock-geometry.ts';
|
|
4
4
|
/**
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
size?: number;
|
|
4
|
-
className?: string;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const IconSettingsOutlineMedium: Icon;
|
|
7
|
-
export declare const IconQuestionOutlineMedium: Icon;
|
|
8
|
-
export declare const IconSparkleMedium: Icon;
|
|
9
|
-
export declare const IconDownloadOutlineMedium: Icon;
|
|
10
|
-
export declare const IconThinkOutlineMedium: Icon;
|
|
11
|
-
export declare const IconStopFillMedium: Icon;
|
|
12
|
-
export declare const IconArchiveOutlineMedium: Icon;
|
|
13
|
-
export {};
|
|
1
|
+
/** Keep host icon imports behind a single official SDK boundary. */
|
|
2
|
+
export { IconQuestionOutlineMedium, IconSparkleMedium, IconDownloadOutlineMedium, IconThinkOutlineMedium, IconStopFillMedium, } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import './host-image-preview.module.css';
|
|
1
2
|
interface PreviewProps {
|
|
2
3
|
readonly src: string;
|
|
3
4
|
readonly alt: string;
|
|
4
5
|
readonly onClose: () => void;
|
|
5
6
|
}
|
|
6
|
-
/** Preview an
|
|
7
|
+
/** Preview an authorized object URL using the host lifecycle and caption clearance; the caller retains URL ownership. */
|
|
7
8
|
export declare function HostImagePreview({ src, alt, onClose }: PreviewProps): import("react").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
|
|
3
|
+
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
4
|
+
/**
|
|
5
|
+
* Read the current Chat projection of a source already retained by the host UI.
|
|
6
|
+
* @param ctx - Client context with the Session Controller and Conversation services.
|
|
7
|
+
* @returns a synchronous reader; undefined means the source or Chat target is unavailable.
|
|
8
|
+
* This borrows the Client generation without retaining it, opening history, or
|
|
9
|
+
* changing the source log. DSH owns the derived Chat projection's lifetime.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createSourceChatReader(ctx: Context): (sessionId: SessionId) => ChatSnapshot | undefined;
|
|
@@ -3,7 +3,7 @@ import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
|
3
3
|
import type { SettingsDescribeFace } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
4
4
|
import type { SessionPendingInteraction } from '@deepseek-ai/dsh-client-ui-session/client';
|
|
5
5
|
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
6
|
-
/**
|
|
6
|
+
/** Preference operations supplied by the official DSH ConfigForm service. */
|
|
7
7
|
export interface SettingsForm<T> extends ObservableSnapshot<{
|
|
8
8
|
value: T | undefined;
|
|
9
9
|
status: 'loading' | 'ready' | 'unavailable';
|
|
@@ -19,6 +19,6 @@ interface ModernForms {
|
|
|
19
19
|
/** Call only public preference services. The selected service owns binding teardown. */
|
|
20
20
|
export declare function hostSettings(ctx: Context): ModernForms;
|
|
21
21
|
export type InteractionSnapshot = ReadonlyMap<SessionId, SessionPendingInteraction>;
|
|
22
|
-
/**
|
|
22
|
+
/** Project native UI status without creating another approval authority. */
|
|
23
23
|
export declare function hostInteractions(ctx: Context): ObservableSnapshot<InteractionSnapshot>;
|
|
24
24
|
export {};
|
|
@@ -3,12 +3,27 @@ import type { ComposerAttachment, DraftAttachmentId, DraftFileUploads } from '@d
|
|
|
3
3
|
import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
|
|
4
4
|
import type { SessionFace } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
5
5
|
import { type CiterSessionSnapshot } from './citer-session-face.ts';
|
|
6
|
+
import type { PendingQuestion } from '../topic.ts';
|
|
7
|
+
import { TopicQuestionController } from './topic-question-controller.ts';
|
|
6
8
|
export type DeliveryMode = 'queue' | 'steer';
|
|
7
9
|
/** A lost transport response is not proof that the host rejected a submission. */
|
|
8
10
|
export declare class UncertainSubmissionError extends Error {
|
|
9
11
|
}
|
|
10
12
|
export interface NativeComposer {
|
|
11
13
|
readonly uploads: ObservableSnapshot<DraftFileUploads>;
|
|
14
|
+
/** Controllers stay alive across hidden/unmounted cards, like native DSH question carriers. */
|
|
15
|
+
question(sessionId: string, pending: PendingQuestion): TopicQuestionController;
|
|
16
|
+
syncQuestions(sessionId: string, questions: readonly PendingQuestion[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* Release one confirmed deleted Topic's local carriers and reject their later reuse.
|
|
19
|
+
* @param sessionId - identity validated against the successful Host deletion response.
|
|
20
|
+
* Idempotent; a missing list row or a failed read is not proof of deletion.
|
|
21
|
+
*/
|
|
22
|
+
retire(sessionId: string): void;
|
|
23
|
+
/** Observe a confirmed retirement; unsubscribe with the owning controller. */
|
|
24
|
+
onRetired(listener: (sessionId: string) => void): () => void;
|
|
25
|
+
hasUnsavedQuestionDrafts(): boolean;
|
|
26
|
+
flushQuestionDrafts(): Promise<PromiseSettledResult<void>[]>;
|
|
12
27
|
retry(sessionId: string, id: DraftAttachmentId): void;
|
|
13
28
|
watch(sessionId: string, listener: (snapshot: CiterSessionSnapshot) => void): () => void;
|
|
14
29
|
queue(sessionId: string, id: Parameters<SessionFace['updateQueue']>[0], action: Parameters<SessionFace['updateQueue']>[1]): Promise<void>;
|
|
@@ -6,11 +6,11 @@ export interface ParsedNextQuestions {
|
|
|
6
6
|
readonly invalid: boolean;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Trim a first question without wrapping it in Citation or role prose. It may be
|
|
10
|
+
* empty because creation only prepares a draft; the length limit applies before any request.
|
|
11
|
+
* @param rawQuestion - text typed or chosen by the user.
|
|
12
|
+
* @returns the trimmed question.
|
|
11
13
|
*/
|
|
12
|
-
export declare function normalizeQuestion(rawQuestion: string): string;
|
|
13
|
-
/** Creation may prepare an empty composer; length limits apply before any request. */
|
|
14
14
|
export declare function normalizeDraftQuestion(rawQuestion: string): string;
|
|
15
15
|
/**
|
|
16
16
|
* Parse optional follow-up control text without exposing complete or partial markers.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type QuestionDraftContent, type QuestionDraftState } from '../question-draft-contract.ts';
|
|
2
|
+
export interface QuestionDraftResult {
|
|
3
|
+
readonly state: QuestionDraftState;
|
|
4
|
+
readonly conflict?: boolean;
|
|
5
|
+
readonly closed?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** The caller binds this port to one exact Topic/question key. It must never submit an answer. */
|
|
8
|
+
export interface QuestionDraftPort {
|
|
9
|
+
get(): Promise<QuestionDraftResult>;
|
|
10
|
+
save(state: QuestionDraftState): Promise<QuestionDraftResult>;
|
|
11
|
+
}
|
|
12
|
+
export interface QuestionDraftView {
|
|
13
|
+
readonly content: QuestionDraftContent;
|
|
14
|
+
readonly ready: boolean;
|
|
15
|
+
readonly closed: boolean;
|
|
16
|
+
readonly error: string | null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Keep question editing synchronous while serializing revision-checked background saves.
|
|
20
|
+
* The owning question carrier outlives its React card. Disposal flushes but never submits,
|
|
21
|
+
* and only an authoritative Host outcome may finish this draft before disposal.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createQuestionDraftController(port: QuestionDraftPort, isOperating: () => boolean): {
|
|
24
|
+
getSnapshot: () => QuestionDraftView;
|
|
25
|
+
subscribe: (listener: () => void) => () => void;
|
|
26
|
+
ensure: () => Promise<void>;
|
|
27
|
+
flush: () => Promise<void>;
|
|
28
|
+
/** Bind manual submission to this window's saved version; the Host checks it atomically with acceptance. */
|
|
29
|
+
prepareSubmission: () => Promise<number>;
|
|
30
|
+
/** Preserve local answers when another window saved after our last edit or flush. */
|
|
31
|
+
rejectSubmission: (result: QuestionDraftResult) => Promise<void>;
|
|
32
|
+
/** Keep remote reconciliation out of an unfinished input-method composition. */
|
|
33
|
+
setComposing: (value: boolean) => void;
|
|
34
|
+
/** Echo edits before returning to React; persistence is deliberately deferred. */
|
|
35
|
+
setAnswers: (answers: Readonly<Record<string, {
|
|
36
|
+
readonly selected: readonly string[];
|
|
37
|
+
readonly custom: string;
|
|
38
|
+
}>>) => void;
|
|
39
|
+
setPage: (page: number) => void;
|
|
40
|
+
setWaitState: (next: {
|
|
41
|
+
readonly edited?: boolean;
|
|
42
|
+
readonly held?: boolean;
|
|
43
|
+
}) => void;
|
|
44
|
+
hasUnsavedChanges: () => boolean;
|
|
45
|
+
/** Invalidate pending acknowledgements after the Host confirms acceptance or termination. */
|
|
46
|
+
finish: () => void;
|
|
47
|
+
/** Flush local edits without deleting the durable draft or submitting an answer. */
|
|
48
|
+
dispose: () => Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
export type QuestionDraftController = ReturnType<typeof createQuestionDraftController>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { PendingQuestion } from '@deepseek-ai/dsh-client-ui-user-questions/client';
|
|
3
|
+
import type { AskUserQuestionAnswerItem } from '@deepseek-ai/dsh-user-questions';
|
|
4
|
+
/** Host-owned question lifecycle projected into a service-independent answer form. */
|
|
5
|
+
export interface QuestionInteraction {
|
|
6
|
+
readonly state: 'open' | 'continued';
|
|
7
|
+
readonly channel: 'waterfall' | 'rpc' | 'none';
|
|
8
|
+
readonly closed: boolean;
|
|
9
|
+
readonly review: readonly AskUserQuestionAnswerItem[] | undefined;
|
|
10
|
+
readonly dismissLabel: string;
|
|
11
|
+
readonly status: string | undefined;
|
|
12
|
+
readonly canTakeTime: boolean;
|
|
13
|
+
readonly allowSkip: boolean;
|
|
14
|
+
focus(): void;
|
|
15
|
+
blur(): void;
|
|
16
|
+
edit(): void;
|
|
17
|
+
takeTime(): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Keep the native carrier responsible for its timeout and late-reply channel.
|
|
21
|
+
* Focus pauses only a pristine countdown; the first edit asks the Host to wait.
|
|
22
|
+
* @param pending - the current Host carrier, never a copied question record.
|
|
23
|
+
* @returns the form lifecycle and a ref identifying its answer surface.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useNativeQuestionInteraction(pending: Pick<PendingQuestion, 'subscribe' | 'getSnapshot' | 'review' | 'dismissal' | 'holdFocus' | 'releaseFocus' | 'engage' | 'takeTime'> & {
|
|
26
|
+
readonly callId?: string | undefined;
|
|
27
|
+
readonly kind?: string | undefined;
|
|
28
|
+
readonly allowSkip?: boolean;
|
|
29
|
+
readonly interrupted?: boolean;
|
|
30
|
+
}): {
|
|
31
|
+
readonly interaction: QuestionInteraction;
|
|
32
|
+
readonly surface: RefObject<HTMLFormElement>;
|
|
33
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { ActionModel } from '../actions.ts';
|
|
2
|
-
import type { TopicScenario } from '../topic.ts';
|
|
3
2
|
import type { CiteSelection } from './types.ts';
|
|
4
|
-
export type CreateMode = 'observer' | 'exact-fork' | 'exact-when-available';
|
|
5
3
|
export interface RequestIntent {
|
|
6
4
|
readonly key: string;
|
|
7
5
|
readonly requestId: string;
|
|
@@ -10,18 +8,17 @@ export interface RequestIntent {
|
|
|
10
8
|
* Claim the retry-stable request ID for one pending Topic-creation intent.
|
|
11
9
|
* @param selection - cited source selection.
|
|
12
10
|
* @param question - normalized first question.
|
|
13
|
-
* @param
|
|
11
|
+
* @param modelRoute - optional model chosen by the wheel action.
|
|
14
12
|
* @returns the pending intent key and request ID.
|
|
15
13
|
*/
|
|
16
|
-
export declare function claimCreateTopicIntent(selection: CiteSelection, question: string,
|
|
14
|
+
export declare function claimCreateTopicIntent(selection: CiteSelection, question: string, modelRoute?: ActionModel): Promise<RequestIntent>;
|
|
17
15
|
/**
|
|
18
16
|
* Claim the retry-stable request ID for one uncited Topic creation.
|
|
19
17
|
* @param sourceSessionId - owning DSH Session.
|
|
20
18
|
* @param question - normalized first question.
|
|
21
|
-
* @param scenario - requested Topic presentation.
|
|
22
19
|
* @returns the pending intent key and request ID.
|
|
23
20
|
*/
|
|
24
|
-
export declare function claimCreateFreeTopicIntent(sourceSessionId: string, question: string
|
|
21
|
+
export declare function claimCreateFreeTopicIntent(sourceSessionId: string, question: string): Promise<RequestIntent>;
|
|
25
22
|
/** Document-range claim identity shared by the Reader entry point. */
|
|
26
23
|
export interface DocumentClaimIntent {
|
|
27
24
|
readonly documentId: string;
|
|
@@ -36,13 +33,6 @@ export interface DocumentClaimIntent {
|
|
|
36
33
|
* @returns the pending intent key and request ID.
|
|
37
34
|
*/
|
|
38
35
|
export declare function claimCreateDocumentIntent(claim: DocumentClaimIntent, question: string, sourceSessionId?: string, modelRoute?: ActionModel): Promise<RequestIntent>;
|
|
39
|
-
/**
|
|
40
|
-
* Claim the retry-stable request ID for one pending Topic follow-up.
|
|
41
|
-
* @param topicSessionId - target private Topic Session.
|
|
42
|
-
* @param question - normalized follow-up question.
|
|
43
|
-
* @returns the pending intent key and request ID.
|
|
44
|
-
*/
|
|
45
|
-
export declare function claimAskIntent(topicSessionId: string, question: string): Promise<RequestIntent>;
|
|
46
36
|
/**
|
|
47
37
|
* Forget a confirmed request so a later identical submission is a new user intent.
|
|
48
38
|
* @param intent - confirmed pending intent.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ActionSource } from './action-controller.ts';
|
|
2
|
+
/** Where a settled selection ends, in viewport coordinates. */
|
|
3
|
+
export interface SelectionAnchor {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly top: number;
|
|
6
|
+
readonly bottom: number;
|
|
7
|
+
}
|
|
8
|
+
/** The toolbar's subject: one captured selection and the place to show actions for it. */
|
|
9
|
+
export interface SelectionToolbarSnapshot {
|
|
10
|
+
current: {
|
|
11
|
+
readonly source: ActionSource;
|
|
12
|
+
readonly anchor: SelectionAnchor;
|
|
13
|
+
} | null;
|
|
14
|
+
}
|
|
15
|
+
/** Resolvers for the two kinds of selection the toolbar can follow. */
|
|
16
|
+
export interface SelectionReaders {
|
|
17
|
+
/** A DOM text range: conversation entries and registered surfaces. */
|
|
18
|
+
readonly range: (event: MouseEvent) => ActionSource | null;
|
|
19
|
+
/** A selection kept inside a registered read-only control, such as the reader's textarea. */
|
|
20
|
+
readonly surface: (event: MouseEvent) => ActionSource | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Show Citer actions next to a settled text selection. It never claims the native context
|
|
24
|
+
* menu and never changes the selection; the selection is captured when the toolbar appears.
|
|
25
|
+
* A plain click never shows it: conversation entries are consulted only for a real text range.
|
|
26
|
+
* @param readers - resolve a pointer-like event to a citable source, or null when Citer does not own it.
|
|
27
|
+
* @param enabled - the user's toolbar preference, read on every selection.
|
|
28
|
+
* @returns the toolbar snapshot store, `dismiss()` and a `dispose()` that removes every listener.
|
|
29
|
+
*/
|
|
30
|
+
export declare function installSelectionToolbar(readers: SelectionReaders, enabled: () => boolean): {
|
|
31
|
+
getSnapshot: () => SelectionToolbarSnapshot;
|
|
32
|
+
subscribe: (fn: () => void) => () => void;
|
|
33
|
+
dismiss: () => void;
|
|
34
|
+
dispose(): void;
|
|
35
|
+
};
|
|
36
|
+
export type SelectionToolbarController = ReturnType<typeof installSelectionToolbar>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TopicMessage } from '../topic.ts';
|
|
2
|
+
type ToolMessage = Extract<TopicMessage, {
|
|
3
|
+
role: 'tool';
|
|
4
|
+
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Title and one-line summary for a tool row. The full arguments and result stay in its details.
|
|
7
|
+
* @returns a readable title, the summary shown after it, and whether the call is still running.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toolPresentation(message: ToolMessage): {
|
|
10
|
+
readonly title: string;
|
|
11
|
+
readonly summary: string;
|
|
12
|
+
readonly running: boolean;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import type { TopicMessage } from '../topic.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Append a requested board reference without replacing text the user already wrote.
|
|
4
|
-
* @param draft - current Topic composer draft.
|
|
5
|
-
* @param prompt - explicit board reference requested by the user.
|
|
6
|
-
* @returns the combined composer value.
|
|
7
|
-
*/
|
|
8
|
-
export declare function appendBoardCitation(draft: string, prompt: string): string;
|
|
9
2
|
/**
|
|
10
3
|
* Decide whether one Topic event belongs in the user-facing transcript.
|
|
11
4
|
* @param message - candidate projected Topic event.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { AskUserQuestionAnswer } from '@deepseek-ai/dsh-user-questions';
|
|
2
|
+
import type { PendingQuestion as HostQuestion } from '@deepseek-ai/dsh-client-ui-user-questions/client';
|
|
3
|
+
import type { PendingQuestion } from '../topic.ts';
|
|
4
|
+
import type { QuestionDraftController, QuestionDraftResult } from './question-draft-controller.ts';
|
|
5
|
+
export interface QuestionDraftAnswer {
|
|
6
|
+
readonly selected: readonly string[];
|
|
7
|
+
readonly custom: string;
|
|
8
|
+
}
|
|
9
|
+
export type QuestionDraft = Readonly<Record<string, QuestionDraftAnswer>>;
|
|
10
|
+
type HostSnapshot = ReturnType<HostQuestion['getSnapshot']>;
|
|
11
|
+
export type TopicQuestionSnapshot = HostSnapshot & {
|
|
12
|
+
readonly hidden: boolean;
|
|
13
|
+
readonly error: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
interface WaitClaim extends AsyncIterable<{
|
|
16
|
+
remainingMs: number;
|
|
17
|
+
}> {
|
|
18
|
+
dispose(): void;
|
|
19
|
+
}
|
|
20
|
+
export interface TopicQuestionChannel {
|
|
21
|
+
claim(callId: string, signal: AbortSignal): WaitClaim;
|
|
22
|
+
answer(key: string, answer: AskUserQuestionAnswer, draftRevision: number): Promise<QuestionDraftResult | undefined>;
|
|
23
|
+
cancel(key: string): Promise<void>;
|
|
24
|
+
timeout(key: string): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Private Topic presentation of the Host's foreground question protocol.
|
|
28
|
+
* This controller outlives its React card: hidden cards keep counting, and a
|
|
29
|
+
* disconnected Client releases its public Host claim instead of pinning a run.
|
|
30
|
+
*/
|
|
31
|
+
export declare class TopicQuestionController {
|
|
32
|
+
private readonly channel;
|
|
33
|
+
readonly drafts: QuestionDraftController;
|
|
34
|
+
readonly review: undefined;
|
|
35
|
+
private pending;
|
|
36
|
+
private readonly lifetime;
|
|
37
|
+
private readonly listeners;
|
|
38
|
+
private timer;
|
|
39
|
+
private claim;
|
|
40
|
+
private started;
|
|
41
|
+
private ended;
|
|
42
|
+
private deadline;
|
|
43
|
+
private remaining;
|
|
44
|
+
private focused;
|
|
45
|
+
private edited;
|
|
46
|
+
private held;
|
|
47
|
+
private closed;
|
|
48
|
+
private hidden;
|
|
49
|
+
private failure;
|
|
50
|
+
private readonly releaseDraft;
|
|
51
|
+
private snapshot;
|
|
52
|
+
constructor(pending: PendingQuestion, channel: TopicQuestionChannel, drafts: QuestionDraftController);
|
|
53
|
+
readonly subscribe: (listener: () => void) => (() => void);
|
|
54
|
+
readonly getSnapshot: () => TopicQuestionSnapshot;
|
|
55
|
+
get dismissal(): 'hide' | 'cancel';
|
|
56
|
+
get callId(): string | undefined;
|
|
57
|
+
get allowSkip(): boolean;
|
|
58
|
+
get interrupted(): boolean;
|
|
59
|
+
getDraft(): QuestionDraft;
|
|
60
|
+
setDraft(draft: QuestionDraft): void;
|
|
61
|
+
/** Reconcile the private Host snapshot; an older open frame cannot undo continuation. */
|
|
62
|
+
sync(pending: PendingQuestion): void;
|
|
63
|
+
private attach;
|
|
64
|
+
private read;
|
|
65
|
+
private publish;
|
|
66
|
+
/** Focus freezes only an untouched countdown; blur resumes the remaining duration. */
|
|
67
|
+
holdFocus(): void;
|
|
68
|
+
releaseFocus(): void;
|
|
69
|
+
/** The first actual edit keeps this Client's answerable foreground wait open. */
|
|
70
|
+
engage(): void;
|
|
71
|
+
takeTime(): void;
|
|
72
|
+
private timeout;
|
|
73
|
+
answer(answer: AskUserQuestionAnswer): Promise<void>;
|
|
74
|
+
dismiss(): Promise<void>;
|
|
75
|
+
reveal(): void;
|
|
76
|
+
private close;
|
|
77
|
+
/** Release a carrier without deleting its draft; only a confirmed Topic deletion may discard it here. */
|
|
78
|
+
dispose(deleted?: boolean): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
@@ -32,7 +32,7 @@ export interface ToolCiteSelection {
|
|
|
32
32
|
export type CiteSelection = AssistantCiteSelection | ToolCiteSelection;
|
|
33
33
|
/** One explicit request to append a blackboard reference to the Topic composer. */
|
|
34
34
|
export interface BoardCitationRequest {
|
|
35
|
-
readonly id:
|
|
35
|
+
readonly id: string;
|
|
36
36
|
readonly topicSessionId: string;
|
|
37
37
|
readonly prompt: string;
|
|
38
38
|
}
|
|
@@ -48,7 +48,6 @@ export declare class CiteBus {
|
|
|
48
48
|
private readonly reportListenerError;
|
|
49
49
|
private snapshot;
|
|
50
50
|
private readonly listeners;
|
|
51
|
-
private nextCitationId;
|
|
52
51
|
/** @param reportListenerError - contains one failed browser subscriber. */
|
|
53
52
|
constructor(reportListenerError: (error: unknown) => void);
|
|
54
53
|
/** @returns stable overlay snapshot. */
|
|
@@ -67,8 +66,8 @@ export declare class CiteBus {
|
|
|
67
66
|
requestBoardCitation(topicSessionId: string, prompt: string): void;
|
|
68
67
|
/**
|
|
69
68
|
* Clear the citation only when the matching consumer handled it.
|
|
70
|
-
* @param id -
|
|
69
|
+
* @param id - exact request identity, unique across windows and draft restoration.
|
|
71
70
|
*/
|
|
72
|
-
clearBoardCitation(id:
|
|
71
|
+
clearBoardCitation(id: string): void;
|
|
73
72
|
private notify;
|
|
74
73
|
}
|
|
@@ -6,8 +6,13 @@ export declare function createSelectionSurfaces(): {
|
|
|
6
6
|
read(target: EventTarget | null): ActionSource | null;
|
|
7
7
|
};
|
|
8
8
|
export type SelectionSurfaces = ReturnType<typeof createSelectionSurfaces>;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Install the optional hold/move/release wheel. While `wheelEnabled` is off, every
|
|
11
|
+
* listener returns early and the browser keeps its native context menu.
|
|
12
|
+
* @returns a disposer removing every global listener.
|
|
13
|
+
*/
|
|
10
14
|
export declare function installWheelGesture(controller: ActionController, read: (event: MouseEvent) => ActionSource | null, preferences: () => {
|
|
15
|
+
wheelEnabled?: boolean | undefined;
|
|
11
16
|
wheelTrigger?: WheelTrigger | undefined;
|
|
12
17
|
wheelSlots?: (CiteAction | null)[] | undefined;
|
|
13
18
|
}): () => void;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { Session } from '@deepseek-ai/dsh-session';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Resolve one document from durable user submissions. Draft metadata grants no access.
|
|
4
|
+
* @param session - the Topic Session whose committed user messages carry document addresses.
|
|
5
|
+
* @param requested - explicit documentId; optional when exactly one document was sent.
|
|
6
|
+
* @returns the readable documentId.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveReadableDocument(session: Session | undefined, requested?: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
1
|
+
import type { Context, Plugin } from '@deepseek-ai/cordis';
|
|
2
2
|
import type AgentLoop from '@deepseek-ai/dsh-agent-loop';
|
|
3
3
|
import type SessionStore from '@deepseek-ai/dsh-session';
|
|
4
4
|
import type SessionTitleService from '@deepseek-ai/dsh-session-title';
|
|
@@ -6,18 +6,28 @@ interface HostScope {
|
|
|
6
6
|
readonly ctx: Context;
|
|
7
7
|
dispose(): Promise<void>;
|
|
8
8
|
}
|
|
9
|
+
/** Required policy of DSH's model-backed title provider; all fields are required by its Loader schema. */
|
|
10
|
+
export interface SessionTitleLlmConfig {
|
|
11
|
+
readonly targetWords: number;
|
|
12
|
+
readonly targetCjkCharacters: number;
|
|
13
|
+
readonly maxInputBytes: number;
|
|
14
|
+
readonly maxOutputTokens: number;
|
|
15
|
+
readonly timeoutMs: number;
|
|
16
|
+
}
|
|
9
17
|
export interface HostAgentModules {
|
|
10
18
|
readonly AgentLoop: typeof AgentLoop;
|
|
11
19
|
readonly SessionStore: typeof SessionStore;
|
|
12
20
|
readonly SessionTitleService: typeof SessionTitleService;
|
|
21
|
+
/** DSH's own first-prompt model title provider, the one `dsh-base` mounts for host sessions. */
|
|
22
|
+
readonly SessionTitleProvider: Plugin<SessionTitleLlmConfig>;
|
|
13
23
|
readonly createScope: (ctx: Context, key: object) => HostScope;
|
|
14
24
|
}
|
|
15
25
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
26
|
+
* Load the declared SDK peers through DSH's active profile resolver.
|
|
27
|
+
* File URLs bypass peer routing and can create a second private scope identity,
|
|
28
|
+
* particularly when Electron ASAR paths use different casing on Windows.
|
|
29
|
+
* Bare imports also leave CLI symlinks and Desktop packaging to the host resolver.
|
|
30
|
+
* @returns the host's AgentLoop, SessionStore, title service and provider, and scope factory.
|
|
21
31
|
*/
|
|
22
32
|
export declare function loadHostAgentModules(): Promise<HostAgentModules>;
|
|
23
33
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type { Agent, AgentHandle } from '@deepseek-ai/dsh-agent';
|
|
3
|
-
import { type SessionEvent } from '@deepseek-ai/dsh-session';
|
|
4
3
|
import type { CiteCiterSettings, TopicMetadata } from './topic.ts';
|
|
5
4
|
/** Host-owned session services; Citer owns only its scoped contributions and factory handles. */
|
|
6
5
|
export declare class HostSessionAdapter {
|
|
@@ -18,14 +17,18 @@ export declare class HostSessionAdapter {
|
|
|
18
17
|
private dispose;
|
|
19
18
|
/** Retain navigation metadata before the Host can resume this identity. */
|
|
20
19
|
remember(metadata: TopicMetadata): void;
|
|
21
|
-
/** Resolve the Topic's factory
|
|
20
|
+
/** Resolve the Topic's own factory and persistence realm below its source directory. */
|
|
22
21
|
context(metadata: TopicMetadata): Promise<Context>;
|
|
23
22
|
/** Release a complete owned Topic realm before deleting its files. */
|
|
24
23
|
retire(metadata: TopicMetadata): Promise<void>;
|
|
25
24
|
/** Compose a Topic on a native Agent without replacing its loop, tools or permission service. */
|
|
26
25
|
private attach;
|
|
27
|
-
/**
|
|
28
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Create a native Session with an explicit initial permission. It starts without
|
|
28
|
+
* inherited history, so references removed from a draft cannot leak into model input.
|
|
29
|
+
* No prompt is sent here.
|
|
30
|
+
*/
|
|
31
|
+
create(metadata: TopicMetadata, signal?: AbortSignal): Promise<AgentHandle>;
|
|
29
32
|
/** Resume with the Host's preset and preserve the user's logged permission. */
|
|
30
33
|
resume(metadata: TopicMetadata, signal?: AbortSignal): Promise<AgentHandle>;
|
|
31
34
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type z from '@deepseek-ai/schemastery';
|
|
3
3
|
import { type CiteCiterSettings } from './topic.ts';
|
|
4
|
-
/**
|
|
4
|
+
/** Official DSH supplies a live Cordis configuration reader. */
|
|
5
5
|
export interface SettingsReader {
|
|
6
6
|
get(): unknown;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
export declare function settingsConfig(schema: z<object>): z<object>;
|
|
10
|
-
/** Bind settings
|
|
11
|
-
export declare function bindHostSettings(ctx: Context,
|
|
8
|
+
/** Keep settings live through the official Cordis configuration contract. */
|
|
9
|
+
export declare function settingsConfig(schema: z<object>): z<object, object, "volatile">;
|
|
10
|
+
/** Bind settings to their owning plugin; registrations are released with ctx. */
|
|
11
|
+
export declare function bindHostSettings(ctx: Context, config: SettingsReader): () => CiteCiterSettings;
|