@evident-ai/cli 3.5.2-dev.cf0e80a → 3.5.2-dev.d192e6e

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
@@ -1322,7 +1322,7 @@ import ora4 from "ora";
1322
1322
  import { select as select4 } from "@inquirer/prompts";
1323
1323
 
1324
1324
  // src/lib/telemetry.ts
1325
- var CLI_VERSION = (true ? "3.5.2-dev.cf0e80a" : void 0) ?? process.env.npm_package_version ?? "unknown";
1325
+ var CLI_VERSION = (true ? "3.5.2-dev.d192e6e" : void 0) ?? process.env.npm_package_version ?? "unknown";
1326
1326
  function getCliVersion() {
1327
1327
  return CLI_VERSION;
1328
1328
  }
@@ -3518,32 +3518,19 @@ function isAbortedTerminalReply(messages, userMessageId) {
3518
3518
  }
3519
3519
  return false;
3520
3520
  }
3521
- var CLAUDE_AUTH_EXPIRY_MESSAGES = Object.freeze([
3522
- "Claude Code credentials are unavailable or expired. Run `claude` to refresh them."
3523
- ]);
3524
- function extractReplyErrorShape(reply) {
3525
- const error2 = errorOf(reply);
3526
- if (error2 == null || typeof error2 !== "object") {
3527
- return { name: null, statusCode: null };
3528
- }
3529
- const e = error2;
3530
- const name = typeof e.name === "string" ? e.name.slice(0, 100) : null;
3531
- const data = e.data;
3532
- const statusCode = typeof data?.statusCode === "number" && Number.isFinite(data.statusCode) ? data.statusCode : null;
3533
- return { name, statusCode };
3534
- }
3535
3521
  function classifyReplyAuthError(reply) {
3536
3522
  const error2 = errorOf(reply);
3537
3523
  if (error2 == null || typeof error2 !== "object") return null;
3538
3524
  const e = error2;
3539
3525
  const replyProviderId = reply?.info?.providerID ?? null;
3540
3526
  const replyModelId = reply?.info?.modelID ?? null;
3541
- const data = e.data;
3542
3527
  if (e.name === "ProviderAuthError") {
3528
+ const data = e.data;
3543
3529
  const providerId = typeof data?.providerID === "string" && data.providerID || replyProviderId;
3544
3530
  return { kind: "model_auth", providerId, modelId: replyModelId, reason: "missing" };
3545
3531
  }
3546
3532
  if (e.name === "APIError") {
3533
+ const data = e.data;
3547
3534
  const statusCode = data?.statusCode;
3548
3535
  if (statusCode === 401 || statusCode === 403) {
3549
3536
  return {
@@ -3554,15 +3541,6 @@ function classifyReplyAuthError(reply) {
3554
3541
  };
3555
3542
  }
3556
3543
  }
3557
- const errorMessage3 = typeof data?.message === "string" ? data.message : typeof e.message === "string" ? e.message : null;
3558
- if (errorMessage3 !== null && CLAUDE_AUTH_EXPIRY_MESSAGES.some((knownMessage) => errorMessage3.includes(knownMessage))) {
3559
- return {
3560
- kind: "model_auth",
3561
- providerId: typeof data?.providerID === "string" && data.providerID || replyProviderId,
3562
- modelId: replyModelId,
3563
- reason: "rejected"
3564
- };
3565
- }
3566
3544
  return null;
3567
3545
  }
3568
3546
  function messageFailure(messages, userMessageId) {
@@ -12529,17 +12507,11 @@ var ChannelDriver = class _ChannelDriver {
12529
12507
  if (subagentInvocations && subagentInvocations.length > 0) {
12530
12508
  body.subagent_invocations = subagentInvocations;
12531
12509
  }
12532
- if (failure && failure.errorShape.name !== null) {
12533
- body.failure_error_name = failure.errorShape.name;
12534
- }
12535
- if (failure && failure.errorShape.statusCode !== null) {
12536
- body.failure_status_code = failure.errorShape.statusCode;
12537
- }
12538
- if (failure?.classification) {
12539
- body.failure_kind = failure.classification.kind;
12540
- body.failure_provider_id = failure.classification.providerId;
12541
- body.failure_model_id = failure.classification.modelId;
12542
- body.failure_reason = failure.classification.reason;
12510
+ if (failure) {
12511
+ body.failure_kind = failure.kind;
12512
+ body.failure_provider_id = failure.providerId;
12513
+ body.failure_model_id = failure.modelId;
12514
+ body.failure_reason = failure.reason;
12543
12515
  }
12544
12516
  try {
12545
12517
  await this.callWithRetry(
@@ -12560,28 +12532,27 @@ var ChannelDriver = class _ChannelDriver {
12560
12532
  this.clearSubagentInvocationCaches(messageId);
12561
12533
  }
12562
12534
  /**
12563
- * Classify an errored turn and extract its bounded error shape for `markFailed`.
12535
+ * Classify an errored turn as a model-auth failure (#736 P1-4), for `markFailed`.
12564
12536
  *
12565
12537
  * `messageFailure` alone (structured OpenCode error → `model_auth`) covers
12566
12538
  * most cases; when it returns `null` on this ALREADY-FAILED turn, fall back
12567
12539
  * to the P1-2b zero-provider check — one extra loopback call to
12568
12540
  * `hasAnyConfiguredProvider`, only reached when the structured classifier
12569
12541
  * couldn't place it. Fails open (never throws): a fallback probe failure
12570
- * (`null`/indeterminate) leaves the classification `null`; the raw error shape
12571
- * is still retained for diagnostics.
12542
+ * (`null`/indeterminate) leaves the classification `null`, which produces
12543
+ * today's byte-identical PATCH body via `markFailed`'s `if (failure)` guard.
12572
12544
  */
12573
12545
  async classifyModelAuthFailure(messages, userMessageId) {
12574
- const reply = findLastAssistantReplyFor(messages, userMessageId);
12575
- const errorShape = extractReplyErrorShape(reply);
12576
12546
  const classified = messageFailure(messages, userMessageId);
12577
- if (classified != null) return { classification: classified, errorShape };
12578
- const classification = applyZeroProviderFallback(
12547
+ if (classified != null) return classified;
12548
+ const reply = findLastAssistantReplyFor(messages, userMessageId);
12549
+ const hasProvider = await this.hasAnyConfiguredProvider();
12550
+ return applyZeroProviderFallback(
12579
12551
  classified,
12580
- await this.hasAnyConfiguredProvider(),
12552
+ hasProvider,
12581
12553
  reply?.info?.providerID ?? null,
12582
12554
  reply?.info?.modelID ?? null
12583
12555
  );
12584
- return { classification, errorShape };
12585
12556
  }
12586
12557
  async recordSubagentModelAuthFailure(failure, conversationId, messageId) {
12587
12558
  const providerId = failure.providerId ?? "(unknown)";