@klarkxy/dsh-current-title 0.1.5 → 0.1.7

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.
@@ -1,4 +1,4 @@
1
- import { RpcResult } from "@klarkxy/dsh-ai-services/contracts";
1
+ import { RpcResult } from "@klarkxy/dsh-plugin-kit/contracts";
2
2
  //#region src/contracts.d.ts
3
3
  declare const PLUGIN_NAME = "@klarkxy/dsh-current-title";
4
4
  declare const FEATURE_ID = "current-title";
@@ -6,19 +6,22 @@ declare const PROVIDER_ID = "@klarkxy/dsh-current-title";
6
6
  declare const PURPOSE_ID = "current-title.generate";
7
7
  declare const RPC_CHANNEL = "/dsh-current-title";
8
8
  declare const TITLE_CLIENT_SERVICE = "dshCurrentTitleClient";
9
- declare const PROMPT_VERSION = "current-title.v1";
9
+ declare const PROMPT_VERSION = "current-title.v2";
10
10
  declare const SCHEMA_VERSION = "title-json.v1";
11
11
  declare const CONTRACT_VERSION = 1;
12
12
  declare const SETTINGS_KEY = "current";
13
+ declare const MAX_PROMPT_CHARS = 4000;
13
14
  declare const DEFAULT_MAX_RECENT_MESSAGES = 8;
14
15
  declare const DEFAULT_TARGET_WORDS = 5;
15
16
  declare const DEFAULT_TARGET_CJK = 10;
16
17
  declare const DEFAULT_MAX_INPUT_BYTES = 4096;
17
- declare const DEFAULT_MAX_OUTPUT_TOKENS = 64;
18
+ declare const DEFAULT_MAX_OUTPUT_TOKENS = 256;
18
19
  declare const DEFAULT_TIMEOUT_MS = 60000;
19
20
  declare const DEFAULT_MAX_TITLE_BYTES = 80;
20
21
  type TitleLocaleMode = 'auto' | 'zh' | 'en';
21
22
  type TitleSourceKind = 'fallback' | 'provider' | 'user';
