Introduction¶
In DSH’s session flow, once a user message is sent, subsequent content is usually appended to the session log. For scenarios requiring correction of the prompt or regenerating a reply based on the same context, directly editing the historical message and regenerating is more convenient.
dsh-plugin-edit-regenerate is a DSH plugin designed to handle this flow: it confirms the modification under the user message, discards content after that message, and regenerates from the modified prompt.
What is This¶
The positioning of dsh-plugin-edit-regenerate is: editing a user message in the DSH session history and regenerating subsequent replies based on the modified prompt.
It is suitable for scenarios where you need to correct a user prompt mid-conversation rather than creating a new session from scratch. The plugin implements “edit and regenerate” via forking, leaving the original session unchanged.
This plugin uses the MIT license. The repository address is:
https://github.com/ExploringBB/dsh-edit-regenerate
No maintainer information was explicitly declared in this documentation, only the repository address was provided.
Core Features¶
Below are the verified capabilities.
- Provide a “✎ Edit” entry under the user message.
- After confirming the modification, discard content after that message and regenerate from the modified prompt.
- Non-first message: Fork a new sub-session at the end of the previous turn.
- First message: Create a blank new session in the same workspace and use the modified text as the opening prompt.
- Retain the original “⧉ Copy” action on the user message, coexisting with the edit button.
- Register Cordis service
editRegenerateand override theusermessage renderer on the browser side.
Please note that attachments will not be preserved. Messages with attachments will be resent as plain text after modification.
Installation and Enablement¶
Installation is distinguished by DSH profiles. desktop and web are independent of each other; installing to one profile does not affect the other.
If using DSH Desktop, install to the desktop profile:
dsh plugin --profile desktop add file:./dsh-plugin-edit-regenerate
If using the official launcher / CLI, i.e., dsh web, install to the web profile:
dsh plugin --profile web add file:./dsh-plugin-edit-regenerate
Manual installation is also possible. The steps are:
- Add
dsh-plugin-edit-regeneratetodsh.profile.bundles. - Add
file:<absolute path>to thedependenciesinpackage.jsonof that profile. - Run
pnpm installin that profile directory.
After installation or update, DSH needs to be restarted to take effect.
If the plugin source code is updated later, the file: dependency copy installed in the profile may not update automatically. You need to refresh that copy, or run in the corresponding profile directory:
pnpm install --force
After refreshing or updating, restart DSH again.
Typical Usage¶
Below is the basic usage documented.
- Install the plugin and restart DSH.
- Find the user message in the session that needs modification.
- Click “✎ Edit” under the user bubble.
- Confirm the modification.
- The plugin will discard content after that message and regenerate from the modified prompt.
If modifying a non-first user message, the plugin will fork a new sub-session at the end of the previous turn, leaving the original session unchanged.
If modifying the first user message, the plugin will create a blank new session in the same workspace and use the modified text as the opening prompt.
The original “⧉ Copy” action on the user message is still retained, existing alongside the “✎ Edit” button.
Applicable Scenarios and Notes¶
This plugin is suitable for users who wish to correct a user prompt within an existing session and regenerate replies based on the corrected prompt. It does not change the original session but generates a new session path through forking.
Pay special attention to the following points when using:
- The plugin runs with the current DSH process permissions; you should check the source code and license before installing.
- Messages with attachments will be resent as plain text after modification; attachments will not be preserved.
- DSH’s session storage is append-only; it cannot be truncated in place. The plugin implements edit-and-regenerate by forking.
- The
desktopandwebprofiles are independent of each other and need to be installed separately according to the actual usage method. - After changing configuration, installing, or updating, DSH needs to be restarted to take effect.
- After updating the source code, the
file:dependency copy in the installed profile may not update automatically. You need to refresh the copy or runpnpm install --force.
If the forked session fails to load after restarting DSH, you can stop DSH first, then run:
node scripts/repair-session-logs.mjs
Conclusion¶
dsh-plugin-edit-regenerate solves a very specific problem: modifying an already sent user message in a DSH session and regenerating subsequent content based on the modified prompt. It avoids directly altering the original session by forking the session, while retaining the copy action on the user message, making it suitable as a prompt correction tool in daily development.
GitHub repository:
https://github.com/ExploringBB/dsh-edit-regenerate
No verified community directory page address was provided in this documentation.