vibelet 1.2.195 → 1.2.196

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.195"}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.196"}var a=l();process.stdout.write(`${a}
2
2
  `);
package/dist/vibelet.mjs CHANGED
@@ -12369,7 +12369,7 @@ function canUseSystemdUserManager({ spawnSyncImpl = node_child_process__WEBPACK_
12369
12369
 
12370
12370
  /***/ }),
12371
12371
 
12372
- /***/ 1168:
12372
+ /***/ 877:
12373
12373
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
12374
12374
 
12375
12375
 
@@ -12380,7 +12380,7 @@ __nccwpck_require__.d(__webpack_exports__, {
12380
12380
  gJ: () => (/* binding */ terminalControlTokenPath)
12381
12381
  });
12382
12382
 
12383
- // UNUSED EXPORTS: buildClaudeSessionIdArgs, buildClaudeTerminalArgs, buildResumeNativeArgs, cleanupClaudeTerminalHookFiles, collectProcessTreePids, connectTerminalControl, createClaudeTerminalHookFiles, createTerminalModeState, exitCodeFromChildExit, extractInitialSessionId, extractTerminalPromptPreview, formatTerminalControlScreen, hasClaudeContinueArg, hasClaudeResumePickerArg, hasClaudeSettingsArg, installTerminalSignalHandlers, monitorTerminalControlUntilChildExit, normalizeTerminalScreenForTty, requestSwitchBackWhenReady, resolveNativeAgentCommand, stopNativeChild, waitForRemoteMonitorInput
12383
+ // UNUSED EXPORTS: buildClaudeSessionIdArgs, buildClaudeTerminalArgs, buildResumeNativeArgs, captureTerminalLineDiscipline, cleanupClaudeTerminalHookFiles, collectProcessTreePids, connectTerminalControl, createClaudeTerminalHookFiles, createTerminalModeState, exitCodeFromChildExit, extractInitialSessionId, extractTerminalPromptPreview, formatTerminalControlScreen, hasClaudeContinueArg, hasClaudeResumePickerArg, hasClaudeSettingsArg, installTerminalSignalHandlers, monitorTerminalControlUntilChildExit, normalizeTerminalScreenForTty, requestSwitchBackWhenReady, resolveNativeAgentCommand, restoreTerminalAfterNativeTui, stopNativeChild, waitForRemoteMonitorInput
12384
12384
 
12385
12385
  // EXTERNAL MODULE: external "node:child_process"
12386
12386
  var external_node_child_process_ = __nccwpck_require__(1421);
@@ -12543,6 +12543,125 @@ function installTerminalSignalHandlers(
12543
12543
  };
12544
12544
  }
12545
12545
 
