KeepLost/harniverse--packages-client-modules ↗★ 1
@deepseek-ai/dsh-client-modules
Client module system, dual-face: node half composes the __DSH_BOOT__ entry graph (incremental dsh.client scan, bundle route, index tap, webPlugins service); browser half is the lazy-CJS module table the vendored cordis Loader consumes as its internal seam 适合理解客户端插件加载机制的开发者,替换模块到达方式。
同名パッケージの別リポジトリ
- deepseek-ai/deepseek-harness--packages-client-modules
- whitelonng/dshcode--packages-client-modules
- fufankeji/deepseek-harness-studio--packages-client-modules
- op7418/pilot-harness--packages-client-modules
- See-Sol-Lab/DeepSeekGUI--packages-client-modules
- peiyuwang54/deepseek-harness-cli--packages-client-modules
インストール
検証済み bundle がないか、互換性チェックに失敗しています。先にリポジトリの説明を読んでください。 README 全文を読む ↗
ドキュメント
README 全文を読む ↗@deepseek-ai/dsh-client-modules
English | 中文
Client module system: the browser peer of Node's internal ESM loader, built as a lazy CJS table. The web shell mounts the vendored cordis Loader for entry governance (fiber lifecycle, inject waiting, update/refresh) and injects this package's ClientModuleLoader through its internal contract — the vendored side's only consumption point is EntryTree.import, so replacing internal replaces exactly "how plugin code arrives" and nothing else.
Lazy CJS model (web2): executing a plugin bundle only REGISTERS its factory (window.__ModuleLoader__.load({id, factory})); every module body side effect — CSS injection included — lives in the factory closure and runs at materialization (factory(require) → exports, memoized in loadCache), not at script execution. A factory that requires another registered-but-unmaterialized module materializes it recursively, so load order needs no external sequencing; require cycles throw (factory-form CJS cannot deliver partial exports). /client and the bare id resolve to the same exports (a plugin bundle IS its package's client half).
Resolution branch order (import(specifier)): platform seed word → shell instance; memoized record → surface; shell-own static registry (registerStatic, app-shell) → module; registered factory → materialize; graph row (window.__DSH_BOOT__) → load its external classic script + materialize; anything else throws — the runtime mirror of the build-time bundle purity gate. The synchronous require handed to factories walks the same order minus the asynchronous load branch and records observed edges into the module record. Initial boot calls prefetchGraph once for critical factories, activates the critical entries, then calls prefetchDeferredGraph in the background for deferred entries; both remain protected by the same Connection admission. prefetch(id) retains independent bundle arrival for HMR and as the fallback when aggregate registration fails. invalidate drops one factory and materialized record so the next prefetch/import reloads that plugin.
The Node half scans enabled Loader entries for web dsh.client packages, resolves each exports["./client"], hashes the built bundle into the boot graph, and serves it with its source map under /plugins only after Connection admits an harniverse.observe principal. Each client declaration may mark startup as critical or deferred; the registry caches separate graph-revision bootstrap artifacts so non-critical code cannot delay first paint. Bootstrap responses prefer Brotli, then gzip, with immutable revision caching. Initial boot therefore requires one protected critical script admission instead of one admission per bundle; the deferred script remains protected and loads after the critical UI is interactive. Individual resources and maps remain available for HMR and diagnostics. Source launch maps host imports to TypeScript source but still consumes this built client export; missing files share one build instruction followed by a package/path list, while unrelated filesystem errors remain separate failures.
Model Experience
None, as the module loader is browser-side kernel machinery; nothing here reaches a model request.
KV Cache effect
None; this package neither assembles nor sends a provider request.
Known Limitations and Deferred Work
- Flat module graph by design — every bundle is one module node whose edges point only at table leaves; the interface (
loadCache/edges/invalidate) already supports a general module graph, so the externalization granularity can change without an interface change. - No unload bookkeeping of its own — style removal and fiber teardown ordering live with the HMR driver (
@deepseek-ai/dsh-client-hmr); the loader only inventories owned style tag ids per record. - Initial aggregate has no source map — startup strips each bundle's map comment to prevent source-map request fan-out; direct and HMR-loaded per-plugin scripts retain their maps.