adhdev 0.1.40 → 0.1.41
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 +28 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2092,7 +2092,8 @@ var init_claude_cli = __esm({
|
|
|
2092
2092
|
};
|
|
2093
2093
|
}
|
|
2094
2094
|
async sendMessage(text) {
|
|
2095
|
-
if (!this.ptyProcess
|
|
2095
|
+
if (!this.ptyProcess) throw new Error("Claude Code PTY process not running");
|
|
2096
|
+
if (!this.ready) throw new Error(`Claude Code not ready (status: ${this.currentStatus}). Startup may still be in progress.`);
|
|
2096
2097
|
this.messages.push({ role: "user", content: text, timestamp: Date.now() });
|
|
2097
2098
|
this.isWaitingForResponse = true;
|
|
2098
2099
|
this.currentStatus = "generating";
|
|
@@ -4311,8 +4312,8 @@ var init_daemon_commands = __esm({
|
|
|
4311
4312
|
const cliMatch = raw.match(/:cli:(.+)$/);
|
|
4312
4313
|
if (ideMatch) raw = ideMatch[1];
|
|
4313
4314
|
else if (cliMatch) raw = cliMatch[1];
|
|
4314
|
-
const
|
|
4315
|
-
if (
|
|
4315
|
+
const lastUnderscore = raw.lastIndexOf("_");
|
|
4316
|
+
if (lastUnderscore > 0) return raw.substring(0, lastUnderscore);
|
|
4316
4317
|
}
|
|
4317
4318
|
return void 0;
|
|
4318
4319
|
}
|
|
@@ -6484,12 +6485,23 @@ var init_adhdev_daemon = __esm({
|
|
|
6484
6485
|
}
|
|
6485
6486
|
case "agent_command": {
|
|
6486
6487
|
const agentType = args?.agentType || args?.cliType;
|
|
6487
|
-
const dir = args?.dir
|
|
6488
|
+
const dir = args?.dir;
|
|
6488
6489
|
const action = args?.action;
|
|
6489
6490
|
if (!agentType || !action) throw new Error("agentType and action required");
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6491
|
+
let adapter;
|
|
6492
|
+
if (dir) {
|
|
6493
|
+
const key = this.getCliKey(agentType, dir);
|
|
6494
|
+
adapter = this.adapters.get(key);
|
|
6495
|
+
}
|
|
6496
|
+
if (!adapter) {
|
|
6497
|
+
for (const [k, a] of this.adapters) {
|
|
6498
|
+
if (a.cliType === agentType || k.startsWith(agentType)) {
|
|
6499
|
+
adapter = a;
|
|
6500
|
+
break;
|
|
6501
|
+
}
|
|
6502
|
+
}
|
|
6503
|
+
}
|
|
6504
|
+
if (!adapter) throw new Error(`CLI agent not running: ${agentType}`);
|
|
6493
6505
|
if (action === "send_chat") {
|
|
6494
6506
|
const message = args.message || args.text;
|
|
6495
6507
|
if (!message) throw new Error("message required for send_chat");
|
|
@@ -6501,7 +6513,14 @@ var init_adhdev_daemon = __esm({
|
|
|
6501
6513
|
}
|
|
6502
6514
|
this.sendResult(msg, true, { cleared: true });
|
|
6503
6515
|
} else if (action === "stop") {
|
|
6504
|
-
|
|
6516
|
+
let adapterKey;
|
|
6517
|
+
for (const [k, a] of this.adapters) {
|
|
6518
|
+
if (a === adapter) {
|
|
6519
|
+
adapterKey = k;
|
|
6520
|
+
break;
|
|
6521
|
+
}
|
|
6522
|
+
}
|
|
6523
|
+
if (adapterKey) await this.stopCliSession(adapterKey);
|
|
6505
6524
|
this.sendResult(msg, true, { stopped: true });
|
|
6506
6525
|
} else {
|
|
6507
6526
|
throw new Error(`Unknown action: ${action}`);
|
|
@@ -6770,14 +6789,7 @@ var init_adhdev_daemon = __esm({
|
|
|
6770
6789
|
adapter.setOnStatusChange(() => this.sendUnifiedStatusReport());
|
|
6771
6790
|
if (typeof adapter.setOnPtyData === "function") {
|
|
6772
6791
|
adapter.setOnPtyData((data) => {
|
|
6773
|
-
|
|
6774
|
-
if (!sentViaP2P && this.bridge) {
|
|
6775
|
-
this.bridge.sendMessage("pty_output", {
|
|
6776
|
-
cliType: key,
|
|
6777
|
-
// adapter key (cliType_hash)
|
|
6778
|
-
data
|
|
6779
|
-
});
|
|
6780
|
-
}
|
|
6792
|
+
this.p2p?.broadcastPtyOutput(key, data);
|
|
6781
6793
|
});
|
|
6782
6794
|
}
|
|
6783
6795
|
this.adapters.set(key, adapter);
|