12546
+ ;// CONCATENATED MODULE: ./bin/terminal-state.mjs
12547
+
12548
+
12549
+ const ANSI_SHOW_CURSOR = '\x1b[?25h';
12550
+ const ANSI_RESET = '\x1b[0m';
12551
+ const ANSI_RESET_TERMINAL_INPUT_MODES = [
12552
+ '\x1b[?1000l', // X10 mouse reporting
12553
+ '\x1b[?1002l', // button-event mouse reporting
12554
+ '\x1b[?1003l', // any-event mouse reporting
12555
+ '\x1b[?1004l', // focus reporting
12556
+ '\x1b[?1006l', // SGR mouse coordinates
12557
+ '\x1b[?2004l', // bracketed paste
12558
+ '\x1b[<1u', // pop kitty keyboard enhancement flags
12559
+ '\x1b[=0u', // reset kitty keyboard enhancement flags
12560
+ '\x1b[>4;0m', // disable xterm modifyOtherKeys
12561
+ ].join('');
12562
+
12563
+ function captureTerminalLineDiscipline(
12564
+ stdin = process.stdin,
12565
+ { platform = process.platform, execFile = external_node_child_process_.execFileSync } = {},
12566
+ ) {
12567
+ if (platform === 'win32' || !stdin?.isTTY) return null;
12568
+ try {
12569
+ const state = execFile('stty', ['-g'], {
12570
+ encoding: 'utf8',
12571
+ stdio: [Number.isInteger(stdin.fd) ? stdin.fd : 0, 'pipe', 'ignore'],
12572
+ });
12573
+ return String(state).trim() || null;
12574
+ } catch {
12575
+ return null;
12576
+ }
12577
+ }
12578
+
12579
+ function restoreTerminalAfterNativeTui(
12580
+ stream,
12581
+ stdin = process.stdin,
12582
+ lineDiscipline = null,
12583
+ { platform = process.platform, execFile = external_node_child_process_.execFileSync } = {},
12584
+ ) {
12585
+ let restoredLineDiscipline = false;
12586
+ if (platform !== 'win32' && lineDiscipline && stdin?.isTTY) {
12587
+ try {
12588
+ execFile('stty', [lineDiscipline], {
12589
+ stdio: [Number.isInteger(stdin.fd) ? stdin.fd : 0, 'ignore', 'ignore'],
12590
+ });
12591
+ restoredLineDiscipline = true;
12592
+ } catch {
12593
+ // Fall through to Node's portable cooked-mode reset.
12594
+ }
12595
+ }
12596
+ if (!restoredLineDiscipline && stdin?.isTTY && typeof stdin.setRawMode === 'function') {
12597
+ try {
12598
+ stdin.setRawMode(false);
12599
+ } catch {
12600
+ // The controlling terminal may already be detached during shutdown.
12601
+ }
12602
+ }
12603
+ if (stream?.isTTY) {
12604
+ stream.write(`${ANSI_RESET_TERMINAL_INPUT_MODES}${ANSI_SHOW_CURSOR}${ANSI_RESET}`);
12605
+ }
12606
+ }
12607
+
12608
+ function installRemoteMonitorSignalListeners(processObj, finish) {
12609
+ if (!processObj || typeof processObj.once !== 'function') return () => {};
12610
+ const off =
12611
+ typeof processObj.off === 'function'
12612
+ ? processObj.off.bind(processObj)
12613
+ : typeof processObj.removeListener === 'function'
12614
+ ? processObj.removeListener.bind(processObj)
12615
+ : null;
12616
+ const onSigint = () => finish({ type: 'exit', code: 130 });
12617
+ const onSigterm = () => finish({ type: 'exit', code: 143 });
12618
+ processObj.once('SIGINT', onSigint);
12619
+ processObj.once('SIGTERM', onSigterm);
12620
+ return () => {
12621
+ if (!off) return;
12622
+ off('SIGINT', onSigint);
12623
+ off('SIGTERM', onSigterm);
12624
+ };
12625
+ }
12626
+
12627
+ function waitForRemoteMonitorInput(signalExit, stdin = process.stdin, processObj = process) {
12628
+ return new Promise((resolve) => {
12629
+ let settled = false;
12630
+ let cleanupInput = () => {};
12631
+ const cleanupSignals = installRemoteMonitorSignalListeners(processObj, (result) => finish(result));
12632
+ const finish = (result) => {
12633
+ if (settled) return;
12634
+ settled = true;
12635
+ cleanupSignals();
12636
+ cleanupInput();
12637
+ resolve(result);
12638
+ };
12639
+
12640
+ if (stdin.isTTY && typeof stdin.setRawMode === 'function') {
12641
+ const onData = (chunk) => {
12642
+ const text = Buffer.isBuffer(chunk) ? chunk.toString('utf8') : String(chunk);
12643
+ const userInput = text.replaceAll('\x1b[I', '').replaceAll('\x1b[O', '');
12644
+ if (!userInput) return;
12645
+ if (userInput.includes('\u0003')) {
12646
+ finish({ type: 'exit', code: 130 });
12647
+ return;
12648
+ }
12649
+ finish({ type: 'switchBack' });
12650
+ };
12651
+ cleanupInput = () => {
12652
+ stdin.off('data', onData);
12653
+ stdin.setRawMode(false);
12654
+ if (typeof stdin.pause === 'function') stdin.pause();
12655
+ };
12656
+ stdin.setRawMode(true);
12657
+ stdin.resume();
12658
+ stdin.on('data', onData);
12659
+ }
12660
+
12661
+ signalExit.then((code) => finish({ type: 'exit', code }));
12662
+ });
12663
+ }
12664
+
12546
12665
  ;// CONCATENATED MODULE: external "node:crypto"
