@indigoai-us/hq-cli 5.334.0 → 5.335.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.335.0] — 2026-10-03
6
+ - Keep expected invalid-refresh-token events countable at warning level and tag each rejection with its allowlisted Cognito OAuth error class.
7
+ - Keep the intentional HQ Anywhere flag-off refusal for `hq mcp login` out of Sentry while preserving its message and exit code.
8
+
5
9
  ## [5.334.0] — 2026-10-03
6
10
  - Keep keep-alive audit verdicts for expired stops independent of the lane's current state, and report restarts recorded after the grace window separately.
7
11
 
@@ -5,6 +5,7 @@ import * as os from "node:os";
5
5
  import * as path from "node:path";
6
6
  import open from "open";
7
7
  import { resolveCognitoTokenSource } from "../../utils/cognito-session.js";
8
+ import { markExpectedUserError } from "../../utils/expected-cli-error.js";
8
9
  import { anywhereRuntimeEnabled } from "../../commands/anywhere-runtime-flag.js";
9
10
  import { resolveHqMcpOAuthOrigin } from "./mcp-endpoint.js";
10
11
  const MCP_SCOPE = "openid email profile hq-mcp/use";
@@ -128,7 +129,7 @@ function newPkce() {
128
129
  async function runLogin(options) {
129
130
  const env = options.env ?? process.env;
130
131
  if (!(options.isEnabled ?? (() => anywhereRuntimeEnabled(env)))()) {
131
- throw new McpOAuthError("HQ Anywhere is not enabled. Enable the hq-anywhere-runtime flag to use `hq mcp login`.");
132
+ throw markExpectedUserError(new McpOAuthError("HQ Anywhere is not enabled. Enable the hq-anywhere-runtime flag to use `hq mcp login`."));
132
133
  }
133
134
  if ((options.isMachine ?? (() => resolveCognitoTokenSource(env) === "machine"))()) {
134
135
  throw new McpOAuthError("`hq mcp login` is for person accounts; this box uses machine credentials.");
@@ -1,5 +1,15 @@
1
1
  import { CLI_VERSION } from "../cli-version.js";
2
2
  import { CognitoRefreshError } from "@indigoai-us/hq-cloud";
3
+ const OAUTH_ERROR_CLASSES = new Set([
4
+ "invalid_grant",
5
+ "invalid_client",
6
+ "unauthorized_client",
7
+ "invalid_request",
8
+ "invalid_scope",
9
+ "NotAuthorizedException",
10
+ "other",
11
+ "unknown",
12
+ ]);
3
13
  /** Capture only fixed, aggregatable auth diagnostics; never attach tokens or identity. */
4
14
  export async function reportNoninteractivePersonRefreshRejection(error) {
5
15
  try {
@@ -11,6 +21,15 @@ export async function reportNoninteractivePersonRefreshRejection(error) {
11
21
  const rejectionKind = error instanceof CognitoRefreshError
12
22
  ? "cognito_refresh_rejection"
13
23
  : "classified_auth_error";
24
+ const rawOauthError = error instanceof CognitoRefreshError &&
25
+ "oauthError" in error &&
26
+ typeof error.oauthError === "string"
27
+ ? error.oauthError
28
+ : "unknown";
29
+ const oauthError = OAUTH_ERROR_CLASSES.has(rawOauthError)
30
+ ? rawOauthError
31
+ : "unknown";
32
+ const expectedReauthentication = oauthError === "invalid_grant" || oauthError === "NotAuthorizedException";
14
33
  Sentry.withScope((scope) => {
15
34
  scope.setUser(null);
16
35
  scope.clearBreadcrumbs();
@@ -29,10 +48,11 @@ export async function reportNoninteractivePersonRefreshRejection(error) {
29
48
  ...(Number.isInteger(statusCode) ? { status_code: statusCode } : {}),
30
49
  },
31
50
  });
32
- scope.setLevel("error");
51
+ scope.setLevel(expectedReauthentication ? "warning" : "error");
33
52
  scope.setFingerprint(["hq-cli", "person-refresh-rejected"]);
34
53
  scope.setTag("component", "person-session-refresh");
35
54
  scope.setTag("auth.rejection_kind", rejectionKind);
55
+ scope.setTag("auth.oauth_error", oauthError);
36
56
  scope.setTag("auth.fresh_cache_generation_found", "false");
37
57
  scope.setTag("platform", process.platform);
38
58
  scope.setTag("cli_version", CLI_VERSION);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.334.0",
3
+ "version": "5.335.0",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {