deepline 0.3.235 → 0.3.237

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
@@ -1267,7 +1267,7 @@ var SDK_RELEASE = {
1267
1267
  // getters keep their established compatibility behavior.
1268
1268
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1269
1269
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
1270
- version: "0.3.235",
1270
+ version: "0.3.237",
1271
1271
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
1272
1272
  packageCapabilities: {
1273
1273
  updatePreferences: 1
@@ -1909,6 +1909,15 @@ function describeRequestTarget(path) {
1909
1909
  }
1910
1910
  return "Deepline";
1911
1911
  }
1912
+ function networkDiagnosticUrl(value) {
1913
+ try {
1914
+ const url = new URL(value);
1915
+ if (url.protocol !== "https:" && url.protocol !== "http:") return void 0;
1916
+ return `${url.origin}${url.pathname}`;
1917
+ } catch {
1918
+ return void 0;
1919
+ }
1920
+ }
1912
1921
  function providerLabelFromToolId(toolId) {
1913
1922
  const normalized = toolId.trim().toLowerCase();
1914
1923
  const provider = normalized.split(/[_:./-]+/)[0];
@@ -2009,6 +2018,10 @@ var HttpClient = class {
2009
2018
  const baseUrl = this.config.baseUrl;
2010
2019
  const url = `${baseUrl}${path}`;
2011
2020
  const method = options?.method ?? "GET";
2021
+ const requestStartedAt = Date.now();
2022
+ let fetchAttempts = 0;
2023
+ let lastRequestUrl = url;
2024
+ let networkFailedAt;
2012
2025
  const headers = this.authHeaders(options?.headers);
2013
2026
  if (options?.body !== void 0) {
2014
2027
  headers["Content-Type"] = "application/json";
@@ -2020,6 +2033,7 @@ var HttpClient = class {
2020
2033
  requestAttempts: for (let attempt = 0; attempt <= maxRetries; attempt++) {
2021
2034
  if (options?.signal?.aborted) {
2022
2035
  lastError = requestCancelledError(options.signal);
2036
+ networkFailedAt = Date.now();
2023
2037
  break;
2024
2038
  }
2025
2039
  if (attempt > 0) {
@@ -2030,12 +2044,14 @@ var HttpClient = class {
2030
2044
  await sleep(delayMs, options?.signal);
2031
2045
  } catch (error) {
2032
2046
  lastError = error instanceof Error ? error : new Error(String(error));
2047
+ networkFailedAt = Date.now();
2033
2048
  break;
2034
2049
  }
2035
2050
  }
2036
2051
  for (const candidateUrl of candidateUrls) {
2037
2052
  if (options?.signal?.aborted) {
2038
2053
  lastError = requestCancelledError(options.signal);
2054
+ networkFailedAt = Date.now();
2039
2055
  break requestAttempts;
2040
2056
  }
2041
2057
  const controller = new AbortController();
@@ -2050,10 +2066,13 @@ var HttpClient = class {
2050
2066
  once: true
2051
2067
  });
2052
2068
  try {
2069
+ const requestBody = options?.formData !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : options?.body !== void 0 ? JSON.stringify(options.body) : void 0;
2070
+ fetchAttempts += 1;
2071
+ lastRequestUrl = candidateUrl;
2053
2072
  const response = await fetch(candidateUrl, {
2054
2073
  method,
2055
2074
  headers,
2056
- body: options?.formData !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
2075
+ body: requestBody,
2057
2076
  signal: controller.signal
2058
2077
  });
2059
2078
  options?.onResponse?.(response);
@@ -2157,6 +2176,7 @@ var HttpClient = class {
2157
2176
  return parsed;
2158
2177
  } catch (error) {
2159
2178
  clearTimeout(timeoutId);
2179
+ networkFailedAt = Date.now();
2160
2180
  if (options?.signal?.aborted) {
2161
2181
  lastError = requestCancelledError(options.signal);
2162
2182
  break requestAttempts;
@@ -2187,6 +2207,19 @@ var HttpClient = class {
2187
2207
  lastError,
2188
2208
  describeRequestTarget(path)
2189
2209
  );
2210
+ const failedAt = networkFailedAt ?? Date.now();
2211
+ const diagnosticUrl = networkDiagnosticUrl(lastRequestUrl);
2212
+ const networkDetails = {
2213
+ ...mappedNetworkError.details,
2214
+ request: {
2215
+ method,
2216
+ ...diagnosticUrl === void 0 ? {} : { url: diagnosticUrl },
2217
+ failedAtUtc: new Date(failedAt).toISOString(),
2218
+ // Elapsed time covers the entire logical request, including retries.
2219
+ elapsedMs: Math.max(0, failedAt - requestStartedAt),
2220
+ attempts: fetchAttempts
2221
+ }
2222
+ };
2190
2223
  if (options?.toolId) {
2191
2224
  const code = mappedNetworkError.code;
2192
2225
  throw withErrorCause(
@@ -2207,7 +2240,7 @@ var HttpClient = class {
2207
2240
  retryAfterMs: null,
2208
2241
  networkKind: code === "NETWORK_TIMEOUT" ? "timeout" : code === "NETWORK_ABORTED" ? "unknown" : "unavailable",
2209
2242
  networkScope: "client_to_deepline",
2210
- details: mappedNetworkError.details,
2243
+ details: networkDetails,
2211
2244
  publicDetails: options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : null
2212
2245
  }
2213
2246
  ),
@@ -2219,7 +2252,7 @@ var HttpClient = class {
2219
2252
  withCoworkNetworkHint(mappedNetworkError.message),
2220
2253
  void 0,
2221
2254
  mappedNetworkError.code,
2222
- mappedNetworkError.details
2255
+ networkDetails
2223
2256
  ),
2224
2257
  lastError
2225
2258
  );
package/dist/index.mjs CHANGED
@@ -1171,7 +1171,7 @@ var SDK_RELEASE = {
1171
1171
  // getters keep their established compatibility behavior.
1172
1172
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1173
1173
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
1174
- version: "0.3.235",
1174
+ version: "0.3.237",
1175
1175
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
1176
1176
  packageCapabilities: {
1177
1177
  updatePreferences: 1
@@ -1813,6 +1813,15 @@ function describeRequestTarget(path) {
1813
1813
  }
1814
1814
  return "Deepline";
1815
1815
  }
1816
+ function networkDiagnosticUrl(value) {
1817
+ try {
1818
+ const url = new URL(value);
1819
+ if (url.protocol !== "https:" && url.protocol !== "http:") return void 0;
1820
+ return `${url.origin}${url.pathname}`;
1821
+ } catch {
1822
+ return void 0;
1823
+ }
1824
+ }
1816
1825
  function providerLabelFromToolId(toolId) {
1817
1826
  const normalized = toolId.trim().toLowerCase();
1818
1827
  const provider = normalized.split(/[_:./-]+/)[0];
@@ -1913,6 +1922,10 @@ var HttpClient = class {
1913
1922
  const baseUrl = this.config.baseUrl;
1914
1923
  const url = `${baseUrl}${path}`;
1915
1924
  const method = options?.method ?? "GET";
1925
+ const requestStartedAt = Date.now();
1926
+ let fetchAttempts = 0;
1927
+ let lastRequestUrl = url;
1928
+ let networkFailedAt;
1916
1929
  const headers = this.authHeaders(options?.headers);
1917
1930
  if (options?.body !== void 0) {
1918
1931
  headers["Content-Type"] = "application/json";
@@ -1924,6 +1937,7 @@ var HttpClient = class {
1924
1937
  requestAttempts: for (let attempt = 0; attempt <= maxRetries; attempt++) {
1925
1938
  if (options?.signal?.aborted) {
1926
1939
  lastError = requestCancelledError(options.signal);
1940
+ networkFailedAt = Date.now();
1927
1941
  break;
1928
1942
  }
1929
1943
  if (attempt > 0) {
@@ -1934,12 +1948,14 @@ var HttpClient = class {
1934
1948
  await sleep(delayMs, options?.signal);
1935
1949
  } catch (error) {
1936
1950
  lastError = error instanceof Error ? error : new Error(String(error));
1951
+ networkFailedAt = Date.now();
1937
1952
  break;
1938
1953
  }
1939
1954
  }
1940
1955
  for (const candidateUrl of candidateUrls) {
1941
1956
  if (options?.signal?.aborted) {
1942
1957
  lastError = requestCancelledError(options.signal);
1958
+ networkFailedAt = Date.now();
1943
1959
  break requestAttempts;
1944
1960
  }
1945
1961
  const controller = new AbortController();
@@ -1954,10 +1970,13 @@ var HttpClient = class {
1954
1970
  once: true
1955
1971
  });
1956
1972
  try {
1973
+ const requestBody = options?.formData !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : options?.body !== void 0 ? JSON.stringify(options.body) : void 0;
1974
+ fetchAttempts += 1;
1975
+ lastRequestUrl = candidateUrl;
1957
1976
  const response = await fetch(candidateUrl, {
1958
1977
  method,
1959
1978
  headers,
1960
- body: options?.formData !== void 0 ? typeof options.formData === "function" ? options.formData() : options.formData : options?.body !== void 0 ? JSON.stringify(options.body) : void 0,
1979
+ body: requestBody,
1961
1980
  signal: controller.signal
1962
1981
  });
1963
1982
  options?.onResponse?.(response);
@@ -2061,6 +2080,7 @@ var HttpClient = class {
2061
2080
  return parsed;
2062
2081
  } catch (error) {
2063
2082
  clearTimeout(timeoutId);
2083
+ networkFailedAt = Date.now();
2064
2084
  if (options?.signal?.aborted) {
2065
2085
  lastError = requestCancelledError(options.signal);
2066
2086
  break requestAttempts;
@@ -2091,6 +2111,19 @@ var HttpClient = class {
2091
2111
  lastError,
2092
2112
  describeRequestTarget(path)
2093
2113
  );
2114
+ const failedAt = networkFailedAt ?? Date.now();
2115
+ const diagnosticUrl = networkDiagnosticUrl(lastRequestUrl);
2116
+ const networkDetails = {
2117
+ ...mappedNetworkError.details,
2118
+ request: {
2119
+ method,
2120
+ ...diagnosticUrl === void 0 ? {} : { url: diagnosticUrl },
2121
+ failedAtUtc: new Date(failedAt).toISOString(),
2122
+ // Elapsed time covers the entire logical request, including retries.
2123
+ elapsedMs: Math.max(0, failedAt - requestStartedAt),
2124
+ attempts: fetchAttempts
2125
+ }
2126
+ };
2094
2127
  if (options?.toolId) {
2095
2128
  const code = mappedNetworkError.code;
2096
2129
  throw withErrorCause(
@@ -2111,7 +2144,7 @@ var HttpClient = class {
2111
2144
  retryAfterMs: null,
2112
2145
  networkKind: code === "NETWORK_TIMEOUT" ? "timeout" : code === "NETWORK_ABORTED" ? "unknown" : "unavailable",
2113
2146
  networkScope: "client_to_deepline",
2114
- details: mappedNetworkError.details,
2147
+ details: networkDetails,
2115
2148
  publicDetails: options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : null
2116
2149
  }
2117
2150
  ),
@@ -2123,7 +2156,7 @@ var HttpClient = class {
2123
2156
  withCoworkNetworkHint(mappedNetworkError.message),
2124
2157
  void 0,
2125
2158
  mappedNetworkError.code,
2126
- mappedNetworkError.details
2159
+ networkDetails
2127
2160
  ),
2128
2161
  lastError
2129
2162
  );
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.235";
152
+ readonly version: "0.3.237";
153
153
  readonly updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.d.ts CHANGED
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.235";
152
+ readonly version: "0.3.237";
153
153
  readonly updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.js CHANGED
@@ -74,7 +74,7 @@ var SDK_RELEASE = {
74
74
  // getters keep their established compatibility behavior.
75
75
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
76
76
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
77
- version: "0.3.235",
77
+ version: "0.3.237",
78
78
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
79
79
  packageCapabilities: {
80
80
  updatePreferences: 1
package/dist/release.mjs CHANGED
@@ -48,7 +48,7 @@ var SDK_RELEASE = {
48
48
  // getters keep their established compatibility behavior.
49
49
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
50
50
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
51
- version: "0.3.235",
51
+ version: "0.3.237",
52
52
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
53
53
  packageCapabilities: {
54
54
  updatePreferences: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.235",
3
+ "version": "0.3.237",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",