@memberjunction/core-actions 2.107.0 → 2.109.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/custom/ai/find-best-action.action.d.ts +53 -0
- package/dist/custom/ai/find-best-action.action.d.ts.map +1 -0
- package/dist/custom/ai/find-best-action.action.js +211 -0
- package/dist/custom/ai/find-best-action.action.js.map +1 -0
- 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 +3 -3
- package/dist/custom/ai/summarize-content.action.d.ts.map +1 -1
- package/dist/custom/ai/summarize-content.action.js +51 -143
- package/dist/custom/ai/summarize-content.action.js.map +1 -1
- 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 +36 -18
- package/dist/custom/data/execute-research-query.action.d.ts.map +1 -1
- package/dist/custom/data/execute-research-query.action.js +221 -114
- package/dist/custom/data/execute-research-query.action.js.map +1 -1
- package/dist/custom/data/explore-database-schema.action.d.ts +4 -0
- package/dist/custom/data/explore-database-schema.action.d.ts.map +1 -1
- package/dist/custom/data/explore-database-schema.action.js +101 -8
- package/dist/custom/data/explore-database-schema.action.js.map +1 -1
- 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/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 +326 -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 +687 -0
- package/dist/custom/visualization/create-svg-network.action.js.map +1 -0
- package/dist/custom/visualization/create-svg-sketch-diagram.action.d.ts +97 -0
- package/dist/custom/visualization/create-svg-sketch-diagram.action.d.ts.map +1 -0
- package/dist/custom/visualization/create-svg-sketch-diagram.action.js +730 -0
- package/dist/custom/visualization/create-svg-sketch-diagram.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 +497 -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 +354 -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 +166 -0
- package/dist/custom/visualization/shared/svg-utils.d.ts.map +1 -0
- package/dist/custom/visualization/shared/svg-utils.js +555 -0
- package/dist/custom/visualization/shared/svg-utils.js.map +1 -0
- package/dist/custom/web/google-custom-search.action.d.ts +6 -1
- package/dist/custom/web/google-custom-search.action.d.ts.map +1 -1
- package/dist/custom/web/google-custom-search.action.js +78 -10
- package/dist/custom/web/google-custom-search.action.js.map +1 -1
- 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 +4 -4
- package/dist/generated/action_subclasses.js +13 -13
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/package.json +30 -12
|
@@ -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 actions for a given task using embedding-based semantic search.
|
|
5
|
+
*
|
|
6
|
+
* This action uses local embeddings to perform fast similarity search across all available actions,
|
|
7
|
+
* returning the most relevant actions based on their descriptions and capabilities.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // Find actions for a web search task
|
|
12
|
+
* await runAction({
|
|
13
|
+
* ActionName: 'Find Best Action',
|
|
14
|
+
* Params: [{
|
|
15
|
+
* Name: 'TaskDescription',
|
|
16
|
+
* Value: 'Search the internet for information on a topic'
|
|
17
|
+
* }, {
|
|
18
|
+
* Name: 'MaxResults',
|
|
19
|
+
* Value: 5
|
|
20
|
+
* }, {
|
|
21
|
+
* Name: 'MinimumSimilarityScore',
|
|
22
|
+
* Value: 0.6
|
|
23
|
+
* }]
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class FindBestActionAction extends BaseAction {
|
|
28
|
+
/**
|
|
29
|
+
* Executes the Find Best Action action.
|
|
30
|
+
*
|
|
31
|
+
* @param params - The action parameters containing:
|
|
32
|
+
* - TaskDescription: Description of the task to find actions for (required)
|
|
33
|
+
* - MaxResults: Maximum number of actions to return (optional, default: 10)
|
|
34
|
+
* - MinimumSimilarityScore: Minimum similarity score 0-1 (optional, default: 0.5)
|
|
35
|
+
* - ExcludeAgentManagement: Exclude Agent Management actions (optional, default: true)
|
|
36
|
+
*
|
|
37
|
+
* @returns Action result with matched actions
|
|
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 FindBestActionAction class is included in the bundle
|
|
51
|
+
*/
|
|
52
|
+
export declare function LoadFindBestActionAction(): void;
|
|
53
|
+
//# sourceMappingURL=find-best-action.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-best-action.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/find-best-action.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,oBAAqB,SAAQ,UAAU;IAChD;;;;;;;;;;OAUG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsJvF;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,aAAa;CAIxB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,SAEvC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
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.LoadFindBestActionAction = exports.FindBestActionAction = 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 core_1 = require("@memberjunction/core");
|
|
14
|
+
/**
|
|
15
|
+
* Action that finds the best-matching actions for a given task using embedding-based semantic search.
|
|
16
|
+
*
|
|
17
|
+
* This action uses local embeddings to perform fast similarity search across all available actions,
|
|
18
|
+
* returning the most relevant actions based on their descriptions and capabilities.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* // Find actions for a web search task
|
|
23
|
+
* await runAction({
|
|
24
|
+
* ActionName: 'Find Best Action',
|
|
25
|
+
* Params: [{
|
|
26
|
+
* Name: 'TaskDescription',
|
|
27
|
+
* Value: 'Search the internet for information on a topic'
|
|
28
|
+
* }, {
|
|
29
|
+
* Name: 'MaxResults',
|
|
30
|
+
* Value: 5
|
|
31
|
+
* }, {
|
|
32
|
+
* Name: 'MinimumSimilarityScore',
|
|
33
|
+
* Value: 0.6
|
|
34
|
+
* }]
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
let FindBestActionAction = class FindBestActionAction extends actions_1.BaseAction {
|
|
39
|
+
/**
|
|
40
|
+
* Executes the Find Best Action action.
|
|
41
|
+
*
|
|
42
|
+
* @param params - The action parameters containing:
|
|
43
|
+
* - TaskDescription: Description of the task to find actions for (required)
|
|
44
|
+
* - MaxResults: Maximum number of actions to return (optional, default: 10)
|
|
45
|
+
* - MinimumSimilarityScore: Minimum similarity score 0-1 (optional, default: 0.5)
|
|
46
|
+
* - ExcludeAgentManagement: Exclude Agent Management actions (optional, default: true)
|
|
47
|
+
*
|
|
48
|
+
* @returns Action result with matched actions
|
|
49
|
+
*/
|
|
50
|
+
async InternalRunAction(params) {
|
|
51
|
+
try {
|
|
52
|
+
// Extract and validate input parameters
|
|
53
|
+
const taskDescription = this.getParamValue(params, 'taskdescription');
|
|
54
|
+
const maxResults = parseInt(this.getParamValue(params, 'maxresults') || '10');
|
|
55
|
+
const minimumSimilarityScore = parseFloat(this.getParamValue(params, 'minimumsimilarityscore') || '0.5');
|
|
56
|
+
const excludeAgentManagement = this.getBooleanParam(params, 'excludeagentmanagement', true);
|
|
57
|
+
// Validate required input
|
|
58
|
+
if (!taskDescription || taskDescription.trim().length === 0) {
|
|
59
|
+
return {
|
|
60
|
+
Success: false,
|
|
61
|
+
ResultCode: 'INVALID_INPUT',
|
|
62
|
+
Message: 'TaskDescription parameter is required and cannot be empty'
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// Validate numeric ranges
|
|
66
|
+
if (maxResults < 1 || maxResults > 50) {
|
|
67
|
+
return {
|
|
68
|
+
Success: false,
|
|
69
|
+
ResultCode: 'INVALID_INPUT',
|
|
70
|
+
Message: 'MaxResults must be between 1 and 50'
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (minimumSimilarityScore < 0 || minimumSimilarityScore > 1) {
|
|
74
|
+
return {
|
|
75
|
+
Success: false,
|
|
76
|
+
ResultCode: 'INVALID_INPUT',
|
|
77
|
+
Message: 'MinimumSimilarityScore must be between 0 and 1'
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Validate contextUser is provided
|
|
81
|
+
if (!params.ContextUser) {
|
|
82
|
+
return {
|
|
83
|
+
Success: false,
|
|
84
|
+
ResultCode: 'MISSING_USER_CONTEXT',
|
|
85
|
+
Message: 'User context required'
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// Ensure AIEngine is loaded (embeddings computed during initialization)
|
|
89
|
+
await aiengine_1.AIEngine.Instance.Config(false, params.ContextUser);
|
|
90
|
+
// Find similar actions using AIEngine's built-in method - no database round trip!
|
|
91
|
+
const matchedActions = await aiengine_1.AIEngine.Instance.FindSimilarActions(taskDescription, maxResults * 2, // Get 2x results to account for filtering
|
|
92
|
+
minimumSimilarityScore);
|
|
93
|
+
// Filter out Agent Management actions if requested
|
|
94
|
+
let filteredActions = matchedActions;
|
|
95
|
+
if (excludeAgentManagement) {
|
|
96
|
+
filteredActions = matchedActions.filter(a => a.categoryName !== 'Agent Management');
|
|
97
|
+
}
|
|
98
|
+
// Limit to maxResults after filtering
|
|
99
|
+
filteredActions = filteredActions.slice(0, maxResults);
|
|
100
|
+
if (filteredActions.length === 0) {
|
|
101
|
+
return {
|
|
102
|
+
Success: false,
|
|
103
|
+
ResultCode: 'NO_ACTIONS_FOUND',
|
|
104
|
+
Message: `No actions found matching the criteria (minimum similarity: ${minimumSimilarityScore}).`
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// Load action parameters for all matched actions
|
|
108
|
+
const actionIds = filteredActions.map(a => a.actionId);
|
|
109
|
+
const rv = new core_1.RunView();
|
|
110
|
+
const paramsResult = await rv.RunView({
|
|
111
|
+
EntityName: 'Action Params',
|
|
112
|
+
ExtraFilter: `ActionID IN ('${actionIds.join("','")}')`,
|
|
113
|
+
OrderBy: 'ActionID, Name',
|
|
114
|
+
ResultType: 'entity_object'
|
|
115
|
+
}, params.ContextUser);
|
|
116
|
+
// Group parameters by action ID
|
|
117
|
+
const paramsByActionId = new Map();
|
|
118
|
+
if (paramsResult.Success && paramsResult.Results) {
|
|
119
|
+
for (const param of paramsResult.Results) {
|
|
120
|
+
const actionId = param.ActionID;
|
|
121
|
+
if (!paramsByActionId.has(actionId)) {
|
|
122
|
+
paramsByActionId.set(actionId, []);
|
|
123
|
+
}
|
|
124
|
+
paramsByActionId.get(actionId).push(param);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Build response with parameters included
|
|
128
|
+
const actionsWithParams = filteredActions.map(a => ({
|
|
129
|
+
actionId: a.actionId,
|
|
130
|
+
actionName: a.actionName,
|
|
131
|
+
similarityScore: Math.round(a.similarityScore * 100) / 100,
|
|
132
|
+
description: a.description,
|
|
133
|
+
categoryName: a.categoryName,
|
|
134
|
+
status: a.status,
|
|
135
|
+
driverClass: a.driverClass,
|
|
136
|
+
parameters: (paramsByActionId.get(a.actionId) || []).map(p => ({
|
|
137
|
+
name: p.Name,
|
|
138
|
+
type: p.Type, // Input/Output
|
|
139
|
+
valueType: p.ValueType,
|
|
140
|
+
isArray: p.IsArray,
|
|
141
|
+
description: p.Description,
|
|
142
|
+
isRequired: p.IsRequired,
|
|
143
|
+
defaultValue: p.DefaultValue
|
|
144
|
+
}))
|
|
145
|
+
}));
|
|
146
|
+
// Add output parameters
|
|
147
|
+
params.Params.push({
|
|
148
|
+
Name: 'MatchedActions',
|
|
149
|
+
Type: 'Output',
|
|
150
|
+
Value: actionsWithParams
|
|
151
|
+
});
|
|
152
|
+
params.Params.push({
|
|
153
|
+
Name: 'MatchCount',
|
|
154
|
+
Type: 'Output',
|
|
155
|
+
Value: filteredActions.length
|
|
156
|
+
});
|
|
157
|
+
// Build response message with full descriptions and parameters
|
|
158
|
+
const responseData = {
|
|
159
|
+
message: `Found ${filteredActions.length} relevant action(s)`,
|
|
160
|
+
taskDescription: taskDescription,
|
|
161
|
+
matchCount: filteredActions.length,
|
|
162
|
+
allMatches: actionsWithParams
|
|
163
|
+
};
|
|
164
|
+
return {
|
|
165
|
+
Success: true,
|
|
166
|
+
ResultCode: 'SUCCESS',
|
|
167
|
+
Message: JSON.stringify(responseData, null, 2)
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
return {
|
|
172
|
+
Success: false,
|
|
173
|
+
ResultCode: 'EXECUTION_ERROR',
|
|
174
|
+
Message: `Failed to find best action: ${error instanceof Error ? error.message : String(error)}`
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get boolean parameter with default
|
|
180
|
+
*/
|
|
181
|
+
getBooleanParam(params, name, defaultValue) {
|
|
182
|
+
const value = this.getParamValue(params, name);
|
|
183
|
+
if (value === undefined || value === null)
|
|
184
|
+
return defaultValue;
|
|
185
|
+
if (typeof value === 'boolean')
|
|
186
|
+
return value;
|
|
187
|
+
if (typeof value === 'string') {
|
|
188
|
+
return value.toLowerCase() === 'true';
|
|
189
|
+
}
|
|
190
|
+
return defaultValue;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Get parameter value by name (case-insensitive)
|
|
194
|
+
*/
|
|
195
|
+
getParamValue(params, name) {
|
|
196
|
+
const param = params.Params.find(p => p.Name.toLowerCase() === name.toLowerCase());
|
|
197
|
+
return param?.Value;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
exports.FindBestActionAction = FindBestActionAction;
|
|
201
|
+
exports.FindBestActionAction = FindBestActionAction = __decorate([
|
|
202
|
+
(0, global_1.RegisterClass)(actions_1.BaseAction, "Find Best Action")
|
|
203
|
+
], FindBestActionAction);
|
|
204
|
+
/**
|
|
205
|
+
* Loader function to ensure the FindBestActionAction class is included in the bundle
|
|
206
|
+
*/
|
|
207
|
+
function LoadFindBestActionAction() {
|
|
208
|
+
// Stub function to prevent tree shaking
|
|
209
|
+
}
|
|
210
|
+
exports.LoadFindBestActionAction = LoadFindBestActionAction;
|
|
211
|
+
//# sourceMappingURL=find-best-action.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-best-action.action.js","sourceRoot":"","sources":["../../../src/custom/ai/find-best-action.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,qDAAqD;AACrD,uDAAoD;AACpD,+CAA+C;AAG/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,oBAAU;IAChD;;;;;;;;;;OAUG;IACO,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,wCAAwC;YACxC,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;YACtE,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,IAAI,CAAC,CAAC;YAC9E,MAAM,sBAAsB,GAAG,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,wBAAwB,CAAC,IAAI,KAAK,CAAC,CAAC;YACzG,MAAM,sBAAsB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,wBAAwB,EAAE,IAAI,CAAC,CAAC;YAE5F,0BAA0B;YAC1B,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1D,OAAO;oBACH,OAAO,EAAE,KAAK;oBACd,UAAU,EAAE,eAAe;oBAC3B,OAAO,EAAE,2DA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AEC"}
|
|
@@ -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;IAE1E;;;;;;;;;;OAUG;IACO,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,wCAAwC;YACxC,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;YACtE,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,YAAY,CAA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|
|
@@ -52,13 +52,13 @@ export declare class SummarizeContentAction extends BaseAction {
|
|
|
52
52
|
*/
|
|
53
53
|
private fetchWebPageContent;
|
|
54
54
|
/**
|
|
55
|
-
* Generate summary using
|
|
55
|
+
* Generate summary using AI Prompts package directly
|
|
56
56
|
*/
|
|
57
57
|
private generateSummary;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Get prompt by name and category from AIEngine
|
|
60
60
|
*/
|
|
61
|
-
private
|
|
61
|
+
private getPromptByNameAndCategory;
|
|
62
62
|
private getStringParam;
|
|
63
63
|
private getNumericParam;
|
|
64
64
|
private getBooleanParam;
|
|
@@ -1 +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,
|
|
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"}
|