@songsid/agend 2.4.0-alpha.1 → 2.4.0-alpha.2
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/README.md +1 -1
- package/README.zh-TW.md +1 -1
- package/dist/agent-whats-new.js +2 -0
- package/dist/agent-whats-new.js.map +1 -1
- package/dist/auth-api.js +3 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/claude-code.js +4 -0
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/types.d.ts +6 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-availability.d.ts +1 -1
- package/dist/backend-availability.js +28 -1
- package/dist/backend-availability.js.map +1 -1
- package/dist/browser-backend-signins.d.ts +7 -1
- package/dist/browser-backend-signins.js +8 -4
- package/dist/browser-backend-signins.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/channel/mcp-tools.js +1 -1
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/config-validator.js +47 -7
- package/dist/config-validator.js.map +1 -1
- package/dist/daemon.d.ts +3 -0
- package/dist/daemon.js +4 -0
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +33 -4
- package/dist/fleet-manager.js +143 -61
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/credential-profiles/SKILL.md +19 -0
- package/dist/hub/audit/index.js +12 -5
- package/dist/hub/audit/index.js.map +1 -1
- package/dist/hub/catalog.d.ts +6 -0
- package/dist/hub/catalog.js +14 -4
- package/dist/hub/catalog.js.map +1 -1
- package/dist/hub/client.js +2 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +2 -0
- package/dist/hub/compose/member.js +11 -2
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/compose/server.js +2 -1
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/enrolment-code.d.ts +126 -0
- package/dist/hub/enrolment-code.js +266 -0
- package/dist/hub/enrolment-code.js.map +1 -0
- package/dist/hub/group-policy/admin-impact.js +4 -2
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-inventory.js +6 -6
- package/dist/hub/group-policy/admin-inventory.js.map +1 -1
- package/dist/hub/group-policy/authorization.d.ts +16 -2
- package/dist/hub/group-policy/authorization.js +69 -5
- package/dist/hub/group-policy/authorization.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.js +3 -3
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/resources.d.ts +40 -1
- package/dist/hub/group-policy/resources.js +51 -13
- package/dist/hub/group-policy/resources.js.map +1 -1
- package/dist/hub/group-policy/store.d.ts +6 -0
- package/dist/hub/group-policy/store.js +49 -4
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/http/compose.js +30 -6
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/init/text.js +2 -2
- package/dist/hub/init/text.js.map +1 -1
- package/dist/hub/init/web.d.ts +7 -0
- package/dist/hub/init/web.js +6 -1
- package/dist/hub/init/web.js.map +1 -1
- package/dist/hub/join/local.d.ts +27 -0
- package/dist/hub/join/local.js +70 -5
- package/dist/hub/join/local.js.map +1 -1
- package/dist/hub/join/receipt.d.ts +1 -0
- package/dist/hub/join/receipt.js +1 -1
- package/dist/hub/join/receipt.js.map +1 -1
- package/dist/hub/join/service.d.ts +92 -6
- package/dist/hub/join/service.js +199 -28
- package/dist/hub/join/service.js.map +1 -1
- package/dist/hub/join/store.d.ts +2 -1
- package/dist/hub/join/store.js +7 -7
- package/dist/hub/join/store.js.map +1 -1
- package/dist/hub/member/exposure-api.d.ts +2 -0
- package/dist/hub/member/exposure-api.js +3 -2
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/exposures.d.ts +4 -0
- package/dist/hub/member/exposures.js +12 -2
- package/dist/hub/member/exposures.js.map +1 -1
- package/dist/hub/member/pairing-notices.js +8 -6
- package/dist/hub/member/pairing-notices.js.map +1 -1
- package/dist/hub/pairing-notices.d.ts +5 -2
- package/dist/hub/pairing-notices.js +38 -13
- package/dist/hub/pairing-notices.js.map +1 -1
- package/dist/hub/pairing.d.ts +7 -2
- package/dist/hub/protocol.d.ts +47 -0
- package/dist/hub/protocol.js +3 -1
- package/dist/hub/protocol.js.map +1 -1
- package/dist/hub/server.js +15 -1
- package/dist/hub/server.js.map +1 -1
- package/dist/hub/types.d.ts +12 -4
- package/dist/hub-pairing-summary.js +1 -1
- package/dist/hub-pairing-summary.js.map +1 -1
- package/dist/instance-config-impact.js +4 -0
- package/dist/instance-config-impact.js.map +1 -1
- package/dist/instance-lifecycle.js +4 -0
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/locale.js +6 -2
- package/dist/locale.js.map +1 -1
- package/dist/log-service.d.ts +62 -6
- package/dist/log-service.js +135 -28
- package/dist/log-service.js.map +1 -1
- package/dist/log-steps-agy-grok.d.ts +74 -0
- package/dist/log-steps-agy-grok.js +440 -0
- package/dist/log-steps-agy-grok.js.map +1 -0
- package/dist/log-steps.d.ts +62 -3
- package/dist/log-steps.js +188 -22
- package/dist/log-steps.js.map +1 -1
- package/dist/log-transcript-paths.d.ts +29 -0
- package/dist/log-transcript-paths.js +109 -0
- package/dist/log-transcript-paths.js.map +1 -0
- package/dist/login-controller.d.ts +17 -3
- package/dist/login-controller.js +57 -5
- package/dist/login-controller.js.map +1 -1
- package/dist/login-window-lock.d.ts +20 -8
- package/dist/login-window-lock.js +35 -16
- package/dist/login-window-lock.js.map +1 -1
- package/dist/outbound-handlers.d.ts +14 -0
- package/dist/outbound-handlers.js +49 -1
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/profile-signins.d.ts +2 -0
- package/dist/profile-signins.js +1 -1
- package/dist/profile-signins.js.map +1 -1
- package/dist/settings-api.d.ts +34 -0
- package/dist/settings-api.js +184 -6
- package/dist/settings-api.js.map +1 -1
- package/dist/settings-change.js +38 -1
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-effect.js +14 -0
- package/dist/settings-effect.js.map +1 -1
- package/dist/tool-progress.d.ts +7 -0
- package/dist/tool-progress.js +21 -9
- package/dist/tool-progress.js.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/ui/accounts-view.js +14 -4
- package/dist/ui/agent-details-settings.js +2 -2
- package/dist/ui/agent-page-strings.js +2 -2
- package/dist/ui/backend-signin.js +47 -14
- package/dist/ui/chat-activity-groups.js +225 -0
- package/dist/ui/chat-activity.js +355 -0
- package/dist/ui/chat-popout-header.js +35 -0
- package/dist/ui/chat-popout-transport.js +80 -0
- package/dist/ui/chat-popout.js +63 -0
- package/dist/ui/chat-quote.js +3 -1
- package/dist/ui/chat-store.js +45 -4
- package/dist/ui/chat-workspace-gestures.js +177 -0
- package/dist/ui/chat-workspace-navigation.js +34 -10
- package/dist/ui/chat-workspace.js +96 -32
- package/dist/ui/host-install.js +2 -2
- package/dist/ui/hub-agent-copy.js +7 -7
- package/dist/ui/hub-chat-strings.js +3 -3
- package/dist/ui/hub-client.js +77 -17
- package/dist/ui/hub-company-join-strings.js +12 -10
- package/dist/ui/hub-company-join.js +52 -39
- package/dist/ui/hub-confirm-place.js +44 -0
- package/dist/ui/hub-directory-editor-strings.js +3 -3
- package/dist/ui/hub-directory-notice-strings.js +1 -1
- package/dist/ui/hub-enrolment-code-strings.js +44 -0
- package/dist/ui/hub-enrolment-code.js +159 -0
- package/dist/ui/hub-group-search.js +82 -0
- package/dist/ui/hub-group-strings.js +8 -8
- package/dist/ui/hub-join-approval.js +31 -0
- package/dist/ui/hub-join-code-input.js +66 -0
- package/dist/ui/hub-join-queue.js +62 -0
- package/dist/ui/hub-join-steps.js +231 -0
- package/dist/ui/hub-joincode-flow-strings.js +22 -0
- package/dist/ui/hub-owner-strings.js +9 -9
- package/dist/ui/hub-pairing-progress-strings.js +1 -1
- package/dist/ui/hub-quick-pairing.js +8 -4
- package/dist/ui/hub-quick-strings.js +11 -11
- package/dist/ui/hub-share-refused.js +17 -0
- package/dist/ui/hub-strings.js +61 -61
- package/dist/ui/hub-this-hub.js +2 -2
- package/dist/ui/hub-welcome.js +26 -5
- package/dist/ui/image-annotate.js +283 -0
- package/dist/ui/image-lightbox.js +26 -6
- package/dist/ui/log-row.js +327 -0
- package/dist/ui/panel-chat.js +151 -12
- package/dist/ui/panel-details.js +14 -6
- package/dist/ui/panel-hub.js +42 -13
- package/dist/ui/panel-log.js +9 -154
- package/dist/ui/panel-settings.js +48 -11
- package/dist/ui/search-dialog.js +1 -0
- package/dist/ui/settings-access-overview.js +1 -1
- package/dist/ui/settings-hub-browser-certificate.js +3 -3
- package/dist/ui/settings-hub-company-join.js +41 -30
- package/dist/ui/settings-hub-connection.js +8 -5
- package/dist/ui/settings-hub-membership.js +3 -3
- package/dist/ui/settings-hub-section.js +1 -1
- package/dist/ui/settings-hub-setup-strings.js +6 -6
- package/dist/ui/settings-hub-setup.js +44 -6
- package/dist/ui/settings-hub.js +35 -10
- package/dist/ui/settings-layout.js +6 -4
- package/dist/ui/settings-public-session-strings.js +37 -0
- package/dist/ui/settings-registry.js +4 -0
- package/dist/ui/settings-strings.js +2 -2
- package/dist/ui/shared/app-shell.js +16 -10
- package/dist/ui/shared/app.css +195 -30
- package/dist/ui/shared/app.js +8 -1
- package/dist/ui/shared/chat-render.js +11 -2
- package/dist/ui/shared/chat-thread.js +20 -3
- package/dist/ui/shared/chat-work-bar.css +7 -0
- package/dist/ui/shared/chat-workspace-model.js +39 -9
- package/dist/ui/shared/hub-owner.css +8 -0
- package/dist/ui/shared/identity-color.js +9 -3
- package/dist/ui/shared/image-annotate.css +45 -0
- package/dist/ui/shared/instance-nav.js +59 -22
- package/dist/ui/shared/pane-geometry.js +29 -0
- package/dist/ui/shared/signin.js +2 -2
- package/dist/ui/shared/tokens.css +14 -0
- package/dist/ui/shared/ui-menu.js +22 -7
- package/dist/ui/signin.html +1 -1
- package/dist/ui/structured-signin.js +11 -4
- package/dist/web-api.d.ts +1 -0
- package/dist/web-api.js +34 -4
- package/dist/web-api.js.map +1 -1
- package/dist/web-backend-login.d.ts +9 -3
- package/dist/web-backend-login.js +7 -4
- package/dist/web-backend-login.js.map +1 -1
- package/dist/web-chat-history.d.ts +11 -0
- package/dist/web-chat-history.js +9 -1
- package/dist/web-chat-history.js.map +1 -1
- package/dist/web-guest-access.js +2 -2
- package/dist/web-guest-access.js.map +1 -1
- package/dist/web-session.d.ts +31 -3
- package/dist/web-session.js +25 -4
- package/dist/web-session.js.map +1 -1
- package/dist/web-settings-patch.d.ts +8 -2
- package/dist/web-settings-patch.js +22 -10
- package/dist/web-settings-patch.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
// - the list is never remounted on navigation, and only its own scrollTop follows the active row (#1515).
|
|
9
9
|
// Public (/assets/): an anonymous View reader gets the same list, fed by View's roster read instead of status frames.
|
|
10
10
|
import { html, useLayoutEffect, useRef, useState } from "./app-html.js";
|
|
11
|
-
import { t } from "./app-i18n.js";
|
|
11
|
+
import { register, t } from "./app-i18n.js";
|
|
12
12
|
import { recordEdit } from "./text-undo.js";
|
|
13
13
|
import { appStore, createStore, guestPage, useStore } from "./app-store.js";
|
|
14
14
|
import { Menu } from "./ui-menu.js";
|
|
15
15
|
import { chatPath, detailsPath, logPath, viewPath } from "./app-route.js";
|
|
16
|
+
import { navigate } from "./app-nav.js";
|
|
16
17
|
import { Icon } from "./ui-icons.js";
|
|
17
18
|
import { Skeleton } from "./ui-states.js";
|
|
18
19
|
import { viewStore } from "./view-roster-store.js";
|
|
@@ -22,6 +23,12 @@ import { themesShown, themesStore } from "./app-themes.js";
|
|
|
22
23
|
import { machineName } from "./machine-name.js";
|
|
23
24
|
import { identityClasses, identityOf, paintIdentity, useIdentityColors } from "./identity-color.js";
|
|
24
25
|
|
|
26
|
+
// Keep new copy beside its caller: a retained view-strings.js still links and renders the menu.
|
|
27
|
+
register("agentRow", {
|
|
28
|
+
en: { actions: "Actions for {0}", add: "Add to favorites", remove: "Remove from favorites" },
|
|
29
|
+
"zh-TW": { actions: "{0} 的操作", add: "加入最愛", remove: "移出最愛" },
|
|
30
|
+
});
|
|
31
|
+
|
|
25
32
|
/** view.* text with named values. */
|
|
26
33
|
function tn(key, values = {}) {
|
|
27
34
|
let s = t(`view.${key}`);
|
|
@@ -490,11 +497,20 @@ function SortMenu({ sort }) {
|
|
|
490
497
|
export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting = {}, viewOnly = false, onPick }) {
|
|
491
498
|
const nav = useStore(navStore);
|
|
492
499
|
const workspace = useStore(appStore).chatWorkspace;
|
|
500
|
+
const styledMenus = typeof getComputedStyle === "function" && getComputedStyle(document.documentElement).getPropertyValue?.("--agent-menu-version")?.trim() === "1";
|
|
493
501
|
const names = useStore(namesStore); // #1722: which name leads
|
|
494
502
|
useIdentityColors(); // #1958: repaint when the host's colour settings or the themes switch change
|
|
495
503
|
const filterRef = useRef(null);
|
|
496
504
|
const list = useRef(null);
|
|
497
505
|
const drag = useRef(null);
|
|
506
|
+
const focusRow = useRef(null);
|
|
507
|
+
useLayoutEffect(() => {
|
|
508
|
+
if (!focusRow.current) return;
|
|
509
|
+
const row = [...(list.current?.querySelectorAll("[data-agent-row]") || [])].find(el => el.getAttribute("data-agent-row") === focusRow.current);
|
|
510
|
+
focusRow.current = null;
|
|
511
|
+
// Starring moves a row into another group. Return keyboard focus to its new slot, or Edit if its group is folded.
|
|
512
|
+
(row?.querySelector(".inst-row-menu > button") || list.current?.querySelector(".fav-edit"))?.focus({ preventScroll: true });
|
|
513
|
+
}, [nav.favorites]);
|
|
498
514
|
// #2179: the reply times and their highlight move on by themselves — the list is drawn again every 30 s.
|
|
499
515
|
const [, setTick] = useState(0);
|
|
500
516
|
useLayoutEffect(() => { const id = setInterval(() => setTick((n) => n + 1), 30000); return () => clearInterval(id); }, []);
|
|
@@ -509,9 +525,10 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
509
525
|
const panelPath = viewOnly || (route && route.panel === "view") ? viewPath
|
|
510
526
|
: route && route.panel === "log" ? logPath // #1218: Log → Log
|
|
511
527
|
: route && route.panel === "details" ? detailsPath : chatPath;
|
|
512
|
-
const rowPath = (name) => byName.get(name)?.runtime === "windows" && ["view", "log", "details"].includes(route?.panel)
|
|
513
|
-
? chatPath(name) : panelPath(name);
|
|
514
528
|
const active = route && (route.panel === "chat" || route.panel === "view" || route.panel === "log" || route.panel === "details") ? route.instance : null;
|
|
529
|
+
// A selected row returns to Chat; a different row keeps the current view. Real hrefs give Enter the same action.
|
|
530
|
+
const rowPath = (name) => !viewOnly && name === active ? chatPath(name)
|
|
531
|
+
: byName.get(name)?.runtime === "windows" && ["view", "log", "details"].includes(route?.panel) ? chatPath(name) : panelPath(name);
|
|
515
532
|
const own = (map, name) => Object.prototype.hasOwnProperty.call(map, name);
|
|
516
533
|
const byName = new Map(items.map((it) => [nameOf(it), it]));
|
|
517
534
|
const facetOf = (name) => statusFacet(byName.get(name), own(exec, name) ? exec[name] : null, own(awaiting, name) ? awaiting[name] : null);
|
|
@@ -565,10 +582,19 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
565
582
|
const flip = (key, value) => { const cur = new Set(navStore.get().filter[key]); if (cur.has(value)) cur.delete(value); else cur.add(value); setNavFilter({ [key]: [...cur] }); };
|
|
566
583
|
// Drag to reorder: only the full list (a filtered subset would be ambiguous), groups among groups, instances within
|
|
567
584
|
// their group.
|
|
568
|
-
const dragProps = (item
|
|
585
|
+
const dragProps = (item, allowOrder = true) => {
|
|
586
|
+
const reorder = allowOrder && !shown.active && !guest && !recent; // #2179: not while sorted by reply
|
|
587
|
+
const dock = item.type === "instance" && !guest && workspace?.dragStart;
|
|
588
|
+
if (!reorder && !dock) return {};
|
|
589
|
+
return {
|
|
569
590
|
draggable: true,
|
|
570
|
-
onDragStart: (e) => {
|
|
571
|
-
|
|
591
|
+
onDragStart: (e) => {
|
|
592
|
+
const docking = dock && workspace.dragStart(item.name, e);
|
|
593
|
+
if (!reorder && !docking) { e.preventDefault(); return; }
|
|
594
|
+
drag.current = reorder ? item : null; e.currentTarget.classList.add("dragging");
|
|
595
|
+
try { e.dataTransfer.effectAllowed = "move"; e.dataTransfer.setData("text/plain", item.name); } catch { /* Firefox needs data */ }
|
|
596
|
+
},
|
|
597
|
+
onDragEnd: (e) => { workspace?.dragEnd?.(); e.currentTarget.classList.remove("dragging"); drag.current = null; },
|
|
572
598
|
onDragOver: (e) => {
|
|
573
599
|
const d = drag.current;
|
|
574
600
|
if (!d || d.type !== item.type || d.name === item.name || (item.type === "instance" && d.group !== item.group)) return;
|
|
@@ -591,6 +617,7 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
591
617
|
else return;
|
|
592
618
|
persistOrder(names, insts);
|
|
593
619
|
},
|
|
620
|
+
};
|
|
594
621
|
};
|
|
595
622
|
// #1700: a facet group (Status, CLI) folds under a real header button. Folded with a filter set, the header says so:
|
|
596
623
|
// one or two choices by name, more as "N selected" — a filter is never out of sight.
|
|
@@ -620,15 +647,34 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
620
647
|
const on = name === active;
|
|
621
648
|
const fav = g === FAV_GROUP, starred = favSet.has(name);
|
|
622
649
|
// #1958: its identity colour — the ring, a left bar and/or the name, as resolved; painted through the CSSOM.
|
|
623
|
-
const id = identityOf(it);
|
|
650
|
+
const id = identityOf(it, { sidebar: true });
|
|
624
651
|
const full = !starred && favs.length >= MAX_FAVORITES;
|
|
625
652
|
// #2179 (B5, the user's pick): the % (and the ★ beside the row) on the name's line; the time of the last reply at the
|
|
626
653
|
// end of the second line, highlighted for REPLY_FRESH_MIN minutes, fading by itself (a reply under a minute pulses once).
|
|
627
654
|
const mins = ageOf(name), fade = replyFade(mins);
|
|
628
655
|
const two = !!secondary || mins != null;
|
|
629
|
-
|
|
656
|
+
const menuItems = [
|
|
657
|
+
canStar ? { key: "favorite", label: t(`agentRow.${starred ? "remove" : "add"}`), icon: "star", disabled: full,
|
|
658
|
+
iconClass: starred ? "menu-starred" : undefined,
|
|
659
|
+
title: full ? tn("favFull", { max: MAX_FAVORITES }) : undefined,
|
|
660
|
+
onSelect: () => { focusRow.current = name; toggleFavorite(name, known); } } : null,
|
|
661
|
+
workspace && !viewOnly && route?.instance ? { key: "beside", label: workspace.label(name), icon: "sidebar", onSelect: () => workspace.open(name) } : null,
|
|
662
|
+
canConfigure && supportsInstanceFeature(it, "details") ? { key: "settings", label: t("app.details"), icon: "settings", onSelect: () => {
|
|
663
|
+
if (workspace && route?.instance) workspace.settings(name);
|
|
664
|
+
else { navigate(`${detailsPath(name)}?cat=basic`); onPick?.(); }
|
|
665
|
+
} } : null,
|
|
666
|
+
...(fav && editing && canStar ? [
|
|
667
|
+
{ key: "up", label: tn("favUp", { name: label }), icon: "up", disabled: shown.active || favsSorted || i === 0,
|
|
668
|
+
title: shown.active ? tn("favFiltered") : favsSorted ? tn("favSorted") : tn("favUp", { name: label }),
|
|
669
|
+
onSelect: () => { if (!shown.active && !favsSorted) { focusRow.current = name; moveFavorite(name, -1, known); } } },
|
|
670
|
+
{ key: "down", label: tn("favDown", { name: label }), icon: "down", disabled: shown.active || favsSorted || i === count - 1,
|
|
671
|
+
title: shown.active ? tn("favFiltered") : favsSorted ? tn("favSorted") : tn("favDown", { name: label }),
|
|
672
|
+
onSelect: () => { if (!shown.active && !favsSorted) { focusRow.current = name; moveFavorite(name, 1, known); } } },
|
|
673
|
+
] : []),
|
|
674
|
+
].filter(Boolean);
|
|
675
|
+
return html`<li key=${name} data-agent-row=${name} class=${`v-li${two ? " two-line" : ""}`}><a class=${`inst v-inst${on ? " active" : ""}${starred ? " inst-favorite" : ""}${fade > 0 ? " replied" : ""}${mins != null && mins < 1 ? " just" : ""} ${identityClasses(id)}`}
|
|
630
676
|
ref=${(el) => { paintIdentity(el, id); paintReply(el, fade); }} href=${rowPath(name)} title=${instanceTooltip(it)}
|
|
631
|
-
aria-current=${on ? "page" : undefined} onClick=${onPick} ...${
|
|
677
|
+
aria-current=${on ? "page" : undefined} onClick=${onPick} ...${dragProps({ type: "instance", name, group: g }, !fav)}>
|
|
632
678
|
<${InstanceAvatar} it=${it} state=${dotState(it, own(exec, name) ? exec[name] : null, waiting)} cli=${true} />
|
|
633
679
|
<span class="inst-text"><span class="inst-line"><span class="inst-name" title=${label}>${label}</span>
|
|
634
680
|
<span class="v-meta">${it.runtime === "windows" ? "Windows" : it.context_pct != null ? `${Math.round(it.context_pct)}%` : ""}</span></span>
|
|
@@ -637,19 +683,10 @@ export function InstanceNav({ route, items, loaded = true, exec = {}, awaiting =
|
|
|
637
683
|
${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}
|
|
638
684
|
${facet === "needs" ? html`<span class="inst-sub"><span class="badge-await" title=${waiting || t("app.approxNote")}>${t("app.needsYou")}</span></span>` : null}
|
|
639
685
|
<span class="sr-only">${tn("tooltipBackend", { value: backendLabel(it.backend) })}</span></span>
|
|
640
|
-
</a>${
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
? html`<button type="button" class=${`icon-btn inst-star${starred ? " on" : ""}`} aria-pressed=${starred ? "true" : "false"} disabled=${full}
|
|
645
|
-
aria-label=${tn(starred ? "favRemove" : "favAdd", { name: label })} title=${full ? tn("favFull", { max: MAX_FAVORITES }) : tn(starred ? "favRemove" : "favAdd", { name: label })}
|
|
646
|
-
onClick=${() => toggleFavorite(name, known)}><${Icon} name="star" size=${14} /></button>` : null}${canConfigure && supportsInstanceFeature(it, "details")
|
|
647
|
-
// one step to this agent's settings (its Details & settings page, Basic info; a kind with no Basic info — a ClassicBot room — starts at its first category); the row itself still opens the chat.
|
|
648
|
-
? html`<a class="icon-btn inst-gear" href=${`${detailsPath(name)}?cat=basic`} aria-label=${tn("gearOpen", { name: label })} title=${tn("gearOpen", { name: label })}
|
|
649
|
-
onClick=${onPick}><${Icon} name="settings" size=${14} /></a>` : null}
|
|
650
|
-
${workspace && !viewOnly && route?.instance ? html`<${Menu} cls="inst-workspace" label=${t("app.more")} items=${[
|
|
651
|
-
{ key: "beside", label: workspace.label(name), onSelect: () => workspace.open(name) },
|
|
652
|
-
canConfigure && supportsInstanceFeature(it, "details") ? { key: "settings", label: t("app.details"), icon: "settings", onSelect: () => workspace.settings(name) } : null]} />` : null}</li>`;
|
|
686
|
+
</a>${menuItems.length ? html`<${Menu} cls=${`inst-workspace inst-row-menu agent-menu${starred ? " is-favorite" : ""}`} fit=${true} topLayer=${true}
|
|
687
|
+
ownerKey=${name} label=${t("agentRow.actions", label)} items=${menuItems}
|
|
688
|
+
trigger=${styledMenus ? html`<span class="inst-menu-star" aria-hidden="true">${starred ? html`<${Icon} name="star" size=${14} />` : null}</span><span class="inst-menu-more" aria-hidden="true"><${Icon} name="more" size=${16} /></span>` : undefined} />`
|
|
689
|
+
: starred ? html`<span class="inst-favorite-mark" aria-hidden="true"><${Icon} name="star" size=${14} /></span>` : null}</li>`;
|
|
653
690
|
};
|
|
654
691
|
// #2401: an open list of two or more lines leaves room under the count for "shown" and Clear (stacked); otherwise compact.
|
|
655
692
|
const facetSet = f.status.length > 0 || f.cli.length > 0;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// #3637: display geometry shared by the split sash, docking preview and in-page float.
|
|
2
|
+
export const SASH = 8;
|
|
3
|
+
const finite = (value, fallback) => Number.isFinite(Number(value)) ? Number(value) : fallback;
|
|
4
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
5
|
+
export function splitSize(width, height, layout, ratio = .5) {
|
|
6
|
+
const total = Math.max(0, finite(layout === "stack" ? height : width, 0) - SASH);
|
|
7
|
+
const min = Math.min(layout === "stack" ? 320 : 360, total / 2);
|
|
8
|
+
const first = clamp(total * finite(ratio, .5), min, total - min);
|
|
9
|
+
return { first, second: total - first, ratio: total ? first / total : .5, min, max: total - min };
|
|
10
|
+
}
|
|
11
|
+
export function floatBox(width, height, box) {
|
|
12
|
+
width = Math.max(0, finite(width, 0)); height = Math.max(0, finite(height, 0));
|
|
13
|
+
const w = clamp(finite(box?.width, 560), Math.min(420, width), width);
|
|
14
|
+
const h = clamp(finite(box?.height, 460), Math.min(360, height), height);
|
|
15
|
+
return { x: clamp(finite(box?.x, width - w - 16), 0, width - w), y: clamp(finite(box?.y, height - h - 96), 0, height - h), width: w, height: h };
|
|
16
|
+
}
|
|
17
|
+
export function dropZone(rect, x, y) {
|
|
18
|
+
const dx = x - rect.left, dy = y - rect.top;
|
|
19
|
+
if (![dx, dy, rect.width, rect.height].every(Number.isFinite) || rect.width <= 0 || rect.height <= 0 || dx < 0 || dy < 0 || dx > rect.width || dy > rect.height) return null;
|
|
20
|
+
const edges = [["left", dx / Math.min(72, rect.width * .22)], ["right", (rect.width - dx) / Math.min(72, rect.width * .22)],
|
|
21
|
+
["top", dy / Math.min(72, rect.height * .22)], ["bottom", (rect.height - dy) / Math.min(72, rect.height * .22)]];
|
|
22
|
+
edges.sort((a, b) => a[1] - b[1]);
|
|
23
|
+
return edges[0][1] <= 1 ? edges[0][0] : "center";
|
|
24
|
+
}
|
|
25
|
+
export function dropBox(rect, zone) {
|
|
26
|
+
const { left, top, width, height } = rect;
|
|
27
|
+
return { left: left + (zone === "right" ? width / 2 : 0), top: top + (zone === "bottom" ? height / 2 : 0),
|
|
28
|
+
width: ["left", "right"].includes(zone) ? width / 2 : width, height: ["top", "bottom"].includes(zone) ? height / 2 : height };
|
|
29
|
+
}
|
package/dist/ui/shared/signin.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
const T = {
|
|
13
13
|
en: {
|
|
14
14
|
signout_unsaved: "Signed out for now, but the change could not be saved: a restart may bring the session back. This page cannot repair session storage.",
|
|
15
|
-
checking: "Checking your session…", title: "Sign in to AgEnD", lead: "Enter your authenticator app
|
|
15
|
+
checking: "Checking your session…", title: "Sign in to AgEnD", lead: "Enter the 6-digit code from your authenticator app, or an 8-character device sign-in code, to sign in.",
|
|
16
16
|
label: "Authenticator or device sign-in code", submit: "Sign in", working: "Signing in…",
|
|
17
17
|
hint: "Paste an 8-character device sign-in code",
|
|
18
18
|
nobot: "No chat bot?", nobot_body: "Ask the operator to run agend web --code on the AgEnD computer.",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"zh-TW": {
|
|
65
65
|
signout_unsaved: "暫時登出了,但變更沒能儲存:重新啟動後這個工作階段可能會回來。這個頁面無法修復工作階段的儲存問題。",
|
|
66
|
-
checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "填入驗證器 App 的 6
|
|
66
|
+
checking: "正在確認登入狀態…", title: "登入 AgEnD", lead: "填入驗證器 App 的 6 位數驗證碼,或 8 字元的裝置登入碼,即可登入。",
|
|
67
67
|
label: "驗證碼或裝置登入碼", submit: "登入", working: "登入中…",
|
|
68
68
|
hint: "也可以貼上 8 字元裝置登入碼",
|
|
69
69
|
nobot: "沒有聊天 bot?", nobot_body: "請管理員在 AgEnD 電腦執行 agend web --code。",
|
|
@@ -155,6 +155,20 @@
|
|
|
155
155
|
--shadow-2: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
/* #3727: theme-INDEPENDENT tokens, in a block of their own after the themes. The image viewer's chrome is dark in either
|
|
159
|
+
theme (its picture sits on black), so these are not dark-theme tokens and no theme redefines them: the annotation
|
|
160
|
+
editor's text, bars, buttons and fields, and its four marker colours (the same values the editor draws with on the
|
|
161
|
+
canvas, image-annotate.js COLOURS). */
|
|
162
|
+
:root {
|
|
163
|
+
--media-ink: #ffffff;
|
|
164
|
+
--media-bar: rgba(0, 0, 0, 0.75);
|
|
165
|
+
--media-panel: rgba(0, 0, 0, 0.6);
|
|
166
|
+
--media-btn: rgba(255, 255, 255, 0.12);
|
|
167
|
+
--media-btn-on: rgba(255, 255, 255, 0.32);
|
|
168
|
+
--media-line: rgba(255, 255, 255, 0.35);
|
|
169
|
+
--mark-red: #e5484d; --mark-yellow: #ffc53d; --mark-blue: #3e8eff; --mark-white: #ffffff;
|
|
170
|
+
}
|
|
171
|
+
|
|
158
172
|
@media (prefers-reduced-motion: reduce) {
|
|
159
173
|
:root { --t-fast: 0ms; --t-med: 0ms; }
|
|
160
174
|
}
|
|
@@ -10,15 +10,18 @@ import { t } from "./app-i18n.js";
|
|
|
10
10
|
* open. `active`: the button shows a pressed look (what it controls is on), without changing its role.
|
|
11
11
|
* Optional `trigger` and `triggerClass` customize the button content and styling; `label` remains its accessible name.
|
|
12
12
|
*/
|
|
13
|
-
export function Menu({ items, label, icon = "more", cls = "", active = false, trigger, triggerClass = "icon-btn", disabled = false, fit = false, ownerKey, inactive = false, onOpen, leading }) {
|
|
13
|
+
export function Menu({ items, label, icon = "more", cls = "", active = false, trigger, triggerClass = "icon-btn", disabled = false, fit = false, topLayer = false, ownerKey, inactive = false, onOpen, leading }) {
|
|
14
14
|
const [open, setOpen] = useState(false);
|
|
15
15
|
const [placement,setPlacement] = useState("");
|
|
16
16
|
const btn = useRef(null), list = useRef(null);
|
|
17
17
|
const shown = (items || []).filter(Boolean);
|
|
18
|
+
const anchored = topLayer && open && typeof getComputedStyle === "function" && getComputedStyle(document.documentElement).getPropertyValue?.("--agent-menu-version")?.trim() === "1";
|
|
18
19
|
useLayoutEffect(() => { setOpen(false); }, [ownerKey]);
|
|
19
20
|
useLayoutEffect(() => { if (inactive) setOpen(false); }, [inactive]);
|
|
20
21
|
useLayoutEffect(() => {
|
|
21
22
|
if (!open || !fit || !btn.current?.getBoundingClientRect || !list.current) return;
|
|
23
|
+
const menu = list.current;
|
|
24
|
+
if (anchored) menu.showPopover?.(); // escape the sidebar's scrolling clip; the same Menu keeps focus/ownership
|
|
22
25
|
const place = () => {
|
|
23
26
|
if (!btn.current || !list.current) return;
|
|
24
27
|
const rect = btn.current.getBoundingClientRect();
|
|
@@ -28,11 +31,23 @@ export function Menu({ items, label, icon = "more", cls = "", active = false, tr
|
|
|
28
31
|
const up = below < Math.min(list.current.scrollHeight || 280,280) && above > below;
|
|
29
32
|
const available = up ? above : below;
|
|
30
33
|
setPlacement(`${up ? " menu-up" : ""}${available < 180 ? " menu-short" : available < 280 ? " menu-compact" : ""}`);
|
|
34
|
+
if (anchored) {
|
|
35
|
+
menu.style.setProperty("--menu-available", `${Math.max(44, available)}px`);
|
|
36
|
+
const popup = menu.getBoundingClientRect();
|
|
37
|
+
menu.style.setProperty("--menu-x", `${Math.max(8, Math.min(rect.right - popup.width, window.innerWidth - popup.width - 8))}px`);
|
|
38
|
+
menu.style.setProperty("--menu-y", `${Math.max(8, up ? rect.top - popup.height - 4 : rect.bottom + 4)}px`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
list.current.style.setProperty("--menu-shift", "0px");
|
|
42
|
+
const popup = list.current.getBoundingClientRect();
|
|
43
|
+
const shift = Math.max(8 - popup.left, Math.min(0, window.innerWidth - 8 - popup.right));
|
|
44
|
+
list.current.style.setProperty("--menu-shift", `${shift}px`);
|
|
31
45
|
};
|
|
32
46
|
place();
|
|
33
47
|
window.addEventListener("resize",place);
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
if (anchored) window.addEventListener("scroll",place,true);
|
|
49
|
+
return () => { window.removeEventListener("resize",place); if (anchored) { window.removeEventListener("scroll",place,true); if (menu.isConnected) menu.hidePopover?.(); } };
|
|
50
|
+
},[open,fit,anchored]);
|
|
36
51
|
useEffect(() => {
|
|
37
52
|
if (!open || disabled) { if (open && disabled) setOpen(false); return undefined; }
|
|
38
53
|
const first = list.current && list.current.querySelector("[role=menuitem]:not([disabled]), [role=menuitemradio]:not([disabled]), [role=menuitemcheckbox]:not([disabled])");
|
|
@@ -59,19 +74,19 @@ export function Menu({ items, label, icon = "more", cls = "", active = false, tr
|
|
|
59
74
|
<button ref=${btn} type="button" class=${`${triggerClass}${active ? " active" : ""}`} aria-haspopup="menu" aria-expanded=${open ? "true" : "false"} disabled=${disabled}
|
|
60
75
|
aria-label=${label || t("app.more")} title=${label || t("app.more")} onClick=${() => { if (!disabled) { if (!open) onOpen?.(); setOpen(!open); } }}
|
|
61
76
|
onKeyDown=${(e) => { if (!disabled && (e.key === "ArrowDown" || e.key === "ArrowUp")) { e.preventDefault(); onOpen?.(); setOpen(true); } }}>${trigger === undefined ? html`<${Icon} name=${icon} />` : trigger}</button>
|
|
62
|
-
${open && !disabled ? html`<div data-trust="menu" ref=${list} class=${`menu-list${fit ? placement : ""}`} role="menu" aria-label=${label || t("app.more")} onKeyDown=${onKey}>
|
|
77
|
+
${open && !disabled ? html`<div data-trust="menu" ref=${list} popover=${anchored ? "manual" : undefined} class=${`menu-list${anchored ? " menu-anchored" : ""}${fit ? placement : ""}`} role="menu" aria-label=${label || t("app.more")} onKeyDown=${onKey}>
|
|
63
78
|
${leading || null}
|
|
64
79
|
${shown.map(item => item.heading
|
|
65
80
|
? html`<div key=${item.key} class="menu-heading" role="presentation">${item.label}</div>`
|
|
66
81
|
: item.checkbox
|
|
67
82
|
? html`<button key=${item.key} type="button" role="menuitemcheckbox" aria-checked=${item.checked ? "true" : "false"} class="menu-item menu-radio"
|
|
68
|
-
disabled=${!!item.disabled} onClick=${() => item.onSelect()}><span class="menu-tick" aria-hidden="true">${item.checked ? html`<${Icon} name="check" size=${16} />` : null}</span><span>${item.label}</span
|
|
83
|
+
title=${item.title} disabled=${!!item.disabled} onClick=${() => item.onSelect()}><span class="menu-tick" aria-hidden="true">${item.icon ? html`<${Icon} name=${item.icon} size=${16} />` : item.checked ? html`<${Icon} name="check" size=${16} />` : null}</span><span>${item.label}</span>${item.icon && item.checked ? html`<span class="menu-state" aria-hidden="true"><${Icon} name="check" size=${14} /></span>` : null}</button>`
|
|
69
84
|
: item.checked !== undefined
|
|
70
85
|
// #2196: one of a group of choices (Page colours): a radio item, the chosen one ticked.
|
|
71
86
|
? html`<button key=${item.key} type="button" role="menuitemradio" aria-checked=${item.checked ? "true" : "false"} class="menu-item menu-radio"
|
|
72
|
-
disabled=${!!item.disabled} onClick=${() => choose(item)}><span class="menu-tick" aria-hidden="true">${item.checked ? html`<${Icon} name="check" size=${16} />` : null}</span><span>${item.label}</span
|
|
87
|
+
title=${item.title} disabled=${!!item.disabled} onClick=${() => choose(item)}><span class="menu-tick" aria-hidden="true">${item.icon ? html`<${Icon} name=${item.icon} size=${16} />` : item.checked ? html`<${Icon} name="check" size=${16} />` : null}</span><span>${item.label}</span>${item.icon && item.checked ? html`<span class="menu-state" aria-hidden="true"><${Icon} name="check" size=${14} /></span>` : null}</button>`
|
|
73
88
|
: html`<button key=${item.key} type="button" role="menuitem" class=${`menu-item${item.danger ? " danger" : ""}`}
|
|
74
|
-
disabled=${!!item.disabled} onClick=${() => choose(item)}>${item.icon ? html`<${Icon} name=${item.icon} size=${16} />` : null}<span>${item.label}</span></button>`)}
|
|
89
|
+
title=${item.title} disabled=${!!item.disabled} onClick=${() => choose(item)}>${item.icon ? html`<${Icon} name=${item.icon} cls=${item.iconClass || ""} size=${16} />` : null}<span>${item.label}</span></button>`)}
|
|
75
90
|
</div>` : null}
|
|
76
91
|
</div>`;
|
|
77
92
|
}
|
package/dist/ui/signin.html
CHANGED
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
</div>
|
|
71
71
|
<form id="form" hidden autocomplete="off">
|
|
72
72
|
<h1 data-i18n="title">Sign in to AgEnD</h1>
|
|
73
|
-
<p data-i18n="lead">Enter your authenticator app
|
|
73
|
+
<p data-i18n="lead">Enter the 6-digit code from your authenticator app, or an 8-character device sign-in code, to sign in.</p>
|
|
74
74
|
<label for="code" data-i18n="label">Authenticator or device sign-in code</label>
|
|
75
75
|
<input id="code" name="code" inputmode="text" autocomplete="one-time-code" autocapitalize="characters"
|
|
76
76
|
autocorrect="off" spellcheck="false" maxlength="32" placeholder="" aria-describedby="codeHint" required>
|
|
@@ -94,10 +94,12 @@ const pageLang = doc => /^zh/i.test(doc?.documentElement?.lang || "") ? "zh-TW"
|
|
|
94
94
|
* themselves every second) and no "Sign in later" (nothing would remember it). `focus` (a backend id) then shows only that backend's card: the default account's checklist may
|
|
95
95
|
* hold others. The setup page and the installer's `?backend_signins=` list do not pass `dialog`, and look as they did.
|
|
96
96
|
*
|
|
97
|
-
* `started` (run id → void): called with the id of the run a press of Sign in in THESE cards started
|
|
98
|
-
* keeps it, to end exactly that run when it closes.
|
|
97
|
+
* `started` (run id → void): called with the id of the run a press of Sign in in THESE cards started — the id the server names as created by that very request (`started` in its
|
|
98
|
+
* answer), never one it joined that was already running (another tab's, another backend's, a double click). The account dialog keeps it, to end exactly that run when it closes.
|
|
99
|
+
* `abandoned` (run id → void): the same id, when the cards were disposed (the dialog closed) while that request was still in flight: nobody is left to show or keep the run, so
|
|
100
|
+
* whoever mounted the cards ends it by this id. Nothing is drawn, and no other run is touched.
|
|
99
101
|
*/
|
|
100
|
-
export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, changed = () => {}, lang, machine = false, ask, dashboard = false, dialog = false, focus, started = () => {} } = {}) {
|
|
102
|
+
export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, changed = () => {}, lang, machine = false, ask, dashboard = false, dialog = false, focus, started = () => {}, abandoned = () => {} } = {}) {
|
|
101
103
|
const doc = root.ownerDocument;
|
|
102
104
|
let view = null, busy = false, disposed = false, timer = null, generation = 0, message = "", rendered = "";
|
|
103
105
|
const language = () => (lang ? lang() : pageLang(doc)) === "zh-TW" ? "zh-TW" : "en";
|
|
@@ -119,7 +121,12 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
|
|
|
119
121
|
async function perform(data) {
|
|
120
122
|
if (busy || disposed) return;
|
|
121
123
|
busy = true; generation++; message = ""; render();
|
|
122
|
-
try {
|
|
124
|
+
try {
|
|
125
|
+
const next = await request(data);
|
|
126
|
+
const created = data?.operation === "start" && typeof next?.started === "string" ? next.started : null; // a start that joined a run already there names none
|
|
127
|
+
if (disposed) { if (created) abandoned(created); }
|
|
128
|
+
else { if (created) started(created); accept(next); }
|
|
129
|
+
}
|
|
123
130
|
catch (error) { if (!disposed) message = String(error?.message || "error"); }
|
|
124
131
|
finally { busy = false; if (!disposed) render(); }
|
|
125
132
|
}
|
package/dist/web-api.d.ts
CHANGED
package/dist/web-api.js
CHANGED
|
@@ -1500,7 +1500,7 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
|
|
|
1500
1500
|
z.strictObject({ kind: z.enum(["code", "start_url", "region"]), value: z.string().max(4096) }),
|
|
1501
1501
|
]) }),
|
|
1502
1502
|
z.strictObject({ operation: z.literal("skip"), backend: z.enum(ONBOARDING_BACKENDS) }),
|
|
1503
|
-
z.strictObject({ operation: z.literal("cancel") }), z.strictObject({ operation: z.literal("refresh") }),
|
|
1503
|
+
z.strictObject({ operation: z.literal("cancel"), id: z.string().regex(/^[0-9a-f]{32}$/).optional(), backend: z.enum(ONBOARDING_BACKENDS).optional() }), z.strictObject({ operation: z.literal("refresh") }),
|
|
1504
1504
|
]).safeParse(body);
|
|
1505
1505
|
if (!parsed.success) {
|
|
1506
1506
|
json(res, 400, { error: "invalid_signin_action" });
|
|
@@ -1516,7 +1516,7 @@ function handleBrowserBackendSignIns(req, res, url, ctx) {
|
|
|
1516
1516
|
else if (action.operation === "skip")
|
|
1517
1517
|
result = await service.skip(owner, action.backend);
|
|
1518
1518
|
else if (action.operation === "cancel")
|
|
1519
|
-
result = await service.cancel(owner);
|
|
1519
|
+
result = await service.cancel(owner, action.id, action.backend);
|
|
1520
1520
|
else
|
|
1521
1521
|
result = await service.refresh(owner, true);
|
|
1522
1522
|
}
|
|
@@ -1634,7 +1634,8 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
|
|
|
1634
1634
|
else {
|
|
1635
1635
|
// `{}`: the explicit "Cancel sign-in" — whatever sign-in is running, as ever. `{ run, ifUnopened }`: the dialog's own Close (#3321 review), for
|
|
1636
1636
|
// that one run and only while its terminal is unopened and it is this session's own; anything else is left alone and `cancelled` is false.
|
|
1637
|
-
|
|
1637
|
+
// `{ backend }` (AGEND-203): the "Cancel the running sign-in" a refused start offers — only the sign-in or install on that backend.
|
|
1638
|
+
const parsed = z.union([z.strictObject({}), z.strictObject({ backend: z.string().regex(/^[a-z][a-z0-9-]{0,31}$/i) }), z.strictObject({ run: z.string().regex(/^[0-9a-f]{32}$/), ifUnopened: z.literal(true) })]).safeParse(body);
|
|
1638
1639
|
if (!parsed.success) {
|
|
1639
1640
|
json(res, 400, { error: "sign_in_args" });
|
|
1640
1641
|
return;
|
|
@@ -1642,7 +1643,7 @@ function handleBackendLogin(req, res, url, ctx, path, method) {
|
|
|
1642
1643
|
if ("run" in parsed.data)
|
|
1643
1644
|
json(res, 200, await logins.closeRun(now, parsed.data.run));
|
|
1644
1645
|
else
|
|
1645
|
-
json(res, 200, { message: await logins.cancel() });
|
|
1646
|
+
json(res, 200, { message: await logins.cancel("backend" in parsed.data ? parsed.data.backend.toLowerCase() : undefined) });
|
|
1646
1647
|
}
|
|
1647
1648
|
})().catch(() => { try {
|
|
1648
1649
|
json(res, 500, { error: "sign_in_request_failed" });
|
|
@@ -3270,11 +3271,33 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
3270
3271
|
json(res, 404, { error: "not available" });
|
|
3271
3272
|
return true;
|
|
3272
3273
|
}
|
|
3274
|
+
// AGEND-181: thinking only for an admin session on the local dashboard, decided here — never the public link, a
|
|
3275
|
+
// guest or a View projection, whatever the query says. The service makes none otherwise (its parser is not asked).
|
|
3276
|
+
// AGEND-197: the chat's activity block (chat=1) is for the same viewer and no other: a refusal here, not a hidden block.
|
|
3277
|
+
const admission = adminAdmissionOf(req, url, ctx);
|
|
3278
|
+
const admin = !!admission && !gatewayRequestContext(req) && !guestRequestOf(req);
|
|
3279
|
+
const chat = p.get("chat") === "1";
|
|
3280
|
+
if (chat && !admin) {
|
|
3281
|
+
json(res, 403, { error: "admin_only" });
|
|
3282
|
+
return true;
|
|
3283
|
+
}
|
|
3284
|
+
const thinking = p.get("thinking") === "1" && admin;
|
|
3273
3285
|
ctx.logSteps(instance, {
|
|
3286
|
+
...(chat ? { chat: true } : {}),
|
|
3287
|
+
...(thinking ? { thinking: true } : {}),
|
|
3274
3288
|
...(after !== undefined ? { after } : {}), ...(before !== undefined ? { before } : {}), ...(ev !== undefined ? { ev } : {}),
|
|
3275
3289
|
...(limit !== undefined ? { limit } : {}), ...(key !== null ? { key } : {}),
|
|
3276
3290
|
skip: p.get("skip") === "1", watch: p.get("watch") === "1",
|
|
3277
3291
|
}).then(answer => {
|
|
3292
|
+
if (res.destroyed)
|
|
3293
|
+
return;
|
|
3294
|
+
// Prism #3709 R1: the transcript read is asynchronous — an admin session revoked, or the web token rotated, while it
|
|
3295
|
+
// ran must not receive the private steps (the chat's block, thinking) it was admitted for. Asked again here, as
|
|
3296
|
+
// /ui/subagents does; the Log tab's own read (no chat, no thinking) is not private and is left as it was.
|
|
3297
|
+
if ((chat || thinking) && (adminAdmissionOf(req, url, ctx) !== admission || gatewayRequestContext(req) || guestRequestOf(req))) {
|
|
3298
|
+
json(res, 403, { error: "admin_only" });
|
|
3299
|
+
return;
|
|
3300
|
+
}
|
|
3278
3301
|
if (answer === null)
|
|
3279
3302
|
json(res, 404, { error: `Instance not found: ${instance}` });
|
|
3280
3303
|
else
|
|
@@ -6178,6 +6201,13 @@ function shellBodyTag(req, ctx, mode, viewer) {
|
|
|
6178
6201
|
+ ` data-usage-panel="${ctx.fleetConfig?.web?.usage_panel === false ? "0" : "1"}"` // #2855: guests' too
|
|
6179
6202
|
// #1218: whether the Log tab is on (web.log_tab; off by default): the tab says so and offers to turn it on.
|
|
6180
6203
|
+ ` data-log-tab="${ctx.fleetConfig?.web?.log_tab === true ? "1" : "0"}"`
|
|
6204
|
+
// AGEND-181: whether thinking may be asked for (web.log_thinking; OFF by default, AGEND-197). The server answers
|
|
6205
|
+
// `thinking: true` only to an admin session on the local dashboard (GET /ui/steps), whatever this says.
|
|
6206
|
+
+ ` data-log-thinking="${ctx.fleetConfig?.web?.log_thinking === true ? "1" : "0"}"`
|
|
6207
|
+
// AGEND-197: whether this page may ask for the chat's activity block at all — an admin session on the local dashboard
|
|
6208
|
+
// only (a guest, the public link and a read-only session are never offered it, and the server refuses them anyway).
|
|
6209
|
+
// Each agent's own tool_progress decides whether there is anything to show (the answer's `level`).
|
|
6210
|
+
+ ` data-chat-activity="${childMark ? "1" : "0"}"`
|
|
6181
6211
|
// #1937: the upload limits in force for this page (the config's; the public link's own cap on it) — what the chat
|
|
6182
6212
|
// checks before sending a file, and the numbers its words say. The server checks again on every upload.
|
|
6183
6213
|
+ ` data-upload-limits="${attr(JSON.stringify(uploadLimits(ctx.fleetConfig?.web, { publicLink: gatewayRequestContext(req) !== undefined })))}"`
|