@everworker/oneringai 0.2.1 → 0.2.3

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as crypto2 from 'crypto';
2
2
  import { randomUUID } from 'crypto';
3
3
  import { importPKCS8, SignJWT } from 'jose';
4
- import * as fs16 from 'fs';
4
+ import * as fs17 from 'fs';
5
5
  import { promises, existsSync } from 'fs';
6
6
  import { EventEmitter } from 'eventemitter3';
7
7
  import * as path2 from 'path';
@@ -19,7 +19,7 @@ import * as z from 'zod/v4';
19
19
  import spawn$1 from 'cross-spawn';
20
20
  import process2 from 'process';
21
21
  import { PassThrough } from 'stream';
22
- import * as fs15 from 'fs/promises';
22
+ import * as fs16 from 'fs/promises';
23
23
  import { stat, readFile, mkdir, writeFile, readdir } from 'fs/promises';
24
24
  import * as simpleIcons from 'simple-icons';
25
25
  import { exec, spawn } from 'child_process';
@@ -308,6 +308,10 @@ var init_pkce = __esm({
308
308
  });
309
309
 
310
310
  // src/connectors/oauth/flows/AuthCodePKCE.ts
311
+ function isPublicClientError(responseBody) {
312
+ const lower = responseBody.toLowerCase();
313
+ return lower.includes("aadsts700025") || lower.includes("invalid_client") && lower.includes("public");
314
+ }
311
315
  var AuthCodePKCEFlow;
