impel-cli 0.20.46-beta.0 → 0.20.46

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/src/doctor.js CHANGED
@@ -10,6 +10,7 @@ const MAX_ERROR_BODY_BYTES = 64 * 1024;
10
10
  const MAX_OUTPUT_CHARS = 16 * 1024;
11
11
  const MAX_PENDING_SSE_CHARS = 1024 * 1024;
12
12
  const MAX_STREAM_BYTES = 4 * 1024 * 1024;
13
+ const CLAUDE_PROBE_MAX_TOKENS = 1_024;
13
14
  const GATEWAY_REQUEST_ID_RE = /^impel-[a-f0-9]{32}$/u;
14
15
  const POOL_STATES = new Set(["healthy", "exhausted", "rate_limited", "expired", "no_seat"]);
15
16
 
@@ -86,6 +87,12 @@ function consumeSseBlock(provider, block, state, startedAt, now) {
86
87
  if (!state.responseId && typeof event?.message?.id === "string") {
87
88
  state.responseId = event.message.id.slice(0, 512) || null;
88
89
  }
90
+ if (event?.type === "message_delta" && typeof event?.delta?.stop_reason === "string") {
91
+ state.stopReason = event.delta.stop_reason.slice(0, 100);
92
+ if (state.stopReason !== "end_turn") {
93
+ state.error ||= `provider stopped the response with reason ${redactSecretText(state.stopReason)}`;
94
+ }
95
+ }
89
96
  if (event?.type === "message_stop") state.terminalEvent = event.type;
90
97
  if (event?.type === "content_block_delta" && event?.delta?.type === "text_delta") {
91
98
  delta = typeof event.delta.text === "string" ? event.delta.text : "";
@@ -131,7 +138,11 @@ async function streamProbe({ provider, url, bearer, model, tenantId, attempt, ti
131
138
  const body = provider === "claude"
132
139
  ? {
133
140
  model,
134
- max_tokens: 96,
141
+ // Current reasoning-capable Claude models may spend part of this budget
142
+ // before emitting the tiny acknowledgement. Ninety-six tokens made a
143
+ // healthy route look broken when reasoning exhausted the response
144
+ // budget before the first text delta.
145
+ max_tokens: CLAUDE_PROBE_MAX_TOKENS,
135
146
  stream: true,
136
147
  messages: [{ role: "user", content: prompt }],
137
148
  }
@@ -192,6 +203,7 @@ async function streamProbe({ provider, url, bearer, model, tenantId, attempt, ti
192
203
  exactAck: false,
193
204
  outputChars: 0,
194
205
  outputTruncated: false,
206
+ stopReason: null,
195
207
  terminalEvent: null,
196
208
  doneSentinel: false,
197
209
  receivedBytes: 0,
@@ -204,6 +216,7 @@ async function streamProbe({ provider, url, bearer, model, tenantId, attempt, ti
204
216
  responseId: null,
205
217
  ttftMs: null,
206
218
  outputTruncated: false,
219
+ stopReason: null,
207
220
  terminalEvent: null,
208
221
  doneSentinel: false,
209
222
  error: null,
@@ -262,6 +275,7 @@ async function streamProbe({ provider, url, bearer, model, tenantId, attempt, ti
262
275
  exactAck,
263
276
  outputChars: state.answer.length,
264
277
  outputTruncated: state.outputTruncated,
278
+ stopReason: state.stopReason,
265
279
  terminalEvent: state.terminalEvent,
266
280
  doneSentinel: state.doneSentinel,
267
281
  receivedBytes,
@@ -283,6 +297,7 @@ async function streamProbe({ provider, url, bearer, model, tenantId, attempt, ti
283
297
  exactAck: false,
284
298
  outputChars: 0,
285
299
  outputTruncated: false,
300
+ stopReason: null,
286
301
  terminalEvent: null,
287
302
  doneSentinel: false,
288
303
  receivedBytes: 0,
@@ -488,6 +503,7 @@ export async function probeTenant({
488
503
  exactAck: false,
489
504
  outputChars: 0,
490
505
  outputTruncated: false,
506
+ stopReason: null,
491
507
  terminalEvent: null,
492
508
  doneSentinel: false,
493
509
  receivedBytes: 0,
@@ -1,4 +1,6 @@
1
1
  // Fleet generation shared by managed-profile writers and upstream clients.
2
2
  // Keep this isolated from apps.js so latency-sensitive transports do not load
3
3
  // desktop bundle machinery just to identify their managed config contract.
4
- export const CURRENT_CONFIG_VERSION = 37;
4
+ // v38 replaces the generated desktop MCP Apps host with the authenticated web
5
+ // board and removes the desktop-only Codex renderer flag.
6
+ export const CURRENT_CONFIG_VERSION = 38;