@distlang/opencode-plugin 0.1.4 → 0.1.5

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/package.json +1 -1
  2. package/src/recorder.js +18 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distlang/opencode-plugin",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "OpenCode plugin for Distlang AI Debugger",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/recorder.js CHANGED
@@ -514,15 +514,15 @@ function tokensFromMessage(info) {
514
514
  }
515
515
 
516
516
  function extractMessageText(info) {
517
- const direct = configuredValue(info && (info.text ?? info.prompt ?? info.message ?? info.body), "");
517
+ const direct = sanitizeDebuggerText(configuredValue(info && (info.text ?? info.prompt ?? info.message ?? info.body), ""));
518
518
  if (direct !== "") {
519
519
  return direct;
520
520
  }
521
- if (typeof info?.content === "string" && info.content.trim() !== "") {
522
- return info.content.trim();
521
+ if (typeof info?.content === "string") {
522
+ return sanitizeDebuggerText(info.content);
523
523
  }
524
524
  if (Array.isArray(info?.content)) {
525
- return info.content
525
+ return sanitizeDebuggerText(info.content
526
526
  .map((part) => {
527
527
  if (typeof part === "string") {
528
528
  return part;
@@ -534,11 +534,24 @@ function extractMessageText(info) {
534
534
  })
535
535
  .filter(Boolean)
536
536
  .join("\n")
537
- .trim();
537
+ .trim());
538
538
  }
539
539
  return "";
540
540
  }
541
541
 
542
+ function sanitizeDebuggerText(value) {
543
+ if (typeof value !== "string") {
544
+ return "";
545
+ }
546
+ return value
547
+ .replace(/<system-reminder>[\s\S]*?<\/system-reminder>/gi, "")
548
+ .replace(/<system>[\s\S]*?<\/system>/gi, "")
549
+ .split("\n")
550
+ .filter((line) => !line.trim().startsWith("# Plan Mode - System Reminder"))
551
+ .join("\n")
552
+ .trim();
553
+ }
554
+
542
555
  function summarizePrompt(prompt, fallback) {
543
556
  const trimmed = configuredValue(prompt, fallback);
544
557
  if (trimmed.length <= 80) {