dsh-share-html 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/kernel.js +15 -9
  2. package/package.json +1 -1
package/lib/kernel.js CHANGED
@@ -1564,14 +1564,19 @@ main { display: flex; flex-direction: column; gap: 28px; }
1564
1564
  word-break: break-word;
1565
1565
  }
1566
1566
 
1567
+ /* \u6D88\u606F\u5934\u90E8\uFF1A\u6A21\u578B\u540D\u653E\u5DE6\u4FA7\uFF0C\u4E0E DSH \u539F\u4F1A\u8BDD\u4E00\u81F4\u3002
1568
+ \u6CA1\u6709\u6A21\u578B\u4FE1\u606F\u65F6\u6574\u4E2A header \u4E0D\u6E32\u67D3\uFF0C\u4E0D\u7559\u7A7A\u884C\u3002 */
1569
+ .msg-head {
1570
+ display: flex;
1571
+ align-items: center;
1572
+ min-height: 24px;
1573
+ margin-bottom: 2px;
1574
+ }
1575
+
1567
1576
  .msg-model {
1568
- margin-top: 6px;
1569
1577
  color: var(--dsh-label-tertiary);
1570
1578
  font-size: 12px;
1571
1579
  line-height: 18px;
1572
- display: flex;
1573
- gap: 10px;
1574
- flex-wrap: wrap;
1575
1580
  font-variant-numeric: tabular-nums;
1576
1581
  }
1577
1582
 
@@ -2008,14 +2013,18 @@ function renderHtml(model, meta = {}) {
2008
2013
  body.push(renderUserMessage(turn.user));
2009
2014
  }
2010
2015
  const assistantBlocks = [];
2016
+ const turnModels = [];
2011
2017
  for (const msg of turn.assistants) {
2012
2018
  stats.messages += 1;
2013
2019
  stats.toolCalls += msg.blocks.filter((b) => b.kind === "tool").length;
2020
+ if (msg.model && !turnModels.includes(msg.model)) turnModels.push(msg.model);
2014
2021
  assistantBlocks.push(renderAssistantMessage(msg));
2015
2022
  }
2016
2023
  if (assistantBlocks.length) {
2024
+ const head = turnModels.length ? `<header class="msg-head"><span class="msg-model">${turnModels.map(esc).join(" \xB7 ")}</span></header>
2025
+ ` : "";
2017
2026
  body.push(`<article class="msg" data-role="assistant">
2018
- ${assistantBlocks.join("\n")}
2027
+ ${head}${assistantBlocks.join("\n")}
2019
2028
  </article>`);
2020
2029
  }
2021
2030
  }
@@ -2126,9 +2135,6 @@ function renderAssistantMessage(msg) {
2126
2135
  for (const block of msg.blocks) {
2127
2136
  parts.push(renderBlock(block));
2128
2137
  }
2129
- if (msg.model) {
2130
- parts.push(`<div class="msg-model"><span>${esc(msg.model)}</span></div>`);
2131
- }
2132
2138
  return parts.filter(Boolean).join("\n");
2133
2139
  }
2134
2140
  function renderBlock(block) {
@@ -2330,7 +2336,7 @@ function filenameStamp(epochMs, timeZone) {
2330
2336
  }
2331
2337
 
2332
2338
  // src/host/index.ts
2333
- var VERSION = "0.2.0";
2339
+ var VERSION = "0.2.1";
2334
2340
  function exportSession(input) {
2335
2341
  const preset = input.preset ?? "conversation";
2336
2342
  const opts = shareOptions(preset, input.options ?? {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-share-html",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Export a DSH session as one self-contained, offline HTML file that looks like the original conversation: three detail presets, per-block switches, built-in redaction, zero scripts and zero external requests.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",