@ouro.bot/cli 0.1.0-alpha.506 → 0.1.0-alpha.507

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.
package/changelog.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.507",
6
+ "changes": [
7
+ "Drop the second of two consecutive assistant messages with byte-identical content in `repairSessionMessages`. The existing back-to-back-assistant repair concatenated content with `\\n\\n`, which produced visible duplicate text on the surface when the second message was a retry/double-persist artifact (a common shape when a turn is interrupted mid-save and re-emitted).",
8
+ "Behavior change is narrow: trim-equality only, both sides must have non-empty content, and the second assistant must not have its own tool_calls. Different content still concatenates (legitimate continuation). Empty-content assistants still concatenate (the existing test case for null+undefined is preserved). Emits `mind.session_duplicate_assistant_dropped` (info) with the count so #622 (nerves-review) can show how often it fires in real traffic. 2 new tests cover the dedup path and the no-false-positive case (different content concatenates as before)."
9
+ ]
10
+ },
4
11
  {
5
12
  "version": "0.1.0-alpha.506",
6
13
  "changes": [
@@ -355,18 +355,37 @@ function repairSessionMessages(messages) {
355
355
  if (violations.length === 0)
356
356
  return normalized.map(toProviderMessage);
357
357
  const result = [];
358
+ let duplicateAssistantsDropped = 0;
358
359
  for (const msg of normalized) {
359
360
  if (msg.role === "assistant" && result.length > 0) {
360
361
  const prev = result[result.length - 1];
361
362
  if (prev.role === "assistant" && prev.toolCalls.length === 0) {
362
363
  const prevContent = contentText(prev.content);
363
364
  const curContent = contentText(msg.content);
365
+ // Drop the second of two consecutive assistants when the content is
366
+ // byte-identical (after trim) — that's a retry/double-persist artifact,
367
+ // not legitimate continuation. Concatenating them produced visible
368
+ // duplicate text in surfaces. Empty strings still concatenate (could
369
+ // be "" + real content).
370
+ if (prevContent.trim().length > 0 && prevContent.trim() === curContent.trim() && msg.toolCalls.length === 0) {
371
+ duplicateAssistantsDropped += 1;
372
+ continue;
373
+ }
364
374
  prev.content = `${prevContent}\n\n${curContent}`;
365
375
  continue;
366
376
  }
367
377
  }
368
378
  result.push(msg);
369
379
  }
380
+ if (duplicateAssistantsDropped > 0) {
381
+ (0, runtime_1.emitNervesEvent)({
382
+ level: "info",
383
+ event: "mind.session_duplicate_assistant_dropped",
384
+ component: "mind",
385
+ message: "dropped consecutive assistant messages with identical content (retry/double-persist artifact)",
386
+ meta: { count: duplicateAssistantsDropped },
387
+ });
388
+ }
370
389
  (0, runtime_1.emitNervesEvent)({
371
390
  level: "info",
372
391
  event: "mind.session_invariant_repair",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.506",
3
+ "version": "0.1.0-alpha.507",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",