The document bridge
The assistant does not edit files on disk. It works on the document that is open in LibreOffice, through LibreOffice's UNO interface. The document bridge is the helper that makes this possible.
How it works
- The bridge is a separate process. It starts the first time the assistant needs the document and then stays running.
- It runs under LibreOffice's own Python and talks to LibreOffice on local port 2002.
- The assistant sends it one request at a time as a line of JSON. The bridge runs the request against the open document and replies.
- Only your computer can reach this connection.
Recovery
The bridge restarts itself when something goes wrong.
- It restarts when its connection to LibreOffice is lost, or after 3 failed requests in a row because no document was open.
- When LibreOffice refuses or resets the connection, it waits 0.5 seconds, then 1 second, before trying again.
- Restarts because no document was open, or because LibreOffice closed the connection, are limited to 3 in 60 seconds.
- A request that gets no answer after 110 seconds is treated as hung, and the bridge process is stopped. This is what happens when LibreOffice is waiting on a dialog.
The bridge can only restart itself. It cannot restart LibreOffice.
When LibreOffice is blocked by a dialog
A dialog that is open in LibreOffice, such as a save prompt or a file picker, stops it from answering the bridge. After three requests in a row time out, the assistant stops and the sidebar says LibreOffice stopped responding and should be restarted.
- Look for an open dialog, which may be behind other windows.
- Close or answer it.
- Send your request again.
If LibreOffice has crashed, the same message appears. Restart OfficeLabs.
If this keeps happening, check that no other program uses ports 8766 or 2002. See also Troubleshooting.