@lethevimlet/sshift 0.6.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 +143 -5
package/src/webapp/js/app.js
CHANGED
|
@@ -3058,6 +3058,9 @@ class SSHIFTClient {
|
|
|
3058
3058
|
// Update mobile tabs Dropdown after restoration
|
|
3059
3059
|
this.updateMobileTabsDropdown();
|
|
3060
3060
|
|
|
3061
|
+
// Apply any flash states that arrived before DOM elements existed
|
|
3062
|
+
this.applyFlashStates();
|
|
3063
|
+
|
|
3061
3064
|
// Clear restoring flag after restoration is complete
|
|
3062
3065
|
this.isRestoring = false;
|
|
3063
3066
|
}
|
|
@@ -3160,6 +3163,7 @@ class SSHIFTClient {
|
|
|
3160
3163
|
console.log('[SSHIFT] Tab order updated:', data.order);
|
|
3161
3164
|
if (this.sticky) {
|
|
3162
3165
|
this.reorderTabsInDOM(data.order);
|
|
3166
|
+
this.updateMobileTabsDropdown();
|
|
3163
3167
|
}
|
|
3164
3168
|
});
|
|
3165
3169
|
|
|
@@ -3721,6 +3725,15 @@ class SSHIFTClient {
|
|
|
3721
3725
|
this.renderBookmarks();
|
|
3722
3726
|
}
|
|
3723
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
|
+
});
|
|
3724
3737
|
}
|
|
3725
3738
|
|
|
3726
3739
|
// Event Listeners
|
|
@@ -4676,6 +4689,9 @@ class SSHIFTClient {
|
|
|
4676
4689
|
const option = document.createElement('div');
|
|
4677
4690
|
option.className = `mobile-tab-option${isActive ? ' active' : ''}`;
|
|
4678
4691
|
option.dataset.sessionId = sessionId;
|
|
4692
|
+
if (this._flashingSessions && this._flashingSessions.has(sessionId)) {
|
|
4693
|
+
option.classList.add('flashing');
|
|
4694
|
+
}
|
|
4679
4695
|
option.innerHTML = `
|
|
4680
4696
|
<i class="fas ${icon} tab-icon ${iconClass}"></i>
|
|
4681
4697
|
<span class="tab-name">${displayName}</span>
|
|
@@ -4723,6 +4739,13 @@ class SSHIFTClient {
|
|
|
4723
4739
|
iconElement.className = `fas ${activeTabIcon} tab-icon-active`;
|
|
4724
4740
|
}
|
|
4725
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
|
+
}
|
|
4726
4749
|
} else {
|
|
4727
4750
|
// Desktop: Update dropdowns per panel (original behavior)
|
|
4728
4751
|
// If panelId is provided, update only that panel's dropdown
|
|
@@ -4766,6 +4789,9 @@ class SSHIFTClient {
|
|
|
4766
4789
|
const option = document.createElement('div');
|
|
4767
4790
|
option.className = `mobile-tab-option${isActive ? ' active' : ''}`;
|
|
4768
4791
|
option.dataset.sessionId = sessionId;
|
|
4792
|
+
if (this._flashingSessions && this._flashingSessions.has(sessionId)) {
|
|
4793
|
+
option.classList.add('flashing');
|
|
4794
|
+
}
|
|
4769
4795
|
option.innerHTML = `
|
|
4770
4796
|
<i class="fas ${icon} tab-icon ${iconClass}"></i>
|
|
4771
4797
|
<span class="tab-name">${name}</span>
|
|
@@ -4813,6 +4839,15 @@ class SSHIFTClient {
|
|
|
4813
4839
|
iconElement.className = `fas ${activeTabIcon} tab-icon-active`;
|
|
4814
4840
|
}
|
|
4815
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
|
+
}
|
|
4816
4851
|
});
|
|
4817
4852
|
}
|
|
4818
4853
|
}
|
|
@@ -6531,10 +6566,101 @@ class SSHIFTClient {
|
|
|
6531
6566
|
URL.revokeObjectURL(url);
|
|
6532
6567
|
}
|
|
6533
6568
|
|
|
6534
|
-
|
|
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
|
+
|
|
6535
6658
|
switchTab(sessionId, panelId = null) {
|
|
6536
6659
|
console.log('[SSHIFT] switchTab called for session:', sessionId, 'panel:', panelId);
|
|
6537
6660
|
|
|
6661
|
+
// Stop any active flash on this tab since user is viewing it
|
|
6662
|
+
this.stopTabFlash(sessionId);
|
|
6663
|
+
|
|
6538
6664
|
// Determine which panel this session belongs to
|
|
6539
6665
|
if (!panelId) {
|
|
6540
6666
|
panelId = this.getPanelForSession(sessionId);
|
|
@@ -6746,9 +6872,10 @@ class SSHIFTClient {
|
|
|
6746
6872
|
|
|
6747
6873
|
// Update mobile tabs dropdown
|
|
6748
6874
|
this.updateMobileTabsDropdown();
|
|
6875
|
+
|
|
6876
|
+
// Apply any flash states that may have arrived before the tab DOM existed
|
|
6877
|
+
this.applyFlashStates();
|
|
6749
6878
|
}
|
|
6750
|
-
|
|
6751
|
-
// Handle tab closed by another client
|
|
6752
6879
|
handleTabClosed(sessionId) {
|
|
6753
6880
|
// Check if we have this session
|
|
6754
6881
|
const session = this.sessions.get(sessionId) || this.sftpSessions.get(sessionId);
|
|
@@ -6808,8 +6935,16 @@ class SSHIFTClient {
|
|
|
6808
6935
|
}
|
|
6809
6936
|
|
|
6810
6937
|
// Sync tabs from server (called on connect when sticky is enabled)
|
|
6811
|
-
|
|
6812
|
-
|
|
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
|
+
}
|
|
6813
6948
|
|
|
6814
6949
|
console.log('[SSHIFT] Syncing tabs from server:', tabs.length);
|
|
6815
6950
|
this.isRestoring = true;
|
|
@@ -6846,6 +6981,9 @@ class SSHIFTClient {
|
|
|
6846
6981
|
// Update mobile tabs dropdown after syncing
|
|
6847
6982
|
this.updateMobileTabsDropdown();
|
|
6848
6983
|
|
|
6984
|
+
// Apply any flash states that arrived before DOM elements existed
|
|
6985
|
+
this.applyFlashStates();
|
|
6986
|
+
|
|
6849
6987
|
this.isRestoring = false;
|
|
6850
6988
|
}
|
|
6851
6989
|
|