pi-cursor-sdk 0.1.35 → 0.1.36

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,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.36 - 2026-06-05
6
+
7
+ ### Fixed
8
+
9
+ - Classify Cursor backend `ConnectError: [unavailable] Error` failures with code 14 and `aiserver.v1.ErrorDetails` as recoverable network/service errors, preventing duplicate process-level uncaught exceptions from crashing pi while still surfacing scrubbed retry guidance.
10
+
5
11
  ## 0.1.35 - 2026-06-05
6
12
 
7
13
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cursor-sdk",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "pi provider extension backed by @cursor/sdk local agents",
5
5
  "author": "Mitch Fultz (https://github.com/fitchmultz)",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@ const GENERIC_CURSOR_SDK_ERROR_MESSAGE =
9
9
  const AUTH_CURSOR_SDK_ERROR_MESSAGE =
10
10
  "Cursor SDK request failed because the Cursor SDK API key may be invalid or unauthorized. Cursor Agent CLI/Desktop login is not reused. Run /login -> Use an API key -> Cursor, verify CURSOR_API_KEY, or pass --api-key, then retry.";
11
11
  const NETWORK_CURSOR_SDK_ERROR_MESSAGE =
12
- "Cursor SDK request timed out during network I/O. Check your connection and retry; if this keeps happening, try again later or verify Cursor service availability.";
12
+ "Cursor SDK request failed during network or service I/O. Check your connection and retry; if this keeps happening, try again later or verify Cursor service availability.";
13
13
 
14
14
  const GENERIC_CURSOR_RUN_FAILURE_TEXT = "cursor sdk run failed";
15
15
 
@@ -47,6 +47,10 @@ function isUnauthenticatedConnectCode(code: unknown): boolean {
47
47
  return code === 16 || (typeof code === "string" && /^(?:16|unauthenticated)$/i.test(code));
48
48
  }
49
49
 
50
+ function isUnavailableConnectCode(code: unknown): boolean {
51
+ return code === 14 || (typeof code === "string" && /^(?:14|unavailable)$/i.test(code));
52
+ }
53
+
50
54
  function isCursorExtensionConnectStack(stack: string): boolean {
51
55
  return stack.includes("@connectrpc/connect-node") && /(?:^|[\\/])pi-cursor-sdk(?:[\\/]|$)/.test(stack);
52
56
  }
@@ -101,6 +105,10 @@ export function classifyCursorConnectError(error: unknown): CursorConnectErrorCl
101
105
  return { kind: "unauthenticated", source: getCursorConnectSource(error, record) };
102
106
  }
103
107
 
108
+ if (isUnavailableConnectCode(code)) {
109
+ return { kind: "network", source: getCursorConnectSource(error, record) };
110
+ }
111
+
104
112
  const causeCode = getErrorStringField(cause, "code");
105
113
  const causeSyscall = getErrorStringField(cause, "syscall");
106
114
  if (isLikelyNetworkTimeout(`${message}\n${rawMessage}\n${causeCode ?? ""}\n${causeSyscall ?? ""}`)) {
@@ -179,8 +187,9 @@ export function sanitizeCursorProviderError(error: unknown, apiKey?: string): st
179
187
  const message = error instanceof Error ? error.message : typeof error === "string" ? error : "";
180
188
  if (message === MISSING_CURSOR_API_KEY_MESSAGE) return MISSING_CURSOR_API_KEY_MESSAGE;
181
189
  const scrubbed = scrubSensitiveText(message, apiKey).trim();
182
- if (isUnauthenticatedConnectError(error) || isLikelyAuthError(scrubbed)) return AUTH_CURSOR_SDK_ERROR_MESSAGE;
190
+ const connectClassification = classifyCursorConnectError(error);
191
+ if (connectClassification?.kind === "unauthenticated" || isLikelyAuthError(scrubbed)) return AUTH_CURSOR_SDK_ERROR_MESSAGE;
192
+ if (connectClassification?.kind === "network" || isLikelyNetworkTimeout(scrubbed)) return NETWORK_CURSOR_SDK_ERROR_MESSAGE;
183
193
  if (isGenericErrorMessage(scrubbed)) return GENERIC_CURSOR_SDK_ERROR_MESSAGE;
184
- if (isLikelyNetworkTimeout(scrubbed)) return NETWORK_CURSOR_SDK_ERROR_MESSAGE;
185
194
  return scrubbed || GENERIC_CURSOR_SDK_ERROR_MESSAGE;
186
195
  }