312
316
  var init_AuthCodePKCE = __esm({
313
317
  "src/connectors/oauth/flows/AuthCodePKCE.ts"() {
@@ -403,14 +407,32 @@ var init_AuthCodePKCE = __esm({
403
407
  if (this.config.usePKCE !== false && verifierData) {
404
408
  params.append("code_verifier", verifierData.verifier);
405
409
  }
406
- const response = await fetch(this.config.tokenUrl, {
410
+ let response = await fetch(this.config.tokenUrl, {
407
411
  method: "POST",
408
412
  headers: {
409
413
  "Content-Type": "application/x-www-form-urlencoded"
410
414
  },
411
415
  body: params
412
416
  });
413
- if (!response.ok) {
417
+ if (!response.ok && this.config.clientSecret) {
418
+ const errorText = await response.text();
419
+ if (isPublicClientError(errorText)) {
420
+ params.delete("client_secret");
421
+ response = await fetch(this.config.tokenUrl, {
422
+ method: "POST",
423
+ headers: {
424
+ "Content-Type": "application/x-www-form-urlencoded"
425
+ },
426
+ body: params
427
+ });
428
+ if (!response.ok) {
429
+ const retryError = await response.text();
430
+ throw new Error(`Token exchange failed: ${response.status} ${response.statusText} - ${retryError}`);
431
+ }
432
+ } else {
433
+ throw new Error(`Token exchange failed: ${response.status} ${response.statusText} - ${errorText}`);
434
+ }
435
+ } else if (!response.ok) {
414
436
  const error = await response.text();
415
437
  throw new Error(`Token exchange failed: ${response.status} ${response.statusText} - ${error}`);
416
438
  }
@@ -456,14 +478,32 @@ var init_AuthCodePKCE = __esm({
456
478
  if (this.config.clientSecret) {
457
479
  params.append("client_secret", this.config.clientSecret);
458
480
  }
459
- const response = await fetch(this.config.tokenUrl, {
481
+ let response = await fetch(this.config.tokenUrl, {
460
482
  method: "POST",
461
483
  headers: {
462
484
  "Content-Type": "application/x-www-form-urlencoded"
463
485
  },
464
486
  body: params
465
487
  });
466
- if (!response.ok) {
488
+ if (!response.ok && this.config.clientSecret) {
489
+ const errorText = await response.text();
490
+ if (isPublicClientError(errorText)) {
491
+ params.delete("client_secret");
492
+ response = await fetch(this.config.tokenUrl, {
493
+ method: "POST",
494
+ headers: {
495
+ "Content-Type": "application/x-www-form-urlencoded"
496
+ },
497
+ body: params
498
+ });
499
+ if (!response.ok) {
500
+ const retryError = await response.text();
501
+ throw new Error(`Token refresh failed: ${response.status} ${response.statusText} - ${retryError}`);
502
+ }
503
+ } else {
504
+ throw new Error(`Token refresh failed: ${response.status} ${response.statusText} - ${errorText}`);
505
+ }
506
+ } else if (!response.ok) {
467
507
  const error = await response.text();
468
508
  throw new Error(`Token refresh failed: ${response.status} ${response.statusText} - ${error}`);
469
509
  }
@@ -601,7 +641,7 @@ var init_JWTBearer = __esm({
601
641
  this.privateKey = config.privateKey;
602
642
  } else if (config.privateKeyPath) {
603
643
  try {
604
- this.privateKey = fs16.readFileSync(config.privateKeyPath, "utf8");
644
+ this.privateKey = fs17.readFileSync(config.privateKeyPath, "utf8");
605
645
  } catch (error) {
606
646
  throw new Error(`Failed to read private key from ${config.privateKeyPath}: ${error.message}`);
607
647
  }
@@ -1252,10 +1292,10 @@ var init_Logger = __esm({
1252
1292
  initFileStream(filePath) {
1253
1293
  try {
1254
1294
  const dir = path2.dirname(filePath);
1255
- if (!fs16.existsSync(dir)) {
1256
- fs16.mkdirSync(dir, { recursive: true });
1295
+ if (!fs17.existsSync(dir)) {
1296
+ fs17.mkdirSync(dir, { recursive: true });
1257
1297
  }
1258
- this.fileStream = fs16.createWriteStream(filePath, {
1298
+ this.fileStream = fs17.createWriteStream(filePath, {
1259
1299
  flags: "a",
1260
1300
  // append mode
1261
1301
  encoding: "utf8"
@@ -14592,12 +14632,12 @@ var require_dist = __commonJS({
14592
14632
  throw new Error(`Unknown format "${name}"`);
14593
14633
  return f;
14594
14634
  };
14595
- function addFormats(ajv, list, fs17, exportName) {
14635
+ function addFormats(ajv, list, fs18, exportName) {
14596
14636
  var _a;
14597
14637
  var _b;
14598
14638
  (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
14599
14639
  for (const f of list)
14600
- ajv.addFormat(f, fs17[f]);
14640
+ ajv.addFormat(f, fs18[f]);
14601
14641
  }
14602
14642
  module.exports = exports$1 = formatsPlugin;
14603
14643
  Object.defineProperty(exports$1, "__esModule", { value: true });
@@ -16651,6 +16691,9 @@ var ToolManager = class extends EventEmitter {
16651
16691
  if (options.priority !== void 0) existing.priority = options.priority;
16652
16692
  if (options.conditions !== void 0) existing.conditions = options.conditions;
16653
16693
  if (options.permission !== void 0) existing.permission = options.permission;
16694
+ if (options.tags !== void 0) existing.tags = options.tags;
16695
+ if (options.category !== void 0) existing.category = options.category;
16696
+ if (options.source !== void 0) existing.source = options.source;
16654
16697
  return;
16655
16698
  }
16656
16699
  const namespace = options.namespace ?? "default";
@@ -16669,7 +16712,10 @@ var ToolManager = class extends EventEmitter {
16669
16712
  successCount: 0,
16670
16713
  failureCount: 0
16671
16714
  },
16672
- permission: effectivePermission
16715
+ permission: effectivePermission,
16716
+ tags: options.tags,
16717
+ category: options.category,
16718
+ source: options.source
16673
16719
  };
16674
16720
  this.registry.set(name, registration);
16675
16721
  this.addToNamespace(name, namespace);
@@ -17252,6 +17298,9 @@ var ToolManager = class extends EventEmitter {
17252
17298
  const namespaces = {};
17253
17299
  const priorities = {};
17254
17300
  const permissions = {};
17301
+ const tags = {};
17302
+ const categories = {};
17303
+ const sources = {};
17255
17304
  for (const [name, reg] of this.registry) {
17256
17305
  enabled[name] = reg.enabled;
17257
17306
  namespaces[name] = reg.namespace;
@@ -17259,8 +17308,17 @@ var ToolManager = class extends EventEmitter {
17259
17308
  if (reg.permission) {
17260
17309
  permissions[name] = reg.permission;
17261
17310
  }
17311
+ if (reg.tags) {
17312
+ tags[name] = reg.tags;
17313
+ }
17314
+ if (reg.category) {
17315
+ categories[name] = reg.category;
17316
+ }
17317
+ if (reg.source) {
17318
+ sources[name] = reg.source;
17319
+ }
17262
17320
  }
17263
- return { enabled, namespaces, priorities, permissions };
17321
+ return { enabled, namespaces, priorities, permissions, tags, categories, sources };
17264
17322
  }
17265
17323
  /**
17266
17324
  * Load state (restores enabled/disabled, namespaces, priorities, permissions)
@@ -17284,6 +17342,24 @@ var ToolManager = class extends EventEmitter {
17284
17342
  this.setPermission(name, permission);
17285
17343
  }
17286
17344
  }
17345
+ if (state.tags) {
17346
+ for (const [name, toolTags] of Object.entries(state.tags)) {
17347
+ const reg = this.registry.get(name);
17348
+ if (reg) reg.tags = toolTags;
17349
+ }
17350
+ }
17351
+ if (state.categories) {
17352
+ for (const [name, category] of Object.entries(state.categories)) {
17353
+ const reg = this.registry.get(name);
17354
+ if (reg) reg.category = category;
17355
+ }
17356
+ }
17357
+ if (state.sources) {
17358
+ for (const [name, source] of Object.entries(state.sources)) {
17359
+ const reg = this.registry.get(name);
17360
+ if (reg) reg.source = source;
17361
+ }
17362
+ }
17287
17363
  }
17288
17364
  // ==========================================================================
17289
17365
  // Private Helpers
@@ -28277,8 +28353,8 @@ init_constants();
28277
28353
  throw new Error("Configuration file not found. Searched: " + this.DEFAULT_PATHS.join(", "));
28278
28354
  }
28279
28355
  try {
28280
- const fs17 = __require("fs");
28281
- const content = fs17.readFileSync(configPath, "utf-8");
28356
+ const fs18 = __require("fs");
28357
+ const content = fs18.readFileSync(configPath, "utf-8");
28282
28358
  let config = JSON.parse(content);
28283
28359
  config = this.interpolateEnvVars(config);
28284
28360
  this.validate(config);
@@ -28307,10 +28383,10 @@ init_constants();
28307
28383
  * Find configuration file synchronously
28308
28384
  */
28309
28385
  static findConfigSync() {
28310
- const fs17 = __require("fs");
28386
+ const fs18 = __require("fs");
28311
28387
  for (const path6 of this.DEFAULT_PATHS) {
28312
28388
  try {
28313
- fs17.accessSync(resolve(path6));
28389
+ fs18.accessSync(resolve(path6));
28314
28390
  return resolve(path6);
28315
28391
  } catch {
28316
28392
  }
@@ -34471,7 +34547,7 @@ var OpenAISTTProvider = class extends BaseMediaProvider {
34471
34547
  if (Buffer.isBuffer(audio)) {
34472
34548
  return new File([new Uint8Array(audio)], "audio.wav", { type: "audio/wav" });
34473
34549
  } else if (typeof audio === "string") {
34474
- return fs16.createReadStream(audio);
34550
+ return fs17.createReadStream(audio);
34475
34551
  } else {
34476
34552
  throw new Error("Invalid audio input: must be Buffer or file path");
34477
34553
  }
@@ -35024,7 +35100,7 @@ var TextToSpeech = class _TextToSpeech {
35024
35100
  */
35025
35101
  async toFile(text, filePath, options) {
35026
35102
  const response = await this.synthesize(text, options);
35027
- await fs15.writeFile(filePath, response.audio);
35103
+ await fs16.writeFile(filePath, response.audio);
35028
35104
  }
35029
35105
  // ======================== Introspection Methods ========================
35030
35106
  /**
@@ -35372,7 +35448,7 @@ var SpeechToText = class _SpeechToText {
35372
35448
  * @param options - Optional transcription parameters
35373
35449
  */
35374
35450
  async transcribeFile(filePath, options) {
35375
- const audio = await fs15.readFile(filePath);
35451
+ const audio = await fs16.readFile(filePath);
35376
35452
  return this.transcribe(audio, options);
35377
35453
  }
35378
35454
  /**
@@ -35698,7 +35774,7 @@ var OpenAIImageProvider = class extends BaseMediaProvider {
35698
35774
  if (Buffer.isBuffer(image)) {
35699
35775
  return new File([new Uint8Array(image)], "image.png", { type: "image/png" });
35700
35776
  }
35701
- return fs16.createReadStream(image);
35777
+ return fs17.createReadStream(image);
35702
35778
  }
35703
35779
  /**
35704
35780
  * Handle OpenAI API errors
@@ -35845,8 +35921,8 @@ var GoogleImageProvider = class extends BaseMediaProvider {
35845
35921
  if (Buffer.isBuffer(image)) {
35846
35922
  imageBytes = image.toString("base64");
35847
35923
  } else {
35848
- const fs17 = await import('fs');
35849
- const buffer = fs17.readFileSync(image);
35924
+ const fs18 = await import('fs');
35925
+ const buffer = fs18.readFileSync(image);
35850
35926
  imageBytes = buffer.toString("base64");
35851
35927
  }
35852
35928
  return {
@@ -36007,7 +36083,7 @@ var GrokImageProvider = class extends BaseMediaProvider {
36007
36083
  if (Buffer.isBuffer(image)) {
36008
36084
  return new File([new Uint8Array(image)], "image.png", { type: "image/png" });
36009
36085
  }
36010
- return fs16.createReadStream(image);
36086
+ return fs17.createReadStream(image);
36011
36087
  }
36012
36088
  /**
36013
36089
  * Handle API errors
@@ -37457,8 +37533,8 @@ var OpenAISoraProvider = class extends BaseMediaProvider {
37457
37533
  return new File([new Uint8Array(image)], "input.png", { type: "image/png" });
37458
37534
  }
37459
37535
  if (!image.startsWith("http")) {
37460
- const fs17 = await import('fs');
37461
- const data = fs17.readFileSync(image);
37536
+ const fs18 = await import('fs');
37537
+ const data = fs18.readFileSync(image);
37462
37538
  return new File([new Uint8Array(data)], "input.png", { type: "image/png" });
37463
37539
  }
37464
37540
  const response = await fetch(image);
@@ -37636,7 +37712,7 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
37636
37712
  if (video.videoBytes) {
37637
37713
  buffer = Buffer.from(video.videoBytes, "base64");
37638
37714
  } else if (video.uri) {
37639
- const fs17 = await import('fs/promises');
37715
+ const fs18 = await import('fs/promises');
37640
37716
  const os3 = await import('os');
37641
37717
  const path6 = await import('path');
37642
37718
  const tempDir = os3.tmpdir();
@@ -37647,11 +37723,11 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
37647
37723
  // Pass as GeneratedVideo
37648
37724
  downloadPath: tempFile
37649
37725
  });
37650
- buffer = await fs17.readFile(tempFile);
37651
- await fs17.unlink(tempFile).catch(() => {
37726
+ buffer = await fs18.readFile(tempFile);
37727
+ await fs18.unlink(tempFile).catch(() => {
37652
37728
  });
37653
37729
  } catch (downloadError) {
37654
- await fs17.unlink(tempFile).catch(() => {
37730
+ await fs18.unlink(tempFile).catch(() => {
37655
37731
  });
37656
37732
  throw new ProviderError(
37657
37733
  "google",
@@ -37773,8 +37849,8 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
37773
37849
  if (image.startsWith("http://") || image.startsWith("https://")) {
37774
37850
  return { imageUri: image };
37775
37851
  }
37776
- const fs17 = await import('fs/promises');
37777
- const data = await fs17.readFile(image);
37852
+ const fs18 = await import('fs/promises');
37853
+ const data = await fs18.readFile(image);
37778
37854
  return {
37779
37855
  imageBytes: data.toString("base64")
37780
37856
  };
@@ -38081,8 +38157,8 @@ var GrokImagineProvider = class extends BaseMediaProvider {
38081
38157
  if (image.startsWith("http") || image.startsWith("data:")) {
38082
38158
  return image;
38083
38159
  }
38084
- const fs17 = await import('fs');
38085
- const data = fs17.readFileSync(image);
38160
+ const fs18 = await import('fs');
38161
+ const data = fs18.readFileSync(image);
38086
38162
  const base64 = data.toString("base64");
38087
38163
  const ext = image.split(".").pop()?.toLowerCase() || "png";
38088
38164
  const mimeType = ext === "jpg" || ext === "jpeg" ? "image/jpeg" : `image/${ext}`;
@@ -42354,10 +42430,10 @@ var FileMediaStorage = class {
42354
42430
  }
42355
42431
  async save(data, metadata) {
42356
42432
  const dir = metadata.userId ? path2.join(this.outputDir, metadata.userId) : this.outputDir;
42357
- await fs15.mkdir(dir, { recursive: true });
42433
+ await fs16.mkdir(dir, { recursive: true });
42358
42434
  const filename = metadata.suggestedFilename ?? this.generateFilename(metadata);
42359
42435
  const filePath = path2.join(dir, filename);
42360
- await fs15.writeFile(filePath, data);
42436
+ await fs16.writeFile(filePath, data);
42361
42437
  const format = metadata.format.toLowerCase();
42362
42438
  const mimeType = MIME_TYPES2[format] ?? "application/octet-stream";
42363
42439
  return {
@@ -42368,7 +42444,7 @@ var FileMediaStorage = class {
42368
42444
  }
42369
42445
  async read(location) {
42370
42446
  try {
42371
- return await fs15.readFile(location);
42447
+ return await fs16.readFile(location);
42372
42448
  } catch (err) {
42373
42449
  if (err.code === "ENOENT") {
42374
42450
  return null;
@@ -42378,7 +42454,7 @@ var FileMediaStorage = class {
42378
42454
  }
42379
42455
  async delete(location) {
42380
42456
  try {
42381
- await fs15.unlink(location);
42457
+ await fs16.unlink(location);
42382
42458
  } catch (err) {
42383
42459
  if (err.code === "ENOENT") {
42384
42460
  return;
@@ -42388,7 +42464,7 @@ var FileMediaStorage = class {
42388
42464
  }
42389
42465
  async exists(location) {
42390
42466
  try {
42391
- await fs15.access(location);
42467
+ await fs16.access(location);
42392
42468
  return true;
42393
42469
  } catch {
42394
42470
  return false;
@@ -42397,11 +42473,11 @@ var FileMediaStorage = class {
42397
42473
  async list(options) {
42398
42474
  await this.ensureDir();
42399
42475
  let entries = [];
42400
- const files = await fs15.readdir(this.outputDir);
42476
+ const files = await fs16.readdir(this.outputDir);
42401
42477
  for (const file of files) {
42402
42478
  const filePath = path2.join(this.outputDir, file);
42403
42479
  try {
42404
- const stat6 = await fs15.stat(filePath);
42480
+ const stat6 = await fs16.stat(filePath);
42405
42481
  if (!stat6.isFile()) continue;
42406
42482
  const ext = path2.extname(file).slice(1).toLowerCase();
42407
42483
  const mimeType = MIME_TYPES2[ext] ?? "application/octet-stream";
@@ -42441,7 +42517,7 @@ var FileMediaStorage = class {
42441
42517
  }
42442
42518
  async ensureDir() {
42443
42519
  if (!this.initialized) {
42444
- await fs15.mkdir(this.outputDir, { recursive: true });
42520
+ await fs16.mkdir(this.outputDir, { recursive: true });
42445
42521
  this.initialized = true;
42446
42522
  }
42447
42523
  }
@@ -42449,6 +42525,230 @@ var FileMediaStorage = class {
42449
42525
  function createFileMediaStorage(config) {
42450
42526
  return new FileMediaStorage(config);
42451
42527
  }
42528
+ function getDefaultBaseDirectory4() {
42529
+ const platform2 = process.platform;
42530
+ if (platform2 === "win32") {
42531
+ const appData = process.env.APPDATA || process.env.LOCALAPPDATA;
42532
+ if (appData) {
42533
+ return join(appData, "oneringai", "custom-tools");
42534
+ }
42535
+ }
42536
+ return join(homedir(), ".oneringai", "custom-tools");
42537
+ }
42538
+ function sanitizeName(name) {
42539
+ return name.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase() || "default";
42540
+ }
42541
+ var FileCustomToolStorage = class {
42542
+ baseDirectory;
42543
+ indexPath;
42544
+ prettyPrint;
42545
+ index = null;
42546
+ constructor(config = {}) {
42547
+ this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory4();
42548
+ this.prettyPrint = config.prettyPrint ?? true;
42549
+ this.indexPath = join(this.baseDirectory, "_index.json");
42550
+ }
42551
+ /**
42552
+ * Save a custom tool definition
42553
+ */
42554
+ async save(definition) {
42555
+ const sanitized = sanitizeName(definition.name);
42556
+ const filePath = join(this.baseDirectory, `${sanitized}.json`);
42557
+ await this.ensureDirectory(this.baseDirectory);
42558
+ const data = this.prettyPrint ? JSON.stringify(definition, null, 2) : JSON.stringify(definition);
42559
+ const tempPath = `${filePath}.tmp`;
42560
+ try {
42561
+ await promises.writeFile(tempPath, data, "utf-8");
42562
+ await promises.rename(tempPath, filePath);
42563
+ } catch (error) {
42564
+ try {
42565
+ await promises.unlink(tempPath);
42566
+ } catch {
42567
+ }
42568
+ throw error;
42569
+ }
42570
+ await this.updateIndex(definition);
42571
+ }
42572
+ /**
42573
+ * Load a custom tool definition by name
42574
+ */
42575
+ async load(name) {
42576
+ const sanitized = sanitizeName(name);
42577
+ const filePath = join(this.baseDirectory, `${sanitized}.json`);
42578
+ try {
42579
+ const data = await promises.readFile(filePath, "utf-8");
42580
+ return JSON.parse(data);
42581
+ } catch (error) {
42582
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
42583
+ return null;
42584
+ }
42585
+ if (error instanceof SyntaxError) {
42586
+ return null;
42587
+ }
42588
+ throw error;
42589
+ }
42590
+ }
42591
+ /**
42592
+ * Delete a custom tool definition
42593
+ */
42594
+ async delete(name) {
42595
+ const sanitized = sanitizeName(name);
42596
+ const filePath = join(this.baseDirectory, `${sanitized}.json`);
42597
+ try {
42598
+ await promises.unlink(filePath);
42599
+ } catch (error) {
42600
+ if (error instanceof Error && "code" in error && error.code !== "ENOENT") {
42601
+ throw error;
42602
+ }
42603
+ }
42604
+ await this.removeFromIndex(name);
42605
+ }
42606
+ /**
42607
+ * Check if a custom tool exists
42608
+ */
42609
+ async exists(name) {
42610
+ const sanitized = sanitizeName(name);
42611
+ const filePath = join(this.baseDirectory, `${sanitized}.json`);
42612
+ try {
42613
+ await promises.access(filePath);
42614
+ return true;
42615
+ } catch {
42616
+ return false;
42617
+ }
42618
+ }
42619
+ /**
42620
+ * List custom tools (summaries only)
42621
+ */
42622
+ async list(options) {
42623
+ const index = await this.loadIndex();
42624
+ let entries = [...index.tools];
42625
+ if (options?.tags && options.tags.length > 0) {
42626
+ entries = entries.filter((e) => {
42627
+ const entryTags = e.tags ?? [];
42628
+ return options.tags.some((t) => entryTags.includes(t));
42629
+ });
42630
+ }
42631
+ if (options?.category) {
42632
+ entries = entries.filter((e) => e.category === options.category);
42633
+ }
42634
+ if (options?.search) {
42635
+ const searchLower = options.search.toLowerCase();
42636
+ entries = entries.filter(
42637
+ (e) => e.name.toLowerCase().includes(searchLower) || e.description.toLowerCase().includes(searchLower)
42638
+ );
42639
+ }
42640
+ entries.sort(
42641
+ (a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
42642
+ );
42643
+ if (options?.offset) {
42644
+ entries = entries.slice(options.offset);
42645
+ }
42646
+ if (options?.limit) {
42647
+ entries = entries.slice(0, options.limit);
42648
+ }
42649
+ return entries.map((e) => ({
42650
+ name: e.name,
42651
+ displayName: e.displayName,
42652
+ description: e.description,
42653
+ createdAt: e.createdAt,
42654
+ updatedAt: e.updatedAt,
42655
+ metadata: {
42656
+ tags: e.tags,
42657
+ category: e.category
42658
+ }
42659
+ }));
42660
+ }
42661
+ /**
42662
+ * Update metadata without loading full definition
42663
+ */
42664
+ async updateMetadata(name, metadata) {
42665
+ const definition = await this.load(name);
42666
+ if (!definition) {
42667
+ throw new Error(`Custom tool '${name}' not found`);
42668
+ }
42669
+ definition.metadata = { ...definition.metadata, ...metadata };
42670
+ definition.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
42671
+ await this.save(definition);
42672
+ }
42673
+ /**
42674
+ * Get storage path
42675
+ */
42676
+ getPath() {
42677
+ return this.baseDirectory;
42678
+ }
42679
+ // ==========================================================================
42680
+ // Private Helpers
42681
+ // ==========================================================================
42682
+ async ensureDirectory(dir) {
42683
+ try {
42684
+ await promises.mkdir(dir, { recursive: true });
42685
+ } catch (error) {
42686
+ if (error instanceof Error && "code" in error && error.code !== "EEXIST") {
42687
+ throw error;
42688
+ }
42689
+ }
42690
+ }
42691
+ async loadIndex() {
42692
+ if (this.index) {
42693
+ return this.index;
42694
+ }
42695
+ try {
42696
+ const data = await promises.readFile(this.indexPath, "utf-8");
42697
+ this.index = JSON.parse(data);
42698
+ return this.index;
42699
+ } catch (error) {
42700
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") {
42701
+ this.index = {
42702
+ version: 1,
42703
+ tools: [],
42704
+ lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
42705
+ };
42706
+ return this.index;
42707
+ }
42708
+ throw error;
42709
+ }
42710
+ }
42711
+ async saveIndex() {
42712
+ if (!this.index) return;
42713
+ await this.ensureDirectory(this.baseDirectory);
42714
+ this.index.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
42715
+ const data = this.prettyPrint ? JSON.stringify(this.index, null, 2) : JSON.stringify(this.index);
42716
+ await promises.writeFile(this.indexPath, data, "utf-8");
42717
+ }
42718
+ async updateIndex(definition) {
42719
+ const index = await this.loadIndex();
42720
+ const entry = this.definitionToIndexEntry(definition);
42721
+ const existingIdx = index.tools.findIndex((e) => e.name === definition.name);
42722
+ if (existingIdx >= 0) {
42723
+ index.tools[existingIdx] = entry;
42724
+ } else {
42725
+ index.tools.push(entry);
42726
+ }
42727
+ await this.saveIndex();
42728
+ }
42729
+ async removeFromIndex(name) {
42730
+ const index = await this.loadIndex();
42731
+ index.tools = index.tools.filter((e) => e.name !== name);
42732
+ await this.saveIndex();
42733
+ }
42734
+ definitionToIndexEntry(definition) {
42735
+ return {
42736
+ name: definition.name,
42737
+ displayName: definition.displayName,
42738
+ description: definition.description,
42739
+ createdAt: definition.createdAt,
42740
+ updatedAt: definition.updatedAt,
42741
+ tags: definition.metadata?.tags,
42742
+ category: definition.metadata?.category
42743
+ };
42744
+ }
42745
+ };
42746
+ function createFileCustomToolStorage(config) {
42747
+ return new FileCustomToolStorage(config);
42748
+ }
42749
+
42750
+ // src/domain/entities/CustomToolDefinition.ts
42751
+ var CUSTOM_TOOL_DEFINITION_VERSION = 1;
42452
42752
 
42453
42753
  // src/capabilities/agents/StreamHelpers.ts
42454
42754
  var StreamHelpers = class {
@@ -42896,6 +43196,23 @@ var SERVICE_DEFINITIONS = [
42896
43196
  baseURL: "https://api-m.paypal.com/v2",
42897
43197
  docsURL: "https://developer.paypal.com/docs/api/"
42898
43198
  },
43199
+ {
43200
+ id: "quickbooks",
43201
+ name: "QuickBooks",
43202
+ category: "payments",
43203
+ urlPattern: /quickbooks\.api\.intuit\.com|intuit\.com.*quickbooks/i,
43204
+ baseURL: "https://quickbooks.api.intuit.com/v3",
43205
+ docsURL: "https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/account",
43206
+ commonScopes: ["com.intuit.quickbooks.accounting"]
43207
+ },
43208
+ {
43209
+ id: "ramp",
43210
+ name: "Ramp",
43211
+ category: "payments",
43212
+ urlPattern: /api\.ramp\.com/i,
43213
+ baseURL: "https://api.ramp.com/developer/v1",
43214
+ docsURL: "https://docs.ramp.com/reference"
43215
+ },
42899
43216
  // ============ Cloud Providers ============
42900
43217
  {
42901
43218
  id: "aws",
@@ -43528,8 +43845,8 @@ var FileStorage = class {
43528
43845
  }
43529
43846
  async ensureDirectory() {
43530
43847
  try {
43531
- await fs15.mkdir(this.directory, { recursive: true });
43532
- await fs15.chmod(this.directory, 448);
43848
+ await fs16.mkdir(this.directory, { recursive: true });
43849
+ await fs16.chmod(this.directory, 448);
43533
43850
  } catch (error) {
43534
43851
  }
43535
43852
  }
@@ -43545,13 +43862,13 @@ var FileStorage = class {
43545
43862
  const filePath = this.getFilePath(key);
43546
43863
  const plaintext = JSON.stringify(token);
43547
43864
  const encrypted = encrypt(plaintext, this.encryptionKey);
43548
- await fs15.writeFile(filePath, encrypted, "utf8");
43549
- await fs15.chmod(filePath, 384);
43865
+ await fs16.writeFile(filePath, encrypted, "utf8");
43866
+ await fs16.chmod(filePath, 384);
43550
43867
  }
43551
43868
  async getToken(key) {
43552
43869
  const filePath = this.getFilePath(key);
43553
43870
  try {
43554
- const encrypted = await fs15.readFile(filePath, "utf8");
43871
+ const encrypted = await fs16.readFile(filePath, "utf8");
43555
43872
  const decrypted = decrypt(encrypted, this.encryptionKey);
43556
43873
  return JSON.parse(decrypted);
43557
43874
  } catch (error) {
@@ -43560,7 +43877,7 @@ var FileStorage = class {
43560
43877
  }
43561
43878
  console.error("Failed to read/decrypt token file:", error);
43562
43879
  try {
43563
- await fs15.unlink(filePath);
43880
+ await fs16.unlink(filePath);
43564
43881
  } catch {
43565
43882
  }
43566
43883
  return null;
@@ -43569,7 +43886,7 @@ var FileStorage = class {
43569
43886
  async deleteToken(key) {
43570
43887
  const filePath = this.getFilePath(key);
43571
43888
  try {
43572
- await fs15.unlink(filePath);
43889
+ await fs16.unlink(filePath);
43573
43890
  } catch (error) {
43574
43891
  if (error.code !== "ENOENT") {
43575
43892
  throw error;
@@ -43579,7 +43896,7 @@ var FileStorage = class {
43579
43896
  async hasToken(key) {
43580
43897
  const filePath = this.getFilePath(key);
43581
43898
  try {
43582
- await fs15.access(filePath);
43899
+ await fs16.access(filePath);
43583
43900
  return true;
43584
43901
  } catch {
43585
43902
  return false;
@@ -43590,7 +43907,7 @@ var FileStorage = class {
43590
43907
  */
43591
43908
  async listTokens() {
43592
43909
  try {
43593
- const files = await fs15.readdir(this.directory);
43910
+ const files = await fs16.readdir(this.directory);
43594
43911
  return files.filter((f) => f.endsWith(".token")).map((f) => f.replace(".token", ""));
43595
43912
  } catch {
43596
43913
  return [];
@@ -43601,10 +43918,10 @@ var FileStorage = class {
43601
43918
  */
43602
43919
  async clearAll() {
43603
43920
  try {
43604
- const files = await fs15.readdir(this.directory);
43921
+ const files = await fs16.readdir(this.directory);
43605
43922
  const tokenFiles = files.filter((f) => f.endsWith(".token"));
43606
43923
  await Promise.all(
43607
- tokenFiles.map((f) => fs15.unlink(path2.join(this.directory, f)).catch(() => {
43924
+ tokenFiles.map((f) => fs16.unlink(path2.join(this.directory, f)).catch(() => {
43608
43925
  }))
43609
43926
  );
43610
43927
  } catch {
@@ -44031,14 +44348,14 @@ var FileConnectorStorage = class {
44031
44348
  await this.ensureDirectory();
44032
44349
  const filePath = this.getFilePath(name);
44033
44350
  const json = JSON.stringify(stored, null, 2);
44034
- await fs15.writeFile(filePath, json, "utf8");
44035
- await fs15.chmod(filePath, 384);
44351
+ await fs16.writeFile(filePath, json, "utf8");
44352
+ await fs16.chmod(filePath, 384);
44036
44353
  await this.updateIndex(name, "add");
44037
44354
  }
44038
44355
  async get(name) {
44039
44356
  const filePath = this.getFilePath(name);
44040
44357
  try {
44041
- const json = await fs15.readFile(filePath, "utf8");
44358
+ const json = await fs16.readFile(filePath, "utf8");
44042
44359
  return JSON.parse(json);
44043
44360
  } catch (error) {
44044
44361
  const err = error;
@@ -44051,7 +44368,7 @@ var FileConnectorStorage = class {
44051
44368
  async delete(name) {
44052
44369
  const filePath = this.getFilePath(name);
44053
44370
  try {
44054
- await fs15.unlink(filePath);
44371
+ await fs16.unlink(filePath);
44055
44372
  await this.updateIndex(name, "remove");
44056
44373
  return true;
44057
44374
  } catch (error) {
@@ -44065,7 +44382,7 @@ var FileConnectorStorage = class {
44065
44382
  async has(name) {
44066
44383
  const filePath = this.getFilePath(name);
44067
44384
  try {
44068
- await fs15.access(filePath);
44385
+ await fs16.access(filePath);
44069
44386
  return true;
44070
44387
  } catch {
44071
44388
  return false;
@@ -44091,13 +44408,13 @@ var FileConnectorStorage = class {
44091
44408
  */
44092
44409
  async clear() {
44093
44410
  try {
44094
- const files = await fs15.readdir(this.directory);
44411
+ const files = await fs16.readdir(this.directory);
44095
44412
  const connectorFiles = files.filter(
44096
44413
  (f) => f.endsWith(".connector.json") || f === "_index.json"
44097
44414
  );
44098
44415
  await Promise.all(
44099
44416
  connectorFiles.map(
44100
- (f) => fs15.unlink(path2.join(this.directory, f)).catch(() => {
44417
+ (f) => fs16.unlink(path2.join(this.directory, f)).catch(() => {
44101
44418
  })
44102
44419
  )
44103
44420
  );
@@ -44124,8 +44441,8 @@ var FileConnectorStorage = class {
44124
44441
  async ensureDirectory() {
44125
44442
  if (this.initialized) return;
44126
44443
  try {
44127
- await fs15.mkdir(this.directory, { recursive: true });
44128
- await fs15.chmod(this.directory, 448);
44444
+ await fs16.mkdir(this.directory, { recursive: true });
44445
+ await fs16.chmod(this.directory, 448);
44129
44446
  this.initialized = true;
44130
44447
  } catch {
44131
44448
  this.initialized = true;
@@ -44136,7 +44453,7 @@ var FileConnectorStorage = class {
44136
44453
  */
44137
44454
  async loadIndex() {
44138
44455
  try {
44139
- const json = await fs15.readFile(this.indexPath, "utf8");
44456
+ const json = await fs16.readFile(this.indexPath, "utf8");
44140
44457
  return JSON.parse(json);
44141
44458
  } catch {
44142
44459
  return { connectors: {} };
@@ -44154,8 +44471,8 @@ var FileConnectorStorage = class {
44154
44471
  delete index.connectors[hash];
44155
44472
  }
44156
44473
  const json = JSON.stringify(index, null, 2);
44157
- await fs15.writeFile(this.indexPath, json, "utf8");
44158
- await fs15.chmod(this.indexPath, 384);
44474
+ await fs16.writeFile(this.indexPath, json, "utf8");
44475
+ await fs16.chmod(this.indexPath, 384);
44159
44476
  }
44160
44477
  };
44161
44478
 
@@ -44321,7 +44638,9 @@ function getVendorInfo(vendorId) {
44321
44638
  name: a.name,
44322
44639
  type: a.type,
44323
44640
  description: a.description,
44324
- requiredFields: a.requiredFields
44641
+ requiredFields: a.requiredFields,
44642
+ scopes: a.scopes,
44643
+ scopeDescriptions: a.scopeDescriptions
44325
44644
  }))
44326
44645
  };
44327
44646
  }
@@ -44337,7 +44656,9 @@ function listVendors() {
44337
44656
  name: a.name,
44338
44657
  type: a.type,
44339
44658
  description: a.description,
44340
- requiredFields: a.requiredFields
44659
+ requiredFields: a.requiredFields,
44660
+ scopes: a.scopes,
44661
+ scopeDescriptions: a.scopeDescriptions
44341
44662
  }))
44342
44663
  }));
44343
44664
  }
@@ -44386,14 +44707,49 @@ var microsoftTemplate = {
44386
44707
  scopes: [
44387
44708
  "User.Read",
44388
44709
  "Mail.Read",
44710
+ "Mail.ReadWrite",
44389
44711
  "Mail.Send",
44390
- "Files.ReadWrite",
44391
44712
  "Calendars.ReadWrite",
44713
+ "Contacts.Read",
44714
+ "Contacts.ReadWrite",
44715
+ "Files.ReadWrite",
44716
+ "Sites.Read.All",
44717
+ "Sites.ReadWrite.All",
44718
+ "Notes.Read",
44719
+ "Notes.ReadWrite",
44720
+ "Tasks.ReadWrite",
44392
44721
  "ChannelMessage.Send",
44393
44722
  "Team.ReadBasic.All",
44394
44723
  "Chat.ReadWrite",
44724
+ "People.Read",
44725
+ "Presence.Read",
44726
+ "Directory.Read.All",
44727
+ "BookingsAppointment.ReadWrite.All",
44395
44728
  "offline_access"
44396
- ]
44729
+ ],
44730
+ scopeDescriptions: {
44731
+ "User.Read": "Read your profile",
44732
+ "Mail.Read": "Read your email",
44733
+ "Mail.ReadWrite": "Read and write your email",
44734
+ "Mail.Send": "Send email on your behalf",
44735
+ "Calendars.ReadWrite": "Read and write your calendar",
44736
+ "Contacts.Read": "Read your contacts",
44737
+ "Contacts.ReadWrite": "Read and write your contacts",
44738
+ "Files.ReadWrite": "Read and write your files (OneDrive)",
44739
+ "Sites.Read.All": "Read SharePoint sites",
44740
+ "Sites.ReadWrite.All": "Read and write SharePoint sites",
44741
+ "Notes.Read": "Read your OneNote notebooks",
44742
+ "Notes.ReadWrite": "Read and write your OneNote notebooks",
44743
+ "Tasks.ReadWrite": "Read and write your tasks (To Do / Planner)",
44744
+ "ChannelMessage.Send": "Send messages in Teams channels",
44745
+ "Team.ReadBasic.All": "Read Teams basic info",
44746
+ "Chat.ReadWrite": "Read and write Teams chats",
44747
+ "People.Read": "Read your relevant people list",
44748
+ "Presence.Read": "Read user presence information",
44749
+ "Directory.Read.All": "Read directory data (Azure AD)",
44750
+ "BookingsAppointment.ReadWrite.All": "Manage Bookings appointments",
44751
+ "offline_access": "Maintain access (refresh token)"
44752
+ }
44397
44753
  },
44398
44754
  {
44399
44755
  id: "client-credentials",
@@ -44408,7 +44764,10 @@ var microsoftTemplate = {
44408
44764
  flow: "client_credentials",
44409
44765
  tokenUrl: "https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token"
44410
44766
  },
44411
- scopes: ["https://graph.microsoft.com/.default"]
44767
+ scopes: ["https://graph.microsoft.com/.default"],
44768
+ scopeDescriptions: {
44769
+ "https://graph.microsoft.com/.default": "All permissions granted to the app registration"
44770
+ }
44412
44771
  }
44413
44772
  ]
44414
44773
  };
@@ -44442,9 +44801,24 @@ var googleTemplate = {
44442
44801
  "https://www.googleapis.com/auth/drive",
44443
44802
  "https://www.googleapis.com/auth/calendar",
44444
44803
  "https://www.googleapis.com/auth/gmail.readonly",
44804
+ "https://www.googleapis.com/auth/gmail.send",
44445
44805
  "https://www.googleapis.com/auth/spreadsheets",
44446
- "https://www.googleapis.com/auth/documents"
44447
- ]
44806
+ "https://www.googleapis.com/auth/documents",
44807
+ "https://www.googleapis.com/auth/contacts.readonly",
44808
+ "https://www.googleapis.com/auth/tasks",
44809
+ "https://www.googleapis.com/auth/admin.directory.user.readonly"
44810
+ ],
44811
+ scopeDescriptions: {
44812
+ "https://www.googleapis.com/auth/drive": "Read and write Google Drive files",
44813
+ "https://www.googleapis.com/auth/calendar": "Read and write Google Calendar",
44814
+ "https://www.googleapis.com/auth/gmail.readonly": "Read Gmail messages",
44815
+ "https://www.googleapis.com/auth/gmail.send": "Send Gmail messages",
44816
+ "https://www.googleapis.com/auth/spreadsheets": "Read and write Google Sheets",
44817
+ "https://www.googleapis.com/auth/documents": "Read and write Google Docs",
44818
+ "https://www.googleapis.com/auth/contacts.readonly": "Read Google Contacts",
44819
+ "https://www.googleapis.com/auth/tasks": "Read and write Google Tasks",
44820
+ "https://www.googleapis.com/auth/admin.directory.user.readonly": "Read user directory (Admin)"
44821
+ }
44448
44822
  },
44449
44823
  {
44450
44824
  id: "service-account",
@@ -44463,7 +44837,11 @@ var googleTemplate = {
44463
44837
  scopes: [
44464
44838
  "https://www.googleapis.com/auth/cloud-platform",
44465
44839
  "https://www.googleapis.com/auth/drive"
44466
- ]
44840
+ ],
44841
+ scopeDescriptions: {
44842
+ "https://www.googleapis.com/auth/cloud-platform": "Full access to Google Cloud Platform",
44843
+ "https://www.googleapis.com/auth/drive": "Read and write Google Drive files"
44844
+ }
44467
44845
  }
44468
44846
  ]
44469
44847
  };
@@ -44505,7 +44883,19 @@ var slackTemplate = {
44505
44883
  authorizationUrl: "https://slack.com/oauth/v2/authorize",
44506
44884
  tokenUrl: "https://slack.com/api/oauth.v2.access"
44507
44885
  },
44508
- scopes: ["chat:write", "channels:read", "users:read", "im:write", "groups:read"]
44886
+ scopes: ["chat:write", "channels:read", "users:read", "im:write", "groups:read", "files:read", "files:write", "reactions:read", "reactions:write", "team:read"],
44887
+ scopeDescriptions: {
44888
+ "chat:write": "Send messages as the app",
44889
+ "channels:read": "View basic channel info",
44890
+ "users:read": "View people in the workspace",
44891
+ "im:write": "Send direct messages",
44892
+ "groups:read": "View basic private channel info",
44893
+ "files:read": "View files shared in channels",
44894
+ "files:write": "Upload and manage files",
44895
+ "reactions:read": "View emoji reactions",
44896
+ "reactions:write": "Add and remove emoji reactions",
44897
+ "team:read": "View workspace info"
44898
+ }
44509
44899
  }
44510
44900
  ]
44511
44901
  };
@@ -44546,7 +44936,16 @@ var discordTemplate = {
44546
44936
  authorizationUrl: "https://discord.com/api/oauth2/authorize",
44547
44937
  tokenUrl: "https://discord.com/api/oauth2/token"
44548
44938
  },
44549
- scopes: ["identify", "guilds", "guilds.members.read", "messages.read"]
44939
+ scopes: ["identify", "email", "guilds", "guilds.members.read", "messages.read", "bot", "connections"],
44940
+ scopeDescriptions: {
44941
+ "identify": "Access your username and avatar",
44942
+ "email": "Access your email address",
44943
+ "guilds": "View your server list",
44944
+ "guilds.members.read": "Read server member info",
44945
+ "messages.read": "Read messages in accessible channels",
44946
+ "bot": "Add a bot to your servers",
44947
+ "connections": "View your connected accounts"
44948
+ }
44550
44949
  }
44551
44950
  ]
44552
44951
  };
@@ -44613,7 +45012,18 @@ var githubTemplate = {
44613
45012
  authorizationUrl: "https://github.com/login/oauth/authorize",
44614
45013
  tokenUrl: "https://github.com/login/oauth/access_token"
44615
45014
  },
44616
- scopes: ["repo", "read:user", "read:org", "workflow", "gist"]
45015
+ scopes: ["repo", "read:user", "user:email", "read:org", "workflow", "gist", "notifications", "delete_repo", "admin:org"],
45016
+ scopeDescriptions: {
45017
+ "repo": "Full control of private repositories",
45018
+ "read:user": "Read user profile data",
45019
+ "user:email": "Access user email addresses",
45020
+ "read:org": "Read org and team membership",
45021
+ "workflow": "Update GitHub Actions workflows",
45022
+ "gist": "Create and manage gists",
45023
+ "notifications": "Access notifications",
45024
+ "delete_repo": "Delete repositories",
45025
+ "admin:org": "Full control of orgs and teams"
45026
+ }
44617
45027
  },
44618
45028
  {
44619
45029
  id: "github-app",
@@ -44668,7 +45078,13 @@ var gitlabTemplate = {
44668
45078
  authorizationUrl: "https://gitlab.com/oauth/authorize",
44669
45079
  tokenUrl: "https://gitlab.com/oauth/token"
44670
45080
  },
44671
- scopes: ["api", "read_user", "read_repository", "write_repository"]
45081
+ scopes: ["api", "read_user", "read_repository", "write_repository"],
45082
+ scopeDescriptions: {
45083
+ "api": "Full API access",
45084
+ "read_user": "Read user profile",
45085
+ "read_repository": "Read repository contents",
45086
+ "write_repository": "Write to repositories"
45087
+ }
44672
45088
  }
44673
45089
  ]
44674
45090
  };
@@ -44710,7 +45126,14 @@ var jiraTemplate = {
44710
45126
  authorizationUrl: "https://auth.atlassian.com/authorize",
44711
45127
  tokenUrl: "https://auth.atlassian.com/oauth/token"
44712
45128
  },
44713
- scopes: ["read:jira-work", "write:jira-work", "read:jira-user"]
45129
+ scopes: ["read:jira-work", "write:jira-work", "read:jira-user", "manage:jira-project", "manage:jira-configuration"],
45130
+ scopeDescriptions: {
45131
+ "read:jira-work": "Read issues, projects, boards",
45132
+ "write:jira-work": "Create and update issues",
45133
+ "read:jira-user": "Read user information",
45134
+ "manage:jira-project": "Manage projects and components",
45135
+ "manage:jira-configuration": "Manage Jira settings"
45136
+ }
44714
45137
  }
44715
45138
  ]
44716
45139
  };
@@ -44750,7 +45173,14 @@ var confluenceTemplate = {
44750
45173
  authorizationUrl: "https://auth.atlassian.com/authorize",
44751
45174
  tokenUrl: "https://auth.atlassian.com/oauth/token"
44752
45175
  },
44753
- scopes: ["read:confluence-content.all", "write:confluence-content", "read:confluence-space.summary"]
45176
+ scopes: ["read:confluence-content.all", "write:confluence-content", "read:confluence-space.summary", "write:confluence-space", "read:confluence-user"],
45177
+ scopeDescriptions: {
45178
+ "read:confluence-content.all": "Read all pages and blog posts",
45179
+ "write:confluence-content": "Create and update pages",
45180
+ "read:confluence-space.summary": "Read space summaries",
45181
+ "write:confluence-space": "Create and manage spaces",
45182
+ "read:confluence-user": "Read user information"
45183
+ }
44754
45184
  }
44755
45185
  ]
44756
45186
  };
@@ -44789,7 +45219,16 @@ var bitbucketTemplate = {
44789
45219
  authorizationUrl: "https://bitbucket.org/site/oauth2/authorize",
44790
45220
  tokenUrl: "https://bitbucket.org/site/oauth2/access_token"
44791
45221
  },
44792
- scopes: ["repository", "pullrequest", "account"]
45222
+ scopes: ["repository", "repository:write", "pullrequest", "pullrequest:write", "account", "pipeline", "wiki"],
45223
+ scopeDescriptions: {
45224
+ "repository": "Read repositories",
45225
+ "repository:write": "Write to repositories",
45226
+ "pullrequest": "Read pull requests",
45227
+ "pullrequest:write": "Create and update pull requests",
45228
+ "account": "Read account information",
45229
+ "pipeline": "Access Pipelines (CI/CD)",
45230
+ "wiki": "Access repository wiki"
45231
+ }
44793
45232
  }
44794
45233
  ]
44795
45234
  };
@@ -44829,7 +45268,12 @@ var trelloTemplate = {
44829
45268
  authorizationUrl: "https://trello.com/1/authorize",
44830
45269
  tokenUrl: "https://trello.com/1/OAuthGetAccessToken"
44831
45270
  },
44832
- scopes: ["read", "write", "account"]
45271
+ scopes: ["read", "write", "account"],
45272
+ scopeDescriptions: {
45273
+ "read": "Read boards, lists, and cards",
45274
+ "write": "Create and update boards, lists, and cards",
45275
+ "account": "Read member information"
45276
+ }
44833
45277
  }
44834
45278
  ]
44835
45279
  };
@@ -45024,7 +45468,15 @@ var salesforceTemplate = {
45024
45468
  authorizationUrl: "https://login.salesforce.com/services/oauth2/authorize",
45025
45469
  tokenUrl: "https://login.salesforce.com/services/oauth2/token"
45026
45470
  },
45027
- scopes: ["api", "refresh_token", "offline_access"]
45471
+ scopes: ["api", "refresh_token", "offline_access", "chatter_api", "wave_api", "full"],
45472
+ scopeDescriptions: {
45473
+ "api": "Access and manage your data",
45474
+ "refresh_token": "Maintain access with refresh tokens",
45475
+ "offline_access": "Access data while you are offline",
45476
+ "chatter_api": "Access Chatter feeds and posts",
45477
+ "wave_api": "Access Analytics (Wave) API",
45478
+ "full": "Full access to all data"
45479
+ }
45028
45480
  },
45029
45481
  {
45030
45482
  id: "jwt-bearer",
@@ -45079,7 +45531,26 @@ var hubspotTemplate = {
45079
45531
  authorizationUrl: "https://app.hubspot.com/oauth/authorize",
45080
45532
  tokenUrl: "https://api.hubapi.com/oauth/v1/token"
45081
45533
  },
45082
- scopes: ["crm.objects.contacts.read", "crm.objects.contacts.write", "crm.objects.companies.read"]
45534
+ scopes: [
45535
+ "crm.objects.contacts.read",
45536
+ "crm.objects.contacts.write",
45537
+ "crm.objects.companies.read",
45538
+ "crm.objects.companies.write",
45539
+ "crm.objects.deals.read",
45540
+ "crm.objects.deals.write",
45541
+ "tickets",
45542
+ "e-commerce"
45543
+ ],
45544
+ scopeDescriptions: {
45545
+ "crm.objects.contacts.read": "Read contacts",
45546
+ "crm.objects.contacts.write": "Create and update contacts",
45547
+ "crm.objects.companies.read": "Read companies",
45548
+ "crm.objects.companies.write": "Create and update companies",
45549
+ "crm.objects.deals.read": "Read deals",
45550
+ "crm.objects.deals.write": "Create and update deals",
45551
+ "tickets": "Read and write support tickets",
45552
+ "e-commerce": "Access e-commerce data (products, line items)"
45553
+ }
45083
45554
  }
45084
45555
  ]
45085
45556
  };
@@ -45192,6 +45663,86 @@ var paypalTemplate = {
45192
45663
  ]
45193
45664
  };
45194
45665
 
45666
+ // src/connectors/vendors/templates/quickbooks.ts
45667
+ var quickbooksTemplate = {
45668
+ id: "quickbooks",
45669
+ name: "QuickBooks",
45670
+ serviceType: "quickbooks",
45671
+ baseURL: "https://quickbooks.api.intuit.com/v3",
45672
+ docsURL: "https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/account",
45673
+ credentialsSetupURL: "https://developer.intuit.com/app/developer/dashboard",
45674
+ category: "payments",
45675
+ notes: "Use sandbox URL (sandbox-quickbooks.api.intuit.com) for testing. Requires company/realm ID in API paths.",
45676
+ authTemplates: [
45677
+ {
45678
+ id: "oauth-user",
45679
+ name: "OAuth (User Authorization)",
45680
+ type: "oauth",
45681
+ flow: "authorization_code",
45682
+ description: "Standard OAuth 2.0 flow for accessing QuickBooks on behalf of a user. Create an app at developer.intuit.com",
45683
+ requiredFields: ["clientId", "clientSecret", "redirectUri"],
45684
+ optionalFields: ["scope"],
45685
+ defaults: {
45686
+ type: "oauth",
45687
+ flow: "authorization_code",
45688
+ authorizationUrl: "https://appcenter.intuit.com/connect/oauth2",
45689
+ tokenUrl: "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer"
45690
+ },
45691
+ scopes: ["com.intuit.quickbooks.accounting", "com.intuit.quickbooks.payment"]
45692
+ }
45693
+ ]
45694
+ };
45695
+
45696
+ // src/connectors/vendors/templates/ramp.ts
45697
+ var rampTemplate = {
45698
+ id: "ramp",
45699
+ name: "Ramp",
45700
+ serviceType: "ramp",
45701
+ baseURL: "https://api.ramp.com/developer/v1",
45702
+ docsURL: "https://docs.ramp.com",
45703
+ credentialsSetupURL: "https://app.ramp.com/settings/developer",
45704
+ category: "payments",
45705
+ authTemplates: [
45706
+ {
45707
+ id: "oauth-client-credentials",
45708
+ name: "OAuth (Client Credentials)",
45709
+ type: "oauth",
45710
+ flow: "client_credentials",
45711
+ description: "App-level authentication using client credentials. Create an API application in Ramp developer settings",
45712
+ requiredFields: ["clientId", "clientSecret"],
45713
+ defaults: {
45714
+ type: "oauth",
45715
+ flow: "client_credentials",
45716
+ tokenUrl: "https://api.ramp.com/developer/v1/token"
45717
+ }
45718
+ },
45719
+ {
45720
+ id: "oauth-user",
45721
+ name: "OAuth (User Authorization)",
45722
+ type: "oauth",
45723
+ flow: "authorization_code",
45724
+ description: "OAuth 2.0 authorization code flow for accessing Ramp on behalf of a user",
45725
+ requiredFields: ["clientId", "clientSecret", "redirectUri"],
45726
+ optionalFields: ["scope"],
45727
+ defaults: {
45728
+ type: "oauth",
45729
+ flow: "authorization_code",
45730
+ authorizationUrl: "https://app.ramp.com/v1/authorize",
45731
+ tokenUrl: "https://api.ramp.com/developer/v1/token"
45732
+ },
45733
+ scopes: [
45734
+ "transactions:read",
45735
+ "users:read",
45736
+ "users:write",
45737
+ "cards:read",
45738
+ "cards:write",
45739
+ "departments:read",
45740
+ "reimbursements:read"
45741
+ ]
45742
+ }
45743
+ ]
45744
+ };
45745
+
45195
45746
  // src/connectors/vendors/templates/aws.ts
45196
45747
  var awsTemplate = {
45197
45748
  id: "aws",
@@ -45244,7 +45795,16 @@ var dropboxTemplate = {
45244
45795
  tokenUrl: "https://api.dropboxapi.com/oauth2/token",
45245
45796
  usePKCE: true
45246
45797
  },
45247
- scopes: ["files.content.read", "files.content.write", "files.metadata.read"]
45798
+ scopes: ["files.content.read", "files.content.write", "files.metadata.read", "files.metadata.write", "sharing.read", "sharing.write", "account_info.read"],
45799
+ scopeDescriptions: {
45800
+ "files.content.read": "Read file contents",
45801
+ "files.content.write": "Upload and modify files",
45802
+ "files.metadata.read": "Read file and folder metadata",
45803
+ "files.metadata.write": "Modify file and folder metadata",
45804
+ "sharing.read": "View sharing settings",
45805
+ "sharing.write": "Manage sharing settings",
45806
+ "account_info.read": "Read account information"
45807
+ }
45248
45808
  }
45249
45809
  ]
45250
45810
  };
@@ -45272,6 +45832,13 @@ var boxTemplate = {
45272
45832
  flow: "authorization_code",
45273
45833
  authorizationUrl: "https://account.box.com/api/oauth2/authorize",
45274
45834
  tokenUrl: "https://api.box.com/oauth2/token"
45835
+ },
45836
+ scopes: ["root_readwrite", "manage_users", "manage_groups", "manage_enterprise"],
45837
+ scopeDescriptions: {
45838
+ "root_readwrite": "Read and write all files and folders",
45839
+ "manage_users": "Manage enterprise users",
45840
+ "manage_groups": "Manage enterprise groups",
45841
+ "manage_enterprise": "Manage enterprise settings"
45275
45842
  }
45276
45843
  },
45277
45844
  {
@@ -45448,6 +46015,11 @@ var pagerdutyTemplate = {
45448
46015
  flow: "authorization_code",
45449
46016
  authorizationUrl: "https://app.pagerduty.com/oauth/authorize",
45450
46017
  tokenUrl: "https://app.pagerduty.com/oauth/token"
46018
+ },
46019
+ scopes: ["read", "write"],
46020
+ scopeDescriptions: {
46021
+ "read": "Read incidents, services, and schedules",
46022
+ "write": "Create and update incidents and services"
45451
46023
  }
45452
46024
  }
45453
46025
  ]
@@ -45486,6 +46058,14 @@ var sentryTemplate = {
45486
46058
  flow: "authorization_code",
45487
46059
  authorizationUrl: "https://sentry.io/oauth/authorize/",
45488
46060
  tokenUrl: "https://sentry.io/oauth/token/"
46061
+ },
46062
+ scopes: ["project:read", "project:write", "event:read", "org:read", "member:read"],
46063
+ scopeDescriptions: {
46064
+ "project:read": "Read project settings",
46065
+ "project:write": "Manage project settings",
46066
+ "event:read": "Read error events and issues",
46067
+ "org:read": "Read organization info",
46068
+ "member:read": "Read org member info"
45489
46069
  }
45490
46070
  }
45491
46071
  ]
@@ -45683,7 +46263,13 @@ var zendeskTemplate = {
45683
46263
  authorizationUrl: "https://{subdomain}.zendesk.com/oauth/authorizations/new",
45684
46264
  tokenUrl: "https://{subdomain}.zendesk.com/oauth/tokens"
45685
46265
  },
45686
- scopes: ["read", "write", "tickets:read", "tickets:write"]
46266
+ scopes: ["read", "write", "tickets:read", "tickets:write"],
46267
+ scopeDescriptions: {
46268
+ "read": "Read all resources",
46269
+ "write": "Create and update resources",
46270
+ "tickets:read": "Read support tickets",
46271
+ "tickets:write": "Create and update tickets"
46272
+ }
45687
46273
  }
45688
46274
  ]
45689
46275
  };
@@ -45761,7 +46347,19 @@ var shopifyTemplate = {
45761
46347
  authorizationUrl: "https://{subdomain}.myshopify.com/admin/oauth/authorize",
45762
46348
  tokenUrl: "https://{subdomain}.myshopify.com/admin/oauth/access_token"
45763
46349
  },
45764
- scopes: ["read_products", "write_products", "read_orders", "write_orders"]
46350
+ scopes: ["read_products", "write_products", "read_orders", "write_orders", "read_customers", "write_customers", "read_inventory", "write_inventory", "read_fulfillments", "write_fulfillments"],
46351
+ scopeDescriptions: {
46352
+ "read_products": "Read products and collections",
46353
+ "write_products": "Create and update products",
46354
+ "read_orders": "Read orders and transactions",
46355
+ "write_orders": "Create and update orders",
46356
+ "read_customers": "Read customer information",
46357
+ "write_customers": "Create and update customers",
46358
+ "read_inventory": "Read inventory levels",
46359
+ "write_inventory": "Update inventory levels",
46360
+ "read_fulfillments": "Read fulfillment data",
46361
+ "write_fulfillments": "Create and update fulfillments"
46362
+ }
45765
46363
  }
45766
46364
  ]
45767
46365
  };
@@ -45794,6 +46392,8 @@ var allVendorTemplates = [
45794
46392
  // Payments
45795
46393
  stripeTemplate,
45796
46394
  paypalTemplate,
46395
+ quickbooksTemplate,
46396
+ rampTemplate,
45797
46397
  // Cloud
45798
46398
  awsTemplate,
45799
46399
  // Storage
@@ -45856,6 +46456,9 @@ var VENDOR_ICON_MAP = {
45856
46456
  // Payments
45857
46457
  stripe: "stripe",
45858
46458
  paypal: "paypal",
46459
+ quickbooks: "quickbooks",
46460
+ ramp: null,
46461
+ // No Simple Icon available
45859
46462
  // Email
45860
46463
  sendgrid: "sendgrid",
45861
46464
  mailchimp: "mailchimp",
@@ -45902,6 +46505,8 @@ var FALLBACK_PLACEHOLDERS = {
45902
46505
  // Email (trademark removed)
45903
46506
  sendgrid: { color: "#1A82E2", letter: "S" },
45904
46507
  postmark: { color: "#FFDE00", letter: "P" },
46508
+ // Payments (no Simple Icon available)
46509
+ ramp: { color: "#F2C94C", letter: "R" },
45905
46510
  // Search (no Simple Icon available)
45906
46511
  serper: { color: "#4A90A4", letter: "S" },
45907
46512
  tavily: { color: "#7C3AED", letter: "T" },
@@ -46322,8 +46927,8 @@ function createMessageWithImages(text, imageUrls, role = "user" /* USER */) {
46322
46927
  var execAsync = promisify(exec);
46323
46928
  function cleanupTempFile(filePath) {
46324
46929
  try {
46325
- if (fs16.existsSync(filePath)) {
46326
- fs16.unlinkSync(filePath);
46930
+ if (fs17.existsSync(filePath)) {
46931
+ fs17.unlinkSync(filePath);
46327
46932
  }
46328
46933
  } catch {
46329
46934
  }
@@ -46374,7 +46979,7 @@ async function readClipboardImageMac() {
46374
46979
  end try
46375
46980
  `;
46376
46981
  const { stdout } = await execAsync(`osascript -e '${script}'`);
46377
- if (stdout.includes("success") || fs16.existsSync(tempFile)) {
46982
+ if (stdout.includes("success") || fs17.existsSync(tempFile)) {
46378
46983
  return await convertFileToDataUri(tempFile);
46379
46984
  }
46380
46985
  return {
@@ -46391,14 +46996,14 @@ async function readClipboardImageLinux() {
46391
46996
  try {
46392
46997
  try {
46393
46998
  await execAsync(`xclip -selection clipboard -t image/png -o > "${tempFile}"`);
46394
- if (fs16.existsSync(tempFile) && fs16.statSync(tempFile).size > 0) {
46999
+ if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
46395
47000
  return await convertFileToDataUri(tempFile);
46396
47001
  }
46397
47002
  } catch {
46398
47003
  }
46399
47004
  try {
46400
47005
  await execAsync(`wl-paste -t image/png > "${tempFile}"`);
46401
- if (fs16.existsSync(tempFile) && fs16.statSync(tempFile).size > 0) {
47006
+ if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
46402
47007
  return await convertFileToDataUri(tempFile);
46403
47008
  }
46404
47009
  } catch {
@@ -46425,7 +47030,7 @@ async function readClipboardImageWindows() {
46425
47030
  }
46426
47031
  `;
46427
47032
  await execAsync(`powershell -Command "${psScript}"`);
46428
- if (fs16.existsSync(tempFile) && fs16.statSync(tempFile).size > 0) {
47033
+ if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
46429
47034
  return await convertFileToDataUri(tempFile);
46430
47035
  }
46431
47036
  return {
@@ -46438,7 +47043,7 @@ async function readClipboardImageWindows() {
46438
47043
  }
46439
47044
  async function convertFileToDataUri(filePath) {
46440
47045
  try {
46441
- const imageBuffer = fs16.readFileSync(filePath);
47046
+ const imageBuffer = fs17.readFileSync(filePath);
46442
47047
  const base64Image = imageBuffer.toString("base64");
46443
47048
  const magic = imageBuffer.slice(0, 4).toString("hex");
46444
47049
  let mimeType = "image/png";
@@ -46694,6 +47299,13 @@ __export(tools_exports, {
46694
47299
  bash: () => bash,
46695
47300
  createBashTool: () => createBashTool,
46696
47301
  createCreatePRTool: () => createCreatePRTool,
47302
+ createCustomToolDelete: () => createCustomToolDelete,
47303
+ createCustomToolDraft: () => createCustomToolDraft,
47304
+ createCustomToolList: () => createCustomToolList,
47305
+ createCustomToolLoad: () => createCustomToolLoad,
47306
+ createCustomToolMetaTools: () => createCustomToolMetaTools,
47307
+ createCustomToolSave: () => createCustomToolSave,
47308
+ createCustomToolTest: () => createCustomToolTest,
46697
47309
  createDesktopGetCursorTool: () => createDesktopGetCursorTool,
46698
47310
  createDesktopGetScreenSizeTool: () => createDesktopGetScreenSizeTool,
46699
47311
  createDesktopKeyboardKeyTool: () => createDesktopKeyboardKeyTool,
@@ -46724,6 +47336,12 @@ __export(tools_exports, {
46724
47336
  createWebScrapeTool: () => createWebScrapeTool,
46725
47337
  createWebSearchTool: () => createWebSearchTool,
46726
47338
  createWriteFileTool: () => createWriteFileTool,
47339
+ customToolDelete: () => customToolDelete,
47340
+ customToolDraft: () => customToolDraft,
47341
+ customToolList: () => customToolList,
47342
+ customToolLoad: () => customToolLoad,
47343
+ customToolSave: () => customToolSave,
47344
+ customToolTest: () => customToolTest,
46727
47345
  desktopGetCursor: () => desktopGetCursor,
46728
47346
  desktopGetScreenSize: () => desktopGetScreenSize,
46729
47347
  desktopKeyboardKey: () => desktopKeyboardKey,
@@ -46738,6 +47356,7 @@ __export(tools_exports, {
46738
47356
  desktopWindowList: () => desktopWindowList,
46739
47357
  developerTools: () => developerTools,
46740
47358
  editFile: () => editFile,
47359
+ executeInVM: () => executeInVM,
46741
47360
  executeJavaScript: () => executeJavaScript,
46742
47361
  expandTilde: () => expandTilde,
46743
47362
  getAllBuiltInTools: () => getAllBuiltInTools,
@@ -46752,6 +47371,7 @@ __export(tools_exports, {
46752
47371
  getToolsRequiringConnector: () => getToolsRequiringConnector,
46753
47372
  glob: () => glob,
46754
47373
  grep: () => grep,
47374
+ hydrateCustomTool: () => hydrateCustomTool,
46755
47375
  isBlockedCommand: () => isBlockedCommand,
46756
47376
  isExcludedExtension: () => isExcludedExtension,
46757
47377
  jsonManipulator: () => jsonManipulator,
@@ -51659,6 +52279,498 @@ var desktopTools = [
51659
52279
  desktopWindowFocus
51660
52280
  ];
51661
52281
 
52282
+ // src/tools/custom-tools/customToolDelete.ts
52283
+ function createCustomToolDelete(storage) {
52284
+ return {
52285
+ definition: {
52286
+ type: "function",
52287
+ function: {
52288
+ name: "custom_tool_delete",
52289
+ description: "Delete a custom tool from persistent storage.",
52290
+ parameters: {
52291
+ type: "object",
52292
+ properties: {
52293
+ name: {
52294
+ type: "string",
52295
+ description: "Name of the tool to delete"
52296
+ }
52297
+ },
52298
+ required: ["name"]
52299
+ }
52300
+ }
52301
+ },
52302
+ permission: { scope: "session", riskLevel: "medium" },
52303
+ execute: async (args) => {
52304
+ try {
52305
+ const exists = await storage.exists(args.name);
52306
+ if (!exists) {
52307
+ return { success: false, name: args.name, error: `Custom tool '${args.name}' not found` };
52308
+ }
52309
+ await storage.delete(args.name);
52310
+ return { success: true, name: args.name };
52311
+ } catch (error) {
52312
+ return { success: false, name: args.name, error: error.message };
52313
+ }
52314
+ },
52315
+ describeCall: (args) => args.name
52316
+ };
52317
+ }
52318
+ var customToolDelete = createCustomToolDelete(new FileCustomToolStorage());
52319
+
52320
+ // src/tools/custom-tools/sandboxDescription.ts
52321
+ init_Connector();
52322
+ function formatConnectorEntry2(c) {
52323
+ const parts = [];
52324
+ const serviceOrVendor = c.serviceType ?? c.vendor ?? void 0;
52325
+ if (serviceOrVendor) parts.push(`Service: ${serviceOrVendor}`);
52326
+ if (c.config.description) parts.push(c.config.description);
52327
+ if (c.baseURL) parts.push(`URL: ${c.baseURL}`);
52328
+ const details = parts.map((p) => ` ${p}`).join("\n");
52329
+ return ` \u2022 "${c.name}" (${c.displayName})
52330
+ ${details}`;
52331
+ }
52332
+ function buildConnectorList(context) {
52333
+ const registry = context?.connectorRegistry ?? Connector.asRegistry();
52334
+ const connectors = registry.listAll();
52335
+ if (connectors.length === 0) {
52336
+ return " No connectors registered.";
52337
+ }
52338
+ return connectors.map(formatConnectorEntry2).join("\n\n");
52339
+ }
52340
+ var SANDBOX_API_REFERENCE = `SANDBOX API (available inside custom tool code):
52341
+
52342
+ 1. authenticatedFetch(url, options, connectorName)
52343
+ Makes authenticated HTTP requests using the connector's credentials.
52344
+ Auth headers are added automatically \u2014 DO NOT set Authorization header manually.
52345
+
52346
+ Parameters:
52347
+ \u2022 url: Full URL or path relative to the connector's base URL
52348
+ - Full: "https://api.github.com/user/repos"
52349
+ - Relative: "/user/repos" (resolved against connector's base URL)
52350
+ \u2022 options: Standard fetch options { method, headers, body }
52351
+ - For POST/PUT: set body to JSON.stringify(data) and headers to { 'Content-Type': 'application/json' }
52352
+ \u2022 connectorName: Name of a registered connector (see REGISTERED CONNECTORS below)
52353
+
52354
+ Returns: Promise<Response>
52355
+ \u2022 response.ok \u2014 true if status 200-299
52356
+ \u2022 response.status \u2014 HTTP status code
52357
+ \u2022 await response.json() \u2014 parse JSON body
52358
+ \u2022 await response.text() \u2014 get text body
52359
+
52360
+ 2. fetch(url, options) \u2014 Standard fetch without authentication
52361
+
52362
+ 3. connectors.list() \u2014 Array of available connector names
52363
+ 4. connectors.get(name) \u2014 Connector info: { displayName, description, baseURL, serviceType }
52364
+
52365
+ VARIABLES:
52366
+ \u2022 input \u2014 the tool's input arguments (matches inputSchema)
52367
+ \u2022 output \u2014 SET THIS to return the tool's result to the caller
52368
+
52369
+ GLOBALS: console.log/error/warn, JSON, Math, Date, Buffer, Promise, Array, Object, String, Number, Boolean, setTimeout, setInterval, URL, URLSearchParams, RegExp, Map, Set, Error, TextEncoder, TextDecoder
52370
+
52371
+ LIMITS: No file system access, no require/import. Code runs in async context (await is available).`;
52372
+ function buildDraftDescription(context) {
52373
+ const connectorList = buildConnectorList(context);
52374
+ return `Validate a draft custom tool definition. Checks name format, schema structure, and code syntax.
52375
+
52376
+ When writing the "code" field, you have access to the full VM sandbox:
52377
+
52378
+ ${SANDBOX_API_REFERENCE}
52379
+
52380
+ REGISTERED CONNECTORS:
52381
+ ${connectorList}
52382
+
52383
+ CODE EXAMPLES:
52384
+
52385
+ // Simple data processing tool
52386
+ const items = input.data;
52387
+ output = items.filter(i => i.score > 0.8).sort((a, b) => b.score - a.score);
52388
+
52389
+ // API tool using a connector
52390
+ const resp = await authenticatedFetch('/user/repos', { method: 'GET' }, 'github');
52391
+ const repos = await resp.json();
52392
+ output = repos.map(r => ({ name: r.full_name, stars: r.stargazers_count }));
52393
+
52394
+ // Tool that chains multiple API calls
52395
+ const users = await (await authenticatedFetch('/users', {}, 'my-api')).json();
52396
+ const enriched = await Promise.all(users.map(async u => {
52397
+ const details = await (await authenticatedFetch(\`/users/\${u.id}\`, {}, 'my-api')).json();
52398
+ return { ...u, ...details };
52399
+ }));
52400
+ output = enriched;`;
52401
+ }
52402
+ function buildTestDescription(context) {
52403
+ const connectorList = buildConnectorList(context);
52404
+ return `Test custom tool code by executing it in the VM sandbox with provided test input. Returns execution result, captured logs, and timing.
52405
+
52406
+ The code runs in the same sandbox as execute_javascript:
52407
+
52408
+ ${SANDBOX_API_REFERENCE}
52409
+
52410
+ REGISTERED CONNECTORS:
52411
+ ${connectorList}
52412
+
52413
+ The testInput you provide will be available as the \`input\` variable in the code.
52414
+ Set \`output\` to the value you want returned.`;
52415
+ }
52416
+
52417
+ // src/tools/custom-tools/customToolDraft.ts
52418
+ var NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
52419
+ function createCustomToolDraft() {
52420
+ return {
52421
+ definition: {
52422
+ type: "function",
52423
+ function: {
52424
+ name: "custom_tool_draft",
52425
+ description: "Validate a draft custom tool definition. Checks name format, schema structure, and code syntax.",
52426
+ parameters: {
52427
+ type: "object",
52428
+ properties: {
52429
+ name: {
52430
+ type: "string",
52431
+ description: 'Tool name (lowercase, underscores, must start with letter). Example: "fetch_weather"'
52432
+ },
52433
+ description: {
52434
+ type: "string",
52435
+ description: "What the tool does"
52436
+ },
52437
+ inputSchema: {
52438
+ type: "object",
52439
+ description: 'JSON Schema for the tool input (must have type: "object")'
52440
+ },
52441
+ outputSchema: {
52442
+ type: "object",
52443
+ description: "Optional JSON Schema for the tool output (documentation only)"
52444
+ },
52445
+ code: {
52446
+ type: "string",
52447
+ description: "JavaScript code that reads `input` and sets `output`. Runs in the same sandbox as execute_javascript. See tool description for full API reference."
52448
+ },
52449
+ tags: {
52450
+ type: "array",
52451
+ description: "Optional tags for categorization",
52452
+ items: { type: "string" }
52453
+ },
52454
+ connectorName: {
52455
+ type: "string",
52456
+ description: "Optional connector name if the tool requires API access"
52457
+ }
52458
+ },
52459
+ required: ["name", "description", "inputSchema", "code"]
52460
+ }
52461
+ }
52462
+ },
52463
+ descriptionFactory: (context) => buildDraftDescription(context),
52464
+ permission: { scope: "always", riskLevel: "low" },
52465
+ execute: async (args) => {
52466
+ const errors = [];
52467
+ if (!args.name || typeof args.name !== "string") {
52468
+ errors.push("name is required and must be a string");
52469
+ } else if (!NAME_PATTERN.test(args.name)) {
52470
+ errors.push(
52471
+ `name "${args.name}" is invalid. Must match /^[a-z][a-z0-9_]*$/ (lowercase, underscores, start with letter)`
52472
+ );
52473
+ }
52474
+ if (!args.description || typeof args.description !== "string" || args.description.trim().length === 0) {
52475
+ errors.push("description is required and must be a non-empty string");
52476
+ }
52477
+ if (!args.inputSchema || typeof args.inputSchema !== "object") {
52478
+ errors.push("inputSchema is required and must be an object");
52479
+ } else if (args.inputSchema.type !== "object") {
52480
+ errors.push('inputSchema.type must be "object"');
52481
+ }
52482
+ if (!args.code || typeof args.code !== "string" || args.code.trim().length === 0) {
52483
+ errors.push("code is required and must be a non-empty string");
52484
+ } else {
52485
+ try {
52486
+ new Function(args.code);
52487
+ } catch (e) {
52488
+ errors.push(`code has syntax error: ${e.message}`);
52489
+ }
52490
+ }
52491
+ if (errors.length > 0) {
52492
+ return { success: false, errors };
52493
+ }
52494
+ return {
52495
+ success: true,
52496
+ validated: {
52497
+ name: args.name,
52498
+ description: args.description,
52499
+ inputSchema: args.inputSchema,
52500
+ outputSchema: args.outputSchema,
52501
+ code: args.code,
52502
+ tags: args.tags,
52503
+ connectorName: args.connectorName
52504
+ }
52505
+ };
52506
+ },
52507
+ describeCall: (args) => args.name ?? "unknown"
52508
+ };
52509
+ }
52510
+ var customToolDraft = createCustomToolDraft();
52511
+
52512
+ // src/tools/custom-tools/customToolList.ts
52513
+ function createCustomToolList(storage) {
52514
+ return {
52515
+ definition: {
52516
+ type: "function",
52517
+ function: {
52518
+ name: "custom_tool_list",
52519
+ description: "List saved custom tools from persistent storage. Supports filtering by search text, tags, and category.",
52520
+ parameters: {
52521
+ type: "object",
52522
+ properties: {
52523
+ search: {
52524
+ type: "string",
52525
+ description: "Search text (case-insensitive substring match on name + description)"
52526
+ },
52527
+ tags: {
52528
+ type: "array",
52529
+ description: "Filter by tags (any match)",
52530
+ items: { type: "string" }
52531
+ },
52532
+ category: {
52533
+ type: "string",
52534
+ description: "Filter by category"
52535
+ },
52536
+ limit: {
52537
+ type: "number",
52538
+ description: "Maximum number of results"
52539
+ },
52540
+ offset: {
52541
+ type: "number",
52542
+ description: "Offset for pagination"
52543
+ }
52544
+ }
52545
+ }
52546
+ }
52547
+ },
52548
+ permission: { scope: "always", riskLevel: "low" },
52549
+ execute: async (args) => {
52550
+ const tools = await storage.list({
52551
+ search: args.search,
52552
+ tags: args.tags,
52553
+ category: args.category,
52554
+ limit: args.limit,
52555
+ offset: args.offset
52556
+ });
52557
+ return { tools, total: tools.length };
52558
+ },
52559
+ describeCall: (args) => args.search ?? "all tools"
52560
+ };
52561
+ }
52562
+ var customToolList = createCustomToolList(new FileCustomToolStorage());
52563
+
52564
+ // src/tools/custom-tools/customToolLoad.ts
52565
+ function createCustomToolLoad(storage) {
52566
+ return {
52567
+ definition: {
52568
+ type: "function",
52569
+ function: {
52570
+ name: "custom_tool_load",
52571
+ description: "Load a full custom tool definition from storage (including code). Use this to inspect, modify, or hydrate a saved tool.",
52572
+ parameters: {
52573
+ type: "object",
52574
+ properties: {
52575
+ name: {
52576
+ type: "string",
52577
+ description: "Name of the tool to load"
52578
+ }
52579
+ },
52580
+ required: ["name"]
52581
+ }
52582
+ }
52583
+ },
52584
+ permission: { scope: "always", riskLevel: "low" },
52585
+ execute: async (args) => {
52586
+ const tool = await storage.load(args.name);
52587
+ if (!tool) {
52588
+ return { success: false, error: `Custom tool '${args.name}' not found` };
52589
+ }
52590
+ return { success: true, tool };
52591
+ },
52592
+ describeCall: (args) => args.name
52593
+ };
52594
+ }
52595
+ var customToolLoad = createCustomToolLoad(new FileCustomToolStorage());
52596
+
52597
+ // src/tools/custom-tools/customToolSave.ts
52598
+ function createCustomToolSave(storage) {
52599
+ return {
52600
+ definition: {
52601
+ type: "function",
52602
+ function: {
52603
+ name: "custom_tool_save",
52604
+ description: "Save a custom tool definition to persistent storage. The tool can later be loaded, hydrated, and registered on any agent.",
52605
+ parameters: {
52606
+ type: "object",
52607
+ properties: {
52608
+ name: {
52609
+ type: "string",
52610
+ description: "Tool name (must match /^[a-z][a-z0-9_]*$/)"
52611
+ },
52612
+ description: {
52613
+ type: "string",
52614
+ description: "What the tool does"
52615
+ },
52616
+ displayName: {
52617
+ type: "string",
52618
+ description: "Optional human-readable display name"
52619
+ },
52620
+ inputSchema: {
52621
+ type: "object",
52622
+ description: "JSON Schema for input parameters"
52623
+ },
52624
+ outputSchema: {
52625
+ type: "object",
52626
+ description: "Optional JSON Schema for output"
52627
+ },
52628
+ code: {
52629
+ type: "string",
52630
+ description: "JavaScript code (same sandbox as execute_javascript)"
52631
+ },
52632
+ tags: {
52633
+ type: "array",
52634
+ description: "Tags for categorization",
52635
+ items: { type: "string" }
52636
+ },
52637
+ category: {
52638
+ type: "string",
52639
+ description: "Category grouping"
52640
+ },
52641
+ generationPrompt: {
52642
+ type: "string",
52643
+ description: "The prompt that was used to generate this tool (for reference)"
52644
+ },
52645
+ connectorNames: {
52646
+ type: "array",
52647
+ description: "Connector names this tool uses",
52648
+ items: { type: "string" }
52649
+ }
52650
+ },
52651
+ required: ["name", "description", "inputSchema", "code"]
52652
+ }
52653
+ }
52654
+ },
52655
+ permission: { scope: "session", riskLevel: "medium" },
52656
+ execute: async (args) => {
52657
+ try {
52658
+ const now = (/* @__PURE__ */ new Date()).toISOString();
52659
+ const existing = await storage.load(args.name);
52660
+ const definition = {
52661
+ version: CUSTOM_TOOL_DEFINITION_VERSION,
52662
+ name: args.name,
52663
+ displayName: args.displayName,
52664
+ description: args.description,
52665
+ inputSchema: args.inputSchema,
52666
+ outputSchema: args.outputSchema,
52667
+ code: args.code,
52668
+ createdAt: existing?.createdAt ?? now,
52669
+ updatedAt: now,
52670
+ metadata: {
52671
+ tags: args.tags,
52672
+ category: args.category,
52673
+ generationPrompt: args.generationPrompt,
52674
+ connectorNames: args.connectorNames,
52675
+ requiresConnector: (args.connectorNames?.length ?? 0) > 0
52676
+ }
52677
+ };
52678
+ await storage.save(definition);
52679
+ return {
52680
+ success: true,
52681
+ name: args.name,
52682
+ storagePath: storage.getPath()
52683
+ };
52684
+ } catch (error) {
52685
+ return {
52686
+ success: false,
52687
+ name: args.name,
52688
+ storagePath: storage.getPath(),
52689
+ error: error.message
52690
+ };
52691
+ }
52692
+ },
52693
+ describeCall: (args) => args.name
52694
+ };
52695
+ }
52696
+ var customToolSave = createCustomToolSave(new FileCustomToolStorage());
52697
+
52698
+ // src/tools/custom-tools/customToolTest.ts
52699
+ init_Connector();
52700
+ var DEFAULT_TEST_TIMEOUT = 1e4;
52701
+ var MAX_TEST_TIMEOUT = 3e4;
52702
+ function createCustomToolTest() {
52703
+ return {
52704
+ definition: {
52705
+ type: "function",
52706
+ function: {
52707
+ name: "custom_tool_test",
52708
+ description: "Test custom tool code by executing it in the VM sandbox with provided test input.",
52709
+ parameters: {
52710
+ type: "object",
52711
+ properties: {
52712
+ code: {
52713
+ type: "string",
52714
+ description: "JavaScript code to test. See tool description for full sandbox API reference."
52715
+ },
52716
+ inputSchema: {
52717
+ type: "object",
52718
+ description: "The input schema (for documentation, not enforced at test time)"
52719
+ },
52720
+ testInput: {
52721
+ description: "Test input data \u2014 available as `input` in the code"
52722
+ },
52723
+ connectorName: {
52724
+ type: "string",
52725
+ description: "Optional connector name for authenticated API access"
52726
+ },
52727
+ timeout: {
52728
+ type: "number",
52729
+ description: `Execution timeout in ms. Default: ${DEFAULT_TEST_TIMEOUT}, max: ${MAX_TEST_TIMEOUT}`
52730
+ }
52731
+ },
52732
+ required: ["code", "inputSchema", "testInput"]
52733
+ }
52734
+ },
52735
+ timeout: MAX_TEST_TIMEOUT + 5e3
52736
+ },
52737
+ descriptionFactory: (context) => buildTestDescription(context),
52738
+ permission: { scope: "session", riskLevel: "medium" },
52739
+ execute: async (args, context) => {
52740
+ const logs = [];
52741
+ const startTime = Date.now();
52742
+ const timeout = Math.min(Math.max(args.timeout || DEFAULT_TEST_TIMEOUT, 0), MAX_TEST_TIMEOUT);
52743
+ try {
52744
+ const registry = context?.connectorRegistry ?? Connector.asRegistry();
52745
+ const result = await executeInVM(
52746
+ args.code,
52747
+ args.testInput,
52748
+ timeout,
52749
+ logs,
52750
+ context?.userId,
52751
+ registry
52752
+ );
52753
+ return {
52754
+ success: true,
52755
+ result,
52756
+ logs,
52757
+ executionTime: Date.now() - startTime
52758
+ };
52759
+ } catch (error) {
52760
+ return {
52761
+ success: false,
52762
+ result: null,
52763
+ logs,
52764
+ error: error.message,
52765
+ executionTime: Date.now() - startTime
52766
+ };
52767
+ }
52768
+ },
52769
+ describeCall: (args) => `testing code (${args.code.length} chars)`
52770
+ };
52771
+ }
52772
+ var customToolTest = createCustomToolTest();
52773
+
51662
52774
  // src/tools/registry.generated.ts
51663
52775
  var toolRegistry = [
51664
52776
  {
@@ -51670,6 +52782,60 @@ var toolRegistry = [
51670
52782
  tool: executeJavaScript,
51671
52783
  safeByDefault: false
51672
52784
  },
52785
+ {
52786
+ name: "custom_tool_delete",
52787
+ exportName: "customToolDelete",
52788
+ displayName: "Custom Tool Delete",
52789
+ category: "custom-tools",
52790
+ description: "Delete a custom tool from persistent storage.",
52791
+ tool: customToolDelete,
52792
+ safeByDefault: false
52793
+ },
52794
+ {
52795
+ name: "custom_tool_draft",
52796
+ exportName: "customToolDraft",
52797
+ displayName: "Custom Tool Draft",
52798
+ category: "custom-tools",
52799
+ description: "Validate a draft custom tool definition. Checks name format, schema structure, and code syntax.",
52800
+ tool: customToolDraft,
52801
+ safeByDefault: true
52802
+ },
52803
+ {
52804
+ name: "custom_tool_list",
52805
+ exportName: "customToolList",
52806
+ displayName: "Custom Tool List",
52807
+ category: "custom-tools",
52808
+ description: "List saved custom tools from persistent storage. Supports filtering by search text, tags, and category.",
52809
+ tool: customToolList,
52810
+ safeByDefault: true
52811
+ },
52812
+ {
52813
+ name: "custom_tool_load",
52814
+ exportName: "customToolLoad",
52815
+ displayName: "Custom Tool Load",
52816
+ category: "custom-tools",
52817
+ description: "Load a full custom tool definition from storage (including code).",
52818
+ tool: customToolLoad,
52819
+ safeByDefault: true
52820
+ },
52821
+ {
52822
+ name: "custom_tool_save",
52823
+ exportName: "customToolSave",
52824
+ displayName: "Custom Tool Save",
52825
+ category: "custom-tools",
52826
+ description: "Save a custom tool definition to persistent storage.",
52827
+ tool: customToolSave,
52828
+ safeByDefault: false
52829
+ },
52830
+ {
52831
+ name: "custom_tool_test",
52832
+ exportName: "customToolTest",
52833
+ displayName: "Custom Tool Test",
52834
+ category: "custom-tools",
52835
+ description: "Test custom tool code by executing it in the VM sandbox with provided test input.",
52836
+ tool: customToolTest,
52837
+ safeByDefault: false
52838
+ },
51673
52839
  {
51674
52840
  name: "desktop_get_cursor",
51675
52841
  exportName: "desktopGetCursor",
@@ -51870,6 +53036,61 @@ function getToolCategories() {
51870
53036
  return [...new Set(toolRegistry.map((entry) => entry.category))];
51871
53037
  }
51872
53038
 
53039
+ // src/tools/custom-tools/factories.ts
53040
+ function createCustomToolMetaTools(options) {
53041
+ const storage = options?.storage ?? new FileCustomToolStorage();
53042
+ return [
53043
+ createCustomToolDraft(),
53044
+ createCustomToolTest(),
53045
+ createCustomToolSave(storage),
53046
+ createCustomToolList(storage),
53047
+ createCustomToolLoad(storage),
53048
+ createCustomToolDelete(storage)
53049
+ ];
53050
+ }
53051
+
53052
+ // src/tools/custom-tools/hydrate.ts
53053
+ init_Connector();
53054
+ var DEFAULT_TIMEOUT2 = 1e4;
53055
+ var MAX_TIMEOUT = 3e4;
53056
+ function hydrateCustomTool(definition, options) {
53057
+ const defaultTimeout = options?.defaultTimeout ?? DEFAULT_TIMEOUT2;
53058
+ const maxTimeout = options?.maxTimeout ?? MAX_TIMEOUT;
53059
+ return {
53060
+ definition: {
53061
+ type: "function",
53062
+ function: {
53063
+ name: definition.name,
53064
+ description: definition.description,
53065
+ parameters: definition.inputSchema
53066
+ },
53067
+ timeout: maxTimeout + 5e3
53068
+ },
53069
+ permission: { scope: "session", riskLevel: "medium" },
53070
+ execute: async (args, context) => {
53071
+ const logs = [];
53072
+ const registry = context?.connectorRegistry ?? Connector.asRegistry();
53073
+ const result = await executeInVM(
53074
+ definition.code,
53075
+ args,
53076
+ defaultTimeout,
53077
+ logs,
53078
+ context?.userId,
53079
+ registry
53080
+ );
53081
+ return result;
53082
+ },
53083
+ describeCall: (args) => {
53084
+ if (!args || typeof args !== "object") return definition.name;
53085
+ const firstKey = Object.keys(args)[0];
53086
+ if (!firstKey) return definition.name;
53087
+ const val = args[firstKey];
53088
+ const str = typeof val === "string" ? val : JSON.stringify(val);
53089
+ return str.length > 50 ? str.slice(0, 47) + "..." : str;
53090
+ }
53091
+ };
53092
+ }
53093
+
51873
53094
  // src/tools/ToolRegistry.ts
51874
53095
  init_Connector();
51875
53096
  var ToolRegistry = class {
@@ -52206,6 +53427,6 @@ REMEMBER: Keep it conversational, ask one question at a time, and only output th
52206
53427
  }
52207
53428
  };
52208
53429
 
52209
- export { AGENT_DEFINITION_FORMAT_VERSION, AIError, APPROVAL_STATE_VERSION, Agent, AgentContextNextGen, ApproximateTokenEstimator, BaseMediaProvider, BasePluginNextGen, BaseProvider, BaseTextProvider, BraveProvider, CONNECTOR_CONFIG_VERSION, CONTEXT_SESSION_FORMAT_VERSION, CheckpointManager, CircuitBreaker, CircuitOpenError, Connector, ConnectorConfigStore, ConnectorTools, ConsoleMetrics, ContentType, ContextOverflowError, DEFAULT_ALLOWLIST, DEFAULT_BACKOFF_CONFIG, DEFAULT_BASE_DELAY_MS, DEFAULT_CHECKPOINT_STRATEGY, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONFIG2 as DEFAULT_CONFIG, DEFAULT_CONNECTOR_TIMEOUT, DEFAULT_CONTEXT_CONFIG, DEFAULT_DESKTOP_CONFIG, DEFAULT_FEATURES, DEFAULT_FILESYSTEM_CONFIG, DEFAULT_HISTORY_MANAGER_CONFIG, DEFAULT_MAX_DELAY_MS, DEFAULT_MAX_RETRIES, DEFAULT_MEMORY_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_RATE_LIMITER_CONFIG, DEFAULT_RETRYABLE_STATUSES, DEFAULT_SHELL_CONFIG, DESKTOP_TOOL_NAMES, DefaultCompactionStrategy, DependencyCycleError, DocumentReader, ErrorHandler, ExecutionContext, ExternalDependencyHandler, FileAgentDefinitionStorage, FileConnectorStorage, FileContextStorage, FileMediaStorage as FileMediaOutputHandler, FileMediaStorage, FilePersistentInstructionsStorage, FileStorage, FormatDetector, FrameworkLogger, HookManager, IMAGE_MODELS, IMAGE_MODEL_REGISTRY, ImageGeneration, InContextMemoryPluginNextGen, InMemoryAgentStateStorage, InMemoryHistoryStorage, InMemoryMetrics, InMemoryPlanStorage, InMemoryStorage, InvalidConfigError, InvalidToolArgumentsError, LLM_MODELS, LoggingPlugin, MCPClient, MCPConnectionError, MCPError, MCPProtocolError, MCPRegistry, MCPResourceError, MCPTimeoutError, MCPToolError, MEMORY_PRIORITY_VALUES, MODEL_REGISTRY, MemoryConnectorStorage, MemoryEvictionCompactor, MemoryStorage, MessageBuilder, MessageRole, ModelNotSupportedError, NoOpMetrics, NutTreeDriver, OAuthManager, ParallelTasksError, PersistentInstructionsPluginNextGen, PlanningAgent, ProviderAuthError, ProviderConfigAgent, ProviderContextLengthError, ProviderError, ProviderErrorMapper, ProviderNotFoundError, ProviderRateLimitError, RapidAPIProvider, RateLimitError, SERVICE_DEFINITIONS, SERVICE_INFO, SERVICE_URL_PATTERNS, SIMPLE_ICONS_CDN, STT_MODELS, STT_MODEL_REGISTRY, ScopedConnectorRegistry, ScrapeProvider, SearchProvider, SerperProvider, Services, SpeechToText, StrategyRegistry, StreamEventType, StreamHelpers, StreamState, SummarizeCompactor, TERMINAL_TASK_STATUSES, TTS_MODELS, TTS_MODEL_REGISTRY, TaskTimeoutError, TaskValidationError, TavilyProvider, TextToSpeech, TokenBucketRateLimiter, ToolCallState, ToolExecutionError, ToolExecutionPipeline, ToolManager, ToolNotFoundError, ToolPermissionManager, ToolRegistry, ToolTimeoutError, TruncateCompactor, VENDORS, VENDOR_ICON_MAP, VIDEO_MODELS, VIDEO_MODEL_REGISTRY, Vendor, VideoGeneration, WorkingMemory, WorkingMemoryPluginNextGen, addJitter, allVendorTemplates, assertNotDestroyed, authenticatedFetch, backoffSequence, backoffWait, bash, buildAuthConfig, buildEndpointWithQuery, buildQueryString, calculateBackoff, calculateCost, calculateEntrySize, calculateImageCost, calculateSTTCost, calculateTTSCost, calculateVideoCost, canTaskExecute, createAgentStorage, createAuthenticatedFetch, createBashTool, createConnectorFromTemplate, createCreatePRTool, createDesktopGetCursorTool, createDesktopGetScreenSizeTool, createDesktopKeyboardKeyTool, createDesktopKeyboardTypeTool, createDesktopMouseClickTool, createDesktopMouseDragTool, createDesktopMouseMoveTool, createDesktopMouseScrollTool, createDesktopScreenshotTool, createDesktopWindowFocusTool, createDesktopWindowListTool, createEditFileTool, createEstimator, createExecuteJavaScriptTool, createFileAgentDefinitionStorage, createFileContextStorage, createFileMediaStorage, createGetPRTool, createGitHubReadFileTool, createGlobTool, createGrepTool, createImageGenerationTool, createImageProvider, createListDirectoryTool, createMessageWithImages, createMetricsCollector, createPRCommentsTool, createPRFilesTool, createPlan, createProvider, createReadFileTool, createSearchCodeTool, createSearchFilesTool, createSpeechToTextTool, createTask, createTextMessage, createTextToSpeechTool, createVideoProvider, createVideoTools, createWriteFileTool, defaultDescribeCall, desktopGetCursor, desktopGetScreenSize, desktopKeyboardKey, desktopKeyboardType, desktopMouseClick, desktopMouseDrag, desktopMouseMove, desktopMouseScroll, desktopScreenshot, desktopTools, desktopWindowFocus, desktopWindowList, detectDependencyCycle, detectServiceFromURL, developerTools, documentToContent, editFile, evaluateCondition, extractJSON, extractJSONField, extractNumber, findConnectorByServiceTypes, forPlan, forTasks, generateEncryptionKey, generateSimplePlan, generateWebAPITool, getActiveImageModels, getActiveModels, getActiveSTTModels, getActiveTTSModels, getActiveVideoModels, getAllBuiltInTools, getAllServiceIds, getAllVendorLogos, getAllVendorTemplates, getBackgroundOutput, getConnectorTools, getCredentialsSetupURL, getDesktopDriver, getDocsURL, getImageModelInfo, getImageModelsByVendor, getImageModelsWithFeature, getMediaOutputHandler, getMediaStorage, getModelInfo, getModelsByVendor, getNextExecutableTasks, getRegisteredScrapeProviders, getSTTModelInfo, getSTTModelsByVendor, getSTTModelsWithFeature, getServiceDefinition, getServiceInfo, getServicesByCategory, getTTSModelInfo, getTTSModelsByVendor, getTTSModelsWithFeature, getTaskDependencies, getToolByName, getToolCallDescription, getToolCategories, getToolRegistry, getToolsByCategory, getToolsRequiringConnector, getVendorAuthTemplate, getVendorColor, getVendorDefaultBaseURL, getVendorInfo, getVendorLogo, getVendorLogoCdnUrl, getVendorLogoSvg, getVendorTemplate, getVideoModelInfo, getVideoModelsByVendor, getVideoModelsWithAudio, getVideoModelsWithFeature, glob, globalErrorHandler, grep, hasClipboardImage, hasVendorLogo, isBlockedCommand, isErrorEvent, isExcludedExtension, isKnownService, isOutputTextDelta, isResponseComplete, isSimpleScope, isStreamEvent, isTaskAwareScope, isTaskBlocked, isTerminalMemoryStatus, isTerminalStatus, isToolCallArgumentsDelta, isToolCallArgumentsDone, isToolCallStart, isVendor, killBackgroundProcess, listConnectorsByServiceTypes, listDirectory, listVendorIds, listVendors, listVendorsByAuthType, listVendorsByCategory, listVendorsWithLogos, logger, mergeTextPieces, metrics, parseKeyCombo, parseRepository, readClipboardImage, readDocumentAsContent, readFile5 as readFile, registerScrapeProvider, resetDefaultDriver, resolveConnector, resolveDependencies, resolveRepository, retryWithBackoff, scopeEquals, scopeMatches, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, tools_exports as tools, updateTaskStatus, validatePath, writeFile5 as writeFile };
53430
+ export { AGENT_DEFINITION_FORMAT_VERSION, AIError, APPROVAL_STATE_VERSION, Agent, AgentContextNextGen, ApproximateTokenEstimator, BaseMediaProvider, BasePluginNextGen, BaseProvider, BaseTextProvider, BraveProvider, CONNECTOR_CONFIG_VERSION, CONTEXT_SESSION_FORMAT_VERSION, CUSTOM_TOOL_DEFINITION_VERSION, CheckpointManager, CircuitBreaker, CircuitOpenError, Connector, ConnectorConfigStore, ConnectorTools, ConsoleMetrics, ContentType, ContextOverflowError, DEFAULT_ALLOWLIST, DEFAULT_BACKOFF_CONFIG, DEFAULT_BASE_DELAY_MS, DEFAULT_CHECKPOINT_STRATEGY, DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_CONFIG2 as DEFAULT_CONFIG, DEFAULT_CONNECTOR_TIMEOUT, DEFAULT_CONTEXT_CONFIG, DEFAULT_DESKTOP_CONFIG, DEFAULT_FEATURES, DEFAULT_FILESYSTEM_CONFIG, DEFAULT_HISTORY_MANAGER_CONFIG, DEFAULT_MAX_DELAY_MS, DEFAULT_MAX_RETRIES, DEFAULT_MEMORY_CONFIG, DEFAULT_PERMISSION_CONFIG, DEFAULT_RATE_LIMITER_CONFIG, DEFAULT_RETRYABLE_STATUSES, DEFAULT_SHELL_CONFIG, DESKTOP_TOOL_NAMES, DefaultCompactionStrategy, DependencyCycleError, DocumentReader, ErrorHandler, ExecutionContext, ExternalDependencyHandler, FileAgentDefinitionStorage, FileConnectorStorage, FileContextStorage, FileCustomToolStorage, FileMediaStorage as FileMediaOutputHandler, FileMediaStorage, FilePersistentInstructionsStorage, FileStorage, FormatDetector, FrameworkLogger, HookManager, IMAGE_MODELS, IMAGE_MODEL_REGISTRY, ImageGeneration, InContextMemoryPluginNextGen, InMemoryAgentStateStorage, InMemoryHistoryStorage, InMemoryMetrics, InMemoryPlanStorage, InMemoryStorage, InvalidConfigError, InvalidToolArgumentsError, LLM_MODELS, LoggingPlugin, MCPClient, MCPConnectionError, MCPError, MCPProtocolError, MCPRegistry, MCPResourceError, MCPTimeoutError, MCPToolError, MEMORY_PRIORITY_VALUES, MODEL_REGISTRY, MemoryConnectorStorage, MemoryEvictionCompactor, MemoryStorage, MessageBuilder, MessageRole, ModelNotSupportedError, NoOpMetrics, NutTreeDriver, OAuthManager, ParallelTasksError, PersistentInstructionsPluginNextGen, PlanningAgent, ProviderAuthError, ProviderConfigAgent, ProviderContextLengthError, ProviderError, ProviderErrorMapper, ProviderNotFoundError, ProviderRateLimitError, RapidAPIProvider, RateLimitError, SERVICE_DEFINITIONS, SERVICE_INFO, SERVICE_URL_PATTERNS, SIMPLE_ICONS_CDN, STT_MODELS, STT_MODEL_REGISTRY, ScopedConnectorRegistry, ScrapeProvider, SearchProvider, SerperProvider, Services, SpeechToText, StrategyRegistry, StreamEventType, StreamHelpers, StreamState, SummarizeCompactor, TERMINAL_TASK_STATUSES, TTS_MODELS, TTS_MODEL_REGISTRY, TaskTimeoutError, TaskValidationError, TavilyProvider, TextToSpeech, TokenBucketRateLimiter, ToolCallState, ToolExecutionError, ToolExecutionPipeline, ToolManager, ToolNotFoundError, ToolPermissionManager, ToolRegistry, ToolTimeoutError, TruncateCompactor, VENDORS, VENDOR_ICON_MAP, VIDEO_MODELS, VIDEO_MODEL_REGISTRY, Vendor, VideoGeneration, WorkingMemory, WorkingMemoryPluginNextGen, addJitter, allVendorTemplates, assertNotDestroyed, authenticatedFetch, backoffSequence, backoffWait, bash, buildAuthConfig, buildEndpointWithQuery, buildQueryString, calculateBackoff, calculateCost, calculateEntrySize, calculateImageCost, calculateSTTCost, calculateTTSCost, calculateVideoCost, canTaskExecute, createAgentStorage, createAuthenticatedFetch, createBashTool, createConnectorFromTemplate, createCreatePRTool, createCustomToolDelete, createCustomToolDraft, createCustomToolList, createCustomToolLoad, createCustomToolMetaTools, createCustomToolSave, createCustomToolTest, createDesktopGetCursorTool, createDesktopGetScreenSizeTool, createDesktopKeyboardKeyTool, createDesktopKeyboardTypeTool, createDesktopMouseClickTool, createDesktopMouseDragTool, createDesktopMouseMoveTool, createDesktopMouseScrollTool, createDesktopScreenshotTool, createDesktopWindowFocusTool, createDesktopWindowListTool, createEditFileTool, createEstimator, createExecuteJavaScriptTool, createFileAgentDefinitionStorage, createFileContextStorage, createFileCustomToolStorage, createFileMediaStorage, createGetPRTool, createGitHubReadFileTool, createGlobTool, createGrepTool, createImageGenerationTool, createImageProvider, createListDirectoryTool, createMessageWithImages, createMetricsCollector, createPRCommentsTool, createPRFilesTool, createPlan, createProvider, createReadFileTool, createSearchCodeTool, createSearchFilesTool, createSpeechToTextTool, createTask, createTextMessage, createTextToSpeechTool, createVideoProvider, createVideoTools, createWriteFileTool, customToolDelete, customToolDraft, customToolList, customToolLoad, customToolSave, customToolTest, defaultDescribeCall, desktopGetCursor, desktopGetScreenSize, desktopKeyboardKey, desktopKeyboardType, desktopMouseClick, desktopMouseDrag, desktopMouseMove, desktopMouseScroll, desktopScreenshot, desktopTools, desktopWindowFocus, desktopWindowList, detectDependencyCycle, detectServiceFromURL, developerTools, documentToContent, editFile, evaluateCondition, extractJSON, extractJSONField, extractNumber, findConnectorByServiceTypes, forPlan, forTasks, generateEncryptionKey, generateSimplePlan, generateWebAPITool, getActiveImageModels, getActiveModels, getActiveSTTModels, getActiveTTSModels, getActiveVideoModels, getAllBuiltInTools, getAllServiceIds, getAllVendorLogos, getAllVendorTemplates, getBackgroundOutput, getConnectorTools, getCredentialsSetupURL, getDesktopDriver, getDocsURL, getImageModelInfo, getImageModelsByVendor, getImageModelsWithFeature, getMediaOutputHandler, getMediaStorage, getModelInfo, getModelsByVendor, getNextExecutableTasks, getRegisteredScrapeProviders, getSTTModelInfo, getSTTModelsByVendor, getSTTModelsWithFeature, getServiceDefinition, getServiceInfo, getServicesByCategory, getTTSModelInfo, getTTSModelsByVendor, getTTSModelsWithFeature, getTaskDependencies, getToolByName, getToolCallDescription, getToolCategories, getToolRegistry, getToolsByCategory, getToolsRequiringConnector, getVendorAuthTemplate, getVendorColor, getVendorDefaultBaseURL, getVendorInfo, getVendorLogo, getVendorLogoCdnUrl, getVendorLogoSvg, getVendorTemplate, getVideoModelInfo, getVideoModelsByVendor, getVideoModelsWithAudio, getVideoModelsWithFeature, glob, globalErrorHandler, grep, hasClipboardImage, hasVendorLogo, hydrateCustomTool, isBlockedCommand, isErrorEvent, isExcludedExtension, isKnownService, isOutputTextDelta, isResponseComplete, isSimpleScope, isStreamEvent, isTaskAwareScope, isTaskBlocked, isTerminalMemoryStatus, isTerminalStatus, isToolCallArgumentsDelta, isToolCallArgumentsDone, isToolCallStart, isVendor, killBackgroundProcess, listConnectorsByServiceTypes, listDirectory, listVendorIds, listVendors, listVendorsByAuthType, listVendorsByCategory, listVendorsWithLogos, logger, mergeTextPieces, metrics, parseKeyCombo, parseRepository, readClipboardImage, readDocumentAsContent, readFile5 as readFile, registerScrapeProvider, resetDefaultDriver, resolveConnector, resolveDependencies, resolveRepository, retryWithBackoff, scopeEquals, scopeMatches, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, tools_exports as tools, updateTaskStatus, validatePath, writeFile5 as writeFile };
52210
53431
  //# sourceMappingURL=index.js.map
52211
53432
  //# sourceMappingURL=index.js.map