@kirkchinese/dsh-citeciter 0.4.2 → 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.
- package/README.md +37 -28
- package/README.zh.md +37 -28
- package/lib/client.js +32133 -2518
- package/lib/index.js +1304 -126
- package/lib/{typert-common-4_cbghYz.js → typert-common-DKqYKnRO.js} +23 -3
- package/lib/typert.host.js +7 -3
- package/lib/typert.remote-client.js +2 -2
- package/lib/types/assistant-content.d.ts +7 -0
- package/lib/types/board.d.ts +237 -0
- package/lib/types/client/answer.d.ts +1 -1
- package/lib/types/client/companion-controller.d.ts +10 -4
- package/lib/types/client/components/BlackboardWorkspace.d.ts +16 -0
- package/lib/types/client/components/BoardView.d.ts +12 -0
- package/lib/types/client/components/CiteCiterSettings.d.ts +3 -1
- package/lib/types/client/components/CitePanel.d.ts +5 -1
- package/lib/types/client/components/DocumentReader.d.ts +5 -0
- package/lib/types/client/components/SelectionMenu.d.ts +5 -1
- package/lib/types/client/components/UpdateNotice.d.ts +11 -0
- package/lib/types/client/conversation-dom.d.ts +19 -4
- package/lib/types/client/entries.d.ts +60 -0
- package/lib/types/client/entry-ids.d.ts +3 -0
- package/lib/types/client/hotkeys.d.ts +19 -0
- package/lib/types/client/reader-controller.d.ts +33 -0
- package/lib/types/client/reader-selection.d.ts +12 -0
- package/lib/types/client/request-guard.d.ts +24 -1
- package/lib/types/client/rich-content.d.ts +6 -0
- package/lib/types/client/selection.d.ts +4 -2
- package/lib/types/client/topic-presentation.d.ts +15 -0
- package/lib/types/client/types.d.ts +36 -1
- package/lib/types/client/update-controller.d.ts +57 -0
- package/lib/types/documents.d.ts +45 -0
- package/lib/types/evidence-text.d.ts +29 -0
- package/lib/types/index.d.ts +13 -14
- package/lib/types/observer.d.ts +27 -2
- package/lib/types/service.d.ts +81 -0
- package/lib/types/topic-runtime.d.ts +302 -4
- package/lib/types/topic.d.ts +604 -43
- package/lib/types/typert-common.d.ts +278 -11
- package/lib/types/typert.host.d.ts +669 -34
- package/lib/types/typert.remote-client.d.ts +3 -0
- package/lib/types/update.d.ts +68 -0
- package/lib/update-u9-6c_qp.js +1072 -0
- package/package.json +7 -4
- package/lib/topic-BVNCaVbJ.js +0 -307
|
@@ -1,13 +1,245 @@
|
|
|
1
1
|
import { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import { type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session';
|
|
3
3
|
import { type SessionTitleProviderRequest } from '@deepseek-ai/dsh-session-title';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { type BoardSnapshot } from './board.ts';
|
|
4
6
|
import { type ObserverSourceSnapshot } from './observer.ts';
|
|
5
|
-
import { type CiteCiterRequest, type CiteCiterResponse, type CiteCiterSettings, type TopicMetadata, type TopicMode } from './topic.ts';
|
|
7
|
+
import { type CiteCiterRequest, type CiteCiterResponse, type CiteCiterSettings, type CitationRecord, type TopicMessage, type TopicMetadata, type TopicMode, type TopicScenario, type TopicSummary } from './topic.ts';
|
|
6
8
|
type CreateRequest = Extract<CiteCiterRequest, {
|
|
7
9
|
action: 'create';
|
|
8
10
|
}>;
|
|
11
|
+
type DeleteResponse = Extract<CiteCiterResponse, {
|
|
12
|
+
kind: 'deleted';
|
|
13
|
+
}>;
|
|
14
|
+
type TopicChangeListener = (name: 'created' | 'updated' | 'deleted', payload: {
|
|
15
|
+
topic: TopicSummary;
|
|
16
|
+
} | Omit<DeleteResponse, 'kind'>) => void;
|
|
9
17
|
/** Decide both model visibility and execution access for one private Topic tool. */
|
|
10
|
-
export declare function citeCiterToolAvailable(name: string, allowSourceFiles: boolean): boolean;
|
|
18
|
+
export declare function citeCiterToolAvailable(name: string, allowSourceFiles: boolean, scenario?: TopicScenario): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Render selected evidence only when this Topic actually owns a Citation.
|
|
21
|
+
* @param citation - immutable Citation or explicit absence for a free Topic.
|
|
22
|
+
* @returns model context text, or `undefined` when no quote was selected.
|
|
23
|
+
*/
|
|
24
|
+
export declare function topicCitationContext(citation: CitationRecord | null): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Keep product safety and scenario rules authoritative over optional teaching-style preferences.
|
|
27
|
+
* @param scenario - Topic behavior selected at creation.
|
|
28
|
+
* @param custom - optional user-authored teaching preferences.
|
|
29
|
+
* @returns the complete tutor prompt.
|
|
30
|
+
*/
|
|
31
|
+
export declare function composeTutorPrompt(scenario: TopicScenario, custom: string | undefined): string;
|
|
32
|
+
/** Complete model-visible parameter schema for blackboard_apply. */
|
|
33
|
+
export declare const BLACKBOARD_APPLY_PARAMETERS: {
|
|
34
|
+
readonly ops: {
|
|
35
|
+
readonly type: "array";
|
|
36
|
+
readonly required: true;
|
|
37
|
+
readonly description: "Ordered atomic batch containing 1-50 board operations.";
|
|
38
|
+
readonly items: {
|
|
39
|
+
readonly oneOf: readonly [{
|
|
40
|
+
readonly type: "object";
|
|
41
|
+
readonly additionalProperties: false;
|
|
42
|
+
readonly properties: {
|
|
43
|
+
readonly op: {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
readonly const: "clear";
|
|
46
|
+
readonly required: true;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}, {
|
|
50
|
+
readonly type: "object";
|
|
51
|
+
readonly additionalProperties: false;
|
|
52
|
+
readonly properties: {
|
|
53
|
+
readonly style: {
|
|
54
|
+
readonly type: "object";
|
|
55
|
+
readonly additionalProperties: false;
|
|
56
|
+
readonly properties: {
|
|
57
|
+
readonly color: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly description: "CSS color restricted by the board validator.";
|
|
60
|
+
};
|
|
61
|
+
readonly fontSize: {
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
readonly description: "CSS length in px, em, rem, or percent.";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly x: {
|
|
68
|
+
readonly type: "number";
|
|
69
|
+
readonly required: true;
|
|
70
|
+
readonly description: "Left edge as canvas percent; x + w must be at most 100.";
|
|
71
|
+
};
|
|
72
|
+
readonly y: {
|
|
73
|
+
readonly type: "number";
|
|
74
|
+
readonly required: true;
|
|
75
|
+
readonly description: "Top edge as canvas percent; y + h must be at most 100.";
|
|
76
|
+
};
|
|
77
|
+
readonly w: {
|
|
78
|
+
readonly type: "number";
|
|
79
|
+
readonly required: true;
|
|
80
|
+
readonly description: "Width as canvas percent, from 0.5 to 100.";
|
|
81
|
+
};
|
|
82
|
+
readonly h: {
|
|
83
|
+
readonly type: "number";
|
|
84
|
+
readonly required: true;
|
|
85
|
+
readonly description: "Height as canvas percent, from 0.5 to 100.";
|
|
86
|
+
};
|
|
87
|
+
readonly op: {
|
|
88
|
+
readonly type: "string";
|
|
89
|
+
readonly const: "set";
|
|
90
|
+
readonly required: true;
|
|
91
|
+
};
|
|
92
|
+
readonly id: {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
readonly required: true;
|
|
95
|
+
};
|
|
96
|
+
readonly kind: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
readonly enum: readonly ["text", "markdown", "math", "svg", "html", "image", "table"];
|
|
99
|
+
readonly required: true;
|
|
100
|
+
};
|
|
101
|
+
readonly content: {
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
readonly required: true;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
}, {
|
|
107
|
+
readonly type: "object";
|
|
108
|
+
readonly additionalProperties: false;
|
|
109
|
+
readonly properties: {
|
|
110
|
+
readonly op: {
|
|
111
|
+
readonly type: "string";
|
|
112
|
+
readonly const: "update";
|
|
113
|
+
readonly required: true;
|
|
114
|
+
};
|
|
115
|
+
readonly id: {
|
|
116
|
+
readonly type: "string";
|
|
117
|
+
readonly required: true;
|
|
118
|
+
};
|
|
119
|
+
readonly content: {
|
|
120
|
+
readonly type: "string";
|
|
121
|
+
};
|
|
122
|
+
readonly x: {
|
|
123
|
+
readonly type: "number";
|
|
124
|
+
};
|
|
125
|
+
readonly y: {
|
|
126
|
+
readonly type: "number";
|
|
127
|
+
};
|
|
128
|
+
readonly w: {
|
|
129
|
+
readonly type: "number";
|
|
130
|
+
};
|
|
131
|
+
readonly h: {
|
|
132
|
+
readonly type: "number";
|
|
133
|
+
};
|
|
134
|
+
readonly style: {
|
|
135
|
+
readonly type: "object";
|
|
136
|
+
readonly additionalProperties: false;
|
|
137
|
+
readonly properties: {
|
|
138
|
+
readonly color: {
|
|
139
|
+
readonly type: "string";
|
|
140
|
+
readonly description: "CSS color restricted by the board validator.";
|
|
141
|
+
};
|
|
142
|
+
readonly fontSize: {
|
|
143
|
+
readonly type: "string";
|
|
144
|
+
readonly description: "CSS length in px, em, rem, or percent.";
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
}, {
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly additionalProperties: false;
|
|
152
|
+
readonly properties: {
|
|
153
|
+
readonly op: {
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
readonly const: "remove";
|
|
156
|
+
readonly required: true;
|
|
157
|
+
};
|
|
158
|
+
readonly id: {
|
|
159
|
+
readonly type: "string";
|
|
160
|
+
readonly required: true;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
}, {
|
|
164
|
+
readonly type: "object";
|
|
165
|
+
readonly additionalProperties: false;
|
|
166
|
+
readonly properties: {
|
|
167
|
+
readonly x: {
|
|
168
|
+
readonly type: "number";
|
|
169
|
+
readonly required: true;
|
|
170
|
+
readonly description: "Left edge as canvas percent; x + w must be at most 100.";
|
|
171
|
+
};
|
|
172
|
+
readonly y: {
|
|
173
|
+
readonly type: "number";
|
|
174
|
+
readonly required: true;
|
|
175
|
+
readonly description: "Top edge as canvas percent; y + h must be at most 100.";
|
|
176
|
+
};
|
|
177
|
+
readonly w: {
|
|
178
|
+
readonly type: "number";
|
|
179
|
+
readonly required: true;
|
|
180
|
+
readonly description: "Width as canvas percent, from 0.5 to 100.";
|
|
181
|
+
};
|
|
182
|
+
readonly h: {
|
|
183
|
+
readonly type: "number";
|
|
184
|
+
readonly required: true;
|
|
185
|
+
readonly description: "Height as canvas percent, from 0.5 to 100.";
|
|
186
|
+
};
|
|
187
|
+
readonly op: {
|
|
188
|
+
readonly type: "string";
|
|
189
|
+
readonly const: "clear_region";
|
|
190
|
+
readonly required: true;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
}, {
|
|
194
|
+
readonly type: "object";
|
|
195
|
+
readonly additionalProperties: false;
|
|
196
|
+
readonly properties: {
|
|
197
|
+
readonly op: {
|
|
198
|
+
readonly type: "string";
|
|
199
|
+
readonly const: "animate";
|
|
200
|
+
readonly required: true;
|
|
201
|
+
};
|
|
202
|
+
readonly id: {
|
|
203
|
+
readonly type: "string";
|
|
204
|
+
readonly required: true;
|
|
205
|
+
};
|
|
206
|
+
readonly animation: {
|
|
207
|
+
readonly type: "string";
|
|
208
|
+
readonly enum: readonly ["fade-in", "slide-in", "pulse", "highlight"];
|
|
209
|
+
readonly required: true;
|
|
210
|
+
};
|
|
211
|
+
readonly durationMs: {
|
|
212
|
+
readonly type: "integer";
|
|
213
|
+
readonly description: "Animation duration from 50 to 5000 milliseconds.";
|
|
214
|
+
};
|
|
215
|
+
readonly iterations: {
|
|
216
|
+
readonly type: "integer";
|
|
217
|
+
readonly description: "Iteration count from 1 to 5.";
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
}, {
|
|
221
|
+
readonly type: "object";
|
|
222
|
+
readonly additionalProperties: false;
|
|
223
|
+
readonly properties: {
|
|
224
|
+
readonly op: {
|
|
225
|
+
readonly type: "string";
|
|
226
|
+
readonly const: "focus";
|
|
227
|
+
readonly required: true;
|
|
228
|
+
};
|
|
229
|
+
readonly id: {
|
|
230
|
+
readonly oneOf: readonly [{
|
|
231
|
+
readonly type: "string";
|
|
232
|
+
}, {
|
|
233
|
+
readonly type: "null";
|
|
234
|
+
}];
|
|
235
|
+
readonly required: true;
|
|
236
|
+
readonly description: "Existing element id, or null to clear focus.";
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
}];
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
};
|
|
11
243
|
/** Select the first human question added after a Topic's inherited seed. */
|
|
12
244
|
export declare function selectTopicTitleMessage(request: SessionTitleProviderRequest): import("@deepseek-ai/dsh-session-title").SessionTitleUserMessage;
|
|
13
245
|
/** Session header and events used to project one private Topic. */
|
|
@@ -15,6 +247,31 @@ export interface RuntimeTopicLog {
|
|
|
15
247
|
readonly header: SessionHeader;
|
|
16
248
|
readonly events: readonly SessionEvent[];
|
|
17
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Remove one artifact from a caller-owned JSONL root without following links.
|
|
252
|
+
* @param root - fixed private JSONL root owned by the caller.
|
|
253
|
+
* @param artifact - location returned by that exact JSONL backend.
|
|
254
|
+
* @returns when the file/link and its empty per-session directory are absent.
|
|
255
|
+
*/
|
|
256
|
+
export declare function removeOwnedJsonlArtifact(root: string, artifact: {
|
|
257
|
+
readonly kind: string;
|
|
258
|
+
readonly path: string;
|
|
259
|
+
} | undefined): Promise<void>;
|
|
260
|
+
declare const topicDeletionMarkerSchema: z.ZodObject<{
|
|
261
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
262
|
+
sessionId: z.ZodString;
|
|
263
|
+
sourceSessionId: z.ZodString;
|
|
264
|
+
topicId: z.ZodNumber;
|
|
265
|
+
sessionHeader: z.ZodObject<{
|
|
266
|
+
version: z.ZodNumber;
|
|
267
|
+
id: z.ZodString;
|
|
268
|
+
createdAt: z.ZodNumber;
|
|
269
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
270
|
+
}, z.core.$strict>;
|
|
271
|
+
}, z.core.$strict>;
|
|
272
|
+
type TopicDeletionMarker = Omit<z.infer<typeof topicDeletionMarkerSchema>, 'sessionHeader'> & {
|
|
273
|
+
readonly sessionHeader: SessionHeader;
|
|
274
|
+
};
|
|
18
275
|
/** Minimal on-disk navigation index; Session history stays in standard DSH JSONL. */
|
|
19
276
|
export declare class TopicIndex {
|
|
20
277
|
private readonly root;
|
|
@@ -27,11 +284,32 @@ export declare class TopicIndex {
|
|
|
27
284
|
save(metadata: TopicMetadata): Promise<void>;
|
|
28
285
|
loadBySessionId(sessionId: string): Promise<TopicMetadata>;
|
|
29
286
|
list(sourceSessionId: string): Promise<TopicMetadata[]>;
|
|
30
|
-
|
|
287
|
+
/** Commit a minimal deletion marker before making Topic metadata unreachable. */
|
|
288
|
+
markDeleting(metadata: TopicMetadata, sessionHeader: SessionHeader): Promise<TopicDeletionMarker>;
|
|
289
|
+
/** Discover committed deletion markers without following linked directories. */
|
|
290
|
+
listDeleting(): Promise<TopicDeletionMarker[]>;
|
|
291
|
+
/** Remove the marker and its now-empty Topic directory after artifact cleanup. */
|
|
292
|
+
finishDeleting(marker: TopicDeletionMarker): Promise<void>;
|
|
31
293
|
private directory;
|
|
32
294
|
private read;
|
|
33
295
|
private readIfPresent;
|
|
296
|
+
private deletionMarkerIfPresent;
|
|
34
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Project transcript rows and the latest turn's active failure banner.
|
|
300
|
+
* @param log - private Topic Session contents.
|
|
301
|
+
* @returns transcript rows plus an error only while the newest turn remains failed.
|
|
302
|
+
*/
|
|
303
|
+
export declare function topicMessages(log: RuntimeTopicLog): {
|
|
304
|
+
messages: TopicMessage[];
|
|
305
|
+
error: string | null;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Project final blackboard state from successful blackboard_apply call/result pairs.
|
|
309
|
+
* @param log - private Topic Session contents.
|
|
310
|
+
* @returns versioned final state, successful commit revision, and invalid-commit count.
|
|
311
|
+
*/
|
|
312
|
+
export declare function projectBoardFromLog(log: RuntimeTopicLog): BoardSnapshot;
|
|
35
313
|
/**
|
|
36
314
|
* Return the first genuine Topic question after any Exact Fork seed.
|
|
37
315
|
* @param log - private Topic Session contents.
|
|
@@ -59,6 +337,7 @@ export declare class TopicRuntime {
|
|
|
59
337
|
private readonly settings;
|
|
60
338
|
private readonly runtime;
|
|
61
339
|
private readonly index;
|
|
340
|
+
private readonly documents;
|
|
62
341
|
private readonly lifecycleAbort;
|
|
63
342
|
private readonly fibers;
|
|
64
343
|
private readonly handles;
|
|
@@ -70,13 +349,14 @@ export declare class TopicRuntime {
|
|
|
70
349
|
private readonly creations;
|
|
71
350
|
private readonly asks;
|
|
72
351
|
private readonly topicAdmissions;
|
|
73
|
-
private readonly
|
|
352
|
+
private readonly deleting;
|
|
74
353
|
private readonly titleRefreshes;
|
|
75
354
|
private readonly titleRefreshAttempted;
|
|
76
355
|
private readonly titleHydrated;
|
|
77
356
|
private readonly sourceAvailability;
|
|
78
357
|
private readonly sourceAvailabilityChecks;
|
|
79
358
|
private readonly ready;
|
|
359
|
+
private readonly topicListeners;
|
|
80
360
|
private disposal;
|
|
81
361
|
private releasing;
|
|
82
362
|
private releaseLlm;
|
|
@@ -92,6 +372,12 @@ export declare class TopicRuntime {
|
|
|
92
372
|
initialize(): Promise<void>;
|
|
93
373
|
/** Execute one validated browser command against private Topics. */
|
|
94
374
|
request(rawRequest: CiteCiterRequest, callerSignal: AbortSignal): Promise<CiteCiterResponse>;
|
|
375
|
+
/**
|
|
376
|
+
* Observe committed Topic state changes.
|
|
377
|
+
* @param listener - receives the change kind and durable summary.
|
|
378
|
+
* @returns disposer removing the exact listener.
|
|
379
|
+
*/
|
|
380
|
+
onTopicChange(listener: TopicChangeListener): () => void;
|
|
95
381
|
private executeRequest;
|
|
96
382
|
/** Stop every owned Agent and plugin fiber before releasing bridged services. */
|
|
97
383
|
dispose(): Promise<void>;
|
|
@@ -110,6 +396,9 @@ export declare class TopicRuntime {
|
|
|
110
396
|
private createHandle;
|
|
111
397
|
private setupAgent;
|
|
112
398
|
private globTool;
|
|
399
|
+
private blackboardApplyTool;
|
|
400
|
+
private readDocumentTool;
|
|
401
|
+
private searchDocumentTool;
|
|
113
402
|
private sourceTool;
|
|
114
403
|
private ensureHandle;
|
|
115
404
|
private disposeLateHandle;
|
|
@@ -126,12 +415,20 @@ export declare class TopicRuntime {
|
|
|
126
415
|
private rename;
|
|
127
416
|
private archive;
|
|
128
417
|
private delete;
|
|
418
|
+
private deleteAdmitted;
|
|
419
|
+
/** Await rc.2 JSONL retirement without populating its prepared-session cache. */
|
|
420
|
+
private readRetiredSessionHeader;
|
|
421
|
+
/** Remove one artifact only from CiteCiter's fixed private JSONL backend. */
|
|
129
422
|
private removeSessionArtifact;
|
|
423
|
+
private finishDeletion;
|
|
424
|
+
private recoverDeletions;
|
|
425
|
+
private clearDeletedTopicState;
|
|
130
426
|
private enqueueModelChange;
|
|
131
427
|
private setModelRoute;
|
|
132
428
|
private setReasoningEffort;
|
|
133
429
|
private selectModel;
|
|
134
430
|
private applyModelSelection;
|
|
431
|
+
private importDocument;
|
|
135
432
|
private models;
|
|
136
433
|
private list;
|
|
137
434
|
private summary;
|
|
@@ -142,6 +439,7 @@ export declare class TopicRuntime {
|
|
|
142
439
|
private rememberSourceAvailability;
|
|
143
440
|
private snapshot;
|
|
144
441
|
private patchMetadata;
|
|
442
|
+
private patchMetadataSerialized;
|
|
145
443
|
private scheduleExactTitleRefresh;
|
|
146
444
|
}
|
|
147
445
|
export {};
|