@chosengeneration/light-code 0.201.0 → 0.202.0

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/server.cjs CHANGED
@@ -437,7 +437,7 @@ var require_util = __commonJS({
437
437
  var { kDestroyed, kBodyUsed } = require_symbols();
438
438
  var { IncomingMessage } = require("http");
439
439
  var stream = require("stream");
440
- var net2 = require("net");
440
+ var net = require("net");
441
441
  var { InvalidArgumentError } = require_errors();
442
442
  var { Blob: Blob2 } = require("buffer");
443
443
  var nodeUtil = require("util");
@@ -528,7 +528,7 @@ var require_util = __commonJS({
528
528
  }
529
529
  assert2.strictEqual(typeof host, "string");
530
530
  const servername = getHostname(host);
531
- if (net2.isIP(servername)) {
531
+ if (net.isIP(servername)) {
532
532
  return "";
533
533
  }
534
534
  return servername;
@@ -5682,7 +5682,7 @@ var require_dispatcher_base = __commonJS({
5682
5682
  var require_connect = __commonJS({
5683
5683
  "../../node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/core/connect.js"(exports2, module2) {
5684
5684
  "use strict";
5685
- var net2 = require("net");
5685
+ var net = require("net");
5686
5686
  var assert2 = require("assert");
5687
5687
  var util = require_util();
5688
5688
  var { InvalidArgumentError, ConnectTimeoutError } = require_errors();
@@ -5773,7 +5773,7 @@ var require_connect = __commonJS({
5773
5773
  });
5774
5774
  } else {
5775
5775
  assert2(!httpSocket, "httpSocket can only be sent on TLS update");
5776
- socket = net2.connect({
5776
+ socket = net.connect({
5777
5777
  highWaterMark: 64 * 1024,
5778
5778
  // Same as nodejs fs streams.
5779
5779
  ...options,
@@ -6366,7 +6366,7 @@ var require_client = __commonJS({
6366
6366
  "../../node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/client.js"(exports2, module2) {
6367
6367
  "use strict";
6368
6368
  var assert2 = require("assert");
6369
- var net2 = require("net");
6369
+ var net = require("net");
6370
6370
  var http = require("http");
6371
6371
  var { pipeline } = require("stream");
6372
6372
  var util = require_util();
@@ -6558,7 +6558,7 @@ var require_client = __commonJS({
6558
6558
  if (maxRequestsPerClient != null && (!Number.isInteger(maxRequestsPerClient) || maxRequestsPerClient < 0)) {
6559
6559
  throw new InvalidArgumentError("maxRequestsPerClient must be a positive number");
6560
6560
  }
6561
- if (localAddress != null && (typeof localAddress !== "string" || net2.isIP(localAddress) === 0)) {
6561
+ if (localAddress != null && (typeof localAddress !== "string" || net.isIP(localAddress) === 0)) {
6562
6562
  throw new InvalidArgumentError("localAddress must be valid string IP address");
6563
6563
  }
6564
6564
  if (maxResponseSize != null && (!Number.isInteger(maxResponseSize) || maxResponseSize < -1)) {
@@ -7248,7 +7248,7 @@ var require_client = __commonJS({
7248
7248
  const idx = hostname3.indexOf("]");
7249
7249
  assert2(idx !== -1);
7250
7250
  const ip = hostname3.substring(1, idx);
7251
- assert2(net2.isIP(ip));
7251
+ assert2(net.isIP(ip));
7252
7252
  hostname3 = ip;
7253
7253
  }
7254
7254
  client[kConnecting] = true;
@@ -67124,8 +67124,6 @@ function fillBody(setup, question) {
67124
67124
  }
67125
67125
 
67126
67126
  // ../../packages/core/dist/webchat/guard.js
67127
- var import_node_dns = require("node:dns");
67128
- var import_node_net2 = __toESM(require("node:net"), 1);
67129
67127
  var REQUIRED_CHROME_FLAGS = ["--no-usage-statistics", "--no-performance-crux"];
67130
67128
  function npxPackage(args) {
67131
67129
  for (let i = 0; i < args.length; i += 1) {
@@ -67143,7 +67141,7 @@ function npxPackage(args) {
67143
67141
  function isPinned(spec) {
67144
67142
  return /^(@[^/\s]+\/)?[^@\s]+@\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/.test(spec);
67145
67143
  }
67146
- function chromeServerProblems(config2, npmRegistry) {
67144
+ function chromeServerProblems(config2) {
67147
67145
  if (config2 === void 0)
67148
67146
  return ["No Chrome DevTools MCP server is configured."];
67149
67147
  const record2 = config2;
@@ -67159,10 +67157,6 @@ function chromeServerProblems(config2, npmRegistry) {
67159
67157
  if (spec === void 0 || !isPinned(spec)) {
67160
67158
  problems.push(`With npx the version must be pinned (e.g. chrome-devtools-mcp@1.13.0, not ${spec ?? "no version"}), so an unreviewed new version is never run.`);
67161
67159
  }
67162
- if (npmRegistry === void 0)
67163
- problems.push("npm's registry could not be checked, so npx cannot be confirmed to stay inside the network.");
67164
- else if (npmRegistry.problem !== void 0)
67165
- problems.push(`npx downloads from npm's registry ${npmRegistry.registry}: ${npmRegistry.problem}`);
67166
67160
  } else if (isPackageRunnerCommand(command)) {
67167
67161
  problems.push(`It is started with ${command}, which downloads the package each start. Use npx (with a pinned version and the organisation's registry) or an installed copy.`);
67168
67162
  }
@@ -67194,23 +67188,7 @@ function commandWords(line) {
67194
67188
  function isLoopback2(host) {
67195
67189
  return host === "localhost" || host === "::1" || /^127\./.test(host);
67196
67190
  }
67197
- function isPrivateAddress(address) {
67198
- if (import_node_net2.default.isIPv4(address)) {
67199
- const [a = 0, b = 0] = address.split(".").map(Number);
67200
- return a === 10 || a === 127 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254;
67201
- }
67202
- if (import_node_net2.default.isIPv6(address)) {
67203
- const lower = address.toLowerCase();
67204
- if (lower === "::1")
67205
- return true;
67206
- const mapped = /^::ffff:(\d+\.\d+\.\d+\.\d+)$/.exec(lower);
67207
- if (mapped !== null)
67208
- return isPrivateAddress(mapped[1] ?? "");
67209
- return /^f[cd][0-9a-f]{2}:/.test(lower) || /^fe[89ab][0-9a-f]:/.test(lower);
67210
- }
67211
- return false;
67212
- }
67213
- async function webChatHostProblem(pageUrl, lookup = lookupAll) {
67191
+ function webChatAddressProblem(pageUrl) {
67214
67192
  let url2;
67215
67193
  try {
67216
67194
  url2 = new URL(pageUrl);
@@ -67219,24 +67197,8 @@ async function webChatHostProblem(pageUrl, lookup = lookupAll) {
67219
67197
  }
67220
67198
  if (url2.protocol !== "https:" && url2.protocol !== "http:")
67221
67199
  return "The web chat address must start with https:// (or http://).";
67222
- const host = url2.hostname.replace(/^\[|\]$/g, "");
67223
- let addresses2;
67224
- try {
67225
- addresses2 = import_node_net2.default.isIP(host) !== 0 ? [host] : await lookup(host);
67226
- } catch (error51) {
67227
- return `${host} could not be looked up (${error51 instanceof Error ? error51.message : String(error51)}), so it cannot be confirmed to be inside the network.`;
67228
- }
67229
- if (addresses2.length === 0)
67230
- return `${host} has no address.`;
67231
- const outside = addresses2.filter((address) => !isPrivateAddress(address));
67232
- if (outside.length > 0)
67233
- return `${host} resolves to ${outside.join(", ")}, which is on the public internet - the web chat must be inside the bank's network, so nothing is sent.`;
67234
67200
  return void 0;
67235
67201
  }
67236
- async function lookupAll(host) {
67237
- const found2 = await import_node_dns.promises.lookup(host, { all: true });
67238
- return found2.map((entry) => entry.address);
67239
- }
67240
67202
 
67241
67203
  // ../../packages/core/dist/webchat/answer.js
67242
67204
  function leaves(value, path70, out) {
@@ -91342,7 +91304,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
91342
91304
  child.on("close", (code) => resolve(code === 0 ? out.trim() : void 0));
91343
91305
  setTimeout(() => child.kill(), 15e3).unref?.();
91344
91306
  });
91345
- const value = registry2 === void 0 || registry2.length === 0 ? void 0 : { registry: registry2, problem: await webChatHostProblem(registry2) };
91307
+ const value = registry2 === void 0 || registry2.length === 0 ? void 0 : registry2;
91346
91308
  npmRegistryCheck = { at: Date.now(), value };
91347
91309
  return value;
91348
91310
  }
@@ -91350,13 +91312,21 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
91350
91312
  const config2 = mcp.serverConfig(server);
91351
91313
  const command = config2?.command ?? "";
91352
91314
  const npx = /(^|[\\/])npx(\.cmd)?$/i.test(command);
91353
- return chromeServerProblems(config2, npx ? await npmRegistry() : void 0);
91315
+ void npx;
91316
+ return chromeServerProblems(config2);
91317
+ }
91318
+ async function npxRegistryFor(server) {
91319
+ const command = mcp.serverConfig(server)?.command ?? "";
91320
+ if (!/(^|[\\/\s])npx(\.cmd)?(\s|$)/i.test(command))
91321
+ return {};
91322
+ const registry2 = await npmRegistry();
91323
+ return registry2 !== void 0 ? { registry: registry2 } : {};
91354
91324
  }
91355
91325
  async function hostProblem(pageUrl) {
91356
91326
  const known = webChatHostChecks.get(pageUrl);
91357
91327
  if (known !== void 0 && Date.now() - known.at < 6e5)
91358
91328
  return known.problem;
91359
- const problem = await webChatHostProblem(pageUrl);
91329
+ const problem = webChatAddressProblem(pageUrl);
91360
91330
  webChatHostChecks.set(pageUrl, { at: Date.now(), problem });
91361
91331
  return problem;
91362
91332
  }
@@ -91407,7 +91377,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
91407
91377
  }
91408
91378
  } : {},
91409
91379
  chrome: {
91410
- servers: await Promise.all(servers.map(async (name) => ({ name, problems: await chromeProblems(name) }))),
91380
+ servers: await Promise.all(servers.map(async (name) => ({ name, problems: await chromeProblems(name), ...await npxRegistryFor(name) }))),
91411
91381
  ...setup?.server !== void 0 ? { chosen: setup.server } : {}
91412
91382
  },
91413
91383
  ...setup !== void 0 ? { hostProblem: await hostProblem(setup.pageUrl).catch((error51) => String(error51)) ?? "" } : {},
@@ -106064,9 +106034,9 @@ DevTools MCP server is connected, and never on a shared server.
106064
106034
  (e.g. chrome-webchat), so any Chrome server you already use is left exactly as it is - and choose it in the Web chat
106065
106035
  panel. Add it with \`--autoConnect\`, \`--no-usage-statistics\` and
106066
106036
  \`--no-performance-crux\` (the panel shows the entry to paste), and allow it in Chrome at
106067
- chrome://inspect/#remote-debugging. Either installed once (\`npm i -g chrome-devtools-mcp\`), or run with **npx** -
106068
- allowed when npm downloads from your organisation's registry (an Artifactory inside the network, checked with
106069
- \`npm config get registry\`) and the version is pinned (\`chrome-devtools-mcp@1.13.0\`, not \`@latest\`).
106037
+ chrome://inspect/#remote-debugging. Either installed once (\`npm i -g chrome-devtools-mcp\`), or run with **npx**
106038
+ and a pinned version (\`chrome-devtools-mcp@1.13.0\`, not \`@latest\`); the panel shows where npx downloads it from
106039
+ (\`npm config get registry\` - it should be your organisation's registry).
106070
106040
  2. Type the web chat page's address and press **Capture**. In the tab Light Code selects, start a new chat, choose the
106071
106041
  model, and send the phrase shown (or press **Send it for me**).
106072
106042
  3. Light Code shows the request that carried it: **the backend address**, the model, and the start of the answer it read.
@@ -106076,11 +106046,8 @@ DevTools MCP server is connected, and never on a shared server.
106076
106046
  - Light Code opens no connection itself: the request runs inside the chat page, in your Chrome, to the approved
106077
106047
  backend address on the chat's own site only, with redirects refused; a reply from another site is not used. Your session
106078
106048
  never reaches Light Code - a header that carries a credential is taken from the page each time, never stored.
106079
- - The web chat's address must resolve to an address inside the network (10.x, 172.16-31.x, 192.168.x, 100.64-127.x);
106080
- one on the public internet is refused.
106081
- - The Chrome DevTools MCP server must run on this PC (not a remote server) - installed, or through npx only when npm's
106082
- registry is inside the network and the version is pinned - with its reporting to Google off (both flags above),
106083
- attached to this PC's Chrome only.
106049
+ - The Chrome DevTools MCP server must run on this PC (not a remote server) - installed, or through npx with a pinned
106050
+ version - with its reporting to Google off (both flags above), attached to this PC's Chrome only.
106084
106051
  - **The assistant never gets the web chat's Chrome server's tools**: it cannot open a page, click or run anything
106085
106052
  through it - \`ask_web_chat\` and its one approved request are the only way in. Its tools are replaced by that one
106086
106053
  tool, so the assistant is given fewer tools, not more. Any other Chrome server you have is untouched - and with it the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chosengeneration/light-code",
3
- "version": "0.201.0",
3
+ "version": "0.202.0",
4
4
  "description": "A minimal agentic coding assistant, served to your browser from a local Node server",
5
5
  "license": "MIT",
6
6
  "type": "module",