Skip to content

v1.6.1 — fix: v0–v3 tool results were mismatched

Choose a tag to compare

@hoshF hoshF released this 03 Oct 16:34
· 11 commits to main since this release

A Export MD button in the DSH Web session header that writes the current
conversation to a file chosen through the native save dialog, plus a CLI over
the same renderer. A toast then names the file that was written, or carries the
reason if it failed.

It reads session logs directly from disk, multi-frame zstd included, and handles
v0, v3 and v4 — each verified against real logs. Formats v1 and v2 exist in DSH's codec chain but were never observed here, so they are not claimed as tested. That is what makes it work
on DSH 0.2.x where other export plugins fail on the version gate, the session
format, or the decompression.

Requires Node 22.15+. The node:zlib zstd API does not exist in Node 20 or 21.

After installing or updating, restart DSH and hard-refresh the page
(⌘⇧R / Ctrl+Shift+R). An ordinary reload can serve the client bundle the
browser cached from the previous version.

Install

Open Plugins in the DSH sidebar → Add plugin → paste
https://github.com/hoshF/dsh-md-export → restart DSH. Or clone and run
./install.sh.


Fixed

  • Tool results in v0–v3 sessions never matched their calls. Those formats wrap
    a result in a tool-result block carrying the call id and the error flag one
    level deeper than v4 does, and only the v4 shape was read. Nothing crashed,
    which is what made it bad: every result failed to match, so each tool appeared
    twice in the document — once with an empty body and once as
    (未匹配的工具结果) — tool output was lost entirely, failed calls were
    reported as successful, and search sources inside those results never reached
    ### References.

    Measured on this machine before the fix: 4,552 results across 56 old-format
    sessions, of which 4,552 were unmatched, 0% carried output and 0 carried an
    error flag. After: 4,552 matched, 100% with output, 71 error flags, 0 orphans.

  • A result arriving after the next user turn no longer goes unmatched. The
    call-id lookup tables were rebuilt on every user message, so a result written
    later — a long-running tool, an approval flow — could not find its call. callIds
    are unique within a session, so the tables now persist for the whole session.
    This removed 32 stray unmatched entries from current-format sessions.

Changed

  • docs/FORMAT.md had both of these wrong. It promised a stderr warning and an
    "incomplete" mark for version < 3 that the code has never emitted, and it
    asserted that v0–v2 kept message content only in chunk rows. Real v0 logs carry
    the finalized rows as well, so no such warning was ever needed. The document now
    states the actual policy — no version gate, rows dispatched by shape — and
    records the one real gap: steps interrupted before a finalized message was
    written, whose partial reasoning exists only as chunks.