Workspace System
Tightly control filesystem access and logic execution for plugins through enterprise-grade sandboxing.
Authorization via Config
Plugin permissions are explicitly authorized in xypriss.config.jsonc under the $internal key.
{
"$internal": {
"@my-org/my-plugin": {
"__xfs__": {
"path": "ROOT://.private/plugin-data",
}
}
}
}Path Resolution Anchors
The path resolver enforces explicit semantic anchors to prevent unauthorized traversal.
Resolves relative to the Global Project Root. Shifts to Plugin Root when called within a plugin.
Resolves relative to the active execution directory. Use with extreme caution as it grants host-level access.
Accessing Workspaces
Plugins retrieve their authorized filesystem instance from the global __sys__ API.
export function initMyPlugin() {
const workspaceFS = __sys__.plugins.get("@my-org/my-plugin");
if (!workspaceFS) {
throw new Error("Plugin not authorized");
}
// Trapped within the assigned sandbox
const files = workspaceFS.fs.lsDirs(".");
}Multi-Tenant Isolation
Caller-Aware Resolution: Anchors like ROOT:// adapt automatically based on whether the caller is the host app or a specific plugin.
Env Sandboxing: Plugins can only "see" environment variables defined in their own .env files.
Master the art of building scalable and secure plugins for XyPriss.
