Truncates text to a character budget, appending a marker (and a note that the full detail is on the clipboard) when it has to cut.
Collects a full diagnostics snapshot. When called with a specific error, its
message and stack lead the report; otherwise the report is "manual" and the
ring buffer of recent exceptions stands in for the stack.
Formats the always-short environment block (fits any URL budget).
Formats the unbounded part — the primary stack, recent exceptions, and any extra payload. This is what gets truncated to fit a URL budget.
Formats the complete diagnostics — metadata plus logs — for the review dialog and the clipboard.
Builds a prefilled GitHub issue-form URL. Because a template is set, GitHub
prefills by field id (version, diagnostics, logs) rather than body.
The logs field is shrunk last so the whole URL stays within the configured
character budget.
Builds a prefilled Google Form viewform URL. Field ids come from
config.json (report.googleForm.entries); the logs value is truncated to
the form-specific budget (Google Forms drops prefills on very long URLs).
Opens a URL in a new browser tab, using chrome.tabs.create inside the
extension and falling back to window.open elsewhere.
Optional caller-supplied context attached to a report.
A fully-assembled diagnostics snapshot, ready to render into a report.