deepcode-ai 1.1.33 → 1.1.34

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/dist/index.js CHANGED
@@ -6302,6 +6302,7 @@ function toOpenAICompatibleToolChoice(toolChoice) {
6302
6302
  return toolChoice;
6303
6303
  }
6304
6304
  var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([408, 429, 502, 503, 504]);
6305
+ var MODEL_CATALOG_GRACE_MS = 250;
6305
6306
  function isRetryableError(error) {
6306
6307
  if (error instanceof ProviderError && error.statusCode !== void 0) {
6307
6308
  return RETRYABLE_STATUS_CODES.has(error.statusCode);
@@ -6459,30 +6460,49 @@ var ProviderManager = class {
6459
6460
  validateModelForProvider(providerId, model);
6460
6461
  const started = Date.now();
6461
6462
  const controller = new AbortController();
6463
+ const modelCatalogController = new AbortController();
6462
6464
  const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 15e3);
6463
6465
  try {
6464
- const [models, responseText] = await Promise.all([
6465
- provider.listModels({ signal: controller.signal }).catch(() => []),
6466
- provider.complete("Reply exactly with: OK", {
6467
- model,
6468
- maxTokens: 16,
6469
- temperature: 0,
6470
- signal: controller.signal
6471
- })
6472
- ]);
6466
+ let modelCatalogStatus = "skipped";
6467
+ const modelCatalogSignal = AbortSignal.any([controller.signal, modelCatalogController.signal]);
6468
+ const modelCatalogPromise = provider.listModels({ signal: modelCatalogSignal }).then((models2) => {
6469
+ modelCatalogStatus = "checked";
6470
+ return models2;
6471
+ }).catch(() => {
6472
+ modelCatalogStatus = modelCatalogController.signal.aborted ? "skipped" : "unavailable";
6473
+ return [];
6474
+ });
6475
+ const responseText = await provider.complete("Reply exactly with: OK", {
6476
+ model,
6477
+ maxTokens: 16,
6478
+ temperature: 0,
6479
+ signal: controller.signal
6480
+ });
6481
+ const latencyMs = Date.now() - started;
6473
6482
  if (!responseText.trim()) {
6474
6483
  throw new ProviderError(`${provider.name} returned an empty validation response`, providerId);
6475
6484
  }
6485
+ const catalogResult = await Promise.race([
6486
+ modelCatalogPromise.then((models2) => ({ completed: true, models: models2 })),
6487
+ delay2(MODEL_CATALOG_GRACE_MS, controller.signal).then(() => ({ completed: false }))
6488
+ ]);
6489
+ const models = catalogResult.completed ? catalogResult.models : [];
6490
+ if (!catalogResult.completed) {
6491
+ modelCatalogStatus = "skipped";
6492
+ modelCatalogController.abort();
6493
+ }
6476
6494
  const modelFound = models.length === 0 || models.some((item) => item.id === model || item.id === configuredModel);
6477
6495
  return {
6478
6496
  provider: providerId,
6479
6497
  model,
6480
6498
  modelFound,
6481
6499
  modelCount: models.length,
6500
+ modelCatalogStatus,
6482
6501
  responseText,
6483
- latencyMs: Date.now() - started
6502
+ latencyMs
6484
6503
  };
6485
6504
  } finally {
6505
+ modelCatalogController.abort();
6486
6506
  clearTimeout(timeout);
6487
6507
  }
6488
6508
  }
@@ -10268,6 +10288,21 @@ function isIndexable(value) {
10268
10288
  function isPlainObject2(value) {
10269
10289
  return typeof value === "object" && value !== null && !Array.isArray(value);
10270
10290
  }
10291
+ function formatModelCatalogSummary(result) {
10292
+ if (result.modelCatalogStatus === "checked") {
10293
+ return `${result.modelCount} models visible`;
10294
+ }
10295
+ if (result.modelCatalogStatus === "skipped") {
10296
+ return "model catalog skipped";
10297
+ }
10298
+ return "model catalog unavailable";
10299
+ }
10300
+ function formatModelCheckDetail(result) {
10301
+ if (result.modelCatalogStatus === "checked") {
10302
+ return result.modelFound ? result.model : `${result.model} (not present in provider model catalog)`;
10303
+ }
10304
+ return `${result.model} (model catalog ${result.modelCatalogStatus})`;
10305
+ }
10271
10306
  async function doctorCommand(options) {
10272
10307
  const runtime = await createRuntime({
10273
10308
  cwd: options.cwd,
@@ -10352,12 +10387,12 @@ async function providerChecks(runtime) {
10352
10387
  {
10353
10388
  name: "provider",
10354
10389
  ok: true,
10355
- detail: `${target.provider} authenticated; ${result.modelCount} models visible; model call ok (${result.latencyMs}ms)`
10390
+ detail: `${target.provider} authenticated; ${formatModelCatalogSummary(result)}; model call ok (${result.latencyMs}ms)`
10356
10391
  },
10357
10392
  {
10358
10393
  name: "model",
10359
10394
  ok: result.modelFound,
10360
- detail: result.modelFound ? result.model : `${result.model} (not present in provider model catalog)`
10395
+ detail: formatModelCheckDetail(result)
10361
10396
  }
10362
10397
  ];
10363
10398
  } catch (error) {
@@ -28293,7 +28328,7 @@ function parseVersion2(version) {
28293
28328
  if (!match) return null;
28294
28329
  return [Number(match[1]), Number(match[2]), Number(match[3])];
28295
28330
  }
28296
- var VERSION = "1.1.33".length > 0 ? "1.1.33" : "0.0.0-dev";
28331
+ var VERSION = "1.1.34".length > 0 ? "1.1.34" : "0.0.0-dev";
28297
28332
  var updateCommand = {
28298
28333
  name: "update",
28299
28334
  description: "Check published DeepCode versions",
@@ -29872,6 +29907,15 @@ Follow-up suggestion:`;
29872
29907
  return null;
29873
29908
  }
29874
29909
  }
29910
+ function formatModelCatalogSummary2(result) {
29911
+ if (result.modelCatalogStatus === "checked") {
29912
+ return `${result.modelCount} models visible`;
29913
+ }
29914
+ if (result.modelCatalogStatus === "skipped") {
29915
+ return "model catalog skipped";
29916
+ }
29917
+ return "model catalog unavailable";
29918
+ }
29875
29919
  var APPROVAL_ENTER_ARM_DELAY_MS = 350;
29876
29920
  var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
29877
29921
  const historyManager = useHistory();
@@ -31066,7 +31110,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31066
31110
  return {
31067
31111
  ok: true,
31068
31112
  latencyMs: result.latencyMs,
31069
- detail: `${result.modelCount} models visible; model call ok (${result.model})`
31113
+ detail: `${formatModelCatalogSummary2(result)}; model call ok (${result.model})`
31070
31114
  };
31071
31115
  } catch (error) {
31072
31116
  return {