@memberjunction/core-actions 2.106.0 → 2.108.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 +112 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +34 -2
- package/dist/config.js.map +1 -1
- package/dist/custom/ai/find-best-agent.action.d.ts +53 -0
- package/dist/custom/ai/find-best-agent.action.d.ts.map +1 -0
- package/dist/custom/ai/find-best-agent.action.js +194 -0
- package/dist/custom/ai/find-best-agent.action.js.map +1 -0
- package/dist/custom/ai/summarize-content.action.d.ts +72 -0
- package/dist/custom/ai/summarize-content.action.d.ts.map +1 -0
- package/dist/custom/ai/summarize-content.action.js +296 -0
- package/dist/custom/ai/summarize-content.action.js.map +1 -0
- package/dist/custom/code-execution/execute-code.action.d.ts +61 -0
- package/dist/custom/code-execution/execute-code.action.d.ts.map +1 -0
- package/dist/custom/code-execution/execute-code.action.js +172 -0
- package/dist/custom/code-execution/execute-code.action.js.map +1 -0
- package/dist/custom/data/csv-parser.action.js +1 -1
- package/dist/custom/data/csv-parser.action.js.map +1 -1
- package/dist/custom/data/execute-research-query.action.d.ts +114 -0
- package/dist/custom/data/execute-research-query.action.d.ts.map +1 -0
- package/dist/custom/data/execute-research-query.action.js +520 -0
- package/dist/custom/data/execute-research-query.action.js.map +1 -0
- package/dist/custom/data/explore-database-schema.action.d.ts +95 -0
- package/dist/custom/data/explore-database-schema.action.d.ts.map +1 -0
- package/dist/custom/data/explore-database-schema.action.js +499 -0
- package/dist/custom/data/explore-database-schema.action.js.map +1 -0
- package/dist/custom/data/get-entity-details.action.d.ts +63 -0
- package/dist/custom/data/get-entity-details.action.d.ts.map +1 -0
- package/dist/custom/data/get-entity-details.action.js +284 -0
- package/dist/custom/data/get-entity-details.action.js.map +1 -0
- package/dist/custom/data/get-entity-list.action.d.ts +57 -0
- package/dist/custom/data/get-entity-list.action.d.ts.map +1 -0
- package/dist/custom/data/get-entity-list.action.js +177 -0
- package/dist/custom/data/get-entity-list.action.js.map +1 -0
- package/dist/custom/files/index.d.ts +2 -0
- package/dist/custom/files/index.d.ts.map +1 -1
- package/dist/custom/files/index.js +5 -1
- package/dist/custom/files/index.js.map +1 -1
- package/dist/custom/files/list-storage-providers.action.d.ts +52 -0
- package/dist/custom/files/list-storage-providers.action.d.ts.map +1 -0
- package/dist/custom/files/list-storage-providers.action.js +175 -0
- package/dist/custom/files/list-storage-providers.action.js.map +1 -0
- package/dist/custom/files/search-storage-files.action.d.ts +61 -0
- package/dist/custom/files/search-storage-files.action.d.ts.map +1 -0
- package/dist/custom/files/search-storage-files.action.js +183 -0
- package/dist/custom/files/search-storage-files.action.js.map +1 -0
- package/dist/custom/visualization/create-svg-chart.action.d.ts +97 -0
- package/dist/custom/visualization/create-svg-chart.action.d.ts.map +1 -0
- package/dist/custom/visualization/create-svg-chart.action.js +290 -0
- package/dist/custom/visualization/create-svg-chart.action.js.map +1 -0
- package/dist/custom/visualization/create-svg-diagram.action.d.ts +151 -0
- package/dist/custom/visualization/create-svg-diagram.action.d.ts.map +1 -0
- package/dist/custom/visualization/create-svg-diagram.action.js +764 -0
- package/dist/custom/visualization/create-svg-diagram.action.js.map +1 -0
- package/dist/custom/visualization/create-svg-infographic.action.d.ts +72 -0
- package/dist/custom/visualization/create-svg-infographic.action.d.ts.map +1 -0
- package/dist/custom/visualization/create-svg-infographic.action.js +343 -0
- package/dist/custom/visualization/create-svg-infographic.action.js.map +1 -0
- package/dist/custom/visualization/create-svg-network.action.d.ts +106 -0
- package/dist/custom/visualization/create-svg-network.action.d.ts.map +1 -0
- package/dist/custom/visualization/create-svg-network.action.js +651 -0
- package/dist/custom/visualization/create-svg-network.action.js.map +1 -0
- package/dist/custom/visualization/create-svg-word-cloud.action.d.ts +94 -0
- package/dist/custom/visualization/create-svg-word-cloud.action.d.ts.map +1 -0
- package/dist/custom/visualization/create-svg-word-cloud.action.js +422 -0
- package/dist/custom/visualization/create-svg-word-cloud.action.js.map +1 -0
- package/dist/custom/visualization/shared/svg-theming.d.ts +91 -0
- package/dist/custom/visualization/shared/svg-theming.d.ts.map +1 -0
- package/dist/custom/visualization/shared/svg-theming.js +235 -0
- package/dist/custom/visualization/shared/svg-theming.js.map +1 -0
- package/dist/custom/visualization/shared/svg-types.d.ts +338 -0
- package/dist/custom/visualization/shared/svg-types.d.ts.map +1 -0
- package/dist/custom/visualization/shared/svg-types.js +11 -0
- package/dist/custom/visualization/shared/svg-types.js.map +1 -0
- package/dist/custom/visualization/shared/svg-utils.d.ts +129 -0
- package/dist/custom/visualization/shared/svg-utils.d.ts.map +1 -0
- package/dist/custom/visualization/shared/svg-utils.js +287 -0
- package/dist/custom/visualization/shared/svg-utils.js.map +1 -0
- package/dist/custom/web/google-custom-search.action.d.ts +60 -0
- package/dist/custom/web/google-custom-search.action.d.ts.map +1 -0
- package/dist/custom/web/google-custom-search.action.js +378 -0
- package/dist/custom/web/google-custom-search.action.js.map +1 -0
- package/dist/custom/web/web-page-content.action.d.ts +24 -0
- package/dist/custom/web/web-page-content.action.d.ts.map +1 -1
- package/dist/custom/web/web-page-content.action.js +90 -9
- package/dist/custom/web/web-page-content.action.js.map +1 -1
- package/dist/generated/action_subclasses.d.ts +51 -3
- package/dist/generated/action_subclasses.d.ts.map +1 -1
- package/dist/generated/action_subclasses.js +174 -90
- package/dist/generated/action_subclasses.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/package.json +30 -11
package/dist/config.d.ts
CHANGED
|
@@ -16,12 +16,62 @@ declare const apiIntegrationsSchema: z.ZodObject<{
|
|
|
16
16
|
* API keys follow format: sk-gamma-xxxxxxxx
|
|
17
17
|
*/
|
|
18
18
|
gammaApiKey: z.ZodOptional<z.ZodString>;
|
|
19
|
+
/**
|
|
20
|
+
* Google services configuration (nested structure)
|
|
21
|
+
* Follows MJStorage pattern for better organization and scalability
|
|
22
|
+
*/
|
|
23
|
+
google: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
/**
|
|
25
|
+
* Google Custom Search configuration
|
|
26
|
+
* Used by: Google Custom Search action
|
|
27
|
+
* Get your API key from: https://developers.google.com/custom-search/v1/overview
|
|
28
|
+
* Get your CX from: https://programmablesearchengine.google.com/
|
|
29
|
+
*/
|
|
30
|
+
customSearch: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
/**
|
|
32
|
+
* Google Custom Search API key
|
|
33
|
+
*/
|
|
34
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
35
|
+
/**
|
|
36
|
+
* Google Custom Search engine identifier (CX)
|
|
37
|
+
*/
|
|
38
|
+
cx: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
apiKey?: string;
|
|
41
|
+
cx?: string;
|
|
42
|
+
}, {
|
|
43
|
+
apiKey?: string;
|
|
44
|
+
cx?: string;
|
|
45
|
+
}>>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
customSearch?: {
|
|
48
|
+
apiKey?: string;
|
|
49
|
+
cx?: string;
|
|
50
|
+
};
|
|
51
|
+
}, {
|
|
52
|
+
customSearch?: {
|
|
53
|
+
apiKey?: string;
|
|
54
|
+
cx?: string;
|
|
55
|
+
};
|
|
56
|
+
}>>;
|
|
19
57
|
}, "strip", z.ZodTypeAny, {
|
|
20
58
|
perplexityApiKey?: string;
|
|
21
59
|
gammaApiKey?: string;
|
|
60
|
+
google?: {
|
|
61
|
+
customSearch?: {
|
|
62
|
+
apiKey?: string;
|
|
63
|
+
cx?: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
22
66
|
}, {
|
|
23
67
|
perplexityApiKey?: string;
|
|
24
68
|
gammaApiKey?: string;
|
|
69
|
+
google?: {
|
|
70
|
+
customSearch?: {
|
|
71
|
+
apiKey?: string;
|
|
72
|
+
cx?: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
25
75
|
}>;
|
|
26
76
|
/**
|
|
27
77
|
* Complete configuration schema for Core Actions package
|
|
@@ -44,22 +94,84 @@ declare const coreActionsConfigSchema: z.ZodObject<{
|
|
|
44
94
|
* API keys follow format: sk-gamma-xxxxxxxx
|
|
45
95
|
*/
|
|
46
96
|
gammaApiKey: z.ZodOptional<z.ZodString>;
|
|
97
|
+
/**
|
|
98
|
+
* Google services configuration (nested structure)
|
|
99
|
+
* Follows MJStorage pattern for better organization and scalability
|
|
100
|
+
*/
|
|
101
|
+
google: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
/**
|
|
103
|
+
* Google Custom Search configuration
|
|
104
|
+
* Used by: Google Custom Search action
|
|
105
|
+
* Get your API key from: https://developers.google.com/custom-search/v1/overview
|
|
106
|
+
* Get your CX from: https://programmablesearchengine.google.com/
|
|
107
|
+
*/
|
|
108
|
+
customSearch: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
/**
|
|
110
|
+
* Google Custom Search API key
|
|
111
|
+
*/
|
|
112
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
113
|
+
/**
|
|
114
|
+
* Google Custom Search engine identifier (CX)
|
|
115
|
+
*/
|
|
116
|
+
cx: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
apiKey?: string;
|
|
119
|
+
cx?: string;
|
|
120
|
+
}, {
|
|
121
|
+
apiKey?: string;
|
|
122
|
+
cx?: string;
|
|
123
|
+
}>>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
customSearch?: {
|
|
126
|
+
apiKey?: string;
|
|
127
|
+
cx?: string;
|
|
128
|
+
};
|
|
129
|
+
}, {
|
|
130
|
+
customSearch?: {
|
|
131
|
+
apiKey?: string;
|
|
132
|
+
cx?: string;
|
|
133
|
+
};
|
|
134
|
+
}>>;
|
|
47
135
|
}, "strip", z.ZodTypeAny, {
|
|
48
136
|
perplexityApiKey?: string;
|
|
49
137
|
gammaApiKey?: string;
|
|
138
|
+
google?: {
|
|
139
|
+
customSearch?: {
|
|
140
|
+
apiKey?: string;
|
|
141
|
+
cx?: string;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
50
144
|
}, {
|
|
51
145
|
perplexityApiKey?: string;
|
|
52
146
|
gammaApiKey?: string;
|
|
147
|
+
google?: {
|
|
148
|
+
customSearch?: {
|
|
149
|
+
apiKey?: string;
|
|
150
|
+
cx?: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
53
153
|
}>>>;
|
|
54
154
|
}, "strip", z.ZodTypeAny, {
|
|
55
155
|
apiIntegrations?: {
|
|
56
156
|
perplexityApiKey?: string;
|
|
57
157
|
gammaApiKey?: string;
|
|
158
|
+
google?: {
|
|
159
|
+
customSearch?: {
|
|
160
|
+
apiKey?: string;
|
|
161
|
+
cx?: string;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
58
164
|
};
|
|
59
165
|
}, {
|
|
60
166
|
apiIntegrations?: {
|
|
61
167
|
perplexityApiKey?: string;
|
|
62
168
|
gammaApiKey?: string;
|
|
169
|
+
google?: {
|
|
170
|
+
customSearch?: {
|
|
171
|
+
apiKey?: string;
|
|
172
|
+
cx?: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
63
175
|
};
|
|
64
176
|
}>;
|
|
65
177
|
export type CoreActionsConfig = z.infer<typeof coreActionsConfigSchema>;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,QAAA,MAAM,qBAAqB;IACzB;;;;OAIG;;IAGH;;;;;OAKG
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,QAAA,MAAM,qBAAqB;IACzB;;;;OAIG;;IAGH;;;;;OAKG;;IAGH;;;OAGG;;QAED;;;;;WAKG;;YAED;;eAEG;;YAEH;;eAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIP,CAAC;AAEH;;GAEG;AACH,QAAA,MAAM,uBAAuB;IAC3B;;OAEG;;QA7CH;;;;WAIG;;QAGH;;;;;WAKG;;QAGH;;;WAGG;;YAED;;;;;eAKG;;gBAED;;mBAEG;;gBAEH;;mBAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcP,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAI1E;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAqCxD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,CAGhE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C"}
|
package/dist/config.js
CHANGED
|
@@ -22,6 +22,28 @@ const apiIntegrationsSchema = zod_1.z.object({
|
|
|
22
22
|
* API keys follow format: sk-gamma-xxxxxxxx
|
|
23
23
|
*/
|
|
24
24
|
gammaApiKey: zod_1.z.string().optional(),
|
|
25
|
+
/**
|
|
26
|
+
* Google services configuration (nested structure)
|
|
27
|
+
* Follows MJStorage pattern for better organization and scalability
|
|
28
|
+
*/
|
|
29
|
+
google: zod_1.z.object({
|
|
30
|
+
/**
|
|
31
|
+
* Google Custom Search configuration
|
|
32
|
+
* Used by: Google Custom Search action
|
|
33
|
+
* Get your API key from: https://developers.google.com/custom-search/v1/overview
|
|
34
|
+
* Get your CX from: https://programmablesearchengine.google.com/
|
|
35
|
+
*/
|
|
36
|
+
customSearch: zod_1.z.object({
|
|
37
|
+
/**
|
|
38
|
+
* Google Custom Search API key
|
|
39
|
+
*/
|
|
40
|
+
apiKey: zod_1.z.string().optional(),
|
|
41
|
+
/**
|
|
42
|
+
* Google Custom Search engine identifier (CX)
|
|
43
|
+
*/
|
|
44
|
+
cx: zod_1.z.string().optional(),
|
|
45
|
+
}).optional(),
|
|
46
|
+
}).optional(),
|
|
25
47
|
});
|
|
26
48
|
/**
|
|
27
49
|
* Complete configuration schema for Core Actions package
|
|
@@ -51,8 +73,18 @@ function getCoreActionsConfig() {
|
|
|
51
73
|
// Extract only the fields relevant to Core Actions
|
|
52
74
|
const rawConfig = {
|
|
53
75
|
apiIntegrations: {
|
|
54
|
-
perplexityApiKey: result.config
|
|
55
|
-
gammaApiKey: result.config
|
|
76
|
+
perplexityApiKey: result.config?.perplexityApiKey || process.env.PERPLEXITY_API_KEY,
|
|
77
|
+
gammaApiKey: result.config?.gammaApiKey || process.env.GAMMA_API_KEY,
|
|
78
|
+
google: {
|
|
79
|
+
customSearch: {
|
|
80
|
+
apiKey: result.config?.google?.customSearch?.apiKey ||
|
|
81
|
+
result.config?.googleCustomSearchApiKey || // Backwards compatibility
|
|
82
|
+
process.env.GOOGLE_CUSTOM_SEARCH_API_KEY,
|
|
83
|
+
cx: result.config?.google?.customSearch?.cx ||
|
|
84
|
+
result.config?.googleCustomSearchCx || // Backwards compatibility
|
|
85
|
+
process.env.GOOGLE_CUSTOM_SEARCH_CX,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
56
88
|
},
|
|
57
89
|
};
|
|
58
90
|
_config = coreActionsConfigSchema.parse(rawConfig);
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,6CAA8C;AAC9C,+CAA2D;AAE3D,MAAM,QAAQ,GAAG,IAAA,6BAAe,EAAC,IAAI,EAAE,EAAE,cAAc,EAAE,QAAQ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CAAC;AACH,CAAC;AArCD,oDAqCC;AAED;;;GAGG;AACH,SAAgB,wBAAwB;IACtC,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACtC,OAAO,MAAM,CAAC,eAAe,CAAC;AAChC,CAAC;AAHD,4DAGC;AAED;;GAEG;AACH,SAAgB,sBAAsB;IACpC,OAAO,GAAG,IAAI,CAAC;AACjB,CAAC;AAFD,wDAEC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Action that finds the best-matching AI agents for a given task using embedding-based semantic search.
|
|
5
|
+
*
|
|
6
|
+
* This action uses local embeddings to perform fast similarity search across all available agents,
|
|
7
|
+
* returning the most relevant agents based on their descriptions and capabilities.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Find agents for a research task
|
|
12
|
+
* await runAction({
|
|
13
|
+
* ActionName: 'Find Best Agent',
|
|
14
|
+
* Params: [{
|
|
15
|
+
* Name: 'TaskDescription',
|
|
16
|
+
* Value: 'Research market trends and compile a comprehensive report'
|
|
17
|
+
* }, {
|
|
18
|
+
* Name: 'MaxResults',
|
|
19
|
+
* Value: 5
|
|
20
|
+
* }, {
|
|
21
|
+
* Name: 'MinimumSimilarityScore',
|
|
22
|
+
* Value: 0.7
|
|
23
|
+
* }]
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class FindBestAgentAction extends BaseAction {
|
|
28
|
+
/**
|
|
29
|
+
* Executes the Find Best Agent action.
|
|
30
|
+
*
|
|
31
|
+
* @param params - The action parameters containing:
|
|
32
|
+
* - TaskDescription: Description of the task to find agents for (required)
|
|
33
|
+
* - MaxResults: Maximum number of agents to return (optional, default: 5)
|
|
34
|
+
* - MinimumSimilarityScore: Minimum similarity score 0-1 (optional, default: 0.5)
|
|
35
|
+
* - IncludeInactive: Include inactive agents (optional, default: false)
|
|
36
|
+
*
|
|
37
|
+
* @returns Action result with matched agents
|
|
38
|
+
*/
|
|
39
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
40
|
+
/**
|
|
41
|
+
* Get boolean parameter with default
|
|
42
|
+
*/
|
|
43
|
+
private getBooleanParam;
|
|
44
|
+
/**
|
|
45
|
+
* Get parameter value by name (case-insensitive)
|
|
46
|
+
*/
|
|
47
|
+
private getParamValue;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Loader function to ensure the FindBestAgentAction class is included in the bundle
|
|
51
|
+
*/
|
|
52
|
+
export declare function LoadFindBestAgentAction(): void;
|
|
53
|
+
//# sourceMappingURL=find-best-agent.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-best-agent.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/find-best-agent.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,mBAAoB,SAAQ,UAAU;IAG/C;;;;;;;;;;OAUG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwIvF;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,aAAa;CAIxB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,SAEtC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LoadFindBestAgentAction = exports.FindBestAgentAction = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const actions_1 = require("@memberjunction/actions");
|
|
12
|
+
const aiengine_1 = require("@memberjunction/aiengine");
|
|
13
|
+
const ai_engine_base_1 = require("@memberjunction/ai-engine-base");
|
|
14
|
+
/**
|
|
15
|
+
* Action that finds the best-matching AI agents for a given task using embedding-based semantic search.
|
|
16
|
+
*
|
|
17
|
+
* This action uses local embeddings to perform fast similarity search across all available agents,
|
|
18
|
+
* returning the most relevant agents based on their descriptions and capabilities.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Find agents for a research task
|
|
23
|
+
* await runAction({
|
|
24
|
+
* ActionName: 'Find Best Agent',
|
|
25
|
+
* Params: [{
|
|
26
|
+
* Name: 'TaskDescription',
|
|
27
|
+
* Value: 'Research market trends and compile a comprehensive report'
|
|
28
|
+
* }, {
|
|
29
|
+
* Name: 'MaxResults',
|
|
30
|
+
* Value: 5
|
|
31
|
+
* }, {
|
|
32
|
+
* Name: 'MinimumSimilarityScore',
|
|
33
|
+
* Value: 0.7
|
|
34
|
+
* }]
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
let FindBestAgentAction = class FindBestAgentAction extends actions_1.BaseAction {
|
|
39
|
+
// Singleton initialization removed - AIEngine handles embedding lifecycle
|
|
40
|
+
/**
|
|
41
|
+
* Executes the Find Best Agent action.
|
|
42
|
+
*
|
|
43
|
+
* @param params - The action parameters containing:
|
|
44
|
+
* - TaskDescription: Description of the task to find agents for (required)
|
|
45
|
+
* - MaxResults: Maximum number of agents to return (optional, default: 5)
|
|
46
|
+
* - MinimumSimilarityScore: Minimum similarity score 0-1 (optional, default: 0.5)
|
|
47
|
+
* - IncludeInactive: Include inactive agents (optional, default: false)
|
|
48
|
+
*
|
|
49
|
+
* @returns Action result with matched agents
|
|
50
|
+
*/
|
|
51
|
+
async InternalRunAction(params) {
|
|
52
|
+
try {
|
|
53
|
+
// Extract and validate input parameters
|
|
54
|
+
const taskDescription = this.getParamValue(params, 'taskdescription');
|
|
55
|
+
const maxResults = parseInt(this.getParamValue(params, 'maxresults') || '5');
|
|
56
|
+
const minimumSimilarityScore = parseFloat(this.getParamValue(params, 'minimumsimilarityscore') || '0.5');
|
|
57
|
+
const includeInactive = this.getBooleanParam(params, 'includeinactive', false);
|
|
58
|
+
// Validate required input
|
|
59
|
+
if (!taskDescription || taskDescription.trim().length === 0) {
|
|
60
|
+
return {
|
|
61
|
+
Success: false,
|
|
62
|
+
ResultCode: 'INVALID_INPUT',
|
|
63
|
+
Message: 'TaskDescription parameter is required and cannot be empty'
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
// Validate numeric ranges
|
|
67
|
+
if (maxResults < 1 || maxResults > 20) {
|
|
68
|
+
return {
|
|
69
|
+
Success: false,
|
|
70
|
+
ResultCode: 'INVALID_INPUT',
|
|
71
|
+
Message: 'MaxResults must be between 1 and 20'
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (minimumSimilarityScore < 0 || minimumSimilarityScore > 1) {
|
|
75
|
+
return {
|
|
76
|
+
Success: false,
|
|
77
|
+
ResultCode: 'INVALID_INPUT',
|
|
78
|
+
Message: 'MinimumSimilarityScore must be between 0 and 1'
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// Validate contextUser is provided for permission filtering
|
|
82
|
+
if (!params.ContextUser) {
|
|
83
|
+
return {
|
|
84
|
+
Success: false,
|
|
85
|
+
ResultCode: 'MISSING_USER_CONTEXT',
|
|
86
|
+
Message: 'User context required for permission filtering'
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Ensure AIEngine is loaded (embeddings computed during initialization)
|
|
90
|
+
await aiengine_1.AIEngine.Instance.Config(false, params.ContextUser);
|
|
91
|
+
// Find similar agents using AIEngine's built-in method - no database round trip!
|
|
92
|
+
const matchedAgents = await aiengine_1.AIEngine.Instance.FindSimilarAgents(taskDescription, maxResults * 3, // Get 3x results to account for filtering
|
|
93
|
+
minimumSimilarityScore);
|
|
94
|
+
// Filter by user permissions - user must have 'run' permission
|
|
95
|
+
const accessibleAgents = await ai_engine_base_1.AIAgentPermissionHelper.GetAccessibleAgents(params.ContextUser, 'run');
|
|
96
|
+
const accessibleAgentIds = new Set(accessibleAgents.map(a => a.ID));
|
|
97
|
+
// Filter matched agents by permissions
|
|
98
|
+
let permissionFilteredAgents = matchedAgents.filter(a => accessibleAgentIds.has(a.agentId));
|
|
99
|
+
// Filter by status if not including inactive
|
|
100
|
+
if (!includeInactive) {
|
|
101
|
+
permissionFilteredAgents = permissionFilteredAgents.filter(a => a.status === 'Active');
|
|
102
|
+
}
|
|
103
|
+
// Filter by invocation mode - exclude Sub-Agent agents (only show Any or Top-Level)
|
|
104
|
+
// Sub-Agents are meant to be called by other agents, not discovered by users/tools
|
|
105
|
+
const invocationFilteredAgents = permissionFilteredAgents.filter(a => a.invocationMode !== 'Sub-Agent');
|
|
106
|
+
// Limit to maxResults after all filtering
|
|
107
|
+
const filteredAgents = invocationFilteredAgents.slice(0, maxResults);
|
|
108
|
+
if (filteredAgents.length === 0) {
|
|
109
|
+
return {
|
|
110
|
+
Success: false,
|
|
111
|
+
ResultCode: 'NO_AGENTS_FOUND',
|
|
112
|
+
Message: `No accessible agents found matching the criteria (minimum similarity: ${minimumSimilarityScore}). You may not have permission to run the matching agents.`
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// AIEngine already loaded above - use it to get agent actions
|
|
116
|
+
// Create map of agentId -> action names
|
|
117
|
+
const agentActionsMap = new Map();
|
|
118
|
+
for (const agent of filteredAgents) {
|
|
119
|
+
const agentActions = aiengine_1.AIEngine.Instance.AgentActions
|
|
120
|
+
.filter(aa => aa.AgentID === agent.agentId && aa.Status === 'Active')
|
|
121
|
+
.map(aa => aa.Action); // Get action name
|
|
122
|
+
agentActionsMap.set(agent.agentId, agentActions);
|
|
123
|
+
}
|
|
124
|
+
// Add output parameters
|
|
125
|
+
params.Params.push({
|
|
126
|
+
Name: 'MatchedAgents',
|
|
127
|
+
Type: 'Output',
|
|
128
|
+
Value: filteredAgents
|
|
129
|
+
});
|
|
130
|
+
params.Params.push({
|
|
131
|
+
Name: 'MatchCount',
|
|
132
|
+
Type: 'Output',
|
|
133
|
+
Value: filteredAgents.length
|
|
134
|
+
});
|
|
135
|
+
// Build response message with full descriptions and actions
|
|
136
|
+
const responseData = {
|
|
137
|
+
message: `Found ${filteredAgents.length} accessible agent(s)`,
|
|
138
|
+
taskDescription: taskDescription,
|
|
139
|
+
matchCount: filteredAgents.length,
|
|
140
|
+
allMatches: filteredAgents.map(a => ({
|
|
141
|
+
agentName: a.agentName,
|
|
142
|
+
similarityScore: Math.round(a.similarityScore * 100) / 100, // Round to 2 decimal places
|
|
143
|
+
description: a.description, // Full description, no truncation
|
|
144
|
+
actions: agentActionsMap.get(a.agentId) || []
|
|
145
|
+
}))
|
|
146
|
+
};
|
|
147
|
+
return {
|
|
148
|
+
Success: true,
|
|
149
|
+
ResultCode: 'SUCCESS',
|
|
150
|
+
Message: JSON.stringify(responseData, null, 2)
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
return {
|
|
155
|
+
Success: false,
|
|
156
|
+
ResultCode: 'EXECUTION_ERROR',
|
|
157
|
+
Message: `Failed to find best agent: ${error instanceof Error ? error.message : String(error)}`
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get boolean parameter with default
|
|
163
|
+
*/
|
|
164
|
+
getBooleanParam(params, name, defaultValue) {
|
|
165
|
+
const value = this.getParamValue(params, name);
|
|
166
|
+
if (value === undefined || value === null)
|
|
167
|
+
return defaultValue;
|
|
168
|
+
if (typeof value === 'boolean')
|
|
169
|
+
return value;
|
|
170
|
+
if (typeof value === 'string') {
|
|
171
|
+
return value.toLowerCase() === 'true';
|
|
172
|
+
}
|
|
173
|
+
return defaultValue;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get parameter value by name (case-insensitive)
|
|
177
|
+
*/
|
|
178
|
+
getParamValue(params, name) {
|
|
179
|
+
const param = params.Params.find(p => p.Name.toLowerCase() === name.toLowerCase());
|
|
180
|
+
return param?.Value;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
exports.FindBestAgentAction = FindBestAgentAction;
|
|
184
|
+
exports.FindBestAgentAction = FindBestAgentAction = __decorate([
|
|
185
|
+
(0, global_1.RegisterClass)(actions_1.BaseAction, "Find Best Agent")
|
|
186
|
+
], FindBestAgentAction);
|
|
187
|
+
/**
|
|
188
|
+
* Loader function to ensure the FindBestAgentAction class is included in the bundle
|
|
189
|
+
*/
|
|
190
|
+
function LoadFindBestAgentAction() {
|
|
191
|
+
// Stub function to prevent tree shaking
|
|
192
|
+
}
|
|
193
|
+
exports.LoadFindBestAgentAction = LoadFindBestAgentAction;
|
|
194
|
+
//# sourceMappingURL=find-best-agent.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-best-agent.action.js","sourceRoot":"","sources":["../../../src/custom/ai/find-best-agent.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,qDAAqD;AACrD,uDAAoD;AACpD,mEAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,oBAAU;IAC/C,0EAA0E;IAE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C,CAAC;QACnF,OAAO,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC;CACJ,CAAA;AA1KY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,sBAAa,EAAC,oBAAU,EAAE,iBAAiB,CAAC;GAChC,mBAAmB,CA0K/B;AAED;;GAEG;AACH,SAAgB,uBAAuB;IACnC,wCAAwC;AAC5C,CAAC;AAFD,0DAEC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Action that creates a concise summary of content with citations to source material.
|
|
5
|
+
* Can work with either a URL (fetch + summarize) or pre-fetched content.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Flexible input: URL or pre-fetched content
|
|
9
|
+
* - Configurable summary length (word count target)
|
|
10
|
+
* - Optional citations with quotes and links
|
|
11
|
+
* - Focus instructions for domain-specific summarization
|
|
12
|
+
* - Multiple output formats (paragraph, bullets, hybrid)
|
|
13
|
+
* - Automatic anchor link detection for precise citations
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Summarize from URL
|
|
18
|
+
* await runAction({
|
|
19
|
+
* ActionName: 'Summarize Content',
|
|
20
|
+
* Params: [{
|
|
21
|
+
* Name: 'url',
|
|
22
|
+
* Value: 'https://docs.memberjunction.org/architecture'
|
|
23
|
+
* }, {
|
|
24
|
+
* Name: 'summaryWords',
|
|
25
|
+
* Value: 200
|
|
26
|
+
* }, {
|
|
27
|
+
* Name: 'instructions',
|
|
28
|
+
* Value: 'Focus on metadata layer and entity system'
|
|
29
|
+
* }]
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Summarize pre-fetched content
|
|
33
|
+
* await runAction({
|
|
34
|
+
* ActionName: 'Summarize Content',
|
|
35
|
+
* Params: [{
|
|
36
|
+
* Name: 'content',
|
|
37
|
+
* Value: '<html>...</html>'
|
|
38
|
+
* }, {
|
|
39
|
+
* Name: 'sourceUrl',
|
|
40
|
+
* Value: 'https://docs.memberjunction.org/architecture'
|
|
41
|
+
* }, {
|
|
42
|
+
* Name: 'includeCitations',
|
|
43
|
+
* Value: true
|
|
44
|
+
* }]
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class SummarizeContentAction extends BaseAction {
|
|
49
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
50
|
+
/**
|
|
51
|
+
* Fetch web page content using the Get Web Page Content action
|
|
52
|
+
*/
|
|
53
|
+
private fetchWebPageContent;
|
|
54
|
+
/**
|
|
55
|
+
* Generate summary using AI Prompts package directly
|
|
56
|
+
*/
|
|
57
|
+
private generateSummary;
|
|
58
|
+
/**
|
|
59
|
+
* Get prompt by name and category from AIEngine
|
|
60
|
+
*/
|
|
61
|
+
private getPromptByNameAndCategory;
|
|
62
|
+
private getStringParam;
|
|
63
|
+
private getNumericParam;
|
|
64
|
+
private getBooleanParam;
|
|
65
|
+
private addOutputParam;
|
|
66
|
+
private createErrorResult;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Loader function to ensure the SummarizeContentAction class is included in the bundle.
|
|
70
|
+
*/
|
|
71
|
+
export declare function LoadSummarizeContentAction(): void;
|
|
72
|
+
//# sourceMappingURL=summarize-content.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summarize-content.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/summarize-content.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAiC,MAAM,8BAA8B,CAAC;AAClH,OAAO,EAAE,UAAU,EAAsB,MAAM,yBAAyB,CAAC;AA2BzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBACa,sBAAuB,SAAQ,UAAU;cAElC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA6FvF;;OAEG;YACW,mBAAmB;IAqDjC;;OAEG;YACW,eAAe;IAiE7B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAOlC,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iBAAiB;CAO5B;AAED;;GAEG;AACH,wBAAgB,0BAA0B,SAEzC"}
|