adhdev 0.6.49 → 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 +70 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +70 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -321,14 +321,26 @@ function addCliHistory(entry) {
|
|
|
321
321
|
const config2 = loadConfig();
|
|
322
322
|
const history = config2.cliHistory || [];
|
|
323
323
|
const argsKey = (entry.cliArgs || []).join(" ");
|
|
324
|
+
const category = entry.category || "cli";
|
|
325
|
+
const workspaceKey = entry.workspace || "";
|
|
326
|
+
const modelKey = entry.model || "";
|
|
324
327
|
const filtered = history.filter((h) => {
|
|
325
328
|
const hArgsKey = (h.cliArgs || []).join(" ");
|
|
326
|
-
return !(h.cliType === entry.cliType && h.dir === entry.dir && hArgsKey === argsKey);
|
|
329
|
+
return !((h.category || "cli") === category && h.cliType === entry.cliType && h.dir === entry.dir && hArgsKey === argsKey && (h.workspace || "") === workspaceKey && (h.model || "") === modelKey);
|
|
327
330
|
});
|
|
328
331
|
filtered.unshift({
|
|
329
332
|
...entry,
|
|
333
|
+
category,
|
|
330
334
|
timestamp: Date.now(),
|
|
331
|
-
label: entry.label ||
|
|
335
|
+
label: entry.label || (() => {
|
|
336
|
+
const base = `${entry.cliType} \xB7 ${entry.dir.split("/").filter(Boolean).pop() || "root"}`;
|
|
337
|
+
const suffix = [];
|
|
338
|
+
if (entry.workspace && entry.workspace !== entry.dir) suffix.push(entry.workspace.split("/").filter(Boolean).pop() || entry.workspace);
|
|
339
|
+
if (entry.model) suffix.push(`model=${entry.model}`);
|
|
340
|
+
if (argsKey) suffix.push(argsKey);
|
|
341
|
+
if (entry.newWindow) suffix.push("new window");
|
|
342
|
+
return suffix.length > 0 ? `${base} (${suffix.join(" \xB7 ")})` : base;
|
|
343
|
+
})()
|
|
332
344
|
});
|
|
333
345
|
config2.cliHistory = filtered.slice(0, 20);
|
|
334
346
|
saveConfig(config2);
|
|
@@ -6431,6 +6443,7 @@ var init_router = __esm({
|
|
|
6431
6443
|
init_config();
|
|
6432
6444
|
init_workspaces();
|
|
6433
6445
|
init_workspace_activity();
|
|
6446
|
+
init_config();
|
|
6434
6447
|
init_ide_detector();
|
|
6435
6448
|
init_logger();
|
|
6436
6449
|
init_command_log();
|
|
@@ -6562,6 +6575,18 @@ var init_router = __esm({
|
|
|
6562
6575
|
};
|
|
6563
6576
|
LOG.info("LaunchIDE", `target=${ideKey || "auto"}`);
|
|
6564
6577
|
const result = await launchWithCdp(launchArgs);
|
|
6578
|
+
if (result.success && (result.ideId || ideKey)) {
|
|
6579
|
+
try {
|
|
6580
|
+
addCliHistory({
|
|
6581
|
+
category: "ide",
|
|
6582
|
+
cliType: result.ideId || ideKey,
|
|
6583
|
+
dir: resolvedWorkspace || "",
|
|
6584
|
+
workspace: resolvedWorkspace || "",
|
|
6585
|
+
newWindow: args?.newWindow === true
|
|
6586
|
+
});
|
|
6587
|
+
} catch {
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6565
6590
|
if (result.success && result.port && result.ideId && !this.deps.cdpManagers.has(result.ideId)) {
|
|
6566
6591
|
const logFn = this.deps.getCdpLogFn ? this.deps.getCdpLogFn(result.ideId) : LOG.forComponent(`CDP:${result.ideId}`).asLogFn();
|
|
6567
6592
|
const provider = this.deps.providerLoader.getMeta(result.ideId);
|
|
@@ -7135,6 +7160,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
7135
7160
|
idleTimeout = null;
|
|
7136
7161
|
ready = false;
|
|
7137
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;
|
|
7138
7166
|
// PTY I/O
|
|
7139
7167
|
onPtyDataCallback = null;
|
|
7140
7168
|
ptyOutputBuffer = "";
|
|
@@ -7248,9 +7276,15 @@ var init_provider_cli_adapter = __esm({
|
|
|
7248
7276
|
this.ptyProcess = null;
|
|
7249
7277
|
this.setStatus("stopped", "pty_exit");
|
|
7250
7278
|
this.ready = false;
|
|
7279
|
+
this.startupParseGate = false;
|
|
7280
|
+
this.spawnAt = 0;
|
|
7251
7281
|
this.onStatusChange?.();
|
|
7252
7282
|
});
|
|
7253
|
-
this.
|
|
7283
|
+
this.spawnAt = Date.now();
|
|
7284
|
+
this.startupParseGate = true;
|
|
7285
|
+
this.startupBuffer = "";
|
|
7286
|
+
this.ready = true;
|
|
7287
|
+
this.setStatus("idle", "pty_ready");
|
|
7254
7288
|
this.onStatusChange?.();
|
|
7255
7289
|
}
|
|
7256
7290
|
// ─── Output state machine ────────────────────────────
|
|
@@ -7266,7 +7300,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
7266
7300
|
}
|
|
7267
7301
|
}
|
|
7268
7302
|
this.recentOutputBuffer = (this.recentOutputBuffer + cleanData).slice(-1e3);
|
|
7269
|
-
if (
|
|
7303
|
+
if (this.startupParseGate) {
|
|
7270
7304
|
this.startupBuffer += cleanData;
|
|
7271
7305
|
LOG.info("CLI", `[${this.cliType}] startup chunk (${cleanData.length} chars): ${cleanData.slice(0, 200).replace(/\n/g, "\\n")}`);
|
|
7272
7306
|
const dialogPatterns = [
|
|
@@ -7281,13 +7315,19 @@ var init_provider_cli_adapter = __esm({
|
|
|
7281
7315
|
this.startupBuffer = "";
|
|
7282
7316
|
return;
|
|
7283
7317
|
}
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
this.
|
|
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;
|
|
7289
7330
|
}
|
|
7290
|
-
return;
|
|
7291
7331
|
}
|
|
7292
7332
|
if (cleanData.trim().length > 5) {
|
|
7293
7333
|
LOG.debug("CLI", `[${this.cliType}] output chunk (${cleanData.length}): ${cleanData.slice(0, 300).replace(/\n/g, "\\n")}`);
|
|
@@ -7495,6 +7535,8 @@ var init_provider_cli_adapter = __esm({
|
|
|
7495
7535
|
this.ptyProcess = null;
|
|
7496
7536
|
this.setStatus("stopped", "stop_cmd");
|
|
7497
7537
|
this.ready = false;
|
|
7538
|
+
this.startupParseGate = false;
|
|
7539
|
+
this.spawnAt = 0;
|
|
7498
7540
|
this.onStatusChange?.();
|
|
7499
7541
|
}, this.timeouts.shutdownGrace);
|
|
7500
7542
|
}
|
|
@@ -7541,16 +7583,29 @@ var init_provider_cli_adapter = __esm({
|
|
|
7541
7583
|
* Used by DevServer /api/cli/debug endpoint.
|
|
7542
7584
|
*/
|
|
7543
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
|
+
}));
|
|
7544
7595
|
return {
|
|
7545
7596
|
type: this.cliType,
|
|
7546
7597
|
name: this.cliName,
|
|
7547
7598
|
status: this.currentStatus,
|
|
7548
7599
|
ready: this.ready,
|
|
7600
|
+
startupParseGate: this.startupParseGate,
|
|
7601
|
+
spawnAt: this.spawnAt,
|
|
7549
7602
|
workingDir: this.workingDir,
|
|
7550
7603
|
messages: this.messages.slice(-20),
|
|
7551
7604
|
messageCount: this.messages.length,
|
|
7552
|
-
// Buffers
|
|
7553
|
-
startupBuffer:
|
|
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,
|
|
7554
7609
|
recentOutputBuffer: this.recentOutputBuffer.slice(-500),
|
|
7555
7610
|
settledBuffer: this.settledBuffer.slice(-500),
|
|
7556
7611
|
responseBuffer: this.responseBuffer.slice(-500),
|
|
@@ -25146,7 +25201,7 @@ ${installInfo}`
|
|
|
25146
25201
|
}
|
|
25147
25202
|
}
|
|
25148
25203
|
try {
|
|
25149
|
-
addCliHistory({ cliType: normalizedType, dir: resolvedDir, cliArgs });
|
|
25204
|
+
addCliHistory({ category: "acp", cliType: normalizedType, dir: resolvedDir, workspace: resolvedDir, cliArgs, model: initialModel });
|
|
25150
25205
|
} catch (e) {
|
|
25151
25206
|
LOG.warn("CLI", `ACP history save failed: ${e?.message}`);
|
|
25152
25207
|
}
|
|
@@ -25235,7 +25290,7 @@ ${installInfo}`
|
|
|
25235
25290
|
console.log(import_chalk.default.green(` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
|
|
25236
25291
|
}
|
|
25237
25292
|
try {
|
|
25238
|
-
addCliHistory({ cliType, dir: resolvedDir, cliArgs });
|
|
25293
|
+
addCliHistory({ category: "cli", cliType, dir: resolvedDir, workspace: resolvedDir, cliArgs, model: initialModel });
|
|
25239
25294
|
} catch (e) {
|
|
25240
25295
|
LOG.warn("CLI", `CLI history save failed: ${e?.message}`);
|
|
25241
25296
|
}
|
|
@@ -30889,7 +30944,7 @@ var init_adhdev_daemon = __esm({
|
|
|
30889
30944
|
fs11 = __toESM(require("fs"));
|
|
30890
30945
|
path14 = __toESM(require("path"));
|
|
30891
30946
|
import_chalk2 = __toESM(require("chalk"));
|
|
30892
|
-
pkgVersion = "0.6.
|
|
30947
|
+
pkgVersion = "0.6.51";
|
|
30893
30948
|
if (pkgVersion === "unknown") {
|
|
30894
30949
|
try {
|
|
30895
30950
|
const possiblePaths = [
|