@everworker/oneringai 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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 fs17 from 'fs';
4
+ import * as fs18 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 fs16 from 'fs/promises';
22
+ import * as fs17 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';
@@ -641,7 +641,7 @@ var init_JWTBearer = __esm({
641
641
  this.privateKey = config.privateKey;
642
642
  } else if (config.privateKeyPath) {
643
643
  try {
644
- this.privateKey = fs17.readFileSync(config.privateKeyPath, "utf8");
644
+ this.privateKey = fs18.readFileSync(config.privateKeyPath, "utf8");
645
645
  } catch (error) {
646
646
  throw new Error(`Failed to read private key from ${config.privateKeyPath}: ${error.message}`);
647
647
  }
@@ -1400,10 +1400,10 @@ var init_Logger = __esm({
1400
1400
  initFileStream(filePath) {
1401
1401
  try {
1402
1402
  const dir = path2.dirname(filePath);
1403
- if (!fs17.existsSync(dir)) {
1404
- fs17.mkdirSync(dir, { recursive: true });
1403
+ if (!fs18.existsSync(dir)) {
1404
+ fs18.mkdirSync(dir, { recursive: true });
1405
1405
  }
1406
- this.fileStream = fs17.createWriteStream(filePath, {
1406
+ this.fileStream = fs18.createWriteStream(filePath, {
1407
1407
  flags: "a",
1408
1408
  // append mode
1409
1409
  encoding: "utf8"
@@ -9133,12 +9133,12 @@ var require_dist = __commonJS({
9133
9133
  throw new Error(`Unknown format "${name}"`);
9134
9134
  return f;
9135
9135
  };
9136
- function addFormats(ajv, list, fs18, exportName) {
9136
+ function addFormats(ajv, list, fs19, exportName) {
9137
9137
  var _a;
9138
9138
  var _b;
9139
9139
  (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
9140
9140
  for (const f of list)
9141
- ajv.addFormat(f, fs18[f]);
9141
+ ajv.addFormat(f, fs19[f]);
9142
9142
  }
9143
9143
  module.exports = exports$1 = formatsPlugin;
9144
9144
  Object.defineProperty(exports$1, "__esModule", { value: true });
@@ -10141,6 +10141,11 @@ var DEFAULT_ALLOWLIST = [
10141
10141
  "instructions_remove",
10142
10142
  "instructions_list",
10143
10143
  "instructions_clear",
10144
+ // User info tools (user-specific data - safe)
10145
+ "user_info_set",
10146
+ "user_info_get",
10147
+ "user_info_remove",
10148
+ "user_info_clear",
10144
10149
  // Meta-tools (internal coordination)
10145
10150
  "_start_planning",
10146
10151
  "_modify_plan",
@@ -15440,6 +15445,572 @@ ${entry.content}`).join("\n\n");
15440
15445
  };
15441
15446
  }
15442
15447
  };
15448
+ function getDefaultBaseDirectory2() {
15449
+ const platform2 = process.platform;
15450
+ if (platform2 === "win32") {
15451
+ const appData = process.env.APPDATA || process.env.LOCALAPPDATA;
15452
+ if (appData) {
15453
+ return join(appData, "oneringai", "users");
15454
+ }
15455
+ }
15456
+ return join(homedir(), ".oneringai", "users");
15457
+ }
15458
+ var DEFAULT_USER_ID = "default";
15459
+ function sanitizeUserId(userId) {
15460
+ if (!userId) return DEFAULT_USER_ID;
15461
+ return userId.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase() || DEFAULT_USER_ID;
15462
+ }
15463
+ var FileUserInfoStorage = class {
15464
+ baseDirectory;
15465
+ filename;
15466
+ constructor(config) {
15467
+ this.baseDirectory = config?.baseDirectory ?? getDefaultBaseDirectory2();
15468
+ this.filename = config?.filename ?? "user_info.json";
15469
+ }
15470
+ /**
15471
+ * Get the directory path for a specific user
15472
+ */
15473
+ getUserDirectory(userId) {
15474
+ const sanitizedId = sanitizeUserId(userId);
15475
+ return join(this.baseDirectory, sanitizedId);
15476
+ }
15477
+ /**
15478
+ * Get the file path for a specific user
15479
+ */
15480
+ getUserFilePath(userId) {
15481
+ return join(this.getUserDirectory(userId), this.filename);
15482
+ }
15483
+ /**
15484
+ * Load user info entries from file for a specific user
15485
+ */
15486
+ async load(userId) {
15487
+ const filePath = this.getUserFilePath(userId);
15488
+ try {
15489
+ const raw = await promises.readFile(filePath, "utf-8");
15490
+ const data = JSON.parse(raw);
15491
+ if (data.version === 1 && Array.isArray(data.entries)) {
15492
+ return data.entries.length > 0 ? data.entries : null;
15493
+ }
15494
+ return null;
15495
+ } catch (error) {
15496
+ if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
15497
+ throw error;
15498
+ }
15499
+ return null;
15500
+ }
15501
+ }
15502
+ /**
15503
+ * Save user info entries to file for a specific user
15504
+ * Creates directory if it doesn't exist.
15505
+ */
15506
+ async save(userId, entries) {
15507
+ const directory = this.getUserDirectory(userId);
15508
+ const filePath = this.getUserFilePath(userId);
15509
+ await this.ensureDirectory(directory);
15510
+ const data = {
15511
+ version: 1,
15512
+ userId: userId || DEFAULT_USER_ID,
15513
+ entries
15514
+ };
15515
+ const tempPath = `${filePath}.tmp`;
15516
+ try {
15517
+ await promises.writeFile(tempPath, JSON.stringify(data, null, 2), "utf-8");
15518
+ await promises.rename(tempPath, filePath);
15519
+ } catch (error) {
15520
+ try {
15521
+ await promises.unlink(tempPath);
15522
+ } catch {
15523
+ }
15524
+ throw error;
15525
+ }
15526
+ }
15527
+ /**
15528
+ * Delete user info file for a specific user
15529
+ */
15530
+ async delete(userId) {
15531
+ const filePath = this.getUserFilePath(userId);
15532
+ try {
15533
+ await promises.unlink(filePath);
15534
+ } catch (error) {
15535
+ if (error instanceof Error && "code" in error && error.code !== "ENOENT") {
15536
+ throw error;
15537
+ }
15538
+ }
15539
+ }
15540
+ /**
15541
+ * Check if user info file exists for a specific user
15542
+ */
15543
+ async exists(userId) {
15544
+ const filePath = this.getUserFilePath(userId);
15545
+ try {
15546
+ await promises.access(filePath);
15547
+ return true;
15548
+ } catch {
15549
+ return false;
15550
+ }
15551
+ }
15552
+ /**
15553
+ * Get the file path for a specific user (for display/debugging)
15554
+ */
15555
+ getPath(userId) {
15556
+ return this.getUserFilePath(userId);
15557
+ }
15558
+ /**
15559
+ * Ensure the directory exists
15560
+ */
15561
+ async ensureDirectory(directory) {
15562
+ try {
15563
+ await promises.mkdir(directory, { recursive: true });
15564
+ } catch (error) {
15565
+ if (error instanceof Error && "code" in error && error.code !== "EEXIST") {
15566
+ throw error;
15567
+ }
15568
+ }
15569
+ }
15570
+ };
15571
+
15572
+ // src/core/context-nextgen/plugins/UserInfoPluginNextGen.ts
15573
+ init_StorageRegistry();
15574
+ var DEFAULT_MAX_TOTAL_SIZE = 1e5;
15575
+ var DEFAULT_MAX_ENTRIES2 = 100;
15576
+ var KEY_MAX_LENGTH2 = 100;
15577
+ var KEY_PATTERN2 = /^[a-zA-Z0-9_-]+$/;
15578
+ var USER_INFO_INSTRUCTIONS = `User Info stores key-value information about the current user.
15579
+ Data is user-specific and persists across sessions and agents.
15580
+ User info is automatically shown in context \u2014 no need to call user_info_get every turn.
15581
+
15582
+ **To manage:**
15583
+ - \`user_info_set(key, value, description?)\`: Store/update user information
15584
+ - \`user_info_get(key?)\`: Retrieve one entry by key, or all entries if no key
15585
+ - \`user_info_remove(key)\`: Remove a specific entry
15586
+ - \`user_info_clear(confirm: true)\`: Remove all entries (destructive!)
15587
+
15588
+ **Use for:** User preferences, context, metadata (theme, language, timezone, role, etc.) It is also perfectly fine to search the web and other external sources for information about the user and then store it in user info for future use.
15589
+
15590
+ **Important:** Do not store sensitive information (passwords, tokens, PII) in user info. It is not encrypted and may be accessible to other parts of the system. Always follow best practices for security.
15591
+
15592
+ **Rules after each user message:** If the user provides new information about themselves, update user info accordingly. If they ask to change or remove existing information, do that as well. Always keep user info up to date with the latest information provided by the user. Learn about the user proactively!`;
15593
+ var userInfoSetDefinition = {
15594
+ type: "function",
15595
+ function: {
15596
+ name: "user_info_set",
15597
+ description: `Store or update user information by key. Data persists across sessions.
15598
+ If the key exists, it will be updated. If not, a new entry is created.`,
15599
+ parameters: {
15600
+ type: "object",
15601
+ properties: {
15602
+ key: {
15603
+ type: "string",
15604
+ description: "Unique key for the information (alphanumeric, dash, underscore; max 100 chars)"
15605
+ },
15606
+ value: {
15607
+ description: "Value to store (any JSON-serializable data: string, number, boolean, object, array)"
15608
+ },
15609
+ description: {
15610
+ type: "string",
15611
+ description: "Optional description for self-documentation"
15612
+ }
15613
+ },
15614
+ required: ["key", "value"]
15615
+ }
15616
+ }
15617
+ };
15618
+ var userInfoGetDefinition = {
15619
+ type: "function",
15620
+ function: {
15621
+ name: "user_info_get",
15622
+ description: "Retrieve user information. If key is provided, returns that entry. Otherwise returns all entries.",
15623
+ parameters: {
15624
+ type: "object",
15625
+ properties: {
15626
+ key: {
15627
+ type: "string",
15628
+ description: "Key of the entry to retrieve (optional - omit to get all entries)"
15629
+ }
15630
+ },
15631
+ required: []
15632
+ }
15633
+ }
15634
+ };
15635
+ var userInfoRemoveDefinition = {
15636
+ type: "function",
15637
+ function: {
15638
+ name: "user_info_remove",
15639
+ description: "Remove a specific user information entry by key.",
15640
+ parameters: {
15641
+ type: "object",
15642
+ properties: {
15643
+ key: {
15644
+ type: "string",
15645
+ description: "Key of the entry to remove"
15646
+ }
15647
+ },
15648
+ required: ["key"]
15649
+ }
15650
+ }
15651
+ };
15652
+ var userInfoClearDefinition = {
15653
+ type: "function",
15654
+ function: {
15655
+ name: "user_info_clear",
15656
+ description: "Clear all user information entries (DESTRUCTIVE). Requires confirmation.",
15657
+ parameters: {
15658
+ type: "object",
15659
+ properties: {
15660
+ confirm: {
15661
+ type: "boolean",
15662
+ description: "Must be true to confirm deletion"
15663
+ }
15664
+ },
15665
+ required: ["confirm"]
15666
+ }
15667
+ }
15668
+ };
15669
+ function validateKey2(key) {
15670
+ if (typeof key !== "string") return "Key must be a string";
15671
+ const trimmed = key.trim();
15672
+ if (trimmed.length === 0) return "Key cannot be empty";
15673
+ if (trimmed.length > KEY_MAX_LENGTH2) return `Key exceeds maximum length (${KEY_MAX_LENGTH2} chars)`;
15674
+ if (!KEY_PATTERN2.test(trimmed)) return "Key must contain only alphanumeric characters, dashes, and underscores";
15675
+ return null;
15676
+ }
15677
+ function getValueType(value) {
15678
+ if (value === null) return "null";
15679
+ if (Array.isArray(value)) return "array";
15680
+ return typeof value;
15681
+ }
15682
+ function calculateValueSize(value) {
15683
+ const json = JSON.stringify(value);
15684
+ return Buffer.byteLength(json, "utf-8");
15685
+ }
15686
+ function buildStorageContext(toolContext) {
15687
+ const global2 = StorageRegistry.getContext();
15688
+ if (global2) return global2;
15689
+ if (toolContext?.userId) return { userId: toolContext.userId };
15690
+ return void 0;
15691
+ }
15692
+ function formatValue(value) {
15693
+ if (value === null) return "null";
15694
+ if (typeof value === "string") return value;
15695
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
15696
+ return JSON.stringify(value);
15697
+ }
15698
+ var UserInfoPluginNextGen = class {
15699
+ name = "user_info";
15700
+ _destroyed = false;
15701
+ _storage = null;
15702
+ /** In-memory cache of entries */
15703
+ _entries = /* @__PURE__ */ new Map();
15704
+ /** Whether entries have been loaded from storage */
15705
+ _initialized = false;
15706
+ maxTotalSize;
15707
+ maxEntries;
15708
+ estimator = simpleTokenEstimator;
15709
+ explicitStorage;
15710
+ /** UserId for getContent() and lazy initialization */
15711
+ userId;
15712
+ _tokenCache = null;
15713
+ _instructionsTokenCache = null;
15714
+ constructor(config) {
15715
+ this.maxTotalSize = config?.maxTotalSize ?? DEFAULT_MAX_TOTAL_SIZE;
15716
+ this.maxEntries = config?.maxEntries ?? DEFAULT_MAX_ENTRIES2;
15717
+ this.explicitStorage = config?.storage;
15718
+ this.userId = config?.userId;
15719
+ }
15720
+ // ============================================================================
15721
+ // IContextPluginNextGen Implementation
15722
+ // ============================================================================
15723
+ getInstructions() {
15724
+ return USER_INFO_INSTRUCTIONS;
15725
+ }
15726
+ async getContent() {
15727
+ await this.ensureInitialized();
15728
+ if (this._entries.size === 0) {
15729
+ this._tokenCache = 0;
15730
+ return null;
15731
+ }
15732
+ const rendered = this.renderContent();
15733
+ this._tokenCache = this.estimator.estimateTokens(rendered);
15734
+ return rendered;
15735
+ }
15736
+ getContents() {
15737
+ return new Map(this._entries);
15738
+ }
15739
+ getTokenSize() {
15740
+ return this._tokenCache ?? 0;
15741
+ }
15742
+ getInstructionsTokenSize() {
15743
+ if (this._instructionsTokenCache === null) {
15744
+ this._instructionsTokenCache = this.estimator.estimateTokens(USER_INFO_INSTRUCTIONS);
15745
+ }
15746
+ return this._instructionsTokenCache;
15747
+ }
15748
+ isCompactable() {
15749
+ return false;
15750
+ }
15751
+ async compact(_targetTokensToFree) {
15752
+ return 0;
15753
+ }
15754
+ getTools() {
15755
+ return [
15756
+ this.createUserInfoSetTool(),
15757
+ this.createUserInfoGetTool(),
15758
+ this.createUserInfoRemoveTool(),
15759
+ this.createUserInfoClearTool()
15760
+ ];
15761
+ }
15762
+ destroy() {
15763
+ if (this._destroyed) return;
15764
+ this._entries.clear();
15765
+ this._destroyed = true;
15766
+ this._tokenCache = null;
15767
+ }
15768
+ getState() {
15769
+ return {
15770
+ version: 1,
15771
+ entries: Array.from(this._entries.values()),
15772
+ userId: this.userId
15773
+ };
15774
+ }
15775
+ restoreState(state) {
15776
+ if (!state || typeof state !== "object") return;
15777
+ const s = state;
15778
+ if ("version" in s && s.version === 1 && Array.isArray(s.entries)) {
15779
+ this._entries.clear();
15780
+ for (const entry of s.entries) {
15781
+ this._entries.set(entry.id, entry);
15782
+ }
15783
+ this._initialized = true;
15784
+ this._tokenCache = null;
15785
+ }
15786
+ }
15787
+ // ============================================================================
15788
+ // Public API
15789
+ // ============================================================================
15790
+ /**
15791
+ * Check if initialized
15792
+ */
15793
+ get isInitialized() {
15794
+ return this._initialized;
15795
+ }
15796
+ // ============================================================================
15797
+ // Private Helpers
15798
+ // ============================================================================
15799
+ assertNotDestroyed() {
15800
+ if (this._destroyed) {
15801
+ throw new Error("UserInfoPluginNextGen is destroyed");
15802
+ }
15803
+ }
15804
+ /**
15805
+ * Lazy load entries from storage
15806
+ */
15807
+ async ensureInitialized() {
15808
+ if (this._initialized || this._destroyed) return;
15809
+ try {
15810
+ const storage = this.resolveStorage();
15811
+ const entries = await storage.load(this.userId);
15812
+ this._entries.clear();
15813
+ if (entries) {
15814
+ for (const entry of entries) {
15815
+ this._entries.set(entry.id, entry);
15816
+ }
15817
+ }
15818
+ this._initialized = true;
15819
+ } catch (error) {
15820
+ console.warn(`Failed to load user info for userId '${this.userId ?? "default"}':`, error);
15821
+ this._entries.clear();
15822
+ this._initialized = true;
15823
+ }
15824
+ this._tokenCache = null;
15825
+ }
15826
+ /**
15827
+ * Render entries as markdown for context injection
15828
+ */
15829
+ renderContent() {
15830
+ const sorted = Array.from(this._entries.values()).sort((a, b) => a.createdAt - b.createdAt);
15831
+ return sorted.map((entry) => `### ${entry.id}
15832
+ ${formatValue(entry.value)}`).join("\n\n");
15833
+ }
15834
+ /**
15835
+ * Resolve storage instance (lazy singleton)
15836
+ */
15837
+ resolveStorage(context) {
15838
+ if (this._storage) return this._storage;
15839
+ if (this.explicitStorage) {
15840
+ this._storage = this.explicitStorage;
15841
+ return this._storage;
15842
+ }
15843
+ const factory = StorageRegistry.get("userInfo");
15844
+ if (factory) {
15845
+ this._storage = factory(buildStorageContext(context));
15846
+ return this._storage;
15847
+ }
15848
+ this._storage = new FileUserInfoStorage();
15849
+ return this._storage;
15850
+ }
15851
+ /**
15852
+ * Persist current entries to storage
15853
+ */
15854
+ async persistToStorage(userId) {
15855
+ const storage = this.resolveStorage();
15856
+ if (this._entries.size === 0) {
15857
+ await storage.delete(userId);
15858
+ } else {
15859
+ await storage.save(userId, Array.from(this._entries.values()));
15860
+ }
15861
+ }
15862
+ // ============================================================================
15863
+ // Tool Factories
15864
+ // ============================================================================
15865
+ createUserInfoSetTool() {
15866
+ return {
15867
+ definition: userInfoSetDefinition,
15868
+ execute: async (args, context) => {
15869
+ this.assertNotDestroyed();
15870
+ await this.ensureInitialized();
15871
+ const userId = context?.userId ?? this.userId;
15872
+ const key = args.key;
15873
+ const value = args.value;
15874
+ const description = args.description;
15875
+ const keyError = validateKey2(key);
15876
+ if (keyError) {
15877
+ return { error: keyError };
15878
+ }
15879
+ const trimmedKey = key.trim();
15880
+ if (value === void 0) {
15881
+ return { error: "Value cannot be undefined. Use null for explicit null value." };
15882
+ }
15883
+ if (!this._entries.has(trimmedKey) && this._entries.size >= this.maxEntries) {
15884
+ return { error: `Maximum number of entries reached (${this.maxEntries})` };
15885
+ }
15886
+ const valueSize = calculateValueSize(value);
15887
+ let currentTotal = 0;
15888
+ for (const e of this._entries.values()) {
15889
+ currentTotal += calculateValueSize(e.value);
15890
+ }
15891
+ const existingSize = this._entries.has(trimmedKey) ? calculateValueSize(this._entries.get(trimmedKey).value) : 0;
15892
+ const newTotal = currentTotal - existingSize + valueSize;
15893
+ if (newTotal > this.maxTotalSize) {
15894
+ return { error: `Total size would exceed maximum (${this.maxTotalSize} bytes)` };
15895
+ }
15896
+ const now = Date.now();
15897
+ const existing = this._entries.get(trimmedKey);
15898
+ const entry = {
15899
+ id: trimmedKey,
15900
+ value,
15901
+ valueType: getValueType(value),
15902
+ description,
15903
+ createdAt: existing?.createdAt ?? now,
15904
+ updatedAt: now
15905
+ };
15906
+ this._entries.set(trimmedKey, entry);
15907
+ this._tokenCache = null;
15908
+ await this.persistToStorage(userId);
15909
+ return {
15910
+ success: true,
15911
+ message: existing ? `User info '${trimmedKey}' updated` : `User info '${trimmedKey}' added`,
15912
+ key: trimmedKey,
15913
+ valueType: entry.valueType,
15914
+ valueSize
15915
+ };
15916
+ },
15917
+ permission: { scope: "always", riskLevel: "low" },
15918
+ describeCall: (args) => `set user info '${args.key}'`
15919
+ };
15920
+ }
15921
+ createUserInfoGetTool() {
15922
+ return {
15923
+ definition: userInfoGetDefinition,
15924
+ execute: async (args, _context) => {
15925
+ this.assertNotDestroyed();
15926
+ await this.ensureInitialized();
15927
+ const key = args.key;
15928
+ if (this._entries.size === 0) {
15929
+ return { error: "User info not found" };
15930
+ }
15931
+ if (key !== void 0) {
15932
+ const trimmedKey = key.trim();
15933
+ const entry = this._entries.get(trimmedKey);
15934
+ if (!entry) {
15935
+ return { error: `User info '${trimmedKey}' not found` };
15936
+ }
15937
+ return {
15938
+ key: entry.id,
15939
+ value: entry.value,
15940
+ valueType: entry.valueType,
15941
+ description: entry.description,
15942
+ createdAt: entry.createdAt,
15943
+ updatedAt: entry.updatedAt
15944
+ };
15945
+ }
15946
+ const entries = Array.from(this._entries.values());
15947
+ return {
15948
+ count: entries.length,
15949
+ entries: entries.map((e) => ({
15950
+ key: e.id,
15951
+ value: e.value,
15952
+ valueType: e.valueType,
15953
+ description: e.description,
15954
+ createdAt: e.createdAt,
15955
+ updatedAt: e.updatedAt
15956
+ }))
15957
+ };
15958
+ },
15959
+ permission: { scope: "always", riskLevel: "low" },
15960
+ describeCall: (args) => args.key ? `get user info '${args.key}'` : "get all user info"
15961
+ };
15962
+ }
15963
+ createUserInfoRemoveTool() {
15964
+ return {
15965
+ definition: userInfoRemoveDefinition,
15966
+ execute: async (args, context) => {
15967
+ this.assertNotDestroyed();
15968
+ await this.ensureInitialized();
15969
+ const userId = context?.userId ?? this.userId;
15970
+ const key = args.key;
15971
+ if (!key || typeof key !== "string" || key.trim().length === 0) {
15972
+ return { error: "Key is required" };
15973
+ }
15974
+ const trimmedKey = key.trim();
15975
+ if (!this._entries.has(trimmedKey)) {
15976
+ return { error: `User info '${trimmedKey}' not found` };
15977
+ }
15978
+ this._entries.delete(trimmedKey);
15979
+ this._tokenCache = null;
15980
+ await this.persistToStorage(userId);
15981
+ return {
15982
+ success: true,
15983
+ message: `User info '${trimmedKey}' removed`,
15984
+ key: trimmedKey
15985
+ };
15986
+ },
15987
+ permission: { scope: "always", riskLevel: "low" },
15988
+ describeCall: (args) => `remove user info '${args.key}'`
15989
+ };
15990
+ }
15991
+ createUserInfoClearTool() {
15992
+ return {
15993
+ definition: userInfoClearDefinition,
15994
+ execute: async (args, context) => {
15995
+ this.assertNotDestroyed();
15996
+ const userId = context?.userId ?? this.userId;
15997
+ if (args.confirm !== true) {
15998
+ return { error: "Must pass confirm: true to clear user info" };
15999
+ }
16000
+ this._entries.clear();
16001
+ this._tokenCache = null;
16002
+ const storage = this.resolveStorage(context);
16003
+ await storage.delete(userId);
16004
+ return {
16005
+ success: true,
16006
+ message: "All user information cleared"
16007
+ };
16008
+ },
16009
+ permission: { scope: "once", riskLevel: "medium" },
16010
+ describeCall: () => "clear user info"
16011
+ };
16012
+ }
16013
+ };
15443
16014
 
15444
16015
  // src/core/context-nextgen/AgentContextNextGen.ts
15445
16016
  init_StorageRegistry();
@@ -16088,7 +16659,8 @@ var StrategyRegistry = class {
16088
16659
  var DEFAULT_FEATURES = {
16089
16660
  workingMemory: true,
16090
16661
  inContextMemory: false,
16091
- persistentInstructions: false
16662
+ persistentInstructions: false,
16663
+ userInfo: false
16092
16664
  };
16093
16665
  var DEFAULT_CONFIG2 = {
16094
16666
  responseReserve: 4096,
@@ -16206,6 +16778,13 @@ var AgentContextNextGen = class _AgentContextNextGen extends EventEmitter {
16206
16778
  ...piConfig
16207
16779
  }));
16208
16780
  }
16781
+ if (features.userInfo) {
16782
+ const uiConfig = configs.userInfo;
16783
+ this.registerPlugin(new UserInfoPluginNextGen({
16784
+ userId: this._userId,
16785
+ ...uiConfig
16786
+ }));
16787
+ }
16209
16788
  this.validateStrategyDependencies(this._compactionStrategy);
16210
16789
  }
16211
16790
  /**
@@ -22792,8 +23371,8 @@ init_constants();
22792
23371
  throw new Error("Configuration file not found. Searched: " + this.DEFAULT_PATHS.join(", "));
22793
23372
  }
22794
23373
  try {
22795
- const fs18 = __require("fs");
22796
- const content = fs18.readFileSync(configPath, "utf-8");
23374
+ const fs19 = __require("fs");
23375
+ const content = fs19.readFileSync(configPath, "utf-8");
22797
23376
  let config = JSON.parse(content);
22798
23377
  config = this.interpolateEnvVars(config);
22799
23378
  this.validate(config);
@@ -22822,10 +23401,10 @@ init_constants();
22822
23401
  * Find configuration file synchronously
22823
23402
  */
22824
23403
  static findConfigSync() {
22825
- const fs18 = __require("fs");
23404
+ const fs19 = __require("fs");
22826
23405
  for (const path6 of this.DEFAULT_PATHS) {
22827
23406
  try {
22828
- fs18.accessSync(resolve(path6));
23407
+ fs19.accessSync(resolve(path6));
22829
23408
  return resolve(path6);
22830
23409
  } catch {
22831
23410
  }
@@ -27783,10 +28362,16 @@ function applyServerDefaults(config, defaults) {
27783
28362
  };
27784
28363
  }
27785
28364
 
27786
- // src/infrastructure/mcp/adapters/MCPToolAdapter.ts
28365
+ // src/utils/sanitize.ts
27787
28366
  function sanitizeToolName(name) {
27788
- return name.replace(/[^a-zA-Z0-9_-]/g, "_");
28367
+ let result = name.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+/g, "_").replace(/^[_-]+|[_-]+$/g, "");
28368
+ if (/^[0-9]/.test(result)) {
28369
+ result = `n_${result}`;
28370
+ }
28371
+ return result || "unnamed";
27789
28372
  }
28373
+
28374
+ // src/infrastructure/mcp/adapters/MCPToolAdapter.ts
27790
28375
  function createMCPToolAdapter(tool, client, namespace) {
27791
28376
  const fullName = sanitizeToolName(`${namespace}:${tool.name}`);
27792
28377
  return {
@@ -28998,7 +29583,7 @@ var OpenAISTTProvider = class extends BaseMediaProvider {
28998
29583
  if (Buffer.isBuffer(audio)) {
28999
29584
  return new File([new Uint8Array(audio)], "audio.wav", { type: "audio/wav" });
29000
29585
  } else if (typeof audio === "string") {
29001
- return fs17.createReadStream(audio);
29586
+ return fs18.createReadStream(audio);
29002
29587
  } else {
29003
29588
  throw new Error("Invalid audio input: must be Buffer or file path");
29004
29589
  }
@@ -29551,7 +30136,7 @@ var TextToSpeech = class _TextToSpeech {
29551
30136
  */
29552
30137
  async toFile(text, filePath, options) {
29553
30138
  const response = await this.synthesize(text, options);
29554
- await fs16.writeFile(filePath, response.audio);
30139
+ await fs17.writeFile(filePath, response.audio);
29555
30140
  }
29556
30141
  // ======================== Introspection Methods ========================
29557
30142
  /**
@@ -29899,7 +30484,7 @@ var SpeechToText = class _SpeechToText {
29899
30484
  * @param options - Optional transcription parameters
29900
30485
  */
29901
30486
  async transcribeFile(filePath, options) {
29902
- const audio = await fs16.readFile(filePath);
30487
+ const audio = await fs17.readFile(filePath);
29903
30488
  return this.transcribe(audio, options);
29904
30489
  }
29905
30490
  /**
@@ -30225,7 +30810,7 @@ var OpenAIImageProvider = class extends BaseMediaProvider {
30225
30810
  if (Buffer.isBuffer(image)) {
30226
30811
  return new File([new Uint8Array(image)], "image.png", { type: "image/png" });
30227
30812
  }
30228
- return fs17.createReadStream(image);
30813
+ return fs18.createReadStream(image);
30229
30814
  }
30230
30815
  /**
30231
30816
  * Handle OpenAI API errors
@@ -30372,8 +30957,8 @@ var GoogleImageProvider = class extends BaseMediaProvider {
30372
30957
  if (Buffer.isBuffer(image)) {
30373
30958
  imageBytes = image.toString("base64");
30374
30959
  } else {
30375
- const fs18 = await import('fs');
30376
- const buffer = fs18.readFileSync(image);
30960
+ const fs19 = await import('fs');
30961
+ const buffer = fs19.readFileSync(image);
30377
30962
  imageBytes = buffer.toString("base64");
30378
30963
  }
30379
30964
  return {
@@ -30534,7 +31119,7 @@ var GrokImageProvider = class extends BaseMediaProvider {
30534
31119
  if (Buffer.isBuffer(image)) {
30535
31120
  return new File([new Uint8Array(image)], "image.png", { type: "image/png" });
30536
31121
  }
30537
- return fs17.createReadStream(image);
31122
+ return fs18.createReadStream(image);
30538
31123
  }
30539
31124
  /**
30540
31125
  * Handle API errors
@@ -31984,8 +32569,8 @@ var OpenAISoraProvider = class extends BaseMediaProvider {
31984
32569
  return new File([new Uint8Array(image)], "input.png", { type: "image/png" });
31985
32570
  }
31986
32571
  if (!image.startsWith("http")) {
31987
- const fs18 = await import('fs');
31988
- const data = fs18.readFileSync(image);
32572
+ const fs19 = await import('fs');
32573
+ const data = fs19.readFileSync(image);
31989
32574
  return new File([new Uint8Array(data)], "input.png", { type: "image/png" });
31990
32575
  }
31991
32576
  const response = await fetch(image);
@@ -32163,7 +32748,7 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
32163
32748
  if (video.videoBytes) {
32164
32749
  buffer = Buffer.from(video.videoBytes, "base64");
32165
32750
  } else if (video.uri) {
32166
- const fs18 = await import('fs/promises');
32751
+ const fs19 = await import('fs/promises');
32167
32752
  const os3 = await import('os');
32168
32753
  const path6 = await import('path');
32169
32754
  const tempDir = os3.tmpdir();
@@ -32174,11 +32759,11 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
32174
32759
  // Pass as GeneratedVideo
32175
32760
  downloadPath: tempFile
32176
32761
  });
32177
- buffer = await fs18.readFile(tempFile);
32178
- await fs18.unlink(tempFile).catch(() => {
32762
+ buffer = await fs19.readFile(tempFile);
32763
+ await fs19.unlink(tempFile).catch(() => {
32179
32764
  });
32180
32765
  } catch (downloadError) {
32181
- await fs18.unlink(tempFile).catch(() => {
32766
+ await fs19.unlink(tempFile).catch(() => {
32182
32767
  });
32183
32768
  throw new ProviderError(
32184
32769
  "google",
@@ -32300,8 +32885,8 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
32300
32885
  if (image.startsWith("http://") || image.startsWith("https://")) {
32301
32886
  return { imageUri: image };
32302
32887
  }
32303
- const fs18 = await import('fs/promises');
32304
- const data = await fs18.readFile(image);
32888
+ const fs19 = await import('fs/promises');
32889
+ const data = await fs19.readFile(image);
32305
32890
  return {
32306
32891
  imageBytes: data.toString("base64")
32307
32892
  };
@@ -32608,8 +33193,8 @@ var GrokImagineProvider = class extends BaseMediaProvider {
32608
33193
  if (image.startsWith("http") || image.startsWith("data:")) {
32609
33194
  return image;
32610
33195
  }
32611
- const fs18 = await import('fs');
32612
- const data = fs18.readFileSync(image);
33196
+ const fs19 = await import('fs');
33197
+ const data = fs19.readFileSync(image);
32613
33198
  const base64 = data.toString("base64");
32614
33199
  const ext = image.split(".").pop()?.toLowerCase() || "png";
32615
33200
  const mimeType = ext === "jpg" || ext === "jpeg" ? "image/jpeg" : `image/${ext}`;
@@ -36312,7 +36897,7 @@ var InMemoryHistoryStorage = class {
36312
36897
  this.summaries = state.summaries ? [...state.summaries] : [];
36313
36898
  }
36314
36899
  };
36315
- function getDefaultBaseDirectory2() {
36900
+ function getDefaultBaseDirectory3() {
36316
36901
  const platform2 = process.platform;
36317
36902
  if (platform2 === "win32") {
36318
36903
  const appData = process.env.APPDATA || process.env.LOCALAPPDATA;
@@ -36335,7 +36920,7 @@ var FileContextStorage = class {
36335
36920
  constructor(config) {
36336
36921
  this.agentId = config.agentId;
36337
36922
  const sanitizedAgentId = sanitizeId(config.agentId);
36338
- const baseDir = config.baseDirectory ?? getDefaultBaseDirectory2();
36923
+ const baseDir = config.baseDirectory ?? getDefaultBaseDirectory3();
36339
36924
  this.prettyPrint = config.prettyPrint ?? true;
36340
36925
  this.sessionsDirectory = join(baseDir, sanitizedAgentId, "sessions");
36341
36926
  this.indexPath = join(this.sessionsDirectory, "_index.json");
@@ -36607,7 +37192,7 @@ var FileContextStorage = class {
36607
37192
  function createFileContextStorage(agentId, options) {
36608
37193
  return new FileContextStorage({ agentId, ...options });
36609
37194
  }
36610
- function getDefaultBaseDirectory3() {
37195
+ function getDefaultBaseDirectory4() {
36611
37196
  const platform2 = process.platform;
36612
37197
  if (platform2 === "win32") {
36613
37198
  const appData = process.env.APPDATA || process.env.LOCALAPPDATA;
@@ -36626,7 +37211,7 @@ var FileAgentDefinitionStorage = class {
36626
37211
  prettyPrint;
36627
37212
  index = null;
36628
37213
  constructor(config = {}) {
36629
- this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory3();
37214
+ this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory4();
36630
37215
  this.prettyPrint = config.prettyPrint ?? true;
36631
37216
  this.indexPath = join(this.baseDirectory, "_agents_index.json");
36632
37217
  }
@@ -36881,10 +37466,10 @@ var FileMediaStorage = class {
36881
37466
  }
36882
37467
  async save(data, metadata) {
36883
37468
  const dir = metadata.userId ? path2.join(this.outputDir, metadata.userId) : this.outputDir;
36884
- await fs16.mkdir(dir, { recursive: true });
37469
+ await fs17.mkdir(dir, { recursive: true });
36885
37470
  const filename = metadata.suggestedFilename ?? this.generateFilename(metadata);
36886
37471
  const filePath = path2.join(dir, filename);
36887
- await fs16.writeFile(filePath, data);
37472
+ await fs17.writeFile(filePath, data);
36888
37473
  const format = metadata.format.toLowerCase();
36889
37474
  const mimeType = MIME_TYPES2[format] ?? "application/octet-stream";
36890
37475
  return {
@@ -36895,7 +37480,7 @@ var FileMediaStorage = class {
36895
37480
  }
36896
37481
  async read(location) {
36897
37482
  try {
36898
- return await fs16.readFile(location);
37483
+ return await fs17.readFile(location);
36899
37484
  } catch (err) {
36900
37485
  if (err.code === "ENOENT") {
36901
37486
  return null;
@@ -36905,7 +37490,7 @@ var FileMediaStorage = class {
36905
37490
  }
36906
37491
  async delete(location) {
36907
37492
  try {
36908
- await fs16.unlink(location);
37493
+ await fs17.unlink(location);
36909
37494
  } catch (err) {
36910
37495
  if (err.code === "ENOENT") {
36911
37496
  return;
@@ -36915,7 +37500,7 @@ var FileMediaStorage = class {
36915
37500
  }
36916
37501
  async exists(location) {
36917
37502
  try {
36918
- await fs16.access(location);
37503
+ await fs17.access(location);
36919
37504
  return true;
36920
37505
  } catch {
36921
37506
  return false;
@@ -36924,11 +37509,11 @@ var FileMediaStorage = class {
36924
37509
  async list(options) {
36925
37510
  await this.ensureDir();
36926
37511
  let entries = [];
36927
- const files = await fs16.readdir(this.outputDir);
37512
+ const files = await fs17.readdir(this.outputDir);
36928
37513
  for (const file of files) {
36929
37514
  const filePath = path2.join(this.outputDir, file);
36930
37515
  try {
36931
- const stat6 = await fs16.stat(filePath);
37516
+ const stat6 = await fs17.stat(filePath);
36932
37517
  if (!stat6.isFile()) continue;
36933
37518
  const ext = path2.extname(file).slice(1).toLowerCase();
36934
37519
  const mimeType = MIME_TYPES2[ext] ?? "application/octet-stream";
@@ -36968,7 +37553,7 @@ var FileMediaStorage = class {
36968
37553
  }
36969
37554
  async ensureDir() {
36970
37555
  if (!this.initialized) {
36971
- await fs16.mkdir(this.outputDir, { recursive: true });
37556
+ await fs17.mkdir(this.outputDir, { recursive: true });
36972
37557
  this.initialized = true;
36973
37558
  }
36974
37559
  }
@@ -36976,36 +37561,60 @@ var FileMediaStorage = class {
36976
37561
  function createFileMediaStorage(config) {
36977
37562
  return new FileMediaStorage(config);
36978
37563
  }
36979
- function getDefaultBaseDirectory4() {
37564
+ function getDefaultBaseDirectory5() {
36980
37565
  const platform2 = process.platform;
36981
37566
  if (platform2 === "win32") {
36982
37567
  const appData = process.env.APPDATA || process.env.LOCALAPPDATA;
36983
37568
  if (appData) {
36984
- return join(appData, "oneringai", "custom-tools");
37569
+ return join(appData, "oneringai", "users");
36985
37570
  }
36986
37571
  }
36987
- return join(homedir(), ".oneringai", "custom-tools");
37572
+ return join(homedir(), ".oneringai", "users");
37573
+ }
37574
+ var DEFAULT_USER_ID2 = "default";
37575
+ function sanitizeUserId2(userId) {
37576
+ if (!userId) {
37577
+ return DEFAULT_USER_ID2;
37578
+ }
37579
+ return userId.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase() || DEFAULT_USER_ID2;
36988
37580
  }
36989
37581
  function sanitizeName(name) {
36990
37582
  return name.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase() || "default";
36991
37583
  }
36992
37584
  var FileCustomToolStorage = class {
36993
37585
  baseDirectory;
36994
- indexPath;
36995
37586
  prettyPrint;
36996
- index = null;
36997
37587
  constructor(config = {}) {
36998
- this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory4();
37588
+ this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory5();
36999
37589
  this.prettyPrint = config.prettyPrint ?? true;
37000
- this.indexPath = join(this.baseDirectory, "_index.json");
37590
+ }
37591
+ /**
37592
+ * Get the directory path for a specific user's custom tools
37593
+ */
37594
+ getUserDirectory(userId) {
37595
+ const sanitizedId = sanitizeUserId2(userId);
37596
+ return join(this.baseDirectory, sanitizedId, "custom-tools");
37597
+ }
37598
+ /**
37599
+ * Get the index file path for a specific user
37600
+ */
37601
+ getUserIndexPath(userId) {
37602
+ return join(this.getUserDirectory(userId), "_index.json");
37603
+ }
37604
+ /**
37605
+ * Get the tool file path for a specific user
37606
+ */
37607
+ getToolPath(userId, sanitizedName) {
37608
+ return join(this.getUserDirectory(userId), `${sanitizedName}.json`);
37001
37609
  }
37002
37610
  /**
37003
37611
  * Save a custom tool definition
37004
37612
  */
37005
- async save(definition) {
37613
+ async save(userId, definition) {
37614
+ const directory = this.getUserDirectory(userId);
37006
37615
  const sanitized = sanitizeName(definition.name);
37007
- const filePath = join(this.baseDirectory, `${sanitized}.json`);
37008
- await this.ensureDirectory(this.baseDirectory);
37616
+ const filePath = this.getToolPath(userId, sanitized);
37617
+ await this.ensureDirectory(directory);
37009
37618
  const data = this.prettyPrint ? JSON.stringify(definition, null, 2) : JSON.stringify(definition);
37010
37619
  const tempPath = `${filePath}.tmp`;
37011
37620
  try {
@@ -37018,14 +37627,14 @@ var FileCustomToolStorage = class {
37018
37627
  }
37019
37628
  throw error;
37020
37629
  }
37021
- await this.updateIndex(definition);
37630
+ await this.updateIndex(userId, definition);
37022
37631
  }
37023
37632
  /**
37024
37633
  * Load a custom tool definition by name
37025
37634
  */
37026
- async load(name) {
37635
+ async load(userId, name) {
37027
37636
  const sanitized = sanitizeName(name);
37028
- const filePath = join(this.baseDirectory, `${sanitized}.json`);
37637
+ const filePath = this.getToolPath(userId, sanitized);
37029
37638
  try {
37030
37639
  const data = await promises.readFile(filePath, "utf-8");
37031
37640
  return JSON.parse(data);
@@ -37042,9 +37651,9 @@ var FileCustomToolStorage = class {
37042
37651
  /**
37043
37652
  * Delete a custom tool definition
37044
37653
  */
37045
- async delete(name) {
37654
+ async delete(userId, name) {
37046
37655
  const sanitized = sanitizeName(name);
37047
- const filePath = join(this.baseDirectory, `${sanitized}.json`);
37656
+ const filePath = this.getToolPath(userId, sanitized);
37048
37657
  try {
37049
37658
  await promises.unlink(filePath);
37050
37659
  } catch (error) {
@@ -37052,14 +37661,14 @@ var FileCustomToolStorage = class {
37052
37661
  throw error;
37053
37662
  }
37054
37663
  }
37055
- await this.removeFromIndex(name);
37664
+ await this.removeFromIndex(userId, name);
37056
37665
  }
37057
37666
  /**
37058
37667
  * Check if a custom tool exists
37059
37668
  */
37060
- async exists(name) {
37669
+ async exists(userId, name) {
37061
37670
  const sanitized = sanitizeName(name);
37062
- const filePath = join(this.baseDirectory, `${sanitized}.json`);
37671
+ const filePath = this.getToolPath(userId, sanitized);
37063
37672
  try {
37064
37673
  await promises.access(filePath);
37065
37674
  return true;
@@ -37070,8 +37679,8 @@ var FileCustomToolStorage = class {
37070
37679
  /**
37071
37680
  * List custom tools (summaries only)
37072
37681
  */
37073
- async list(options) {
37074
- const index = await this.loadIndex();
37682
+ async list(userId, options) {
37683
+ const index = await this.loadIndex(userId);
37075
37684
  let entries = [...index.tools];
37076
37685
  if (options?.tags && options.tags.length > 0) {
37077
37686
  entries = entries.filter((e) => {
@@ -37112,20 +37721,20 @@ var FileCustomToolStorage = class {
37112
37721
  /**
37113
37722
  * Update metadata without loading full definition
37114
37723
  */
37115
- async updateMetadata(name, metadata) {
37116
- const definition = await this.load(name);
37724
+ async updateMetadata(userId, name, metadata) {
37725
+ const definition = await this.load(userId, name);
37117
37726
  if (!definition) {
37118
37727
  throw new Error(`Custom tool '${name}' not found`);
37119
37728
  }
37120
37729
  definition.metadata = { ...definition.metadata, ...metadata };
37121
37730
  definition.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
37122
- await this.save(definition);
37731
+ await this.save(userId, definition);
37123
37732
  }
37124
37733
  /**
37125
- * Get storage path
37734
+ * Get storage path for a specific user
37126
37735
  */
37127
- getPath() {
37128
- return this.baseDirectory;
37736
+ getPath(userId) {
37737
+ return this.getUserDirectory(userId);
37129
37738
  }
37130
37739
  // ==========================================================================
37131
37740
  // Private Helpers
@@ -37139,35 +37748,32 @@ var FileCustomToolStorage = class {
37139
37748
  }
37140
37749
  }
37141
37750
  }
37142
- async loadIndex() {
37143
- if (this.index) {
37144
- return this.index;
37145
- }
37751
+ async loadIndex(userId) {
37752
+ const indexPath = this.getUserIndexPath(userId);
37146
37753
  try {
37147
- const data = await promises.readFile(this.indexPath, "utf-8");
37148
- this.index = JSON.parse(data);
37149
- return this.index;
37754
+ const data = await promises.readFile(indexPath, "utf-8");
37755
+ return JSON.parse(data);
37150
37756
  } catch (error) {
37151
37757
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
37152
- this.index = {
37758
+ return {
37153
37759
  version: 1,
37154
37760
  tools: [],
37155
37761
  lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
37156
37762
  };
37157
- return this.index;
37158
37763
  }
37159
37764
  throw error;
37160
37765
  }
37161
37766
  }
37162
- async saveIndex() {
37163
- if (!this.index) return;
37164
- await this.ensureDirectory(this.baseDirectory);
37165
- this.index.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
37166
- const data = this.prettyPrint ? JSON.stringify(this.index, null, 2) : JSON.stringify(this.index);
37167
- await promises.writeFile(this.indexPath, data, "utf-8");
37767
+ async saveIndex(userId, index) {
37768
+ const directory = this.getUserDirectory(userId);
37769
+ const indexPath = this.getUserIndexPath(userId);
37770
+ await this.ensureDirectory(directory);
37771
+ index.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
37772
+ const data = this.prettyPrint ? JSON.stringify(index, null, 2) : JSON.stringify(index);
37773
+ await promises.writeFile(indexPath, data, "utf-8");
37168
37774
  }
37169
- async updateIndex(definition) {
37170
- const index = await this.loadIndex();
37775
+ async updateIndex(userId, definition) {
37776
+ const index = await this.loadIndex(userId);
37171
37777
  const entry = this.definitionToIndexEntry(definition);
37172
37778
  const existingIdx = index.tools.findIndex((e) => e.name === definition.name);
37173
37779
  if (existingIdx >= 0) {
@@ -37175,12 +37781,12 @@ var FileCustomToolStorage = class {
37175
37781
  } else {
37176
37782
  index.tools.push(entry);
37177
37783
  }
37178
- await this.saveIndex();
37784
+ await this.saveIndex(userId, index);
37179
37785
  }
37180
- async removeFromIndex(name) {
37181
- const index = await this.loadIndex();
37786
+ async removeFromIndex(userId, name) {
37787
+ const index = await this.loadIndex(userId);
37182
37788
  index.tools = index.tools.filter((e) => e.name !== name);
37183
- await this.saveIndex();
37789
+ await this.saveIndex(userId, index);
37184
37790
  }
37185
37791
  definitionToIndexEntry(definition) {
37186
37792
  return {
@@ -38010,7 +38616,7 @@ var ConnectorTools = class {
38010
38616
  const factory = this.factories.get(serviceType);
38011
38617
  const serviceTools = factory(connector, userId);
38012
38618
  for (const tool of serviceTools) {
38013
- tool.definition.function.name = `${connector.name}_${tool.definition.function.name}`;
38619
+ tool.definition.function.name = `${sanitizeToolName(connector.name)}_${tool.definition.function.name}`;
38014
38620
  }
38015
38621
  tools.push(...serviceTools);
38016
38622
  }
@@ -38164,7 +38770,7 @@ var ConnectorTools = class {
38164
38770
  return connectorOrName;
38165
38771
  }
38166
38772
  static createGenericAPITool(connector, options) {
38167
- const toolName = options?.toolName ?? `${connector.name}_api`;
38773
+ const toolName = options?.toolName ?? `${sanitizeToolName(connector.name)}_api`;
38168
38774
  const userId = options?.userId;
38169
38775
  const description = options?.description ?? `Make an authenticated API call to ${connector.displayName}.` + (connector.baseURL ? ` Base URL: ${connector.baseURL}.` : " Provide full URL in endpoint.") + ' IMPORTANT: For POST/PUT/PATCH requests, pass data in the "body" parameter as a JSON object, NOT as query string parameters in the endpoint URL. The body is sent as application/json.';
38170
38776
  return {
@@ -38297,8 +38903,8 @@ var FileStorage = class {
38297
38903
  }
38298
38904
  async ensureDirectory() {
38299
38905
  try {
38300
- await fs16.mkdir(this.directory, { recursive: true });
38301
- await fs16.chmod(this.directory, 448);
38906
+ await fs17.mkdir(this.directory, { recursive: true });
38907
+ await fs17.chmod(this.directory, 448);
38302
38908
  } catch (error) {
38303
38909
  }
38304
38910
  }
@@ -38314,13 +38920,13 @@ var FileStorage = class {
38314
38920
  const filePath = this.getFilePath(key);
38315
38921
  const plaintext = JSON.stringify(token);
38316
38922
  const encrypted = encrypt(plaintext, this.encryptionKey);
38317
- await fs16.writeFile(filePath, encrypted, "utf8");
38318
- await fs16.chmod(filePath, 384);
38923
+ await fs17.writeFile(filePath, encrypted, "utf8");
38924
+ await fs17.chmod(filePath, 384);
38319
38925
  }
38320
38926
  async getToken(key) {
38321
38927
  const filePath = this.getFilePath(key);
38322
38928
  try {
38323
- const encrypted = await fs16.readFile(filePath, "utf8");
38929
+ const encrypted = await fs17.readFile(filePath, "utf8");
38324
38930
  const decrypted = decrypt(encrypted, this.encryptionKey);
38325
38931
  return JSON.parse(decrypted);
38326
38932
  } catch (error) {
@@ -38329,7 +38935,7 @@ var FileStorage = class {
38329
38935
  }
38330
38936
  console.error("Failed to read/decrypt token file:", error);
38331
38937
  try {
38332
- await fs16.unlink(filePath);
38938
+ await fs17.unlink(filePath);
38333
38939
  } catch {
38334
38940
  }
38335
38941
  return null;
@@ -38338,7 +38944,7 @@ var FileStorage = class {
38338
38944
  async deleteToken(key) {
38339
38945
  const filePath = this.getFilePath(key);
38340
38946
  try {
38341
- await fs16.unlink(filePath);
38947
+ await fs17.unlink(filePath);
38342
38948
  } catch (error) {
38343
38949
  if (error.code !== "ENOENT") {
38344
38950
  throw error;
@@ -38348,7 +38954,7 @@ var FileStorage = class {
38348
38954
  async hasToken(key) {
38349
38955
  const filePath = this.getFilePath(key);
38350
38956
  try {
38351
- await fs16.access(filePath);
38957
+ await fs17.access(filePath);
38352
38958
  return true;
38353
38959
  } catch {
38354
38960
  return false;
@@ -38359,7 +38965,7 @@ var FileStorage = class {
38359
38965
  */
38360
38966
  async listTokens() {
38361
38967
  try {
38362
- const files = await fs16.readdir(this.directory);
38968
+ const files = await fs17.readdir(this.directory);
38363
38969
  return files.filter((f) => f.endsWith(".token")).map((f) => f.replace(".token", ""));
38364
38970
  } catch {
38365
38971
  return [];
@@ -38370,10 +38976,10 @@ var FileStorage = class {
38370
38976
  */
38371
38977
  async clearAll() {
38372
38978
  try {
38373
- const files = await fs16.readdir(this.directory);
38979
+ const files = await fs17.readdir(this.directory);
38374
38980
  const tokenFiles = files.filter((f) => f.endsWith(".token"));
38375
38981
  await Promise.all(
38376
- tokenFiles.map((f) => fs16.unlink(path2.join(this.directory, f)).catch(() => {
38982
+ tokenFiles.map((f) => fs17.unlink(path2.join(this.directory, f)).catch(() => {
38377
38983
  }))
38378
38984
  );
38379
38985
  } catch {
@@ -38821,14 +39427,14 @@ var FileConnectorStorage = class {
38821
39427
  await this.ensureDirectory();
38822
39428
  const filePath = this.getFilePath(name);
38823
39429
  const json = JSON.stringify(stored, null, 2);
38824
- await fs16.writeFile(filePath, json, "utf8");
38825
- await fs16.chmod(filePath, 384);
39430
+ await fs17.writeFile(filePath, json, "utf8");
39431
+ await fs17.chmod(filePath, 384);
38826
39432
  await this.updateIndex(name, "add");
38827
39433
  }
38828
39434
  async get(name) {
38829
39435
  const filePath = this.getFilePath(name);
38830
39436
  try {
38831
- const json = await fs16.readFile(filePath, "utf8");
39437
+ const json = await fs17.readFile(filePath, "utf8");
38832
39438
  return JSON.parse(json);
38833
39439
  } catch (error) {
38834
39440
  const err = error;
@@ -38841,7 +39447,7 @@ var FileConnectorStorage = class {
38841
39447
  async delete(name) {
38842
39448
  const filePath = this.getFilePath(name);
38843
39449
  try {
38844
- await fs16.unlink(filePath);
39450
+ await fs17.unlink(filePath);
38845
39451
  await this.updateIndex(name, "remove");
38846
39452
  return true;
38847
39453
  } catch (error) {
@@ -38855,7 +39461,7 @@ var FileConnectorStorage = class {
38855
39461
  async has(name) {
38856
39462
  const filePath = this.getFilePath(name);
38857
39463
  try {
38858
- await fs16.access(filePath);
39464
+ await fs17.access(filePath);
38859
39465
  return true;
38860
39466
  } catch {
38861
39467
  return false;
@@ -38881,13 +39487,13 @@ var FileConnectorStorage = class {
38881
39487
  */
38882
39488
  async clear() {
38883
39489
  try {
38884
- const files = await fs16.readdir(this.directory);
39490
+ const files = await fs17.readdir(this.directory);
38885
39491
  const connectorFiles = files.filter(
38886
39492
  (f) => f.endsWith(".connector.json") || f === "_index.json"
38887
39493
  );
38888
39494
  await Promise.all(
38889
39495
  connectorFiles.map(
38890
- (f) => fs16.unlink(path2.join(this.directory, f)).catch(() => {
39496
+ (f) => fs17.unlink(path2.join(this.directory, f)).catch(() => {
38891
39497
  })
38892
39498
  )
38893
39499
  );
@@ -38914,8 +39520,8 @@ var FileConnectorStorage = class {
38914
39520
  async ensureDirectory() {
38915
39521
  if (this.initialized) return;
38916
39522
  try {
38917
- await fs16.mkdir(this.directory, { recursive: true });
38918
- await fs16.chmod(this.directory, 448);
39523
+ await fs17.mkdir(this.directory, { recursive: true });
39524
+ await fs17.chmod(this.directory, 448);
38919
39525
  this.initialized = true;
38920
39526
  } catch {
38921
39527
  this.initialized = true;
@@ -38926,7 +39532,7 @@ var FileConnectorStorage = class {
38926
39532
  */
38927
39533
  async loadIndex() {
38928
39534
  try {
38929
- const json = await fs16.readFile(this.indexPath, "utf8");
39535
+ const json = await fs17.readFile(this.indexPath, "utf8");
38930
39536
  return JSON.parse(json);
38931
39537
  } catch {
38932
39538
  return { connectors: {} };
@@ -38944,8 +39550,8 @@ var FileConnectorStorage = class {
38944
39550
  delete index.connectors[hash];
38945
39551
  }
38946
39552
  const json = JSON.stringify(index, null, 2);
38947
- await fs16.writeFile(this.indexPath, json, "utf8");
38948
- await fs16.chmod(this.indexPath, 384);
39553
+ await fs17.writeFile(this.indexPath, json, "utf8");
39554
+ await fs17.chmod(this.indexPath, 384);
38949
39555
  }
38950
39556
  };
38951
39557
 
@@ -41400,8 +42006,8 @@ function createMessageWithImages(text, imageUrls, role = "user" /* USER */) {
41400
42006
  var execAsync = promisify(exec);
41401
42007
  function cleanupTempFile(filePath) {
41402
42008
  try {
41403
- if (fs17.existsSync(filePath)) {
41404
- fs17.unlinkSync(filePath);
42009
+ if (fs18.existsSync(filePath)) {
42010
+ fs18.unlinkSync(filePath);
41405
42011
  }
41406
42012
  } catch {
41407
42013
  }
@@ -41452,7 +42058,7 @@ async function readClipboardImageMac() {
41452
42058
  end try
41453
42059
  `;
41454
42060
  const { stdout } = await execAsync(`osascript -e '${script}'`);
41455
- if (stdout.includes("success") || fs17.existsSync(tempFile)) {
42061
+ if (stdout.includes("success") || fs18.existsSync(tempFile)) {
41456
42062
  return await convertFileToDataUri(tempFile);
41457
42063
  }
41458
42064
  return {
@@ -41469,14 +42075,14 @@ async function readClipboardImageLinux() {
41469
42075
  try {
41470
42076
  try {
41471
42077
  await execAsync(`xclip -selection clipboard -t image/png -o > "${tempFile}"`);
41472
- if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
42078
+ if (fs18.existsSync(tempFile) && fs18.statSync(tempFile).size > 0) {
41473
42079
  return await convertFileToDataUri(tempFile);
41474
42080
  }
41475
42081
  } catch {
41476
42082
  }
41477
42083
  try {
41478
42084
  await execAsync(`wl-paste -t image/png > "${tempFile}"`);
41479
- if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
42085
+ if (fs18.existsSync(tempFile) && fs18.statSync(tempFile).size > 0) {
41480
42086
  return await convertFileToDataUri(tempFile);
41481
42087
  }
41482
42088
  } catch {
@@ -41503,7 +42109,7 @@ async function readClipboardImageWindows() {
41503
42109
  }
41504
42110
  `;
41505
42111
  await execAsync(`powershell -Command "${psScript}"`);
41506
- if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
42112
+ if (fs18.existsSync(tempFile) && fs18.statSync(tempFile).size > 0) {
41507
42113
  return await convertFileToDataUri(tempFile);
41508
42114
  }
41509
42115
  return {
@@ -41516,7 +42122,7 @@ async function readClipboardImageWindows() {
41516
42122
  }
41517
42123
  async function convertFileToDataUri(filePath) {
41518
42124
  try {
41519
- const imageBuffer = fs17.readFileSync(filePath);
42125
+ const imageBuffer = fs18.readFileSync(filePath);
41520
42126
  const base64Image = imageBuffer.toString("base64");
41521
42127
  const magic = imageBuffer.slice(0, 4).toString("hex");
41522
42128
  let mimeType = "image/png";
@@ -46751,7 +47357,7 @@ var desktopTools = [
46751
47357
 
46752
47358
  // src/tools/custom-tools/resolveStorage.ts
46753
47359
  init_StorageRegistry();
46754
- function buildStorageContext(toolContext) {
47360
+ function buildStorageContext2(toolContext) {
46755
47361
  const global2 = StorageRegistry.getContext();
46756
47362
  if (global2) return global2;
46757
47363
  if (toolContext?.userId) return { userId: toolContext.userId };
@@ -46761,7 +47367,7 @@ function resolveCustomToolStorage(explicit, toolContext) {
46761
47367
  if (explicit) return explicit;
46762
47368
  const factory = StorageRegistry.get("customTools");
46763
47369
  if (factory) {
46764
- return factory(buildStorageContext(toolContext));
47370
+ return factory(buildStorageContext2(toolContext));
46765
47371
  }
46766
47372
  return new FileCustomToolStorage();
46767
47373
  }
@@ -46789,12 +47395,13 @@ function createCustomToolDelete(storage) {
46789
47395
  permission: { scope: "session", riskLevel: "medium" },
46790
47396
  execute: async (args, context) => {
46791
47397
  try {
47398
+ const userId = context?.userId;
46792
47399
  const s = resolveCustomToolStorage(storage, context);
46793
- const exists = await s.exists(args.name);
47400
+ const exists = await s.exists(userId, args.name);
46794
47401
  if (!exists) {
46795
47402
  return { success: false, name: args.name, error: `Custom tool '${args.name}' not found` };
46796
47403
  }
46797
- await s.delete(args.name);
47404
+ await s.delete(userId, args.name);
46798
47405
  return { success: true, name: args.name };
46799
47406
  } catch (error) {
46800
47407
  return { success: false, name: args.name, error: error.message };
@@ -47035,8 +47642,9 @@ function createCustomToolList(storage) {
47035
47642
  },
47036
47643
  permission: { scope: "always", riskLevel: "low" },
47037
47644
  execute: async (args, context) => {
47645
+ const userId = context?.userId;
47038
47646
  const s = resolveCustomToolStorage(storage, context);
47039
- const tools = await s.list({
47647
+ const tools = await s.list(userId, {
47040
47648
  search: args.search,
47041
47649
  tags: args.tags,
47042
47650
  category: args.category,
@@ -47072,8 +47680,9 @@ function createCustomToolLoad(storage) {
47072
47680
  },
47073
47681
  permission: { scope: "always", riskLevel: "low" },
47074
47682
  execute: async (args, context) => {
47683
+ const userId = context?.userId;
47075
47684
  const s = resolveCustomToolStorage(storage, context);
47076
- const tool = await s.load(args.name);
47685
+ const tool = await s.load(userId, args.name);
47077
47686
  if (!tool) {
47078
47687
  return { success: false, error: `Custom tool '${args.name}' not found` };
47079
47688
  }
@@ -47145,9 +47754,10 @@ function createCustomToolSave(storage) {
47145
47754
  permission: { scope: "session", riskLevel: "medium" },
47146
47755
  execute: async (args, context) => {
47147
47756
  try {
47757
+ const userId = context?.userId;
47148
47758
  const s = resolveCustomToolStorage(storage, context);
47149
47759
  const now = (/* @__PURE__ */ new Date()).toISOString();
47150
- const existing = await s.load(args.name);
47760
+ const existing = await s.load(userId, args.name);
47151
47761
  const definition = {
47152
47762
  version: CUSTOM_TOOL_DEFINITION_VERSION,
47153
47763
  name: args.name,
@@ -47166,17 +47776,17 @@ function createCustomToolSave(storage) {
47166
47776
  requiresConnector: (args.connectorNames?.length ?? 0) > 0
47167
47777
  }
47168
47778
  };
47169
- await s.save(definition);
47779
+ await s.save(userId, definition);
47170
47780
  return {
47171
47781
  success: true,
47172
47782
  name: args.name,
47173
- storagePath: s.getPath()
47783
+ storagePath: s.getPath(userId)
47174
47784
  };
47175
47785
  } catch (error) {
47176
47786
  return {
47177
47787
  success: false,
47178
47788
  name: args.name,
47179
- storagePath: resolveCustomToolStorage(storage, context).getPath(),
47789
+ storagePath: resolveCustomToolStorage(storage, context).getPath(context?.userId),
47180
47790
  error: error.message
47181
47791
  };
47182
47792
  }
@@ -47918,6 +48528,6 @@ REMEMBER: Keep it conversational, ask one question at a time, and only output th
47918
48528
  }
47919
48529
  };
47920
48530
 
47921
- 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, StorageRegistry, 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, resolveMaxContextTokens, resolveModelCapabilities, resolveRepository, retryWithBackoff, scopeEquals, scopeMatches, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, tools_exports as tools, updateTaskStatus, validatePath, writeFile5 as writeFile };
48531
+ 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, FileUserInfoStorage, 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, StorageRegistry, 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, UserInfoPluginNextGen, 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, resolveMaxContextTokens, resolveModelCapabilities, resolveRepository, retryWithBackoff, sanitizeToolName, scopeEquals, scopeMatches, setMediaOutputHandler, setMediaStorage, setMetricsCollector, simpleTokenEstimator, toConnectorOptions, toolRegistry, tools_exports as tools, updateTaskStatus, validatePath, writeFile5 as writeFile };
47922
48532
  //# sourceMappingURL=index.js.map
47923
48533
  //# sourceMappingURL=index.js.map