@kirkchinese/dsh-citeciter 0.9.0-beta.1 → 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 (38) hide show
  1. package/README.md +16 -14
  2. package/README.zh.md +16 -14
  3. package/lib/client.js +1808 -1001
  4. package/lib/index.js +43 -8
  5. package/lib/{typert-common-BRv6PLDv.js → typert-common-g1lnIG8u.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 +18 -5
  9. package/lib/types/client/action-controller.d.ts +9 -2
  10. package/lib/types/client/action-executor.d.ts +5 -1
  11. package/lib/types/client/companion-controller.d.ts +14 -5
  12. package/lib/types/client/components/{WheelSettings.d.ts → ActionSettings.d.ts} +2 -2
  13. package/lib/types/client/components/ActionWheel.d.ts +4 -4
  14. package/lib/types/client/components/CiteCiterSettings.d.ts +1 -1
  15. package/lib/types/client/components/CiteLauncher.d.ts +7 -2
  16. package/lib/types/client/components/CitePanel.d.ts +4 -1
  17. package/lib/types/client/components/CiterPet.d.ts +10 -0
  18. package/lib/types/client/components/DocumentReader.d.ts +2 -4
  19. package/lib/types/client/components/LearningRoute.d.ts +3 -4
  20. package/lib/types/client/components/ModelChoice.d.ts +7 -3
  21. package/lib/types/client/components/ReferenceAttachments.d.ts +6 -2
  22. package/lib/types/client/components/SelectionToolbar.d.ts +19 -0
  23. package/lib/types/client/components/ToolMessage.d.ts +1 -1
  24. package/lib/types/client/components/TopicActions.d.ts +15 -4
  25. package/lib/types/client/components/TopicHeader.d.ts +8 -3
  26. package/lib/types/client/components/TopicNavigation.d.ts +4 -4
  27. package/lib/types/client/components/TopicTitle.d.ts +6 -2
  28. package/lib/types/client/components/UserMessageBody.d.ts +2 -1
  29. package/lib/types/client/draft-references.d.ts +6 -0
  30. package/lib/types/client/host-icons.d.ts +1 -1
  31. package/lib/types/client/selection-toolbar.d.ts +36 -0
  32. package/lib/types/client/tool-presentation.d.ts +14 -0
  33. package/lib/types/client/wheel-gesture.d.ts +6 -1
  34. package/lib/types/host-agent-modules.d.ts +12 -2
  35. package/lib/types/topic.d.ts +17 -0
  36. package/lib/{update-DDut5jKW.js → update-B_0nN1_f.js} +34 -16
  37. package/package.json +3 -1
  38. package/lib/types/client/components/TopicSettingsDialog.d.ts +0 -19
@@ -6,8 +6,13 @@ export declare function createSelectionSurfaces(): {
6
6
  read(target: EventTarget | null): ActionSource | null;
7
7
  };
8
8
  export type SelectionSurfaces = ReturnType<typeof createSelectionSurfaces>;
9
- /** Install hold/move/release gestures; returns a disposer removing every global listener. */
9
+ /**
10
+ * Install the optional hold/move/release wheel. While `wheelEnabled` is off, every
11
+ * listener returns early and the browser keeps its native context menu.
12
+ * @returns a disposer removing every global listener.
13
+ */
10
14
  export declare function installWheelGesture(controller: ActionController, read: (event: MouseEvent) => ActionSource | null, preferences: () => {
15
+ wheelEnabled?: boolean | undefined;
11
16
  wheelTrigger?: WheelTrigger | undefined;
12
17
  wheelSlots?: (CiteAction | null)[] | undefined;
13
18
  }): () => void;
@@ -1,4 +1,4 @@
1
- import type { Context } from '@deepseek-ai/cordis';
1
+ import type { Context, Plugin } from '@deepseek-ai/cordis';
2
2
  import type AgentLoop from '@deepseek-ai/dsh-agent-loop';
3
3
  import type SessionStore from '@deepseek-ai/dsh-session';
4
4
  import type SessionTitleService from '@deepseek-ai/dsh-session-title';
@@ -6,10 +6,20 @@ interface HostScope {
6
6
  readonly ctx: Context;
7
7
  dispose(): Promise<void>;
8
8
  }
9
+ /** Required policy of DSH's model-backed title provider; all fields are required by its Loader schema. */
10
+ export interface SessionTitleLlmConfig {
11
+ readonly targetWords: number;
12
+ readonly targetCjkCharacters: number;
13
+ readonly maxInputBytes: number;
14
+ readonly maxOutputTokens: number;
15
+ readonly timeoutMs: number;
16
+ }
9
17
  export interface HostAgentModules {
10
18
  readonly AgentLoop: typeof AgentLoop;
11
19
  readonly SessionStore: typeof SessionStore;
12
20
  readonly SessionTitleService: typeof SessionTitleService;
21
+ /** DSH's own first-prompt model title provider, the one `dsh-base` mounts for host sessions. */
22
+ readonly SessionTitleProvider: Plugin<SessionTitleLlmConfig>;
13
23
  readonly createScope: (ctx: Context, key: object) => HostScope;
14
24
  }
15
25
  /**
@@ -17,7 +27,7 @@ export interface HostAgentModules {
17
27
  * File URLs bypass peer routing and can create a second private scope identity,
18
28
  * particularly when Electron ASAR paths use different casing on Windows.
19
29
  * Bare imports also leave CLI symlinks and Desktop packaging to the host resolver.
20
- * @returns the host's AgentLoop, SessionStore, title service and scope factory.
30
+ * @returns the host's AgentLoop, SessionStore, title service and provider, and scope factory.
21
31
  */
22
32
  export declare function loadHostAgentModules(): Promise<HostAgentModules>;
23
33
  export {};
@@ -20,6 +20,12 @@ export declare const citeCiterSettingsSchema: z.ZodObject<{
20
20
  boardAnimations: z.ZodOptional<z.ZodBoolean>;
21
21
  activeRecall: z.ZodOptional<z.ZodBoolean>;
22
22
  updateNotifications: z.ZodOptional<z.ZodBoolean>;
23
+ selectionToolbar: z.ZodOptional<z.ZodBoolean>;
24
+ actionDelivery: z.ZodOptional<z.ZodEnum<{
25
+ send: "send";
26
+ draft: "draft";
27
+ }>>;
28
+ wheelEnabled: z.ZodOptional<z.ZodBoolean>;
23
29
  wheelSlots: z.ZodOptional<z.ZodArray<z.ZodNullable<z.ZodObject<{
24
30
  label: z.ZodString;
25
31
  prompt: z.ZodString;
@@ -308,6 +314,17 @@ export type TopicMetadata = z.infer<typeof topicMetadataSchema>;
308
314
  * @returns canonical TopicMetadata.
309
315
  */
310
316
  export declare function parseTopicMetadataFile(raw: unknown): TopicMetadata;
317
+ /**
318
+ * The title a Topic shows. DSH's fallback title repeats the first prompt, which for a Topic
319
+ * is Citer's action instructions, so the excerpt or question it started from stays until a
320
+ * provider or the user names the Topic.
321
+ * @param metadata - the Topic's cached and temporary titles.
322
+ * @returns the display title and whether a real title is still pending.
323
+ */
324
+ export declare function topicDisplayTitle(metadata: Pick<TopicMetadata, 'temporaryTitle' | 'cachedTitle' | 'cachedTitleSource'>): {
325
+ readonly title: string;
326
+ readonly pending: boolean;
327
+ };
311
328
  export declare const permissionSchema: z.ZodEnum<{
312
329
  "read-only": "read-only";
313
330
  "workspace-write": "workspace-write";
@@ -538,8 +538,10 @@ z.object({ cards: z.array(learningCardSchema.extend({ example: z.union([learning
538
538
  //#endregion
539
539
  //#region lib/types/actions.js
540
540
  /**
541
- * One persisted wheel slot; its prompt is sent as a durable user message.
542
- * Fields saved by older versions, such as `scenario`, are dropped when read.
541
+ * One persisted action slot, shown in the selection toolbar and the optional wheel.
542
+ * An `ask` action opens the composer for the user's own question; any other action
543
+ * sends its prompt as a durable user message. Fields saved by older versions, such as
544
+ * `scenario` and `target`, are read but no longer change where an action goes.
543
545
  */
544
546
  const citeActionSchema = z.object({
545
547
  label: z.string().trim().min(1).max(20),
@@ -556,21 +558,22 @@ const wheelTriggerSchema = z.enum([
556
558
  "Shift",
557
559
  "Meta"
558
560
  ]);
561
+ /** Whether a preset action sends at once or only fills the composer. */
562
+ const actionDeliverySchema = z.enum(["send", "draft"]);
559
563
  const actionModelSchema = z.object({
560
564
  provider: z.string().min(1).max(200),
561
565
  model: z.string().min(1).max(200)
562
566
  }).strict();
563
- /** Clockwise from twelve o'clock. Empty slots retain their positions. */
567
+ /** Toolbar order, and clockwise from twelve o'clock on the wheel. Empty slots retain their positions. */
564
568
  const DEFAULT_WHEEL_SLOTS = [
565
569
  {
566
- label: "自由提问",
570
+ label: "提问",
567
571
  prompt: "",
568
572
  ask: true,
569
- presentation: "side",
570
- target: "current"
573
+ presentation: "side"
571
574
  },
572
575
  {
573
- label: "解释这段",
576
+ label: "解释",
574
577
  prompt: learningQuestion("logic"),
575
578
  ask: false,
576
579
  presentation: "side"
@@ -588,13 +591,13 @@ const DEFAULT_WHEEL_SLOTS = [
588
591
  presentation: "floating"
589
592
  },
590
593
  {
591
- label: "定量板书",
594
+ label: "板书",
592
595
  prompt: learningQuestion("quantitative"),
593
596
  ask: false,
594
597
  presentation: "side"
595
598
  },
596
599
  {
597
- label: "总结卡片",
600
+ label: "学习卡",
598
601
  prompt: learningQuestion("summary", "围绕本次引用的内容整理。"),
599
602
  ask: false,
600
603
  presentation: "side"
@@ -602,11 +605,6 @@ const DEFAULT_WHEEL_SLOTS = [
602
605
  null,
603
606
  null
604
607
  ];
605
- /** Slots saved before targets existed append only when they are the unchanged built-in free question. */
606
- function actionTarget(action) {
607
- if (action.target !== void 0) return action.target;
608
- return action.label === "自由提问" && action.prompt === "" && action.ask && action.presentation === "side" ? "current" : "new";
609
- }
610
608
  //#endregion
611
609
  //#region lib/types/tool-outcome-contract.js
612
610
  /** Recognized question outcomes shared by Host and Client without importing either service face. */
@@ -703,6 +701,9 @@ const citeCiterSettingsSchema = z.object({
703
701
  boardAnimations: z.boolean().optional(),
704
702
  activeRecall: z.boolean().optional(),
705
703
  updateNotifications: z.boolean().optional(),
704
+ selectionToolbar: z.boolean().optional(),
705
+ actionDelivery: actionDeliverySchema.optional(),
706
+ wheelEnabled: z.boolean().optional(),
706
707
  wheelSlots: wheelSlotsSchema.optional(),
707
708
  wheelTrigger: wheelTriggerSchema.optional(),
708
709
  defaultCiterModel: actionModelSchema.nullable().optional(),
@@ -723,7 +724,10 @@ const DEFAULT_CITECITER_SETTINGS = Object.freeze({
723
724
  activeRecall: false,
724
725
  defaultPermission: "read-only",
725
726
  learningRoute: false,
726
- updateNotifications: true
727
+ updateNotifications: true,
728
+ selectionToolbar: true,
729
+ actionDelivery: "send",
730
+ wheelEnabled: false
727
731
  });
728
732
  /**
729
733
  * Read persisted settings field by field. Keys written by other versions are
@@ -937,6 +941,20 @@ function parseTopicMetadataFile(raw) {
937
941
  documentId: documentId ?? null
938
942
  });
939
943
  }
944
+ /**
945
+ * The title a Topic shows. DSH's fallback title repeats the first prompt, which for a Topic
946
+ * is Citer's action instructions, so the excerpt or question it started from stays until a
947
+ * provider or the user names the Topic.
948
+ * @param metadata - the Topic's cached and temporary titles.
949
+ * @returns the display title and whether a real title is still pending.
950
+ */
951
+ function topicDisplayTitle(metadata) {
952
+ const named = metadata.cachedTitleSource === "fallback" ? null : metadata.cachedTitle;
953
+ return {
954
+ title: named ?? metadata.temporaryTitle,
955
+ pending: named === null
956
+ };
957
+ }
940
958
  const permissionSchema = z.enum([
941
959
  "read-only",
942
960
  "workspace-write",
@@ -1584,4 +1602,4 @@ function waitForCaller(operation, signal) {
1584
1602
  });
1585
1603
  }
1586
1604
  //#endregion
1587
- export { applyBoardOps as A, readQuestionReply as C, learningCardsInputSchema as D, LEARNING_CARD_FIELD_DESCRIPTIONS as E, DRAFT_CHUNK_BYTES as F, EMPTY_DRAFT_STATE as I, draftFileSchema as L, EMPTY_QUESTION_DRAFT_STATE as M, questionDraftKeySchema as N, LEARNING_EXAMPLE_PARAMETER as O, questionDraftRecordSchema as P, draftStateSchema as R, questionReplyText as S, actionTarget as T, readCiteCiterSettings as _, DEFAULT_CITECITER_SETTINGS as a, topicSnapshotSchema as b, citationDraftSchema as c, citeCiterRequestSchema as d, citeCiterResponseSchema as f, parseTopicMetadataFile as g, documentSummarySchema as h, CITECITER_SETTINGS_NAMESPACE as i, boardBatchSchema as j, EMPTY_BOARD_STATE as k, citationRecordSchema as l, documentEvidenceClaimSchema as m, updateCheckErrorCodeSchema as n, TUTOR_SECTION_NAME as o, documentContentSchema as p, updateCheckResponseSchema as r, canonicalCitationIdentity as s, UpdateChecker as t, citationSelectionClaimSchema as u, toolEvidenceClaimSchema as v, DEFAULT_WHEEL_SLOTS as w, topicSummarySchema as x, topicMetadataSchema as y, subtractSubmitted as z };
1605
+ export { applyBoardOps as A, questionReplyText as C, learningCardsInputSchema as D, LEARNING_CARD_FIELD_DESCRIPTIONS as E, DRAFT_CHUNK_BYTES as F, EMPTY_DRAFT_STATE as I, draftFileSchema as L, EMPTY_QUESTION_DRAFT_STATE as M, questionDraftKeySchema as N, LEARNING_EXAMPLE_PARAMETER as O, questionDraftRecordSchema as P, draftStateSchema as R, topicSummarySchema as S, DEFAULT_WHEEL_SLOTS as T, readCiteCiterSettings as _, DEFAULT_CITECITER_SETTINGS as a, topicMetadataSchema as b, citationDraftSchema as c, citeCiterRequestSchema as d, citeCiterResponseSchema as f, parseTopicMetadataFile as g, documentSummarySchema as h, CITECITER_SETTINGS_NAMESPACE as i, boardBatchSchema as j, EMPTY_BOARD_STATE as k, citationRecordSchema as l, documentEvidenceClaimSchema as m, updateCheckErrorCodeSchema as n, TUTOR_SECTION_NAME as o, documentContentSchema as p, updateCheckResponseSchema as r, canonicalCitationIdentity as s, UpdateChecker as t, citationSelectionClaimSchema as u, toolEvidenceClaimSchema as v, readQuestionReply as w, topicSnapshotSchema as x, topicDisplayTitle as y, subtractSubmitted as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirkchinese/dsh-citeciter",
3
- "version": "0.9.0-beta.1",
3
+ "version": "0.9.0-beta.2",
4
4
  "description": "Source-aware native DSH Topics with manual drafts, permissions, visual boards and learning cards",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -99,6 +99,7 @@
99
99
  "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
100
100
  "@deepseek-ai/dsh-session-query": "0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
101
101
  "@deepseek-ai/dsh-session-title": "0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
102
+ "@deepseek-ai/dsh-session-title-first-prompt-llm": "0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
102
103
  "@deepseek-ai/dsh-settings": "0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
103
104
  "@deepseek-ai/dsh-tools": "0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
104
105
  "@deepseek-ai/dsh-typert-protocol": "0.2.0-rc.2 || 0.2.1-alpha.1 || 0.2.1-alpha.2",
@@ -138,6 +139,7 @@
138
139
  "@deepseek-ai/dsh-session-persistence-jsonl": "0.2.1-alpha.2",
139
140
  "@deepseek-ai/dsh-session-query": "0.2.1-alpha.2",
140
141
  "@deepseek-ai/dsh-session-title": "0.2.1-alpha.2",
142
+ "@deepseek-ai/dsh-session-title-first-prompt-llm": "0.2.1-alpha.2",
141
143
  "@deepseek-ai/dsh-settings": "0.2.1-alpha.2",
142
144
  "@deepseek-ai/dsh-tools": "0.2.1-alpha.2",
143
145
  "@deepseek-ai/dsh-typert-protocol": "0.2.1-alpha.2",
@@ -1,19 +0,0 @@
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 for archiving and permanent deletion.
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
- } | undefined;
13
- readonly archiving: boolean;
14
- readonly deleting: boolean;
15
- readonly error: string | null;
16
- readonly onClose: () => void;
17
- readonly onArchive: (archived: boolean) => Promise<boolean>;
18
- readonly onDelete: () => void;
19
- }): import("react").JSX.Element;