Phials developer documentation
User guide
AI Notice: Most documentation right now was auto-generated by an LLM. Handwritten documentation will be implemented over time on the road to 1.0

Public plugin API contract (v1)

This document defines the supported API contract for community plugins. The SDK types and manifest definitions in the phials-plugin-example repository under sdk/ serve as the single source of truth for plugin development.

See also: Getting started, Plugin types overview, Type references, Community plugins, and Plugin overview.


Trust and security model

Community plugins execute in the same renderer process as Phials. The dynamic import() of your main.js bundle runs within the application window and has access to browser APIs. Phials does not enforce sandboxing or process-level isolation in the current version.

To help users manage permissions, Phials gates certain capabilities on the PluginAPI instance passed to your plugin:

  • api.invoke: Restricted to Tauri command names matching your declared manifest permissions.
  • api.clipboard: Methods require clipboard permissions in the manifest.
  • api.fetch: Access requires the network.fetch permission in the manifest.

These manifest permissions exist to clarify plugin capabilities and inform users of potential risks. They do not sandbox your code or prevent direct access to global browser APIs (such as the browser’s native fetch or direct DOM manipulation).


Versioning and compatibility

Manifest fields

FieldRequirementDescription
versionRequiredSemver string representing the plugin version.
minAppVersionRequiredMinimum Phials application version required. Phials will not load the plugin if the application version is lower.
pluginApiVersionOptional (default: 1.0.0)Version of the public API contract the plugin uses. Phials will not load the plugin if the application’s API version is lower than this value.

Set minAppVersion to the earliest version of Phials that supports the features your plugin relies on. Set pluginApiVersion to the API version your plugin is compiled against.

Semver rules

  • Plugin version: Follow semantic versioning for your plugin releases.
  • minAppVersion: Specify the lowest Phials version that supports the APIs and behaviors your plugin uses.
  • pluginApiVersion: Increments represent API compatibility:
    • Major version changes indicate breaking contract modifications (such as renamed types or altered callback signatures).
    • Minor version changes indicate additive features (such as new optional fields or new event types).
    • Patch version changes represent non-breaking clarifications or documentation updates.

Additive vs breaking changes

  • Additive changes: New optional properties, new event names, new permitted Tauri commands, or new provider capabilities that older application builds can safely ignore.
  • Breaking changes: Renaming or deleting types, adding required manifest fields, narrowing permissions, or changing callback parameters.

Current behavior

Phials validates minAppVersion against the running application version, and pluginApiVersion against the supported API contract. If your manifest requests the filesystem.write permission, the corresponding read commands are automatically allowed. The network.fetch permission gates the api.fetch utility, and the shell.execute permission is unsupported.


API types classification

Stable public API types

The following types are defined in sdk/plugin-types.generated.d.ts in the example repository. These files are auto-generated and should not be edited manually.

CategoryTypes
ContainerPhialsPlugin
ProvidersPluginProvider, ProviderType
PreviewPreviewProvider, PreviewProviderProps, ThumbnailProviderProps, FullscreenProviderProps
Context (legacy)ContextProvider, ContextProviderItem, ContextProviderCategory, ContextItemContext, ItemShortcutConfig (prefer commands for new work)
MetadataMetadataProvider, RawMetadata, ExtractedMetadata, FileMetadata, MetadataSchemaField, MetadataSchema, MetadataColumnPolicy, DirectoryMetadataProfileOptions, MetadataProviderDirectoryStats, DirectoryMetadataProfile
Toolbar (legacy)ToolbarButtonProvider, ToolbarContext, ToolbarSubToolbarProps, ToolbarButtonDefinition, ToolbarButtonGroupDefinition, ToolbarButtonDropdownDefinition, ToolbarDropdownItem (prefer commands with toolbar placement)
ViewFileBrowserViewProvider, FileBrowserViewProps, ViewColumnDefinition
ThemeThemeProvider, ThemeVariables (re-exports Phoundry UI theme structures)
Selection (deprecated)SelectionProvider, SelectionContext, SelectionProviderItem
ModuleModuleProvider, ModuleProviderProps
Settings / DatabasePluginSettingsSchema, SettingsField, SettingsFieldType, BooleanSettingsField, StringSettingsField, NumberSettingsField, SelectSettingsField, PathSettingsField, PluginDatabaseSchema, PluginTableDefinition, PluginColumnDefinition, PluginIndexDefinition, PluginColumnType
APIsPluginAPI, PreviewAPI, ContextAPI, MetadataAPI, SelectionActionAPI, PluginSettings, PluginStorageAPI, PluginDatabaseAPI, DatabaseExecuteResult, ReadonlyAppSettings, ModalAPI, NotifyAPI, FileUtilsAPI, FileMatchAPI, EventsAPI, SelectionAPI, ClipboardAPI, FileOpsAPI, SelectionFileOpsAPI

