In the plugin-based architecture of DeepSeek Harness (DSH), the dsh-router-loomy plugin provides a solution for integrating the iFlytek Loomy Office Assistant cloud channel as a supplier into dsh-router. Following the isomorphic paradigm of dsh-router-traework, this plugin wraps Loomy’s interface into an OpenAI-compatible format for unified management by the DSH core.
Core Features¶
This plugin primarily addresses the problem of integrating the local Loomy client’s login session into the cloud channel. Its core capabilities are as follows:
- OpenAI Chat Completions Compatible: Provides a single endpoint
POST /chat/completions, fully compatible with OpenAI’s request and response formats, supporting SSE streaming responses. - Automatic Login Session Acquisition: No manual credential pasting required—the plugin automatically reads the
userData/auth-session.jsonfile saved locally after the Loomy client logs in. - Unified Route Management: The plugin only exposes differentiated logic (such as
status,listModels,generateLoginUrl, etc.); common capabilities like account selection, cooldown, account switching, aliases, model enable status, and credit caching are uniformly managed by the dsh-router core. - Upstream Truncation Detection: To address the issue of silent upstream truncation (sending
[DONE]without returningfinish_reason), the plugin implements theguardUpstreamStreamfinishing validation logic.
Installation and Activation¶
The plugin is installed via npm.
npm install dsh-router-loomy
After installation, the plugin needs to be registered in the Profile configuration. Add 'dsh-router-loomy' to the dsh.profile.bundles field in the Profile’s package.json:
{
"dsh": {
"profile": {
"bundles": [
"dsh-router-loomy"
]
}
}
}
After restarting the DSH process, if the log shows [dsh-router-loomy] registered router.suppliers: loomy, the installation was successful.
Login and Credential Acquisition¶
Loomy credentials are not stored on a web page but in a file generated by the local client after login. This plugin obtains the login session by launching the local client and reading the file.
- In the dsh-router panel’s Loomy card, click “Add Link”.
- The plugin will automatically launch the local Loomy client and provide a link to the “Client Status Page”.
- Complete login in the popped-up client window.
- Return to the panel and click “Finish Adding”. The plugin will read
auth-session.jsonand complete account registration.
If the client was previously logged in, the panel will automatically scan the file and display the account without requiring repeated operations. For cases where the client path cannot be automatically detected, you can specify the path by setting the environment variable LOOMY_CLIENT_EXE.
Upstream Contract and Truncation Handling¶
The upstream endpoint connected by the plugin is POST https://loomyad.xunfei.cn/api/v1/chat/completions. Requests must carry specific tracing headers (such as traceparent, chatid, msgid, loomy-version, invokeorigin).
The upstream response uses SSE streaming format, with the final frame containing usage information (including points_consumed). Note that the upstream sometimes silently sends data: [DONE] before generation is complete without providing a finish_reason. The plugin handles this as follows:
- Normal Completion: If
finish_reasonis present along with body content or tool calls, the stream passes through directly. - Truncation Detection: If no
finish_reasonexists andcompletion_tokens < max_tokens, the plugin intercepts[DONE], triggers a core error, and automatically retries (retry resends the entire context, which is costly). - Length Truncation: If no
finish_reasonexists butcompletion_tokens >= max_tokens, the plugin directly appends a frame withfinish_reason: "length"and passes it through.
Notes¶
- Dependency Environment: The plugin depends on
@deepseek-ai/cordisandcordis(injected by the host). Node.js version 20 or above is required. - Retry Cost: Since the truncation detection retry logic resends the entire context, it may result in high credit consumption. After two consecutive truncations on the same account, the plugin will stop retrying and mark it as length truncation.
- License: This plugin is licensed under the MIT License.
Related Links¶
- Plugin Directory: https://www.skillhub.cn/plugins/2404723600/dsh-router-loomy
- GitHub Repository: https://github.com/2404723600/dsh-router-loomy