@songsid/agend 2.4.0-beta.4 → 2.4.0-beta.6
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/auth-api.js +2 -0
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/cli-runtime-switch.d.ts +21 -2
- package/dist/backend/cli-runtime-switch.js +124 -2
- package/dist/backend/cli-runtime-switch.js.map +1 -1
- package/dist/backend/codex-footer-hints.d.ts +1 -0
- package/dist/backend/codex-footer-hints.js +15 -0
- package/dist/backend/codex-footer-hints.js.map +1 -1
- package/dist/backend/codex.d.ts +6 -4
- package/dist/backend/codex.js +26 -9
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/kiro.js +3 -3
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/native-pane.js +1 -1
- package/dist/backend/native-pane.js.map +1 -1
- package/dist/backend/types.d.ts +2 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/daemon.d.ts +3 -0
- package/dist/daemon.js +28 -9
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +5 -0
- package/dist/fleet-manager.js +15 -3
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/hub/SKILL.md +27 -18
- package/dist/hub/compose/server.js +4 -3
- package/dist/hub/compose/server.js.map +1 -1
- package/dist/hub/group-policy/admin-api.js +9 -0
- package/dist/hub/group-policy/admin-api.js.map +1 -1
- package/dist/hub/group-policy/admin-control.d.ts +1 -0
- package/dist/hub/group-policy/admin-control.js +13 -4
- package/dist/hub/group-policy/admin-control.js.map +1 -1
- package/dist/hub/group-policy/admin-dto.d.ts +37 -0
- package/dist/hub/group-policy/admin-dto.js.map +1 -1
- package/dist/hub/group-policy/admin-facts.d.ts +4 -2
- package/dist/hub/group-policy/admin-facts.js +17 -2
- package/dist/hub/group-policy/admin-facts.js.map +1 -1
- package/dist/hub/group-policy/admin-impact.d.ts +4 -3
- package/dist/hub/group-policy/admin-impact.js +8 -6
- package/dist/hub/group-policy/admin-impact.js.map +1 -1
- package/dist/hub/group-policy/admin-search.d.ts +2 -1
- package/dist/hub/group-policy/admin-search.js +56 -7
- package/dist/hub/group-policy/admin-search.js.map +1 -1
- package/dist/hub/group-policy/impact-inventory.d.ts +4 -1
- package/dist/hub/group-policy/impact-inventory.js +23 -2
- package/dist/hub/group-policy/impact-inventory.js.map +1 -1
- package/dist/hub/group-policy/model.d.ts +29 -1
- package/dist/hub/group-policy/model.js +20 -7
- package/dist/hub/group-policy/model.js.map +1 -1
- package/dist/hub/group-policy/store.js +22 -3
- package/dist/hub/group-policy/store.js.map +1 -1
- package/dist/hub/group-policy/team-subjects.d.ts +16 -0
- package/dist/hub/group-policy/team-subjects.js +32 -0
- package/dist/hub/group-policy/team-subjects.js.map +1 -0
- package/dist/hub/http/compose.js +15 -1
- package/dist/hub/http/compose.js.map +1 -1
- package/dist/hub/join/client.js +75 -42
- package/dist/hub/join/client.js.map +1 -1
- package/dist/hub/runtime.js +4 -3
- package/dist/hub/runtime.js.map +1 -1
- package/dist/hub/socket.d.ts +1 -0
- package/dist/hub/socket.js +39 -2
- package/dist/hub/socket.js.map +1 -1
- package/dist/hub/teams/index.d.ts +8 -3
- package/dist/hub/teams/index.js +106 -31
- package/dist/hub/teams/index.js.map +1 -1
- package/dist/hub/teams/store.d.ts +5 -1
- package/dist/hub/teams/store.js +25 -2
- package/dist/hub/teams/store.js.map +1 -1
- package/dist/hub/teams/types.d.ts +19 -2
- package/dist/native-mcp.js +1 -2
- package/dist/native-mcp.js.map +1 -1
- package/dist/native-pane-lifecycle.js +3 -2
- package/dist/native-pane-lifecycle.js.map +1 -1
- package/dist/office-share-page.js +1 -1
- package/dist/office-share-page.js.map +1 -1
- package/dist/runtime-pane-native.js +3 -1
- package/dist/runtime-pane-native.js.map +1 -1
- package/dist/ui/chat-store.js +2 -1
- package/dist/ui/fleet-canvas.js +5 -1
- package/dist/ui/fleet-office-carousel.d.ts +14 -0
- package/dist/ui/fleet-office-carousel.js +95 -0
- package/dist/ui/fleet-office-store.js +14 -2
- package/dist/ui/fleet-office.js +125 -13
- package/dist/ui/hub-admin-rooms.js +1 -1
- package/dist/ui/hub-chat-strings.js +7 -0
- package/dist/ui/hub-client.js +3 -0
- package/dist/ui/hub-grant-picker.js +3 -37
- package/dist/ui/hub-group-policy.js +22 -10
- package/dist/ui/hub-group-strings.js +26 -17
- package/dist/ui/hub-join-steps.js +27 -15
- package/dist/ui/hub-policy-subjects.js +35 -0
- package/dist/ui/hub-subject-picker.js +58 -0
- package/dist/ui/hub-teams-strings.js +10 -6
- package/dist/ui/hub-teams.js +56 -28
- package/dist/ui/hub-welcome.js +122 -75
- package/dist/ui/panel-chat.js +179 -11
- package/dist/ui/panel-details.js +3 -1
- package/dist/ui/panel-fleet.js +25 -3
- package/dist/ui/panel-hub.js +101 -57
- package/dist/ui/panel-log.js +3 -1
- package/dist/ui/shared/agent-sheet.js +115 -0
- package/dist/ui/shared/app-shell.js +56 -17
- package/dist/ui/shared/app.css +61 -1
- package/dist/ui/shared/chat-composer.js +23 -2
- package/dist/ui/shared/chat-strings.js +4 -2
- package/dist/ui/shared/chat-work-bar.css +63 -1
- package/dist/ui/shared/hub-chat.css +33 -0
- package/dist/ui/shared/hub-groups.css +18 -14
- package/dist/ui/shared/hub-owner.css +11 -0
- package/dist/ui/shared/hub-rooms-u2.css +4 -0
- package/dist/ui/shared/model-picker.css +27 -0
- package/dist/ui/shared/panel-view.js +7 -1
- package/dist/ui/shared/ui-toast.js +1 -1
- package/package.json +1 -1
package/dist/ui/panel-hub.js
CHANGED
|
@@ -374,7 +374,6 @@ export function HubNav({ onPick } = {}) {
|
|
|
374
374
|
const s = useSession();
|
|
375
375
|
const rs = useRooms();
|
|
376
376
|
const [q, setQ] = useState("");
|
|
377
|
-
const [picking, setPicking] = useState(false);
|
|
378
377
|
const star = useRoomStar(rs.rooms, s?.login);
|
|
379
378
|
useEffect(() => { linkHubChatCss(); }, []);
|
|
380
379
|
if (!s) return null;
|
|
@@ -382,7 +381,7 @@ export function HubNav({ onPick } = {}) {
|
|
|
382
381
|
const shown = rs.rooms.filter((r) => !q.trim() || [r.name, r.agent?.owner?.name, r.lastText].some((v) => String(v || "").toLowerCase().includes(q.trim().toLowerCase())));
|
|
383
382
|
const pick = (e, r) => { if (onPick) onPick(); if (e && (e.metaKey || e.ctrlKey)) return; e && e.preventDefault(); navigate(roomPath(r.id)); };
|
|
384
383
|
return html`<div class="hub-nav">
|
|
385
|
-
<button type="button" class="btn hub-new" onClick=${() =>
|
|
384
|
+
<button type="button" class="btn hub-new" onClick=${() => { if (onPick) onPick(); navigate(NEW_CHAT_PATH); }}><${Icon} name="plus" size=${16} />${hc("newChat")}</button>
|
|
386
385
|
<label class="hub-search"><${Icon} name="search" size=${14} /><input type="search" placeholder=${hc("search")} aria-label=${hc("search")} value=${q}
|
|
387
386
|
onInput=${(e) => setQ(e.target.value)} /></label>
|
|
388
387
|
<div class="hub-sec">${hc("chats")}</div>
|
|
@@ -391,7 +390,6 @@ export function HubNav({ onPick } = {}) {
|
|
|
391
390
|
${rs.loaded && !rs.error && !rs.denied && !rs.rooms.length ? html`<p class="note hub-list-empty">${hc("noChats")}</p>` : null}
|
|
392
391
|
${rs.rooms.length && !shown.length ? html`<p class="note hub-list-empty">${hc("noMatch")}</p>` : null}
|
|
393
392
|
<div class="view-roster inst-nav hub-side-rooms"><${HubRoomRows} rooms=${rs.rooms} q=${q} current=${current} href=${(r) => roomPath(r.id)} onGo=${pick} star=${star} /></div>
|
|
394
|
-
${picking ? html`<${NewChatDialog} onClose=${() => setPicking(false)} />` : null}
|
|
395
393
|
</div>`;
|
|
396
394
|
}
|
|
397
395
|
|
|
@@ -409,7 +407,7 @@ export function HubSide({ onPick } = {}) {
|
|
|
409
407
|
const { route } = useStore(navStore);
|
|
410
408
|
const [q, setQ] = useState("");
|
|
411
409
|
const [filtering, setFiltering] = useState(false);
|
|
412
|
-
const [
|
|
410
|
+
const [newRoom, setNewRoom] = useState(false);
|
|
413
411
|
// M-3127 C: on a Hub with rooms, Ctrl K is the search dialog (names, then messages); before rooms, the list's filter.
|
|
414
412
|
const [searching, setSearching] = useState(false);
|
|
415
413
|
const filter = useRef(null);
|
|
@@ -444,15 +442,14 @@ export function HubSide({ onPick } = {}) {
|
|
|
444
442
|
${noticesOffered(s) ? row("notices", NOTICES_PATH, "bell", hc("notices")) : null}
|
|
445
443
|
<button type="button" class="side-row side-search" onClick=${openFilter} title=${`${hc("search")} (${searchShortcut()})`}
|
|
446
444
|
aria-keyshortcuts=${isMacLike() ? "Meta+K" : "Control+K"}><${Icon} name="search" /><span class="grow">${hc("navSearch")}</span><kbd class="kbd-hint" aria-hidden="true">${searchShortcut()}</kbd></button>
|
|
447
|
-
<button type="button" class="side-row side-new" onClick=${() => setPicking(true)}><${Icon} name="plus" /><span class="grow">${hc("newChat")}</span></button>
|
|
448
|
-
${roomsLive() && rs.me?.canCreateRooms ? html`<button type="button" class="side-row side-new hub-new-room" onClick=${() => setNewRoom(true)}><${Icon} name="room" /><span class="grow">${hroom("newRoomTitle")}</span></button>` : null}
|
|
449
445
|
${searching ? html`<${LazyRoomPart} load=${() => import("./hub-room-search.js")} name="RoomSearch" props=${{ client: hubClient(), rooms: rs.rooms || [], onClose: () => setSearching(false),
|
|
450
446
|
openRoom: (r) => { if (onPick) onPick(); navigate(roomPath(r.id)); },
|
|
451
447
|
openHit: (h) => { if (onPick) onPick(); navigate(`${roomPath(h.roomId)}&m=${encodeURIComponent(h.messageId)}`); } }} />` : null}
|
|
452
448
|
</nav>
|
|
453
449
|
|
|
454
|
-
|
|
455
|
-
|
|
450
|
+
${/* M-3190 (Argon): 新對話 and 新房間 head the conversation list, not the primary rows. */ ""}
|
|
451
|
+
<${HubRoomList} rs=${rs} q=${q} setQ=${setQ} filtering=${filtering} setFiltering=${setFiltering} filterRef=${filter} onPick=${onPick} quietEmpty=${home} foot=${roomsLive()}
|
|
452
|
+
onNew=${() => { if (onPick) onPick(); navigate(NEW_CHAT_PATH); }} onNewRoom=${roomsLive() && rs.me?.canCreateRooms ? () => setNewRoom(true) : null} />
|
|
456
453
|
${newRoom ? html`<${LazyRoomPart} load=${() => import("./hub-room-new.js")} name="NewRoomDialog" props=${{ client: hubClient(), assistant: !!rs.me?.assistant,
|
|
457
454
|
onClose: () => setNewRoom(false), onOpenRoom: (id) => { setNewRoom(false); void refreshRooms(); navigate(roomPath(id)); } }} />` : null}`;
|
|
458
455
|
}
|
|
@@ -462,12 +459,12 @@ export function HubSide({ onPick } = {}) {
|
|
|
462
459
|
* count, one-line empty states) — the sidebar's (HubSide) and, on a phone, the chats' home page's (with its own New chat
|
|
463
460
|
* row and the filter always shown): one drawing, not two (Argon #9). `quietEmpty`: the page beside it already says "No chats yet".
|
|
464
461
|
*/
|
|
465
|
-
function HubRoomList({ rs, q, setQ, filtering, setFiltering, filterRef, onPick, quietEmpty = false, onNew = null, onNewRoom = null, foot = false }) {
|
|
462
|
+
function HubRoomList({ rs, q, setQ, filtering, setFiltering, filterRef, onPick, quietEmpty = false, onNew = null, onNewRoom = null, foot = false, home = false }) {
|
|
466
463
|
const current = roomParam();
|
|
467
464
|
const star = useRoomStar(rs.rooms, useSession()?.login); // S-145: favourites, as the Fleet sidebar's
|
|
468
465
|
const go = (e, href) => { if (onPick) onPick(); if (e && (e.metaKey || e.ctrlKey)) return; e && e.preventDefault(); navigate(href); };
|
|
469
466
|
const shown = rs.rooms.filter((r) => !q.trim() || [r.name, r.agent?.owner?.name, r.lastText].some((v) => String(v || "").toLowerCase().includes(q.trim().toLowerCase())));
|
|
470
|
-
const always =
|
|
467
|
+
const always = home; // the phone's home list: its filter is always there (when there's a list to filter)
|
|
471
468
|
return html`<div class="view-roster inst-nav hub-side-rooms"><div data-trust="navigation" class="side-section">
|
|
472
469
|
${onNew ? html`<button type="button" class="side-row side-new" onClick=${onNew}><${Icon} name="plus" /><span class="grow">${hc("newChat")}</span></button>` : null}
|
|
473
470
|
${/* Lumen (spec §2): on the phone's list too, beside New chat — not only in the drawer. */ ""}
|
|
@@ -496,11 +493,10 @@ function HubRoomList({ rs, q, setQ, filtering, setFiltering, filterRef, onPick,
|
|
|
496
493
|
/** The phone's chats home: the same roster, with New chat at its head and the filter in place. */
|
|
497
494
|
function HubHomeList() {
|
|
498
495
|
const rs = useRooms();
|
|
499
|
-
const [q, setQ] = useState(""), [filtering, setFiltering] = useState(false), [
|
|
496
|
+
const [q, setQ] = useState(""), [filtering, setFiltering] = useState(false), [newRoom, setNewRoom] = useState(false);
|
|
500
497
|
const filter = useRef(null);
|
|
501
|
-
return html`<${HubRoomList} rs=${rs} q=${q} setQ=${setQ} filtering=${filtering} setFiltering=${setFiltering} filterRef=${filter} onNew=${() =>
|
|
498
|
+
return html`<${HubRoomList} rs=${rs} q=${q} setQ=${setQ} filtering=${filtering} setFiltering=${setFiltering} filterRef=${filter} home=${true} onNew=${() => navigate(NEW_CHAT_PATH)}
|
|
502
499
|
onNewRoom=${roomsLive() && rs.me?.canCreateRooms ? () => setNewRoom(true) : null} />
|
|
503
|
-
${picking ? html`<${NewChatDialog} onClose=${() => setPicking(false)} />` : null}
|
|
504
500
|
${newRoom ? html`<${LazyRoomPart} load=${() => import("./hub-room-new.js")} name="NewRoomDialog" props=${{ client: hubClient(), assistant: !!rs.me?.assistant,
|
|
505
501
|
onClose: () => setNewRoom(false), onOpenRoom: (id) => { setNewRoom(false); void refreshRooms(); navigate(roomPath(id)); } }} />` : null}`;
|
|
506
502
|
}
|
|
@@ -527,49 +523,36 @@ export function HubFoot() {
|
|
|
527
523
|
trigger=${html`<span class="dot ok" aria-hidden="true"></span><span class="grow">${hc("signedIn")}</span><span class="meta" title=${s.displayName}>${s.displayName}</span>`} /></div>`;
|
|
528
524
|
}
|
|
529
525
|
|
|
530
|
-
/**
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
if (!r.ok) { setMsg(errText(r)); return; }
|
|
543
|
-
onClose(); await refreshRooms(); navigate(roomPath(r.room.id));
|
|
544
|
-
};
|
|
545
|
-
const all = cat && cat.askable ? cat.askable : [];
|
|
546
|
-
const shown = all.filter((it) => !q.trim() || `${it.exposure.displayName} ${it.ownerName}`.toLowerCase().includes(q.trim().toLowerCase()));
|
|
547
|
-
const hasRoom = (it) => rs.rooms.some((r) => { const o = r.legacy || r; return o.exposureId === it.exposure.id && o.grantId === it.grant.id; });
|
|
548
|
-
return html`<${Dialog} title=${hc("pickTitle")} onClose=${onClose}>
|
|
549
|
-
<div class="hub-pick">
|
|
550
|
-
<label class="field"><span class="sr-only">${hc("pickSearch")}</span><input type="search" placeholder=${hc("pickSearch")} value=${q} onInput=${(e) => setQ(e.target.value)} /></label>
|
|
551
|
-
${!cat ? html`<${Skeleton} variant="rows" lines=${4} />` : cat.error ? html`<${ErrorState} message=${cat.error} onRetry=${reload} />` : null}
|
|
552
|
-
${cat && !cat.error && !all.length ? html`<${Empty} icon="chat" title=${hc("pickEmpty")} hint=${hw("askHint")} />` : null}
|
|
553
|
-
${all.length && !shown.length ? html`<p class="note">${hc("pickNone")}</p>` : null}
|
|
554
|
-
<ul class="hub-pick-list" role="list">${shown.map((it) => html`<li key=${it.grant.id} class="hub-pick-row">
|
|
555
|
-
<${Avatar} name=${it.exposure.displayName} />
|
|
556
|
-
<span class="hub-room-text"><span class="t">${it.exposure.displayName}</span><span class="s">${hc("pickUntil", it.ownerName || "—", dateOnly(it.grant.expiresAt))}</span></span>
|
|
557
|
-
<button type="button" class=${`btn btn-sm${hasRoom(it) ? "" : " btn-primary"}`} disabled=${busy} onClick=${() => open(it)}>${hasRoom(it) ? hc("pickOpen") : hc("pickAsk")}</button>
|
|
558
|
-
</li>`)}</ul>
|
|
559
|
-
<p class="note">${hc("pickHint")}</p>
|
|
560
|
-
${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
|
|
561
|
-
</div>
|
|
562
|
-
</${Dialog}>`;
|
|
563
|
-
}
|
|
526
|
+
/** M-3190: 新對話 is the launcher's own address (the sidebar's and the phone list's 新對話 open it). */
|
|
527
|
+
const NEW_CHAT_PATH = "/ui/hub?view=new";
|
|
528
|
+
/**
|
|
529
|
+
* Once per page load (this window): 對話 opens the most recent room or 1:1 chat, by when it last moved; back on 對話 later shows
|
|
530
|
+
* the list / launcher. M-3204: by recency, never by preview text — the Hub sends a 1:1 chat without one. The one exception is the
|
|
531
|
+
* Hub assistant's chat, which the Hub makes for everyone when the list is read: unused (no message yet) it is not a chat to open.
|
|
532
|
+
*/
|
|
533
|
+
const openedIn = new WeakSet();
|
|
534
|
+
const thisWindow = () => (typeof window !== "undefined" ? window : globalThis);
|
|
535
|
+
const autoOpened = () => openedIn.has(thisWindow());
|
|
536
|
+
const recentRoom = (rooms) => rooms.filter((r) => !r.archived && (!r.assistant || !!r.lastText))
|
|
537
|
+
.sort((a, b) => (b.lastAt || 0) - (a.lastAt || 0))[0] || null;
|
|
564
538
|
|
|
565
|
-
/**
|
|
539
|
+
/**
|
|
540
|
+
* The Ask tab: the chosen room; else (M-3190, Argon's chat-first review) the most recent room once per visit, and otherwise the
|
|
541
|
+
* launcher — beside the sidebar's list on a wide screen; on a phone the list, or the launcher on 新對話 or with nothing to list.
|
|
542
|
+
*/
|
|
566
543
|
function HubChats() {
|
|
567
544
|
useStore(navStore); // ?room= changes without a new route
|
|
568
545
|
const rs = useRooms();
|
|
569
546
|
const s = useSession();
|
|
570
|
-
const [picking, setPicking] = useState(false);
|
|
571
547
|
useEffect(() => { linkHubChatCss(); }, []);
|
|
572
|
-
const id = roomParam();
|
|
548
|
+
const id = roomParam(), launch = viewParam() === "new";
|
|
549
|
+
const opening = !id && !launch && !autoOpened();
|
|
550
|
+
useLayoutEffect(() => {
|
|
551
|
+
if (!rs.loaded || autoOpened()) return;
|
|
552
|
+
openedIn.add(thisWindow());
|
|
553
|
+
const recent = !id && !launch ? recentRoom(rs.rooms) : null;
|
|
554
|
+
if (recent) navigate(roomPath(recent.id), { replace: true });
|
|
555
|
+
}, [rs.loaded, id, launch]);
|
|
573
556
|
// Today's chats (the list's `legacy` item) open the room view they always had; a room of a Hub with rooms opens the
|
|
574
557
|
// shared thread (M-3092 PR 2).
|
|
575
558
|
const listed = id ? rs.rooms.find((r) => r.id === id) : null;
|
|
@@ -580,19 +563,78 @@ function HubChats() {
|
|
|
580
563
|
onLeft=${() => { void refreshRooms(); navigate("/ui/hub"); }} onMe=${noteHubMeId} />`;
|
|
581
564
|
if (id && room) return html`<${HubRoomView} key=${id} room=${room} />`;
|
|
582
565
|
if (id) return html`<${HubRoomLoading} error=${rs.error} />`;
|
|
583
|
-
return html`<${PanelHeader} title=${hc("chats")}
|
|
566
|
+
if (opening && (!rs.loaded || recentRoom(rs.rooms))) return html`<${PanelHeader} title=${hc("chats")} /><div class="hub-home"><div class="hub-home-pick center"><${Skeleton} variant="rows" lines=${4} /></div></div>`;
|
|
567
|
+
// On a phone the launcher takes the page on 新對話 and when there is nothing to list; otherwise the list does.
|
|
568
|
+
const alone = launch || (rs.loaded && !rs.error && !rs.rooms.length);
|
|
569
|
+
return html`<${PanelHeader} title=${launch ? hc("newChat") : hc("chats")} />
|
|
584
570
|
${/* M-3137 (versions spec §2.3): the signed-in person whose own Fleet is behind is told here, once per sign-in. */ ""}
|
|
585
571
|
<${OlderFleetBanner} client=${hubClient()} signIn=${s?.csrf || ""} />
|
|
586
|
-
<div class=${`hub-home${
|
|
572
|
+
<div class=${`hub-home${alone ? " is-launch" : ""}`}>
|
|
587
573
|
<div class="hub-home-list"><${HubHomeList} /></div>
|
|
588
|
-
|
|
589
|
-
: html`<div class="hub-home-pick center">${!rs.loaded ? html`<${Skeleton} variant="rows" lines=${4} />` : rs.error && !rs.rooms.length ? html`<${ErrorState} message=${rs.error} onRetry=${refreshRooms} />` : !rs.rooms.length
|
|
590
|
-
? html`<${Empty} icon="chat" title=${hc("noChats")} />`
|
|
591
|
-
: html`<${Empty} icon="chat" title=${hc("choose")} hint=${hc("chooseHint")} />`}</div>`}
|
|
592
|
-
${picking ? html`<${NewChatDialog} onClose=${() => setPicking(false)} />` : null}
|
|
574
|
+
<div class="hub-home-pick hub-home-launch">${rs.error && !rs.rooms.length ? html`<${ErrorState} message=${rs.error} onRetry=${refreshRooms} />` : html`<${ChatLauncher} />`}</div>
|
|
593
575
|
</div>`;
|
|
594
576
|
}
|
|
595
577
|
|
|
578
|
+
/**
|
|
579
|
+
* M-3190: the launcher — one centred column, 「今天想找哪位 Agent?」, one row per agent this person can talk to: shared with them
|
|
580
|
+
* (one-to-one), the Hub's own (the assistant's chat) and the agents in their rooms (the five most recent rooms, read from each
|
|
581
|
+
* room's members); a row opens (or reopens) its chat or room. With no agent shared directly, a compact card says the next step.
|
|
582
|
+
* On a Hub with group permissions the welcome's frame adds its notes and the Fleet status line (hub-welcome.js).
|
|
583
|
+
*/
|
|
584
|
+
function ChatLauncher() {
|
|
585
|
+
const s = useSession(), rs = useRooms();
|
|
586
|
+
const [cat, reloadCat] = useRead(() => hubClient().catalog());
|
|
587
|
+
const [inRooms, setInRooms] = useState([]);
|
|
588
|
+
const [q, setQ] = useState(""), [busy, setBusy] = useState(false), [msg, setMsg] = useState(null), [newRoom, setNewRoom] = useState(false);
|
|
589
|
+
const groups = rs.rooms.filter((r) => r.kind === "group" && !r.archived).sort((a, b) => (b.lastAt || 0) - (a.lastAt || 0)).slice(0, 5);
|
|
590
|
+
const groupKey = groups.map((r) => r.id).join(",");
|
|
591
|
+
useEffect(() => {
|
|
592
|
+
let live = true;
|
|
593
|
+
if (typeof hubClient().room !== "function") return undefined;
|
|
594
|
+
Promise.all(groups.map((r) => hubClient().room(r.id).then((d) => (d && Array.isArray(d.members) ? d.members : [])
|
|
595
|
+
.filter((m) => m && m.kind === "agent" && !m.mine).map((m) => ({ key: `room:${r.id}:${m.id}`, name: m.name || "", sub: hc("launchInRoom", r.name), href: roomPath(r.id) })), () => [])))
|
|
596
|
+
.then((all) => { if (live) setInRooms(all.flat()); });
|
|
597
|
+
return () => { live = false; };
|
|
598
|
+
}, [groupKey]);
|
|
599
|
+
const askable = cat && Array.isArray(cat.askable) ? cat.askable : [];
|
|
600
|
+
const open = async (it) => {
|
|
601
|
+
if (busy) return;
|
|
602
|
+
setBusy(true); setMsg(null);
|
|
603
|
+
const r = await hubClient().openRoom(it.exposure.id, it.grant.id);
|
|
604
|
+
setBusy(false);
|
|
605
|
+
if (!r.ok) { setMsg(errText(r)); return; }
|
|
606
|
+
await refreshRooms(); navigate(roomPath(r.room.id));
|
|
607
|
+
};
|
|
608
|
+
const chats = rs.rooms.filter((r) => r.kind !== "group" && !r.archived);
|
|
609
|
+
const shownIn = new Set(chats.map((r) => (r.legacy || r.agent || {}).exposureId).filter(Boolean));
|
|
610
|
+
const rows = [
|
|
611
|
+
...chats.map((r) => ({ key: r.id, name: r.assistant ? hroom("hubAssistant") : r.name, sub: r.assistant ? hroom("providedByHub") : r.agent?.owner?.name ? hc("launchOwner", r.agent.owner.name) : "",
|
|
612
|
+
href: roomPath(r.id), online: r.assistant ? (r.presence || "idle") !== "unavailable" : r.agent?.presence === "online" })),
|
|
613
|
+
...askable.filter((it) => !shownIn.has(it.exposure.id)).map((it) => ({ key: it.grant.id, name: it.exposure.displayName, sub: hc("launchOwner", it.ownerName || "—"), ask: it })),
|
|
614
|
+
...inRooms,
|
|
615
|
+
];
|
|
616
|
+
const needle = q.trim().toLowerCase();
|
|
617
|
+
const shown = rows.filter((r) => !needle || `${r.name} ${r.sub}`.toLowerCase().includes(needle));
|
|
618
|
+
const go = (e, r) => { if (r.ask) { e.preventDefault(); void open(r.ask); return; } if (e.metaKey || e.ctrlKey) return; e.preventDefault(); navigate(r.href); };
|
|
619
|
+
const list = html`<h2 class="hub-launch-title">${hc("launchTitle")}</h2>
|
|
620
|
+
${rows.length > 8 ? html`<label class="field hub-launch-filter"><span class="sr-only">${hc("launchFilter")}</span><input type="search" placeholder=${hc("launchFilter")} value=${q} onInput=${(e) => setQ(e.target.value)} /></label>` : null}
|
|
621
|
+
${!cat || !rs.loaded ? html`<${Skeleton} variant="rows" lines=${3} />` : html`<div class="hub-launch-rows" role="list">${shown.map((r) => html`<a key=${r.key} role="listitem" class="hub-launch-row"
|
|
622
|
+
href=${r.href || NEW_CHAT_PATH} aria-disabled=${r.ask && busy ? "true" : undefined} onClick=${(e) => go(e, r)}>
|
|
623
|
+
<span class="hub-launch-av"><${Avatar} name=${r.name} />${r.online ? html`<span class="dot ok" aria-hidden="true"></span>` : null}</span>
|
|
624
|
+
<span class="hub-launch-text"><strong>${r.name}</strong><small>${r.sub}</small></span><span class="hub-launch-go" aria-hidden="true">${hc("launchGo")}</span></a>`)}</div>
|
|
625
|
+
${rows.length && !shown.length ? html`<p class="note">${hc("launchNoMatch")}</p>` : null}`}
|
|
626
|
+
${cat && cat.error ? html`<${ErrorState} message=${cat.error} onRetry=${reloadCat} />` : null}
|
|
627
|
+
${cat && !cat.error && !askable.length ? html`<section class="hub-launch-empty" data-launch="none-shared"><strong><${Icon} name="chat" size=${18} />${hc("launchNone")}</strong>
|
|
628
|
+
<p>${hc("launchNoneHint")}</p>
|
|
629
|
+
<div class="hub-launch-actions">${roomsLive() && rs.me?.canCreateRooms ? html`<button type="button" class="btn btn-primary hub-launch-pill" onClick=${() => setNewRoom(true)}><${Icon} name="room" size=${16} />${hc("launchNewRoom")}</button>` : null}
|
|
630
|
+
<a class="btn hub-launch-pill" href="/ui/hub/exposures" onClick=${(e) => { if (e.metaKey || e.ctrlKey) return; e.preventDefault(); navigate("/ui/hub/exposures"); }}><${Icon} name="globe" size=${16} />${hc("launchShare")}</a></div></section>` : null}
|
|
631
|
+
${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
|
|
632
|
+
${newRoom ? html`<${LazyRoomPart} load=${() => import("./hub-room-new.js")} name="NewRoomDialog" props=${{ client: hubClient(), assistant: !!rs.me?.assistant,
|
|
633
|
+
onClose: () => setNewRoom(false), onOpenRoom: (rid) => { setNewRoom(false); void refreshRooms(); navigate(roomPath(rid)); } }} />` : null}`;
|
|
634
|
+
return html`<div class="hub-launch">${groupPolicyOn(s, hubClient())
|
|
635
|
+
? html`<${LazyGroups} pick=${(m) => m.ChatLauncherFrame || (({ children }) => children)} props=${{ admin: s.admin === true, features: s.features, children: list }} />` : list}</div>`;
|
|
636
|
+
}
|
|
637
|
+
|
|
596
638
|
const RAIL_KEY = "agend_hub_context";
|
|
597
639
|
const railOpen = () => { try { return localStorage.getItem(RAIL_KEY) !== "0"; } catch { return true; } };
|
|
598
640
|
const setRailPref = (open) => { try { localStorage.setItem(RAIL_KEY, open ? "1" : "0"); } catch { /* not remembered */ } };
|
|
@@ -921,6 +963,8 @@ function HubMine() {
|
|
|
921
963
|
// Nothing shared yet: the empty state below says where to share from, so the lead doesn't say it too (Argon #20).
|
|
922
964
|
return html`<div class="col hub-owner"><${OlderFleetBanner} client=${hubClient()} signIn=${session?.csrf || ""} /><p class="s-page-lead hub-page-lead">${ho(cat && !cat.error && !mine.length ? "mineLeadShort" : "mineLead")}</p>
|
|
923
965
|
<div class="s-section-layout">
|
|
966
|
+
${/* M-3190: 「我的 Fleet」 moved here from 對話 — the person's Fleets and the steps to connect one. */ ""}
|
|
967
|
+
${groupPolicyOn(session, hubClient()) ? html`<${LazyGroups} pick=${(m) => m.MyFleetsCard || (() => null)} props=${{ quick: session.features.includes("quick-pairing-v1"), admin: session.admin === true, features: session.features }} />` : null}
|
|
924
968
|
${roomsLive() ? html`<${LazyRoomPart} load=${() => import("./hub-invitations.js")} name="InvitationsList" props=${{ client: hubClient(), heading: true }} />` : null}
|
|
925
969
|
${msg ? html`<p class="err" role="alert">${msg}</p>` : null}
|
|
926
970
|
${!pairings ? html`<${Skeleton} lines=${2} />` : pairings.error ? html`<${ErrorState} message=${pairings.error} onRetry=${reloadPairings} />` : null}
|
package/dist/ui/panel-log.js
CHANGED
|
@@ -20,6 +20,7 @@ import { useLease } from "/assets/app-ctx.js";
|
|
|
20
20
|
import * as paneContext from "/assets/app-ctx.js";
|
|
21
21
|
import { PanelHeader, setTitle, statusClass, statusLabel, openDrawer } from "/assets/app-shell.js";
|
|
22
22
|
import { InstanceSwitch } from "/assets/instance-switch.js";
|
|
23
|
+
import { AgentSheetButton, usePhone } from "/assets/agent-sheet.js";
|
|
23
24
|
import { HeaderSlot, HeaderTools } from "/assets/header-tools.js";
|
|
24
25
|
import { Empty, ErrorState, Skeleton } from "/assets/ui-states.js";
|
|
25
26
|
import { toast } from "/assets/ui-toast.js";
|
|
@@ -119,6 +120,7 @@ export function LogPanel({ route, navKey }) {
|
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
function LogView({ name, inst, navKey, exec, awaiting }) {
|
|
123
|
+
const phone = usePhone(); // M-3166 PR 5: a phone's header is "← name ● ⋯" (the ⋯ sheet holds the rest)
|
|
122
124
|
const lease = useLease(`log:${name}`);
|
|
123
125
|
const [state, setState] = useState({ phase: "loading" }); // loading | off | on | failed
|
|
124
126
|
const [steps, setSteps] = useState([]);
|
|
@@ -284,7 +286,7 @@ function LogView({ name, inst, navKey, exec, awaiting }) {
|
|
|
284
286
|
${["all", "tools", "errors"].map((k) => html`<button key=${k} type="button" class=${`chip-btn${filter === k ? " on" : ""}`} aria-pressed=${filter === k ? "true" : "false"} onClick=${() => setFilter(k)}>${tl(k)}</button>`)}
|
|
285
287
|
<span class="grow"></span><span class="log-live" title=${tl("live")}><span class="dot running" aria-hidden="true"></span>${tl("live")}</span></div>` : null;
|
|
286
288
|
return html`<div data-effect-panel="log" class="panel p-log">
|
|
287
|
-
<${PanelHeader} title=${name} sub=${sub} pageControls=${{ navKey }} nav=${html`<${InstanceSwitch} name=${name} current="log" />`}><${HeaderTools} navKey=${navKey} /><${HeaderSlot}
|
|
289
|
+
<${PanelHeader} title=${name} sub=${sub} pageControls=${{ navKey }} nav=${html`<${InstanceSwitch} name=${name} current="log" />`}><${HeaderTools} navKey=${navKey} /><${HeaderSlot} />${phone ? html`<${AgentSheetButton} name=${name} inst=${inst} current="log" navKey=${navKey} />` : null}</${PanelHeader}>
|
|
288
290
|
${tools}
|
|
289
291
|
<div data-trust="panel-content" class="panel-body log-body" ref=${scroller} onScroll=${onScroll}><div class="col log-col">${content}</div></div>
|
|
290
292
|
</div>`;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M-3166 (Argon 3, the user's OK of round 2): a phone's ⋯ on an agent's pages — a bottom sheet. It began as the chat's
|
|
3
|
+
* (PR 2); PR 5 gives View, Log and Details the same header ("← name ● ⋯", no tab row), so the sheet is shared here.
|
|
4
|
+
* tiles — Chat (when not on it), View, Log (the ones you are not on), Search, Files & changes, Card, Usage
|
|
5
|
+
* rows — Model & effort and CLI backend (the chat's own commands), Text size, Appearance (the page's colour, theme,
|
|
6
|
+
* effect and activity items, in place), Agent details (when not on it), Settings (Windows)
|
|
7
|
+
* This agent — start / restart / stop / pause / wake / delete, as the page offers them
|
|
8
|
+
* ✓ Verified at the foot, when the page knows it
|
|
9
|
+
* Every entry is the page's own item or its header's own control (the header shows none of them on a phone). Static code,
|
|
10
|
+
* no data: served from /assets/ like the other shared modules (an anonymous View reader never has the sheet).
|
|
11
|
+
*/
|
|
12
|
+
import { html, useEffect, useState } from "./app-html.js";
|
|
13
|
+
import { register, t } from "./app-i18n.js";
|
|
14
|
+
import { useStore } from "./app-store.js";
|
|
15
|
+
import { navigate } from "./app-nav.js";
|
|
16
|
+
import { chatPath, detailsPath, logPath, viewPath } from "./app-route.js";
|
|
17
|
+
import { openSearch } from "./app-shell.js";
|
|
18
|
+
import { Dialog } from "./ui-dialog.js";
|
|
19
|
+
import { Icon } from "./ui-icons.js";
|
|
20
|
+
import { setTextSize, textSizeStore, TEXT_SIZES, usageOffered } from "./header-tools.js";
|
|
21
|
+
import { UsageDialog } from "./usage-dialog.js";
|
|
22
|
+
import { supportsInstanceFeature } from "./instance-nav.js";
|
|
23
|
+
|
|
24
|
+
register("agentSheet", {
|
|
25
|
+
en: { sheet: "{0}: more", search: "Search", files: "Files & changes", card: "Card", usage: "Usage", model: "Model & effort", backend: "CLI backend",
|
|
26
|
+
textSize: "Text size", textSizes: "Small,Medium,Large", look: "Appearance", agent: "This agent", details: "Agent details",
|
|
27
|
+
verifiedUntil: "Verified · speaks as you until {0}" },
|
|
28
|
+
"zh-TW": { sheet: "{0}:更多", search: "搜尋", files: "檔案與變更", card: "卡片", usage: "用量", model: "模型與推理", backend: "CLI backend",
|
|
29
|
+
textSize: "文字大小", textSizes: "小,中,大", look: "外觀", agent: "這個 Agent", details: "Agent 詳細資料",
|
|
30
|
+
verifiedUntil: "已驗證 · 以你的身分發言到 {0}" },
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// The sheet's and the phone header's styles live with the chat's (chat-work-bar.css, linked fresh: an older app.css lacks
|
|
34
|
+
// them). View, Log or Details may be the first agent page a phone opens, so the sheet links it too (once, the chat's own mark).
|
|
35
|
+
(function linkSheetCss() {
|
|
36
|
+
try {
|
|
37
|
+
if (typeof document === "undefined" || !document.head || document.querySelector('link[data-chat-work-bar-css="1"]')) return;
|
|
38
|
+
const link = document.createElement("link");
|
|
39
|
+
link.setAttribute("rel", "stylesheet"); link.setAttribute("href", "/assets/chat-work-bar.css"); link.setAttribute("data-chat-work-bar-css", "1");
|
|
40
|
+
document.head.appendChild(link);
|
|
41
|
+
} catch { /* the header keeps its desk look */ }
|
|
42
|
+
})();
|
|
43
|
+
|
|
44
|
+
/** A phone's width (the shell's own: max-width 899 px), kept current as the window is resized. */
|
|
45
|
+
export function usePhone() {
|
|
46
|
+
const read = () => typeof matchMedia === "function" && matchMedia("(max-width: 899px)").matches;
|
|
47
|
+
const [on, setOn] = useState(read);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (typeof matchMedia !== "function") return undefined;
|
|
50
|
+
const mq = matchMedia("(max-width: 899px)"), changed = () => setOn(mq.matches);
|
|
51
|
+
changed(); mq.addEventListener?.("change", changed);
|
|
52
|
+
return () => mq.removeEventListener?.("change", changed);
|
|
53
|
+
}, []);
|
|
54
|
+
return on;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The item keys that are this agent's controls (their own heading), not its appearance. */
|
|
58
|
+
const CONTROLS = ["start", "restart", "stop", "pause", "wake", "delete"];
|
|
59
|
+
/** The item keys the sheet places itself (a tile or a row of its own), never under Appearance. */
|
|
60
|
+
const PLACED = ["details", "splitChat", "settings", "workspace", "fullWidth", ...CONTROLS];
|
|
61
|
+
const untilClock = (ms) => { try { return new Date(ms).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); } catch { return ""; } };
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The header's ⋯ on a phone, and its sheet.
|
|
65
|
+
* - `current`: the page it is on ("chat" | "view" | "log" | "details") — its own tile is left out, Chat's added elsewhere
|
|
66
|
+
* - `items`: the page's own menu items (the desk's ⋯) — Files, Appearance, Agent details, Settings and This agent come from them
|
|
67
|
+
* - `chat`: the chat's own extras, or null — { card, onCard, onModel, modelText, onBackend, backendText }
|
|
68
|
+
* - `extra`: the page's own rows that are not appearance (View's help), after Agent details
|
|
69
|
+
* - `verifiedUntil`: when this browser's ✓ Verified ends (ms), or null
|
|
70
|
+
*/
|
|
71
|
+
export function AgentSheetButton({ name, inst, current, items = [], extra = [], navKey = "", chat = null, verifiedUntil = null }) {
|
|
72
|
+
const [open, setOpen] = useState(false), [usage, setUsage] = useState(false);
|
|
73
|
+
return html`<button type="button" class="icon-btn chat-sheet-more" aria-haspopup="dialog" aria-label=${t("app.more")} title=${t("app.more")} onClick=${() => setOpen(true)}><${Icon} name="more" /></button>
|
|
74
|
+
${open ? html`<${AgentSheet} name=${name} inst=${inst} current=${current} items=${items} extra=${extra} chat=${chat} verifiedUntil=${verifiedUntil}
|
|
75
|
+
onUsage=${() => { setOpen(false); setUsage(true); }} onClose=${() => setOpen(false)} />` : null}
|
|
76
|
+
${usage ? html`<${UsageDialog} owner=${navKey} onClose=${() => setUsage(false)} />` : null}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function AgentSheet({ name, inst, current, items = [], extra = [], chat = null, verifiedUntil = null, onUsage, onClose }) {
|
|
80
|
+
const [look, setLook] = useState(false);
|
|
81
|
+
const size = useStore(textSizeStore).size;
|
|
82
|
+
const by = (key) => items.find((i) => i && i.key === key);
|
|
83
|
+
const pick = (fn) => () => { onClose(); fn(); };
|
|
84
|
+
const tile = (icon, label, fn) => html`<button type="button" class="chat-sheet-tile" onClick=${pick(fn)}><${Icon} name=${icon} size=${20} /><span>${label}</span></button>`;
|
|
85
|
+
const row = (item, extra) => item ? html`<button type="button" class=${`menu-item chat-sheet-row${item.danger ? " danger" : ""}`} disabled=${!!item.disabled}
|
|
86
|
+
aria-checked=${item.checkbox ? (item.checked ? "true" : "false") : undefined} role=${item.checkbox ? "menuitemcheckbox" : undefined}
|
|
87
|
+
onClick=${() => { if (item.checkbox) item.onSelect(); else { onClose(); item.onSelect(); } }}>${item.icon ? html`<${Icon} name=${item.icon} size=${18} />` : html`<span class="chat-sheet-gap"></span>`}
|
|
88
|
+
<span>${item.label}</span>${extra || item.checkbox ? html`<small>${extra || (item.checked ? "✓" : "")}</small>` : null}</button>` : null;
|
|
89
|
+
const words = t("agentSheet.textSizes").split(","), at = Math.max(0, TEXT_SIZES.indexOf(size));
|
|
90
|
+
const looks = items.filter((i) => i && !PLACED.includes(i.key));
|
|
91
|
+
const controls = CONTROLS.map(by).filter(Boolean);
|
|
92
|
+
// Agent details: the page's own item (the chat's), else a way there from View and Log; none on Details itself.
|
|
93
|
+
const details = by("details") || (current !== "details" && supportsInstanceFeature(inst, "details")
|
|
94
|
+
? { key: "details", icon: "info", onSelect: () => navigate(detailsPath(name)) } : null);
|
|
95
|
+
return html`<${Dialog} title=${t("agentSheet.sheet", name)} onClose=${onClose} cls="chat-sheet">
|
|
96
|
+
<div class="chat-sheet-tiles">
|
|
97
|
+
${current !== "chat" ? tile("chat", t("app.chat"), () => navigate(chatPath(name))) : null}
|
|
98
|
+
${current !== "view" && supportsInstanceFeature(inst, "view") ? tile("view", t("app.view"), () => navigate(viewPath(name))) : null}
|
|
99
|
+
${current !== "log" && supportsInstanceFeature(inst, "log") ? tile("file", t("app.log"), () => navigate(logPath(name))) : null}
|
|
100
|
+
${tile("search", t("agentSheet.search"), () => openSearch({ instance: name }))}
|
|
101
|
+
${by("workspace") ? tile("diff", t("agentSheet.files"), () => by("workspace").onSelect()) : null}
|
|
102
|
+
${chat?.card ? tile("idcard", t("agentSheet.card"), () => chat.onCard()) : null}
|
|
103
|
+
${supportsInstanceFeature(inst, "usage") && usageOffered() ? html`<button type="button" class="chat-sheet-tile" onClick=${onUsage}><${Icon} name="chart" size=${20} /><span>${t("agentSheet.usage")}</span></button>` : null}
|
|
104
|
+
</div>
|
|
105
|
+
${chat?.onModel ? row({ key: "model", icon: "sliders", label: t("agentSheet.model"), onSelect: chat.onModel }, chat.modelText) : null}
|
|
106
|
+
${chat?.onBackend ? row({ key: "backend", icon: "bot", label: t("agentSheet.backend"), onSelect: chat.onBackend }, chat.backendText) : null}
|
|
107
|
+
<button type="button" class="menu-item chat-sheet-row" onClick=${() => setTextSize(TEXT_SIZES[(at + 1) % TEXT_SIZES.length])}><${Icon} name="type" size=${18} /><span>${t("agentSheet.textSize")}</span><small>${words[at] || ""}</small></button>
|
|
108
|
+
${looks.length ? html`<button type="button" class="menu-item chat-sheet-row" aria-expanded=${look ? "true" : "false"} onClick=${() => setLook((v) => !v)}><${Icon} name="palette" size=${18} /><span>${t("agentSheet.look")}</span><small>${look ? "⌃" : "⌄"}</small></button>
|
|
109
|
+
${look ? html`<div class="chat-sheet-sub">${looks.map((i) => i.heading ? html`<div key=${i.key} class="menu-heading">${i.label}</div>` : html`<span key=${i.key}>${row(i)}</span>`)}</div>` : null}` : null}
|
|
110
|
+
${row(details ? { ...details, label: t("agentSheet.details") } : null)}${row(by("settings"))}${extra.map((i) => row(i))}
|
|
111
|
+
${controls.length ? html`<div class="menu-heading chat-sheet-head">${t("agentSheet.agent")}</div>` : null}
|
|
112
|
+
${row(by("start"))}${row(by("restart"))}${row(by("stop"))}${row(by("pause"))}${row(by("wake"))}${row(by("delete"))}
|
|
113
|
+
${verifiedUntil ? html`<div class="chat-sheet-foot">✓ ${t("agentSheet.verifiedUntil", untilClock(verifiedUntil))}</div>` : null}
|
|
114
|
+
</${Dialog}>`;
|
|
115
|
+
}
|
|
@@ -350,8 +350,8 @@ function hubMarks() {
|
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
352
352
|
* The Hub workspace's sidebar — cid-hub-shell-parity (the user's approved mockup): the fleet dashboard's own, so the two
|
|
353
|
-
* read as one product (style guide rule 1). The brand
|
|
354
|
-
*
|
|
353
|
+
* read as one product (style guide rule 1). The brand: "AgEnD Hub" and, when it has one, the Hub's name on a small line under it
|
|
354
|
+
* (M-3190, Argon: it replaced the welcome's greeting on 對話); the rows, the conversation list and the foot come from the Hub's lazy
|
|
355
355
|
* module (HubSide, HubFoot). An older Hub module without them gets its HubNav and session row, or the three page links.
|
|
356
356
|
*/
|
|
357
357
|
function HubSidebar({ route }) {
|
|
@@ -361,7 +361,7 @@ function HubSidebar({ route }) {
|
|
|
361
361
|
aria-current=${tab === key ? "page" : undefined} onClick=${closeDrawer}><${Icon} name=${icon} /><span class="grow">${t(`hubShell.${key}`)}</span></a>`;
|
|
362
362
|
return html`<aside id="sidebar" class="sidebar" aria-label=${t("app.menu")}>
|
|
363
363
|
<div class="side-head" data-trust="navigation">
|
|
364
|
-
<a class="brand" href="/ui/hub"
|
|
364
|
+
<span class="side-brand"><span class="side-brand-line"><a class="brand" href="/ui/hub" onClick=${closeDrawer}>${t("hubShell.brand")}</a><span class="tag warn hub-preview-tag">${t("hubShell.preview")}</span></span>${name ? html`<small class="side-brand-name" title=${name}>${name}</small>` : null}</span>
|
|
365
365
|
<button type="button" class="icon-btn side-collapse" onClick=${toggleSidebar} aria-label=${narrow() ? t("app.closeMenu") : t("app.collapse")} title=${narrow() ? t("app.closeMenu") : t("app.collapse")} aria-controls="sidebar"><${Icon} name=${narrow() ? "close" : "sidebar"} /></button>
|
|
366
366
|
</div>
|
|
367
367
|
<${HubSideSlot} fallback=${html`<nav data-trust="navigation" class="side-nav" aria-label=${t("app.menu")}>${row("ask", "/ui/hub", "chat")}${row("exposures", "/ui/hub/exposures", "globe")}${row("admin", "/ui/hub/admin", "key")}</nav>`} />
|
|
@@ -455,7 +455,7 @@ function Sidebar({ route, onNewInstance, viewOnly }) {
|
|
|
455
455
|
const onFleet = !!route && route.panel === "fleet";
|
|
456
456
|
const overview = html`<a class=${`side-row side-overview${onFleet ? " active" : ""}`} href=${fleetEntryPath(route)}
|
|
457
457
|
aria-current=${onFleet ? "page" : undefined} onClick=${closeDrawer}><${Icon} name="org" /><span class="grow">${t("app.fleetOverview")}</span></a>`;
|
|
458
|
-
return html`<aside id="sidebar" class="sidebar" aria-label=${t("app.menu")}>
|
|
458
|
+
return html`<aside id="sidebar" class="sidebar fleet-side" aria-label=${t("app.menu")}>
|
|
459
459
|
<div class="side-head" data-trust="navigation">
|
|
460
460
|
<a class="brand" href="/ui" onClick=${closeDrawer}>${t("app.brand")}</a>
|
|
461
461
|
<button type="button" class="icon-btn side-collapse" onClick=${toggleSidebar} aria-label=${narrow() ? t("app.closeMenu") : t("app.collapse")} title=${narrow() ? t("app.closeMenu") : t("app.collapse")} aria-controls="sidebar"><${Icon} name="sidebar" /></button>
|
|
@@ -544,18 +544,19 @@ function PrefsPopover() {
|
|
|
544
544
|
* (#1523 N2): an instance page's view switch — beside the title on a wide screen, a row of tabs under it on a phone.
|
|
545
545
|
*/
|
|
546
546
|
// M-3115 (phone v2): inside an agent's pages a phone has no bottom tabs; the header's first button goes back to the
|
|
547
|
-
// agents (the drawer)
|
|
547
|
+
// agents (the drawer) — with no count since M-3166. Kept beside its caller: a retained dictionary has no such word.
|
|
548
548
|
register("phoneNav", {
|
|
549
|
-
en: { back: "Back to your agents"
|
|
550
|
-
"zh-TW": { back: "回到 Agent 清單"
|
|
549
|
+
en: { back: "Back to your agents" },
|
|
550
|
+
"zh-TW": { back: "回到 Agent 清單" },
|
|
551
551
|
});
|
|
552
552
|
/** What Needs you counts: its items and the agents' proposals (the tab's badge, the sidebar's). */
|
|
553
553
|
export function needsCount(app) { return (app.needs || []).length + (app.proposals || []).length; }
|
|
554
554
|
|
|
555
555
|
export function PanelHeader({ title, sub, children, headingRef, nav, notice, pageControls, pageActions }) {
|
|
556
556
|
const shell = useStore(shellStore);
|
|
557
|
-
const { route } = useStore(navStore)
|
|
558
|
-
|
|
557
|
+
const { route } = useStore(navStore);
|
|
558
|
+
// M-3166 (the user, round 2): no counts or badges on the Fleet side — ← goes back to the agents without a number.
|
|
559
|
+
const agent = !!openInstanceOf(route) && !guestPage();
|
|
559
560
|
const admin = useCanCreate();
|
|
560
561
|
const canCreate = admin && !!newInstanceOpener;
|
|
561
562
|
const pane = paneContext.usePane?.();
|
|
@@ -565,9 +566,9 @@ export function PanelHeader({ title, sub, children, headingRef, nav, notice, pag
|
|
|
565
566
|
pageControls=${pageControls} pageActions=${pageActions} />`;
|
|
566
567
|
return html`<header data-trust="header" class=${`panel-head${shell.collapsed ? " collapsed" : ""}`}>
|
|
567
568
|
<button type="button" id="sbOpen" class=${`icon-btn sb-open${agent ? " sb-back" : ""}`} onClick=${() => (narrow() ? openDrawer() : toggleSidebar())}
|
|
568
|
-
aria-label=${narrow() ? agent ?
|
|
569
|
+
aria-label=${narrow() ? agent ? t("phoneNav.back") : t("app.openMenu") : t("app.expand")}
|
|
569
570
|
title=${narrow() ? agent ? t("phoneNav.back") : t("app.openMenu") : t("app.expand")} aria-controls="sidebar" aria-expanded=${shell.drawer ? "true" : "false"}><${Icon} name="menu" cls="ic-menu" />${agent
|
|
570
|
-
? html`<${Icon} name="back" cls="ic-back"
|
|
571
|
+
? html`<${Icon} name="back" cls="ic-back" />` : null}</button>
|
|
571
572
|
${canCreate && shell.collapsed ? html`<button type="button" class="icon-btn sb-new" onClick=${requestNewInstance} aria-label=${t("app.newAgent")} title=${t("app.newAgent")}><${Icon} name="plus" /></button>` : null}
|
|
572
573
|
${searchOffered(admin) ? html`<button type="button" class="icon-btn sb-search" onClick=${() => openSearch()} aria-label=${t("app.search")} title=${t("app.searchTitle", searchShortcut())}><${Icon} name="search" /></button>` : null}
|
|
573
574
|
<div class="panel-title"><h1 ref=${headingRef} tabindex="-1">${title}</h1>${sub ? html`<div class="panel-sub">${sub}</div>` : null}</div>
|
|
@@ -1236,7 +1237,12 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
|
|
|
1236
1237
|
// field, or the view growing from its lowest by more than a keyboard (put away), takes it down. While an IME composes
|
|
1237
1238
|
// nothing changes at all; what the view says then is applied at compositionend — or as soon as the field it composes
|
|
1238
1239
|
// in has lost focus or left the page (a composition can end without its compositionend: #2517 review).
|
|
1239
|
-
let width = -1, tallest = 0, held = false, lowest = 0, upLowest = 0, composing = null;
|
|
1240
|
+
let width = -1, tallest = 0, held = false, lowest = 0, upLowest = 0, composing = null, downSince = 0, downTimer = 0;
|
|
1241
|
+
// beta.4 (the user, iPhone): a keystroke can move the view (the predictive or candidate bar, the caret panned into view)
|
|
1242
|
+
// so that one reading says "no keyboard" while the field still has focus. Taken at its word, the keyboard came down and
|
|
1243
|
+
// went up again on every key, and the page re-aligned each time. While the field keeps focus, "down" now has to hold
|
|
1244
|
+
// for DOWN_HOLD_MS (judged again then); leaving the field still takes it down at once.
|
|
1245
|
+
const DOWN_HOLD_MS = 300;
|
|
1240
1246
|
const coarse = () => typeof matchMedia === "function" && matchMedia("(pointer: coarse)").matches;
|
|
1241
1247
|
// M-3111 (iPhone, alpha.4): with the keyboard up, and while it rises or falls, the shell is the visible view itself —
|
|
1242
1248
|
// its height and where the browser has panned it, set on the shell itself only then (its stylesheet height otherwise:
|
|
@@ -1247,17 +1253,41 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
|
|
|
1247
1253
|
// The keyboard rises and falls over a few hundred ms, and the view's resize comes when it has settled (iOS): for that
|
|
1248
1254
|
// long after a field gains or loses focus the shell follows the view every frame — both ways — instead of jumping.
|
|
1249
1255
|
const FOLLOW_MS = 800;
|
|
1250
|
-
|
|
1256
|
+
// M-3206 (the user, iPhone, beta.5): with "down" on hold, typing still flickered. While typing, iOS reports the view a
|
|
1257
|
+
// little differently from key to key (the suggestion bar, a few px of pan) and the shell followed each reading — its
|
|
1258
|
+
// height and its place — so the box (and what is above it) moved on every key and back. Once the keyboard has settled
|
|
1259
|
+
// (past the follow window, the field still focused, the same width), the shell's height and place change only when a
|
|
1260
|
+
// new reading has held for DOWN_HOLD_MS; one that comes and goes with a keystroke moves nothing. The keyboard coming up
|
|
1261
|
+
// (the view a keyboard shorter) and a turn (a new width) are followed at once.
|
|
1262
|
+
let raf = 0, followUntil = 0, fitH = 0, fitTop = 0, fitW = -1, moveSince = 0, moveTimer = 0;
|
|
1251
1263
|
const now = () => (typeof performance !== "undefined" ? performance.now() : Date.now());
|
|
1252
1264
|
const frame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : null;
|
|
1253
1265
|
const unfit = (el) => { if (el?.style) { el.style.removeProperty("height"); el.style.removeProperty("transform"); } };
|
|
1254
1266
|
const fit = () => {
|
|
1255
1267
|
const el = root.current;
|
|
1256
1268
|
if (!el?.style) return;
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
const
|
|
1269
|
+
// While typing (a text field focused on a touch screen) the shell keeps being the view, whatever the keyboard state
|
|
1270
|
+
// says for the moment: a reading that dips must not hand the height back to the stylesheet for one frame.
|
|
1271
|
+
const typingNow = coarse() && isTextEntry(document.activeElement);
|
|
1272
|
+
const on = coarse() && (shellStore.get().keyboard || typingNow || now() < followUntil) && Math.abs((Number(vv.scale) || 1) - 1) < 0.01;
|
|
1273
|
+
if (!on) { unfit(el); fitH = 0; fitTop = 0; fitW = -1; moveSince = 0; return; }
|
|
1274
|
+
const h = Math.round(vv.height), top = Math.max(0, Math.round(Number(vv.offsetTop) || 0)), w = Math.round(vv.width);
|
|
1275
|
+
const settled = fitH && typingNow && w === fitW && now() >= followUntil;
|
|
1276
|
+
if (settled && (h !== fitH || top !== fitTop) && !(fitH - h > KEYBOARD_MIN_PX)) {
|
|
1277
|
+
if (!moveSince) moveSince = now();
|
|
1278
|
+
const left = DOWN_HOLD_MS - (now() - moveSince);
|
|
1279
|
+
if (left > 0) { // not held yet: the shell stays as it is
|
|
1280
|
+
if (!moveTimer && typeof setTimeout === "function") moveTimer = setTimeout(() => { moveTimer = 0; fit(); }, left + 20);
|
|
1281
|
+
return;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
moveSince = 0;
|
|
1285
|
+
// A reading that says "down" while the field keeps focus is on hold (below): until it holds, the shell keeps the height
|
|
1286
|
+
// it had, so the box does not drop under a keyboard that is still there.
|
|
1287
|
+
const pending = downSince && now() - downSince < DOWN_HOLD_MS && fitH;
|
|
1288
|
+
fitH = pending ? fitH : h;
|
|
1289
|
+
fitTop = top; fitW = w;
|
|
1290
|
+
el.style.setProperty("height", `${fitH}px`);
|
|
1261
1291
|
if (top) el.style.setProperty("transform", `translateY(${top}px)`); else el.style.removeProperty("transform");
|
|
1262
1292
|
};
|
|
1263
1293
|
const follow = () => {
|
|
@@ -1284,6 +1314,13 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
|
|
|
1284
1314
|
const was = shellStore.get().keyboard;
|
|
1285
1315
|
let up = held || keyboardUp(h, tallest, typing);
|
|
1286
1316
|
if (!up && was && typing && h - upLowest <= KEYBOARD_MIN_PX) up = true; // a bar's height, not the keyboard
|
|
1317
|
+
if (!up && was && typing) { // still in the field: "down" must hold
|
|
1318
|
+
if (!downSince) downSince = now();
|
|
1319
|
+
if (now() - downSince < DOWN_HOLD_MS) {
|
|
1320
|
+
up = true;
|
|
1321
|
+
if (!downTimer && typeof setTimeout === "function") downTimer = setTimeout(() => { downTimer = 0; check(); }, DOWN_HOLD_MS + 20);
|
|
1322
|
+
}
|
|
1323
|
+
} else downSince = 0;
|
|
1287
1324
|
upLowest = up ? (was ? Math.min(upLowest, h) : h) : 0;
|
|
1288
1325
|
if (up !== was) shellStore.set({ keyboard: up });
|
|
1289
1326
|
fit();
|
|
@@ -1301,6 +1338,8 @@ export function Shell({ panels, onNewInstance, viewOnly = false }) {
|
|
|
1301
1338
|
return () => {
|
|
1302
1339
|
vv.removeEventListener("resize", check); vv.removeEventListener("scroll", fit); document.removeEventListener("focusin", focusChanged); document.removeEventListener("focusout", focusChanged);
|
|
1303
1340
|
if (raf && typeof cancelAnimationFrame === "function") cancelAnimationFrame(raf);
|
|
1341
|
+
if (downTimer && typeof clearTimeout === "function") clearTimeout(downTimer);
|
|
1342
|
+
if (moveTimer && typeof clearTimeout === "function") clearTimeout(moveTimer);
|
|
1304
1343
|
unfit(root.current);
|
|
1305
1344
|
document.removeEventListener("compositionstart", start, true); document.removeEventListener("compositionend", end, true);
|
|
1306
1345
|
};
|