clay-server 2.31.0 → 2.32.0-beta.10

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 (82) hide show
  1. package/lib/browser-mcp-server.js +32 -44
  2. package/lib/codex-defaults.js +18 -0
  3. package/lib/debate-mcp-server.js +14 -31
  4. package/lib/mcp-local.js +31 -1
  5. package/lib/project-connection.js +9 -6
  6. package/lib/project-debate.js +8 -0
  7. package/lib/project-filesystem.js +47 -1
  8. package/lib/project-http.js +75 -8
  9. package/lib/project-mate-interaction.js +102 -16
  10. package/lib/project-mcp.js +4 -0
  11. package/lib/project-notifications.js +9 -0
  12. package/lib/project-sessions.js +94 -51
  13. package/lib/project-user-message.js +12 -7
  14. package/lib/project.js +234 -99
  15. package/lib/public/app.js +135 -454
  16. package/lib/public/codex-avatar.png +0 -0
  17. package/lib/public/css/debate.css +3 -2
  18. package/lib/public/css/filebrowser.css +91 -1
  19. package/lib/public/css/icon-strip.css +21 -5
  20. package/lib/public/css/input.css +338 -104
  21. package/lib/public/css/mates.css +43 -0
  22. package/lib/public/css/mention.css +48 -4
  23. package/lib/public/css/menus.css +1 -1
  24. package/lib/public/css/messages.css +2 -0
  25. package/lib/public/css/notifications-center.css +26 -0
  26. package/lib/public/css/tooltip.css +47 -0
  27. package/lib/public/index.html +78 -26
  28. package/lib/public/modules/app-connection.js +138 -37
  29. package/lib/public/modules/app-cursors.js +18 -17
  30. package/lib/public/modules/app-debate-ui.js +9 -9
  31. package/lib/public/modules/app-dm.js +175 -131
  32. package/lib/public/modules/app-favicon.js +28 -26
  33. package/lib/public/modules/app-header.js +79 -68
  34. package/lib/public/modules/app-home-hub.js +55 -47
  35. package/lib/public/modules/app-loop-ui.js +34 -18
  36. package/lib/public/modules/app-loop-wizard.js +6 -6
  37. package/lib/public/modules/app-messages.js +199 -153
  38. package/lib/public/modules/app-misc.js +23 -12
  39. package/lib/public/modules/app-notifications.js +119 -9
  40. package/lib/public/modules/app-panels.js +203 -49
  41. package/lib/public/modules/app-projects.js +161 -150
  42. package/lib/public/modules/app-rate-limit.js +5 -4
  43. package/lib/public/modules/app-rendering.js +149 -101
  44. package/lib/public/modules/app-skills-install.js +4 -4
  45. package/lib/public/modules/context-sources.js +102 -66
  46. package/lib/public/modules/dom-refs.js +21 -0
  47. package/lib/public/modules/filebrowser.js +173 -2
  48. package/lib/public/modules/input.js +122 -0
  49. package/lib/public/modules/markdown.js +5 -1
  50. package/lib/public/modules/mate-sidebar.js +38 -0
  51. package/lib/public/modules/mention.js +24 -6
  52. package/lib/public/modules/scheduler.js +1 -1
  53. package/lib/public/modules/sidebar-mates.js +79 -35
  54. package/lib/public/modules/sidebar-mobile.js +34 -30
  55. package/lib/public/modules/sidebar-projects.js +60 -57
  56. package/lib/public/modules/sidebar-sessions.js +75 -69
  57. package/lib/public/modules/sidebar.js +12 -20
  58. package/lib/public/modules/skills.js +8 -9
  59. package/lib/public/modules/sticky-notes.js +1 -2
  60. package/lib/public/modules/store.js +9 -2
  61. package/lib/public/modules/stt.js +4 -1
  62. package/lib/public/modules/terminal.js +12 -0
  63. package/lib/public/modules/tools.js +18 -13
  64. package/lib/public/modules/tooltip.js +32 -5
  65. package/lib/sdk-bridge.js +562 -1114
  66. package/lib/sdk-message-processor.js +150 -135
  67. package/lib/sdk-worker.js +4 -0
  68. package/lib/server-dm.js +1 -0
  69. package/lib/server.js +86 -1
  70. package/lib/sessions.js +81 -37
  71. package/lib/ws-schema.js +2 -0
  72. package/lib/yoke/adapters/claude-worker.js +559 -0
  73. package/lib/yoke/adapters/claude.js +1483 -0
  74. package/lib/yoke/adapters/codex.js +1121 -0
  75. package/lib/yoke/adapters/gemini.js +709 -0
  76. package/lib/yoke/codex-app-server.js +307 -0
  77. package/lib/yoke/index.js +199 -0
  78. package/lib/yoke/instructions.js +62 -0
  79. package/lib/yoke/interface.js +98 -0
  80. package/lib/yoke/mcp-bridge-server.js +294 -0
  81. package/lib/yoke/package.json +7 -0
  82. package/package.json +3 -1
@@ -2,8 +2,10 @@
2
2
  // Extracted from app.js (PR-27)
3
3
 
