openfox 1.6.64 → 1.6.66

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.
@@ -1,3 +1,6 @@
1
+ import {
2
+ startInspectProxy
3
+ } from "./chunk-NRUMWHLX.js";
1
4
  import {
2
5
  createProcess,
3
6
  getPlatformShell,
@@ -3380,7 +3383,7 @@ var callSubAgentTool = {
3380
3383
  };
3381
3384
  }
3382
3385
  try {
3383
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-TSGPRFT2.js");
3386
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-AQEL6ZJG.js");
3384
3387
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3385
3388
  const turnMetrics = new TurnMetrics();
3386
3389
  const result = await executeSubAgent({
@@ -3637,282 +3640,6 @@ var webFetchTool = createTool(
3637
3640
  import { spawn as spawn4 } from "child_process";
3638
3641
  import { readFile as readFile7, writeFile as writeFile5, mkdir as mkdir4 } from "fs/promises";
3639
3642
  import { resolve as resolve5, join as join6 } from "path";
3640
-
3641
- // src/server/dev-server/inspect-proxy.ts
3642
- import net from "net";
3643
- import zlib from "zlib";
3644
- import fs from "fs";
3645
- import "http";
3646
- var INJECT_SCRIPT = '<script src="/__inspect__.js"></script>';
3647
- var proxyPool = /* @__PURE__ */ new Map();
3648
- var nextOffset = 0;
3649
- function getAvailablePort() {
3650
- const base = Number(process.env["OPENFOX_BASE_PROXY_PORT"] ?? 1e4);
3651
- const used = /* @__PURE__ */ new Set();
3652
- for (const instance of proxyPool.values()) {
3653
- const addr = instance.server.address();
3654
- if (addr && typeof addr === "object") used.add(addr.port);
3655
- }
3656
- for (let port = base + 1; port < base + 200; port++) {
3657
- if (!used.has(port)) return port;
3658
- }
3659
- return base + (nextOffset++ % 200 + 1);
3660
- }
3661
- function parseReqHeaders(str) {
3662
- const lines = str.split("\r\n");
3663
- const method = lines[0].split(" ")[0];
3664
- const url = lines[0].split(" ")[1];
3665
- const headers = parseHeaderLines(lines);
3666
- return { method, url, headers };
3667
- }
3668
- function parseResHeaders(str) {
3669
- const lines = str.split("\r\n");
3670
- const status = parseInt(lines[0].split(" ")[1] || "200");
3671
- const headers = parseHeaderLines(lines);
3672
- return { status, headers };
3673
- }
3674
- function parseHeaderLines(lines) {
3675
- const headers = {};
3676
- for (let i = 1; i < lines.length; i++) {
3677
- const line = lines[i];
3678
- if (!line) break;
3679
- const ci = line.indexOf(":");
3680
- if (ci < 0) continue;
3681
- headers[line.slice(0, ci).toLowerCase()] = line.slice(ci + 1).trim();
3682
- }
3683
- return headers;
3684
- }
3685
- function buildResponse(status, headers, body) {
3686
- const statusLine = `HTTP/1.1 ${status} ${status === 200 ? "OK" : status === 404 ? "Not Found" : "Error"}`;
3687
- const headerLines = Object.entries(headers).map(([k, v]) => `${k}: ${v}`).join("\r\n");
3688
- const head = Buffer.from(`${statusLine}\r
3689
- ${headerLines}\r
3690
- \r
3691
- `, "utf8");
3692
- return Buffer.concat([head, body]);
3693
- }
3694
- function forwardHtml(client, body, resHeaders, status) {
3695
- const bi = body.indexOf("</body>");
3696
- const hi = body.indexOf("</head>");
3697
- let modified;
3698
- if (bi >= 0) {
3699
- modified = Buffer.concat([body.slice(0, bi), Buffer.from(INJECT_SCRIPT, "utf8"), body.slice(bi)]);
3700
- } else if (hi >= 0) {
3701
- modified = Buffer.concat([body.slice(0, hi), Buffer.from(INJECT_SCRIPT, "utf8"), body.slice(hi)]);
3702
- } else {
3703
- client.write(body);
3704
- return;
3705
- }
3706
- const newH = { ...resHeaders };
3707
- delete newH["content-length"];
3708
- delete newH["transfer-encoding"];
3709
- newH["content-length"] = Buffer.byteLength(modified).toString();
3710
- const newHead = `HTTP/1.1 ${status} OK\r
3711
- ` + Object.entries(newH).map(([k, v]) => `${k}: ${v}`).join("\r\n") + "\r\n\r\n";
3712
- client.write(Buffer.from(newHead, "utf8"));
3713
- client.write(modified);
3714
- }
3715
- function forwardHtmlChunk(client, chunk) {
3716
- const str = chunk.toString("utf8");
3717
- const bi = str.indexOf("</body>");
3718
- const hi = str.indexOf("</head>");
3719
- if (bi >= 0) {
3720
- const modified = Buffer.from(str.slice(0, bi) + INJECT_SCRIPT + str.slice(bi), "utf8");
3721
- client.write(modified);
3722
- } else if (hi >= 0) {
3723
- const modified = Buffer.from(str.slice(0, hi) + INJECT_SCRIPT + str.slice(hi), "utf8");
3724
- client.write(modified);
3725
- } else {
3726
- client.write(chunk);
3727
- }
3728
- }
3729
- function startInspectProxy(target, sessionManager) {
3730
- const port = getAvailablePort();
3731
- const server = net.createServer((client) => {
3732
- let clientHead = "";
3733
- let clientParsed = false;
3734
- client.on("data", (chunk) => {
3735
- if (clientParsed) return;
3736
- clientHead += chunk.toString("utf8");
3737
- const he = clientHead.indexOf("\r\n\r\n");
3738
- if (he < 0) return;
3739
- const { method, url, headers } = parseReqHeaders(clientHead);
3740
- const isWS = headers["upgrade"] === "websocket";
3741
- clientParsed = true;
3742
- if (url === "/__inspect__.js") {
3743
- const inspectPath = new URL("./server/public/__inspect__.js", import.meta.url);
3744
- let inspectJs = null;
3745
- try {
3746
- inspectJs = fs.readFileSync(inspectPath);
3747
- } catch {
3748
- const resp2 = buildResponse(404, { "Content-Type": "text/plain" }, Buffer.from("Not found"));
3749
- client.write(resp2);
3750
- client.end();
3751
- return;
3752
- }
3753
- const resp = buildResponse(200, { "Content-Type": "application/javascript", "Content-Length": inspectJs.length.toString() }, inspectJs);
3754
- client.write(resp);
3755
- client.end();
3756
- return;
3757
- }
3758
- if (url === "/__openfox_feedback" && method === "POST") {
3759
- const contentLength = parseInt(headers["content-length"] || "0", 10);
3760
- let bodyData = chunk.slice(he + 4);
3761
- let bodyTotal = bodyData.length;
3762
- const handleFeedback = () => {
3763
- try {
3764
- const { sessionId, element, annotation, pageUrl } = JSON.parse(bodyData.toString("utf8"));
3765
- if (sessionId) {
3766
- const elementDesc = element ? `${element.tag}${element.id ? "#" + element.id : ""}` : "unknown";
3767
- const htmlSnippet = element?.outerHTML ? `
3768
- Html: ${element.outerHTML.slice(0, 300)}` : "";
3769
- const textSnippet = element?.textContent ? `
3770
- Text (SVG-stripped): ${element.textContent.slice(0, 500)}` : "";
3771
- const content = `# User feedback from page inspection on dev_server
3772
-
3773
- ## Context
3774
-
3775
- Page: ${pageUrl || ""}
3776
- Element: ${elementDesc}
3777
- xPath: ${element?.xpath || ""}${htmlSnippet}${textSnippet}
3778
-
3779
- ## Feedback
3780
-
3781
- ${annotation || "(none)"}`;
3782
- sessionManager.queueMessage(sessionId, "asap", content, [], "ui_feedback");
3783
- }
3784
- client.write(buildResponse(200, { "Content-Type": "application/json" }, Buffer.from('{"success":true}')));
3785
- } catch {
3786
- client.write(buildResponse(400, { "Content-Type": "application/json" }, Buffer.from('{"error":"Invalid request"}')));
3787
- }
3788
- client.end();
3789
- };
3790
- if (bodyTotal >= contentLength) {
3791
- handleFeedback();
3792
- return;
3793
- }
3794
- client.on("data", (more) => {
3795
- bodyData = Buffer.concat([bodyData, more]);
3796
- bodyTotal += more.length;
3797
- if (bodyTotal < contentLength) return;
3798
- handleFeedback();
3799
- });
3800
- return;
3801
- }
3802
- const targetParts = target.replace(/^https?:\/\//, "").split(":");
3803
- const targetHost = targetParts[0] ?? "127.0.0.1";
3804
- const targetPort = parseInt(targetParts[1] ?? "80");
3805
- if (isWS) {
3806
- const server3 = net.connect(targetPort, targetHost);
3807
- server3.on("error", () => client.destroy());
3808
- client.on("error", () => server3.destroy());
3809
- server3.write(clientHead);
3810
- server3.pipe(client);
3811
- client.pipe(server3);
3812
- return;
3813
- }
3814
- const server2 = net.connect(targetPort, targetHost);
3815
- server2.on("error", () => client.destroy());
3816
- client.on("error", () => server2.destroy());
3817
- server2.write(clientHead);
3818
- client.pipe(server2);
3819
- let serverHeadBuf = "";
3820
- let serverParsed = false;
3821
- let isHtml = false;
3822
- let enc = null;
3823
- let status = 200;
3824
- let resHeaders = {};
3825
- let bodyBuf = [];
3826
- let headEnd = -1;
3827
- server2.on("data", (sChunk) => {
3828
- if (!serverParsed) {
3829
- serverHeadBuf += sChunk.toString("utf8");
3830
- const sHe = serverHeadBuf.indexOf("\r\n\r\n");
3831
- if (sHe < 0) return;
3832
- headEnd = sHe + 4;
3833
- const p = parseResHeaders(serverHeadBuf.slice(0, sHe));
3834
- status = p.status;
3835
- resHeaders = p.headers;
3836
- isHtml = (resHeaders["content-type"] || "").includes("text/html");
3837
- enc = resHeaders["content-encoding"] || null;
3838
- serverParsed = true;
3839
- if (isHtml && enc) {
3840
- bodyBuf.push(sChunk.slice(headEnd));
3841
- return;
3842
- }
3843
- if (isHtml) {
3844
- const body = sChunk.slice(headEnd);
3845
- forwardHtml(client, body, resHeaders, status);
3846
- return;
3847
- }
3848
- client.write(sChunk);
3849
- return;
3850
- }
3851
- if (isHtml && enc) {
3852
- bodyBuf.push(sChunk);
3853
- return;
3854
- }
3855
- if (isHtml) {
3856
- forwardHtmlChunk(client, sChunk);
3857
- return;
3858
- }
3859
- client.write(sChunk);
3860
- });
3861
- server2.on("end", () => {
3862
- if (!serverParsed) {
3863
- client.end();
3864
- return;
3865
- }
3866
- if (isHtml && enc) {
3867
- const fullBody = Buffer.concat(bodyBuf);
3868
- let text;
3869
- try {
3870
- if (enc === "gzip") text = zlib.gunzipSync(fullBody).toString("utf8");
3871
- else if (enc === "deflate") text = zlib.inflateSync(fullBody).toString("utf8");
3872
- else text = fullBody.toString("utf8");
3873
- } catch {
3874
- client.end();
3875
- return;
3876
- }
3877
- const bi = text.indexOf("</body>");
3878
- const hi = text.indexOf("</head>");
3879
- let modified;
3880
- if (bi >= 0) modified = text.slice(0, bi) + INJECT_SCRIPT + text.slice(bi);
3881
- else if (hi >= 0) modified = text.slice(0, hi) + INJECT_SCRIPT + text.slice(hi);
3882
- else {
3883
- client.end();
3884
- return;
3885
- }
3886
- let compressed;
3887
- if (enc === "gzip") compressed = zlib.gzipSync(Buffer.from(modified, "utf8"));
3888
- else if (enc === "deflate") compressed = zlib.deflateSync(Buffer.from(modified, "utf8"));
3889
- else compressed = Buffer.from(modified, "utf8");
3890
- const newH = { ...resHeaders };
3891
- delete newH["content-length"];
3892
- const headStr = `HTTP/1.1 ${status} OK\r
3893
- ` + Object.entries(newH).map(([k, v]) => `${k}: ${v}`).join("\r\n") + "\r\n\r\n";
3894
- client.write(Buffer.from(headStr, "utf8"));
3895
- client.write(compressed);
3896
- }
3897
- client.end();
3898
- });
3899
- });
3900
- client.on("error", () => {
3901
- });
3902
- });
3903
- server.listen(port, "0.0.0.0", () => {
3904
- logger.debug("Inspect proxy listening", { port, target });
3905
- });
3906
- proxyPool.set(target, { server, target });
3907
- const cleanup = () => {
3908
- server.close();
3909
- proxyPool.delete(target);
3910
- logger.debug("Inspect proxy stopped", { port, target });
3911
- };
3912
- return { port, cleanup };
3913
- }
3914
-
3915
- // src/server/dev-server/manager.ts
3916
3643
  var MAX_LOG_LINES = 2e3;
3917
3644
  var MAX_LOG_BYTES = 1e5;
3918
3645
  var getDevServerConfigPath = (workdir) => {
@@ -4389,12 +4116,12 @@ These processes run independently of agent turns and persist across session comp
4389
4116
  }
4390
4117
  const since = args.since ?? 0;
4391
4118
  const maxLines = Math.min(args.maxLines ?? 500, 2e3);
4392
- const { lines, totalLines, nextOffset: nextOffset2, hasMore } = getProcessLogs(args.processId, since, maxLines);
4119
+ const { lines, totalLines, nextOffset, hasMore } = getProcessLogs(args.processId, since, maxLines);
4393
4120
  return helpers.success(JSON.stringify({
4394
4121
  processId: args.processId,
4395
4122
  lines,
4396
4123
  totalLines,
4397
- nextOffset: nextOffset2,
4124
+ nextOffset,
4398
4125
  hasMore,
4399
4126
  truncated: hasMore
4400
4127
  }, null, 2));
@@ -4810,4 +4537,4 @@ export {
4810
4537
  getToolRegistryForAgent,
4811
4538
  createToolRegistry
4812
4539
  };
4813
- //# sourceMappingURL=chunk-7TMH3MPE.js.map
4540
+ //# sourceMappingURL=chunk-PU4AOT3E.js.map
package/dist/cli/dev.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-OXQGLKLE.js";
4
+ } from "../chunk-PCCYGUYA.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-PNBH3RAX.js";
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-OXQGLKLE.js";
4
+ } from "../chunk-PCCYGUYA.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-PNBH3RAX.js";
@@ -0,0 +1,10 @@
1
+ import {
2
+ startInspectProxy,
3
+ stopAllInspectProxies
4
+ } from "./chunk-NRUMWHLX.js";
5
+ import "./chunk-PNBH3RAX.js";
6
+ export {
7
+ startInspectProxy,
8
+ stopAllInspectProxies
9
+ };
10
+ //# sourceMappingURL=inspect-proxy-M5222JOC.js.map
@@ -3,7 +3,7 @@ import {
3
3
  runBuilderTurn,
4
4
  runChatTurn,
5
5
  runVerifierTurn
6
- } from "./chunk-YF3ERP7E.js";
6
+ } from "./chunk-7XO4OW2P.js";
7
7
  import {
8
8
  TurnMetrics,
9
9
  createChatDoneEvent,
@@ -11,7 +11,8 @@ import {
11
11
  createMessageStartEvent,
12
12
  createToolCallEvent,
13
13
  createToolResultEvent
14
- } from "./chunk-7TMH3MPE.js";
14
+ } from "./chunk-PU4AOT3E.js";
15
+ import "./chunk-NRUMWHLX.js";
15
16
  import "./chunk-NBU6KIOD.js";
16
17
  import "./chunk-574HZVLE.js";
17
18
  import "./chunk-7JPKRM6M.js";
@@ -39,4 +40,4 @@ export {
39
40
  runChatTurn,
40
41
  runVerifierTurn
41
42
  };
42
- //# sourceMappingURL=orchestrator-TEL2CUIT.js.map
43
+ //# sourceMappingURL=orchestrator-UEDPSWG6.js.map
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openfox",
3
- "version": "1.6.64",
3
+ "version": "1.6.66",
4
4
  "description": "Local-LLM-first agentic coding assistant",
5
5
  "type": "module",
6
6
  "bin": {
@@ -173,7 +173,7 @@ var QueueProcessor = class {
173
173
  backend: provider?.backend ?? llmClient.getBackend(),
174
174
  model: llmClient.getModel()
175
175
  };
176
- const { runChatTurn } = await import("./orchestrator-TEL2CUIT.js");
176
+ const { runChatTurn } = await import("./orchestrator-UEDPSWG6.js");
177
177
  const runChatTurnParams = buildRunChatTurnParams({
178
178
  sessionManager,
179
179
  sessionId,
@@ -210,4 +210,4 @@ var QueueProcessor = class {
210
210
  export {
211
211
  QueueProcessor
212
212
  };
213
- //# sourceMappingURL=processor-GSMNLIRM.js.map
213
+ //# sourceMappingURL=processor-TSSCNWED.js.map
@@ -6,9 +6,10 @@ import {
6
6
  import {
7
7
  VERSION,
8
8
  createServer
9
- } from "./chunk-JY7BGPTB.js";
10
- import "./chunk-YF3ERP7E.js";
11
- import "./chunk-7TMH3MPE.js";
9
+ } from "./chunk-GFE5Y2UE.js";
10
+ import "./chunk-7XO4OW2P.js";
11
+ import "./chunk-PU4AOT3E.js";
12
+ import "./chunk-NRUMWHLX.js";
12
13
  import "./chunk-NBU6KIOD.js";
13
14
  import "./chunk-574HZVLE.js";
14
15
  import "./chunk-7JPKRM6M.js";
@@ -187,4 +188,4 @@ async function runServe(options) {
187
188
  export {
188
189
  runServe
189
190
  };
190
- //# sourceMappingURL=serve-55UYT2JO.js.map
191
+ //# sourceMappingURL=serve-QTGMR7OM.js.map
@@ -1,9 +1,10 @@
1
1
  import {
2
2
  createServer,
3
3
  createServerHandle
4
- } from "../chunk-JY7BGPTB.js";
5
- import "../chunk-YF3ERP7E.js";
6
- import "../chunk-7TMH3MPE.js";
4
+ } from "../chunk-GFE5Y2UE.js";
5
+ import "../chunk-7XO4OW2P.js";
6
+ import "../chunk-PU4AOT3E.js";
7
+ import "../chunk-NRUMWHLX.js";
7
8
  import "../chunk-NBU6KIOD.js";
8
9
  import "../chunk-574HZVLE.js";
9
10
  import "../chunk-7JPKRM6M.js";
@@ -7,6 +7,7 @@
7
7
  window.__foxInspectEnabled = true;
8
8
  window.__foxSentPending = false;
9
9
  window.__foxPopupOpen = false;
10
+ window.__foxHighlightedEl = null;
10
11
 
11
12
  var overlayStyle = document.createElement('style');
12
13
  overlayStyle.textContent = [
@@ -50,9 +51,9 @@
50
51
  }
51
52
 
52
53
  function clearHighlights() {
53
- var highlighted = document.querySelectorAll('.__fox-highlight');
54
- for (var i = 0; i < highlighted.length; i++) {
55
- highlighted[i].classList.remove('__fox-highlight');
54
+ if (window.__foxHighlightedEl) {
55
+ window.__foxHighlightedEl.classList.remove('__fox-highlight');
56
+ window.__foxHighlightedEl = null;
56
57
  }
57
58
  }
58
59
 
@@ -211,14 +212,9 @@
211
212
  if (!window.__foxInspectMode || window.__foxPopupOpen) return;
212
213
  if (e.target === document.documentElement || e.target === document.body) return;
213
214
  if (overlay.contains(e.target)) return;
215
+ clearHighlights();
214
216
  e.target.classList.add('__fox-highlight');
215
- }, true);
216
-
217
- document.addEventListener('mouseout', function(e) {
218
- if (!window.__foxInspectMode || window.__foxPopupOpen) return;
219
- if (e.target === document.documentElement || e.target === document.body) return;
220
- if (overlay.contains(e.target)) return;
221
- e.target.classList.remove('__fox-highlight');
217
+ window.__foxHighlightedEl = e.target;
222
218
  }, true);
223
219
 
224
220
  document.addEventListener('click', function(e) {
@@ -228,7 +224,9 @@
228
224
 
229
225
  e.preventDefault();
230
226
  e.stopPropagation();
231
- showPopup(e.target, e.clientX, e.clientY);
227
+ var el = window.__foxHighlightedEl;
228
+ if (!el) return;
229
+ showPopup(el, e.clientX, e.clientY);
232
230
  }, true);
233
231
 
234
232
  document.addEventListener('keydown', function(e) {
@@ -11,7 +11,8 @@ import {
11
11
  requestPathAccess,
12
12
  stepDoneTool,
13
13
  validateToolAction
14
- } from "./chunk-7TMH3MPE.js";
14
+ } from "./chunk-PU4AOT3E.js";
15
+ import "./chunk-NRUMWHLX.js";
15
16
  import "./chunk-NBU6KIOD.js";
16
17
  import "./chunk-574HZVLE.js";
17
18
  import "./chunk-7JPKRM6M.js";
@@ -48,4 +49,4 @@ export {
48
49
  stepDoneTool,
49
50
  validateToolAction
50
51
  };
51
- //# sourceMappingURL=tools-TSGPRFT2.js.map
52
+ //# sourceMappingURL=tools-AQEL6ZJG.js.map