@clagentic/console 1.7.1-beta.1 → 1.8.0-beta.1
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 +198 -2542
- package/lib/build-sha.json +2 -2
- package/lib/cli/daemon-launch.js +797 -0
- package/lib/cli/ipc-subcommands.js +186 -0
- package/lib/cli/menus.js +849 -0
- package/lib/cli/net-detect.js +209 -0
- package/lib/cli/tui.js +589 -0
- package/lib/pages.js +13 -17
- package/lib/public/css/diagnostics.css +15 -0
- package/lib/public/css/overlays.css +19 -0
- package/lib/public/index.html +12 -11
- package/lib/public/manifest.json +1 -1
- package/lib/public/modules/app-connection.js +150 -4
- package/lib/public/modules/app-history-replay.js +155 -0
- package/lib/public/modules/app-home-hub.js +2 -16
- package/lib/public/modules/app-messages.js +1245 -1489
- package/lib/public/modules/app-notifications.js +4 -4
- package/lib/public/modules/command-palette.js +11 -22
- package/lib/public/modules/context-sources.js +1 -6
- package/lib/public/modules/filebrowser.js +25 -13
- package/lib/public/modules/mcp-ui.js +2 -2
- package/lib/public/modules/notifications.js +22 -1
- package/lib/public/modules/playbook.js +6 -6
- package/lib/public/modules/project-settings.js +5 -13
- package/lib/public/modules/qrcode.js +2 -2
- package/lib/public/modules/relative-time.js +27 -0
- package/lib/public/modules/scheduler-history.js +1 -5
- package/lib/public/modules/server-settings.js +28 -15
- package/lib/public/modules/sidebar-projects.js +1 -1
- package/lib/public/modules/sidebar-sessions.js +1 -15
- package/lib/public/modules/sidebar.js +3 -3
- package/lib/public/modules/utils.js +1 -0
- package/lib/public/sw.js +24 -4
- package/lib/server-auth.js +48 -2
- package/lib/server-settings.js +70 -4
- package/lib/server.js +200 -4
- package/lib/smtp.js +6 -6
- package/lib/yoke/adapters/codex.js +1 -1
- package/package.json +1 -1
package/lib/pages.js
CHANGED
|
@@ -5,7 +5,7 @@ function setupPageHtml(httpsUrl, httpUrl, hasCert, lanMode) {
|
|
|
5
5
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
6
6
|
<link rel="manifest" href="/manifest.json">
|
|
7
7
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
|
8
|
-
<title>Setup - Clagentic:Console</title>
|
|
8
|
+
<title>Setup - Clagentic: Console</title>
|
|
9
9
|
<style>
|
|
10
10
|
:root{--s-bg:#060810;--s-text:#C8D4E0;--s-accent:#00CFFF;--s-muted:#7A8FA6;--s-border:#1E2E48;--s-dimmer:#3D5068;--s-success:#29D9A8;--s-accent-15:rgba(0,207,255,0.15);--s-success-10:rgba(41,217,168,0.1);--s-success-15:rgba(41,217,168,0.15);--s-accent-06:rgba(0,207,255,0.06);--s-muted-06:rgba(122,143,166,0.06);--s-muted-15:rgba(122,143,166,0.15)}
|
|
11
11
|
@media(prefers-color-scheme:light){:root{--s-bg:#F4F7FB;--s-text:#1E2A38;--s-accent:#0099CC;--s-muted:#4A5D72;--s-border:#B4C6D9;--s-dimmer:#8FA4BA;--s-success:#1BA87E;--s-accent-15:rgba(0,153,204,0.15);--s-success-10:rgba(27,168,126,0.1);--s-success-15:rgba(27,168,126,0.15);--s-accent-06:rgba(0,153,204,0.06);--s-muted-06:rgba(74,93,114,0.06);--s-muted-15:rgba(74,93,114,0.15)}}
|
|
@@ -65,7 +65,7 @@ h1{color:var(--s-accent);font-size:22px;margin:0 0 4px;text-align:center}
|
|
|
65
65
|
.done-note .skip-link{display:inline;margin-top:0;font-size:13px}
|
|
66
66
|
</style></head><body>
|
|
67
67
|
<div class="c">
|
|
68
|
-
<h1>Clagentic:Console</h1>
|
|
68
|
+
<h1>Clagentic: Console</h1>
|
|
69
69
|
<p class="subtitle">Setup your device for the best experience</p>
|
|
70
70
|
|
|
71
71
|
<div class="steps-bar" id="steps-bar"></div>
|
|
@@ -118,7 +118,7 @@ h1{color:var(--s-accent);font-size:22px;margin:0 0 4px;text-align:center}
|
|
|
118
118
|
<div class="step-card" id="step-pwa">
|
|
119
119
|
<div class="step-label">Step <span class="step-cur">2</span> of <span class="step-total">3</span></div>
|
|
120
120
|
<div class="step-title">Add to Home Screen</div>
|
|
121
|
-
<div class="step-desc">Install Clagentic:Console as an app for quick access and a full-screen experience.</div>
|
|
121
|
+
<div class="step-desc">Install Clagentic: Console as an app for quick access and a full-screen experience.</div>
|
|
122
122
|
|
|
123
123
|
<div class="platform-ios">
|
|
124
124
|
<div class="check-status warn">On iOS, push notifications only work from the installed app. This step is required.</div>
|
|
@@ -158,12 +158,12 @@ h1{color:var(--s-accent);font-size:22px;margin:0 0 4px;text-align:center}
|
|
|
158
158
|
</div>
|
|
159
159
|
<div class="instruction"><div class="inst-num">2</div>
|
|
160
160
|
<div class="inst-text">Click it and then click <b>Install</b> to confirm.
|
|
161
|
-
<div class="note">If there is no icon, go to <b>Menu > Install Clagentic:Console</b> or <b>Menu > Save and Share > Install</b>.</div>
|
|
161
|
+
<div class="note">If there is no icon, go to <b>Menu > Install Clagentic: Console</b> or <b>Menu > Save and Share > Install</b>.</div>
|
|
162
162
|
</div>
|
|
163
163
|
</div>
|
|
164
164
|
</div>
|
|
165
165
|
|
|
166
|
-
<div id="pwa-status" class="check-status pending">After installing, open Clagentic:Console from your home screen to continue setup.</div>
|
|
166
|
+
<div id="pwa-status" class="check-status pending">After installing, open Clagentic: Console from your home screen to continue setup.</div>
|
|
167
167
|
<button class="skip-link" id="pwa-skip" onclick="nextStep()" style="display:none">Skip for now</button>
|
|
168
168
|
</div>
|
|
169
169
|
|
|
@@ -191,7 +191,7 @@ h1{color:var(--s-accent);font-size:22px;margin:0 0 4px;text-align:center}
|
|
|
191
191
|
<div class="done-title">All set!</div>
|
|
192
192
|
<div class="done-desc">Your device is configured. You can change these settings anytime from the app.</div>
|
|
193
193
|
<p class="done-note" id="remote-access-note">Want access outside your local network? Options include <a href="https://tailscale.com" target="_blank" rel="noopener">Tailscale</a>, <a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/" target="_blank" rel="noopener">Cloudflare Tunnel</a>, or your existing VPN. <button class="skip-link" onclick="document.getElementById('remote-access-note').style.display='none'">Dismiss</button></p>
|
|
194
|
-
<a class="btn" id="done-link" href="${httpsUrl}">Open Clagentic:Console</a>
|
|
194
|
+
<a class="btn" id="done-link" href="${httpsUrl}">Open Clagentic: Console</a>
|
|
195
195
|
</div>
|
|
196
196
|
</div>
|
|
197
197
|
</div>
|
|
@@ -447,7 +447,7 @@ function pushDone() {
|
|
|
447
447
|
pushStatus.textContent = "Push notifications enabled!";
|
|
448
448
|
fireConfetti();
|
|
449
449
|
navigator.serviceWorker.ready.then(function(reg) {
|
|
450
|
-
reg.showNotification("\ud83c\udf89 Welcome to Clagentic:Console!", {
|
|
450
|
+
reg.showNotification("\ud83c\udf89 Welcome to Clagentic: Console!", {
|
|
451
451
|
body: "\ud83d\udd14 You\u2019ll be notified when Claude responds.",
|
|
452
452
|
tag: "claude-welcome",
|
|
453
453
|
});
|
|
@@ -554,10 +554,6 @@ if (!isHttps && !isLocal) {
|
|
|
554
554
|
}
|
|
555
555
|
|
|
556
556
|
|
|
557
|
-
function escapeHtml(s) {
|
|
558
|
-
return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
557
|
// --- Build auth page CSS variables from ayu-light theme (same logic as theme.js computeVars) ---
|
|
562
558
|
var path = require("path");
|
|
563
559
|
var _authTheme = require(path.join(__dirname, "themes", "ayu-light.json"));
|
|
@@ -702,7 +698,7 @@ function adminSetupPageHtml() {
|
|
|
702
698
|
return '<!DOCTYPE html><html lang="en"><head>' +
|
|
703
699
|
'<meta charset="UTF-8">' +
|
|
704
700
|
'<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">' +
|
|
705
|
-
'<title>Admin Setup - Clagentic:Console</title>' +
|
|
701
|
+
'<title>Admin Setup - Clagentic: Console</title>' +
|
|
706
702
|
'<style>' + authPageStyles + '</style></head><body><div class="c">' +
|
|
707
703
|
'<div class="steps-bar"><span class="steps-dot current" id="dot0"></span><span class="steps-dot" id="dot1"></span><span class="steps-dot" id="dot2"></span><span class="steps-dot" id="dot3"></span></div>' +
|
|
708
704
|
|
|
@@ -797,7 +793,7 @@ function multiUserLoginPageHtml() {
|
|
|
797
793
|
return '<!DOCTYPE html><html lang="en"><head>' +
|
|
798
794
|
'<meta charset="UTF-8">' +
|
|
799
795
|
'<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">' +
|
|
800
|
-
'<title>Login - Clagentic:Console</title>' +
|
|
796
|
+
'<title>Login - Clagentic: Console</title>' +
|
|
801
797
|
'<style>' + authPageStyles + '</style></head><body><div class="c">' +
|
|
802
798
|
'<div class="steps-bar"><span class="steps-dot current" id="dot0"></span><span class="steps-dot" id="dot1"></span></div>' +
|
|
803
799
|
|
|
@@ -885,7 +881,7 @@ function invitePageHtml(inviteCode) {
|
|
|
885
881
|
return '<!DOCTYPE html><html lang="en"><head>' +
|
|
886
882
|
'<meta charset="UTF-8">' +
|
|
887
883
|
'<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">' +
|
|
888
|
-
'<title>Join - Clagentic:Console</title>' +
|
|
884
|
+
'<title>Join - Clagentic: Console</title>' +
|
|
889
885
|
'<style>' + authPageStyles + '</style></head><body><div class="c">' +
|
|
890
886
|
'<div class="steps-bar"><span class="steps-dot current" id="dot0"></span><span class="steps-dot" id="dot1"></span><span class="steps-dot" id="dot2"></span></div>' +
|
|
891
887
|
|
|
@@ -966,7 +962,7 @@ function smtpLoginPageHtml() {
|
|
|
966
962
|
return '<!DOCTYPE html><html lang="en"><head>' +
|
|
967
963
|
'<meta charset="UTF-8">' +
|
|
968
964
|
'<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">' +
|
|
969
|
-
'<title>Login - Clagentic:Console</title>' +
|
|
965
|
+
'<title>Login - Clagentic: Console</title>' +
|
|
970
966
|
'<style>' + authPageStyles +
|
|
971
967
|
'.otp-input{width:100%;font-size:24px;letter-spacing:8px;text-align:center;padding:12px;' +
|
|
972
968
|
'background:var(--field-bg);border:1px solid var(--field-border);border-radius:8px;color:var(--fg);' +
|
|
@@ -1122,7 +1118,7 @@ function smtpInvitePageHtml(inviteCode) {
|
|
|
1122
1118
|
return '<!DOCTYPE html><html lang="en"><head>' +
|
|
1123
1119
|
'<meta charset="UTF-8">' +
|
|
1124
1120
|
'<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">' +
|
|
1125
|
-
'<title>Join - Clagentic:Console</title>' +
|
|
1121
|
+
'<title>Join - Clagentic: Console</title>' +
|
|
1126
1122
|
'<style>' + authPageStyles + '</style></head><body><div class="c">' +
|
|
1127
1123
|
'<div class="steps-bar"><span class="steps-dot current" id="dot0"></span><span class="steps-dot" id="dot1"></span><span class="steps-dot" id="dot2"></span></div>' +
|
|
1128
1124
|
|
|
@@ -1210,7 +1206,7 @@ function noProjectsPageHtml() {
|
|
|
1210
1206
|
return '<!DOCTYPE html><html lang="en"><head>' +
|
|
1211
1207
|
'<meta charset="UTF-8">' +
|
|
1212
1208
|
'<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">' +
|
|
1213
|
-
'<title>Clagentic:Console</title>' +
|
|
1209
|
+
'<title>Clagentic: Console</title>' +
|
|
1214
1210
|
'<style>' + authPageStyles + '</style></head><body><div class="c">' +
|
|
1215
1211
|
'<h1>Hang tight!</h1>' +
|
|
1216
1212
|
'<div class="sub">No projects have been assigned to your account yet.</div>' +
|
|
@@ -241,6 +241,21 @@
|
|
|
241
241
|
-------------------------------------------------------- */
|
|
242
242
|
.toast-diagnostic {
|
|
243
243
|
position: relative;
|
|
244
|
+
/* lr-56fb36: the base .toast rule (base.css) sets left:50% and bottom:80px
|
|
245
|
+
for its own center-bottom, single-toast anchoring. .toast-diagnostic
|
|
246
|
+
already overrides transform (translateY only, no translateX) and
|
|
247
|
+
position (relative, not fixed), but left/bottom are separate properties
|
|
248
|
+
that were never reset here — the cascade lets them leak through
|
|
249
|
+
unchanged, offsetting this box away from the normal-flow position the
|
|
250
|
+
corner-anchored #diagnostic-toast-container (lr-e901) computes for it.
|
|
251
|
+
That leftover left:50% is what pushes the toast off past the right
|
|
252
|
+
viewport edge on both desktop and mobile despite the lr-fab390/lr-4ef618
|
|
253
|
+
width clamps, which only bound the box's own width, not its offset.
|
|
254
|
+
Reset both explicitly so this box's position comes entirely from normal
|
|
255
|
+
flow inside the container, matching the positioning-comes-from-the-
|
|
256
|
+
parent contract stated below. */
|
|
257
|
+
left: auto;
|
|
258
|
+
bottom: auto;
|
|
244
259
|
opacity: 0;
|
|
245
260
|
transform: translateY(-8px);
|
|
246
261
|
pointer-events: auto;
|
|
@@ -1325,3 +1325,22 @@ button.top-bar-pill.pill-accent:hover { background: color-mix(in srgb, var(--acc
|
|
|
1325
1325
|
margin-top: 1.2rem;
|
|
1326
1326
|
letter-spacing: 0.03em;
|
|
1327
1327
|
}
|
|
1328
|
+
|
|
1329
|
+
/* lr-de5fcb Surface 1: shown only in the explicit "session expired" state,
|
|
1330
|
+
never during a normal transient-disconnect reconnect. */
|
|
1331
|
+
#connect-overlay-signin-btn {
|
|
1332
|
+
margin-top: 1rem;
|
|
1333
|
+
padding: 0.5rem 1.2rem;
|
|
1334
|
+
border-radius: 6px;
|
|
1335
|
+
border: 1px solid #DA7756;
|
|
1336
|
+
background: transparent;
|
|
1337
|
+
color: #DA7756;
|
|
1338
|
+
font-family: var(--font-mono);
|
|
1339
|
+
font-size: 0.85rem;
|
|
1340
|
+
cursor: pointer;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
#connect-overlay-signin-btn:hover {
|
|
1344
|
+
background: #DA7756;
|
|
1345
|
+
color: #000;
|
|
1346
|
+
}
|
package/lib/public/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<meta name="theme-color" content="#282a36">
|
|
15
15
|
<link rel="icon" type="image/png" href="favicon-banded.png">
|
|
16
16
|
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
|
17
|
-
<title>Clagentic:Console</title>
|
|
17
|
+
<title>Clagentic: Console</title>
|
|
18
18
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
19
19
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
20
20
|
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@300;400;500&family=Roboto+Mono:wght@400;500;700&family=Nunito:wght@700;800&display=swap" rel="stylesheet">
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
<button id="ext-pill" class="top-bar-ext-btn" title="Chrome Extension"><i data-lucide="puzzle"></i> Extension</button>
|
|
53
53
|
<div id="ext-popover" class="ext-popover">
|
|
54
54
|
<div class="ext-popover-header">
|
|
55
|
-
<div class="ext-popover-title">Clagentic:Console for Chrome <span class="ext-experimental">Experimental</span></div>
|
|
55
|
+
<div class="ext-popover-title">Clagentic: Console for Chrome <span class="ext-experimental">Experimental</span></div>
|
|
56
56
|
<div class="ext-popover-sub">v0.1.0</div>
|
|
57
57
|
</div>
|
|
58
58
|
<div class="ext-popover-connected hidden" id="ext-connected-banner"><i data-lucide="check-circle"></i> Extension connected</div>
|
|
59
|
-
<div class="ext-popover-desc" id="ext-popover-desc">Connect your browser to Clagentic:Console. Gives Claude visibility into open tabs, console, network, DOM, and screenshots.</div>
|
|
59
|
+
<div class="ext-popover-desc" id="ext-popover-desc">Connect your browser to Clagentic: Console. Gives Claude visibility into open tabs, console, network, DOM, and screenshots.</div>
|
|
60
60
|
<button class="ext-popover-download" id="ext-download-btn"><i data-lucide="download"></i> Download Extension (.zip)</button>
|
|
61
61
|
<div class="ext-popover-status hidden" id="ext-download-status"></div>
|
|
62
62
|
<div class="ext-popover-divider" id="ext-popover-divider"></div>
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
|
|
96
96
|
<!-- === Icon Strip === -->
|
|
97
97
|
<div id="icon-strip">
|
|
98
|
-
<div class="icon-strip-home" title="Clagentic:Console">
|
|
98
|
+
<div class="icon-strip-home" title="Clagentic: Console">
|
|
99
99
|
<span class="icon-strip-pill"></span>
|
|
100
|
-
<svg class="icon-strip-logo" width="38" height="38" viewBox="0 0 72 72" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Clagentic:Console">
|
|
100
|
+
<svg class="icon-strip-logo" width="38" height="38" viewBox="0 0 72 72" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Clagentic: Console">
|
|
101
101
|
<defs>
|
|
102
102
|
<linearGradient id="cg-strip" gradientUnits="userSpaceOnUse" x1="6" y1="10" x2="66" y2="62">
|
|
103
103
|
<stop offset="0%" stop-color="#00CFFF"/>
|
|
@@ -282,6 +282,7 @@
|
|
|
282
282
|
<div id="connect-overlay">
|
|
283
283
|
<svg id="console-logo-svg" viewBox="0 0 112 112" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"></svg>
|
|
284
284
|
<p id="connect-overlay-msg">Reconnecting to server…</p>
|
|
285
|
+
<button id="connect-overlay-signin-btn" class="hidden">Sign in again</button>
|
|
285
286
|
</div>
|
|
286
287
|
<div id="sticky-notes-container" class="hidden"></div>
|
|
287
288
|
<div id="replay-loading" class="hidden">
|
|
@@ -949,7 +950,7 @@
|
|
|
949
950
|
<button class="layout-option" data-brand="classic">
|
|
950
951
|
<span class="layout-option-icon">◈</span>
|
|
951
952
|
<span class="layout-option-label">Classic</span>
|
|
952
|
-
<span class="layout-option-desc">The original Clagentic:Console look. Dracula dark, Ayu light.</span>
|
|
953
|
+
<span class="layout-option-desc">The original Clagentic: Console look. Dracula dark, Ayu light.</span>
|
|
953
954
|
</button>
|
|
954
955
|
</div>
|
|
955
956
|
</div>
|
|
@@ -1427,7 +1428,7 @@
|
|
|
1427
1428
|
</div>
|
|
1428
1429
|
<div class="server-settings-section" data-section="restart">
|
|
1429
1430
|
<h2>Restart</h2>
|
|
1430
|
-
<p class="settings-hint" style="margin-bottom: 16px;">Restart the Clagentic:Console daemon process. All active sessions will be briefly interrupted and clients will automatically reconnect.</p>
|
|
1431
|
+
<p class="settings-hint" style="margin-bottom: 16px;">Restart the Clagentic: Console daemon process. All active sessions will be briefly interrupted and clients will automatically reconnect.</p>
|
|
1431
1432
|
<div class="settings-card">
|
|
1432
1433
|
<div class="settings-field">
|
|
1433
1434
|
<label class="settings-label">Restart Daemon</label>
|
|
@@ -1445,7 +1446,7 @@
|
|
|
1445
1446
|
<div class="settings-danger-icon"><i data-lucide="alert-triangle"></i></div>
|
|
1446
1447
|
<div class="settings-danger-body">
|
|
1447
1448
|
<h3 class="settings-danger-title">Danger Zone</h3>
|
|
1448
|
-
<p class="settings-danger-desc">Shutting down the server will terminate all active sessions, disconnect all clients, and stop the Clagentic:Console daemon process. This action cannot be undone.</p>
|
|
1449
|
+
<p class="settings-danger-desc">Shutting down the server will terminate all active sessions, disconnect all clients, and stop the Clagentic: Console daemon process. This action cannot be undone.</p>
|
|
1449
1450
|
</div>
|
|
1450
1451
|
</div>
|
|
1451
1452
|
<div class="settings-card settings-card-danger">
|
|
@@ -1696,7 +1697,7 @@
|
|
|
1696
1697
|
<button class="skills-close" id="mcp-modal-close"><i data-lucide="x"></i></button>
|
|
1697
1698
|
</div>
|
|
1698
1699
|
<div class="mcp-content" id="mcp-content">
|
|
1699
|
-
<p class="mcp-no-servers">No MCP servers detected. Configure in Clagentic:Console Chrome Extension.</p>
|
|
1700
|
+
<p class="mcp-no-servers">No MCP servers detected. Configure in Clagentic: Console Chrome Extension.</p>
|
|
1700
1701
|
</div>
|
|
1701
1702
|
</div>
|
|
1702
1703
|
</div>
|
|
@@ -1794,7 +1795,7 @@
|
|
|
1794
1795
|
<h3>Provide details</h3>
|
|
1795
1796
|
<div id="ralph-input-task-section" class="hidden">
|
|
1796
1797
|
<label class="ralph-field-label" for="ralph-task">Task description <span class="ralph-field-req">*</span></label>
|
|
1797
|
-
<p class="ralph-hint">Write a rough idea. Clagentic:Console will refine it into detailed instructions.</p>
|
|
1798
|
+
<p class="ralph-hint">Write a rough idea. Clagentic: Console will refine it into detailed instructions.</p>
|
|
1798
1799
|
<textarea id="ralph-task" rows="5" placeholder="e.g. Add dark mode toggle to the settings page"></textarea>
|
|
1799
1800
|
</div>
|
|
1800
1801
|
<div id="ralph-input-prompt-section" class="hidden">
|
|
@@ -2082,7 +2083,7 @@
|
|
|
2082
2083
|
<div class="pwa-modal-card">
|
|
2083
2084
|
<div class="pwa-modal-icon">📲</div>
|
|
2084
2085
|
<h3 class="pwa-modal-title">Add to Home Screen</h3>
|
|
2085
|
-
<p class="pwa-modal-desc">Add Clagentic:Console to your home screen for a better experience.</p>
|
|
2086
|
+
<p class="pwa-modal-desc">Add Clagentic: Console to your home screen for a better experience.</p>
|
|
2086
2087
|
<ul class="pwa-modal-benefits">
|
|
2087
2088
|
<li><i data-lucide="maximize" class="pwa-benefit-icon"></i>Full-screen — no browser toolbar</li>
|
|
2088
2089
|
<li><i data-lucide="bell" class="pwa-benefit-icon"></i>Push notifications when tasks finish</li>
|
package/lib/public/manifest.json
CHANGED
|
@@ -13,6 +13,7 @@ import { isHomeHubVisible } from './app-home-hub.js';
|
|
|
13
13
|
import { resetTerminals } from './terminal.js';
|
|
14
14
|
import { closeDmUserPicker } from './sidebar-users.js';
|
|
15
15
|
import { openDm } from './app-dm.js';
|
|
16
|
+
import { getPaletteVersion } from './command-palette.js';
|
|
16
17
|
|
|
17
18
|
var reconnectTimer = null;
|
|
18
19
|
var reconnectDelay = 100;
|
|
@@ -20,6 +21,20 @@ var connectTimeoutId = null;
|
|
|
20
21
|
var connectOverlay = null;
|
|
21
22
|
var overlayGraceTimer = null;
|
|
22
23
|
|
|
24
|
+
// --- Stale-bundle watchdog (lr-e0ec47) ---
|
|
25
|
+
// A foregrounded mobile PWA can be stuck serving a pre-deploy bundle from
|
|
26
|
+
// the service worker's cache (see sw.js network-first/cache-fallback). If
|
|
27
|
+
// that stale bundle predates a WS/message contract change, the reconnect
|
|
28
|
+
// FSM can wedge on "reconnecting" indefinitely even though the server is
|
|
29
|
+
// reachable. Each reconnect attempt compares the server's currently served
|
|
30
|
+
// version (fetched from /info) against the version this client's own WS
|
|
31
|
+
// handshake last reported running (command-palette's cachedVersion, set
|
|
32
|
+
// from the "info" WS message). A version mismatch that survives several
|
|
33
|
+
// consecutive disconnected reconnect attempts means we are not going to
|
|
34
|
+
// self-heal by reconnecting — force a hard reload to fetch the fresh bundle.
|
|
35
|
+
var STALE_VERSION_THRESHOLD = 3;
|
|
36
|
+
var staleVersionStreak = 0;
|
|
37
|
+
|
|
23
38
|
// Message types that warrant a visible IO blink. Everything else is
|
|
24
39
|
// background infrastructure traffic (presence, rate-limit accounting,
|
|
25
40
|
// cursor relay, session list updates, input echo) that does not need
|
|
@@ -46,6 +61,17 @@ var _blinkTypes = {
|
|
|
46
61
|
export function initConnection() {
|
|
47
62
|
connectOverlay = document.getElementById("connect-overlay");
|
|
48
63
|
|
|
64
|
+
var signinBtn = document.getElementById("connect-overlay-signin-btn");
|
|
65
|
+
if (signinBtn) {
|
|
66
|
+
signinBtn.addEventListener("click", function () {
|
|
67
|
+
// The session is already gone server-side; reloading re-requests "/"
|
|
68
|
+
// which server.js:519 serves as the login page for an unauthed
|
|
69
|
+
// request. No client-side router exists for auth state (see
|
|
70
|
+
// lib/pages.js), so a full reload is the correct navigation here.
|
|
71
|
+
location.reload();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
49
75
|
// --- Reactive UI sync for connected/processing state ---
|
|
50
76
|
store.subscribe(['connected', 'processing'], function (state, prev) {
|
|
51
77
|
// Status dot (depends on both connected and processing)
|
|
@@ -71,6 +97,12 @@ export function initConnection() {
|
|
|
71
97
|
var updPill = document.getElementById("update-pill-wrap");
|
|
72
98
|
if (updPill) updPill.classList.add("hidden");
|
|
73
99
|
stopLogoAnimation();
|
|
100
|
+
// Reset any lr-de5fcb Surface-1 "session expired" state left over
|
|
101
|
+
// from a prior unauthenticated episode, now that we're connected.
|
|
102
|
+
var signinBtnReset = document.getElementById("connect-overlay-signin-btn");
|
|
103
|
+
if (signinBtnReset) signinBtnReset.classList.add("hidden");
|
|
104
|
+
var msgElReset = document.getElementById("connect-overlay-msg");
|
|
105
|
+
if (msgElReset) msgElReset.textContent = "Reconnecting to server…";
|
|
74
106
|
} else {
|
|
75
107
|
if (sendBtn) sendBtn.disabled = true;
|
|
76
108
|
// Clear any in-progress replay indicator — history_done won't fire on disconnect.
|
|
@@ -156,13 +188,81 @@ function onConnected() {
|
|
|
156
188
|
}
|
|
157
189
|
}
|
|
158
190
|
|
|
191
|
+
// handleUnauthenticated (lr-de5fcb Surface 1): the reconnect FSM previously
|
|
192
|
+
// treated a 401 identically to a transient disconnect — it kept showing
|
|
193
|
+
// "reconnecting to server" and silently called location.reload() on the
|
|
194
|
+
// next /info poll, which just re-served the login page. The user perceived
|
|
195
|
+
// an endless reconnect loop with no signal that they needed to log back in.
|
|
196
|
+
// This stops the reconnect machinery outright and swaps the overlay to an
|
|
197
|
+
// explicit "session expired" state with a manual sign-in action, instead of
|
|
198
|
+
// auto-reloading (auto-reload here would immediately re-trigger connect(),
|
|
199
|
+
// which would hit /api/ws-ticket 401 again — a tight loop of its own).
|
|
200
|
+
function handleUnauthenticated() {
|
|
201
|
+
cancelReconnect();
|
|
202
|
+
if (connectTimeoutId) { clearTimeout(connectTimeoutId); connectTimeoutId = null; }
|
|
203
|
+
if (overlayGraceTimer) { clearTimeout(overlayGraceTimer); overlayGraceTimer = null; }
|
|
204
|
+
setStatus("disconnected");
|
|
205
|
+
stopLogoAnimation();
|
|
206
|
+
var msgEl = document.getElementById("connect-overlay-msg");
|
|
207
|
+
if (msgEl) msgEl.textContent = "Session expired — sign in again.";
|
|
208
|
+
var signinBtn = document.getElementById("connect-overlay-signin-btn");
|
|
209
|
+
if (signinBtn) signinBtn.classList.remove("hidden");
|
|
210
|
+
if (connectOverlay) connectOverlay.classList.remove("hidden");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Fetch a short-TTL, single-use WS-upgrade ticket (lr-de5fcb). The session
|
|
214
|
+
// cookie is HttpOnly (unreadable by JS), so the client cannot read the raw
|
|
215
|
+
// session token — it must ask the server for a ticket over a normal
|
|
216
|
+
// authenticated HTTP request instead. This request DOES reliably carry the
|
|
217
|
+
// cookie (it's not a script-initiated WebSocket upgrade), which is exactly
|
|
218
|
+
// the mobile-browser gap this ticket exists to route around: mobile
|
|
219
|
+
// browsers don't reliably attach a SameSite=Lax cookie to the WS handshake
|
|
220
|
+
// itself. Returns { ticket } on success, or { unauthenticated: true } on a
|
|
221
|
+
// 401, or { ticket: null } on any other failure (network hiccup — the
|
|
222
|
+
// upgrade will then rely on the cookie alone, same as before this fix).
|
|
223
|
+
function fetchWsTicket() {
|
|
224
|
+
return fetch("/api/ws-ticket", { credentials: "same-origin" })
|
|
225
|
+
.then(function (res) {
|
|
226
|
+
if (res.status === 401) return { unauthenticated: true };
|
|
227
|
+
if (!res.ok) return { ticket: null };
|
|
228
|
+
return res.json().then(function (data) {
|
|
229
|
+
return { ticket: (data && data.ticket) || null };
|
|
230
|
+
}).catch(function () { return { ticket: null }; });
|
|
231
|
+
})
|
|
232
|
+
.catch(function () { return { ticket: null }; });
|
|
233
|
+
}
|
|
234
|
+
|
|
159
235
|
export function connect() {
|
|
160
236
|
var ws = getWs();
|
|
161
237
|
if (ws) { ws.onclose = null; ws.onmessage = null; ws.onerror = null; ws.close(); }
|
|
162
238
|
if (connectTimeoutId) { clearTimeout(connectTimeoutId); connectTimeoutId = null; }
|
|
163
239
|
|
|
240
|
+
fetchWsTicket().then(function (result) {
|
|
241
|
+
if (result.unauthenticated) {
|
|
242
|
+
// Ticket fetch itself came back 401: the session is gone (expired /
|
|
243
|
+
// revoked), not just cookie-less-on-upgrade. Route to sign-in instead
|
|
244
|
+
// of opening a socket that would only 401 on the upgrade too — ties
|
|
245
|
+
// into the Surface-1 unauth-vs-unreachable split below.
|
|
246
|
+
handleUnauthenticated();
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
openSocket(result.ticket);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// openSocket does the actual WebSocket construction. Split out from
|
|
254
|
+
// connect() so the ticket fetch (network round-trip) can complete first
|
|
255
|
+
// without duplicating the onopen/onclose/onmessage wiring.
|
|
256
|
+
function openSocket(ticket) {
|
|
257
|
+
// WS URL is derived strictly from window.location — never from the
|
|
258
|
+
// daemon.js:239-243 LAN/share host resolution (which may prefer a
|
|
259
|
+
// 100.x Tailscale address). Pointing the socket at a different origin
|
|
260
|
+
// than the page was served from would re-introduce a cross-origin
|
|
261
|
+
// session mismatch; same-origin is a load-bearing invariant here, not
|
|
262
|
+
// an incidental default (lr-de5fcb / lr-e0ec47 comment #4).
|
|
164
263
|
var protocol = location.protocol === "https:" ? "wss:" : "ws:";
|
|
165
|
-
var
|
|
264
|
+
var url = protocol + "//" + location.host + store.get('wsPath');
|
|
265
|
+
var newWs = ticket ? new WebSocket(url, ["clagentic.auth." + ticket]) : new WebSocket(url);
|
|
166
266
|
setWs(newWs);
|
|
167
267
|
|
|
168
268
|
// If not connected within 3s, force retry
|
|
@@ -176,10 +276,20 @@ export function connect() {
|
|
|
176
276
|
}
|
|
177
277
|
}, 3000);
|
|
178
278
|
|
|
279
|
+
// Track whether this socket ever reached onopen. A upgrade rejected with
|
|
280
|
+
// 401 (server.js:781 area — socket.write + socket.destroy, not a clean WS
|
|
281
|
+
// close frame) closes the browser WebSocket WITHOUT ever firing onopen.
|
|
282
|
+
// That is the only client-observable signal that distinguishes "rejected
|
|
283
|
+
// upgrade" from "connected then dropped" — the close event itself carries
|
|
284
|
+
// no HTTP status (lr-de5fcb Surface 1).
|
|
285
|
+
var everOpened = false;
|
|
286
|
+
|
|
179
287
|
newWs.onopen = function () {
|
|
288
|
+
everOpened = true;
|
|
180
289
|
if (connectTimeoutId) { clearTimeout(connectTimeoutId); connectTimeoutId = null; }
|
|
181
290
|
setStatus("connected");
|
|
182
291
|
reconnectDelay = 100;
|
|
292
|
+
staleVersionStreak = 0;
|
|
183
293
|
if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }
|
|
184
294
|
|
|
185
295
|
// Wrap ws.send to blink LED on outgoing traffic
|
|
@@ -204,6 +314,16 @@ export function connect() {
|
|
|
204
314
|
// stale — leaving it would cause the *next* successful session_list (on
|
|
205
315
|
// any project reconnect) to switch to a wrong session.
|
|
206
316
|
try { sessionStorage.removeItem("pending-hub-session"); } catch (e) {}
|
|
317
|
+
|
|
318
|
+
// A socket that had a valid ticket AND still never opened means the
|
|
319
|
+
// upgrade itself was rejected as unauthenticated (both the cookie and
|
|
320
|
+
// the fresh ticket failed, or the ticket was already consumed by a
|
|
321
|
+
// racing tab) rather than a reachability problem — don't mask this as
|
|
322
|
+
// an endless "reconnecting to server" spinner (lr-de5fcb Surface 1).
|
|
323
|
+
if (!everOpened && ticket) {
|
|
324
|
+
handleUnauthenticated();
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
207
327
|
scheduleReconnect();
|
|
208
328
|
};
|
|
209
329
|
|
|
@@ -214,6 +334,7 @@ export function connect() {
|
|
|
214
334
|
if (!store.get('connected')) {
|
|
215
335
|
setStatus("connected");
|
|
216
336
|
reconnectDelay = 100;
|
|
337
|
+
staleVersionStreak = 0;
|
|
217
338
|
if (reconnectTimer) { clearTimeout(reconnectTimer); reconnectTimer = null; }
|
|
218
339
|
}
|
|
219
340
|
|
|
@@ -238,12 +359,37 @@ export function scheduleReconnect() {
|
|
|
238
359
|
reconnectTimer = setTimeout(function () {
|
|
239
360
|
reconnectTimer = null;
|
|
240
361
|
// Attempt reconnect immediately — don't block on /info preflight.
|
|
241
|
-
// Check auth in parallel: if the server returns 401 while we're trying
|
|
242
|
-
// connect,
|
|
362
|
+
// Check auth in parallel: if the server returns 401 while we're trying
|
|
363
|
+
// to connect, route to the explicit unauthenticated state (lr-de5fcb
|
|
364
|
+
// Surface 1) instead of silently reloading into a fresh reconnect loop.
|
|
243
365
|
fetch("/info").then(function (res) {
|
|
244
|
-
if (res.status === 401) {
|
|
366
|
+
if (res.status === 401) { handleUnauthenticated(); return null; }
|
|
367
|
+
return res.ok ? res.json().catch(function () { return null; }) : null;
|
|
368
|
+
}).then(function (info) {
|
|
369
|
+
if (info) checkStaleVersion(info);
|
|
245
370
|
}).catch(function () {});
|
|
246
371
|
connect();
|
|
247
372
|
}, reconnectDelay);
|
|
248
373
|
reconnectDelay = Math.min(reconnectDelay * 1.5, 10000);
|
|
249
374
|
}
|
|
375
|
+
|
|
376
|
+
// Compare the server's currently-served version (from /info) against the
|
|
377
|
+
// version this client's own WS session last reported running. A mismatch
|
|
378
|
+
// that persists across several consecutive disconnected reconnect attempts
|
|
379
|
+
// means the running bundle predates the current deploy and the SW's
|
|
380
|
+
// registration.update() path has not (yet) replaced it — reload rather than
|
|
381
|
+
// keep retrying a connection whose client code may no longer match the
|
|
382
|
+
// server's message contract (lr-e0ec47).
|
|
383
|
+
function checkStaleVersion(info) {
|
|
384
|
+
if (store.get('connected')) { staleVersionStreak = 0; return; }
|
|
385
|
+
var runningVersion = getPaletteVersion();
|
|
386
|
+
var servedVersion = info && info.version;
|
|
387
|
+
if (!runningVersion || !servedVersion || servedVersion === runningVersion) {
|
|
388
|
+
staleVersionStreak = 0;
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
staleVersionStreak++;
|
|
392
|
+
if (staleVersionStreak >= STALE_VERSION_THRESHOLD) {
|
|
393
|
+
location.reload();
|
|
394
|
+
}
|
|
395
|
+
}
|