12547
12666
  const external_node_crypto_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto");
12548
12667
  // EXTERNAL MODULE: external "node:fs"
@@ -12594,6 +12713,8 @@ var websocket_server = __nccwpck_require__(3261);
12594
12713
 
12595
12714
 
12596
12715
 
12716
+
12717
+
12597
12718
  const terminalControlTokenPath = (0,external_node_path_.join)((0,external_node_os_.homedir)(), '.vibelet', 'runtime', 'terminal-control-token');
12598
12719
 
12599
12720
  const terminal_wrapper_TAKEOVER_STOP_TIMEOUT_MS = 3000;
@@ -12604,8 +12725,7 @@ const TERMINAL_CONTROL_RECONNECT_DELAY_MS = 1000;
12604
12725
  const CLAUDE_HOOK_SECRET_HEADER = 'x-vibelet-claude-hook-secret';
12605
12726
  const ANSI_CLEAR_SCREEN = '\x1b[2J\x1b[H';
12606
12727
  const ANSI_HIDE_CURSOR = '\x1b[?25l';
12607
- const ANSI_SHOW_CURSOR = '\x1b[?25h';
12608
- const ANSI_RESET = '\x1b[0m';
12728
+ const terminal_wrapper_ANSI_RESET = '\x1b[0m';
12609
12729
  const ANSI_BOLD = '\x1b[1m';
12610
12730
  const ANSI_CYAN = '\x1b[36m';
12611
12731
  const ANSI_GREEN = '\x1b[32m';
