@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.
Files changed (89) hide show
  1. package/README.md +68 -139
  2. package/README.zh.md +70 -141
  3. package/lib/client.js +4020 -1830
  4. package/lib/index.js +16928 -16567
  5. package/lib/{typert-common-BQpqe5Ph.js → typert-common-g1lnIG8u.js} +3 -5
  6. package/lib/typert.host.js +2 -2
  7. package/lib/typert.remote-client.js +1 -1
  8. package/lib/types/actions.d.ts +22 -14
  9. package/lib/types/blackboard-tool.d.ts +6 -0
  10. package/lib/types/blocking-question-recovery.d.ts +16 -0
  11. package/lib/types/board.d.ts +0 -15
  12. package/lib/types/client/action-controller.d.ts +9 -2
  13. package/lib/types/client/action-executor.d.ts +5 -1
  14. package/lib/types/client/board-citation.d.ts +8 -0
  15. package/lib/types/client/citer-session-face.d.ts +3 -2
  16. package/lib/types/client/companion-controller.d.ts +18 -9
  17. package/lib/types/client/components/{WheelSettings.d.ts → ActionSettings.d.ts} +2 -2
  18. package/lib/types/client/components/ActionWheel.d.ts +4 -4
  19. package/lib/types/client/components/CiteCiterSettings.d.ts +1 -1
  20. package/lib/types/client/components/CiteLauncher.d.ts +7 -2
  21. package/lib/types/client/components/CitePanel.d.ts +4 -1
  22. package/lib/types/client/components/CiterPet.d.ts +10 -0
  23. package/lib/types/client/components/DocumentReader.d.ts +2 -4
  24. package/lib/types/client/components/LearningRoute.d.ts +3 -4
  25. package/lib/types/client/components/ModelChoice.d.ts +7 -3
  26. package/lib/types/client/components/QuestionCard.d.ts +8 -4
  27. package/lib/types/client/components/QuestionReplyBody.d.ts +5 -0
  28. package/lib/types/client/components/ReferenceAttachments.d.ts +6 -2
  29. package/lib/types/client/components/SelectionToolbar.d.ts +19 -0
  30. package/lib/types/client/components/ToolMessage.d.ts +1 -1
  31. package/lib/types/client/components/TopicActions.d.ts +15 -4
  32. package/lib/types/client/components/TopicComposer.d.ts +2 -1
  33. package/lib/types/client/components/TopicHeader.d.ts +8 -3
  34. package/lib/types/client/components/TopicNavigation.d.ts +4 -4
  35. package/lib/types/client/components/TopicQuestions.d.ts +10 -0
  36. package/lib/types/client/components/TopicTitle.d.ts +6 -2
  37. package/lib/types/client/components/UserMessageBody.d.ts +4 -1
  38. package/lib/types/client/conversation-dom.d.ts +0 -7
  39. package/lib/types/client/draft-controller.d.ts +3 -6
  40. package/lib/types/client/draft-merge.d.ts +8 -0
  41. package/lib/types/client/draft-references.d.ts +6 -0
  42. package/lib/types/client/host-dock.d.ts +1 -1
  43. package/lib/types/client/host-icons.d.ts +2 -13
  44. package/lib/types/client/host-image-preview.d.ts +2 -1
  45. package/lib/types/client/host-source-chat.d.ts +11 -0
  46. package/lib/types/client/host-ui-adapter.d.ts +2 -2
  47. package/lib/types/client/native-composer.d.ts +15 -0
  48. package/lib/types/client/prompt.d.ts +4 -4
  49. package/lib/types/client/question-draft-controller.d.ts +50 -0
  50. package/lib/types/client/question-interaction.d.ts +33 -0
  51. package/lib/types/client/request-guard.d.ts +3 -13
  52. package/lib/types/client/selection-toolbar.d.ts +36 -0
  53. package/lib/types/client/tool-presentation.d.ts +14 -0
  54. package/lib/types/client/topic-presentation.d.ts +0 -7
  55. package/lib/types/client/topic-question-controller.d.ts +80 -0
  56. package/lib/types/client/types.d.ts +3 -4
  57. package/lib/types/client/wheel-gesture.d.ts +6 -1
  58. package/lib/types/document-access.d.ts +7 -2
  59. package/lib/types/host-agent-modules.d.ts +16 -6
  60. package/lib/types/host-session-adapter.d.ts +7 -4
  61. package/lib/types/host-settings-adapter.d.ts +5 -5
  62. package/lib/types/index.d.ts +8 -8
  63. package/lib/types/learning-cards-tool.d.ts +5 -0
  64. package/lib/types/learning.d.ts +0 -4
  65. package/lib/types/legacy-migration.d.ts +16 -0
  66. package/lib/types/observer.d.ts +0 -7
  67. package/lib/types/question-draft-contract.d.ts +55 -0
  68. package/lib/types/question-draft-lifecycle.d.ts +8 -0
  69. package/lib/types/question-draft-store.d.ts +38 -0
  70. package/lib/types/question-reply.d.ts +23 -0
  71. package/lib/types/source-read-tool.d.ts +3 -4
  72. package/lib/types/tool-approval-projection.d.ts +10 -0
  73. package/lib/types/tool-events.d.ts +2 -0
  74. package/lib/types/tool-outcome-contract.d.ts +3 -0
  75. package/lib/types/topic-deletion-receipts.d.ts +40 -0
  76. package/lib/types/topic-index.d.ts +26 -30
  77. package/lib/types/topic-log.d.ts +41 -0
  78. package/lib/types/topic-prompts.d.ts +8 -1
  79. package/lib/types/topic-question-bridge.d.ts +10 -0
  80. package/lib/types/topic-questions.d.ts +53 -0
  81. package/lib/types/topic-runtime.d.ts +21 -317
  82. package/lib/types/topic.d.ts +219 -177
  83. package/lib/types/typert-codec.d.ts +2 -4
  84. package/lib/types/typert-common.d.ts +251 -1138
  85. package/lib/types/typert.host.d.ts +525 -2584
  86. package/lib/types/update.d.ts +0 -7
  87. package/lib/{update-CRD1jFLf.js → update-B_0nN1_f.js} +215 -121
  88. package/package.json +68 -79
  89. package/lib/types/client/components/TopicSettingsDialog.d.ts +0 -21
