Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Skip empty trailing runs when replacing text

Fei241159a58491f4a3
diff --git a/ds-bot/office.js b/ds-bot/office.js
index 45fb804e..b4a195d0 100644
--- a/ds-bot/office.js
+++ b/ds-bot/office.js
@@ -7693,7 +7693,7 @@ function replaceInDoc(doc, re, withText) {
if (m.index >= rs && m.index < rend) pieces.push({ repl: expand(m, withText) });
pos = ce;
}
- pieces.push({ text: texts[i].slice(pos) });
+ if (pos < texts[i].length || pieces.length === 0) pieces.push({ text: texts[i].slice(pos) });
const run = runs[i];
let anchor = run;
for (const [k, piece] of pieces.entries()) {
diff --git a/ds-bot/src/office/docx.js b/ds-bot/src/office/docx.js
index 680a2c64..a1241ac6 100644
--- a/ds-bot/src/office/docx.js
+++ b/ds-bot/src/office/docx.js
@@ -361,7 +361,7 @@ function replaceInDoc(doc, re, withText) {
if (m.index >= rs && m.index < rend) pieces.push({ repl: expand(m, withText) })
pos = ce
}
- pieces.push({ text: texts[i].slice(pos) })
+ if (pos < texts[i].length || pieces.length === 0) pieces.push({ text: texts[i].slice(pos) })
const run = runs[i]
let anchor = run
for (const [k, piece] of pieces.entries()) {
diff --git a/ds-bot/src/office/pptx.js b/ds-bot/src/office/pptx.js
index 1670425b..3d177b85 100644
--- a/ds-bot/src/office/pptx.js
+++ b/ds-bot/src/office/pptx.js
@@ -368,7 +368,6 @@ export function pptxClean(pkg, { dryRun = false } = {}) {
if (!xml.includes(`"${id}"`) && !xml.includes(`'${id}'`)) map.delete(id)
}
}
- // Slides not in sldIdLst.
// Slides not in sldIdLst — pptx only; docx/xlsx have no presentation part.
const listed = new Set(pkg.parts.has('ppt/presentation.xml') ? deckOrder(pkg).map(e => e.part) : [])
for (const part of slideParts(pkg)) {