dsh-loop-engine 1.0.0-rc5 → 1.0.0-rc6

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/lib/index.js CHANGED
@@ -3712,16 +3712,20 @@ function applyManagedBlock(text, engine) {
3712
3712
  const span = managedSpan(text);
3713
3713
  let result;
3714
3714
  if (!span.present) {
3715
- if (block === "") return text;
3716
- const base = ensureTrailingNewline(text);
3717
- result = `${base}
3715
+ if (block === "") {
3716
+ result = text;
3717
+ } else {
3718
+ const base = ensureTrailingNewline(text);
3719
+ result = `${base}
3718
3720
  ${block}`;
3721
+ }
3719
3722
  } else if (block === "") {
3720
3723
  result = span.tail.startsWith("\n") ? `${span.head}${span.tail.slice(1)}` : `${span.head}${span.tail}`;
3721
3724
  } else {
3722
3725
  result = `${span.head}${span.blankBefore ? "\n" : ""}${block}${span.tail}`;
3723
3726
  }
3724
3727
  if (block !== "") return dropSeedPlaceholder(result);
3728
+ if (text.trim() === "") return result;
3725
3729
  return hasRootEntry(result) ? result : seedEmptyArray(result);
3726
3730
  }
3727
3731
 
package/lib/invariant.js CHANGED
@@ -62,16 +62,20 @@ function applyManagedBlock(text, engine) {
62
62
  const span = managedSpan(text);
63
63
  let result;
64
64
  if (!span.present) {
65
- if (block === "") return text;
66
- const base = ensureTrailingNewline(text);
67
- result = `${base}
65
+ if (block === "") {
66
+ result = text;
67
+ } else {
68
+ const base = ensureTrailingNewline(text);
69
+ result = `${base}
68
70
  ${block}`;
71
+ }
69
72
  } else if (block === "") {
70
73
  result = span.tail.startsWith("\n") ? `${span.head}${span.tail.slice(1)}` : `${span.head}${span.tail}`;
71
74
  } else {
72
75
  result = `${span.head}${span.blankBefore ? "\n" : ""}${block}${span.tail}`;
73
76
  }
74
77
  if (block !== "") return dropSeedPlaceholder(result);
78
+ if (text.trim() === "") return result;
75
79
  return hasRootEntry(result) ? result : seedEmptyArray(result);
76
80
  }
77
81
 
@@ -81,13 +85,17 @@ var name = "loop-engine-invariant";
81
85
  var inject = ["invariants"];
82
86
  var install = (ctx, fail) => {
83
87
  void ctx;
84
- const seed = "# dsh profile patch layer\n";
88
+ const seed = "";
89
+ const commentOnly = "# dsh profile patch layer\n";
85
90
  for (const engine of LOOP_ENGINE_IDS) {
86
91
  const applied = applyManagedBlock(seed, engine);
87
92
  const reborn = applyManagedBlock(applied, currentEngineOf(applied));
88
- if (reborn !== applied) fail(`managed-block round trip for ${engine} is not a fixed point`);
89
- if (engine === "in-process" && applied !== seed) fail("in-process engine must leave the file text unchanged");
93
+ if (reborn !== applied) fail(`bare round trip for ${engine} is not a fixed point`);
94
+ if (engine === "in-process" && applied !== seed) fail("in-process engine must leave a bare layer unchanged");
90
95
  if (engine !== "in-process" && currentEngineOf(renderManagedBlock(engine)) !== engine) fail(`${engine} block must read back as the ${engine} engine`);
96
+ if (engine === "in-process" && applyManagedBlock(commentOnly, engine) === commentOnly) {
97
+ fail("in-process engine must re-seed a comment-only file to a loadable top-level array");
98
+ }
91
99
  }
92
100
  };
93
101
  var apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-loop-engine",
3
3
  "description": "Web-switchable agent loop engine selection for the DeepSeek Harness - out-of-tree plugin (Claude Code / Codex drivers) maintained by @kuun993, zero main-repo changes",
4
- "version": "1.0.0-rc5",
4
+ "version": "1.0.0-rc6",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },