adhdev 0.6.18 → 0.6.21
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 +251 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +123 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4822,6 +4822,15 @@ var init_handler = __esm({
|
|
|
4822
4822
|
return handleExtensionScript(this, args, "listModes");
|
|
4823
4823
|
case "set_extension_mode":
|
|
4824
4824
|
return handleExtensionScript(this, args, "setMode");
|
|
4825
|
+
// ─── Provider Auto-Fix / Clone (DevServer proxy) ──────────
|
|
4826
|
+
case "provider_auto_fix":
|
|
4827
|
+
return this.proxyDevServerPost(args, "auto-implement");
|
|
4828
|
+
case "provider_auto_fix_cancel":
|
|
4829
|
+
return this.proxyDevServerPost(args, "auto-implement/cancel");
|
|
4830
|
+
case "provider_auto_fix_status":
|
|
4831
|
+
return this.proxyDevServerGet(args, "auto-implement/status");
|
|
4832
|
+
case "provider_clone":
|
|
4833
|
+
return this.proxyDevServerScaffold(args);
|
|
4825
4834
|
default:
|
|
4826
4835
|
return { success: false, error: `Unknown command: ${cmd}` };
|
|
4827
4836
|
}
|
|
@@ -4849,6 +4858,95 @@ var init_handler = __esm({
|
|
|
4849
4858
|
}
|
|
4850
4859
|
return { success: false, error: "ProviderLoader not initialized" };
|
|
4851
4860
|
}
|
|
4861
|
+
// ─── DevServer HTTP proxy helpers ─────────────────
|
|
4862
|
+
// These bridge WS commands to the DevServer REST API (localhost:19280)
|
|
4863
|
+
async proxyDevServerPost(args, endpoint) {
|
|
4864
|
+
const { providerType, ...body } = args || {};
|
|
4865
|
+
if (!providerType) return { success: false, error: "providerType required" };
|
|
4866
|
+
try {
|
|
4867
|
+
const http3 = await import("http");
|
|
4868
|
+
const postData = JSON.stringify(body);
|
|
4869
|
+
const result = await new Promise((resolve8, reject) => {
|
|
4870
|
+
const req = http3.request({
|
|
4871
|
+
hostname: "127.0.0.1",
|
|
4872
|
+
port: 19280,
|
|
4873
|
+
path: `/api/providers/${providerType}/${endpoint}`,
|
|
4874
|
+
method: "POST",
|
|
4875
|
+
headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
|
|
4876
|
+
}, (res) => {
|
|
4877
|
+
let data = "";
|
|
4878
|
+
res.on("data", (chunk) => data += chunk);
|
|
4879
|
+
res.on("end", () => {
|
|
4880
|
+
try {
|
|
4881
|
+
resolve8(JSON.parse(data));
|
|
4882
|
+
} catch {
|
|
4883
|
+
resolve8({ raw: data });
|
|
4884
|
+
}
|
|
4885
|
+
});
|
|
4886
|
+
});
|
|
4887
|
+
req.on("error", reject);
|
|
4888
|
+
req.write(postData);
|
|
4889
|
+
req.end();
|
|
4890
|
+
});
|
|
4891
|
+
return { success: true, ...result };
|
|
4892
|
+
} catch (e) {
|
|
4893
|
+
return { success: false, error: `DevServer unreachable: ${e.message}. Start daemon with --dev flag.` };
|
|
4894
|
+
}
|
|
4895
|
+
}
|
|
4896
|
+
async proxyDevServerGet(args, endpoint) {
|
|
4897
|
+
const { providerType } = args || {};
|
|
4898
|
+
if (!providerType) return { success: false, error: "providerType required" };
|
|
4899
|
+
try {
|
|
4900
|
+
const http3 = await import("http");
|
|
4901
|
+
const result = await new Promise((resolve8, reject) => {
|
|
4902
|
+
http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
|
|
4903
|
+
let data = "";
|
|
4904
|
+
res.on("data", (chunk) => data += chunk);
|
|
4905
|
+
res.on("end", () => {
|
|
4906
|
+
try {
|
|
4907
|
+
resolve8(JSON.parse(data));
|
|
4908
|
+
} catch {
|
|
4909
|
+
resolve8({ raw: data });
|
|
4910
|
+
}
|
|
4911
|
+
});
|
|
4912
|
+
}).on("error", reject);
|
|
4913
|
+
});
|
|
4914
|
+
return { success: true, ...result };
|
|
4915
|
+
} catch (e) {
|
|
4916
|
+
return { success: false, error: `DevServer unreachable: ${e.message}. Start daemon with --dev flag.` };
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
async proxyDevServerScaffold(args) {
|
|
4920
|
+
try {
|
|
4921
|
+
const http3 = await import("http");
|
|
4922
|
+
const postData = JSON.stringify(args || {});
|
|
4923
|
+
const result = await new Promise((resolve8, reject) => {
|
|
4924
|
+
const req = http3.request({
|
|
4925
|
+
hostname: "127.0.0.1",
|
|
4926
|
+
port: 19280,
|
|
4927
|
+
path: "/api/scaffold",
|
|
4928
|
+
method: "POST",
|
|
4929
|
+
headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData) }
|
|
4930
|
+
}, (res) => {
|
|
4931
|
+
let data = "";
|
|
4932
|
+
res.on("data", (chunk) => data += chunk);
|
|
4933
|
+
res.on("end", () => {
|
|
4934
|
+
try {
|
|
4935
|
+
resolve8(JSON.parse(data));
|
|
4936
|
+
} catch {
|
|
4937
|
+
resolve8({ raw: data });
|
|
4938
|
+
}
|
|
4939
|
+
});
|
|
4940
|
+
});
|
|
4941
|
+
req.on("error", reject);
|
|
4942
|
+
req.write(postData);
|
|
4943
|
+
req.end();
|
|
4944
|
+
});
|
|
4945
|
+
return { success: true, ...result };
|
|
4946
|
+
} catch (e) {
|
|
4947
|
+
return { success: false, error: `DevServer unreachable: ${e.message}. Start daemon with --dev flag.` };
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4852
4950
|
};
|
|
4853
4951
|
}
|
|
4854
4952
|
});
|
|
@@ -26699,7 +26797,7 @@ var init_dev_server = __esm({
|
|
|
26699
26797
|
this.json(res, 400, { error: `Script '${scriptName}' not found in provider '${type}'`, available: provider.scripts ? Object.keys(provider.scripts) : [] });
|
|
26700
26798
|
return;
|
|
26701
26799
|
}
|
|
26702
|
-
const cdp = this.getCdp(scriptIdeType);
|
|
26800
|
+
const cdp = this.getCdp(scriptIdeType || type);
|
|
26703
26801
|
if (!cdp) {
|
|
26704
26802
|
this.json(res, 503, { error: "No CDP connection available" });
|
|
26705
26803
|
return;
|
|
@@ -28214,7 +28312,7 @@ var init_dev_server = __esm({
|
|
|
28214
28312
|
// ─── Phase 2: Auto-Implement Backend ───
|
|
28215
28313
|
async handleAutoImplement(type, req, res) {
|
|
28216
28314
|
const body = await this.readBody(req);
|
|
28217
|
-
const { agent = "claude-cli", functions, reference = "antigravity", model } = body;
|
|
28315
|
+
const { agent = "claude-cli", functions, reference = "antigravity", model, comment } = body;
|
|
28218
28316
|
if (!functions || !Array.isArray(functions) || functions.length === 0) {
|
|
28219
28317
|
this.json(res, 400, { error: 'functions[] is required (e.g. ["readChat", "sendMessage"])' });
|
|
28220
28318
|
return;
|
|
@@ -28263,7 +28361,7 @@ var init_dev_server = __esm({
|
|
|
28263
28361
|
}
|
|
28264
28362
|
}
|
|
28265
28363
|
}
|
|
28266
|
-
const prompt = this.buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts);
|
|
28364
|
+
const prompt = this.buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts, comment);
|
|
28267
28365
|
const tmpDir = path12.join(os14.tmpdir(), "adhdev-autoimpl");
|
|
28268
28366
|
if (!fs9.existsSync(tmpDir)) fs9.mkdirSync(tmpDir, { recursive: true });
|
|
28269
28367
|
const promptFile = path12.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
|
|
@@ -28418,9 +28516,11 @@ var init_dev_server = __esm({
|
|
|
28418
28516
|
const baseArgs = [...spawn3.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
28419
28517
|
let shellCmd;
|
|
28420
28518
|
if (command === "claude") {
|
|
28421
|
-
const args = [...baseArgs, "--
|
|
28519
|
+
const args = [...baseArgs, "--dangerously-skip-permissions"];
|
|
28520
|
+
if (model) args.push("--model", model);
|
|
28422
28521
|
const escapedArgs = args.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
28423
|
-
|
|
28522
|
+
const metaPrompt = `Read the file at ${promptFile} and follow ALL the instructions. Implement the specific function requested, then test it via CDP curl targeting 127.0.0.1:19280, wait for confirmation of success, and then close. DO NOT start working on other features not listed in the prompt constraint.`;
|
|
28523
|
+
shellCmd = `${command} ${escapedArgs} -p "${metaPrompt}"`;
|
|
28424
28524
|
} else if (command === "gemini") {
|
|
28425
28525
|
const args = [...baseArgs, "-y", "-s", "false"];
|
|
28426
28526
|
if (model) args.push("-m", model);
|
|
@@ -28436,7 +28536,7 @@ var init_dev_server = __esm({
|
|
|
28436
28536
|
}
|
|
28437
28537
|
if (model) args.push("--model", model);
|
|
28438
28538
|
const escapedArgs = args.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
28439
|
-
const metaPrompt = `Read the file at ${promptFile} and follow ALL
|
|
28539
|
+
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 "AUTO_IMPLEMENT_FINISHED" to gracefully close the pipeline. DO NOT WAIT FOR APPROVAL, execute completely autonomously.`;
|
|
28440
28540
|
shellCmd = `${command} ${escapedArgs} "${metaPrompt}"`;
|
|
28441
28541
|
} else {
|
|
28442
28542
|
const escapedArgs = baseArgs.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
|
|
@@ -28444,6 +28544,7 @@ var init_dev_server = __esm({
|
|
|
28444
28544
|
}
|
|
28445
28545
|
this.sendAutoImplSSE({ event: "progress", data: { function: "_init", status: "spawning", message: `\uC5D0\uC774\uC804\uD2B8 \uC2E4\uD589 \uC911: ${shellCmd.substring(0, 200)}... (prompt: ${prompt.length} chars)` } });
|
|
28446
28546
|
this.autoImplStatus = { running: true, type, progress: [] };
|
|
28547
|
+
const spawnedAt = Date.now();
|
|
28447
28548
|
let child;
|
|
28448
28549
|
let isPty = false;
|
|
28449
28550
|
const { spawn: spawnFn } = await import("child_process");
|
|
@@ -28496,8 +28597,9 @@ var init_dev_server = __esm({
|
|
|
28496
28597
|
const checkAutoApproval = (chunk, writeFn) => {
|
|
28497
28598
|
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, " ");
|
|
28498
28599
|
approvalBuffer = (approvalBuffer + cleanData).slice(-1500);
|
|
28499
|
-
|
|
28500
|
-
|
|
28600
|
+
const elapsed = Date.now() - spawnedAt;
|
|
28601
|
+
if (elapsed > 15e3 && approvalBuffer.includes("AUTO_IMPLEMENT_FINISHED")) {
|
|
28602
|
+
this.log(`Agent finished task after ${Math.round(elapsed / 1e3)}s. Terminating interactive CLI session to unblock pipeline.`);
|
|
28501
28603
|
this.sendAutoImplSSE({ event: "output", data: { chunk: `
|
|
28502
28604
|
[\u{1F916} ADHDev Pipeline] Completion token detected. Proceeding...
|
|
28503
28605
|
`, stream: "stdout" } });
|
|
@@ -28599,7 +28701,7 @@ var init_dev_server = __esm({
|
|
|
28599
28701
|
this.json(res, 500, { error: `Auto-implement failed: ${e.message}` });
|
|
28600
28702
|
}
|
|
28601
28703
|
}
|
|
28602
|
-
buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts) {
|
|
28704
|
+
buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts, userComment) {
|
|
28603
28705
|
const lines = [];
|
|
28604
28706
|
lines.push("You are implementing browser automation scripts for an IDE provider.");
|
|
28605
28707
|
lines.push("Be concise. Do NOT explain your reasoning. Just edit files directly.");
|
|
@@ -28715,6 +28817,10 @@ var init_dev_server = __esm({
|
|
|
28715
28817
|
lines.push("1. Edit the script files to implement working code");
|
|
28716
28818
|
lines.push("2. After editing, TEST each function using the DevConsole API (see below)");
|
|
28717
28819
|
lines.push("3. If a test fails, fix the implementation and re-test");
|
|
28820
|
+
lines.push("4. **IMPORTANT VERIFICATION LOGIC**: When verifying your implementation, beware of state contamination! You MUST perform strict Integration Testing:");
|
|
28821
|
+
lines.push(" - `openPanel`: Toggle buttons are usually located in the top header, sidebar, or activity bar. Prefer finding and clicking these native UI buttons over extreme CSS injection hacks if possible.");
|
|
28822
|
+
lines.push(" - `listSessions`: If sessions are unmounted when the panel is closed, try to explicitly interact with the UI to open the history/sessions view (e.g., clicking a history icon usually found near the chat header) BEFORE scraping.");
|
|
28823
|
+
lines.push(" - `switchSession`: Prove your switch was successful by subsequently calling `readChat` and explicitly checking that the chat context has actually changed.");
|
|
28718
28824
|
lines.push("");
|
|
28719
28825
|
lines.push("## YOU MUST EXPLORE THE DOM YOURSELF!");
|
|
28720
28826
|
lines.push("I have NOT provided you with the DOM snapshot. You MUST use your command-line tools to discover the IDE structure dynamically!");
|
|
@@ -28749,6 +28855,13 @@ var init_dev_server = __esm({
|
|
|
28749
28855
|
lines.push("3. Use CDP evaluate to deeply inspect the DOM structure of the newly generated tables, code blocks, thought blocks, and tool calls.");
|
|
28750
28856
|
lines.push("4. Ensure `readChat` extracts `content` with precise markdown formatting (especially for tables/code) and assigns correct `kind` tags (`thought`, `tool`, `terminal`).");
|
|
28751
28857
|
lines.push("");
|
|
28858
|
+
if (userComment) {
|
|
28859
|
+
lines.push("## \u26A0\uFE0F User Instructions (HIGH PRIORITY)");
|
|
28860
|
+
lines.push("The user has provided the following additional instructions. Follow them strictly:");
|
|
28861
|
+
lines.push("");
|
|
28862
|
+
lines.push(userComment);
|
|
28863
|
+
lines.push("");
|
|
28864
|
+
}
|
|
28752
28865
|
lines.push("Start NOW. Do not ask for permission. Explore the DOM -> Code -> Test.");
|
|
28753
28866
|
return lines.join("\n");
|
|
28754
28867
|
}
|
|
@@ -30574,7 +30687,7 @@ var init_adhdev_daemon = __esm({
|
|
|
30574
30687
|
fs11 = __toESM(require("fs"));
|
|
30575
30688
|
path14 = __toESM(require("path"));
|
|
30576
30689
|
import_chalk2 = __toESM(require("chalk"));
|
|
30577
|
-
pkgVersion = "0.6.
|
|
30690
|
+
pkgVersion = "0.6.21";
|
|
30578
30691
|
if (pkgVersion === "unknown") {
|
|
30579
30692
|
try {
|
|
30580
30693
|
const possiblePaths = [
|