@lethevimlet/sshift 0.5.0 → 0.9.0
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/README.md +72 -2
- package/example.config.json +20 -0
- package/package.json +2 -1
- package/plugins/claude-attention/index.js +296 -0
- package/plugins/claude-attention/package.json +6 -0
- package/plugins/opencode-attention/index.js +248 -0
- package/plugins/opencode-attention/package.json +6 -0
- package/src/server/index.js +39 -1
- package/src/server/plugins/plugin-manager.js +256 -0
- package/src/server/services/ssh-manager.js +14 -0
- package/src/server/utils/config.js +23 -0
- package/src/webapp/css/style.css +138 -0
- package/src/webapp/js/app.js +177 -9
package/src/webapp/js/app.js
CHANGED
|
@@ -2243,10 +2243,8 @@ class SSHIFTClient {
|
|
|
2243
2243
|
}
|
|
2244
2244
|
|
|
2245
2245
|
// Update mobile detection on resize and re-apply layout if needed
|
|
2246
|
-
let previousIsMobile = this.isMobile;
|
|
2247
2246
|
window.addEventListener('resize', () => {
|
|
2248
|
-
const wasMobile =
|
|
2249
|
-
previousIsMobile = this.isMobile;
|
|
2247
|
+
const wasMobile = this.isMobile;
|
|
2250
2248
|
this.isMobile = window.innerWidth <= 768;
|
|
2251
2249
|
|
|
2252
2250
|
// If we switched between mobile and desktop, re-apply the layout
|
|
@@ -3060,6 +3058,9 @@ class SSHIFTClient {
|
|
|
3060
3058
|
// Update mobile tabs Dropdown after restoration
|
|
3061
3059
|
this.updateMobileTabsDropdown();
|
|
3062
3060
|
|
|
3061
|
+
// Apply any flash states that arrived before DOM elements existed
|
|
3062
|
+
this.applyFlashStates();
|
|
3063
|
+
|
|
3063
3064
|
// Clear restoring flag after restoration is complete
|
|
3064
3065
|
this.isRestoring = false;
|
|
3065
3066
|
}
|
|
@@ -3162,6 +3163,7 @@ class SSHIFTClient {
|
|
|
3162
3163
|
console.log('[SSHIFT] Tab order updated:', data.order);
|
|
3163
3164
|
if (this.sticky) {
|
|
3164
3165
|
this.reorderTabsInDOM(data.order);
|
|
3166
|
+
this.updateMobileTabsDropdown();
|
|
3165
3167
|
}
|
|
3166
3168
|
});
|
|
3167
3169
|
|
|
@@ -3450,6 +3452,21 @@ class SSHIFTClient {
|
|
|
3450
3452
|
rows: session.terminal.rows
|
|
3451
3453
|
});
|
|
3452
3454
|
console.log('[SSHIFT] Resized terminal after becoming controller:', session.terminal.cols, 'x', session.terminal.rows);
|
|
3455
|
+
|
|
3456
|
+
// Delayed refit to handle viewport transitions (e.g. mobile -> desktop)
|
|
3457
|
+
setTimeout(() => {
|
|
3458
|
+
if (session.terminal && session.fitAddon && session.isController) {
|
|
3459
|
+
session.isResyncing = true;
|
|
3460
|
+
this._fitTerminal(session);
|
|
3461
|
+
session.isResyncing = false;
|
|
3462
|
+
this.socket.emit('ssh-resize', {
|
|
3463
|
+
sessionId: data.sessionId,
|
|
3464
|
+
cols: session.terminal.cols,
|
|
3465
|
+
rows: session.terminal.rows
|
|
3466
|
+
});
|
|
3467
|
+
console.log('[SSHIFT] Delayed refit after becoming controller:', session.terminal.cols, 'x', session.terminal.rows);
|
|
3468
|
+
}
|
|
3469
|
+
}, 300);
|
|
3453
3470
|
}
|
|
3454
3471
|
this.showToast('You are now in control (previous controller left)', 'info');
|
|
3455
3472
|
} else if (!session.isController) {
|
|
@@ -3508,6 +3525,22 @@ class SSHIFTClient {
|
|
|
3508
3525
|
});
|
|
3509
3526
|
|
|
3510
3527
|
console.log('[SSHIFT] Resized SSH terminal after taking control:', session.terminal.cols, 'x', session.terminal.rows);
|
|
3528
|
+
|
|
3529
|
+
// Delayed refit to handle viewport transitions (e.g. mobile -> desktop)
|
|
3530
|
+
// The container dimensions may not be final when fit first runs
|
|
3531
|
+
setTimeout(() => {
|
|
3532
|
+
if (session.terminal && session.fitAddon && session.isController) {
|
|
3533
|
+
session.isResyncing = true;
|
|
3534
|
+
this._fitTerminal(session);
|
|
3535
|
+
session.isResyncing = false;
|
|
3536
|
+
this.socket.emit('ssh-resize', {
|
|
3537
|
+
sessionId: data.sessionId,
|
|
3538
|
+
cols: session.terminal.cols,
|
|
3539
|
+
rows: session.terminal.rows
|
|
3540
|
+
});
|
|
3541
|
+
console.log('[SSHIFT] Delayed refit after take control:', session.terminal.cols, 'x', session.terminal.rows);
|
|
3542
|
+
}
|
|
3543
|
+
}, 300);
|
|
3511
3544
|
} catch (e) {
|
|
3512
3545
|
console.warn('[SSHIFT] Error resizing terminal after taking control:', e.message);
|
|
3513
3546
|
session.isResyncing = false;
|
|
@@ -3692,6 +3725,15 @@ class SSHIFTClient {
|
|
|
3692
3725
|
this.renderBookmarks();
|
|
3693
3726
|
}
|
|
3694
3727
|
});
|
|
3728
|
+
|
|
3729
|
+
// Plugin-driven tab flash events
|
|
3730
|
+
this.socket.on('tab-flash', (data) => {
|
|
3731
|
+
this.startTabFlash(data.sessionId, data);
|
|
3732
|
+
});
|
|
3733
|
+
|
|
3734
|
+
this.socket.on('tab-flash-stop', (data) => {
|
|
3735
|
+
this.stopTabFlash(data.sessionId);
|
|
3736
|
+
});
|
|
3695
3737
|
}
|
|
3696
3738
|
|
|
3697
3739
|
// Event Listeners
|
|
@@ -4608,8 +4650,9 @@ class SSHIFTClient {
|
|
|
4608
4650
|
updateMobileTabsDropdown(panelId = null) {
|
|
4609
4651
|
// On mobile, we always show a single dropdown that combines all tabs from all panels
|
|
4610
4652
|
// On desktop with multi-panel, we show separate dropdowns per panel
|
|
4653
|
+
const isMobileView = window.innerWidth <= 768;
|
|
4611
4654
|
|
|
4612
|
-
if (this.isMobile) {
|
|
4655
|
+
if (isMobileView || this.isMobile) {
|
|
4613
4656
|
// Mobile: Single dropdown with all tabs from all panels
|
|
4614
4657
|
const mobileTabsLabel = document.getElementById('mobileTabsLabel');
|
|
4615
4658
|
const mobileTabsMenu = document.getElementById('mobileTabsMenu');
|
|
@@ -4646,6 +4689,9 @@ class SSHIFTClient {
|
|
|
4646
4689
|
const option = document.createElement('div');
|
|
4647
4690
|
option.className = `mobile-tab-option${isActive ? ' active' : ''}`;
|
|
4648
4691
|
option.dataset.sessionId = sessionId;
|
|
4692
|
+
if (this._flashingSessions && this._flashingSessions.has(sessionId)) {
|
|
4693
|
+
option.classList.add('flashing');
|
|
4694
|
+
}
|
|
4649
4695
|
option.innerHTML = `
|
|
4650
4696
|
<i class="fas ${icon} tab-icon ${iconClass}"></i>
|
|
4651
4697
|
<span class="tab-name">${displayName}</span>
|
|
@@ -4693,6 +4739,13 @@ class SSHIFTClient {
|
|
|
4693
4739
|
iconElement.className = `fas ${activeTabIcon} tab-icon-active`;
|
|
4694
4740
|
}
|
|
4695
4741
|
mobileTabsLabel.textContent = activeTabName;
|
|
4742
|
+
|
|
4743
|
+
// Restore flashing state on toggle if any tab is flashing
|
|
4744
|
+
if (this._flashingSessions && this._flashingSessions.size > 0) {
|
|
4745
|
+
mobileTabsToggle.classList.add('flashing');
|
|
4746
|
+
} else {
|
|
4747
|
+
mobileTabsToggle.classList.remove('flashing');
|
|
4748
|
+
}
|
|
4696
4749
|
} else {
|
|
4697
4750
|
// Desktop: Update dropdowns per panel (original behavior)
|
|
4698
4751
|
// If panelId is provided, update only that panel's dropdown
|
|
@@ -4736,6 +4789,9 @@ class SSHIFTClient {
|
|
|
4736
4789
|
const option = document.createElement('div');
|
|
4737
4790
|
option.className = `mobile-tab-option${isActive ? ' active' : ''}`;
|
|
4738
4791
|
option.dataset.sessionId = sessionId;
|
|
4792
|
+
if (this._flashingSessions && this._flashingSessions.has(sessionId)) {
|
|
4793
|
+
option.classList.add('flashing');
|
|
4794
|
+
}
|
|
4739
4795
|
option.innerHTML = `
|
|
4740
4796
|
<i class="fas ${icon} tab-icon ${iconClass}"></i>
|
|
4741
4797
|
<span class="tab-name">${name}</span>
|
|
@@ -4783,6 +4839,15 @@ class SSHIFTClient {
|
|
|
4783
4839
|
iconElement.className = `fas ${activeTabIcon} tab-icon-active`;
|
|
4784
4840
|
}
|
|
4785
4841
|
mobileTabsLabel.textContent = activeTabName;
|
|
4842
|
+
|
|
4843
|
+
// Restore flashing state on toggle if any tab is flashing
|
|
4844
|
+
if (mobileTabsToggle) {
|
|
4845
|
+
if (this._flashingSessions && this._flashingSessions.size > 0) {
|
|
4846
|
+
mobileTabsToggle.classList.add('flashing');
|
|
4847
|
+
} else {
|
|
4848
|
+
mobileTabsToggle.classList.remove('flashing');
|
|
4849
|
+
}
|
|
4850
|
+
}
|
|
4786
4851
|
});
|
|
4787
4852
|
}
|
|
4788
4853
|
}
|
|
@@ -6501,10 +6566,101 @@ class SSHIFTClient {
|
|
|
6501
6566
|
URL.revokeObjectURL(url);
|
|
6502
6567
|
}
|
|
6503
6568
|
|
|
6504
|
-
|
|
6569
|
+
// Tab Management
|
|
6570
|
+
|
|
6571
|
+
startTabFlash(sessionId, options = {}) {
|
|
6572
|
+
const flashingSessions = this._flashingSessions || (this._flashingSessions = new Set());
|
|
6573
|
+
flashingSessions.add(sessionId);
|
|
6574
|
+
|
|
6575
|
+
const tab = document.querySelector(`.tab[data-session-id="${sessionId}"]`);
|
|
6576
|
+
if (tab) {
|
|
6577
|
+
tab.classList.add('flashing');
|
|
6578
|
+
}
|
|
6579
|
+
|
|
6580
|
+
const mobileOption = document.querySelector(`.mobile-tab-option[data-session-id="${sessionId}"]`);
|
|
6581
|
+
if (mobileOption) {
|
|
6582
|
+
mobileOption.classList.add('flashing');
|
|
6583
|
+
}
|
|
6584
|
+
|
|
6585
|
+
const mobileToggle = document.querySelector('.mobile-tabs-toggle');
|
|
6586
|
+
if (mobileToggle) {
|
|
6587
|
+
mobileToggle.classList.add('flashing');
|
|
6588
|
+
}
|
|
6589
|
+
|
|
6590
|
+
if (!this._tabFlashTimers) this._tabFlashTimers = new Map();
|
|
6591
|
+
if (options.duration) {
|
|
6592
|
+
const existing = this._tabFlashTimers.get(sessionId);
|
|
6593
|
+
if (existing) clearTimeout(existing);
|
|
6594
|
+
this._tabFlashTimers.set(sessionId, setTimeout(() => {
|
|
6595
|
+
this.stopTabFlash(sessionId);
|
|
6596
|
+
}, options.duration));
|
|
6597
|
+
}
|
|
6598
|
+
|
|
6599
|
+
// Safety net: schedule a delayed applyFlashStates in case DOM elements
|
|
6600
|
+
// didn't exist yet when this call was made (e.g., during tab sync)
|
|
6601
|
+
if (!this._flashApplyTimer) this._flashApplyTimer = null;
|
|
6602
|
+
clearTimeout(this._flashApplyTimer);
|
|
6603
|
+
this._flashApplyTimer = setTimeout(() => this.applyFlashStates(), 150);
|
|
6604
|
+
}
|
|
6605
|
+
|
|
6606
|
+
stopTabFlash(sessionId) {
|
|
6607
|
+
const flashingSessions = this._flashingSessions;
|
|
6608
|
+
if (flashingSessions) {
|
|
6609
|
+
flashingSessions.delete(sessionId);
|
|
6610
|
+
}
|
|
6611
|
+
|
|
6612
|
+
const tab = document.querySelector(`.tab[data-session-id="${sessionId}"]`);
|
|
6613
|
+
if (tab) {
|
|
6614
|
+
tab.classList.remove('flashing');
|
|
6615
|
+
}
|
|
6616
|
+
|
|
6617
|
+
const mobileOption = document.querySelector(`.mobile-tab-option[data-session-id="${sessionId}"]`);
|
|
6618
|
+
if (mobileOption) {
|
|
6619
|
+
mobileOption.classList.remove('flashing');
|
|
6620
|
+
}
|
|
6621
|
+
|
|
6622
|
+
const mobileToggle = document.querySelector('.mobile-tabs-toggle');
|
|
6623
|
+
if (mobileToggle && (!flashingSessions || flashingSessions.size === 0)) {
|
|
6624
|
+
mobileToggle.classList.remove('flashing');
|
|
6625
|
+
}
|
|
6626
|
+
|
|
6627
|
+
if (this._tabFlashTimers) {
|
|
6628
|
+
const timer = this._tabFlashTimers.get(sessionId);
|
|
6629
|
+
if (timer) {
|
|
6630
|
+
clearTimeout(timer);
|
|
6631
|
+
this._tabFlashTimers.delete(sessionId);
|
|
6632
|
+
}
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
|
|
6636
|
+
applyFlashStates() {
|
|
6637
|
+
const flashingSessions = this._flashingSessions;
|
|
6638
|
+
if (!flashingSessions || flashingSessions.size === 0) return;
|
|
6639
|
+
|
|
6640
|
+
for (const sessionId of flashingSessions) {
|
|
6641
|
+
const tab = document.querySelector(`.tab[data-session-id="${sessionId}"]`);
|
|
6642
|
+
if (tab) {
|
|
6643
|
+
tab.classList.add('flashing');
|
|
6644
|
+
}
|
|
6645
|
+
|
|
6646
|
+
const mobileOption = document.querySelector(`.mobile-tab-option[data-session-id="${sessionId}"]`);
|
|
6647
|
+
if (mobileOption) {
|
|
6648
|
+
mobileOption.classList.add('flashing');
|
|
6649
|
+
}
|
|
6650
|
+
}
|
|
6651
|
+
|
|
6652
|
+
const mobileToggle = document.querySelector('.mobile-tabs-toggle');
|
|
6653
|
+
if (mobileToggle) {
|
|
6654
|
+
mobileToggle.classList.add('flashing');
|
|
6655
|
+
}
|
|
6656
|
+
}
|
|
6657
|
+
|
|
6505
6658
|
switchTab(sessionId, panelId = null) {
|
|
6506
6659
|
console.log('[SSHIFT] switchTab called for session:', sessionId, 'panel:', panelId);
|
|
6507
6660
|
|
|
6661
|
+
// Stop any active flash on this tab since user is viewing it
|
|
6662
|
+
this.stopTabFlash(sessionId);
|
|
6663
|
+
|
|
6508
6664
|
// Determine which panel this session belongs to
|
|
6509
6665
|
if (!panelId) {
|
|
6510
6666
|
panelId = this.getPanelForSession(sessionId);
|
|
@@ -6716,9 +6872,10 @@ class SSHIFTClient {
|
|
|
6716
6872
|
|
|
6717
6873
|
// Update mobile tabs dropdown
|
|
6718
6874
|
this.updateMobileTabsDropdown();
|
|
6875
|
+
|
|
6876
|
+
// Apply any flash states that may have arrived before the tab DOM existed
|
|
6877
|
+
this.applyFlashStates();
|
|
6719
6878
|
}
|
|
6720
|
-
|
|
6721
|
-
// Handle tab closed by another client
|
|
6722
6879
|
handleTabClosed(sessionId) {
|
|
6723
6880
|
// Check if we have this session
|
|
6724
6881
|
const session = this.sessions.get(sessionId) || this.sftpSessions.get(sessionId);
|
|
@@ -6778,8 +6935,16 @@ class SSHIFTClient {
|
|
|
6778
6935
|
}
|
|
6779
6936
|
|
|
6780
6937
|
// Sync tabs from server (called on connect when sticky is enabled)
|
|
6781
|
-
|
|
6782
|
-
|
|
6938
|
+
async syncTabsFromServer(tabs) {
|
|
6939
|
+
// Wait for any in-progress restoration to complete before syncing
|
|
6940
|
+
// This prevents the race condition where restoreTabs starts first,
|
|
6941
|
+
// sets isRestoring=true, and then this function returns early, missing
|
|
6942
|
+
// server tabs that aren't in localStorage
|
|
6943
|
+
let waitCount = 0;
|
|
6944
|
+
while (this.isRestoring && waitCount < 200) {
|
|
6945
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
6946
|
+
waitCount++;
|
|
6947
|
+
}
|
|
6783
6948
|
|
|
6784
6949
|
console.log('[SSHIFT] Syncing tabs from server:', tabs.length);
|
|
6785
6950
|
this.isRestoring = true;
|
|
@@ -6816,6 +6981,9 @@ class SSHIFTClient {
|
|
|
6816
6981
|
// Update mobile tabs dropdown after syncing
|
|
6817
6982
|
this.updateMobileTabsDropdown();
|
|
6818
6983
|
|
|
6984
|
+
// Apply any flash states that arrived before DOM elements existed
|
|
6985
|
+
this.applyFlashStates();
|
|
6986
|
+
|
|
6819
6987
|
this.isRestoring = false;
|
|
6820
6988
|
}
|
|
6821
6989
|
|