@gapi/gcli 1.8.253 → 1.8.255

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/release/index.js CHANGED
@@ -21369,7 +21369,7 @@ var require_lib = __commonJS({
21369
21369
  var require_XMLHttpRequest = __commonJS({
21370
21370
  "../../node_modules/xmlhttprequest/lib/XMLHttpRequest.js"(exports2) {
21371
21371
  var Url = require("url");
21372
- var spawn4 = require("child_process").spawn;
21372
+ var spawn5 = require("child_process").spawn;
21373
21373
  var fs3 = require("fs");
21374
21374
  exports2.XMLHttpRequest = function() {
21375
21375
  "use strict";
@@ -21639,7 +21639,7 @@ var require_XMLHttpRequest = __commonJS({
21639
21639
  var syncFile = ".node-xmlhttprequest-sync-" + process.pid;
21640
21640
  fs3.writeFileSync(syncFile, "", "utf8");
21641
21641
  var execString = "var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http" + (ssl ? "s" : "") + ".request;var options = " + JSON.stringify(options) + ";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText}}), 'utf8');fs.unlinkSync('" + syncFile + "');});response.on('error', function(error) {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('" + syncFile + "');});}).on('error', function(error) {fs.writeFileSync('" + contentFile + "', JSON.stringify({err: error}), 'utf8');fs.unlinkSync('" + syncFile + "');});" + (data ? "req.write('" + JSON.stringify(data).slice(1, -1).replace(/'/g, "\\'") + "');" : "") + "req.end();";
21642
- var syncProc = spawn4(process.argv[0], ["-e", execString]);
21642
+ var syncProc = spawn5(process.argv[0], ["-e", execString]);
21643
21643
  while (fs3.existsSync(syncFile)) {
21644
21644
  }
21645
21645
  var resp = JSON.parse(fs3.readFileSync(contentFile, "utf8"));
@@ -29867,7 +29867,7 @@ var require_buffer_list = __commonJS({
29867
29867
  }
29868
29868
  }, {
29869
29869
  key: "join",
29870
- value: function join6(s2) {
29870
+ value: function join7(s2) {
29871
29871
  if (this.length === 0) return "";
29872
29872
  var p = this.head;
29873
29873
  var ret = "" + p.data;
@@ -32885,7 +32885,7 @@ var require_buffer_list2 = __commonJS({
32885
32885
  }
32886
32886
  }, {
32887
32887
  key: "join",
32888
- value: function join6(s2) {
32888
+ value: function join7(s2) {
32889
32889
  if (this.length === 0) return "";
32890
32890
  var p = this.head;
32891
32891
  var ret = "" + p.data;
@@ -36015,7 +36015,7 @@ var init_types = __esm({
36015
36015
  });
36016
36016
 
36017
36017
  // src/commands/cluster/types.ts
36018
- var ClusterChangeFragment, ClusterAutoscaleFragment, ClusterOverviewFragment, ClusterHealthFragment, ClusterScaleEventFragment, ClusterNodeFragment;
36018
+ var ClusterChangeFragment, ClusterAutoscaleFragment, ClusterOverviewFragment, ClusterHealthFragment, ClusterScaleEventFragment, SCALING_PROFILES, ClusterNodeFragment;
36019
36019
  var init_types2 = __esm({
36020
36020
  "src/commands/cluster/types.ts"() {
36021
36021
  ClusterChangeFragment = `
@@ -36036,6 +36036,9 @@ error
36036
36036
  `;
36037
36037
  ClusterAutoscaleFragment = `
36038
36038
  enabled
36039
+ scalingProfile
36040
+ serverTypes
36041
+ scaleUpStep
36039
36042
  minWorkers
36040
36043
  maxWorkers
36041
36044
  cpuScaleUpPercent
@@ -36134,6 +36137,12 @@ memRequestsPercent
36134
36137
  pendingPods
36135
36138
  error
36136
36139
  `;
36140
+ SCALING_PROFILES = [
36141
+ "conservative",
36142
+ "balanced",
36143
+ "aggressive",
36144
+ "custom"
36145
+ ];
36137
36146
  ClusterNodeFragment = `
36138
36147
  name
36139
36148
  pool
@@ -37917,12 +37926,101 @@ var init_helpers = __esm({
37917
37926
  }
37918
37927
  });
37919
37928
 
37929
+ // src/commands/auth/browser-login.ts
37930
+ var import_child_process, import_os2, anonymous, startBrowserLogin, pollBrowserLogin, openInBrowser, sleep, waitForApproval, browserLogin;
37931
+ var init_browser_login = __esm({
37932
+ "src/commands/auth/browser-login.ts"() {
37933
+ import_child_process = require("child_process");
37934
+ import_os2 = require("os");
37935
+ init_log();
37936
+ anonymous = async (url2, query, variables) => {
37937
+ const res = await fetch(url2, {
37938
+ method: "POST",
37939
+ headers: { "Content-Type": "application/json", Accept: "application/json" },
37940
+ body: JSON.stringify({ query, variables })
37941
+ });
37942
+ const body = await res.json().catch(() => ({}));
37943
+ if (body.errors?.length) {
37944
+ throw new Error(body.errors.map((e2) => e2.message).join("; "));
37945
+ }
37946
+ if (!body.data) {
37947
+ throw new Error(`${url2} answered ${res.status} without data`);
37948
+ }
37949
+ return body.data;
37950
+ };
37951
+ startBrowserLogin = (url2) => anonymous(
37952
+ url2,
37953
+ `mutation startCliLogin($hostname: String, $platform: String, $apiUrl: String) {
37954
+ startCliLogin(hostname: $hostname, platform: $platform, apiUrl: $apiUrl) {
37955
+ sessionId userCode verificationUrl expiresAt pollIntervalSeconds
37956
+ }
37957
+ }`,
37958
+ { hostname: (0, import_os2.hostname)(), platform: (0, import_os2.platform)(), apiUrl: url2 }
37959
+ ).then((d) => d.startCliLogin);
37960
+ pollBrowserLogin = (url2, sessionId) => anonymous(
37961
+ url2,
37962
+ `mutation pollCliLogin($sessionId: String!) {
37963
+ pollCliLogin(sessionId: $sessionId) { status token key }
37964
+ }`,
37965
+ { sessionId }
37966
+ ).then((d) => d.pollCliLogin);
37967
+ openInBrowser = (link) => {
37968
+ const [cmd, args] = process.platform === "darwin" ? ["open", [link]] : process.platform === "win32" ? ["cmd", ["/c", "start", '""', link]] : ["xdg-open", [link]];
37969
+ try {
37970
+ const child = (0, import_child_process.spawn)(cmd, args, { stdio: "ignore", detached: true });
37971
+ child.on("error", () => void 0);
37972
+ child.unref();
37973
+ } catch {
37974
+ }
37975
+ };
37976
+ sleep = (ms) => new Promise((r2) => setTimeout(r2, ms));
37977
+ waitForApproval = async (url2, start3, pollMs) => {
37978
+ const every = pollMs ?? Math.max(1, start3.pollIntervalSeconds ?? 2) * 1e3;
37979
+ const deadline = start3.expiresAt ? new Date(start3.expiresAt).getTime() : Date.now() + 10 * 6e4;
37980
+ while (Date.now() < deadline + every) {
37981
+ await sleep(every);
37982
+ let poll;
37983
+ try {
37984
+ poll = await pollBrowserLogin(url2, start3.sessionId);
37985
+ } catch {
37986
+ continue;
37987
+ }
37988
+ if (poll.status === "approved" && poll.token && poll.key) {
37989
+ return { token: poll.token, key: poll.key };
37990
+ }
37991
+ if (poll.status === "denied") {
37992
+ throw new Error("The login was denied in the browser.");
37993
+ }
37994
+ if (poll.status === "expired") {
37995
+ break;
37996
+ }
37997
+ }
37998
+ throw new Error("The login link expired. Run `gcli login` again.");
37999
+ };
38000
+ browserLogin = async (url2, options = {}) => {
38001
+ const print = options.print ?? ((line) => Logger.log(line));
38002
+ const start3 = await startBrowserLogin(url2);
38003
+ print("");
38004
+ print("Log in to Lambforge from your browser:");
38005
+ print(` ${start3.verificationUrl}`);
38006
+ print(` Code: ${start3.userCode} (check it matches the page)`);
38007
+ print("");
38008
+ if (options.openBrowser !== false) {
38009
+ openInBrowser(start3.verificationUrl);
38010
+ }
38011
+ print("Waiting for approval... (Ctrl+C to cancel)");
38012
+ return waitForApproval(url2, start3, options.pollMs);
38013
+ };
38014
+ }
38015
+ });
38016
+
37920
38017
  // src/commands/auth/login.ts
37921
38018
  var login_exports = {};
37922
38019
  __export(login_exports, {
37923
- default: () => login_default
38020
+ default: () => login_default,
38021
+ loginWithToken: () => loginWithToken
37924
38022
  });
37925
- var import_fs2, import_rxjs4, import_operators3, import_util2, MainLambforgeAPI, login_default;
38023
+ var import_fs2, import_rxjs4, import_operators3, import_util2, MainLambforgeAPI, login_default, loginWithToken;
37926
38024
  var init_login = __esm({
37927
38025
  "src/commands/auth/login.ts"() {
37928
38026
  import_fs2 = require("fs");
@@ -37932,8 +38030,23 @@ var init_login = __esm({
37932
38030
  init_log();
37933
38031
  init_types();
37934
38032
  init_gql_client();
38033
+ init_browser_login();
37935
38034
  MainLambforgeAPI = "https://api.lambforge.com";
37936
- login_default = (cmd) => (0, import_rxjs4.lastValueFrom)(
38035
+ login_default = async (cmd) => {
38036
+ if (!cmd.token && !cmd.ci) {
38037
+ const { token, key } = await browserLogin(cmd.url || MainLambforgeAPI, {
38038
+ openBrowser: cmd.browser !== false
38039
+ });
38040
+ return loginWithToken({ ...cmd, token, key: cmd.key || key });
38041
+ }
38042
+ if (!cmd.key && !cmd.ci) {
38043
+ throw new Error(
38044
+ "--key is required with --token (or run `gcli login` alone to log in through the browser)"
38045
+ );
38046
+ }
38047
+ return loginWithToken(cmd);
38048
+ };
38049
+ loginWithToken = (cmd) => (0, import_rxjs4.lastValueFrom)(
37937
38050
  (0, import_rxjs4.of)(GraphqlClienAPI.init(cmd.key)).pipe(
37938
38051
  (0, import_operators3.switchMap)(
37939
38052
  () => (0, import_rxjs4.from)((0, import_util2.promisify)(import_fs2.mkdir)(mainDirectory)).pipe(
@@ -37988,7 +38101,7 @@ var init_login = __esm({
37988
38101
  ]).pipe((0, import_operators3.map)(() => user))
37989
38102
  ),
37990
38103
  (0, import_operators3.tap)(
37991
- (user) => Logger.log(
38104
+ (user) => cmd.silent || Logger.log(
37992
38105
  "Logged in as",
37993
38106
  `"${user?.displayName}"`,
37994
38107
  "with email",
@@ -38710,7 +38823,7 @@ var require_util = __commonJS({
38710
38823
  return path2;
38711
38824
  }
38712
38825
  exports2.normalize = normalize2;
38713
- function join6(aRoot, aPath) {
38826
+ function join7(aRoot, aPath) {
38714
38827
  if (aRoot === "") {
38715
38828
  aRoot = ".";
38716
38829
  }
@@ -38742,7 +38855,7 @@ var require_util = __commonJS({
38742
38855
  }
38743
38856
  return joined;
38744
38857
  }
38745
- exports2.join = join6;
38858
+ exports2.join = join7;
38746
38859
  exports2.isAbsolute = function(aPath) {
38747
38860
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
38748
38861
  };
@@ -38915,7 +39028,7 @@ var require_util = __commonJS({
38915
39028
  parsed.path = parsed.path.substring(0, index + 1);
38916
39029
  }
38917
39030
  }
38918
- sourceURL = join6(urlGenerate(parsed), sourceURL);
39031
+ sourceURL = join7(urlGenerate(parsed), sourceURL);
38919
39032
  }
38920
39033
  return normalize2(sourceURL);
38921
39034
  }
@@ -44558,10 +44671,10 @@ var require_typescript = __commonJS({
44558
44671
  Debug2.loggingHost.log(level, s2);
44559
44672
  }
44560
44673
  }
44561
- function log(s2) {
44674
+ function log2(s2) {
44562
44675
  logMessage(3, s2);
44563
44676
  }
44564
- Debug2.log = log;
44677
+ Debug2.log = log2;
44565
44678
  ((_log) => {
44566
44679
  function error210(s2) {
44567
44680
  logMessage(1, s2);
@@ -44571,15 +44684,15 @@ var require_typescript = __commonJS({
44571
44684
  logMessage(2, s2);
44572
44685
  }
44573
44686
  _log.warn = warn;
44574
- function log2(s2) {
44687
+ function log22(s2) {
44575
44688
  logMessage(3, s2);
44576
44689
  }
44577
- _log.log = log2;
44690
+ _log.log = log22;
44578
44691
  function trace2(s2) {
44579
44692
  logMessage(4, s2);
44580
44693
  }
44581
44694
  _log.trace = trace2;
44582
- })(log = Debug2.log || (Debug2.log = {}));
44695
+ })(log2 = Debug2.log || (Debug2.log = {}));
44583
44696
  const assertionCache = {};
44584
44697
  function getAssertionLevel() {
44585
44698
  return currentAssertionLevel;
@@ -49333,7 +49446,7 @@ ${lanes.join("\n")}
49333
49446
  const isMacOs = process.platform === "darwin";
49334
49447
  const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
49335
49448
  const statSyncOptions = { throwIfNoEntry: false };
49336
- const platform = _os.platform();
49449
+ const platform2 = _os.platform();
49337
49450
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
49338
49451
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
49339
49452
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
@@ -49538,7 +49651,7 @@ ${lanes.join("\n")}
49538
49651
  }
49539
49652
  }
49540
49653
  function isFileSystemCaseSensitive() {
49541
- if (platform === "win32" || platform === "win64") {
49654
+ if (platform2 === "win32" || platform2 === "win64") {
49542
49655
  return false;
49543
49656
  }
49544
49657
  return !fileExists(swapCase(__filename));
@@ -175897,8 +176010,8 @@ ${lanes.join("\n")}
175897
176010
  WatchLogLevel2[WatchLogLevel2["Verbose"] = 2] = "Verbose";
175898
176011
  return WatchLogLevel2;
175899
176012
  })(WatchLogLevel || {});
175900
- function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo2) {
175901
- setSysLog(watchLogLevel === 2 ? log : noop3);
176013
+ function getWatchFactory(host, watchLogLevel, log2, getDetailWatchInfo2) {
176014
+ setSysLog(watchLogLevel === 2 ? log2 : noop3);
175902
176015
  const plainInvokeFactory = {
175903
176016
  watchFile: (file2, callback, pollingInterval, options) => host.watchFile(file2, callback, pollingInterval, options),
175904
176017
  watchDirectory: (directory, callback, flags, options) => host.watchDirectory(directory, callback, (flags & 1) !== 0, options)
@@ -175935,36 +176048,36 @@ ${lanes.join("\n")}
175935
176048
  return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
175936
176049
  }
175937
176050
  function createExcludeWatcherWithLogging(file2, flags, options, detailInfo1, detailInfo2) {
175938
- log(`ExcludeWatcher:: Added:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
176051
+ log2(`ExcludeWatcher:: Added:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
175939
176052
  return {
175940
- close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
176053
+ close: () => log2(`ExcludeWatcher:: Close:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
175941
176054
  };
175942
176055
  }
175943
176056
  function createFileWatcherWithLogging(file2, cb, flags, options, detailInfo1, detailInfo2) {
175944
- log(`FileWatcher:: Added:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
176057
+ log2(`FileWatcher:: Added:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
175945
176058
  const watcher = triggerInvokingFactory.watchFile(file2, cb, flags, options, detailInfo1, detailInfo2);
175946
176059
  return {
175947
176060
  close: () => {
175948
- log(`FileWatcher:: Close:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
176061
+ log2(`FileWatcher:: Close:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
175949
176062
  watcher.close();
175950
176063
  }
175951
176064
  };
175952
176065
  }
175953
176066
  function createDirectoryWatcherWithLogging(file2, cb, flags, options, detailInfo1, detailInfo2) {
175954
176067
  const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
175955
- log(watchInfo);
176068
+ log2(watchInfo);
175956
176069
  const start3 = timestamp();
175957
176070
  const watcher = triggerInvokingFactory.watchDirectory(file2, cb, flags, options, detailInfo1, detailInfo2);
175958
176071
  const elapsed = timestamp() - start3;
175959
- log(`Elapsed:: ${elapsed}ms ${watchInfo}`);
176072
+ log2(`Elapsed:: ${elapsed}ms ${watchInfo}`);
175960
176073
  return {
175961
176074
  close: () => {
175962
176075
  const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
175963
- log(watchInfo2);
176076
+ log2(watchInfo2);
175964
176077
  const start22 = timestamp();
175965
176078
  watcher.close();
175966
176079
  const elapsed2 = timestamp() - start22;
175967
- log(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
176080
+ log2(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
175968
176081
  }
175969
176082
  };
175970
176083
  }
@@ -175975,7 +176088,7 @@ ${lanes.join("\n")}
175975
176088
  file2,
175976
176089
  (...args) => {
175977
176090
  const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file2, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
175978
- log(triggerredInfo);
176091
+ log2(triggerredInfo);
175979
176092
  const start3 = timestamp();
175980
176093
  cb.call(
175981
176094
  /*thisArg*/
@@ -175983,7 +176096,7 @@ ${lanes.join("\n")}
175983
176096
  ...args
175984
176097
  );
175985
176098
  const elapsed = timestamp() - start3;
175986
- log(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
176099
+ log2(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
175987
176100
  },
175988
176101
  flags,
175989
176102
  options,
@@ -189054,7 +189167,7 @@ ${lanes.join("\n")}
189054
189167
  }
189055
189168
  return void 0;
189056
189169
  }
189057
- function discoverTypings(host, log, fileNames, projectRootPath, safeList, packageNameToTypingLocation, typeAcquisition, unresolvedImports, typesRegistry, compilerOptions) {
189170
+ function discoverTypings(host, log2, fileNames, projectRootPath, safeList, packageNameToTypingLocation, typeAcquisition, unresolvedImports, typesRegistry, compilerOptions) {
189058
189171
  if (!typeAcquisition || !typeAcquisition.enable) {
189059
189172
  return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
189060
189173
  }
@@ -189089,7 +189202,7 @@ ${lanes.join("\n")}
189089
189202
  }
189090
189203
  for (const excludeTypingName of exclude) {
189091
189204
  const didDelete = inferredTypings.delete(excludeTypingName);
189092
- if (didDelete && log) log(`Typing for ${excludeTypingName} is in exclude list, will be ignored.`);
189205
+ if (didDelete && log2) log2(`Typing for ${excludeTypingName} is in exclude list, will be ignored.`);
189093
189206
  }
189094
189207
  packageNameToTypingLocation.forEach((typing, name2) => {
189095
189208
  const registryEntry = typesRegistry.get(name2);
@@ -189107,7 +189220,7 @@ ${lanes.join("\n")}
189107
189220
  }
189108
189221
  });
189109
189222
  const result = { cachedTypingPaths, newTypingNames, filesToWatch };
189110
- if (log) log(`Finished typings discovery:${stringifyIndented(result)}`);
189223
+ if (log2) log2(`Finished typings discovery:${stringifyIndented(result)}`);
189111
189224
  return result;
189112
189225
  function addInferredTyping(typingName) {
189113
189226
  if (!inferredTypings.has(typingName)) {
@@ -189115,7 +189228,7 @@ ${lanes.join("\n")}
189115
189228
  }
189116
189229
  }
189117
189230
  function addInferredTypings(typingNames, message) {
189118
- if (log) log(`${message}: ${JSON.stringify(typingNames)}`);
189231
+ if (log2) log2(`${message}: ${JSON.stringify(typingNames)}`);
189119
189232
  forEach(typingNames, addInferredTyping);
189120
189233
  }
189121
189234
  function getTypingNames(projectRootPath2, manifestName, modulesDirName, filesToWatch2) {
@@ -189155,7 +189268,7 @@ ${lanes.join("\n")}
189155
189268
  return isScoped && toFileNameLowerCase(pathComponents2[pathComponents2.length - 4]) === modulesDirName || // `node_modules/@foo/bar`
189156
189269
  !isScoped && toFileNameLowerCase(pathComponents2[pathComponents2.length - 3]) === modulesDirName;
189157
189270
  });
189158
- if (log) log(`Searching for typing names in ${packagesFolderPath}; all files: ${JSON.stringify(dependencyManifestNames)}`);
189271
+ if (log2) log2(`Searching for typing names in ${packagesFolderPath}; all files: ${JSON.stringify(dependencyManifestNames)}`);
189159
189272
  for (const manifestPath2 of dependencyManifestNames) {
189160
189273
  const normalizedFileName = normalizePath(manifestPath2);
189161
189274
  const result2 = readConfigFile(normalizedFileName, (path2) => host.readFile(path2));
@@ -189167,10 +189280,10 @@ ${lanes.join("\n")}
189167
189280
  if (ownTypes) {
189168
189281
  const absolutePath = getNormalizedAbsolutePath(ownTypes, getDirectoryPath(normalizedFileName));
189169
189282
  if (host.fileExists(absolutePath)) {
189170
- if (log) log(` Package '${manifest2.name}' provides its own types.`);
189283
+ if (log2) log2(` Package '${manifest2.name}' provides its own types.`);
189171
189284
  inferredTypings.set(manifest2.name, absolutePath);
189172
189285
  } else {
189173
- if (log) log(` Package '${manifest2.name}' provides its own types but they are missing.`);
189286
+ if (log2) log2(` Package '${manifest2.name}' provides its own types but they are missing.`);
189174
189287
  }
189175
189288
  } else {
189176
189289
  packageNames.push(manifest2.name);
@@ -189194,7 +189307,7 @@ ${lanes.join("\n")}
189194
189307
  /* Jsx */
189195
189308
  ));
189196
189309
  if (hasJsxFile) {
189197
- if (log) log(`Inferred 'react' typings due to presence of '.jsx' extension`);
189310
+ if (log2) log2(`Inferred 'react' typings due to presence of '.jsx' extension`);
189198
189311
  addInferredTyping("react");
189199
189312
  }
189200
189313
  }
@@ -203582,7 +203695,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
203582
203695
  const cancellationToken = host.getCancellationToken ? new CancellationTokenObject(host.getCancellationToken()) : NoopCancellationToken;
203583
203696
  const currentDirectory = host.getCurrentDirectory();
203584
203697
  maybeSetLocalizedDiagnosticMessages((_a2 = host.getLocalizedDiagnosticMessages) == null ? void 0 : _a2.bind(host));
203585
- function log(message) {
203698
+ function log2(message) {
203586
203699
  if (host.log) {
203587
203700
  host.log(message);
203588
203701
  }
@@ -203597,7 +203710,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
203597
203710
  readFile: maybeBind(host, host.readFile),
203598
203711
  getDocumentPositionMapper: maybeBind(host, host.getDocumentPositionMapper),
203599
203712
  getSourceFileLike: maybeBind(host, host.getSourceFileLike),
203600
- log
203713
+ log: log2
203601
203714
  });
203602
203715
  function getValidSourceFile(fileName) {
203603
203716
  const sourceFile = program2.getSourceFile(fileName);
@@ -203632,7 +203745,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
203632
203745
  }
203633
203746
  const typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0;
203634
203747
  if (lastTypesRootVersion !== typeRootsVersion) {
203635
- log("TypeRoots version has changed; provide new program");
203748
+ log2("TypeRoots version has changed; provide new program");
203636
203749
  program2 = void 0;
203637
203750
  lastTypesRootVersion = typeRootsVersion;
203638
203751
  }
@@ -204002,7 +204115,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
204002
204115
  return ts_Completions_exports.getCompletionsAtPosition(
204003
204116
  host,
204004
204117
  program2,
204005
- log,
204118
+ log2,
204006
204119
  getValidSourceFile(fileName),
204007
204120
  position,
204008
204121
  fullPreferences,
@@ -204017,7 +204130,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
204017
204130
  synchronizeHostData();
204018
204131
  return ts_Completions_exports.getCompletionEntryDetails(
204019
204132
  program2,
204020
- log,
204133
+ log2,
204021
204134
  getValidSourceFile(fileName),
204022
204135
  position,
204023
204136
  { name: name2, source, data },
@@ -204030,7 +204143,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
204030
204143
  }
204031
204144
  function getCompletionEntrySymbol2(fileName, position, name2, source, preferences = emptyOptions) {
204032
204145
  synchronizeHostData();
204033
- return ts_Completions_exports.getCompletionEntrySymbol(program2, log, getValidSourceFile(fileName), position, { name: name2, source }, host, preferences);
204146
+ return ts_Completions_exports.getCompletionEntrySymbol(program2, log2, getValidSourceFile(fileName), position, { name: name2, source }, host, preferences);
204034
204147
  }
204035
204148
  function getQuickInfoAtPosition(fileName, position, maximumLength, verbosityLevel) {
204036
204149
  synchronizeHostData();
@@ -204335,10 +204448,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
204335
204448
  let start3 = timestamp();
204336
204449
  const settings = toEditorSettings(editorOptions);
204337
204450
  const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
204338
- log("getIndentationAtPosition: getCurrentSourceFile: " + (timestamp() - start3));
204451
+ log2("getIndentationAtPosition: getCurrentSourceFile: " + (timestamp() - start3));
204339
204452
  start3 = timestamp();
204340
204453
  const result = ts_formatting_exports.SmartIndenter.getIndentation(position, sourceFile, settings);
204341
- log("getIndentationAtPosition: computeIndentation : " + (timestamp() - start3));
204454
+ log2("getIndentationAtPosition: computeIndentation : " + (timestamp() - start3));
204342
204455
  return result;
204343
204456
  }
204344
204457
  function getFormattingEditsForRange(fileName, start3, end, options) {
@@ -218092,7 +218205,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
218092
218205
  }
218093
218206
  return allCommitCharacters;
218094
218207
  }
218095
- function getCompletionsAtPosition(host, program2, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
218208
+ function getCompletionsAtPosition(host, program2, log2, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
218096
218209
  var _a2;
218097
218210
  const { previousToken } = getRelevantTokens(position, sourceFile);
218098
218211
  if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
@@ -218125,7 +218238,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
218125
218238
  } else {
218126
218239
  incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
218127
218240
  }
218128
- const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program2, log, preferences, includeSymbol);
218241
+ const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program2, log2, preferences, includeSymbol);
218129
218242
  if (stringCompletions) {
218130
218243
  return stringCompletions;
218131
218244
  }
@@ -218134,7 +218247,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
218134
218247
  }
218135
218248
  const completionData = getCompletionData(
218136
218249
  program2,
218137
- log,
218250
+ log2,
218138
218251
  sourceFile,
218139
218252
  compilerOptions,
218140
218253
  position,
@@ -218150,7 +218263,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
218150
218263
  }
218151
218264
  switch (completionData.kind) {
218152
218265
  case 0:
218153
- const response = completionInfoFromData(sourceFile, host, program2, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
218266
+ const response = completionInfoFromData(sourceFile, host, program2, compilerOptions, log2, completionData, preferences, formatContext, position, includeSymbol);
218154
218267
  if (response == null ? void 0 : response.isIncomplete) {
218155
218268
  incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
218156
218269
  }
@@ -218572,7 +218685,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
218572
218685
  function getOptionalReplacementSpan(location) {
218573
218686
  return (location == null ? void 0 : location.kind) === 80 ? createTextSpanFromNode(location) : void 0;
218574
218687
  }
218575
- function completionInfoFromData(sourceFile, host, program2, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
218688
+ function completionInfoFromData(sourceFile, host, program2, compilerOptions, log2, completionData, preferences, formatContext, position, includeSymbol) {
218576
218689
  const {
218577
218690
  symbols,
218578
218691
  contextToken,
@@ -218636,7 +218749,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
218636
218749
  host,
218637
218750
  program2,
218638
218751
  getEmitScriptTarget(compilerOptions),
218639
- log,
218752
+ log2,
218640
218753
  completionKind,
218641
218754
  preferences,
218642
218755
  compilerOptions,
@@ -219648,7 +219761,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
219648
219761
  return "TypeOnlyAlias/";
219649
219762
  }
219650
219763
  }
219651
- function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program2, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
219764
+ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program2, target, log2, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
219652
219765
  const start3 = timestamp();
219653
219766
  const closestSymbolDeclaration = getClosestSymbolDeclaration(contextToken, location);
219654
219767
  const useSemicolons = probablyUsesSemicolons(sourceFile);
@@ -219708,7 +219821,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
219708
219821
  true
219709
219822
  );
219710
219823
  }
219711
- log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (timestamp() - start3));
219824
+ log2("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (timestamp() - start3));
219712
219825
  return {
219713
219826
  has: (name2) => uniques.has(name2),
219714
219827
  add: (name2) => uniques.set(name2, true)
@@ -219804,7 +219917,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
219804
219917
  }
219805
219918
  return entries;
219806
219919
  }
219807
- function getSymbolCompletionFromEntryId(program2, log, sourceFile, position, entryId, host, preferences) {
219920
+ function getSymbolCompletionFromEntryId(program2, log2, sourceFile, position, entryId, host, preferences) {
219808
219921
  if (entryId.source === "SwitchCases/") {
219809
219922
  return { type: "cases" };
219810
219923
  }
@@ -219827,7 +219940,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
219827
219940
  const compilerOptions = program2.getCompilerOptions();
219828
219941
  const completionData = getCompletionData(
219829
219942
  program2,
219830
- log,
219943
+ log2,
219831
219944
  sourceFile,
219832
219945
  compilerOptions,
219833
219946
  position,
@@ -219852,7 +219965,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
219852
219965
  return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" && symbol2.flags & 106500 || entryId.source === "ObjectLiteralMethodSnippet/" && symbol2.flags & (4 | 8192) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/") ? { type: "symbol", symbol: symbol2, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
219853
219966
  }) || { type: "none" };
219854
219967
  }
219855
- function getCompletionEntryDetails(program2, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
219968
+ function getCompletionEntryDetails(program2, log2, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
219856
219969
  const typeChecker = program2.getTypeChecker();
219857
219970
  const compilerOptions = program2.getCompilerOptions();
219858
219971
  const { name: name2, source, data } = entryId;
@@ -219860,7 +219973,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
219860
219973
  if (isInString(sourceFile, position, previousToken)) {
219861
219974
  return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name2, sourceFile, position, previousToken, program2, host, cancellationToken, preferences);
219862
219975
  }
219863
- const symbolCompletion = getSymbolCompletionFromEntryId(program2, log, sourceFile, position, entryId, host, preferences);
219976
+ const symbolCompletion = getSymbolCompletionFromEntryId(program2, log2, sourceFile, position, entryId, host, preferences);
219864
219977
  switch (symbolCompletion.type) {
219865
219978
  case "request": {
219866
219979
  const { request } = symbolCompletion;
@@ -220054,8 +220167,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
220054
220167
  Debug.assert(!(data == null ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
220055
220168
  return { sourceDisplay: [textPart(moduleSpecifier)], codeActions: [codeAction] };
220056
220169
  }
220057
- function getCompletionEntrySymbol(program2, log, sourceFile, position, entryId, host, preferences) {
220058
- const completion = getSymbolCompletionFromEntryId(program2, log, sourceFile, position, entryId, host, preferences);
220170
+ function getCompletionEntrySymbol(program2, log2, sourceFile, position, entryId, host, preferences) {
220171
+ const completion = getSymbolCompletionFromEntryId(program2, log2, sourceFile, position, entryId, host, preferences);
220059
220172
  return completion.type === "symbol" ? completion.symbol : void 0;
220060
220173
  }
220061
220174
  var CompletionKind = /* @__PURE__ */ ((CompletionKind2) => {
@@ -220128,15 +220241,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
220128
220241
  /* SourceFile */
220129
220242
  ));
220130
220243
  }
220131
- function getCompletionData(program2, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
220244
+ function getCompletionData(program2, log2, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) {
220132
220245
  const typeChecker = program2.getTypeChecker();
220133
220246
  const inCheckedFile = isCheckedFile(sourceFile, compilerOptions);
220134
220247
  let start3 = timestamp();
220135
220248
  let currentToken2 = getTokenAtPosition(sourceFile, position);
220136
- log("getCompletionData: Get current token: " + (timestamp() - start3));
220249
+ log2("getCompletionData: Get current token: " + (timestamp() - start3));
220137
220250
  start3 = timestamp();
220138
220251
  const insideComment = isInComment(sourceFile, position, currentToken2);
220139
- log("getCompletionData: Is inside comment: " + (timestamp() - start3));
220252
+ log2("getCompletionData: Is inside comment: " + (timestamp() - start3));
220140
220253
  let insideJsDocTagTypeExpression = false;
220141
220254
  let insideJsDocImportTag = false;
220142
220255
  let isInSnippetScope = false;
@@ -220181,7 +220294,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
220181
220294
  }
220182
220295
  }
220183
220296
  if (!insideJsDocTagTypeExpression && !insideJsDocImportTag) {
220184
- log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
220297
+ log2("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment.");
220185
220298
  return void 0;
220186
220299
  }
220187
220300
  }
@@ -220190,7 +220303,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
220190
220303
  const tokens = getRelevantTokens(position, sourceFile);
220191
220304
  const previousToken = tokens.previousToken;
220192
220305
  let contextToken = tokens.contextToken;
220193
- log("getCompletionData: Get previous token: " + (timestamp() - start3));
220306
+ log2("getCompletionData: Get previous token: " + (timestamp() - start3));
220194
220307
  let node = currentToken2;
220195
220308
  let propertyAccessToConvert;
220196
220309
  let isRightOfDot = false;
@@ -220223,7 +220336,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
220223
220336
  isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
220224
220337
  }
220225
220338
  if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
220226
- log("Returning an empty list because completion was requested in an invalid position.");
220339
+ log2("Returning an empty list because completion was requested in an invalid position.");
220227
220340
  return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, computeCommitCharactersAndIsNewIdentifier().isNewIdentifierLocation) : void 0;
220228
220341
  }
220229
220342
  let parent2 = contextToken.parent;
@@ -220356,7 +220469,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
220356
220469
  return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierLocation) : void 0;
220357
220470
  }
220358
220471
  }
220359
- log("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
220472
+ log2("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
220360
220473
  const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker);
220361
220474
  const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected;
220362
220475
  const literals = !isLiteralExpected ? [] : mapDefined(
@@ -220903,7 +221016,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
220903
221016
  function isCompletionListBlocker(contextToken2) {
220904
221017
  const start22 = timestamp();
220905
221018
  const result = isInStringOrRegularExpressionOrTemplateLiteral(contextToken2) || isSolelyIdentifierDefinitionLocation(contextToken2) || isDotOfNumericLiteral(contextToken2) || isInJsxText(contextToken2) || isBigIntLiteral(contextToken2);
220906
- log("getCompletionsAtPosition: isCompletionListBlocker: " + (timestamp() - start22));
221019
+ log2("getCompletionsAtPosition: isCompletionListBlocker: " + (timestamp() - start22));
220907
221020
  return result;
220908
221021
  }
220909
221022
  function isInJsxText(contextToken2) {
@@ -222226,7 +222339,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
222226
222339
  values: map210.values.bind(map210)
222227
222340
  };
222228
222341
  }
222229
- function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program2, log, preferences, includeSymbol) {
222342
+ function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program2, log2, preferences, includeSymbol) {
222230
222343
  if (isInReferenceComment(sourceFile, position)) {
222231
222344
  const entries = getTripleSlashReferenceCompletion(sourceFile, position, program2, host, createModuleSpecifierResolutionHost(program2, host));
222232
222345
  return entries && convertPathCompletions(entries);
@@ -222234,10 +222347,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
222234
222347
  if (isInString(sourceFile, position, contextToken)) {
222235
222348
  if (!contextToken || !isStringLiteralLike(contextToken)) return void 0;
222236
222349
  const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program2, host, preferences);
222237
- return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program2, log, options, preferences, position, includeSymbol);
222350
+ return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program2, log2, options, preferences, position, includeSymbol);
222238
222351
  }
222239
222352
  }
222240
- function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program2, log, options, preferences, position, includeSymbol) {
222353
+ function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program2, log2, options, preferences, position, includeSymbol) {
222241
222354
  if (completion === void 0) {
222242
222355
  return void 0;
222243
222356
  }
@@ -222258,7 +222371,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
222258
222371
  host,
222259
222372
  program2,
222260
222373
  99,
222261
- log,
222374
+ log2,
222262
222375
  4,
222263
222376
  preferences,
222264
222377
  options,
@@ -238761,7 +238874,7 @@ ${options.prefix}` : "\n" : options.prefix
238761
238874
  isEnabled: () => false,
238762
238875
  writeLine: noop3
238763
238876
  };
238764
- function typingToFileName(cachePath, packageName, installTypingHost, log) {
238877
+ function typingToFileName(cachePath, packageName, installTypingHost, log2) {
238765
238878
  try {
238766
238879
  const result = resolveModuleName(packageName, combinePaths(cachePath, "index.d.ts"), {
238767
238880
  moduleResolution: 2
@@ -238769,8 +238882,8 @@ ${options.prefix}` : "\n" : options.prefix
238769
238882
  }, installTypingHost);
238770
238883
  return result.resolvedModule && result.resolvedModule.resolvedFileName;
238771
238884
  } catch (e2) {
238772
- if (log.isEnabled()) {
238773
- log.writeLine(`Failed to resolve ${packageName} in folder '${cachePath}': ${e2.message}`);
238885
+ if (log2.isEnabled()) {
238886
+ log2.writeLine(`Failed to resolve ${packageName} in folder '${cachePath}': ${e2.message}`);
238774
238887
  }
238775
238888
  return void 0;
238776
238889
  }
@@ -238797,13 +238910,13 @@ ${options.prefix}` : "\n" : options.prefix
238797
238910
  return { command, remaining: remaining - toSlice };
238798
238911
  }
238799
238912
  var TypingsInstaller = class {
238800
- constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation, throttleLimit, log = nullLog) {
238913
+ constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation, throttleLimit, log2 = nullLog) {
238801
238914
  this.installTypingHost = installTypingHost;
238802
238915
  this.globalCachePath = globalCachePath;
238803
238916
  this.safeListPath = safeListPath;
238804
238917
  this.typesMapLocation = typesMapLocation;
238805
238918
  this.throttleLimit = throttleLimit;
238806
- this.log = log;
238919
+ this.log = log2;
238807
238920
  this.packageNameToTypingLocation = /* @__PURE__ */ new Map();
238808
238921
  this.missingTypingsSet = /* @__PURE__ */ new Set();
238809
238922
  this.knownCachesSet = /* @__PURE__ */ new Set();
@@ -239301,13 +239414,13 @@ ${options.prefix}` : "\n" : options.prefix
239301
239414
  }
239302
239415
  static run(self2) {
239303
239416
  self2.timerId = void 0;
239304
- const log = self2.logger.hasLevel(
239417
+ const log2 = self2.logger.hasLevel(
239305
239418
  2
239306
239419
  /* requestTime */
239307
239420
  );
239308
- const before = log && self2.host.getMemoryUsage();
239421
+ const before = log2 && self2.host.getMemoryUsage();
239309
239422
  self2.host.gc();
239310
- if (log) {
239423
+ if (log2) {
239311
239424
  const after = self2.host.getMemoryUsage();
239312
239425
  self2.logger.perftrc(`GC::before ${before}, after ${after}`);
239313
239426
  }
@@ -240235,17 +240348,17 @@ ${options.prefix}` : "\n" : options.prefix
240235
240348
  updateProjectIfDirty(this);
240236
240349
  return hasOneOrMoreJsAndNoTsFiles(this);
240237
240350
  }
240238
- static resolveModule(moduleName, initialDir, host, log) {
240239
- return _Project.importServicePluginSync({ name: moduleName }, [initialDir], host, log).resolvedModule;
240351
+ static resolveModule(moduleName, initialDir, host, log2) {
240352
+ return _Project.importServicePluginSync({ name: moduleName }, [initialDir], host, log2).resolvedModule;
240240
240353
  }
240241
240354
  /** @internal */
240242
- static importServicePluginSync(pluginConfigEntry, searchPaths, host, log) {
240355
+ static importServicePluginSync(pluginConfigEntry, searchPaths, host, log2) {
240243
240356
  Debug.assertIsDefined(host.require);
240244
240357
  let errorLogs;
240245
240358
  let resolvedModule;
240246
240359
  for (const initialDir of searchPaths) {
240247
240360
  const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules")));
240248
- log(`Loading ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
240361
+ log2(`Loading ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
240249
240362
  const result = host.require(resolvedPath, pluginConfigEntry.name);
240250
240363
  if (!result.error) {
240251
240364
  resolvedModule = result.module;
@@ -240257,13 +240370,13 @@ ${options.prefix}` : "\n" : options.prefix
240257
240370
  return { pluginConfigEntry, resolvedModule, errorLogs };
240258
240371
  }
240259
240372
  /** @internal */
240260
- static async importServicePluginAsync(pluginConfigEntry, searchPaths, host, log) {
240373
+ static async importServicePluginAsync(pluginConfigEntry, searchPaths, host, log2) {
240261
240374
  Debug.assertIsDefined(host.importPlugin);
240262
240375
  let errorLogs;
240263
240376
  let resolvedModule;
240264
240377
  for (const initialDir of searchPaths) {
240265
240378
  const resolvedPath = combinePaths(initialDir, "node_modules");
240266
- log(`Dynamically importing ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
240379
+ log2(`Dynamically importing ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
240267
240380
  let result;
240268
240381
  try {
240269
240382
  result = await host.importPlugin(resolvedPath, pluginConfigEntry.name);
@@ -243070,7 +243183,7 @@ ${options.prefix}` : "\n" : options.prefix
243070
243183
  3
243071
243184
  /* verbose */
243072
243185
  ) ? 2 : this.logger.loggingEnabled() ? 1 : 0;
243073
- const log = watchLogLevel !== 0 ? (s2) => this.logger.info(s2) : noop3;
243186
+ const log2 = watchLogLevel !== 0 ? (s2) => this.logger.info(s2) : noop3;
243074
243187
  this.packageJsonCache = createPackageJsonCache(this);
243075
243188
  this.watchFactory = this.serverMode !== 0 ? {
243076
243189
  watchFile: returnNoopFileWatcher,
@@ -243078,7 +243191,7 @@ ${options.prefix}` : "\n" : options.prefix
243078
243191
  } : getWatchFactory(
243079
243192
  createWatchFactoryHostUsingWatchEvents(this, opts.canUseWatchEvents) || this.host,
243080
243193
  watchLogLevel,
243081
- log,
243194
+ log2,
243082
243195
  getDetailWatchInfo
243083
243196
  );
243084
243197
  this.canUseWatchEvents = getCanUseWatchEvents(this, opts.canUseWatchEvents);
@@ -254783,11 +254896,13 @@ var build_exports = {};
254783
254896
  __export(build_exports, {
254784
254897
  default: () => build_default
254785
254898
  });
254786
- var import_esbuild_decorators, import_esbuild, import_rxjs6, import_operators5, build_default;
254899
+ var import_esbuild_decorators, import_esbuild, import_fs3, import_path, import_rxjs6, import_operators5, build_default;
254787
254900
  var init_build = __esm({
254788
254901
  "src/commands/build/build.ts"() {
254789
254902
  import_esbuild_decorators = __toESM(require_src());
254790
254903
  import_esbuild = __toESM(require("esbuild"));
254904
+ import_fs3 = require("fs");
254905
+ import_path = require("path");
254791
254906
  import_rxjs6 = __toESM(require_cjs());
254792
254907
  import_operators5 = __toESM(require_operators());
254793
254908
  init_log();
@@ -254818,12 +254933,15 @@ var init_build = __esm({
254818
254933
  (0, import_operators5.switchMap)(
254819
254934
  ({ esbuild: esbuild2, options }) => esbuild2.build({
254820
254935
  ...options,
254821
- plugins: [
254936
+ // Decorator metadata needs the project's tsconfig; without one
254937
+ // the plugin failed with "[plugin: tsc] failed to open
254938
+ // 'undefined'" - plain esbuild handles a project without it.
254939
+ plugins: (0, import_fs3.existsSync)((0, import_path.join)(process.cwd(), "tsconfig.json")) ? [
254822
254940
  (0, import_esbuild_decorators.esbuildDecorators)({
254823
254941
  tsconfig: "./tsconfig.json",
254824
254942
  cwd: process.cwd()
254825
254943
  })
254826
- ]
254944
+ ] : []
254827
254945
  })
254828
254946
  ),
254829
254947
  (0, import_operators5.tap)((data) => {
@@ -255085,9 +255203,10 @@ var init_cluster_change = __esm({
255085
255203
  });
255086
255204
 
255087
255205
  // src/commands/cluster/helpers/plan.ts
255088
- var AUTOSCALE_BOUNDS, VIRTUAL_UNSUPPORTED, intIn, validateDesired, planClusterChanges;
255206
+ var AUTOSCALE_BOUNDS, SERVER_TYPE_NAME, VIRTUAL_UNSUPPORTED, intIn, validateDesired, planClusterChanges;
255089
255207
  var init_plan = __esm({
255090
255208
  "src/commands/cluster/helpers/plan.ts"() {
255209
+ init_types2();
255091
255210
  AUTOSCALE_BOUNDS = {
255092
255211
  minWorkers: [1, 10],
255093
255212
  maxWorkers: [1, 10],
@@ -255096,8 +255215,10 @@ var init_plan = __esm({
255096
255215
  cpuScaleDownPercent: [1, 100],
255097
255216
  memScaleDownPercent: [1, 100],
255098
255217
  samplesToScale: [1, 20],
255099
- cooldownMinutes: [1, 1440]
255218
+ cooldownMinutes: [1, 1440],
255219
+ scaleUpStep: [1, 3]
255100
255220
  };
255221
+ SERVER_TYPE_NAME = /^[a-z]+[0-9]+[a-z]*$/;
255101
255222
  VIRTUAL_UNSUPPORTED = [
255102
255223
  "imageId",
255103
255224
  "serverType",
@@ -255138,6 +255259,22 @@ var init_plan = __esm({
255138
255259
  }
255139
255260
  continue;
255140
255261
  }
255262
+ if (key === "scalingProfile") {
255263
+ if (!SCALING_PROFILES.includes(value)) {
255264
+ errors.push(
255265
+ `cluster.autoscale.scalingProfile must be one of ${SCALING_PROFILES.join(", ")}`
255266
+ );
255267
+ }
255268
+ continue;
255269
+ }
255270
+ if (key === "serverTypes") {
255271
+ if (!Array.isArray(value) || value.length > 10 || value.some((t2) => !SERVER_TYPE_NAME.test(String(t2)))) {
255272
+ errors.push(
255273
+ "cluster.autoscale.serverTypes must be a list of up to 10 Hetzner server types, e.g. [cx33, cpx22]"
255274
+ );
255275
+ }
255276
+ continue;
255277
+ }
255141
255278
  const bounds = AUTOSCALE_BOUNDS[key];
255142
255279
  if (!bounds) {
255143
255280
  errors.push(`cluster.autoscale.${key} is not a known setting`);
@@ -255257,8 +255394,9 @@ var init_plan = __esm({
255257
255394
  if (desired.autoscale) {
255258
255395
  const now = current.autoscale ?? {};
255259
255396
  const changed = {};
255397
+ const same = (a, b) => Array.isArray(a) || Array.isArray(b) ? JSON.stringify(a ?? []) === JSON.stringify(b ?? []) : a === b;
255260
255398
  for (const [key, value] of Object.entries(desired.autoscale)) {
255261
- if (now[key] !== value) {
255399
+ if (!same(now[key], value)) {
255262
255400
  changed[key] = value;
255263
255401
  }
255264
255402
  }
@@ -255266,7 +255404,7 @@ var init_plan = __esm({
255266
255404
  steps.push({
255267
255405
  kind: "autoscale",
255268
255406
  input: changed,
255269
- description: `autoscale: ${Object.entries(changed).map(([k, v]) => `${k}=${v}`).join(", ")}`
255407
+ description: `autoscale: ${Object.entries(changed).map(([k, v]) => `${k}=${Array.isArray(v) ? v.join(",") : v}`).join(", ")}`
255270
255408
  });
255271
255409
  }
255272
255410
  }
@@ -255687,12 +255825,12 @@ var init_attach = __esm({
255687
255825
  });
255688
255826
 
255689
255827
  // src/commands/cluster/helpers/talosctl.ts
255690
- function talosctlAssetName(platform = process.platform, arch = process.arch) {
255691
- const os2 = platform === "win32" ? "windows" : platform === "darwin" ? "darwin" : platform === "linux" ? "linux" : null;
255828
+ function talosctlAssetName(platform2 = process.platform, arch = process.arch) {
255829
+ const os2 = platform2 === "win32" ? "windows" : platform2 === "darwin" ? "darwin" : platform2 === "linux" ? "linux" : null;
255692
255830
  const cpu = arch === "x64" ? "amd64" : arch === "arm64" ? "arm64" : null;
255693
255831
  if (!os2 || !cpu) {
255694
255832
  throw new Error(
255695
- `No talosctl release for ${platform}/${arch}. Install talosctl yourself: https://www.talos.dev/latest/talos-guides/install/talosctl/`
255833
+ `No talosctl release for ${platform2}/${arch}. Install talosctl yourself: https://www.talos.dev/latest/talos-guides/install/talosctl/`
255696
255834
  );
255697
255835
  }
255698
255836
  return `talosctl-${os2}-${cpu}${os2 === "windows" ? ".exe" : ""}`;
@@ -255726,12 +255864,12 @@ async function ensureTalosctl(version2) {
255726
255864
  return "talosctl";
255727
255865
  }
255728
255866
  const asset = talosctlAssetName();
255729
- const dir = (0, import_path.join)(mainDirectory, "bin");
255730
- const binary = (0, import_path.join)(
255867
+ const dir = (0, import_path2.join)(mainDirectory, "bin");
255868
+ const binary = (0, import_path2.join)(
255731
255869
  dir,
255732
255870
  `talosctl-${version2}${asset.endsWith(".exe") ? ".exe" : ""}`
255733
255871
  );
255734
- if ((0, import_fs3.existsSync)(binary)) {
255872
+ if ((0, import_fs4.existsSync)(binary)) {
255735
255873
  return binary;
255736
255874
  }
255737
255875
  Logger.info(
@@ -255757,21 +255895,21 @@ async function ensureTalosctl(version2) {
255757
255895
  Logger.info(`talosctl ${version2} saved to ${binary}`);
255758
255896
  return binary;
255759
255897
  }
255760
- var import_child_process, import_crypto, import_fs3, import_promises, import_path, RELEASES, VERSION_RE, clientVersionOf, runBinary;
255898
+ var import_child_process2, import_crypto, import_fs4, import_promises, import_path2, RELEASES, VERSION_RE, clientVersionOf, runBinary;
255761
255899
  var init_talosctl = __esm({
255762
255900
  "src/commands/cluster/helpers/talosctl.ts"() {
255763
- import_child_process = require("child_process");
255901
+ import_child_process2 = require("child_process");
255764
255902
  import_crypto = require("crypto");
255765
- import_fs3 = require("fs");
255903
+ import_fs4 = require("fs");
255766
255904
  import_promises = require("fs/promises");
255767
- import_path = require("path");
255905
+ import_path2 = require("path");
255768
255906
  init_log();
255769
255907
  init_types();
255770
255908
  RELEASES = "https://github.com/siderolabs/talos/releases/download";
255771
255909
  VERSION_RE = /^v\d+\.\d+\.\d+$/;
255772
255910
  clientVersionOf = (output) => output.match(/Talos (v\d+\.\d+\.\d+\S*)/)?.[1] ?? null;
255773
255911
  runBinary = (binary, args, timeoutMs = 2e4) => new Promise(
255774
- (resolve2) => (0, import_child_process.execFile)(
255912
+ (resolve2) => (0, import_child_process2.execFile)(
255775
255913
  binary,
255776
255914
  args,
255777
255915
  { timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024 },
@@ -255790,12 +255928,12 @@ var attach_exports = {};
255790
255928
  __export(attach_exports, {
255791
255929
  default: () => attach_default
255792
255930
  });
255793
- var import_promises2, import_os2, import_path2, import_readline, import_rxjs17, sleep, ask, attach_default;
255931
+ var import_promises2, import_os3, import_path3, import_readline, import_rxjs17, sleep2, ask, attach_default;
255794
255932
  var init_attach2 = __esm({
255795
255933
  "src/commands/cluster/attach.ts"() {
255796
255934
  import_promises2 = require("fs/promises");
255797
- import_os2 = require("os");
255798
- import_path2 = require("path");
255935
+ import_os3 = require("os");
255936
+ import_path3 = require("path");
255799
255937
  import_readline = require("readline");
255800
255938
  import_rxjs17 = __toESM(require_cjs());
255801
255939
  init_gql_client();
@@ -255803,7 +255941,7 @@ var init_attach2 = __esm({
255803
255941
  init_attach();
255804
255942
  init_cluster_change();
255805
255943
  init_talosctl();
255806
- sleep = (ms) => new Promise((r2) => setTimeout(r2, ms));
255944
+ sleep2 = (ms) => new Promise((r2) => setTimeout(r2, ms));
255807
255945
  ask = (question) => new Promise((resolve2) => {
255808
255946
  const rl = (0, import_readline.createInterface)({
255809
255947
  input: process.stdin,
@@ -255845,7 +255983,7 @@ var init_attach2 = __esm({
255845
255983
  "yaml"
255846
255984
  ]);
255847
255985
  version2 = probe.code === 0 ? serverTalosVersion(probe.stdout) : void 0;
255848
- if (!version2) await sleep(5e3);
255986
+ if (!version2) await sleep2(5e3);
255849
255987
  }
255850
255988
  if (!version2) {
255851
255989
  throw new Error(
@@ -255889,8 +256027,8 @@ var init_attach2 = __esm({
255889
256027
  `The cluster runs Talos ${join_.talosVersion}, the machine booted ${version2}. It installs ${join_.talosVersion} anyway; if the join fails, boot ${join_.isoUrl}.`
255890
256028
  );
255891
256029
  }
255892
- const dir = await (0, import_promises2.mkdtemp)((0, import_path2.join)((0, import_os2.tmpdir)(), "gcli-attach-"));
255893
- const file2 = (0, import_path2.join)(dir, "machine.yaml");
256030
+ const dir = await (0, import_promises2.mkdtemp)((0, import_path3.join)((0, import_os3.tmpdir)(), "gcli-attach-"));
256031
+ const file2 = (0, import_path3.join)(dir, "machine.yaml");
255894
256032
  try {
255895
256033
  await (0, import_promises2.writeFile)(file2, join_.config, { mode: 384 });
255896
256034
  const applied = await talosctl(
@@ -255917,7 +256055,7 @@ var init_attach2 = __esm({
255917
256055
  );
255918
256056
  const deadline = Date.now() + opts.timeoutMs;
255919
256057
  while (Date.now() < deadline) {
255920
- await sleep(15e3);
256058
+ await sleep2(15e3);
255921
256059
  const nodes = await (0, import_rxjs17.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId));
255922
256060
  const node = nodes.find((n) => n.name === opts.name);
255923
256061
  if (node?.status === "ready") {
@@ -256002,12 +256140,12 @@ __export(reset_machine_exports, {
256002
256140
  default: () => reset_machine_default,
256003
256141
  hostnameOf: () => hostnameOf
256004
256142
  });
256005
- var import_promises3, import_os3, import_path3, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
256143
+ var import_promises3, import_os4, import_path4, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
256006
256144
  var init_reset_machine = __esm({
256007
256145
  "src/commands/cluster/reset-machine.ts"() {
256008
256146
  import_promises3 = require("fs/promises");
256009
- import_os3 = require("os");
256010
- import_path3 = require("path");
256147
+ import_os4 = require("os");
256148
+ import_path4 = require("path");
256011
256149
  import_readline2 = require("readline");
256012
256150
  import_rxjs20 = __toESM(require_cjs());
256013
256151
  init_gql_client();
@@ -256045,8 +256183,8 @@ var init_reset_machine = __esm({
256045
256183
  GraphqlClienAPI.clusterTalosconfig(clusterId, 15)
256046
256184
  );
256047
256185
  const binary = access.talosVersion ? await ensureTalosctl(access.talosVersion) : "talosctl";
256048
- const dir = await (0, import_promises3.mkdtemp)((0, import_path3.join)((0, import_os3.tmpdir)(), "gcli-reset-"));
256049
- const config2 = (0, import_path3.join)(dir, "talosconfig");
256186
+ const dir = await (0, import_promises3.mkdtemp)((0, import_path4.join)((0, import_os4.tmpdir)(), "gcli-reset-"));
256187
+ const config2 = (0, import_path4.join)(dir, "talosconfig");
256050
256188
  try {
256051
256189
  await (0, import_promises3.writeFile)(config2, access.talosconfig, { mode: 384 });
256052
256190
  const talos = (args, timeoutMs = 3e4) => runBinary(
@@ -256407,6 +256545,7 @@ var init_autoscale = __esm({
256407
256545
  init_gql_client();
256408
256546
  init_log();
256409
256547
  init_cluster_change();
256548
+ init_types2();
256410
256549
  toAutoscaleInput = (cmd) => {
256411
256550
  if (cmd.enable && cmd.disable) {
256412
256551
  throw new Error("Pass --enable or --disable, not both");
@@ -256422,7 +256561,8 @@ var init_autoscale = __esm({
256422
256561
  ["cpuDown", "cpuScaleDownPercent", 1, 100],
256423
256562
  ["memDown", "memScaleDownPercent", 1, 100],
256424
256563
  ["samples", "samplesToScale", 1, 20],
256425
- ["cooldown", "cooldownMinutes", 1, 1440]
256564
+ ["cooldown", "cooldownMinutes", 1, 1440],
256565
+ ["step", "scaleUpStep", 1, 3]
256426
256566
  ];
256427
256567
  for (const [flag, field, min, max] of ints) {
256428
256568
  if (cmd[flag] !== void 0) {
@@ -256434,9 +256574,20 @@ var init_autoscale = __esm({
256434
256574
  );
256435
256575
  }
256436
256576
  }
256577
+ if (cmd.profile !== void 0) {
256578
+ if (!SCALING_PROFILES.includes(cmd.profile)) {
256579
+ throw new Error(
256580
+ `--profile must be one of ${SCALING_PROFILES.join(", ")}, got "${cmd.profile}"`
256581
+ );
256582
+ }
256583
+ input.scalingProfile = cmd.profile;
256584
+ }
256585
+ if (cmd.serverTypes !== void 0) {
256586
+ input.serverTypes = ["", "none"].includes(cmd.serverTypes.trim()) ? [] : cmd.serverTypes.split(",").map((t2) => t2.trim().toLowerCase()).filter(Boolean);
256587
+ }
256437
256588
  if (!Object.keys(input).length) {
256438
256589
  throw new Error(
256439
- "Nothing to change: pass --enable/--disable and/or --min, --max, --cpuUp, --memUp, --cpuDown, --memDown, --samples, --cooldown (gcli cluster:status shows the current policy)"
256590
+ "Nothing to change: pass --enable/--disable and/or --profile, --serverTypes, --step, --min, --max, --cpuUp, --memUp, --cpuDown, --memDown, --samples, --cooldown (gcli cluster:status shows the current policy)"
256440
256591
  );
256441
256592
  }
256442
256593
  return input;
@@ -256455,6 +256606,9 @@ var init_autoscale = __esm({
256455
256606
  cluster: cluster.name,
256456
256607
  workers: cluster.topology?.workers,
256457
256608
  enabled: a.enabled,
256609
+ profile: a.scalingProfile,
256610
+ workerTypes: a.serverTypes?.length ? a.serverTypes.join(",") : "(cluster type)",
256611
+ step: a.scaleUpStep,
256458
256612
  minWorkers: a.minWorkers,
256459
256613
  maxWorkers: a.maxWorkers,
256460
256614
  scaleUpAt: `cpu ${a.cpuScaleUpPercent}% / mem ${a.memScaleUpPercent}%`,
@@ -256588,6 +256742,45 @@ var init_list_environments = __esm({
256588
256742
  }
256589
256743
  });
256590
256744
 
256745
+ // src/commands/environment/environment-payload.ts
256746
+ var NUMERIC_FIELDS, CLI_ONLY, environmentPayload;
256747
+ var init_environment_payload = __esm({
256748
+ "src/commands/environment/environment-payload.ts"() {
256749
+ NUMERIC_FIELDS = [
256750
+ "minCpu",
256751
+ "maxCpu",
256752
+ "minMemory",
256753
+ "maxMemory",
256754
+ "poolSize",
256755
+ "maxPods",
256756
+ "builderPoolSize",
256757
+ "builderMaxParallelBuilds",
256758
+ "builderIdleTimeout",
256759
+ "terminationGracePeriod"
256760
+ ];
256761
+ CLI_ONLY = ["spec", "project", "clusterName"];
256762
+ environmentPayload = (spec, flags) => {
256763
+ const merged = { ...spec };
256764
+ for (const [key, value] of Object.entries(flags)) {
256765
+ if (value !== void 0) merged[key] = value;
256766
+ }
256767
+ for (const key of CLI_ONLY) delete merged[key];
256768
+ for (const key of NUMERIC_FIELDS) {
256769
+ const value = merged[key];
256770
+ if (value === void 0 || value === null || typeof value === "number") {
256771
+ continue;
256772
+ }
256773
+ const n = Number(value);
256774
+ if (!Number.isInteger(n)) {
256775
+ throw new Error(`--${key} must be a whole number, got "${value}"`);
256776
+ }
256777
+ merged[key] = n;
256778
+ }
256779
+ return merged;
256780
+ };
256781
+ }
256782
+ });
256783
+
256591
256784
  // src/commands/environment/create-environment.ts
256592
256785
  var create_environment_exports = {};
256593
256786
  __export(create_environment_exports, {
@@ -256602,6 +256795,7 @@ var init_create_environment = __esm({
256602
256795
  init_gql_client();
256603
256796
  init_log();
256604
256797
  init_load_spec();
256798
+ init_environment_payload();
256605
256799
  create_environment_default = (cmd) => {
256606
256800
  const { clusterName: cmdClusterName, ...cmdRest } = cmd;
256607
256801
  return (0, import_rxjs28.lastValueFrom)(
@@ -256621,8 +256815,7 @@ var init_create_environment = __esm({
256621
256815
  }).pipe(
256622
256816
  (0, import_operators13.switchMap)(
256623
256817
  (clusterId) => GraphqlClienAPI.createEnvironment(projectId, {
256624
- ...data,
256625
- ...cmdRest,
256818
+ ...environmentPayload(data, cmdRest),
256626
256819
  clusterId
256627
256820
  })
256628
256821
  )
@@ -256668,6 +256861,7 @@ var init_update_environment = __esm({
256668
256861
  init_gql_client();
256669
256862
  init_log();
256670
256863
  init_load_spec();
256864
+ init_environment_payload();
256671
256865
  update_environment_default = (cmd) => {
256672
256866
  const { clusterName: cmdClusterName, ...cmdRest } = cmd;
256673
256867
  return (0, import_rxjs29.lastValueFrom)(
@@ -256688,8 +256882,7 @@ var init_update_environment = __esm({
256688
256882
  }).pipe(
256689
256883
  (0, import_operators14.switchMap)(
256690
256884
  (clusterId) => GraphqlClienAPI.updateEnvironment(projectId, {
256691
- ...data,
256692
- ...cmdRest,
256885
+ ...environmentPayload(data, cmdRest),
256693
256886
  clusterId
256694
256887
  })
256695
256888
  )
@@ -269294,7 +269487,7 @@ var require_async3 = __commonJS({
269294
269487
  function groupBySeries(coll, iteratee, callback) {
269295
269488
  return groupByLimit$1(coll, 1, iteratee, callback);
269296
269489
  }
269297
- var log = consoleFunc("log");
269490
+ var log2 = consoleFunc("log");
269298
269491
  function mapValuesLimit(obj, limit, iteratee, callback) {
269299
269492
  callback = once(callback);
269300
269493
  var newObj = {};
@@ -269822,7 +270015,7 @@ var require_async3 = __commonJS({
269822
270015
  groupBy,
269823
270016
  groupByLimit: groupByLimit$1,
269824
270017
  groupBySeries,
269825
- log,
270018
+ log: log2,
269826
270019
  map: map$1,
269827
270020
  mapLimit: mapLimit$1,
269828
270021
  mapSeries: mapSeries$1,
@@ -269928,7 +270121,7 @@ var require_async3 = __commonJS({
269928
270121
  exports3.groupBy = groupBy;
269929
270122
  exports3.groupByLimit = groupByLimit$1;
269930
270123
  exports3.groupBySeries = groupBySeries;
269931
- exports3.log = log;
270124
+ exports3.log = log2;
269932
270125
  exports3.map = map$1;
269933
270126
  exports3.mapLimit = mapLimit$1;
269934
270127
  exports3.mapSeries = mapSeries$1;
@@ -270006,7 +270199,7 @@ var require_polyfills = __commonJS({
270006
270199
  var constants = require("constants");
270007
270200
  var origCwd = process.cwd;
270008
270201
  var cwd = null;
270009
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
270202
+ var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
270010
270203
  process.cwd = function() {
270011
270204
  if (!cwd)
270012
270205
  cwd = origCwd.call(process);
@@ -270065,7 +270258,7 @@ var require_polyfills = __commonJS({
270065
270258
  fs3.lchownSync = function() {
270066
270259
  };
270067
270260
  }
270068
- if (platform === "win32") {
270261
+ if (platform2 === "win32") {
270069
270262
  fs3.rename = /* @__PURE__ */ (function(fs$rename) {
270070
270263
  return function(from16, to, cb) {
270071
270264
  var start3 = Date.now();
@@ -270956,7 +271149,7 @@ var require_BufferList2 = __commonJS({
270956
271149
  this.head = this.tail = null;
270957
271150
  this.length = 0;
270958
271151
  };
270959
- BufferList.prototype.join = function join6(s2) {
271152
+ BufferList.prototype.join = function join7(s2) {
270960
271153
  if (this.length === 0) return "";
270961
271154
  var p = this.head;
270962
271155
  var ret = "" + p.data;
@@ -275756,7 +275949,7 @@ var require_buffer_list3 = __commonJS({
275756
275949
  }
275757
275950
  }, {
275758
275951
  key: "join",
275759
- value: function join6(s2) {
275952
+ value: function join7(s2) {
275760
275953
  if (this.length === 0) return "";
275761
275954
  var p = this.head;
275762
275955
  var ret = "" + p.data;
@@ -278938,8 +279131,8 @@ var require_zip_archive_entry = __commonJS({
278938
279131
  }
278939
279132
  this.name = name2;
278940
279133
  };
278941
- ZipArchiveEntry.prototype.setPlatform = function(platform) {
278942
- this.platform = platform;
279134
+ ZipArchiveEntry.prototype.setPlatform = function(platform2) {
279135
+ this.platform = platform2;
278943
279136
  };
278944
279137
  ZipArchiveEntry.prototype.setSize = function(size) {
278945
279138
  if (size < 0) {
@@ -279098,7 +279291,7 @@ var require_buffer_list4 = __commonJS({
279098
279291
  }
279099
279292
  }, {
279100
279293
  key: "join",
279101
- value: function join6(s2) {
279294
+ value: function join7(s2) {
279102
279295
  if (this.length === 0) return "";
279103
279296
  var p = this.head;
279104
279297
  var ret = "" + p.data;
@@ -281870,7 +282063,7 @@ var require_buffer_list5 = __commonJS({
281870
282063
  }
281871
282064
  }, {
281872
282065
  key: "join",
281873
- value: function join6(s2) {
282066
+ value: function join7(s2) {
281874
282067
  if (this.length === 0) return "";
281875
282068
  var p = this.head;
281876
282069
  var ret = "" + p.data;
@@ -285107,7 +285300,7 @@ var require_buffer_list6 = __commonJS({
285107
285300
  }
285108
285301
  }, {
285109
285302
  key: "join",
285110
- value: function join6(s2) {
285303
+ value: function join7(s2) {
285111
285304
  if (this.length === 0) return "";
285112
285305
  var p = this.head;
285113
285306
  var ret = "" + p.data;
@@ -288055,12 +288248,12 @@ var package_exports = {};
288055
288248
  __export(package_exports, {
288056
288249
  default: () => package_default
288057
288250
  });
288058
- var import_archiver, import_child_process2, import_fs4, import_rxjs32, import_operators17, import_util3, ReadFile, package_default;
288251
+ var import_archiver, import_child_process3, import_fs5, import_rxjs32, import_operators17, import_util3, ReadFile, package_default;
288059
288252
  var init_package = __esm({
288060
288253
  "src/commands/lambda/package.ts"() {
288061
288254
  import_archiver = __toESM(require_archiver());
288062
- import_child_process2 = require("child_process");
288063
- import_fs4 = require("fs");
288255
+ import_child_process3 = require("child_process");
288256
+ import_fs5 = require("fs");
288064
288257
  import_rxjs32 = __toESM(require_cjs());
288065
288258
  import_operators17 = __toESM(require_operators());
288066
288259
  import_util3 = require("util");
@@ -288078,7 +288271,7 @@ var init_package = __esm({
288078
288271
  zlib: { level: 9 }
288079
288272
  // Sets the compression level.
288080
288273
  });
288081
- await (0, import_util3.promisify)(import_child_process2.exec)(["chmod", "+x", data.script].join(" "));
288274
+ await (0, import_util3.promisify)(import_child_process3.exec)(["chmod", "+x", data.script].join(" "));
288082
288275
  const ignore = await (0, import_rxjs32.lastValueFrom)(
288083
288276
  ReadFile(".gignore").pipe(
288084
288277
  (0, import_operators17.map)((ignore2) => parseIgnoredFiles(ignore2))
@@ -288091,10 +288284,10 @@ var init_package = __esm({
288091
288284
  return (0, import_rxjs32.lastValueFrom)(
288092
288285
  (0, import_rxjs32.from)(streamToBufferPromise(archive)).pipe(
288093
288286
  (0, import_operators17.switchMap)(
288094
- (buffer) => (0, import_rxjs32.from)((0, import_util3.promisify)(import_fs4.mkdir)(".gcache")).pipe(
288287
+ (buffer) => (0, import_rxjs32.from)((0, import_util3.promisify)(import_fs5.mkdir)(".gcache")).pipe(
288095
288288
  (0, import_operators17.catchError)(() => (0, import_rxjs32.of)(true)),
288096
288289
  (0, import_operators17.switchMap)(
288097
- () => (0, import_util3.promisify)(import_fs4.writeFile)(`.gcache/${data.name}.zip`, buffer)
288290
+ () => (0, import_util3.promisify)(import_fs5.writeFile)(`.gcache/${data.name}.zip`, buffer)
288098
288291
  )
288099
288292
  )
288100
288293
  )
@@ -288118,11 +288311,11 @@ function streamToBufferPromise(file2) {
288118
288311
  });
288119
288312
  });
288120
288313
  }
288121
- var import_form_data, import_fs5, import_rxjs33, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, createCommand;
288314
+ var import_form_data, import_fs6, import_rxjs33, import_operators18, import_stream_to_buffer, ReadFile2, createOrUpdateLambda, printAddresses, createCommand;
288122
288315
  var init_helpers2 = __esm({
288123
288316
  "src/commands/lambda/helpers/index.ts"() {
288124
288317
  import_form_data = __toESM(require_form_data());
288125
- import_fs5 = require("fs");
288318
+ import_fs6 = require("fs");
288126
288319
  init_src();
288127
288320
  import_rxjs33 = __toESM(require_cjs());
288128
288321
  import_operators18 = __toESM(require_operators());
@@ -288154,7 +288347,7 @@ var init_helpers2 = __esm({
288154
288347
  }
288155
288348
  await package_default(cmd);
288156
288349
  const body = new import_form_data.default();
288157
- body.append("file[]", (0, import_fs5.createReadStream)(`.gcache/${data.name}.zip`));
288350
+ body.append("file[]", (0, import_fs6.createReadStream)(`.gcache/${data.name}.zip`));
288158
288351
  const config2 = await (0, import_rxjs33.lastValueFrom)(GraphqlClienAPI.getConfig());
288159
288352
  return (0, import_rxjs33.lastValueFrom)(
288160
288353
  (0, import_rxjs33.from)(
@@ -288223,18 +288416,32 @@ var init_helpers2 = __esm({
288223
288416
  minScale: cmd.minScale || payload.scaleOptions?.minScale || 0,
288224
288417
  targetCpu: cmd.targetCpu || payload.scaleOptions?.targetCpu || 0,
288225
288418
  idleTimeout: cmd.idleTimeout || payload.scaleOptions?.idleTimeout || 120,
288226
- concurrency: cmd.concurrency || payload.scaleOptions?.concurrency || 500,
288227
- functionTimeout: cmd.functionTimeout || payload.scaleOptions?.functionTimeout || 60,
288228
- specializationTimeout: cmd.specializationTimeout || payload.scaleOptions?.specializationTimeout || 120
288419
+ // 0 = not set: the server fills these in within the project's
288420
+ // plan (concurrency <= 3, timeouts 60/120 s capped). A fixed
288421
+ // 500 / 60 / 120 here was refused on plans with lower maxima.
288422
+ concurrency: cmd.concurrency || payload.scaleOptions?.concurrency || 0,
288423
+ functionTimeout: cmd.functionTimeout || payload.scaleOptions?.functionTimeout || 0,
288424
+ specializationTimeout: cmd.specializationTimeout || payload.scaleOptions?.specializationTimeout || 0
288229
288425
  }
288230
288426
  })
288231
288427
  );
288232
288428
  }),
288233
288429
  (0, import_operators18.tap)((data) => {
288234
288430
  Logger.info(JSON.stringify(data, null, 2));
288235
- })
288431
+ }),
288432
+ (0, import_operators18.switchMap)((data) => printAddresses(data))
288236
288433
  )
288237
288434
  );
288435
+ printAddresses = (data) => (data?.id ? GraphqlClienAPI.getLambda(data.id, ["siteUrl"]).pipe(
288436
+ (0, import_operators18.map)((l) => l.siteUrl ?? null),
288437
+ (0, import_operators18.catchError)(() => (0, import_rxjs33.of)(null))
288438
+ ) : (0, import_rxjs33.of)(null)).pipe(
288439
+ (0, import_operators18.tap)((siteUrl) => {
288440
+ if (data?.url) Logger.info(`URL: ${data.url}`);
288441
+ if (siteUrl) Logger.info(`Site: ${siteUrl}`);
288442
+ }),
288443
+ (0, import_operators18.map)(() => data)
288444
+ );
288238
288445
  createCommand = (command) => (options) => (program2) => {
288239
288446
  const cmd = program2.command(command);
288240
288447
  for (const option of options) {
@@ -288821,10 +289028,10 @@ var use_exports = {};
288821
289028
  __export(use_exports, {
288822
289029
  default: () => use_default
288823
289030
  });
288824
- var import_fs6, import_rxjs45, import_operators30, import_util4, use_default;
289031
+ var import_fs7, import_rxjs45, import_operators30, import_util4, use_default;
288825
289032
  var init_use = __esm({
288826
289033
  "src/commands/project/use.ts"() {
288827
- import_fs6 = require("fs");
289034
+ import_fs7 = require("fs");
288828
289035
  import_rxjs45 = __toESM(require_cjs());
288829
289036
  import_operators30 = __toESM(require_operators());
288830
289037
  import_util4 = require("util");
@@ -288839,7 +289046,7 @@ var init_use = __esm({
288839
289046
  ),
288840
289047
  (0, import_operators30.switchMap)(
288841
289048
  (projectId) => (0, import_rxjs45.from)(
288842
- (0, import_util4.promisify)(import_fs6.writeFile)(projectDirectory, projectId, {
289049
+ (0, import_util4.promisify)(import_fs7.writeFile)(projectDirectory, projectId, {
288843
289050
  encoding: "utf-8"
288844
289051
  })
288845
289052
  )
@@ -288855,13 +289062,13 @@ var clear_exports = {};
288855
289062
  __export(clear_exports, {
288856
289063
  default: () => clear_default
288857
289064
  });
288858
- var import_fs7, import_util5, clear_default;
289065
+ var import_fs8, import_util5, clear_default;
288859
289066
  var init_clear = __esm({
288860
289067
  "src/commands/project/clear.ts"() {
288861
- import_fs7 = require("fs");
289068
+ import_fs8 = require("fs");
288862
289069
  import_util5 = require("util");
288863
289070
  init_types();
288864
- clear_default = async () => (0, import_util5.promisify)(import_fs7.unlink)(projectDirectory);
289071
+ clear_default = async () => (0, import_util5.promisify)(import_fs8.unlink)(projectDirectory);
288865
289072
  }
288866
289073
  });
288867
289074
 
@@ -293833,7 +294040,7 @@ __export(regexes_exports, {
293833
294040
  extendedDuration: () => extendedDuration,
293834
294041
  guid: () => guid,
293835
294042
  hex: () => hex,
293836
- hostname: () => hostname,
294043
+ hostname: () => hostname2,
293837
294044
  html5Email: () => html5Email,
293838
294045
  idnEmail: () => idnEmail,
293839
294046
  integer: () => integer,
@@ -293900,7 +294107,7 @@ function fixedBase64(bodyLength, padding) {
293900
294107
  function fixedBase64url(length) {
293901
294108
  return new RegExp(`^[A-Za-z0-9_-]{${length}}$`);
293902
294109
  }
293903
- var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid, uuid, uuid4, uuid6, uuid7, email, html5Email, rfc5322Email, unicodeEmail, idnEmail, browserEmail, _emoji, ipv4, ipv6, mac, cidrv4, cidrv6, base64, base64url, hostname, domain, e164, dateSource, date, string, bigint, integer, number, boolean, _null, _undefined, lowercase, uppercase, hex, md5_hex, md5_base64, md5_base64url, sha1_hex, sha1_base64, sha1_base64url, sha256_hex, sha256_base64, sha256_base64url, sha384_hex, sha384_base64, sha384_base64url, sha512_hex, sha512_base64, sha512_base64url;
294110
+ var cuid, cuid2, ulid, xid, ksuid, nanoid, duration, extendedDuration, guid, uuid, uuid4, uuid6, uuid7, email, html5Email, rfc5322Email, unicodeEmail, idnEmail, browserEmail, _emoji, ipv4, ipv6, mac, cidrv4, cidrv6, base64, base64url, hostname2, domain, e164, dateSource, date, string, bigint, integer, number, boolean, _null, _undefined, lowercase, uppercase, hex, md5_hex, md5_base64, md5_base64url, sha1_hex, sha1_base64, sha1_base64url, sha256_hex, sha256_base64, sha256_base64url, sha384_hex, sha384_base64, sha384_base64url, sha512_hex, sha512_base64, sha512_base64url;
293904
294111
  var init_regexes = __esm({
293905
294112
  "../../node_modules/zod/v4/core/regexes.js"() {
293906
294113
  init_util2();
@@ -293938,7 +294145,7 @@ var init_regexes = __esm({
293938
294145
  cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
293939
294146
  base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
293940
294147
  base64url = /^[A-Za-z0-9_-]*$/;
293941
- hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
294148
+ hostname2 = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
293942
294149
  domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
293943
294150
  e164 = /^\+[1-9]\d{6,14}$/;
293944
294151
  dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
@@ -305285,7 +305492,7 @@ __export(schemas_exports3, {
305285
305492
  guid: () => guid2,
305286
305493
  hash: () => hash,
305287
305494
  hex: () => hex2,
305288
- hostname: () => hostname2,
305495
+ hostname: () => hostname3,
305289
305496
  httpUrl: () => httpUrl,
305290
305497
  instanceof: () => _instanceof,
305291
305498
  int: () => int,
@@ -305432,7 +305639,7 @@ function jwt(params) {
305432
305639
  function stringFormat(format, fnOrRegex, _params = {}) {
305433
305640
  return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
305434
305641
  }
305435
- function hostname2(_params) {
305642
+ function hostname3(_params) {
305436
305643
  return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
305437
305644
  }
305438
305645
  function hex2(_params) {
@@ -307118,7 +307325,7 @@ __export(external_exports3, {
307118
307325
  guid: () => guid2,
307119
307326
  hash: () => hash,
307120
307327
  hex: () => hex2,
307121
- hostname: () => hostname2,
307328
+ hostname: () => hostname3,
307122
307329
  httpUrl: () => httpUrl,
307123
307330
  includes: () => _includes,
307124
307331
  instanceof: () => _instanceof,
@@ -314404,11 +314611,11 @@ var require_core2 = __commonJS({
314404
314611
  Ajv2.ValidationError = validation_error_1.default;
314405
314612
  Ajv2.MissingRefError = ref_error_1.default;
314406
314613
  exports2.default = Ajv2;
314407
- function checkOptions(checkOpts, options, msg, log = "error") {
314614
+ function checkOptions(checkOpts, options, msg, log2 = "error") {
314408
314615
  for (const key in checkOpts) {
314409
314616
  const opt = key;
314410
314617
  if (opt in options)
314411
- this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
314618
+ this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
314412
314619
  }
314413
314620
  }
314414
314621
  function getSchEnv(keyRef) {
@@ -319669,6 +319876,105 @@ var init_zod = __esm({
319669
319876
  }
319670
319877
  });
319671
319878
 
319879
+ // src/commands/proxy/login-gate.ts
319880
+ var LOGIN_TOOL, log, startLoginGate;
319881
+ var init_login_gate = __esm({
319882
+ "src/commands/proxy/login-gate.ts"() {
319883
+ init_server2();
319884
+ init_stdio2();
319885
+ init_types4();
319886
+ init_browser_login();
319887
+ init_login();
319888
+ LOGIN_TOOL = "LambforgeLogin";
319889
+ log = (line) => process.stderr.write(`${line}
319890
+ `);
319891
+ startLoginGate = async (apiUrl) => {
319892
+ let state = { kind: "idle" };
319893
+ const begin = async () => {
319894
+ const start3 = await startBrowserLogin(apiUrl);
319895
+ state = { kind: "waiting", start: start3 };
319896
+ log(
319897
+ `Lambforge login: open ${start3.verificationUrl} (code ${start3.userCode})`
319898
+ );
319899
+ waitForApproval(apiUrl, start3).then(async ({ token, key }) => {
319900
+ await loginWithToken({
319901
+ token,
319902
+ key,
319903
+ url: apiUrl,
319904
+ uploadUrl: "",
319905
+ ci: false,
319906
+ silent: true
319907
+ });
319908
+ state = { kind: "done" };
319909
+ log("Lambforge login saved - reconnect this MCP server.");
319910
+ }).catch((e2) => {
319911
+ state = { kind: "failed", error: e2.message };
319912
+ log(`Lambforge login failed: ${e2.message}`);
319913
+ });
319914
+ return start3;
319915
+ };
319916
+ const answer = async () => {
319917
+ if (state.kind === "done") {
319918
+ return 'Logged in. Ask the user to reconnect the "lambforge" MCP server (in Claude Code: /mcp -> lambforge -> Reconnect); after that every Lambforge tool is available.';
319919
+ }
319920
+ if (state.kind === "waiting") {
319921
+ const { start: start4 } = state;
319922
+ return `Still waiting. Ask the user to open ${start4.verificationUrl} and approve code ${start4.userCode}, then call ${LOGIN_TOOL} again.`;
319923
+ }
319924
+ const start3 = await begin();
319925
+ return [
319926
+ "Not logged in to Lambforge yet. Show the user this link and code:",
319927
+ "",
319928
+ ` ${start3.verificationUrl}`,
319929
+ ` Code: ${start3.userCode}`,
319930
+ "",
319931
+ "They open it (signed in to lambforge.com), check the code matches and press Approve.",
319932
+ `Then call ${LOGIN_TOOL} again; it reports when the login is saved.`,
319933
+ "You cannot approve it yourself."
319934
+ ].join("\n");
319935
+ };
319936
+ const server2 = new Server(
319937
+ { name: "gapi-proxy", version: "1.0.0" },
319938
+ { capabilities: { tools: {} } }
319939
+ );
319940
+ server2.setRequestHandler(ListToolsRequestSchema, async () => ({
319941
+ tools: [
319942
+ {
319943
+ name: LOGIN_TOOL,
319944
+ description: "gcli is not logged in to Lambforge, so no other Lambforge tool is available yet. Call this to get a login link and code for the user; call again to check whether they approved it.",
319945
+ inputSchema: { type: "object", properties: {} }
319946
+ }
319947
+ ]
319948
+ }));
319949
+ server2.setRequestHandler(CallToolRequestSchema, async (request) => {
319950
+ if (request.params.name !== LOGIN_TOOL) {
319951
+ return {
319952
+ isError: true,
319953
+ content: [
319954
+ {
319955
+ type: "text",
319956
+ text: `Not logged in to Lambforge - call ${LOGIN_TOOL} first.`
319957
+ }
319958
+ ]
319959
+ };
319960
+ }
319961
+ try {
319962
+ return { content: [{ type: "text", text: await answer() }] };
319963
+ } catch (e2) {
319964
+ if (state.kind === "failed") state = { kind: "idle" };
319965
+ return {
319966
+ isError: true,
319967
+ content: [{ type: "text", text: e2.message }]
319968
+ };
319969
+ }
319970
+ });
319971
+ await server2.connect(new StdioServerTransport());
319972
+ log(`Not logged in - serving only ${LOGIN_TOOL}.`);
319973
+ await new Promise(() => void 0);
319974
+ };
319975
+ }
319976
+ });
319977
+
319672
319978
  // src/commands/proxy/start.ts
319673
319979
  var start_exports = {};
319674
319980
  __export(start_exports, {
@@ -319677,6 +319983,11 @@ __export(start_exports, {
319677
319983
  performFetch: () => performFetch
319678
319984
  });
319679
319985
  async function startProxy(cmd) {
319986
+ if (!(0, import_fs9.existsSync)(tokenDirectory)) {
319987
+ return startLoginGate(
319988
+ cmd.url ? cmd.url.replace(/\/mcp\/?$/, "") : "https://api.lambforge.com"
319989
+ );
319990
+ }
319680
319991
  return (0, import_rxjs46.lastValueFrom)(
319681
319992
  GraphqlClienAPI.getConfig().pipe(
319682
319993
  (0, import_operators31.take)(1),
@@ -319786,18 +320097,21 @@ async function startProxy(cmd) {
319786
320097
  )
319787
320098
  );
319788
320099
  }
319789
- var import_rxjs46, import_operators31, import_stream2, pendingToken, currentToken, withToken, performFetch;
320100
+ var import_fs9, import_rxjs46, import_operators31, import_stream2, pendingToken, currentToken, withToken, performFetch;
319790
320101
  var init_start = __esm({
319791
320102
  "src/commands/proxy/start.ts"() {
319792
320103
  init_client2();
319793
320104
  init_streamableHttp();
319794
320105
  init_server2();
319795
320106
  init_stdio2();
320107
+ import_fs9 = require("fs");
319796
320108
  import_rxjs46 = __toESM(require_cjs());
319797
320109
  import_operators31 = __toESM(require_operators());
319798
320110
  import_stream2 = require("stream");
319799
320111
  init_zod();
319800
320112
  init_gql_client();
320113
+ init_types();
320114
+ init_login_gate();
319801
320115
  pendingToken = null;
319802
320116
  currentToken = (force = false) => {
319803
320117
  if (!pendingToken || force) {
@@ -320537,19 +320851,19 @@ var init_connection = __esm({
320537
320851
  });
320538
320852
 
320539
320853
  // src/commands/runner/daemon.ts
320540
- var import_child_process3, import_fs8, import_promises6, import_os4, import_path4, import_util11, DEFAULT_SERVICE_NAME, RUNNER_AUTH_EXIT_CODE, systemdQuote, unitPath, buildUnit, resolveGcliCommand, defaultExec, SystemdUserService, assertSystemdAvailable;
320854
+ var import_child_process4, import_fs10, import_promises6, import_os5, import_path5, import_util11, DEFAULT_SERVICE_NAME, RUNNER_AUTH_EXIT_CODE, systemdQuote, unitPath, buildUnit, resolveGcliCommand, defaultExec, SystemdUserService, assertSystemdAvailable;
320541
320855
  var init_daemon = __esm({
320542
320856
  "src/commands/runner/daemon.ts"() {
320543
- import_child_process3 = require("child_process");
320544
- import_fs8 = require("fs");
320857
+ import_child_process4 = require("child_process");
320858
+ import_fs10 = require("fs");
320545
320859
  import_promises6 = require("fs/promises");
320546
- import_os4 = require("os");
320547
- import_path4 = require("path");
320860
+ import_os5 = require("os");
320861
+ import_path5 = require("path");
320548
320862
  import_util11 = require("util");
320549
320863
  DEFAULT_SERVICE_NAME = "lambforge-runner";
320550
320864
  RUNNER_AUTH_EXIT_CODE = 78;
320551
320865
  systemdQuote = (word) => /^[A-Za-z0-9_@%+=:,./-]+$/.test(word) ? word : `"${word.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
320552
- unitPath = (serviceName, home = (0, import_os4.homedir)()) => (0, import_path4.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
320866
+ unitPath = (serviceName, home = (0, import_os5.homedir)()) => (0, import_path5.join)(home, ".config", "systemd", "user", `${serviceName}.service`);
320553
320867
  buildUnit = ({
320554
320868
  serviceName,
320555
320869
  execStart,
@@ -320588,7 +320902,7 @@ var init_daemon = __esm({
320588
320902
  }
320589
320903
  let script = argv[1];
320590
320904
  try {
320591
- script = (0, import_fs8.realpathSync)(script);
320905
+ script = (0, import_fs10.realpathSync)(script);
320592
320906
  } catch {
320593
320907
  }
320594
320908
  const ephemeral = /[/\\]_npx[/\\]|[/\\]\.npm[/\\]_cacache/.test(script);
@@ -320597,9 +320911,9 @@ var init_daemon = __esm({
320597
320911
  warning: ephemeral ? `gcli is running from the npx cache (${script}), which npm may clean up and break the service. Install it globally first: npm i -g @gapi/gcli, then re-run this command with \`gcli\`.` : void 0
320598
320912
  };
320599
320913
  };
320600
- defaultExec = (file2, args) => (0, import_util11.promisify)(import_child_process3.execFile)(file2, args, { encoding: "utf8" });
320914
+ defaultExec = (file2, args) => (0, import_util11.promisify)(import_child_process4.execFile)(file2, args, { encoding: "utf8" });
320601
320915
  SystemdUserService = class {
320602
- constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0, import_os4.homedir)()) {
320916
+ constructor(serviceName = DEFAULT_SERVICE_NAME, exec2 = defaultExec, home = (0, import_os5.homedir)()) {
320603
320917
  this.serviceName = serviceName;
320604
320918
  this.exec = exec2;
320605
320919
  this.home = home;
@@ -320610,7 +320924,7 @@ var init_daemon = __esm({
320610
320924
  /** install -> daemon-reload -> enable -> restart (picks up a changed unit). */
320611
320925
  async install(unitContent) {
320612
320926
  const path2 = unitPath(this.serviceName, this.home);
320613
- await (0, import_promises6.mkdir)((0, import_path4.join)(path2, ".."), { recursive: true });
320927
+ await (0, import_promises6.mkdir)((0, import_path5.join)(path2, ".."), { recursive: true });
320614
320928
  await (0, import_promises6.writeFile)(path2, unitContent, "utf-8");
320615
320929
  await this.systemctl("daemon-reload");
320616
320930
  await this.systemctl("enable", this.unit);
@@ -320626,7 +320940,7 @@ var init_daemon = __esm({
320626
320940
  }
320627
320941
  /** Whether `runner:daemon:install` wrote the unit. */
320628
320942
  installed() {
320629
- return (0, import_fs8.existsSync)(unitPath(this.serviceName, this.home));
320943
+ return (0, import_fs10.existsSync)(unitPath(this.serviceName, this.home));
320630
320944
  }
320631
320945
  start() {
320632
320946
  return this.systemctl("start", this.unit);
@@ -320690,10 +321004,10 @@ __export(start_exports2, {
320690
321004
  default: () => start_default,
320691
321005
  resolveRunner: () => resolveRunner
320692
321006
  });
320693
- var import_os5, import_rxjs50, RUNNER_VERSION, resolveRunner, start_default;
321007
+ var import_os6, import_rxjs50, RUNNER_VERSION, resolveRunner, start_default;
320694
321008
  var init_start2 = __esm({
320695
321009
  "src/commands/runner/start.ts"() {
320696
- import_os5 = require("os");
321010
+ import_os6 = require("os");
320697
321011
  import_rxjs50 = __toESM(require_cjs());
320698
321012
  init_gql_client();
320699
321013
  init_log();
@@ -320713,7 +321027,7 @@ var init_start2 = __esm({
320713
321027
  if (saved) {
320714
321028
  return saved;
320715
321029
  }
320716
- const name2 = cmd.name || (0, import_os5.hostname)();
321030
+ const name2 = cmd.name || (0, import_os6.hostname)();
320717
321031
  Logger.info(`Registering this machine as local runner "${name2}"...`);
320718
321032
  const { runner, token } = await (0, import_rxjs50.lastValueFrom)(
320719
321033
  GraphqlClienAPI.createLocalRunner(name2)
@@ -320776,10 +321090,10 @@ __export(daemon_commands_exports, {
320776
321090
  stop: () => stop,
320777
321091
  uninstall: () => uninstall
320778
321092
  });
320779
- var import_child_process4, install, uninstall, installedService, reportStarted, start, restart, stop, status, logs;
321093
+ var import_child_process5, install, uninstall, installedService, reportStarted, start, restart, stop, status, logs;
320780
321094
  var init_daemon_commands = __esm({
320781
321095
  "src/commands/runner/daemon-commands.ts"() {
320782
- import_child_process4 = require("child_process");
321096
+ import_child_process5 = require("child_process");
320783
321097
  init_log();
320784
321098
  init_config();
320785
321099
  init_daemon();
@@ -320895,7 +321209,7 @@ var init_daemon_commands = __esm({
320895
321209
  assertSystemdAvailable();
320896
321210
  const serviceName = cmd.service || DEFAULT_SERVICE_NAME;
320897
321211
  return new Promise((resolve2) => {
320898
- (0, import_child_process4.spawn)(
321212
+ (0, import_child_process5.spawn)(
320899
321213
  "journalctl",
320900
321214
  ["--user", "-u", `${serviceName}.service`, "-f", "-n", cmd.lines || "50"],
320901
321215
  { stdio: "inherit" }
@@ -322281,11 +322595,11 @@ var init_approvals = __esm({
322281
322595
  }
322282
322596
  };
322283
322597
  ApprovalGate = class {
322284
- constructor(policy, backend, prompt, log, timeoutMs = APPROVAL_TIMEOUT_MS) {
322598
+ constructor(policy, backend, prompt, log2, timeoutMs = APPROVAL_TIMEOUT_MS) {
322285
322599
  this.policy = policy;
322286
322600
  this.backend = backend;
322287
322601
  this.prompt = prompt;
322288
- this.log = log;
322602
+ this.log = log2;
322289
322603
  this.timeoutMs = timeoutMs;
322290
322604
  this.waiting = /* @__PURE__ */ new Map();
322291
322605
  // A web answer that arrived before the card's id was back here.
@@ -322412,15 +322726,15 @@ var init_config2 = __esm({
322412
322726
  });
322413
322727
 
322414
322728
  // src/commands/workspace/files.ts
322415
- var import_child_process5, import_crypto2, import_fs9, import_path5, import_util12, run, WorkspaceError, MAX_READ_BYTES, MAX_WRITE_BYTES, DEFAULT_LIST_LIMIT, MAX_LIST_LIMIT, DEFAULT_SEARCH_RESULTS, MAX_SEARCH_RESULTS, MAX_MATCH_TEXT, SKIP_DIRS, SECRET_FILE, SECRET_TEMPLATE, isSecretFile, contentHash, toPosix, WorkspaceFiles;
322729
+ var import_child_process6, import_crypto2, import_fs11, import_path6, import_util12, run, WorkspaceError, MAX_READ_BYTES, MAX_WRITE_BYTES, DEFAULT_LIST_LIMIT, MAX_LIST_LIMIT, DEFAULT_SEARCH_RESULTS, MAX_SEARCH_RESULTS, MAX_MATCH_TEXT, SKIP_DIRS, SECRET_FILE, SECRET_TEMPLATE, isSecretFile, contentHash, toPosix, WorkspaceFiles;
322416
322730
  var init_files = __esm({
322417
322731
  "src/commands/workspace/files.ts"() {
322418
- import_child_process5 = require("child_process");
322732
+ import_child_process6 = require("child_process");
322419
322733
  import_crypto2 = require("crypto");
322420
- import_fs9 = require("fs");
322421
- import_path5 = require("path");
322734
+ import_fs11 = require("fs");
322735
+ import_path6 = require("path");
322422
322736
  import_util12 = require("util");
322423
- run = (0, import_util12.promisify)(import_child_process5.execFile);
322737
+ run = (0, import_util12.promisify)(import_child_process6.execFile);
322424
322738
  WorkspaceError = class extends Error {
322425
322739
  constructor(message, status2 = 400) {
322426
322740
  super(message);
@@ -322438,11 +322752,11 @@ var init_files = __esm({
322438
322752
  SECRET_FILE = /^(\.env(\..+)?|.*\.(pem|key|p12|pfx|keystore|jks)|id_(rsa|dsa|ecdsa|ed25519)(\.pub)?|\.npmrc|\.pypirc|\.netrc|credentials(\.json)?)$/i;
322439
322753
  SECRET_TEMPLATE = /\.(example|sample|template|dist|defaults)$/i;
322440
322754
  isSecretFile = (path2) => {
322441
- const name2 = (0, import_path5.basename)(path2);
322755
+ const name2 = (0, import_path6.basename)(path2);
322442
322756
  return SECRET_FILE.test(name2) && !SECRET_TEMPLATE.test(name2);
322443
322757
  };
322444
322758
  contentHash = (content) => (0, import_crypto2.createHash)("sha256").update(content).digest("hex").slice(0, 16);
322445
- toPosix = (p) => p.split(import_path5.sep).join("/");
322759
+ toPosix = (p) => p.split(import_path6.sep).join("/");
322446
322760
  WorkspaceFiles = class {
322447
322761
  constructor(root, options = {}) {
322448
322762
  this.root = root;
@@ -322451,9 +322765,9 @@ var init_files = __esm({
322451
322765
  /** Absolute path for a workspace-relative one, or a WorkspaceError. */
322452
322766
  async resolvePath(input, { forWrite = false } = {}) {
322453
322767
  const rel = (input ?? ".").trim() || ".";
322454
- const abs = (0, import_path5.resolve)(this.root, rel);
322455
- const fromRoot = (0, import_path5.relative)(this.root, abs);
322456
- if (fromRoot.startsWith("..") || (0, import_path5.isAbsolute)(fromRoot)) {
322768
+ const abs = (0, import_path6.resolve)(this.root, rel);
322769
+ const fromRoot = (0, import_path6.relative)(this.root, abs);
322770
+ if (fromRoot.startsWith("..") || (0, import_path6.isAbsolute)(fromRoot)) {
322457
322771
  throw new WorkspaceError(
322458
322772
  `${input} is outside the workspace root - paths are relative to ${this.root}`,
322459
322773
  403
@@ -322462,9 +322776,9 @@ var init_files = __esm({
322462
322776
  let existing = abs;
322463
322777
  for (; ; ) {
322464
322778
  try {
322465
- const real = await import_fs9.promises.realpath(existing);
322466
- const realFromRoot = (0, import_path5.relative)(this.root, real);
322467
- if (realFromRoot.startsWith("..") || (0, import_path5.isAbsolute)(realFromRoot)) {
322779
+ const real = await import_fs11.promises.realpath(existing);
322780
+ const realFromRoot = (0, import_path6.relative)(this.root, real);
322781
+ if (realFromRoot.startsWith("..") || (0, import_path6.isAbsolute)(realFromRoot)) {
322468
322782
  throw new WorkspaceError(
322469
322783
  `${input} resolves outside the workspace root (symlink)`,
322470
322784
  403
@@ -322473,7 +322787,7 @@ var init_files = __esm({
322473
322787
  break;
322474
322788
  } catch (e2) {
322475
322789
  if (e2 instanceof WorkspaceError) throw e2;
322476
- const parent = (0, import_path5.dirname)(existing);
322790
+ const parent = (0, import_path6.dirname)(existing);
322477
322791
  if (parent === existing) break;
322478
322792
  existing = parent;
322479
322793
  }
@@ -322521,7 +322835,7 @@ var init_files = __esm({
322521
322835
  const out = [];
322522
322836
  const walk = async (relDir) => {
322523
322837
  if (out.length > limit) return;
322524
- const entries = await import_fs9.promises.readdir((0, import_path5.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
322838
+ const entries = await import_fs11.promises.readdir((0, import_path6.join)(this.root, relDir), { withFileTypes: true }).catch(() => []);
322525
322839
  for (const entry of entries) {
322526
322840
  if (SKIP_DIRS.has(entry.name)) continue;
322527
322841
  const rel = relDir === "." ? entry.name : `${relDir}/${entry.name}`;
@@ -322564,7 +322878,7 @@ var init_files = __esm({
322564
322878
  entries = entries.slice(0, limit);
322565
322879
  await Promise.all(
322566
322880
  entries.filter((e2) => e2.type === "file").map(async (e2) => {
322567
- e2.size = await import_fs9.promises.stat((0, import_path5.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
322881
+ e2.size = await import_fs11.promises.stat((0, import_path6.join)(this.root, e2.path)).then((s2) => s2.size).catch(() => void 0);
322568
322882
  })
322569
322883
  );
322570
322884
  return {
@@ -322575,12 +322889,12 @@ var init_files = __esm({
322575
322889
  async read(args) {
322576
322890
  if (!args.path) throw new WorkspaceError("path is required");
322577
322891
  const { abs, rel } = await this.resolvePath(args.path);
322578
- const stat2 = await import_fs9.promises.stat(abs).catch(() => null);
322892
+ const stat2 = await import_fs11.promises.stat(abs).catch(() => null);
322579
322893
  if (!stat2) throw new WorkspaceError(`${rel} does not exist`, 404);
322580
322894
  if (stat2.isDirectory()) {
322581
322895
  throw new WorkspaceError(`${rel} is a directory - use LocalListFiles`);
322582
322896
  }
322583
- const buffer = await import_fs9.promises.readFile(abs);
322897
+ const buffer = await import_fs11.promises.readFile(abs);
322584
322898
  if (buffer.subarray(0, 8e3).includes(0)) {
322585
322899
  return { path: rel, size: stat2.size, binary: true, content: "" };
322586
322900
  }
@@ -322609,7 +322923,7 @@ var init_files = __esm({
322609
322923
  };
322610
322924
  }
322611
322925
  async currentText(abs) {
322612
- return import_fs9.promises.readFile(abs, "utf-8").catch((e2) => {
322926
+ return import_fs11.promises.readFile(abs, "utf-8").catch((e2) => {
322613
322927
  if (e2?.code === "ENOENT") return null;
322614
322928
  throw e2;
322615
322929
  });
@@ -322630,8 +322944,8 @@ var init_files = __esm({
322630
322944
  );
322631
322945
  }
322632
322946
  }
322633
- await import_fs9.promises.mkdir((0, import_path5.dirname)(abs), { recursive: true });
322634
- await import_fs9.promises.writeFile(abs, content, "utf-8");
322947
+ await import_fs11.promises.mkdir((0, import_path6.dirname)(abs), { recursive: true });
322948
+ await import_fs11.promises.writeFile(abs, content, "utf-8");
322635
322949
  return {
322636
322950
  path: rel,
322637
322951
  size: Buffer.byteLength(content),
@@ -322663,7 +322977,7 @@ var init_files = __esm({
322663
322977
  );
322664
322978
  }
322665
322979
  const after = args.replaceAll ? before.split(args.oldText).join(args.newText ?? "") : before.replace(args.oldText, () => args.newText ?? "");
322666
- await import_fs9.promises.writeFile(abs, after, "utf-8");
322980
+ await import_fs11.promises.writeFile(abs, after, "utf-8");
322667
322981
  return {
322668
322982
  path: rel,
322669
322983
  replacements: args.replaceAll ? count : 1,
@@ -322674,14 +322988,14 @@ var init_files = __esm({
322674
322988
  async delete(args) {
322675
322989
  if (!args.path) throw new WorkspaceError("path is required");
322676
322990
  const { abs, rel } = await this.resolvePath(args.path, { forWrite: true });
322677
- const stat2 = await import_fs9.promises.lstat(abs).catch(() => null);
322991
+ const stat2 = await import_fs11.promises.lstat(abs).catch(() => null);
322678
322992
  if (!stat2) return { path: rel, deleted: false };
322679
322993
  if (stat2.isDirectory()) {
322680
322994
  throw new WorkspaceError(
322681
322995
  `${rel} is a directory - only files can be deleted (use RunCommand for more)`
322682
322996
  );
322683
322997
  }
322684
- await import_fs9.promises.unlink(abs);
322998
+ await import_fs11.promises.unlink(abs);
322685
322999
  return { path: rel, deleted: true };
322686
323000
  }
322687
323001
  async search(args) {
@@ -322733,7 +323047,7 @@ var init_files = __esm({
322733
323047
  raw = [];
322734
323048
  for (const file2 of await this.allFiles(rel, 2e4)) {
322735
323049
  if (globRe && !globRe.test(file2)) continue;
322736
- const text = await import_fs9.promises.readFile((0, import_path5.join)(this.root, file2)).catch(() => null);
323050
+ const text = await import_fs11.promises.readFile((0, import_path6.join)(this.root, file2)).catch(() => null);
322737
323051
  if (!text || text.subarray(0, 8e3).includes(0)) continue;
322738
323052
  text.toString("utf-8").split("\n").forEach((line, i2) => {
322739
323053
  if (raw.length <= max && re.test(line)) {
@@ -322754,10 +323068,10 @@ var init_files = __esm({
322754
323068
  });
322755
323069
 
322756
323070
  // src/commands/workspace/processes.ts
322757
- var import_child_process6, DEFAULT_TIMEOUT_S, MAX_TIMEOUT_S, MAX_STREAM_CHARS, MAX_PROCESS_LINES, MAX_PROCESSES, DEFAULT_WAIT_S, MAX_WAIT_S, KILL_GRACE_MS, ANSI, stripAnsi, BASE_ENV, buildEnv, shellOf, killTree, terminate, TailBuffer, runCommand, ProcessManager;
323071
+ var import_child_process7, DEFAULT_TIMEOUT_S, MAX_TIMEOUT_S, MAX_STREAM_CHARS, MAX_PROCESS_LINES, MAX_PROCESSES, DEFAULT_WAIT_S, MAX_WAIT_S, KILL_GRACE_MS, ANSI, stripAnsi, BASE_ENV, buildEnv, shellOf, killTree, terminate, TailBuffer, runCommand, ProcessManager;
322758
323072
  var init_processes = __esm({
322759
323073
  "src/commands/workspace/processes.ts"() {
322760
- import_child_process6 = require("child_process");
323074
+ import_child_process7 = require("child_process");
322761
323075
  init_files();
322762
323076
  DEFAULT_TIMEOUT_S = 300;
322763
323077
  MAX_TIMEOUT_S = 1800;
@@ -322840,7 +323154,7 @@ var init_processes = __esm({
322840
323154
  if (!child.pid || child.exitCode !== null) return;
322841
323155
  try {
322842
323156
  if (process.platform === "win32") {
322843
- (0, import_child_process6.spawn)("taskkill", ["/pid", String(child.pid), "/T", "/F"]);
323157
+ (0, import_child_process7.spawn)("taskkill", ["/pid", String(child.pid), "/T", "/F"]);
322844
323158
  } else {
322845
323159
  process.kill(-child.pid, signal);
322846
323160
  }
@@ -322882,7 +323196,7 @@ ${this.text}` : this.text;
322882
323196
  );
322883
323197
  const started = Date.now();
322884
323198
  const [shell, shellArgs] = shellOf(args.command);
322885
- const child = (0, import_child_process6.spawn)(shell, shellArgs, {
323199
+ const child = (0, import_child_process7.spawn)(shell, shellArgs, {
322886
323200
  cwd: args.cwd,
322887
323201
  env: args.env,
322888
323202
  stdio: ["ignore", "pipe", "pipe"],
@@ -322972,7 +323286,7 @@ ${this.text}` : this.text;
322972
323286
  }
322973
323287
  }
322974
323288
  const [shell, shellArgs] = shellOf(args.command);
322975
- const child = (0, import_child_process6.spawn)(shell, shellArgs, {
323289
+ const child = (0, import_child_process7.spawn)(shell, shellArgs, {
322976
323290
  cwd: args.cwd,
322977
323291
  env: args.env,
322978
323292
  stdio: ["ignore", "pipe", "pipe"],
@@ -323128,10 +323442,10 @@ ${this.text}` : this.text;
323128
323442
  });
323129
323443
 
323130
323444
  // src/commands/workspace/connection.ts
323131
- var import_os6, WORKSPACE_PATH_PREFIX, WORKSPACE_OPS, HEARTBEAT_MUTATION2, REQUEST_APPROVAL_MUTATION, SETTLE_APPROVAL_MUTATION, str, num, short, WorkspaceConnection;
323445
+ var import_os7, WORKSPACE_PATH_PREFIX, WORKSPACE_OPS, HEARTBEAT_MUTATION2, REQUEST_APPROVAL_MUTATION, SETTLE_APPROVAL_MUTATION, str, num, short, WorkspaceConnection;
323132
323446
  var init_connection2 = __esm({
323133
323447
  "src/commands/workspace/connection.ts"() {
323134
- import_os6 = require("os");
323448
+ import_os7 = require("os");
323135
323449
  init_tunnel();
323136
323450
  init_approvals();
323137
323451
  init_files();
@@ -323214,7 +323528,7 @@ var init_connection2 = __esm({
323214
323528
  const data = await this.operation(HEARTBEAT_MUTATION2, {
323215
323529
  info: {
323216
323530
  root: this.options.root,
323217
- hostname: (0, import_os6.hostname)(),
323531
+ hostname: (0, import_os7.hostname)(),
323218
323532
  platform: process.platform,
323219
323533
  gitBranch: await this.files.gitBranch(),
323220
323534
  clientVersion: this.options.version,
@@ -323278,7 +323592,7 @@ var init_connection2 = __esm({
323278
323592
  }
323279
323593
  /** One operation (exposed for tests). */
323280
323594
  async dispatch(op, args, signal) {
323281
- const log = (line) => this.options.logger.info(line);
323595
+ const log2 = (line) => this.options.logger.info(line);
323282
323596
  switch (op) {
323283
323597
  case "info":
323284
323598
  return {
@@ -323291,21 +323605,21 @@ var init_connection2 = __esm({
323291
323605
  processes: this.processes.list()
323292
323606
  };
323293
323607
  case "list":
323294
- log(`-> list ${str(args.path) ?? "."}`);
323608
+ log2(`-> list ${str(args.path) ?? "."}`);
323295
323609
  return this.files.list({
323296
323610
  path: str(args.path),
323297
323611
  recursive: args.recursive !== false,
323298
323612
  limit: num(args.limit)
323299
323613
  });
323300
323614
  case "read":
323301
- log(`-> read ${str(args.path)}`);
323615
+ log2(`-> read ${str(args.path)}`);
323302
323616
  return this.files.read({
323303
323617
  path: str(args.path),
323304
323618
  startLine: num(args.startLine),
323305
323619
  endLine: num(args.endLine)
323306
323620
  });
323307
323621
  case "search":
323308
- log(`-> search /${str(args.pattern)}/ in ${str(args.path) ?? "."}`);
323622
+ log2(`-> search /${str(args.pattern)}/ in ${str(args.path) ?? "."}`);
323309
323623
  return this.files.search({
323310
323624
  pattern: str(args.pattern),
323311
323625
  path: str(args.path),
@@ -323320,7 +323634,7 @@ var init_connection2 = __esm({
323320
323634
  content: str(args.content) ?? "",
323321
323635
  expectedHash: str(args.expectedHash)
323322
323636
  });
323323
- log(`\u270E ${result.created ? "created" : "wrote"} ${result.path}`);
323637
+ log2(`\u270E ${result.created ? "created" : "wrote"} ${result.path}`);
323324
323638
  return result;
323325
323639
  }
323326
323640
  case "edit": {
@@ -323331,12 +323645,12 @@ var init_connection2 = __esm({
323331
323645
  replaceAll: args.replaceAll === true,
323332
323646
  expectedHash: str(args.expectedHash)
323333
323647
  });
323334
- log(`\u270E edited ${result.path} (${result.replacements}x)`);
323648
+ log2(`\u270E edited ${result.path} (${result.replacements}x)`);
323335
323649
  return result;
323336
323650
  }
323337
323651
  case "delete": {
323338
323652
  const result = await this.files.delete({ path: str(args.path) });
323339
- if (result.deleted) log(`\u270E deleted ${result.path}`);
323653
+ if (result.deleted) log2(`\u270E deleted ${result.path}`);
323340
323654
  return result;
323341
323655
  }
323342
323656
  case "exec":
@@ -323355,7 +323669,7 @@ var init_connection2 = __esm({
323355
323669
  const result = await this.processes.stop({
323356
323670
  processId: str(args.processId)
323357
323671
  });
323358
- log(`\u25A0 stopped ${result.processId}`);
323672
+ log2(`\u25A0 stopped ${result.processId}`);
323359
323673
  return result;
323360
323674
  }
323361
323675
  default:
@@ -323526,11 +323840,11 @@ __export(start_exports4, {
323526
323840
  WORKSPACE_VERSION: () => WORKSPACE_VERSION,
323527
323841
  default: () => start_default2
323528
323842
  });
323529
- var import_promises12, import_path6, import_rxjs66, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
323843
+ var import_promises12, import_path7, import_rxjs66, WORKSPACE_VERSION, csv, resolveWorkspace, start_default2;
323530
323844
  var init_start4 = __esm({
323531
323845
  "src/commands/workspace/start.ts"() {
323532
323846
  import_promises12 = require("fs/promises");
323533
- import_path6 = require("path");
323847
+ import_path7 = require("path");
323534
323848
  import_rxjs66 = __toESM(require_cjs());
323535
323849
  init_helpers();
323536
323850
  init_gql_client();
@@ -323548,7 +323862,7 @@ var init_start4 = __esm({
323548
323862
  if (cmd.token) {
323549
323863
  return {
323550
323864
  id: "(from --token)",
323551
- name: cmd.name ?? (0, import_path6.basename)(root),
323865
+ name: cmd.name ?? (0, import_path7.basename)(root),
323552
323866
  token: cmd.token,
323553
323867
  projectId: cmd.project ?? "",
323554
323868
  root
@@ -323568,7 +323882,7 @@ var init_start4 = __esm({
323568
323882
  );
323569
323883
  }
323570
323884
  );
323571
- const name2 = cmd.name || (0, import_path6.basename)(root);
323885
+ const name2 = cmd.name || (0, import_path7.basename)(root);
323572
323886
  Logger.info(`Registering ${root} as local workspace "${name2}"...`);
323573
323887
  const { workspace, token } = await (0, import_rxjs66.lastValueFrom)(
323574
323888
  GraphqlClienAPI.createLocalWorkspace(projectId, name2)
@@ -323745,7 +324059,9 @@ init_src();
323745
324059
  // src/commands/auth/index.ts
323746
324060
  init_helpers();
323747
324061
  function registerAuthCommands(program2) {
323748
- program2.command("login").description("Login to graphql-server").option("-k, --key <key>", "Specify api key").option("-uu, --uploadUrl <key>", "Specify upload server").option("-ci, --ci", "Initialize directories for CI/CD purposes").option(
324062
+ program2.command("login").description(
324063
+ "Log in. Without --token: prints a link, opens your browser and waits for you to approve it on lambforge.com"
324064
+ ).option("--no-browser", "Only print the login link, do not open a browser").option("-k, --key <key>", "Specify api key").option("-uu, --uploadUrl <key>", "Specify upload server").option("-ci, --ci", "Initialize directories for CI/CD purposes").option(
323749
324065
  "-t, --token <token>",
323750
324066
  "Specify custom token generated from the website"
323751
324067
  ).option("-u, --url <url>", "Specify api url").action(lazy(() => Promise.resolve().then(() => (init_login(), login_exports)).then((m2) => m2.default)));
@@ -323756,8 +324072,20 @@ init_helpers();
323756
324072
  function buildCommands(program2) {
323757
324073
  program2.command("build").description("Build bundle using esbuild https://esbuild.github.io ").option(
323758
324074
  "-f, --files <files...>",
323759
- "File or files to bundle defaults to index.ts"
323760
- ).option("-b, --bundle", "Bundle code", true).option("-m, --minify", "Minify code", false).option("-p, --platform <char>", "Platform ", "node").option("-t, --target <char>", "Target ", "node14.4").option("-o, --outfile <char>", "Outfile name").option("-e, --external <external...>", "External libraries").action(lazy(() => Promise.resolve().then(() => (init_build(), build_exports)).then((m2) => m2.default)));
324075
+ "File or files to bundle (default: function.file from lambforge.yaml, else index.ts)"
324076
+ ).option(
324077
+ "-b, --bundle",
324078
+ "Bundle code (default: options.bundler.bundle, else true)"
324079
+ ).option(
324080
+ "-m, --minify",
324081
+ "Minify code (default: options.bundler.minify, else false)"
324082
+ ).option("-p, --platform <char>", "Platform ", "node").option(
324083
+ "-t, --target <char>",
324084
+ "Target (default: options.bundler.target, else node24)"
324085
+ ).option(
324086
+ "-o, --outfile <char>",
324087
+ "Outfile name (default: options.bundler.outfile, else index.js)"
324088
+ ).option("-e, --external <external...>", "External libraries").action(lazy(() => Promise.resolve().then(() => (init_build(), build_exports)).then((m2) => m2.default)));
323761
324089
  }
323762
324090
 
323763
324091
  // src/commands/cluster/index.ts
@@ -323869,7 +324197,13 @@ function registerClusterCommands(program2) {
323869
324197
  program2.command("cluster:autoscale").description(
323870
324198
  "Change the worker autoscaling policy - only the flags you pass change"
323871
324199
  )
323872
- ).option("--enable", "Turn autoscaling on (multi-node clusters only)").option("--disable", "Turn autoscaling off").option("--min <min>", "Minimum workers (1-10)").option("--max <max>", "Maximum workers (1-10)").option("--cpuUp <percent>", "Scale up at this CPU % (1-100)").option("--memUp <percent>", "Scale up at this memory % (1-100)").option("--cpuDown <percent>", "Scale down below this CPU % (1-100)").option("--memDown <percent>", "Scale down below this memory % (1-100)").option("--samples <n>", "Consecutive readings before acting (1-20)").option("--cooldown <minutes>", "Minutes between scale actions (1-1440)").action(lazy(() => Promise.resolve().then(() => (init_autoscale(), autoscale_exports)).then((m2) => m2.default)));
324200
+ ).option("--enable", "Turn autoscaling on (multi-node clusters only)").option("--disable", "Turn autoscaling off").option("--min <min>", "Minimum workers (1-10)").option("--max <max>", "Maximum workers (1-10)").option("--cpuUp <percent>", "Scale up at this CPU % (1-100)").option("--memUp <percent>", "Scale up at this memory % (1-100)").option("--cpuDown <percent>", "Scale down below this CPU % (1-100)").option("--memDown <percent>", "Scale down below this memory % (1-100)").option("--samples <n>", "Consecutive readings before acting (1-20)").option("--cooldown <minutes>", "Minutes between scale actions (1-1440)").option(
324201
+ "--profile <profile>",
324202
+ "conservative | balanced | aggressive presets the thresholds above; custom uses them as given"
324203
+ ).option(
324204
+ "--serverTypes <types>",
324205
+ `Comma-separated worker server types in order of preference, e.g. cx33,cpx22 (the next is used when one is out of stock); "" = the cluster's own type`
324206
+ ).option("--step <n>", "Workers added per scale-up (1-3, custom profile)").action(lazy(() => Promise.resolve().then(() => (init_autoscale(), autoscale_exports)).then((m2) => m2.default)));
323873
324207
  target(
323874
324208
  program2.command("cluster:multi-node").description(
323875
324209
  "Convert a single-node cluster to dedicated worker nodes (required for autoscaling)"