@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-chat.js
CHANGED
|
@@ -10,16 +10,18 @@ import { GeneralLocation } from "./general-location.js";
|
|
|
10
10
|
// that apply to its state are offered (#1408 rough edges 4 and 7).
|
|
11
11
|
import { html, Fragment, useEffect, useLayoutEffect, useRef, useState } from "/assets/app-html.js";
|
|
12
12
|
import { lang, register, t } from "/assets/app-i18n.js";
|
|
13
|
+
import { AgentSheetButton } from "/assets/agent-sheet.js";
|
|
13
14
|
import { appStore, createStore, guestPage, guestTrusted, useStore } from "/assets/app-store.js";
|
|
14
15
|
import { ComposerAuth, useWebAuthorization } from "/assets/web-authorize.js";
|
|
15
16
|
import { useLease } from "/assets/app-ctx.js";
|
|
16
17
|
import * as paneContext from "/assets/app-ctx.js";
|
|
17
18
|
import { backendLabel, modelText, namesOf, namesStore, navStore as instanceNavStore, supportsInstanceFeature } from "/assets/instance-nav.js";
|
|
18
19
|
import { machineName } from "/assets/machine-name.js";
|
|
19
|
-
import { PanelHeader, onPanelKey, setTitle, statusClass, statusLabel, openDrawer, requestNewInstance, needsCount } from "/assets/app-shell.js";
|
|
20
|
-
import { detailsPath, textLinkSegments, sectionPath, NEEDS_PATH, fleetEntryPath, settingsPath } from "/assets/app-route.js";
|
|
20
|
+
import { PanelHeader, onPanelKey, setTitle, statusClass, statusLabel, openDrawer, requestNewInstance, needsCount, openSearch } from "/assets/app-shell.js";
|
|
21
|
+
import { detailsPath, textLinkSegments, sectionPath, NEEDS_PATH, fleetEntryPath, settingsPath, viewPath, logPath } from "/assets/app-route.js";
|
|
21
22
|
import { InstanceSwitch } from "/assets/instance-switch.js";
|
|
22
|
-
import { HeaderTools } from "/assets/header-tools.js";
|
|
23
|
+
import { HeaderTools, setTextSize, textSizeStore, usageOffered, TEXT_SIZES } from "/assets/header-tools.js";
|
|
24
|
+
import { UsageDialog } from "/assets/usage-dialog.js";
|
|
23
25
|
import { navigate, navStore } from "/assets/app-nav.js";
|
|
24
26
|
import { Menu } from "/assets/ui-menu.js";
|
|
25
27
|
import { Dialog } from "/assets/ui-dialog.js";
|
|
@@ -108,7 +110,7 @@ const needKey = (item) => String(item?.nonce || item?.id || JSON.stringify(item
|
|
|
108
110
|
* count), Fleet, Settings — then this chat's items, and ends with 「✓ 已驗證」 (the line under the composer no longer
|
|
109
111
|
* says it). A Needs-you item that arrives meanwhile, for another agent, is a short toast. A desk's ⋯ is unchanged.
|
|
110
112
|
*/
|
|
111
|
-
function ChatMoreMenu({ items, name }) {
|
|
113
|
+
function ChatMoreMenu({ items, name, inst = null, card = null, navKey, lease = null }) {
|
|
112
114
|
const app = useStore(appStore);
|
|
113
115
|
const auth = useWebAuthorization();
|
|
114
116
|
const seen = useRef(null);
|
|
@@ -125,6 +127,20 @@ function ChatMoreMenu({ items, name }) {
|
|
|
125
127
|
});
|
|
126
128
|
}, [name]);
|
|
127
129
|
if (!narrowScreen()) return html`<${Menu} items=${items} label=${t("app.more")} />`;
|
|
130
|
+
// M-3166 (Argon 3, the user's OK of round 2): a phone's ⋯ is a sheet (below); its Go to went to the drawer.
|
|
131
|
+
if (inst) {
|
|
132
|
+
// The header's chips, here: the same commands, bound to this page's lease (a reply after the page moved on is dropped).
|
|
133
|
+
const run = (command) => store.runCommand(name, command, "", lease ? { alive: () => lease.current() } : {});
|
|
134
|
+
const commands = supportsInstanceFeature(inst, "commands");
|
|
135
|
+
const chat = { card: !!card, onCard: () => setChatCardOpen(!chatCardPrefs.get().open),
|
|
136
|
+
...(commands ? {
|
|
137
|
+
onModel: () => run("model"),
|
|
138
|
+
modelText: `${shortModelName(modelLabel(inst.model || modelText(inst)))}${supportsInstanceFeature(inst, "effort") && effortChip(inst) ? ` · ${effortChip(inst)}` : ""}`,
|
|
139
|
+
onBackend: () => (inst.runtime === "windows" ? navigate(sectionPath("agents")) : run("backend")), backendText: backendLabel(inst.backend),
|
|
140
|
+
} : {}) };
|
|
141
|
+
return html`<${AgentSheetButton} items=${items} name=${name} inst=${inst} current="chat" navKey=${navKey} chat=${chat}
|
|
142
|
+
verifiedUntil=${auth.st?.state === "verified" ? auth.st.until : null} />`;
|
|
143
|
+
}
|
|
128
144
|
const waiting = needsCount(app);
|
|
129
145
|
const route = navStore.get().route;
|
|
130
146
|
const verified = auth.st?.state === "verified";
|
|
@@ -604,14 +620,14 @@ function ChatView({ name, inst, lease, navKey, exec, awaiting }) {
|
|
|
604
620
|
${inst.runtime === "windows" ? html`<span class="tag">Windows</span>` : null}
|
|
605
621
|
${nativeCliTag(inst)}${inst.machine_id ? html`<span class="tag runtime-machine-tag" title=${t("chat.machineName",machineName(inst.machine_id,inst.machine_name))}>${machineName(inst.machine_id,inst.machine_name)}</span>${inst.machine_status !== "online" ? html`<span class="tag runtime-machine-offline">${t(inst.machine_status === "revoked" ? "chat.machineRevoked" : "chat.machineOffline")}</span>` : null}` : null}
|
|
606
622
|
${!guest && supportsInstanceFeature(inst,"commands") ? html`<button type="button" class="hd-chip chat-model-entry" title=${mw("backend")} aria-label=${mw("backend")} onClick=${() => inst.runtime === "windows" ? navigate(sectionPath("agents")) : pick("backend")}>${backendLabel(inst.backend)} ▾</button>
|
|
607
|
-
<button type="button" class="hd-chip chat-model-entry" title=${t("chat.chipModel", modelText(inst))} aria-label=${t("chat.chipModel", modelText(inst))} onClick=${() => pick("model")}>${modelLabel(inst.model || modelText(inst))} ▾</button>` : null}
|
|
623
|
+
<button type="button" class="hd-chip chat-model-entry" title=${t("chat.chipModel", modelText(inst))} aria-label=${t("chat.chipModel", modelText(inst))} onClick=${(e) => { noteModelMenuAnchor(e.currentTarget); pick("model"); }}>${modelLabel(inst.model || modelText(inst))} ▾</button>` : null}
|
|
608
624
|
${effortChip(inst) && supportsInstanceFeature(inst,"effort") ? html`<button type="button" class="hd-chip" title=${t("chat.chipEffort", effortChip(inst))} aria-label=${t("chat.chipEffort", effortChip(inst))} onClick=${() => pick("effort")}>${effortChip(inst)}</button>` : null}`;
|
|
609
625
|
|
|
610
626
|
return html`<div class=${`panel p-chat${wrap ? " wrap-code" : ""}`} data-width=${wide ? "full" : undefined} ref=${view}>
|
|
611
627
|
<${PanelHeader} title=${inst.runtime === "windows" ? inst.display_name || name : headerName(namesOf(inst || { name }, names.primary))} sub=${sub}
|
|
612
628
|
pageControls=${{ CardMenu, card, navKey, usage: supportsInstanceFeature(inst,"usage") }} pageActions=${[
|
|
613
629
|
...items]}
|
|
614
|
-
nav=${guest ? (guestTrusted() ? html`<${InstanceSwitch} name=${name} instance=${inst} current="chat" guest=${true} />` : null) : html`<${InstanceSwitch} name=${name} instance=${inst} current="chat" />`}><${CardMenu} card=${card} /><${HeaderTools} navKey=${navKey} usage=${supportsInstanceFeature(inst,"usage")} />${guest ? null : html`<${ChatMoreMenu} items=${items} name=${name} />`}</${PanelHeader}>
|
|
630
|
+
nav=${guest ? (guestTrusted() ? html`<${InstanceSwitch} name=${name} instance=${inst} current="chat" guest=${true} />` : null) : html`<${InstanceSwitch} name=${name} instance=${inst} current="chat" />`}><${CardMenu} card=${card} /><${HeaderTools} navKey=${navKey} usage=${supportsInstanceFeature(inst,"usage")} />${guest ? null : html`<${ChatMoreMenu} items=${items} name=${name} inst=${inst} card=${card} navKey=${navKey} lease=${lease} />`}</${PanelHeader}>
|
|
615
631
|
<${ChatCard} key=${name} name=${name} card=${card} />
|
|
616
632
|
<${AgentWidget} slot="chat_header" widget=${widgetFor(name, "chat_header")} binds=${instanceBinds(inst, exec, awaiting)} />
|
|
617
633
|
<div class="chat-split" ref=${split}>
|
|
@@ -926,16 +942,20 @@ function SubagentProgress({ name }) {
|
|
|
926
942
|
function Dock({ name, inst, lease, exec, awaiting, workingLabel, bindings, ids, focused }) {
|
|
927
943
|
useChatTick(name, ["state"]);
|
|
928
944
|
const s = store.state;
|
|
945
|
+
// M-3166 (Argon 0): a phone's one line above the box — model · effort · context, or what the agent is doing — instead of
|
|
946
|
+
// the working bar; the line under the box goes with it (its Not verified is this line's right end).
|
|
947
|
+
const metaLine = useMedia("(max-width: 899px)") && !guestPage();
|
|
929
948
|
return html`<div data-trust="composer" class="dock"><div class="dock-col">
|
|
930
949
|
<${Prompts} name=${name} />
|
|
931
950
|
<${SubagentProgress} name=${name} />
|
|
932
|
-
|
|
951
|
+
${metaLine ? html`<${ChatMetaLine} ids=${ids} name=${name} inst=${inst} lease=${lease} exec=${exec} awaiting=${awaiting} />`
|
|
952
|
+
: html`<${WorkBar} ids=${ids} name=${name} lease=${lease} exec=${exec} awaiting=${awaiting} workingLabel=${workingLabel} />`}
|
|
933
953
|
<${CommandCard} name=${name} lease=${lease} />
|
|
934
954
|
<${QuickActions} name=${name} inst=${inst} lease=${lease} />
|
|
935
955
|
${s.waking[name] ? html`<p class="send-waking" role="status">${t("chat.waking", name)}</p>` : null}
|
|
936
956
|
<${Composer} name=${name} inst=${inst} bindings=${bindings} ids=${ids} focused=${focused} label=${composerLabel(inst, name)} lease=${lease} busy=${R().isBusy(exec)} />
|
|
937
|
-
|
|
938
|
-
class="hint" title=${t(guestPage() || !supportsInstanceFeature(inst,"commands") ? "chat.guestMore" : "chat.composerMore")}>${t(supportsInstanceFeature(inst,"commands") ? touchScreen() ? "chat.composerHintTouch" : "chat.composerHint" : touchScreen() ? "chat.nativeComposerHintTouch" : "chat.nativeComposerHint")}</span></div
|
|
957
|
+
${metaLine ? null : html`<div class="composer-row">${guestPage() ? html`<span class="guest-note" title=${t("chat.guestNote")}>${t("chat.guestNote")}</span>` : html`<${ComposerAuth} />`}<span
|
|
958
|
+
class="hint" title=${t(guestPage() || !supportsInstanceFeature(inst,"commands") ? "chat.guestMore" : "chat.composerMore")}>${t(supportsInstanceFeature(inst,"commands") ? touchScreen() ? "chat.composerHintTouch" : "chat.composerHint" : touchScreen() ? "chat.nativeComposerHintTouch" : "chat.nativeComposerHint")}</span></div>`}
|
|
939
959
|
</div></div>`;
|
|
940
960
|
}
|
|
941
961
|
|
|
@@ -947,6 +967,115 @@ function openBackendSignIn(backend) {
|
|
|
947
967
|
}
|
|
948
968
|
|
|
949
969
|
/** #1269: what the last chat command answered — its text, why it was refused, or a list to choose from. */
|
|
970
|
+
// M-3166 PR 3: the model menu's words (kept beside their caller: a retained chat dictionary has no such words).
|
|
971
|
+
register("modelMenu", {
|
|
972
|
+
en: { title: "Model", effort: "Reasoning effort", loading: "Loading models…", opus: "Most capable, for complex and long work",
|
|
973
|
+
sonnet: "Fast and capable, for everyday work", haiku: "Fastest, for simple and high-volume work", close: "Close" },
|
|
974
|
+
"zh-TW": { title: "模型", effort: "推理強度", loading: "正在讀取模型…", opus: "最強,適合複雜、長時間的工作",
|
|
975
|
+
sonnet: "速度與品質兼顧,適合日常工作", haiku: "最快,適合簡單、大量的工作", close: "關閉" },
|
|
976
|
+
});
|
|
977
|
+
const mm = (key, ...args) => t(`modelMenu.${key}`, ...args);
|
|
978
|
+
/** Where the model control that opened the menu is (a desk anchors the menu under it); null: under the box's left end. */
|
|
979
|
+
let modelMenuAnchor = null, modelMenuOpener = null;
|
|
980
|
+
/** The control that opens the menu: where it sits (the menu goes by it) and itself (focus goes back to it on close, M-3192). */
|
|
981
|
+
export function noteModelMenuAnchor(el) {
|
|
982
|
+
try { modelMenuAnchor = el ? el.getBoundingClientRect() : null; } catch { modelMenuAnchor = null; }
|
|
983
|
+
modelMenuOpener = el || null;
|
|
984
|
+
}
|
|
985
|
+
/** A model's one line: its family's (Opus / Sonnet / Haiku), else its own id when the name doesn't say it. */
|
|
986
|
+
function modelDescription(o, name) {
|
|
987
|
+
const s = `${o.id} ${o.label}`;
|
|
988
|
+
const family = /\bopus\b|claude-opus/i.test(s) ? "opus" : /\bsonnet\b|claude-sonnet/i.test(s) ? "sonnet" : /\bhaiku\b|claude-haiku/i.test(s) ? "haiku" : "";
|
|
989
|
+
if (o.disabled) return String(o.disabled);
|
|
990
|
+
if (family) return mm(family);
|
|
991
|
+
return o.id && o.id !== name ? o.id : "";
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* M-3166 PR 3 (the user's OK of round 2): /model as a menu. One row per model — its name and one line, ✓ on the current
|
|
995
|
+
* one; "More models" in place; the current model's reasoning effort as one segmented row; Refresh in the head. Picking a
|
|
996
|
+
* model or an effort runs the same commands the card ran (its result then shows as the card does). A failed Refresh says
|
|
997
|
+
* so in the menu and keeps the list (M-2731); a refused switch (no list with it) is the card's.
|
|
998
|
+
*/
|
|
999
|
+
function ModelMenu({ name, c, lease }) {
|
|
1000
|
+
const narrow = useMedia("(max-width: 899px)");
|
|
1001
|
+
const close = () => store.dismissCommand(name);
|
|
1002
|
+
const alive = () => lease.current();
|
|
1003
|
+
const run = (args, action) => store.runCommand(name, "model", args, { alive, ...(action ? { action } : {}) });
|
|
1004
|
+
// The control that opened it is this opening's only: gone with the menu, a later typed /model is placed by the box.
|
|
1005
|
+
// M-3192: on a desk, focus goes back where it came from when the menu closes — that control, else the box (a typed /model).
|
|
1006
|
+
useEffect(() => () => {
|
|
1007
|
+
const back = modelMenuOpener;
|
|
1008
|
+
modelMenuAnchor = null; modelMenuOpener = null;
|
|
1009
|
+
if (narrow || typeof document === "undefined") return;
|
|
1010
|
+
const inMenu = !document.activeElement || document.activeElement === document.body || !!document.activeElement.closest?.(".model-menu-pop");
|
|
1011
|
+
if (!inMenu) return; // the person moved on (clicked elsewhere): leave their focus be
|
|
1012
|
+
const to = back && back.isConnected !== false ? back : document.getElementById("msgIn");
|
|
1013
|
+
try { to?.focus?.(); } catch { /* gone */ }
|
|
1014
|
+
}, []);
|
|
1015
|
+
const pop = useRef(null);
|
|
1016
|
+
// M-3192: a desk's menu takes the keyboard — focus on the model in use (else the first), ↑ ↓ Home End move between its
|
|
1017
|
+
// buttons (rows, More, the effort row), Enter picks (they are buttons), Escape closes, Tab goes on as anywhere.
|
|
1018
|
+
const items = () => [...(pop.current?.querySelectorAll(".model-menu button:not([disabled])") || [])];
|
|
1019
|
+
useEffect(() => {
|
|
1020
|
+
if (narrow || !pop.current || pop.current.contains(document.activeElement)) return;
|
|
1021
|
+
const first = pop.current.querySelector(".model-menu-row.on:not([disabled])") || items()[0];
|
|
1022
|
+
try { first?.focus?.(); } catch { /* none */ }
|
|
1023
|
+
}, [narrow, c.choices?.options?.length || 0, !!c.busy]);
|
|
1024
|
+
const onKeys = (e) => {
|
|
1025
|
+
if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key)) return;
|
|
1026
|
+
const list = items(); if (!list.length) return;
|
|
1027
|
+
e.preventDefault();
|
|
1028
|
+
const at = list.indexOf(document.activeElement);
|
|
1029
|
+
const next = e.key === "Home" ? 0 : e.key === "End" ? list.length - 1
|
|
1030
|
+
: e.key === "ArrowDown" ? (at + 1) % list.length : (at <= 0 ? list.length - 1 : at - 1);
|
|
1031
|
+
try { list[next].focus(); } catch { /* gone */ }
|
|
1032
|
+
};
|
|
1033
|
+
const options = c.choices?.options || [], current = c.choices?.current ?? null, actions = c.choices?.actions || [];
|
|
1034
|
+
const refresh = actions.find((a) => a === "refresh" || a === "refreshAll");
|
|
1035
|
+
const cur = options.find((o) => o.id === current && o.effort);
|
|
1036
|
+
useEffect(() => {
|
|
1037
|
+
if (narrow) return undefined;
|
|
1038
|
+
const esc = (e) => { if (e.key === "Escape") { e.stopPropagation(); close(); } };
|
|
1039
|
+
document.addEventListener("keydown", esc, true);
|
|
1040
|
+
return () => document.removeEventListener("keydown", esc, true);
|
|
1041
|
+
}, [narrow]);
|
|
1042
|
+
const rows = options.filter((o) => !o.signIn).map((o) => {
|
|
1043
|
+
const label = String(o.label || o.id).replace(/^✓\s*/, ""), short = shortModelName(modelLabel(label)), on = o.id === current;
|
|
1044
|
+
const desc = modelDescription(o, short);
|
|
1045
|
+
return html`<button key=${o.id} type="button" role="menuitemradio" aria-checked=${on ? "true" : "false"} class=${`model-menu-row${on ? " on" : ""}`}
|
|
1046
|
+
disabled=${c.busy || !!o.disabled} title=${label} onClick=${() => (on ? close() : run(o.id))}>
|
|
1047
|
+
<span class="model-menu-text"><b>${short}</b>${desc ? html`<small>${desc}</small>` : null}</span>${on ? html`<${Icon} name="check" size=${18} />` : null}</button>`;
|
|
1048
|
+
});
|
|
1049
|
+
const body = html`<div class="model-menu" role="menu" aria-label=${mm("title")}>
|
|
1050
|
+
${narrow ? null : html`<div class="model-menu-head"><span>${mm("title")}</span>${refresh ? html`<button type="button" class="icon-btn" data-model-action=${refresh} title=${mw("refresh")}
|
|
1051
|
+
aria-label=${mw("refresh")} disabled=${c.busy} onClick=${() => run(c.choices.args || "", refresh)}><${Icon} name="restart" size=${16} /></button>` : null}</div>`}
|
|
1052
|
+
${c.error ? html`<p class="err model-menu-error" role="alert">${c.error}</p>` : null}
|
|
1053
|
+
${c.busy && !options.length ? html`<p class="note model-menu-loading" role="status">${mm("loading")}</p>` : rows}
|
|
1054
|
+
${actions.includes("more") ? html`<button type="button" class="model-menu-more" data-model-action="more" disabled=${c.busy} onClick=${() => run("", "more")}>${mw("more")}</button>` : null}
|
|
1055
|
+
${cur ? html`<div class="model-menu-label">${mm("effort")}</div>
|
|
1056
|
+
<div class="model-menu-seg" role="group" aria-label=${mm("effort")}>${cur.effort.levels.map((level) => html`<button key=${level} type="button"
|
|
1057
|
+
class=${level === cur.effort.current ? "on" : ""} aria-pressed=${level === cur.effort.current ? "true" : "false"} disabled=${c.busy}
|
|
1058
|
+
onClick=${() => store.runCommand(name, "effort", level, { alive })}>${effortWord(level)}</button>`)}</div>` : null}
|
|
1059
|
+
${options.some((o) => o.signIn) && !publicLinkPage() ? html`<div class="model-menu-signin">${options.filter((o) => o.signIn).map((o) => html`<button
|
|
1060
|
+
key=${`signin:${o.signIn}`} type="button" class="btn btn-sm btn-primary" onClick=${() => openBackendSignIn(o.signIn)}>${t("chat.cmdSignInTo", o.signIn)}</button>`)}</div>` : null}
|
|
1061
|
+
</div>`;
|
|
1062
|
+
if (narrow) return html`<${Dialog} title=${mm("title")} onClose=${close} cls="model-menu-sheet"
|
|
1063
|
+
tools=${refresh ? html`<button type="button" class="icon-btn" data-model-action=${refresh} title=${mw("refresh")} aria-label=${mw("refresh")} disabled=${c.busy}
|
|
1064
|
+
onClick=${() => run(c.choices.args || "", refresh)}><${Icon} name="restart" size=${16} /></button>` : null}>${body}</${Dialog}>`;
|
|
1065
|
+
// A desk: under the control that opened it (else above the box's left end); a click outside closes it.
|
|
1066
|
+
const place = (el) => {
|
|
1067
|
+
if (!el) return;
|
|
1068
|
+
const at = modelMenuAnchor, w = el.offsetWidth || 320, h = el.offsetHeight || 0;
|
|
1069
|
+
const vw = globalThis.innerWidth || 1280, vh = globalThis.innerHeight || 800; // (a test DOM has no viewport)
|
|
1070
|
+
let left, top;
|
|
1071
|
+
// Under the control, or above it when it sits in the lower half (the composer's chip): never over it.
|
|
1072
|
+
if (at) { left = Math.min(Math.max(8, at.right - w), vw - w - 8); top = at.top > vh / 2 ? Math.max(8, at.top - h - 6) : Math.min(at.bottom + 6, vh - h - 8); }
|
|
1073
|
+
else { const box = el.closest(".p-chat")?.querySelector(".composer-box")?.getBoundingClientRect(); left = box ? box.left : 16; top = box ? Math.max(8, box.top - h - 8) : 72; }
|
|
1074
|
+
el.style.setProperty("left", `${Math.round(left)}px`); el.style.setProperty("top", `${Math.round(top)}px`);
|
|
1075
|
+
};
|
|
1076
|
+
return html`<div class="model-menu-scrim" onClick=${close}></div><div class="model-menu-pop" ref=${(el) => { pop.current = el; place(el); }} onKeyDown=${onKeys}>${body}</div>`;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
950
1079
|
function CommandCard({ name, lease }) {
|
|
951
1080
|
const c = store.state.commands[name];
|
|
952
1081
|
if (!c) return null;
|
|
@@ -955,6 +1084,11 @@ function CommandCard({ name, lease }) {
|
|
|
955
1084
|
const refresh = actions.find(a => a === "refresh" || a === "refreshAll");
|
|
956
1085
|
// The phone's second level: a /model option with an `effort` (its levels and the one set) opens its own list, with a way back.
|
|
957
1086
|
const [sub, setSub] = useState(null);
|
|
1087
|
+
// M-3166 PR 3 (the user's OK of round 2): /model's pick list is a menu — anchored under the model control on a desk, a
|
|
1088
|
+
// bottom sheet on a phone — not a card above the box. A failure, its result text and /backend stay the card.
|
|
1089
|
+
// The menu is /model's list: shown with its choices, or while that list loads. A model being switched to (a pick from the
|
|
1090
|
+
// menu, a typed "/model <id>") is the card's, as before (#4003 review).
|
|
1091
|
+
if (c.command === "model" && (c.choices ? c.choices.step !== "backend" : c.busy && !c.error && !c.args)) return html`<${ModelMenu} name=${name} c=${c} lease=${lease} />`;
|
|
958
1092
|
const open = sub && sub.for === c.choices ? c.choices.options.find((o) => o.id === sub.id && o.effort) : null;
|
|
959
1093
|
const pickEffort = async (model, level) => {
|
|
960
1094
|
setSub(null);
|
|
@@ -1042,6 +1176,40 @@ function PromptText({ p, action }) {
|
|
|
1042
1176
|
* #3724: the strip is always there — idle it keeps its height and shows nothing (no button), so a state change only changes
|
|
1043
1177
|
* what is inside it and never moves the thread or the composer (chat-work-bar.css fixes the height; long text stays one line).
|
|
1044
1178
|
*/
|
|
1179
|
+
/**
|
|
1180
|
+
* M-3166 (Argon 0, the user's OK of round 2): a phone's meta line above the box, 26 px, 12 px text. Left: the model, its
|
|
1181
|
+
* effort and the context ("Opus 5.5 · high · 56%", which opens the model's pick list) — or, while the agent is busy, what it
|
|
1182
|
+
* is doing and for how long ("處理中 0:12 · 56%"). Right: Not verified · Authorize (and its other states) only while this
|
|
1183
|
+
* browser is not verified; while the agent works with something typed, Stop (Send sends again). Hit targets ≥ 32 px.
|
|
1184
|
+
*/
|
|
1185
|
+
function ChatMetaLine({ name, inst, lease, exec, awaiting, ids = {} }) {
|
|
1186
|
+
const s = store.state, busy = R().isBusy(exec) ? exec : "";
|
|
1187
|
+
const kind = awaiting != null ? "awaiting" : s.stopping[name] && busy ? "stopping" : busy;
|
|
1188
|
+
const [, tick] = useState(0);
|
|
1189
|
+
useEffect(() => {
|
|
1190
|
+
if (!kind || kind === "awaiting") return undefined;
|
|
1191
|
+
const h = lease.interval(() => tick((n) => n + 1), 1000);
|
|
1192
|
+
return () => lease.clear(h);
|
|
1193
|
+
}, [kind, lease]);
|
|
1194
|
+
const pct = inst?.context_pct == null ? null : Math.round(inst.context_pct);
|
|
1195
|
+
const since = s.workingSince[name];
|
|
1196
|
+
const tail = pct != null ? ` · ${pct}%` : "";
|
|
1197
|
+
const commands = supportsInstanceFeature(inst, "commands");
|
|
1198
|
+
const model = shortModelName(modelLabel(inst?.model || modelText(inst || {})));
|
|
1199
|
+
const effort = supportsInstanceFeature(inst, "effort") ? effortChip(inst || {}) : "";
|
|
1200
|
+
const doing = kind ? `${t(kind === "stuck" ? "chat.metaStuck" : kind === "stopping" ? "chat.metaStopping" : kind === "awaiting" ? "chat.metaAwaiting" : "chat.metaWorking")}${
|
|
1201
|
+
kind !== "awaiting" && since != null ? ` ${R().formatElapsed(performance.now() - since)}` : ""}` : "";
|
|
1202
|
+
const run = (command) => store.runCommand(name, command, "", { alive: () => lease.current() });
|
|
1203
|
+
const label = `${model}${effort ? ` · ${effort}` : ""}`;
|
|
1204
|
+
return html`<div class=${`chat-meta${kind ? ` busy ${kind}` : ""}`} data-trust="status" role="status">
|
|
1205
|
+
${kind ? html`<span class="chat-meta-left"><span class="chat-meta-dot" aria-hidden="true"></span><span>${doing}${tail}</span></span>`
|
|
1206
|
+
: commands ? html`<button type="button" class="chat-meta-left chat-meta-model" title=${t("chat.chipModel", label)} aria-label=${t("chat.chipModel", label)}
|
|
1207
|
+
onClick=${() => (inst?.runtime === "windows" ? navigate(sectionPath("agents")) : run("model"))}><span>${label}${tail}</span><span class="chev" aria-hidden="true">⌄</span></button>`
|
|
1208
|
+
: html`<span class="chat-meta-left"><span>${label}${tail}</span></span>`}
|
|
1209
|
+
<span class="chat-meta-right">${busy ? html`<button type="button" id=${ids.stopBtn || "stopBtn"} class="chat-meta-stop btn-stop" disabled=${!!s.cancelling[name]} title=${t("chat.stopReplyTitle")}
|
|
1210
|
+
onClick=${() => store.cancelReply(name)}>${t("chat.stopReply")}</button>` : null}<${ComposerAuth} /></span>
|
|
1211
|
+
</div>`;
|
|
1212
|
+
}
|
|
1045
1213
|
function WorkBar({ name, lease, exec, awaiting, workingLabel, ids }) {
|
|
1046
1214
|
const s = store.state;
|
|
1047
1215
|
const busy = R().isBusy(exec) ? exec : "";
|
|
@@ -1171,7 +1339,7 @@ function Composer({ name, inst, label = name, lease, busy, bindings, ids = {}, f
|
|
|
1171
1339
|
onKeyDown=${onKeyDown} onPaste=${onPaste} controls=${palette ? paletteId : undefined} expanded=${!!palette} activeDescendant=${pick ? optId(pick) : undefined}
|
|
1172
1340
|
attach=${attachmentsSupported ? { title: t("chat.attachTitle"), onFiles: (list) => store.addFiles(name, list) } : null}
|
|
1173
1341
|
stop=${HIDDEN_STOP}
|
|
1174
|
-
tools=${toolsHere && !guestPage() ? html`<${ComposerTools} name=${name} inst=${inst} lease=${lease} short=${
|
|
1342
|
+
tools=${toolsHere && !narrow && !guestPage() ? html`<${ComposerTools} name=${name} inst=${inst} lease=${lease} short=${true} />` : null}
|
|
1175
1343
|
send=${stopNow ? { hidden: false, stop: true, disabled: !!s.cancelling[name], label: t("chat.stopReply"), title: t("chat.stopReplyTitle"), onClick: () => store.cancelReply(name) }
|
|
1176
1344
|
: { hidden: false, disabled: !content || sendingBlocked, label: t("chat.send"), onClick: submit }} />
|
|
1177
1345
|
</div>`;
|
|
@@ -1194,7 +1362,7 @@ function ComposerTools({ name, inst, lease, short = false }) {
|
|
|
1194
1362
|
${pct != null && pct >= 50 ? html`<button type="button" class=${`ctx-ring${pct >= 70 ? " warn" : ""}`} ref=${(el) => el?.style?.setProperty("--pct", String(pct))}
|
|
1195
1363
|
title=${t("chat.chipContext", pct)} aria-label=${t("chat.chipContext", pct)} onClick=${() => run("ctx")}><span class="ctx-dial" aria-hidden="true"><span class="ctx-pct">${pct}</span></span></button>` : null}
|
|
1196
1364
|
${supportsInstanceFeature(inst, "commands") ? html`<button type="button" class="composer-pick" title=${t("chat.chipModel", pickLabel)} aria-label=${t("chat.chipModel", pickLabel)}
|
|
1197
|
-
onClick=${() => (inst?.runtime === "windows"
|
|
1365
|
+
onClick=${(e) => { if (inst?.runtime === "windows") navigate(sectionPath("agents")); else { noteModelMenuAnchor(e.currentTarget); run("model"); } }}><b>${model}</b><span class="chev" aria-hidden="true">⌄</span></button>` : null}
|
|
1198
1366
|
</span>`;
|
|
1199
1367
|
}
|
|
1200
1368
|
|
package/dist/ui/panel-details.js
CHANGED
|
@@ -18,6 +18,7 @@ import { PanelHeader, setTitle, statusClass, statusLabel, openDrawer } from "/as
|
|
|
18
18
|
import { navigate } from "/assets/app-nav.js";
|
|
19
19
|
import { chatPath, detailsPath } from "/assets/app-route.js";
|
|
20
20
|
import { InstanceSwitch } from "/assets/instance-switch.js";
|
|
21
|
+
import { AgentSheetButton, usePhone } from "/assets/agent-sheet.js";
|
|
21
22
|
import { modelText } from "/assets/instance-nav.js";
|
|
22
23
|
import { HeaderTools } from "/assets/header-tools.js";
|
|
23
24
|
import { Menu } from "/assets/ui-menu.js";
|
|
@@ -55,6 +56,7 @@ export function DetailsPanel({ route, navKey }) {
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
function DetailsView({ name, inst, navKey, exec, awaiting }) {
|
|
59
|
+
const phone = usePhone(); // M-3166 PR 5: a phone's header is "← name ● ⋯" (the ⋯ sheet holds the rest)
|
|
58
60
|
const pane = paneContext.usePane?.();
|
|
59
61
|
useStore(themesStore); // #1629: Lock / Unlock follows the themes as read
|
|
60
62
|
const lease = useLease(`details:${name}`);
|
|
@@ -191,7 +193,7 @@ function DetailsView({ name, inst, navKey, exec, awaiting }) {
|
|
|
191
193
|
<p class="note">${pt("actionsNote")}</p></section>` : null}`;
|
|
192
194
|
const Pending = sess.mod && sess.mod.PendingBar, OpCard = sess.mod && sess.mod.OperationCard;
|
|
193
195
|
return html`<div data-effect-panel="details" class="panel p-details p-settings p-agent-page" data-view=${cat ? "section" : "index"}>
|
|
194
|
-
<${PanelHeader} title=${name} sub=${sub} pageControls=${{ navKey }} pageActions=${items} nav=${html`<${InstanceSwitch} name=${name} current="details" />`}><${HeaderTools} navKey=${navKey} /><${Menu} items=${items} label=${t("app.more")}
|
|
196
|
+
<${PanelHeader} title=${name} sub=${sub} pageControls=${{ navKey }} pageActions=${items} nav=${html`<${InstanceSwitch} name=${name} current="details" />`}><${HeaderTools} navKey=${navKey} /><${Menu} items=${items} label=${t("app.more")} />${phone ? html`<${AgentSheetButton} name=${name} inst=${inst} current="details" items=${items} navKey=${navKey} />` : null}</${PanelHeader}>
|
|
195
197
|
<${AgentCategoryNav} name=${name} kind=${kind} cat=${shownCat} dirty=${dirty}>${!cat ? html`<div class="only-narrow"><div class="s-row agent-settings-index-return"><h2>${pt("title")}</h2>${backLink()}</div></div>` : null}</${AgentCategoryNav}>
|
|
196
198
|
<div data-trust="panel-content" class="panel-body"><div class="col" ref=${body}>
|
|
197
199
|
<div class="s-row agent-settings-heading"><a class="s-back" href=${detailsPath(name)}><${Icon} name="back" size=${16} /><span>${t("app.details")}</span></a><${AgentPageHead} name=${name} kind=${kind} cat=${shownCat} inst=${null} />${backLink()}</div>
|
package/dist/ui/panel-fleet.js
CHANGED
|
@@ -168,6 +168,18 @@ export function measureTabsFit(root) {
|
|
|
168
168
|
gaps: px(hs.columnGap) * (others.length + 1),
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
|
+
/** M-3166: whether this is a phone's width (under 900 px), kept current as the window is resized. */
|
|
172
|
+
function usePhoneWidth() {
|
|
173
|
+
const read = () => typeof matchMedia === "function" && matchMedia("(max-width: 899px)").matches;
|
|
174
|
+
const [on, setOn] = useState(read);
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if (typeof matchMedia !== "function") return undefined;
|
|
177
|
+
const mq = matchMedia("(max-width: 899px)"), changed = () => setOn(mq.matches);
|
|
178
|
+
changed(); mq.addEventListener?.("change", changed);
|
|
179
|
+
return () => mq.removeEventListener?.("change", changed);
|
|
180
|
+
}, []);
|
|
181
|
+
return on;
|
|
182
|
+
}
|
|
171
183
|
function useTabsInHeader(rootRef) {
|
|
172
184
|
const mq = () => (typeof matchMedia === "function" ? matchMedia(NARROW) : null);
|
|
173
185
|
const [inHeader, setInHeader] = useState(() => !(mq()?.matches ?? false));
|
|
@@ -207,7 +219,15 @@ export function FleetPanel({ route, navKey }) {
|
|
|
207
219
|
const top = hostMemory && hostMemoryTop?.length ? t("fleet.hostMemory_top", hostMemoryTop.map(memoryHogText).join(" · ")) : "";
|
|
208
220
|
const sub = hostMemory ? html`<span class=${`status host-mem ${hostMemory}`} role="status"><span class=${`dot ${hostMemory === "critical" ? "bad" : "warn"}`} aria-hidden="true"></span>${t(`fleet.hostMemory_${hostMemory}`)}${top ? html`<span class="host-mem-top" title=${top}>${top}</span>` : null}</span>` : null;
|
|
209
221
|
const root = useRef(null);
|
|
210
|
-
const wide = useTabsInHeader(root);
|
|
222
|
+
const wide = useTabsInHeader(root), phone = usePhoneWidth();
|
|
223
|
+
// The phone's tab row scrolls sideways when it does not fit beside ☰: bring the open tab into view (用量 is the last).
|
|
224
|
+
useLayoutEffect(() => {
|
|
225
|
+
const nav = phone ? root.current?.querySelector(".fleet-phone-tabs") : null, on = nav?.querySelector(".active");
|
|
226
|
+
if (!nav || !on) return;
|
|
227
|
+
const n = nav.getBoundingClientRect(), a = on.getBoundingClientRect();
|
|
228
|
+
if (a.right > n.right) nav.scrollLeft += a.right - n.right;
|
|
229
|
+
else if (a.left < n.left) nav.scrollLeft -= n.left - a.left;
|
|
230
|
+
}, [phone, tab]);
|
|
211
231
|
const tabs = (cls) => html`<nav data-trust="panel-navigation" class=${cls} aria-label=${t("fleet.title")}>${FLEET_TABS.map(k => html`<a key=${k} href=${fleetPath(k)} class=${`seg-item${k === tab ? " active" : ""}`}
|
|
212
232
|
aria-current=${k === tab ? "page" : undefined}><${Icon} name=${ICONS[k]} size=${16} /><span>${t(`fleet.${k}`)}</span></a>`)}</nav>`;
|
|
213
233
|
return html`<div ref=${root} data-effect-panel="fleet" class="panel p-fleet">
|
|
@@ -216,8 +236,10 @@ export function FleetPanel({ route, navKey }) {
|
|
|
216
236
|
stay the row under the header they always were (.seg, the same markup as before). Not ".seg" in the header,
|
|
217
237
|
and chosen here rather than by CSS: a previous release's app.css, cached in an open tab, has no rule for the
|
|
218
238
|
header slot — this way either stylesheet lays both out (smoke-2542 SKEW). */ ""}
|
|
219
|
-
|
|
220
|
-
|
|
239
|
+
${/* M-3166 (Argon 5, the user's OK of round 2): a phone's Fleet is two rows — its tabs in the header's row (☰, then the
|
|
240
|
+
tabs; the title, search, docs and text size give way: app.css), then the page's own tools. */ ""}
|
|
241
|
+
<${PanelHeader} title=${t("fleet.title")} sub=${sub} nav=${wide ? tabs("fleet-tabs") : phone ? tabs("seg fleet-phone-tabs") : null}><${DocsLink} /><${HeaderTools} navKey=${navKey} /></${PanelHeader}>
|
|
242
|
+
${wide || phone ? null : tabs("seg")}
|
|
221
243
|
<div data-trust="panel-content" class="panel-body"><div class=${`col${tab === "tasks" || tab === "org" || tab === "cache" || tab === "usage" ? " col-wide" : ""}`}><${Body} lease=${lease} /></div></div>
|
|
222
244
|
</div>`;
|
|
223
245
|
}
|