@kirkchinese/dsh-citeciter 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +83 -56
  2. package/README.zh.md +85 -56
  3. package/lib/client.js +6677 -953
  4. package/lib/index.js +1730 -538
  5. package/lib/{typert-common-C6yTitXx.js → typert-common-DxE1_Bn_.js} +1 -1
  6. package/lib/typert.host.js +2 -2
  7. package/lib/typert.remote-client.js +1 -1
  8. package/lib/types/actions.d.ts +47 -0
  9. package/lib/types/board-capture.d.ts +11 -0
  10. package/lib/types/board.d.ts +4 -4
  11. package/lib/types/citation-mapping.d.ts +8 -0
  12. package/lib/types/citer-agent-registry.d.ts +21 -0
  13. package/lib/types/citer-session-access.d.ts +11 -0
  14. package/lib/types/citer-session-store.d.ts +7 -0
  15. package/lib/types/citer-session-world.d.ts +21 -0
  16. package/lib/types/client/action-controller.d.ts +61 -0
  17. package/lib/types/client/action-executor.d.ts +6 -0
  18. package/lib/types/client/board-capture-target.d.ts +8 -0
  19. package/lib/types/client/citer-session-face.d.ts +59 -0
  20. package/lib/types/client/compact-navigation.d.ts +3 -0
  21. package/lib/types/client/companion-controller.d.ts +15 -4
  22. package/lib/types/client/components/ActionWheel.d.ts +12 -0
  23. package/lib/types/client/components/BoardCaptureSurface.d.ts +8 -0
  24. package/lib/types/client/components/BoardView.d.ts +5 -3
  25. package/lib/types/client/components/ChoicePopover.d.ts +8 -0
  26. package/lib/types/client/components/CiteLauncher.d.ts +9 -0
  27. package/lib/types/client/components/CitePanel.d.ts +7 -1
  28. package/lib/types/client/components/CompactBackButton.d.ts +4 -0
  29. package/lib/types/client/components/DocumentReader.d.ts +7 -1
  30. package/lib/types/client/components/FileAttachments.d.ts +9 -0
  31. package/lib/types/client/components/FileDropHint.d.ts +5 -0
  32. package/lib/types/client/components/LearningCards.d.ts +12 -0
  33. package/lib/types/client/components/LearningRoute.d.ts +7 -0
  34. package/lib/types/client/components/MessageAttachments.d.ts +12 -0
  35. package/lib/types/client/components/MessageFile.d.ts +8 -0
  36. package/lib/types/client/components/ModelChoice.d.ts +10 -0
  37. package/lib/types/client/components/NativeInteraction.d.ts +7 -0
  38. package/lib/types/client/components/NativeLearningDocument.d.ts +9 -0
  39. package/lib/types/client/components/NativeQueue.d.ts +6 -0
  40. package/lib/types/client/components/OverlayPortal.d.ts +10 -0
  41. package/lib/types/client/components/PermissionControl.d.ts +7 -0
  42. package/lib/types/client/components/QuestionCard.d.ts +10 -4
  43. package/lib/types/client/components/ReasoningDisclosure.d.ts +5 -0
  44. package/lib/types/client/components/ReferenceAttachments.d.ts +6 -0
  45. package/lib/types/client/components/TopicActions.d.ts +6 -0
  46. package/lib/types/client/components/TopicComposer.d.ts +36 -0
  47. package/lib/types/client/components/TopicHeader.d.ts +10 -0
  48. package/lib/types/client/components/TopicModelControls.d.ts +9 -0
  49. package/lib/types/client/components/TopicNavigation.d.ts +12 -0
  50. package/lib/types/client/components/TopicSettingsDialog.d.ts +21 -0
  51. package/lib/types/client/components/TopicTitle.d.ts +6 -0
  52. package/lib/types/client/components/UserMessageBody.d.ts +4 -0
  53. package/lib/types/client/components/WheelSettings.d.ts +7 -0
  54. package/lib/types/client/dock-geometry.d.ts +3 -3
  55. package/lib/types/client/draft-references.d.ts +20 -0
  56. package/lib/types/client/file-download.d.ts +16 -0
  57. package/lib/types/client/file-drop.d.ts +18 -0
  58. package/lib/types/client/host-dock.d.ts +2 -2
  59. package/lib/types/client/learning-route.d.ts +10 -0
  60. package/lib/types/client/native-composer.d.ts +18 -0
  61. package/lib/types/client/native-document.d.ts +13 -0
  62. package/lib/types/client/panel-drag.d.ts +10 -0
  63. package/lib/types/client/reader-controller.d.ts +6 -0
  64. package/lib/types/client/request-guard.d.ts +3 -2
  65. package/lib/types/client/submission-preference.d.ts +5 -0
  66. package/lib/types/client/transcript-position.d.ts +6 -0
  67. package/lib/types/client/types.d.ts +5 -4
  68. package/lib/types/client/view-actions.d.ts +1 -1
  69. package/lib/types/client/wheel-gesture.d.ts +13 -0
  70. package/lib/types/document-pages.d.ts +4 -0
  71. package/lib/types/documents.d.ts +7 -5
  72. package/lib/types/host-agent-modules.d.ts +15 -0
  73. package/lib/types/host-session-adapter.d.ts +31 -0
  74. package/lib/types/index.d.ts +5 -5
  75. package/lib/types/learning.d.ts +72 -0
  76. package/lib/types/native-attachment-read.d.ts +19 -0
  77. package/lib/types/native-session-contract.d.ts +198 -0
  78. package/lib/types/native-session-read.d.ts +4 -0
  79. package/lib/types/owned-session-cleanup.d.ts +2 -0
  80. package/lib/types/service.d.ts +1 -1
  81. package/lib/types/session-migration.d.ts +3 -0
  82. package/lib/types/source-session.d.ts +7 -0
  83. package/lib/types/source-storage.d.ts +12 -0
  84. package/lib/types/topic-index.d.ts +75 -0
  85. package/lib/types/topic-runtime.d.ts +19 -55
  86. package/lib/types/topic-stream.d.ts +14 -0
  87. package/lib/types/topic.d.ts +301 -2
  88. package/lib/types/typert-common.d.ts +210 -1
  89. package/lib/types/typert.host.d.ts +454 -3
  90. package/lib/{update-C0K5ekMg.js → update-0LcFDvI5.js} +279 -13
  91. package/package.json +86 -78
  92. package/lib/types/client/components/SelectionMenu.d.ts +0 -17