23
+ /** Automatic generation cadence: every eligible message, or only the first. */
24
+ type TitleCadence = 'all-prompts' | 'first-prompt';
22
25
  interface TitleMessage {
23
26
  readonly seq: number;
24
27
  readonly text: string;
@@ -33,9 +36,19 @@ interface TitleSnapshot {
33
36
  readonly eventSeq: number;
34
37
  readonly updatedAt: number;
35
38
  }
39
+ /** Empty provider and model means the shared weak role. Both must be set together. */
40
+ interface TitleModelRoute {
41
+ provider: string;
42
+ model: string;
43
+ reasoningEffort?: string;
44
+ }
36
45
  interface TitleSettings {
37
46
  revision: number;
38
47
  locale: TitleLocaleMode;
48
+ /** Empty keeps the built-in title instruction. */
49
+ prompt: string;
50
+ model: TitleModelRoute;
51
+ cadence: TitleCadence;
39
52
  }
40
53
  interface TitleSupport {
41
54
  nativeOwner: string | null;
@@ -66,9 +79,13 @@ interface GenerateConfig {
66
79
  readonly timeoutMs: number;
67
80
  readonly maxTitleBytes: number;
68
81
  }
82
+ declare function defaultModelRoute(): TitleModelRoute;
69
83
  declare function defaultSettings(locale?: TitleLocaleMode): TitleSettings;
84
+ declare function normalizeCadence(value: unknown): TitleCadence;
85
+ declare function normalizePrompt(value: unknown): string;
86
+ declare function normalizeModelRoute(value: unknown): TitleModelRoute;
70
87
  declare function defaultGenerateConfig(locale?: TitleLocaleMode): GenerateConfig;
71
88
  declare function isTitleLocaleMode(value: unknown): value is TitleLocaleMode;
72
89
  //#endregion
73
- export { CONTRACT_VERSION, DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_MAX_RECENT_MESSAGES, DEFAULT_MAX_TITLE_BYTES, DEFAULT_TARGET_CJK, DEFAULT_TARGET_WORDS, DEFAULT_TIMEOUT_MS, FEATURE_ID, GenerateConfig, PLUGIN_NAME, PROMPT_VERSION, PROVIDER_ID, PURPOSE_ID, RPC_CHANNEL, type RpcResult, SCHEMA_VERSION, SETTINGS_KEY, TITLE_CLIENT_SERVICE, TitleClientMarker, TitleLocaleMode, TitleMessage, TitleSettings, TitleSnapshot, TitleSourceKind, TitleStatus, TitleSupport, defaultGenerateConfig, defaultSettings, isTitleLocaleMode };
90
+ export { CONTRACT_VERSION, DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_MAX_RECENT_MESSAGES, DEFAULT_MAX_TITLE_BYTES, DEFAULT_TARGET_CJK, DEFAULT_TARGET_WORDS, DEFAULT_TIMEOUT_MS, FEATURE_ID, GenerateConfig, MAX_PROMPT_CHARS, PLUGIN_NAME, PROMPT_VERSION, PROVIDER_ID, PURPOSE_ID, RPC_CHANNEL, type RpcResult, SCHEMA_VERSION, SETTINGS_KEY, TITLE_CLIENT_SERVICE, TitleCadence, TitleClientMarker, TitleLocaleMode, TitleMessage, TitleModelRoute, TitleSettings, TitleSnapshot, TitleSourceKind, TitleStatus, TitleSupport, defaultGenerateConfig, defaultModelRoute, defaultSettings, isTitleLocaleMode, normalizeCadence, normalizeModelRoute, normalizePrompt };
74
91
  //# sourceMappingURL=contracts.d.ts.map
package/lib/contracts.js CHANGED
@@ -5,21 +5,54 @@ const PROVIDER_ID = "@klarkxy/dsh-current-title";
5
5
  const PURPOSE_ID = "current-title.generate";
6
6
  const RPC_CHANNEL = "/dsh-current-title";
7
7
  const TITLE_CLIENT_SERVICE = "dshCurrentTitleClient";
8
- const PROMPT_VERSION = "current-title.v1";
8
+ const PROMPT_VERSION = "current-title.v2";
9
9
  const SCHEMA_VERSION = "title-json.v1";
10
10
  const CONTRACT_VERSION = 1;
11
11
  const SETTINGS_KEY = "current";
12
+ const MAX_PROMPT_CHARS = 4e3;
12
13
  const DEFAULT_MAX_RECENT_MESSAGES = 8;
13
14
  const DEFAULT_TARGET_WORDS = 5;
14
15
  const DEFAULT_TARGET_CJK = 10;
15
16
  const DEFAULT_MAX_INPUT_BYTES = 4096;
16
- const DEFAULT_MAX_OUTPUT_TOKENS = 64;
17
+ const DEFAULT_MAX_OUTPUT_TOKENS = 256;
17
18
  const DEFAULT_TIMEOUT_MS = 6e4;
18
19
  const DEFAULT_MAX_TITLE_BYTES = 80;
20
+ function defaultModelRoute() {
21
+ return {
22
+ provider: "",
23
+ model: ""
24
+ };
25
+ }
19
26
  function defaultSettings(locale = "auto") {
20
27
  return {
21
28
  revision: 0,
22
- locale
29
+ locale,
30
+ prompt: "",
31
+ model: defaultModelRoute(),
32
+ cadence: "all-prompts"
33
+ };
34
+ }
35
+ function normalizeCadence(value) {
36
+ return value === "first-prompt" ? "first-prompt" : "all-prompts";
37
+ }
38
+ function normalizePrompt(value) {
39
+ if (typeof value !== "string") return "";
40
+ return value.replace(/\u0000/gu, "").trim().slice(0, MAX_PROMPT_CHARS);
41
+ }
42
+ function normalizeModelRoute(value) {
43
+ if (!value || typeof value !== "object" || Array.isArray(value)) return defaultModelRoute();
44
+ const route = value;
45
+ const provider = typeof route.provider === "string" ? route.provider.trim() : "";
46
+ const model = typeof route.model === "string" ? route.model.trim() : "";
47
+ const effort = typeof route.reasoningEffort === "string" ? route.reasoningEffort.trim() : "";
48
+ if (!provider || !model || provider.length > 250 || model.length > 250) return defaultModelRoute();
49
+ return effort && effort.length <= 80 ? {
50
+ provider,
51
+ model,
52
+ reasoningEffort: effort
53
+ } : {
54
+ provider,
55
+ model
23
56
  };
24
57
  }
25
58
  function defaultGenerateConfig(locale = "auto") {
@@ -29,7 +62,7 @@ function defaultGenerateConfig(locale = "auto") {
29
62
  targetWords: 5,
30
63
  targetCjkCharacters: 10,
31
64
  maxInputBytes: DEFAULT_MAX_INPUT_BYTES,
32
- maxOutputTokens: 64,
65
+ maxOutputTokens: 256,
33
66
  timeoutMs: DEFAULT_TIMEOUT_MS,
34
67
  maxTitleBytes: 80
35
68
  };
@@ -38,6 +71,6 @@ function isTitleLocaleMode(value) {
38
71
  return value === "auto" || value === "zh" || value === "en";
39
72
  }
40
73
  //#endregion
41
- export { CONTRACT_VERSION, DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_MAX_RECENT_MESSAGES, DEFAULT_MAX_TITLE_BYTES, DEFAULT_TARGET_CJK, DEFAULT_TARGET_WORDS, DEFAULT_TIMEOUT_MS, FEATURE_ID, PLUGIN_NAME, PROMPT_VERSION, PROVIDER_ID, PURPOSE_ID, RPC_CHANNEL, SCHEMA_VERSION, SETTINGS_KEY, TITLE_CLIENT_SERVICE, defaultGenerateConfig, defaultSettings, isTitleLocaleMode };
74
+ export { CONTRACT_VERSION, DEFAULT_MAX_INPUT_BYTES, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_MAX_RECENT_MESSAGES, DEFAULT_MAX_TITLE_BYTES, DEFAULT_TARGET_CJK, DEFAULT_TARGET_WORDS, DEFAULT_TIMEOUT_MS, FEATURE_ID, MAX_PROMPT_CHARS, PLUGIN_NAME, PROMPT_VERSION, PROVIDER_ID, PURPOSE_ID, RPC_CHANNEL, SCHEMA_VERSION, SETTINGS_KEY, TITLE_CLIENT_SERVICE, defaultGenerateConfig, defaultModelRoute, defaultSettings, isTitleLocaleMode, normalizeCadence, normalizeModelRoute, normalizePrompt };
42
75
 
43
76
  //# sourceMappingURL=contracts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.js","names":[],"sources":["../src/contracts.ts"],"sourcesContent":["/** Browser-safe contracts. Shared RPC/result types stay on @klarkxy/dsh-ai-services. */\nexport type { RpcResult } from '@klarkxy/dsh-ai-services/contracts'\n\nexport const PLUGIN_NAME = '@klarkxy/dsh-current-title'\nexport const FEATURE_ID = 'current-title'\nexport const PROVIDER_ID = '@klarkxy/dsh-current-title'\nexport const PURPOSE_ID = 'current-title.generate'\nexport const RPC_CHANNEL = '/dsh-current-title'\nexport const TITLE_CLIENT_SERVICE = 'dshCurrentTitleClient'\nexport const PROMPT_VERSION = 'current-title.v1'\nexport const SCHEMA_VERSION = 'title-json.v1'\nexport const CONTRACT_VERSION = 1\nexport const SETTINGS_KEY = 'current'\n\nexport const DEFAULT_MAX_RECENT_MESSAGES = 8\nexport const DEFAULT_TARGET_WORDS = 5\nexport const DEFAULT_TARGET_CJK = 10\nexport const DEFAULT_MAX_INPUT_BYTES = 4096\nexport const DEFAULT_MAX_OUTPUT_TOKENS = 64\nexport const DEFAULT_TIMEOUT_MS = 60_000\nexport const DEFAULT_MAX_TITLE_BYTES = 80\n\nexport type TitleLocaleMode = 'auto' | 'zh' | 'en'\nexport type TitleSourceKind = 'fallback' | 'provider' | 'user'\n\nexport interface TitleMessage {\n readonly seq: number\n readonly text: string\n}\n\nexport interface TitleSnapshot {\n readonly title: string\n readonly messageSeqs: readonly number[]\n readonly source: { readonly kind: TitleSourceKind; readonly provider?: string }\n readonly eventSeq: number\n readonly updatedAt: number\n}\n\nexport interface TitleSettings {\n revision: number\n locale: TitleLocaleMode\n}\n\nexport interface TitleSupport {\n nativeOwner: string | null\n weOwn: boolean\n limitation?: string\n}\n\nexport interface TitleStatus {\n settings: TitleSettings\n support: TitleSupport\n session?: {\n sessionId: string\n title?: string\n sourceKind?: TitleSourceKind\n generating: boolean\n pinned: boolean\n }\n}\n\nexport interface TitleClientMarker {\n active: boolean\n}\n\nexport interface GenerateConfig {\n readonly maxRecentMessages: number\n readonly locale: TitleLocaleMode\n readonly targetWords: number\n readonly targetCjkCharacters: number\n readonly maxInputBytes: number\n readonly maxOutputTokens: number\n readonly timeoutMs: number\n readonly maxTitleBytes: number\n}\n\nexport function defaultSettings(locale: TitleLocaleMode = 'auto'): TitleSettings {\n return { revision: 0, locale }\n}\n\nexport function defaultGenerateConfig(locale: TitleLocaleMode = 'auto'): GenerateConfig {\n return {\n maxRecentMessages: DEFAULT_MAX_RECENT_MESSAGES,\n locale,\n targetWords: DEFAULT_TARGET_WORDS,\n targetCjkCharacters: DEFAULT_TARGET_CJK,\n maxInputBytes: DEFAULT_MAX_INPUT_BYTES,\n maxOutputTokens: DEFAULT_MAX_OUTPUT_TOKENS,\n timeoutMs: DEFAULT_TIMEOUT_MS,\n maxTitleBytes: DEFAULT_MAX_TITLE_BYTES,\n }\n}\n\nexport function isTitleLocaleMode(value: unknown): value is TitleLocaleMode {\n return value === 'auto' || value === 'zh' || value === 'en'\n}\n"],"mappings":";AAGA,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,uBAAuB;AACpC,MAAa,iBAAiB;AAC9B,MAAa,iBAAiB;AAC9B,MAAa,mBAAmB;AAChC,MAAa,eAAe;AAE5B,MAAa,8BAA8B;AAC3C,MAAa,uBAAuB;AACpC,MAAa,qBAAqB;AAClC,MAAa,0BAA0B;AACvC,MAAa,4BAA4B;AACzC,MAAa,qBAAqB;AAClC,MAAa,0BAA0B;AAwDvC,SAAgB,gBAAgB,SAA0B,QAAuB;CAC/E,OAAO;EAAE,UAAU;EAAG;CAAO;AAC/B;AAEA,SAAgB,sBAAsB,SAA0B,QAAwB;CACtF,OAAO;EACL,mBAAA;EACA;EACA,aAAA;EACA,qBAAA;EACA,eAAe;EACf,iBAAA;EACA,WAAW;EACX,eAAA;CACF;AACF;AAEA,SAAgB,kBAAkB,OAA0C;CAC1E,OAAO,UAAU,UAAU,UAAU,QAAQ,UAAU;AACzD"}
1
+ {"version":3,"file":"contracts.js","names":[],"sources":["../src/contracts.ts"],"sourcesContent":["/** Browser-safe contracts. Shared RPC/result types stay on @klarkxy/dsh-plugin-kit. */\nexport type { RpcResult } from '@klarkxy/dsh-plugin-kit/contracts'\n\nexport const PLUGIN_NAME = '@klarkxy/dsh-current-title'\nexport const FEATURE_ID = 'current-title'\nexport const PROVIDER_ID = '@klarkxy/dsh-current-title'\nexport const PURPOSE_ID = 'current-title.generate'\nexport const RPC_CHANNEL = '/dsh-current-title'\nexport const TITLE_CLIENT_SERVICE = 'dshCurrentTitleClient'\nexport const PROMPT_VERSION = 'current-title.v2'\nexport const SCHEMA_VERSION = 'title-json.v1'\nexport const CONTRACT_VERSION = 1\nexport const SETTINGS_KEY = 'current'\nexport const MAX_PROMPT_CHARS = 4000\n\nexport const DEFAULT_MAX_RECENT_MESSAGES = 8\nexport const DEFAULT_TARGET_WORDS = 5\nexport const DEFAULT_TARGET_CJK = 10\nexport const DEFAULT_MAX_INPUT_BYTES = 4096\nexport const DEFAULT_MAX_OUTPUT_TOKENS = 256\nexport const DEFAULT_TIMEOUT_MS = 60_000\nexport const DEFAULT_MAX_TITLE_BYTES = 80\n\nexport type TitleLocaleMode = 'auto' | 'zh' | 'en'\nexport type TitleSourceKind = 'fallback' | 'provider' | 'user'\n/** Automatic generation cadence: every eligible message, or only the first. */\nexport type TitleCadence = 'all-prompts' | 'first-prompt'\n\nexport interface TitleMessage {\n readonly seq: number\n readonly text: string\n}\n\nexport interface TitleSnapshot {\n readonly title: string\n readonly messageSeqs: readonly number[]\n readonly source: { readonly kind: TitleSourceKind; readonly provider?: string }\n readonly eventSeq: number\n readonly updatedAt: number\n}\n\n/** Empty provider and model means the shared weak role. Both must be set together. */\nexport interface TitleModelRoute {\n provider: string\n model: string\n reasoningEffort?: string\n}\n\nexport interface TitleSettings {\n revision: number\n locale: TitleLocaleMode\n /** Empty keeps the built-in title instruction. */\n prompt: string\n model: TitleModelRoute\n cadence: TitleCadence\n}\n\nexport interface TitleSupport {\n nativeOwner: string | null\n weOwn: boolean\n limitation?: string\n}\n\nexport interface TitleStatus {\n settings: TitleSettings\n support: TitleSupport\n session?: {\n sessionId: string\n title?: string\n sourceKind?: TitleSourceKind\n generating: boolean\n pinned: boolean\n }\n}\n\nexport interface TitleClientMarker {\n active: boolean\n}\n\nexport interface GenerateConfig {\n readonly maxRecentMessages: number\n readonly locale: TitleLocaleMode\n readonly targetWords: number\n readonly targetCjkCharacters: number\n readonly maxInputBytes: number\n readonly maxOutputTokens: number\n readonly timeoutMs: number\n readonly maxTitleBytes: number\n}\n\nexport function defaultModelRoute(): TitleModelRoute {\n return { provider: '', model: '' }\n}\n\nexport function defaultSettings(locale: TitleLocaleMode = 'auto'): TitleSettings {\n return { revision: 0, locale, prompt: '', model: defaultModelRoute(), cadence: 'all-prompts' }\n}\n\nexport function normalizeCadence(value: unknown): TitleCadence {\n return value === 'first-prompt' ? 'first-prompt' : 'all-prompts'\n}\n\nexport function normalizePrompt(value: unknown): string {\n if (typeof value !== 'string') return ''\n return value.replace(/\\u0000/gu, '').trim().slice(0, MAX_PROMPT_CHARS)\n}\n\nexport function normalizeModelRoute(value: unknown): TitleModelRoute {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return defaultModelRoute()\n const route = value as Record<string, unknown>\n const provider = typeof route.provider === 'string' ? route.provider.trim() : ''\n const model = typeof route.model === 'string' ? route.model.trim() : ''\n const effort = typeof route.reasoningEffort === 'string' ? route.reasoningEffort.trim() : ''\n if (!provider || !model || provider.length > 250 || model.length > 250) return defaultModelRoute()\n return effort && effort.length <= 80 ? { provider, model, reasoningEffort: effort } : { provider, model }\n}\n\nexport function defaultGenerateConfig(locale: TitleLocaleMode = 'auto'): GenerateConfig {\n return {\n maxRecentMessages: DEFAULT_MAX_RECENT_MESSAGES,\n locale,\n targetWords: DEFAULT_TARGET_WORDS,\n targetCjkCharacters: DEFAULT_TARGET_CJK,\n maxInputBytes: DEFAULT_MAX_INPUT_BYTES,\n maxOutputTokens: DEFAULT_MAX_OUTPUT_TOKENS,\n timeoutMs: DEFAULT_TIMEOUT_MS,\n maxTitleBytes: DEFAULT_MAX_TITLE_BYTES,\n }\n}\n\nexport function isTitleLocaleMode(value: unknown): value is TitleLocaleMode {\n return value === 'auto' || value === 'zh' || value === 'en'\n}\n"],"mappings":";AAGA,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,uBAAuB;AACpC,MAAa,iBAAiB;AAC9B,MAAa,iBAAiB;AAC9B,MAAa,mBAAmB;AAChC,MAAa,eAAe;AAC5B,MAAa,mBAAmB;AAEhC,MAAa,8BAA8B;AAC3C,MAAa,uBAAuB;AACpC,MAAa,qBAAqB;AAClC,MAAa,0BAA0B;AACvC,MAAa,4BAA4B;AACzC,MAAa,qBAAqB;AAClC,MAAa,0BAA0B;AAqEvC,SAAgB,oBAAqC;CACnD,OAAO;EAAE,UAAU;EAAI,OAAO;CAAG;AACnC;AAEA,SAAgB,gBAAgB,SAA0B,QAAuB;CAC/E,OAAO;EAAE,UAAU;EAAG;EAAQ,QAAQ;EAAI,OAAO,kBAAkB;EAAG,SAAS;CAAc;AAC/F;AAEA,SAAgB,iBAAiB,OAA8B;CAC7D,OAAO,UAAU,iBAAiB,iBAAiB;AACrD;AAEA,SAAgB,gBAAgB,OAAwB;CACtD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,OAAO,MAAM,QAAQ,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,gBAAgB;AACvE;AAEA,SAAgB,oBAAoB,OAAiC;CACnE,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO,kBAAkB;CAC1F,MAAM,QAAQ;CACd,MAAM,WAAW,OAAO,MAAM,aAAa,WAAW,MAAM,SAAS,KAAK,IAAI;CAC9E,MAAM,QAAQ,OAAO,MAAM,UAAU,WAAW,MAAM,MAAM,KAAK,IAAI;CACrE,MAAM,SAAS,OAAO,MAAM,oBAAoB,WAAW,MAAM,gBAAgB,KAAK,IAAI;CAC1F,IAAI,CAAC,YAAY,CAAC,SAAS,SAAS,SAAS,OAAO,MAAM,SAAS,KAAK,OAAO,kBAAkB;CACjG,OAAO,UAAU,OAAO,UAAU,KAAK;EAAE;EAAU;EAAO,iBAAiB;CAAO,IAAI;EAAE;EAAU;CAAM;AAC1G;AAEA,SAAgB,sBAAsB,SAA0B,QAAwB;CACtF,OAAO;EACL,mBAAA;EACA;EACA,aAAA;EACA,qBAAA;EACA,eAAe;EACf,iBAAA;EACA,WAAW;EACX,eAAA;CACF;AACF;AAEA,SAAgB,kBAAkB,OAA0C;CAC1E,OAAO,UAAU,UAAU,UAAU,QAAQ,UAAU;AACzD"}
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { TitleLocaleMode as TitleLocaleMode$1, TitleMessage, TitleSettings, TitleSnapshot, TitleStatus, TitleSupport } from "./contracts.js";
2
- import { AiServices } from "@klarkxy/dsh-ai-services/contracts";
2
+ import "@klarkxy/dsh-plugin-kit/contracts";
3
+ import { LlmTextCaller } from "@klarkxy/dsh-plugin-kit";
3
4
  import { Context } from "@deepseek-ai/cordis";
4
5
  //#region src/messages.d.ts
5
6
  interface SessionEventLike {
@@ -99,6 +100,11 @@ interface ParsedTitle {
99
100
  summary: string;
100
101
  }
101
102
  declare function resolveTitleLocale(mode: TitleLocaleMode, messages: readonly string[], preference?: string): TitleLocale;
103
+ /**
104
+ * Accept the required JSON shape, including a code fence or a short preface.
105
+ * Extra keys are ignored. A plain one-line title still becomes a title so a
106
+ * chatty model does not leave the session on the built-in fallback.
107
+ */
102
108
  declare function parseModelTitle(raw: string, targetWords: number, targetCjkCharacters: number): ParsedTitle;
103
109
  declare function formatTitle(parsed: ParsedTitle, locale: TitleLocale, now?: Date): string;
104
110
  //#endregion
@@ -111,16 +117,17 @@ declare class CurrentTitleService {
111
117
  private readonly options;
112
118
  private settings;
113
119
  private config;
114
- private scope?;
115
- private unregisterPurpose?;
116
120
  private claim?;
117
121
  private nativeSlot?;
118
122
  private generation;
123
+ private settingsPending;
124
+ private disposed;
119
125
  private readonly inFlight;
120
126
  readonly support: TitleSupport;
121
127
  constructor(options: {
122
128
  plugin: string;
123
- ai?: AiServices;
129
+ llm?: LlmTextCaller;
130
+ host?: unknown;
124
131
  sessionTitle?: SessionTitleServiceLike;
125
132
  loader?: LoaderFace;
126
133
  sessions?: {
@@ -134,6 +141,15 @@ declare class CurrentTitleService {
134
141
  start(): Promise<void>;
135
142
  dispose(): Promise<void>;
136
143
  status(sessionId?: string): TitleStatus;
144
+ updateSettings(patch: {
145
+ prompt?: unknown;
146
+ model?: unknown;
147
+ cadence?: unknown;
148
+ expectedRevision: number;
149
+ }): Promise<TitleSettings>;
150
+ /** Re-register the provider so a cadence change takes effect without a restart. */
151
+ private reclaimWithCadence;
152
+ /** @deprecated Locale is always auto. Kept so older clients still save a revision. */
137
153
  updateLocale(_locale: TitleLocaleMode, expectedRevision: number): Promise<TitleSettings>;
138
154
  regenerate(sessionId: string, signal: AbortSignal): Promise<TitleSnapshot | undefined>;
139
155
  read(session: SessionLike): TitleSnapshot | undefined;
@@ -146,7 +162,7 @@ declare function selectRecentMessages(messages: readonly TitleMessage[], maxRece
146
162
  //#endregion
147
163
  //#region src/index.d.ts
148
164
  declare const name = "@klarkxy/dsh-current-title";
149
- declare const inject: readonly ["sessionTitle", "aiServices", "sessions", "loader", "storageDomain", "connection", "webServer"];
165
+ declare const inject: readonly ["sessionTitle", "llm", "sessions", "loader", "storageDomain", "connection", "webServer"];
150
166
  declare module '@deepseek-ai/cordis' {
151
167
  interface Context {
152
168
  currentTitle: CurrentTitleService;