adhdev 0.7.14 → 0.7.16
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 +21 -78
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +21 -78
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -19203,31 +19203,14 @@ var init_provider_cli_adapter = __esm({
|
|
|
19203
19203
|
this.accumulatedRawBuffer = (this.accumulatedRawBuffer + rawData).slice(-_ProviderCliAdapter.MAX_ACCUMULATED_BUFFER);
|
|
19204
19204
|
if (this.startupParseGate) {
|
|
19205
19205
|
this.startupBuffer += cleanData;
|
|
19206
|
-
const dialogPatterns = [
|
|
19207
|
-
/Do you want to connect/i,
|
|
19208
|
-
/Do you trust the files/i,
|
|
19209
|
-
/Quick safety check/i,
|
|
19210
|
-
/Is this a project/i,
|
|
19211
|
-
/Enter to confirm/i,
|
|
19212
|
-
/be able to read, edit, and execute/i,
|
|
19213
|
-
/Security guide/i
|
|
19214
|
-
];
|
|
19215
|
-
if (dialogPatterns.some((p) => p.test(this.startupBuffer))) {
|
|
19216
|
-
setTimeout(() => this.ptyProcess?.write("\r"), this.timeouts.dialogAccept);
|
|
19217
|
-
this.startupBuffer = "";
|
|
19218
|
-
return;
|
|
19219
|
-
}
|
|
19220
19206
|
const elapsed = Date.now() - this.spawnAt;
|
|
19221
|
-
const bufCap = this.startupBuffer.length > 12e3;
|
|
19222
19207
|
const scriptStatus = this.runDetectStatus(this.startupBuffer);
|
|
19223
|
-
const isReady = scriptStatus === "idle" || elapsed > 8e3 ||
|
|
19208
|
+
const isReady = scriptStatus === "idle" || scriptStatus === "waiting_approval" || elapsed > 8e3 || this.startupBuffer.length > 12e3;
|
|
19224
19209
|
if (isReady) {
|
|
19225
19210
|
this.startupParseGate = false;
|
|
19226
19211
|
this.ready = true;
|
|
19227
|
-
LOG.info("CLI", `[${this.cliType}] Startup
|
|
19212
|
+
LOG.info("CLI", `[${this.cliType}] Startup ready (${elapsed}ms, scriptStatus=${scriptStatus})`);
|
|
19228
19213
|
this.onStatusChange?.();
|
|
19229
|
-
} else {
|
|
19230
|
-
return;
|
|
19231
19214
|
}
|
|
19232
19215
|
}
|
|
19233
19216
|
this.scheduleSettle();
|
|
@@ -19435,51 +19418,6 @@ var init_provider_cli_adapter = __esm({
|
|
|
19435
19418
|
this.onStatusChange?.();
|
|
19436
19419
|
}
|
|
19437
19420
|
commitCurrentTranscript() {
|
|
19438
|
-
const baseMessages = [...this.committedMessages];
|
|
19439
|
-
const parsed = this.parseCurrentTranscript(baseMessages, "", this.currentTurnScope);
|
|
19440
|
-
if (parsed && Array.isArray(parsed.messages) && parsed.messages.length > 0) {
|
|
19441
|
-
const parsedMessages = parsed.messages.filter((m) => m && (m.role === "user" || m.role === "assistant")).map((m) => ({
|
|
19442
|
-
role: m.role,
|
|
19443
|
-
content: typeof m.content === "string" ? m.content : String(m.content || ""),
|
|
19444
|
-
timestamp: m.timestamp
|
|
19445
|
-
}));
|
|
19446
|
-
const latestAssistant = [...parsedMessages].reverse().find((m) => m.role === "assistant" && m.content.trim());
|
|
19447
|
-
if (latestAssistant) {
|
|
19448
|
-
LOG.info("CLI", `[${this.cliType}] commitCurrentTranscript parsed assistant len=${latestAssistant.content.length} scopePrompt=${JSON.stringify(this.currentTurnScope?.prompt || "").slice(0, 120)}`);
|
|
19449
|
-
const nextMessages = [...baseMessages];
|
|
19450
|
-
const last2 = nextMessages[nextMessages.length - 1];
|
|
19451
|
-
if (last2?.role === "assistant") {
|
|
19452
|
-
last2.content = latestAssistant.content;
|
|
19453
|
-
last2.timestamp = latestAssistant.timestamp || last2.timestamp;
|
|
19454
|
-
} else if (last2?.role === "user") {
|
|
19455
|
-
nextMessages.push({
|
|
19456
|
-
role: "assistant",
|
|
19457
|
-
content: latestAssistant.content,
|
|
19458
|
-
timestamp: latestAssistant.timestamp || Date.now()
|
|
19459
|
-
});
|
|
19460
|
-
} else {
|
|
19461
|
-
nextMessages.push({
|
|
19462
|
-
role: "assistant",
|
|
19463
|
-
content: latestAssistant.content,
|
|
19464
|
-
timestamp: latestAssistant.timestamp || Date.now()
|
|
19465
|
-
});
|
|
19466
|
-
}
|
|
19467
|
-
this.committedMessages = nextMessages;
|
|
19468
|
-
this.syncMessageViews();
|
|
19469
|
-
return;
|
|
19470
|
-
}
|
|
19471
|
-
}
|
|
19472
|
-
const fallback = String(this.responseBuffer || "").trim();
|
|
19473
|
-
LOG.info("CLI", `[${this.cliType}] commitCurrentTranscript fallback len=${fallback.length} scopePrompt=${JSON.stringify(this.currentTurnScope?.prompt || "").slice(0, 120)}`);
|
|
19474
|
-
if (!fallback) return;
|
|
19475
|
-
const last = baseMessages[baseMessages.length - 1];
|
|
19476
|
-
if (last?.role === "assistant") {
|
|
19477
|
-
last.content = fallback;
|
|
19478
|
-
} else {
|
|
19479
|
-
baseMessages.push({ role: "assistant", content: fallback, timestamp: Date.now() });
|
|
19480
|
-
}
|
|
19481
|
-
this.committedMessages = baseMessages;
|
|
19482
|
-
this.syncMessageViews();
|
|
19483
19421
|
}
|
|
19484
19422
|
// ─── Script Execution ──────────────────────────
|
|
19485
19423
|
runDetectStatus(text) {
|
|
@@ -37400,7 +37338,11 @@ var init_acp_provider_instance = __esm({
|
|
|
37400
37338
|
});
|
|
37401
37339
|
|
|
37402
37340
|
// ../../oss/packages/daemon-core/src/commands/cli-manager.ts
|
|
37403
|
-
|
|
37341
|
+
function colorize(color, text) {
|
|
37342
|
+
const fn2 = chalkApi?.[color];
|
|
37343
|
+
return typeof fn2 === "function" ? fn2(text) : text;
|
|
37344
|
+
}
|
|
37345
|
+
var os14, path10, crypto4, import_chalk, chalkApi, DaemonCliManager;
|
|
37404
37346
|
var init_cli_manager = __esm({
|
|
37405
37347
|
"../../oss/packages/daemon-core/src/commands/cli-manager.ts"() {
|
|
37406
37348
|
"use strict";
|
|
@@ -37416,6 +37358,7 @@ var init_cli_manager = __esm({
|
|
|
37416
37358
|
init_cli_provider_instance();
|
|
37417
37359
|
init_acp_provider_instance();
|
|
37418
37360
|
init_logger();
|
|
37361
|
+
chalkApi = import_chalk.default?.yellow ? import_chalk.default : import_chalk.default?.default || null;
|
|
37419
37362
|
DaemonCliManager = class {
|
|
37420
37363
|
adapters = /* @__PURE__ */ new Map();
|
|
37421
37364
|
deps;
|
|
@@ -37435,16 +37378,16 @@ var init_cli_manager = __esm({
|
|
|
37435
37378
|
const provider = this.providerLoader.getByAlias(cliType);
|
|
37436
37379
|
const actKind = provider?.category === "acp" ? "acp" : "cli";
|
|
37437
37380
|
let next = loadConfig();
|
|
37438
|
-
console.log(
|
|
37381
|
+
console.log(colorize("cyan", ` \u{1F4C2} Saving recent workspace: ${dir}`));
|
|
37439
37382
|
const recent = next.recentCliWorkspaces || [];
|
|
37440
37383
|
if (!recent.includes(dir)) {
|
|
37441
37384
|
next = { ...next, recentCliWorkspaces: [dir, ...recent].slice(0, 10) };
|
|
37442
37385
|
}
|
|
37443
37386
|
next = appendWorkspaceActivity(next, dir, { kind: actKind, agentType: normalizedType });
|
|
37444
37387
|
saveConfig(next);
|
|
37445
|
-
console.log(
|
|
37388
|
+
console.log(colorize("green", ` \u2713 Recent workspace saved: ${dir}`));
|
|
37446
37389
|
} catch (e) {
|
|
37447
|
-
console.error(
|
|
37390
|
+
console.error(colorize("red", ` \u2717 Failed to save recent workspace: ${e}`));
|
|
37448
37391
|
}
|
|
37449
37392
|
}
|
|
37450
37393
|
getTransportFactory(runtimeId, providerType, workspace, cliArgs, attachExisting = false) {
|
|
@@ -37460,7 +37403,7 @@ var init_cli_manager = __esm({
|
|
|
37460
37403
|
const normalizedType = this.providerLoader.resolveAlias(cliType);
|
|
37461
37404
|
const provider = this.providerLoader.getMeta(normalizedType);
|
|
37462
37405
|
if (provider && provider.category === "cli" && provider.patterns && provider.spawn) {
|
|
37463
|
-
console.log(
|
|
37406
|
+
console.log(colorize("cyan", ` \u{1F4E6} Using provider: ${provider.name} (${provider.type})`));
|
|
37464
37407
|
const resolvedProvider = this.providerLoader.resolve(normalizedType) || provider;
|
|
37465
37408
|
const transportFactory = this.getTransportFactory(runtimeId, normalizedType, workingDir, cliArgs, attachExisting);
|
|
37466
37409
|
return new ProviderCliAdapter(resolvedProvider, workingDir, cliArgs, transportFactory);
|
|
@@ -37553,7 +37496,7 @@ ${installInfo}`
|
|
|
37553
37496
|
);
|
|
37554
37497
|
}
|
|
37555
37498
|
}
|
|
37556
|
-
console.log(
|
|
37499
|
+
console.log(colorize("cyan", ` \u{1F50C} Starting ACP agent: ${provider.name} (${provider.type}) in ${resolvedDir}`));
|
|
37557
37500
|
const acpInstance = new AcpProviderInstance(provider, resolvedDir, cliArgs);
|
|
37558
37501
|
await instanceManager2.addInstance(key, acpInstance, {
|
|
37559
37502
|
settings: this.providerLoader.getSettings(normalizedType)
|
|
@@ -37593,11 +37536,11 @@ ${installInfo}`
|
|
|
37593
37536
|
setOnPtyData: () => {
|
|
37594
37537
|
}
|
|
37595
37538
|
});
|
|
37596
|
-
console.log(
|
|
37539
|
+
console.log(colorize("green", ` \u2713 ACP agent started: ${provider.name} in ${resolvedDir}`));
|
|
37597
37540
|
if (initialModel) {
|
|
37598
37541
|
try {
|
|
37599
37542
|
await acpInstance.setConfigOption("model", initialModel);
|
|
37600
|
-
console.log(
|
|
37543
|
+
console.log(colorize("green", ` \u{1F916} Initial model set: ${initialModel}`));
|
|
37601
37544
|
} catch (e) {
|
|
37602
37545
|
LOG.warn("CLI", `[ACP] Initial model set failed: ${e?.message}`);
|
|
37603
37546
|
}
|
|
@@ -37612,9 +37555,9 @@ ${installInfo}`
|
|
|
37612
37555
|
}
|
|
37613
37556
|
const cliInfo = await detectCLI(cliType, this.providerLoader);
|
|
37614
37557
|
if (!cliInfo) throw new Error(`${cliType} not found`);
|
|
37615
|
-
console.log(
|
|
37558
|
+
console.log(colorize("yellow", ` \u26A1 Starting CLI ${cliType} in ${resolvedDir}...`));
|
|
37616
37559
|
if (provider) {
|
|
37617
|
-
console.log(
|
|
37560
|
+
console.log(colorize("cyan", ` \u{1F4E6} Using provider: ${provider.name} (${provider.type})`));
|
|
37618
37561
|
}
|
|
37619
37562
|
const instanceManager = this.deps.getInstanceManager();
|
|
37620
37563
|
if (provider && instanceManager) {
|
|
@@ -37629,7 +37572,7 @@ ${installInfo}`
|
|
|
37629
37572
|
{},
|
|
37630
37573
|
false
|
|
37631
37574
|
);
|
|
37632
|
-
console.log(
|
|
37575
|
+
console.log(colorize("green", ` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
|
|
37633
37576
|
} else {
|
|
37634
37577
|
const adapter = this.createAdapter(cliType, resolvedDir, cliArgs, key, false);
|
|
37635
37578
|
try {
|
|
@@ -37662,7 +37605,7 @@ ${installInfo}`
|
|
|
37662
37605
|
});
|
|
37663
37606
|
}
|
|
37664
37607
|
this.adapters.set(key, adapter);
|
|
37665
|
-
console.log(
|
|
37608
|
+
console.log(colorize("green", ` \u2713 CLI started: ${cliInfo.displayName} v${cliInfo.version || "unknown"} in ${resolvedDir}`));
|
|
37666
37609
|
}
|
|
37667
37610
|
try {
|
|
37668
37611
|
addCliHistory({ category: "cli", cliType, dir: resolvedDir, workspace: resolvedDir, cliArgs, model: initialModel });
|
|
@@ -37824,7 +37767,7 @@ ${installInfo}`
|
|
|
37824
37767
|
if (found) {
|
|
37825
37768
|
await this.stopSessionWithMode(found.key, mode);
|
|
37826
37769
|
} else {
|
|
37827
|
-
console.log(
|
|
37770
|
+
console.log(colorize("yellow", ` \u26A0 No adapter found for ${cliType}`));
|
|
37828
37771
|
}
|
|
37829
37772
|
return { success: true, cliType, dir, stopped: true, mode };
|
|
37830
37773
|
}
|
|
@@ -45320,7 +45263,7 @@ var init_adhdev_daemon = __esm({
|
|
|
45320
45263
|
fs14 = __toESM(require("fs"));
|
|
45321
45264
|
path16 = __toESM(require("path"));
|
|
45322
45265
|
import_chalk2 = __toESM(require("chalk"));
|
|
45323
|
-
pkgVersion = "0.7.
|
|
45266
|
+
pkgVersion = "0.7.16";
|
|
45324
45267
|
if (pkgVersion === "unknown") {
|
|
45325
45268
|
try {
|
|
45326
45269
|
const possiblePaths = [
|