@everworker/oneringai 0.1.0 → 0.1.1
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/README.md +1 -0
- package/dist/capabilities/images/index.cjs.map +1 -1
- package/dist/capabilities/images/index.js.map +1 -1
- package/dist/index.cjs +747 -115
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +182 -5
- package/dist/index.d.ts +182 -5
- package/dist/index.js +741 -116
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5322,8 +5322,8 @@ var require_utils = __commonJS({
|
|
|
5322
5322
|
}
|
|
5323
5323
|
return ind;
|
|
5324
5324
|
}
|
|
5325
|
-
function removeDotSegments(
|
|
5326
|
-
let input =
|
|
5325
|
+
function removeDotSegments(path6) {
|
|
5326
|
+
let input = path6;
|
|
5327
5327
|
const output = [];
|
|
5328
5328
|
let nextSlash = -1;
|
|
5329
5329
|
let len = 0;
|
|
@@ -5521,8 +5521,8 @@ var require_schemes = __commonJS({
|
|
|
5521
5521
|
wsComponent.secure = void 0;
|
|
5522
5522
|
}
|
|
5523
5523
|
if (wsComponent.resourceName) {
|
|
5524
|
-
const [
|
|
5525
|
-
wsComponent.path =
|
|
5524
|
+
const [path6, query] = wsComponent.resourceName.split("?");
|
|
5525
|
+
wsComponent.path = path6 && path6 !== "/" ? path6 : void 0;
|
|
5526
5526
|
wsComponent.query = query;
|
|
5527
5527
|
wsComponent.resourceName = void 0;
|
|
5528
5528
|
}
|
|
@@ -14452,12 +14452,12 @@ var require_dist = __commonJS({
|
|
|
14452
14452
|
throw new Error(`Unknown format "${name}"`);
|
|
14453
14453
|
return f;
|
|
14454
14454
|
};
|
|
14455
|
-
function addFormats(ajv, list,
|
|
14455
|
+
function addFormats(ajv, list, fs18, exportName) {
|
|
14456
14456
|
var _a;
|
|
14457
14457
|
var _b;
|
|
14458
14458
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
14459
14459
|
for (const f of list)
|
|
14460
|
-
ajv.addFormat(f,
|
|
14460
|
+
ajv.addFormat(f, fs18[f]);
|
|
14461
14461
|
}
|
|
14462
14462
|
module.exports = exports$1 = formatsPlugin;
|
|
14463
14463
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
@@ -14470,8 +14470,8 @@ var require_windows = __commonJS({
|
|
|
14470
14470
|
"node_modules/isexe/windows.js"(exports$1, module) {
|
|
14471
14471
|
module.exports = isexe;
|
|
14472
14472
|
isexe.sync = sync;
|
|
14473
|
-
var
|
|
14474
|
-
function checkPathExt(
|
|
14473
|
+
var fs18 = __require("fs");
|
|
14474
|
+
function checkPathExt(path6, options) {
|
|
14475
14475
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
14476
14476
|
if (!pathext) {
|
|
14477
14477
|
return true;
|
|
@@ -14482,25 +14482,25 @@ var require_windows = __commonJS({
|
|
|
14482
14482
|
}
|
|
14483
14483
|
for (var i = 0; i < pathext.length; i++) {
|
|
14484
14484
|
var p = pathext[i].toLowerCase();
|
|
14485
|
-
if (p &&
|
|
14485
|
+
if (p && path6.substr(-p.length).toLowerCase() === p) {
|
|
14486
14486
|
return true;
|
|
14487
14487
|
}
|
|
14488
14488
|
}
|
|
14489
14489
|
return false;
|
|
14490
14490
|
}
|
|
14491
|
-
function checkStat(stat5,
|
|
14491
|
+
function checkStat(stat5, path6, options) {
|
|
14492
14492
|
if (!stat5.isSymbolicLink() && !stat5.isFile()) {
|
|
14493
14493
|
return false;
|
|
14494
14494
|
}
|
|
14495
|
-
return checkPathExt(
|
|
14495
|
+
return checkPathExt(path6, options);
|
|
14496
14496
|
}
|
|
14497
|
-
function isexe(
|
|
14498
|
-
|
|
14499
|
-
cb(er, er ? false : checkStat(stat5,
|
|
14497
|
+
function isexe(path6, options, cb) {
|
|
14498
|
+
fs18.stat(path6, function(er, stat5) {
|
|
14499
|
+
cb(er, er ? false : checkStat(stat5, path6, options));
|
|
14500
14500
|
});
|
|
14501
14501
|
}
|
|
14502
|
-
function sync(
|
|
14503
|
-
return checkStat(
|
|
14502
|
+
function sync(path6, options) {
|
|
14503
|
+
return checkStat(fs18.statSync(path6), path6, options);
|
|
14504
14504
|
}
|
|
14505
14505
|
}
|
|
14506
14506
|
});
|
|
@@ -14510,14 +14510,14 @@ var require_mode = __commonJS({
|
|
|
14510
14510
|
"node_modules/isexe/mode.js"(exports$1, module) {
|
|
14511
14511
|
module.exports = isexe;
|
|
14512
14512
|
isexe.sync = sync;
|
|
14513
|
-
var
|
|
14514
|
-
function isexe(
|
|
14515
|
-
|
|
14513
|
+
var fs18 = __require("fs");
|
|
14514
|
+
function isexe(path6, options, cb) {
|
|
14515
|
+
fs18.stat(path6, function(er, stat5) {
|
|
14516
14516
|
cb(er, er ? false : checkStat(stat5, options));
|
|
14517
14517
|
});
|
|
14518
14518
|
}
|
|
14519
|
-
function sync(
|
|
14520
|
-
return checkStat(
|
|
14519
|
+
function sync(path6, options) {
|
|
14520
|
+
return checkStat(fs18.statSync(path6), options);
|
|
14521
14521
|
}
|
|
14522
14522
|
function checkStat(stat5, options) {
|
|
14523
14523
|
return stat5.isFile() && checkMode(stat5, options);
|
|
@@ -14550,7 +14550,7 @@ var require_isexe = __commonJS({
|
|
|
14550
14550
|
}
|
|
14551
14551
|
module.exports = isexe;
|
|
14552
14552
|
isexe.sync = sync;
|
|
14553
|
-
function isexe(
|
|
14553
|
+
function isexe(path6, options, cb) {
|
|
14554
14554
|
if (typeof options === "function") {
|
|
14555
14555
|
cb = options;
|
|
14556
14556
|
options = {};
|
|
@@ -14560,7 +14560,7 @@ var require_isexe = __commonJS({
|
|
|
14560
14560
|
throw new TypeError("callback not provided");
|
|
14561
14561
|
}
|
|
14562
14562
|
return new Promise(function(resolve4, reject) {
|
|
14563
|
-
isexe(
|
|
14563
|
+
isexe(path6, options || {}, function(er, is) {
|
|
14564
14564
|
if (er) {
|
|
14565
14565
|
reject(er);
|
|
14566
14566
|
} else {
|
|
@@ -14569,7 +14569,7 @@ var require_isexe = __commonJS({
|
|
|
14569
14569
|
});
|
|
14570
14570
|
});
|
|
14571
14571
|
}
|
|
14572
|
-
core(
|
|
14572
|
+
core(path6, options || {}, function(er, is) {
|
|
14573
14573
|
if (er) {
|
|
14574
14574
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
14575
14575
|
er = null;
|
|
@@ -14579,9 +14579,9 @@ var require_isexe = __commonJS({
|
|
|
14579
14579
|
cb(er, is);
|
|
14580
14580
|
});
|
|
14581
14581
|
}
|
|
14582
|
-
function sync(
|
|
14582
|
+
function sync(path6, options) {
|
|
14583
14583
|
try {
|
|
14584
|
-
return core.sync(
|
|
14584
|
+
return core.sync(path6, options || {});
|
|
14585
14585
|
} catch (er) {
|
|
14586
14586
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
14587
14587
|
return false;
|
|
@@ -14597,7 +14597,7 @@ var require_isexe = __commonJS({
|
|
|
14597
14597
|
var require_which = __commonJS({
|
|
14598
14598
|
"node_modules/which/which.js"(exports$1, module) {
|
|
14599
14599
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
14600
|
-
var
|
|
14600
|
+
var path6 = __require("path");
|
|
14601
14601
|
var COLON = isWindows ? ";" : ":";
|
|
14602
14602
|
var isexe = require_isexe();
|
|
14603
14603
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -14635,7 +14635,7 @@ var require_which = __commonJS({
|
|
|
14635
14635
|
return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
|
|
14636
14636
|
const ppRaw = pathEnv[i];
|
|
14637
14637
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
14638
|
-
const pCmd =
|
|
14638
|
+
const pCmd = path6.join(pathPart, cmd);
|
|
14639
14639
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
14640
14640
|
resolve4(subStep(p, i, 0));
|
|
14641
14641
|
});
|
|
@@ -14662,7 +14662,7 @@ var require_which = __commonJS({
|
|
|
14662
14662
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
14663
14663
|
const ppRaw = pathEnv[i];
|
|
14664
14664
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
14665
|
-
const pCmd =
|
|
14665
|
+
const pCmd = path6.join(pathPart, cmd);
|
|
14666
14666
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
14667
14667
|
for (let j = 0; j < pathExt.length; j++) {
|
|
14668
14668
|
const cur = p + pathExt[j];
|
|
@@ -14708,7 +14708,7 @@ var require_path_key = __commonJS({
|
|
|
14708
14708
|
// node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
14709
14709
|
var require_resolveCommand = __commonJS({
|
|
14710
14710
|
"node_modules/cross-spawn/lib/util/resolveCommand.js"(exports$1, module) {
|
|
14711
|
-
var
|
|
14711
|
+
var path6 = __require("path");
|
|
14712
14712
|
var which = require_which();
|
|
14713
14713
|
var getPathKey = require_path_key();
|
|
14714
14714
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -14726,7 +14726,7 @@ var require_resolveCommand = __commonJS({
|
|
|
14726
14726
|
try {
|
|
14727
14727
|
resolved = which.sync(parsed.command, {
|
|
14728
14728
|
path: env[getPathKey({ env })],
|
|
14729
|
-
pathExt: withoutPathExt ?
|
|
14729
|
+
pathExt: withoutPathExt ? path6.delimiter : void 0
|
|
14730
14730
|
});
|
|
14731
14731
|
} catch (e) {
|
|
14732
14732
|
} finally {
|
|
@@ -14735,7 +14735,7 @@ var require_resolveCommand = __commonJS({
|
|
|
14735
14735
|
}
|
|
14736
14736
|
}
|
|
14737
14737
|
if (resolved) {
|
|
14738
|
-
resolved =
|
|
14738
|
+
resolved = path6.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
14739
14739
|
}
|
|
14740
14740
|
return resolved;
|
|
14741
14741
|
}
|
|
@@ -14786,8 +14786,8 @@ var require_shebang_command = __commonJS({
|
|
|
14786
14786
|
if (!match) {
|
|
14787
14787
|
return null;
|
|
14788
14788
|
}
|
|
14789
|
-
const [
|
|
14790
|
-
const binary =
|
|
14789
|
+
const [path6, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
14790
|
+
const binary = path6.split("/").pop();
|
|
14791
14791
|
if (binary === "env") {
|
|
14792
14792
|
return argument;
|
|
14793
14793
|
}
|
|
@@ -14799,16 +14799,16 @@ var require_shebang_command = __commonJS({
|
|
|
14799
14799
|
// node_modules/cross-spawn/lib/util/readShebang.js
|
|
14800
14800
|
var require_readShebang = __commonJS({
|
|
14801
14801
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports$1, module) {
|
|
14802
|
-
var
|
|
14802
|
+
var fs18 = __require("fs");
|
|
14803
14803
|
var shebangCommand = require_shebang_command();
|
|
14804
14804
|
function readShebang(command) {
|
|
14805
14805
|
const size = 150;
|
|
14806
14806
|
const buffer = Buffer.alloc(size);
|
|
14807
14807
|
let fd;
|
|
14808
14808
|
try {
|
|
14809
|
-
fd =
|
|
14810
|
-
|
|
14811
|
-
|
|
14809
|
+
fd = fs18.openSync(command, "r");
|
|
14810
|
+
fs18.readSync(fd, buffer, 0, size, 0);
|
|
14811
|
+
fs18.closeSync(fd);
|
|
14812
14812
|
} catch (e) {
|
|
14813
14813
|
}
|
|
14814
14814
|
return shebangCommand(buffer.toString());
|
|
@@ -14820,7 +14820,7 @@ var require_readShebang = __commonJS({
|
|
|
14820
14820
|
// node_modules/cross-spawn/lib/parse.js
|
|
14821
14821
|
var require_parse = __commonJS({
|
|
14822
14822
|
"node_modules/cross-spawn/lib/parse.js"(exports$1, module) {
|
|
14823
|
-
var
|
|
14823
|
+
var path6 = __require("path");
|
|
14824
14824
|
var resolveCommand = require_resolveCommand();
|
|
14825
14825
|
var escape2 = require_escape();
|
|
14826
14826
|
var readShebang = require_readShebang();
|
|
@@ -14845,7 +14845,7 @@ var require_parse = __commonJS({
|
|
|
14845
14845
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
14846
14846
|
if (parsed.options.forceShell || needsShell) {
|
|
14847
14847
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
14848
|
-
parsed.command =
|
|
14848
|
+
parsed.command = path6.normalize(parsed.command);
|
|
14849
14849
|
parsed.command = escape2.command(parsed.command);
|
|
14850
14850
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
14851
14851
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -27137,8 +27137,8 @@ exports.logger.child({ component: "SmartCompactor" });
|
|
|
27137
27137
|
/**
|
|
27138
27138
|
* Load configuration from file
|
|
27139
27139
|
*/
|
|
27140
|
-
static async load(
|
|
27141
|
-
const configPath =
|
|
27140
|
+
static async load(path6) {
|
|
27141
|
+
const configPath = path6 ? path3.resolve(path6) : await this.findConfig();
|
|
27142
27142
|
if (!configPath) {
|
|
27143
27143
|
throw new Error("Configuration file not found. Searched: " + this.DEFAULT_PATHS.join(", "));
|
|
27144
27144
|
}
|
|
@@ -27158,14 +27158,14 @@ exports.logger.child({ component: "SmartCompactor" });
|
|
|
27158
27158
|
/**
|
|
27159
27159
|
* Load configuration synchronously
|
|
27160
27160
|
*/
|
|
27161
|
-
static loadSync(
|
|
27162
|
-
const configPath =
|
|
27161
|
+
static loadSync(path6) {
|
|
27162
|
+
const configPath = path6 ? path3.resolve(path6) : this.findConfigSync();
|
|
27163
27163
|
if (!configPath) {
|
|
27164
27164
|
throw new Error("Configuration file not found. Searched: " + this.DEFAULT_PATHS.join(", "));
|
|
27165
27165
|
}
|
|
27166
27166
|
try {
|
|
27167
|
-
const
|
|
27168
|
-
const content =
|
|
27167
|
+
const fs18 = __require("fs");
|
|
27168
|
+
const content = fs18.readFileSync(configPath, "utf-8");
|
|
27169
27169
|
let config = JSON.parse(content);
|
|
27170
27170
|
config = this.interpolateEnvVars(config);
|
|
27171
27171
|
this.validate(config);
|
|
@@ -27181,10 +27181,10 @@ exports.logger.child({ component: "SmartCompactor" });
|
|
|
27181
27181
|
* Find configuration file in default paths
|
|
27182
27182
|
*/
|
|
27183
27183
|
static async findConfig() {
|
|
27184
|
-
for (const
|
|
27184
|
+
for (const path6 of this.DEFAULT_PATHS) {
|
|
27185
27185
|
try {
|
|
27186
|
-
await fs15.promises.access(path3.resolve(
|
|
27187
|
-
return path3.resolve(
|
|
27186
|
+
await fs15.promises.access(path3.resolve(path6));
|
|
27187
|
+
return path3.resolve(path6);
|
|
27188
27188
|
} catch {
|
|
27189
27189
|
}
|
|
27190
27190
|
}
|
|
@@ -27194,11 +27194,11 @@ exports.logger.child({ component: "SmartCompactor" });
|
|
|
27194
27194
|
* Find configuration file synchronously
|
|
27195
27195
|
*/
|
|
27196
27196
|
static findConfigSync() {
|
|
27197
|
-
const
|
|
27198
|
-
for (const
|
|
27197
|
+
const fs18 = __require("fs");
|
|
27198
|
+
for (const path6 of this.DEFAULT_PATHS) {
|
|
27199
27199
|
try {
|
|
27200
|
-
|
|
27201
|
-
return path3.resolve(
|
|
27200
|
+
fs18.accessSync(path3.resolve(path6));
|
|
27201
|
+
return path3.resolve(path6);
|
|
27202
27202
|
} catch {
|
|
27203
27203
|
}
|
|
27204
27204
|
}
|
|
@@ -30777,8 +30777,8 @@ async function random(size) {
|
|
|
30777
30777
|
const evenDistCutoff = Math.pow(2, 8) - Math.pow(2, 8) % mask.length;
|
|
30778
30778
|
let result = "";
|
|
30779
30779
|
while (result.length < size) {
|
|
30780
|
-
const
|
|
30781
|
-
for (const randomByte of
|
|
30780
|
+
const randomBytes4 = await getRandomValues(size - result.length);
|
|
30781
|
+
for (const randomByte of randomBytes4) {
|
|
30782
30782
|
if (randomByte < evenDistCutoff) {
|
|
30783
30783
|
result += mask[randomByte % mask.length];
|
|
30784
30784
|
}
|
|
@@ -32251,7 +32251,7 @@ var MCPClient = class extends eventemitter3.EventEmitter {
|
|
|
32251
32251
|
this.transport = this.createTransport();
|
|
32252
32252
|
this.client = new Client(
|
|
32253
32253
|
{
|
|
32254
|
-
name: "@oneringai
|
|
32254
|
+
name: "@everworker/oneringai",
|
|
32255
32255
|
version: "0.2.0"
|
|
32256
32256
|
},
|
|
32257
32257
|
{
|
|
@@ -32753,9 +32753,9 @@ var MCPRegistry = class {
|
|
|
32753
32753
|
/**
|
|
32754
32754
|
* Load MCP configuration from file and create clients
|
|
32755
32755
|
*/
|
|
32756
|
-
static async loadFromConfigFile(
|
|
32756
|
+
static async loadFromConfigFile(path6) {
|
|
32757
32757
|
try {
|
|
32758
|
-
const configPath = path3.resolve(
|
|
32758
|
+
const configPath = path3.resolve(path6);
|
|
32759
32759
|
const content = await fs15.promises.readFile(configPath, "utf-8");
|
|
32760
32760
|
const config = JSON.parse(content);
|
|
32761
32761
|
if (!config.mcp) {
|
|
@@ -32767,7 +32767,7 @@ var MCPRegistry = class {
|
|
|
32767
32767
|
if (error instanceof MCPError) {
|
|
32768
32768
|
throw error;
|
|
32769
32769
|
}
|
|
32770
|
-
throw new MCPError(`Failed to load MCP configuration from '${
|
|
32770
|
+
throw new MCPError(`Failed to load MCP configuration from '${path6}'`, void 0, error);
|
|
32771
32771
|
}
|
|
32772
32772
|
}
|
|
32773
32773
|
/**
|
|
@@ -34735,8 +34735,8 @@ var GoogleImageProvider = class extends BaseMediaProvider {
|
|
|
34735
34735
|
if (Buffer.isBuffer(image)) {
|
|
34736
34736
|
imageBytes = image.toString("base64");
|
|
34737
34737
|
} else {
|
|
34738
|
-
const
|
|
34739
|
-
const buffer =
|
|
34738
|
+
const fs18 = await import('fs');
|
|
34739
|
+
const buffer = fs18.readFileSync(image);
|
|
34740
34740
|
imageBytes = buffer.toString("base64");
|
|
34741
34741
|
}
|
|
34742
34742
|
return {
|
|
@@ -36734,8 +36734,8 @@ var OpenAISoraProvider = class extends BaseMediaProvider {
|
|
|
36734
36734
|
return new File([new Uint8Array(image)], "input.png", { type: "image/png" });
|
|
36735
36735
|
}
|
|
36736
36736
|
if (!image.startsWith("http")) {
|
|
36737
|
-
const
|
|
36738
|
-
const data =
|
|
36737
|
+
const fs18 = await import('fs');
|
|
36738
|
+
const data = fs18.readFileSync(image);
|
|
36739
36739
|
return new File([new Uint8Array(data)], "input.png", { type: "image/png" });
|
|
36740
36740
|
}
|
|
36741
36741
|
const response = await fetch(image);
|
|
@@ -36913,22 +36913,22 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
|
|
|
36913
36913
|
if (video.videoBytes) {
|
|
36914
36914
|
buffer = Buffer.from(video.videoBytes, "base64");
|
|
36915
36915
|
} else if (video.uri) {
|
|
36916
|
-
const
|
|
36917
|
-
const
|
|
36918
|
-
const
|
|
36919
|
-
const tempDir =
|
|
36920
|
-
const tempFile =
|
|
36916
|
+
const fs18 = await import('fs/promises');
|
|
36917
|
+
const os3 = await import('os');
|
|
36918
|
+
const path6 = await import('path');
|
|
36919
|
+
const tempDir = os3.tmpdir();
|
|
36920
|
+
const tempFile = path6.join(tempDir, `veo-${Date.now()}.mp4`);
|
|
36921
36921
|
try {
|
|
36922
36922
|
await this.client.files.download({
|
|
36923
36923
|
file: { video },
|
|
36924
36924
|
// Pass as GeneratedVideo
|
|
36925
36925
|
downloadPath: tempFile
|
|
36926
36926
|
});
|
|
36927
|
-
buffer = await
|
|
36928
|
-
await
|
|
36927
|
+
buffer = await fs18.readFile(tempFile);
|
|
36928
|
+
await fs18.unlink(tempFile).catch(() => {
|
|
36929
36929
|
});
|
|
36930
36930
|
} catch (downloadError) {
|
|
36931
|
-
await
|
|
36931
|
+
await fs18.unlink(tempFile).catch(() => {
|
|
36932
36932
|
});
|
|
36933
36933
|
throw new ProviderError(
|
|
36934
36934
|
"google",
|
|
@@ -37050,8 +37050,8 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
|
|
|
37050
37050
|
if (image.startsWith("http://") || image.startsWith("https://")) {
|
|
37051
37051
|
return { imageUri: image };
|
|
37052
37052
|
}
|
|
37053
|
-
const
|
|
37054
|
-
const data = await
|
|
37053
|
+
const fs18 = await import('fs/promises');
|
|
37054
|
+
const data = await fs18.readFile(image);
|
|
37055
37055
|
return {
|
|
37056
37056
|
imageBytes: data.toString("base64")
|
|
37057
37057
|
};
|
|
@@ -37358,8 +37358,8 @@ var GrokImagineProvider = class extends BaseMediaProvider {
|
|
|
37358
37358
|
if (image.startsWith("http") || image.startsWith("data:")) {
|
|
37359
37359
|
return image;
|
|
37360
37360
|
}
|
|
37361
|
-
const
|
|
37362
|
-
const data =
|
|
37361
|
+
const fs18 = await import('fs');
|
|
37362
|
+
const data = fs18.readFileSync(image);
|
|
37363
37363
|
const base64 = data.toString("base64");
|
|
37364
37364
|
const ext = image.split(".").pop()?.toLowerCase() || "png";
|
|
37365
37365
|
const mimeType = ext === "jpg" || ext === "jpeg" ? "image/jpeg" : `image/${ext}`;
|
|
@@ -39746,10 +39746,10 @@ function detectDependencyCycle(tasks) {
|
|
|
39746
39746
|
const visited = /* @__PURE__ */ new Set();
|
|
39747
39747
|
const recStack = /* @__PURE__ */ new Set();
|
|
39748
39748
|
const taskMap = new Map(tasks.map((t) => [t.id, t]));
|
|
39749
|
-
function dfs(taskId,
|
|
39749
|
+
function dfs(taskId, path6) {
|
|
39750
39750
|
if (recStack.has(taskId)) {
|
|
39751
|
-
const cycleStart =
|
|
39752
|
-
return [...
|
|
39751
|
+
const cycleStart = path6.indexOf(taskId);
|
|
39752
|
+
return [...path6.slice(cycleStart), taskId];
|
|
39753
39753
|
}
|
|
39754
39754
|
if (visited.has(taskId)) {
|
|
39755
39755
|
return null;
|
|
@@ -39759,7 +39759,7 @@ function detectDependencyCycle(tasks) {
|
|
|
39759
39759
|
const task = taskMap.get(taskId);
|
|
39760
39760
|
if (task) {
|
|
39761
39761
|
for (const depId of task.dependsOn) {
|
|
39762
|
-
const cycle = dfs(depId, [...
|
|
39762
|
+
const cycle = dfs(depId, [...path6, taskId]);
|
|
39763
39763
|
if (cycle) {
|
|
39764
39764
|
return cycle;
|
|
39765
39765
|
}
|
|
@@ -42090,6 +42090,7 @@ init_Connector();
|
|
|
42090
42090
|
|
|
42091
42091
|
// src/tools/connector/ConnectorTools.ts
|
|
42092
42092
|
init_Connector();
|
|
42093
|
+
init_Logger();
|
|
42093
42094
|
var PROTECTED_HEADERS = ["authorization", "x-api-key", "api-key", "bearer"];
|
|
42094
42095
|
function safeStringify2(obj) {
|
|
42095
42096
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
@@ -42156,6 +42157,7 @@ var ConnectorTools = class {
|
|
|
42156
42157
|
*/
|
|
42157
42158
|
static registerService(serviceType, factory) {
|
|
42158
42159
|
this.factories.set(serviceType, factory);
|
|
42160
|
+
exports.logger.debug(`[ConnectorTools.registerService] Registered factory for: ${serviceType} (total factories: ${this.factories.size})`);
|
|
42159
42161
|
}
|
|
42160
42162
|
/**
|
|
42161
42163
|
* Unregister a service tool factory
|
|
@@ -42186,7 +42188,11 @@ var ConnectorTools = class {
|
|
|
42186
42188
|
const serviceType = this.detectService(connector);
|
|
42187
42189
|
if (serviceType && this.factories.has(serviceType)) {
|
|
42188
42190
|
const factory = this.factories.get(serviceType);
|
|
42189
|
-
|
|
42191
|
+
const serviceTools = factory(connector, userId);
|
|
42192
|
+
for (const tool of serviceTools) {
|
|
42193
|
+
tool.definition.function.name = `${connector.name}_${tool.definition.function.name}`;
|
|
42194
|
+
}
|
|
42195
|
+
tools.push(...serviceTools);
|
|
42190
42196
|
}
|
|
42191
42197
|
return tools;
|
|
42192
42198
|
}
|
|
@@ -42238,16 +42244,27 @@ var ConnectorTools = class {
|
|
|
42238
42244
|
*/
|
|
42239
42245
|
static discoverAll(userId) {
|
|
42240
42246
|
const result = /* @__PURE__ */ new Map();
|
|
42241
|
-
|
|
42247
|
+
const allConnectors = exports.Connector.listAll();
|
|
42248
|
+
const factoryKeys = Array.from(this.factories.keys());
|
|
42249
|
+
exports.logger.debug(`[ConnectorTools.discoverAll] ${allConnectors.length} connectors in library, ${factoryKeys.length} factories registered: [${factoryKeys.join(", ")}]`);
|
|
42250
|
+
for (const connector of allConnectors) {
|
|
42242
42251
|
const hasServiceType = !!connector.config.serviceType;
|
|
42243
42252
|
const isExternalAPI = connector.baseURL && !connector.vendor;
|
|
42244
|
-
|
|
42245
|
-
|
|
42246
|
-
|
|
42247
|
-
|
|
42253
|
+
const hasVendorFactory = !!connector.vendor && this.factories.has(connector.vendor);
|
|
42254
|
+
exports.logger.debug(`[ConnectorTools.discoverAll] connector=${connector.name}: vendor=${connector.vendor}, serviceType=${connector.config.serviceType}, baseURL=${connector.baseURL ? "yes" : "no"} \u2192 hasServiceType=${hasServiceType}, isExternalAPI=${isExternalAPI}, hasVendorFactory=${hasVendorFactory}`);
|
|
42255
|
+
if (hasServiceType || isExternalAPI || hasVendorFactory) {
|
|
42256
|
+
try {
|
|
42257
|
+
const tools = this.for(connector, userId);
|
|
42258
|
+
exports.logger.debug(`[ConnectorTools.discoverAll] \u2192 ${tools.length} tools: [${tools.map((t) => t.definition.function.name).join(", ")}]`);
|
|
42259
|
+
if (tools.length > 0) {
|
|
42260
|
+
result.set(connector.name, tools);
|
|
42261
|
+
}
|
|
42262
|
+
} catch (err) {
|
|
42263
|
+
exports.logger.error(`[ConnectorTools.discoverAll] \u2192 ERROR generating tools for ${connector.name}: ${err instanceof Error ? err.message : String(err)}`);
|
|
42248
42264
|
}
|
|
42249
42265
|
}
|
|
42250
42266
|
}
|
|
42267
|
+
exports.logger.debug(`[ConnectorTools.discoverAll] Result: ${result.size} connectors with tools`);
|
|
42251
42268
|
return result;
|
|
42252
42269
|
}
|
|
42253
42270
|
/**
|
|
@@ -42298,6 +42315,9 @@ var ConnectorTools = class {
|
|
|
42298
42315
|
} else if (connector.baseURL) {
|
|
42299
42316
|
result = detectServiceFromURL(connector.baseURL);
|
|
42300
42317
|
}
|
|
42318
|
+
if (!result && connector.vendor) {
|
|
42319
|
+
result = connector.vendor;
|
|
42320
|
+
}
|
|
42301
42321
|
this.maintainCacheSize(this.serviceTypeCache);
|
|
42302
42322
|
this.serviceTypeCache.set(cacheKey, result);
|
|
42303
42323
|
return result;
|
|
@@ -43056,7 +43076,7 @@ function initVendorRegistry(templates) {
|
|
|
43056
43076
|
function getVendorTemplate(vendorId) {
|
|
43057
43077
|
if (!vendorRegistry) {
|
|
43058
43078
|
throw new Error(
|
|
43059
|
-
"Vendor registry not initialized. Make sure to import from @oneringai
|
|
43079
|
+
"Vendor registry not initialized. Make sure to import from @everworker/oneringai which auto-registers templates."
|
|
43060
43080
|
);
|
|
43061
43081
|
}
|
|
43062
43082
|
return vendorRegistry.get(vendorId);
|
|
@@ -43064,7 +43084,7 @@ function getVendorTemplate(vendorId) {
|
|
|
43064
43084
|
function getAllVendorTemplates() {
|
|
43065
43085
|
if (!vendorRegistry) {
|
|
43066
43086
|
throw new Error(
|
|
43067
|
-
"Vendor registry not initialized. Make sure to import from @oneringai
|
|
43087
|
+
"Vendor registry not initialized. Make sure to import from @everworker/oneringai which auto-registers templates."
|
|
43068
43088
|
);
|
|
43069
43089
|
}
|
|
43070
43090
|
return Array.from(vendorRegistry.values());
|
|
@@ -43077,7 +43097,7 @@ function getVendorAuthTemplate(vendorId, authId) {
|
|
|
43077
43097
|
function listVendorIds() {
|
|
43078
43098
|
if (!vendorRegistry) {
|
|
43079
43099
|
throw new Error(
|
|
43080
|
-
"Vendor registry not initialized. Make sure to import from @oneringai
|
|
43100
|
+
"Vendor registry not initialized. Make sure to import from @everworker/oneringai which auto-registers templates."
|
|
43081
43101
|
);
|
|
43082
43102
|
}
|
|
43083
43103
|
return Array.from(vendorRegistry.keys());
|
|
@@ -45562,6 +45582,7 @@ __export(tools_exports, {
|
|
|
45562
45582
|
ConnectorTools: () => ConnectorTools,
|
|
45563
45583
|
DEFAULT_FILESYSTEM_CONFIG: () => DEFAULT_FILESYSTEM_CONFIG,
|
|
45564
45584
|
DEFAULT_SHELL_CONFIG: () => DEFAULT_SHELL_CONFIG,
|
|
45585
|
+
FileMediaOutputHandler: () => FileMediaOutputHandler,
|
|
45565
45586
|
ToolRegistry: () => ToolRegistry,
|
|
45566
45587
|
bash: () => bash,
|
|
45567
45588
|
createBashTool: () => createBashTool,
|
|
@@ -45569,8 +45590,12 @@ __export(tools_exports, {
|
|
|
45569
45590
|
createExecuteJavaScriptTool: () => createExecuteJavaScriptTool,
|
|
45570
45591
|
createGlobTool: () => createGlobTool,
|
|
45571
45592
|
createGrepTool: () => createGrepTool,
|
|
45593
|
+
createImageGenerationTool: () => createImageGenerationTool,
|
|
45572
45594
|
createListDirectoryTool: () => createListDirectoryTool,
|
|
45573
45595
|
createReadFileTool: () => createReadFileTool,
|
|
45596
|
+
createSpeechToTextTool: () => createSpeechToTextTool,
|
|
45597
|
+
createTextToSpeechTool: () => createTextToSpeechTool,
|
|
45598
|
+
createVideoTools: () => createVideoTools,
|
|
45574
45599
|
createWriteFileTool: () => createWriteFileTool,
|
|
45575
45600
|
developerTools: () => developerTools,
|
|
45576
45601
|
editFile: () => editFile,
|
|
@@ -45578,6 +45603,7 @@ __export(tools_exports, {
|
|
|
45578
45603
|
expandTilde: () => expandTilde,
|
|
45579
45604
|
getAllBuiltInTools: () => getAllBuiltInTools,
|
|
45580
45605
|
getBackgroundOutput: () => getBackgroundOutput,
|
|
45606
|
+
getMediaOutputHandler: () => getMediaOutputHandler,
|
|
45581
45607
|
getToolByName: () => getToolByName,
|
|
45582
45608
|
getToolCategories: () => getToolCategories,
|
|
45583
45609
|
getToolRegistry: () => getToolRegistry,
|
|
@@ -45591,6 +45617,7 @@ __export(tools_exports, {
|
|
|
45591
45617
|
killBackgroundProcess: () => killBackgroundProcess,
|
|
45592
45618
|
listDirectory: () => listDirectory,
|
|
45593
45619
|
readFile: () => readFile4,
|
|
45620
|
+
setMediaOutputHandler: () => setMediaOutputHandler,
|
|
45594
45621
|
toolRegistry: () => toolRegistry,
|
|
45595
45622
|
validatePath: () => validatePath,
|
|
45596
45623
|
webFetch: () => webFetch,
|
|
@@ -46208,8 +46235,8 @@ WHEN TO USE:
|
|
|
46208
46235
|
return args.pattern;
|
|
46209
46236
|
},
|
|
46210
46237
|
execute: async (args) => {
|
|
46211
|
-
const { pattern, path:
|
|
46212
|
-
const searchDir =
|
|
46238
|
+
const { pattern, path: path6 } = args;
|
|
46239
|
+
const searchDir = path6 || mergedConfig.workingDirectory;
|
|
46213
46240
|
const validation = validatePath(searchDir, {
|
|
46214
46241
|
...mergedConfig,
|
|
46215
46242
|
blockedDirectories: []
|
|
@@ -46429,7 +46456,7 @@ WHEN TO USE:
|
|
|
46429
46456
|
execute: async (args) => {
|
|
46430
46457
|
const {
|
|
46431
46458
|
pattern,
|
|
46432
|
-
path:
|
|
46459
|
+
path: path6,
|
|
46433
46460
|
glob: globPattern,
|
|
46434
46461
|
type: fileType,
|
|
46435
46462
|
output_mode = "files_with_matches",
|
|
@@ -46438,7 +46465,7 @@ WHEN TO USE:
|
|
|
46438
46465
|
context_after = 0,
|
|
46439
46466
|
limit
|
|
46440
46467
|
} = args;
|
|
46441
|
-
const searchPath =
|
|
46468
|
+
const searchPath = path6 || mergedConfig.workingDirectory;
|
|
46442
46469
|
const validation = validatePath(searchPath, {
|
|
46443
46470
|
...mergedConfig,
|
|
46444
46471
|
blockedDirectories: []
|
|
@@ -46656,8 +46683,8 @@ EXAMPLES:
|
|
|
46656
46683
|
return args.path;
|
|
46657
46684
|
},
|
|
46658
46685
|
execute: async (args) => {
|
|
46659
|
-
const { path:
|
|
46660
|
-
const validation = validatePath(
|
|
46686
|
+
const { path: path6, recursive = false, filter, max_depth = 3 } = args;
|
|
46687
|
+
const validation = validatePath(path6, {
|
|
46661
46688
|
...mergedConfig,
|
|
46662
46689
|
blockedDirectories: []
|
|
46663
46690
|
// Allow listing any valid directory
|
|
@@ -46672,7 +46699,7 @@ EXAMPLES:
|
|
|
46672
46699
|
if (!fs15.existsSync(resolvedPath)) {
|
|
46673
46700
|
return {
|
|
46674
46701
|
success: false,
|
|
46675
|
-
error: `Directory not found: ${
|
|
46702
|
+
error: `Directory not found: ${path6}`
|
|
46676
46703
|
};
|
|
46677
46704
|
}
|
|
46678
46705
|
try {
|
|
@@ -46680,7 +46707,7 @@ EXAMPLES:
|
|
|
46680
46707
|
if (!stats.isDirectory()) {
|
|
46681
46708
|
return {
|
|
46682
46709
|
success: false,
|
|
46683
|
-
error: `Path is not a directory: ${
|
|
46710
|
+
error: `Path is not a directory: ${path6}. Use read_file to read file contents.`
|
|
46684
46711
|
};
|
|
46685
46712
|
}
|
|
46686
46713
|
const entries = await listDir(
|
|
@@ -46982,19 +47009,19 @@ function killBackgroundProcess(bgId) {
|
|
|
46982
47009
|
var bash = createBashTool();
|
|
46983
47010
|
|
|
46984
47011
|
// src/tools/json/pathUtils.ts
|
|
46985
|
-
function parsePath(
|
|
46986
|
-
if (
|
|
47012
|
+
function parsePath(path6) {
|
|
47013
|
+
if (path6 === "" || path6 === "$") {
|
|
46987
47014
|
return [];
|
|
46988
47015
|
}
|
|
46989
|
-
const keys =
|
|
47016
|
+
const keys = path6.split(".");
|
|
46990
47017
|
const filtered = keys.filter((p) => p.length > 0);
|
|
46991
47018
|
if (filtered.length !== keys.length) {
|
|
46992
|
-
throw new Error(`Invalid path format: ${
|
|
47019
|
+
throw new Error(`Invalid path format: ${path6} (consecutive dots not allowed)`);
|
|
46993
47020
|
}
|
|
46994
47021
|
return filtered;
|
|
46995
47022
|
}
|
|
46996
|
-
function getValueAtPath(obj,
|
|
46997
|
-
const keys = parsePath(
|
|
47023
|
+
function getValueAtPath(obj, path6) {
|
|
47024
|
+
const keys = parsePath(path6);
|
|
46998
47025
|
let current = obj;
|
|
46999
47026
|
for (const key of keys) {
|
|
47000
47027
|
if (current === null || current === void 0) {
|
|
@@ -47004,8 +47031,8 @@ function getValueAtPath(obj, path5) {
|
|
|
47004
47031
|
}
|
|
47005
47032
|
return current;
|
|
47006
47033
|
}
|
|
47007
|
-
function setValueAtPath(obj,
|
|
47008
|
-
const keys = parsePath(
|
|
47034
|
+
function setValueAtPath(obj, path6, value) {
|
|
47035
|
+
const keys = parsePath(path6);
|
|
47009
47036
|
if (keys.length === 0) {
|
|
47010
47037
|
throw new Error("Cannot set root object - path must not be empty");
|
|
47011
47038
|
}
|
|
@@ -47034,8 +47061,8 @@ function setValueAtPath(obj, path5, value) {
|
|
|
47034
47061
|
}
|
|
47035
47062
|
return true;
|
|
47036
47063
|
}
|
|
47037
|
-
function deleteAtPath(obj,
|
|
47038
|
-
const keys = parsePath(
|
|
47064
|
+
function deleteAtPath(obj, path6) {
|
|
47065
|
+
const keys = parsePath(path6);
|
|
47039
47066
|
if (keys.length === 0) {
|
|
47040
47067
|
throw new Error("Cannot delete root object - path must not be empty");
|
|
47041
47068
|
}
|
|
@@ -47065,9 +47092,9 @@ function deleteAtPath(obj, path5) {
|
|
|
47065
47092
|
}
|
|
47066
47093
|
return true;
|
|
47067
47094
|
}
|
|
47068
|
-
function pathExists(obj,
|
|
47095
|
+
function pathExists(obj, path6) {
|
|
47069
47096
|
try {
|
|
47070
|
-
const value = getValueAtPath(obj,
|
|
47097
|
+
const value = getValueAtPath(obj, path6);
|
|
47071
47098
|
return value !== void 0;
|
|
47072
47099
|
} catch {
|
|
47073
47100
|
return false;
|
|
@@ -48512,6 +48539,591 @@ async function executeInVM(code, input, timeout, logs) {
|
|
|
48512
48539
|
const result = await resultPromise;
|
|
48513
48540
|
return result !== void 0 ? result : sandbox.output;
|
|
48514
48541
|
}
|
|
48542
|
+
var MIME_TYPES = {
|
|
48543
|
+
png: "image/png",
|
|
48544
|
+
jpeg: "image/jpeg",
|
|
48545
|
+
jpg: "image/jpeg",
|
|
48546
|
+
webp: "image/webp",
|
|
48547
|
+
gif: "image/gif",
|
|
48548
|
+
mp4: "video/mp4",
|
|
48549
|
+
webm: "video/webm",
|
|
48550
|
+
mp3: "audio/mpeg",
|
|
48551
|
+
wav: "audio/wav",
|
|
48552
|
+
opus: "audio/opus",
|
|
48553
|
+
ogg: "audio/ogg",
|
|
48554
|
+
aac: "audio/aac",
|
|
48555
|
+
flac: "audio/flac",
|
|
48556
|
+
pcm: "audio/pcm"
|
|
48557
|
+
};
|
|
48558
|
+
var FileMediaOutputHandler = class {
|
|
48559
|
+
outputDir;
|
|
48560
|
+
initialized = false;
|
|
48561
|
+
constructor(outputDir) {
|
|
48562
|
+
this.outputDir = outputDir ?? path3__namespace.join(os__namespace.tmpdir(), "oneringai-media");
|
|
48563
|
+
}
|
|
48564
|
+
async save(data, metadata) {
|
|
48565
|
+
if (!this.initialized) {
|
|
48566
|
+
await fs14__namespace.mkdir(this.outputDir, { recursive: true });
|
|
48567
|
+
this.initialized = true;
|
|
48568
|
+
}
|
|
48569
|
+
const filename = metadata.suggestedFilename ?? this.generateFilename(metadata);
|
|
48570
|
+
const filePath = path3__namespace.join(this.outputDir, filename);
|
|
48571
|
+
await fs14__namespace.writeFile(filePath, data);
|
|
48572
|
+
const format = metadata.format.toLowerCase();
|
|
48573
|
+
const mimeType = MIME_TYPES[format] ?? `application/octet-stream`;
|
|
48574
|
+
return {
|
|
48575
|
+
location: filePath,
|
|
48576
|
+
mimeType,
|
|
48577
|
+
size: data.length
|
|
48578
|
+
};
|
|
48579
|
+
}
|
|
48580
|
+
generateFilename(metadata) {
|
|
48581
|
+
const timestamp = Date.now();
|
|
48582
|
+
const random2 = crypto2__namespace.randomBytes(4).toString("hex");
|
|
48583
|
+
const indexSuffix = metadata.index != null ? `_${metadata.index}` : "";
|
|
48584
|
+
return `${metadata.type}_${timestamp}_${random2}${indexSuffix}.${metadata.format}`;
|
|
48585
|
+
}
|
|
48586
|
+
};
|
|
48587
|
+
|
|
48588
|
+
// src/tools/multimedia/config.ts
|
|
48589
|
+
var _outputHandler = null;
|
|
48590
|
+
function getMediaOutputHandler() {
|
|
48591
|
+
if (!_outputHandler) {
|
|
48592
|
+
_outputHandler = new FileMediaOutputHandler();
|
|
48593
|
+
}
|
|
48594
|
+
return _outputHandler;
|
|
48595
|
+
}
|
|
48596
|
+
function setMediaOutputHandler(handler) {
|
|
48597
|
+
_outputHandler = handler;
|
|
48598
|
+
}
|
|
48599
|
+
|
|
48600
|
+
// src/tools/multimedia/imageGeneration.ts
|
|
48601
|
+
function createImageGenerationTool(connector, outputHandler) {
|
|
48602
|
+
const vendor = connector.vendor;
|
|
48603
|
+
const handler = outputHandler ?? getMediaOutputHandler();
|
|
48604
|
+
const vendorModels = vendor ? getImageModelsByVendor(vendor) : [];
|
|
48605
|
+
const modelNames = vendorModels.map((m) => m.name);
|
|
48606
|
+
const properties = {
|
|
48607
|
+
prompt: {
|
|
48608
|
+
type: "string",
|
|
48609
|
+
description: "Text description of the image to generate"
|
|
48610
|
+
}
|
|
48611
|
+
};
|
|
48612
|
+
if (modelNames.length > 0) {
|
|
48613
|
+
const descriptions = vendorModels.map((m) => `${m.name}: ${m.description || m.displayName}`).join("; ");
|
|
48614
|
+
properties.model = {
|
|
48615
|
+
type: "string",
|
|
48616
|
+
enum: modelNames,
|
|
48617
|
+
description: `Image model to use. Options: ${descriptions}`
|
|
48618
|
+
};
|
|
48619
|
+
}
|
|
48620
|
+
const hasSizes = vendorModels.some((m) => m.capabilities.sizes.length > 1);
|
|
48621
|
+
if (hasSizes) {
|
|
48622
|
+
const allSizes = [...new Set(vendorModels.flatMap((m) => m.capabilities.sizes))];
|
|
48623
|
+
properties.size = {
|
|
48624
|
+
type: "string",
|
|
48625
|
+
enum: allSizes,
|
|
48626
|
+
description: "Image dimensions"
|
|
48627
|
+
};
|
|
48628
|
+
}
|
|
48629
|
+
const hasAspectRatios = vendorModels.some((m) => m.capabilities.aspectRatios?.length);
|
|
48630
|
+
if (hasAspectRatios) {
|
|
48631
|
+
const allRatios = [...new Set(vendorModels.flatMap((m) => m.capabilities.aspectRatios ?? []))];
|
|
48632
|
+
properties.aspectRatio = {
|
|
48633
|
+
type: "string",
|
|
48634
|
+
enum: allRatios,
|
|
48635
|
+
description: "Image aspect ratio"
|
|
48636
|
+
};
|
|
48637
|
+
}
|
|
48638
|
+
const hasQuality = vendorModels.some((m) => m.capabilities.features.qualityControl);
|
|
48639
|
+
if (hasQuality) {
|
|
48640
|
+
properties.quality = {
|
|
48641
|
+
type: "string",
|
|
48642
|
+
enum: ["standard", "hd"],
|
|
48643
|
+
description: "Image quality level"
|
|
48644
|
+
};
|
|
48645
|
+
}
|
|
48646
|
+
const hasStyle = vendorModels.some((m) => m.capabilities.features.styleControl);
|
|
48647
|
+
if (hasStyle) {
|
|
48648
|
+
properties.style = {
|
|
48649
|
+
type: "string",
|
|
48650
|
+
enum: ["vivid", "natural"],
|
|
48651
|
+
description: "Image style (vivid for hyper-real, natural for less hyper-real)"
|
|
48652
|
+
};
|
|
48653
|
+
}
|
|
48654
|
+
const maxN = Math.max(...vendorModels.map((m) => m.capabilities.maxImagesPerRequest));
|
|
48655
|
+
if (maxN > 1) {
|
|
48656
|
+
properties.n = {
|
|
48657
|
+
type: "number",
|
|
48658
|
+
description: `Number of images to generate (1-${maxN})`,
|
|
48659
|
+
minimum: 1,
|
|
48660
|
+
maximum: maxN
|
|
48661
|
+
};
|
|
48662
|
+
}
|
|
48663
|
+
return {
|
|
48664
|
+
definition: {
|
|
48665
|
+
type: "function",
|
|
48666
|
+
function: {
|
|
48667
|
+
name: "generate_image",
|
|
48668
|
+
description: `Generate images from text prompts using ${connector.displayName}`,
|
|
48669
|
+
parameters: {
|
|
48670
|
+
type: "object",
|
|
48671
|
+
properties,
|
|
48672
|
+
required: ["prompt"]
|
|
48673
|
+
}
|
|
48674
|
+
}
|
|
48675
|
+
},
|
|
48676
|
+
execute: async (args) => {
|
|
48677
|
+
try {
|
|
48678
|
+
const imageGen = ImageGeneration.create({ connector });
|
|
48679
|
+
const response = await imageGen.generate({
|
|
48680
|
+
prompt: args.prompt,
|
|
48681
|
+
model: args.model,
|
|
48682
|
+
size: args.size,
|
|
48683
|
+
quality: args.quality,
|
|
48684
|
+
style: args.style,
|
|
48685
|
+
n: args.n,
|
|
48686
|
+
response_format: "b64_json"
|
|
48687
|
+
});
|
|
48688
|
+
const images = [];
|
|
48689
|
+
for (let i = 0; i < response.data.length; i++) {
|
|
48690
|
+
const item = response.data[i];
|
|
48691
|
+
let buffer;
|
|
48692
|
+
if (item.b64_json) {
|
|
48693
|
+
buffer = Buffer.from(item.b64_json, "base64");
|
|
48694
|
+
} else if (item.url) {
|
|
48695
|
+
const resp = await fetch(item.url);
|
|
48696
|
+
buffer = Buffer.from(await resp.arrayBuffer());
|
|
48697
|
+
} else {
|
|
48698
|
+
continue;
|
|
48699
|
+
}
|
|
48700
|
+
const modelName = args.model || modelNames[0] || "unknown";
|
|
48701
|
+
const modelInfo = IMAGE_MODEL_REGISTRY[modelName];
|
|
48702
|
+
const format = modelInfo?.capabilities.outputFormats[0] === "url" ? "png" : modelInfo?.capabilities.outputFormats[0] || "png";
|
|
48703
|
+
const result = await handler.save(buffer, {
|
|
48704
|
+
type: "image",
|
|
48705
|
+
format,
|
|
48706
|
+
model: modelName,
|
|
48707
|
+
vendor: vendor || "unknown",
|
|
48708
|
+
index: response.data.length > 1 ? i : void 0
|
|
48709
|
+
});
|
|
48710
|
+
images.push({
|
|
48711
|
+
location: result.location,
|
|
48712
|
+
mimeType: result.mimeType,
|
|
48713
|
+
revisedPrompt: item.revised_prompt
|
|
48714
|
+
});
|
|
48715
|
+
}
|
|
48716
|
+
return { success: true, images };
|
|
48717
|
+
} catch (error) {
|
|
48718
|
+
return {
|
|
48719
|
+
success: false,
|
|
48720
|
+
error: error instanceof Error ? error.message : String(error)
|
|
48721
|
+
};
|
|
48722
|
+
}
|
|
48723
|
+
},
|
|
48724
|
+
describeCall: (args) => args.prompt.length > 50 ? args.prompt.slice(0, 47) + "..." : args.prompt,
|
|
48725
|
+
permission: {
|
|
48726
|
+
scope: "session",
|
|
48727
|
+
riskLevel: "medium",
|
|
48728
|
+
approvalMessage: `Generate image(s) using ${connector.displayName}`
|
|
48729
|
+
}
|
|
48730
|
+
};
|
|
48731
|
+
}
|
|
48732
|
+
|
|
48733
|
+
// src/tools/multimedia/videoGeneration.ts
|
|
48734
|
+
var videoGenInstances = /* @__PURE__ */ new Map();
|
|
48735
|
+
function createVideoTools(connector, outputHandler) {
|
|
48736
|
+
const vendor = connector.vendor;
|
|
48737
|
+
const handler = outputHandler ?? getMediaOutputHandler();
|
|
48738
|
+
const vendorModels = vendor ? getVideoModelsByVendor(vendor) : [];
|
|
48739
|
+
const modelNames = vendorModels.map((m) => m.name);
|
|
48740
|
+
const generateProperties = {
|
|
48741
|
+
prompt: {
|
|
48742
|
+
type: "string",
|
|
48743
|
+
description: "Text description of the video to generate"
|
|
48744
|
+
}
|
|
48745
|
+
};
|
|
48746
|
+
if (modelNames.length > 0) {
|
|
48747
|
+
const descriptions = vendorModels.map((m) => `${m.name}: ${m.displayName}`).join("; ");
|
|
48748
|
+
generateProperties.model = {
|
|
48749
|
+
type: "string",
|
|
48750
|
+
enum: modelNames,
|
|
48751
|
+
description: `Video model to use. Options: ${descriptions}`
|
|
48752
|
+
};
|
|
48753
|
+
}
|
|
48754
|
+
const allDurations = [...new Set(vendorModels.flatMap((m) => m.capabilities.durations))].sort(
|
|
48755
|
+
(a, b) => a - b
|
|
48756
|
+
);
|
|
48757
|
+
if (allDurations.length > 0) {
|
|
48758
|
+
generateProperties.duration = {
|
|
48759
|
+
type: "number",
|
|
48760
|
+
description: `Video duration in seconds. Supported: ${allDurations.join(", ")}`
|
|
48761
|
+
};
|
|
48762
|
+
}
|
|
48763
|
+
const allResolutions = [...new Set(vendorModels.flatMap((m) => m.capabilities.resolutions))];
|
|
48764
|
+
if (allResolutions.length > 0) {
|
|
48765
|
+
generateProperties.resolution = {
|
|
48766
|
+
type: "string",
|
|
48767
|
+
enum: allResolutions,
|
|
48768
|
+
description: "Video resolution"
|
|
48769
|
+
};
|
|
48770
|
+
}
|
|
48771
|
+
const allAspectRatios = [
|
|
48772
|
+
...new Set(vendorModels.flatMap((m) => m.capabilities.aspectRatios ?? []))
|
|
48773
|
+
];
|
|
48774
|
+
if (allAspectRatios.length > 0) {
|
|
48775
|
+
generateProperties.aspectRatio = {
|
|
48776
|
+
type: "string",
|
|
48777
|
+
enum: allAspectRatios,
|
|
48778
|
+
description: "Video aspect ratio"
|
|
48779
|
+
};
|
|
48780
|
+
}
|
|
48781
|
+
const hasSeed = vendorModels.some((m) => m.capabilities.features.seed);
|
|
48782
|
+
if (hasSeed) {
|
|
48783
|
+
generateProperties.seed = {
|
|
48784
|
+
type: "number",
|
|
48785
|
+
description: "Random seed for reproducible generation"
|
|
48786
|
+
};
|
|
48787
|
+
}
|
|
48788
|
+
const generateTool = {
|
|
48789
|
+
definition: {
|
|
48790
|
+
type: "function",
|
|
48791
|
+
function: {
|
|
48792
|
+
name: "generate_video",
|
|
48793
|
+
description: `Start video generation from a text prompt using ${connector.displayName}. Returns a jobId to check status with video_status.`,
|
|
48794
|
+
parameters: {
|
|
48795
|
+
type: "object",
|
|
48796
|
+
properties: generateProperties,
|
|
48797
|
+
required: ["prompt"]
|
|
48798
|
+
}
|
|
48799
|
+
}
|
|
48800
|
+
},
|
|
48801
|
+
execute: async (args) => {
|
|
48802
|
+
try {
|
|
48803
|
+
const videoGen = VideoGeneration.create({ connector });
|
|
48804
|
+
const response = await videoGen.generate({
|
|
48805
|
+
prompt: args.prompt,
|
|
48806
|
+
model: args.model,
|
|
48807
|
+
duration: args.duration,
|
|
48808
|
+
resolution: args.resolution,
|
|
48809
|
+
aspectRatio: args.aspectRatio,
|
|
48810
|
+
seed: args.seed
|
|
48811
|
+
});
|
|
48812
|
+
videoGenInstances.set(response.jobId, videoGen);
|
|
48813
|
+
return {
|
|
48814
|
+
success: true,
|
|
48815
|
+
jobId: response.jobId,
|
|
48816
|
+
status: response.status
|
|
48817
|
+
};
|
|
48818
|
+
} catch (error) {
|
|
48819
|
+
return {
|
|
48820
|
+
success: false,
|
|
48821
|
+
error: error instanceof Error ? error.message : String(error)
|
|
48822
|
+
};
|
|
48823
|
+
}
|
|
48824
|
+
},
|
|
48825
|
+
describeCall: (args) => args.prompt.length > 50 ? args.prompt.slice(0, 47) + "..." : args.prompt,
|
|
48826
|
+
permission: {
|
|
48827
|
+
scope: "session",
|
|
48828
|
+
riskLevel: "medium",
|
|
48829
|
+
approvalMessage: `Generate video using ${connector.displayName}`
|
|
48830
|
+
}
|
|
48831
|
+
};
|
|
48832
|
+
const statusTool = {
|
|
48833
|
+
definition: {
|
|
48834
|
+
type: "function",
|
|
48835
|
+
function: {
|
|
48836
|
+
name: "video_status",
|
|
48837
|
+
description: "Check the status of a video generation job. If completed, downloads and saves the video.",
|
|
48838
|
+
parameters: {
|
|
48839
|
+
type: "object",
|
|
48840
|
+
properties: {
|
|
48841
|
+
jobId: {
|
|
48842
|
+
type: "string",
|
|
48843
|
+
description: "The job ID returned by generate_video"
|
|
48844
|
+
}
|
|
48845
|
+
},
|
|
48846
|
+
required: ["jobId"]
|
|
48847
|
+
}
|
|
48848
|
+
}
|
|
48849
|
+
},
|
|
48850
|
+
execute: async (args) => {
|
|
48851
|
+
try {
|
|
48852
|
+
let videoGen = videoGenInstances.get(args.jobId);
|
|
48853
|
+
if (!videoGen) {
|
|
48854
|
+
videoGen = VideoGeneration.create({ connector });
|
|
48855
|
+
}
|
|
48856
|
+
const status = await videoGen.getStatus(args.jobId);
|
|
48857
|
+
if (status.status === "completed") {
|
|
48858
|
+
let buffer;
|
|
48859
|
+
if (status.video?.b64_json) {
|
|
48860
|
+
buffer = Buffer.from(status.video.b64_json, "base64");
|
|
48861
|
+
} else if (status.video?.url) {
|
|
48862
|
+
const resp = await fetch(status.video.url);
|
|
48863
|
+
buffer = Buffer.from(await resp.arrayBuffer());
|
|
48864
|
+
} else if (videoGen.download) {
|
|
48865
|
+
try {
|
|
48866
|
+
buffer = await videoGen.download(args.jobId);
|
|
48867
|
+
} catch {
|
|
48868
|
+
}
|
|
48869
|
+
}
|
|
48870
|
+
if (buffer) {
|
|
48871
|
+
const format = status.video?.format || "mp4";
|
|
48872
|
+
const modelName = modelNames[0] || "unknown";
|
|
48873
|
+
const result = await handler.save(buffer, {
|
|
48874
|
+
type: "video",
|
|
48875
|
+
format,
|
|
48876
|
+
model: modelName,
|
|
48877
|
+
vendor: vendor || "unknown"
|
|
48878
|
+
});
|
|
48879
|
+
videoGenInstances.delete(args.jobId);
|
|
48880
|
+
return {
|
|
48881
|
+
success: true,
|
|
48882
|
+
status: "completed",
|
|
48883
|
+
location: result.location,
|
|
48884
|
+
mimeType: result.mimeType
|
|
48885
|
+
};
|
|
48886
|
+
}
|
|
48887
|
+
videoGenInstances.delete(args.jobId);
|
|
48888
|
+
return {
|
|
48889
|
+
success: true,
|
|
48890
|
+
status: "completed",
|
|
48891
|
+
location: status.video?.url
|
|
48892
|
+
};
|
|
48893
|
+
}
|
|
48894
|
+
if (status.status === "failed") {
|
|
48895
|
+
videoGenInstances.delete(args.jobId);
|
|
48896
|
+
return {
|
|
48897
|
+
success: false,
|
|
48898
|
+
status: "failed",
|
|
48899
|
+
error: status.error || "Video generation failed"
|
|
48900
|
+
};
|
|
48901
|
+
}
|
|
48902
|
+
return {
|
|
48903
|
+
success: true,
|
|
48904
|
+
status: status.status,
|
|
48905
|
+
progress: status.progress
|
|
48906
|
+
};
|
|
48907
|
+
} catch (error) {
|
|
48908
|
+
return {
|
|
48909
|
+
success: false,
|
|
48910
|
+
error: error instanceof Error ? error.message : String(error)
|
|
48911
|
+
};
|
|
48912
|
+
}
|
|
48913
|
+
},
|
|
48914
|
+
describeCall: (args) => `job ${args.jobId}`,
|
|
48915
|
+
permission: {
|
|
48916
|
+
scope: "session",
|
|
48917
|
+
riskLevel: "low",
|
|
48918
|
+
approvalMessage: "Check video generation status"
|
|
48919
|
+
}
|
|
48920
|
+
};
|
|
48921
|
+
return [generateTool, statusTool];
|
|
48922
|
+
}
|
|
48923
|
+
|
|
48924
|
+
// src/tools/multimedia/textToSpeech.ts
|
|
48925
|
+
function createTextToSpeechTool(connector, outputHandler) {
|
|
48926
|
+
const vendor = connector.vendor;
|
|
48927
|
+
const handler = outputHandler ?? getMediaOutputHandler();
|
|
48928
|
+
const vendorModels = vendor ? getTTSModelsByVendor(vendor) : [];
|
|
48929
|
+
const modelNames = vendorModels.map((m) => m.name);
|
|
48930
|
+
const properties = {
|
|
48931
|
+
text: {
|
|
48932
|
+
type: "string",
|
|
48933
|
+
description: "Text to convert to speech"
|
|
48934
|
+
}
|
|
48935
|
+
};
|
|
48936
|
+
if (modelNames.length > 0) {
|
|
48937
|
+
const descriptions = vendorModels.map((m) => `${m.name}: ${m.description || m.displayName}`).join("; ");
|
|
48938
|
+
properties.model = {
|
|
48939
|
+
type: "string",
|
|
48940
|
+
enum: modelNames,
|
|
48941
|
+
description: `TTS model to use. Options: ${descriptions}`
|
|
48942
|
+
};
|
|
48943
|
+
}
|
|
48944
|
+
const allVoices = [
|
|
48945
|
+
...new Map(
|
|
48946
|
+
vendorModels.flatMap((m) => m.capabilities.voices).map((v) => [v.id, v])
|
|
48947
|
+
).values()
|
|
48948
|
+
];
|
|
48949
|
+
if (allVoices.length > 0) {
|
|
48950
|
+
const voiceDescriptions = allVoices.slice(0, 10).map((v) => `${v.id}${v.name !== v.id ? ` (${v.name})` : ""}`).join(", ");
|
|
48951
|
+
properties.voice = {
|
|
48952
|
+
type: "string",
|
|
48953
|
+
enum: allVoices.map((v) => v.id),
|
|
48954
|
+
description: `Voice to use. Options include: ${voiceDescriptions}${allVoices.length > 10 ? `, and ${allVoices.length - 10} more` : ""}`
|
|
48955
|
+
};
|
|
48956
|
+
}
|
|
48957
|
+
const allFormats = [...new Set(vendorModels.flatMap((m) => [...m.capabilities.formats]))];
|
|
48958
|
+
if (allFormats.length > 0) {
|
|
48959
|
+
properties.format = {
|
|
48960
|
+
type: "string",
|
|
48961
|
+
enum: allFormats,
|
|
48962
|
+
description: `Output audio format: ${allFormats.join(", ")}`
|
|
48963
|
+
};
|
|
48964
|
+
}
|
|
48965
|
+
const hasSpeed = vendorModels.some((m) => m.capabilities.speed.supported);
|
|
48966
|
+
if (hasSpeed) {
|
|
48967
|
+
const speedModel = vendorModels.find((m) => m.capabilities.speed.supported);
|
|
48968
|
+
properties.speed = {
|
|
48969
|
+
type: "number",
|
|
48970
|
+
description: `Speech speed (${speedModel?.capabilities.speed.min ?? 0.25} to ${speedModel?.capabilities.speed.max ?? 4})`,
|
|
48971
|
+
minimum: speedModel?.capabilities.speed.min ?? 0.25,
|
|
48972
|
+
maximum: speedModel?.capabilities.speed.max ?? 4
|
|
48973
|
+
};
|
|
48974
|
+
}
|
|
48975
|
+
return {
|
|
48976
|
+
definition: {
|
|
48977
|
+
type: "function",
|
|
48978
|
+
function: {
|
|
48979
|
+
name: "text_to_speech",
|
|
48980
|
+
description: `Convert text to speech audio using ${connector.displayName}`,
|
|
48981
|
+
parameters: {
|
|
48982
|
+
type: "object",
|
|
48983
|
+
properties,
|
|
48984
|
+
required: ["text"]
|
|
48985
|
+
}
|
|
48986
|
+
}
|
|
48987
|
+
},
|
|
48988
|
+
execute: async (args) => {
|
|
48989
|
+
try {
|
|
48990
|
+
const tts = TextToSpeech.create({
|
|
48991
|
+
connector,
|
|
48992
|
+
model: args.model,
|
|
48993
|
+
voice: args.voice,
|
|
48994
|
+
format: args.format,
|
|
48995
|
+
speed: args.speed
|
|
48996
|
+
});
|
|
48997
|
+
const response = await tts.synthesize(args.text);
|
|
48998
|
+
const format = response.format || args.format || "mp3";
|
|
48999
|
+
const result = await handler.save(response.audio, {
|
|
49000
|
+
type: "audio",
|
|
49001
|
+
format,
|
|
49002
|
+
model: args.model || modelNames[0] || "unknown",
|
|
49003
|
+
vendor: vendor || "unknown"
|
|
49004
|
+
});
|
|
49005
|
+
return {
|
|
49006
|
+
success: true,
|
|
49007
|
+
location: result.location,
|
|
49008
|
+
format,
|
|
49009
|
+
mimeType: result.mimeType
|
|
49010
|
+
};
|
|
49011
|
+
} catch (error) {
|
|
49012
|
+
return {
|
|
49013
|
+
success: false,
|
|
49014
|
+
error: error instanceof Error ? error.message : String(error)
|
|
49015
|
+
};
|
|
49016
|
+
}
|
|
49017
|
+
},
|
|
49018
|
+
describeCall: (args) => args.text.length > 50 ? args.text.slice(0, 47) + "..." : args.text,
|
|
49019
|
+
permission: {
|
|
49020
|
+
scope: "session",
|
|
49021
|
+
riskLevel: "medium",
|
|
49022
|
+
approvalMessage: `Convert text to speech using ${connector.displayName}`
|
|
49023
|
+
}
|
|
49024
|
+
};
|
|
49025
|
+
}
|
|
49026
|
+
function createSpeechToTextTool(connector) {
|
|
49027
|
+
const vendor = connector.vendor;
|
|
49028
|
+
const vendorModels = vendor ? getSTTModelsByVendor(vendor) : [];
|
|
49029
|
+
const modelNames = vendorModels.map((m) => m.name);
|
|
49030
|
+
const properties = {
|
|
49031
|
+
audioFilePath: {
|
|
49032
|
+
type: "string",
|
|
49033
|
+
description: "Path to the audio file to transcribe"
|
|
49034
|
+
}
|
|
49035
|
+
};
|
|
49036
|
+
if (modelNames.length > 0) {
|
|
49037
|
+
const descriptions = vendorModels.map((m) => `${m.name}: ${m.description || m.displayName}`).join("; ");
|
|
49038
|
+
properties.model = {
|
|
49039
|
+
type: "string",
|
|
49040
|
+
enum: modelNames,
|
|
49041
|
+
description: `STT model to use. Options: ${descriptions}`
|
|
49042
|
+
};
|
|
49043
|
+
}
|
|
49044
|
+
properties.language = {
|
|
49045
|
+
type: "string",
|
|
49046
|
+
description: 'Language code (ISO-639-1, e.g., "en", "es", "fr"). Optional for auto-detection.'
|
|
49047
|
+
};
|
|
49048
|
+
properties.prompt = {
|
|
49049
|
+
type: "string",
|
|
49050
|
+
description: "Optional context hint to guide transcription (e.g., domain-specific terms)"
|
|
49051
|
+
};
|
|
49052
|
+
return {
|
|
49053
|
+
definition: {
|
|
49054
|
+
type: "function",
|
|
49055
|
+
function: {
|
|
49056
|
+
name: "speech_to_text",
|
|
49057
|
+
description: `Transcribe audio to text using ${connector.displayName}`,
|
|
49058
|
+
parameters: {
|
|
49059
|
+
type: "object",
|
|
49060
|
+
properties,
|
|
49061
|
+
required: ["audioFilePath"]
|
|
49062
|
+
}
|
|
49063
|
+
}
|
|
49064
|
+
},
|
|
49065
|
+
execute: async (args) => {
|
|
49066
|
+
try {
|
|
49067
|
+
const audioBuffer = await fs14__namespace.readFile(args.audioFilePath);
|
|
49068
|
+
const stt = SpeechToText.create({
|
|
49069
|
+
connector,
|
|
49070
|
+
model: args.model,
|
|
49071
|
+
language: args.language
|
|
49072
|
+
});
|
|
49073
|
+
const response = await stt.transcribe(audioBuffer, {
|
|
49074
|
+
prompt: args.prompt
|
|
49075
|
+
});
|
|
49076
|
+
return {
|
|
49077
|
+
success: true,
|
|
49078
|
+
text: response.text,
|
|
49079
|
+
language: response.language,
|
|
49080
|
+
durationSeconds: response.durationSeconds
|
|
49081
|
+
};
|
|
49082
|
+
} catch (error) {
|
|
49083
|
+
return {
|
|
49084
|
+
success: false,
|
|
49085
|
+
error: error instanceof Error ? error.message : String(error)
|
|
49086
|
+
};
|
|
49087
|
+
}
|
|
49088
|
+
},
|
|
49089
|
+
describeCall: (args) => args.audioFilePath,
|
|
49090
|
+
permission: {
|
|
49091
|
+
scope: "session",
|
|
49092
|
+
riskLevel: "low",
|
|
49093
|
+
approvalMessage: `Transcribe audio using ${connector.displayName}`
|
|
49094
|
+
}
|
|
49095
|
+
};
|
|
49096
|
+
}
|
|
49097
|
+
|
|
49098
|
+
// src/tools/multimedia/register.ts
|
|
49099
|
+
var VENDOR_CAPABILITIES = {
|
|
49100
|
+
[Vendor.OpenAI]: ["image", "video", "tts", "stt"],
|
|
49101
|
+
[Vendor.Google]: ["image", "video", "tts"],
|
|
49102
|
+
[Vendor.Grok]: ["image", "video"]
|
|
49103
|
+
};
|
|
49104
|
+
function registerMultimediaTools() {
|
|
49105
|
+
for (const [vendor, capabilities] of Object.entries(VENDOR_CAPABILITIES)) {
|
|
49106
|
+
ConnectorTools.registerService(vendor, (connector, _userId) => {
|
|
49107
|
+
const tools = [];
|
|
49108
|
+
if (capabilities.includes("image")) {
|
|
49109
|
+
tools.push(createImageGenerationTool(connector));
|
|
49110
|
+
}
|
|
49111
|
+
if (capabilities.includes("video")) {
|
|
49112
|
+
tools.push(...createVideoTools(connector));
|
|
49113
|
+
}
|
|
49114
|
+
if (capabilities.includes("tts")) {
|
|
49115
|
+
tools.push(createTextToSpeechTool(connector));
|
|
49116
|
+
}
|
|
49117
|
+
if (capabilities.includes("stt")) {
|
|
49118
|
+
tools.push(createSpeechToTextTool(connector));
|
|
49119
|
+
}
|
|
49120
|
+
return tools;
|
|
49121
|
+
});
|
|
49122
|
+
}
|
|
49123
|
+
}
|
|
49124
|
+
|
|
49125
|
+
// src/tools/multimedia/index.ts
|
|
49126
|
+
registerMultimediaTools();
|
|
48515
49127
|
|
|
48516
49128
|
// src/tools/registry.generated.ts
|
|
48517
49129
|
var toolRegistry = [
|
|
@@ -48755,17 +49367,23 @@ var ToolRegistry = class {
|
|
|
48755
49367
|
*/
|
|
48756
49368
|
static toRegistryEntry(tool, connectorName) {
|
|
48757
49369
|
let serviceType;
|
|
49370
|
+
let displayPrefix;
|
|
48758
49371
|
try {
|
|
48759
49372
|
const connector = exports.Connector.get(connectorName);
|
|
48760
49373
|
serviceType = ConnectorTools.detectService(connector);
|
|
49374
|
+
if (connector.vendor) {
|
|
49375
|
+
const vendorInfo = getVendorInfo(connector.vendor);
|
|
49376
|
+
displayPrefix = vendorInfo?.name || connector.vendor;
|
|
49377
|
+
}
|
|
48761
49378
|
} catch {
|
|
48762
49379
|
}
|
|
48763
49380
|
const serviceInfo = serviceType ? getServiceInfo(serviceType) : void 0;
|
|
49381
|
+
const displayContext = displayPrefix || serviceInfo?.name;
|
|
48764
49382
|
const def = tool.definition.function;
|
|
48765
49383
|
return {
|
|
48766
49384
|
name: def.name,
|
|
48767
49385
|
exportName: def.name,
|
|
48768
|
-
displayName: this.deriveDisplayName(def.name,
|
|
49386
|
+
displayName: this.deriveDisplayName(def.name, displayContext, connectorName),
|
|
48769
49387
|
category: "connector",
|
|
48770
49388
|
description: def.description || `API tool for ${connectorName}`,
|
|
48771
49389
|
tool,
|
|
@@ -48778,14 +49396,21 @@ var ToolRegistry = class {
|
|
|
48778
49396
|
}
|
|
48779
49397
|
/**
|
|
48780
49398
|
* Derive a human-readable display name from a tool name
|
|
49399
|
+
*
|
|
49400
|
+
* @param toolName - Full tool name (e.g., "main-openai_generate_image")
|
|
49401
|
+
* @param contextName - Vendor or service display name (e.g., "OpenAI")
|
|
49402
|
+
* @param connectorName - Connector name used as prefix (e.g., "main-openai")
|
|
48781
49403
|
*/
|
|
48782
|
-
static deriveDisplayName(toolName,
|
|
48783
|
-
|
|
48784
|
-
|
|
48785
|
-
|
|
49404
|
+
static deriveDisplayName(toolName, contextName, connectorName) {
|
|
49405
|
+
let baseName = toolName;
|
|
49406
|
+
if (connectorName && toolName.startsWith(connectorName + "_")) {
|
|
49407
|
+
baseName = toolName.slice(connectorName.length + 1);
|
|
49408
|
+
}
|
|
49409
|
+
if (baseName === "api") {
|
|
49410
|
+
return contextName ? `${contextName} API` : toolName.replace(/_/g, " ");
|
|
48786
49411
|
}
|
|
48787
|
-
const
|
|
48788
|
-
return
|
|
49412
|
+
const readable = baseName.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
49413
|
+
return contextName ? `${contextName} ${readable}` : readable;
|
|
48789
49414
|
}
|
|
48790
49415
|
};
|
|
48791
49416
|
|
|
@@ -49019,6 +49644,7 @@ exports.ExternalDependencyHandler = ExternalDependencyHandler;
|
|
|
49019
49644
|
exports.FileAgentDefinitionStorage = FileAgentDefinitionStorage;
|
|
49020
49645
|
exports.FileConnectorStorage = FileConnectorStorage;
|
|
49021
49646
|
exports.FileContextStorage = FileContextStorage;
|
|
49647
|
+
exports.FileMediaOutputHandler = FileMediaOutputHandler;
|
|
49022
49648
|
exports.FilePersistentInstructionsStorage = FilePersistentInstructionsStorage;
|
|
49023
49649
|
exports.FileStorage = FileStorage;
|
|
49024
49650
|
exports.HookManager = HookManager;
|
|
@@ -49134,6 +49760,7 @@ exports.createFileAgentDefinitionStorage = createFileAgentDefinitionStorage;
|
|
|
49134
49760
|
exports.createFileContextStorage = createFileContextStorage;
|
|
49135
49761
|
exports.createGlobTool = createGlobTool;
|
|
49136
49762
|
exports.createGrepTool = createGrepTool;
|
|
49763
|
+
exports.createImageGenerationTool = createImageGenerationTool;
|
|
49137
49764
|
exports.createImageProvider = createImageProvider;
|
|
49138
49765
|
exports.createListDirectoryTool = createListDirectoryTool;
|
|
49139
49766
|
exports.createMessageWithImages = createMessageWithImages;
|
|
@@ -49141,10 +49768,13 @@ exports.createMetricsCollector = createMetricsCollector;
|
|
|
49141
49768
|
exports.createPlan = createPlan;
|
|
49142
49769
|
exports.createProvider = createProvider;
|
|
49143
49770
|
exports.createReadFileTool = createReadFileTool;
|
|
49771
|
+
exports.createSpeechToTextTool = createSpeechToTextTool;
|
|
49144
49772
|
exports.createStrategy = createStrategy;
|
|
49145
49773
|
exports.createTask = createTask;
|
|
49146
49774
|
exports.createTextMessage = createTextMessage;
|
|
49775
|
+
exports.createTextToSpeechTool = createTextToSpeechTool;
|
|
49147
49776
|
exports.createVideoProvider = createVideoProvider;
|
|
49777
|
+
exports.createVideoTools = createVideoTools;
|
|
49148
49778
|
exports.createWriteFileTool = createWriteFileTool;
|
|
49149
49779
|
exports.defaultDescribeCall = defaultDescribeCall;
|
|
49150
49780
|
exports.detectDependencyCycle = detectDependencyCycle;
|
|
@@ -49177,6 +49807,7 @@ exports.getDocsURL = getDocsURL;
|
|
|
49177
49807
|
exports.getImageModelInfo = getImageModelInfo;
|
|
49178
49808
|
exports.getImageModelsByVendor = getImageModelsByVendor;
|
|
49179
49809
|
exports.getImageModelsWithFeature = getImageModelsWithFeature;
|
|
49810
|
+
exports.getMediaOutputHandler = getMediaOutputHandler;
|
|
49180
49811
|
exports.getModelInfo = getModelInfo;
|
|
49181
49812
|
exports.getModelsByVendor = getModelsByVendor;
|
|
49182
49813
|
exports.getNextExecutableTasks = getNextExecutableTasks;
|
|
@@ -49245,6 +49876,7 @@ exports.resolveDependencies = resolveDependencies;
|
|
|
49245
49876
|
exports.retryWithBackoff = retryWithBackoff;
|
|
49246
49877
|
exports.scopeEquals = scopeEquals;
|
|
49247
49878
|
exports.scopeMatches = scopeMatches;
|
|
49879
|
+
exports.setMediaOutputHandler = setMediaOutputHandler;
|
|
49248
49880
|
exports.setMetricsCollector = setMetricsCollector;
|
|
49249
49881
|
exports.simpleTokenEstimator = simpleTokenEstimator;
|
|
49250
49882
|
exports.toConnectorOptions = toConnectorOptions;
|