@memberjunction/core-actions 6.1.3 → 6.2.0-edge.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.
Files changed (31) hide show
  1. package/dist/config.d.ts +68 -10
  2. package/dist/config.d.ts.map +1 -1
  3. package/dist/config.js +32 -5
  4. package/dist/config.js.map +1 -1
  5. package/dist/custom/ai/generate-image.action.d.ts +13 -1
  6. package/dist/custom/ai/generate-image.action.d.ts.map +1 -1
  7. package/dist/custom/ai/generate-image.action.js +25 -13
  8. package/dist/custom/ai/generate-image.action.js.map +1 -1
  9. package/dist/custom/utilities/base-file-handler.d.ts.map +1 -1
  10. package/dist/custom/utilities/base-file-handler.js +4 -2
  11. package/dist/custom/utilities/base-file-handler.js.map +1 -1
  12. package/dist/custom/web/brave-search.action.d.ts +108 -0
  13. package/dist/custom/web/brave-search.action.d.ts.map +1 -0
  14. package/dist/custom/web/brave-search.action.js +285 -0
  15. package/dist/custom/web/brave-search.action.js.map +1 -0
  16. package/dist/custom/web/perplexity-search.action.d.ts +76 -44
  17. package/dist/custom/web/perplexity-search.action.d.ts.map +1 -1
  18. package/dist/custom/web/perplexity-search.action.js +228 -157
  19. package/dist/custom/web/perplexity-search.action.js.map +1 -1
  20. package/dist/custom/web/rss-feed-read.action.d.ts.map +1 -1
  21. package/dist/custom/web/rss-feed-read.action.js +4 -1
  22. package/dist/custom/web/rss-feed-read.action.js.map +1 -1
  23. package/dist/custom/web/web-search.action.d.ts +56 -40
  24. package/dist/custom/web/web-search.action.d.ts.map +1 -1
  25. package/dist/custom/web/web-search.action.js +141 -413
  26. package/dist/custom/web/web-search.action.js.map +1 -1
  27. package/dist/index.d.ts +1 -0
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -0
  30. package/dist/index.js.map +1 -1
  31. package/package.json +40 -39
@@ -4,454 +4,182 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var WebSearchAction_1;
7
8
  import { BaseAction } from "@memberjunction/actions";
8
9
  import { RegisterClass } from "@memberjunction/global";
9
- import { getDuckDuckGoRateLimiter } from "./duckduckgo-rate-limiter.js";
10
+ import { WebSearchEngine, } from "@memberjunction/web-search-engine";
10
11
  /**
11
- * Action that performs web search using DuckDuckGo's Instant Answer API
12
- * Returns search results with titles, URLs, and snippets
12
+ * Action that performs a web search through whichever provider the administrator has configured.
13
+ *
14
+ * This is the **provider-neutral entry point** agents should bind to. It holds no vendor logic of
15
+ * its own: it extracts parameters, hands them to {@link WebSearchEngine}, and maps the result
16
+ * back. Which vendor actually serves the request — Brave, Tavily, Perplexity, or a fallback when
17
+ * the first choice is rate-limited — is decided by the `MJ: Web Search Providers` records and
18
+ * their `Priority`, not by the caller and not by the agent.
19
+ *
20
+ * That is the point. An LLM choosing between named vendor actions is making an infrastructure
21
+ * decision it has no information for: it cannot know which key is configured, which is cheaper,
22
+ * or which is rate-limited right now. Swapping vendors here is a metadata edit, with no change to
23
+ * any agent.
24
+ *
25
+ * `Provider` is the escape hatch for a caller who genuinely knows better. When set, the engine
26
+ * **fails rather than substituting** — a silent substitution is how you discover months later
27
+ * that a deliberate choice stopped being honoured.
13
28
  *
14
29
  * @example
15
30
  * ```typescript
16
- * // Basic web search
31
+ * // Let the administrator's priority order decide
32
+ * await runAction({
33
+ * ActionName: 'Web Search',
34
+ * Params: [{ Name: 'Query', Value: 'association management trends' }]
35
+ * });
36
+ *
37
+ * // Recent results from two domains, with a synthesized answer
17
38
  * await runAction({
18
39
  * ActionName: 'Web Search',
19
- * Params: [{
20
- * Name: 'SearchTerms',
21
- * Value: 'TypeScript programming'
22
- * }]
40
+ * Params: [
41
+ * { Name: 'Query', Value: 'IRS Form 990 filing changes' },
42
+ * { Name: 'Freshness', Value: 'month' },
43
+ * { Name: 'IncludeDomains', Value: ['irs.gov', 'councilofnonprofits.org'] },
44
+ * { Name: 'IncludeAnswer', Value: true }
45
+ * ]
23
46
  * });
24
47
  *
25
- * // Search with custom result count
48
+ * // Pin one vendor — fails if it is not available rather than using another
26
49
  * await runAction({
27
50
  * ActionName: 'Web Search',
28
- * Params: [{
29
- * Name: 'SearchTerms',
30
- * Value: 'machine learning tutorials'
31
- * }, {
32
- * Name: 'MaxResults',
33
- * Value: 15
34
- * }]
51
+ * Params: [
52
+ * { Name: 'Query', Value: 'quantum error correction 2026' },
53
+ * { Name: 'Provider', Value: 'Brave' }
54
+ * ]
35
55
  * });
36
56
  * ```
37
57
  */
