adhdev 0.6.34 → 0.6.36
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 +146 -35
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +104 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1281,21 +1281,41 @@ var init_manager = __esm({
|
|
|
1281
1281
|
clickCount: 1
|
|
1282
1282
|
});
|
|
1283
1283
|
await new Promise((r) => setTimeout(r, 150));
|
|
1284
|
-
|
|
1284
|
+
const lines = text.split("\n");
|
|
1285
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1286
|
+
if (lines[i].length > 0) {
|
|
1287
|
+
await this.sendInternal("Input.insertText", { text: lines[i] });
|
|
1288
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
1289
|
+
}
|
|
1290
|
+
if (i < lines.length - 1) {
|
|
1291
|
+
await this.sendInternal("Input.dispatchKeyEvent", { type: "rawKeyDown", key: "Enter", code: "Enter", windowsVirtualKeyCode: 13, modifiers: 8 });
|
|
1292
|
+
await this.sendInternal("Input.dispatchKeyEvent", { type: "char", key: "Enter", code: "Enter", windowsVirtualKeyCode: 13, text: "\r", unmodifiedText: "\r", modifiers: 8 });
|
|
1293
|
+
await this.sendInternal("Input.dispatchKeyEvent", { type: "keyUp", key: "Enter", code: "Enter", windowsVirtualKeyCode: 13, modifiers: 8 });
|
|
1294
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1285
1297
|
await new Promise((r) => setTimeout(r, 200));
|
|
1286
1298
|
await this.sendInternal("Input.dispatchKeyEvent", {
|
|
1287
1299
|
type: "rawKeyDown",
|
|
1288
1300
|
key: "Enter",
|
|
1289
1301
|
code: "Enter",
|
|
1290
1302
|
windowsVirtualKeyCode: 13,
|
|
1291
|
-
|
|
1303
|
+
text: "\r",
|
|
1304
|
+
unmodifiedText: "\r"
|
|
1292
1305
|
});
|
|
1293
1306
|
await this.sendInternal("Input.dispatchKeyEvent", {
|
|
1294
|
-
type: "
|
|
1307
|
+
type: "char",
|
|
1295
1308
|
key: "Enter",
|
|
1296
1309
|
code: "Enter",
|
|
1297
1310
|
windowsVirtualKeyCode: 13,
|
|
1298
|
-
|
|
1311
|
+
text: "\r",
|
|
1312
|
+
unmodifiedText: "\r"
|
|
1313
|
+
});
|
|
1314
|
+
await this.sendInternal("Input.dispatchKeyEvent", {
|
|
1315
|
+
type: "keyUp",
|
|
1316
|
+
key: "Enter",
|
|
1317
|
+
code: "Enter",
|
|
1318
|
+
windowsVirtualKeyCode: 13
|
|
1299
1319
|
});
|
|
1300
1320
|
this.log(`[CDP] typeAndSend: sent "${text.substring(0, 50)}..."`);
|
|
1301
1321
|
return true;
|
|
@@ -1349,21 +1369,41 @@ var init_manager = __esm({
|
|
|
1349
1369
|
windowsVirtualKeyCode: 8
|
|
1350
1370
|
});
|
|
1351
1371
|
await new Promise((r) => setTimeout(r, 150));
|
|
1352
|
-
|
|
1372
|
+
const lines = text.split("\n");
|
|
1373
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1374
|
+
if (lines[i].length > 0) {
|
|
1375
|
+
await this.sendInternal("Input.insertText", { text: lines[i] });
|
|
1376
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
1377
|
+
}
|
|
1378
|
+
if (i < lines.length - 1) {
|
|
1379
|
+
await this.sendInternal("Input.dispatchKeyEvent", { type: "rawKeyDown", key: "Enter", code: "Enter", windowsVirtualKeyCode: 13, modifiers: 8 });
|
|
1380
|
+
await this.sendInternal("Input.dispatchKeyEvent", { type: "char", key: "Enter", code: "Enter", windowsVirtualKeyCode: 13, text: "\r", unmodifiedText: "\r", modifiers: 8 });
|
|
1381
|
+
await this.sendInternal("Input.dispatchKeyEvent", { type: "keyUp", key: "Enter", code: "Enter", windowsVirtualKeyCode: 13, modifiers: 8 });
|
|
1382
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1353
1385
|
await new Promise((r) => setTimeout(r, 200));
|
|
1354
1386
|
await this.sendInternal("Input.dispatchKeyEvent", {
|
|
1355
1387
|
type: "rawKeyDown",
|
|
1356
1388
|
key: "Enter",
|
|
1357
1389
|
code: "Enter",
|
|
1358
1390
|
windowsVirtualKeyCode: 13,
|
|
1359
|
-
|
|
1391
|
+
text: "\r",
|
|
1392
|
+
unmodifiedText: "\r"
|
|
1360
1393
|
});
|
|
1361
1394
|
await this.sendInternal("Input.dispatchKeyEvent", {
|
|
1362
|
-
type: "
|
|
1395
|
+
type: "char",
|
|
1363
1396
|
key: "Enter",
|
|
1364
1397
|
code: "Enter",
|
|
1365
1398
|
windowsVirtualKeyCode: 13,
|
|
1366
|
-
|
|
1399
|
+
text: "\r",
|
|
1400
|
+
unmodifiedText: "\r"
|
|
1401
|
+
});
|
|
1402
|
+
await this.sendInternal("Input.dispatchKeyEvent", {
|
|
1403
|
+
type: "keyUp",
|
|
1404
|
+
key: "Enter",
|
|
1405
|
+
code: "Enter",
|
|
1406
|
+
windowsVirtualKeyCode: 13
|
|
1367
1407
|
});
|
|
1368
1408
|
this.log(`[CDP] typeAndSendAt(${Math.round(x)},${Math.round(y)}): sent "${text.substring(0, 50)}..."`);
|
|
1369
1409
|
return true;
|
|
@@ -4983,7 +5023,9 @@ var init_provider_loader = __esm({
|
|
|
4983
5023
|
if (options?.builtinDir) {
|
|
4984
5024
|
this.builtinDirs = Array.isArray(options.builtinDir) ? options.builtinDir : [options.builtinDir];
|
|
4985
5025
|
} else {
|
|
4986
|
-
|
|
5026
|
+
const bundledDir = path6.resolve(__dirname, "../providers/_builtin");
|
|
5027
|
+
const devDir = path6.resolve(__dirname, "../../providers/_builtin");
|
|
5028
|
+
this.builtinDirs = [fs5.existsSync(devDir) ? devDir : bundledDir];
|
|
4987
5029
|
}
|
|
4988
5030
|
this.userDir = options?.userDir || path6.join(os7.homedir(), ".adhdev", "providers");
|
|
4989
5031
|
this.upstreamDir = path6.join(this.userDir, ".upstream");
|
|
@@ -26572,6 +26614,7 @@ var init_dev_server = __esm({
|
|
|
26572
26614
|
{ method: "GET", pattern: "/api/providers/versions", handler: (q, s) => this.handleDetectVersions(q, s) },
|
|
26573
26615
|
{ method: "POST", pattern: "/api/providers/reload", handler: (q, s) => this.handleReload(q, s) },
|
|
26574
26616
|
{ method: "POST", pattern: "/api/cdp/evaluate", handler: (q, s) => this.handleCdpEvaluate(q, s) },
|
|
26617
|
+
{ method: "POST", pattern: "/api/cdp/click", handler: (q, s) => this.handleCdpClick(q, s) },
|
|
26575
26618
|
{ method: "POST", pattern: "/api/cdp/dom/query", handler: (q, s) => this.handleCdpDomQuery(q, s) },
|
|
26576
26619
|
{ method: "POST", pattern: "/api/cdp/dom/inspect", handler: (q, s) => this.handleDomInspect(q, s) },
|
|
26577
26620
|
{ method: "POST", pattern: "/api/cdp/dom/children", handler: (q, s) => this.handleDomChildren(q, s) },
|
|
@@ -26602,6 +26645,7 @@ var init_dev_server = __esm({
|
|
|
26602
26645
|
{ method: "POST", pattern: /^\/api\/providers\/([^/]+)\/file$/, handler: (q, s, p) => this.handleWriteFile(p[0], q, s) },
|
|
26603
26646
|
{ method: "GET", pattern: /^\/api\/providers\/([^/]+)\/source$/, handler: (q, s, p) => this.handleSource(p[0], q, s) },
|
|
26604
26647
|
{ method: "POST", pattern: /^\/api\/providers\/([^/]+)\/save$/, handler: (q, s, p) => this.handleSave(p[0], q, s) },
|
|
26648
|
+
{ method: "POST", pattern: /^\/api\/providers\/([^/]+)\/typeAndSend$/, handler: (q, s, p) => this.handleTypeAndSend(p[0], q, s) },
|
|
26605
26649
|
{ method: "GET", pattern: /^\/api\/providers\/([^/]+)\/config$/, handler: (q, s, p) => this.handleProviderConfig(p[0], q, s) },
|
|
26606
26650
|
{ method: "POST", pattern: /^\/api\/providers\/([^/]+)\/dom-context$/, handler: (q, s, p) => this.handleDomContext(p[0], q, s) },
|
|
26607
26651
|
{ method: "POST", pattern: /^\/api\/providers\/([^/]+)\/auto-implement$/, handler: (q, s, p) => this.handleAutoImplement(p[0], q, s) },
|
|
@@ -26844,6 +26888,7 @@ var init_dev_server = __esm({
|
|
|
26844
26888
|
} catch {
|
|
26845
26889
|
}
|
|
26846
26890
|
}
|
|
26891
|
+
this.log(`Script raw debug: typeof=${typeof raw}, raw=${JSON.stringify(raw)}, parsed=${JSON.stringify(result)}`);
|
|
26847
26892
|
this.json(res, 200, { type, script: scriptName, result });
|
|
26848
26893
|
} catch (e) {
|
|
26849
26894
|
this.json(res, 500, { error: `Script execution failed: ${e.message}` });
|
|
@@ -26878,6 +26923,26 @@ var init_dev_server = __esm({
|
|
|
26878
26923
|
this.json(res, 500, { error: e.message });
|
|
26879
26924
|
}
|
|
26880
26925
|
}
|
|
26926
|
+
async handleCdpClick(req, res) {
|
|
26927
|
+
const body = await this.readBody(req);
|
|
26928
|
+
const { ideType, x, y } = body;
|
|
26929
|
+
if (x == null || y == null) {
|
|
26930
|
+
this.json(res, 400, { error: "x and y coordinates required" });
|
|
26931
|
+
return;
|
|
26932
|
+
}
|
|
26933
|
+
const cdp = this.getCdp(ideType);
|
|
26934
|
+
if (!cdp?.isConnected) {
|
|
26935
|
+
this.json(res, 503, { error: "No CDP connection available" });
|
|
26936
|
+
return;
|
|
26937
|
+
}
|
|
26938
|
+
try {
|
|
26939
|
+
await cdp.send("Input.dispatchMouseEvent", { type: "mousePressed", x, y, button: "left", clickCount: 1 });
|
|
26940
|
+
await cdp.send("Input.dispatchMouseEvent", { type: "mouseReleased", x, y, button: "left", clickCount: 1 });
|
|
26941
|
+
this.json(res, 200, { success: true, clicked: true, x, y });
|
|
26942
|
+
} catch (e) {
|
|
26943
|
+
this.json(res, 500, { error: e.message });
|
|
26944
|
+
}
|
|
26945
|
+
}
|
|
26881
26946
|
async handleCdpDomQuery(req, res) {
|
|
26882
26947
|
const body = await this.readBody(req);
|
|
26883
26948
|
const { selector, limit = 10, ideType } = body;
|
|
@@ -26986,6 +27051,11 @@ var init_dev_server = __esm({
|
|
|
26986
27051
|
name: p.name,
|
|
26987
27052
|
category: p.category
|
|
26988
27053
|
}));
|
|
27054
|
+
for (const cdp of this.cdpManagers.values()) {
|
|
27055
|
+
if (!cdp.isConnected) {
|
|
27056
|
+
cdp._targetId = null;
|
|
27057
|
+
}
|
|
27058
|
+
}
|
|
26989
27059
|
this.json(res, 200, { reloaded: true, providers });
|
|
26990
27060
|
} catch (e) {
|
|
26991
27061
|
this.json(res, 500, { error: e.message });
|
|
@@ -27141,7 +27211,7 @@ var init_dev_server = __esm({
|
|
|
27141
27211
|
const provider = this.providerLoader.getMeta(type);
|
|
27142
27212
|
if (!provider) return null;
|
|
27143
27213
|
const cat = provider.category;
|
|
27144
|
-
const builtinDir = this.providerLoader.
|
|
27214
|
+
const builtinDir = this.providerLoader.builtinDirs?.[0] || path12.resolve(__dirname, "../providers/_builtin");
|
|
27145
27215
|
const userDir = path12.join(os14.homedir(), ".adhdev", "providers");
|
|
27146
27216
|
const directCandidates = [
|
|
27147
27217
|
path12.join(userDir, type),
|
|
@@ -27292,6 +27362,25 @@ var init_dev_server = __esm({
|
|
|
27292
27362
|
this.json(res, 500, { error: `Save failed: ${e.message}` });
|
|
27293
27363
|
}
|
|
27294
27364
|
}
|
|
27365
|
+
async handleTypeAndSend(type, req, res) {
|
|
27366
|
+
const body = await this.readBody(req);
|
|
27367
|
+
const { selector, text } = body;
|
|
27368
|
+
if (!selector || typeof selector !== "string" || !text || typeof text !== "string") {
|
|
27369
|
+
this.json(res, 400, { error: "selector and text strings required" });
|
|
27370
|
+
return;
|
|
27371
|
+
}
|
|
27372
|
+
const cdp = this.getCdp(type);
|
|
27373
|
+
if (!cdp) {
|
|
27374
|
+
this.json(res, 503, { error: `CDP not connected for '${type}'` });
|
|
27375
|
+
return;
|
|
27376
|
+
}
|
|
27377
|
+
try {
|
|
27378
|
+
const sent = await cdp.typeAndSend(selector, text);
|
|
27379
|
+
this.json(res, 200, { sent });
|
|
27380
|
+
} catch (e) {
|
|
27381
|
+
this.json(res, 500, { error: e.message });
|
|
27382
|
+
}
|
|
27383
|
+
}
|
|
27295
27384
|
async handleScriptHints(type, _req, res) {
|
|
27296
27385
|
const dir = this.findProviderDir(type);
|
|
27297
27386
|
if (!dir) {
|
|
@@ -27527,7 +27616,7 @@ var init_dev_server = __esm({
|
|
|
27527
27616
|
if (location === "user") {
|
|
27528
27617
|
targetDir = path12.join(os14.homedir(), ".adhdev", "providers", type);
|
|
27529
27618
|
} else {
|
|
27530
|
-
const builtinDir = path12.resolve(__dirname, "../providers/_builtin");
|
|
27619
|
+
const builtinDir = this.providerLoader.builtinDirs?.[0] || path12.resolve(__dirname, "../providers/_builtin");
|
|
27531
27620
|
targetDir = path12.join(builtinDir, category, type);
|
|
27532
27621
|
}
|
|
27533
27622
|
const jsonPath = path12.join(targetDir, "provider.json");
|
|
@@ -28337,7 +28426,7 @@ var init_dev_server = __esm({
|
|
|
28337
28426
|
const domContext = null;
|
|
28338
28427
|
this.sendAutoImplSSE({ event: "progress", data: { function: "_init", status: "loading_reference", message: `\uB808\uD37C\uB7F0\uC2A4 \uC2A4\uD06C\uB9BD\uD2B8 \uB85C\uB4DC \uC911 (${reference})...` } });
|
|
28339
28428
|
let referenceScripts = {};
|
|
28340
|
-
const builtinDir = this.providerLoader.
|
|
28429
|
+
const builtinDir = this.providerLoader.builtinDirs?.[0] || path12.resolve(__dirname, "../providers/_builtin");
|
|
28341
28430
|
const refDir = path12.join(builtinDir, "ide", reference);
|
|
28342
28431
|
if (fs9.existsSync(refDir)) {
|
|
28343
28432
|
const scriptsDir = path12.join(refDir, "scripts");
|
|
@@ -28537,7 +28626,7 @@ var init_dev_server = __esm({
|
|
|
28537
28626
|
}
|
|
28538
28627
|
if (model) args.push("--model", model);
|
|
28539
28628
|
const escapedArgs = args.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
28540
|
-
const metaPrompt = `Read the file at ${promptFile} and follow ALL instructions recursively. You have full authority to implement ALL required script files, update provider.json configurations based on the reference patterns, and independently test them against 127.0.0.1:19280 via CDP CURL. Upon complete validation of ALL assigned files, print exactly "
|
|
28629
|
+
const metaPrompt = `Read the file at ${promptFile} and follow ALL instructions recursively. You have full authority to implement ALL required script files, update provider.json configurations based on the reference patterns, and independently test them against 127.0.0.1:19280 via CDP CURL. Upon complete validation of ALL assigned files, print exactly "_PIPELINE_COMPLETE_SIGNAL_" to gracefully close the pipeline. DO NOT WAIT FOR APPROVAL, execute completely autonomously.`;
|
|
28541
28630
|
shellCmd = `${command} ${escapedArgs} "${metaPrompt}"`;
|
|
28542
28631
|
} else {
|
|
28543
28632
|
const escapedArgs = baseArgs.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
@@ -28599,7 +28688,7 @@ var init_dev_server = __esm({
|
|
|
28599
28688
|
const cleanData = chunk.replace(/\x1B\[\d*[A-HJKSTfG]/g, " ").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "").replace(/\x1B\][^\x07]*\x07/g, "").replace(/\x1B\][^\x1B]*\x1B\\/g, "").replace(/ +/g, " ");
|
|
28600
28689
|
approvalBuffer = (approvalBuffer + cleanData).slice(-1500);
|
|
28601
28690
|
const elapsed = Date.now() - spawnedAt;
|
|
28602
|
-
if (elapsed > 15e3 && approvalBuffer.includes("
|
|
28691
|
+
if (elapsed > 15e3 && approvalBuffer.includes("_PIPELINE_COMPLETE_SIGNAL_")) {
|
|
28603
28692
|
this.log(`Agent finished task after ${Math.round(elapsed / 1e3)}s. Terminating interactive CLI session to unblock pipeline.`);
|
|
28604
28693
|
this.sendAutoImplSSE({ event: "output", data: { chunk: `
|
|
28605
28694
|
[\u{1F916} ADHDev Pipeline] Completion token detected. Proceeding...
|
|
@@ -30744,7 +30833,7 @@ var init_adhdev_daemon = __esm({
|
|
|
30744
30833
|
fs11 = __toESM(require("fs"));
|
|
30745
30834
|
path14 = __toESM(require("path"));
|
|
30746
30835
|
import_chalk2 = __toESM(require("chalk"));
|
|
30747
|
-
pkgVersion = "0.6.
|
|
30836
|
+
pkgVersion = "0.6.36";
|
|
30748
30837
|
if (pkgVersion === "unknown") {
|
|
30749
30838
|
try {
|
|
30750
30839
|
const possiblePaths = [
|