dsh-advisor-group 0.1.0 → 0.1.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.
package/lib/index.d.mts CHANGED
@@ -17,6 +17,27 @@ interface AdvisorConfig {
17
17
  apiKeyEnv?: string;
18
18
  protocol?: ProviderProtocol;
19
19
  authMode?: ProviderAuthMode;
20
+ /**
21
+ * Per-advisor thinking mode; unset = provider default. `disabled` forces
22
+ * every request from this advisor to run without a thinking/reasoning block
23
+ * (mapped to `reasoningEffort: 'off'` on the DSH built-in channel; on the
24
+ * direct-http channel it maps to provider-specific "no thinking" params
25
+ * where supported). When `enabled`, the selected `reasoningEffort` applies.
26
+ */
27
+ thinking?: 'enabled' | 'disabled';
28
+ /**
29
+ * Per-advisor thinking strength; unset = provider/model default. Standard
30
+ * DSH effort ids (`off` disables thinking per request). On the direct-http
31
+ * channel the ids are mapped to provider-specific reasoning parameters
32
+ * (OpenAI `reasoning_effort`, Anthropic thinking budget, Gemini
33
+ * `thinkingConfig`).
34
+ */
35
+ reasoningEffort?: 'off' | 'low' | 'high' | 'max';
36
+ /**
37
+ * Per-advisor tool calling scope override; unset = the global default
38
+ * (`discussion.advisorTools`). Only meaningful on the direct-http channel.
39
+ */
40
+ tools?: 'readonly' | 'all' | 'off';
20
41
  /**
21
42
  * Server-side per-provider direct-key history for one advisor.
22
43
  * Keys are never returned to the browser; they let a user switch back to a
@@ -69,39 +90,108 @@ interface DiscussionConfig {
69
90
  */
70
91
  stopOnConsensus: boolean;
71
92
  /**
72
- * Per-advisor call timeout in milliseconds (default 120000 = 2 min).
93
+ * Per-advisor call timeout in milliseconds (default 600000 = 10 min).
73
94
  * Applied to both the ctx.llm and direct-http channels.
74
95
  */
75
96
  advisorTimeoutMs?: number;
97
+ /**
98
+ * Advisor tool calling scope (2026-09-05): 'readonly' (default) exposes only
99
+ * a read-only whitelist of the session's tools (read/grep/glob/web_search…);
100
+ * 'all' exposes every session-visible tool (incl. writable ones); 'off'
101
+ * disables tool calling. Only the direct-http OpenAI/Anthropic channel
102
+ * supports tool calling (ctx.llm / dsh-llm does not expose tool calling).
103
+ */
104
+ advisorTools?: 'readonly' | 'all' | 'off';
105
+ /**
106
+ * Driver (deep-question / conclusion) generation timeout in milliseconds
107
+ * (default 600000 = 10 min).
108
+ */
109
+ driverTimeoutMs?: number;
76
110
  }
77
111
  interface TriggerConfig {
78
112
  requireClassifier: boolean;
79
113
  allowWebFallback: boolean;
80
114
  confidenceThreshold: number;
115
+ jev?: JevConfig;
116
+ }
117
+ type JevProvider = 'typesafe' | 'openrouter';
118
+ interface JevConfig {
119
+ enabled: boolean;
120
+ provider: JevProvider;
121
+ model: string;
122
+ baseURL?: string;
123
+ apiKey?: string;
124
+ apiKeyEnv?: string;
125
+ timeoutMs: number;
126
+ confidenceThreshold: number;
127
+ /** Judge with the caller-provided English gist (questionEn) as the Jev state; default keeps the Chinese question. */
128
+ useEnglishState?: boolean;
129
+ /** Threshold for the high_risk question; unset means follow confidenceThreshold. */
130
+ highRiskThreshold?: number;
131
+ apiKeyMeta?: {
132
+ configured: boolean;
133
+ last4?: string;
134
+ };
81
135
  }
82
136
  interface UiConfig {
83
137
  theme: 'retro-green' | 'retro-amber' | 'retro-blue';
84
138
  showTimestamps: boolean;
85
139
  autoExpand: boolean;
86
140
  }
