@gapi/gcli 1.8.254 → 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"));
@@ -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",
@@ -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);
@@ -255090,9 +255203,10 @@ var init_cluster_change = __esm({
255090
255203
  });
255091
255204
 
255092
255205
  // src/commands/cluster/helpers/plan.ts
255093
- var AUTOSCALE_BOUNDS, VIRTUAL_UNSUPPORTED, intIn, validateDesired, planClusterChanges;
255206
+ var AUTOSCALE_BOUNDS, SERVER_TYPE_NAME, VIRTUAL_UNSUPPORTED, intIn, validateDesired, planClusterChanges;
255094
255207
  var init_plan = __esm({
255095
255208
  "src/commands/cluster/helpers/plan.ts"() {
255209
+ init_types2();
255096
255210
  AUTOSCALE_BOUNDS = {
255097
255211
  minWorkers: [1, 10],
255098
255212
  maxWorkers: [1, 10],
@@ -255101,8 +255215,10 @@ var init_plan = __esm({
255101
255215
  cpuScaleDownPercent: [1, 100],
255102
255216
  memScaleDownPercent: [1, 100],
255103
255217
  samplesToScale: [1, 20],
255104
- cooldownMinutes: [1, 1440]
255218
+ cooldownMinutes: [1, 1440],
255219
+ scaleUpStep: [1, 3]
255105
255220
  };
255221
+ SERVER_TYPE_NAME = /^[a-z]+[0-9]+[a-z]*$/;
255106
255222
  VIRTUAL_UNSUPPORTED = [
255107
255223
  "imageId",
255108
255224
  "serverType",
@@ -255143,6 +255259,22 @@ var init_plan = __esm({
255143
255259
  }
255144
255260
  continue;
255145
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
+ }
255146
255278
  const bounds = AUTOSCALE_BOUNDS[key];
255147
255279
  if (!bounds) {
255148
255280
  errors.push(`cluster.autoscale.${key} is not a known setting`);
@@ -255262,8 +255394,9 @@ var init_plan = __esm({
255262
255394
  if (desired.autoscale) {
255263
255395
  const now = current.autoscale ?? {};
255264
255396
  const changed = {};
255397
+ const same = (a, b) => Array.isArray(a) || Array.isArray(b) ? JSON.stringify(a ?? []) === JSON.stringify(b ?? []) : a === b;
255265
255398
  for (const [key, value] of Object.entries(desired.autoscale)) {
255266
- if (now[key] !== value) {
255399
+ if (!same(now[key], value)) {
255267
255400
  changed[key] = value;
255268
255401
  }
255269
255402
  }
@@ -255271,7 +255404,7 @@ var init_plan = __esm({
255271
255404
  steps.push({
255272
255405
  kind: "autoscale",
255273
255406
  input: changed,
255274
- 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(", ")}`
255275
255408
  });
255276
255409
  }
255277
255410
  }
@@ -255692,12 +255825,12 @@ var init_attach = __esm({
255692
255825
  });
255693
255826
 
255694
255827
  // src/commands/cluster/helpers/talosctl.ts
255695
- function talosctlAssetName(platform = process.platform, arch = process.arch) {
255696
- 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;
255697
255830
  const cpu = arch === "x64" ? "amd64" : arch === "arm64" ? "arm64" : null;
255698
255831
  if (!os2 || !cpu) {
255699
255832
  throw new Error(
255700
- `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/`
255701
255834
  );
255702
255835
  }
255703
255836
  return `talosctl-${os2}-${cpu}${os2 === "windows" ? ".exe" : ""}`;
@@ -255762,10 +255895,10 @@ async function ensureTalosctl(version2) {
255762
255895
  Logger.info(`talosctl ${version2} saved to ${binary}`);
255763
255896
  return binary;
255764
255897
  }
255765
- var import_child_process, import_crypto, import_fs4, import_promises, import_path2, RELEASES, VERSION_RE, clientVersionOf, runBinary;
255898
+ var import_child_process2, import_crypto, import_fs4, import_promises, import_path2, RELEASES, VERSION_RE, clientVersionOf, runBinary;
255766
255899
  var init_talosctl = __esm({
255767
255900
  "src/commands/cluster/helpers/talosctl.ts"() {
255768
- import_child_process = require("child_process");
255901
+ import_child_process2 = require("child_process");
255769
255902
  import_crypto = require("crypto");
255770
255903
  import_fs4 = require("fs");
255771
255904
  import_promises = require("fs/promises");
@@ -255776,7 +255909,7 @@ var init_talosctl = __esm({
255776
255909
  VERSION_RE = /^v\d+\.\d+\.\d+$/;
255777
255910
  clientVersionOf = (output) => output.match(/Talos (v\d+\.\d+\.\d+\S*)/)?.[1] ?? null;
255778
255911
  runBinary = (binary, args, timeoutMs = 2e4) => new Promise(
255779
- (resolve2) => (0, import_child_process.execFile)(
255912
+ (resolve2) => (0, import_child_process2.execFile)(
255780
255913
  binary,
255781
255914
  args,
255782
255915
  { timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024 },
@@ -255795,11 +255928,11 @@ var attach_exports = {};
255795
255928
  __export(attach_exports, {
255796
255929
  default: () => attach_default
255797
255930
  });
255798
- var import_promises2, import_os2, import_path3, import_readline, import_rxjs17, sleep, ask, attach_default;
255931
+ var import_promises2, import_os3, import_path3, import_readline, import_rxjs17, sleep2, ask, attach_default;
255799
255932
  var init_attach2 = __esm({
255800
255933
  "src/commands/cluster/attach.ts"() {
255801
255934
  import_promises2 = require("fs/promises");
255802
- import_os2 = require("os");
255935
+ import_os3 = require("os");
255803
255936
  import_path3 = require("path");
255804
255937
  import_readline = require("readline");
255805
255938
  import_rxjs17 = __toESM(require_cjs());
@@ -255808,7 +255941,7 @@ var init_attach2 = __esm({
255808
255941
  init_attach();
255809
255942
  init_cluster_change();
255810
255943
  init_talosctl();
255811
- sleep = (ms) => new Promise((r2) => setTimeout(r2, ms));
255944
+ sleep2 = (ms) => new Promise((r2) => setTimeout(r2, ms));
255812
255945
  ask = (question) => new Promise((resolve2) => {
255813
255946
  const rl = (0, import_readline.createInterface)({
255814
255947
  input: process.stdin,
@@ -255850,7 +255983,7 @@ var init_attach2 = __esm({
255850
255983
  "yaml"
255851
255984
  ]);
255852
255985
  version2 = probe.code === 0 ? serverTalosVersion(probe.stdout) : void 0;
255853
- if (!version2) await sleep(5e3);
255986
+ if (!version2) await sleep2(5e3);
255854
255987
  }
255855
255988
  if (!version2) {
255856
255989
  throw new Error(
@@ -255894,7 +256027,7 @@ var init_attach2 = __esm({
255894
256027
  `The cluster runs Talos ${join_.talosVersion}, the machine booted ${version2}. It installs ${join_.talosVersion} anyway; if the join fails, boot ${join_.isoUrl}.`
255895
256028
  );
255896
256029
  }
255897
- const dir = await (0, import_promises2.mkdtemp)((0, import_path3.join)((0, import_os2.tmpdir)(), "gcli-attach-"));
256030
+ const dir = await (0, import_promises2.mkdtemp)((0, import_path3.join)((0, import_os3.tmpdir)(), "gcli-attach-"));
255898
256031
  const file2 = (0, import_path3.join)(dir, "machine.yaml");
255899
256032
  try {
255900
256033
  await (0, import_promises2.writeFile)(file2, join_.config, { mode: 384 });
@@ -255922,7 +256055,7 @@ var init_attach2 = __esm({
255922
256055
  );
255923
256056
  const deadline = Date.now() + opts.timeoutMs;
255924
256057
  while (Date.now() < deadline) {
255925
- await sleep(15e3);
256058
+ await sleep2(15e3);
255926
256059
  const nodes = await (0, import_rxjs17.lastValueFrom)(GraphqlClienAPI.clusterNodes(clusterId));
255927
256060
  const node = nodes.find((n) => n.name === opts.name);
255928
256061
  if (node?.status === "ready") {
@@ -256007,11 +256140,11 @@ __export(reset_machine_exports, {
256007
256140
  default: () => reset_machine_default,
256008
256141
  hostnameOf: () => hostnameOf
256009
256142
  });
256010
- var import_promises3, import_os3, import_path4, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
256143
+ var import_promises3, import_os4, import_path4, import_readline2, import_rxjs20, hostnameOf, reset_machine_default;
256011
256144
  var init_reset_machine = __esm({
256012
256145
  "src/commands/cluster/reset-machine.ts"() {
256013
256146
  import_promises3 = require("fs/promises");
256014
- import_os3 = require("os");
256147
+ import_os4 = require("os");
256015
256148
  import_path4 = require("path");
256016
256149
  import_readline2 = require("readline");
256017
256150
  import_rxjs20 = __toESM(require_cjs());
@@ -256050,7 +256183,7 @@ var init_reset_machine = __esm({
256050
256183
  GraphqlClienAPI.clusterTalosconfig(clusterId, 15)
256051
256184
  );
256052
256185
  const binary = access.talosVersion ? await ensureTalosctl(access.talosVersion) : "talosctl";
256053
- const dir = await (0, import_promises3.mkdtemp)((0, import_path4.join)((0, import_os3.tmpdir)(), "gcli-reset-"));
256186
+ const dir = await (0, import_promises3.mkdtemp)((0, import_path4.join)((0, import_os4.tmpdir)(), "gcli-reset-"));
256054
256187
  const config2 = (0, import_path4.join)(dir, "talosconfig");
256055
256188
  try {
256056
256189
  await (0, import_promises3.writeFile)(config2, access.talosconfig, { mode: 384 });
@@ -256412,6 +256545,7 @@ var init_autoscale = __esm({
256412
256545
  init_gql_client();
256413
256546
  init_log();
256414
256547
  init_cluster_change();
256548
+ init_types2();
256415
256549
  toAutoscaleInput = (cmd) => {
256416
256550
  if (cmd.enable && cmd.disable) {
256417
256551
  throw new Error("Pass --enable or --disable, not both");
@@ -256427,7 +256561,8 @@ var init_autoscale = __esm({
256427
256561
  ["cpuDown", "cpuScaleDownPercent", 1, 100],
256428
256562
  ["memDown", "memScaleDownPercent", 1, 100],
256429
256563
  ["samples", "samplesToScale", 1, 20],
256430
- ["cooldown", "cooldownMinutes", 1, 1440]
256564
+ ["cooldown", "cooldownMinutes", 1, 1440],
256565
+ ["step", "scaleUpStep", 1, 3]
256431
256566
  ];
256432
256567
  for (const [flag, field, min, max] of ints) {
256433
256568
  if (cmd[flag] !== void 0) {
@@ -256439,9 +256574,20 @@ var init_autoscale = __esm({
256439
256574
  );
256440
256575
  }
256441
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
+ }
256442
256588
  if (!Object.keys(input).length) {
256443
256589
  throw new Error(
256444
- "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)"
256445
256591
  );
256446
256592
  }
256447
256593
  return input;
@@ -256460,6 +256606,9 @@ var init_autoscale = __esm({
256460
256606
  cluster: cluster.name,
256461
256607
  workers: cluster.topology?.workers,
256462
256608
  enabled: a.enabled,
256609
+ profile: a.scalingProfile,
256610
+ workerTypes: a.serverTypes?.length ? a.serverTypes.join(",") : "(cluster type)",
256611
+ step: a.scaleUpStep,
256463
256612
  minWorkers: a.minWorkers,
256464
256613
  maxWorkers: a.maxWorkers,
256465
256614
  scaleUpAt: `cpu ${a.cpuScaleUpPercent}% / mem ${a.memScaleUpPercent}%`,
@@ -269338,7 +269487,7 @@ var require_async3 = __commonJS({
269338
269487
  function groupBySeries(coll, iteratee, callback) {
269339
269488
  return groupByLimit$1(coll, 1, iteratee, callback);
269340
269489
  }
269341
- var log = consoleFunc("log");
269490
+ var log2 = consoleFunc("log");
269342
269491
  function mapValuesLimit(obj, limit, iteratee, callback) {
269343
269492
  callback = once(callback);
269344
269493
  var newObj = {};
@@ -269866,7 +270015,7 @@ var require_async3 = __commonJS({
269866
270015
  groupBy,
269867
270016
  groupByLimit: groupByLimit$1,
269868
270017
  groupBySeries,
269869
- log,
270018
+ log: log2,
269870
270019
  map: map$1,
269871
270020
  mapLimit: mapLimit$1,
269872
270021
  mapSeries: mapSeries$1,
@@ -269972,7 +270121,7 @@ var require_async3 = __commonJS({
269972
270121
  exports3.groupBy = groupBy;
269973
270122
  exports3.groupByLimit = groupByLimit$1;
269974
270123
  exports3.groupBySeries = groupBySeries;
269975
- exports3.log = log;
270124
+ exports3.log = log2;
269976
270125
  exports3.map = map$1;
269977
270126
  exports3.mapLimit = mapLimit$1;
269978
270127
  exports3.mapSeries = mapSeries$1;
@@ -270050,7 +270199,7 @@ var require_polyfills = __commonJS({
270050
270199
  var constants = require("constants");
270051
270200
  var origCwd = process.cwd;
270052
270201
  var cwd = null;
270053
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
270202
+ var platform2 = process.env.GRACEFUL_FS_PLATFORM || process.platform;
270054
270203
  process.cwd = function() {
270055
270204
  if (!cwd)
270056
270205
  cwd = origCwd.call(process);
@@ -270109,7 +270258,7 @@ var require_polyfills = __commonJS({
270109
270258
  fs3.lchownSync = function() {
270110
270259
  };
270111
270260
  }
270112
- if (platform === "win32") {
270261
+ if (platform2 === "win32") {
270113
270262
  fs3.rename = /* @__PURE__ */ (function(fs$rename) {
270114
270263
  return function(from16, to, cb) {
270115
270264
  var start3 = Date.now();
@@ -278982,8 +279131,8 @@ var require_zip_archive_entry = __commonJS({
278982
279131
  }
278983
279132
  this.name = name2;
278984
279133
  };
278985
- ZipArchiveEntry.prototype.setPlatform = function(platform) {
278986
- this.platform = platform;
279134
+ ZipArchiveEntry.prototype.setPlatform = function(platform2) {
279135
+ this.platform = platform2;
278987
279136
  };
278988
279137
  ZipArchiveEntry.prototype.setSize = function(size) {
278989
279138
  if (size < 0) {
@@ -288099,11 +288248,11 @@ var package_exports = {};
288099
288248
  __export(package_exports, {
288100
288249
  default: () => package_default
288101
288250
  });
288102
- var import_archiver, import_child_process2, import_fs5, 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;
288103
288252
  var init_package = __esm({
288104
288253
  "src/commands/lambda/package.ts"() {
288105
288254
  import_archiver = __toESM(require_archiver());
288106
- import_child_process2 = require("child_process");
288255
+ import_child_process3 = require("child_process");
288107
288256
  import_fs5 = require("fs");
288108
288257
  import_rxjs32 = __toESM(require_cjs());
288109
288258
  import_operators17 = __toESM(require_operators());
@@ -288122,7 +288271,7 @@ var init_package = __esm({
288122
288271
  zlib: { level: 9 }
288123
288272
  // Sets the compression level.
288124
288273
  });
288125
- 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(" "));
288126
288275
  const ignore = await (0, import_rxjs32.lastValueFrom)(
288127
288276
  ReadFile(".gignore").pipe(
288128
288277
  (0, import_operators17.map)((ignore2) => parseIgnoredFiles(ignore2))
@@ -288162,7 +288311,7 @@ function streamToBufferPromise(file2) {
288162
288311
  });
288163
288312
  });
288164
288313
  }
288165
- var import_form_data, import_fs6, 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;
288166
288315
  var init_helpers2 = __esm({
288167
288316
  "src/commands/lambda/helpers/index.ts"() {
288168
288317
  import_form_data = __toESM(require_form_data());
@@ -288279,9 +288428,20 @@ var init_helpers2 = __esm({
288279
288428
  }),
288280
288429
  (0, import_operators18.tap)((data) => {
288281
288430
  Logger.info(JSON.stringify(data, null, 2));
288282
- })
288431
+ }),
288432
+ (0, import_operators18.switchMap)((data) => printAddresses(data))
288283
288433
  )
288284
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
+ );
288285
288445
  createCommand = (command) => (options) => (program2) => {
288286
288446
  const cmd = program2.command(command);
288287
288447
  for (const option of options) {
@@ -293880,7 +294040,7 @@ __export(regexes_exports, {
293880
294040
  extendedDuration: () => extendedDuration,
293881
294041
  guid: () => guid,
293882
294042
  hex: () => hex,
293883
- hostname: () => hostname,
294043
+ hostname: () => hostname2,
293884
294044
  html5Email: () => html5Email,
293885
294045
  idnEmail: () => idnEmail,
293886
294046
  integer: () => integer,
@@ -293947,7 +294107,7 @@ function fixedBase64(bodyLength, padding) {
293947
294107
  function fixedBase64url(length) {
293948
294108
  return new RegExp(`^[A-Za-z0-9_-]{${length}}$`);
293949
294109
  }
293950
- 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;
293951
294111
  var init_regexes = __esm({
293952
294112
  "../../node_modules/zod/v4/core/regexes.js"() {
293953
294113
  init_util2();
@@ -293985,7 +294145,7 @@ var init_regexes = __esm({
293985
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])$/;
293986
294146
  base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
293987
294147
  base64url = /^[A-Za-z0-9_-]*$/;
293988
- 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])?)*\.?$/;
293989
294149
  domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
293990
294150
  e164 = /^\+[1-9]\d{6,14}$/;
293991
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])))`;
@@ -305332,7 +305492,7 @@ __export(schemas_exports3, {
305332
305492
  guid: () => guid2,
305333
305493
  hash: () => hash,
305334
305494
  hex: () => hex2,
305335
- hostname: () => hostname2,
305495
+ hostname: () => hostname3,
305336
305496
  httpUrl: () => httpUrl,
305337
305497
  instanceof: () => _instanceof,
305338
305498
  int: () => int,
@@ -305479,7 +305639,7 @@ function jwt(params) {
305479
305639
  function stringFormat(format, fnOrRegex, _params = {}) {
305480
305640
  return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
305481
305641
  }
305482
- function hostname2(_params) {
305642
+ function hostname3(_params) {
305483
305643
  return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
305484
305644
  }
305485
305645
  function hex2(_params) {
@@ -307165,7 +307325,7 @@ __export(external_exports3, {
307165
307325
  guid: () => guid2,
307166
307326
  hash: () => hash,
307167
307327
  hex: () => hex2,
307168
- hostname: () => hostname2,
307328
+ hostname: () => hostname3,
307169
307329
  httpUrl: () => httpUrl,
307170
307330
  includes: () => _includes,
307171
307331
  instanceof: () => _instanceof,
@@ -314451,11 +314611,11 @@ var require_core2 = __commonJS({
314451
314611
  Ajv2.ValidationError = validation_error_1.default;
314452
314612
  Ajv2.MissingRefError = ref_error_1.default;
314453
314613
  exports2.default = Ajv2;
314454
- function checkOptions(checkOpts, options, msg, log = "error") {
314614
+ function checkOptions(checkOpts, options, msg, log2 = "error") {
314455
314615
  for (const key in checkOpts) {
314456
314616
  const opt = key;
314457
314617
  if (opt in options)
314458
- this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
314618
+ this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
314459
314619
  }
314460
314620
  }
314461
314621
  function getSchEnv(keyRef) {
@@ -319716,6 +319876,105 @@ var init_zod = __esm({
319716
319876
  }
319717
319877
  });
319718
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
+
319719
319978
  // src/commands/proxy/start.ts
319720
319979
  var start_exports = {};
319721
319980
  __export(start_exports, {
@@ -319724,6 +319983,11 @@ __export(start_exports, {
319724
319983
  performFetch: () => performFetch
319725
319984
  });
319726
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
+ }
319727
319991
  return (0, import_rxjs46.lastValueFrom)(
319728
319992
  GraphqlClienAPI.getConfig().pipe(
319729
319993
  (0, import_operators31.take)(1),
@@ -319833,18 +320097,21 @@ async function startProxy(cmd) {
319833
320097
  )
319834
320098
  );
319835
320099
  }
319836
- 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;
319837
320101
  var init_start = __esm({
319838
320102
  "src/commands/proxy/start.ts"() {
319839
320103
  init_client2();
319840
320104
  init_streamableHttp();
319841
320105
  init_server2();
319842
320106
  init_stdio2();
320107
+ import_fs9 = require("fs");
319843
320108
  import_rxjs46 = __toESM(require_cjs());
319844
320109
  import_operators31 = __toESM(require_operators());
319845
320110
  import_stream2 = require("stream");
319846
320111
  init_zod();
319847
320112
  init_gql_client();
320113
+ init_types();
320114
+ init_login_gate();
319848
320115
  pendingToken = null;
319849
320116
  currentToken = (force = false) => {
319850
320117
  if (!pendingToken || force) {
@@ -320584,19 +320851,19 @@ var init_connection = __esm({
320584
320851
  });
320585
320852
 
320586
320853
  // src/commands/runner/daemon.ts
320587
- var import_child_process3, import_fs9, import_promises6, import_os4, import_path5, 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;
320588
320855
  var init_daemon = __esm({
320589
320856
  "src/commands/runner/daemon.ts"() {
320590
- import_child_process3 = require("child_process");
320591
- import_fs9 = require("fs");
320857
+ import_child_process4 = require("child_process");
320858
+ import_fs10 = require("fs");
320592
320859
  import_promises6 = require("fs/promises");
320593
- import_os4 = require("os");
320860
+ import_os5 = require("os");
320594
320861
  import_path5 = require("path");
320595
320862
  import_util11 = require("util");
320596
320863
  DEFAULT_SERVICE_NAME = "lambforge-runner";
320597
320864
  RUNNER_AUTH_EXIT_CODE = 78;
320598
320865
  systemdQuote = (word) => /^[A-Za-z0-9_@%+=:,./-]+$/.test(word) ? word : `"${word.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
320599
- unitPath = (serviceName, home = (0, import_os4.homedir)()) => (0, import_path5.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`);
320600
320867
  buildUnit = ({
320601
320868
  serviceName,
320602
320869
  execStart,
@@ -320635,7 +320902,7 @@ var init_daemon = __esm({
320635
320902
  }
320636
320903
  let script = argv[1];
320637
320904
  try {
320638
- script = (0, import_fs9.realpathSync)(script);
320905
+ script = (0, import_fs10.realpathSync)(script);
320639
320906
  } catch {
320640
320907
  }
320641
320908
  const ephemeral = /[/\\]_npx[/\\]|[/\\]\.npm[/\\]_cacache/.test(script);
@@ -320644,9 +320911,9 @@ var init_daemon = __esm({
320644
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
320645
320912
  };
320646
320913
  };
320647
- 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" });
320648
320915
  SystemdUserService = class {
320649
- 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)()) {
320650
320917
  this.serviceName = serviceName;
320651
320918
  this.exec = exec2;
320652
320919
  this.home = home;
@@ -320673,7 +320940,7 @@ var init_daemon = __esm({
320673
320940
  }
320674
320941
  /** Whether `runner:daemon:install` wrote the unit. */
320675
320942
  installed() {
320676
- return (0, import_fs9.existsSync)(unitPath(this.serviceName, this.home));
320943
+ return (0, import_fs10.existsSync)(unitPath(this.serviceName, this.home));
320677
320944
  }
320678
320945
  start() {
320679
320946
  return this.systemctl("start", this.unit);
@@ -320737,10 +321004,10 @@ __export(start_exports2, {
320737
321004
  default: () => start_default,
320738
321005
  resolveRunner: () => resolveRunner
320739
321006
  });
320740
- var import_os5, import_rxjs50, RUNNER_VERSION, resolveRunner, start_default;
321007
+ var import_os6, import_rxjs50, RUNNER_VERSION, resolveRunner, start_default;
320741
321008
  var init_start2 = __esm({
320742
321009
  "src/commands/runner/start.ts"() {
320743
- import_os5 = require("os");
321010
+ import_os6 = require("os");
320744
321011
  import_rxjs50 = __toESM(require_cjs());
320745
321012
  init_gql_client();
320746
321013
  init_log();
@@ -320760,7 +321027,7 @@ var init_start2 = __esm({
320760
321027
  if (saved) {
320761
321028
  return saved;
320762
321029
  }
320763
- const name2 = cmd.name || (0, import_os5.hostname)();
321030
+ const name2 = cmd.name || (0, import_os6.hostname)();
320764
321031
  Logger.info(`Registering this machine as local runner "${name2}"...`);
320765
321032
  const { runner, token } = await (0, import_rxjs50.lastValueFrom)(
320766
321033
  GraphqlClienAPI.createLocalRunner(name2)
@@ -320823,10 +321090,10 @@ __export(daemon_commands_exports, {
320823
321090
  stop: () => stop,
320824
321091
  uninstall: () => uninstall
320825
321092
  });
320826
- 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;
320827
321094
  var init_daemon_commands = __esm({
320828
321095
  "src/commands/runner/daemon-commands.ts"() {
320829
- import_child_process4 = require("child_process");
321096
+ import_child_process5 = require("child_process");
320830
321097
  init_log();
320831
321098
  init_config();
320832
321099
  init_daemon();
@@ -320942,7 +321209,7 @@ var init_daemon_commands = __esm({
320942
321209
  assertSystemdAvailable();
320943
321210
  const serviceName = cmd.service || DEFAULT_SERVICE_NAME;
320944
321211
  return new Promise((resolve2) => {
320945
- (0, import_child_process4.spawn)(
321212
+ (0, import_child_process5.spawn)(
320946
321213
  "journalctl",
320947
321214
  ["--user", "-u", `${serviceName}.service`, "-f", "-n", cmd.lines || "50"],
320948
321215
  { stdio: "inherit" }
@@ -322328,11 +322595,11 @@ var init_approvals = __esm({
322328
322595
  }
322329
322596
  };
322330
322597
  ApprovalGate = class {
322331
- constructor(policy, backend, prompt, log, timeoutMs = APPROVAL_TIMEOUT_MS) {
322598
+ constructor(policy, backend, prompt, log2, timeoutMs = APPROVAL_TIMEOUT_MS) {
322332
322599
  this.policy = policy;
322333
322600
  this.backend = backend;
322334
322601
  this.prompt = prompt;
322335
- this.log = log;
322602
+ this.log = log2;
322336
322603
  this.timeoutMs = timeoutMs;
322337
322604
  this.waiting = /* @__PURE__ */ new Map();
322338
322605
  // A web answer that arrived before the card's id was back here.
@@ -322459,15 +322726,15 @@ var init_config2 = __esm({
322459
322726
  });
322460
322727
 
322461
322728
  // src/commands/workspace/files.ts
322462
- var import_child_process5, import_crypto2, import_fs10, 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;
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;
322463
322730
  var init_files = __esm({
322464
322731
  "src/commands/workspace/files.ts"() {
322465
- import_child_process5 = require("child_process");
322732
+ import_child_process6 = require("child_process");
322466
322733
  import_crypto2 = require("crypto");
322467
- import_fs10 = require("fs");
322734
+ import_fs11 = require("fs");
322468
322735
  import_path6 = require("path");
322469
322736
  import_util12 = require("util");
322470
- run = (0, import_util12.promisify)(import_child_process5.execFile);
322737
+ run = (0, import_util12.promisify)(import_child_process6.execFile);
322471
322738
  WorkspaceError = class extends Error {
322472
322739
  constructor(message, status2 = 400) {
322473
322740
  super(message);
@@ -322509,7 +322776,7 @@ var init_files = __esm({
322509
322776
  let existing = abs;
322510
322777
  for (; ; ) {
322511
322778
  try {
322512
- const real = await import_fs10.promises.realpath(existing);
322779
+ const real = await import_fs11.promises.realpath(existing);
322513
322780
  const realFromRoot = (0, import_path6.relative)(this.root, real);
322514
322781
  if (realFromRoot.startsWith("..") || (0, import_path6.isAbsolute)(realFromRoot)) {
322515
322782
  throw new WorkspaceError(
@@ -322568,7 +322835,7 @@ var init_files = __esm({
322568
322835
  const out = [];
322569
322836
  const walk = async (relDir) => {
322570
322837
  if (out.length > limit) return;
322571
- const entries = await import_fs10.promises.readdir((0, import_path6.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(() => []);
322572
322839
  for (const entry of entries) {
322573
322840
  if (SKIP_DIRS.has(entry.name)) continue;
322574
322841
  const rel = relDir === "." ? entry.name : `${relDir}/${entry.name}`;
@@ -322611,7 +322878,7 @@ var init_files = __esm({
322611
322878
  entries = entries.slice(0, limit);
322612
322879
  await Promise.all(
322613
322880
  entries.filter((e2) => e2.type === "file").map(async (e2) => {
322614
- e2.size = await import_fs10.promises.stat((0, import_path6.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);
322615
322882
  })
322616
322883
  );
322617
322884
  return {
@@ -322622,12 +322889,12 @@ var init_files = __esm({
322622
322889
  async read(args) {
322623
322890
  if (!args.path) throw new WorkspaceError("path is required");
322624
322891
  const { abs, rel } = await this.resolvePath(args.path);
322625
- const stat2 = await import_fs10.promises.stat(abs).catch(() => null);
322892
+ const stat2 = await import_fs11.promises.stat(abs).catch(() => null);
322626
322893
  if (!stat2) throw new WorkspaceError(`${rel} does not exist`, 404);
322627
322894
  if (stat2.isDirectory()) {
322628
322895
  throw new WorkspaceError(`${rel} is a directory - use LocalListFiles`);
322629
322896
  }
322630
- const buffer = await import_fs10.promises.readFile(abs);
322897
+ const buffer = await import_fs11.promises.readFile(abs);
322631
322898
  if (buffer.subarray(0, 8e3).includes(0)) {
322632
322899
  return { path: rel, size: stat2.size, binary: true, content: "" };
322633
322900
  }
@@ -322656,7 +322923,7 @@ var init_files = __esm({
322656
322923
  };
322657
322924
  }
322658
322925
  async currentText(abs) {
322659
- return import_fs10.promises.readFile(abs, "utf-8").catch((e2) => {
322926
+ return import_fs11.promises.readFile(abs, "utf-8").catch((e2) => {
322660
322927
  if (e2?.code === "ENOENT") return null;
322661
322928
  throw e2;
322662
322929
  });
@@ -322677,8 +322944,8 @@ var init_files = __esm({
322677
322944
  );
322678
322945
  }
322679
322946
  }
322680
- await import_fs10.promises.mkdir((0, import_path6.dirname)(abs), { recursive: true });
322681
- await import_fs10.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");
322682
322949
  return {
322683
322950
  path: rel,
322684
322951
  size: Buffer.byteLength(content),
@@ -322710,7 +322977,7 @@ var init_files = __esm({
322710
322977
  );
322711
322978
  }
322712
322979
  const after = args.replaceAll ? before.split(args.oldText).join(args.newText ?? "") : before.replace(args.oldText, () => args.newText ?? "");
322713
- await import_fs10.promises.writeFile(abs, after, "utf-8");
322980
+ await import_fs11.promises.writeFile(abs, after, "utf-8");
322714
322981
  return {
322715
322982
  path: rel,
322716
322983
  replacements: args.replaceAll ? count : 1,
@@ -322721,14 +322988,14 @@ var init_files = __esm({
322721
322988
  async delete(args) {
322722
322989
  if (!args.path) throw new WorkspaceError("path is required");
322723
322990
  const { abs, rel } = await this.resolvePath(args.path, { forWrite: true });
322724
- const stat2 = await import_fs10.promises.lstat(abs).catch(() => null);
322991
+ const stat2 = await import_fs11.promises.lstat(abs).catch(() => null);
322725
322992
  if (!stat2) return { path: rel, deleted: false };
322726
322993
  if (stat2.isDirectory()) {
322727
322994
  throw new WorkspaceError(
322728
322995
  `${rel} is a directory - only files can be deleted (use RunCommand for more)`
322729
322996
  );
322730
322997
  }
322731
- await import_fs10.promises.unlink(abs);
322998
+ await import_fs11.promises.unlink(abs);
322732
322999
  return { path: rel, deleted: true };
322733
323000
  }
322734
323001
  async search(args) {
@@ -322780,7 +323047,7 @@ var init_files = __esm({
322780
323047
  raw = [];
322781
323048
  for (const file2 of await this.allFiles(rel, 2e4)) {
322782
323049
  if (globRe && !globRe.test(file2)) continue;
322783
- const text = await import_fs10.promises.readFile((0, import_path6.join)(this.root, file2)).catch(() => null);
323050
+ const text = await import_fs11.promises.readFile((0, import_path6.join)(this.root, file2)).catch(() => null);
322784
323051
  if (!text || text.subarray(0, 8e3).includes(0)) continue;
322785
323052
  text.toString("utf-8").split("\n").forEach((line, i2) => {
322786
323053
  if (raw.length <= max && re.test(line)) {
@@ -322801,10 +323068,10 @@ var init_files = __esm({
322801
323068
  });
322802
323069
 
322803
323070
  // src/commands/workspace/processes.ts
322804
- 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;
322805
323072
  var init_processes = __esm({
322806
323073
  "src/commands/workspace/processes.ts"() {
322807
- import_child_process6 = require("child_process");
323074
+ import_child_process7 = require("child_process");
322808
323075
  init_files();
322809
323076
  DEFAULT_TIMEOUT_S = 300;
322810
323077
  MAX_TIMEOUT_S = 1800;
@@ -322887,7 +323154,7 @@ var init_processes = __esm({
322887
323154
  if (!child.pid || child.exitCode !== null) return;
322888
323155
  try {
322889
323156
  if (process.platform === "win32") {
322890
- (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"]);
322891
323158
  } else {
322892
323159
  process.kill(-child.pid, signal);
322893
323160
  }
@@ -322929,7 +323196,7 @@ ${this.text}` : this.text;
322929
323196
  );
322930
323197
  const started = Date.now();
322931
323198
  const [shell, shellArgs] = shellOf(args.command);
322932
- const child = (0, import_child_process6.spawn)(shell, shellArgs, {
323199
+ const child = (0, import_child_process7.spawn)(shell, shellArgs, {
322933
323200
  cwd: args.cwd,
322934
323201
  env: args.env,
322935
323202
  stdio: ["ignore", "pipe", "pipe"],
@@ -323019,7 +323286,7 @@ ${this.text}` : this.text;
323019
323286
  }
323020
323287
  }
323021
323288
  const [shell, shellArgs] = shellOf(args.command);
323022
- const child = (0, import_child_process6.spawn)(shell, shellArgs, {
323289
+ const child = (0, import_child_process7.spawn)(shell, shellArgs, {
323023
323290
  cwd: args.cwd,
323024
323291
  env: args.env,
323025
323292
  stdio: ["ignore", "pipe", "pipe"],
@@ -323175,10 +323442,10 @@ ${this.text}` : this.text;
323175
323442
  });
323176
323443
 
323177
323444
  // src/commands/workspace/connection.ts
323178
- 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;
323179
323446
  var init_connection2 = __esm({
323180
323447
  "src/commands/workspace/connection.ts"() {
323181
- import_os6 = require("os");
323448
+ import_os7 = require("os");
323182
323449
  init_tunnel();
323183
323450
  init_approvals();
323184
323451
  init_files();
@@ -323261,7 +323528,7 @@ var init_connection2 = __esm({
323261
323528
  const data = await this.operation(HEARTBEAT_MUTATION2, {
323262
323529
  info: {
323263
323530
  root: this.options.root,
323264
- hostname: (0, import_os6.hostname)(),
323531
+ hostname: (0, import_os7.hostname)(),
323265
323532
  platform: process.platform,
323266
323533
  gitBranch: await this.files.gitBranch(),
323267
323534
  clientVersion: this.options.version,
@@ -323325,7 +323592,7 @@ var init_connection2 = __esm({
323325
323592
  }
323326
323593
  /** One operation (exposed for tests). */
323327
323594
  async dispatch(op, args, signal) {
323328
- const log = (line) => this.options.logger.info(line);
323595
+ const log2 = (line) => this.options.logger.info(line);
323329
323596
  switch (op) {
323330
323597
  case "info":
323331
323598
  return {
@@ -323338,21 +323605,21 @@ var init_connection2 = __esm({
323338
323605
  processes: this.processes.list()
323339
323606
  };
323340
323607
  case "list":
323341
- log(`-> list ${str(args.path) ?? "."}`);
323608
+ log2(`-> list ${str(args.path) ?? "."}`);
323342
323609
  return this.files.list({
323343
323610
  path: str(args.path),
323344
323611
  recursive: args.recursive !== false,
323345
323612
  limit: num(args.limit)
323346
323613
  });
323347
323614
  case "read":
323348
- log(`-> read ${str(args.path)}`);
323615
+ log2(`-> read ${str(args.path)}`);
323349
323616
  return this.files.read({
323350
323617
  path: str(args.path),
323351
323618
  startLine: num(args.startLine),
323352
323619
  endLine: num(args.endLine)
323353
323620
  });
323354
323621
  case "search":
323355
- log(`-> search /${str(args.pattern)}/ in ${str(args.path) ?? "."}`);
323622
+ log2(`-> search /${str(args.pattern)}/ in ${str(args.path) ?? "."}`);
323356
323623
  return this.files.search({
323357
323624
  pattern: str(args.pattern),
323358
323625
  path: str(args.path),
@@ -323367,7 +323634,7 @@ var init_connection2 = __esm({
323367
323634
  content: str(args.content) ?? "",
323368
323635
  expectedHash: str(args.expectedHash)
323369
323636
  });
323370
- log(`\u270E ${result.created ? "created" : "wrote"} ${result.path}`);
323637
+ log2(`\u270E ${result.created ? "created" : "wrote"} ${result.path}`);
323371
323638
  return result;
323372
323639
  }
323373
323640
  case "edit": {
@@ -323378,12 +323645,12 @@ var init_connection2 = __esm({
323378
323645
  replaceAll: args.replaceAll === true,
323379
323646
  expectedHash: str(args.expectedHash)
323380
323647
  });
323381
- log(`\u270E edited ${result.path} (${result.replacements}x)`);
323648
+ log2(`\u270E edited ${result.path} (${result.replacements}x)`);
323382
323649
  return result;
323383
323650
  }
323384
323651
  case "delete": {
323385
323652
  const result = await this.files.delete({ path: str(args.path) });
323386
- if (result.deleted) log(`\u270E deleted ${result.path}`);
323653
+ if (result.deleted) log2(`\u270E deleted ${result.path}`);
323387
323654
  return result;
323388
323655
  }
323389
323656
  case "exec":
@@ -323402,7 +323669,7 @@ var init_connection2 = __esm({
323402
323669
  const result = await this.processes.stop({
323403
323670
  processId: str(args.processId)
323404
323671
  });
323405
- log(`\u25A0 stopped ${result.processId}`);
323672
+ log2(`\u25A0 stopped ${result.processId}`);
323406
323673
  return result;
323407
323674
  }
323408
323675
  default:
@@ -323792,7 +324059,9 @@ init_src();
323792
324059
  // src/commands/auth/index.ts
323793
324060
  init_helpers();
323794
324061
  function registerAuthCommands(program2) {
323795
- 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(
323796
324065
  "-t, --token <token>",
323797
324066
  "Specify custom token generated from the website"
323798
324067
  ).option("-u, --url <url>", "Specify api url").action(lazy(() => Promise.resolve().then(() => (init_login(), login_exports)).then((m2) => m2.default)));
@@ -323928,7 +324197,13 @@ function registerClusterCommands(program2) {
323928
324197
  program2.command("cluster:autoscale").description(
323929
324198
  "Change the worker autoscaling policy - only the flags you pass change"
323930
324199
  )
323931
- ).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)));
323932
324207
  target(
323933
324208
  program2.command("cluster:multi-node").description(
323934
324209
  "Convert a single-node cluster to dedicated worker nodes (required for autoscaling)"