Skip to main content
The Palyra WASM Plugin system provides a high-performance, sandboxed environment for executing untrusted code. It leverages wasmtime for hardware-isolated execution and a Capability-Based Security model to restrict access to system resources such as the network, secrets, and filesystem.

WASM Plugin Runtime (palyra-plugins-runtime)

The core runtime is implemented in palyra-plugins-runtime, which manages the wasmtime engine, memory limits, and fuel consumption.

Runtime Configuration and Limits

The WasmRuntime is initialized with RuntimeLimits that enforce strict quotas on every execution crates/palyra-plugins/runtime/src/lib.rs#24-29.

Capability Host Interface

Plugins interact with the host via a WIT-style interface defined in HOST_CAPABILITIES_IMPORT_MODULE crates/palyra-plugins/runtime/src/lib.rs#4. Instead of direct access, plugins are provided with Capability Handles crates/palyra-plugins/runtime/src/lib.rs#63-68.
Handle TypeBase OffsetDescription
HTTP10,000Allowed egress hosts crates/palyra-plugins/runtime/src/lib.rs#16
SECRET20,000Keys authorized for retrieval from Vault crates/palyra-plugins/runtime/src/lib.rs#17
STORAGE30,000Filesystem prefixes for persistence crates/palyra-plugins/runtime/src/lib.rs#18
CHANNEL40,000Authorized communication channels crates/palyra-plugins/runtime/src/lib.rs#19
Sources: crates/palyra-plugins/runtime/src/lib.rs#1-108, crates/palyra-daemon/src/wasm_plugin_runner.rs#8-30

Skills and Manifests (palyra-skills)

A “Skill” is a packaged unit containing WASM modules, metadata, and a security manifest.

Skill Manifest (skill.toml)

The SkillManifest defines the identity, entrypoints, and required capabilities of the plugin crates/palyra-skills/src/models.rs.

Security Lifecycle: Audit and Quarantine

Skills undergo a multi-stage lifecycle managed by the palyrad daemon:
  1. Ingestion: The skill artifact is parsed and verified for signature integrity crates/palyra-skills/src/lib.rs#25.
  2. Audit: audit_skill_artifact_security checks for dangerous WASM exports or excessive capability requests crates/palyra-skills/src/lib.rs#12.
  3. Quarantine: New or updated skills are placed in SkillExecutionStatus::Quarantined crates/palyra-daemon/src/transport/http/handlers/console/skills.rs#169 until approved by an operator.
  4. Installation: Approved skills are indexed in the InstalledSkillsIndex crates/palyra-daemon/src/transport/http/handlers/console/skills.rs#16.

Data Flow: Plugin Execution

The following diagram illustrates the transition from a tool call request to WASM execution. WASM Execution Pipeline Sources: crates/palyra-daemon/src/wasm_plugin_runner.rs#124-154, crates/palyra-plugins/runtime/src/lib.rs#152-186, crates/palyra-daemon/src/transport/http/handlers/console/skills.rs#9-42

InstalledSkillsIndex and Persistence

The daemon maintains an index of all active skills.

Skill Status Management

The console_skills_list_handler retrieves the list of installed skills and their current operational status crates/palyra-daemon/src/transport/http/handlers/console/skills.rs#9-16.

Skill Builder (Experimental)

Palyra includes a “Dynamic Tool Builder” that can generate WASM skill scaffolds from natural language prompts or learning candidates crates/palyra-daemon/src/transport/http/handlers/console/skills.rs#67-101.

Component Association

The following table bridges the conceptual “Skill” to the internal Rust structs.
ConceptCode EntityFile
Skill IdentitySkillManifestcrates/palyra-skills/src/models.rs
Execution PolicyWasmPluginRunnerPolicycrates/palyra-daemon/src/wasm_plugin_runner.rs#18-30
Resource AccessCapabilityGrantSetcrates/palyra-plugins/runtime/src/lib.rs#43-48
Runtime InstanceWasmRuntimecrates/palyra-plugins/runtime/src/lib.rs#105-108
Module ResolutionResolvedInstalledSkillModulecrates/palyra-daemon/src/wasm_plugin_runner.rs#113-122
Sources: crates/palyra-daemon/src/wasm_plugin_runner.rs#113-122, crates/palyra-daemon/src/transport/http/handlers/console/skills.rs#9-184, crates/palyra-skills/src/manifest.rs#12-17