vibelet 1.2.152 → 1.2.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var c=require("node:fs"),n=require("node:path"),p="@vibelet/cli";function i(r){try{let e=JSON.parse((0,c.readFileSync)(r,"utf8"));if(e.name===p&&typeof e.version=="string"&&e.version.length>0)return e.version}catch{}return null}function l(){return"1.2.152"}var a=l();process.stdout.write(`${a}
1
+ var c=require("node:fs"),n=require("node:path"),p="@vibelet/cli";function i(r){try{let e=JSON.parse((0,c.readFileSync)(r,"utf8"));if(e.name===p&&typeof e.version=="string"&&e.version.length>0)return e.version}catch{}return null}function l(){return"1.2.154"}var a=l();process.stdout.write(`${a}
2
2
  `);
package/dist/vibelet.mjs CHANGED
@@ -11245,7 +11245,7 @@ module.exports = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("zlib");
11245
11245
 
11246
11246
  /***/ }),
11247
11247
 
11248
- /***/ 2517:
11248
+ /***/ 2755:
11249
11249
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
11250
11250
 
11251
11251
 
@@ -11267,17 +11267,208 @@ var external_node_fs_ = __nccwpck_require__(3024);
11267
11267
  var external_node_module_ = __nccwpck_require__(8995);
11268
11268
  // EXTERNAL MODULE: external "node:path"
11269
11269
  var external_node_path_ = __nccwpck_require__(6760);
11270
+ ;// CONCATENATED MODULE: external "node:fs/promises"
11271
+ const promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises");
11272
+ ;// CONCATENATED MODULE: external "node:util"
11273
+ const external_node_util_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:util");
11274
+ ;// CONCATENATED MODULE: ../../packages/cloudflared-tunnel/managed-binary.mjs
11275
+
11276
+
11277
+
11278
+
11279
+
11280
+
11281
+ const execFileAsync = (0,external_node_util_namespaceObject.promisify)(external_node_child_process_.execFile);
11282
+ const DEFAULT_UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1000;
11283
+ const DEFAULT_UPDATE_TIMEOUT_MS = 30_000;
11284
+
11285
+ function parseCloudflaredVersion(output) {
11286
+ return String(output || '').match(/cloudflared version\s+([0-9]+(?:\.[0-9]+){1,2})/i)?.[1] ?? null;
11287
+ }
11288
+
11289
+ async function readUpdateState(updateStatePath) {
11290
+ try {
11291
+ const state = JSON.parse(await (0,promises_namespaceObject.readFile)(updateStatePath, 'utf8'));
11292
+ return state && typeof state === 'object' ? state : null;
11293
+ } catch {
11294
+ return null;
11295
+ }
11296
+ }
11297
+
11298
+ async function writeUpdateState(updateStatePath, state) {
11299
+ await (0,promises_namespaceObject.mkdir)((0,external_node_path_.dirname)(updateStatePath), { recursive: true });
11300
+ const temporaryPath = `${updateStatePath}.tmp-${process.pid}-${Date.now()}`;
11301
+ await (0,promises_namespaceObject.writeFile)(temporaryPath, `${JSON.stringify(state, null, 2)}\n`, 'utf8');
11302
+ await (0,promises_namespaceObject.rename)(temporaryPath, updateStatePath);
11303
+ }
11304
+
11305
+ async function runVersion(binaryPath, timeoutMs, runCommand) {
11306
+ if (!binaryPath || !(0,external_node_fs_.existsSync)(binaryPath)) return null;
11307
+ try {
11308
+ const { stdout, stderr } = await runCommand(binaryPath, ['--version'], {
11309
+ encoding: 'utf8',
11310
+ timeout: timeoutMs,
11311
+ maxBuffer: 1024 * 1024,
11312
+ });
11313
+ return parseCloudflaredVersion(`${stdout || ''}\n${stderr || ''}`);
11314
+ } catch {
11315
+ return null;
11316
+ }
11317
+ }
11318
+
11319
+ async function probeCloudflaredLaunchSpecVersion(
11320
+ launchSpec,
11321
+ { timeoutMs = 5_000, runCommand = execFileAsync } = {},
11322
+ ) {
11323
+ try {
11324
+ const { stdout, stderr } = await runCommand(launchSpec.command, [...launchSpec.args, '--version'], {
11325
+ encoding: 'utf8',
11326
+ timeout: timeoutMs,
11327
+ maxBuffer: 1024 * 1024,
11328
+ ...(launchSpec.shell ? { shell: true } : {}),
11329
+ });
11330
+ return parseCloudflaredVersion(`${stdout || ''}\n${stderr || ''}`);
11331
+ } catch {
11332
+ return null;
11333
+ }
11334
+ }
11335
+
11336
+ async function installLatestToTemporaryPath({ launchSpec, binaryPath, timeoutMs, platform, runCommand }) {
11337
+ const temporaryDir = (0,external_node_path_.join)((0,external_node_path_.dirname)(binaryPath), `.cloudflared-update-${process.pid}-${Date.now()}`);
11338
+ const temporaryBinaryPath = (0,external_node_path_.join)(temporaryDir, (0,external_node_path_.basename)(binaryPath));
11339
+ await (0,promises_namespaceObject.mkdir)(temporaryDir, { recursive: true });
11340
+ try {
11341
+ await runCommand(launchSpec.command, [...launchSpec.args, 'bin', 'install', 'latest'], {
11342
+ encoding: 'utf8',
11343
+ timeout: timeoutMs,
11344
+ maxBuffer: 4 * 1024 * 1024,
11345
+ env: { ...process.env, CLOUDFLARED_BIN: temporaryBinaryPath },
11346
+ ...(launchSpec.shell ? { shell: true } : {}),
11347
+ });
11348
+ const version = await runVersion(temporaryBinaryPath, timeoutMs, runCommand);
11349
+ if (!version) throw new Error('downloaded cloudflared did not report a valid version');
11350
+
11351
+ if (platform === 'win32' && (0,external_node_fs_.existsSync)(binaryPath)) {
11352
+ const backupPath = `${binaryPath}.previous-${process.pid}`;
11353
+ await (0,promises_namespaceObject.rename)(binaryPath, backupPath);
11354
+ try {
11355
+ await (0,promises_namespaceObject.rename)(temporaryBinaryPath, binaryPath);
11356
+ await (0,promises_namespaceObject.rm)(backupPath, { force: true });
11357
+ } catch (error) {
11358
+ await (0,promises_namespaceObject.rename)(backupPath, binaryPath).catch(() => undefined);
11359
+ throw error;
11360
+ }
11361
+ } else {
11362
+ await (0,promises_namespaceObject.rename)(temporaryBinaryPath, binaryPath);
11363
+ }
11364
+ return version;
11365
+ } finally {
11366
+ await (0,promises_namespaceObject.rm)(temporaryDir, { recursive: true, force: true });
11367
+ }
11368
+ }
11369
+
11370
+ async function resolveManagedCloudflared({
11371
+ launchSpec,
11372
+ updateStatePath,
11373
+ now = Date.now(),
11374
+ updateIntervalMs = DEFAULT_UPDATE_INTERVAL_MS,
11375
+ timeoutMs = DEFAULT_UPDATE_TIMEOUT_MS,
11376
+ platform = process.platform,
11377
+ runCommand = execFileAsync,
11378
+ }) {
11379
+ const state = await readUpdateState(updateStatePath);
11380
+ const lastAttemptAt = Date.parse(state?.lastAttemptAt || '');
11381
+ const recentlyAttempted = Number.isFinite(lastAttemptAt) && now - lastAttemptAt < updateIntervalMs;
11382
+ if (recentlyAttempted) {
11383
+ return {
11384
+ launchSpec,
11385
+ version: state?.installedVersion ?? null,
11386
+ update: 'skipped',
11387
+ };
11388
+ }
11389
+
11390
+ const attemptedAt = new Date(now).toISOString();
11391
+ const binaryPath = launchSpec.managedBinaryPath;
11392
+ if (launchSpec.source !== 'dependency' || !binaryPath) {
11393
+ const version = state?.installedVersion ?? null;
11394
+ let stateWarning = '';
11395
+ try {
11396
+ await writeUpdateState(updateStatePath, {
11397
+ ...state,
11398
+ lastAttemptAt: attemptedAt,
11399
+ installedVersion: version,
11400
+ });
11401
+ } catch (error) {
11402
+ stateWarning = ` Update state could not be saved: ${error instanceof Error ? error.message : String(error)}`;
11403
+ }
11404
+ return {
11405
+ launchSpec,
11406
+ version,
11407
+ update: 'skipped',
11408
+ warning: `Skipping cloudflared self-update for unmanaged ${launchSpec.source} executable: ${launchSpec.description}.${stateWarning}`,
11409
+ };
11410
+ }
11411
+
11412
+ const previousVersion = await runVersion(binaryPath, timeoutMs, runCommand);
11413
+ try {
11414
+ const installedVersion = await installLatestToTemporaryPath({
11415
+ launchSpec,
11416
+ binaryPath,
11417
+ timeoutMs,
11418
+ platform,
11419
+ runCommand,
11420
+ });
11421
+ await writeUpdateState(updateStatePath, {
11422
+ lastAttemptAt: attemptedAt,
11423
+ lastSuccessAt: attemptedAt,
11424
+ installedVersion,
11425
+ });
11426
+ return {
11427
+ launchSpec,
11428
+ version: installedVersion,
11429
+ update: previousVersion ? 'updated' : 'fresh',
11430
+ };
11431
+ } catch (error) {
11432
+ const fallbackVersion = previousVersion || (await runVersion(binaryPath, timeoutMs, runCommand));
11433
+ await writeUpdateState(updateStatePath, {
11434
+ ...state,
11435
+ lastAttemptAt: attemptedAt,
11436
+ installedVersion: fallbackVersion,
11437
+ }).catch(() => undefined);
11438
+ return {
11439
+ launchSpec,
11440
+ version: fallbackVersion,
11441
+ update: 'failed',
11442
+ warning: `cloudflared update failed; continuing with ${fallbackVersion || 'the existing launcher'}: ${error instanceof Error ? error.message : String(error)}`,
11443
+ };
11444
+ }
11445
+ }
11446
+
11270
11447
  ;// CONCATENATED MODULE: ../../packages/cloudflared-tunnel/index.mjs
11271
11448
 
11272
11449
 
11273
11450
 
11274
11451
 
11275
11452
 
11453
+
11454
+
11455
+
11276
11456
  const QUICK_TUNNEL_URL_PATTERN = /https:\/\/[a-z0-9-]+\.trycloudflare\.com(?=$|[\s"',)\]])/g;
11277
11457
  const npmFallbackArgs = ['--yes', '--package=cloudflared', 'cloudflared'];
11278
11458
  const npmFallbackDescription = `npx ${npmFallbackArgs.join(' ')}`;
11279
11459
  const defaultUrlTimeoutMs = 90_000;
11280
11460
 
11461
+ function supportsFastAutoProtocolFallback(version) {
11462
+ if (!version) return false;
11463
+ const parts = version.split('.').map(Number);
11464
+ const threshold = [2026, 5, 2];
11465
+ for (let index = 0; index < threshold.length; index += 1) {
11466
+ const value = parts[index] || 0;
11467
+ if (value !== threshold[index]) return value > threshold[index];
11468
+ }
11469
+ return true;
11470
+ }
11471
+
11281
11472
  function extractQuickTunnelUrl(logContent) {
11282
11473
  if (typeof logContent !== 'string' || logContent.length === 0) {
11283
11474
  return null;
@@ -11403,6 +11594,21 @@ function resolveInstalledCloudflaredCliPath({
11403
11594
  return (0,external_node_fs_.existsSync)(cliPath) ? cliPath : null;
11404
11595
  }
11405
11596
 
11597
+ function createDependencyLaunchSpec(dependencyCliPath, platform = process.platform) {
11598
+ return {
11599
+ command: process.execPath,
11600
+ args: [dependencyCliPath],
11601
+ source: 'dependency',
11602
+ description: dependencyCliPath,
11603
+ managedBinaryPath: (0,external_node_path_.join)(
11604
+ (0,external_node_path_.dirname)((0,external_node_path_.dirname)(dependencyCliPath)),
11605
+ 'bin',
11606
+ platform === 'win32' ? 'cloudflared.exe' : 'cloudflared',
11607
+ ),
11608
+ urlTimeoutMs: defaultUrlTimeoutMs,
11609
+ };
11610
+ }
11611
+
11406
11612
  function resolveCloudflaredLaunchSpec({
11407
11613
  pathValue = process.env.PATH ?? '',
11408
11614
  pathExtValue = process.env.PATHEXT ?? '',
@@ -11427,13 +11633,7 @@ function resolveCloudflaredLaunchSpec({
11427
11633
 
11428
11634
  const dependencyCliPath = resolveInstalledCloudflaredCliPath({ resolvePackageJsonPath });
11429
11635
  if (dependencyCliPath) {
11430
- return {
11431
- command: process.execPath,
11432
- args: [dependencyCliPath],
11433
- source: 'dependency',
11434
- description: dependencyCliPath,
11435
- urlTimeoutMs: defaultUrlTimeoutMs,
11436
- };
11636
+ return createDependencyLaunchSpec(dependencyCliPath, platform);
11437
11637
  }
11438
11638
 
11439
11639
  return {
@@ -11446,6 +11646,11 @@ function resolveCloudflaredLaunchSpec({
11446
11646
  };
11447
11647
  }
11448
11648
 
11649
+ function resolvePreferredCloudflaredLaunchSpec() {
11650
+ const dependencyCliPath = resolveInstalledCloudflaredCliPath();
11651
+ return dependencyCliPath ? createDependencyLaunchSpec(dependencyCliPath) : resolveCloudflaredLaunchSpec();
11652
+ }
11653
+
11449
11654
  function summarizeCloudflaredLog(logContent, { maxLines = 8, maxChars = 1200 } = {}) {
11450
11655
  const lines = logContent
11451
11656
  .split(/\r?\n/u)
@@ -11546,13 +11751,50 @@ function readCloudflaredLog(logPath) {
11546
11751
  }
11547
11752
  }
11548
11753
 
11549
- function startTunnel({ port, logDir, tunnelStatePath, resolveLaunchSpec = resolveCloudflaredLaunchSpec }) {
11754
+ async function startTunnel({
11755
+ port,
11756
+ logDir,
11757
+ tunnelStatePath,
11758
+ protocol = 'auto',
11759
+ updateStatePath,
11760
+ resolveLaunchSpec = resolvePreferredCloudflaredLaunchSpec,
11761
+ resolveFallbackLaunchSpec = resolveCloudflaredLaunchSpec,
11762
+ }) {
11763
+ if (!['auto', 'quic', 'http2'].includes(protocol)) {
11764
+ throw new Error(`Unsupported cloudflared protocol: ${protocol}`);
11765
+ }
11766
+ const unresolvedLaunchSpec = resolveLaunchSpec();
11767
+ const managed = updateStatePath
11768
+ ? await resolveManagedCloudflared({ launchSpec: unresolvedLaunchSpec, updateStatePath })
11769
+ : null;
11770
+ let launchSpec = managed?.launchSpec ?? unresolvedLaunchSpec;
11771
+ if (
11772
+ managed &&
11773
+ managed.version === null &&
11774
+ launchSpec.managedBinaryPath &&
11775
+ !(0,external_node_fs_.existsSync)(launchSpec.managedBinaryPath)
11776
+ ) {
11777
+ const fallbackLaunchSpec = resolveFallbackLaunchSpec();
11778
+ if (fallbackLaunchSpec.source !== 'dependency') launchSpec = fallbackLaunchSpec;
11779
+ }
11780
+ if (managed?.warning) process.stderr.write(`[cloudflared] ${managed.warning}\n`);
11781
+ const launchVersion =
11782
+ managed?.version ??
11783
+ (updateStatePath && launchSpec.source !== 'dependency'
11784
+ ? await probeCloudflaredLaunchSpecVersion(launchSpec)
11785
+ : null);
11786
+ const effectiveProtocol =
11787
+ protocol === 'auto' && updateStatePath && !supportsFastAutoProtocolFallback(launchVersion) ? 'http2' : protocol;
11788
+ if (effectiveProtocol !== protocol) {
11789
+ process.stderr.write(
11790
+ `[cloudflared] cloudflared ${launchVersion || 'unknown'} lacks fast auto connectivity pre-checks; using http2 until the managed binary updates to 2026.5.2 or newer.\n`,
11791
+ );
11792
+ }
11793
+
11550
11794
  return new Promise((resolveStart, rejectStart) => {
11551
11795
  const logPath = (0,external_node_path_.join)(logDir, 'tunnel.stderr.log');
11552
11796
  (0,external_node_fs_.mkdirSync)(logDir, { recursive: true });
11553
11797
 
11554
- const launchSpec = resolveLaunchSpec();
11555
-
11556
11798
  // Truncate first so URL polling cannot match a stale quick-tunnel URL.
11557
11799
  (0,external_node_fs_.writeFileSync)(logPath, '', 'utf8');
11558
11800
  const stdoutLogFd = (0,external_node_fs_.openSync)(logPath, 'a');
@@ -11561,7 +11803,7 @@ function startTunnel({ port, logDir, tunnelStatePath, resolveLaunchSpec = resolv
11561
11803
  try {
11562
11804
  child = (0,external_node_child_process_.spawn)(
11563
11805
  launchSpec.command,
11564
- [...launchSpec.args, 'tunnel', '--protocol', 'http2', '--url', `http://localhost:${port}`],
11806
+ [...launchSpec.args, 'tunnel', '--protocol', effectiveProtocol, '--url', `http://localhost:${port}`],
11565
11807
  {
11566
11808
  detached: true,
11567
11809
  stdio: ['ignore', stdoutLogFd, stderrLogFd],
@@ -11768,7 +12010,7 @@ __nccwpck_require__.d(__webpack_exports__, {
11768
12010
  gJ: () => (/* binding */ terminalControlTokenPath)
11769
12011
  });
11770
12012
 
11771
- // UNUSED EXPORTS: buildClaudeSessionIdArgs, buildClaudeTerminalArgs, buildResumeNativeArgs, cleanupClaudeTerminalHookFiles, collectProcessTreePids, connectTerminalControl, createClaudeTerminalHookFiles, createTerminalModeState, exitCodeFromChildExit, extractInitialSessionId, extractTerminalPromptPreview, formatTerminalControlScreen, hasClaudeContinueArg, hasClaudeResumePickerArg, hasClaudeSettingsArg, monitorTerminalControlUntilChildExit, normalizeTerminalScreenForTty, requestSwitchBackWhenReady, resolveNativeAgentCommand, stopNativeChild, waitForRemoteMonitorInput
12013
+ // UNUSED EXPORTS: buildClaudeSessionIdArgs, buildClaudeTerminalArgs, buildResumeNativeArgs, cleanupClaudeTerminalHookFiles, collectProcessTreePids, connectTerminalControl, createClaudeTerminalHookFiles, createTerminalModeState, exitCodeFromChildExit, extractInitialSessionId, extractTerminalPromptPreview, formatTerminalControlScreen, hasClaudeContinueArg, hasClaudeResumePickerArg, hasClaudeSettingsArg, installTerminalSignalHandlers, monitorTerminalControlUntilChildExit, normalizeTerminalScreenForTty, requestSwitchBackWhenReady, resolveNativeAgentCommand, stopNativeChild, waitForRemoteMonitorInput
11772
12014
 
11773
12015
  // EXTERNAL MODULE: external "node:child_process"
11774
12016
  var external_node_child_process_ = __nccwpck_require__(1421);
@@ -12449,18 +12691,22 @@ function restoreTerminalCursor(stream) {
12449
12691
  if (stream?.isTTY) stream.write(`${ANSI_SHOW_CURSOR}${ANSI_RESET}`);
12450
12692
  }
12451
12693
 
12452
- function installTerminalSignalHandlers(getChild, getMode) {
12694
+ function installTerminalSignalHandlers(
12695
+ getChild,
12696
+ getMode,
12697
+ { processObj = process, sendChildSignal = sendSignal } = {},
12698
+ ) {
12453
12699
  const previous = {
12454
- SIGINT: process.listeners('SIGINT'),
12455
- SIGTERM: process.listeners('SIGTERM'),
12700
+ SIGINT: processObj.listeners('SIGINT'),
12701
+ SIGTERM: processObj.listeners('SIGTERM'),
12456
12702
  };
12457
12703
  let resolveSignalExit;
12458
12704
  const signalExit = new Promise((resolve) => {
12459
12705
  resolveSignalExit = resolve;
12460
12706
  });
12461
12707
 
12462
- process.removeAllListeners('SIGINT');
12463
- process.removeAllListeners('SIGTERM');
12708
+ processObj.removeAllListeners('SIGINT');
12709
+ processObj.removeAllListeners('SIGTERM');
12464
12710
 
12465
12711
  function handleSignal(signal) {
12466
12712
  if (getMode() === 'remoteDaemon') {
@@ -12468,23 +12714,29 @@ function installTerminalSignalHandlers(getChild, getMode) {
12468
12714
  return;
12469
12715
  }
12470
12716
  const child = getChild();
12471
- if (!child) {
12717
+ if (!child?.pid || child.exitCode !== null || child.signalCode !== null) {
12472
12718
  resolveSignalExit(signal === 'SIGINT' ? 130 : 143);
12473
12719
  return;
12474
12720
  }
12475
- sendSignal(child, signal);
12721
+ if (signal === 'SIGINT') {
12722
+ // The inherited native TUI shares this foreground terminal/console and
12723
+ // receives keyboard Ctrl-C directly. Forwarding it here would deliver
12724
+ // the same interrupt twice.
12725
+ return;
12726
+ }
12727
+ sendChildSignal(child, signal);
12476
12728
  }
12477
12729
 
12478
- process.on('SIGINT', () => handleSignal('SIGINT'));
12479
- process.on('SIGTERM', () => handleSignal('SIGTERM'));
12730
+ processObj.on('SIGINT', () => handleSignal('SIGINT'));
12731
+ processObj.on('SIGTERM', () => handleSignal('SIGTERM'));
12480
12732
 
12481
12733
  return {
12482
12734
  signalExit,
12483
12735
  restore() {
12484
- process.removeAllListeners('SIGINT');
12485
- process.removeAllListeners('SIGTERM');
12486
- for (const listener of previous.SIGINT) process.on('SIGINT', listener);
12487
- for (const listener of previous.SIGTERM) process.on('SIGTERM', listener);
12736
+ processObj.removeAllListeners('SIGINT');
12737
+ processObj.removeAllListeners('SIGTERM');
12738
+ for (const listener of previous.SIGINT) processObj.on('SIGINT', listener);
12739
+ for (const listener of previous.SIGTERM) processObj.on('SIGTERM', listener);
12488
12740
  },
12489
12741
  };
12490
12742
  }
@@ -13092,7 +13344,10 @@ async function runManagedNativeTerminal({
13092
13344
  ],
13093
13345
  footerLines: ['Starting now...'],
13094
13346
  });
13095
- await waitMs(SWITCHBACK_RESTORE_NOTICE_MS);
13347
+ const restoreNotice = await waitForRetryOrSignal(signalHandlers.signalExit, SWITCHBACK_RESTORE_NOTICE_MS);
13348
+ if (restoreNotice.type === 'exit') {
13349
+ return restoreNotice.code;
13350
+ }
13096
13351
  nativeArgs = buildResumeNativeArgs(agent, args, sessionId);
13097
13352
  argv = [command, ...nativeArgs];
13098
13353
  }
@@ -13804,7 +14059,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
13804
14059
  /* harmony import */ var node_url__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(3136);
13805
14060
  /* harmony import */ var qrcode__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(7514);
13806
14061
  /* harmony import */ var _vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_14__ = __nccwpck_require__(6927);
13807
- /* harmony import */ var _cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(2517);
14062
+ /* harmony import */ var _cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(2755);
13808
14063
  /* harmony import */ var _vibelet_launchd_mjs__WEBPACK_IMPORTED_MODULE_11__ = __nccwpck_require__(1010);
13809
14064
  /* harmony import */ var _linux_systemd_mjs__WEBPACK_IMPORTED_MODULE_8__ = __nccwpck_require__(4217);
13810
14065
  /* harmony import */ var _vibelet_stop_logic_mjs__WEBPACK_IMPORTED_MODULE_12__ = __nccwpck_require__(6274);
@@ -13848,6 +14103,7 @@ const stderrLogPath = (0,node_path__WEBPACK_IMPORTED_MODULE_4__.join)(logDir, 'd
13848
14103
  const pidFilePath = (0,node_path__WEBPACK_IMPORTED_MODULE_4__.join)(vibeletDir, 'daemon.pid');
13849
14104
  const relayConfigPath = (0,node_path__WEBPACK_IMPORTED_MODULE_4__.join)(vibeletDir, 'relay.json');
13850
14105
  const tunnelStatePath = (0,node_path__WEBPACK_IMPORTED_MODULE_4__.join)(vibeletDir, 'tunnel.json');
14106
+ const cloudflaredUpdateStatePath = (0,node_path__WEBPACK_IMPORTED_MODULE_4__.join)(vibeletDir, 'cloudflared-update.json');
13851
14107
  const updateCheckPath = (0,node_path__WEBPACK_IMPORTED_MODULE_4__.join)(vibeletDir, 'update-check.json');
13852
14108
  const OFFICIAL_SITE_URL = 'https://vibelet.icu';
13853
14109
  const UPDATE_CHECK_INTERVAL_MS = 4 * 60 * 60 * 1000; // 4 hours
@@ -14786,7 +15042,7 @@ function printHelp() {
14786
15042
  process.stdout.write(` # Need a fresh Cloudflare Tunnel URL?\n`);
14787
15043
  process.stdout.write(` npx ${packageJson.name} --access=remote --force\n\n`);
14788
15044
  process.stdout.write(` # Or bring your own tunnel and pass the URL manually:\n`);
14789
- process.stdout.write(` npx cloudflared tunnel --protocol http2 --url http://localhost:${port}\n`);
15045
+ process.stdout.write(` npx cloudflared tunnel --protocol auto --url http://localhost:${port}\n`);
14790
15046
  process.stdout.write(` ngrok http ${port}\n`);
14791
15047
  process.stdout.write(` npx ${packageJson.name} --access=https://<your-tunnel-url>\n\n`);
14792
15048
  process.stdout.write(` # Tailscale (P2P VPN, no tunnel needed)\n`);
@@ -14966,6 +15222,10 @@ async function main() {
14966
15222
  // --remote/--tunnel remain accepted for compatibility, but startup commands
14967
15223
  // now default to managed remote access unless another connection target wins.
14968
15224
  const shouldManageTunnel = startCommand && !localFlag && relayArg === null && !hostArg && !fallbackHostsArg;
15225
+ const cloudflaredProtocol = process.env.VIBELET_CLOUDFLARED_PROTOCOL?.trim() || 'http2';
15226
+ if (!['auto', 'quic', 'http2'].includes(cloudflaredProtocol)) {
15227
+ fail(`Unsupported VIBELET_CLOUDFLARED_PROTOCOL: ${cloudflaredProtocol}. Use auto, quic, or http2.`);
15228
+ }
14969
15229
 
14970
15230
  if (localFlag) {
14971
15231
  process.env.VIBELET_LOCAL_ONLY = '1';
@@ -14982,7 +15242,13 @@ async function main() {
14982
15242
  if (forceFlag) (0,_cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_7__/* .stopTunnel */ .HM)(getTunnelManagerOptions());
14983
15243
  process.stdout.write('Starting Cloudflare Tunnel...\n');
14984
15244
  try {
14985
- const tunnel = await (0,_cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_7__/* .startTunnel */ .DH)({ port, logDir, tunnelStatePath });
15245
+ const tunnel = await (0,_cloudflared_tunnel_manager_mjs__WEBPACK_IMPORTED_MODULE_7__/* .startTunnel */ .DH)({
15246
+ port,
15247
+ logDir,
15248
+ tunnelStatePath,
15249
+ protocol: cloudflaredProtocol,
15250
+ updateStatePath: cloudflaredUpdateStatePath,
15251
+ });
14986
15252
  process.stdout.write(`Tunnel ready: ${tunnel.url}\n`);
14987
15253
  saveRelayConfig(tunnel.url);
14988
15254
  } catch (err) {
@@ -1 +1 @@
1
- import{R as c,M as p,B as x}from"./mermaid-O7DHMXV3-DcLAcT5g.js";import{r,j as d}from"./index-m1lWI7bU.js";var R=({code:i,language:e,raw:t,className:g,startLine:u,...m})=>{let{shikiTheme:o}=r.useContext(c),a=p(),[n,s]=r.useState(t);return r.useEffect(()=>{if(!a){s(t);return}let l=a.highlight({code:i,language:e,themes:o},h=>{s(h)});l&&s(l)},[i,e,o,a,t]),d.jsx(x,{className:g,language:e,result:n,startLine:u,...m})};export{R as HighlightedCodeBlockBody};
1
+ import{R as c,M as p,B as x}from"./mermaid-O7DHMXV3-BA2glr4S.js";import{r,j as d}from"./index-BiSnL70b.js";var R=({code:i,language:e,raw:t,className:g,startLine:u,...m})=>{let{shikiTheme:o}=r.useContext(c),a=p(),[n,s]=r.useState(t);return r.useEffect(()=>{if(!a){s(t);return}let l=a.highlight({code:i,language:e,themes:o},h=>{s(h)});l&&s(l)},[i,e,o,a,t]),d.jsx(x,{className:g,language:e,result:n,startLine:u,...m})};export{R as HighlightedCodeBlockBody};