clay-server 2.36.2-beta.7 → 2.36.2-beta.9

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.
@@ -284,6 +284,14 @@
284
284
  color: var(--accent2);
285
285
  }
286
286
 
287
+ .activity-inline-avatar {
288
+ width: 28px;
289
+ height: 28px;
290
+ border-radius: 50%;
291
+ flex-shrink: 0;
292
+ object-fit: cover;
293
+ }
294
+
287
295
  .activity-inline .activity-icon {
288
296
  display: inline-flex;
289
297
  animation: sparkle 2s ease-in-out infinite;
@@ -5,7 +5,8 @@ import { refreshIcons } from './icons.js';
5
5
  import { store } from './store.js';
6
6
  import { getSendBtn, getStatusDot } from './dom-refs.js';
7
7
  import { onThemeChange } from './theme.js';
8
- import { getActivityEl, setActivityEl, addToMessages, scrollToBottom } from './app-rendering.js';
8
+ import { getActivityEl, setActivityEl, addToMessages, scrollToBottom, VENDOR_AVATARS } from './app-rendering.js';
9
+ import { escapeHtml } from './utils.js';
9
10
 
10
11
  // --- Module-owned state ---
11
12
  var faviconLink, faviconOrigHref, faviconCanvas, faviconCtx, faviconImg, faviconImgReady;
@@ -199,8 +200,21 @@ export function setActivity(text) {
199
200
  if (!getActivityEl()) {
200
201
  var _actEl = document.createElement("div");
201
202
  _actEl.className = "activity-inline";
202
- _actEl.innerHTML =
203
- '<div class="mate-thinking-dots"><span></span><span></span><span></span></div>';
203
+ // In channel mode (Claude Code / Codex sessions), include the vendor
204
+ // avatar so the user can see who is responding while the dots are
205
+ // animating. DM mode handles its own avatar via mate-thinking
206
+ // elements and shouldn't pick up a vendor avatar here.
207
+ var _isDm = !!(store.get('dmMode') && store.get('dmTargetUser') && store.get('dmTargetUser').isMate);
208
+ if (!_isDm) {
209
+ var _vendor = store.get('currentVendor') || 'claude';
210
+ var _avatarUrl = VENDOR_AVATARS[_vendor] || VENDOR_AVATARS.claude;
211
+ _actEl.innerHTML =
212
+ '<img class="activity-inline-avatar" src="' + escapeHtml(_avatarUrl) + '" alt="">' +
213
+ '<div class="mate-thinking-dots"><span></span><span></span><span></span></div>';
214
+ } else {
215
+ _actEl.innerHTML =
216
+ '<div class="mate-thinking-dots"><span></span><span></span><span></span></div>';
217
+ }
204
218
  setActivityEl(_actEl);
205
219
  addToMessages(_actEl);
206
220
  }
@@ -733,6 +733,10 @@ export function processMessage(msg) {
733
733
  // applied at history_done time.
734
734
  store.set({ sessionIsProcessing: true });
735
735
  applyDeadSessionTodoCompaction();
736
+ // Server confirmed the turn started: pre-thinking dots have done
737
+ // their job, drop them so they aren't stranded if no further
738
+ // events make it through.
739
+ removeMatePreThinking();
736
740
  if (!(store.get('dmMode') && store.get('dmTargetUser') && store.get('dmTargetUser').isMate) && !store.get('matePreThinkingEl')) {
737
741
  setActivity("thinking");
738
742
  }
@@ -740,6 +744,10 @@ export function processMessage(msg) {
740
744
  break;
741
745
 
742
746
  case "compacting":
747
+ // Compacting means the SDK is mid-turn doing context compaction.
748
+ // Pre-thinking dots have served their purpose, clear them so the
749
+ // user sees the compaction indicator instead.
750
+ removeMatePreThinking();
743
751
  if (msg.active) {
744
752
  setActivity("compacting");
745
753
  } else if (!(store.get('dmMode') && store.get('dmTargetUser') && store.get('dmTargetUser').isMate)) {
@@ -934,6 +942,10 @@ export function processMessage(msg) {
934
942
  break;
935
943
 
936
944
  case "result":
945
+ // Result marks turn end. Drop pre-thinking even if no delta/tool
946
+ // event ever arrived (e.g. tool-only turn whose progress signals
947
+ // were missed by the client).
948
+ removeMatePreThinking();
937
949
  setActivity(null);
938
950
  stopThinking();
939
951
  markAllToolsDone();
@@ -623,6 +623,23 @@ function doShowMatePreThinking(mateName, mateAvatar) {
623
623
  }
624
624
  refreshIcons();
625
625
  scrollToBottom();
626
+ // Safety net: if no server event ever clears these dots (lost in transit,
627
+ // missed handler, etc.) the user sees them forever and assumes the
628
+ // session is hung. After 90s with zero progress, clear the indicator
629
+ // and log a system note so the user knows to retry.
630
+ if (matePreThinkingTimer) clearTimeout(matePreThinkingTimer);
631
+ matePreThinkingTimer = setTimeout(function () {
632
+ var stillThere = store.get('matePreThinkingEl');
633
+ if (!stillThere) return;
634
+ stillThere.remove();
635
+ store.set({ matePreThinkingEl: null });
636
+ matePreThinkingTimer = null;
637
+ var note = document.createElement("div");
638
+ note.className = "system-msg";
639
+ note.textContent = "No response received in 90s. The server may have stalled. Send another message to retry.";
640
+ addToMessages(note);
641
+ scrollToBottom();
642
+ }, 90000);
626
643
  }
627
644
 
628
645
  export function removeMatePreThinking() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "2.36.2-beta.7",
3
+ "version": "2.36.2-beta.9",
4
4
  "description": "Self-hosted team workspace for Claude Code and Codex. Multi-user, browser-based, with persistent AI mates.",
5
5
  "bin": {
6
6
  "clay-server": "./bin/cli.js",