@songsid/agend 2.3.5-alpha.2 → 2.3.5-alpha.4
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/dist/agend-home.d.ts +13 -0
- package/dist/agend-home.js +42 -0
- package/dist/agend-home.js.map +1 -1
- package/dist/agent-runtime-api.d.ts +4 -0
- package/dist/agent-runtime-api.js +59 -0
- package/dist/agent-runtime-api.js.map +1 -0
- package/dist/agent-runtime-change.d.ts +74 -0
- package/dist/agent-runtime-change.js +102 -0
- package/dist/agent-runtime-change.js.map +1 -0
- package/dist/auth-api.d.ts +21 -0
- package/dist/auth-api.js +95 -4
- package/dist/auth-api.js.map +1 -1
- package/dist/authority/web-authority.d.ts +12 -2
- package/dist/authority/web-authority.js +25 -4
- package/dist/authority/web-authority.js.map +1 -1
- package/dist/backend/claude-code.js +16 -1
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex-footer-hints.d.ts +4 -0
- package/dist/backend/codex-footer-hints.js +27 -0
- package/dist/backend/codex-footer-hints.js.map +1 -0
- package/dist/backend/codex.js +19 -11
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/kiro-identity.d.ts +2 -0
- package/dist/backend/kiro-identity.js +13 -6
- package/dist/backend/kiro-identity.js.map +1 -1
- package/dist/backend/kiro.js +18 -3
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend-availability.d.ts +6 -0
- package/dist/backend-availability.js +13 -5
- package/dist/backend-availability.js.map +1 -1
- package/dist/channel/mcp-tools.js +1 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/cli.js +6 -9
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +12 -1
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.js +107 -30
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +146 -8
- package/dist/fleet-manager.js +1030 -166
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-windows-runtime.d.ts +6 -1
- package/dist/fleet-windows-runtime.js +77 -1
- package/dist/fleet-windows-runtime.js.map +1 -1
- package/dist/fleet-yaml-patch.d.ts +3 -0
- package/dist/fleet-yaml-patch.js +103 -0
- package/dist/fleet-yaml-patch.js.map +1 -0
- package/dist/general-binding.d.ts +85 -0
- package/dist/general-binding.js +298 -0
- package/dist/general-binding.js.map +1 -0
- package/dist/general-host-owner.d.ts +8 -0
- package/dist/general-host-owner.js +26 -0
- package/dist/general-host-owner.js.map +1 -0
- package/dist/general-instance.d.ts +7 -0
- package/dist/general-instance.js +20 -3
- package/dist/general-instance.js.map +1 -1
- package/dist/general-knowledge/skills/model-discovery/SKILL.md +2 -0
- package/dist/general-role.d.ts +5 -0
- package/dist/general-role.js +26 -0
- package/dist/general-role.js.map +1 -0
- package/dist/instance-lifecycle.d.ts +1 -0
- package/dist/instance-lifecycle.js +26 -4
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +2 -0
- package/dist/instructions.js +6 -0
- package/dist/instructions.js.map +1 -1
- package/dist/kiro-resume-summary.d.ts +37 -0
- package/dist/kiro-resume-summary.js +85 -0
- package/dist/kiro-resume-summary.js.map +1 -0
- package/dist/locale.js +59 -0
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.js +9 -1
- package/dist/login-controller.js.map +1 -1
- package/dist/native-pane-lifecycle.js +4 -1
- package/dist/native-pane-lifecycle.js.map +1 -1
- package/dist/native-pane-manager.d.ts +1 -0
- package/dist/native-pane-manager.js +23 -2
- package/dist/native-pane-manager.js.map +1 -1
- package/dist/needs-you-hub.js +1 -1
- package/dist/needs-you-hub.js.map +1 -1
- package/dist/needs-you.d.ts +8 -1
- package/dist/needs-you.js +5 -2
- package/dist/needs-you.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/package-preimage.js +27 -2
- package/dist/package-preimage.js.map +1 -1
- package/dist/pane-port.d.ts +11 -0
- package/dist/public-web-gateway.js +9 -0
- package/dist/public-web-gateway.js.map +1 -1
- package/dist/public-web-link.d.ts +11 -0
- package/dist/public-web-link.js +13 -0
- package/dist/public-web-link.js.map +1 -1
- package/dist/quickstart-api.js +9 -5
- package/dist/quickstart-api.js.map +1 -1
- package/dist/quickstart.d.ts +1 -0
- package/dist/quickstart.js +4 -1
- package/dist/quickstart.js.map +1 -1
- package/dist/reply-buttons-controller.js +10 -0
- package/dist/reply-buttons-controller.js.map +1 -1
- package/dist/runtime-api.js +84 -9
- package/dist/runtime-api.js.map +1 -1
- package/dist/runtime-build-info.d.ts +9 -0
- package/dist/runtime-build-info.js +57 -0
- package/dist/runtime-build-info.js.map +1 -0
- package/dist/runtime-bundle.d.ts +3 -1
- package/dist/runtime-bundle.js +17 -8
- package/dist/runtime-bundle.js.map +1 -1
- package/dist/runtime-cli.d.ts +6 -1
- package/dist/runtime-cli.js +46 -11
- package/dist/runtime-cli.js.map +1 -1
- package/dist/runtime-client-store.d.ts +20 -1
- package/dist/runtime-client-store.js +56 -4
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-client.d.ts +12 -0
- package/dist/runtime-client.js +43 -7
- package/dist/runtime-client.js.map +1 -1
- package/dist/runtime-connection.d.ts +22 -0
- package/dist/runtime-connection.js +93 -0
- package/dist/runtime-connection.js.map +1 -0
- package/dist/runtime-coordinator.d.ts +9 -0
- package/dist/runtime-coordinator.js +81 -34
- package/dist/runtime-coordinator.js.map +1 -1
- package/dist/runtime-general-protocol.d.ts +22 -0
- package/dist/runtime-general-protocol.js +57 -0
- package/dist/runtime-general-protocol.js.map +1 -0
- package/dist/runtime-general-workspace.d.ts +17 -0
- package/dist/runtime-general-workspace.js +213 -0
- package/dist/runtime-general-workspace.js.map +1 -0
- package/dist/runtime-pane-assets.d.ts +1 -1
- package/dist/runtime-pane-assets.js +1 -1
- package/dist/runtime-pane-assets.js.map +1 -1
- package/dist/runtime-pane-boot.d.ts +7 -0
- package/dist/runtime-pane-boot.js +23 -0
- package/dist/runtime-pane-boot.js.map +1 -1
- package/dist/runtime-pane-host.d.ts +1 -0
- package/dist/runtime-pane-host.js +22 -1
- package/dist/runtime-pane-host.js.map +1 -1
- package/dist/runtime-pane-mcp.d.ts +8 -0
- package/dist/runtime-pane-mcp.js +15 -2
- package/dist/runtime-pane-mcp.js.map +1 -1
- package/dist/runtime-pane-port.d.ts +6 -1
- package/dist/runtime-pane-port.js +21 -0
- package/dist/runtime-pane-port.js.map +1 -1
- package/dist/runtime-pane-protocol.d.ts +4 -1
- package/dist/runtime-pane-protocol.js +7 -1
- package/dist/runtime-pane-protocol.js.map +1 -1
- package/dist/runtime-protocol.d.ts +13 -0
- package/dist/runtime-protocol.js +18 -0
- package/dist/runtime-protocol.js.map +1 -1
- package/dist/settings-api.d.ts +5 -0
- package/dist/settings-api.js +37 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-baseline.d.ts +1 -0
- package/dist/settings-baseline.js +1 -1
- package/dist/settings-baseline.js.map +1 -1
- package/dist/settings-confirmation.d.ts +1 -0
- package/dist/settings-confirmation.js +1 -0
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +4 -0
- package/dist/settings-effect.js +36 -1
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +4 -0
- package/dist/settings-http-confirmation.js +20 -1
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-request-capability.d.ts +2 -0
- package/dist/settings-request-capability.js +4 -0
- package/dist/settings-request-capability.js.map +1 -1
- package/dist/settings-route-lifetime.d.ts +14 -0
- package/dist/settings-route-lifetime.js +48 -0
- package/dist/settings-route-lifetime.js.map +1 -0
- package/dist/settings-transaction.d.ts +4 -0
- package/dist/settings-transaction.js +9 -0
- package/dist/settings-transaction.js.map +1 -1
- package/dist/setup-form.js +6 -3
- package/dist/setup-form.js.map +1 -1
- package/dist/setup-i18n.js +3 -0
- package/dist/setup-i18n.js.map +1 -1
- package/dist/stall-reporter.d.ts +21 -0
- package/dist/stall-reporter.js +82 -0
- package/dist/stall-reporter.js.map +1 -0
- package/dist/tmux-control.d.ts +2 -2
- package/dist/tmux-control.js +4 -2
- package/dist/tmux-control.js.map +1 -1
- package/dist/tmux-exec-helper.d.ts +6 -3
- package/dist/tmux-exec-helper.js +115 -53
- package/dist/tmux-exec-helper.js.map +1 -1
- package/dist/tool-permissions.js +2 -1
- package/dist/tool-permissions.js.map +1 -1
- package/dist/tunnel/cloudflared-install.d.ts +4 -0
- package/dist/tunnel/cloudflared-install.js +20 -1
- package/dist/tunnel/cloudflared-install.js.map +1 -1
- package/dist/tunnel/cloudflared.d.ts +8 -1
- package/dist/tunnel/cloudflared.js +34 -6
- package/dist/tunnel/cloudflared.js.map +1 -1
- package/dist/tunnel/lease.d.ts +3 -3
- package/dist/tunnel/lease.js +23 -19
- package/dist/tunnel/lease.js.map +1 -1
- package/dist/tunnel/manager.js +6 -7
- package/dist/tunnel/manager.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/ui/agent-proposals.js +2 -2
- package/dist/ui/agent-runtime-settings.js +67 -0
- package/dist/ui/agent-runtime.js +20 -2
- package/dist/ui/backend-signin.js +36 -21
- package/dist/ui/general-location.js +71 -0
- package/dist/ui/native-instance-settings.js +5 -8
- package/dist/ui/native-pane-recovery.js +1 -1
- package/dist/ui/panel-chat.js +5 -2
- package/dist/ui/panel-fleet.js +4 -2
- package/dist/ui/panel-needs.js +2 -0
- package/dist/ui/panel-runtimes.js +136 -33
- package/dist/ui/panel-settings.js +227 -138
- package/dist/ui/panel-windows-cli.js +77 -41
- package/dist/ui/settings-agent-filters.js +94 -0
- package/dist/ui/settings-appearance.js +122 -23
- package/dist/ui/settings-dialogs.js +13 -7
- package/dist/ui/settings-guests.js +25 -11
- package/dist/ui/settings-layout.js +245 -0
- package/dist/ui/settings-model.js +10 -1
- package/dist/ui/settings-outside.js +176 -0
- package/dist/ui/settings-registry.js +6 -3
- package/dist/ui/settings-shortcuts.js +65 -0
- package/dist/ui/settings-strings.js +95 -0
- package/dist/ui/settings-web-authority.js +14 -11
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +17 -7
- package/dist/ui/shared/app.css +1038 -13
- package/dist/ui/shared/instance-nav.js +16 -5
- package/dist/ui/shared/machine-name.js +13 -0
- package/dist/ui/shared/panel-view.js +266 -17
- package/dist/ui/shared/qrcode.module.js +2237 -0
- package/dist/ui/shared/settings-width.js +31 -0
- package/dist/ui/shared/signin.js +39 -5
- package/dist/ui/shared/tokens.css +1 -0
- package/dist/ui/shared/ui-dialog.js +2 -2
- package/dist/ui/shared/ui-menu.js +3 -3
- package/dist/ui/shared/vendor/qrcode-generator.LICENSE +27 -0
- package/dist/ui/shared/vendor/vendor.json +19 -2
- package/dist/ui/shared/view-strings.js +28 -0
- package/dist/ui/windows-cli-catalog.js +41 -12
- package/dist/unattended-install.d.ts +1 -1
- package/dist/unattended-install.js +19 -5
- package/dist/unattended-install.js.map +1 -1
- package/dist/update-check.d.ts +2 -8
- package/dist/update-check.js +2 -5
- package/dist/update-check.js.map +1 -1
- package/dist/view-api.d.ts +15 -0
- package/dist/view-api.js +94 -33
- package/dist/view-api.js.map +1 -1
- package/dist/web-api.d.ts +13 -0
- package/dist/web-api.js +80 -0
- package/dist/web-api.js.map +1 -1
- package/dist/web-login.d.ts +4 -3
- package/dist/web-login.js +23 -14
- package/dist/web-login.js.map +1 -1
- package/dist/web-only-fleet.d.ts +20 -0
- package/dist/web-only-fleet.js +21 -0
- package/dist/web-only-fleet.js.map +1 -1
- package/dist/web-remote-access.d.ts +152 -0
- package/dist/web-remote-access.js +368 -0
- package/dist/web-remote-access.js.map +1 -0
- package/dist/web-session.d.ts +12 -0
- package/dist/web-session.js +22 -8
- package/dist/web-session.js.map +1 -1
- package/dist/windows-agents.d.ts +15 -1
- package/dist/windows-agents.js +37 -10
- package/dist/windows-agents.js.map +1 -1
- package/dist/windows-cli-api.js +2 -1
- package/dist/windows-cli-api.js.map +1 -1
- package/dist/windows-cli-worker.d.ts +1 -0
- package/dist/windows-cli-worker.js +2 -2
- package/dist/windows-cli-worker.js.map +1 -1
- package/dist/windows-cli.d.ts +1 -0
- package/dist/windows-cli.js +7 -2
- package/dist/windows-cli.js.map +1 -1
- package/launcher/agend-install.cjs +16 -2
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ import { viewStore } from "./view-roster-store.js";
|
|
|
18
18
|
import { onPrefsChanged, prefInForce, prefsWritable, savePref } from "./app-prefs.js";
|
|
19
19
|
import "./view-strings.js";
|
|
20
20
|
import { themesShown, themesStore } from "./app-themes.js";
|
|
21
|
+
import { machineName } from "./machine-name.js";
|
|
21
22
|
import { identityClasses, identityOf, paintIdentity, useIdentityColors } from "./identity-color.js";
|
|
22
23
|
|
|
23
24
|
/** view.* text with named values. */
|
|
@@ -145,7 +146,7 @@ export function instanceTooltip(it) {
|
|
|
145
146
|
else lines.push(name);
|
|
146
147
|
lines.push(line("tooltipBackend", backendLabel(it.backend)));
|
|
147
148
|
if (it.runtime) lines.push(`Runtime: ${runtimeLabel(it.runtime)}`);
|
|
148
|
-
if (it.machine_id) lines.push(line("tooltipMachine",it.
|
|
149
|
+
if (it.machine_id) lines.push(line("tooltipMachine",machineName(it.machine_id,it.machine_name)));
|
|
149
150
|
if (it.machine_id && it.machine_status !== "online") lines.push(tn(it.machine_status === "revoked" ? "machineRevoked" : "machineOffline"));
|
|
150
151
|
const src = (s) => (s === "instance" || s === "classic" ? tn("srcConfigured") : s === "fleet-default" ? tn("srcFleetDefault") : "");
|
|
151
152
|
lines.push(line("tooltipModel", (modelText(it) || tn("tooltipUnavailable")) + src(it.model_source)));
|
|
@@ -294,6 +295,8 @@ function writeFacetsOpen(open) { try { localStorage.setItem(FACETS_KEY, JSON.str
|
|
|
294
295
|
|
|
295
296
|
/** The Favorites group's key among the tag groups: no tag can be it (a group name is never a control character). */
|
|
296
297
|
const FAV_GROUP = "\u0000favorites";
|
|
298
|
+
/** #3008 G2: a web-only fleet's General (its status row says `general: true`), pinned first under its own head. */
|
|
299
|
+
const GENERAL_GROUP = "\u0000general";
|
|
297
300
|
/** #1936: the open instance, pinned on top while a filter is on. */
|
|
298
301
|
const PINNED_GROUP = "\u0000pinned";
|
|
299
302
|
function persistOrder(groupNames, instByGroup) {
|
|
@@ -515,7 +518,10 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
515
518
|
// their order. Changing them: a signed-in page that may write preferences (not the public link, not the anonymous
|
|
516
519
|
// reader — they still see the list).
|
|
517
520
|
const known = new Set(byName.keys());
|
|
518
|
-
|
|
521
|
+
// #3008 G2: the General, when the server marks one (a web-only fleet), comes first — out of every other group.
|
|
522
|
+
const general = items.find((it) => it && it.general === true);
|
|
523
|
+
const generalName = general ? nameOf(general) : null;
|
|
524
|
+
const favs = nav.favorites.filter((n) => known.has(n) && n !== generalName);
|
|
519
525
|
const favSet = new Set(favs);
|
|
520
526
|
const canStar = !viewOnly && prefsWritable("nav.favorites");
|
|
521
527
|
// #1920: a guest's list is not reordered (the order is the host's). #2855: it stars, sorts and filters as its own
|
|
@@ -533,14 +539,15 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
533
539
|
let shownGroups, shownInsts;
|
|
534
540
|
if (recent) {
|
|
535
541
|
const sortRecent = byRecentReply(ageOf);
|
|
536
|
-
const rest = groupNames.flatMap((g) => instByGroup.get(g) || []).filter((n) => !favSet.has(n)).sort(sortRecent);
|
|
542
|
+
const rest = groupNames.flatMap((g) => instByGroup.get(g) || []).filter((n) => !favSet.has(n) && n !== generalName).sort(sortRecent);
|
|
537
543
|
shownGroups = [...(favs.length ? [FAV_GROUP] : []), ...(rest.length ? [RECENT_GROUP] : [])];
|
|
538
544
|
shownInsts = new Map([[FAV_GROUP, favsSorted ? [...favs].sort(sortRecent) : favs], [RECENT_GROUP, rest]]);
|
|
539
545
|
} else {
|
|
540
546
|
shownGroups = favs.length ? [FAV_GROUP, ...groupNames] : groupNames;
|
|
541
|
-
shownInsts = new Map([...instByGroup].map(([g, names]) => [g, names.filter((n) => !favSet.has(n))]));
|
|
547
|
+
shownInsts = new Map([...instByGroup].map(([g, names]) => [g, names.filter((n) => !favSet.has(n) && n !== generalName)]));
|
|
542
548
|
if (favs.length) shownInsts.set(FAV_GROUP, favs);
|
|
543
549
|
}
|
|
550
|
+
if (generalName) { shownGroups = [GENERAL_GROUP, ...shownGroups]; shownInsts.set(GENERAL_GROUP, [generalName]); }
|
|
544
551
|
const f = nav.filter;
|
|
545
552
|
const shown = filterSidebar(shownGroups, shownInsts, byName, f.q, backendLabel, { status: f.status, cli: f.cli, statusOf: facetOf });
|
|
546
553
|
// #1936: while a filter is on, the instance you have open stays on top, pinned and marked "Current", whether or not
|
|
@@ -624,7 +631,7 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
624
631
|
<span class="v-meta">${it.runtime === "windows" ? "Windows" : it.context_pct != null ? `${Math.round(it.context_pct)}%` : ""}</span></span>
|
|
625
632
|
${two ? html`<span class="inst-line inst-line2"><span class="inst-alt" title=${secondary || undefined}>${secondary || ""}</span>
|
|
626
633
|
${mins != null ? html`<span class=${`inst-when${fade > 0 ? " fresh" : ""}`} title=${tn("replyTitle", { time: new Date(Date.parse(it.last_reply)).toLocaleString() })}>${replyText(mins)}</span>` : null}</span>` : null}
|
|
627
|
-
${it.machine_id ? html`<span class=${`inst-machine${it.machine_status !== "online" ? " offline" : ""}`} title=${tn("tooltipMachine",{value:it.
|
|
634
|
+
${it.machine_id ? html`<span class=${`inst-machine${it.machine_status !== "online" ? " offline" : ""}`} title=${tn("tooltipMachine",{value:machineName(it.machine_id,it.machine_name)})}><span class="inst-machine-name">${machineName(it.machine_id,it.machine_name)}</span>${it.machine_status !== "online" ? html`<span class="inst-machine-status">${tn(it.machine_status === "revoked" ? "machineRevoked" : "machineOffline")}</span>` : null}</span>` : null}
|
|
628
635
|
${facet === "needs" ? html`<span class="inst-sub"><span class="badge-await" title=${waiting || t("app.approxNote")}>${t("app.needsYou")}</span></span>` : null}
|
|
629
636
|
<span class="sr-only">${tn("tooltipBackend", { value: backendLabel(it.backend) })}</span></span>
|
|
630
637
|
</a>${fav && editing && canStar ? html`<button type="button" class="icon-btn inst-move" aria-label=${tn("favUp", { name: label })}
|
|
@@ -655,6 +662,10 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
655
662
|
if (g === RECENT_GROUP) return html`<div key=${g} class="v-group v-recent" role="group" aria-label=${tn("recentOthers")}>
|
|
656
663
|
<div class="v-group-head recent-head"><${Icon} name="clock" size=${14} /><span class="grow">${tn("recentOthers")}</span><span class="count">${names.length}</span></div>
|
|
657
664
|
<ul class="inst-list">${names.map((name, i) => row(name, g, i, names.length))}</ul></div>`;
|
|
665
|
+
// #3008 G2: the General — always open, first, not dragged or starred into another place.
|
|
666
|
+
if (g === GENERAL_GROUP) return html`<div key=${g} class="v-group v-general" role="group" aria-label=${tn("generalGroup")}>
|
|
667
|
+
<div class="v-group-head general-head"><span class="grow">${tn("generalGroup")}</span></div>
|
|
668
|
+
<ul class="inst-list">${names.map((name, i) => row(name, g, i, names.length))}</ul></div>`;
|
|
658
669
|
// #1664: Favorites — always open, not dragged (↑ ↓ in Edit), named in the page's language.
|
|
659
670
|
if (g === FAV_GROUP) return html`<div key=${g} class="v-group v-fav" role="group" aria-label=${tn("favorites")}>
|
|
660
671
|
<div class="v-group-head fav-head"><${Icon} name="star" size=${14} cls="fav-mark" /><span class="grow">${tn("favorites")}</span><span class="count">${names.length}</span></div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// A paired computer's display name. A module of its own, imported by the sidebar (instance-nav.js) and by the lazy
|
|
2
|
+
// chat panel. A tab opened before an upgrade keeps the old shell, whose instance-nav.js has no `machineName`; the new
|
|
3
|
+
// chat panel imports it from here instead, a module that tab loads fresh, so Chat still opens (as #2978 did for
|
|
4
|
+
// settings-width.js). It registers its own words so it does not depend on the shell's older string tables.
|
|
5
|
+
import { register, t } from "./app-i18n.js";
|
|
6
|
+
|
|
7
|
+
register("machine", {
|
|
8
|
+
"en": { "short": "Computer {value}" },
|
|
9
|
+
"zh-TW": { "short": "電腦 {value}" },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/** A remote computer by its name; with no name yet, by the start of its id, never the whole id. The 8-character cut matches `shortId` in src/ui/settings-agent-filters.js; keep the two in step. */
|
|
13
|
+
export const machineName = (id, name) => name || t("machine.short").split("{value}").join(String(id).slice(0, 8));
|
|
@@ -26,7 +26,7 @@ import { viewStore } from "./view-roster-store.js";
|
|
|
26
26
|
/** #1580: the app's stream says the fleet is not answering (a restart): the View's polls skip their turn until it is. */
|
|
27
27
|
const fleetUnreachable = () => appStore.get().connection === "reconnecting";
|
|
28
28
|
import { navigate } from "./app-nav.js";
|
|
29
|
-
import { viewPath } from "./app-route.js";
|
|
29
|
+
import { logPath, sectionPath, viewPath } from "./app-route.js";
|
|
30
30
|
import { Dialog } from "./ui-dialog.js";
|
|
31
31
|
import { Empty, ErrorState, Skeleton } from "./ui-states.js";
|
|
32
32
|
import { Icon } from "./ui-icons.js";
|
|
@@ -41,6 +41,44 @@ function tn(key, values = {}) {
|
|
|
41
41
|
for (const [k, v] of Object.entries(values)) s = s.split(`{${k}}`).join(String(v));
|
|
42
42
|
return s;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* v2.3.4-beta.4 P1 (hmsg-985db235, hmsg-5ab1997d): this module is loaded on first use, so a tab opened before an upgrade
|
|
46
|
+
* runs the new View with the stylesheet and the View's words it loaded at its start. Without the View's layout rules
|
|
47
|
+
* (.v-term-box) the terminal box grew with its text: the text shrank every second (fit() measured the box its own text
|
|
48
|
+
* sized), a normal-buffer CLI's View showed its whole history from the top, and new words showed as raw keys. Each is
|
|
49
|
+
* found by a mark the current files carry — VIEW_REV in app.css (the --v-term-rev property) and view-strings.js (the
|
|
50
|
+
* view.rev word) — and a stale one is read again, once per page: the stylesheet re-linked after the one in force, the
|
|
51
|
+
* words imported again (register() replaces them). The query only makes it a new request: /assets/ serves the file.
|
|
52
|
+
*/
|
|
53
|
+
export const VIEW_REV = "2";
|
|
54
|
+
const healed = { css: false, words: false };
|
|
55
|
+
export function healStalePage(doc = typeof document !== "undefined" ? document : null, load = (u) => import(u), onWords = () => {}) {
|
|
56
|
+
if (!doc) return { css: false, words: false };
|
|
57
|
+
const out = { css: false, words: false };
|
|
58
|
+
try {
|
|
59
|
+
const box = doc.querySelector && doc.querySelector(".v-term-box");
|
|
60
|
+
// Only a page that has the stylesheet linked (the app; never a test's page without one) and an older one in force.
|
|
61
|
+
const linked = [...(doc.querySelectorAll ? doc.querySelectorAll('link[rel="stylesheet"]') : [])]
|
|
62
|
+
.some((l) => String(l.getAttribute("href") || "").split("?")[0] === "/assets/app.css");
|
|
63
|
+
if (box && linked && !healed.css) {
|
|
64
|
+
const cs = typeof getComputedStyle === "function" ? getComputedStyle(box) : null;
|
|
65
|
+
const rev = cs && typeof cs.getPropertyValue === "function" ? String(cs.getPropertyValue("--v-term-rev")).trim().replace(/^"|"$/g, "") : VIEW_REV;
|
|
66
|
+
if (rev !== VIEW_REV) {
|
|
67
|
+
healed.css = true; out.css = true;
|
|
68
|
+
const link = doc.createElement("link");
|
|
69
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", `/assets/app.css?rev=${VIEW_REV}-${Date.now().toString(36)}`);
|
|
70
|
+
doc.head.appendChild(link);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} catch { /* never in the View's way */ }
|
|
74
|
+
if (t("view.rev") !== VIEW_REV && !healed.words) {
|
|
75
|
+
healed.words = true; out.words = true;
|
|
76
|
+
Promise.resolve(load(`./view-strings.js?rev=${VIEW_REV}-${Date.now().toString(36)}`)).then(() => onWords(), () => {});
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/** For tests: as on a fresh page. */
|
|
81
|
+
export function resetHealed() { healed.css = false; healed.words = false; }
|
|
44
82
|
const stored = (k) => { try { return localStorage.getItem(k); } catch { return null; } };
|
|
45
83
|
const store = (k, v) => { try { localStorage.setItem(k, v); } catch { /* this page only */ } };
|
|
46
84
|
|
|
@@ -198,8 +236,8 @@ export function ViewPanel({ route, navKey }) {
|
|
|
198
236
|
else if (!it) body = html`<div data-trust="panel-content" class="panel-body center"><${Empty} icon="alert" title=${tn("notFound", { name })} hint=${tn("notFoundHint")} /></div>`;
|
|
199
237
|
else if (guest && !trusted) body = html`<div data-trust="panel-content" class="panel-body center"><${Empty} icon="view" title=${tn("guestNeedsTrusted")} hint=${tn("guestNeedsTrustedHint")} /></div>`;
|
|
200
238
|
else if (guest) body = html`<p data-trust="panel-content" class="v-watching" role="note">${tn("guestWatching")}</p>
|
|
201
|
-
<${Terminal} key=${name} name=${name} lease=${lease} density=${density} every=${GUEST_PANE_MS} />`;
|
|
202
|
-
else body = html`<${Terminal} key=${name} name=${name} lease=${lease} density=${density} />
|
|
239
|
+
<${Terminal} key=${name} name=${name} lease=${lease} density=${density} every=${GUEST_PANE_MS} backend=${it.backend || ""} signedIn=${false} />`;
|
|
240
|
+
else body = html`<${Terminal} key=${name} name=${name} lease=${lease} density=${density} backend=${it.backend || ""} signedIn=${!viewOnly} />
|
|
203
241
|
<${ViewIdentity} it=${it} viewOnly=${viewOnly} onEdit=${() => setDialog("edit")} />`;
|
|
204
242
|
|
|
205
243
|
return html`<div data-effect-panel="view" class="panel p-view">
|
|
@@ -214,11 +252,74 @@ export function ViewPanel({ route, navKey }) {
|
|
|
214
252
|
|
|
215
253
|
/** #2855: how often a guest's View reads the pane (the server allows it two reads a second). */
|
|
216
254
|
const GUEST_PANE_MS = 1000;
|
|
217
|
-
/**
|
|
218
|
-
|
|
255
|
+
/**
|
|
256
|
+
* The live terminal: the pane every 800 ms (passive), drawn as escaped markup, its font fitted to the pane's grid.
|
|
257
|
+
*
|
|
258
|
+
* M-2262 (the user, hmsg-435f6df6): scrolling back. Following (the default), it shows the pane's screen as it is now.
|
|
259
|
+
* Scrolling up — the wheel, a touch drag, PageUp/↑/Home, or "Earlier output" — reads the pane's scrollback once
|
|
260
|
+
* (`?history=1`: tmux's history above the screen, bounded) and shows it: reading. While reading, nothing moves the
|
|
261
|
+
* person: the refresh keeps reading the screen only to say "New output below", and never redraws. "Jump to latest"
|
|
262
|
+
* (or End), or scrolling to the bottom, follows again. Everything happens in this page, over text tmux was asked to
|
|
263
|
+
* capture: never copy-mode and never a key to the pane (hmsg-b8a170c0 — scrolling must never affect delivery).
|
|
264
|
+
*/
|
|
265
|
+
/** How long a scrollback note stays (it covers the terminal's bottom rows). */
|
|
266
|
+
const NOTE_MS = 6000;
|
|
267
|
+
/** A scroll this soon after the person's own wheel, touch, key or pointer is theirs (not one this page made). */
|
|
268
|
+
const GESTURE_MS = 1000;
|
|
269
|
+
/**
|
|
270
|
+
* #2969 review (Prism P3): is `live` (a screen read) still what `shown` ends with — the screen as it was when reading
|
|
271
|
+
* began (the scrollback's last lines, or the screen itself)? Trailing blank rows are not content.
|
|
272
|
+
*/
|
|
273
|
+
export function sameScreen(shown, live) {
|
|
274
|
+
if (shown == null || live == null) return shown === live;
|
|
275
|
+
const trim = (t) => String(t).replace(/\n+$/, "");
|
|
276
|
+
const s = trim(shown).split("\n"), l = trim(live).split("\n");
|
|
277
|
+
return s.length >= l.length && s.slice(s.length - l.length).join("\n") === l.join("\n");
|
|
278
|
+
}
|
|
279
|
+
/** M-2262 survey: CLIs that redraw their whole window (no tmux scrollback even outside the alternate screen). */
|
|
280
|
+
const REDRAWS_IN_PLACE = new Set(["grok"]);
|
|
281
|
+
/** M-2262 survey: the full-screen CLIs (the alternate screen, or redrawn in place) — tmux keeps nothing above their screen. */
|
|
282
|
+
const FULL_SCREEN = new Set(["claude-code", "opencode", "grok"]); // agy: its chat UI unverified — found by the read
|
|
283
|
+
/** The full-screen CLIs whose earlier output the Log tab shows (it reads their transcript: log-service.ts). */
|
|
284
|
+
const LOG_HAS_HISTORY = new Set(["claude-code"]);
|
|
285
|
+
/**
|
|
286
|
+
* M-2267 option (2), the leader's safe default: where a full-screen CLI's earlier output is — its Log tab (or that the
|
|
287
|
+
* Log tab is off, and where to turn it on). Only for whom the Log tab is (a signed-in session on the full app; never a
|
|
288
|
+
* guest or a View-only reader: they get the plain words), and only for a CLI the Log tab reads.
|
|
289
|
+
*/
|
|
290
|
+
function logLinkFor(name, backend, signedIn) {
|
|
291
|
+
if (!signedIn || !LOG_HAS_HISTORY.has(backend)) return null;
|
|
292
|
+
const on = typeof document !== "undefined" && document.body?.dataset?.logTab === "1";
|
|
293
|
+
return on ? { href: logPath(name), text: tn("earlierInLog") } : { href: sectionPath("web-dashboard"), text: tn("logTabOff") };
|
|
294
|
+
}
|
|
295
|
+
function Terminal({ name, lease, density, every = 800, backend = "", signedIn = false }) {
|
|
219
296
|
const term = useRef(null), pre = useRef(null);
|
|
220
|
-
const grid = useRef({ cols: 0, rows: 0, applied: 0, key: "" });
|
|
297
|
+
const grid = useRef({ cols: 0, rows: 0, applied: 0, key: "", follows: false });
|
|
221
298
|
const [problem, setProblem] = useState(null);
|
|
299
|
+
const [, setWordsRev] = useState(0);
|
|
300
|
+
// "follow" | "loading" | "reading"; the screen's text when reading began, the newest read since; a note about history.
|
|
301
|
+
const [mode, setModeState] = useState("follow");
|
|
302
|
+
const modeRef = useRef("follow");
|
|
303
|
+
const setMode = (m) => { modeRef.current = m; setModeState(m); };
|
|
304
|
+
const [newBelow, setNewBelow] = useState(false);
|
|
305
|
+
const [historyNote, setHistoryNoteState] = useState(null);
|
|
306
|
+
// A CLI found to keep no scrollback (full screen): nothing is offered or read again for it; the note says why, briefly.
|
|
307
|
+
const [noScrollback, setNoScrollback] = useState(FULL_SCREEN.has(backend));
|
|
308
|
+
const noScrollbackRef = useRef(FULL_SCREEN.has(backend));
|
|
309
|
+
const logLink = logLinkFor(name, backend, signedIn);
|
|
310
|
+
const noteTimer = useRef(null);
|
|
311
|
+
const setHistoryNote = (note, brief = false) => {
|
|
312
|
+
lease.clear(noteTimer.current); noteTimer.current = null;
|
|
313
|
+
setHistoryNoteState(note);
|
|
314
|
+
if (note && brief) noteTimer.current = lease.timeout(() => setHistoryNoteState(null), NOTE_MS);
|
|
315
|
+
};
|
|
316
|
+
// `reading`: the text shown while reading (the scrollback, or the screen as it was when the person left the bottom);
|
|
317
|
+
// `latest`: the newest screen read; `history`: whether what is shown has the scrollback in it.
|
|
318
|
+
// `drawn` (#2969 review P3): the text actually on the page now — what reading starts from, never a newer read not drawn.
|
|
319
|
+
const screenAt = useRef({ reading: null, latest: null, history: false, drawn: null });
|
|
320
|
+
// #2969 review (Prism P2): when the person last moved the terminal themselves (wheel, touch, key, pointer).
|
|
321
|
+
const gestureAt = useRef(-Infinity);
|
|
322
|
+
const recentGesture = () => performance.now() - gestureAt.current < GESTURE_MS;
|
|
222
323
|
// #1674: the text size as of this render. The pane refresh and the resize handlers below are set up once per mount
|
|
223
324
|
// and keep the fit() of that render; reading the size here, not from that render's props, keeps them on the current
|
|
224
325
|
// choice (they used to put the mount-time size back within one 800 ms refresh).
|
|
@@ -236,16 +337,71 @@ function Terminal({ name, lease, density, every = 800 }) {
|
|
|
236
337
|
const pcs = getComputedStyle(p);
|
|
237
338
|
const lh = parseFloat(pcs.lineHeight) / parseFloat(pcs.fontSize);
|
|
238
339
|
const lineH = Number.isFinite(lh) && lh > 0 ? lh : 1.2;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
340
|
+
const byW = innerW / (g.cols * glyphRatio(p)), byH = innerH / (g.rows * lineH);
|
|
341
|
+
const sizeFor = (limit) => (density === "fit" ? Math.max(FIT_FLOOR_PX, Math.min(limit * 0.995, MAX_PX))
|
|
342
|
+
: Math.max(8, Math.min(Math.max(MIN_PX, Math.min(limit * 0.995, MAX_PX)) * (VIEW_SCALE[density] || 1), 32)));
|
|
343
|
+
const size = sizeFor(g.follows ? byW : Math.min(byW, byH));
|
|
242
344
|
g.key = key;
|
|
243
345
|
// A small change is skipped only when growing (the size applied still fits); a smaller box always shrinks it.
|
|
244
346
|
if (size >= g.applied && size - g.applied < 0.75) return;
|
|
245
|
-
|
|
246
|
-
|
|
347
|
+
const padH = (parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom)) || 0;
|
|
348
|
+
const was = g.applied || parseFloat(pcs.fontSize) || 0, before = box.clientHeight - padH;
|
|
349
|
+
const apply = (px) => { g.applied = px; p.style.fontSize = `${px.toFixed(2)}px`; }; // CSSOM, never a style attribute (#1300)
|
|
350
|
+
apply(size);
|
|
351
|
+
// v2.3.4-beta.4 P1: the box's height is a limit only while it is the box's own. Read again right after the text took
|
|
352
|
+
// its new size (the read lays the page out), a box whose height moved with it, by the same factor, is following its
|
|
353
|
+
// text — a stale stylesheet, or any container that grows with its content: measured next time it would shrink the
|
|
354
|
+
// text 0.5% each refresh, for ever. Then the width alone decides, at once and from then on (until the choice or the
|
|
355
|
+
// stylesheet changes). Cause and effect within this one call: a resize between calls (#2991 review: the box made
|
|
356
|
+
// shorter step by step, where a height-limited size moves in proportion too) never counts. The move must match the
|
|
357
|
+
// expected one closely for its size (#2991 review r2: not ±5% of the whole), and a second probe in the same call —
|
|
358
|
+
// 10% smaller, then back, before any frame is painted — must move it in proportion again: a one-off fixed drop (a
|
|
359
|
+
// scrollbar coming) never does.
|
|
360
|
+
if (!g.follows && was > 0 && before > 0) {
|
|
361
|
+
const height = () => box.clientHeight - padH;
|
|
362
|
+
const moves = (from, to, ratio) => {
|
|
363
|
+
const expect = from * (ratio - 1), got = to - from;
|
|
364
|
+
return got !== 0 && Math.sign(got) === Math.sign(expect) && Math.abs(got - expect) <= Math.max(1.5, 0.25 * Math.abs(expect));
|
|
365
|
+
};
|
|
366
|
+
const after = height();
|
|
367
|
+
if (moves(before, after, size / was)) {
|
|
368
|
+
p.style.fontSize = `${(size * 0.9).toFixed(2)}px`;
|
|
369
|
+
const probed = height();
|
|
370
|
+
p.style.fontSize = `${size.toFixed(2)}px`;
|
|
371
|
+
if (moves(after, probed, 0.9)) {
|
|
372
|
+
g.follows = true;
|
|
373
|
+
const byWidth = sizeFor(byW);
|
|
374
|
+
if (byWidth !== size) apply(byWidth);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
/** Keep a following view on the newest line (a grid taller than the box at the larger sizes scrolls). */
|
|
380
|
+
const toBottom = () => { const box = term.current; if (box) box.scrollTop = box.scrollHeight; };
|
|
381
|
+
const draw = (text) => {
|
|
382
|
+
pre.current.innerHTML = ansiToHtml(text); // escaped by construction: markup only from ansiToHtml's own spans
|
|
383
|
+
paintAnsi(pre.current);
|
|
384
|
+
screenAt.current.drawn = text;
|
|
247
385
|
};
|
|
248
|
-
useEffect(() => { grid.current.key = ""; fit(); }, [density]);
|
|
386
|
+
useEffect(() => { grid.current.key = ""; grid.current.follows = false; fit(); }, [density]);
|
|
387
|
+
// A tab opened before an upgrade: its stylesheet and the View's words read again (healStalePage), then fitted anew.
|
|
388
|
+
useEffect(() => {
|
|
389
|
+
const h = healStalePage(document, (u) => import(u), () => { setWordsRev((n) => n + 1); });
|
|
390
|
+
if (h.css) lease.timeout(() => { grid.current.key = ""; grid.current.follows = false; fit(); }, 300);
|
|
391
|
+
}, []);
|
|
392
|
+
const atBottom = () => { const box = term.current; return !box || box.scrollHeight - box.scrollTop - box.clientHeight <= 2; };
|
|
393
|
+
/** Reading what is shown now (`text`, with or without the scrollback): the refresh only says whether there is more. */
|
|
394
|
+
const startReading = (text, history) => {
|
|
395
|
+
screenAt.current.reading = text; screenAt.current.history = history;
|
|
396
|
+
setNewBelow(false); setMode("reading");
|
|
397
|
+
};
|
|
398
|
+
const grid1 = (r) => {
|
|
399
|
+
const c = Number(r.headers.get("X-Pane-Cols")), rw = Number(r.headers.get("X-Pane-Rows"));
|
|
400
|
+
if (c >= 1 && rw >= 1 && (c !== grid.current.cols || rw !== grid.current.rows)) { grid.current.cols = c; grid.current.rows = rw; grid.current.key = ""; }
|
|
401
|
+
};
|
|
402
|
+
// The person asked for what scrolled off: one bounded read, then reading (or why there is nothing to read).
|
|
403
|
+
const loadEarlier = useRef(null);
|
|
404
|
+
const follow = useRef(null);
|
|
249
405
|
useEffect(() => {
|
|
250
406
|
const reads = readStream(lease);
|
|
251
407
|
const refresh = async () => {
|
|
@@ -263,15 +419,72 @@ function Terminal({ name, lease, density, every = 800 }) {
|
|
|
263
419
|
if (!r.ok) { setProblem(r.status === 404 ? tn("paneUnavailable") : r.status === 403 && guestPage() ? tn("guestNeedsTrusted") : tn("paneFailed", { name, status: r.status })); return; }
|
|
264
420
|
const text = await r.text();
|
|
265
421
|
if (!reads.live(token) || !pre.current) return;
|
|
266
|
-
const c = Number(r.headers.get("X-Pane-Cols")), rw = Number(r.headers.get("X-Pane-Rows"));
|
|
267
|
-
if (c >= 1 && rw >= 1 && (c !== grid.current.cols || rw !== grid.current.rows)) { grid.current.cols = c; grid.current.rows = rw; grid.current.key = ""; }
|
|
268
422
|
setProblem(null);
|
|
269
|
-
|
|
270
|
-
|
|
423
|
+
screenAt.current.latest = text;
|
|
424
|
+
// Reading earlier output: nothing is redrawn under the person — the read only says whether there is more.
|
|
425
|
+
if (modeRef.current !== "follow") { if (modeRef.current === "reading") setNewBelow(!sameScreen(screenAt.current.reading, text)); return; }
|
|
426
|
+
// #2969 review (Prism P2): the person is moving a screen taller than its box away from the bottom right now —
|
|
427
|
+
// this is them leaving it, not the latest to follow: read on, nothing redrawn.
|
|
428
|
+
// Reading starts from what is drawn; this newer read (not drawn) is then the new output below.
|
|
429
|
+
if (recentGesture() && !atBottom()) { startReading(screenAt.current.drawn, false); setNewBelow(!sameScreen(screenAt.current.drawn, text)); return; }
|
|
430
|
+
grid1(r);
|
|
431
|
+
draw(text);
|
|
271
432
|
fit();
|
|
433
|
+
toBottom();
|
|
272
434
|
} catch { /* a transient error keeps the last frame */ }
|
|
273
435
|
finally { reads.end(token); }
|
|
274
436
|
};
|
|
437
|
+
loadEarlier.current = async () => {
|
|
438
|
+
// From following, or from reading what was on the screen (the person reached its top): never twice, never over it.
|
|
439
|
+
const from = modeRef.current;
|
|
440
|
+
if (from !== "follow" && !(from === "reading" && !screenAt.current.history)) return;
|
|
441
|
+
if (noScrollbackRef.current) { setHistoryNote(tn("noEarlier"), true); return; } // known: nothing to read
|
|
442
|
+
const box0 = term.current;
|
|
443
|
+
// Where the person is, measured from the end: the screen's lines stay where they are under the scrollback added.
|
|
444
|
+
const fromEnd = box0 ? box0.scrollHeight - box0.scrollTop : 0;
|
|
445
|
+
const back = () => { setMode(from); if (from === "follow") toBottom(); };
|
|
446
|
+
setMode("loading"); setHistoryNote(tn("loadingEarlier"));
|
|
447
|
+
try {
|
|
448
|
+
const r = await lease.fetch(`/api/pane/${encodeURIComponent(name)}?history=1`);
|
|
449
|
+
if (!lease.current() || modeRef.current !== "loading") return;
|
|
450
|
+
// #2969 review (Prism P2): a scrollback read that failed — or answered without its facts — changes nothing shown.
|
|
451
|
+
if (!r.ok || r.headers.get("X-Pane-History-Lines") == null) { back(); setHistoryNote(r.status === 429 ? null : tn("earlierFailed"), true); return; }
|
|
452
|
+
const text = await r.text();
|
|
453
|
+
if (!lease.current() || modeRef.current !== "loading" || !pre.current) return;
|
|
454
|
+
// A full-screen CLI (the alternate screen, or one that redraws its whole window) leaves nothing above its screen;
|
|
455
|
+
// any other with no history yet has simply not scrolled: say which, keep following.
|
|
456
|
+
if (r.headers.get("X-Pane-Alternate") === "1" || REDRAWS_IN_PLACE.has(backend)) {
|
|
457
|
+
noScrollbackRef.current = true; setNoScrollback(true);
|
|
458
|
+
back(); setHistoryNote(tn("noEarlier"), true); return;
|
|
459
|
+
}
|
|
460
|
+
if (r.headers.get("X-Pane-History-Lines") === "0") { back(); setHistoryNote(tn("nothingEarlier"), true); return; }
|
|
461
|
+
grid1(r);
|
|
462
|
+
const lines = text.split("\n").length, rows = grid.current.rows || 0;
|
|
463
|
+
// #2969 review (Prism P3): new output is judged against what is shown — the scrollback's own last screen — and
|
|
464
|
+
// a screen read while this one was out already counts.
|
|
465
|
+
screenAt.current.reading = text; screenAt.current.history = true;
|
|
466
|
+
setNewBelow(screenAt.current.latest != null && !sameScreen(text, screenAt.current.latest));
|
|
467
|
+
setMode("reading"); setHistoryNote(null);
|
|
468
|
+
draw(text);
|
|
469
|
+
fit();
|
|
470
|
+
const box = term.current;
|
|
471
|
+
if (box) {
|
|
472
|
+
const lineH = lines > 0 ? pre.current.scrollHeight / lines : 16;
|
|
473
|
+
// From following (at the bottom): a few lines up — the earlier output right above. From reading: the same lines.
|
|
474
|
+
box.scrollTop = from === "follow"
|
|
475
|
+
? Math.max(0, box.scrollHeight - box.clientHeight - lineH * Math.min(3, Math.max(1, lines - rows)))
|
|
476
|
+
: Math.max(0, box.scrollHeight - fromEnd);
|
|
477
|
+
}
|
|
478
|
+
} catch { if (lease.current()) { back(); setHistoryNote(tn("earlierFailed"), true); } }
|
|
479
|
+
};
|
|
480
|
+
follow.current = () => {
|
|
481
|
+
if (modeRef.current === "follow") return;
|
|
482
|
+
setMode("follow"); setNewBelow(false); setHistoryNote(null); screenAt.current.history = false;
|
|
483
|
+
const latest = screenAt.current.latest;
|
|
484
|
+
if (latest != null && pre.current) { draw(latest); fit(); }
|
|
485
|
+
toBottom();
|
|
486
|
+
refresh();
|
|
487
|
+
};
|
|
275
488
|
refresh();
|
|
276
489
|
lease.interval(refresh, every);
|
|
277
490
|
let timer = null;
|
|
@@ -282,8 +495,44 @@ function Terminal({ name, lease, density, every = 800 }) {
|
|
|
282
495
|
ro.observe(term.current);
|
|
283
496
|
lease.hold(() => ro.disconnect());
|
|
284
497
|
}
|
|
498
|
+
// Scrolling up asks for the earlier output; reaching the bottom while reading follows again.
|
|
499
|
+
const box = term.current;
|
|
500
|
+
if (box) {
|
|
501
|
+
// Asking for the earlier output: from following, or from reading the screen as it was — at the top.
|
|
502
|
+
const mayLoad = () => (modeRef.current === "follow" || (modeRef.current === "reading" && !screenAt.current.history)) && box.scrollTop <= 0;
|
|
503
|
+
const gesture = () => { gestureAt.current = performance.now(); };
|
|
504
|
+
lease.on(box, "wheel", (e) => { gesture(); if (e.deltaY < 0 && mayLoad()) loadEarlier.current(); }, { passive: true });
|
|
505
|
+
let touchY = null;
|
|
506
|
+
lease.on(box, "touchstart", (e) => { gesture(); touchY = e.touches && e.touches[0] ? e.touches[0].clientY : null; }, { passive: true });
|
|
507
|
+
lease.on(box, "touchmove", (e) => {
|
|
508
|
+
gesture();
|
|
509
|
+
const y = e.touches && e.touches[0] ? e.touches[0].clientY : null;
|
|
510
|
+
if (touchY == null || y == null) return;
|
|
511
|
+
if (y - touchY > 24 && mayLoad()) { touchY = null; loadEarlier.current(); }
|
|
512
|
+
}, { passive: true });
|
|
513
|
+
lease.on(box, "pointerdown", gesture, { passive: true }); // the scrollbar, dragged
|
|
514
|
+
lease.on(box, "keydown", (e) => {
|
|
515
|
+
gesture();
|
|
516
|
+
if ((e.key === "PageUp" || e.key === "ArrowUp" || e.key === "Home") && mayLoad()) { e.preventDefault(); loadEarlier.current(); }
|
|
517
|
+
else if (modeRef.current === "reading" && e.key === "End") { e.preventDefault(); follow.current(); }
|
|
518
|
+
});
|
|
519
|
+
lease.on(box, "scroll", () => {
|
|
520
|
+
if (modeRef.current === "reading") { if (atBottom()) follow.current(); return; }
|
|
521
|
+
// #2969 review (Prism P2): a screen taller than its box (a larger Aa), moved up from the bottom by the person:
|
|
522
|
+
// reading what is on it — the refresh no longer pulls them back down.
|
|
523
|
+
if (modeRef.current === "follow" && recentGesture() && !atBottom()) startReading(screenAt.current.drawn, false);
|
|
524
|
+
}, { passive: true });
|
|
525
|
+
}
|
|
285
526
|
}, [lease, name]);
|
|
286
|
-
|
|
527
|
+
const reading = mode === "reading";
|
|
528
|
+
// A full-screen CLI's Log link is a bar above the terminal, not over it: its first row is never covered.
|
|
529
|
+
return html`<div class="v-term-box">
|
|
530
|
+
${noScrollback && logLink ? html`<p class="v-term-logbar"><a class="v-term-log" href=${logLink.href}>${logLink.text}<${Icon} name="forward" size=${14} /></a></p>` : null}
|
|
531
|
+
<div data-trust="panel-content" class=${`v-term${reading ? " is-reading" : ""}`} ref=${term} tabindex="0" aria-label=${tn(reading ? "readingEarlier" : "earlierHint")}>${problem ? html`<p class="v-term-note" role="status">${problem}</p>` : null}<pre ref=${pre} class="v-pre"></pre></div>
|
|
532
|
+
${historyNote ? html`<p class="v-term-history-note" role="status">${historyNote}</p>` : null}
|
|
533
|
+
${mode === "follow" && !noScrollback ? html`<button type="button" class="v-term-earlier btn btn-sm" title=${tn("earlierHint")} onClick=${() => loadEarlier.current && loadEarlier.current()}><${Icon} name="up" size=${14} />${tn("earlier")}</button>` : null}
|
|
534
|
+
${reading ? html`<button type="button" class=${`v-term-latest btn btn-sm${newBelow ? " has-new" : ""}`} onClick=${() => follow.current && follow.current()}>${newBelow ? html`<span class="v-term-new">${tn("newBelow")} · </span>` : null}${tn("jumpLatest")}<${Icon} name="down" size=${14} /></button>` : null}
|
|
535
|
+
</div>`;
|
|
287
536
|
}
|
|
288
537
|
|
|
289
538
|
// The advance of one monospace cell as a fraction of font-size, measured once on this page.
|