@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
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as applyBoardOps, C as readQuestionReply, D as learningCardsInputSchema, E as LEARNING_CARD_FIELD_DESCRIPTIONS, F as DRAFT_CHUNK_BYTES, I as EMPTY_DRAFT_STATE, L as draftFileSchema, M as EMPTY_QUESTION_DRAFT_STATE, N as questionDraftKeySchema, O as LEARNING_EXAMPLE_PARAMETER, P as questionDraftRecordSchema, R as draftStateSchema, S as questionReplyText, T as actionTarget, _ as readCiteCiterSettings, a as DEFAULT_CITECITER_SETTINGS, d as citeCiterRequestSchema, g as parseTopicMetadataFile, h as documentSummarySchema, i as CITECITER_SETTINGS_NAMESPACE, j as boardBatchSchema, k as EMPTY_BOARD_STATE, m as documentEvidenceClaimSchema, n as updateCheckErrorCodeSchema, o as TUTOR_SECTION_NAME, p as documentContentSchema, r as updateCheckResponseSchema, s as canonicalCitationIdentity, t as UpdateChecker, u as citationSelectionClaimSchema, v as toolEvidenceClaimSchema, w as DEFAULT_WHEEL_SLOTS, y as topicMetadataSchema, z as subtractSubmitted } from "./update-DDut5jKW.js";
1
+ import { A as applyBoardOps, C as questionReplyText, D as learningCardsInputSchema, E as LEARNING_CARD_FIELD_DESCRIPTIONS, F as DRAFT_CHUNK_BYTES, I as EMPTY_DRAFT_STATE, L as draftFileSchema, M as EMPTY_QUESTION_DRAFT_STATE, N as questionDraftKeySchema, O as LEARNING_EXAMPLE_PARAMETER, P as questionDraftRecordSchema, R as draftStateSchema, T as DEFAULT_WHEEL_SLOTS, _ as readCiteCiterSettings, a as DEFAULT_CITECITER_SETTINGS, b as topicMetadataSchema, d as citeCiterRequestSchema, g as parseTopicMetadataFile, h as documentSummarySchema, i as CITECITER_SETTINGS_NAMESPACE, j as boardBatchSchema, k as EMPTY_BOARD_STATE, m as documentEvidenceClaimSchema, n as updateCheckErrorCodeSchema, o as TUTOR_SECTION_NAME, p as documentContentSchema, r as updateCheckResponseSchema, s as canonicalCitationIdentity, t as UpdateChecker, u as citationSelectionClaimSchema, v as toolEvidenceClaimSchema, w as readQuestionReply, y as topicDisplayTitle, z as subtractSubmitted } from "./update-B_0nN1_f.js";
2
2
  import { Context, Service } from "@deepseek-ai/cordis";
3
3
  import { z } from "zod";
4
4
  import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
