vibelet 1.2.75 → 1.2.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/runtime-version.cjs +1 -1
- package/dist/vibelet.mjs +247 -227
- package/package.json +1 -1
package/dist/runtime-version.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var s=require("node:fs"),n=require("node:path"),c="@vibelet/cli";function a(e){try{let r=JSON.parse((0,s.readFileSync)(e,"utf8"));if(r.name===c&&typeof r.version=="string"&&r.version.length>0)return r.version}catch{}return null}function p(){return"1.2.
|
|
1
|
+
var s=require("node:fs"),n=require("node:path"),c="@vibelet/cli";function a(e){try{let r=JSON.parse((0,s.readFileSync)(e,"utf8"));if(r.name===c&&typeof r.version=="string"&&r.version.length>0)return r.version}catch{}return null}function p(){return"1.2.76"}var i=p();process.stdout.write(`${i}
|
|
2
2
|
`);
|
package/dist/vibelet.mjs
CHANGED
|
@@ -6618,6 +6618,237 @@ function describeLaunchctlResult(result) {
|
|
|
6618
6618
|
}
|
|
6619
6619
|
|
|
6620
6620
|
|
|
6621
|
+
/***/ }),
|
|
6622
|
+
|
|
6623
|
+
/***/ 3528:
|
|
6624
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
|
|
6625
|
+
|
|
6626
|
+
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
|
6627
|
+
/* harmony export */ N7: () => (/* binding */ buildPairingDeepLink),
|
|
6628
|
+
/* harmony export */ No: () => (/* binding */ normalizePairingConnections),
|
|
6629
|
+
/* harmony export */ YP: () => (/* binding */ createCompactPairingPayload),
|
|
6630
|
+
/* harmony export */ dE: () => (/* binding */ findUnsafeCleartextHosts),
|
|
6631
|
+
/* harmony export */ uR: () => (/* binding */ formatConnectionSummary)
|
|
6632
|
+
/* harmony export */ });
|
|
6633
|
+
/* unused harmony exports normalizeHostValue, isIpv4Host, isTailscaleHost, isSharedIpv4Host, isLocalNetworkHost, isLoopbackHost, isPlainLocalHostname, isTrustedCleartextHost, parseCommaSeparatedHosts, isQuickTunnelHost, buildLegacyConnection, formatConnectionSourceLabel */
|
|
6634
|
+
function normalizeHostValue(host) {
|
|
6635
|
+
if (typeof host !== 'string') {
|
|
6636
|
+
return '';
|
|
6637
|
+
}
|
|
6638
|
+
return host.trim().replace(/\.$/, '').toLowerCase();
|
|
6639
|
+
}
|
|
6640
|
+
|
|
6641
|
+
function isIpv4Host(host) {
|
|
6642
|
+
const parts = host.split('.');
|
|
6643
|
+
return parts.length === 4 && parts.every((part) => /^\d+$/.test(part) && Number(part) >= 0 && Number(part) <= 255);
|
|
6644
|
+
}
|
|
6645
|
+
|
|
6646
|
+
function isTailscaleHost(host) {
|
|
6647
|
+
if (host.endsWith('.ts.net')) {
|
|
6648
|
+
return true;
|
|
6649
|
+
}
|
|
6650
|
+
return false;
|
|
6651
|
+
}
|
|
6652
|
+
|
|
6653
|
+
function isSharedIpv4Host(host) {
|
|
6654
|
+
if (!isIpv4Host(host)) return false;
|
|
6655
|
+
const [first, second] = host.split('.').map(Number);
|
|
6656
|
+
return first === 100 && second >= 64 && second <= 127;
|
|
6657
|
+
}
|
|
6658
|
+
|
|
6659
|
+
function isLocalNetworkHost(host) {
|
|
6660
|
+
if (host.endsWith('.local')) {
|
|
6661
|
+
return true;
|
|
6662
|
+
}
|
|
6663
|
+
if (!isIpv4Host(host)) {
|
|
6664
|
+
return false;
|
|
6665
|
+
}
|
|
6666
|
+
const [first, second] = host.split('.').map(Number);
|
|
6667
|
+
return first === 10
|
|
6668
|
+
|| (first === 172 && second >= 16 && second <= 31)
|
|
6669
|
+
|| (first === 192 && second === 168);
|
|
6670
|
+
}
|
|
6671
|
+
|
|
6672
|
+
function isLoopbackHost(host) {
|
|
6673
|
+
return host === 'localhost'
|
|
6674
|
+
|| host === '127.0.0.1'
|
|
6675
|
+
|| host === '::1'
|
|
6676
|
+
|| host === '::ffff:127.0.0.1';
|
|
6677
|
+
}
|
|
6678
|
+
|
|
6679
|
+
function isPlainLocalHostname(host) {
|
|
6680
|
+
return Boolean(host) && !host.includes('.') && !host.includes(':');
|
|
6681
|
+
}
|
|
6682
|
+
|
|
6683
|
+
function isTrustedCleartextHost(host) {
|
|
6684
|
+
const normalized = normalizeHostValue(host.replace(/^https?:\/\//, '').replace(/\/.*$/, ''));
|
|
6685
|
+
return isLoopbackHost(normalized)
|
|
6686
|
+
|| isLocalNetworkHost(normalized)
|
|
6687
|
+
|| isTailscaleHost(normalized)
|
|
6688
|
+
|| isSharedIpv4Host(normalized)
|
|
6689
|
+
|| isPlainLocalHostname(normalized);
|
|
6690
|
+
}
|
|
6691
|
+
|
|
6692
|
+
function parseCommaSeparatedHosts(rawValue) {
|
|
6693
|
+
return typeof rawValue === 'string'
|
|
6694
|
+
? rawValue.split(',').map((entry) => normalizeHostValue(entry)).filter(Boolean)
|
|
6695
|
+
: [];
|
|
6696
|
+
}
|
|
6697
|
+
|
|
6698
|
+
function findUnsafeCleartextHosts({ hostArg, fallbackHostsArg }) {
|
|
6699
|
+
return [
|
|
6700
|
+
...(hostArg ? [normalizeHostValue(hostArg)] : []),
|
|
6701
|
+
...parseCommaSeparatedHosts(fallbackHostsArg),
|
|
6702
|
+
].filter((host) => host && !isTrustedCleartextHost(host));
|
|
6703
|
+
}
|
|
6704
|
+
|
|
6705
|
+
function isQuickTunnelHost(host) {
|
|
6706
|
+
return host.endsWith('.trycloudflare.com');
|
|
6707
|
+
}
|
|
6708
|
+
|
|
6709
|
+
function buildLegacyConnection(host, port, isPrimary) {
|
|
6710
|
+
if (isQuickTunnelHost(host)) {
|
|
6711
|
+
return {
|
|
6712
|
+
kind: 'relay',
|
|
6713
|
+
host,
|
|
6714
|
+
port,
|
|
6715
|
+
source: 'quick_tunnel',
|
|
6716
|
+
stability: 'ephemeral',
|
|
6717
|
+
};
|
|
6718
|
+
}
|
|
6719
|
+
if (isTailscaleHost(host)) {
|
|
6720
|
+
return {
|
|
6721
|
+
kind: 'direct',
|
|
6722
|
+
host,
|
|
6723
|
+
port,
|
|
6724
|
+
source: 'tailscale',
|
|
6725
|
+
stability: 'stable',
|
|
6726
|
+
};
|
|
6727
|
+
}
|
|
6728
|
+
if (isLocalNetworkHost(host)) {
|
|
6729
|
+
return {
|
|
6730
|
+
kind: 'direct',
|
|
6731
|
+
host,
|
|
6732
|
+
port,
|
|
6733
|
+
source: 'local_network',
|
|
6734
|
+
stability: 'stable',
|
|
6735
|
+
};
|
|
6736
|
+
}
|
|
6737
|
+
return {
|
|
6738
|
+
kind: 'direct',
|
|
6739
|
+
host,
|
|
6740
|
+
port,
|
|
6741
|
+
source: isPrimary ? 'configured_host' : 'fallback',
|
|
6742
|
+
stability: 'stable',
|
|
6743
|
+
};
|
|
6744
|
+
}
|
|
6745
|
+
|
|
6746
|
+
function normalizePairingConnections(pairingPayload) {
|
|
6747
|
+
const explicitConnections = Array.isArray(pairingPayload.connections)
|
|
6748
|
+
? pairingPayload.connections
|
|
6749
|
+
.filter((target) => (
|
|
6750
|
+
target
|
|
6751
|
+
&& typeof target.host === 'string'
|
|
6752
|
+
&& Number.isFinite(target.port)
|
|
6753
|
+
&& typeof target.source === 'string'
|
|
6754
|
+
&& typeof target.stability === 'string'
|
|
6755
|
+
))
|
|
6756
|
+
.map((target) => ({
|
|
6757
|
+
kind: target.kind === 'relay' ? 'relay' : 'direct',
|
|
6758
|
+
host: normalizeHostValue(target.host),
|
|
6759
|
+
port: Math.floor(Number(target.port)),
|
|
6760
|
+
...(target.secure === true ? { secure: true } : {}),
|
|
6761
|
+
source: target.source,
|
|
6762
|
+
stability: target.stability,
|
|
6763
|
+
}))
|
|
6764
|
+
.filter((target) => target.host && target.port > 0)
|
|
6765
|
+
: [];
|
|
6766
|
+
|
|
6767
|
+
const dedupe = (targets) => {
|
|
6768
|
+
const seen = new Set();
|
|
6769
|
+
return targets.filter((target) => {
|
|
6770
|
+
const key = `${target.host}:${target.port}:${target.secure === true ? 'secure' : 'plain'}`;
|
|
6771
|
+
if (seen.has(key)) {
|
|
6772
|
+
return false;
|
|
6773
|
+
}
|
|
6774
|
+
seen.add(key);
|
|
6775
|
+
return true;
|
|
6776
|
+
});
|
|
6777
|
+
};
|
|
6778
|
+
|
|
6779
|
+
if (explicitConnections.length > 0) {
|
|
6780
|
+
return dedupe(explicitConnections);
|
|
6781
|
+
}
|
|
6782
|
+
|
|
6783
|
+
const canonicalHost = normalizeHostValue(pairingPayload.canonicalHost) || 'localhost';
|
|
6784
|
+
const port = Number.isFinite(pairingPayload.port) && pairingPayload.port > 0
|
|
6785
|
+
? Math.floor(Number(pairingPayload.port))
|
|
6786
|
+
: 9876;
|
|
6787
|
+
const fallbackHosts = Array.isArray(pairingPayload.fallbackHosts)
|
|
6788
|
+
? pairingPayload.fallbackHosts
|
|
6789
|
+
.map((host) => normalizeHostValue(host))
|
|
6790
|
+
.filter((host) => host && host !== canonicalHost)
|
|
6791
|
+
: [];
|
|
6792
|
+
|
|
6793
|
+
return dedupe([
|
|
6794
|
+
buildLegacyConnection(canonicalHost, port, true),
|
|
6795
|
+
...fallbackHosts.map((host) => buildLegacyConnection(host, port, false)),
|
|
6796
|
+
]);
|
|
6797
|
+
}
|
|
6798
|
+
|
|
6799
|
+
function createCompactPairingPayload(pairingPayload) {
|
|
6800
|
+
const connections = normalizePairingConnections(pairingPayload);
|
|
6801
|
+
const compactPayload = {
|
|
6802
|
+
t: 'vp',
|
|
6803
|
+
d: pairingPayload.daemonId,
|
|
6804
|
+
n: pairingPayload.displayName,
|
|
6805
|
+
h: pairingPayload.canonicalHost,
|
|
6806
|
+
p: pairingPayload.port,
|
|
6807
|
+
c: pairingPayload.pairNonce,
|
|
6808
|
+
e: pairingPayload.expiresAt,
|
|
6809
|
+
};
|
|
6810
|
+
if (pairingPayload.fallbackHosts) compactPayload.f = pairingPayload.fallbackHosts;
|
|
6811
|
+
if (connections.length > 0) {
|
|
6812
|
+
compactPayload.o = connections.map((target) => [
|
|
6813
|
+
target.kind,
|
|
6814
|
+
target.host,
|
|
6815
|
+
target.port,
|
|
6816
|
+
target.source,
|
|
6817
|
+
target.stability,
|
|
6818
|
+
target.secure === true,
|
|
6819
|
+
]);
|
|
6820
|
+
}
|
|
6821
|
+
return compactPayload;
|
|
6822
|
+
}
|
|
6823
|
+
|
|
6824
|
+
function formatConnectionSourceLabel(source) {
|
|
6825
|
+
switch (source) {
|
|
6826
|
+
case 'configured_relay':
|
|
6827
|
+
return 'Custom Relay';
|
|
6828
|
+
case 'quick_tunnel':
|
|
6829
|
+
return 'Quick Tunnel';
|
|
6830
|
+
case 'configured_host':
|
|
6831
|
+
return 'Manual Host';
|
|
6832
|
+
case 'tailscale':
|
|
6833
|
+
return 'Tailscale';
|
|
6834
|
+
case 'local_network':
|
|
6835
|
+
return 'LAN';
|
|
6836
|
+
case 'fallback':
|
|
6837
|
+
default:
|
|
6838
|
+
return 'Fallback';
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
|
|
6842
|
+
function formatConnectionSummary(target) {
|
|
6843
|
+
const stabilityLabel = target.stability === 'ephemeral' ? 'ephemeral' : 'stable';
|
|
6844
|
+
return `${target.host}:${target.port} [${formatConnectionSourceLabel(target.source)}, ${stabilityLabel}]`;
|
|
6845
|
+
}
|
|
6846
|
+
|
|
6847
|
+
function buildPairingDeepLink(pairingPayloadText) {
|
|
6848
|
+
return `vibelet://pair?data=${encodeURIComponent(pairingPayloadText)}`;
|
|
6849
|
+
}
|
|
6850
|
+
|
|
6851
|
+
|
|
6621
6852
|
/***/ }),
|
|
6622
6853
|
|
|
6623
6854
|
/***/ 6067:
|
|
@@ -6795,13 +7026,15 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
|
|
|
6795
7026
|
/* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(6760);
|
|
6796
7027
|
/* harmony import */ var node_url__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(3136);
|
|
6797
7028
|
/* harmony import */ var qrcode__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(1302);
|
|
6798
|
-
/* harmony import */ var
|
|
6799
|
-
/* harmony import */ var
|
|
7029
|
+
/* harmony import */ var _vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__ = __nccwpck_require__(3428);
|
|
7030
|
+
/* harmony import */ var _cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_13__ = __nccwpck_require__(1932);
|
|
6800
7031
|
/* harmony import */ var _cloudflared_resolver_mjs__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(3006);
|
|
6801
7032
|
/* harmony import */ var _vibelet_launchd_mjs__WEBPACK_IMPORTED_MODULE_9__ = __nccwpck_require__(2927);
|
|
6802
7033
|
/* harmony import */ var _linux_systemd_mjs__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(5400);
|
|
6803
7034
|
/* harmony import */ var _vibelet_stop_logic_mjs__WEBPACK_IMPORTED_MODULE_10__ = __nccwpck_require__(9917);
|
|
6804
7035
|
/* harmony import */ var _vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_8__ = __nccwpck_require__(6067);
|
|
7036
|
+
/* harmony import */ var _vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_11__ = __nccwpck_require__(3528);
|
|
7037
|
+
|
|
6805
7038
|
|
|
6806
7039
|
|
|
6807
7040
|
|
|
@@ -7590,100 +7823,8 @@ async function stopRunningDaemon(backend) {
|
|
|
7590
7823
|
}
|
|
7591
7824
|
}
|
|
7592
7825
|
|
|
7593
|
-
function createCompactPairingPayload(pairingPayload) {
|
|
7594
|
-
const connections = normalizePairingConnections(pairingPayload);
|
|
7595
|
-
const compactPayload = {
|
|
7596
|
-
t: 'vp',
|
|
7597
|
-
d: pairingPayload.daemonId,
|
|
7598
|
-
n: pairingPayload.displayName,
|
|
7599
|
-
h: pairingPayload.canonicalHost,
|
|
7600
|
-
p: pairingPayload.port,
|
|
7601
|
-
c: pairingPayload.pairNonce,
|
|
7602
|
-
e: pairingPayload.expiresAt,
|
|
7603
|
-
};
|
|
7604
|
-
if (pairingPayload.fallbackHosts) compactPayload.f = pairingPayload.fallbackHosts;
|
|
7605
|
-
if (connections.length > 0) {
|
|
7606
|
-
compactPayload.o = connections.map((target) => [
|
|
7607
|
-
target.kind,
|
|
7608
|
-
target.host,
|
|
7609
|
-
target.port,
|
|
7610
|
-
target.source,
|
|
7611
|
-
target.stability,
|
|
7612
|
-
target.secure === true,
|
|
7613
|
-
]);
|
|
7614
|
-
}
|
|
7615
|
-
return compactPayload;
|
|
7616
|
-
}
|
|
7617
|
-
|
|
7618
|
-
function normalizeHostValue(host) {
|
|
7619
|
-
if (typeof host !== 'string') {
|
|
7620
|
-
return '';
|
|
7621
|
-
}
|
|
7622
|
-
return host.trim().replace(/\.$/, '').toLowerCase();
|
|
7623
|
-
}
|
|
7624
|
-
|
|
7625
|
-
function isIpv4Host(host) {
|
|
7626
|
-
const parts = host.split('.');
|
|
7627
|
-
return parts.length === 4 && parts.every((part) => /^\d+$/.test(part) && Number(part) >= 0 && Number(part) <= 255);
|
|
7628
|
-
}
|
|
7629
|
-
|
|
7630
|
-
function isTailscaleHost(host) {
|
|
7631
|
-
if (host.endsWith('.ts.net')) {
|
|
7632
|
-
return true;
|
|
7633
|
-
}
|
|
7634
|
-
return false;
|
|
7635
|
-
}
|
|
7636
|
-
|
|
7637
|
-
function isSharedIpv4Host(host) {
|
|
7638
|
-
if (!isIpv4Host(host)) return false;
|
|
7639
|
-
const [first, second] = host.split('.').map(Number);
|
|
7640
|
-
return first === 100 && second >= 64 && second <= 127;
|
|
7641
|
-
}
|
|
7642
|
-
|
|
7643
|
-
function isLocalNetworkHost(host) {
|
|
7644
|
-
if (host.endsWith('.local')) {
|
|
7645
|
-
return true;
|
|
7646
|
-
}
|
|
7647
|
-
if (!isIpv4Host(host)) {
|
|
7648
|
-
return false;
|
|
7649
|
-
}
|
|
7650
|
-
const [first, second] = host.split('.').map(Number);
|
|
7651
|
-
return first === 10
|
|
7652
|
-
|| (first === 172 && second >= 16 && second <= 31)
|
|
7653
|
-
|| (first === 192 && second === 168);
|
|
7654
|
-
}
|
|
7655
|
-
|
|
7656
|
-
function isLoopbackHost(host) {
|
|
7657
|
-
return host === 'localhost'
|
|
7658
|
-
|| host === '127.0.0.1'
|
|
7659
|
-
|| host === '::1'
|
|
7660
|
-
|| host === '::ffff:127.0.0.1';
|
|
7661
|
-
}
|
|
7662
|
-
|
|
7663
|
-
function isPlainLocalHostname(host) {
|
|
7664
|
-
return Boolean(host) && !host.includes('.') && !host.includes(':');
|
|
7665
|
-
}
|
|
7666
|
-
|
|
7667
|
-
function isTrustedCleartextHost(host) {
|
|
7668
|
-
const normalized = normalizeHostValue(host.replace(/^https?:\/\//, '').replace(/\/.*$/, ''));
|
|
7669
|
-
return isLoopbackHost(normalized)
|
|
7670
|
-
|| isLocalNetworkHost(normalized)
|
|
7671
|
-
|| isTailscaleHost(normalized)
|
|
7672
|
-
|| isSharedIpv4Host(normalized)
|
|
7673
|
-
|| isPlainLocalHostname(normalized);
|
|
7674
|
-
}
|
|
7675
|
-
|
|
7676
|
-
function parseCommaSeparatedHosts(rawValue) {
|
|
7677
|
-
return typeof rawValue === 'string'
|
|
7678
|
-
? rawValue.split(',').map((entry) => normalizeHostValue(entry)).filter(Boolean)
|
|
7679
|
-
: [];
|
|
7680
|
-
}
|
|
7681
|
-
|
|
7682
7826
|
function validateExplicitCleartextHosts({ hostArg, fallbackHostsArg }) {
|
|
7683
|
-
const unsafeHosts =
|
|
7684
|
-
...(hostArg ? [normalizeHostValue(hostArg)] : []),
|
|
7685
|
-
...parseCommaSeparatedHosts(fallbackHostsArg),
|
|
7686
|
-
].filter((host) => host && !isTrustedCleartextHost(host));
|
|
7827
|
+
const unsafeHosts = (0,_vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_11__/* .findUnsafeCleartextHosts */ .dE)({ hostArg, fallbackHostsArg });
|
|
7687
7828
|
if (unsafeHosts.length === 0) {
|
|
7688
7829
|
return;
|
|
7689
7830
|
}
|
|
@@ -7692,130 +7833,9 @@ function validateExplicitCleartextHosts({ hostArg, fallbackHostsArg }) {
|
|
|
7692
7833
|
);
|
|
7693
7834
|
}
|
|
7694
7835
|
|
|
7695
|
-
function isQuickTunnelHost(host) {
|
|
7696
|
-
return host.endsWith('.trycloudflare.com');
|
|
7697
|
-
}
|
|
7698
|
-
|
|
7699
|
-
function buildLegacyConnection(host, port, isPrimary) {
|
|
7700
|
-
if (isQuickTunnelHost(host)) {
|
|
7701
|
-
return {
|
|
7702
|
-
kind: 'relay',
|
|
7703
|
-
host,
|
|
7704
|
-
port,
|
|
7705
|
-
source: 'quick_tunnel',
|
|
7706
|
-
stability: 'ephemeral',
|
|
7707
|
-
};
|
|
7708
|
-
}
|
|
7709
|
-
if (isTailscaleHost(host)) {
|
|
7710
|
-
return {
|
|
7711
|
-
kind: 'direct',
|
|
7712
|
-
host,
|
|
7713
|
-
port,
|
|
7714
|
-
source: 'tailscale',
|
|
7715
|
-
stability: 'stable',
|
|
7716
|
-
};
|
|
7717
|
-
}
|
|
7718
|
-
if (isLocalNetworkHost(host)) {
|
|
7719
|
-
return {
|
|
7720
|
-
kind: 'direct',
|
|
7721
|
-
host,
|
|
7722
|
-
port,
|
|
7723
|
-
source: 'local_network',
|
|
7724
|
-
stability: 'stable',
|
|
7725
|
-
};
|
|
7726
|
-
}
|
|
7727
|
-
return {
|
|
7728
|
-
kind: 'direct',
|
|
7729
|
-
host,
|
|
7730
|
-
port,
|
|
7731
|
-
source: isPrimary ? 'configured_host' : 'fallback',
|
|
7732
|
-
stability: 'stable',
|
|
7733
|
-
};
|
|
7734
|
-
}
|
|
7735
|
-
|
|
7736
|
-
function normalizePairingConnections(pairingPayload) {
|
|
7737
|
-
const explicitConnections = Array.isArray(pairingPayload.connections)
|
|
7738
|
-
? pairingPayload.connections
|
|
7739
|
-
.filter((target) => (
|
|
7740
|
-
target
|
|
7741
|
-
&& typeof target.host === 'string'
|
|
7742
|
-
&& Number.isFinite(target.port)
|
|
7743
|
-
&& typeof target.source === 'string'
|
|
7744
|
-
&& typeof target.stability === 'string'
|
|
7745
|
-
))
|
|
7746
|
-
.map((target) => ({
|
|
7747
|
-
kind: target.kind === 'relay' ? 'relay' : 'direct',
|
|
7748
|
-
host: normalizeHostValue(target.host),
|
|
7749
|
-
port: Math.floor(Number(target.port)),
|
|
7750
|
-
...(target.secure === true ? { secure: true } : {}),
|
|
7751
|
-
source: target.source,
|
|
7752
|
-
stability: target.stability,
|
|
7753
|
-
}))
|
|
7754
|
-
.filter((target) => target.host && target.port > 0)
|
|
7755
|
-
: [];
|
|
7756
|
-
|
|
7757
|
-
const dedupe = (targets) => {
|
|
7758
|
-
const seen = new Set();
|
|
7759
|
-
return targets.filter((target) => {
|
|
7760
|
-
const key = `${target.host}:${target.port}:${target.secure === true ? 'secure' : 'plain'}`;
|
|
7761
|
-
if (seen.has(key)) {
|
|
7762
|
-
return false;
|
|
7763
|
-
}
|
|
7764
|
-
seen.add(key);
|
|
7765
|
-
return true;
|
|
7766
|
-
});
|
|
7767
|
-
};
|
|
7768
|
-
|
|
7769
|
-
if (explicitConnections.length > 0) {
|
|
7770
|
-
return dedupe(explicitConnections);
|
|
7771
|
-
}
|
|
7772
|
-
|
|
7773
|
-
const canonicalHost = normalizeHostValue(pairingPayload.canonicalHost) || 'localhost';
|
|
7774
|
-
const port = Number.isFinite(pairingPayload.port) && pairingPayload.port > 0
|
|
7775
|
-
? Math.floor(Number(pairingPayload.port))
|
|
7776
|
-
: 9876;
|
|
7777
|
-
const fallbackHosts = Array.isArray(pairingPayload.fallbackHosts)
|
|
7778
|
-
? pairingPayload.fallbackHosts
|
|
7779
|
-
.map((host) => normalizeHostValue(host))
|
|
7780
|
-
.filter((host) => host && host !== canonicalHost)
|
|
7781
|
-
: [];
|
|
7782
|
-
|
|
7783
|
-
return dedupe([
|
|
7784
|
-
buildLegacyConnection(canonicalHost, port, true),
|
|
7785
|
-
...fallbackHosts.map((host) => buildLegacyConnection(host, port, false)),
|
|
7786
|
-
]);
|
|
7787
|
-
}
|
|
7788
|
-
|
|
7789
|
-
function formatConnectionSourceLabel(source) {
|
|
7790
|
-
switch (source) {
|
|
7791
|
-
case 'configured_relay':
|
|
7792
|
-
return 'Custom Relay';
|
|
7793
|
-
case 'quick_tunnel':
|
|
7794
|
-
return 'Quick Tunnel';
|
|
7795
|
-
case 'configured_host':
|
|
7796
|
-
return 'Manual Host';
|
|
7797
|
-
case 'tailscale':
|
|
7798
|
-
return 'Tailscale';
|
|
7799
|
-
case 'local_network':
|
|
7800
|
-
return 'LAN';
|
|
7801
|
-
case 'fallback':
|
|
7802
|
-
default:
|
|
7803
|
-
return 'Fallback';
|
|
7804
|
-
}
|
|
7805
|
-
}
|
|
7806
|
-
|
|
7807
|
-
function formatConnectionSummary(target) {
|
|
7808
|
-
const stabilityLabel = target.stability === 'ephemeral' ? 'ephemeral' : 'stable';
|
|
7809
|
-
return `${target.host}:${target.port} [${formatConnectionSourceLabel(target.source)}, ${stabilityLabel}]`;
|
|
7810
|
-
}
|
|
7811
|
-
|
|
7812
|
-
function buildPairingDeepLink(pairingPayloadText) {
|
|
7813
|
-
return `vibelet://pair?data=${encodeURIComponent(pairingPayloadText)}`;
|
|
7814
|
-
}
|
|
7815
|
-
|
|
7816
7836
|
async function printPairingQr(pairingPayload) {
|
|
7817
|
-
const payload = JSON.stringify(createCompactPairingPayload(pairingPayload));
|
|
7818
|
-
const deepLink = buildPairingDeepLink(payload);
|
|
7837
|
+
const payload = JSON.stringify((0,_vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_11__/* .createCompactPairingPayload */ .YP)(pairingPayload));
|
|
7838
|
+
const deepLink = (0,_vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_11__/* .buildPairingDeepLink */ .N7)(payload);
|
|
7819
7839
|
(0,node_fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync)(vibeletDir, { recursive: true });
|
|
7820
7840
|
await qrcode__WEBPACK_IMPORTED_MODULE_5__.toFile(pairingQrPngPath, payload, {
|
|
7821
7841
|
type: 'png',
|
|
@@ -7841,7 +7861,7 @@ async function printPairingQr(pairingPayload) {
|
|
|
7841
7861
|
async function printPairingSummary(existingHealth = null) {
|
|
7842
7862
|
const health = existingHealth ?? await waitForHealth();
|
|
7843
7863
|
const pairingPayload = await postJson('/pair/open');
|
|
7844
|
-
const connections = normalizePairingConnections(pairingPayload);
|
|
7864
|
+
const connections = (0,_vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_11__/* .normalizePairingConnections */ .No)(pairingPayload);
|
|
7845
7865
|
const [preferredConnection, ...otherConnections] = connections;
|
|
7846
7866
|
|
|
7847
7867
|
process.stdout.write(`Vibelet daemon is ready.\n\n`);
|
|
@@ -7850,12 +7870,12 @@ async function printPairingSummary(existingHealth = null) {
|
|
|
7850
7870
|
process.stdout.write(`Host: ${pairingPayload.canonicalHost}\n`);
|
|
7851
7871
|
process.stdout.write(`Port: ${pairingPayload.port}\n`);
|
|
7852
7872
|
if (preferredConnection) {
|
|
7853
|
-
process.stdout.write(`Preferred path: ${formatConnectionSummary(preferredConnection)}\n`);
|
|
7873
|
+
process.stdout.write(`Preferred path: ${(0,_vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_11__/* .formatConnectionSummary */ .uR)(preferredConnection)}\n`);
|
|
7854
7874
|
}
|
|
7855
7875
|
if (otherConnections.length > 0) {
|
|
7856
7876
|
process.stdout.write(`Other paths:\n`);
|
|
7857
7877
|
otherConnections.forEach((target) => {
|
|
7858
|
-
process.stdout.write(` - ${formatConnectionSummary(target)}\n`);
|
|
7878
|
+
process.stdout.write(` - ${(0,_vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_11__/* .formatConnectionSummary */ .uR)(target)}\n`);
|
|
7859
7879
|
});
|
|
7860
7880
|
}
|
|
7861
7881
|
process.stdout.write(`Paired devices: ${health.pairedDevices}\n`);
|
|
@@ -7903,7 +7923,7 @@ function printHelp() {
|
|
|
7903
7923
|
}
|
|
7904
7924
|
|
|
7905
7925
|
function parseNamedArg(name, errorHint) {
|
|
7906
|
-
return (0,
|
|
7926
|
+
return (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .parseNamedArg */ .nE)(process.argv, name, errorHint, fail);
|
|
7907
7927
|
}
|
|
7908
7928
|
|
|
7909
7929
|
function parseRelayArg() {
|
|
@@ -8056,7 +8076,7 @@ function startTunnel() {
|
|
|
8056
8076
|
const poll = setInterval(() => {
|
|
8057
8077
|
try {
|
|
8058
8078
|
const content = (0,node_fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync)(logPath, 'utf8');
|
|
8059
|
-
const tunnelUrl = (0,
|
|
8079
|
+
const tunnelUrl = (0,_cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_13__/* .extractQuickTunnelUrl */ .k)(content);
|
|
8060
8080
|
if (tunnelUrl) {
|
|
8061
8081
|
url = tunnelUrl;
|
|
8062
8082
|
saveTunnelState(pid, url);
|
|
@@ -8078,7 +8098,7 @@ function startTunnel() {
|
|
|
8078
8098
|
childExited = true;
|
|
8079
8099
|
if (!url) {
|
|
8080
8100
|
const content = readCloudflaredLog(logPath);
|
|
8081
|
-
const tunnelUrl = (0,
|
|
8101
|
+
const tunnelUrl = (0,_cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_13__/* .extractQuickTunnelUrl */ .k)(content);
|
|
8082
8102
|
if (tunnelUrl) {
|
|
8083
8103
|
url = tunnelUrl;
|
|
8084
8104
|
saveTunnelState(pid, url);
|
|
@@ -8117,9 +8137,9 @@ async function main() {
|
|
|
8117
8137
|
process.env.VIBE_PORT = String(portArg);
|
|
8118
8138
|
}
|
|
8119
8139
|
|
|
8120
|
-
(0,
|
|
8121
|
-
const localFlag = (0,
|
|
8122
|
-
const forceFlag = (0,
|
|
8140
|
+
(0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .consumeFlag */ .PC)(process.argv, 'remote') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .consumeFlag */ .PC)(process.argv, 'tunnel') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .readNpmConfigFlag */ .AW)('remote') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .readNpmConfigFlag */ .AW)('tunnel');
|
|
8141
|
+
const localFlag = (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .consumeFlag */ .PC)(process.argv, 'local') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .readNpmConfigFlag */ .AW)('local') || isTruthyEnvFlag(process.env.VIBELET_LOCAL_ONLY);
|
|
8142
|
+
const forceFlag = (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .consumeFlag */ .PC)(process.argv, 'force') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_12__/* .readNpmConfigFlag */ .AW)('force');
|
|
8123
8143
|
const relayArg = parseRelayArg();
|
|
8124
8144
|
const hostArg = parseNamedArg('host', '100.x.x.x');
|
|
8125
8145
|
const fallbackHostsArg = parseNamedArg('fallback-hosts', '100.x.x.x,192.168.1.x');
|