@sentry/junior 0.25.0 → 0.26.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/dist/app.js CHANGED
@@ -6644,7 +6644,7 @@ function createWebFetchTool(hooks) {
6644
6644
  import { generateText } from "ai";
6645
6645
  import { createGatewayProvider } from "@ai-sdk/gateway";
6646
6646
  import { Type as Type14 } from "@sinclair/typebox";
6647
- var SEARCH_TIMEOUT_MS = 1e4;
6647
+ var SEARCH_TIMEOUT_MS = 6e4;
6648
6648
  var MAX_RESULTS = 5;
6649
6649
  var DEFAULT_SEARCH_MODEL = "xai/grok-4-fast-reasoning";
6650
6650
  var SEARCH_TOOL_NAME = "parallelSearch";
@@ -6676,21 +6676,13 @@ function parseSearchResults(toolResults, maxResults) {
6676
6676
  return parsedResults;
6677
6677
  }
6678
6678
  function formatSearchFailure(error) {
6679
- if (error instanceof Error) {
6680
- const message = error.message.trim();
6681
- if (message) {
6682
- return `web search failed: ${message}`;
6683
- }
6684
- }
6685
- return "web search failed";
6679
+ const message = error instanceof Error ? error.message.trim() : "";
6680
+ return message ? `web search failed: ${message}` : "web search failed";
6686
6681
  }
6687
- function isNonRetryableSearchFailure(message) {
6682
+ function isAuthFailure(message) {
6688
6683
  const normalized = message.toLowerCase();
6689
6684
  return normalized.includes("missing ai gateway credentials") || normalized.includes("authentication failed");
6690
6685
  }
6691
- function isTimeoutSearchFailure(message) {
6692
- return /timed out/i.test(message);
6693
- }
6694
6686
  function createWebSearchTool() {
6695
6687
  return tool({
6696
6688
  description: "Search public web sources and return top snippets/URLs. Use when you need discovery or source candidates. Do not use when the user already provided a specific URL to inspect.",
@@ -6710,30 +6702,21 @@ function createWebSearchTool() {
6710
6702
  }),
6711
6703
  execute: async ({ query, max_results }) => {
6712
6704
  const maxResults = max_results ?? 3;
6705
+ const model = process.env.AI_WEB_SEARCH_MODEL ?? DEFAULT_SEARCH_MODEL;
6713
6706
  try {
6714
- const model = process.env.AI_WEB_SEARCH_MODEL ?? process.env.AI_FAST_MODEL ?? process.env.AI_MODEL ?? DEFAULT_SEARCH_MODEL;
6715
6707
  const provider = createGatewayProvider();
6716
6708
  const response = await withTimeout(
6717
- (async () => {
6718
- try {
6719
- return await generateText({
6720
- model: provider.chat(model),
6721
- prompt: query,
6722
- tools: {
6723
- [SEARCH_TOOL_NAME]: provider.tools.parallelSearch({
6724
- mode: "agentic",
6725
- maxResults
6726
- })
6727
- },
6728
- toolChoice: {
6729
- type: "tool",
6730
- toolName: SEARCH_TOOL_NAME
6731
- }
6732
- });
6733
- } catch (error) {
6734
- throw new Error(formatSearchFailure(error));
6735
- }
6736
- })(),
6709
+ generateText({
6710
+ model: provider.chat(model),
6711
+ prompt: query,
6712
+ tools: {
6713
+ [SEARCH_TOOL_NAME]: provider.tools.parallelSearch({
6714
+ mode: "agentic",
6715
+ maxResults
6716
+ })
6717
+ },
6718
+ toolChoice: { type: "tool", toolName: SEARCH_TOOL_NAME }
6719
+ }),
6737
6720
  SEARCH_TIMEOUT_MS,
6738
6721
  "webSearch"
6739
6722
  );
@@ -6747,14 +6730,28 @@ function createWebSearchTool() {
6747
6730
  };
6748
6731
  } catch (error) {
6749
6732
  const message = formatSearchFailure(error);
6733
+ const timeout = /timed out/i.test(message);
6734
+ const retryable = !isAuthFailure(message);
6735
+ logException(
6736
+ error,
6737
+ "web_search_failed",
6738
+ {},
6739
+ {
6740
+ "gen_ai.tool.name": "webSearch",
6741
+ "app.web_search.timeout": timeout,
6742
+ "app.web_search.retryable": retryable,
6743
+ "app.web_search.query": query
6744
+ },
6745
+ message
6746
+ );
6750
6747
  return {
6751
6748
  ok: false,
6752
6749
  query,
6753
6750
  result_count: 0,
6754
6751
  results: [],
6755
6752
  error: message,
6756
- timeout: isTimeoutSearchFailure(message),
6757
- retryable: !isNonRetryableSearchFailure(message)
6753
+ timeout,
6754
+ retryable
6758
6755
  };
6759
6756
  }
6760
6757
  }
package/dist/cli/init.js CHANGED
@@ -144,6 +144,7 @@ JUNIOR_BOT_NAME=
144
144
  AI_MODEL=
145
145
  AI_FAST_MODEL=
146
146
  AI_VISION_MODEL=
147
+ AI_WEB_SEARCH_MODEL=
147
148
  REDIS_URL=
148
149
  SENTRY_DSN=
149
150
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"