141
+ interface QuotaConfig {
142
+ /** Enable the per-UTC-day new-consultation cap (cost safety valve). */
143
+ enabled: boolean;
144
+ /** Max new consultations per UTC day when enabled (1–100000), default 50. */
145
+ maxPerDay: number;
146
+ }
87
147
  interface Config {
88
148
  enabled: boolean;
89
149
  discussion: DiscussionConfig;
90
150
  trigger: TriggerConfig;
91
151
  ui: UiConfig;
152
+ quota: QuotaConfig;
92
153
  advisors: AdvisorConfig[];
93
154
  }
94
155
  declare const Config: Schema<Config>;
95
156
  //#endregion
96
157
  //#region src/types.d.ts
158
+ interface DriverSource {
159
+ provider: string;
160
+ model: string;
161
+ }
97
162
  type ChatRole = 'main' | 'advisor' | 'system';
163
+ /** Why an advisor stream ended before producing a complete answer body. */
164
+ interface TruncationInfo {
165
+ reason: 'timeout' | 'network';
166
+ atMs: number;
167
+ }
168
+ /** One tool step (agent-loop style) attached to the advisor message. */
169
+ interface AdvisorToolStep {
170
+ kind: 'call' | 'result';
171
+ name: string;
172
+ text: string;
173
+ atMs: number;
174
+ }
98
175
  interface ChatMessage {
99
176
  role: ChatRole;
100
177
  advisorId?: string;
101
178
  advisorName?: string;
102
179
  content: string;
103
180
  thinking?: string;
181
+ /** Thinking split at each tool-call boundary, in stream order — the card
182
+ * renders ONE row per segment (第 N 步思考), interleaved with tool rows. */
183
+ thinkingSegments?: string[];
184
+ /**
185
+ * The model's TEXT blocks spoken before each tool round (the DSH block order
186
+ * text → reasoning → tool-call): the "我要做什么" announcement the model
187
+ * makes to the user. Precise source for the card's 📋 行动·N rows.
188
+ */
189
+ actionDescriptions?: string[];
104
190
  round?: number;
191
+ /** Tool-calling steps streamed as independent rows (not part of thinking). */
192
+ toolSteps?: AdvisorToolStep[];
193
+ /** Set when the stream was cut before a complete body (e.g. advisor timeout). */
194
+ truncated?: TruncationInfo;
105
195
  ts: number;
106
196
  }
107
197
  interface ConsultSession {
@@ -112,6 +202,18 @@ interface ConsultSession {
112
202
  advisors: AdvisorConfig[];
113
203
  maxRounds: number;
114
204
  messages: ChatMessage[];
205
+ /** Working directory of the agent session (for cross-restart recovery). */
206
+ cwd?: string;
207
+ /** The agent's DSH session id: resume rebuilds THIS session so the card
208
+ * (assembled from the agent session log) keeps receiving events. */
209
+ dshSessionId?: string;
210
+ /** Driver model source captured at first run; resume reuses it because the
211
+ * rebuilt session has no request/header event to read the agent model from. */
212
+ driverSource?: DriverSource;
213
+ /** Why the consultation was interrupted: 'user-stop' (explicit stop button),
214
+ * 'exec-cancel' (host signal), 'abort-error' (unclassified AbortError),
215
+ * or an advisor-level reason mirrored from truncated (timeout/network). */
216
+ stopReason?: string;
115
217
  createdAt: number;
116
218
  updatedAt: number;
117
219
  }
@@ -130,6 +232,8 @@ interface ConsultSummary {
130
232
  riskNotes: string[];
131
233
  /** Driver-model synthesis appended after all auto-deepen rounds (2026-09-05). */
132
234
  conclusion?: string;
235
+ /** True when the consultation was stopped by the user (partial content). */
236
+ stopped?: boolean;
133
237
  }
134
238
  //#endregion
135
239
  //#region src/events.d.ts
@@ -154,6 +258,9 @@ declare module '@deepseek-ai/cordis' {
154
258
  sessionId: string;
155
259
  summary: ConsultSummary;
156
260
  }): void;
261
+ 'advisor-group/resume'(payload: {
262
+ sessionId: string;
263
+ }): void;
157
264
  }
158
265
  }
159
266
  //#endregion