@memberjunction/core-actions 6.2.0-edge.1 → 6.2.0-edge.2
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/base-find-agents.action.d.ts.map +1 -1
- package/dist/custom/ai/base-find-agents.action.js +2 -7
- package/dist/custom/ai/base-find-agents.action.js.map +1 -1
- package/dist/custom/ai/find-candidate-agents.action.d.ts.map +1 -1
- package/dist/custom/ai/find-candidate-agents.action.js +2 -1
- package/dist/custom/ai/find-candidate-agents.action.js.map +1 -1
- package/dist/custom/ai/generate-image.action.d.ts +63 -5
- package/dist/custom/ai/generate-image.action.d.ts.map +1 -1
- package/dist/custom/ai/generate-image.action.js +196 -139
- package/dist/custom/ai/generate-image.action.js.map +1 -1
- package/dist/custom/ai/run-decision.action.d.ts +45 -0
- package/dist/custom/ai/run-decision.action.d.ts.map +1 -0
- package/dist/custom/ai/run-decision.action.js +169 -0
- package/dist/custom/ai/run-decision.action.js.map +1 -0
- package/dist/custom/record-cloning/clone-record.action.d.ts +15 -0
- package/dist/custom/record-cloning/clone-record.action.d.ts.map +1 -0
- package/dist/custom/record-cloning/clone-record.action.js +125 -0
- package/dist/custom/record-cloning/clone-record.action.js.map +1 -0
- package/dist/custom/record-cloning/clone-records.action.d.ts +15 -0
- package/dist/custom/record-cloning/clone-records.action.d.ts.map +1 -0
- package/dist/custom/record-cloning/clone-records.action.js +175 -0
- package/dist/custom/record-cloning/clone-records.action.js.map +1 -0
- package/dist/custom/utilities/vectorize-entity.action.js +1 -1
- package/dist/custom/utilities/vectorize-entity.action.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +42 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-find-agents.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/base-find-agents.action.ts"],"names":[],"mappings":"AAAA,OAAO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uBAAuB,EAAE;cAIvG,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkGvF,iDAAiD;IACjD,SAAS,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAMxD,8EAA8E;IAC9E,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAoBrF,iGAAiG;IACjG,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAcrG"}
|
|
@@ -88,13 +88,8 @@ export class BaseFindAgentsAction extends BaseAction {
|
|
|
88
88
|
scoreById.set(NormalizeUUID(agent.ID), reported);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
// Permission-filter to agents the user can 'run'
|
|
92
|
-
|
|
93
|
-
const accessibleAgentIds = new Set(accessibleAgents.map(a => NormalizeUUID(a.ID)));
|
|
94
|
-
matched = matched.filter(a => accessibleAgentIds.has(NormalizeUUID(a.ID)));
|
|
95
|
-
if (!includeInactive) {
|
|
96
|
-
matched = matched.filter(a => a.Status === 'Active');
|
|
97
|
-
}
|
|
91
|
+
// Permission-filter to agents the user can 'run' (Active only unless includeInactive)
|
|
92
|
+
matched = await AIAgentPermissionHelper.FilterRunnableAgents(matched, params.ContextUser, includeInactive);
|
|
98
93
|
matched = this.applyInvocationFilter(matched, params).slice(0, maxResults);
|
|
99
94
|
if (matched.length === 0) {
|
|
100
95
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-find-agents.action.js","sourceRoot":"","sources":["../../../src/custom/ai/base-find-agents.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC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AE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"find-candidate-agents.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/find-candidate-agents.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAGjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,yBAA0B,SAAQ,oBAAoB;IAC/D,SAAS,KAAK,WAAW,IAAI,MAAM,CAAoC;IACvE,SAAS,KAAK,sBAAsB,IAAI,OAAO,CAAiB;cAE7C,qBAAqB,CAAC,MAAM,EAAE,uBAAuB,EAAE,EAAE,MAAM,EAAE,eAAe,GAAG,uBAAuB,EAAE;CAQlI"}
|
|
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { RegisterClass } from "@memberjunction/global";
|
|
8
8
|
import { BaseAction } from "@memberjunction/actions";
|
|
9
|
+
import { AIAgentPermissionHelper } from "@memberjunction/ai-engine-base";
|
|
9
10
|
import { BaseFindAgentsAction } from "./base-find-agents.action.js";
|
|
10
11
|
import { GetActionBooleanParam } from "./semantic-entity-search.helper.js";
|
|
11
12
|
/**
|
|
@@ -35,7 +36,7 @@ let FindCandidateAgentsAction = class FindCandidateAgentsAction extends BaseFind
|
|
|
35
36
|
const excludeSubAgents = GetActionBooleanParam(params, 'excludesubagents', true);
|
|
36
37
|
if (excludeSubAgents) {
|
|
37
38
|
// Sub-Agents and child agents are meant to be called by other agents, not discovered directly
|
|
38
|
-
return agents.filter(a =>
|
|
39
|
+
return agents.filter(a => AIAgentPermissionHelper.IsDirectlyDiscoverable(a));
|
|
39
40
|
}
|
|
40
41
|
return agents;
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-candidate-agents.action.js","sourceRoot":"","sources":["../../../src/custom/ai/find-candidate-agents.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,oBAAoB;IAC/D,IAAc,WAAW,KAAa,OAAO,uBAAuB,CAAC,CAAC,CAAC;IACvE,IAAc,sBAAsB,KAAc,OAAO,IAAI,CAAC,CAAC,CAAC;IAE7C,qBAAqB,CAAC,MAAiC,EAAE,MAAuB;QAC/F,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,gBAAgB,EAAE,CAAC;YACnB,8FAA8F;YAC9F,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"find-candidate-agents.action.js","sourceRoot":"","sources":["../../../src/custom/ai/find-candidate-agents.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,oBAAoB;IAC/D,IAAc,WAAW,KAAa,OAAO,uBAAuB,CAAC,CAAC,CAAC;IACvE,IAAc,sBAAsB,KAAc,OAAO,IAAI,CAAC,CAAC,CAAC;IAE7C,qBAAqB,CAAC,MAAiC,EAAE,MAAuB;QAC/F,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC;QACjF,IAAI,gBAAgB,EAAE,CAAC;YACnB,8FAA8F;YAC9F,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAZY,yBAAyB;IADrC,aAAa,CAAC,UAAU,EAAE,uBAAuB,CAAC;GACtC,yBAAyB,CAYrC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ActionResultSimple, RunActionParams, RuntimeAPIKeyResolver } from "@memberjunction/actions-base";
|
|
2
2
|
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
import { AIAPIKey } from "@memberjunction/ai";
|
|
3
4
|
/**
|
|
4
5
|
* Action that generates images using AI image generation models (DALL-E, Gemini, etc.)
|
|
5
6
|
*
|
|
@@ -67,8 +68,30 @@ import { BaseAction } from "@memberjunction/actions";
|
|
|
67
68
|
* the platform key as it always did. Then the vendor-name fallback that was always here — but
|
|
68
69
|
* actually USED this time: the previous code found a key by vendor name and then handed the empty
|
|
69
70
|
* driver-class result to the generator, so that branch never produced an image.
|
|
71
|
+
*
|
|
72
|
+
* @deprecated Kept for compatibility only: `GenerateImageAction` no longer calls it. Use
|
|
73
|
+
* {@link BuildImageGenerationAPIKeys}, which the action and the runner use.
|
|
70
74
|
*/
|
|
71
75
|
export declare function ResolveImageGenerationAPIKey(driverClass: string, vendorName: string | undefined, resolve?: RuntimeAPIKeyResolver): string;
|
|
76
|
+
/** One vendor an image run may reach: the driver class that serves it, and the vendor's name. */
|
|
77
|
+
export interface ImageGenerationKeySource {
|
|
78
|
+
/** The driver class the runner builds for this vendor. */
|
|
79
|
+
DriverClass: string;
|
|
80
|
+
/** The vendor's name, for the vendor-name key fallback. */
|
|
81
|
+
VendorName?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The keys an image run hands the runner as `APIKeys`: at most one per driver class, resolved as
|
|
85
|
+
* {@link ResolveImageGenerationAPIKey} does. A key reaches only the candidates of its own driver
|
|
86
|
+
* class, so a run's own key survives failover to another vendor only if that vendor's class has
|
|
87
|
+
* one here.
|
|
88
|
+
*
|
|
89
|
+
* `sources` should be in the order the runner tries its candidates. When two sources share a driver
|
|
90
|
+
* class, the first whose key resolves wins, so the key a class carries is the one for the vendor the
|
|
91
|
+
* runner reaches first. A class with no key anywhere is left out: the runner may still resolve a
|
|
92
|
+
* credential binding for it, and otherwise skips it.
|
|
93
|
+
*/
|
|
94
|
+
export declare function BuildImageGenerationAPIKeys(sources: ImageGenerationKeySource[], resolve?: RuntimeAPIKeyResolver): AIAPIKey[];
|
|
72
95
|
export declare class GenerateImageAction extends BaseAction {
|
|
73
96
|
/**
|
|
74
97
|
* Generates or edits image(s) using AI image generation models.
|
|
@@ -78,7 +101,8 @@ export declare class GenerateImageAction extends BaseAction {
|
|
|
78
101
|
*
|
|
79
102
|
* @param params - The action parameters containing:
|
|
80
103
|
* - Prompt: Text description of the image to generate or edit instructions (required)
|
|
81
|
-
* - Model: Model name
|
|
104
|
+
* - Model: Model name or API name to pin (optional; when not specified, the `Default Image
|
|
105
|
+
* Generation` prompt's bindings choose, with failover between them)
|
|
82
106
|
* - NumberOfImages: Number of images to generate (optional, default: 1)
|
|
83
107
|
* - Size: Image size like "1024x1024" (optional)
|
|
84
108
|
* - Quality: Quality level - "standard" or "hd" (optional)
|
|
@@ -92,15 +116,49 @@ export declare class GenerateImageAction extends BaseAction {
|
|
|
92
116
|
*/
|
|
93
117
|
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
94
118
|
/**
|
|
95
|
-
*
|
|
119
|
+
* Build the runner options for this call.
|
|
120
|
+
*
|
|
121
|
+
* - **The model is pinned only when the caller named one.** Otherwise the `Default Image
|
|
122
|
+
* Generation` prompt's bindings choose, and its failover reaches the other models. As shipped,
|
|
123
|
+
* its top binding is the highest-PowerRank active image model, the one this action used to
|
|
124
|
+
* pick itself.
|
|
125
|
+
* - **`APIKeys` holds a key for every driver class the run may reach** (see
|
|
126
|
+
* {@link BuildImageGenerationAPIKeys}), so a run's own key carries across vendors on failover.
|
|
127
|
+
* Within a model the sources follow the runner's vendor order exactly; across models they
|
|
128
|
+
* follow PowerRank. That order matters only when two vendors share a driver class that has no
|
|
129
|
+
* key of its own, where it picks whose vendor-name key the class carries.
|
|
130
|
+
* - **The calling agent** (`Context.AgentID`, stamped by BaseAgent) is recorded on the run row.
|
|
131
|
+
*
|
|
132
|
+
* The keys rank as they do for chat prompts: a credential bound to the prompt-model, the
|
|
133
|
+
* model-vendor or the vendor, or a default credential of the vendor's credential type, wins
|
|
134
|
+
* over them. Only with none of those is the key the generator gets the one this action resolves.
|
|
135
|
+
*/
|
|
136
|
+
private prepareImageRun;
|
|
137
|
+
/** The active image models, highest PowerRank first. */
|
|
138
|
+
private activeImageModels;
|
|
139
|
+
/** The image model the caller named, by name or API name. */
|
|
140
|
+
private findNamedModel;
|
|
141
|
+
/** The named model's key sources. A named model with no active inference provider cannot run. */
|
|
142
|
+
private pinnedKeySources;
|
|
143
|
+
/**
|
|
144
|
+
* A model's active inference vendors, in the order the runner tries them (Priority, highest
|
|
145
|
+
* first), each with the driver class the runner builds for it.
|
|
96
146
|
*/
|
|
97
|
-
private
|
|
147
|
+
private keySources;
|
|
148
|
+
/** The calling agent's ID, which BaseAgent stamps on the action's context. */
|
|
149
|
+
private contextAgentID;
|
|
150
|
+
/** Runs the edit when a source image is given, otherwise the generation. */
|
|
151
|
+
private runImageOperation;
|
|
152
|
+
/** Maps the runner's result onto the action's result codes and output params. */
|
|
153
|
+
private toActionResult;
|
|
154
|
+
/** Adds the Images, ImageCount, RevisedPrompt and ModelUsed output params. */
|
|
155
|
+
private addOutputParams;
|
|
98
156
|
/**
|
|
99
|
-
* Execute text-to-image generation
|
|
157
|
+
* Execute text-to-image generation through the image runner
|
|
100
158
|
*/
|
|
101
159
|
private executeImageGeneration;
|
|
102
160
|
/**
|
|
103
|
-
* Execute image-to-image editing
|
|
161
|
+
* Execute image-to-image editing through the image runner
|
|
104
162
|
*/
|
|
105
163
|
private executeImageEdit;
|
|
106
164
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-image.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/generate-image.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1G,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-image.action.d.ts","sourceRoot":"","sources":["../../../src/custom/ai/generate-image.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1G,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EACH,QAAQ,EAKX,MAAM,oBAAoB,CAAC;AAW5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAIzI;AAUD,iGAAiG;AACjG,MAAM,WAAW,wBAAwB;IACrC,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,wBAAwB,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,QAAQ,EAAE,CAQ5H;AAQD,qBACa,mBAAoB,SAAQ,UAAU;IAE/C;;;;;;;;;;;;;;;;;;;;OAoBG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwBvF;;;;;;;;;;;;;;;;;OAiBG;YACW,eAAe;IAmB7B,wDAAwD;IACxD,OAAO,CAAC,iBAAiB;IAUzB,6DAA6D;IAC7D,OAAO,CAAC,cAAc;IAStB,iGAAiG;IACjG,OAAO,CAAC,gBAAgB;IAQxB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAUlB,8EAA8E;IAC9E,OAAO,CAAC,cAAc;IAMtB,4EAA4E;IAC5E,OAAO,CAAC,iBAAiB;IAgBzB,iFAAiF;IACjF,OAAO,CAAC,cAAc;IAsCtB,8EAA8E;IAC9E,OAAO,CAAC,eAAe;IA4BvB;;OAEG;YACW,sBAAsB;IAiCpC;;OAEG;YACW,gBAAgB;IA+B9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAYzB;;OAEG;IACH,OAAO,CAAC,aAAa;IAKrB;;OAEG;IACH,OAAO,CAAC,cAAc;CAMzB"}
|
|
@@ -6,9 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { RegisterClass } from "@memberjunction/global";
|
|
8
8
|
import { BaseAction } from "@memberjunction/actions";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { UUIDsEqual } from "@memberjunction/global";
|
|
10
|
+
import { GetAIAPIKey, } from "@memberjunction/ai";
|
|
11
11
|
import { AIEngineBase } from "@memberjunction/ai-engine-base";
|
|
12
|
+
import { AIImageGenerationRunner, } from "@memberjunction/ai-prompts";
|
|
12
13
|
/**
|
|
13
14
|
* Action that generates images using AI image generation models (DALL-E, Gemini, etc.)
|
|
14
15
|
*
|
|
@@ -76,15 +77,45 @@ import { AIEngineBase } from "@memberjunction/ai-engine-base";
|
|
|
76
77
|
* the platform key as it always did. Then the vendor-name fallback that was always here — but
|
|
77
78
|
* actually USED this time: the previous code found a key by vendor name and then handed the empty
|
|
78
79
|
* driver-class result to the generator, so that branch never produced an image.
|
|
80
|
+
*
|
|
81
|
+
* @deprecated Kept for compatibility only: `GenerateImageAction` no longer calls it. Use
|
|
82
|
+
* {@link BuildImageGenerationAPIKeys}, which the action and the runner use.
|
|
79
83
|
*/
|
|
80
84
|
export function ResolveImageGenerationAPIKey(driverClass, vendorName, resolve) {
|
|
85
|
+
const key = findImageGenerationAPIKey(driverClass, vendorName, resolve);
|
|
86
|
+
if (key)
|
|
87
|
+
return key;
|
|
88
|
+
throw new Error(`No API key found for ${driverClass} or vendor ${vendorName || 'unknown'}`);
|
|
89
|
+
}
|
|
90
|
+
/** {@link ResolveImageGenerationAPIKey}'s lookup, answering undefined rather than throwing when nothing resolves. */
|
|
91
|
+
function findImageGenerationAPIKey(driverClass, vendorName, resolve) {
|
|
81
92
|
const byDriver = resolve?.(driverClass) || GetAIAPIKey(driverClass);
|
|
82
93
|
if (byDriver)
|
|
83
94
|
return byDriver;
|
|
84
95
|
const byVendor = vendorName ? resolve?.(vendorName) || GetAIAPIKey(vendorName) : '';
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
return byVendor || undefined;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The keys an image run hands the runner as `APIKeys`: at most one per driver class, resolved as
|
|
100
|
+
* {@link ResolveImageGenerationAPIKey} does. A key reaches only the candidates of its own driver
|
|
101
|
+
* class, so a run's own key survives failover to another vendor only if that vendor's class has
|
|
102
|
+
* one here.
|
|
103
|
+
*
|
|
104
|
+
* `sources` should be in the order the runner tries its candidates. When two sources share a driver
|
|
105
|
+
* class, the first whose key resolves wins, so the key a class carries is the one for the vendor the
|
|
106
|
+
* runner reaches first. A class with no key anywhere is left out: the runner may still resolve a
|
|
107
|
+
* credential binding for it, and otherwise skips it.
|
|
108
|
+
*/
|
|
109
|
+
export function BuildImageGenerationAPIKeys(sources, resolve) {
|
|
110
|
+
const keys = [];
|
|
111
|
+
for (const source of sources) {
|
|
112
|
+
if (keys.some(k => k.driverClass === source.DriverClass))
|
|
113
|
+
continue;
|
|
114
|
+
const apiKey = findImageGenerationAPIKey(source.DriverClass, source.VendorName, resolve);
|
|
115
|
+
if (apiKey)
|
|
116
|
+
keys.push({ driverClass: source.DriverClass, apiKey });
|
|
117
|
+
}
|
|
118
|
+
return keys;
|
|
88
119
|
}
|
|
89
120
|
let GenerateImageAction = class GenerateImageAction extends BaseAction {
|
|
90
121
|
/**
|
|
@@ -95,7 +126,8 @@ let GenerateImageAction = class GenerateImageAction extends BaseAction {
|
|
|
95
126
|
*
|
|
96
127
|
* @param params - The action parameters containing:
|
|
97
128
|
* - Prompt: Text description of the image to generate or edit instructions (required)
|
|
98
|
-
* - Model: Model name
|
|
129
|
+
* - Model: Model name or API name to pin (optional; when not specified, the `Default Image
|
|
130
|
+
* Generation` prompt's bindings choose, with failover between them)
|
|
99
131
|
* - NumberOfImages: Number of images to generate (optional, default: 1)
|
|
100
132
|
* - Size: Image size like "1024x1024" (optional)
|
|
101
133
|
* - Quality: Quality level - "standard" or "hd" (optional)
|
|
@@ -110,16 +142,6 @@ let GenerateImageAction = class GenerateImageAction extends BaseAction {
|
|
|
110
142
|
async InternalRunAction(params) {
|
|
111
143
|
try {
|
|
112
144
|
const prompt = this.getParamValue(params, 'prompt');
|
|
113
|
-
const modelName = this.getParamValue(params, 'model');
|
|
114
|
-
const numberOfImages = this.getNumberParam(params, 'numberofimages', 1);
|
|
115
|
-
const size = this.getParamValue(params, 'size') || '1024x1024';
|
|
116
|
-
const quality = this.getParamValue(params, 'quality');
|
|
117
|
-
const style = this.getParamValue(params, 'style');
|
|
118
|
-
const negativePrompt = this.getParamValue(params, 'negativeprompt');
|
|
119
|
-
const outputFormat = this.getParamValue(params, 'outputformat') || 'base64';
|
|
120
|
-
const sourceImage = this.getParamValue(params, 'sourceimage');
|
|
121
|
-
const mask = this.getParamValue(params, 'mask');
|
|
122
|
-
// Validate prompt
|
|
123
145
|
if (!prompt) {
|
|
124
146
|
return {
|
|
125
147
|
Success: false,
|
|
@@ -127,89 +149,10 @@ let GenerateImageAction = class GenerateImageAction extends BaseAction {
|
|
|
127
149
|
ResultCode: "MISSING_PROMPT"
|
|
128
150
|
};
|
|
129
151
|
}
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// Image-to-image: use EditImage when source image is provided
|
|
135
|
-
result = await this.executeImageEdit(generator, {
|
|
136
|
-
prompt,
|
|
137
|
-
apiName,
|
|
138
|
-
sourceImage,
|
|
139
|
-
mask,
|
|
140
|
-
numberOfImages,
|
|
141
|
-
size,
|
|
142
|
-
outputFormat,
|
|
143
|
-
negativePrompt
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
// Text-to-image: use GenerateImage
|
|
148
|
-
result = await this.executeImageGeneration(generator, {
|
|
149
|
-
prompt,
|
|
150
|
-
apiName,
|
|
151
|
-
numberOfImages,
|
|
152
|
-
size,
|
|
153
|
-
outputFormat,
|
|
154
|
-
quality,
|
|
155
|
-
style,
|
|
156
|
-
negativePrompt
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
if (!result.success) {
|
|
160
|
-
return {
|
|
161
|
-
Success: false,
|
|
162
|
-
Message: `Image generation failed: ${result.errorMessage || 'Unknown error'}`,
|
|
163
|
-
ResultCode: "GENERATION_FAILED"
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
if (!result.images || result.images.length === 0) {
|
|
167
|
-
return {
|
|
168
|
-
Success: false,
|
|
169
|
-
Message: "No images were generated",
|
|
170
|
-
ResultCode: "NO_IMAGES"
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
// Format output images
|
|
174
|
-
const outputImages = result.images.map((img, index) => this.formatImageOutput(img, index));
|
|
175
|
-
// Add output parameters
|
|
176
|
-
params.Params.push({
|
|
177
|
-
Name: 'Images',
|
|
178
|
-
Type: 'Output',
|
|
179
|
-
Value: outputImages
|
|
180
|
-
});
|
|
181
|
-
params.Params.push({
|
|
182
|
-
Name: 'ImageCount',
|
|
183
|
-
Type: 'Output',
|
|
184
|
-
Value: result.images.length
|
|
185
|
-
});
|
|
186
|
-
if (result.revisedPrompt) {
|
|
187
|
-
params.Params.push({
|
|
188
|
-
Name: 'RevisedPrompt',
|
|
189
|
-
Type: 'Output',
|
|
190
|
-
Value: result.revisedPrompt
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
params.Params.push({
|
|
194
|
-
Name: 'ModelUsed',
|
|
195
|
-
Type: 'Output',
|
|
196
|
-
Value: model.Name
|
|
197
|
-
});
|
|
198
|
-
// Build response - NOTE: images data is in output params, not in Message
|
|
199
|
-
// This keeps Message lightweight for LLM context (base64 images are ~700K tokens each)
|
|
200
|
-
const responseData = {
|
|
201
|
-
message: `Successfully generated ${result.images.length} image(s)`,
|
|
202
|
-
model: model.Name,
|
|
203
|
-
imageCount: result.images.length,
|
|
204
|
-
// Images are available in the 'Images' output parameter
|
|
205
|
-
// Use the provided placeholder references in your response
|
|
206
|
-
revisedPrompt: result.revisedPrompt
|
|
207
|
-
};
|
|
208
|
-
return {
|
|
209
|
-
Success: true,
|
|
210
|
-
ResultCode: "IMAGES_GENERATED",
|
|
211
|
-
Message: JSON.stringify(responseData, null, 2)
|
|
212
|
-
};
|
|
152
|
+
const { PinnedModel, RunOptions } = await this.prepareImageRun(params, this.getParamValue(params, 'model'));
|
|
153
|
+
const runResult = await this.runImageOperation(params, prompt, RunOptions);
|
|
154
|
+
// The model that answered, which after failover may not be the first choice
|
|
155
|
+
return this.toActionResult(params, runResult, runResult.ModelName ?? PinnedModel?.Name ?? '');
|
|
213
156
|
}
|
|
214
157
|
catch (error) {
|
|
215
158
|
return {
|
|
@@ -220,53 +163,167 @@ let GenerateImageAction = class GenerateImageAction extends BaseAction {
|
|
|
220
163
|
}
|
|
221
164
|
}
|
|
222
165
|
/**
|
|
223
|
-
*
|
|
166
|
+
* Build the runner options for this call.
|
|
167
|
+
*
|
|
168
|
+
* - **The model is pinned only when the caller named one.** Otherwise the `Default Image
|
|
169
|
+
* Generation` prompt's bindings choose, and its failover reaches the other models. As shipped,
|
|
170
|
+
* its top binding is the highest-PowerRank active image model, the one this action used to
|
|
171
|
+
* pick itself.
|
|
172
|
+
* - **`APIKeys` holds a key for every driver class the run may reach** (see
|
|
173
|
+
* {@link BuildImageGenerationAPIKeys}), so a run's own key carries across vendors on failover.
|
|
174
|
+
* Within a model the sources follow the runner's vendor order exactly; across models they
|
|
175
|
+
* follow PowerRank. That order matters only when two vendors share a driver class that has no
|
|
176
|
+
* key of its own, where it picks whose vendor-name key the class carries.
|
|
177
|
+
* - **The calling agent** (`Context.AgentID`, stamped by BaseAgent) is recorded on the run row.
|
|
178
|
+
*
|
|
179
|
+
* The keys rank as they do for chat prompts: a credential bound to the prompt-model, the
|
|
180
|
+
* model-vendor or the vendor, or a default credential of the vendor's credential type, wins
|
|
181
|
+
* over them. Only with none of those is the key the generator gets the one this action resolves.
|
|
224
182
|
*/
|
|
225
|
-
async
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
183
|
+
async prepareImageRun(params, modelName) {
|
|
184
|
+
await AIEngineBase.Instance.Config(false, params.ContextUser);
|
|
185
|
+
const imageModels = this.activeImageModels();
|
|
186
|
+
const pinned = modelName ? this.findNamedModel(imageModels, modelName) : undefined;
|
|
187
|
+
const sources = pinned ? this.pinnedKeySources(pinned) : imageModels.flatMap(m => this.keySources(m));
|
|
188
|
+
const runOptions = {
|
|
189
|
+
ContextUser: params.ContextUser,
|
|
190
|
+
APIKeys: BuildImageGenerationAPIKeys(sources, params.RuntimeAPIKeyResolver)
|
|
191
|
+
};
|
|
192
|
+
if (pinned) {
|
|
193
|
+
runOptions.ModelID = pinned.ID;
|
|
232
194
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const foundModel = imageGeneratorModels.find(m => m.Name.toLowerCase() === modelName.toLowerCase() ||
|
|
237
|
-
(m.APIName && m.APIName.toLowerCase() === modelName.toLowerCase()));
|
|
238
|
-
if (!foundModel) {
|
|
239
|
-
throw new Error(`Image generator model '${modelName}' not found`);
|
|
240
|
-
}
|
|
241
|
-
model = foundModel;
|
|
195
|
+
const agentId = this.contextAgentID(params);
|
|
196
|
+
if (agentId) {
|
|
197
|
+
runOptions.AgentID = agentId;
|
|
242
198
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
199
|
+
return { PinnedModel: pinned, RunOptions: runOptions };
|
|
200
|
+
}
|
|
201
|
+
/** The active image models, highest PowerRank first. */
|
|
202
|
+
activeImageModels() {
|
|
203
|
+
const models = AIEngineBase.Instance.Models.filter(m => m.AIModelType?.toLowerCase() === 'image generator' && m.IsActive);
|
|
204
|
+
if (models.length === 0) {
|
|
205
|
+
throw new Error('No active image generator models found');
|
|
206
|
+
}
|
|
207
|
+
return [...models].sort((a, b) => (b.PowerRank || 0) - (a.PowerRank || 0));
|
|
208
|
+
}
|
|
209
|
+
/** The image model the caller named, by name or API name. */
|
|
210
|
+
findNamedModel(models, modelName) {
|
|
211
|
+
const wanted = modelName.toLowerCase();
|
|
212
|
+
const found = models.find(m => m.Name.toLowerCase() === wanted || (m.APIName && m.APIName.toLowerCase() === wanted));
|
|
213
|
+
if (!found) {
|
|
214
|
+
throw new Error(`Image generator model '${modelName}' not found`);
|
|
246
215
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
216
|
+
return found;
|
|
217
|
+
}
|
|
218
|
+
/** The named model's key sources. A named model with no active inference provider cannot run. */
|
|
219
|
+
pinnedKeySources(model) {
|
|
220
|
+
const sources = this.keySources(model);
|
|
221
|
+
if (sources.length === 0) {
|
|
251
222
|
throw new Error(`No active inference provider found for model '${model.Name}'`);
|
|
252
223
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
224
|
+
return sources;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* A model's active inference vendors, in the order the runner tries them (Priority, highest
|
|
228
|
+
* first), each with the driver class the runner builds for it.
|
|
229
|
+
*/
|
|
230
|
+
keySources(model) {
|
|
231
|
+
return model.ModelVendors
|
|
232
|
+
.filter(mv => mv.Status === 'Active' && AIEngineBase.Instance.IsInferenceProvider(mv) && (mv.DriverClass || model.DriverClass))
|
|
233
|
+
.sort((a, b) => (b.Priority || 0) - (a.Priority || 0))
|
|
234
|
+
.map(mv => ({
|
|
235
|
+
DriverClass: mv.DriverClass || model.DriverClass,
|
|
236
|
+
VendorName: AIEngineBase.Instance.Vendors.find(v => UUIDsEqual(v.ID, mv.VendorID))?.Name
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
/** The calling agent's ID, which BaseAgent stamps on the action's context. */
|
|
240
|
+
contextAgentID(params) {
|
|
241
|
+
const context = params.Context;
|
|
242
|
+
const agentId = context?.AgentID;
|
|
243
|
+
return typeof agentId === 'string' && agentId.trim().length > 0 ? agentId : undefined;
|
|
244
|
+
}
|
|
245
|
+
/** Runs the edit when a source image is given, otherwise the generation. */
|
|
246
|
+
runImageOperation(params, prompt, runOptions) {
|
|
247
|
+
const numberOfImages = this.getNumberParam(params, 'numberofimages', 1);
|
|
248
|
+
const size = this.getParamValue(params, 'size') || '1024x1024';
|
|
249
|
+
const outputFormat = this.getParamValue(params, 'outputformat') || 'base64';
|
|
250
|
+
const negativePrompt = this.getParamValue(params, 'negativeprompt');
|
|
251
|
+
const sourceImage = this.getParamValue(params, 'sourceimage');
|
|
252
|
+
if (sourceImage) {
|
|
253
|
+
// Image-to-image: use EditImage when source image is provided
|
|
254
|
+
const mask = this.getParamValue(params, 'mask');
|
|
255
|
+
return this.executeImageEdit(runOptions, { prompt, sourceImage, mask, numberOfImages, size, outputFormat, negativePrompt });
|
|
256
|
+
}
|
|
257
|
+
const quality = this.getParamValue(params, 'quality');
|
|
258
|
+
const style = this.getParamValue(params, 'style');
|
|
259
|
+
return this.executeImageGeneration(runOptions, { prompt, numberOfImages, size, outputFormat, quality, style, negativePrompt });
|
|
260
|
+
}
|
|
261
|
+
/** Maps the runner's result onto the action's result codes and output params. */
|
|
262
|
+
toActionResult(params, runResult, modelName) {
|
|
263
|
+
if (!runResult.Success) {
|
|
264
|
+
return {
|
|
265
|
+
Success: false,
|
|
266
|
+
Message: `Image generation failed: ${runResult.ErrorMessage || 'Unknown error'}`,
|
|
267
|
+
ResultCode: "GENERATION_FAILED"
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
const result = runResult.ImageResult;
|
|
271
|
+
if (!result?.images || result.images.length === 0) {
|
|
272
|
+
return {
|
|
273
|
+
Success: false,
|
|
274
|
+
Message: "No images were generated",
|
|
275
|
+
ResultCode: "NO_IMAGES"
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
this.addOutputParams(params, result, modelName);
|
|
279
|
+
// Build response - NOTE: images data is in output params, not in Message
|
|
280
|
+
// This keeps Message lightweight for LLM context (base64 images are ~700K tokens each)
|
|
281
|
+
const responseData = {
|
|
282
|
+
message: `Successfully generated ${result.images.length} image(s)`,
|
|
283
|
+
model: modelName,
|
|
284
|
+
imageCount: result.images.length,
|
|
285
|
+
// Images are available in the 'Images' output parameter
|
|
286
|
+
// Use the provided placeholder references in your response
|
|
287
|
+
revisedPrompt: result.revisedPrompt
|
|
288
|
+
};
|
|
289
|
+
return {
|
|
290
|
+
Success: true,
|
|
291
|
+
ResultCode: "IMAGES_GENERATED",
|
|
292
|
+
Message: JSON.stringify(responseData, null, 2)
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/** Adds the Images, ImageCount, RevisedPrompt and ModelUsed output params. */
|
|
296
|
+
addOutputParams(params, result, modelName) {
|
|
297
|
+
params.Params.push({
|
|
298
|
+
Name: 'Images',
|
|
299
|
+
Type: 'Output',
|
|
300
|
+
Value: result.images.map((img, index) => this.formatImageOutput(img, index))
|
|
301
|
+
});
|
|
302
|
+
params.Params.push({
|
|
303
|
+
Name: 'ImageCount',
|
|
304
|
+
Type: 'Output',
|
|
305
|
+
Value: result.images.length
|
|
306
|
+
});
|
|
307
|
+
if (result.revisedPrompt) {
|
|
308
|
+
params.Params.push({
|
|
309
|
+
Name: 'RevisedPrompt',
|
|
310
|
+
Type: 'Output',
|
|
311
|
+
Value: result.revisedPrompt
|
|
312
|
+
});
|
|
260
313
|
}
|
|
261
|
-
|
|
314
|
+
params.Params.push({
|
|
315
|
+
Name: 'ModelUsed',
|
|
316
|
+
Type: 'Output',
|
|
317
|
+
Value: modelName
|
|
318
|
+
});
|
|
262
319
|
}
|
|
263
320
|
/**
|
|
264
|
-
* Execute text-to-image generation
|
|
321
|
+
* Execute text-to-image generation through the image runner
|
|
265
322
|
*/
|
|
266
|
-
async executeImageGeneration(
|
|
323
|
+
async executeImageGeneration(runOptions, options) {
|
|
267
324
|
const genParams = {
|
|
325
|
+
...runOptions,
|
|
268
326
|
prompt: options.prompt,
|
|
269
|
-
model: options.apiName,
|
|
270
327
|
n: options.numberOfImages,
|
|
271
328
|
size: options.size,
|
|
272
329
|
outputFormat: options.outputFormat === 'url' ? 'url' : 'b64_json'
|
|
@@ -280,15 +337,15 @@ let GenerateImageAction = class GenerateImageAction extends BaseAction {
|
|
|
280
337
|
if (options.negativePrompt) {
|
|
281
338
|
genParams.negativePrompt = options.negativePrompt;
|
|
282
339
|
}
|
|
283
|
-
return
|
|
340
|
+
return new AIImageGenerationRunner().RunImageGeneration(genParams);
|
|
284
341
|
}
|
|
285
342
|
/**
|
|
286
|
-
* Execute image-to-image editing
|
|
343
|
+
* Execute image-to-image editing through the image runner
|
|
287
344
|
*/
|
|
288
|
-
async executeImageEdit(
|
|
345
|
+
async executeImageEdit(runOptions, options) {
|
|
289
346
|
const editParams = {
|
|
347
|
+
...runOptions,
|
|
290
348
|
prompt: options.prompt,
|
|
291
|
-
model: options.apiName,
|
|
292
349
|
image: options.sourceImage,
|
|
293
350
|
n: options.numberOfImages,
|
|
294
351
|
size: options.size,
|
|
@@ -300,7 +357,7 @@ let GenerateImageAction = class GenerateImageAction extends BaseAction {
|
|
|
300
357
|
if (options.negativePrompt) {
|
|
301
358
|
editParams.negativePrompt = options.negativePrompt;
|
|
302
359
|
}
|
|
303
|
-
return
|
|
360
|
+
return new AIImageGenerationRunner().RunImageEdit(editParams);
|
|
304
361
|
}
|
|
305
362
|
/**
|
|
306
363
|
* Format a generated image for output as MediaOutput
|