38
58
  let WebSearchAction = class WebSearchAction extends BaseAction {
59
+ static { WebSearchAction_1 = this; }
60
+ static { this.FRESHNESS_WINDOWS = ['day', 'week', 'month', 'year']; }
61
+ static { this.SAFE_SEARCH_VALUES = ['off', 'moderate', 'strict']; }
39
62
  /**
40
- * Executes the web search using DuckDuckGo's API
63
+ * Executes the search.
41
64
  *
42
65
  * @param params - The action parameters containing:
43
- * - SearchTerms: Keywords to search for (required)
44
- * - MaxResults: Maximum number of results to return (default: 10, max: 30)
45
- * - Region: Regional search preference (default: 'us-en')
46
- * - SafeSearch: Safe search level - 'strict', 'moderate', 'off' (default: 'moderate')
47
- * - DisableQueueing: If true, fails immediately when rate limited instead of queueing (default: false)
66
+ * - Query: Search query text (required)
67
+ * - MaxResults: Desired result count, clamped to the serving provider's cap (default 10)
68
+ * - Provider: Pin to one provider by Name or DriverClass. Fails if unavailable
69
+ * - IncludeDomains / ExcludeDomains: Array or comma-separated domain lists
70
+ * - Freshness: 'day' | 'week' | 'month' | 'year'
71
+ * - Country: Two-letter country code, e.g. 'US'
72
+ * - Language: Language code, e.g. 'en'
73
+ * - SafeSearch: 'off' | 'moderate' | 'strict' (default 'moderate')
74
+ * - IncludeAnswer: Also return a synthesized answer, restricting provider selection
48
75
  *
49
- * @returns Web search results with titles, URLs, and snippets
76
+ * @returns Normalised results plus which provider served them
50
77
  */
51
78
  async InternalRunAction(params) {
52
- try {
53
- const searchTermsParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'searchterms');
54
- const maxResultsParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'maxresults');
55
- const regionParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'region');
56
- const safeSearchParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'safesearch');
57
- const disableQueueingParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'disablequeueing');
58
- if (!searchTermsParam || !searchTermsParam.Value) {
59
- return {
60
- Success: false,
61
- Message: "SearchTerms parameter is required",
62
- ResultCode: "MISSING_PARAMETERS"
63
- };
64
- }
65
- const searchTerms = searchTermsParam.Value.toString().trim();
66
- const maxResults = Math.min(parseInt(maxResultsParam?.Value?.toString() || '10'), 30);
67
- const region = regionParam?.Value?.toString() || 'us-en';
68
- const safeSearch = safeSearchParam?.Value?.toString() || 'moderate';
69
- const disableQueueing = disableQueueingParam?.Value?.toString()?.toLowerCase() === 'true';
70
- if (searchTerms.length === 0) {
71
- return {
72
- Success: false,
73
- Message: "SearchTerms cannot be empty",
74
- ResultCode: "INVALID_PARAMETERS"
75
- };
76
- }
77
- // Get the rate limiter instance
78
- const rateLimiter = getDuckDuckGoRateLimiter();
79
- // Try DuckDuckGo Instant Answer API first (JSON response)
80
- let response;
81
- let html = '';
82
- let useInstantAPI = true;
83
- try {
84
- // Try the Instant Answer API first (more reliable)
85
- const instantUrl = `https://api.duckduckgo.com/?q=${encodeURIComponent(searchTerms)}&format=json&no_html=1&skip_disambig=1`;
86
- const searchRequest = {
87
- url: instantUrl,
88
- options: {
89
- headers: {
90
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
91
- }
92
- },
93
- disableQueueing
94
- };
95
- const result = await rateLimiter.search(searchRequest);
96
- response = result.response;
97
- if (response.ok) {
98
- const jsonData = result.text;
99
- const instantResults = this.parseInstantResults(jsonData, maxResults);
100
- if (instantResults.length > 0) {
101
- const resultData = {
102
- searchTerms,
103
- totalResults: instantResults.length,
104
- maxResults,
105
- region,
106
- safeSearch,
107
- results: instantResults,
108
- searchUrl: `https://duckduckgo.com/?q=${encodeURIComponent(searchTerms)}`,
109
- method: 'instant-api'
110
- };
111
- return {
112
- Success: true,
113
- ResultCode: "SUCCESS",
114
- Message: JSON.stringify(resultData, null, 2)
115
- };
116
- }
117
- }
118
- }
119
- catch (error) {
120
- // Instant API failed, fall back to HTML scraping
121
- useInstantAPI = false;
122
- }
123
- // Fallback to HTML search with more realistic headers
124
- const searchUrl = `https://duckduckgo.com/html/?q=${encodeURIComponent(searchTerms)}&kl=${region}`;
125
- const htmlSearchRequest = {
126
- url: searchUrl,
127
- options: {
128
- method: 'GET',
129
- headers: {
130
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
131
- 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
132
- 'Accept-Language': 'en-US,en;q=0.5',
133
- 'Accept-Encoding': 'gzip, deflate, br',
134
- 'DNT': '1',
135
- 'Connection': 'keep-alive',
136
- 'Upgrade-Insecure-Requests': '1'
137
- }
138
- },
139
- disableQueueing
140
- };
141
- const htmlResult = await rateLimiter.search(htmlSearchRequest);
142
- response = htmlResult.response;
143
- html = htmlResult.text;
144
- if (!response.ok) {
145
- return {
146
- Success: false,
147
- Message: `DuckDuckGo search failed: ${response.status} ${response.statusText}`,
148
- ResultCode: "SEARCH_FAILED"
149
- };
150
- }
151
- // Check if we got an empty or invalid response
152
- if (!html || html.length < 1000 || !html.includes('result')) {
153
- return {
154
- Success: false,
155
- Message: "DuckDuckGo returned empty or invalid response. This may be due to rate limiting or anti-bot measures.",
156
- ResultCode: "EMPTY_RESPONSE"
157
- };
158
- }
159
- const results = this.parseSearchResults(html, maxResults);
160
- if (results.length === 0) {
161
- return {
162
- Success: false,
163
- Message: "No search results found in response",
164
- ResultCode: "NO_RESULTS"
165
- };
166
- }
167
- const resultData = {
168
- searchTerms,
169
- totalResults: results.length,
170
- maxResults,
171
- region,
172
- safeSearch,
173
- results,
174
- searchUrl: `https://duckduckgo.com/?q=${encodeURIComponent(searchTerms)}`,
175
- method: 'html-scraping'
176
- };
177
- // add output props as well to make it easier to use in flows
178
- params.Params.push({
179
- Name: 'SearchResultsDetails',
180
- Value: resultData,
181
- Type: "Output"
182
- });
183
- params.Params.push({
184
- Name: 'SearchUrl',
185
- Value: resultData.searchUrl,
186
- Type: "Output"
187
- });
188
- params.Params.push({
189
- Name: 'SearchResults',
190
- Value: results,
191
- Type: "Output"
192
- });
193
- params.Params.push({
194
- Name: 'SearchResultsCount',
195
- Value: results.length,
196
- Type: "Output"
197
- });
198
- // and finally share the first result as well
199
- if (results.length > 0) {
200
- params.Params.push({
201
- Name: 'FirstSearchResult',
202
- Value: results[0],
203
- Type: "Output"
204
- });
205
- }
206
- return {
207
- Success: true,
208
- ResultCode: "SUCCESS",
209
- Message: JSON.stringify(resultData, null, 2)
210
- };
79
+ const query = this.getStringParam(params, 'query') || this.getStringParam(params, 'searchterms');
80
+ if (!query) {
81
+ return this.createErrorResult("Query parameter is required", "MISSING_QUERY");
211
82
  }
