dsh-uno-office-win
LibreOffice (UNO) office engine for DeepSeek Harness, ready for Windows, with full
Writer formatting. Fork of dsh-uno-office
(MIT), see Credits below.
The plugin is installed in the DSH profile, so it works in every workspace — the tools accept absolute paths and do not depend on the current working directory.
Tools
| Tool | Purpose |
|---|---|
lo_status |
Show python, soffice, port, profile and connection state. Run this first. |
lo_create |
Create docx/odt (Writer), xlsx/ods (Calc), pptx/odp (Impress). |
lo_read |
Read paragraphs/styles plus tables and graphics; detail:true adds formatting. |
lo_edit |
Replace text, append blocks, change page/header/footer/styles, format a paragraph, update TOC; Calc and Impress ops. |
lo_convert |
Export to PDF or convert between formats. |
lo_review_export / lo_review_import |
Human-in-the-loop editing round-trip. |
lo_shutdown |
Stop the shared headless LibreOffice instance. |
Writer spec (short version)
{
"page": {"size": "A4", "orientation": "portrait",
"margins_cm": {"top": 2, "bottom": 2, "left": 2.5, "right": 1.5},
"header_cm": 1.0, "footer_cm": 1.0},
"defaults": {"name": "Times New Roman", "size_pt": 12, "color": "#1F1F1F"},
"styles": [{"name": "Body", "based_on": "Standard",
"font": {"name": "Times New Roman", "size_pt": 12},
"paragraph": {"align": "justify", "line_spacing": 1.15,
"first_line_indent_cm": 1.25, "space_after_pt": 6}}],
"header": {"text": "Report", "align": "right", "page_number": true,
"separator_line": true, "font": {"size_pt": 9, "italic": true}},
"footer": {"text": "Page", "align": "center", "page_number": true},
"blocks": [
{"type": "title", "text": "Title"},
{"type": "subtitle", "text": "Subtitle"},
{"type": "heading", "level": 1, "text": "Section"},
{"type": "paragraph", "style": "Body", "runs": [
{"text": "plain "}, {"text": "bold red", "bold": true, "color": "#C00000"}]},
{"type": "list", "ordered": false, "items": ["one", "two"]},
{"type": "table", "header": true, "header_bg": "#DCE6F1",
"rows": [["A", "B"], ["1", "2"]]},
{"type": "image", "path": "C:\\\\abs\\\\picture.png", "width_cm": 10, "caption": "Fig. 1"},
{"type": "rule"},
{"type": "page_break"},
{"type": "toc", "title": "Contents", "levels": 3}
]
}
Font keys: name, size_pt, bold, italic, underline (single/double),
strikeout, color, highlight, uppercase, small_caps, superscript,
subscript.
Paragraph keys: align, line_spacing, space_before_pt, space_after_pt,
first_line_indent_cm, left_indent_cm, right_indent_cm, keep_with_next.
content.paragraphs (string, {text, style} or {text, heading}) is still accepted
for compatibility.
Margins, header and footer
margins_cm.top/.bottom are the body margins in Word terms; header_cm/footer_cm
are the distances from the page edge to the header/footer. LibreOffice stores the
header inside its top margin, so the bridge pins a fixed header line height and
recomputes HeaderBodyDistance to make the exported Word margins exact.
Requirements and runtime notes
- LibreOffice (any recent version) with its bundled
program\python.exe, which must be able toimport uno. The bridge also looks at%ProgramFiles%,%ProgramFiles(x86)%,%LOCALAPPDATA%\Programs, and the Windows registry. sofficeruns headless on127.0.0.1:2002(override withDSH_UNO_PORT) using an isolated profile in%USERPROFILE%\.dsh\office-kit\uno-profile, so it does not clash with a LibreOffice window you have open.- The bridge speaks JSON in UTF-8 on both stdin and stdout, whatever the Windows
ANSI code page is, so Cyrillic,
Σ,Δ,≤,→and friends survive the round-trip.PYTHONIOENCODING/PYTHONUTF8are set for the child by the bundle. - If a document is open in another LibreOffice window (a
.~lock.<name>#file exists),lo_read/lo_edit/lo_convertretry it read-only instead of failing; if the load still fails you get a message naming the lock file. DSH_UNO_PYTHON,DSH_UNO_SOFFICE,DSH_UNO_PROFILEoverride detection.- The first call after a restart starts LibreOffice (a few seconds); later calls reuse it.
Enabling and disabling
The plugin is a normal DSH bundle:
- Plugins page → the
dsh-uno-office-winrow → toggle it off. The tools disappear from the agent and the bundledctx.effectcleanup stops the headless soffice, so nothing keeps running in the background. - Toggle it back on (or reinstall with
plugin_manager) to get the tools again. - The original
dsh-uno-officebundle stays installed but disabled; the two do not share tool names (dsh-uno-officeusesuno_*, this fork useslo_*), so both can even be enabled at the same time.
Known limitations
widths_cmon tables is best-effort: headless LibreOffice normalises writer table column separators on export, so exported columns may end up equal.- No merged table cells, different headers per page parity, columns, footnotes, hyperlinks or SmartArt yet.
- A TOC is exported as a Word field; Word may ask to update fields on open.
- Round-tripping an existing Word document through LibreOffice can alter exotic features.
- The header/footer line height is fixed to keep margins deterministic; keep header text to one line.
Credits
Derived from dsh-uno-office (MIT), which itself wraps LibreOffice UNO. This fork adds
Windows discovery, an isolated profile, and the Writer formatting engine.
No comments yet. Be the first to write one.