dsh-advisor-group 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.mts CHANGED
@@ -144,16 +144,86 @@ interface QuotaConfig {
144
144
  /** Max new consultations per UTC day when enabled (1–100000), default 50. */
145
145
  maxPerDay: number;
146
146
  }
147
+ interface SwarmConfig {
148
+ /** Master switch for the cross-session tools (ask_session / list_sessions / ask_result). */
149
+ enabled: boolean;
150
+ /** Default response mode when the caller omits both `waitMs` and `detach`. */
151
+ defaultMode: 'wait' | 'detach';
152
+ /** Default wait ceiling in milliseconds when the caller omits `waitMs` (1–10 min). */
153
+ defaultWaitMs: number;
154
+ /** How long detached ask results are kept on disk, in hours (clamped to 1–720). */
155
+ resultTtlHours: number;
156
+ /**
157
+ * Copy a settled answer back into the asking session automatically
158
+ * (`state: done` only; timeout/error are never delivered back). On by
159
+ * default; off leaves results readable only through `ask_result`.
160
+ */
161
+ deliverBack?: boolean;
162
+ /** Whether the session roster lists subagent sessions. */
163
+ rosterIncludeSubagents: boolean;
164
+ /**
165
+ * Route an unnamed question to candidate sessions instead of guessing or
166
+ * sending it blind (pure keyword layer, no model call). Schema default is on.
167
+ */
168
+ routingEnabled?: boolean;
169
+ /** How many routing candidates to return (1–8, default 3). */
170
+ routingTopN?: number;
171
+ /**
172
+ * Which engine orders the routing candidates (2026-10-19): 'local' (default)
173
+ * uses the keyword scorer alone; 'jev' still recalls with the local scorer —
174
+ * it is the recall step and the safety net — and lets Jev re-rank that closed
175
+ * list. Jev reuses the `trigger.jev` credentials/endpoint config; when it is
176
+ * not configured, or on any failure, the local order is returned unchanged.
177
+ */
178
+ routingEngine?: 'local' | 'jev';
179
+ /**
180
+ * Whether a user turn should ask the cross-session engine for a suggestion
181
+ * (2026-10-19). 'off' never calls Jev; 'gated' (default) asks only when the
182
+ * pure prefilter thinks the turn points at another session/task; 'always'
183
+ * asks on every turn (one batched Jev call per turn). Any answer is a hint
184
+ * only: nothing is delivered and the model decides.
185
+ */
186
+ routingAsk?: 'off' | 'gated' | 'always';
187
+ /**
188
+ * Sessions excluded from the whole swarm (2026-10-19): an entry matches a
189
+ * session when it equals its session id (case-insensitive) or is a
190
+ * case-insensitive substring of its title / fallback display name. Excluded
191
+ * sessions never appear in the roster or routing candidates, routing aliases
192
+ * pointing at them are dropped, and an explicit ask_session target that
193
+ * resolves to one is refused with `swarm-excluded`.
194
+ */
195
+ routingExclude?: string[];
196
+ }
147
197
  interface Config {
148
198
  enabled: boolean;
149
199
  discussion: DiscussionConfig;
150
200
  trigger: TriggerConfig;
151
201
  ui: UiConfig;
152
202
  quota: QuotaConfig;
203
+ swarm: SwarmConfig;
153
204
  advisors: AdvisorConfig[];
154
205
  }
155
206
  declare const Config: Schema<Config>;
156
207
  //#endregion
208
+ //#region src/session-roster.d.ts
209
+ /** The minimal session shape this module reads (structurally compatible with the host row). */
210
+ interface RosterSource {
211
+ sessionId: string;
212
+ updatedAt: number;
213
+ running: boolean;
214
+ cwd?: string;
215
+ origin?: 'subagent';
216
+ /** The host marks a freshly created, never-used session as blank. */
217
+ blank?: boolean;
218
+ /** Byte size of the session's own log, when the caller already looked it up. */
219
+ sizeBytes?: number;
220
+ projections?: {
221
+ values?: {
222
+ title?: unknown;
223
+ };
224
+ };
225
+ }
226
+ //#endregion
157
227
  //#region src/types.d.ts
158
228
  interface DriverSource {
159
229
  provider: string;
@@ -236,6 +306,15 @@ interface ConsultSummary {
236
306
  stopped?: boolean;
237
307
  }
238
308
  //#endregion
309
+ //#region src/session-router.d.ts
310
+ /** One routed session: a choice handed to the user, never an auto-pick. */
311
+ interface RouteCandidate {
312
+ sessionId: string;
313
+ name: string;
314
+ score: number;
315
+ reason: string;
316
+ }
317
+ //#endregion
239
318
  //#region src/events.d.ts
240
319
  declare module '@deepseek-ai/cordis' {
241
320
  interface Events {
@@ -267,6 +346,22 @@ declare module '@deepseek-ai/cordis' {
267
346
  //#region src/index.d.ts
268
347
  declare const name = "dsh-advisor-group";
269
348
  declare const inject: string[];
349
+ /**
350
+ * Recall candidates for the background hint, restricted to the sessions the
351
+ * host actually shows: the registered set (workspace `sessionIds` minus
352
+ * archived). `registered === undefined` means "this host has no workspace
353
+ * registry" and filters nothing; a session no workspace registers must never be
354
+ * suggested by a hint. Pure except for the bounded log-size probe inside the
355
+ * router.
356
+ */
357
+ declare function recallHintCandidates(input: {
358
+ sessions: readonly RosterSource[];
359
+ registered?: ReadonlySet<string>;
360
+ text: string;
361
+ topN?: number;
362
+ currentSessionId: string;
363
+ exclude?: readonly string[];
364
+ }): RouteCandidate[];
270
365
  declare function apply(ctx: Context, config: Config): void;
271
366
  //#endregion
272
- export { Config, apply, inject, name };
367
+ export { Config, apply, inject, name, recallHintCandidates };