@@ -1,335 +1,44 @@
1
- import { Context } from '@deepseek-ai/cordis';
2
- import { SessionLogOffset, type SessionEvent, type SessionHeader } from '@deepseek-ai/dsh-session';
3
- import { type SessionTitleProviderRequest } from '@deepseek-ai/dsh-session-title';
4
- import { type BoardSnapshot } from './board.ts';
5
- import { type ObserverSourceSnapshot } from './observer.ts';
6
- import { type CiteCiterRequest, type CiteCiterResponse, type CiteCiterSettings, type CitationRecord, type TopicMessage, type TopicMode, type TopicScenario, type TopicSummary } from './topic.ts';
7
- type CreateRequest = Extract<CiteCiterRequest, {
8
- action: 'create';
9
- }>;
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { type CiteCiterRequest, type CiteCiterResponse, type CiteCiterSettings, type TopicSummary } from './topic.ts';
10
3
  type DeleteResponse = Extract<CiteCiterResponse, {
11
4
  kind: 'deleted';
12
5
  }>;
13
6
  type TopicChangeListener = (name: 'created' | 'updated' | 'deleted', payload: {
14
7
  topic: TopicSummary;
15
8
  } | Omit<DeleteResponse, 'kind'>) => void;
16
- /** Decide both model visibility and execution access for one private Topic tool. */
17
- export declare function citeCiterToolAvailable(name: string, allowSourceFiles: boolean, scenario?: TopicScenario): boolean;
18
- /**
19
- * Render selected evidence only when this Topic actually owns a Citation.
20
- * @param citation - immutable Citation or explicit absence for a free Topic.
21
- * @returns model context text, or `undefined` when no quote was selected.
22
- */
23
- export declare function topicCitationContext(citation: CitationRecord | null): string | undefined;
24
- /**
25
- * Keep product safety and scenario rules authoritative over optional teaching-style preferences.
26
- * @param scenario - Topic behavior selected at creation.
27
- * @param custom - optional user-authored teaching preferences.
28
- * @returns the complete tutor prompt.
29
- */
30
- export declare function composeTutorPrompt(scenario: TopicScenario, custom: string | undefined): string;
31
- /** Complete model-visible parameter schema for blackboard_apply. */
32
- export declare const BLACKBOARD_APPLY_PARAMETERS: {
33
- readonly ops: {
34
- readonly type: "array";
35
- readonly required: true;
36
- readonly description: "Ordered atomic batch containing 1-50 board operations.";
37
- readonly items: {
38
- readonly oneOf: readonly [{
39
- readonly type: "object";
40
- readonly additionalProperties: false;
41
- readonly properties: {
42
- readonly op: {
43
- readonly type: "string";
44
- readonly const: "clear";
45
- readonly required: true;
46
- };
47
- };
48
- }, {
49
- readonly type: "object";
50
- readonly additionalProperties: false;
51
- readonly properties: {
52
- readonly style: {
53
- readonly type: "object";
54
- readonly additionalProperties: false;
55
- readonly properties: {
56
- readonly color: {
57
- readonly type: "string";
58
- readonly description: "CSS color restricted by the board validator.";
59
- };
60
- readonly fontSize: {
61
- readonly type: "string";
62
- readonly description: "CSS length in px, em, rem, or percent.";
63
- };
64
- };
65
- };
66
- readonly x: {
67
- readonly type: "number";
68
- readonly required: true;
69
- readonly description: "Left edge as canvas percent; x + w must be at most 100.";
70
- };
71
- readonly y: {
72
- readonly type: "number";
73
- readonly required: true;
74
- readonly description: "Top edge as canvas percent; y + h must be at most 100.";
75
- };
76
- readonly w: {
77
- readonly type: "number";
78
- readonly required: true;
79
- readonly description: "Width as canvas percent, from 0.5 to 100.";
80
- };
81
- readonly h: {
82
- readonly type: "number";
83
- readonly required: true;
84
- readonly description: "Height as canvas percent, from 0.5 to 100.";
85
- };
86
- readonly op: {
87
- readonly type: "string";
88
- readonly const: "set";
89
- readonly required: true;
90
- };
91
- readonly id: {
92
- readonly type: "string";
93
- readonly required: true;
94
- };
95
- readonly kind: {
96
- readonly type: "string";
97
- readonly enum: readonly ["text", "markdown", "math", "svg", "html", "image", "table"];
98
- readonly required: true;
99
- };
100
- readonly content: {
101
- readonly type: "string";
102
- readonly required: true;
103
- };
104
- };
105
- }, {
106
- readonly type: "object";
107
- readonly additionalProperties: false;
108
- readonly properties: {
109
- readonly op: {
110
- readonly type: "string";
111
- readonly const: "update";
112
- readonly required: true;
113
- };
114
- readonly id: {
115
- readonly type: "string";
116
- readonly required: true;
117
- };
118
- readonly content: {
119
- readonly type: "string";
120
- };
121
- readonly x: {
122
- readonly type: "number";
123
- };
124
- readonly y: {
125
- readonly type: "number";
126
- };
127
- readonly w: {
128
- readonly type: "number";
129
- };
130
- readonly h: {
131
- readonly type: "number";
132
- };
133
- readonly style: {
134
- readonly type: "object";
135
- readonly additionalProperties: false;
136
- readonly properties: {
137
- readonly color: {
138
- readonly type: "string";
139
- readonly description: "CSS color restricted by the board validator.";
140
- };
141
- readonly fontSize: {
142
- readonly type: "string";
143
- readonly description: "CSS length in px, em, rem, or percent.";
144
- };
145
- };
146
- };
147
- };
148
- }, {
149
- readonly type: "object";
150
- readonly additionalProperties: false;
151
- readonly properties: {
152
- readonly op: {
153
- readonly type: "string";
154
- readonly const: "remove";
155
- readonly required: true;
156
- };
157
- readonly id: {
158
- readonly type: "string";
159
- readonly required: true;
160
- };
161
- };
162
- }, {
163
- readonly type: "object";
164
- readonly additionalProperties: false;
165
- readonly properties: {
166
- readonly x: {
167
- readonly type: "number";
168
- readonly required: true;
169
- readonly description: "Left edge as canvas percent; x + w must be at most 100.";
170
- };
171
- readonly y: {
172
- readonly type: "number";
173
- readonly required: true;
174
- readonly description: "Top edge as canvas percent; y + h must be at most 100.";
175
- };
176
- readonly w: {
177
- readonly type: "number";
178
- readonly required: true;
179
- readonly description: "Width as canvas percent, from 0.5 to 100.";
180
- };
181
- readonly h: {
182
- readonly type: "number";
183
- readonly required: true;
184
- readonly description: "Height as canvas percent, from 0.5 to 100.";
185
- };
186
- readonly op: {
187
- readonly type: "string";
188
- readonly const: "clear_region";
189
- readonly required: true;
190
- };
191
- };
192
- }, {
193
- readonly type: "object";
194
- readonly additionalProperties: false;
195
- readonly properties: {
196
- readonly op: {
197
- readonly type: "string";
198
- readonly const: "animate";
199
- readonly required: true;
200
- };
201
- readonly id: {
202
- readonly type: "string";
203
- readonly required: true;
204
- };
205
- readonly animation: {
206
- readonly type: "string";
207
- readonly enum: readonly ["fade-in", "slide-in", "pulse", "highlight"];
208
- readonly required: true;
209
- };
210
- readonly durationMs: {
211
- readonly type: "integer";
212
- readonly description: "Animation duration from 50 to 5000 milliseconds.";
213
- };
214
- readonly iterations: {
215
- readonly type: "integer";
216
- readonly description: "Iteration count from 1 to 5.";
217
- };
218
- };
219
- }, {
220
- readonly type: "object";
221
- readonly additionalProperties: false;
222
- readonly properties: {
223
- readonly op: {
224
- readonly type: "string";
225
- readonly const: "focus";
226
- readonly required: true;
227
- };
228
- readonly id: {
229
- readonly oneOf: readonly [{
230
- readonly type: "string";
231
- }, {
232
- readonly type: "null";
233
- }];
234
- readonly required: true;
235
- readonly description: "Existing element id, or null to clear focus.";
236
- };
237
- };
238
- }];
239
- };
240
- };
241
- };
242
- /** Select the first human question added after a Topic's inherited seed. */
243
- export declare function selectTopicTitleMessage(request: SessionTitleProviderRequest): import("@deepseek-ai/dsh-session-title").SessionTitleUserMessage;
244
- /** Session header and events used to project one private Topic. */
245
- export interface RuntimeTopicLog {
246
- readonly header: SessionHeader;
247
- readonly events: readonly SessionEvent[];
248
- readonly inheritedEventCount: SessionLogOffset;
249
- readonly liveMessage?: TopicMessage | undefined;
250
- readonly renderKeys?: ReadonlyMap<number, string> | undefined;
251
- }
252
- /**
253
- * Project transcript rows and the latest turn's active failure banner.
254
- * @param log - private Topic Session contents.
255
- * @returns transcript rows plus an error only while the newest turn remains failed.
256
- */
257
- export declare function topicMessages(log: RuntimeTopicLog): {
258
- messages: TopicMessage[];
259
- error: string | null;
260
- };
261
- /**
262
- * Project final blackboard state from successful blackboard_apply call/result pairs.
263
- * @param log - private Topic Session contents.
264
- * @returns versioned final state, successful commit revision, and invalid-commit count.
265
- */
266
- export declare function projectBoardFromLog(log: RuntimeTopicLog): BoardSnapshot;
267
- /**
268
- * Return the first genuine Topic question after any Exact Fork seed.
269
- * @param log - private Topic Session contents.
270
- * @returns the first post-seed question, or `null` when it has not been committed.
271
- */
272
- export declare function firstPostSeedUserQuestion(log: RuntimeTopicLog): string | null;
273
- /**
274
- * Find a post-seed user question by its durable message identifier.
275
- * @param log - private Topic Session contents.
276
- * @param messageId - request identity stored as the user-message identity.
277
- * @returns the matching question, or `null` when the request is not committed.
278
- */
279
- export declare function postSeedUserQuestionById(log: RuntimeTopicLog, messageId: string): string | null;
280
- /**
281
- * Fold child-owned titles using the restored logical prefix, including after migration.
282
- * @param log - restored Topic events and the host-owned inherited event count.
283
- * @returns the latest Topic title projection, or undefined before any title is recorded.
284
- */
285
- export declare function foldTopicTitle(log: RuntimeTopicLog): import("@deepseek-ai/dsh-session-title").SessionTitleSnapshot | undefined;
286
- /** Resolve the actual Topic mode without forking through an open DSH turn. */
287
- export declare function resolveTopicModeAndSeed(requested: CreateRequest, source: ObserverSourceSnapshot, anchorSeq: number): {
288
- mode: TopicMode;
289
- forkThroughSeq: number | null;
290
- seed: readonly SessionEvent[];
291
- };
292
- /** One process-local private DSH tree with standard Session logs and Agent loop. */
9
+ /** Process-local Topic coordinator over native DSH Sessions stored in each source's Citer directory. */
293
10
  export declare class TopicRuntime {
294
11
  private readonly host;
295
12
  private readonly settings;
296
- private readonly runtime;
297
13
  private readonly native;
298
14
  private readonly index;
299
15
  private readonly sourceStorage;
300
16
  private readonly documents;
301
17
  private readonly lifecycleAbort;
302
- private readonly fibers;
303
18
  private readonly handles;
304
- private readonly selections;
305
19
  private readonly opening;
306
20
  private readonly requests;
307
- private readonly cleanupFailures;
308
21
  private readonly pendingQuestions;
22
+ private readonly questionReplies;
309
23
  private readonly creations;
310
24
  private readonly asks;
311
25
  private readonly topicAdmissions;
312
26
  private readonly deleting;
313
- private readonly titleRefreshes;
314
- private readonly titleRefreshAttempted;
315
27
  private readonly titleHydrated;
316
28
  private readonly sourceAvailability;
317
29
  private readonly sourceAvailabilityChecks;
318
30
  private readonly ready;
319
31
  private readonly topicListeners;
320
32
  private readonly streams;
33
+ private readonly boardCapture;
321
34
  private disposal;
322
35
  private releasing;
323
- private releaseLlm;
324
- private releaseFs;
325
- private releaseSubprocess;
326
- private hasSourceFiles;
327
36
  private closed;
328
37
  /** @param host - owning DSH context. @param settings - current user preferences. */
329
38
  constructor(host: Context, settings?: () => CiteCiterSettings);
330
- /** Wait until every private DSH service has started. */
39
+ /** Wait until source roots are bound and interrupted deletions and migrations have finished. */
331
40
  initialize(): Promise<void>;
332
- /** Execute one validated browser command against private Topics. */
41
+ /** Execute one validated browser command against Topics. */
333
42
  request(rawRequest: CiteCiterRequest, callerSignal: AbortSignal): Promise<CiteCiterResponse>;
334
43
  /**
335
44
  * Observe committed Topic state changes.
@@ -337,16 +46,13 @@ export declare class TopicRuntime {
337
46
  * @returns disposer removing the exact listener.
338
47
  */
339
48
  onTopicChange(listener: TopicChangeListener): () => void;
340
- private readonly boardCapture;
341
49
  private executeRequest;
342
- /** Stop every owned Agent and plugin fiber before releasing bridged services. */
50
+ /** Stop every owned Agent before releasing bridged services. */
343
51
  dispose(): Promise<void>;
344
52
  private disposeOwned;
345
53
  private beginClosing;
346
54
  private assertOpen;
347
55
  private start;
348
- /** Adopt existing Citer histories into each source directory without deleting or rewriting their original logs. */
349
- private migrateStorage;
350
56
  private releaseRuntime;
351
57
  private releaseOwnedRuntime;
352
58
  private settleOwnedOperations;
@@ -354,28 +60,29 @@ export declare class TopicRuntime {
354
60
  /** Let a caller stop waiting without cancelling an accepted idempotent mutation. */
355
61
  private waitForCaller;
356
62
  private createIdempotent;
63
+ /** A retried request returns the Topic its first attempt committed. */
357
64
  private resumeOrCreate;
358
65
  private createHandle;
359
- private setupHostedAgent;
66
+ /** Contribute Citer prompts, tools and observers to one native Topic Agent. */
360
67
  private setupAgent;
361
- private globTool;
362
- private learningCardsTool;
363
- private blackboardApplyTool;
364
68
  /** Keep storage and submitted-reference authorization outside the shared document tool contract. */
365
69
  private registerDocumentTools;
366
- /** Share source-read instructions and contract across native and legacy Topic runtimes. */
70
+ /** Read the source only after the user has sent its address as an attachment. */
367
71
  private registerSourceTool;
368
72
  private ensureHandle;
369
- private disposeLateHandle;
370
- /** Resolve only after the accepted question is present in the durable model-input log. */
371
- private commitFollowup;
73
+ /** Submit a question through the Host session controller, as the composer would. */
372
74
  private ask;
373
75
  private askIdempotent;
374
76
  private queueAsk;
375
77
  private queueTopicAdmission;
78
+ /** Validate partial selections against the exact Host question, without normalizing unsent text. */
79
+ private validateQuestionDraft;
80
+ /** Commit cleanup through the same admission queue as saves and permanent deletion. */
81
+ private trackQuestionDraftReceipts;
376
82
  private askUser;
377
83
  private answerQuestion;
378
84
  private cancelQuestion;
85
+ private timeoutQuestion;
379
86
  private stop;
380
87
  private rename;
381
88
  private archive;
@@ -385,28 +92,25 @@ export declare class TopicRuntime {
385
92
  private deleteAdmitted;
386
93
  /** Observe the retired Session after its Agent has released write ownership. */
387
94
  private readRetiredSessionHeader;
388
- /** Remove every retired generation only from CiteCiter's fixed private JSONL backend. */
389
- private removeSessionArtifact;
390
95
  private finishDeletion;
391
96
  private recoverDeletions;
392
97
  private clearDeletedTopicState;
393
- private enqueueModelChange;
394
98
  private setModelRoute;
395
99
  private setReasoningEffort;
396
- private selectModel;
397
- private applyModelSelection;
398
100
  private importDocument;
399
101
  private models;
400
102
  private list;
401
103
  private summary;
402
104
  private summaryFromMetadata;
403
- private get;
105
+ /** Serialize reads/saves with deletion and report only durable, exact deletion evidence. */
106
+ private withOwnedTopic;
404
107
  private readLog;
405
108
  private scheduleSourceAvailabilityCheck;
406
109
  private rememberSourceAvailability;
407
110
  private snapshot;
111
+ /** Recover persisted blocking cards only; rendering never enqueues a model request. */
112
+ private recoveredBlockingQuestions;
408
113
  private patchMetadata;
409
114
  private patchMetadataSerialized;
410
- private scheduleExactTitleRefresh;
411
115
  }
412
116
  export {};