adhdev 0.6.19 → 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/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
  });
@@ -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`);
@@ -28446,6 +28544,7 @@ var init_dev_server = __esm({
28446
28544
  }
28447
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)` } });
28448
28546
  this.autoImplStatus = { running: true, type, progress: [] };
28547
+ const spawnedAt = Date.now();
28449
28548
  let child;
28450
28549
  let isPty = false;
28451
28550
  const { spawn: spawnFn } = await import("child_process");
@@ -28498,8 +28597,9 @@ var init_dev_server = __esm({
28498
28597
  const checkAutoApproval = (chunk, writeFn) => {
28499
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, " ");
28500
28599
  approvalBuffer = (approvalBuffer + cleanData).slice(-1500);
28501
- if (approvalBuffer.includes("AUTO_IMPLEMENT_FINISHED")) {
28502
- this.log("Agent finished task. Terminating interactive CLI session to unblock pipeline.");
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.`);
28503
28603
  this.sendAutoImplSSE({ event: "output", data: { chunk: `
28504
28604
  [\u{1F916} ADHDev Pipeline] Completion token detected. Proceeding...
28505
28605
  `, stream: "stdout" } });
@@ -28601,7 +28701,7 @@ var init_dev_server = __esm({
28601
28701
  this.json(res, 500, { error: `Auto-implement failed: ${e.message}` });
28602
28702
  }
28603
28703
  }
28604
- buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts) {
28704
+ buildAutoImplPrompt(type, provider, providerDir, functions, domContext, referenceScripts, userComment) {
28605
28705
  const lines = [];
28606
28706
  lines.push("You are implementing browser automation scripts for an IDE provider.");
28607
28707
  lines.push("Be concise. Do NOT explain your reasoning. Just edit files directly.");
@@ -28755,6 +28855,13 @@ var init_dev_server = __esm({
28755
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.");
28756
28856
  lines.push("4. Ensure `readChat` extracts `content` with precise markdown formatting (especially for tables/code) and assigns correct `kind` tags (`thought`, `tool`, `terminal`).");
28757
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
+ }
28758
28865
  lines.push("Start NOW. Do not ask for permission. Explore the DOM -> Code -> Test.");
28759
28866
  return lines.join("\n");
28760
28867
  }
@@ -30580,7 +30687,7 @@ var init_adhdev_daemon = __esm({
30580
30687
  fs11 = __toESM(require("fs"));
30581
30688
  path14 = __toESM(require("path"));
30582
30689
  import_chalk2 = __toESM(require("chalk"));
30583
- pkgVersion = "0.6.19";
30690
+ pkgVersion = "0.6.21";
30584
30691
  if (pkgVersion === "unknown") {
30585
30692
  try {
30586
30693
  const possiblePaths = [