212
- catch (error) {
213
- const errorMessage = error instanceof Error ? error.message : String(error);
214
- // Check if it's a rate limit error with queueing disabled
215
- if (errorMessage.includes('Rate limiting active and queueing is disabled') ||
216
- errorMessage.includes('Rate limited and queueing is disabled')) {
217
- return {
218
- Success: false,
219
- Message: "DuckDuckGo rate limit reached. Queueing is disabled for this request.",
220
- ResultCode: "RATE_LIMITED"
221
- };
222
- }
223
- return {
224
- Success: false,
225
- Message: `Failed to perform web search: ${errorMessage}`,
226
- ResultCode: "FAILED"
227
- };
83
+ const freshness = this.getStringParam(params, 'freshness')?.toLowerCase();
84
+ if (freshness && !WebSearchAction_1.FRESHNESS_WINDOWS.includes(freshness)) {
85
+ return this.createErrorResult(`Freshness must be one of ${WebSearchAction_1.FRESHNESS_WINDOWS.join(', ')} (got '${freshness}')`, "INVALID_FRESHNESS");
228
86
  }
229
- }
230
- /**
231
- * Parses DuckDuckGo Instant Answer API JSON response
232
- */
233
- parseInstantResults(jsonData, maxResults) {
234
- const results = [];
235
- try {
236
- const data = JSON.parse(jsonData);
237
- // Handle abstract (summary) if available
238
- if (data.Abstract && data.AbstractText) {
239
- results.push({
240
- title: data.Heading || 'Summary',
241
- url: data.AbstractURL || '',
242
- displayUrl: data.AbstractSource || '',
243
- snippet: data.AbstractText,
244
- rank: 1,
245
- type: 'abstract'
246
- });
247
- }
248
- // Handle related topics
249
- if (data.RelatedTopics && Array.isArray(data.RelatedTopics)) {
250
- let rank = results.length + 1;
251
- for (const topic of data.RelatedTopics.slice(0, maxResults - results.length)) {
252
- if (topic.FirstURL && topic.Text) {
253
- results.push({
254
- title: topic.Text.split(' - ')[0] || 'Related Topic',
255
- url: topic.FirstURL,
256
- displayUrl: this.extractDomain(topic.FirstURL),
257
- snippet: topic.Text,
258
- rank: rank++,
259
- type: 'related'
260
- });
261
- }
262
- }
263
- }
264
- // Handle definition if available
265
- if (data.Definition && data.DefinitionURL) {
266
- results.push({
267
- title: `Definition: ${data.Heading || 'Term'}`,
268
- url: data.DefinitionURL,
269
- displayUrl: data.DefinitionSource || '',
270
- snippet: data.Definition,
271
- rank: results.length + 1,
272
- type: 'definition'
273
- });
274
- }
275
- // Handle answer if available
276
- if (data.Answer) {
277
- results.push({
278
- title: 'Direct Answer',
279
- url: '',
280
- displayUrl: 'DuckDuckGo',
281
- snippet: data.Answer,
282
- rank: results.length + 1,
283
- type: 'answer'
284
- });
285
- }
87
+ const safeSearch = this.getStringParam(params, 'safesearch')?.toLowerCase();
88
+ if (safeSearch && !WebSearchAction_1.SAFE_SEARCH_VALUES.includes(safeSearch)) {
89
+ return this.createErrorResult(`SafeSearch must be one of ${WebSearchAction_1.SAFE_SEARCH_VALUES.join(', ')} (got '${safeSearch}')`, "INVALID_SAFESEARCH");
286
90
  }
287
- catch (error) {
288
- console.error('Error parsing instant results:', error);
91
+ const searchParams = {
92
+ Query: query,
93
+ MaxResults: this.getOptionalNumericParam(params, 'maxresults'),
94
+ Provider: this.getStringParam(params, 'provider'),
95
+ IncludeDomains: this.getStringArrayParam(params, 'includedomains'),
96
+ ExcludeDomains: this.getStringArrayParam(params, 'excludedomains'),
97
+ Freshness: freshness,
98
+ Country: this.getStringParam(params, 'country'),
99
+ Language: this.getStringParam(params, 'language'),
100
+ SafeSearch: safeSearch,
101
+ IncludeAnswer: this.getBooleanParam(params, 'includeanswer', false),
102
+ };
103
+ const engine = WebSearchEngine.Instance;
104
+ await engine.Config(false, params.ContextUser);
105
+ const result = await engine.Search(searchParams, params.ContextUser);
106
+ // Attempts are emitted on both paths. When a fallback served the request, that is the
107
+ // only thing that says so — and it is worth knowing before the invoice does.
108
+ this.addOutputParam(params, 'Attempts', result.Attempts);
109
+ if (!result.Success) {
110
+ return this.createErrorResult(result.ErrorMessage ?? 'Web search failed.', result.ResultCode);
289
111
  }
290
- return results.slice(0, maxResults);
291
- }
292
- /**
293
- * Extracts domain from URL
294
- */
295
- extractDomain(url) {
296
- try {
297
- return new URL(url).hostname;
298
- }
299
- catch {
300
- return url;
112
+ this.addOutputParam(params, 'Results', result.Hits);
113
+ this.addOutputParam(params, 'ResultCount', result.Hits.length);
114
+ this.addOutputParam(params, 'ProviderUsed', result.ProviderUsed);
115
+ if (result.Answer) {
116
+ this.addOutputParam(params, 'Answer', result.Answer);
301
117
  }
118
+ this.addOutputParam(params, 'SearchResultDetails', {
119
+ query,
120
+ providerUsed: result.ProviderUsed,
121
+ resultCount: result.Hits.length,
122
+ results: result.Hits,
123
+ answer: result.Answer,
124
+ attempts: result.Attempts,
125
+ });
126
+ // Zero results is a real answer to a narrow query, not a failure — a caller that treats
127
+ // it as one would retry a query that will keep returning nothing.
128
+ return {
129
+ Success: true,
130
+ ResultCode: "SUCCESS",
131
+ Message: result.Hits.length === 0
132
+ ? `${result.ProviderUsed} returned no results for '${query}'.`
133
+ : `${result.ProviderUsed} returned ${result.Hits.length} result(s) for '${query}'.`
134
+ };
302
135
  }
303
- /**
304
- * Parses DuckDuckGo HTML search results
305
- */
306
- parseSearchResults(html, maxResults) {
307
- const results = [];
308
- try {
309
- // Improved regex patterns for DuckDuckGo HTML structure
310
- // DuckDuckGo uses different class names, try multiple patterns
311
- const resultPatterns = [
312
- // Standard result pattern
313
- /<div class="[^"]*result[^"]*"[^>]*>(.*?)<\/div>/gs,
314
- // Alternative result pattern
315
- /<div[^>]+data-testid="result"[^>]*>(.*?)<\/div>/gs,
316
- // Links result pattern
317
- /<div class="[^"]*links_main[^"]*"[^>]*>(.*?)<\/div>/gs
318
- ];
319
- const linkPatterns = [
320
- /<a[^>]+href="([^"]+)"[^>]*class="[^"]*result__a[^"]*"[^>]*>(.*?)<\/a>/s,
321
- /<a[^>]+href="([^"]+)"[^>]*>(.*?)<\/a>/s
322
- ];
323
- const snippetPatterns = [
324
- /<a[^>]+class="[^"]*result__snippet[^"]*"[^>]*>(.*?)<\/a>/s,
325
- /<span class="[^"]*result__snippet[^"]*"[^>]*>(.*?)<\/span>/s,
326
- /<div class="[^"]*snippet[^"]*"[^>]*>(.*?)<\/div>/s
327
- ];
328
- const urlDisplayPatterns = [
329
- /<span class="[^"]*result__url[^"]*"[^>]*>(.*?)<\/span>/s,
330
- /<cite[^>]*>(.*?)<\/cite>/s
331
- ];
332
- let count = 0;
333
- // Try each result pattern until we find matches
334
- for (const resultPattern of resultPatterns) {
335
- if (count >= maxResults)
336
- break;
337
- // ── Slice between result STARTS, rather than trusting `(.*?)</div>` ──────────────
338
- // Each pattern's capture group is non-greedy up to the first `</div>`, and a
339
- // DuckDuckGo result block contains nested divs. The link sits near the top of the
340
- // block and survived; the SNIPPET sits after an inner div and was therefore cut out
341
- // of the captured text on every single result. The symptom was ten hits with real
342
- // titles and URLs and `snippet: ''` throughout — search results that look fine and
343
- // carry no information, which a caller cannot distinguish from a topic with nothing
344
- // written about it. A Content Pipeline draft correctly reported "the research data
345
- // was empty" and got overruled by a reviewer counting sources.
346
- //
347
- // Slicing from one block's start to the next captures the whole block, nesting and
348
- // all, without trying to balance tags with a regular expression.
349
- const starts = [];
350
- const startRegex = new RegExp(resultPattern.source, resultPattern.flags);
351
- let startMatch;
352
- while ((startMatch = startRegex.exec(html)) !== null) {
353
- starts.push(startMatch.index);
354
- if (startMatch.index === startRegex.lastIndex)
355
- startRegex.lastIndex++; // zero-width guard
356
- }
357
- for (let i = 0; i < starts.length && count < maxResults; i++) {
358
- const resultHtml = html.slice(starts[i], starts[i + 1] ?? html.length);
359
- // Try each link pattern
360
- let linkMatch = null;
361
- for (const linkPattern of linkPatterns) {
362
- linkMatch = linkPattern.exec(resultHtml);
363
- if (linkMatch)
364
- break;
365
- }
366
- if (linkMatch) {
367
- const url = this.decodeUrl(linkMatch[1]);
368
- const title = this.stripHtml(linkMatch[2]);
369
- // Try each snippet pattern
370
- let snippetMatch = null;
371
- for (const snippetPattern of snippetPatterns) {
372
- snippetMatch = snippetPattern.exec(resultHtml);
373
- if (snippetMatch)
374
- break;
375
- }
376
- const snippet = snippetMatch ? this.stripHtml(snippetMatch[1]) : '';
377
- // Try each URL display pattern
378
- let urlDisplayMatch = null;
379
- for (const urlDisplayPattern of urlDisplayPatterns) {
380
- urlDisplayMatch = urlDisplayPattern.exec(resultHtml);
381
- if (urlDisplayMatch)
382
- break;
383
- }
384
- const displayUrl = urlDisplayMatch ? this.stripHtml(urlDisplayMatch[1]) : this.extractDomain(url);
385
- if (url && title && (url.startsWith('http') || url.startsWith('//'))) {
386
- // Clean up URL
387
- const cleanUrl = url.startsWith('//') ? 'https:' + url : url;
388
- results.push({
389
- title: title.trim(),
390
- url: cleanUrl.trim(),
391
- displayUrl: displayUrl.trim(),
392
- snippet: snippet.trim(),
393
- rank: count + 1,
394
- type: 'web'
395
- });
396
- count++;
397
- }
398
- }
399
- }
400
- // If we found results with this pattern, don't try others
401
- if (results.length > 0)
402
- break;
403
- }
404
- // Results with no text are not results. If the markup shifts again and every snippet
405
- // comes back empty, that must be LOUD: the failure is otherwise invisible — the caller
406
- // receives the expected number of well-formed objects and no indication that the only
407
- // field carrying meaning is blank. Reported rather than thrown, because titles and URLs
408
- // are still genuinely useful and discarding them would be a worse answer than a noisy one.
409
- if (results.length > 0 && results.every((r) => !r.snippet)) {
410
- console.warn(`[Web Search] Parsed ${results.length} result(s) and EVERY snippet is empty. The ` +
411
- `result markup has almost certainly changed — callers are getting titles and URLs ` +
412
- `with no content, which reads as "nothing was written about this topic".`);
413
- }
414
- }
415
- catch (error) {
416
- console.error('Error parsing search results:', error);
417
- }
418
- return results;
136
+ getStringParam(params, paramName) {
137
+ const param = params.Params.find(p => p.Name.trim().toLowerCase() === paramName.toLowerCase());
138
+ if (param?.Value === undefined || param?.Value === null)
139
+ return undefined;
140
+ const value = String(param.Value).trim();
141
+ return value.length > 0 ? value : undefined;
419
142
  }
