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/index.js CHANGED
@@ -7160,6 +7160,9 @@ var init_provider_cli_adapter = __esm({
7160
7160
  idleTimeout = null;
7161
7161
  ready = false;
7162
7162
  startupBuffer = "";
7163
+ /** After spawn: briefly skip generating/settle so splash/redraw does not flip status; not used to gate sendMessage */
7164
+ startupParseGate = false;
7165
+ spawnAt = 0;
7163
7166
  // PTY I/O
7164
7167
  onPtyDataCallback = null;
7165
7168
  ptyOutputBuffer = "";
@@ -7273,9 +7276,15 @@ var init_provider_cli_adapter = __esm({
7273
7276
  this.ptyProcess = null;
7274
7277
  this.setStatus("stopped", "pty_exit");
7275
7278
  this.ready = false;
7279
+ this.startupParseGate = false;
7280
+ this.spawnAt = 0;
7276
7281
  this.onStatusChange?.();
7277
7282
  });
7278
- this.setStatus("starting", "spawn");
7283
+ this.spawnAt = Date.now();
7284
+ this.startupParseGate = true;
7285
+ this.startupBuffer = "";
7286
+ this.ready = true;
7287
+ this.setStatus("idle", "pty_ready");
7279
7288
  this.onStatusChange?.();
7280
7289
  }
7281
7290
  // ─── Output state machine ────────────────────────────
@@ -7291,7 +7300,7 @@ var init_provider_cli_adapter = __esm({
7291
7300
  }
7292
7301
  }
7293
7302
  this.recentOutputBuffer = (this.recentOutputBuffer + cleanData).slice(-1e3);
7294
- if (!this.ready) {
7303
+ if (this.startupParseGate) {
7295
7304
  this.startupBuffer += cleanData;
7296
7305
  LOG.info("CLI", `[${this.cliType}] startup chunk (${cleanData.length} chars): ${cleanData.slice(0, 200).replace(/\n/g, "\\n")}`);
7297
7306
  const dialogPatterns = [
@@ -7306,13 +7315,19 @@ var init_provider_cli_adapter = __esm({
7306
7315
  this.startupBuffer = "";
7307
7316
  return;
7308
7317
  }
7309
- if (patterns.prompt.some((p) => p.test(this.startupBuffer))) {
7310
- this.ready = true;
7311
- this.setStatus("idle", "prompt_matched");
7312
- LOG.info("CLI", `[${this.cliType}] \u2713 Ready`);
7313
- this.onStatusChange?.();
7318
+ const elapsed = Date.now() - this.spawnAt;
7319
+ const bufCap = this.startupBuffer.length > 12e3;
7320
+ const promptMatched = patterns.prompt.some((p) => p.test(this.startupBuffer));
7321
+ if (promptMatched || elapsed > 8e3 || bufCap) {
7322
+ this.startupParseGate = false;
7323
+ if (promptMatched) {
7324
+ LOG.info("CLI", `[${this.cliType}] \u2713 Startup gate end (prompt matched)`);
7325
+ } else {
7326
+ LOG.info("CLI", `[${this.cliType}] startup gate end (${elapsed}ms, cap=${bufCap}, prompt=${promptMatched})`);
7327
+ }
7328
+ } else {
7329
+ return;
7314
7330
  }
7315
- return;
7316
7331
  }
7317
7332
  if (cleanData.trim().length > 5) {
7318
7333
  LOG.debug("CLI", `[${this.cliType}] output chunk (${cleanData.length}): ${cleanData.slice(0, 300).replace(/\n/g, "\\n")}`);
@@ -7520,6 +7535,8 @@ var init_provider_cli_adapter = __esm({
7520
7535
  this.ptyProcess = null;
7521
7536
  this.setStatus("stopped", "stop_cmd");
7522
7537
  this.ready = false;
7538
+ this.startupParseGate = false;
7539
+ this.spawnAt = 0;
7523
7540
  this.onStatusChange?.();
7524
7541
  }, this.timeouts.shutdownGrace);
7525
7542
  }
@@ -7566,16 +7583,29 @@ var init_provider_cli_adapter = __esm({
7566
7583
  * Used by DevServer /api/cli/debug endpoint.
7567
7584
  */
7568
7585
  getDebugState() {
7586
+ const sb = this.startupBuffer;
7587
+ const testOnStartup = (p) => {
7588
+ const flags = p.flags.includes("g") ? p.flags.replace(/g/g, "") : p.flags;
7589
+ return new RegExp(p.source, flags).test(sb);
7590
+ };
7591
+ const promptDiagnostics = this.provider.patterns.prompt.map((p) => ({
7592
+ pattern: p.toString(),
7593
+ matchedAgainstStartupBuffer: testOnStartup(p)
7594
+ }));
7569
7595
  return {
7570
7596
  type: this.cliType,
7571
7597
  name: this.cliName,
7572
7598
  status: this.currentStatus,
7573
7599
  ready: this.ready,
7600
+ startupParseGate: this.startupParseGate,
7601
+ spawnAt: this.spawnAt,
7574
7602
  workingDir: this.workingDir,
7575
7603
  messages: this.messages.slice(-20),
7576
7604
  messageCount: this.messages.length,
7577
- // Buffers
7578
- startupBuffer: this.startupBuffer.slice(-500),
7605
+ // Buffers (longer tails here than in periodic logs — for matching provider.json patterns)
7606
+ startupBuffer: sb.slice(-4e3),
7607
+ startupBufferLength: sb.length,
7608
+ promptDiagnostics,
7579
7609
  recentOutputBuffer: this.recentOutputBuffer.slice(-500),
7580
7610
  settledBuffer: this.settledBuffer.slice(-500),
7581
7611
  responseBuffer: this.responseBuffer.slice(-500),
@@ -30914,7 +30944,7 @@ var init_adhdev_daemon = __esm({
30914
30944
  fs11 = __toESM(require("fs"));
30915
30945
  path14 = __toESM(require("path"));
30916
30946
  import_chalk2 = __toESM(require("chalk"));
30917
- pkgVersion = "0.6.50";
30947
+ pkgVersion = "0.6.51";
30918
30948
  if (pkgVersion === "unknown") {
30919
30949
  try {
30920
30950
  const possiblePaths = [