@zhongqian97-code/ecode 0.5.23 → 0.5.24

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.
Files changed (2) hide show
  1. package/dist/index.js +55 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5574,6 +5574,43 @@ function generateAdminHtml(version2) {
5574
5574
  .num { color: #79c0ff; }
5575
5575
  .fn { color: #d2a8ff; }
5576
5576
 
5577
+ /* \u2500\u2500 Toast notifications \u2500\u2500 */
5578
+ #toast-container {
5579
+ position: fixed;
5580
+ top: 16px;
5581
+ right: 16px;
5582
+ z-index: 200;
5583
+ display: flex;
5584
+ flex-direction: column;
5585
+ gap: 8px;
5586
+ pointer-events: none;
5587
+ }
5588
+ .toast {
5589
+ padding: 10px 16px;
5590
+ border-radius: 4px;
5591
+ font-size: 13px;
5592
+ max-width: 320px;
5593
+ background: #21262d;
5594
+ color: #c9d1d9;
5595
+ border: 1px solid #30363d;
5596
+ pointer-events: auto;
5597
+ animation: toast-in .2s ease;
5598
+ }
5599
+ .toast-error {
5600
+ background: #2d1b1b;
5601
+ color: #ff7b72;
5602
+ border-color: #f85149;
5603
+ }
5604
+ .toast-success {
5605
+ background: #1a2d1a;
5606
+ color: #3fb950;
5607
+ border-color: #2ea043;
5608
+ }
5609
+ @keyframes toast-in {
5610
+ from { opacity: 0; transform: translateX(20px); }
5611
+ to { opacity: 1; transform: translateX(0); }
5612
+ }
5613
+
5577
5614
  /* \u2500\u2500 Mobile \u2500\u2500 */
5578
5615
  @media (max-width: 600px) {
5579
5616
  #hamburger { display: block; }
@@ -5658,6 +5695,9 @@ function generateAdminHtml(version2) {
5658
5695
  </div>
5659
5696
  </div>
5660
5697
 
5698
+ <!-- Toast notifications -->
5699
+ <div id="toast-container"></div>
5700
+
5661
5701
  <!-- Bash approval modal -->
5662
5702
  <div id="approval-modal" role="dialog" aria-modal="true">
5663
5703
  <div id="approval-box">
@@ -5684,6 +5724,17 @@ function generateAdminHtml(version2) {
5684
5724
  streamingMsgEl: null, // DOM element currently receiving delta tokens
5685
5725
  };
5686
5726
 
5727
+ // \u2500\u2500 Toast \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
5728
+ function showToast(msg, type) {
5729
+ const container = document.getElementById('toast-container');
5730
+ if (!container) return;
5731
+ const el = document.createElement('div');
5732
+ el.className = 'toast toast-' + (type || 'info');
5733
+ el.textContent = msg;
5734
+ container.appendChild(el);
5735
+ setTimeout(() => el.remove(), 4000);
5736
+ }
5737
+
5687
5738
  // \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
5688
5739
  function apiUrl(path) {
5689
5740
  const sep = path.includes('?') ? '&' : '?';
@@ -6033,7 +6084,7 @@ function generateAdminHtml(version2) {
6033
6084
  selectSession(session.id);
6034
6085
  }
6035
6086
  } catch (e) {
6036
- document.getElementById('ws-status').textContent = '\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25: ' + e.message;
6087
+ showToast('\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25: ' + e.message, 'error');
6037
6088
  }
6038
6089
  });
6039
6090
 
@@ -6088,7 +6139,7 @@ function generateAdminHtml(version2) {
6088
6139
  document.getElementById('cfg-logdir').value = data.logDir || '';
6089
6140
  document.getElementById('cfg-systemprompt').value = data.systemPrompt || '';
6090
6141
  } catch (e) {
6091
- // open modal even if fetch fails; fields will be empty
6142
+ showToast('\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25: ' + e.message, 'error');
6092
6143
  }
6093
6144
  document.getElementById('config-modal').classList.add('open');
6094
6145
  });
@@ -6109,8 +6160,9 @@ function generateAdminHtml(version2) {
6109
6160
  try {
6110
6161
  await apiFetch('/api/config', { method: 'PUT', headers: {'Content-Type':'application/json'}, body: JSON.stringify(body) });
6111
6162
  updateTopbarModel(body.model);
6163
+ showToast('\u914D\u7F6E\u5DF2\u4FDD\u5B58', 'success');
6112
6164
  } catch (e) {
6113
- // ignore errors silently for now
6165
+ showToast('\u4FDD\u5B58\u5931\u8D25: ' + e.message, 'error');
6114
6166
  }
6115
6167
  document.getElementById('config-modal').classList.remove('open');
6116
6168
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhongqian97-code/ecode",
3
- "version": "0.5.23",
3
+ "version": "0.5.24",
4
4
  "description": "A minimal Claude Code clone with REPL interface and bash tool calling",
5
5
  "type": "module",
6
6
  "author": "zhongqian97-code",