Preface

The philosophy of DSH is “everything is a plugin.” In the actual maintenance of a Profile, if every business plugin enters the DSH loading path directly, plugin installation, start/stop, upgrade, and uninstallation, as well as synchronization between browser tabs, become recurring issues.

Fabric is used to solve these problems. It is DSH’s Runtime Plugin kernel and downstream SDK, with the package name @dsh-do/fabric. Below is an introduction to its positioning, core capabilities, installation methods, plugin creation process, and migration notes.

Positioning

Fabric is maintained by BingChanCN, with the repository address at https://github.com/BingChanCN/fabric.

Acting as DSH’s Runtime Plugin kernel and downstream SDK, it provides static base plugins for the Profile. Business plugins are installed, started, stopped, upgraded, and uninstalled as Runtime Packages per Profile, requiring no restart of DSH after installation.

Core Capabilities

Runtime Package Management

Fabric supports installing Runtime Packages via the Fabric Mods page or the dsh-do plugin market.

It supports the installation, upgrade, deactivation, rollback, and deletion of Runtime Packages, and synchronizes them to all browser tabs of the current Profile.

Please note that Runtime Packages are trusted native code and not a secure sandbox. The installation interface will display the source, package name, version, and a prompt to execute native code.

Author Commands

Fabric provides create-fabric-plugin and fabric create to create plugins, and offers the following author commands:

fabric build
fabric test
fabric verify
fabric dev --profile web
fabric pack

fabric dev uses a temporary overlay development mode: successful builds perform a hot swap of Host and Client for each tab; if a build or activation fails, the previous successful generation is retained.

Runtime manifest

The Runtime manifest is used to declare entry points such as host, client, and contracts. At least one of Host or Client must be provided.

Example structure:

{
  "name": "@example/jobs",
  "fabric": {
    "host": "./lib/fabric-host.js",
    "client": "./lib/fabric-client.js",
    "contracts": "./lib/contracts.js"
  }
}

Collaboration, Configuration, and Credentials

Fabric supports registering Page, Dialog, Command, HUD, Config, and Capability.

Plugins can collaborate through Capability, Resource, or Operation. Host/Client data exchange only goes through typed Resource or Operation with the identity { owner, id, exact version }.

Fabric supports typed Config. Config, Document, and Blob are stored in .fabric/data/<canonical-package>/ of the current Profile. Credentials reuse the DSH provider, and Clients can never read the plaintext.

Migrating Normal DSH Plugins

Fabric supports migration evaluation for normal DSH plugins:

fabric migrate analyze <source>
fabric migrate analyze npm:<spec>
fabric migrate analyze file:<tgz>

It also supports strict subset migration:

fabric migrate apply <source> --out <target>

Complex Host/Client behaviors must be migrated manually. Published DSH bundles will not be transpiled upon installation.

Installation

Install Fabric:

dsh plugin --profile web add @dsh-do/fabric

After installation, install Runtime Packages via the Fabric Mods page or the dsh-do plugin market.

Typical Usage

Create a plugin and enter development mode:

npx create-fabric-plugin @example/jobs
cd jobs
pnpm install
pnpm build
fabric verify
fabric dev --profile web

You can also use the fabric author commands:

fabric create @example/jobs
fabric build
fabric test
fabric verify
fabric dev --profile web
fabric pack

If pnpm verify is provided in the project, it can also be run directly:

pnpm verify

When migrating a normal DSH plugin, perform a read-only evaluation first:

fabric migrate analyze <source>

After confirming the source code belongs to a strictly migratable subset, generate the Runtime package:

fabric migrate apply <source> --out <target>

Applicable Scenarios and Notes

Fabric is suitable for DSH plugin authors, AI agent developers, and teams needing to manage Runtime Packages per Profile, synchronize browser tabs, and maintain Host/Client collaboration interfaces.

Please note the following before use:

  • Runtime Packages are trusted native code and execute native code under the permissions of the current DSH process; they are not a secure sandbox.
  • Before installation, check the source code and license. Since the verified materials do not provide license information, please refer to the actual information in the repository or release package.
  • Host/Client data exchange only goes through typed Resource or Operation with the identity { owner, id, exact version }.
  • Credentials reuse the DSH provider, and Clients can never read the plaintext.
  • Complex Host/Client behaviors must be migrated manually, and published DSH bundles will not be transpiled upon installation.

Links

Directory Page:

https://www.skillhub.cn/plugins/BingChanCN/fabric

GitHub:

https://github.com/BingChanCN/fabric