The core philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” When building a Web interface, if you want your app to support offline access and be installable on desktop or mobile devices, additional Service Worker and Manifest configuration is required. The dsh-pwa-plugin introduced below is designed to address exactly this issue.
Plugin Overview¶
This is a PWA plugin provided for DeepSeek Harness. It implements smart caching strategies via Service Worker, enabling offline access to static assets and providing a standard PWA Manifest to support installing the application as a standalone app.
The plugin is maintained by RaulLazaro and is released under the MIT license.
Installation and Activation¶
The installation process consists of three steps and requires modifying the DSH Web Profile configuration files.
- Add the dependency
Add the dependency to the package.json file of the DSH Web Profile:
{
"dependencies": {
"dsh-pwa-plugin": "file:~/workspace/dsh-pwa-plugin"
}
}
- Register the plugin
Insert the plugin configuration into the Profile’s cordis.patch.yml:
- insert:
- id: dsh-pwa
name: 'dsh-pwa-plugin'
- Restart DSH
Run the following command to restart the service:
dsh web
Core Features¶
The plugin hosts and injects the following files:
/sw.js: Service Worker script/manifest.webmanifest: PWA configuration manifest- Icon files
The plugin automatically detects and silently activates new versions without manual intervention.
Caching Strategies¶
The plugin defines differentiated caching strategies for different types of resources:
| Resource Type | Strategy | Description |
|---|---|---|
| HTML | Network-first | Always attempts to fetch the latest version |
| JS/CSS/Fonts/Images | Cache-first | Serves from cache when available |
| API calls | Not cached | Always uses network requests |
How It Works¶
- The plugin runs as a Host plugin and serves static asset files.
- The plugin injects the Service Worker registration script into the HTML.
- After the Service Worker starts, it caches static assets (including icons) for offline use.
- The Manifest file allows the browser to install the application as a PWA.
- It uses DSH’s built-in
/favicon.svgas the icon source without overriding it. - Once an update is detected, it automatically triggers a page reload to apply the new version.
Considerations¶
- HTTPS Requirement: Service Worker must run over HTTPS (
localhostexcepted). - API Limitation: Service Worker cannot cache API calls; API requests always use the network.
- Version Dependency: Requires the
@deepseek-ai/cordisversion to be^4.0.1or higher. - Update Mechanism: After a new version is detected, a page reload is required for it to take effect.