UNPKG

@mastra/core

Version:
249 lines (248 loc) • 6.79 kB
//#region src/workspace/errors.ts var WorkspaceError = class extends Error { code; workspaceId; constructor(message, code, workspaceId) { super(message); this.code = code; this.workspaceId = workspaceId; this.name = "WorkspaceError"; } }; var WorkspaceNotAvailableError = class extends WorkspaceError { constructor() { super("Workspace not available. Ensure the agent has a workspace configured.", "NO_WORKSPACE"); this.name = "WorkspaceNotAvailableError"; } }; var FilesystemNotAvailableError = class extends WorkspaceError { constructor() { super("Workspace does not have a filesystem configured", "NO_FILESYSTEM"); this.name = "FilesystemNotAvailableError"; } }; var SandboxNotAvailableError = class extends WorkspaceError { constructor(message) { super(message ?? "Workspace does not have a sandbox configured", "NO_SANDBOX"); this.name = "SandboxNotAvailableError"; } }; var SandboxFeatureNotSupportedError = class extends WorkspaceError { constructor(feature) { super(`Sandbox does not support ${feature}`, "FEATURE_NOT_SUPPORTED"); this.name = "SandboxFeatureNotSupportedError"; } }; var SearchNotAvailableError = class extends WorkspaceError { constructor() { super("Workspace does not have search configured (enable bm25 or provide vectorStore + embedder)", "NO_SEARCH"); this.name = "SearchNotAvailableError"; } }; var WorkspaceNotReadyError = class extends WorkspaceError { constructor(workspaceId, status) { super(`Workspace is not ready (status: ${status})`, "NOT_READY", workspaceId); this.name = "WorkspaceNotReadyError"; } }; var WorkspaceReadOnlyError = class extends WorkspaceError { constructor(operation) { super(`Workspace is in read-only mode. Cannot perform: ${operation}`, "READ_ONLY"); this.name = "WorkspaceReadOnlyError"; } }; var FilesystemError = class extends Error { code; path; constructor(message, code, path) { super(message); this.code = code; this.path = path; this.name = "FilesystemError"; } }; var FileNotFoundError = class extends FilesystemError { constructor(path) { super(`File not found: ${path}`, "ENOENT", path); this.name = "FileNotFoundError"; } }; var DirectoryNotFoundError = class extends FilesystemError { constructor(path) { super(`Directory not found: ${path}`, "ENOENT", path); this.name = "DirectoryNotFoundError"; } }; var FileExistsError = class extends FilesystemError { constructor(path) { super(`File already exists: ${path}`, "EEXIST", path); this.name = "FileExistsError"; } }; var IsDirectoryError = class extends FilesystemError { constructor(path) { super(`Path is a directory: ${path}`, "EISDIR", path); this.name = "IsDirectoryError"; } }; var NotDirectoryError = class extends FilesystemError { constructor(path) { super(`Path is not a directory: ${path}`, "ENOTDIR", path); this.name = "NotDirectoryError"; } }; var DirectoryNotEmptyError = class extends FilesystemError { constructor(path) { super(`Directory not empty: ${path}`, "ENOTEMPTY", path); this.name = "DirectoryNotEmptyError"; } }; var PermissionError = class extends FilesystemError { operation; constructor(path, operation) { super(`Permission denied: ${operation} on ${path}`, "EACCES", path); this.operation = operation; this.name = "PermissionError"; } }; var FileReadRequiredError = class extends FilesystemError { constructor(path, reason) { super(reason, "EREAD_REQUIRED", path); this.name = "FileReadRequiredError"; } }; var StaleFileError = class extends FilesystemError { expectedMtime; actualMtime; constructor(path, expectedMtime, actualMtime) { super(`File was modified externally: ${path} (expected mtime ${expectedMtime.toISOString()}, actual ${actualMtime.toISOString()})`, "ESTALE", path); this.expectedMtime = expectedMtime; this.actualMtime = actualMtime; this.name = "StaleFileError"; } }; /** * Error thrown when a filesystem operation is attempted before initialization. */ var FilesystemNotReadyError = class extends FilesystemError { constructor(id) { super(`Filesystem "${id}" is not ready. Call init() first or use ensureReady().`, "ENOTREADY", id); this.name = "FilesystemNotReadyError"; } }; //#endregion Object.defineProperty(exports, "DirectoryNotEmptyError", { enumerable: true, get: function() { return DirectoryNotEmptyError; } }); Object.defineProperty(exports, "DirectoryNotFoundError", { enumerable: true, get: function() { return DirectoryNotFoundError; } }); Object.defineProperty(exports, "FileExistsError", { enumerable: true, get: function() { return FileExistsError; } }); Object.defineProperty(exports, "FileNotFoundError", { enumerable: true, get: function() { return FileNotFoundError; } }); Object.defineProperty(exports, "FileReadRequiredError", { enumerable: true, get: function() { return FileReadRequiredError; } }); Object.defineProperty(exports, "FilesystemError", { enumerable: true, get: function() { return FilesystemError; } }); Object.defineProperty(exports, "FilesystemNotAvailableError", { enumerable: true, get: function() { return FilesystemNotAvailableError; } }); Object.defineProperty(exports, "FilesystemNotReadyError", { enumerable: true, get: function() { return FilesystemNotReadyError; } }); Object.defineProperty(exports, "IsDirectoryError", { enumerable: true, get: function() { return IsDirectoryError; } }); Object.defineProperty(exports, "NotDirectoryError", { enumerable: true, get: function() { return NotDirectoryError; } }); Object.defineProperty(exports, "PermissionError", { enumerable: true, get: function() { return PermissionError; } }); Object.defineProperty(exports, "SandboxFeatureNotSupportedError", { enumerable: true, get: function() { return SandboxFeatureNotSupportedError; } }); Object.defineProperty(exports, "SandboxNotAvailableError", { enumerable: true, get: function() { return SandboxNotAvailableError; } }); Object.defineProperty(exports, "SearchNotAvailableError", { enumerable: true, get: function() { return SearchNotAvailableError; } }); Object.defineProperty(exports, "StaleFileError", { enumerable: true, get: function() { return StaleFileError; } }); Object.defineProperty(exports, "WorkspaceError", { enumerable: true, get: function() { return WorkspaceError; } }); Object.defineProperty(exports, "WorkspaceNotAvailableError", { enumerable: true, get: function() { return WorkspaceNotAvailableError; } }); Object.defineProperty(exports, "WorkspaceNotReadyError", { enumerable: true, get: function() { return WorkspaceNotReadyError; } }); Object.defineProperty(exports, "WorkspaceReadOnlyError", { enumerable: true, get: function() { return WorkspaceReadOnlyError; } }); //# sourceMappingURL=errors-Bfv4VhVf.cjs.map