@adhdev/daemon-core 0.9.82-rc.417 → 0.9.82-rc.419

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/dist/index.mjs CHANGED
@@ -384,10 +384,10 @@ function readInjected(value) {
384
384
  }
385
385
  function getDaemonBuildInfo() {
386
386
  if (cached) return cached;
387
- const commit = readInjected(true ? "aebe69a58bc80d5e1db908141ea4d03792bd0b5d" : void 0) ?? "unknown";
388
- const commitShort = readInjected(true ? "aebe69a5" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
389
- const version = readInjected(true ? "0.9.82-rc.417" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
390
- const builtAt = readInjected(true ? "2026-06-28T16:29:44.906Z" : void 0);
387
+ const commit = readInjected(true ? "00b0b1bba6930ac68b6c43e87795cbe63e59b323" : void 0) ?? "unknown";
388
+ const commitShort = readInjected(true ? "00b0b1bb" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
389
+ const version = readInjected(true ? "0.9.82-rc.419" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
390
+ const builtAt = readInjected(true ? "2026-06-28T18:13:37.481Z" : void 0);
391
391
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
392
392
  return cached;
393
393
  }
@@ -8625,6 +8625,36 @@ import { execFile as execFile3, execFileSync as execFileSync2 } from "child_proc
8625
8625
  import { createHash as createHash2 } from "crypto";
8626
8626
  import { promisify as promisify3 } from "util";
8627
8627
  import * as yaml3 from "js-yaml";
8628
+ function getRegisteredSubmodulePaths(workspace) {
8629
+ const paths = /* @__PURE__ */ new Set();
8630
+ try {
8631
+ const out = execFileSync2(
8632
+ resolveWin32Executable("git"),
8633
+ ["config", "--file", ".gitmodules", "--get-regexp", "path"],
8634
+ { cwd: workspace, encoding: "utf8", timeout: 1e4, windowsHide: true }
8635
+ );
8636
+ for (const line of String(out).split(/\r?\n/)) {
8637
+ const trimmed = line.trim();
8638
+ if (!trimmed) continue;
8639
+ const spaceIdx = trimmed.indexOf(" ");
8640
+ if (spaceIdx < 0) continue;
8641
+ const value = trimmed.slice(spaceIdx + 1).trim().replace(/\\/g, "/").replace(/\/+$/, "");
8642
+ if (value) paths.add(value);
8643
+ }
8644
+ } catch {
8645
+ }
8646
+ return paths;
8647
+ }
8648
+ function isCleanIgnoringSubmoduleGitlinks(porcelain, submodulePaths) {
8649
+ const lines = porcelain.split(/\r?\n/).filter((line) => line.length > 0);
8650
+ for (const line of lines) {
8651
+ const status = line.slice(0, 2);
8652
+ const path43 = line.slice(3).trim().replace(/\\/g, "/").replace(/\/+$/, "");
8653
+ const isGitlinkPointerMove = (status === " M" || status === "M ") && submodulePaths.has(path43);
8654
+ if (!isGitlinkPointerMove) return false;
8655
+ }
8656
+ return true;
8657
+ }
8628
8658
  function isWorktreeBootstrapStaleRunning(node, nowMs = Date.now()) {
8629
8659
  const wb = node?.worktreeBootstrap;
8630
8660
  if (!wb || wb.status !== "running") return false;
@@ -8642,7 +8672,11 @@ function isWorktreeBootstrapStaleRunning(node, nowMs = Date.now()) {
8642
8672
  timeout: 1e4,
8643
8673
  windowsHide: true
8644
8674
  });
8645
- return String(out).trim() === "";
8675
+ const porcelain = String(out).replace(/\r?\n$/, "");
8676
+ if (porcelain.trim() === "") return true;
8677
+ const submodulePaths = getRegisteredSubmodulePaths(workspace);
8678
+ if (submodulePaths.size === 0) return false;
8679
+ return isCleanIgnoringSubmoduleGitlinks(porcelain, submodulePaths);
8646
8680
  } catch {
8647
8681
  return false;
8648
8682
  }
@@ -8728,6 +8762,7 @@ function evaluateWorktreeBootstrapState(mesh, workspace, persisted) {
8728
8762
  }
8729
8763
  if (persisted?.status === "running") return { ...persisted, required };
8730
8764
  if (persisted?.status === "failed") return { ...persisted, required };
8765
+ if (persisted?.status === "complete") return { ...persisted, required };
8731
8766
  if (persisted?.status === "ready") {
8732
8767
  const staleInputs = loaded.config.staleInputs ?? persisted.staleInputs ?? [];
8733
8768
  if (staleInputs.length > 0 && persisted.staleInputsDigest) {
@@ -36997,6 +37032,12 @@ var WIN32_SUBMIT_SETTLE_MS = 500;
36997
37032
  var WIN32_SUBMIT_SETTLE_POLL_MS = 120;
36998
37033
  var WIN32_ECHO_PROBE_CHARS = 16;
36999
37034
  var WIN32_ECHO_MAX_WAIT_MS = 2e4;
37035
+ var WIN32_BRACKETED_PASTE_OPEN = "\x1B[200~";
37036
+ var WIN32_BRACKETED_PASTE_CLOSE = "\x1B[201~";
37037
+ var WIN32_SOFT_NEWLINE = "\x1B[27;2;13~";
37038
+ function resolveWin32SubmitMode(env = process.env) {
37039
+ return env.ADHDEV_WIN32_SUBMIT_MODE === "soft_newline" ? "soft_newline" : "paste";
37040
+ }
37000
37041
  function normalizeForEcho(s2) {
37001
37042
  return s2.replace(/\s+/g, "");
37002
37043
  }
@@ -37675,28 +37716,55 @@ var FsmDriver = class {
37675
37716
  * single unbounded ConPTY write can overflow the input pipe and drop leading
37676
37717
  * bytes; splitting it with a short inter-chunk gap keeps the console input
37677
37718
  * buffer from overflowing. Small bodies still go out in a single write. Each
37678
- * chunk advances lastWin32WriteAt so the submit settle-gate keeps waiting until
37679
- * the final chunk is out and echoed.
37719
+ * write advances lastWin32WriteAt so the submit settle-gate keeps waiting until
37720
+ * the final segment is out and echoed.
37721
+ *
37722
+ * FIX-B-v2: a body that contains an embedded newline cannot be written raw —
37723
+ * on the real win32 Ink/ConPTY composer each '\n' SUBMITS the preceding line as
37724
+ * its own entry, truncating the prompt to only the tail fragment. So a
37725
+ * newline-bearing body is rewritten so its embedded newlines never submit:
37726
+ * - 'paste' (default): wrap the body in a bracketed-paste (ESC[200~ … ESC[201~)
37727
+ * — the composer takes the whole thing, newlines and all, as pasted text.
37728
+ * - 'soft_newline': replace each embedded newline with a non-submitting
37729
+ * Shift+Enter (CSI-u) so the body is typed as one multi-line entry.
37730
+ * The trailing submit CR is NOT written here — it stays separate and is fired
37731
+ * later by scheduleWin32Submit (concern (A)). The bracketed-paste markers are
37732
+ * written as their own atomic segments (never chunked), so chunking can never
37733
+ * split ESC[200~ / ESC[201~ mid-sequence regardless of body length.
37680
37734
  */
37681
37735
  writeWin32Body(text) {
37682
37736
  if (this.win32WriteTimer) {
37683
37737
  clearTimeout(this.win32WriteTimer);
37684
37738
  this.win32WriteTimer = null;
37685
37739
  }
37686
- if (text.length <= WIN32_PTY_WRITE_CHUNK_CHARS) {
37740
+ const hasNewline = /\r?\n/.test(text);
37741
+ const mode = resolveWin32SubmitMode();
37742
+ let segments;
37743
+ if (!hasNewline) {
37744
+ segments = chunkPreservingSurrogates2(text, WIN32_PTY_WRITE_CHUNK_CHARS);
37745
+ } else if (mode === "soft_newline") {
37746
+ const rewritten = text.split(/\r?\n/).join(WIN32_SOFT_NEWLINE);
37747
+ segments = chunkPreservingSurrogates2(rewritten, WIN32_PTY_WRITE_CHUNK_CHARS);
37748
+ } else {
37749
+ segments = [
37750
+ WIN32_BRACKETED_PASTE_OPEN,
37751
+ ...chunkPreservingSurrogates2(text, WIN32_PTY_WRITE_CHUNK_CHARS),
37752
+ WIN32_BRACKETED_PASTE_CLOSE
37753
+ ];
37754
+ }
37755
+ if (segments.length <= 1) {
37687
37756
  this.markWin32Write();
37688
- this.adapter.send_keys(text);
37757
+ this.adapter.send_keys(segments[0] ?? text);
37689
37758
  return;
37690
37759
  }
37691
- const chunks = chunkPreservingSurrogates2(text, WIN32_PTY_WRITE_CHUNK_CHARS);
37692
37760
  let idx = 0;
37693
37761
  const writeNext = () => {
37694
37762
  this.win32WriteTimer = null;
37695
- if (idx >= chunks.length) return;
37763
+ if (idx >= segments.length) return;
37696
37764
  this.markWin32Write();
37697
- this.adapter.send_keys(chunks[idx]);
37765
+ this.adapter.send_keys(segments[idx]);
37698
37766
  idx += 1;
37699
- if (idx < chunks.length) {
37767
+ if (idx < segments.length) {
37700
37768
  this.win32WriteTimer = setTimeout(writeNext, WIN32_PTY_WRITE_CHUNK_GAP_MS);
37701
37769
  }
37702
37770
  };