adhdev 0.6.50 → 0.6.51

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/cli/index.js CHANGED
@@ -7356,6 +7356,9 @@ var init_provider_cli_adapter = __esm({
7356
7356
  idleTimeout = null;
7357
7357
  ready = false;
7358
7358
  startupBuffer = "";
7359
+ /** After spawn: briefly skip generating/settle so splash/redraw does not flip status; not used to gate sendMessage */
7360
+ startupParseGate = false;
7361
+ spawnAt = 0;
7359
7362
  // PTY I/O
7360
7363
  onPtyDataCallback = null;
7361
7364
  ptyOutputBuffer = "";
@@ -7469,9 +7472,15 @@ var init_provider_cli_adapter = __esm({
7469
7472
  this.ptyProcess = null;
7470
7473
  this.setStatus("stopped", "pty_exit");
7471
7474
  this.ready = false;
7475
+ this.startupParseGate = false;
7476
+ this.spawnAt = 0;
7472
7477
  this.onStatusChange?.();
7473
7478
  });
7474
- this.setStatus("starting", "spawn");
7479
+ this.spawnAt = Date.now();
7480
+ this.startupParseGate = true;
7481
+ this.startupBuffer = "";
7482
+ this.ready = true;
7483
+ this.setStatus("idle", "pty_ready");
7475
7484
  this.onStatusChange?.();
7476
7485
  }
7477
7486
  // ─── Output state machine ────────────────────────────
@@ -7487,7 +7496,7 @@ var init_provider_cli_adapter = __esm({
7487
7496
  }
7488
7497
  }
7489
7498
  this.recentOutputBuffer = (this.recentOutputBuffer + cleanData).slice(-1e3);
7490
- if (!this.ready) {
7499
+ if (this.startupParseGate) {
7491
7500
  this.startupBuffer += cleanData;
7492
7501
  LOG.info("CLI", `[${this.cliType}] startup chunk (${cleanData.length} chars): ${cleanData.slice(0, 200).replace(/\n/g, "\\n")}`);
7493
7502
  const dialogPatterns = [
@@ -7502,13 +7511,19 @@ var init_provider_cli_adapter = __esm({
7502
7511
  this.startupBuffer = "";
7503
7512
  return;
7504
7513
  }
7505
- if (patterns.prompt.some((p) => p.test(this.startupBuffer))) {
7506
- this.ready = true;
7507
- this.setStatus("idle", "prompt_matched");
7508
- LOG.info("CLI", `[${this.cliType}] \u2713 Ready`);
7509
- this.onStatusChange?.();
7514
+ const elapsed = Date.now() - this.spawnAt;
7515
+ const bufCap = this.startupBuffer.length > 12e3;
7516
+ const promptMatched = patterns.prompt.some((p) => p.test(this.startupBuffer));
7517
+ if (promptMatched || elapsed > 8e3 || bufCap) {
7518
+ this.startupParseGate = false;
7519
+ if (promptMatched) {
7520
+ LOG.info("CLI", `[${this.cliType}] \u2713 Startup gate end (prompt matched)`);
7521
+ } else {
7522
+ LOG.info("CLI", `[${this.cliType}] startup gate end (${elapsed}ms, cap=${bufCap}, prompt=${promptMatched})`);
7523
+ }
7524
+ } else {
7525
+ return;
7510
7526
  }
7511
- return;
7512
7527
  }
7513
7528
  if (cleanData.trim().length > 5) {
7514
7529
  LOG.debug("CLI", `[${this.cliType}] output chunk (${cleanData.length}): ${cleanData.slice(0, 300).replace(/\n/g, "\\n")}`);
@@ -7716,6 +7731,8 @@ var init_provider_cli_adapter = __esm({
7716
7731
  this.ptyProcess = null;
7717
7732
  this.setStatus("stopped", "stop_cmd");
7718
7733
  this.ready = false;
7734
+ this.startupParseGate = false;
7735
+ this.spawnAt = 0;
7719
7736
  this.onStatusChange?.();
7720
7737
  }, this.timeouts.shutdownGrace);
7721
7738
  }
@@ -7762,16 +7779,29 @@ var init_provider_cli_adapter = __esm({
7762
7779
  * Used by DevServer /api/cli/debug endpoint.
7763
7780
  */
7764
7781
  getDebugState() {
7782
+ const sb = this.startupBuffer;
7783
+ const testOnStartup = (p) => {
7784
+ const flags = p.flags.includes("g") ? p.flags.replace(/g/g, "") : p.flags;
7785
+ return new RegExp(p.source, flags).test(sb);
7786
+ };
7787
+ const promptDiagnostics = this.provider.patterns.prompt.map((p) => ({
7788
+ pattern: p.toString(),
7789
+ matchedAgainstStartupBuffer: testOnStartup(p)
7790
+ }));
7765
7791
  return {
7766
7792
  type: this.cliType,
7767
7793
  name: this.cliName,
7768
7794
  status: this.currentStatus,
7769
7795
  ready: this.ready,
7796
+ startupParseGate: this.startupParseGate,
7797
+ spawnAt: this.spawnAt,
7770
7798
  workingDir: this.workingDir,
7771
7799
  messages: this.messages.slice(-20),
7772
7800
  messageCount: this.messages.length,
7773
- // Buffers
7774
- startupBuffer: this.startupBuffer.slice(-500),
7801
+ // Buffers (longer tails here than in periodic logs — for matching provider.json patterns)
7802
+ startupBuffer: sb.slice(-4e3),
7803
+ startupBufferLength: sb.length,
7804
+ promptDiagnostics,
7775
7805
  recentOutputBuffer: this.recentOutputBuffer.slice(-500),
7776
7806
  settledBuffer: this.settledBuffer.slice(-500),
7777
7807
  responseBuffer: this.responseBuffer.slice(-500),
@@ -31354,7 +31384,7 @@ var init_adhdev_daemon = __esm({
31354
31384
  fs11 = __toESM(require("fs"));
31355
31385
  path14 = __toESM(require("path"));
31356
31386
  import_chalk2 = __toESM(require("chalk"));
31357
- pkgVersion = "0.6.50";
31387
+ pkgVersion = "0.6.51";
31358
31388
  if (pkgVersion === "unknown") {
31359
31389
  try {
31360
31390
  const possiblePaths = [