clay-server 4.0.0-beta.11 → 4.0.0-beta.12

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.
@@ -322,8 +322,7 @@ function attachSessionPair(ctx) {
322
322
  title: resolved.partner.title || "New Session",
323
323
  turns: count > 0 ? recentTurns(resolved.partner, count) : [],
324
324
  };
325
- // The same bounded capacity report partner_status returns, so a Driver
326
- // already reading turns needs no second call; null for anyone else.
325
+ // partner_status's bounded report, so reading turns needs no second call.
327
326
  payload.capacity = lifecycle.optionalStatus(caller);
328
327
  return toolResult(payload);
329
328
  } catch (e) {
@@ -411,7 +410,8 @@ function attachSessionPair(ctx) {
411
410
  .concat(workerProposal.getToolDefs(boundSession));
412
411
  }
413
412
 
414
- var factory = attachPairFactory({ sm: sm, splitStore: store, ctx: ctx });
413
+ // Passed through as-is; re-wrapping drops fields. See session-pair-factory.js.
414
+ var factory = attachPairFactory(ctx);
415
415
  var createPairRecord = factory.createPairRecord;
416
416
  var createWorkerForDriver = factory.createWorkerForDriver;
417
417
  var createPair = factory.createPair;
@@ -203,6 +203,23 @@ export function toolActivityText(name, input) {
203
203
  return "Running " + name + "...";
204
204
  }
205
205
 
206
+ // The sublabel for a call that has finished. `toolActivityText` is written in
207
+ // the present progressive for a call in flight, so re-asserting it after a
208
+ // result has arrived leaves a finished card claiming to still be running —
209
+ // which is how a failed custom tool ended up reading "Running
210
+ // send_to_partner..." beside its own error output.
211
+ //
212
+ // Only ever used where a result exists, so a genuinely in-flight call is never
213
+ // relabelled. A failure states so plainly; a success keeps whatever specific
214
+ // description the activity text produced ("Reading foo.js"), because that still
215
+ // describes the call accurately, and only the generic present-progressive
216
+ // fallback is replaced.
217
+ export function toolTerminalText(name, input, isError) {
218
+ if (isError) return name + " failed";
219
+ var activity = toolActivityText(name, input);
220
+ return activity === "Running " + name + "..." ? name : activity;
221
+ }
222
+
206
223
  function shortPath(p) {
207
224
  if (!p) return "";
208
225
  var parts = p.split("/");
@@ -2136,9 +2153,12 @@ export function updateToolResult(id, content, isError, images) {
2136
2153
  var tool = tools[id];
2137
2154
  if (!tool) return;
2138
2155
 
2156
+ // Re-render the sublabel from the now-complete input (streaming can have
2157
+ // built it from a partial one), but in its terminal form: a result has
2158
+ // arrived, so this call is no longer running.
2139
2159
  var subtitleText = tool.el.querySelector(".tool-subtitle-text");
2140
2160
  if (subtitleText && tool.input) {
2141
- subtitleText.textContent = toolActivityText(tool.name, tool.input);
2161
+ subtitleText.textContent = toolTerminalText(tool.name, tool.input, isError);
2142
2162
  }
2143
2163
 
2144
2164
  var resultBlock = document.createElement("div");
@@ -9,6 +9,17 @@
9
9
  // Ownership always comes from the connection or the Driver session, never from
10
10
  // the incoming message.
11
11
  //
12
+ // CONTEXT CONTRACT: this module reads `sm`, `splitStore`, `isMate`,
13
+ // `usersModule` and `sendTo` off its own argument, all at the top level.
14
+ // attachSessionPair's context already carries all five, so it is passed
15
+ // through unchanged. Re-wrapping it (it was once `{ sm, splitStore, ctx }`)
16
+ // leaves `isMate`, `usersModule` and `sendTo` undefined, which silently
17
+ // disables the Mate guard, breaks the pair_session_create reply, and throws
18
+ // "Cannot read properties of undefined (reading 'isMultiUser')" the moment a
19
+ // pair is created for an owned session — single-user installs escape it only
20
+ // because a Driver with no ownerId short-circuits that expression. Add any new
21
+ // dependency as a top-level field of that same context.
22
+ //
12
23
  // Two ordering rules matter and are load-bearing:
13
24
  //
14
25
  // 1. Nothing is created until everything is validated. Driver eligibility and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "4.0.0-beta.11",
3
+ "version": "4.0.0-beta.12",
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",