@kirkchinese/dsh-citeciter 0.4.3 → 0.5.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 (42) hide show
  1. package/README.md +36 -27
  2. package/README.zh.md +36 -27
  3. package/lib/client.js +32043 -2462
  4. package/lib/index.js +1260 -116
  5. package/lib/{typert-common-4_cbghYz.js → typert-common-DKqYKnRO.js} +23 -3
  6. package/lib/typert.host.js +7 -3
  7. package/lib/typert.remote-client.js +2 -2
  8. package/lib/types/board.d.ts +237 -0
  9. package/lib/types/client/companion-controller.d.ts +10 -4
  10. package/lib/types/client/components/BlackboardWorkspace.d.ts +16 -0
  11. package/lib/types/client/components/BoardView.d.ts +12 -0
  12. package/lib/types/client/components/CiteCiterSettings.d.ts +3 -1
  13. package/lib/types/client/components/CitePanel.d.ts +5 -1
  14. package/lib/types/client/components/DocumentReader.d.ts +5 -0
  15. package/lib/types/client/components/SelectionMenu.d.ts +5 -1
  16. package/lib/types/client/components/UpdateNotice.d.ts +11 -0
  17. package/lib/types/client/conversation-dom.d.ts +9 -1
  18. package/lib/types/client/entries.d.ts +60 -0
  19. package/lib/types/client/entry-ids.d.ts +3 -0
  20. package/lib/types/client/hotkeys.d.ts +19 -0
  21. package/lib/types/client/reader-controller.d.ts +33 -0
  22. package/lib/types/client/reader-selection.d.ts +12 -0
  23. package/lib/types/client/request-guard.d.ts +24 -1
  24. package/lib/types/client/rich-content.d.ts +6 -0
  25. package/lib/types/client/selection.d.ts +4 -2
  26. package/lib/types/client/topic-presentation.d.ts +15 -0
  27. package/lib/types/client/types.d.ts +36 -1
  28. package/lib/types/client/update-controller.d.ts +57 -0
  29. package/lib/types/documents.d.ts +45 -0
  30. package/lib/types/evidence-text.d.ts +29 -0
  31. package/lib/types/index.d.ts +13 -14
  32. package/lib/types/observer.d.ts +26 -1
  33. package/lib/types/service.d.ts +81 -0
  34. package/lib/types/topic-runtime.d.ts +302 -4
  35. package/lib/types/topic.d.ts +604 -43
  36. package/lib/types/typert-common.d.ts +278 -11
  37. package/lib/types/typert.host.d.ts +669 -34
  38. package/lib/types/typert.remote-client.d.ts +3 -0
  39. package/lib/types/update.d.ts +68 -0
  40. package/lib/update-u9-6c_qp.js +1072 -0
  41. package/package.json +7 -4
  42. package/lib/topic-BVNCaVbJ.js +0 -307
@@ -1,4 +1,4 @@
1
- import { l as citeCiterRequestSchema, u as citeCiterResponseSchema } from "./topic-BVNCaVbJ.js";
1
+ import { f as citeCiterRequestSchema, p as citeCiterResponseSchema, r as updateCheckResponseSchema } from "./update-u9-6c_qp.js";
2
2
  //#region lib/types/typert-common.js
3
3
  /** Strict root-scoped Topic command shared by Host and browser manifests. */
4
4
  const citeCiterRequestDescriptor = {
@@ -25,9 +25,29 @@ const citeCiterRequestDescriptor = {
25
25
  },
26
26
  sourceLocation: {
27
27
  file: "src/index.ts",
28
- line: 66,
28
+ line: 127,
29
+ column: 3
30
+ }
31
+ };
32
+ /** Strict root-scoped read-only update check shared by Host and browser manifests. */
33
+ const updateCheckDescriptor = {
34
+ id: "@kirkchinese/dsh-citeciter#citeciter/checkUpdate",
35
+ service: "citeciter",
36
+ namespace: "citeciter",
37
+ method: "checkUpdate",
38
+ invocation: { kind: "direct" },
39
+ parameters: [],
40
+ cancellation: { parameter: "signal" },
41
+ result: {
42
+ mode: "strict",
43
+ typeSymbol: "@kirkchinese/dsh-citeciter#UpdateCheckResponse",
44
+ schema: updateCheckResponseSchema
45
+ },
46
+ sourceLocation: {
47
+ file: "src/index.ts",
48
+ line: 134,
29
49
  column: 3
30
50
  }
31
51
  };
32
52
  //#endregion