@@ -1848,24 +1848,48 @@ function createCiterSessionStore(Base, access) {
1848
1848
  * File URLs bypass peer routing and can create a second private scope identity,
1849
1849
  * particularly when Electron ASAR paths use different casing on Windows.
1850
1850
  * Bare imports also leave CLI symlinks and Desktop packaging to the host resolver.
1851
- * @returns the host's AgentLoop, SessionStore, title service and scope factory.
1851
+ * @returns the host's AgentLoop, SessionStore, title service and provider, and scope factory.
1852
1852
  */
1853
1853
  async function loadHostAgentModules() {
1854
- const [loop, scope, session, title] = await Promise.all([
1854
+ const [loop, scope, session, title, titleProvider] = await Promise.all([
1855
1855
  import("@deepseek-ai/dsh-agent-loop"),
1856
1856
  import("@deepseek-ai/dsh-scope"),
1857
1857
  import("@deepseek-ai/dsh-session"),
1858
- import("@deepseek-ai/dsh-session-title")
1858
+ import("@deepseek-ai/dsh-session-title"),
1859
+ import("@deepseek-ai/dsh-session-title-first-prompt-llm")
1859
1860
  ]);
1860
1861
  return {
1861
1862
  AgentLoop: loop.AgentLoop,
1862
1863
  SessionStore: session.SessionStore,
1863
1864
  SessionTitleService: title.SessionTitleService,
1865
+ SessionTitleProvider: titleProvider,
1864
1866
  createScope: scope.createScope
1865
1867
  };
1866
1868
  }
1867
1869
  //#endregion
1868
1870
  //#region lib/types/citer-session-world.js
1871
+ /**
1872
+ * DSH starts automatic first-prompt titles only for sessions without a parent, and a
1873
+ * Topic's parent is its source session. When a Topic request starts while its title is
1874
+ * still the fallback, ask the registered provider once, as the host does for its own
1875
+ * sessions. Explicit renames are never replaced.
1876
+ */
1877
+ const requestTopicTitles = {
1878
+ name: "citeciter-topic-titles",
1879
+ inject: ["sessionTitle", "sessions"],
1880
+ apply(ctx) {
1881
+ const requested = /* @__PURE__ */ new WeakSet();
1882
+ ctx.on("session/event", (session, event) => {
1883
+ if (event.type !== "request/header" || requested.has(session)) return;
1884
+ const title = ctx.sessionTitle.get(session);
1885
+ if (title !== void 0 && title.source.kind !== "fallback") return;
1886
+ requested.add(session);
1887
+ ctx.sessionTitle.refresh(session).catch((error) => {
1888
+ ctx.logger.warn(`CiteCiter could not title Topic ${session.id}`, error);
1889
+ });
1890
+ });
1891
+ }
1892
+ };
1869
1893
  /** A Topic-owned DSH factory and JSONL backend; live conversation APIs stay shared, disk ownership does not. */
1870
1894
  var CiterSessionWorld = class {
1871
1895
  fiber;
@@ -1918,6 +1942,14 @@ var CiterSessionWorld = class {
1918
1942
  fallbackMaxBytes: 40,
1919
1943
  maxTitleBytes: 80
1920
1944
  });
1945
+ await ctx.plugin(modules.SessionTitleProvider, {
1946
+ targetWords: 5,
1947
+ targetCjkCharacters: 10,
1948
+ maxInputBytes: 4096,
1949
+ maxOutputTokens: 64,
1950
+ timeoutMs: 6e4
1951
+ });
1952
+ await ctx.plugin(requestTopicTitles);
1921
1953
  await ctx.plugin({
1922
1954
  name: "citeciter-session-factory",
1923
1955
  inject: [
@@ -19549,7 +19581,7 @@ var TopicRuntime = class {
19549
19581
  }
19550
19582
  summaryFromMetadata(metadata) {
19551
19583
  const agent = this.handles.get(metadata.sessionId)?.agent ?? this.host.agents.get(SessionId(metadata.sessionId));
19552
- const title = metadata.cachedTitle;
19584
+ const title = topicDisplayTitle(metadata);
19553
19585
  return {
19554
19586
  permission: agent === void 0 ? "read-only" : this.host.sandboxPolicy.resolve({ session: agent.session }).mode,
19555
19587
  topicId: metadata.topicId,
@@ -19557,8 +19589,8 @@ var TopicRuntime = class {
19557
19589
  sourceSessionId: metadata.sourceSessionId,
19558
19590
  documentId: metadata.documentId,
19559
19591
  citation: metadata.citation,
19560
- title: title ?? metadata.temporaryTitle,
19561
- titlePending: title === null,
19592
+ title: title.title,
19593
+ titlePending: title.pending,
19562
19594
  createdAt: metadata.createdAt,
19563
19595
  updatedAt: metadata.updatedAt,
19564
19596
  archived: metadata.archivedAt !== null,
@@ -19781,6 +19813,9 @@ const CITECITER_SETTINGS_SCHEMA = z$1.object({
19781
19813
  ]).default("read-only"),
19782
19814
  learningRoute: z$1.boolean().default(false),
19783
19815
  updateNotifications: z$1.boolean().default(DEFAULT_CITECITER_SETTINGS.updateNotifications ?? true),
19816
+ selectionToolbar: z$1.boolean().default(DEFAULT_CITECITER_SETTINGS.selectionToolbar ?? true),
19817
+ actionDelivery: z$1.union(["send", "draft"]).default(DEFAULT_CITECITER_SETTINGS.actionDelivery ?? "send"),
19818
+ wheelEnabled: z$1.boolean().default(DEFAULT_CITECITER_SETTINGS.wheelEnabled ?? false),
19784
19819
  wheelTrigger: z$1.union([
19785
19820
  "right-button",
19786
19821
  "Alt",
@@ -19800,7 +19835,7 @@ const CITECITER_SETTINGS_SCHEMA = z$1.object({
19800
19835
  target: z$1.union(["current", "new"])
19801
19836
  })])).min(8).max(8).default(DEFAULT_WHEEL_SLOTS.map((slot) => slot === null ? null : {
19802
19837
  ...slot,
19803
- target: actionTarget(slot)
19838
+ target: "current"
19804
19839
  }))
19805
19840
  });
19806
19841
  /** Root-scoped Remote service owning Topic metadata and native Topic contributions. */
@@ -1,4 +1,4 @@
1
- import { d as citeCiterRequestSchema, f as citeCiterResponseSchema, r as updateCheckResponseSchema } from "./update-DDut5jKW.js";
1
+ import { d as citeCiterRequestSchema, f as citeCiterResponseSchema, r as updateCheckResponseSchema } from "./update-B_0nN1_f.js";
2
2
  //#region lib/types/typert-codec.js
3
3
  /** Official Typert lazily resolves schemas after module registration. */
4
4
  function strictCodec(typeSymbol, schema) {
@@ -1,5 +1,5 @@
1
- import { b as topicSnapshotSchema, c as citationDraftSchema, d as citeCiterRequestSchema, f as citeCiterResponseSchema, l as citationRecordSchema, r as updateCheckResponseSchema, x as topicSummarySchema } from "./update-DDut5jKW.js";
2
- import { n as updateCheckDescriptor, r as namedSchema, t as citeCiterRequestDescriptor } from "./typert-common-BRv6PLDv.js";
1
+ import { S as topicSummarySchema, c as citationDraftSchema, d as citeCiterRequestSchema, f as citeCiterResponseSchema, l as citationRecordSchema, r as updateCheckResponseSchema, x as topicSnapshotSchema } from "./update-B_0nN1_f.js";
2
+ import { n as updateCheckDescriptor, r as namedSchema, t as citeCiterRequestDescriptor } from "./typert-common-g1lnIG8u.js";
3
3
  //#region lib/types/typert.host.js
4
4
  /** Handwritten strict Host contribution matching the single Remote decorator. */
5
5
  const TYPERT = {
@@ -1,4 +1,4 @@
1
- import { n as updateCheckDescriptor, t as citeCiterRequestDescriptor } from "./typert-common-BRv6PLDv.js";
1
+ import { n as updateCheckDescriptor, t as citeCiterRequestDescriptor } from "./typert-common-g1lnIG8u.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 = {
@@ -1,7 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * One persisted wheel slot; its prompt is sent as a durable user message.
4
- * Fields saved by older versions, such as `scenario`, are dropped when read.
3
+ * One persisted action slot, shown in the selection toolbar and the optional wheel.
4
+ * An `ask` action opens the composer for the user's own question; any other action
5
+ * sends its prompt as a durable user message. Fields saved by older versions, such as
6
+ * `scenario` and `target`, are read but no longer change where an action goes.
5
7
  */
6
8
  export declare const citeActionSchema: z.ZodObject<{
7
9
  label: z.ZodString;
@@ -38,15 +40,26 @@ export declare const wheelTriggerSchema: z.ZodEnum<{
38
40
  Meta: "Meta";
39
41
  }>;
40
42
  export type WheelTrigger = z.infer<typeof wheelTriggerSchema>;
43
+ /** Whether a preset action sends at once or only fills the composer. */
44
+ export declare const actionDeliverySchema: z.ZodEnum<{
45
+ send: "send";
46
+ draft: "draft";
47
+ }>;
48
+ export type ActionDelivery = z.infer<typeof actionDeliverySchema>;
41
49
  export type PanelPresentation = CiteAction['presentation'];
42
50
  export declare const actionModelSchema: z.ZodObject<{
43
51
  provider: z.ZodString;
44
52
  model: z.ZodString;
45
53
  }, z.core.$strict>;
46
54
  export type ActionModel = z.infer<typeof actionModelSchema>;
47
- /** Clockwise from twelve o'clock. Empty slots retain their positions. */
55
+ /** Toolbar order, and clockwise from twelve o'clock on the wheel. Empty slots retain their positions. */
48
56
  export declare const DEFAULT_WHEEL_SLOTS: readonly (CiteAction | null)[];
49
- /** Slots saved before targets existed append only when they are the unchanged built-in free question. */
50
- export declare function actionTarget(action: CiteAction): 'current' | 'new';
57
+ /**
58
+ * Decide how a chosen action is delivered.
59
+ * @param action - the chosen slot.
60
+ * @param preference - the user's preset-action setting.
61
+ * @returns `draft` for questions the user writes, otherwise the preference.
62
+ */
63
+ export declare function actionDelivery(action: CiteAction, preference: ActionDelivery | undefined): ActionDelivery;
51
64
  /** Combine a mode and optional user question without hidden system state. */
52
65
  export declare function actionQuestion(action: CiteAction, question: string): string;
@@ -33,6 +33,7 @@ export interface ActionSnapshot {
33
33
  readonly action: CiteAction;
34
34
  readonly x: number;
35
35
  readonly y: number;
36
+ readonly newTopic: boolean;
36
37
  } | null;
37
38
  submitting: boolean;
38
39
  error: string | null;
@@ -40,8 +41,13 @@ export interface ActionSnapshot {
40
41
  }
41
42
  /** Direction around the actual displayed centre; no action inside the dead zone or outside the wheel. */
42
43
  export declare function wheelSector(dx: number, dy: number): number | null;
43
- /** Prepare a draft through the action's destination policy; the Topic composer owns input and submission. */
44
- export declare function createActionController(execute: (source: ActionSource, action: CiteAction, question: string, model?: ActionModel) => Promise<void>, defaultModel?: () => ActionModel | undefined): {
44
+ /**
45
+ * Run a chosen action through the executor: the selected Topic by default, a new Topic on request.
46
+ * Questions the user writes go to the composer; preset prompts follow the delivery setting.
47
+ */
48
+ export declare function createActionController(execute: (source: ActionSource, action: CiteAction, question: string, model?: ActionModel, options?: {
49
+ readonly newTopic?: boolean;
50
+ }) => Promise<void>, defaultModel?: () => ActionModel | undefined): {
45
51
  getSnapshot: () => ActionSnapshot;
46
52
  subscribe: (fn: () => void) => () => void;
47
53
  open(source: ActionSource, x: number, y: number, slots: readonly (CiteAction | null)[], held: boolean): void;
@@ -51,6 +57,7 @@ export declare function createActionController(execute: (source: ActionSource, a
51
57
  /** Focus loss cancels only the transient gesture; the Topic composer retains its draft. */
52
58
  dismissWheel(): void;
53
59
  choose: (index: number | null) => void;
60
+ run: (source: ActionSource, action: CiteAction, x: number, y: number, newTopic?: boolean) => void;
54
61
  cancel: () => void;
55
62
  submit: () => Promise<void>;
56
63
  dispose(): Promise<void>;
@@ -2,5 +2,9 @@ import { type CiteAction, type ActionModel, type PanelPresentation } from '../ac
2
2
  import { type ActionSource } from './action-controller.ts';
3
3
  import type { CompanionFace } from './companion-controller.ts';
4
4
  import type { ReaderFace } from './reader-controller.ts';
5
+ /** Where a chosen action goes: the selected Topic by default, or a new Topic when the user asks for one. */
6
+ export interface ActionRunOptions {
7
+ readonly newTopic?: boolean;
8
+ }
5
9
  /** Bind explicit Topic and document services. No UI, global listeners or Cordis discovery. */
6
- export declare function createActionExecutor(companion: CompanionFace, reader: ReaderFace, open: (presentation: PanelPresentation) => void): (source: ActionSource, action: CiteAction, question: string, modelRoute?: ActionModel) => Promise<void>;
10
+ export declare function createActionExecutor(companion: CompanionFace, reader: ReaderFace, open: (presentation: PanelPresentation) => void): (source: ActionSource, action: CiteAction, question: string, modelRoute?: ActionModel, options?: ActionRunOptions) => Promise<void>;
@@ -7,7 +7,7 @@ import type { ChatSnapshot } from '@deepseek-ai/dsh-client-ui-chat/client';
7
7
  import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
8
8
  import { type CiteCiterRequest, type CiteCiterResponse, type CiteCiterSettings, type ProviderOption, type QuestionAnswer, type TopicSnapshot, type TopicSummary } from '../topic.ts';
9
9
  import { type DocumentClaimIntent } from './request-guard.ts';
10
- import type { ActionModel } from '../actions.ts';
10
+ import type { ActionDelivery, ActionModel } from '../actions.ts';
11
11
  import type { CiteSelection } from './types.ts';
12
12
  import { type DraftReference } from './draft-references.ts';
13
13
  export type CompanionPhase = 'idle' | 'creating' | 'ready' | 'running' | 'stopping' | 'stopped' | 'error';
@@ -48,15 +48,24 @@ export interface CompanionFace {
48
48
  subscribe(listener: () => void): () => void;
49
49
  setSource(sessionId: SessionId | null): void;
50
50
  retainVisible(): () => void;
51
- create(selection: CiteSelection, question: string, modelRoute?: ActionModel): Promise<void>;
51
+ /** Resolve once the Topic list refresh in progress, including reopening the last Topic, has finished. */
52
+ settle(): Promise<void>;
53
+ /**
54
+ * Create a Topic from a conversation selection.
55
+ * @param delivery - `draft` fills the new Topic's composer; `send` sends the question with its references at once.
56
+ */
57
+ create(selection: CiteSelection, question: string, modelRoute?: ActionModel, delivery?: ActionDelivery): Promise<void>;
52
58
  createFree(question: string): Promise<boolean>;
53
59
  /** Create a Reading Topic; rejects on failure so the Reader retains the unsent question. */
54
- createFromDocument(claim: DocumentClaimIntent, question: string, sourceSessionId?: SessionId, modelRoute?: ActionModel): Promise<void>;
60
+ createFromDocument(claim: DocumentClaimIntent, question: string, sourceSessionId?: SessionId, modelRoute?: ActionModel, delivery?: ActionDelivery): Promise<void>;
55
61
  openTopic(sessionId: string): Promise<void>;
56
62
  /** Resolve only the explicitly selected, unarchived Topic; null means create a new one. */
57
63
  resolveDraftTopic(sourceSessionId: SessionId): Promise<string | null>;
58
- /** Append to the exact still-selected Topic; never change its route, permissions or running turn. */
59
- appendSelection(sourceSessionId: SessionId, topicSessionId: string, question: string, references: readonly DraftReference[]): void;
64
+ /**
65
+ * Append to the exact still-selected Topic; never change its route, permissions, existing draft or running turn.
66
+ * @param delivery - `draft` adds the question and references to the composer; `send` queues them as their own message.
67
+ */
68
+ appendSelection(sourceSessionId: SessionId, topicSessionId: string, question: string, references: readonly DraftReference[], delivery?: ActionDelivery): Promise<void>;
60
69
  /** Acknowledge a draft event only after its UI consumer accepted it. */
61
70
  consumeComposeSeed(id: string): void;
62
71
  ask(question: string, attachments?: readonly DraftAttachmentId[], mode?: DeliveryMode, requestId?: string, expectedSessionId?: string): Promise<boolean>;
@@ -1,7 +1,7 @@
1
1
  import type { CompanionSnapshot } from '../companion-controller.ts';
2
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 }: {
3
+ /** Selection entry points, preset-action delivery, the new-Topic model and the eight action slots, saved together. */
4
+ export declare function ActionSettings({ snapshot, companion }: {
5
5
  snapshot: CompanionSnapshot;
6
6
  companion: CompanionActions;
7
7
  }): import("react").JSX.Element;
@@ -1,10 +1,10 @@
1
1
  import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
2
2
  import { type ActionController, type ActionSnapshot } from '../action-controller.ts';
3
- import type { CompanionActions } from '../view-actions.ts';
3
+ import type { CompanionSnapshot } from '../companion-controller.ts';
4
4
  export type ActionCallbacks = Omit<ActionController, 'getSnapshot' | 'subscribe' | 'dispose'>;
5
- /** Public wheel and creation-error retry. Questions and models are edited only in the Topic composer. */
6
- export declare function ActionWheel({ useActions, actions, companion }: {
5
+ /** Optional wheel and the action retry prompt. Questions and models are edited only in the Topic composer. */
6
+ export declare function ActionWheel({ useActions, useCompanion, actions }: {
7
7
  useActions: SnapshotSelectorHook<ActionSnapshot>;
8
+ useCompanion: SnapshotSelectorHook<CompanionSnapshot>;
8
9
  actions: ActionCallbacks;
9
- companion: CompanionActions;
10
10
  }): import("react").JSX.Element;
@@ -12,5 +12,5 @@ export interface CiteCiterSettingsProps extends SettingsSectionOwnerProps {
12
12
  readonly settingsDocument: SettingsDocumentActions;
13
13
  readonly updateController: UpdateActions;
14
14
  }
15
- /** Native DSH settings page for CiteCiter-owned preferences. */
15
+ /** Native DSH settings page for Citer preferences. */
16
16
  export declare function CiteCiterSettings({ useCompanion, useDocument, useUpdate, companion, settingsDocument, updateController }: CiteCiterSettingsProps): import("react").JSX.Element;
@@ -1,9 +1,14 @@
1
1
  import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
2
2
  import type { CiteOverlaySnapshot } from '../types.ts';
3
3
  import type { CompanionSnapshot } from '../companion-controller.ts';
4
- /** Independent entry back to the current learning workspace; owns no selection state. */
5
- export declare function CiteLauncher({ useCompanion, useOverlay, openPanel }: {
4
+ import type { CompanionActions } from '../view-actions.ts';
5
+ /**
6
+ * Entry back to Citer while its panel is closed. While an answer is still running it keeps
7
+ * the Topic refreshing, so the pet can mark the finished answer; opening Citer clears the mark.
8
+ */
9
+ export declare function CiteLauncher({ useCompanion, useOverlay, companion, openPanel }: {
6
10
  useCompanion: SnapshotSelectorHook<CompanionSnapshot>;
7
11
  useOverlay: SnapshotSelectorHook<CiteOverlaySnapshot>;
12
+ companion: CompanionActions;
8
13
  openPanel: () => void;
9
14
  }): import("react").JSX.Element | null;
@@ -2,6 +2,7 @@ import type { NativeComposer, DeliveryMode } from '../native-composer.ts';
2
2
  import { type DraftController, type DraftSnapshot } from '../draft-controller.ts';
3
3
  import type { InteractionSnapshot } from '../host-ui-adapter.ts';
4
4
  import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
5
+ import type { UseSessions } from '@deepseek-ai/dsh-client-ui-session/client';
5
6
  import type { CiteOverlaySnapshot } from '../types.ts';
6
7
  import type { CompanionSnapshot } from '../companion-controller.ts';
7
8
  import type { CompanionActions, OverlayActions } from '../view-actions.ts';
@@ -18,10 +19,12 @@ export interface CitePanelProps {
18
19
  readonly closePanel: () => void;
19
20
  readonly openReader: () => void;
20
21
  readonly reportParseError: (messageId: string) => void;
22
+ /** Host standard prop: the session list, used to show source titles on reference chips. */
23
+ readonly useSessions?: UseSessions;
21
24
  }
22
25
  /**
23
26
  * Render the independent Topic workspace on the right edge of the shell.
24
27
  * @param props - shared panel bus, Topic controller, and host callbacks.
25
28
  * @returns the responsive Topic dock and its dialogs, or null while closed.
26
29
  */
27
- export declare function CitePanel({ nativeComposer, drafts, useDrafts, useCompanion, useOverlay, useInteractions, useSubmission, bus, companion, closePanel, openReader, reportParseError }: CitePanelProps): import("react").JSX.Element | null;
30
+ export declare function CitePanel({ nativeComposer, drafts, useDrafts, useCompanion, useOverlay, useInteractions, useSubmission, useSessions, bus, companion, closePanel, openReader, reportParseError }: CitePanelProps): import("react").JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The collapsed Citer entry: the mascot peeking over a window edge. It stands up when the
3
+ * pointer comes near or it receives focus, opens Citer on click, and can be dragged to
4
+ * either side; the side and height are remembered in this browser.
5
+ * @param attention - show a dot because an answer finished or a question waits while Citer is closed.
6
+ */
7
+ export declare function CiterPet({ attention, onOpen }: {
8
+ readonly attention: boolean;
9
+ readonly onOpen: () => void;
10
+ }): import("react").JSX.Element;
@@ -1,14 +1,12 @@
1
1
  import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
2
2
  import type { ReaderSnapshot } from '../reader-controller.ts';
3
- import type { CiteOverlaySnapshot } from '../types.ts';
4
3
  import type { ReaderActions } from '../view-actions.ts';
5
4
  import type { SessionId } from '@deepseek-ai/dsh-session/types';
6
5
  import type { SelectionSurfaces } from '../wheel-gesture.ts';
7
- /** Reader shell-overlay entry: compact trigger plus the document library panel. */
8
- export declare function DocumentReader({ reader, useReader, useOverlay, registerSurface, sourceSessionId }: {
6
+ /** The document library panel, opened from the Topic menu. */
7
+ export declare function DocumentReader({ reader, useReader, registerSurface, sourceSessionId }: {
9
8
  readonly reader: ReaderActions;
10
9
  readonly useReader: SnapshotSelectorHook<ReaderSnapshot>;
11
- readonly useOverlay: SnapshotSelectorHook<CiteOverlaySnapshot>;
12
10
  readonly registerSurface: SelectionSurfaces['register'];
13
11
  readonly sourceSessionId: () => SessionId | null;
14
12
  }): import("react").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import type { TopicMessage } from '../../topic.ts';
2
- /** Optional native todo projection. The user toggles planning; the model owns plan contents. */
3
- export declare function LearningRoute({ enabled, messages, onChange }: {
2
+ /** Progress of the optional learning route. It is switched in the Topic menu; the model owns the plan. */
3
+ export declare function LearningRoute({ enabled, messages }: {
4
4
  readonly enabled: boolean;
5
5
  readonly messages: readonly TopicMessage[];
6
- readonly onChange: (enabled: boolean) => void;
7
- }): import("react").JSX.Element;
6
+ }): import("react").JSX.Element | null;
@@ -1,10 +1,14 @@
1
1
  import type { ActionModel } from '../../actions.ts';
2
2
  import type { ProviderOption } from '../../topic.ts';
3
- /** Model identities are encoded together, so provider-local model IDs never collide. */
4
- export declare function ModelChoice({ providers, value, onChange, disabled, label }: {
3
+ /**
4
+ * Model select for settings rows; the row supplies the visible label.
5
+ * Model identities are encoded together, so provider-local model IDs never collide.
6
+ */
7
+ export declare function ModelChoice({ providers, value, onChange, disabled, label, className }: {
5
8
  providers: readonly ProviderOption[];
6
9
  value: ActionModel | undefined;
7
10
  onChange: (value: ActionModel | undefined) => void;
8
11
  disabled?: boolean;
9
- label?: string;
12
+ label: string;
13
+ className?: string | undefined;
10
14
  }): import("react").JSX.Element;
@@ -1,6 +1,10 @@
1
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 }: {
2
+ /**
3
+ * Removable draft chips and rendered previews. No model calls or source reads.
4
+ * @param sourceTitle - resolves a source session's display title for its chip.
5
+ */
6
+ export declare function ReferenceAttachments({ references, onRemove, sourceTitle }: {
4
7
  readonly references: readonly DraftReference[];
5
8
  readonly onRemove?: (id: string) => void;
9
+ readonly sourceTitle?: ((sessionId: string) => string | undefined) | undefined;
6
10
  }): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store';
2
+ import { type CiteAction } from '../../actions.ts';
3
+ import type { ActionSource } from '../action-controller.ts';
4
+ import type { CompanionSnapshot } from '../companion-controller.ts';
5
+ import type { SelectionToolbarSnapshot } from '../selection-toolbar.ts';
6
+ /** Toolbar callbacks; the controllers stay with the Client plugin. */
7
+ export interface SelectionToolbarActions {
8
+ readonly dismiss: () => void;
9
+ readonly run: (source: ActionSource, action: CiteAction, x: number, y: number, newTopic?: boolean) => void;
10
+ }
11
+ /**
12
+ * Actions for the current selection: the first configured actions inline, the rest and
13
+ * "新 Topic" under a menu. Pressing a button never moves focus or clears the selection first.
14
+ */
15
+ export declare function SelectionToolbar({ useToolbar, useCompanion, toolbar }: {
16
+ readonly useToolbar: SnapshotSelectorHook<SelectionToolbarSnapshot>;
17
+ readonly useCompanion: SnapshotSelectorHook<CompanionSnapshot>;
18
+ readonly toolbar: SelectionToolbarActions;
19
+ }): import("react").JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import type { TopicMessage } from '../../topic.ts';
2
2
  import type { NativeComposer } from '../native-composer.ts';
3
- /** Show returned files immediately while keeping diagnostic arguments and results collapsible. */
3
+ /** Show returned files immediately; the readable title and summary expand to the exact arguments and result. */
4
4
  export declare function ToolRow({ message, sessionId, load }: {
5
5
  readonly message: Extract<TopicMessage, {
6
6
  role: 'tool';
@@ -1,6 +1,17 @@
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;
1
+ /** Everything the Topic menu offers; callbacks own their dialogs and services. */
2
+ export interface TopicMenu {
3
+ readonly topic: {
4
+ readonly archived: boolean;
5
+ } | undefined;
6
+ readonly busy: boolean;
7
+ readonly learningRoute: boolean;
8
+ readonly onRename: () => void;
9
+ readonly onLearningRoute: (enabled: boolean) => void;
5
10
  readonly onReader: () => void;
11
+ readonly onArchive: (archived: boolean) => void;
12
+ readonly onDelete: () => void;
13
+ }
14
+ /** The "⋯" menu: rename, learning route, document reader, archive and permanent deletion. */
15
+ export declare function TopicActions({ menu }: {
16
+ readonly menu: TopicMenu;
6
17
  }): import("react").JSX.Element;
@@ -1,10 +1,15 @@
1
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 }: {
2
+ /**
3
+ * Layout-only header. The Citer mark identifies the panel; dragging the header floats it.
4
+ * Navigation, title and closing are supplied by their own controllers.
5
+ * @param status - shown only while something is happening or needs attention.
6
+ */
7
+ export declare function TopicHeader({ compact, onBack, onClose, onDrag, title, status, children }: {
4
8
  readonly compact: boolean;
5
9
  readonly onBack: () => void;
10
+ readonly onClose: () => void;
6
11
  readonly onDrag: PointerEventHandler<HTMLElement>;
7
12
  readonly title: ReactNode;
8
- readonly status: string;
13
+ readonly status: string | null;
9
14
  readonly children: ReactNode;
10
15
  }): import("react").JSX.Element;
@@ -1,12 +1,12 @@
1
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 }: {
2
+ import { type TopicMenu } from './TopicActions.tsx';
3
+ /** Topic list with search, new Topic and the Topic menu. Receives domain rows and callbacks, without service discovery. */
4
+ export declare function TopicNavigation({ topics, activeId, archived, onOpen, onNew, onArchiveView, menu }: {
4
5
  readonly topics: readonly TopicSummary[];
5
6
  readonly activeId: string | undefined;
6
7
  readonly archived: boolean;
7
8
  readonly onOpen: (id: string) => void;
8
9
  readonly onNew: () => void;
9
10
  readonly onArchiveView: (archived: boolean) => void;
10
- readonly onSettings: () => void;
11
- readonly onReader: () => void;
11
+ readonly menu: TopicMenu;
12
12
  }): import("react").JSX.Element;
@@ -1,6 +1,10 @@
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 }: {
1
+ /**
2
+ * Inline rename committed by Enter or blur, cancelled by Escape. Double-click, F2 or a
3
+ * changed `renameRequest` (the Topic menu) start editing.
4
+ */
5
+ export declare function TopicTitle({ id, title, onRename, renameRequest }: {
3
6
  readonly id: string;
4
7
  readonly title: string;
5
8
  readonly onRename: (title: string) => Promise<boolean>;
9
+ readonly renameRequest?: number;
6
10
  }): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import type { QuestionReply } from '../../question-reply.ts';
2
2
  /** Read-only presentation of a committed user message. Attachments remain inspectable and formulas are rendered without mutating the durable prompt. */
3
- export declare function UserMessageBody({ text, questionReply }: {
3
+ export declare function UserMessageBody({ text, questionReply, sourceTitle }: {
4
4
  readonly text: string;
5
5
  readonly questionReply?: QuestionReply | undefined;
6
+ readonly sourceTitle?: ((sessionId: string) => string | undefined) | undefined;
6
7
  }): import("react").JSX.Element;
@@ -8,6 +8,12 @@ export declare function mergeDraftReferences(current: readonly DraftReference[],
8
8
  export declare function topicDraftReferences(topic: TopicSummary, documentTitle?: string): readonly DraftReference[];
9
9
  /** Display a document filename while retaining the full title/path in its serialized content. Legacy ID-only references keep their generic label. */
10
10
  export declare function draftReferenceName(reference: DraftReference): string;
11
+ /**
12
+ * Chip text that shows what a reference contains instead of its kind. Serialized labels
13
+ * are unchanged, so sent messages still parse.
14
+ * @param sourceTitle - resolves a source session's display title; the generic label is used when it is unknown.
15
+ */
16
+ export declare function draftReferenceTitle(reference: DraftReference, sourceTitle?: (sessionId: string) => string | undefined): string;
11
17
  /** Serialize the exact visible attachment collection only at manual submission. */
12
18
  export declare function serializeDraftReferences(question: string, references: readonly DraftReference[]): string;
13
19
  /** Present sent reference blocks as expandable attachments while retaining the exact serialized model input in the Session log. Unrecognized text is preserved. */
@@ -1,2 +1,2 @@
1
1
  /** Keep host icon imports behind a single official SDK boundary. */
2
- export { IconSettingsOutlineMedium, IconQuestionOutlineMedium, IconSparkleMedium, IconDownloadOutlineMedium, IconThinkOutlineMedium, IconStopFillMedium, IconArchiveOutlineMedium, } from '@deepseek-ai/dsh-client-ui-primitives';
2
+ export { IconQuestionOutlineMedium, IconSparkleMedium, IconDownloadOutlineMedium, IconThinkOutlineMedium, IconStopFillMedium, } from '@deepseek-ai/dsh-client-ui-primitives';
@@ -0,0 +1,36 @@
1
+ import type { ActionSource } from './action-controller.ts';
2
+ /** Where a settled selection ends, in viewport coordinates. */
3
+ export interface SelectionAnchor {
4
+ readonly x: number;
5
+ readonly top: number;
6
+ readonly bottom: number;
7
+ }
8
+ /** The toolbar's subject: one captured selection and the place to show actions for it. */
9
+ export interface SelectionToolbarSnapshot {
10
+ current: {
11
+ readonly source: ActionSource;
12
+ readonly anchor: SelectionAnchor;
13
+ } | null;
14
+ }
15
+ /** Resolvers for the two kinds of selection the toolbar can follow. */
16
+ export interface SelectionReaders {
17
+ /** A DOM text range: conversation entries and registered surfaces. */
18
+ readonly range: (event: MouseEvent) => ActionSource | null;
19
+ /** A selection kept inside a registered read-only control, such as the reader's textarea. */
20
+ readonly surface: (event: MouseEvent) => ActionSource | null;
21
+ }
22
+ /**
23
+ * Show Citer actions next to a settled text selection. It never claims the native context
24
+ * menu and never changes the selection; the selection is captured when the toolbar appears.
25
+ * A plain click never shows it: conversation entries are consulted only for a real text range.
26
+ * @param readers - resolve a pointer-like event to a citable source, or null when Citer does not own it.
27
+ * @param enabled - the user's toolbar preference, read on every selection.
28
+ * @returns the toolbar snapshot store, `dismiss()` and a `dispose()` that removes every listener.
29
+ */
30
+ export declare function installSelectionToolbar(readers: SelectionReaders, enabled: () => boolean): {
31
+ getSnapshot: () => SelectionToolbarSnapshot;
32
+ subscribe: (fn: () => void) => () => void;
33
+ dismiss: () => void;
34
+ dispose(): void;
35
+ };
36
+ export type SelectionToolbarController = ReturnType<typeof installSelectionToolbar>;
@@ -0,0 +1,14 @@
1
+ import type { TopicMessage } from '../topic.ts';
2
+ type ToolMessage = Extract<TopicMessage, {
3
+ role: 'tool';
4
+ }>;
5
+ /**
6
+ * Title and one-line summary for a tool row. The full arguments and result stay in its details.
7
+ * @returns a readable title, the summary shown after it, and whether the call is still running.
8
+ */
9
+ export declare function toolPresentation(message: ToolMessage): {
10
+ readonly title: string;
11
+ readonly summary: string;
12
+ readonly running: boolean;
13
+ };
14
+ export {};