The community PluginAPI may also expose optional clipboard and fetch fields if requested in your manifest. These are part of the runtime surface even if they are not defined statically on the base type interface.

Command types

Command types are defined in sdk/command-types.generated.d.ts:

Types
CommandContextKey, CommandContext, CommandShortcut
CommandPlacementArea, CommandPlacementBase, ToolbarPlacementConfig, HeaderBarPlacementConfig, ContextMenuPlacementConfig, SelectionBarPlacementConfig, CommandPlacement
Command, CommandProvider

Deprecated and legacy-preferred types

SurfaceStatusRecommended approach
SelectionProviderDeprecatedUse CommandProvider with defaultPlacements containing selectionBar placements. See Selection providers.
ToolbarButtonProviderLegacyUse CommandProvider with toolbar placements. See Toolbar providers.
ContextProviderLegacyUse CommandProvider with contextMenu placements and CommandShortcut. See Context providers.

All provider type discriminants are supported for backward compatibility. New features should use the command type unless explicitly documented otherwise.

Internal types (do not use in plugins)

The following types represent internal host UI components. They are not part of the public SDK contract and cannot be imported or used in community plugins:

Internal nameDescription
PluginRegistrationHost activation record.
CommandRegistration, ToolbarCommandItem, HeaderBarCommandItem, SelectionBarCommandItemUI command wiring.
ContextMenuUserItem, ContextMenuUserConfig, ToolbarUserItem, ToolbarUserConfig, HeaderBarUserConfig, CommandSettingsPersisted layouts and user configurations.

SDK folder layout

The template repository contains the following definition files under the sdk/ folder:

File in sdk/Description
plugin-types.generated.d.tsStable public and deprecated provider, container, and settings types.
command-types.generated.d.tsStable command and placement definitions.
file-types.generated.d.tsFile model types, including FileEntry and FileCategory.
shortcuts-types.generated.d.tsShortcut mappings and definitions.
events-types.generated.d.tsEvent bus maps and handlers. Authors can augment PluginEvents to register custom events.
pane-context.stub.d.tsType-only stub for CommandContext.pane.
manifest-schema.tsHelpers for validation and manifest schema definitions.

UI and Svelte imports

  • Previews and command components can use Component and Snippet from the svelte package.
  • The Phoundry UI library exports ToastEntry (used on Command.toastData) and styling structure definitions.

Unsupported surfaces

The following surfaces are internal and not supported for community plugins:

  • Tauri command payloads not documented on PluginAPI.
  • The global application core singleton beyond what is exposed on CommandContext or provider properties.

Provider type documentation

typeLink
previewpreview.md
contextcontext.md
metadatametadata.md
toolbartoolbar.md
viewview.md
themetheme.md
selectionselection.md
modulemodule.md
commandcommand.md

Experimental surfaces

There are no experimental surfaces exposed in the current API version. Any API or type not explicitly documented in the SDK or this contract is unsupported.