@clagentic/console 1.9.0-beta.1 → 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 +23 -1
- package/lib/agents.js +13 -3
- package/lib/build-sha.json +2 -2
- package/lib/cli/ipc-subcommands.js +84 -4
- package/lib/daemon.js +111 -7
- package/lib/effective-protocol.js +82 -0
- package/lib/project-connection.js +21 -8
- package/lib/project-filesystem.js +4 -4
- package/lib/project-http.js +4 -4
- package/lib/project-loop.js +49 -5
- package/lib/project-sessions.js +166 -68
- package/lib/project-user-mention.js +7 -7
- package/lib/project-user-message.js +81 -14
- package/lib/project.js +28 -22
- package/lib/public/app.js +18 -4
- package/lib/public/css/base.css +14 -0
- package/lib/public/css/filebrowser.css +6 -0
- package/lib/public/css/home-hub.css +28 -8
- package/lib/public/css/icon-strip.css +17 -0
- package/lib/public/css/messages.css +11 -0
- package/lib/public/css/mobile-nav.css +22 -0
- package/lib/public/css/server-settings.css +9 -0
- package/lib/public/css/sidebar.css +15 -0
- package/lib/public/css/title-bar.css +10 -1
- package/lib/public/index.html +9 -2
- package/lib/public/modules/activity-latch.js +45 -0
- package/lib/public/modules/activity-state.js +195 -0
- package/lib/public/modules/app-connection.js +31 -6
- package/lib/public/modules/app-favicon.js +75 -1
- package/lib/public/modules/app-home-hub.js +14 -11
- package/lib/public/modules/app-loop-ui.js +86 -2
- package/lib/public/modules/app-messages.js +178 -54
- package/lib/public/modules/app-panels.js +91 -32
- package/lib/public/modules/app-projects.js +46 -9
- package/lib/public/modules/app-rate-limit.js +13 -1
- package/lib/public/modules/server-settings.js +256 -21
- package/lib/public/modules/sidebar-mobile.js +32 -22
- package/lib/public/modules/sidebar-projects.js +42 -14
- package/lib/public/modules/sidebar-sessions.js +168 -48
- package/lib/public/modules/theme.js +2 -2
- package/lib/public/modules/tools.js +11 -39
- package/lib/sdk-bridge.js +375 -33
- package/lib/sdk-message-processor.js +98 -15
- package/lib/sdk-skill-discovery.js +46 -6
- package/lib/sdk-slash-enrichment.js +5 -2
- package/lib/server-dm.js +5 -5
- package/lib/server-hub-sessions.js +70 -0
- package/lib/server.js +78 -43
- package/lib/session-activity.js +9 -2
- package/lib/sessions.js +64 -18
- package/lib/smtp.js +10 -1
- package/lib/terminal-manager.js +6 -6
- package/lib/ws-schema.js +16 -0
- package/lib/yoke/adapters/claude.js +7 -1
- package/lib/yoke/adapters/codex.js +219 -31
- package/package.json +2 -2
- package/scripts/check-test-count.js +397 -0
- package/scripts/test-file-completion-reporter.js +43 -0
- package/scripts/verify-installed-build.js +242 -15
- package/lib/model-context-windows.js +0 -74
- package/lib/public/modules/model-context-windows.js +0 -71
|
@@ -8,11 +8,12 @@ import { renderProjectIcon } from './project-icon.js';
|
|
|
8
8
|
import { store } from './store.js';
|
|
9
9
|
import { getWs, setWs } from './ws-ref.js';
|
|
10
10
|
import { getMessagesEl, getStatusDot } from './dom-refs.js';
|
|
11
|
+
import { sessionActivity, indicatorClass } from './activity-state.js';
|
|
11
12
|
import { userAvatarUrl } from './avatar.js';
|
|
12
13
|
import { showConfirm } from './app-misc.js';
|
|
13
14
|
// renderUserStrip is now reactive via store subscriber in sidebar-users.js
|
|
14
15
|
import { renderIconStrip } from './sidebar-projects.js';
|
|
15
|
-
import { updateCrossProjectBlink, stopUrgentBlink
|
|
16
|
+
import { updateCrossProjectBlink, stopUrgentBlink } from './app-favicon.js';
|
|
16
17
|
import { spawnDustParticles } from './sidebar.js';
|
|
17
18
|
import { isSearchOpen, closeSearch } from './session-search.js';
|
|
18
19
|
import { exitDmMode } from './app-dm.js';
|
|
@@ -313,13 +314,15 @@ export function renderTopbarPresence(serverUsers) {
|
|
|
313
314
|
}
|
|
314
315
|
|
|
315
316
|
export function renderProjectList() {
|
|
317
|
+
// lr-66c118: activity-state.js is the sole reader of the processing flag
|
|
318
|
+
// (CI-enforced) — Object.assign carries it through untouched rather than
|
|
319
|
+
// this mapper naming/reading the property itself.
|
|
316
320
|
var iconStripProjects = cachedProjects.map(function (p) {
|
|
317
|
-
return {
|
|
321
|
+
return Object.assign({}, p, {
|
|
318
322
|
slug: p.slug,
|
|
319
323
|
name: p.title || p.project,
|
|
320
324
|
icon: p.icon || null,
|
|
321
325
|
folderName: p.folderName || null,
|
|
322
|
-
isProcessing: p.isProcessing,
|
|
323
326
|
onlineUsers: p.onlineUsers || [],
|
|
324
327
|
unread: p.unread || 0,
|
|
325
328
|
pendingPermissions: p.pendingPermissions || 0,
|
|
@@ -327,7 +330,7 @@ export function renderProjectList() {
|
|
|
327
330
|
parentSlug: p.parentSlug || null,
|
|
328
331
|
branch: p.branch || null,
|
|
329
332
|
worktreeAccessible: p.worktreeAccessible !== undefined ? p.worktreeAccessible : true,
|
|
330
|
-
};
|
|
333
|
+
});
|
|
331
334
|
});
|
|
332
335
|
var st = store.snap();
|
|
333
336
|
var iconStripActiveSlug = st.currentSlug;
|
|
@@ -377,11 +380,20 @@ export function renderProjectList() {
|
|
|
377
380
|
}
|
|
378
381
|
}
|
|
379
382
|
}
|
|
380
|
-
// Re-apply current socket status to the active icon's dot
|
|
383
|
+
// Re-apply current socket status to the active icon's dot. st.processing
|
|
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.
|
|
381
390
|
var dot = getStatusDot();
|
|
382
391
|
if (dot) {
|
|
383
|
-
if (st.connected
|
|
384
|
-
|
|
392
|
+
if (st.connected) {
|
|
393
|
+
dot.classList.add("connected");
|
|
394
|
+
var localActivityCls = indicatorClass(sessionActivity({ isProcessing: st.processing }));
|
|
395
|
+
if (localActivityCls) dot.classList.add(localActivityCls);
|
|
396
|
+
}
|
|
385
397
|
}
|
|
386
398
|
updateCrossProjectBlink();
|
|
387
399
|
}
|
|
@@ -396,7 +408,24 @@ export function resetClientState() {
|
|
|
396
408
|
clearPendingImages();
|
|
397
409
|
clearAllMentionActive();
|
|
398
410
|
setActivityEl(null);
|
|
399
|
-
|
|
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).
|
|
400
429
|
setTurnCounter(0);
|
|
401
430
|
store.set({ messageUuidMap: [] });
|
|
402
431
|
store.set({ historyFrom: 0 });
|
|
@@ -406,7 +435,15 @@ export function resetClientState() {
|
|
|
406
435
|
setIsUserScrolledUp(false);
|
|
407
436
|
document.getElementById("new-msg-btn").classList.add("hidden");
|
|
408
437
|
setRewindMode(false);
|
|
409
|
-
setActivity
|
|
438
|
+
// lr-66c118 / lr-6e20f7: the setActivity clear call is removed here —
|
|
439
|
+
// setActivityEl(null) above already nulls the activity-widget ref, and
|
|
440
|
+
// getMessagesEl().innerHTML = "" already wiped the DOM element itself, so
|
|
441
|
+
// an explicit setActivity(null) call here would be redundant. The widget's
|
|
442
|
+
// OWN reactive clear (app-favicon.js's initActivityFooter, subscribed to
|
|
443
|
+
// store.processing) additionally still needs the DOM ref nulled out here —
|
|
444
|
+
// setActivityEl(null) above is exactly what makes that safe, since a
|
|
445
|
+
// reactive clear firing after this reset would otherwise find a stale ref
|
|
446
|
+
// pointing at an element already removed from the DOM by innerHTML="".
|
|
410
447
|
setStatus("connected");
|
|
411
448
|
// Always re-enable input on session switch. A loop running in another session
|
|
412
449
|
// has its own dedicated session and must not lock unrelated sessions.
|
|
@@ -113,11 +113,23 @@ function updateRateLimitIndicator(msg) {
|
|
|
113
113
|
var isRejected = msg.status === "rejected";
|
|
114
114
|
var pillClass = "header-rate-limit" + (isRejected ? " rejected" : " warning");
|
|
115
115
|
var label = isRejected ? "Rate limited" : "Rate warning";
|
|
116
|
+
// lr-872f94: render the vendor-reported usedPercent in the pill itself
|
|
117
|
+
// (previously only surfaced in the transient warning popover text).
|
|
118
|
+
// Applies to both providers -- Codex's account/rateLimits/updated and
|
|
119
|
+
// Claude's rate_limit_info both carry `utilization` (0-1 fraction) through
|
|
120
|
+
// the same yokeType: "rate_limit" event shape (lib/sdk-message-processor.js).
|
|
121
|
+
var pct = typeof msg.utilization === "number" ? Math.round(msg.utilization * 100) : null;
|
|
122
|
+
var pctHtml = pct != null ? '<span class="header-pill-pct">' + pct + "%</span>" : "";
|
|
123
|
+
// lr-872f94 fold-in: this link was hardcoded to Claude's usage page even
|
|
124
|
+
// for Codex-triggered warnings/rejections. getVendorUsageMeta already
|
|
125
|
+
// exists for exactly this (used by the rate_limit_usage widget below).
|
|
126
|
+
var vendorMeta = getVendorUsageMeta(store.get('currentVendor') || "claude");
|
|
116
127
|
rateLimitIndicatorEl.innerHTML =
|
|
117
128
|
'<span class="' + pillClass + '">' +
|
|
118
129
|
iconHtml("alert-triangle") +
|
|
119
130
|
'<span class="header-pill-text">' + label + "</span>" +
|
|
120
|
-
|
|
131
|
+
pctHtml +
|
|
132
|
+
'<a href="' + vendorMeta.href + '" target="_blank" rel="noopener" class="rate-limit-link">' +
|
|
121
133
|
iconHtml("external-link") +
|
|
122
134
|
"</a>" +
|
|
123
135
|
"</span>";
|
|
@@ -236,29 +236,30 @@ export function initServerSettings(appCtx) {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
// Advanced Memory: min available memory input
|
|
239
|
+
// Advanced Memory: min available memory input.
|
|
240
|
+
// change (blur/Enter) stays wired as an implicit commit path for users who
|
|
241
|
+
// expect it; the explicit ss-memory-save-btn click below (lr-9e6569) is
|
|
242
|
+
// the primary, discoverable affordance — this panel had none before.
|
|
240
243
|
var memAvailInput = document.getElementById("settings-mem-available-min");
|
|
241
244
|
if (memAvailInput) {
|
|
242
|
-
memAvailInput.addEventListener("change", function () {
|
|
243
|
-
var val = parseInt(this.value, 10);
|
|
244
|
-
if (isNaN(val) || val < 0) return;
|
|
245
|
-
var ws = ctx.ws;
|
|
246
|
-
if (ws && ws.readyState === 1) {
|
|
247
|
-
ws.send(JSON.stringify({ type: "set_mem_available_threshold", value: val }));
|
|
248
|
-
}
|
|
249
|
-
});
|
|
245
|
+
memAvailInput.addEventListener("change", function () { saveMemAvailableThreshold(); });
|
|
250
246
|
}
|
|
251
247
|
|
|
252
|
-
// Advanced Memory: tokens per MB headroom input
|
|
248
|
+
// Advanced Memory: tokens per MB headroom input (same change-listener rationale).
|
|
253
249
|
var tpmInput = document.getElementById("settings-tokens-per-mb-headroom");
|
|
254
250
|
if (tpmInput) {
|
|
255
|
-
tpmInput.addEventListener("change", function () {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
251
|
+
tpmInput.addEventListener("change", function () { saveTokensPerMbHeadroom(); });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Advanced Memory: explicit Save button (lr-9e6569). The panel previously had
|
|
255
|
+
// no commit affordance at all -- only the native change event above, which
|
|
256
|
+
// never fires for a user who types a value and navigates away without
|
|
257
|
+
// blurring. Saves both fields; each still validates independently.
|
|
258
|
+
var memorySaveBtn = document.getElementById("ss-memory-save-btn");
|
|
259
|
+
if (memorySaveBtn) {
|
|
260
|
+
memorySaveBtn.addEventListener("click", function () {
|
|
261
|
+
saveMemAvailableThreshold();
|
|
262
|
+
saveTokensPerMbHeadroom();
|
|
262
263
|
});
|
|
263
264
|
}
|
|
264
265
|
|
|
@@ -744,11 +745,23 @@ export function updateDaemonConfig(config) {
|
|
|
744
745
|
var portEl = document.getElementById("settings-port");
|
|
745
746
|
if (portEl) portEl.textContent = String(config.port || "-");
|
|
746
747
|
|
|
747
|
-
//
|
|
748
|
+
// HTTPS (lr-20e71c): three states, not two. tlsState distinguishes the
|
|
749
|
+
// daemon terminating TLS itself ("direct") from a trusted reverse proxy
|
|
750
|
+
// terminating it in front of the daemon ("proxy") — both are genuinely
|
|
751
|
+
// HTTPS from the client's perspective, but only "direct" means tlsOptions
|
|
752
|
+
// is set. A real unencrypted deployment ("disabled") must render visibly
|
|
753
|
+
// distinct from both, never silently reported as Enabled.
|
|
748
754
|
var tlsEl = document.getElementById("settings-tls");
|
|
749
755
|
if (tlsEl) {
|
|
750
|
-
|
|
751
|
-
|
|
756
|
+
var tlsState = config.tlsState || (config.tls ? "direct" : "disabled");
|
|
757
|
+
var tlsLabel = tlsState === "direct" ? "Enabled" :
|
|
758
|
+
tlsState === "proxy" ? "Enabled (proxy)" : "Disabled";
|
|
759
|
+
tlsEl.textContent = tlsLabel;
|
|
760
|
+
tlsEl.classList.toggle("settings-badge-green", tlsState === "direct");
|
|
761
|
+
tlsEl.classList.toggle("settings-badge-proxy", tlsState === "proxy");
|
|
762
|
+
tlsEl.title = tlsState === "proxy"
|
|
763
|
+
? "TLS is terminated by a reverse proxy in front of this daemon, not by the daemon itself."
|
|
764
|
+
: "";
|
|
752
765
|
}
|
|
753
766
|
|
|
754
767
|
// Debug
|
|
@@ -796,14 +809,53 @@ export function updateDaemonConfig(config) {
|
|
|
796
809
|
liteAutoEnrollToggle.checked = !!config.liteAutoEnroll;
|
|
797
810
|
}
|
|
798
811
|
|
|
799
|
-
// Advanced Memory inputs
|
|
812
|
+
// Advanced Memory inputs. lr-9e6569: memAvailableMinMBIsDefault /
|
|
813
|
+
// tokensPerMbHeadroomIsDefault distinguish "this number is a fallback
|
|
814
|
+
// because nothing was ever persisted" from "this number was saved" -- an
|
|
815
|
+
// absent config key renders a value visually identical to a persisted one
|
|
816
|
+
// otherwise, which is part of why a discarded edit went unnoticed.
|
|
800
817
|
var memAvailEl = document.getElementById("settings-mem-available-min");
|
|
801
818
|
if (memAvailEl && config.memAvailableMinMB !== undefined) {
|
|
802
819
|
memAvailEl.value = String(config.memAvailableMinMB);
|
|
820
|
+
// lr-9e6569 fold-in (BOBBIE bobbie.uncat.1): the dedup marker means "the
|
|
821
|
+
// value the server is known to hold", not "the last value this tab
|
|
822
|
+
// optimistically transmitted". This snapshot IS the server's authoritative
|
|
823
|
+
// state, so reconcile the marker here too -- otherwise a save whose
|
|
824
|
+
// response never arrives (disconnect between send and daemon processing)
|
|
825
|
+
// leaves the marker pinned to the unconfirmed value; a reconnect repaints
|
|
826
|
+
// .value but not the marker, and a later legitimate retry of that exact
|
|
827
|
+
// value is then silently suppressed by saveMemAvailableThreshold's
|
|
828
|
+
// `val === lastSentMemAvailableMin` check with no send and no feedback.
|
|
829
|
+
// A fallback default is intentionally NOT marked as last-sent: clicking
|
|
830
|
+
// Save on "Using default — not yet saved" must still persist the key.
|
|
831
|
+
lastSentMemAvailableMin = config.memAvailableMinMBIsDefault === true ? null : config.memAvailableMinMB;
|
|
832
|
+
}
|
|
833
|
+
// lr-9e6569 fold-in (PEACHES finding 3): updateDaemonConfig also receives
|
|
834
|
+
// the PARTIAL daemon_config_changed broadcast (currently just
|
|
835
|
+
// { liteAutoEnroll }), not only the full onGetDaemonConfig snapshot -- see
|
|
836
|
+
// app-messages.js's daemon_config_changed -> updateDaemonConfig wiring.
|
|
837
|
+
// Every other field above guards on `!== undefined` so a partial broadcast
|
|
838
|
+
// leaves it untouched; the note lines below must do the same. Gating only
|
|
839
|
+
// on `!== undefined` before writing keeps an unrelated setting change
|
|
840
|
+
// (e.g. Lite auto-enroll) elsewhere in the app from clearing "Using
|
|
841
|
+
// default — not yet saved" for memory settings that were never part of
|
|
842
|
+
// that broadcast in the first place.
|
|
843
|
+
var memAvailNoteEl = document.getElementById("settings-mem-available-min-default-note");
|
|
844
|
+
if (memAvailNoteEl && config.memAvailableMinMBIsDefault !== undefined) {
|
|
845
|
+
memAvailNoteEl.textContent = config.memAvailableMinMBIsDefault ? "Using default — not yet saved" : "";
|
|
803
846
|
}
|
|
804
847
|
var tpmEl = document.getElementById("settings-tokens-per-mb-headroom");
|
|
805
848
|
if (tpmEl && config.tokensPerMbHeadroom !== undefined) {
|
|
806
849
|
tpmEl.value = String(config.tokensPerMbHeadroom);
|
|
850
|
+
// lr-9e6569 fold-in (BOBBIE bobbie.uncat.1): same reconciliation as
|
|
851
|
+
// memAvailableMinMB above -- see that comment for the full failure
|
|
852
|
+
// sequence this closes.
|
|
853
|
+
// A fallback default must remain persistable by clicking Save.
|
|
854
|
+
lastSentTokensPerMbHeadroom = config.tokensPerMbHeadroomIsDefault === true ? null : config.tokensPerMbHeadroom;
|
|
855
|
+
}
|
|
856
|
+
var tpmNoteEl = document.getElementById("settings-tokens-per-mb-headroom-default-note");
|
|
857
|
+
if (tpmNoteEl && config.tokensPerMbHeadroomIsDefault !== undefined) {
|
|
858
|
+
tpmNoteEl.textContent = config.tokensPerMbHeadroomIsDefault ? "Using default — not yet saved" : "";
|
|
807
859
|
}
|
|
808
860
|
|
|
809
861
|
// Show keep awake subsection only on macOS (lives inside the Advanced section)
|
|
@@ -818,6 +870,182 @@ export function updateDaemonConfig(config) {
|
|
|
818
870
|
}
|
|
819
871
|
}
|
|
820
872
|
|
|
873
|
+
// lr-93e3c8 (fnd-66af4e): the Advanced > Memory inputs had a working change
|
|
874
|
+
// listener and a working daemon-side handler, but zero client-side feedback
|
|
875
|
+
// on either success or failure — a working control was indistinguishable
|
|
876
|
+
// from a dead one. Every other control in this panel (CLAUDE.md save,
|
|
877
|
+
// shared-env autosave) has a status element; these had none.
|
|
878
|
+
//
|
|
879
|
+
// lr-9e6569 fold-in (PEACHES finding 1): both memory fields share this one
|
|
880
|
+
// status element, but each field saves independently and responses can
|
|
881
|
+
// arrive out of order. Writing text unconditionally meant an error from one
|
|
882
|
+
// field was silently overwritten by "Saving..."/"Saved" from the other --
|
|
883
|
+
// a green success indication for a field that actually failed. Track each
|
|
884
|
+
// field's own outcome and render the combined result: any field currently
|
|
885
|
+
// in error wins the display (an error is never masked by the other field's
|
|
886
|
+
// success), and the shared element only clears once neither field is in
|
|
887
|
+
// error and neither has a message actively pending.
|
|
888
|
+
var MEMORY_FIELD_LABELS = {
|
|
889
|
+
memAvail: "Min available memory",
|
|
890
|
+
tpm: "Tokens per MB headroom",
|
|
891
|
+
};
|
|
892
|
+
var memoryFieldStatus = {
|
|
893
|
+
memAvail: { text: "", isError: false, seq: 0 },
|
|
894
|
+
tpm: { text: "", isError: false, seq: 0 },
|
|
895
|
+
};
|
|
896
|
+
var memoryStatusSeq = 0;
|
|
897
|
+
|
|
898
|
+
function renderMemorySaveStatus() {
|
|
899
|
+
var el = document.getElementById("ss-memory-save-status");
|
|
900
|
+
if (!el) return;
|
|
901
|
+
var memAvail = memoryFieldStatus.memAvail;
|
|
902
|
+
var tpm = memoryFieldStatus.tpm;
|
|
903
|
+
var errors = [];
|
|
904
|
+
if (memAvail.isError && memAvail.text) errors.push(MEMORY_FIELD_LABELS.memAvail + ": " + memAvail.text);
|
|
905
|
+
if (tpm.isError && tpm.text) errors.push(MEMORY_FIELD_LABELS.tpm + ": " + tpm.text);
|
|
906
|
+
|
|
907
|
+
if (errors.length > 0) {
|
|
908
|
+
// An error is never masked by the other field's success -- always wins the display.
|
|
909
|
+
el.textContent = errors.join(" | ");
|
|
910
|
+
el.classList.add("ps-save-status-error");
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
el.classList.remove("ps-save-status-error");
|
|
915
|
+
// Neither field is in error: show whichever non-empty status is most recent
|
|
916
|
+
// (the field object holding text is the one that just transitioned).
|
|
917
|
+
var latest = memAvail.seq >= tpm.seq ? memAvail : tpm;
|
|
918
|
+
var other = latest === memAvail ? tpm : memAvail;
|
|
919
|
+
el.textContent = latest.text || other.text || "";
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
function setFieldSaveStatus(field, text, isError) {
|
|
923
|
+
memoryFieldStatus[field] = { text: text, isError: !!isError, seq: ++memoryStatusSeq };
|
|
924
|
+
renderMemorySaveStatus();
|
|
925
|
+
if (!isError && text) {
|
|
926
|
+
setTimeout(function () {
|
|
927
|
+
if (memoryFieldStatus[field].text === text && !memoryFieldStatus[field].isError) {
|
|
928
|
+
memoryFieldStatus[field] = { text: "", isError: false, seq: memoryFieldStatus[field].seq };
|
|
929
|
+
renderMemorySaveStatus();
|
|
930
|
+
}
|
|
931
|
+
}, 2000);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// lr-9e6569: a value the daemon derived from DEFAULT_MEM_AVAILABLE_MIN_MB /
|
|
936
|
+
// DEFAULT_TOKENS_PER_MB_HEADROOM because the config key was never set renders
|
|
937
|
+
// visually identical to a persisted value equal to that default -- part of
|
|
938
|
+
// why a silently-discarded edit went unnoticed for three rounds. Once this
|
|
939
|
+
// module explicitly saves a value, it IS persisted, so clear the note here
|
|
940
|
+
// rather than waiting on the next full daemon_config round-trip.
|
|
941
|
+
function clearDefaultNote(elId) {
|
|
942
|
+
var el = document.getElementById(elId);
|
|
943
|
+
if (el) el.textContent = "";
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// lr-9e6569 fold-in (PEACHES finding 2): the blur/Enter `change` listener and
|
|
947
|
+
// the explicit Save button's click listener both call these same save
|
|
948
|
+
// functions, so typing a value then clicking Save fired the WS send twice
|
|
949
|
+
// for the same field (blur fires `change` first, then the click handler
|
|
950
|
+
// calls the save function again with the identical, already-sent value).
|
|
951
|
+
// Track the last value this field successfully attempted to send; if the
|
|
952
|
+
// current input value hasn't changed since then, the second call is a
|
|
953
|
+
// no-op. A genuinely new edit (different value) still sends -- this only
|
|
954
|
+
// suppresses the redundant repeat of a value already in flight/saved,
|
|
955
|
+
// keeping both commit paths (blur/Enter and the button) working for their
|
|
956
|
+
// own distinct edits.
|
|
957
|
+
var lastSentMemAvailableMin = null;
|
|
958
|
+
var lastSentTokensPerMbHeadroom = null;
|
|
959
|
+
|
|
960
|
+
function saveMemAvailableThreshold() {
|
|
961
|
+
var input = document.getElementById("settings-mem-available-min");
|
|
962
|
+
if (!input) return;
|
|
963
|
+
var val = parseInt(input.value, 10);
|
|
964
|
+
if (isNaN(val) || val < 0) {
|
|
965
|
+
setFieldSaveStatus("memAvail", "Invalid value — must be 0 or greater", true);
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
if (val === lastSentMemAvailableMin) return;
|
|
969
|
+
var ws = ctx.ws;
|
|
970
|
+
if (ws && ws.readyState === 1) {
|
|
971
|
+
lastSentMemAvailableMin = val;
|
|
972
|
+
setFieldSaveStatus("memAvail", "Saving...", false);
|
|
973
|
+
ws.send(JSON.stringify({ type: "set_mem_available_threshold", value: val }));
|
|
974
|
+
} else {
|
|
975
|
+
setFieldSaveStatus("memAvail", "Not connected — change not saved", true);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
function saveTokensPerMbHeadroom() {
|
|
980
|
+
var input = document.getElementById("settings-tokens-per-mb-headroom");
|
|
981
|
+
if (!input) return;
|
|
982
|
+
var val = parseInt(input.value, 10);
|
|
983
|
+
if (isNaN(val) || val < 10 || val > 500) {
|
|
984
|
+
setFieldSaveStatus("tpm", "Invalid value — must be 10-500", true);
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
if (val === lastSentTokensPerMbHeadroom) return;
|
|
988
|
+
var ws = ctx.ws;
|
|
989
|
+
if (ws && ws.readyState === 1) {
|
|
990
|
+
lastSentTokensPerMbHeadroom = val;
|
|
991
|
+
setFieldSaveStatus("tpm", "Saving...", false);
|
|
992
|
+
ws.send(JSON.stringify({ type: "set_tokens_per_mb_headroom", value: val }));
|
|
993
|
+
} else {
|
|
994
|
+
setFieldSaveStatus("tpm", "Not connected — change not saved", true);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
export function handleSetMemAvailableThresholdResult(msg) {
|
|
999
|
+
if (msg.ok) {
|
|
1000
|
+
setFieldSaveStatus("memAvail", "Saved", false);
|
|
1001
|
+
var memAvailEl = document.getElementById("settings-mem-available-min");
|
|
1002
|
+
if (memAvailEl && typeof msg.memAvailableMinMB === "number") {
|
|
1003
|
+
memAvailEl.value = String(msg.memAvailableMinMB);
|
|
1004
|
+
lastSentMemAvailableMin = msg.memAvailableMinMB;
|
|
1005
|
+
}
|
|
1006
|
+
clearDefaultNote("settings-mem-available-min-default-note");
|
|
1007
|
+
} else {
|
|
1008
|
+
// A failed save must not be treated as "in flight" for dedup purposes --
|
|
1009
|
+
// clear the last-sent marker so a retry of the same value is not
|
|
1010
|
+
// silently suppressed.
|
|
1011
|
+
lastSentMemAvailableMin = null;
|
|
1012
|
+
setFieldSaveStatus("memAvail", "Error: " + (msg.error || "Failed to save"), true);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
export function handleMemAvailableThresholdChanged(msg) {
|
|
1017
|
+
var memAvailEl = document.getElementById("settings-mem-available-min");
|
|
1018
|
+
if (memAvailEl && typeof msg.memAvailableMinMB === "number") {
|
|
1019
|
+
memAvailEl.value = String(msg.memAvailableMinMB);
|
|
1020
|
+
lastSentMemAvailableMin = msg.memAvailableMinMB;
|
|
1021
|
+
}
|
|
1022
|
+
clearDefaultNote("settings-mem-available-min-default-note");
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
export function handleSetTokensPerMbHeadroomResult(msg) {
|
|
1026
|
+
if (msg.ok) {
|
|
1027
|
+
setFieldSaveStatus("tpm", "Saved", false);
|
|
1028
|
+
var tpmEl = document.getElementById("settings-tokens-per-mb-headroom");
|
|
1029
|
+
if (tpmEl && typeof msg.tokensPerMbHeadroom === "number") {
|
|
1030
|
+
tpmEl.value = String(msg.tokensPerMbHeadroom);
|
|
1031
|
+
lastSentTokensPerMbHeadroom = msg.tokensPerMbHeadroom;
|
|
1032
|
+
}
|
|
1033
|
+
clearDefaultNote("settings-tokens-per-mb-headroom-default-note");
|
|
1034
|
+
} else {
|
|
1035
|
+
lastSentTokensPerMbHeadroom = null;
|
|
1036
|
+
setFieldSaveStatus("tpm", "Error: " + (msg.error || "Failed to save"), true);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
export function handleTokensPerMbHeadroomChanged(msg) {
|
|
1041
|
+
var tpmEl = document.getElementById("settings-tokens-per-mb-headroom");
|
|
1042
|
+
if (tpmEl && typeof msg.tokensPerMbHeadroom === "number") {
|
|
1043
|
+
tpmEl.value = String(msg.tokensPerMbHeadroom);
|
|
1044
|
+
lastSentTokensPerMbHeadroom = msg.tokensPerMbHeadroom;
|
|
1045
|
+
}
|
|
1046
|
+
clearDefaultNote("settings-tokens-per-mb-headroom-default-note");
|
|
1047
|
+
}
|
|
1048
|
+
|
|
821
1049
|
export function handleSetPinResult(msg) {
|
|
822
1050
|
if (msg.ok) {
|
|
823
1051
|
updatePinStatus(!!msg.pinEnabled);
|
|
@@ -1188,4 +1416,11 @@ registerHandlers({
|
|
|
1188
1416
|
refresh_agents_result: handleRefreshAgentsResult,
|
|
1189
1417
|
restart_server_result: handleRestartResult,
|
|
1190
1418
|
shutdown_server_result: handleShutdownResult,
|
|
1419
|
+
// lr-93e3c8: these four were declared in ws-schema.js with app-messages.js
|
|
1420
|
+
// named as handler but never actually implemented anywhere (fnd-66af4e) —
|
|
1421
|
+
// the client-side half of why edits to Advanced > Memory silently reverted.
|
|
1422
|
+
set_mem_available_threshold_result: handleSetMemAvailableThresholdResult,
|
|
1423
|
+
mem_available_threshold_changed: handleMemAvailableThresholdChanged,
|
|
1424
|
+
set_tokens_per_mb_headroom_result: handleSetTokensPerMbHeadroomResult,
|
|
1425
|
+
tokens_per_mb_headroom_changed: handleTokensPerMbHeadroomChanged,
|
|
1191
1426
|
});
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
getCachedDmUnread,
|
|
35
35
|
getCachedDmRemovedUsers
|
|
36
36
|
} from './sidebar-users.js';
|
|
37
|
+
import { sessionActivity, rollupActivity, indicatorClass } from './activity-state.js';
|
|
37
38
|
|
|
38
39
|
import { store } from './store.js';
|
|
39
40
|
import { getWs } from './ws-ref.js';
|
|
@@ -182,9 +183,10 @@ function renderSheetProjects(listEl) {
|
|
|
182
183
|
nameSpan.textContent = p.name;
|
|
183
184
|
el.appendChild(nameSpan);
|
|
184
185
|
|
|
185
|
-
|
|
186
|
+
var rowActivityCls = indicatorClass(sessionActivity(p, null, { ignoreUnread: true }));
|
|
187
|
+
if (rowActivityCls) {
|
|
186
188
|
var dot = document.createElement("span");
|
|
187
|
-
dot.className = "mobile-project-processing";
|
|
189
|
+
dot.className = "mobile-project-processing " + rowActivityCls;
|
|
188
190
|
el.appendChild(dot);
|
|
189
191
|
}
|
|
190
192
|
if (p.unread > 0 && p.slug !== currentSlug) {
|
|
@@ -231,13 +233,13 @@ function renderSheetProjects(listEl) {
|
|
|
231
233
|
// Exclude the currently-active project from unread so switching into a
|
|
232
234
|
// project inside a folder clears its contribution to the folder badge.
|
|
233
235
|
var totalUnread = 0;
|
|
234
|
-
var anyProcessing = false;
|
|
235
236
|
for (var fai = 0; fai < folderProjects.length; fai++) {
|
|
236
237
|
if (folderProjects[fai].slug !== currentSlug) {
|
|
237
238
|
totalUnread += (folderProjects[fai].unread || 0);
|
|
238
239
|
}
|
|
239
|
-
if (folderProjects[fai].isProcessing) anyProcessing = true;
|
|
240
240
|
}
|
|
241
|
+
// lr-66c118: replaces the open-coded anyProcessing OR-loop above.
|
|
242
|
+
var folderRowActivityCls = indicatorClass(rollupActivity(folderProjects, null, { ignoreUnread: true }));
|
|
241
243
|
|
|
242
244
|
// Folder header row
|
|
243
245
|
var headerEl = document.createElement("button");
|
|
@@ -264,9 +266,9 @@ function renderSheetProjects(listEl) {
|
|
|
264
266
|
chevron.innerHTML = '<i data-lucide="chevron-right"></i>';
|
|
265
267
|
headerEl.appendChild(chevron);
|
|
266
268
|
|
|
267
|
-
if (
|
|
269
|
+
if (folderRowActivityCls) {
|
|
268
270
|
var fdot = document.createElement("span");
|
|
269
|
-
fdot.className = "mobile-project-processing";
|
|
271
|
+
fdot.className = "mobile-project-processing " + folderRowActivityCls;
|
|
270
272
|
headerEl.appendChild(fdot);
|
|
271
273
|
}
|
|
272
274
|
if (totalUnread > 0) {
|
|
@@ -474,9 +476,12 @@ function createMobileSessionItem(s) {
|
|
|
474
476
|
el.className = "mobile-session-item" + (s.active ? " active" : "");
|
|
475
477
|
|
|
476
478
|
// Processing dot (left side, before title)
|
|
477
|
-
|
|
479
|
+
var msiActivityState = sessionActivity(s, store.get('myUserId'));
|
|
480
|
+
var msiActivityCls = indicatorClass(msiActivityState);
|
|
481
|
+
if (msiActivityCls) {
|
|
478
482
|
var dot = document.createElement("span");
|
|
479
|
-
dot.className = "mobile-session-processing";
|
|
483
|
+
dot.className = "mobile-session-processing " + msiActivityCls;
|
|
484
|
+
dot.title = msiActivityState.label;
|
|
480
485
|
el.appendChild(dot);
|
|
481
486
|
}
|
|
482
487
|
|
|
@@ -525,9 +530,10 @@ function createMobileLoopChild(s) {
|
|
|
525
530
|
var el = document.createElement("button");
|
|
526
531
|
el.className = "mobile-loop-child" + (s.active ? " active" : "");
|
|
527
532
|
|
|
528
|
-
|
|
533
|
+
var mlcActivityCls = indicatorClass(sessionActivity(s, store.get('myUserId')));
|
|
534
|
+
if (mlcActivityCls) {
|
|
529
535
|
var dot = document.createElement("span");
|
|
530
|
-
dot.className = "mobile-session-processing";
|
|
536
|
+
dot.className = "mobile-session-processing " + mlcActivityCls;
|
|
531
537
|
el.appendChild(dot);
|
|
532
538
|
}
|
|
533
539
|
|
|
@@ -567,15 +573,15 @@ function createMobileLoopRun(parentGk, startedAtKey, sessions, isRalph) {
|
|
|
567
573
|
var timeLabel = startedAt ? new Date(startedAt).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : "Unknown";
|
|
568
574
|
|
|
569
575
|
var hasActive = false;
|
|
570
|
-
var anyProcessing = false;
|
|
571
576
|
var latestSession = sessions[0];
|
|
572
577
|
for (var i = 0; i < sessions.length; i++) {
|
|
573
578
|
if (sessions[i].active) hasActive = true;
|
|
574
|
-
if (sessions[i].isProcessing) anyProcessing = true;
|
|
575
579
|
if ((sessions[i].lastActivity || 0) > (latestSession.lastActivity || 0)) {
|
|
576
580
|
latestSession = sessions[i];
|
|
577
581
|
}
|
|
578
582
|
}
|
|
583
|
+
// lr-66c118: replaces the open-coded anyProcessing OR-loop above.
|
|
584
|
+
var runRowActivityCls = indicatorClass(rollupActivity(sessions, store.get('myUserId')));
|
|
579
585
|
|
|
580
586
|
var wrapper = document.createElement("div");
|
|
581
587
|
wrapper.className = "mobile-loop-run-wrapper";
|
|
@@ -591,8 +597,8 @@ function createMobileLoopRun(parentGk, startedAtKey, sessions, isRalph) {
|
|
|
591
597
|
var label = document.createElement("span");
|
|
592
598
|
label.className = "mobile-loop-run-time";
|
|
593
599
|
var labelHtml = "";
|
|
594
|
-
if (
|
|
595
|
-
labelHtml += '<span class="mobile-session-processing"></span> ';
|
|
600
|
+
if (runRowActivityCls) {
|
|
601
|
+
labelHtml += '<span class="mobile-session-processing ' + runRowActivityCls + '"></span> ';
|
|
596
602
|
}
|
|
597
603
|
labelHtml += escapeHtml(timeLabel);
|
|
598
604
|
label.innerHTML = labelHtml;
|
|
@@ -659,15 +665,15 @@ function createMobileLoopGroup(loopId, children, groupKey) {
|
|
|
659
665
|
|
|
660
666
|
var expanded = expandedMobileLoopGroups.has(gk);
|
|
661
667
|
var hasActive = false;
|
|
662
|
-
var anyProcessing = false;
|
|
663
668
|
var latestSession = children[0];
|
|
664
669
|
for (var ci = 0; ci < children.length; ci++) {
|
|
665
670
|
if (children[ci].active) hasActive = true;
|
|
666
|
-
if (children[ci].isProcessing) anyProcessing = true;
|
|
667
671
|
if ((children[ci].lastActivity || 0) > (latestSession.lastActivity || 0)) {
|
|
668
672
|
latestSession = children[ci];
|
|
669
673
|
}
|
|
670
674
|
}
|
|
675
|
+
// lr-66c118: replaces the open-coded anyProcessing OR-loop above.
|
|
676
|
+
var groupRowActivityCls = indicatorClass(rollupActivity(children, store.get('myUserId')));
|
|
671
677
|
|
|
672
678
|
var loopName = (children[0].loop && children[0].loop.name) || "Loop";
|
|
673
679
|
var isRalph = children[0].loop && children[0].loop.source === "ralph";
|
|
@@ -695,9 +701,9 @@ function createMobileLoopGroup(loopId, children, groupKey) {
|
|
|
695
701
|
iconSpan.innerHTML = iconHtml(groupIcon);
|
|
696
702
|
header.appendChild(iconSpan);
|
|
697
703
|
|
|
698
|
-
if (
|
|
704
|
+
if (groupRowActivityCls) {
|
|
699
705
|
var dot = document.createElement("span");
|
|
700
|
-
dot.className = "mobile-session-processing";
|
|
706
|
+
dot.className = "mobile-session-processing " + groupRowActivityCls;
|
|
701
707
|
header.appendChild(dot);
|
|
702
708
|
}
|
|
703
709
|
|
|
@@ -968,16 +974,20 @@ export function refreshMobileChatSheet() {
|
|
|
968
974
|
// Update processing dot: same class as icon strip
|
|
969
975
|
var statusDot = chip.querySelector(".icon-strip-status");
|
|
970
976
|
if (statusDot) {
|
|
971
|
-
var
|
|
977
|
+
var chipProject = null;
|
|
972
978
|
var allProjects = getCachedProjects() || [];
|
|
973
979
|
var lookupSlug = chip.dataset.type === "mate" ? ("mate-" + chip.dataset.mateId) : chip.dataset.slug;
|
|
974
980
|
for (var pi = 0; pi < allProjects.length; pi++) {
|
|
975
|
-
if (allProjects[pi].slug === lookupSlug
|
|
976
|
-
|
|
981
|
+
if (allProjects[pi].slug === lookupSlug) {
|
|
982
|
+
chipProject = allProjects[pi];
|
|
977
983
|
break;
|
|
978
984
|
}
|
|
979
985
|
}
|
|
980
|
-
|
|
986
|
+
// lr-66c118: chip dot is project-level — isProcessing-only (no alert
|
|
987
|
+
// tone here, matching every other project-level dot in this module).
|
|
988
|
+
statusDot.classList.remove("processing", "alert", "other");
|
|
989
|
+
var chipActivityCls = indicatorClass(sessionActivity(chipProject, null, { ignoreUnread: true }));
|
|
990
|
+
if (chipActivityCls) statusDot.classList.add(chipActivityCls);
|
|
981
991
|
}
|
|
982
992
|
}
|
|
983
993
|
|