@clagentic/console 1.9.0-beta.2 → 1.9.0-beta.3
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/bin/cli.js +12 -1
- package/lib/build-sha.json +2 -2
- package/lib/cli/ipc-subcommands.js +44 -0
- package/lib/daemon.js +86 -6
- package/lib/effective-protocol.js +82 -0
- package/lib/project-connection.js +6 -6
- package/lib/project-filesystem.js +4 -4
- package/lib/project-http.js +4 -4
- package/lib/project-loop.js +4 -4
- package/lib/project-sessions.js +147 -77
- package/lib/project-user-mention.js +7 -7
- package/lib/project-user-message.js +11 -11
- package/lib/project.js +21 -21
- package/lib/public/app.js +10 -6
- package/lib/public/css/filebrowser.css +6 -0
- package/lib/public/css/server-settings.css +9 -0
- package/lib/public/index.html +8 -2
- package/lib/public/modules/activity-latch.js +25 -139
- package/lib/public/modules/activity-state.js +44 -6
- package/lib/public/modules/app-connection.js +24 -5
- package/lib/public/modules/app-favicon.js +52 -65
- package/lib/public/modules/app-messages.js +114 -54
- package/lib/public/modules/app-projects.js +24 -7
- package/lib/public/modules/server-settings.js +256 -21
- package/lib/public/modules/theme.js +2 -2
- package/lib/sdk-bridge.js +76 -13
- package/lib/server-dm.js +5 -5
- package/lib/server-hub-sessions.js +1 -1
- package/lib/server.js +55 -22
- package/lib/session-activity.js +1 -1
- package/lib/sessions.js +17 -17
- package/lib/terminal-manager.js +6 -6
- package/package.json +1 -1
- package/scripts/verify-installed-build.js +242 -15
|
@@ -6,8 +6,6 @@ import { store } from './store.js';
|
|
|
6
6
|
import { getSendBtn, getStatusDot } from './dom-refs.js';
|
|
7
7
|
import { onThemeChange, getChatLayout } from './theme.js';
|
|
8
8
|
import { getActivityEl, setActivityEl, addToMessages, scrollToBottom } from './app-rendering.js';
|
|
9
|
-
import { getWs } from './ws-ref.js';
|
|
10
|
-
import { createActivityStaleBackstop } from './activity-latch.js';
|
|
11
9
|
|
|
12
10
|
// --- Module-owned state ---
|
|
13
11
|
var faviconLink, faviconOrigHref, faviconCanvas, faviconCtx, faviconImg, faviconImgReady;
|
|
@@ -242,78 +240,67 @@ export function setActivity(text) {
|
|
|
242
240
|
// and was indistinguishable from the .thinking-item's own presence spinner —
|
|
243
241
|
// two indicators live at once (this task's SYMPTOM B).
|
|
244
242
|
//
|
|
245
|
-
// This subscriber makes the footer a DERIVED render of
|
|
246
|
-
//
|
|
247
|
-
// app-
|
|
248
|
-
//
|
|
249
|
-
//
|
|
250
|
-
//
|
|
251
|
-
//
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
//
|
|
255
|
-
//
|
|
256
|
-
//
|
|
257
|
-
// correct for the icon-strip dot instead of inventing a second one that
|
|
258
|
-
// could disagree with it.
|
|
243
|
+
// This subscriber makes the footer a DERIVED render of store.processing —
|
|
244
|
+
// which lr-5edd64 turned into a pure PROJECTION of server-authoritative
|
|
245
|
+
// per-session state (app-messages.js's session_list/session_switched
|
|
246
|
+
// handlers derive it via activity-state.js's sessionActivity(), nothing
|
|
247
|
+
// writes it independently anymore). Previously this boolean was a
|
|
248
|
+
// client-local edge latch (app-connection.js's setStatus(), flipped by the
|
|
249
|
+
// server's {type:"status"}/done/auth_required sends) with no reconciliation
|
|
250
|
+
// path — MILLER's lr-5edd64 diagnosis: two independent state sources
|
|
251
|
+
// (this latch, and the server's per-session session.isProcessing) could
|
|
252
|
+
// disagree, and neither renderer that read one could self-correct from the
|
|
253
|
+
// other. There is now exactly one source; this subscriber and the
|
|
254
|
+
// project-icon dot (sidebar-projects.js) both derive from it.
|
|
259
255
|
//
|
|
260
256
|
// Gated to bubble layout only (mirrors input.js's optimistic-raise gate and
|
|
261
257
|
// showClaudePreThinking's channel-only gate in app-rendering.js) — the two
|
|
262
258
|
// footer renderers are mutually exclusive by design (wide-view <=> channel,
|
|
263
259
|
// theme.js getChatLayout/setChatLayout), so this must not fight
|
|
264
260
|
// .channel-pre-thinking for the same bottom-of-transcript slot in channel
|
|
265
|
-
// layout.
|
|
266
|
-
//
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
// server registry, not any client state. Session-scoping the status/done/
|
|
270
|
-
// auth_required writers and reconciling on every session_switched snapshot
|
|
271
|
-
// (both elsewhere in this fix) close the known trigger paths; this is the
|
|
272
|
-
// backstop for an edge this fix's authors did not anticipate — a single
|
|
273
|
-
// timer, armed only on the 0->1 transition and disarmed on every 1->0
|
|
274
|
-
// transition, so it never polls per-tick and never accumulates more than
|
|
275
|
-
// one in-flight timer regardless of how many turns a session runs. On
|
|
276
|
-
// fire, it re-sends the EXISTING switch_session request for the
|
|
277
|
-
// currently-focused session (same message every sidebar click already
|
|
278
|
-
// sends) rather than inventing a new wire message — the server always
|
|
279
|
-
// answers with a fresh session_switched carrying the authoritative
|
|
280
|
-
// isProcessing (lib/sessions.js switchSession), which the reconciliation in
|
|
281
|
-
// app-messages.js's session_switched handler then applies. Bound: at most
|
|
282
|
-
// one re-request per ACTIVITY_STALE_BACKSTOP_MS per session-focus-duration,
|
|
283
|
-
// never a recurring poll — the timer is one-shot and only re-arms on a
|
|
284
|
-
// fresh 0->1 transition (a genuinely new turn), not on a fixed interval.
|
|
285
|
-
// Decision logic (arm/clear/one-shot-never-stacks) lives in the pure,
|
|
286
|
-
// directly-unit-tested activity-latch.js module — see its header comment
|
|
287
|
-
// for why (app-favicon.js's own import graph is not importable in a plain
|
|
288
|
-
// Node test process, so the behavioral proof lives against the pure
|
|
289
|
-
// module instead of this DOM-driving glue).
|
|
290
|
-
var _activityStaleBackstop = createActivityStaleBackstop({
|
|
291
|
-
onFire: function () {
|
|
292
|
-
// Only re-request if the latch is STILL true when the timer fires —
|
|
293
|
-
// a legitimate long-running turn re-arms nothing extra here (the
|
|
294
|
-
// request is one-shot, not a recurring poll); if the turn already
|
|
295
|
-
// ended, the 1->0 transition already cleared this timer, so reaching
|
|
296
|
-
// this callback at all means 'processing' has been true, unbroken,
|
|
297
|
-
// for the full backstop window.
|
|
298
|
-
if (!store.get('processing')) return;
|
|
299
|
-
var sid = store.get('activeSessionId');
|
|
300
|
-
var ws = getWs();
|
|
301
|
-
if (sid == null || !ws || ws.readyState !== 1) return;
|
|
302
|
-
ws.send(JSON.stringify({ type: "switch_session", id: sid }));
|
|
303
|
-
},
|
|
304
|
-
});
|
|
305
|
-
|
|
261
|
+
// layout. (lr-5edd64 comment #3: in channel layout this subscriber's raise/
|
|
262
|
+
// clear is inert by this same gate — the channel footer's own presence
|
|
263
|
+
// widget, .channel-pre-thinking, is driven separately and unaffected by
|
|
264
|
+
// this change.)
|
|
306
265
|
export function initActivityFooter() {
|
|
307
266
|
store.subscribe(['processing'], function (state, prev) {
|
|
308
267
|
if (state.processing === prev.processing) return;
|
|
309
|
-
|
|
310
|
-
if (getChatLayout() !== "channel") {
|
|
311
|
-
if (state.processing) {
|
|
312
|
-
setActivity("thinking");
|
|
313
|
-
} else {
|
|
314
|
-
setActivity(null);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
268
|
+
reconcileActivityFooter();
|
|
317
269
|
});
|
|
318
270
|
}
|
|
319
271
|
|
|
272
|
+
// lr-5edd64 (9th recurrence, PEACHES BLOCKING on PR #410 + HOLDEN trace):
|
|
273
|
+
// the footer's DOM ref (app-rendering.js's activityEl, via getActivityEl/
|
|
274
|
+
// setActivityEl) must not depend on a store.processing VALUE TRANSITION to
|
|
275
|
+
// get repaired. resetClientState() (app-projects.js) nulls the ref
|
|
276
|
+
// independently of any value change — a session switch where the outgoing
|
|
277
|
+
// AND incoming session are both isProcessing=true never fires the
|
|
278
|
+
// ['processing'] subscriber above (store.js's changed-flag bounding: the
|
|
279
|
+
// value is true before and after), so the widget could never be
|
|
280
|
+
// re-raised, leaving the footer stuck OFF for that session and every
|
|
281
|
+
// later broadcast carrying the same unchanged true value (identical
|
|
282
|
+
// mechanism, inverse edge, to the finding-1 stuck-OFF this same task
|
|
283
|
+
// already fixed once for false->true).
|
|
284
|
+
//
|
|
285
|
+
// FIX SHAPE (not another ordering tweak — see this task's dispatch note):
|
|
286
|
+
// this is an explicit, unconditional "render the footer from current
|
|
287
|
+
// store.processing now" call. Callers invoke it directly, right after
|
|
288
|
+
// applying a 'processing' projection (app-messages.js's session_list and
|
|
289
|
+
// session_switched handlers) — not gated on whether that store.set()
|
|
290
|
+
// actually changed the value. This is safe to call redundantly (setActivity
|
|
291
|
+
// itself no-ops when the DOM already matches the requested state via its
|
|
292
|
+
// own getActivityEl() presence check), and it does not touch
|
|
293
|
+
// lr-9bcd7b's changed-flag bounding on store.set()/the subscriber above,
|
|
294
|
+
// which still exists to suppress spurious re-renders on unrelated store
|
|
295
|
+
// updates that happen to carry the same 'processing' value along for the
|
|
296
|
+
// ride.
|
|
297
|
+
export function reconcileActivityFooter() {
|
|
298
|
+
if (getChatLayout() !== "channel") {
|
|
299
|
+
if (store.get('processing')) {
|
|
300
|
+
setActivity("thinking");
|
|
301
|
+
} else {
|
|
302
|
+
setActivity(null);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
@@ -53,7 +53,7 @@ import { handleLoopRegistryUpdated, handleScheduleRunStarted, handleScheduleRunF
|
|
|
53
53
|
|
|
54
54
|
// --- App module imports ---
|
|
55
55
|
import { scrollToBottom, addToMessages, addUserMessage, addSystemMessage, appendDelta, finalizeAssistantBlock, addConflictMessage, addContextOverflowMessage, showSuggestionChips, removePreThinking } from './app-rendering.js';
|
|
56
|
-
import { startUrgentBlink, stopUrgentBlink, blinkSessionDot, updateCrossProjectBlink } from './app-favicon.js';
|
|
56
|
+
import { startUrgentBlink, stopUrgentBlink, blinkSessionDot, updateCrossProjectBlink, reconcileActivityFooter } from './app-favicon.js';
|
|
57
57
|
import { setStatus } from './app-connection.js';
|
|
58
58
|
import { getModelEffortLevels, accumulateUsage, setSessionUsage, updateUsagePanel, accumulateContext, updateContextPanel, renderCtxPopover, updateStatusPanel } from './app-panels.js';
|
|
59
59
|
import { updateProjectList, resetClientState, showUpdateAvailable, handleRemoveProjectCheckResult, handleRemoveProjectResult, handleBrowseDirResult, handleAddProjectResult, handleCloneProgress } from './app-projects.js';
|
|
@@ -69,7 +69,8 @@ import { handleMentionStart, handleMentionActivity, handleMentionStream, handleM
|
|
|
69
69
|
import { handleTeamState, handleTeamMemberUpdate, handleTeamTaskUpdate, handleTeamMessage as handleTeamMsg, handleTeamGone } from './team-panel.js';
|
|
70
70
|
import { addDiagnostic } from './diagnostics.js';
|
|
71
71
|
import { handleHistoryMeta, handleHistoryDone } from './app-history-replay.js';
|
|
72
|
-
import { shouldApplyActivityEdge
|
|
72
|
+
import { shouldApplyActivityEdge } from './activity-latch.js';
|
|
73
|
+
import { deriveSessionListProcessing } from './activity-state.js';
|
|
73
74
|
|
|
74
75
|
// --- DOM refs (cached once, stable for page lifetime) ---
|
|
75
76
|
var messagesEl = document.getElementById("messages");
|
|
@@ -379,6 +380,58 @@ registerHandlers({
|
|
|
379
380
|
session_list: function (msg) {
|
|
380
381
|
renderSessionList(msg.sessions || []);
|
|
381
382
|
handlePaletteSessionSwitch();
|
|
383
|
+
// lr-5edd64: 'processing' (the transcript footer's field) is now a pure
|
|
384
|
+
// PROJECTION of server-authoritative per-session state — nothing writes
|
|
385
|
+
// it independently anymore (see activity-latch.js's header comment for
|
|
386
|
+
// what this replaced). session_list already carries per-session
|
|
387
|
+
// isProcessing to EVERY client regardless of which session that client
|
|
388
|
+
// has focused (lib/sessions.js broadcastSessionList/mapSessionForClient
|
|
389
|
+
// is not scoped by ws._clagenticActiveSession the way status/done/
|
|
390
|
+
// auth_required sends are) — this is what makes re-deriving here, on
|
|
391
|
+
// every list broadcast, correct for a session whose activity edge this
|
|
392
|
+
// client's own WS connection never received (MILLER lr-5edd64 comment
|
|
393
|
+
// #3, candidate 1: the server-side ws._clagenticActiveSession send filter,
|
|
394
|
+
// not the client-side latch, was dropping the edge before it ever
|
|
395
|
+
// arrived). The other query/snapshot half of the projection is
|
|
396
|
+
// session_switched (below), covering reconnect/switch/hydration.
|
|
397
|
+
// Bounded to the entry matching activeSessionId; store.set() and the
|
|
398
|
+
// footer's own subscriber both already no-op on an unchanged value
|
|
399
|
+
// (lr-9bcd7b's changed-flag bounding), so this cannot introduce a
|
|
400
|
+
// spurious render on every roster broadcast.
|
|
401
|
+
//
|
|
402
|
+
// { ignoreUnread: true } (PEACHES finding 2, lr-5edd64 8th recurrence):
|
|
403
|
+
// the transcript footer is a "a turn is running" indicator, not an
|
|
404
|
+
// unread-alert surface — it has no unread badge affordance of its own,
|
|
405
|
+
// unlike the sidebar/hub dots this same sessionActivity() call also
|
|
406
|
+
// drives. Without this, sessionActivity()'s alert>processing precedence
|
|
407
|
+
// (activity-state.js's LOCKED rule) makes .active true whenever
|
|
408
|
+
// unread>0 REGARDLESS of isProcessing, so a session with isProcessing
|
|
409
|
+
// false and unread>0 pins the footer on with no turn running — the
|
|
410
|
+
// exact "processing dot when idle" symptom this task's operator
|
|
411
|
+
// report described. session_switched's own projection (below) reads
|
|
412
|
+
// sessionIsProcessing directly, which is already immune to this
|
|
413
|
+
// conflation; this call site now matches it. This narrows
|
|
414
|
+
// activity-state.js's documented ignoreUnread contract ("session-level
|
|
415
|
+
// dots never set this" — see its header) for this ONE session-level
|
|
416
|
+
// consumer, since the footer is a processing indicator, not a dot with
|
|
417
|
+
// its own alert affordance; see that header comment for the updated
|
|
418
|
+
// contract.
|
|
419
|
+
// Derivation itself lives in activity-state.js's deriveSessionListProcessing
|
|
420
|
+
// (extracted, not inlined here) specifically so a test can import and
|
|
421
|
+
// exercise this exact production logic directly — app-messages.js is
|
|
422
|
+
// not importable under plain Node (see that function's own doc comment
|
|
423
|
+
// for why), so leaving this inline would leave only a hand-copied
|
|
424
|
+
// reimplementation testable, not the shipped code.
|
|
425
|
+
var _projection = deriveSessionListProcessing(msg.sessions || [], store.get('activeSessionId'));
|
|
426
|
+
if (_projection.found) {
|
|
427
|
+
store.set({ processing: _projection.active });
|
|
428
|
+
// lr-5edd64 (9th recurrence): reconcile the footer's DOM ref
|
|
429
|
+
// unconditionally, not only when store.set() actually changed the
|
|
430
|
+
// value — see app-favicon.js's reconcileActivityFooter() doc for why
|
|
431
|
+
// an unchanged-but-still-true value can otherwise leave a ref nulled
|
|
432
|
+
// by resetClientState() permanently unrepaired.
|
|
433
|
+
reconcileActivityFooter();
|
|
434
|
+
}
|
|
382
435
|
// Drain pending hub cross-project session switch (set by handleHubRecentSessions
|
|
383
436
|
// when switching to a session in a different project). Fires here because
|
|
384
437
|
// session_list is the first reliable post-connect message that guarantees
|
|
@@ -454,14 +507,11 @@ registerHandlers({
|
|
|
454
507
|
// (project-connection.js's hydration path previously omitted it —
|
|
455
508
|
// sessions.js's own switchSession() send already had it).
|
|
456
509
|
store.set({ activeSessionId: msg.id, cliSessionId: msg.cliSessionId || null, vendorCapabilities: msg.capabilities || {}, sessionIsProcessing: !!msg.isProcessing });
|
|
457
|
-
//
|
|
458
|
-
// (
|
|
459
|
-
//
|
|
460
|
-
//
|
|
461
|
-
//
|
|
462
|
-
// already-reconciled value instead of trusting whatever the
|
|
463
|
-
// client-local latch happened to be left at.
|
|
464
|
-
store.set({ processing: store.get('sessionIsProcessing') });
|
|
510
|
+
// NOTE: the 'processing' projection itself is applied further down,
|
|
511
|
+
// AFTER resetClientState() (PEACHES finding 1, lr-5edd64 8th
|
|
512
|
+
// recurrence) — see the comment down there for why the ordering
|
|
513
|
+
// matters. Do not move this store.set({ processing: ... }) back up
|
|
514
|
+
// here without re-reading that comment.
|
|
465
515
|
if (msg.vendor) {
|
|
466
516
|
if (!store.get('vendorSelectionLocked') || msg.hasHistory) {
|
|
467
517
|
store.set({ currentVendor: msg.vendor });
|
|
@@ -500,6 +550,37 @@ registerHandlers({
|
|
|
500
550
|
// Session presence is now tracked server-side (user-presence.json)
|
|
501
551
|
clearRemoteCursors();
|
|
502
552
|
resetClientState();
|
|
553
|
+
// Re-derive 'processing' from sessionIsProcessing (set above), NOT from
|
|
554
|
+
// a second raw msg.isProcessing read — this file's CI invariant test
|
|
555
|
+
// locks .isProcessing reads to exactly the one documented site above,
|
|
556
|
+
// so every switch/reconnect/hydration re-derives 'processing' from that
|
|
557
|
+
// already-read, already-reconciled value instead of trusting whatever
|
|
558
|
+
// the client-local latch happened to be left at.
|
|
559
|
+
//
|
|
560
|
+
// Applied HERE, AFTER resetClientState(), not right after
|
|
561
|
+
// sessionIsProcessing is set above (PEACHES finding 1, lr-5edd64 8th
|
|
562
|
+
// recurrence): resetClientState() calls setActivityEl(null), nulling the
|
|
563
|
+
// footer widget's DOM ref, and wipes the transcript DOM outright. Running
|
|
564
|
+
// the projection after the reset means the incoming session's own
|
|
565
|
+
// transcript DOM already exists by the time the footer is (re)rendered.
|
|
566
|
+
//
|
|
567
|
+
// The render call itself is UNCONDITIONAL (lr-5edd64, 9th recurrence —
|
|
568
|
+
// PEACHES BLOCKING on PR #410 + HOLDEN's trace), not left to
|
|
569
|
+
// initActivityFooter's ['processing'] value-change subscriber: on a
|
|
570
|
+
// true->true session switch (outgoing session processing, incoming
|
|
571
|
+
// session also processing) store.set() below does not change the value,
|
|
572
|
+
// so a value-change subscriber alone would never fire and the ref
|
|
573
|
+
// resetClientState() just nulled would never get repaired — stuck OFF
|
|
574
|
+
// forever, the exact inverse of the stuck-ON failure this redesign
|
|
575
|
+
// exists to close (see finding 1's fix above, which fixed false->true
|
|
576
|
+
// and left true->true broken this same way). reconcileActivityFooter()
|
|
577
|
+
// renders unconditionally from current store.processing instead of
|
|
578
|
+
// depending on a transition firing — see its doc comment in
|
|
579
|
+
// app-favicon.js. This does not defeat lr-9bcd7b's changed-flag
|
|
580
|
+
// bounding on store.set()/the subscriber, which still exists and still
|
|
581
|
+
// suppresses spurious renders on unrelated store updates.
|
|
582
|
+
store.set({ processing: store.get('sessionIsProcessing') });
|
|
583
|
+
reconcileActivityFooter();
|
|
503
584
|
// lr-0827ba: redraw the incoming session's own armed rate-limit /
|
|
504
585
|
// scheduled-message state (arming happens per-session in the
|
|
505
586
|
// background regardless of focus — see rate-limit-state.js) instead
|
|
@@ -624,25 +705,20 @@ registerHandlers({
|
|
|
624
705
|
},
|
|
625
706
|
|
|
626
707
|
status: function (msg) {
|
|
627
|
-
//
|
|
628
|
-
//
|
|
629
|
-
//
|
|
630
|
-
//
|
|
631
|
-
//
|
|
632
|
-
//
|
|
633
|
-
//
|
|
634
|
-
//
|
|
635
|
-
//
|
|
636
|
-
//
|
|
637
|
-
//
|
|
708
|
+
// lr-5edd64: this handler no longer writes 'processing' (the transcript
|
|
709
|
+
// footer's field) — that is now a pure projection derived from
|
|
710
|
+
// session_list/session_switched (see those handlers). Session-scoping
|
|
711
|
+
// still gates the OTHER, non-render side effects below (sessionIsProcessing
|
|
712
|
+
// for dead-session-todo-compaction, and the pre-thinking-dots clear),
|
|
713
|
+
// mirroring the lr-0827ba pattern already used by scheduled_message_*
|
|
714
|
+
// handlers (msg.localId == null || msg.localId === activeSessionId) —
|
|
715
|
+
// a background session's status:"processing" must not touch state
|
|
716
|
+
// scoped to the FOCUSED session. msg.localId is always populated
|
|
717
|
+
// server-side (see sessions.js stampActivityLocalId / project.js
|
|
718
|
+
// sendToSession); a missing localId (e.g. an older server) falls back
|
|
719
|
+
// to applying unconditionally, same as before this fix.
|
|
638
720
|
if (msg.status === "processing") {
|
|
639
|
-
|
|
640
|
-
var _statusEdgeAccepted = shouldApplyActivityEdge(msg.localId, _statusActiveSid);
|
|
641
|
-
// lr-58c813: ledger this edge's outcome for observability only — the
|
|
642
|
-
// decision below (same _statusEdgeAccepted value) is unchanged.
|
|
643
|
-
recordActivityEdgeDecision("status", msg.localId, _statusActiveSid, _statusEdgeAccepted);
|
|
644
|
-
if (_statusEdgeAccepted) {
|
|
645
|
-
setStatus("processing");
|
|
721
|
+
if (shouldApplyActivityEdge(msg.localId, store.get('activeSessionId'))) {
|
|
646
722
|
// Session became live — undo any dead-session todo compaction
|
|
647
723
|
// applied at history_done time.
|
|
648
724
|
store.set({ sessionIsProcessing: true });
|
|
@@ -863,13 +939,13 @@ registerHandlers({
|
|
|
863
939
|
}
|
|
864
940
|
},
|
|
865
941
|
|
|
866
|
-
//
|
|
867
|
-
//
|
|
868
|
-
//
|
|
869
|
-
//
|
|
870
|
-
//
|
|
871
|
-
//
|
|
872
|
-
//
|
|
942
|
+
// lr-5edd64: this handler no longer writes 'processing' — it is now a
|
|
943
|
+
// pure projection derived from session_list/session_switched (see those
|
|
944
|
+
// handlers). Every cleanup call below is unconditional: it targets
|
|
945
|
+
// DOM/tool state for whatever session this client's own WS connection is
|
|
946
|
+
// bound to server-side (ws._clagenticActiveSession), so it is never
|
|
947
|
+
// cross-session — there was no other session-scoped state to guard here
|
|
948
|
+
// once the store-wide latch write is gone.
|
|
873
949
|
done: function (msg) {
|
|
874
950
|
removePreThinking();
|
|
875
951
|
// lr-66c118: the setActivity clear call is removed here too — see the
|
|
@@ -879,14 +955,6 @@ registerHandlers({
|
|
|
879
955
|
markAllToolsDone();
|
|
880
956
|
closeToolGroup();
|
|
881
957
|
finalizeAssistantBlock();
|
|
882
|
-
var _doneActiveSid = store.get('activeSessionId');
|
|
883
|
-
var _doneEdgeAccepted = shouldApplyActivityEdge(msg.localId, _doneActiveSid);
|
|
884
|
-
// lr-58c813: ledger this edge's outcome for observability only — the
|
|
885
|
-
// decision below (same _doneEdgeAccepted value) is unchanged.
|
|
886
|
-
recordActivityEdgeDecision("done", msg.localId, _doneActiveSid, _doneEdgeAccepted);
|
|
887
|
-
if (_doneEdgeAccepted) {
|
|
888
|
-
setStatus("connected");
|
|
889
|
-
}
|
|
890
958
|
// Re-enable input unless this is one of the loop's own sessions (coder/judge).
|
|
891
959
|
// A loop running in a separate session must not suppress input here.
|
|
892
960
|
var _doneLoopSid = store.get('loopCurrentSessionId');
|
|
@@ -931,23 +999,15 @@ registerHandlers({
|
|
|
931
999
|
addContextOverflowMessage(msg);
|
|
932
1000
|
},
|
|
933
1001
|
|
|
1002
|
+
// lr-5edd64: no longer session-scope-guards a 'processing' write here —
|
|
1003
|
+
// that field is now a pure projection (see session_list/session_switched
|
|
1004
|
+
// handlers), and nothing else in this handler was gated by the guard.
|
|
934
1005
|
auth_required: function (msg) {
|
|
935
1006
|
removePreThinking();
|
|
936
1007
|
stopThinking();
|
|
937
1008
|
markAllToolsDone();
|
|
938
1009
|
closeToolGroup();
|
|
939
1010
|
appendDelta((msg.text || "Authentication required.") + "\n");
|
|
940
|
-
// Same session-scoping as the done handler above — a background
|
|
941
|
-
// session's auth_required must not clear the focused session's
|
|
942
|
-
// 'processing' latch.
|
|
943
|
-
var _authActiveSid = store.get('activeSessionId');
|
|
944
|
-
var _authEdgeAccepted = shouldApplyActivityEdge(msg.localId, _authActiveSid);
|
|
945
|
-
// lr-58c813: ledger this edge's outcome for observability only — the
|
|
946
|
-
// decision below (same _authEdgeAccepted value) is unchanged.
|
|
947
|
-
recordActivityEdgeDecision("auth_required", msg.localId, _authActiveSid, _authEdgeAccepted);
|
|
948
|
-
if (_authEdgeAccepted) {
|
|
949
|
-
setStatus("connected");
|
|
950
|
-
}
|
|
951
1011
|
var _authLoopSid = store.get('loopCurrentSessionId');
|
|
952
1012
|
if (!store.get('loopActive') || !_authLoopSid || store.get('activeSessionId') !== _authLoopSid) {
|
|
953
1013
|
enableMainInput();
|
|
@@ -381,12 +381,12 @@ export function renderProjectList() {
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
// Re-apply current socket status to the active icon's dot. st.processing
|
|
384
|
-
// is
|
|
385
|
-
//
|
|
386
|
-
//
|
|
387
|
-
//
|
|
388
|
-
//
|
|
389
|
-
//
|
|
384
|
+
// is always tone 'self' — it can only ever be about the viewing user's
|
|
385
|
+
// own connection. lr-66c118: routed through the same derivation as every
|
|
386
|
+
// other dot rather than writing '.processing' as an independent 3rd
|
|
387
|
+
// state source. lr-5edd64: st.processing is now a projection of the
|
|
388
|
+
// focused session's server-authoritative isProcessing (app-messages.js's
|
|
389
|
+
// session_list/session_switched handlers), not a client-local latch.
|
|
390
390
|
var dot = getStatusDot();
|
|
391
391
|
if (dot) {
|
|
392
392
|
if (st.connected) {
|
|
@@ -408,7 +408,24 @@ export function resetClientState() {
|
|
|
408
408
|
clearPendingImages();
|
|
409
409
|
clearAllMentionActive();
|
|
410
410
|
setActivityEl(null);
|
|
411
|
-
|
|
411
|
+
// lr-5edd64: no longer force-zeroes 'processing' here. It is a
|
|
412
|
+
// PROJECTION now (session_list/session_switched handlers derive it via
|
|
413
|
+
// activity-state.js's sessionActivity()) — unconditionally zeroing it
|
|
414
|
+
// here would stomp a correctly-projected value. session_switched calls
|
|
415
|
+
// resetClientState() BEFORE applying its own 'processing' projection so
|
|
416
|
+
// setActivityEl(null) above nulls the footer widget's DOM ref before the
|
|
417
|
+
// incoming session's transcript DOM exists, and before this function's
|
|
418
|
+
// own innerHTML="" wipes the outgoing one.
|
|
419
|
+
//
|
|
420
|
+
// The DOM ref this line nulls is repaired by an explicit, UNCONDITIONAL
|
|
421
|
+
// call (app-favicon.js's reconcileActivityFooter()) that each projection
|
|
422
|
+
// caller makes right after applying its own 'processing' projection — not
|
|
423
|
+
// by relying on initActivityFooter's ['processing'] value-change
|
|
424
|
+
// subscriber to fire (lr-5edd64, 9th recurrence: a session switch where
|
|
425
|
+
// the value is UNCHANGED across the destroy, e.g. true->true, would never
|
|
426
|
+
// fire that subscriber, leaving this ref permanently un-repaired — see
|
|
427
|
+
// app-messages.js's session_switched handler and app-favicon.js's
|
|
428
|
+
// reconcileActivityFooter() doc for the full mechanism).
|
|
412
429
|
setTurnCounter(0);
|
|
413
430
|
store.set({ messageUuidMap: [] });
|
|
414
431
|
store.set({ historyFrom: 0 });
|