420
- /**
421
- * Decodes DuckDuckGo URL redirects
422
- */
423
- decodeUrl(encodedUrl) {
424
- try {
425
- if (encodedUrl.includes('uddg=')) {
426
- const urlMatch = encodedUrl.match(/uddg=([^&]+)/);
427
- if (urlMatch) {
428
- return decodeURIComponent(urlMatch[1]);
429
- }
430
- }
431
- return encodedUrl;
432
- }
433
- catch {
434
- return encodedUrl;
435
- }
143
+ getBooleanParam(params, paramName, defaultValue) {
144
+ const param = params.Params.find(p => p.Name.trim().toLowerCase() === paramName.toLowerCase());
145
+ if (param?.Value === undefined || param?.Value === null)
146
+ return defaultValue;
147
+ if (typeof param.Value === 'boolean')
148
+ return param.Value;
149
+ return String(param.Value).trim().toLowerCase() === 'true';
150
+ }
151
+ getOptionalNumericParam(params, paramName) {
152
+ const param = params.Params.find(p => p.Name.trim().toLowerCase() === paramName.toLowerCase());
153
+ if (param?.Value === undefined || param?.Value === null || param.Value === '')
154
+ return undefined;
155
+ const num = Number(param.Value);
156
+ return isNaN(num) ? undefined : num;
436
157
  }
437
158
  /**
438
- * Strips HTML tags and decodes entities
159
+ * A list param, accepted as a real array or as a comma-separated string — both forms arrive
160
+ * in practice, from agent input mappings and from humans respectively.
439
161
  */
440
- stripHtml(html) {
441
- return html
442
- .replace(/<[^>]*>/g, '') // Remove HTML tags
443
- .replace(/&amp;/g, '&')
444
- .replace(/&lt;/g, '<')
445
- .replace(/&gt;/g, '>')
446
- .replace(/&quot;/g, '"')
447
- .replace(/&#39;/g, "'")
448
- .replace(/&nbsp;/g, ' ')
449
- .replace(/\s+/g, ' ') // Normalize whitespace
450
- .trim();
162
+ getStringArrayParam(params, paramName) {
163
+ const param = params.Params.find(p => p.Name.trim().toLowerCase() === paramName.toLowerCase());
164
+ const value = param?.Value;
165
+ if (value === undefined || value === null)
166
+ return undefined;
167
+ const raw = Array.isArray(value) ? value.map(v => String(v)) : String(value).split(',');
168
+ const cleaned = raw.map(v => v.trim()).filter(v => v.length > 0);
169
+ return cleaned.length > 0 ? cleaned : undefined;
170
+ }
171
+ addOutputParam(params, name, value) {
172
+ params.Params.push({ Name: name, Type: 'Output', Value: value });
173
+ }
174
+ createErrorResult(message, code) {
175
+ return { Success: false, Message: message, ResultCode: code };
451
176
  }
452
177
  };
453
- WebSearchAction = __decorate([
178
+ WebSearchAction = WebSearchAction_1 = __decorate([
454
179
  RegisterClass(BaseAction, "__WebSearch")
455
180
  ], WebSearchAction);
456
181
  export { WebSearchAction };
182
+ export function LoadWebSearchAction() {
183
+ // Referenced by consumers to keep this registration from being tree-shaken.
184
+ }
457
185
  //# sourceMappingURL=web-search.action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-search.action.js","sourceRoot":"","sources":["../../../src/custom/web/web-search.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,w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E,IAAY,EAAE,KAAc;QACxE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACrE,CAAC;IAEO,iBAAiB,CAAC,OAAe,EAAE,IAAY;QACnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAClE,CAAC;;AAxIQ,eAAe;IAD3B,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC;GAC5B,eAAe,CAyI3B;;AAED,MAAM,UAAU,mBAAmB;IAC/B,4EAA4E;AAChF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ export * from './custom/web/url-metadata-extractor.action.js';
32
32
  export * from './custom/web/perplexity-search.action.js';
33
33
  export * from './custom/web/google-custom-search.action.js';
34
34
  export * from './custom/web/tavily-search.action.js';
35
+ export * from './custom/web/brave-search.action.js';
35
36
  export * from './custom/web/rss-feed-read.action.js';
36
37
  export * from './custom/web/rss-feed-parsing.js';
37
38
  export * from './custom/data/csv-parser.action.js';