@memberjunction/core-actions 6.1.2 → 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.
- package/dist/config.d.ts +68 -10
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +32 -5
- package/dist/config.js.map +1 -1
- package/dist/custom/ai/generate-image.action.d.ts +13 -1
- package/dist/custom/ai/generate-image.action.d.ts.map +1 -1
- package/dist/custom/ai/generate-image.action.js +25 -13
- package/dist/custom/ai/generate-image.action.js.map +1 -1
- package/dist/custom/utilities/base-file-handler.d.ts.map +1 -1
- package/dist/custom/utilities/base-file-handler.js +4 -2
- package/dist/custom/utilities/base-file-handler.js.map +1 -1
- package/dist/custom/web/brave-search.action.d.ts +108 -0
- package/dist/custom/web/brave-search.action.d.ts.map +1 -0
- package/dist/custom/web/brave-search.action.js +285 -0
- package/dist/custom/web/brave-search.action.js.map +1 -0
- package/dist/custom/web/perplexity-search.action.d.ts +76 -44
- package/dist/custom/web/perplexity-search.action.d.ts.map +1 -1
- package/dist/custom/web/perplexity-search.action.js +228 -157
- package/dist/custom/web/perplexity-search.action.js.map +1 -1
- package/dist/custom/web/rss-feed-read.action.d.ts.map +1 -1
- package/dist/custom/web/rss-feed-read.action.js +4 -1
- package/dist/custom/web/rss-feed-read.action.js.map +1 -1
- package/dist/custom/web/web-search.action.d.ts +56 -40
- package/dist/custom/web/web-search.action.d.ts.map +1 -1
- package/dist/custom/web/web-search.action.js +141 -413
- package/dist/custom/web/web-search.action.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +40 -39
|
@@ -1,66 +1,82 @@
|
|
|
1
1
|
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
2
|
import { BaseAction } from "@memberjunction/actions";
|
|
3
3
|
/**
|
|
4
|
-
* Action that performs web search
|
|
5
|
-
*
|
|
4
|
+
* Action that performs a web search through whichever provider the administrator has configured.
|
|
5
|
+
*
|
|
6
|
+
* This is the **provider-neutral entry point** agents should bind to. It holds no vendor logic of
|
|
7
|
+
* its own: it extracts parameters, hands them to {@link WebSearchEngine}, and maps the result
|
|
8
|
+
* back. Which vendor actually serves the request — Brave, Tavily, Perplexity, or a fallback when
|
|
9
|
+
* the first choice is rate-limited — is decided by the `MJ: Web Search Providers` records and
|
|
10
|
+
* their `Priority`, not by the caller and not by the agent.
|
|
11
|
+
*
|
|
12
|
+
* That is the point. An LLM choosing between named vendor actions is making an infrastructure
|
|
13
|
+
* decision it has no information for: it cannot know which key is configured, which is cheaper,
|
|
14
|
+
* or which is rate-limited right now. Swapping vendors here is a metadata edit, with no change to
|
|
15
|
+
* any agent.
|
|
16
|
+
*
|
|
17
|
+
* `Provider` is the escape hatch for a caller who genuinely knows better. When set, the engine
|
|
18
|
+
* **fails rather than substituting** — a silent substitution is how you discover months later
|
|
19
|
+
* that a deliberate choice stopped being honoured.
|
|
6
20
|
*
|
|
7
21
|
* @example
|
|
8
22
|
* ```typescript
|
|
9
|
-
* //
|
|
23
|
+
* // Let the administrator's priority order decide
|
|
24
|
+
* await runAction({
|
|
25
|
+
* ActionName: 'Web Search',
|
|
26
|
+
* Params: [{ Name: 'Query', Value: 'association management trends' }]
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* // Recent results from two domains, with a synthesized answer
|
|
10
30
|
* await runAction({
|
|
11
31
|
* ActionName: 'Web Search',
|
|
12
|
-
* Params: [
|
|
13
|
-
* Name: '
|
|
14
|
-
* Value: '
|
|
15
|
-
*
|
|
32
|
+
* Params: [
|
|
33
|
+
* { Name: 'Query', Value: 'IRS Form 990 filing changes' },
|
|
34
|
+
* { Name: 'Freshness', Value: 'month' },
|
|
35
|
+
* { Name: 'IncludeDomains', Value: ['irs.gov', 'councilofnonprofits.org'] },
|
|
36
|
+
* { Name: 'IncludeAnswer', Value: true }
|
|
37
|
+
* ]
|
|
16
38
|
* });
|
|
17
39
|
*
|
|
18
|
-
* //
|
|
40
|
+
* // Pin one vendor — fails if it is not available rather than using another
|
|
19
41
|
* await runAction({
|
|
20
42
|
* ActionName: 'Web Search',
|
|
21
|
-
* Params: [
|
|
22
|
-
* Name: '
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* Name: 'MaxResults',
|
|
26
|
-
* Value: 15
|
|
27
|
-
* }]
|
|
43
|
+
* Params: [
|
|
44
|
+
* { Name: 'Query', Value: 'quantum error correction 2026' },
|
|
45
|
+
* { Name: 'Provider', Value: 'Brave' }
|
|
46
|
+
* ]
|
|
28
47
|
* });
|
|
29
48
|
* ```
|
|
30
49
|
*/
|
|
31
50
|
export declare class WebSearchAction extends BaseAction {
|
|
51
|
+
private static readonly FRESHNESS_WINDOWS;
|
|
52
|
+
private static readonly SAFE_SEARCH_VALUES;
|
|
32
53
|
/**
|
|
33
|
-
* Executes the
|
|
54
|
+
* Executes the search.
|
|
34
55
|
*
|
|
35
56
|
* @param params - The action parameters containing:
|
|
36
|
-
* -
|
|
37
|
-
* - MaxResults:
|
|
38
|
-
* -
|
|
39
|
-
* -
|
|
40
|
-
* -
|
|
57
|
+
* - Query: Search query text (required)
|
|
58
|
+
* - MaxResults: Desired result count, clamped to the serving provider's cap (default 10)
|
|
59
|
+
* - Provider: Pin to one provider by Name or DriverClass. Fails if unavailable
|
|
60
|
+
* - IncludeDomains / ExcludeDomains: Array or comma-separated domain lists
|
|
61
|
+
* - Freshness: 'day' | 'week' | 'month' | 'year'
|
|
62
|
+
* - Country: Two-letter country code, e.g. 'US'
|
|
63
|
+
* - Language: Language code, e.g. 'en'
|
|
64
|
+
* - SafeSearch: 'off' | 'moderate' | 'strict' (default 'moderate')
|
|
65
|
+
* - IncludeAnswer: Also return a synthesized answer, restricting provider selection
|
|
41
66
|
*
|
|
42
|
-
* @returns
|
|
67
|
+
* @returns Normalised results plus which provider served them
|
|
43
68
|
*/
|
|
44
69
|
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
70
|
+
private getStringParam;
|
|
71
|
+
private getBooleanParam;
|
|
72
|
+
private getOptionalNumericParam;
|
|
45
73
|
/**
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
private parseInstantResults;
|
|
49
|
-
/**
|
|
50
|
-
* Extracts domain from URL
|
|
51
|
-
*/
|
|
52
|
-
private extractDomain;
|
|
53
|
-
/**
|
|
54
|
-
* Parses DuckDuckGo HTML search results
|
|
55
|
-
*/
|
|
56
|
-
private parseSearchResults;
|
|
57
|
-
/**
|
|
58
|
-
* Decodes DuckDuckGo URL redirects
|
|
59
|
-
*/
|
|
60
|
-
private decodeUrl;
|
|
61
|
-
/**
|
|
62
|
-
* Strips HTML tags and decodes entities
|
|
74
|
+
* A list param, accepted as a real array or as a comma-separated string — both forms arrive
|
|
75
|
+
* in practice, from agent input mappings and from humans respectively.
|
|
63
76
|
*/
|
|
64
|
-
private
|
|
77
|
+
private getStringArrayParam;
|
|
78
|
+
private addOutputParam;
|
|
79
|
+
private createErrorResult;
|
|
65
80
|
}
|
|
81
|
+
export declare function LoadWebSearchAction(): void;
|
|
66
82
|
//# sourceMappingURL=web-search.action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-search.action.d.ts","sourceRoot":"","sources":["../../../src/custom/web/web-search.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"web-search.action.d.ts","sourceRoot":"","sources":["../../../src/custom/web/web-search.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AASrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBACa,eAAgB,SAAQ,UAAU;IAC3C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAA6C;IACtF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAA0C;IAEpF;;;;;;;;;;;;;;;OAeG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4EvF,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,uBAAuB;IAO/B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,iBAAiB;CAG5B;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|