4
4
  import { avatarUrl } from './avatar.js';
5
-
6
- var _ctx = null;
5
+ import { getWs } from './ws-ref.js';
6
+ import { store } from './store.js';
7
+ import { getMessagesEl } from './dom-refs.js';
8
+ import { registerTooltip } from './tooltip.js';
7
9
 
8
10
  // --- Module-owned state ---
9
11
  var cursorSharingEnabled = localStorage.getItem("cursorSharing") !== "off";
@@ -122,7 +124,7 @@ function getNodeAtCharOffset(container, charOffset) {
122
124
 
123
125
  // Find parent [data-turn] element from a DOM node
124
126
  function findParentTurn(node) {
125
- var messagesEl = _ctx.messagesEl;
127
+ var messagesEl = getMessagesEl();
126
128
  var el = node.nodeType === 3 ? node.parentElement : node;
127
129
  while (el && el !== messagesEl) {
128
130
  if (el.dataset && el.dataset.turn != null) return el;
@@ -158,7 +160,7 @@ function createOffscreenIndicator(userId, displayName, color) {
158
160
  }
159
161
 
160
162
  function updateCursorVisibility(entry) {
161
- var messagesEl = _ctx.messagesEl;
163
+ var messagesEl = getMessagesEl();
162
164
  var visibleTop = messagesEl.scrollTop;
163
165
  var visibleBottom = visibleTop + messagesEl.clientHeight;
164
166
  var y = entry.lastY || 0;
@@ -176,7 +178,7 @@ function updateCursorVisibility(entry) {
176
178
 
177
179
  // Find the closest [data-turn] element to a given clientY
178
180
  function findClosestTurn(clientY) {
179
- var messagesEl = _ctx.messagesEl;
181
+ var messagesEl = getMessagesEl();
180
182
  var turns = messagesEl.querySelectorAll("[data-turn]");
181
183
  if (!turns.length) return null;
182
184
  // First: exact hit
@@ -198,7 +200,7 @@ function findClosestTurn(clientY) {
198
200
 
199
201
  // Cursor sharing toggle button in user island (multi-user only)
200
202
  export function initCursorToggle() {
201
- if (!_ctx.isMultiUserMode) return;
203
+ if (!store.get('isMultiUserMode')) return;
202
204
  var actionsEl = document.querySelector(".user-island-actions");
203
205
  if (!actionsEl) return;
204
206
  if (document.getElementById("cursor-share-toggle")) return;
@@ -218,11 +220,11 @@ export function initCursorToggle() {
218
220
  if (cursorSharingEnabled) {
219
221
  btn.classList.remove("off");
220
222
  btn.classList.add("on");
221
- _ctx.registerTooltip(btn, "Cursor sharing on");
223
+ registerTooltip(btn, "Cursor sharing on");
222
224
  } else {
223
225
  btn.classList.remove("on");
224
226
  btn.classList.add("off");
225
- _ctx.registerTooltip(btn, "Cursor sharing off");
227
+ registerTooltip(btn, "Cursor sharing off");
226
228
  }
227
229
  }
228
230
 
@@ -233,7 +235,7 @@ export function initCursorToggle() {
233
235
  cursorSharingEnabled = !cursorSharingEnabled;
234
236
  localStorage.setItem("cursorSharing", cursorSharingEnabled ? "on" : "off");
235
237
  updateToggleStyle();
236
- var ws = _ctx.ws;
238
+ var ws = getWs();
237
239
  if (!cursorSharingEnabled && ws && ws.readyState === 1) {
238
240
  ws.send(JSON.stringify({ type: "cursor_leave" }));
239
241
  ws.send(JSON.stringify({ type: "text_select", ranges: [] }));
@@ -244,7 +246,7 @@ export function initCursorToggle() {
244
246
  // --- Exported functions ---
245
247
 
246
248
  export function handleRemoteSelection(msg) {
247
- var messagesEl = _ctx.messagesEl;
249
+ var messagesEl = getMessagesEl();
248
250
  var userId = msg.userId;
249
251
  var color = getCursorColor(userId);
250
252
 
@@ -305,7 +307,7 @@ export function handleRemoteSelection(msg) {
305
307
  }
306
308
 
307
309
  export function handleRemoteCursorMove(msg) {
308
- var messagesEl = _ctx.messagesEl;
310
+ var messagesEl = getMessagesEl();
309
311
  var userId = msg.userId;
310
312
 
311
313
  var entry = remoteCursors[userId];
@@ -379,16 +381,15 @@ export function clearRemoteCursors() {
379
381
  remoteSelections = {};
380
382
  }
381
383
 
382
- export function initCursors(ctx) {
383
- _ctx = ctx;
384
- var messagesEl = _ctx.messagesEl;
384
+ export function initCursors() {
385
+ var messagesEl = getMessagesEl();
385
386
 
386
387
  initCursorToggle();
387
388
 
388
389
  // Track local cursor and send to server
389
390
  messagesEl.addEventListener("mousemove", function (e) {
390
391
  if (!cursorSharingEnabled) return;
391
- var ws = _ctx.ws;
392
+ var ws = getWs();
392
393
  if (!ws || ws.readyState !== 1) return;
393
394
  if (cursorThrottleTimer) return;
394
395
  cursorThrottleTimer = setTimeout(function () { cursorThrottleTimer = null; }, CURSOR_THROTTLE_MS);
@@ -412,7 +413,7 @@ export function initCursors(ctx) {
412
413
 
413
414
  messagesEl.addEventListener("mouseleave", function () {
414
415
  if (!cursorSharingEnabled) return;
415
- var ws = _ctx.ws;
416
+ var ws = getWs();
416
417
  if (!ws || ws.readyState !== 1) return;
417
418
  ws.send(JSON.stringify({ type: "cursor_leave" }));
418
419
  });
@@ -429,7 +430,7 @@ export function initCursors(ctx) {
429
430
  // Track local text selection and send to server
430
431
  document.addEventListener("selectionchange", function () {
431
432
  if (!cursorSharingEnabled) return;
432
- var ws = _ctx.ws;
433
+ var ws = getWs();
433
434
  if (!ws || ws.readyState !== 1) return;
434
435
  if (selectionThrottleTimer) return;
435
436
  selectionThrottleTimer = setTimeout(function () { selectionThrottleTimer = null; }, 100);
@@ -20,7 +20,7 @@ export function showDebateConcludeConfirm(msg) {
20
20
 
21
21
  function showDebateConcludeMode() {
22
22
  removeDebateBottomBar();
23
- store.setState({ debateConcludeMode: true });
23
+ store.set({ debateConcludeMode: true });
24
24
  var inputArea = document.getElementById("input-area");
25
25
  if (inputArea) {
26
26
  inputArea.classList.add("debate-floor-mode");
@@ -57,7 +57,7 @@ function showDebateConcludeMode() {
57
57
  }
58
58
 
59
59
  export function exitDebateConcludeMode() {
60
- store.setState({ debateConcludeMode: false });
60
+ store.set({ debateConcludeMode: false });
61
61
  var inputArea = document.getElementById("input-area");
62
62
  if (inputArea) inputArea.classList.remove("debate-floor-mode");
63
63
  var banner = document.getElementById("debate-floor-banner");
@@ -82,7 +82,7 @@ export function handleDebateConcludeSend() {
82
82
 
83
83
  export function showDebateEndedMode(msg) {
84
84
  removeDebateBottomBar();
85
- store.setState({ debateEndedMode: true });
85
+ store.set({ debateEndedMode: true });
86
86
  var inputArea = document.getElementById("input-area");
87
87
  if (inputArea) {
88
88
  inputArea.classList.add("debate-floor-mode");
@@ -122,7 +122,7 @@ export function showDebateEndedMode(msg) {
122
122
  }
123
123
 
124
124
  export function exitDebateEndedMode() {
125
- store.setState({ debateEndedMode: false });
125
+ store.set({ debateEndedMode: false });
126
126
  var inputArea = document.getElementById("input-area");
127
127
  if (inputArea) inputArea.classList.remove("debate-floor-mode");
128
128
  var banner = document.getElementById("debate-floor-banner");
@@ -146,7 +146,7 @@ function handleDebateEndedSend() {
146
146
 
147
147
  export function showDebateUserFloor(msg) {
148
148
  removeDebateBottomBar();
149
- store.setState({ debateFloorMode: true });
149
+ store.set({ debateFloorMode: true });
150
150
  var inputArea = document.getElementById("input-area");
151
151
  if (inputArea) {
152
152
  inputArea.classList.add("debate-floor-mode");
@@ -184,7 +184,7 @@ export function showDebateUserFloor(msg) {
184
184
  }
185
185
 
186
186
  export function exitDebateFloorMode() {
187
- store.setState({ debateFloorMode: false });
187
+ store.set({ debateFloorMode: false });
188
188
  var inputArea = document.getElementById("input-area");
189
189
  if (inputArea) inputArea.classList.remove("debate-floor-mode");
190
190
  var banner = document.getElementById("debate-floor-banner");
@@ -230,9 +230,9 @@ export function renderDebateUserFloorDone(msg) {
230
230
 
231
231
  export function showDebateSticky(phase, msg) {
232
232
  if (phase === "ended" || phase === "hide") {
233
- store.setState({ debateStickyState: null });
233
+ store.set({ debateStickyState: null });
234
234
  } else {
235
- store.setState({ debateStickyState: { phase: phase, msg: msg } });
235
+ store.set({ debateStickyState: { phase: phase, msg: msg } });
236
236
  }
237
237
 
238
238
  var stickyEl = document.getElementById("debate-sticky");
@@ -343,7 +343,7 @@ export function removeDebateBottomBar() {
343
343
  var handBar = document.getElementById("debate-hand-raise-bar");
344
344
  if (handBar) handBar.remove();
345
345
  debateHandRaiseOpen = false;
346
- var _ds = store.getState();
346
+ var _ds = store.snap();
347
347
  if (_ds.debateFloorMode) exitDebateFloorMode();
348
348
  if (_ds.debateConcludeMode) exitDebateConcludeMode();
349
349
  if (_ds.debateEndedMode) exitDebateEndedMode();