@everworker/oneringai 0.3.1 → 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
  }
@@ -29004,7 +29583,7 @@ var OpenAISTTProvider = class extends BaseMediaProvider {
29004
29583
  if (Buffer.isBuffer(audio)) {
29005
29584
  return new File([new Uint8Array(audio)], "audio.wav", { type: "audio/wav" });
29006
29585
  } else if (typeof audio === "string") {
29007
- return fs17.createReadStream(audio);
29586
+ return fs18.createReadStream(audio);
29008
29587
  } else {
29009
29588
  throw new Error("Invalid audio input: must be Buffer or file path");
29010
29589
  }
@@ -29557,7 +30136,7 @@ var TextToSpeech = class _TextToSpeech {
29557
30136
  */
29558
30137
  async toFile(text, filePath, options) {
29559
30138
  const response = await this.synthesize(text, options);
29560
- await fs16.writeFile(filePath, response.audio);
30139
+ await fs17.writeFile(filePath, response.audio);
29561
30140
  }
29562
30141
  // ======================== Introspection Methods ========================
29563
30142
  /**
@@ -29905,7 +30484,7 @@ var SpeechToText = class _SpeechToText {
29905
30484
  * @param options - Optional transcription parameters
29906
30485
  */
29907
30486
  async transcribeFile(filePath, options) {
29908
- const audio = await fs16.readFile(filePath);
30487
+ const audio = await fs17.readFile(filePath);
29909
30488
  return this.transcribe(audio, options);
29910
30489
  }
29911
30490
  /**
@@ -30231,7 +30810,7 @@ var OpenAIImageProvider = class extends BaseMediaProvider {
30231
30810
  if (Buffer.isBuffer(image)) {
30232
30811
  return new File([new Uint8Array(image)], "image.png", { type: "image/png" });
30233
30812
  }
30234
- return fs17.createReadStream(image);
30813
+ return fs18.createReadStream(image);
30235
30814
  }
30236
30815
  /**
30237
30816
  * Handle OpenAI API errors
@@ -30378,8 +30957,8 @@ var GoogleImageProvider = class extends BaseMediaProvider {
30378
30957
  if (Buffer.isBuffer(image)) {
30379
30958
  imageBytes = image.toString("base64");
30380
30959
  } else {
30381
- const fs18 = await import('fs');
30382
- const buffer = fs18.readFileSync(image);
30960
+ const fs19 = await import('fs');
30961
+ const buffer = fs19.readFileSync(image);
30383
30962
  imageBytes = buffer.toString("base64");
30384
30963
  }
30385
30964
  return {
@@ -30540,7 +31119,7 @@ var GrokImageProvider = class extends BaseMediaProvider {
30540
31119
  if (Buffer.isBuffer(image)) {
30541
31120
  return new File([new Uint8Array(image)], "image.png", { type: "image/png" });
30542
31121
  }
30543
- return fs17.createReadStream(image);
31122
+ return fs18.createReadStream(image);
30544
31123
  }
30545
31124
  /**
30546
31125
  * Handle API errors
@@ -31990,8 +32569,8 @@ var OpenAISoraProvider = class extends BaseMediaProvider {
31990
32569
  return new File([new Uint8Array(image)], "input.png", { type: "image/png" });
31991
32570
  }
31992
32571
  if (!image.startsWith("http")) {
31993
- const fs18 = await import('fs');
31994
- const data = fs18.readFileSync(image);
32572
+ const fs19 = await import('fs');
32573
+ const data = fs19.readFileSync(image);
31995
32574
  return new File([new Uint8Array(data)], "input.png", { type: "image/png" });
31996
32575
  }
31997
32576
  const response = await fetch(image);
@@ -32169,7 +32748,7 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
32169
32748
  if (video.videoBytes) {
32170
32749
  buffer = Buffer.from(video.videoBytes, "base64");
32171
32750
  } else if (video.uri) {
32172
- const fs18 = await import('fs/promises');
32751
+ const fs19 = await import('fs/promises');
32173
32752
  const os3 = await import('os');
32174
32753
  const path6 = await import('path');
32175
32754
  const tempDir = os3.tmpdir();
@@ -32180,11 +32759,11 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
32180
32759
  // Pass as GeneratedVideo
32181
32760
  downloadPath: tempFile
32182
32761
  });
32183
- buffer = await fs18.readFile(tempFile);
32184
- await fs18.unlink(tempFile).catch(() => {
32762
+ buffer = await fs19.readFile(tempFile);
32763
+ await fs19.unlink(tempFile).catch(() => {
32185
32764
  });
32186
32765
  } catch (downloadError) {
32187
- await fs18.unlink(tempFile).catch(() => {
32766
+ await fs19.unlink(tempFile).catch(() => {
32188
32767
  });
32189
32768
  throw new ProviderError(
32190
32769
  "google",
@@ -32306,8 +32885,8 @@ var GoogleVeoProvider = class extends BaseMediaProvider {
32306
32885
  if (image.startsWith("http://") || image.startsWith("https://")) {
32307
32886
  return { imageUri: image };
32308
32887
  }
32309
- const fs18 = await import('fs/promises');
32310
- const data = await fs18.readFile(image);
32888
+ const fs19 = await import('fs/promises');
32889
+ const data = await fs19.readFile(image);
32311
32890
  return {
32312
32891
  imageBytes: data.toString("base64")
32313
32892
  };
@@ -32614,8 +33193,8 @@ var GrokImagineProvider = class extends BaseMediaProvider {
32614
33193
  if (image.startsWith("http") || image.startsWith("data:")) {
32615
33194
  return image;
32616
33195
  }
32617
- const fs18 = await import('fs');
32618
- const data = fs18.readFileSync(image);
33196
+ const fs19 = await import('fs');
33197
+ const data = fs19.readFileSync(image);
32619
33198
  const base64 = data.toString("base64");
32620
33199
  const ext = image.split(".").pop()?.toLowerCase() || "png";
32621
33200
  const mimeType = ext === "jpg" || ext === "jpeg" ? "image/jpeg" : `image/${ext}`;
@@ -36318,7 +36897,7 @@ var InMemoryHistoryStorage = class {
36318
36897
  this.summaries = state.summaries ? [...state.summaries] : [];
36319
36898
  }
36320
36899
  };
36321
- function getDefaultBaseDirectory2() {
36900
+ function getDefaultBaseDirectory3() {
36322
36901
  const platform2 = process.platform;
36323
36902
  if (platform2 === "win32") {
36324
36903
  const appData = process.env.APPDATA || process.env.LOCALAPPDATA;
@@ -36341,7 +36920,7 @@ var FileContextStorage = class {
36341
36920
  constructor(config) {
36342
36921
  this.agentId = config.agentId;
36343
36922
  const sanitizedAgentId = sanitizeId(config.agentId);
36344
- const baseDir = config.baseDirectory ?? getDefaultBaseDirectory2();
36923
+ const baseDir = config.baseDirectory ?? getDefaultBaseDirectory3();
36345
36924
  this.prettyPrint = config.prettyPrint ?? true;
36346
36925
  this.sessionsDirectory = join(baseDir, sanitizedAgentId, "sessions");
36347
36926
  this.indexPath = join(this.sessionsDirectory, "_index.json");
@@ -36613,7 +37192,7 @@ var FileContextStorage = class {
36613
37192
  function createFileContextStorage(agentId, options) {
36614
37193
  return new FileContextStorage({ agentId, ...options });
36615
37194
  }
36616
- function getDefaultBaseDirectory3() {
37195
+ function getDefaultBaseDirectory4() {
36617
37196
  const platform2 = process.platform;
36618
37197
  if (platform2 === "win32") {
36619
37198
  const appData = process.env.APPDATA || process.env.LOCALAPPDATA;
@@ -36632,7 +37211,7 @@ var FileAgentDefinitionStorage = class {
36632
37211
  prettyPrint;
36633
37212
  index = null;
36634
37213
  constructor(config = {}) {
36635
- this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory3();
37214
+ this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory4();
36636
37215
  this.prettyPrint = config.prettyPrint ?? true;
36637
37216
  this.indexPath = join(this.baseDirectory, "_agents_index.json");
36638
37217
  }
@@ -36887,10 +37466,10 @@ var FileMediaStorage = class {
36887
37466
  }
36888
37467
  async save(data, metadata) {
36889
37468
  const dir = metadata.userId ? path2.join(this.outputDir, metadata.userId) : this.outputDir;
36890
- await fs16.mkdir(dir, { recursive: true });
37469
+ await fs17.mkdir(dir, { recursive: true });
36891
37470
  const filename = metadata.suggestedFilename ?? this.generateFilename(metadata);
36892
37471
  const filePath = path2.join(dir, filename);
36893
- await fs16.writeFile(filePath, data);
37472
+ await fs17.writeFile(filePath, data);
36894
37473
  const format = metadata.format.toLowerCase();
36895
37474
  const mimeType = MIME_TYPES2[format] ?? "application/octet-stream";
36896
37475
  return {
@@ -36901,7 +37480,7 @@ var FileMediaStorage = class {
36901
37480
  }
36902
37481
  async read(location) {
36903
37482
  try {
36904
- return await fs16.readFile(location);
37483
+ return await fs17.readFile(location);
36905
37484
  } catch (err) {
36906
37485
  if (err.code === "ENOENT") {
36907
37486
  return null;
@@ -36911,7 +37490,7 @@ var FileMediaStorage = class {
36911
37490
  }
36912
37491
  async delete(location) {
36913
37492
  try {
36914
- await fs16.unlink(location);
37493
+ await fs17.unlink(location);
36915
37494
  } catch (err) {
36916
37495
  if (err.code === "ENOENT") {
36917
37496
  return;
@@ -36921,7 +37500,7 @@ var FileMediaStorage = class {
36921
37500
  }
36922
37501
  async exists(location) {
36923
37502
  try {
36924
- await fs16.access(location);
37503
+ await fs17.access(location);
36925
37504
  return true;
36926
37505
  } catch {
36927
37506
  return false;
@@ -36930,11 +37509,11 @@ var FileMediaStorage = class {
36930
37509
  async list(options) {
36931
37510
  await this.ensureDir();
36932
37511
  let entries = [];
36933
- const files = await fs16.readdir(this.outputDir);
37512
+ const files = await fs17.readdir(this.outputDir);
36934
37513
  for (const file of files) {
36935
37514
  const filePath = path2.join(this.outputDir, file);
36936
37515
  try {
36937
- const stat6 = await fs16.stat(filePath);
37516
+ const stat6 = await fs17.stat(filePath);
36938
37517
  if (!stat6.isFile()) continue;
36939
37518
  const ext = path2.extname(file).slice(1).toLowerCase();
36940
37519
  const mimeType = MIME_TYPES2[ext] ?? "application/octet-stream";
@@ -36974,7 +37553,7 @@ var FileMediaStorage = class {
36974
37553
  }
36975
37554
  async ensureDir() {
36976
37555
  if (!this.initialized) {
36977
- await fs16.mkdir(this.outputDir, { recursive: true });
37556
+ await fs17.mkdir(this.outputDir, { recursive: true });
36978
37557
  this.initialized = true;
36979
37558
  }
36980
37559
  }
@@ -36982,36 +37561,60 @@ var FileMediaStorage = class {
36982
37561
  function createFileMediaStorage(config) {
36983
37562
  return new FileMediaStorage(config);
36984
37563
  }
36985
- function getDefaultBaseDirectory4() {
37564
+ function getDefaultBaseDirectory5() {
36986
37565
  const platform2 = process.platform;
36987
37566
  if (platform2 === "win32") {
36988
37567
  const appData = process.env.APPDATA || process.env.LOCALAPPDATA;
36989
37568
  if (appData) {
36990
- return join(appData, "oneringai", "custom-tools");
37569
+ return join(appData, "oneringai", "users");
36991
37570
  }
36992
37571
  }
36993
- 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;
36994
37580
  }
36995
37581
  function sanitizeName(name) {
36996
37582
  return name.replace(/[^a-zA-Z0-9_-]/g, "_").replace(/_+/g, "_").replace(/^_|_$/g, "").toLowerCase() || "default";
36997
37583
  }
36998
37584
  var FileCustomToolStorage = class {
36999
37585
  baseDirectory;
37000
- indexPath;
37001
37586
  prettyPrint;
37002
- index = null;
37003
37587
  constructor(config = {}) {
37004
- this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory4();
37588
+ this.baseDirectory = config.baseDirectory ?? getDefaultBaseDirectory5();
37005
37589
  this.prettyPrint = config.prettyPrint ?? true;
37006
- 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`);
37007
37609
  }
37008
37610
  /**
37009
37611
  * Save a custom tool definition
37010
37612
  */
37011
- async save(definition) {
37613
+ async save(userId, definition) {
37614
+ const directory = this.getUserDirectory(userId);
37012
37615
  const sanitized = sanitizeName(definition.name);
37013
- const filePath = join(this.baseDirectory, `${sanitized}.json`);
37014
- await this.ensureDirectory(this.baseDirectory);
37616
+ const filePath = this.getToolPath(userId, sanitized);
37617
+ await this.ensureDirectory(directory);
37015
37618
  const data = this.prettyPrint ? JSON.stringify(definition, null, 2) : JSON.stringify(definition);
37016
37619
  const tempPath = `${filePath}.tmp`;
37017
37620
  try {
@@ -37024,14 +37627,14 @@ var FileCustomToolStorage = class {
37024
37627
  }
37025
37628
  throw error;
37026
37629
  }
37027
- await this.updateIndex(definition);
37630
+ await this.updateIndex(userId, definition);
37028
37631
  }
37029
37632
  /**
37030
37633
  * Load a custom tool definition by name
37031
37634
  */
37032
- async load(name) {
37635
+ async load(userId, name) {
37033
37636
  const sanitized = sanitizeName(name);
37034
- const filePath = join(this.baseDirectory, `${sanitized}.json`);
37637
+ const filePath = this.getToolPath(userId, sanitized);
37035
37638
  try {
37036
37639
  const data = await promises.readFile(filePath, "utf-8");
37037
37640
  return JSON.parse(data);
@@ -37048,9 +37651,9 @@ var FileCustomToolStorage = class {
37048
37651
  /**
37049
37652
  * Delete a custom tool definition
37050
37653
  */
37051
- async delete(name) {
37654
+ async delete(userId, name) {
37052
37655
  const sanitized = sanitizeName(name);
37053
- const filePath = join(this.baseDirectory, `${sanitized}.json`);
37656
+ const filePath = this.getToolPath(userId, sanitized);
37054
37657
  try {
37055
37658
  await promises.unlink(filePath);
37056
37659
  } catch (error) {
@@ -37058,14 +37661,14 @@ var FileCustomToolStorage = class {
37058
37661
  throw error;
37059
37662
  }
37060
37663
  }
37061
- await this.removeFromIndex(name);
37664
+ await this.removeFromIndex(userId, name);
37062
37665
  }
37063
37666
  /**
37064
37667
  * Check if a custom tool exists
37065
37668
  */
37066
- async exists(name) {
37669
+ async exists(userId, name) {
37067
37670
  const sanitized = sanitizeName(name);
37068
- const filePath = join(this.baseDirectory, `${sanitized}.json`);
37671
+ const filePath = this.getToolPath(userId, sanitized);
37069
37672
  try {
37070
37673
  await promises.access(filePath);
37071
37674
  return true;
@@ -37076,8 +37679,8 @@ var FileCustomToolStorage = class {
37076
37679
  /**
37077
37680
  * List custom tools (summaries only)
37078
37681
  */
37079
- async list(options) {
37080
- const index = await this.loadIndex();
37682
+ async list(userId, options) {
37683
+ const index = await this.loadIndex(userId);
37081
37684
  let entries = [...index.tools];
37082
37685
  if (options?.tags && options.tags.length > 0) {
37083
37686
  entries = entries.filter((e) => {
@@ -37118,20 +37721,20 @@ var FileCustomToolStorage = class {
37118
37721
  /**
37119
37722
  * Update metadata without loading full definition
37120
37723
  */
37121
- async updateMetadata(name, metadata) {
37122
- const definition = await this.load(name);
37724
+ async updateMetadata(userId, name, metadata) {
37725
+ const definition = await this.load(userId, name);
37123
37726
  if (!definition) {
37124
37727
  throw new Error(`Custom tool '${name}' not found`);
37125
37728
  }
37126
37729
  definition.metadata = { ...definition.metadata, ...metadata };
37127
37730
  definition.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
37128
- await this.save(definition);
37731
+ await this.save(userId, definition);
37129
37732
  }
37130
37733
  /**
37131
- * Get storage path
37734
+ * Get storage path for a specific user
37132
37735
  */
37133
- getPath() {
37134
- return this.baseDirectory;
37736
+ getPath(userId) {
37737
+ return this.getUserDirectory(userId);
37135
37738
  }
37136
37739
  // ==========================================================================
37137
37740
  // Private Helpers
@@ -37145,35 +37748,32 @@ var FileCustomToolStorage = class {
37145
37748
  }
37146
37749
  }
37147
37750
  }
37148
- async loadIndex() {
37149
- if (this.index) {
37150
- return this.index;
37151
- }
37751
+ async loadIndex(userId) {
37752
+ const indexPath = this.getUserIndexPath(userId);
37152
37753
  try {
37153
- const data = await promises.readFile(this.indexPath, "utf-8");
37154
- this.index = JSON.parse(data);
37155
- return this.index;
37754
+ const data = await promises.readFile(indexPath, "utf-8");
37755
+ return JSON.parse(data);
37156
37756
  } catch (error) {
37157
37757
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
37158
- this.index = {
37758
+ return {
37159
37759
  version: 1,
37160
37760
  tools: [],
37161
37761
  lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
37162
37762
  };
37163
- return this.index;
37164
37763
  }
37165
37764
  throw error;
37166
37765
  }
37167
37766
  }
37168
- async saveIndex() {
37169
- if (!this.index) return;
37170
- await this.ensureDirectory(this.baseDirectory);
37171
- this.index.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
37172
- const data = this.prettyPrint ? JSON.stringify(this.index, null, 2) : JSON.stringify(this.index);
37173
- 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");
37174
37774
  }
37175
- async updateIndex(definition) {
37176
- const index = await this.loadIndex();
37775
+ async updateIndex(userId, definition) {
37776
+ const index = await this.loadIndex(userId);
37177
37777
  const entry = this.definitionToIndexEntry(definition);
37178
37778
  const existingIdx = index.tools.findIndex((e) => e.name === definition.name);
37179
37779
  if (existingIdx >= 0) {
@@ -37181,12 +37781,12 @@ var FileCustomToolStorage = class {
37181
37781
  } else {
37182
37782
  index.tools.push(entry);
37183
37783
  }
37184
- await this.saveIndex();
37784
+ await this.saveIndex(userId, index);
37185
37785
  }
37186
- async removeFromIndex(name) {
37187
- const index = await this.loadIndex();
37786
+ async removeFromIndex(userId, name) {
37787
+ const index = await this.loadIndex(userId);
37188
37788
  index.tools = index.tools.filter((e) => e.name !== name);
37189
- await this.saveIndex();
37789
+ await this.saveIndex(userId, index);
37190
37790
  }
37191
37791
  definitionToIndexEntry(definition) {
37192
37792
  return {
@@ -38303,8 +38903,8 @@ var FileStorage = class {
38303
38903
  }
38304
38904
  async ensureDirectory() {
38305
38905
  try {
38306
- await fs16.mkdir(this.directory, { recursive: true });
38307
- await fs16.chmod(this.directory, 448);
38906
+ await fs17.mkdir(this.directory, { recursive: true });
38907
+ await fs17.chmod(this.directory, 448);
38308
38908
  } catch (error) {
38309
38909
  }
38310
38910
  }
@@ -38320,13 +38920,13 @@ var FileStorage = class {
38320
38920
  const filePath = this.getFilePath(key);
38321
38921
  const plaintext = JSON.stringify(token);
38322
38922
  const encrypted = encrypt(plaintext, this.encryptionKey);
38323
- await fs16.writeFile(filePath, encrypted, "utf8");
38324
- await fs16.chmod(filePath, 384);
38923
+ await fs17.writeFile(filePath, encrypted, "utf8");
38924
+ await fs17.chmod(filePath, 384);
38325
38925
  }
38326
38926
  async getToken(key) {
38327
38927
  const filePath = this.getFilePath(key);
38328
38928
  try {
38329
- const encrypted = await fs16.readFile(filePath, "utf8");
38929
+ const encrypted = await fs17.readFile(filePath, "utf8");
38330
38930
  const decrypted = decrypt(encrypted, this.encryptionKey);
38331
38931
  return JSON.parse(decrypted);
38332
38932
  } catch (error) {
@@ -38335,7 +38935,7 @@ var FileStorage = class {
38335
38935
  }
38336
38936
  console.error("Failed to read/decrypt token file:", error);
38337
38937
  try {
38338
- await fs16.unlink(filePath);
38938
+ await fs17.unlink(filePath);
38339
38939
  } catch {
38340
38940
  }
38341
38941
  return null;
@@ -38344,7 +38944,7 @@ var FileStorage = class {
38344
38944
  async deleteToken(key) {
38345
38945
  const filePath = this.getFilePath(key);
38346
38946
  try {
38347
- await fs16.unlink(filePath);
38947
+ await fs17.unlink(filePath);
38348
38948
  } catch (error) {
38349
38949
  if (error.code !== "ENOENT") {
38350
38950
  throw error;
@@ -38354,7 +38954,7 @@ var FileStorage = class {
38354
38954
  async hasToken(key) {
38355
38955
  const filePath = this.getFilePath(key);
38356
38956
  try {
38357
- await fs16.access(filePath);
38957
+ await fs17.access(filePath);
38358
38958
  return true;
38359
38959
  } catch {
38360
38960
  return false;
@@ -38365,7 +38965,7 @@ var FileStorage = class {
38365
38965
  */
38366
38966
  async listTokens() {
38367
38967
  try {
38368
- const files = await fs16.readdir(this.directory);
38968
+ const files = await fs17.readdir(this.directory);
38369
38969
  return files.filter((f) => f.endsWith(".token")).map((f) => f.replace(".token", ""));
38370
38970
  } catch {
38371
38971
  return [];
@@ -38376,10 +38976,10 @@ var FileStorage = class {
38376
38976
  */
38377
38977
  async clearAll() {
38378
38978
  try {
38379
- const files = await fs16.readdir(this.directory);
38979
+ const files = await fs17.readdir(this.directory);
38380
38980
  const tokenFiles = files.filter((f) => f.endsWith(".token"));
38381
38981
  await Promise.all(
38382
- tokenFiles.map((f) => fs16.unlink(path2.join(this.directory, f)).catch(() => {
38982
+ tokenFiles.map((f) => fs17.unlink(path2.join(this.directory, f)).catch(() => {
38383
38983
  }))
38384
38984
  );
38385
38985
  } catch {
@@ -38827,14 +39427,14 @@ var FileConnectorStorage = class {
38827
39427
  await this.ensureDirectory();
38828
39428
  const filePath = this.getFilePath(name);
38829
39429
  const json = JSON.stringify(stored, null, 2);
38830
- await fs16.writeFile(filePath, json, "utf8");
38831
- await fs16.chmod(filePath, 384);
39430
+ await fs17.writeFile(filePath, json, "utf8");
39431
+ await fs17.chmod(filePath, 384);
38832
39432
  await this.updateIndex(name, "add");
38833
39433
  }
38834
39434
  async get(name) {
38835
39435
  const filePath = this.getFilePath(name);
38836
39436
  try {
38837
- const json = await fs16.readFile(filePath, "utf8");
39437
+ const json = await fs17.readFile(filePath, "utf8");
38838
39438
  return JSON.parse(json);
38839
39439
  } catch (error) {
38840
39440
  const err = error;
@@ -38847,7 +39447,7 @@ var FileConnectorStorage = class {
38847
39447
  async delete(name) {
38848
39448
  const filePath = this.getFilePath(name);
38849
39449
  try {
38850
- await fs16.unlink(filePath);
39450
+ await fs17.unlink(filePath);
38851
39451
  await this.updateIndex(name, "remove");
38852
39452
  return true;
38853
39453
  } catch (error) {
@@ -38861,7 +39461,7 @@ var FileConnectorStorage = class {
38861
39461
  async has(name) {
38862
39462
  const filePath = this.getFilePath(name);
38863
39463
  try {
38864
- await fs16.access(filePath);
39464
+ await fs17.access(filePath);
38865
39465
  return true;
38866
39466
  } catch {
38867
39467
  return false;
@@ -38887,13 +39487,13 @@ var FileConnectorStorage = class {
38887
39487
  */
38888
39488
  async clear() {
38889
39489
  try {
38890
- const files = await fs16.readdir(this.directory);
39490
+ const files = await fs17.readdir(this.directory);
38891
39491
  const connectorFiles = files.filter(
38892
39492
  (f) => f.endsWith(".connector.json") || f === "_index.json"
38893
39493
  );
38894
39494
  await Promise.all(
38895
39495
  connectorFiles.map(
38896
- (f) => fs16.unlink(path2.join(this.directory, f)).catch(() => {
39496
+ (f) => fs17.unlink(path2.join(this.directory, f)).catch(() => {
38897
39497
  })
38898
39498
  )
38899
39499
  );
@@ -38920,8 +39520,8 @@ var FileConnectorStorage = class {
38920
39520
  async ensureDirectory() {
38921
39521
  if (this.initialized) return;
38922
39522
  try {
38923
- await fs16.mkdir(this.directory, { recursive: true });
38924
- await fs16.chmod(this.directory, 448);
39523
+ await fs17.mkdir(this.directory, { recursive: true });
39524
+ await fs17.chmod(this.directory, 448);
38925
39525
  this.initialized = true;
38926
39526
  } catch {
38927
39527
  this.initialized = true;
@@ -38932,7 +39532,7 @@ var FileConnectorStorage = class {
38932
39532
  */
38933
39533
  async loadIndex() {
38934
39534
  try {
38935
- const json = await fs16.readFile(this.indexPath, "utf8");
39535
+ const json = await fs17.readFile(this.indexPath, "utf8");
38936
39536
  return JSON.parse(json);
38937
39537
  } catch {
38938
39538
  return { connectors: {} };
@@ -38950,8 +39550,8 @@ var FileConnectorStorage = class {
38950
39550
  delete index.connectors[hash];
38951
39551
  }
38952
39552
  const json = JSON.stringify(index, null, 2);
38953
- await fs16.writeFile(this.indexPath, json, "utf8");
38954
- await fs16.chmod(this.indexPath, 384);
39553
+ await fs17.writeFile(this.indexPath, json, "utf8");
39554
+ await fs17.chmod(this.indexPath, 384);
38955
39555
  }
38956
39556
  };
38957
39557
 
@@ -41406,8 +42006,8 @@ function createMessageWithImages(text, imageUrls, role = "user" /* USER */) {
41406
42006
  var execAsync = promisify(exec);
41407
42007
  function cleanupTempFile(filePath) {
41408
42008
  try {
41409
- if (fs17.existsSync(filePath)) {
41410
- fs17.unlinkSync(filePath);
42009
+ if (fs18.existsSync(filePath)) {
42010
+ fs18.unlinkSync(filePath);
41411
42011
  }
41412
42012
  } catch {
41413
42013
  }
@@ -41458,7 +42058,7 @@ async function readClipboardImageMac() {
41458
42058
  end try
41459
42059
  `;
41460
42060
  const { stdout } = await execAsync(`osascript -e '${script}'`);
41461
- if (stdout.includes("success") || fs17.existsSync(tempFile)) {
42061
+ if (stdout.includes("success") || fs18.existsSync(tempFile)) {
41462
42062
  return await convertFileToDataUri(tempFile);
41463
42063
  }
41464
42064
  return {
@@ -41475,14 +42075,14 @@ async function readClipboardImageLinux() {
41475
42075
  try {
41476
42076
  try {
41477
42077
  await execAsync(`xclip -selection clipboard -t image/png -o > "${tempFile}"`);
41478
- if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
42078
+ if (fs18.existsSync(tempFile) && fs18.statSync(tempFile).size > 0) {
41479
42079
  return await convertFileToDataUri(tempFile);
41480
42080
  }
41481
42081
  } catch {
41482
42082
  }
41483
42083
  try {
41484
42084
  await execAsync(`wl-paste -t image/png > "${tempFile}"`);
41485
- if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
42085
+ if (fs18.existsSync(tempFile) && fs18.statSync(tempFile).size > 0) {
41486
42086
  return await convertFileToDataUri(tempFile);
41487
42087
  }
41488
42088
  } catch {
@@ -41509,7 +42109,7 @@ async function readClipboardImageWindows() {
41509
42109
  }
41510
42110
  `;
41511
42111
  await execAsync(`powershell -Command "${psScript}"`);
41512
- if (fs17.existsSync(tempFile) && fs17.statSync(tempFile).size > 0) {
42112
+ if (fs18.existsSync(tempFile) && fs18.statSync(tempFile).size > 0) {
41513
42113
  return await convertFileToDataUri(tempFile);
41514
42114
  }
41515
42115
  return {
@@ -41522,7 +42122,7 @@ async function readClipboardImageWindows() {
41522
42122
  }
41523
42123
  async function convertFileToDataUri(filePath) {
41524
42124
  try {
41525
- const imageBuffer = fs17.readFileSync(filePath);
42125
+ const imageBuffer = fs18.readFileSync(filePath);
41526
42126
  const base64Image = imageBuffer.toString("base64");
41527
42127
  const magic = imageBuffer.slice(0, 4).toString("hex");
41528
42128
  let mimeType = "image/png";
@@ -46757,7 +47357,7 @@ var desktopTools = [
46757
47357
 
46758
47358
  // src/tools/custom-tools/resolveStorage.ts
46759
47359
  init_StorageRegistry();
46760
- function buildStorageContext(toolContext) {
47360
+ function buildStorageContext2(toolContext) {
46761
47361
  const global2 = StorageRegistry.getContext();
46762
47362
  if (global2) return global2;
46763
47363
  if (toolContext?.userId) return { userId: toolContext.userId };
@@ -46767,7 +47367,7 @@ function resolveCustomToolStorage(explicit, toolContext) {
46767
47367
  if (explicit) return explicit;
46768
47368
  const factory = StorageRegistry.get("customTools");
46769
47369
  if (factory) {
46770
- return factory(buildStorageContext(toolContext));
47370
+ return factory(buildStorageContext2(toolContext));
46771
47371
  }
46772
47372
  return new FileCustomToolStorage();
46773
47373
  }
@@ -46795,12 +47395,13 @@ function createCustomToolDelete(storage) {
46795
47395
  permission: { scope: "session", riskLevel: "medium" },
46796
47396
  execute: async (args, context) => {
46797
47397
  try {
47398
+ const userId = context?.userId;
46798
47399
  const s = resolveCustomToolStorage(storage, context);
46799
- const exists = await s.exists(args.name);
47400
+ const exists = await s.exists(userId, args.name);
46800
47401
  if (!exists) {
46801
47402
  return { success: false, name: args.name, error: `Custom tool '${args.name}' not found` };
46802
47403
  }
46803
- await s.delete(args.name);
47404
+ await s.delete(userId, args.name);
46804
47405
  return { success: true, name: args.name };
46805
47406
  } catch (error) {
46806
47407
  return { success: false, name: args.name, error: error.message };
@@ -47041,8 +47642,9 @@ function createCustomToolList(storage) {
47041
47642
  },
47042
47643
  permission: { scope: "always", riskLevel: "low" },
47043
47644
  execute: async (args, context) => {
47645
+ const userId = context?.userId;
47044
47646
  const s = resolveCustomToolStorage(storage, context);
47045
- const tools = await s.list({
47647
+ const tools = await s.list(userId, {
47046
47648
  search: args.search,
47047
47649
  tags: args.tags,
47048
47650
  category: args.category,
@@ -47078,8 +47680,9 @@ function createCustomToolLoad(storage) {
47078
47680
  },
47079
47681
  permission: { scope: "always", riskLevel: "low" },
47080
47682
  execute: async (args, context) => {
47683
+ const userId = context?.userId;
47081
47684
  const s = resolveCustomToolStorage(storage, context);
47082
- const tool = await s.load(args.name);
47685
+ const tool = await s.load(userId, args.name);
47083
47686
  if (!tool) {
47084
47687
  return { success: false, error: `Custom tool '${args.name}' not found` };
47085
47688
  }
@@ -47151,9 +47754,10 @@ function createCustomToolSave(storage) {
47151
47754
  permission: { scope: "session", riskLevel: "medium" },
47152
47755
  execute: async (args, context) => {
47153
47756
  try {
47757
+ const userId = context?.userId;
47154
47758
  const s = resolveCustomToolStorage(storage, context);
47155
47759
  const now = (/* @__PURE__ */ new Date()).toISOString();
47156
- const existing = await s.load(args.name);
47760
+ const existing = await s.load(userId, args.name);
47157
47761
  const definition = {
47158
47762
  version: CUSTOM_TOOL_DEFINITION_VERSION,
47159
47763
  name: args.name,
@@ -47172,17 +47776,17 @@ function createCustomToolSave(storage) {
47172
47776
  requiresConnector: (args.connectorNames?.length ?? 0) > 0
47173
47777
  }
47174
47778
  };
47175
- await s.save(definition);
47779
+ await s.save(userId, definition);
47176
47780
  return {
47177
47781
  success: true,
47178
47782
  name: args.name,
47179
- storagePath: s.getPath()
47783
+ storagePath: s.getPath(userId)
47180
47784
  };
47181
47785
  } catch (error) {
47182
47786
  return {
47183
47787
  success: false,
47184
47788
  name: args.name,
47185
- storagePath: resolveCustomToolStorage(storage, context).getPath(),
47789
+ storagePath: resolveCustomToolStorage(storage, context).getPath(context?.userId),
47186
47790
  error: error.message
47187
47791
  };
47188
47792
  }
@@ -47924,6 +48528,6 @@ REMEMBER: Keep it conversational, ask one question at a time, and only output th
47924
48528
  }
47925
48529
  };
47926
48530
 
47927
- 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, sanitizeToolName, 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 };
47928
48532
  //# sourceMappingURL=index.js.map
47929
48533
  //# sourceMappingURL=index.js.map