@frontmcp/utils 1.9.4 → 1.9.5

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/esm/index.mjs CHANGED
@@ -4969,7 +4969,10 @@ import {
4969
4969
  } from "#runtime-context";
4970
4970
 
4971
4971
  // libs/utils/src/storage/factory.ts
4972
+ init_memory();
4972
4973
  init_errors();
4974
+ import { getEnv as getEnv3, isProduction as isProduction2 } from "#env";
4975
+ import { getRuntimeContext as getRuntimeContext2 } from "#runtime-context";
4973
4976
 
4974
4977
  // libs/utils/src/storage/namespace.ts
4975
4978
  init_errors();
@@ -5137,8 +5140,14 @@ function createNamespacedStorage(adapter, prefix) {
5137
5140
  }
5138
5141
 
5139
5142
  // libs/utils/src/storage/factory.ts
5140
- init_memory();
5141
- import { getEnv as getEnv3, isProduction as isProduction2 } from "#env";
5143
+ var noDistributedStorageWarned = false;
5144
+ function warnNoDistributedStorage() {
5145
+ if (noDistributedStorageWarned || getRuntimeContext2().runtime === "browser") return;
5146
+ noDistributedStorageWarned = true;
5147
+ console.warn(
5148
+ "[storage] Warning: No distributed storage backend detected in production. Using in-memory storage. Set REDIS_URL, UPSTASH_REDIS_REST_URL, or KV_REST_API_URL."
5149
+ );
5150
+ }
5142
5151
  function detectStorageType() {
5143
5152
  if (getEnv3("UPSTASH_REDIS_REST_URL") && getEnv3("UPSTASH_REDIS_REST_TOKEN")) {
5144
5153
  return "upstash";
@@ -5189,11 +5198,7 @@ async function createStorage(config = {}) {
5189
5198
  const fallback = config.fallback ?? (isProduction2() ? "error" : "memory");
5190
5199
  if (type === "auto") {
5191
5200
  type = detectStorageType();
5192
- if (type === "memory" && isProduction2()) {
5193
- console.warn(
5194
- "[storage] Warning: No distributed storage backend detected in production. Using in-memory storage. Set REDIS_URL, UPSTASH_REDIS_REST_URL, or KV_REST_API_URL."
5195
- );
5196
- }
5201
+ if (type === "memory" && isProduction2()) warnNoDistributedStorage();
5197
5202
  }
5198
5203
  let adapter;
5199
5204
  try {
@@ -5855,6 +5860,14 @@ function saveMachineIdAsync(machineId) {
5855
5860
  }
5856
5861
  })();
5857
5862
  }
5863
+ function getHostname() {
5864
+ if (!isNode()) return void 0;
5865
+ try {
5866
+ return __require("os").hostname();
5867
+ } catch {
5868
+ return void 0;
5869
+ }
5870
+ }
5858
5871
  function computeMachineId() {
5859
5872
  const envMachineId = getEnvDirect("MACHINE_ID");
5860
5873
  if (envMachineId) return envMachineId;
@@ -5999,6 +6012,7 @@ export {
5999
6012
  getDetectedStorageType,
6000
6013
  getEnv2 as getEnv,
6001
6014
  getEnvFlag,
6015
+ getHostname,
6002
6016
  getMachineId,
6003
6017
  getNodeEnv,
6004
6018
  getOrCreateSecret,
package/fs/fs.d.ts CHANGED
@@ -254,13 +254,16 @@ export declare function copyFile(src: string, dest: string): Promise<void>;
254
254
  *
255
255
  * @param src - Source path
256
256
  * @param dest - Destination path
257
- * @param options - Copy options
257
+ * @param options - Copy options; `dereference` copies the files symlinks point to instead of the links,
258
+ * and `filter` returns false for a path to leave it (and, for a folder, its contents) out
258
259
  *
259
260
  * @example
260
261
  * await cp('/path/to/src', '/path/to/dest', { recursive: true });
261
262
  */
262
263
  export declare function cp(src: string, dest: string, options?: {
263
264
  recursive?: boolean;
265
+ dereference?: boolean;
266
+ filter?: (source: string, destination: string) => boolean | Promise<boolean>;
264
267
  }): Promise<void>;
265
268
  /**
266
269
  * List directory contents.
package/index.d.ts CHANGED
@@ -31,4 +31,4 @@ export { createStorage, createMemoryStorage, getDetectedStorageType, NamespacedS
31
31
  export type { StorageAdapter, NamespacedStorage, RootStorage, SetOptions, SetEntry, MessageHandler, Unsubscribe, MemoryAdapterOptions, RedisAdapterOptions, RedisHostConnectionConfig, RedisUrlConnectionConfig, RedisUrlFillInConfig, VercelKvAdapterOptions, UpstashAdapterOptions, StorageType, StorageConfig, RedisErrorListenerOptions, RedisUrlConnection, RedisUrlMerge, RedisUrlSiblingFields, CreateRedisClientOptions, ErrorEmitterClient, } from './storage';
32
32
  export { processPlatformToolCalls } from './llm';
33
33
  export type { CallToolFn, OpenAIToolCallItem, OpenAIToolResponse, ClaudeToolUseBlock, ClaudeToolResultBlock, VercelToolCallInfo, PlatformToolCallsInput, PlatformToolCallsOutput, SupportedPlatform, } from './llm';
34
- export { getMachineId, setMachineIdOverride } from './machine-id';
34
+ export { getHostname, getMachineId, setMachineIdOverride } from './machine-id';
package/index.js CHANGED
@@ -4202,6 +4202,7 @@ __export(index_exports, {
4202
4202
  getDetectedStorageType: () => getDetectedStorageType,
4203
4203
  getEnv: () => import_env2.getEnv,
4204
4204
  getEnvFlag: () => import_env2.getEnvFlag,
4205
+ getHostname: () => getHostname,
4205
4206
  getMachineId: () => getMachineId,
4206
4207
  getNodeEnv: () => import_env2.getNodeEnv,
4207
4208
  getOrCreateSecret: () => getOrCreateSecret,
@@ -5178,6 +5179,9 @@ var import_env2 = require("#env");
5178
5179
  var import_runtime_context = require("#runtime-context");
5179
5180
 
5180
5181
  // libs/utils/src/storage/factory.ts
5182
+ var import_env3 = require("#env");
5183
+ var import_runtime_context2 = require("#runtime-context");
5184
+ init_memory();
5181
5185
  init_errors();
5182
5186
 
5183
5187
  // libs/utils/src/storage/namespace.ts
@@ -5346,8 +5350,14 @@ function createNamespacedStorage(adapter, prefix) {
5346
5350
  }
5347
5351
 
5348
5352
  // libs/utils/src/storage/factory.ts
5349
- init_memory();
5350
- var import_env3 = require("#env");
5353
+ var noDistributedStorageWarned = false;
5354
+ function warnNoDistributedStorage() {
5355
+ if (noDistributedStorageWarned || (0, import_runtime_context2.getRuntimeContext)().runtime === "browser") return;
5356
+ noDistributedStorageWarned = true;
5357
+ console.warn(
5358
+ "[storage] Warning: No distributed storage backend detected in production. Using in-memory storage. Set REDIS_URL, UPSTASH_REDIS_REST_URL, or KV_REST_API_URL."
5359
+ );
5360
+ }
5351
5361
  function detectStorageType() {
5352
5362
  if ((0, import_env3.getEnv)("UPSTASH_REDIS_REST_URL") && (0, import_env3.getEnv)("UPSTASH_REDIS_REST_TOKEN")) {
5353
5363
  return "upstash";
@@ -5398,11 +5408,7 @@ async function createStorage(config = {}) {
5398
5408
  const fallback = config.fallback ?? ((0, import_env3.isProduction)() ? "error" : "memory");
5399
5409
  if (type === "auto") {
5400
5410
  type = detectStorageType();
5401
- if (type === "memory" && (0, import_env3.isProduction)()) {
5402
- console.warn(
5403
- "[storage] Warning: No distributed storage backend detected in production. Using in-memory storage. Set REDIS_URL, UPSTASH_REDIS_REST_URL, or KV_REST_API_URL."
5404
- );
5405
- }
5411
+ if (type === "memory" && (0, import_env3.isProduction)()) warnNoDistributedStorage();
5406
5412
  }
5407
5413
  let adapter;
5408
5414
  try {
@@ -6064,6 +6070,14 @@ function saveMachineIdAsync(machineId) {
6064
6070
  }
6065
6071
  })();
6066
6072
  }
6073
+ function getHostname() {
6074
+ if (!isNode()) return void 0;
6075
+ try {
6076
+ return require("os").hostname();
6077
+ } catch {
6078
+ return void 0;
6079
+ }
6080
+ }
6067
6081
  function computeMachineId() {
6068
6082
  const envMachineId = getEnvDirect("MACHINE_ID");
6069
6083
  if (envMachineId) return envMachineId;
@@ -6209,6 +6223,7 @@ function setMachineIdOverride(id) {
6209
6223
  getDetectedStorageType,
6210
6224
  getEnv,
6211
6225
  getEnvFlag,
6226
+ getHostname,
6212
6227
  getMachineId,
6213
6228
  getNodeEnv,
6214
6229
  getOrCreateSecret,
@@ -1 +1 @@
1
- export { getMachineId, setMachineIdOverride } from './machine-id';
1
+ export { getHostname, getMachineId, setMachineIdOverride } from './machine-id';
@@ -20,6 +20,8 @@
20
20
  * 2. File persistence at `.frontmcp/machine-id` (dev mode)
21
21
  * 3. Random UUID (production)
22
22
  */
23
+ /** This host's name (`os.hostname()`), read when called; `undefined` outside Node. */
24
+ export declare function getHostname(): string | undefined;
23
25
  /**
24
26
  * Get the current machine ID.
25
27
  * Returns the override (if set via `setMachineIdOverride`) or the lazily
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontmcp/utils",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "Shared utility functions for FrontMCP - string manipulation, URI handling, path utilities, and more",
5
5
  "author": "AgentFront <info@agentfront.dev>",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  "@noble/hashes": "^2.0.1"
33
33
  },
34
34
  "peerDependencies": {
35
- "@frontmcp/lazy-zod": "1.9.4",
35
+ "@frontmcp/lazy-zod": "1.9.5",
36
36
  "@upstash/redis": "^1.34.0",
37
37
  "@vercel/kv": "^2.0.0 || ^3.0.0",
38
38
  "ioredis": "^5.0.0"
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Factory function to create storage adapters with auto-detection.
5
5
  */
6
- import type { StorageConfig, StorageType, RootStorage } from './types';
6
+ import type { RootStorage, StorageConfig, StorageType } from './types';
7
7
  /**
8
8
  * Create a storage instance.
9
9
  *