@@ -13022,7 +13142,7 @@ function padRight(text, width) {
13022
13142
 
13023
13143
  function colorize(enabled, style, text) {
13024
13144
  if (!enabled || !style) return text;
13025
- return `${style}${text}${ANSI_RESET}`;
13145
+ return `${style}${text}${terminal_wrapper_ANSI_RESET}`;
13026
13146
  }
13027
13147
 
13028
13148
  function getTerminalControlScreenTone(title) {
@@ -13143,65 +13263,6 @@ function renderTerminalControlScreen(stream, options) {
13143
13263
  stream.write(`\n${screen}`);
13144
13264
  }
13145
13265
 
13146
- function restoreTerminalCursor(stream) {
13147
- if (stream?.isTTY) stream.write(`${ANSI_SHOW_CURSOR}${ANSI_RESET}`);
13148
- }
13149
-
13150
- function installRemoteMonitorSignalListeners(processObj, finish) {
13151
- if (!processObj || typeof processObj.once !== 'function') return () => {};
13152
- const off =
13153
- typeof processObj.off === 'function'
13154
- ? processObj.off.bind(processObj)
13155
- : typeof processObj.removeListener === 'function'
13156
- ? processObj.removeListener.bind(processObj)
13157
- : null;
13158
- const onSigint = () => finish({ type: 'exit', code: 130 });
13159
- const onSigterm = () => finish({ type: 'exit', code: 143 });
13160
- processObj.once('SIGINT', onSigint);
13161
- processObj.once('SIGTERM', onSigterm);
13162
- return () => {
13163
- if (!off) return;
13164
- off('SIGINT', onSigint);
13165
- off('SIGTERM', onSigterm);
13166
- };
13167
- }
13168
-
13169
- function waitForRemoteMonitorInput(signalExit, stdin = process.stdin, processObj = process) {
13170
- return new Promise((resolve) => {
13171
- let settled = false;
13172
- let cleanupInput = () => {};
13173
- const cleanupSignals = installRemoteMonitorSignalListeners(processObj, (result) => finish(result));
13174
- const finish = (result) => {
13175
- if (settled) return;
13176
- settled = true;
13177
- cleanupSignals();
13178
- cleanupInput();
13179
- resolve(result);
13180
- };
13181
-
13182
- if (stdin.isTTY && typeof stdin.setRawMode === 'function') {
13183
- const onData = (chunk) => {
13184
- const text = Buffer.isBuffer(chunk) ? chunk.toString('utf8') : String(chunk);
13185
- if (text.includes('\u0003')) {
13186
- finish({ type: 'exit', code: 130 });
13187
- return;
13188
- }
13189
- finish({ type: 'switchBack' });
13190
- };
13191
- cleanupInput = () => {
13192
- stdin.off('data', onData);
13193
- stdin.setRawMode(false);
13194
- if (typeof stdin.pause === 'function') stdin.pause();
13195
- };
13196
- stdin.setRawMode(true);
13197
- stdin.resume();
13198
- stdin.on('data', onData);
13199
- }
13200
-
13201
- signalExit.then((code) => finish({ type: 'exit', code }));
13202
- });
13203
- }
13204
-
13205
13266
  async function waitForRetryOrSignal(signalExit, delayMs) {
13206
13267
  let timer;
13207
13268
  const retry = new Promise((resolve) => {
@@ -13311,6 +13372,7 @@ async function connectTerminalControl({
13311
13372
  initialSessionId,
13312
13373
  requestedTerminalId,
13313
13374
  taskPreview,
13375
+ terminalLineDiscipline,
13314
13376
  getMode,
13315
13377
  setMode,
13316
13378
  stderr = process.stderr,
@@ -13389,6 +13451,7 @@ async function connectTerminalControl({
13389
13451
  sendResponse(msg.id, false, undefined, 'failed_to_stop_native_terminal');
13390
13452
  return;
13391
13453
  }
13454
+ restoreTerminalAfterNativeTui(stderr, process.stdin, terminalLineDiscipline);
13392
13455
  setMode('remoteDaemon');
13393
13456
  await sendSession('remoteDaemon');
13394
13457
  renderTerminalControlScreen(stderr, {
@@ -13544,6 +13607,7 @@ async function runManagedNativeTerminal({
13544
13607
  }) {
13545
13608
  const command = resolveNativeAgentCommand(agent, env);
13546
13609
  const token = readTerminalControlToken();
13610
+ const terminalLineDiscipline = captureTerminalLineDiscipline();
13547
13611
  let initialSessionId = extractInitialSessionId(agent, args);
13548
13612
  let nativeArgs = args;
13549
13613
  const taskPreview = extractTerminalPromptPreview(agent, args);
@@ -13603,6 +13667,7 @@ async function runManagedNativeTerminal({
13603
13667
  initialSessionId,
13604
13668
  requestedTerminalId: terminalId ?? claudeHookFiles?.terminalId,
13605
13669
  taskPreview,
13670
+ terminalLineDiscipline,
13606
13671
  getMode: () => modeState.getMode(),
13607
13672
  setMode: (nextMode) => modeState.setMode(nextMode),
13608
13673
  stderr,
@@ -13661,7 +13726,7 @@ async function runManagedNativeTerminal({
13661
13726
 
13662
13727
  const monitorAction = await waitForRemoteMonitorInput(signalHandlers.signalExit);
13663
13728
  if (monitorAction.type === 'exit') {
13664
- restoreTerminalCursor(stderr);
13729
+ restoreTerminalAfterNativeTui(stderr, process.stdin, terminalLineDiscipline);
13665
13730
  return monitorAction.code;
13666
13731
  }
13667
13732
 
@@ -13717,7 +13782,7 @@ async function runManagedNativeTerminal({
13717
13782
  },
13718
13783
  });
13719
13784
  if (typeof switchBack.exitCode === 'number') {
13720
- restoreTerminalCursor(stderr);
13785
+ restoreTerminalAfterNativeTui(stderr, process.stdin, terminalLineDiscipline);
13721
13786
  return switchBack.exitCode;
13722
13787
  }
13723
13788
  if (!switchBack.ok) {
@@ -13737,6 +13802,7 @@ async function runManagedNativeTerminal({
13737
13802
  continue;
13738
13803
  }
13739
13804
  modeState.setMode('localNative');
13805
+ restoreTerminalAfterNativeTui(stderr, process.stdin, terminalLineDiscipline);
13740
13806
  renderTerminalControlScreen(stderr, {
13741
13807
  title: 'NATIVE TERMINAL UI STARTING',
13742
13808
  subtitle: 'Vibelet app control has been released',
@@ -13758,7 +13824,7 @@ async function runManagedNativeTerminal({
13758
13824
  argv = [command, ...nativeArgs];
13759
13825
  }
13760
13826
  } finally {
13761
- restoreTerminalCursor(stderr);
13827
+ restoreTerminalAfterNativeTui(stderr, process.stdin, terminalLineDiscipline);
13762
13828
  control?.close();
13763
13829
  signalHandlers?.restore();
13764
13830
  cleanupClaudeTerminalHookFiles(claudeHookFiles);
@@ -14547,9 +14613,25 @@ function createScannablePairingPayload(pairingPayload) {
14547
14613
  c: pairingPayload.pairNonce,
14548
14614
  e: pairingPayload.expiresAt,
14549
14615
  };
14550
- const [primary] = normalizePairingConnections(pairingPayload);
14616
+ const connections = normalizePairingConnections(pairingPayload);
14617
+ const [primary] = connections;
14551
14618
  const needsExplicitTransport =
14552
14619
  primary && (Boolean(primary.tailcat) || (primary.secure === true && primary.port !== 443));
14620
+ const compactFallback = !needsExplicitTransport
14621
+ ? connections
14622
+ .slice(1)
14623
+ .find(
14624
+ (target) =>
14625
+ primary?.secure !== true &&
14626
+ target.kind === 'direct' &&
14627
+ target.secure !== true &&
14628
+ !target.tailcat &&
14629
+ target.port === primary.port,
14630
+ )
14631
+ : undefined;
14632
+ if (compactFallback) {
14633
+ compactPayload.f = [compactFallback.host];
14634
+ }
14553
14635
  if (needsExplicitTransport) {
14554
14636
  const tuple = [
14555
14637
  primary.kind,
@@ -14958,7 +15040,7 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
14958
15040
  /* harmony import */ var _vibelet_help_mjs__WEBPACK_IMPORTED_MODULE_16__ = __nccwpck_require__(4162);
14959
15041
  /* harmony import */ var _vibelet_tailcat_config_mjs__WEBPACK_IMPORTED_MODULE_9__ = __nccwpck_require__(5798);
14960
15042
  /* harmony import */ var _vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_12__ = __nccwpck_require__(4);
14961
- /* harmony import */ var _terminal_wrapper_mjs__WEBPACK_IMPORTED_MODULE_10__ = __nccwpck_require__(1168);
15043
+ /* harmony import */ var _terminal_wrapper_mjs__WEBPACK_IMPORTED_MODULE_10__ = __nccwpck_require__(877);
14962
15044
  /* harmony import */ var _vibelet_pairing_connections_mjs__WEBPACK_IMPORTED_MODULE_15__ = __nccwpck_require__(7721);
14963
15045
  /* harmony import */ var _vibelet_pairing_output_mjs__WEBPACK_IMPORTED_MODULE_11__ = __nccwpck_require__(4021);
14964
15046
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibelet",
3
- "version": "1.2.195",
3
+ "version": "1.2.196",
4
4
  "description": "Cross-platform CLI for installing and running the Vibelet daemon",
5
5
  "homepage": "https://vibelet.icu",
6
6
  "files": [