@@ -0,0 +1,6 @@
1
+ import type { NativeComposer } from '../native-composer.ts';
2
+ /** Read and mutate the Host's authoritative inbox. Citer never owns a second queue. */
3
+ export declare function NativeQueue({ sessionId, native }: {
4
+ readonly sessionId: string;
5
+ readonly native: NativeComposer;
6
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * Render plugin-owned floating content outside the shell's stacking context.
4
+ * The public slot still owns its React lifetime; unmounting removes the portal.
5
+ * Inline content keeps its original ancestry for the isolated dock adapter.
6
+ */
7
+ export declare function OverlayPortal({ children, inline }: {
8
+ readonly children: ReactNode;
9
+ readonly inline?: boolean;
10
+ }): ReactNode;
@@ -0,0 +1,7 @@
1
+ import type { CiteCiterSettings } from '../../topic.ts';
2
+ export type PermissionMode = NonNullable<CiteCiterSettings['defaultPermission']>;
3
+ /** Explicit permission selection; receives the Host's effective value. */
4
+ export declare function PermissionControl({ value, onChange }: {
5
+ readonly value: PermissionMode;
6
+ readonly onChange: (mode: PermissionMode) => void;
7
+ }): import("react").JSX.Element;
@@ -1,8 +1,14 @@
1
- import type { CompanionActions } from '../view-actions.ts';
1
+ import type { AskUserQuestionAnswer } from '@deepseek-ai/dsh-user-questions';
2
2
  import type { PendingQuestion } from '../../topic.ts';
3
3
  export interface QuestionCardProps {
4
- readonly companion: CompanionActions;
5
- readonly pending: PendingQuestion;
4
+ readonly pending: {
5
+ readonly key: string;
6
+ readonly questions: readonly (PendingQuestion['questions'][number] & {
7
+ readonly detail?: string;
8
+ })[];
9
+ };
10
+ readonly onAnswer: (answer: AskUserQuestionAnswer) => Promise<unknown>;
11
+ readonly onCancel: () => Promise<unknown>;
6
12
  }
7
13
  /** Collect one standard DSH ask_user_question answer batch inside the private Topic. */
8
- export declare function QuestionCard({ companion, pending }: QuestionCardProps): import("react").JSX.Element | null;
14
+ export declare function QuestionCard({ onAnswer, onCancel, pending }: QuestionCardProps): import("react").JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ /** Display only reasoning actually returned by the model. Expansion is local UI state; no model call or Session mutation occurs. */
2
+ export declare function ReasoningDisclosure({ text, active }: {
3
+ readonly text: string;
4
+ readonly active: boolean;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { type DraftReference } from '../draft-references.ts';
2
+ /** Removable draft chips and rendered previews. No model calls or source reads. */
3
+ export declare function ReferenceAttachments({ references, onRemove }: {
4
+ readonly references: readonly DraftReference[];
5
+ readonly onRemove?: (id: string) => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /** Workspace actions remain reachable without a floating launcher over the composer. Callbacks own their dialogs and services. */
2
+ export declare function TopicActions({ hasTopic, onSettings, onReader }: {
3
+ readonly hasTopic: boolean;
4
+ readonly onSettings: () => void;
5
+ readonly onReader: () => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { type FormEvent, type Ref, type ReactNode } from 'react';
2
+ import type { ProviderOption, TopicModelConfig } from '../../topic.ts';
3
+ import type { CompanionPhase } from '../companion-controller.ts';
4
+ import { type PermissionMode } from './PermissionControl.tsx';
5
+ import type { DeliveryMode } from '../native-composer.ts';
6
+ import type { DraftReference } from '../draft-references.ts';
7
+ /**
8
+ * Render the Topic draft and its submission controls without accessing services.
9
+ * @param props - controlled draft, model route, request state and user-action callbacks.
10
+ * @returns one form; model changes and sending remain owned by the Topic controller.
11
+ */
12
+ export declare function TopicComposer({ question, placeholder, route, providers, phase, canSend, routeSaving, folded, inputRef, onExpand, onQuestion, onSubmit, onStop, onModel, onReasoning, attachments, permission, onPermission, onFiles, delivery, onDelivery, sources, onReference }: {
13
+ readonly sources: readonly DraftReference[];
14
+ readonly onReference: (reference: DraftReference) => void;
15
+ readonly permission: PermissionMode;
16
+ readonly onPermission: (mode: PermissionMode) => void;
17
+ readonly onFiles: (files: readonly File[]) => void;
18
+ readonly delivery: DeliveryMode;
19
+ readonly onDelivery: (mode: DeliveryMode) => void;
20
+ readonly attachments?: ReactNode;
21
+ readonly question: string;
22
+ readonly placeholder: string;
23
+ readonly route: TopicModelConfig | undefined;
24
+ readonly providers: readonly ProviderOption[];
25
+ readonly phase: CompanionPhase;
26
+ readonly canSend: boolean;
27
+ readonly routeSaving: boolean;
28
+ readonly folded: boolean;
29
+ readonly inputRef: Ref<HTMLTextAreaElement>;
30
+ readonly onExpand: () => void;
31
+ readonly onQuestion: (question: string) => void;
32
+ readonly onSubmit: (event: FormEvent, mode?: DeliveryMode) => void;
33
+ readonly onStop: () => void;
34
+ readonly onModel: (provider: string, model: string) => void;
35
+ readonly onReasoning: (effort: string | null) => void;
36
+ }): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { PointerEventHandler, ReactNode } from 'react';
2
+ /** Layout-only header: navigation, title and drag behavior are supplied by their independent controllers. */
3
+ export declare function TopicHeader({ compact, onBack, onDrag, title, status, children }: {
4
+ readonly compact: boolean;
5
+ readonly onBack: () => void;
6
+ readonly onDrag: PointerEventHandler<HTMLElement>;
7
+ readonly title: ReactNode;
8
+ readonly status: string;
9
+ readonly children: ReactNode;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import type { ProviderOption, TopicModelConfig } from '../../topic.ts';
2
+ /** Model and reasoning hierarchy. Route changes are committed by the injected controller. */
3
+ export declare function TopicModelControls({ providers, route, saving, onModel, onReasoning }: {
4
+ readonly providers: readonly ProviderOption[];
5
+ readonly route: TopicModelConfig;
6
+ readonly saving: boolean;
7
+ readonly onModel: (provider: string, model: string) => void;
8
+ readonly onReasoning: (effort: string | null) => void;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { TopicSummary } from '../../topic.ts';
2
+ /** Session-list navigation with search. Receives domain rows and callbacks, without service discovery. */
3
+ export declare function TopicNavigation({ topics, activeId, archived, onOpen, onNew, onArchiveView, onSettings, onReader }: {
4
+ readonly topics: readonly TopicSummary[];
5
+ readonly activeId: string | undefined;
6
+ readonly archived: boolean;
7
+ readonly onOpen: (id: string) => void;
8
+ readonly onNew: () => void;
9
+ readonly onArchiveView: (archived: boolean) => void;
10
+ readonly onSettings: () => void;
11
+ readonly onReader: () => void;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Render infrequent Topic management separately from the learning composer.
3
+ * @param props - current identity, operation status and management callbacks.
4
+ * @returns a controlled dialog; deletion is enabled only for legacy private logs or verified Citer-owned source storage.
5
+ */
6
+ export declare function TopicSettingsDialog({ open, topic, archiving, deleting, error, onClose, onArchive, onDelete }: {
7
+ readonly open: boolean;
8
+ readonly topic: {
9
+ readonly sessionId: string;
10
+ readonly title: string;
11
+ readonly archived: boolean;
12
+ readonly hosted?: boolean | undefined;
13
+ readonly storage?: 'source' | undefined;
14
+ } | undefined;
15
+ readonly archiving: boolean;
16
+ readonly deleting: boolean;
17
+ readonly error: string | null;
18
+ readonly onClose: () => void;
19
+ readonly onArchive: (archived: boolean) => Promise<boolean>;
20
+ readonly onDelete: () => void;
21
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /** Inline rename committed by Enter or blur, cancelled by Escape. Double-click and F2 start editing. */
2
+ export declare function TopicTitle({ id, title, onRename }: {
3
+ readonly id: string;
4
+ readonly title: string;
5
+ readonly onRename: (title: string) => Promise<boolean>;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /** 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
+ readonly text: string;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { CompanionSnapshot } from '../companion-controller.ts';
2
+ import type { CompanionActions } from '../view-actions.ts';
3
+ /** Edit eight stable slots as one validated settings transaction. */
4
+ export declare function WheelSettings({ snapshot, companion }: {
5
+ snapshot: CompanionSnapshot;
6
+ companion: CompanionActions;
7
+ }): import("react").JSX.Element;
@@ -7,15 +7,15 @@ export interface DockViewport {
7
7
  readonly caption: number;
8
8
  readonly percent: number;
9
9
  }
10
- /** The host keeps its conversation and details visible in both arrangements. */
10
+ /** Wide windows reserve a column; compact windows navigate to a Citer page. */
11
11
  export interface DockGeometry {
12
- readonly mode: 'columns' | 'rows';
12
+ readonly mode: 'columns' | 'page';
13
13
  readonly width: number;
14
14
  readonly height: number;
15
15
  readonly top: number;
16
16
  }
17
17
  /**
18
- * Reserve a separate column, or a bottom row when two readable columns cannot fit.
18
+ * Reserve a separate column, or the content area when two readable columns cannot fit.
19
19
  * CSS pixels already account for browser zoom and Windows display scaling.
20
20
  * @param viewport - measured host dimensions and the saved width preference.
21
21
  * @returns panel dimensions within the host, excluding its native caption.
@@ -0,0 +1,20 @@
1
+ import type { TopicSummary } from '../topic.ts';
2
+ /** One unsent model-visible reference. Removing this value removes its serialized content. */
3
+ export interface DraftReference {
4
+ readonly id: string;
5
+ readonly kind: 'source' | 'excerpt' | 'board';
6
+ readonly label: string;
7
+ readonly content: string;
8
+ readonly address?: string;
9
+ }
10
+ /** Build initial references without submitting them. Stable Topic-scoped IDs preserve menu focus during live snapshot refreshes. */
11
+ export declare function topicDraftReferences(topic: TopicSummary, documentTitle?: string): readonly DraftReference[];
12
+ /** Display a document filename while retaining the full title/path in its serialized content. Legacy ID-only references keep their generic label. */
13
+ export declare function draftReferenceName(reference: DraftReference): string;
14
+ /** Serialize the exact visible attachment collection only at manual submission. */
15
+ export declare function serializeDraftReferences(question: string, references: readonly DraftReference[]): string;
16
+ /** Present sent reference blocks as expandable attachments while retaining the exact serialized model input in the Session log. Unrecognized text is preserved. */
17
+ export declare function parseSentReferences(text: string): {
18
+ readonly question: string;
19
+ readonly references: readonly DraftReference[];
20
+ };
@@ -0,0 +1,16 @@
1
+ import type { NativeComposer } from './native-composer.ts';
2
+ /**
3
+ * Download one committed attachment on demand through its owning Session.
4
+ * @param sessionId - the exact Topic that authorizes the attachment read.
5
+ * @param id - the durable native attachment identity.
6
+ * @param name - suggested local filename; never used as a source filesystem path.
7
+ * @param load - native attachment reader, provided by the client controller.
8
+ * @returns the download action and its visible progress/error state.
9
+ * Repeated clicks share one request. Identity changes and unmount cancel UI effects
10
+ * and release the owned object URL without cancelling the host's shared reader.
11
+ */
12
+ export declare function useFileDownload(sessionId: string, id: string, name: string, load: NativeComposer['attachment']): {
13
+ download: () => Promise<void>;
14
+ busy: boolean;
15
+ error: string | undefined;
16
+ };
@@ -0,0 +1,18 @@
1
+ import { type DragEvent } from 'react';
2
+ /**
3
+ * Isolate file drags inside one physical panel from document-level drop owners.
4
+ * @param open - whether the owning panel is mounted and available.
5
+ * @param enabled - whether a current Topic can receive attachments.
6
+ * @param onFiles - receive one dropped batch; never submits a model request.
7
+ * @returns the local invitation state and handlers to spread on the panel root.
8
+ * Global cancellation listeners exist only while open and are released on cleanup.
9
+ */
10
+ export declare function useFileDrop(open: boolean, enabled: boolean, onFiles: (files: readonly File[]) => void): {
11
+ active: boolean;
12
+ handlers: {
13
+ onDragEnter: (event: DragEvent<HTMLElement>) => void;
14
+ onDragOver: (event: DragEvent<HTMLElement>) => void;
15
+ onDragLeave: (event: DragEvent<HTMLElement>) => void;
16
+ onDrop: (event: DragEvent<HTMLElement>) => void;
17
+ };
18
+ };
@@ -1,4 +1,4 @@
1
- /** Isolated, disposable layout adapter for DSH rc.1 and Desktop 2.0.5 frames. */
1
+ /** Isolated, disposable layout adapter for DSH 0.1.5-rc.1 and Desktop 2.0.9 frames. */
2
2
  import { type RefObject } from 'react';
3
3
  import { type DockGeometry } from './dock-geometry.ts';
4
4
  /**
@@ -15,4 +15,4 @@ export declare function findContainingFrame(panel: HTMLElement | null): HTMLElem
15
15
  * @param percent - user's preferred fraction of the content viewport.
16
16
  * @returns measured panel placement; null when the host frame is unsupported.
17
17
  */
18
- export declare function useHostDock(panel: RefObject<HTMLElement | null>, open: boolean, percent: number): DockGeometry | null;
18
+ export declare function useHostDock(panel: RefObject<HTMLElement | null>, open: boolean, percent: number, floating?: boolean): DockGeometry | null;
@@ -0,0 +1,10 @@
1
+ import type { TopicMessage } from '../topic.ts';
2
+ /** Public todo states, projected from successful native todo_write results. */
3
+ export interface LearningTodo {
4
+ readonly content: string;
5
+ readonly status: 'pending' | 'in_progress' | 'completed';
6
+ }
7
+ /** Read the last accepted plan; malformed historical tool arguments do not replace a valid plan. */
8
+ export declare function learningTodos(messages: readonly TopicMessage[]): readonly LearningTodo[];
9
+ /** One user-submitted learning request. Planning continues inside its ordinary Agent turn. */
10
+ export declare function withLearningRoute(question: string, enabled: boolean): string;
@@ -0,0 +1,18 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { ComposerAttachment, DraftAttachmentId, DraftFileUploads } from '@deepseek-ai/dsh-client-ui-conversation/client';
3
+ import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
4
+ import type { SessionFace, SessionSnapshot } from '@deepseek-ai/dsh-api-session-controller/client';
5
+ export type DeliveryMode = 'queue' | 'steer';
6
+ export interface NativeComposer {
7
+ readonly uploads: ObservableSnapshot<DraftFileUploads>;
8
+ retry(sessionId: string, id: DraftAttachmentId): void;
9
+ watch(sessionId: string, listener: (snapshot: SessionSnapshot) => void): () => void;
10
+ queue(sessionId: string, id: Parameters<SessionFace['updateQueue']>[0], action: Parameters<SessionFace['updateQueue']>[1]): Promise<void>;
11
+ /** Read an image or file through its owning Session's attachment authorization. */
12
+ attachment(sessionId: string, id: string): Promise<Blob>;
13
+ add(sessionId: string, files: readonly File[]): Promise<readonly ComposerAttachment[]>;
14
+ remove(id: DraftAttachmentId): void;
15
+ send(sessionId: string, text: string, attachments: readonly DraftAttachmentId[], mode: DeliveryMode): Promise<void>;
16
+ }
17
+ /** Adapt the installed conversation service's published composer methods; never reach its private input machine. */
18
+ export declare function createNativeComposer(ctx: Context): NativeComposer;
@@ -0,0 +1,13 @@
1
+ import type { ActionSource } from './action-controller.ts';
2
+ import type { ReaderSelection } from './reader-selection.ts';
3
+ /** Decode a complete Host-owned preview buffer. Reject binary, partial and oversized imports. */
4
+ export declare function decodeNativeText(content: {
5
+ readonly kind: 'text';
6
+ readonly text: string;
7
+ readonly eof: boolean;
8
+ } | {
9
+ readonly kind: 'bytes';
10
+ readonly data: Uint8Array;
11
+ }): string;
12
+ /** Capture the file address's own Session and immutable text, never the later active tab. */
13
+ export declare function nativeDocumentSource(address: string, content: string, selection: ReaderSelection): ActionSource;
@@ -0,0 +1,10 @@
1
+ import { type PointerEvent, type RefObject } from 'react';
2
+ /** Pointer lifecycle survives reparenting between the host slot and the floating portal. */
3
+ export declare function usePanelDrag(panel: RefObject<HTMLElement | null>, floating: boolean, setPresentation: (mode: 'side' | 'floating') => void): {
4
+ position: {
5
+ left: number;
6
+ top: number;
7
+ } | null;
8
+ dockTarget: boolean;
9
+ start: (event: PointerEvent<HTMLElement>) => void;
10
+ };
@@ -11,6 +11,8 @@ export interface ReaderSnapshot {
11
11
  selection: ReaderSelection | null;
12
12
  question: string;
13
13
  creating: boolean;
14
+ importing: boolean;
15
+ loading: boolean;
14
16
  error: string | null;
15
17
  }
16
18
  export interface ReaderFace {
@@ -19,7 +21,11 @@ export interface ReaderFace {
19
21
  setOpen(open: boolean): void;
20
22
  refresh(): Promise<void>;
21
23
  importFile(name: string, content: string): Promise<DocumentSummary | null>;
24
+ /** Read a local text file; file access failures are displayed in the Reader. */
25
+ importLocalFile(file: Pick<File, 'name' | 'size' | 'text'>): Promise<void>;
22
26
  openDocument(documentId: string): Promise<void>;
27
+ /** Load a zero-based page of the active document, clearing its previous selection. */
28
+ openPage(page: number): Promise<void>;
23
29
  setSelection(selection: ReaderSelection | null): void;
24
30
  setQuestion(question: string): void;
25
31
  createTopic(): Promise<void>;
@@ -1,3 +1,4 @@
1
+ import type { ActionModel } from '../actions.ts';
1
2
  import type { TopicScenario } from '../topic.ts';
2
3
  import type { CiteSelection } from './types.ts';
3
4
  export type CreateMode = 'observer' | 'exact-fork' | 'exact-when-available';
@@ -12,7 +13,7 @@ export interface RequestIntent {
12
13
  * @param mode - resolved Topic creation mode.
13
14
  * @returns the pending intent key and request ID.
14
15
  */
15
- export declare function claimCreateTopicIntent(selection: CiteSelection, question: string, mode: CreateMode, scenario?: TopicScenario): Promise<RequestIntent>;
16
+ export declare function claimCreateTopicIntent(selection: CiteSelection, question: string, mode: CreateMode, scenario?: TopicScenario, modelRoute?: ActionModel): Promise<RequestIntent>;
16
17
  /**
17
18
  * Claim the retry-stable request ID for one uncited Topic creation.
18
19
  * @param sourceSessionId - owning DSH Session.
@@ -34,7 +35,7 @@ export interface DocumentClaimIntent {
34
35
  * @param question - normalized first question.
35
36
  * @returns the pending intent key and request ID.
36
37
  */
37
- export declare function claimCreateDocumentIntent(claim: DocumentClaimIntent, question: string): Promise<RequestIntent>;
38
+ export declare function claimCreateDocumentIntent(claim: DocumentClaimIntent, question: string, sourceSessionId?: string, modelRoute?: ActionModel): Promise<RequestIntent>;
38
39
  /**
39
40
  * Claim the retry-stable request ID for one pending Topic follow-up.
40
41
  * @param topicSessionId - target private Topic Session.
@@ -0,0 +1,5 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store';
3
+ import type { DeliveryMode } from './native-composer.ts';
4
+ /** Read the conversation-owned busy-Enter preference through the public settings mirror. The bound scope is disposed with ctx; this adapter never writes Host settings. */
5
+ export declare function bindSubmissionPreference(ctx: Context): ObservableSnapshot<DeliveryMode>;
@@ -0,0 +1,6 @@
1
+ import { type UIEvent } from 'react';
2
+ /** Keep each Topic's reading position across portal moves, view changes and close/reopen. Follow new output only while the reader is near the end. */
3
+ export declare function useTranscriptPosition(topicId: string, revision: unknown): {
4
+ ref: (node: HTMLDivElement | null) => void;
5
+ onScroll: (event: UIEvent<HTMLDivElement>) => void;
6
+ };
@@ -1,5 +1,6 @@
1
1
  import type { SessionId } from '@deepseek-ai/dsh-session/types';
2
2
  import type { ToolEvidenceProjection } from '../evidence-text.ts';
3
+ import type { PanelPresentation } from '../actions.ts';
3
4
  /** One right-click selection inside a rendered assistant model call. */
4
5
  export interface AssistantCiteSelection {
5
6
  readonly entryId: 'citeciter.entry.assistant';
@@ -36,11 +37,11 @@ export interface BoardCitationRequest {
36
37
  readonly prompt: string;
37
38
  }
38
39
  export interface CiteOverlaySnapshot {
39
- readonly menuSelection: CiteSelection | null;
40
40
  readonly panelOpen: boolean;
41
+ readonly presentation: PanelPresentation;
41
42
  readonly boardCitation: BoardCitationRequest | null;
42
43
  }
43
- /** Tiny observable state shared by the selection popover and independent dock. */
44
+ /** Observable panel presentation and board-citation requests; gestures have their own controller. */
44
45
  export declare class CiteBus {
45
46
  private readonly reportListenerError;
46
47
  private snapshot;
@@ -52,10 +53,10 @@ export declare class CiteBus {
52
53
  getSnapshot: () => CiteOverlaySnapshot;
53
54
  /** @param listener - observer. @returns disposer. */
54
55
  subscribe: (listener: () => void) => (() => void);
55
- /** Show or dismiss the selection question popover. */
56
- setMenuSelection(selection: CiteSelection | null): void;
57
56
  /** Open or close the independent companion dock. */
58
57
  setPanelOpen(panelOpen: boolean): void;
58
+ /** Change only the current workspace presentation, keeping its Topic and drafts. */
59
+ setPresentation(presentation: PanelPresentation): void;
59
60
  /**
60
61
  * Queue one user-requested board reference for the matching Topic composer.
61
62
  * @param topicSessionId - Topic that owns the referenced board.
@@ -13,7 +13,7 @@ export type SettingsDocumentActions = Omit<SettingsDocumentController, 'getSnaps
13
13
  /** Callbacks the update view may invoke. */
14
14
  export type UpdateActions = Omit<UpdateController, 'getSnapshot' | 'subscribe' | 'dispose'>;
15
15
  /** Overlay events used by rendered components. */
16
- export type OverlayActions = Pick<CiteBus, 'setMenuSelection' | 'setPanelOpen' | 'requestBoardCitation' | 'clearBoardCitation'>;
16
+ export type OverlayActions = Pick<CiteBus, 'setPanelOpen' | 'setPresentation' | 'requestBoardCitation' | 'clearBoardCitation'>;
17
17
  /**
18
18
  * Remove lifecycle and subscription methods from a plain controller's view props.
19
19
  * @param controller - Client-owned controller with arrow-function callbacks.
@@ -0,0 +1,13 @@
1
+ import { type CiteAction, type WheelTrigger } from '../actions.ts';
2
+ import type { ActionController, ActionSource } from './action-controller.ts';
3
+ /** Owned reading surfaces provide captures without probing other plugins' private DOM. */
4
+ export declare function createSelectionSurfaces(): {
5
+ register(element: HTMLElement, read: () => ActionSource | null): () => void;
6
+ read(target: EventTarget | null): ActionSource | null;
7
+ };
8
+ export type SelectionSurfaces = ReturnType<typeof createSelectionSurfaces>;
9
+ /** Install hold/move/release gestures; returns a disposer removing every global listener. */
10
+ export declare function installWheelGesture(controller: ActionController, read: (event: MouseEvent) => ActionSource | null, preferences: () => {
11
+ wheelTrigger?: WheelTrigger | undefined;
12
+ wheelSlots?: (CiteAction | null)[] | undefined;
13
+ }): () => void;
@@ -0,0 +1,4 @@
1
+ /** Shared Host/Client page budget; full text stays in the document owner. */
2
+ export declare const DOCUMENT_CONTENT_MAX_BYTES: number;
3
+ /** Split UTF-8 text without breaking code points; concatenation exactly reproduces the input. */
4
+ export declare function documentPages(content: string): string[];
@@ -1,6 +1,5 @@
1
1
  import { type DocumentContent, type DocumentFormat, type DocumentSummary } from './topic.ts';
2
- /** Reader page budget keeps one document-get response comfortably bounded. */
3
- export declare const DOCUMENT_CONTENT_MAX_BYTES: number;
2
+ export { DOCUMENT_CONTENT_MAX_BYTES } from './document-pages.ts';
4
3
  interface DocumentRecordFile {
5
4
  readonly schemaVersion: 1;
6
5
  readonly documentId: string;
@@ -12,8 +11,11 @@ interface DocumentRecordFile {
12
11
  /** Validate and persist one imported text document under the private library. */
13
12
  export declare class DocumentStore {
14
13
  private readonly root;
14
+ private readonly summaries;
15
15
  /** @param root - private document library root. */
16
16
  constructor(root?: string);
17
+ /** Read validated, immutable metadata without loading the document body. Missing documents return null; successful reads are cached for this store's lifetime. */
18
+ summary(documentId: string): Promise<DocumentSummary | null>;
17
19
  /**
18
20
  * Persist one imported document and its normalized UTF-8 text.
19
21
  * @param input - validated title, format, and content from the import boundary.
@@ -38,8 +40,8 @@ export declare class DocumentStore {
38
40
  /**
39
41
  * Return one bounded Reader page.
40
42
  * @param documentId - private document identity.
41
- * @returns the first content window, truncated when the text exceeds the page budget.
43
+ * @param pageIndex - zero-based page; omitted requests the first page. Out-of-range pages are rejected.
44
+ * @returns a UTF-8-budgeted page and the total page count; Unicode code points are never split.
42
45
  */
43
- get(documentId: string): Promise<DocumentContent>;
46
+ get(documentId: string, pageIndex?: number): Promise<DocumentContent>;
44
47
  }
45
- export {};
@@ -0,0 +1,15 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type AgentLoop from '@deepseek-ai/dsh-agent-loop';
3
+ import type SessionStore from '@deepseek-ai/dsh-session';
4
+ interface HostScope {
5
+ readonly ctx: Context;
6
+ dispose(): Promise<void>;
7
+ }
8
+ export interface HostAgentModules {
9
+ readonly AgentLoop: typeof AgentLoop;
10
+ readonly SessionStore: typeof SessionStore;
11
+ readonly createScope: (ctx: Context, key: object) => HostScope;
12
+ }
13
+ /** Resolve published runtime modules from the actual launcher, preserving Desktop's module identities across external-plugin fallback paths. */
14
+ export declare function loadHostAgentModules(): Promise<HostAgentModules>;
15
+ export {};
@@ -0,0 +1,31 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { Agent, AgentHandle } from '@deepseek-ai/dsh-agent';
3
+ import { type SessionEvent } from '@deepseek-ai/dsh-session';
4
+ import type { CiteCiterSettings, TopicMetadata } from './topic.ts';
5
+ /** Host-owned session services; Citer owns only its scoped contributions and factory handles. */
6
+ export declare class HostSessionAdapter {
7
+ private readonly ctx;
8
+ private readonly settings;
9
+ private readonly assemble;
10
+ private readonly storageRoot;
11
+ private readonly metadata;
12
+ private readonly scopes;
13
+ private readonly worlds;
14
+ private readonly access;
15
+ private disposal;
16
+ constructor(ctx: Context, settings: () => CiteCiterSettings, assemble: (scope: Context, agent: Agent, metadata: TopicMetadata) => Promise<void>, storageRoot: (metadata: TopicMetadata) => string);
17
+ /** Drain owned factories before removing their native checkpoint routes. */
18
+ private dispose;
19
+ /** Retain navigation metadata before the Host can resume this identity. */
20
+ remember(metadata: TopicMetadata): void;
21
+ /** Resolve the Topic's factory/persistence realm, retaining old candidate records without deleting Host files. */
22
+ context(metadata: TopicMetadata): Promise<Context>;
23
+ /** Release a complete owned Topic realm before deleting its files. */
24
+ retire(metadata: TopicMetadata): Promise<void>;
25
+ /** Compose a Topic on a native Agent without replacing its loop, tools or permission service. */
26
+ private attach;
27
+ /** Create a native Session with an explicit initial permission. Citer supplies an empty seed so removed references cannot leak through inherited history. No prompt is sent here. */
28
+ create(metadata: TopicMetadata, seed: readonly SessionEvent[], signal?: AbortSignal): Promise<AgentHandle>;
29
+ /** Resume with the Host's preset and preserve the user's logged permission. */
30
+ resume(metadata: TopicMetadata, signal?: AbortSignal): Promise<AgentHandle>;
31
+ }
@@ -1,4 +1,4 @@
1
- /** Host entry for private Observer Topics and their browser Remote API. */
1
+ /** Host entry for native Topics, legacy compatibility and the browser Remote API. */
2
2
  import { Service, type Context } from '@deepseek-ai/cordis';
3
3
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
4
4
  import z from '@deepseek-ai/schemastery';
@@ -6,15 +6,15 @@ import { type UpdateCheckResponse } from './update.ts';
6
6
  import { type CiteCiterRequest, type CiteCiterResponse } from './topic.ts';
7
7
  /** Cordis/Typert package identity. */
8
8
  export declare const name = "@kirkchinese/dsh-citeciter";
9
- /** Services required by the private Topic runtime. */
10
- export declare const inject: readonly ["llm", "sessionQuery", "subprocess"];
9
+ /** Explicit dependencies for native session composition and legacy compatibility. */
10
+ export declare const inject: readonly ["llm", "sessionQuery", "subprocess", "agents", "agentPresets", "sessionController", "systemPrompt", "tools", "sandboxPolicy", "sessions", "sessionPersistence", "sessionTitle", "attachments"];
11
11
  /** Host settings identity shared with the browser settings scope. */
12
12
  export declare const CITECITER_SETTINGS_NS: "citeciter";
13
13
  /** Native settings schema for new Topics and the companion panel. */
14
14
  export declare const CITECITER_SETTINGS_SCHEMA: z<object>;
15
- /** Root-scoped Remote service owning one isolated DSH runtime. */
15
+ /** Root-scoped Remote service owning Topic metadata, native contributions and a legacy runtime. */
16
16
  export declare class CiteCiterHost extends TypertRemoteService {
17
- static inject: readonly ["llm", "sessionQuery", "subprocess"];
17
+ static inject: readonly ["llm", "sessionQuery", "subprocess", "agents", "agentPresets", "sessionController", "systemPrompt", "tools", "sandboxPolicy", "sessions", "sessionPersistence", "sessionTitle", "attachments"];
18
18
  private readonly topics;
19
19
  private readonly updates;
20
20
  private readonly service;