@integrity-labs/agt-cli 0.27.168 → 0.27.169

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  claudeModelAlias,
3
3
  isClaudeFastMode
4
- } from "./chunk-3A2H4ZLD.js";
4
+ } from "./chunk-L2UTBXZS.js";
5
5
  import {
6
6
  reapOrphanChannelMcps
7
7
  } from "./chunk-XWVM4KPK.js";
@@ -1641,4 +1641,4 @@ export {
1641
1641
  stopAllSessionsAndWait,
1642
1642
  getProjectDir
1643
1643
  };
1644
- //# sourceMappingURL=chunk-5TBIEU36.js.map
1644
+ //# sourceMappingURL=chunk-4ULNASXC.js.map
@@ -1490,6 +1490,24 @@ var ACCOUNT_RESOLUTION_ERROR_PATTERNS = [
1490
1490
  "auth config",
1491
1491
  "no connection found"
1492
1492
  ];
1493
+ var UPSTREAM_AUTH_ERROR_PATTERNS = [
1494
+ "authentication required",
1495
+ "not authenticated",
1496
+ "unauthorized",
1497
+ "authentication_error",
1498
+ "authentication error",
1499
+ "invalid authentication",
1500
+ "invalid credentials",
1501
+ "invalid api key",
1502
+ "invalid access token",
1503
+ "token expired",
1504
+ "token has expired",
1505
+ "expired access token",
1506
+ "expired credentials",
1507
+ "permission denied",
1508
+ "access denied",
1509
+ "forbidden"
1510
+ ];
1493
1511
  function isReadonlyToolDescriptor(t) {
1494
1512
  if (!t?.name)
1495
1513
  return false;
@@ -1525,6 +1543,24 @@ function isAccountResolutionError(message) {
1525
1543
  const m = message.toLowerCase();
1526
1544
  return ACCOUNT_RESOLUTION_ERROR_PATTERNS.some((p) => m.includes(p));
1527
1545
  }
1546
+ function isUpstreamAuthError(message) {
1547
+ const m = message.toLowerCase();
1548
+ if (UPSTREAM_AUTH_ERROR_PATTERNS.some((p) => m.includes(p)))
1549
+ return true;
1550
+ if (/\b(401|403)\s+client error/.test(m))
1551
+ return true;
1552
+ return /(status(?:_?code)?|http_?status(?:_code)?|mercury_last_http_status_code)["'\\\s]*[:=]["'\\\s]*(401|403)\b/.test(m);
1553
+ }
1554
+ function isComposioFailureEnvelope(text) {
1555
+ return /["'\\]*(successful|successfull)["'\\\s]*:\s*false\b/i.test(text);
1556
+ }
1557
+ function classifyToolCallFailure(text) {
1558
+ if (isAccountResolutionError(text))
1559
+ return "account";
1560
+ if (isUpstreamAuthError(text))
1561
+ return "auth";
1562
+ return "benign";
1563
+ }
1528
1564
  async function parseRpc(res, expectedId) {
1529
1565
  const ct = res.headers.get("content-type") ?? "";
1530
1566
  if (ct.includes("text/event-stream")) {
@@ -1629,28 +1665,29 @@ async function probeComposioMcpToolCall(config, fetchImpl = fetch) {
1629
1665
  if (raw)
1630
1666
  baseDetails.response = raw.length > 2e3 ? `${raw.slice(0, 2e3)}\u2026` : raw;
1631
1667
  }
1632
- if (callRpc && "error" in callRpc) {
1633
- const errMsg = callRpc["error"]?.message ?? "";
1634
- if (isAccountResolutionError(errMsg)) {
1668
+ const rpcErrMsg = callRpc && "error" in callRpc ? callRpc["error"]?.message ?? "" : "";
1669
+ const result = callRpc?.["result"];
1670
+ const contentText = (result?.content ?? []).map((c) => c.text ?? "").join(" ").trim();
1671
+ const failed = Boolean(rpcErrMsg) || Boolean(result?.isError) || isComposioFailureEnvelope(contentText);
1672
+ if (failed) {
1673
+ const failureText = [rpcErrMsg, contentText].filter(Boolean).join(" ");
1674
+ const snippet = failureText.length > 200 ? `${failureText.slice(0, 200)}\u2026` : failureText;
1675
+ const kind = classifyToolCallFailure(failureText);
1676
+ if (kind === "account") {
1635
1677
  return {
1636
1678
  status: "down",
1637
- message: `Live tool call '${toolName}' failed to resolve the connected account: ${errMsg}`,
1679
+ message: `Live tool call '${toolName}' failed to resolve the connected account: ${snippet}`,
1638
1680
  details: baseDetails
1639
1681
  };
1640
1682
  }
1641
- return { status: "ok", message: `Live tool call '${toolName}' resolved the account (tool error: ${errMsg})`, details: baseDetails };
1642
- }
1643
- const result = callRpc?.["result"];
1644
- if (result?.isError) {
1645
- const text = (result.content ?? []).map((c) => c.text ?? "").join(" ");
1646
- if (isAccountResolutionError(text)) {
1683
+ if (kind === "auth") {
1647
1684
  return {
1648
1685
  status: "down",
1649
- message: `Live tool call '${toolName}' failed to resolve the connected account: ${text}`,
1650
- details: baseDetails
1686
+ message: `Live tool call '${toolName}' was rejected by the provider \u2014 the connection's credential is no longer valid (reconnect required): ${snippet}`,
1687
+ details: { ...baseDetails, reason: "upstream_auth_rejected" }
1651
1688
  };
1652
1689
  }
1653
- return { status: "ok", message: `Live tool call '${toolName}' resolved the account (tool error)`, details: baseDetails };
1690
+ return { status: "ok", message: `Live tool call '${toolName}' resolved the account (tool error: ${snippet})`, details: baseDetails };
1654
1691
  }
1655
1692
  return { status: "ok", message: `Live tool call '${toolName}' resolved the connected account`, details: baseDetails };
1656
1693
  } catch (err) {
@@ -5076,4 +5113,4 @@ export {
5076
5113
  coerceEnvValue,
5077
5114
  FLAGS_SCHEMA_VERSION
5078
5115
  };
5079
- //# sourceMappingURL=chunk-3A2H4ZLD.js.map
5116
+ //# sourceMappingURL=chunk-L2UTBXZS.js.map