33
- export { citeCiterRequestDescriptor as t };
53
+ export { updateCheckDescriptor as n, citeCiterRequestDescriptor as t };
@@ -1,5 +1,5 @@
1
- import { h as topicSummarySchema, l as citeCiterRequestSchema, m as topicSnapshotSchema, o as citationDraftSchema, s as citationRecordSchema, u as citeCiterResponseSchema } from "./topic-BVNCaVbJ.js";
2
- import { t as citeCiterRequestDescriptor } from "./typert-common-4_cbghYz.js";
1
+ import { C as topicSummarySchema, S as topicSnapshotSchema, f as citeCiterRequestSchema, l as citationDraftSchema, p as citeCiterResponseSchema, r as updateCheckResponseSchema, u as citationRecordSchema } from "./update-u9-6c_qp.js";
2
+ import { n as updateCheckDescriptor, t as citeCiterRequestDescriptor } from "./typert-common-DKqYKnRO.js";
3
3
  //#region lib/types/typert.host.js
4
4
  /** Handwritten strict Host contribution matching the single Remote decorator. */
5
5
  const TYPERT = {
@@ -29,6 +29,10 @@ const TYPERT = {
29
29
  {
30
30
  name: "CiteCiterResponse",
31
31
  schema: citeCiterResponseSchema
32
+ },
33
+ {
34
+ name: "UpdateCheckResponse",
35
+ schema: updateCheckResponseSchema
32
36
  }
33
37
  ],
34
38
  model: {
@@ -36,7 +40,7 @@ const TYPERT = {
36
40
  events: [],
37
41
  objects: []
38
42
  },
39
- invocations: [citeCiterRequestDescriptor]
43
+ invocations: [citeCiterRequestDescriptor, updateCheckDescriptor]
40
44
  };
41
45
  //#endregion
42
46
  export { TYPERT, TYPERT as default };
@@ -1,9 +1,9 @@
1
- import { t as citeCiterRequestDescriptor } from "./typert-common-4_cbghYz.js";
1
+ import { n as updateCheckDescriptor, t as citeCiterRequestDescriptor } from "./typert-common-DKqYKnRO.js";
2
2
  //#region lib/types/typert.remote-client.js
3
3
  /** Browser contribution mounted by the CiteCiter Client fiber. */
4
4
  const TYPERT_REMOTE = {
5
5
  package: "@kirkchinese/dsh-citeciter",
6
- descriptors: [citeCiterRequestDescriptor]
6
+ descriptors: [citeCiterRequestDescriptor, updateCheckDescriptor]
7
7
  };
8
8
  //#endregion
9
9
  export { TYPERT_REMOTE, TYPERT_REMOTE as default };
@@ -0,0 +1,237 @@
1
+ /** Shared blackboard protocol v4 and deterministic state folding. */
2
+ import { z } from 'zod';
3
+ /** Wire/version identity carried by every board snapshot. */
4
+ export declare const BOARD_PROTOCOL_VERSION: 4;
5
+ /** Maximum operations accepted in one atomic board commit. */
6
+ export declare const BOARD_MAX_BATCH_OPS = 50;
7
+ /** Maximum elements retained on one board. */
8
+ export declare const BOARD_MAX_ELEMENTS = 50;
9
+ /** Maximum combined UTF-8 element-content bytes retained on one board. */
10
+ export declare const BOARD_MAX_CONTENT_BYTES = 500000;
11
+ /** Element kinds the blackboard renders safely on the chalk canvas. */
12
+ export declare const boardElementKindSchema: z.ZodEnum<{
13
+ text: "text";
14
+ markdown: "markdown";
15
+ math: "math";
16
+ svg: "svg";
17
+ html: "html";
18
+ image: "image";
19
+ table: "table";
20
+ }>;
21
+ export type BoardElementKind = z.infer<typeof boardElementKindSchema>;
22
+ /** Style keys the board renderer applies directly as inline CSS properties. */
23
+ export declare const boardStyleSchema: z.ZodObject<{
24
+ color: z.ZodOptional<z.ZodString>;
25
+ fontSize: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strict>;
27
+ export type BoardStyle = z.infer<typeof boardStyleSchema>;
28
+ /** One deterministic blackboard command in canvas-percent coordinates. */
29
+ export declare const boardOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
30
+ op: z.ZodLiteral<"clear">;
31
+ }, z.core.$strict>, z.ZodObject<{
32
+ op: z.ZodLiteral<"set">;
33
+ id: z.ZodString;
34
+ kind: z.ZodEnum<{
35
+ text: "text";
36
+ markdown: "markdown";
37
+ math: "math";
38
+ svg: "svg";
39
+ html: "html";
40
+ image: "image";
41
+ table: "table";
42
+ }>;
43
+ content: z.ZodString;
44
+ x: z.ZodNumber;
45
+ y: z.ZodNumber;
46
+ w: z.ZodNumber;
47
+ h: z.ZodNumber;
48
+ style: z.ZodOptional<z.ZodObject<{
49
+ color: z.ZodOptional<z.ZodString>;
50
+ fontSize: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strict>>;
52
+ }, z.core.$strict>, z.ZodObject<{
53
+ op: z.ZodLiteral<"update">;
54
+ id: z.ZodString;
55
+ content: z.ZodOptional<z.ZodString>;
56
+ x: z.ZodOptional<z.ZodNumber>;
57
+ y: z.ZodOptional<z.ZodNumber>;
58
+ w: z.ZodOptional<z.ZodNumber>;
59
+ h: z.ZodOptional<z.ZodNumber>;
60
+ style: z.ZodOptional<z.ZodObject<{
61
+ color: z.ZodOptional<z.ZodString>;
62
+ fontSize: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strict>>;
64
+ }, z.core.$strict>, z.ZodObject<{
65
+ op: z.ZodLiteral<"remove">;
66
+ id: z.ZodString;
67
+ }, z.core.$strict>, z.ZodObject<{
68
+ op: z.ZodLiteral<"clear_region">;
69
+ x: z.ZodNumber;
70
+ y: z.ZodNumber;
71
+ w: z.ZodNumber;
72
+ h: z.ZodNumber;
73
+ }, z.core.$strict>, z.ZodObject<{
74
+ op: z.ZodLiteral<"animate">;
75
+ id: z.ZodString;
76
+ animation: z.ZodEnum<{
77
+ "fade-in": "fade-in";
78
+ "slide-in": "slide-in";
79
+ pulse: "pulse";
80
+ highlight: "highlight";
81
+ }>;
82
+ durationMs: z.ZodOptional<z.ZodNumber>;
83
+ iterations: z.ZodOptional<z.ZodNumber>;
84
+ }, z.core.$strict>, z.ZodObject<{
85
+ op: z.ZodLiteral<"focus">;
86
+ id: z.ZodNullable<z.ZodString>;
87
+ }, z.core.$strict>], "op">;
88
+ export type BoardOp = z.infer<typeof boardOpSchema>;
89
+ /** One validated, non-empty atomic blackboard commit. */
90
+ export declare const boardBatchSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
91
+ op: z.ZodLiteral<"clear">;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ op: z.ZodLiteral<"set">;
94
+ id: z.ZodString;
95
+ kind: z.ZodEnum<{
96
+ text: "text";
97
+ markdown: "markdown";
98
+ math: "math";
99
+ svg: "svg";
100
+ html: "html";
101
+ image: "image";
102
+ table: "table";
103
+ }>;
104
+ content: z.ZodString;
105
+ x: z.ZodNumber;
106
+ y: z.ZodNumber;
107
+ w: z.ZodNumber;
108
+ h: z.ZodNumber;
109
+ style: z.ZodOptional<z.ZodObject<{
110
+ color: z.ZodOptional<z.ZodString>;
111
+ fontSize: z.ZodOptional<z.ZodString>;
112
+ }, z.core.$strict>>;
113
+ }, z.core.$strict>, z.ZodObject<{
114
+ op: z.ZodLiteral<"update">;
115
+ id: z.ZodString;
116
+ content: z.ZodOptional<z.ZodString>;
117
+ x: z.ZodOptional<z.ZodNumber>;
118
+ y: z.ZodOptional<z.ZodNumber>;
119
+ w: z.ZodOptional<z.ZodNumber>;
120
+ h: z.ZodOptional<z.ZodNumber>;
121
+ style: z.ZodOptional<z.ZodObject<{
122
+ color: z.ZodOptional<z.ZodString>;
123
+ fontSize: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strict>>;
125
+ }, z.core.$strict>, z.ZodObject<{
126
+ op: z.ZodLiteral<"remove">;
127
+ id: z.ZodString;
128
+ }, z.core.$strict>, z.ZodObject<{
129
+ op: z.ZodLiteral<"clear_region">;
130
+ x: z.ZodNumber;
131
+ y: z.ZodNumber;
132
+ w: z.ZodNumber;
133
+ h: z.ZodNumber;
134
+ }, z.core.$strict>, z.ZodObject<{
135
+ op: z.ZodLiteral<"animate">;
136
+ id: z.ZodString;
137
+ animation: z.ZodEnum<{
138
+ "fade-in": "fade-in";
139
+ "slide-in": "slide-in";
140
+ pulse: "pulse";
141
+ highlight: "highlight";
142
+ }>;
143
+ durationMs: z.ZodOptional<z.ZodNumber>;
144
+ iterations: z.ZodOptional<z.ZodNumber>;
145
+ }, z.core.$strict>, z.ZodObject<{
146
+ op: z.ZodLiteral<"focus">;
147
+ id: z.ZodNullable<z.ZodString>;
148
+ }, z.core.$strict>], "op">>;
149
+ /** One rendered blackboard element after op folding. */
150
+ export interface BoardElementState {
151
+ readonly id: string;
152
+ readonly kind: BoardElementKind;
153
+ readonly content: string;
154
+ readonly x: number;
155
+ readonly y: number;
156
+ readonly w: number;
157
+ readonly h: number;
158
+ readonly style: BoardStyle;
159
+ readonly focused: boolean;
160
+ readonly animation?: {
161
+ readonly name: 'fade-in' | 'slide-in' | 'pulse' | 'highlight';
162
+ readonly durationMs: number;
163
+ readonly iterations: number;
164
+ readonly run: number;
165
+ } | undefined;
166
+ }
167
+ /** Immutable blackboard state keyed by element id. */
168
+ export type BoardState = ReadonlyMap<string, BoardElementState>;
169
+ /** Empty immutable input for the first board commit. */
170
+ export declare const EMPTY_BOARD_STATE: BoardState;
171
+ /**
172
+ * Apply one validated op batch atomically to the current board state.
173
+ * @param state - current element map.
174
+ * @param ops - validated, non-empty ops in application order.
175
+ * @returns the new state and the number of applied ops.
176
+ */
177
+ export declare function applyBoardOps(state: BoardState, ops: readonly BoardOp[]): {
178
+ readonly state: BoardState;
179
+ readonly revision: number;
180
+ };
181
+ /** Snapshot field containing only the final projected board state. */
182
+ export declare const boardSnapshotSchema: z.ZodObject<{
183
+ version: z.ZodLiteral<4>;
184
+ revision: z.ZodNumber;
185
+ elements: z.ZodArray<z.ZodObject<{
186
+ id: z.ZodString;
187
+ kind: z.ZodEnum<{
188
+ text: "text";
189
+ markdown: "markdown";
190
+ math: "math";
191
+ svg: "svg";
192
+ html: "html";
193
+ image: "image";
194
+ table: "table";
195
+ }>;
196
+ content: z.ZodString;
197
+ x: z.ZodNumber;
198
+ y: z.ZodNumber;
199
+ w: z.ZodNumber;
200
+ h: z.ZodNumber;
201
+ style: z.ZodObject<{
202
+ color: z.ZodOptional<z.ZodString>;
203
+ fontSize: z.ZodOptional<z.ZodString>;
204
+ }, z.core.$strict>;
205
+ focused: z.ZodBoolean;
206
+ animation: z.ZodOptional<z.ZodObject<{
207
+ name: z.ZodEnum<{
208
+ "fade-in": "fade-in";
209
+ "slide-in": "slide-in";
210
+ pulse: "pulse";
211
+ highlight: "highlight";
212
+ }>;
213
+ durationMs: z.ZodNumber;
214
+ iterations: z.ZodNumber;
215
+ run: z.ZodNumber;
216
+ }, z.core.$strict>>;
217
+ }, z.core.$strict>>;
218
+ invalid: z.ZodNumber;
219
+ }, z.core.$strict>;
220
+ export type BoardSnapshot = z.infer<typeof boardSnapshotSchema>;
221
+ /** Empty snapshot used before any board commit. */
222
+ export declare const EMPTY_BOARD_SNAPSHOT: BoardSnapshot;
223
+ /**
224
+ * Read renderable elements from one final-state snapshot.
225
+ * @param snapshot - projected final board state.
226
+ * @returns ordered elements plus the committed revision.
227
+ */
228
+ export declare function foldBoardSnapshot(snapshot: BoardSnapshot): {
229
+ readonly elements: readonly BoardElementState[];
230
+ readonly revision: number;
231
+ };
232
+ /**
233
+ * Fold a raw op list from first-set order; used by protocol tests.
234
+ * @param ops - one validated op batch.
235
+ * @returns final elements in insertion order.
236
+ */
237
+ export declare function foldBoardElements(ops: readonly BoardOp[]): readonly BoardElementState[];
@@ -1,7 +1,7 @@
1
1
  import { type ISessions, type SessionId, type SettingsScope, type SnapshotStore } from '@deepseek-ai/dsh-client-runtime/client';
2
2
  import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
3
- import { type CiteCiterRequest, type CiteCiterResponse, type CiteCiterSettings, type ProviderOption, type QuestionAnswer, type TopicSnapshot, type TopicSummary } from '../topic.ts';
4
- import { type CreateMode } from './request-guard.ts';
3
+ import { type CiteCiterRequest, type CiteCiterResponse, type CiteCiterSettings, type ProviderOption, type QuestionAnswer, type TopicScenario, type TopicSnapshot, type TopicSummary } from '../topic.ts';
4
+ import { type CreateMode, type DocumentClaimIntent } from './request-guard.ts';
5
5
  import type { CiteSelection } from './types.ts';
6
6
  export type CompanionPhase = 'idle' | 'creating' | 'ready' | 'running' | 'stopping' | 'stopped' | 'error';
7
7
  export type { CreateMode } from './request-guard.ts';
@@ -24,6 +24,8 @@ export interface CompanionSnapshot {
24
24
  reasoningEffortSaving: boolean;
25
25
  renaming: boolean;
26
26
  archiving: boolean;
27
+ deleting: boolean;
28
+ notice: string | null;
27
29
  includeArchived: boolean;
28
30
  error: string | null;
29
31
  }
@@ -32,8 +34,10 @@ export interface CompanionFace {
32
34
  getSnapshot(): CompanionSnapshot;
33
35
  subscribe(listener: () => void): () => void;
34
36
  setSource(sessionId: SessionId | null): void;
35
- setVisible(visible: boolean): void;
36
- create(selection: CiteSelection, question: string, mode?: CreateMode): Promise<void>;
37
+ retainVisible(): () => void;
38
+ create(selection: CiteSelection, question: string, mode?: CreateMode, scenario?: TopicScenario): Promise<void>;
39
+ createFree(question: string, scenario: Extract<TopicScenario, 'qa' | 'present'>): Promise<boolean>;
40
+ createFromDocument(claim: DocumentClaimIntent, question: string): Promise<void>;
37
41
  openTopic(sessionId: string): Promise<void>;
38
42
  ask(question: string): Promise<boolean>;
39
43
  answerQuestion(key: string, answer: QuestionAnswer): Promise<void>;
@@ -41,6 +45,8 @@ export interface CompanionFace {
41
45
  stop(): Promise<void>;
42
46
  rename(title: string): Promise<boolean>;
43
47
  archive(archived: boolean): Promise<boolean>;
48
+ deleteTopic(confirmSessionId: string): Promise<'complete' | 'pending' | false>;
49
+ dismissError(): void;
44
50
  setIncludeArchived(include: boolean): void;
45
51
  setModelRoute(provider: string, model: string): Promise<void>;
46
52
  setReasoningEffort(reasoningEffort: string | null): Promise<void>;
@@ -0,0 +1,16 @@
1
+ import type { ConvViewProps } from '@deepseek-ai/dsh-client-ui-conversation/client';
2
+ import type { CompanionFace } from '../companion-controller.ts';
3
+ import type { CiteBus } from '../types.ts';
4
+ /** Additional faces owned by CiteCiter's conversation-view registration. */
5
+ export interface BlackboardWorkspaceInjected {
6
+ readonly companion: CompanionFace;
7
+ readonly bus: CiteBus;
8
+ readonly openPanel: () => void;
9
+ }
10
+ export type BlackboardWorkspaceProps = ConvViewProps & BlackboardWorkspaceInjected;
11
+ /**
12
+ * Render the session-scoped blackboard registered through conversation.view.
13
+ * @param props - active DSH conversation identity and CiteCiter browser faces.
14
+ * @returns the matching Topic board or a source-specific empty state.
15
+ */
16
+ export declare function BlackboardWorkspace({ sessionId, companion, bus, openPanel }: BlackboardWorkspaceProps): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import 'katex/dist/katex.min.css';
2
+ import { type BoardElementState, type BoardSnapshot } from '../../board.ts';
3
+ /**
4
+ * Render one final-state blackboard projection in the main conversation workspace.
5
+ * @param props - board snapshot, motion preference, and optional citation action.
6
+ * @returns the safe blackboard canvas.
7
+ */
8
+ export declare function BoardView({ snapshot, animations, onQuoteElement, }: {
9
+ readonly snapshot: BoardSnapshot | undefined;
10
+ readonly animations: boolean;
11
+ readonly onQuoteElement?: (element: BoardElementState) => void;
12
+ }): import("react").JSX.Element;
@@ -1,9 +1,11 @@
1
1
  import type { SettingsSectionOwnerProps } from '@deepseek-ai/dsh-client-ui-settings/client';
2
2
  import type { CompanionFace } from '../companion-controller.ts';
3
3
  import type { SettingsDocumentController } from '../settings-document.ts';
4
+ import type { UpdateController } from '../update-controller.ts';
4
5
  export interface CiteCiterSettingsProps extends SettingsSectionOwnerProps {
5
6
  readonly companion: CompanionFace;
6
7
  readonly settingsDocument: SettingsDocumentController;
8
+ readonly updateController: UpdateController;
7
9
  }
8
10
  /** Native DSH settings page for CiteCiter-owned preferences. */
9
- export declare function CiteCiterSettings({ companion, settingsDocument }: CiteCiterSettingsProps): import("react").JSX.Element;
11
+ export declare function CiteCiterSettings({ companion, settingsDocument, updateController }: CiteCiterSettingsProps): import("react").JSX.Element;
@@ -6,5 +6,9 @@ export interface CitePanelProps {
6
6
  readonly closePanel: () => void;
7
7
  readonly reportParseError: (messageId: string) => void;
8
8
  }
9
- /** Independent learning workspace with a reversible Host-column compatibility adapter. */
9
+ /**
10
+ * Render the independent Topic workspace on the right edge of the shell.
11
+ * @param props - shared panel bus, Topic controller, and host callbacks.
12
+ * @returns the responsive Topic dock and its dialogs, or null while closed.
13
+ */
10
14
  export declare function CitePanel({ bus, companion, closePanel, reportParseError }: CitePanelProps): import("react").JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ import type { ReaderFace } from '../reader-controller.ts';
2
+ /** Reader shell-overlay entry: compact trigger plus the document library panel. */
3
+ export declare function DocumentReader({ reader }: {
4
+ readonly reader: ReaderFace;
5
+ }): import("react").JSX.Element;
@@ -5,5 +5,9 @@ export interface SelectionMenuProps {
5
5
  readonly companion: CompanionFace;
6
6
  readonly openPanel: () => void;
7
7
  }
8
- /** Ask the first question beside the selected source text. */
8
+ /**
9
+ * Ask the first question beside the selected source text.
10
+ * @param props - shared selection state and Topic actions.
11
+ * @returns the contextual creation popover and companion launcher.
12
+ */
9
13
  export declare function SelectionMenu({ bus, companion, openPanel }: SelectionMenuProps): import("react").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { type UpdateController } from '../update-controller.ts';
2
+ /** Injected owner of the root-scoped update state. */
3
+ export interface UpdateNoticeProps {
4
+ readonly updateController: UpdateController;
5
+ }
6
+ /**
7
+ * Render the non-modal Web update notice in the frame-wide overlay.
8
+ * @param props - root-scoped update actions and observable state.
9
+ * @returns the available-version card, or no surface while current or suppressed.
10
+ */
11
+ export declare function UpdateNotice({ updateController }: UpdateNoticeProps): import("react").JSX.Element | null;
@@ -41,13 +41,21 @@ export declare function dshAssistantAnchorForTarget(target: EventTarget | null):
41
41
  */
42
42
  export declare function dshIntersectedAssistantAnchors(range: Range): DshAssistantAnchor[];
43
43
  /**
44
- * Detect generated controls, reasoning summaries, and collapsed code chrome.
44
+ * Detect generated controls and collapsed code chrome.
45
45
  *
46
46
  * @param range - current rendered selection range.
47
47
  * @param flow - assistant flow containing the range.
48
48
  * @returns whether the range touches content that CiteCiter must ignore.
49
49
  */
50
50
  export declare function dshRangeTouchesExcludedContent(range: Range, flow: HTMLElement): boolean;
51
+ /**
52
+ * Detect a selection endpoint inside a generated reasoning disclosure row.
53
+ *
54
+ * @param range - current rendered selection range.
55
+ * @param flow - assistant flow containing the range.
56
+ * @returns whether a collapsed or expanded reasoning header anchors the selection.
57
+ */
58
+ export declare function dshRangeHasReasoningHeaderEndpoint(range: Range, flow: HTMLElement): boolean;
51
59
  /**
52
60
  * Find the current DSH assistant element for a persisted anchor key.
53
61
  *
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Client entry-point registry: every "start a Citer from here" surface
3
+ * contributes one entry that probes the pointer event and claims a selection.
4
+ * Entries run in registration order; the first claim wins and is allowed to
5
+ * prevent the native context menu.
6
+ */
7
+ import type { ISessions, SessionId } from '@deepseek-ai/dsh-client-runtime/client';
8
+ import type { CiteSelection } from './types.ts';
9
+ /** Live browser facts an entry needs to resolve one selection. */
10
+ export interface CiteCiterEntryContext {
11
+ readonly sessions: ISessions;
12
+ readonly sourceSessionId: SessionId;
13
+ }
14
+ /** One Citer entry point: probe, capture, and claim a selection from the DOM. */
15
+ export interface CiteCiterEntry {
16
+ /** Stable entry identity recorded on the claimed selection. */
17
+ readonly id: string;
18
+ /**
19
+ * Claim the current pointer event for this entry.
20
+ * @param event - context-menu event whose position anchors the claim.
21
+ * @param context - current source session and its bindings.
22
+ * @returns a validated selection, or null when this entry does not own the event.
23
+ */
24
+ claim(event: MouseEvent, context: CiteCiterEntryContext): CiteSelection | null;
25
+ }
26
+ /** Mutable ordered entry registry with effect-style registration. */
27
+ export interface CiteCiterEntryRegistry {
28
+ /**
29
+ * Append one entry.
30
+ * @param entry - immutable entry contribution.
31
+ * @returns disposer removing the exact entry.
32
+ */
33
+ register(entry: CiteCiterEntry): () => void;
34
+ /** Registered entries in claim order. */
35
+ list(): readonly CiteCiterEntry[];
36
+ /**
37
+ * Ask entries in order for a claimed selection.
38
+ * @returns the first entry claim, or null when no entry owns the event.
39
+ */
40
+ claim(event: MouseEvent, context: CiteCiterEntryContext): {
41
+ readonly entry: CiteCiterEntry;
42
+ readonly selection: CiteSelection;
43
+ } | null;
44
+ }
45
+ /** Create an ordered client entry registry. */
46
+ export declare function createCiteCiterEntryRegistry(): CiteCiterEntryRegistry;
47
+ /**
48
+ * Built-in assistant answer entry: resolves a selection inside a committed
49
+ * `assistant-step` flow, including collapsed reasoning disclosure rows.
50
+ * @returns the entry contribution; register it on the shared registry.
51
+ */
52
+ export declare function createAssistantEntry(): CiteCiterEntry;
53
+ /**
54
+ * Built-in tool evidence entry: claims a whole-card tool result from its
55
+ * `call:<callId>` row and the enclosing `tool-call` chat flow. Terminal and
56
+ * diff cards select their dedicated projections; everything else is
57
+ * `result-text`.
58
+ * @returns the entry contribution; register it after the assistant entry.
59
+ */
60
+ export declare function createToolEvidenceEntry(): CiteCiterEntry;
@@ -0,0 +1,3 @@
1
+ /** Stable identities for CiteCiter client entry points. */
2
+ export declare const ASSISTANT_ENTRY_ID: "citeciter.entry.assistant";
3
+ export declare const TOOL_ENTRY_ID: "citeciter.entry.tool";
@@ -0,0 +1,19 @@
1
+ /** CiteCiter-owned accelerator parsing and listener installation. */
2
+ export interface Accelerator {
3
+ readonly modifiers: ReadonlySet<'Control' | 'Alt' | 'Shift' | 'Meta'>;
4
+ readonly key: string;
5
+ }
6
+ /**
7
+ * Parse a `Modifier+Modifier+Key` accelerator string.
8
+ * @param accelerator - user-configured accelerator, e.g. `Control+Shift+C`.
9
+ * @returns normalized modifiers and the final key, or null when malformed.
10
+ */
11
+ export declare function parseAccelerator(accelerator: string): Accelerator | null;
12
+ /**
13
+ * Install a window-level keydown listener that reads the accelerator fresh on
14
+ * every keypress, so settings changes apply without re-registering.
15
+ * @param accelerator - current accelerator getter; an empty value disables the binding.
16
+ * @param handler - invoked once for each matching, non-editable, non-IME keypress.
17
+ * @returns disposer removing the listener.
18
+ */
19
+ export declare function installDynamicAccelerator(accelerator: () => string | undefined, handler: () => void): () => void;
@@ -0,0 +1,33 @@
1
+ import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
2
+ import type { CiteCiterRequest, CiteCiterResponse, DocumentContent, DocumentSummary } from '../topic.ts';
3
+ import type { CompanionFace } from './companion-controller.ts';
4
+ import type { ReaderSelection } from './reader-selection.ts';
5
+ export type ReaderDocumentsStatus = 'idle' | 'loading' | 'ready' | 'error';
6
+ export interface ReaderSnapshot {
7
+ open: boolean;
8
+ documents: readonly DocumentSummary[];
9
+ documentsStatus: ReaderDocumentsStatus;
10
+ active: DocumentContent | null;
11
+ selection: ReaderSelection | null;
12
+ question: string;
13
+ creating: boolean;
14
+ error: string | null;
15
+ }
16
+ export interface ReaderFace {
17
+ getSnapshot(): ReaderSnapshot;
18
+ subscribe(listener: () => void): () => void;
19
+ setOpen(open: boolean): void;
20
+ refresh(): Promise<void>;
21
+ importFile(name: string, content: string): Promise<DocumentSummary | null>;
22
+ openDocument(documentId: string): Promise<void>;
23
+ setSelection(selection: ReaderSelection | null): void;
24
+ setQuestion(question: string): void;
25
+ createTopic(): Promise<void>;
26
+ dispose(): Promise<void>;
27
+ }
28
+ type RemoteRequest = (request: CiteCiterRequest, signal: AbortSignal) => Promise<RemoteResult<CiteCiterResponse>>;
29
+ /** Initial Reader snapshot. */
30
+ export declare function createInitialReaderSnapshot(): ReaderSnapshot;
31
+ /** Bind the Reader store to the CiteCiter Remote and the companion Topic creator. */
32
+ export declare function createReaderController(request: RemoteRequest, companion: CompanionFace, store?: import("@deepseek-ai/dsh-client-runtime/client").SnapshotStore<ReaderSnapshot>): ReaderFace;
33
+ export {};
@@ -0,0 +1,12 @@
1
+ /** Reader textarea selection facts resolved from the user-owned textarea value. */
2
+ export interface ReaderSelection {
3
+ readonly displayText: string;
4
+ readonly prefixText: string;
5
+ readonly suffixText: string;
6
+ }
7
+ /**
8
+ * Resolve the current textarea selection into a verifiable document claim.
9
+ * @param textarea - read-only document textarea holding the complete loaded page.
10
+ * @returns trimmed quote with surrounding context, or null for a collapsed/empty selection.
11
+ */
12
+ export declare function readTextareaSelection(textarea: HTMLTextAreaElement): ReaderSelection | null;
@@ -1,3 +1,4 @@
1
+ import type { TopicScenario } from '../topic.ts';
1
2
  import type { CiteSelection } from './types.ts';
2
3
  export type CreateMode = 'observer' | 'exact-fork' | 'exact-when-available';
3
4
  export interface RequestIntent {
@@ -11,7 +12,29 @@ export interface RequestIntent {
11
12
  * @param mode - resolved Topic creation mode.
12
13
  * @returns the pending intent key and request ID.
13
14
  */
14
- export declare function claimCreateTopicIntent(selection: CiteSelection, question: string, mode: CreateMode): Promise<RequestIntent>;
15
+ export declare function claimCreateTopicIntent(selection: CiteSelection, question: string, mode: CreateMode, scenario?: TopicScenario): Promise<RequestIntent>;
16
+ /**
17
+ * Claim the retry-stable request ID for one uncited Topic creation.
18
+ * @param sourceSessionId - owning DSH Session.
19
+ * @param question - normalized first question.
20
+ * @param scenario - requested Topic presentation.
21
+ * @returns the pending intent key and request ID.
22
+ */
23
+ export declare function claimCreateFreeTopicIntent(sourceSessionId: string, question: string, scenario: Extract<TopicScenario, 'qa' | 'present'>): Promise<RequestIntent>;
24
+ /** Document-range claim identity shared by the Reader entry point. */
25
+ export interface DocumentClaimIntent {
26
+ readonly documentId: string;
27
+ readonly displayText: string;
28
+ readonly prefixText: string;
29
+ readonly suffixText: string;
30
+ }
31
+ /**
32
+ * Claim the retry-stable request ID for one pending document Topic creation.
33
+ * @param claim - document identity and verified-looking quote context.
34
+ * @param question - normalized first question.
35
+ * @returns the pending intent key and request ID.
36
+ */
37
+ export declare function claimCreateDocumentIntent(claim: DocumentClaimIntent, question: string): Promise<RequestIntent>;
15
38
  /**
16
39
  * Claim the retry-stable request ID for one pending Topic follow-up.
17
40
  * @param topicSessionId - target private Topic Session.
@@ -18,6 +18,12 @@ export type RichSegment = {
18
18
  readonly kind: 'html';
19
19
  readonly document: string;
20
20
  };
21
+ /**
22
+ * Break CommonMark image openers without changing visible text or ordinary links.
23
+ * @param text - untrusted board Markdown or table source.
24
+ * @returns Markdown that cannot produce image nodes.
25
+ */
26
+ export declare function neutralizeMarkdownImages(text: string): string;
21
27
  /**
22
28
  * Split complete safe rich fences from Markdown while preserving all prose.
23
29
  * @param text - current assistant response text.